mirror of
https://github.com/ARUP-CAS/aiscr-qgis-amcr-viewer.git
synced 2026-08-11 01:36:06 +02:00
Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7ea2a99ada | |||
| 6772a99ead | |||
| 9e8863b879 | |||
| 0eb8008e27 | |||
| bc799452a3 | |||
| ee558aa718 | |||
| eebd7668a5 | |||
| fd11bee274 | |||
| 93ed0ca810 | |||
| 64ec1ea7fd | |||
| 27e5fe02ac | |||
| 46c09c4a09 | |||
| 444d1c4826 | |||
| d9f5d2ae6e |
@@ -0,0 +1,35 @@
|
||||
<!--
|
||||
Děkujeme za příspěvek! Vyplň prosím sekce níže.
|
||||
Nepotřebné body můžeš smazat. Komentáře (<!-- ... -->) se v PR nezobrazují.
|
||||
-->
|
||||
|
||||
## Souhrn
|
||||
|
||||
<!-- Stručně co a proč. 1–3 věty. -->
|
||||
|
||||
## Změny
|
||||
|
||||
<!-- Co se konkrétně mění, ideálně po souborech / oblastech. -->
|
||||
-
|
||||
|
||||
## Testování
|
||||
|
||||
<!-- Jak ověřit, že to funguje (kroky v QGIS, scénáře). -->
|
||||
-
|
||||
|
||||
## Zapojení AI
|
||||
|
||||
<!-- Byla u změny použita AI? Jak? Např. "text navržen AI, ručně zkontrolováno
|
||||
a upraveno". Smaž, pokud AI použita nebyla. -->
|
||||
-
|
||||
|
||||
## Kontrolní seznam
|
||||
- [ ] Změny jsou v souladu se stylem projektu (viz `AGENTS.md`)
|
||||
- [ ] Při změně funkcí povýšena verze v `amcr_viewer/metadata.txt` a doplněn `changelog`
|
||||
- [ ] Otestováno v QGIS (min. podporovaná verze 3.44)
|
||||
- [ ] PR míří do správné cílové větve
|
||||
- [ ] Větev odpovídá konvenci (`feat/ fix/ docs/ chore/<téma>`, AI `agents/<jméno>/<téma>`)
|
||||
|
||||
## Související issue
|
||||
|
||||
<!-- Např. "Closes #123". Smaž, pokud se neváže k issue. -->
|
||||
@@ -11,7 +11,7 @@ jobs:
|
||||
steps:
|
||||
# 1. Stáhne kód z repozitáře
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
|
||||
|
||||
# 2. Vytvoří ZIP (předpokládá, že kód je ve složce 'amcr_viewer')
|
||||
- name: Zip Plugin
|
||||
@@ -22,7 +22,7 @@ jobs:
|
||||
|
||||
# 3. Nahraje ZIP k Releasu
|
||||
- name: Upload Release Asset
|
||||
uses: softprops/action-gh-release@v1
|
||||
uses: softprops/action-gh-release@b4309332981a82ec1c5618f44dd2e27cc8bfbfda # v3.0.0
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
with:
|
||||
files: amcr_viewer.zip
|
||||
|
||||
@@ -0,0 +1,122 @@
|
||||
# AGENTS.md
|
||||
|
||||
Pokyny pro AI agenty i lidské přispěvatele pracující v tomto repozitáři.
|
||||
Tento soubor je jediný zdroj pravdy; `CLAUDE.md` na něj pouze odkazuje.
|
||||
|
||||
## O projektu
|
||||
|
||||
**AMČR Viewer** je plugin do QGIS pro stahování a vizualizaci dat z Digitálního
|
||||
archivu Archeologické mapy ČR (AMČR / AIS CR) – akce (*Fieldwork events*),
|
||||
lokality (*Sites*) a jejich komponenty. Podporuje anonymní i přihlášený přístup
|
||||
přes AMČR účet.
|
||||
|
||||
Zdroj dat: https://digiarchiv.aiscr.cz/ · Nápověda: https://amcr-help.aiscr.cz/digiarchiv/qgis-viewer.html
|
||||
|
||||
## Zařazení v ekosystému AIS CR
|
||||
|
||||
Tento repozitář je jedním ze **sourozeneckých repozitářů** ekosystému AIS CR.
|
||||
Centrální governance a AI konfigurace spravuje hub **`aiscr-management`**; konvence
|
||||
v tomto souboru jsou s tímto vzorem sladěné a zjednodušené pro potřeby jednoho
|
||||
QGIS pluginu. Těžkou mašinerii hubu (složka `.agents/`, OpenSpec, sync skripty,
|
||||
multi-assistant generování) tento repozitář **záměrně nepřebírá**. Při širších
|
||||
otázkách governance má přednost vzor z `aiscr-management`.
|
||||
|
||||
## Struktura repozitáře
|
||||
|
||||
```
|
||||
amcr_viewer/ # vlastní kód pluginu (toto se balí do releasu)
|
||||
amcr_viewer.py # vstupní bod pluginu, integrace do QGIS
|
||||
amcr_dialog.py # dialogy a UI (filtry, přihlášení)
|
||||
amcr_tools.py # stahování dat z API, sestavení vrstev a atributů
|
||||
amcr_codelists.py # hesláře / číselníky (codelists)
|
||||
codelists/heslar.csv # lokální kopie číselníků
|
||||
metadata.txt # metadata pluginu + verze + changelog
|
||||
i18n/ # překlady (.ts)
|
||||
*.png # ikony
|
||||
.github/workflows/ # CI – release pluginu
|
||||
README.md # uživatelská dokumentace (anglicky)
|
||||
```
|
||||
|
||||
## Konvence
|
||||
|
||||
### Jazyk
|
||||
- **Kód a identifikátory:** anglicky. Atributová pole vrstev musí být ASCII
|
||||
kompatibilní (bez diakritiky) – viz historie změn v `metadata.txt`.
|
||||
- **README a uživatelská dokumentace:** anglicky.
|
||||
- **Commity, PR a komentáře v issue:** česky.
|
||||
|
||||
### Commity
|
||||
- Styl odpovídá historii: česky, věcně, popisně; jeden commit = jedna logická
|
||||
změna.
|
||||
- První řádek stručně a výstižně (ideálně v imperativu); podrobnosti do těla.
|
||||
- Pokud je commit připraven s pomocí AI, uveď to v těle commitu nebo v popisu PR.
|
||||
|
||||
### Větve
|
||||
Konvence názvů je sladěná s hubem `aiscr-management`:
|
||||
|
||||
- **lidé:** `feat/<téma>` (nová funkce), `fix/<téma>` (oprava), `docs/<téma>`
|
||||
(dokumentace), `chore/<téma>` (údržba).
|
||||
- **AI agenti:** `agents/<jméno-agenta>/<téma>` (např. `agents/claude/oprava-pian`).
|
||||
|
||||
Další pravidla:
|
||||
|
||||
- Cílová větev pro nový vývoj je aktuální `version/v2.x.y` (ne přímo do
|
||||
výchozí větve bez PR).
|
||||
- **Nikdy** nepushuj přímo do chráněných větví; vždy přes Pull Request.
|
||||
- Standardizační / nefunkční změny drž v samostatné větvi, ať se nemíchají do
|
||||
feature PR.
|
||||
|
||||
### Pravidla pro AI agenty (git)
|
||||
- AI ve výchozím stavu zůstává u **lokální práce na aktuální větvi**.
|
||||
- Bez **výslovného pokynu** uživatele AI nestageuje (`git add`), necommituje,
|
||||
nepushuje ani samo nepřepíná/nezakládá větev pro vzdálené doručení.
|
||||
- Při výslovném požadavku na push/PR použij větev `agents/<jméno-agenta>/<téma>`;
|
||||
pokud aktuální větev tomuto vzoru neodpovídá, vyžádej si nejdřív potvrzení.
|
||||
- Vytvoření větve, stage, commit, push ani draft PR AI běžně nenabízí; zmiňuj je
|
||||
jen tehdy, když jsou pro splnění úkolu opravdu nutné.
|
||||
|
||||
### QGIS specifika
|
||||
- Minimální podporovaná verze QGIS je **3.44** (`qgisMinimumVersion` v
|
||||
`metadata.txt`); kód nesmí spoléhat na novější API.
|
||||
- Vrstvy a atributy se sestavují přes `QgsField` / QGIS API v `amcr_tools.py`.
|
||||
Při přidání atributu je potřeba doplnit ho konzistentně na všech místech:
|
||||
definice pole (`QgsField`), naplnění hodnoty z dokumentu, překlad hlavičky
|
||||
sloupce a export atributů.
|
||||
|
||||
## Verzování a release
|
||||
|
||||
- Verze pluginu žije v **`amcr_viewer/metadata.txt`** (`version=`).
|
||||
- **Při každé změně chování / nové funkci** povyš verzi a doplň položku do
|
||||
`changelog=` v `metadata.txt` (formát `vX.Y.Z (RRRR-MM-DD)` + odrážky).
|
||||
- Datum v changelogu ber z **deterministického zdroje**, ne z paměti, např.
|
||||
`python -c "import datetime; print(datetime.date.today().isoformat())"`.
|
||||
- Release se vytváří publikací GitHub Release; workflow
|
||||
`.github/workflows/release_plugin.yml` zabalí složku `amcr_viewer/` do
|
||||
`amcr_viewer.zip` a přiloží ji k releasu. Do ZIPu se nesmí dostat `.git*`
|
||||
soubory.
|
||||
|
||||
## Pull requesty
|
||||
|
||||
- Používej PR šablonu (`.github/pull_request_template.md`): Souhrn / Změny /
|
||||
Testování / Kontrolní seznam.
|
||||
- PR musí mířit do správné `version/v2.x.y` větve.
|
||||
- Před požádáním o review projdi kontrolní seznam v šabloně (zejména bump verze
|
||||
v `metadata.txt`, pokud měníš chování).
|
||||
- V popisu PR uveď **podíl AI** (např. „text navržen AI, ručně zkontrolováno")
|
||||
a odkaz na související issue, pokud existuje.
|
||||
|
||||
## Bezpečnost a soukromí
|
||||
|
||||
- Do promptů, příkladů ani commitů **nevkládej** ostrá produkční data, plné
|
||||
log dumpy ani reálné osobní údaje (PII).
|
||||
- **Rediguj** secrets, tokeny, API klíče a hesla z čehokoli, co posíláš AI;
|
||||
nikdy je necommituj do repozitáře (ani přihlašovací údaje k AMČR účtu).
|
||||
- Pro interní infrastrukturu (URL, hostname, prostředí) používej placeholdery,
|
||||
pokud konkrétní hodnota není nutná a povolená.
|
||||
|
||||
## Lokální ověření
|
||||
|
||||
Plugin se testuje načtením do QGIS (Plugins → Manage and Install Plugins →
|
||||
Install from ZIP, nebo nasazením složky `amcr_viewer/` do adresáře pluginů
|
||||
QGIS). Automatizované testy zatím repozitář neobsahuje – změny ověřuj ručně
|
||||
v QGIS na podporované verzi.
|
||||
@@ -0,0 +1,6 @@
|
||||
# CLAUDE.md
|
||||
|
||||
Pokyny pro tento repozitář jsou v [`AGENTS.md`](./AGENTS.md).
|
||||
|
||||
Tento soubor je záměrně jen odkaz, aby existoval jeden zdroj pravdy a obsah se
|
||||
nerozjel. Cokoli platí pro AI agenty v tomto projektu, najdeš v `AGENTS.md`.
|
||||
@@ -131,6 +131,8 @@ Layers are only created if the query returns features of the corresponding geome
|
||||
|
||||
The plugin is developed in **Python 3** using the **PyQt6** framework for the GUI and the **Requests** library for HTTP communication.
|
||||
|
||||
> **Note:** The `requests` library is bundled with the QGIS installers for Windows and macOS. On Linux (distribution packages), it may need to be installed separately (e.g. `python3-requests`).
|
||||
|
||||
### 4.1 File Structure
|
||||
|
||||
* `amcr_viewer.py`: Entry point; handles GUI integration, toolbar/menu setup, and login flow.
|
||||
|
||||
@@ -158,6 +158,11 @@ def fetch_set(internal_name, api_set, task=None):
|
||||
),
|
||||
None
|
||||
)
|
||||
# Skip records without a valid one-letter code –
|
||||
# a None code would end up in the CSV and later
|
||||
# in the API filter as the string "None"
|
||||
if not kod:
|
||||
continue
|
||||
|
||||
dataset.append({
|
||||
'Název': nazev,
|
||||
|
||||
+103
-18
@@ -7,6 +7,7 @@ from qgis.PyQt.QtWidgets import (QDialog, QVBoxLayout,
|
||||
from qgis.PyQt.QtCore import Qt, QSettings
|
||||
from qgis.core import (QgsTask, QgsApplication,
|
||||
QgsMessageLog, Qgis, QgsAuthMethodConfig)
|
||||
from qgis.utils import iface
|
||||
from .amcr_codelists import (OBDOBI, TYP_AKCE, KRAJE, AREAL, ORGANIZACE,
|
||||
OKRESY, KATASTRY, VEDOUCI, PIAN_PRESNOST,
|
||||
TYP_LOKALITY, DRUH_LOKALITY, JISTOTA,
|
||||
@@ -14,6 +15,12 @@ from .amcr_codelists import (OBDOBI, TYP_AKCE, KRAJE, AREAL, ORGANIZACE,
|
||||
download_heslare, refresh_globals)
|
||||
|
||||
|
||||
# Keep Python references to running tasks. QgsTaskManager only holds the
|
||||
# C++ object; without a Python-side reference the wrapper can be garbage
|
||||
# collected before the task finishes, which crashes QGIS.
|
||||
_ACTIVE_TASKS = []
|
||||
|
||||
|
||||
class UpdateCodelistsTask(QgsTask):
|
||||
def __init__(self, description):
|
||||
super().__init__(description, QgsTask.CanCancel)
|
||||
@@ -37,16 +44,19 @@ class UpdateCodelistsTask(QgsTask):
|
||||
refresh_globals()
|
||||
QgsMessageLog.logMessage(
|
||||
"Hesláře AMČR byly úspěšně aktualizovány.",
|
||||
"AMČR", Qgis.Info)
|
||||
"AMČR", Qgis.Info
|
||||
)
|
||||
else:
|
||||
if self.isCanceled():
|
||||
QgsMessageLog.logMessage(
|
||||
"Aktualizace heslářů byla zrušena.",
|
||||
"AMČR", Qgis.Warning)
|
||||
"AMČR", Qgis.Warning
|
||||
)
|
||||
else:
|
||||
QgsMessageLog.logMessage(
|
||||
f"Chyba aktualizace: {self.exception}",
|
||||
"AMČR", Qgis.Critical)
|
||||
"AMČR", Qgis.Critical
|
||||
)
|
||||
|
||||
|
||||
class FilterableSelectionDialog(QDialog):
|
||||
@@ -144,10 +154,20 @@ class AmcrFilterDialog(QDialog):
|
||||
|
||||
# Cache dictionary to store selected codes for each category
|
||||
self.selection_cache = {
|
||||
'organizace': [], 'kraj': [], 'obdobi': [], 'areal': [],
|
||||
'typ_akce': [], 'okres': [], 'katastr': [], 'vedouci': [],
|
||||
'pian_presnost': [], 'pristupnost': [], 'typ_lokality': [],
|
||||
'druh_lokality': [], 'jistota': [], 'lokalita_zachovalost': []
|
||||
'organizace': [],
|
||||
'kraj': [],
|
||||
'obdobi': [],
|
||||
'areal': [],
|
||||
'typ_akce': [],
|
||||
'okres': [],
|
||||
'katastr': [],
|
||||
'vedouci': [],
|
||||
'pian_presnost': [],
|
||||
'pristupnost': [],
|
||||
'typ_lokality': [],
|
||||
'druh_lokality': [],
|
||||
'jistota': [],
|
||||
'lokalita_zachovalost': [],
|
||||
}
|
||||
|
||||
layout = QVBoxLayout()
|
||||
@@ -162,6 +182,8 @@ class AmcrFilterDialog(QDialog):
|
||||
if self.typ_dat == "akce":
|
||||
self.chk_posevidence = QCheckBox("Pouze pozitivní zjištění")
|
||||
layout.addWidget(self.chk_posevidence)
|
||||
self.chk_proj_akce = QCheckBox("Pouze projektové akce")
|
||||
layout.addWidget(self.chk_proj_akce)
|
||||
|
||||
layout.addSpacing(10)
|
||||
|
||||
@@ -354,7 +376,7 @@ class AmcrFilterDialog(QDialog):
|
||||
self.selection_cache[cache_key] = [
|
||||
'HES-000861',
|
||||
'HES-000862',
|
||||
'HES-000863'
|
||||
'HES-000863',
|
||||
]
|
||||
|
||||
btn.clicked.connect(open_dialog)
|
||||
@@ -370,21 +392,38 @@ class AmcrFilterDialog(QDialog):
|
||||
return row_widget
|
||||
|
||||
def action_update_heslare(self):
|
||||
# Create the task instance
|
||||
# Create the task instance and keep a reference so the Python
|
||||
# wrapper survives until the task finishes
|
||||
task = UpdateCodelistsTask("Aktualizace heslářů AMČR")
|
||||
_ACTIVE_TASKS.append(task)
|
||||
|
||||
# Re-enable the button regardless of the outcome
|
||||
task.taskCompleted.connect(lambda: self.btn_update.setEnabled(True))
|
||||
task.taskTerminated.connect(lambda: self.btn_update.setEnabled(True))
|
||||
# Prevent parallel downloads overwriting heslar.csv
|
||||
self.btn_update.setEnabled(False)
|
||||
|
||||
task.taskCompleted.connect(lambda: QMessageBox.information(
|
||||
self,
|
||||
"Hotovo",
|
||||
"Hesláře byly úspěšně aktualizovány."
|
||||
))
|
||||
# Message boxes are parented to the main window, not to this dialog –
|
||||
# the dialog may already be closed (and its C++ object deleted)
|
||||
# by the time the minute-long task finishes.
|
||||
parent_win = iface.mainWindow() if iface else None
|
||||
|
||||
def _cleanup():
|
||||
if task in _ACTIVE_TASKS:
|
||||
_ACTIVE_TASKS.remove(task)
|
||||
try:
|
||||
self.btn_update.setEnabled(True)
|
||||
except RuntimeError:
|
||||
pass # dialog already closed
|
||||
|
||||
def on_completed():
|
||||
_cleanup()
|
||||
QMessageBox.information(
|
||||
parent_win,
|
||||
"Hotovo",
|
||||
"Hesláře byly úspěšně aktualizovány."
|
||||
)
|
||||
|
||||
# Show the exact error if the task fails
|
||||
def on_error():
|
||||
_cleanup()
|
||||
if task.exception:
|
||||
# This will show exactly what went wrong (e.g. PermissionError)
|
||||
msg = (
|
||||
@@ -393,8 +432,9 @@ class AmcrFilterDialog(QDialog):
|
||||
)
|
||||
else:
|
||||
msg = "Aktualizace byla zrušena uživatelem."
|
||||
QMessageBox.warning(self, "Chyba / Zrušeno", msg)
|
||||
QMessageBox.warning(parent_win, "Chyba / Zrušeno", msg)
|
||||
|
||||
task.taskCompleted.connect(on_completed)
|
||||
task.taskTerminated.connect(on_error)
|
||||
|
||||
QgsApplication.taskManager().addTask(task)
|
||||
@@ -428,6 +468,8 @@ class AmcrFilterDialog(QDialog):
|
||||
if self.typ_dat == "akce":
|
||||
if self.chk_posevidence.isChecked():
|
||||
filters['posevidence'] = 'true'
|
||||
if self.chk_proj_akce.isChecked():
|
||||
filters['proj_akce'] = 'true'
|
||||
if self.selection_cache['organizace']:
|
||||
filters['f_organizace'] = self.selection_cache['organizace']
|
||||
if self.selection_cache['typ_akce']:
|
||||
@@ -602,6 +644,39 @@ class LoginDialog(QDialog):
|
||||
|
||||
return True
|
||||
|
||||
def _verify_credentials(self, username: str, password: str) -> bool:
|
||||
"""
|
||||
Verify the credentials against the API before saving them.
|
||||
Returns True if they should be stored: either the login succeeded,
|
||||
or the server was unreachable and the user chose to keep them
|
||||
unverified. Wrong credentials are never stored.
|
||||
"""
|
||||
# Lazy import to avoid an import cycle
|
||||
# (amcr_tools imports LoginDialog lazily as well)
|
||||
from . import amcr_tools
|
||||
|
||||
if amcr_tools.login_to_api(username, password):
|
||||
return True
|
||||
|
||||
if amcr_tools.LAST_LOGIN_ERROR == 'network':
|
||||
answer = QMessageBox.question(
|
||||
self,
|
||||
"Server nedostupný",
|
||||
"Přihlašovací údaje se nepodařilo ověřit – server AMČR "
|
||||
"je nedostupný.\nChcete je přesto uložit (neověřené)?",
|
||||
QMessageBox.StandardButton.Yes
|
||||
| QMessageBox.StandardButton.No
|
||||
)
|
||||
return answer == QMessageBox.StandardButton.Yes
|
||||
|
||||
QMessageBox.warning(
|
||||
self,
|
||||
"Neplatné přihlašovací údaje",
|
||||
"Přihlášení se nezdařilo – zkontrolujte e-mail a heslo.\n"
|
||||
"Údaje nebyly uloženy."
|
||||
)
|
||||
return False
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# Button actions
|
||||
# ------------------------------------------------------------------
|
||||
@@ -628,6 +703,11 @@ class LoginDialog(QDialog):
|
||||
if ok:
|
||||
if not self._ensure_master_password():
|
||||
return
|
||||
# Verify the new username against the stored password
|
||||
if not self._verify_credentials(
|
||||
username, cfg.config("password", "")
|
||||
):
|
||||
return
|
||||
cfg.setConfig("username", username)
|
||||
auth_mgr.updateAuthenticationConfig(cfg)
|
||||
self.accept()
|
||||
@@ -637,6 +717,11 @@ class LoginDialog(QDialog):
|
||||
QMessageBox.warning(self, "Chybí údaje", "Vyplňte prosím heslo.")
|
||||
return
|
||||
|
||||
# Verify before prompting for the master password – wrong
|
||||
# credentials must never reach the Authentication Manager
|
||||
if not self._verify_credentials(username, password):
|
||||
return
|
||||
|
||||
if not self._ensure_master_password():
|
||||
return
|
||||
|
||||
|
||||
+215
-61
@@ -17,6 +17,15 @@ TRANSLATIONS = {}
|
||||
# None = not logged in (anonymous access)
|
||||
AMCR_SESSION: requests.Session | None = None
|
||||
|
||||
# Reason of the last failed login: 'auth' (wrong credentials),
|
||||
# 'network' (server unreachable / invalid response) or None
|
||||
LAST_LOGIN_ERROR: str | None = None
|
||||
|
||||
# Re-entrancy guard: the download runs in the main thread and pumps the
|
||||
# event loop via processEvents(), so the user could otherwise start
|
||||
# a second download while the first one is still running
|
||||
_LOADING = False
|
||||
|
||||
|
||||
def _log(msg: str, level=Qgis.MessageLevel.Info):
|
||||
"""
|
||||
@@ -33,6 +42,9 @@ def login_to_api(username: str, password: str):
|
||||
"""
|
||||
login_url = "https://digiarchiv.aiscr.cz/api/user/login"
|
||||
|
||||
global LAST_LOGIN_ERROR
|
||||
LAST_LOGIN_ERROR = None
|
||||
|
||||
_log(f"Přihlašuji uživatele: '{username}'")
|
||||
|
||||
if not username or not password:
|
||||
@@ -40,6 +52,7 @@ def login_to_api(username: str, password: str):
|
||||
"CHYBA: username nebo heslo je prázdné.",
|
||||
Qgis.MessageLevel.Critical
|
||||
)
|
||||
LAST_LOGIN_ERROR = 'auth'
|
||||
return None
|
||||
|
||||
session = requests.Session()
|
||||
@@ -67,6 +80,7 @@ def login_to_api(username: str, password: str):
|
||||
f"CHYBA přihlášení (API): {body['error']}",
|
||||
Qgis.MessageLevel.Critical
|
||||
)
|
||||
LAST_LOGIN_ERROR = 'auth'
|
||||
return None
|
||||
|
||||
_log("Přihlášení proběhlo úspěšně.")
|
||||
@@ -75,12 +89,22 @@ def login_to_api(username: str, password: str):
|
||||
return session
|
||||
|
||||
except requests.exceptions.HTTPError as e:
|
||||
_log(f"CHYBA HTTP {e.response.status_code if e.response else '?'}: "
|
||||
f"{e.response.text[:300] if e.response else 'žádná odpověď'}",
|
||||
status = e.response.status_code if e.response is not None else None
|
||||
_log(f"CHYBA HTTP {status if status else '?'}: "
|
||||
f"{e.response.text[:300] if e.response is not None else 'žádná odpověď'}",
|
||||
Qgis.MessageLevel.Critical)
|
||||
LAST_LOGIN_ERROR = 'auth' if status in (401, 403) else 'network'
|
||||
return None
|
||||
except requests.exceptions.RequestException as e:
|
||||
_log(f"CHYBA sítě: {e}", Qgis.MessageLevel.Critical)
|
||||
LAST_LOGIN_ERROR = 'network'
|
||||
return None
|
||||
except ValueError:
|
||||
# Server returned non-JSON (e.g. an HTML error page behind a proxy)
|
||||
_log("CHYBA: server nevrátil platný JSON: "
|
||||
f"{response.text[:300]}",
|
||||
Qgis.MessageLevel.Critical)
|
||||
LAST_LOGIN_ERROR = 'network'
|
||||
return None
|
||||
|
||||
|
||||
@@ -104,33 +128,40 @@ def _get_session() -> requests.Session | None:
|
||||
return AMCR_SESSION
|
||||
|
||||
|
||||
def _api_get(url, params, timeout=30) -> requests.Response:
|
||||
def _api_get_json(url, params, timeout=30) -> dict:
|
||||
"""
|
||||
Performs a GET request. If the API signals an expired login,
|
||||
re-authenticates once and retries.
|
||||
Performs a GET request and returns the parsed JSON body.
|
||||
If the API signals an expired login, re-authenticates once and retries.
|
||||
The body is parsed exactly once (the auth check reuses it).
|
||||
Raises ValueError if the server does not return valid JSON.
|
||||
"""
|
||||
global AMCR_SESSION
|
||||
|
||||
def _is_auth_error(resp: requests.Response) -> bool:
|
||||
def _is_auth_error(resp: requests.Response, body) -> bool:
|
||||
"""The API returns auth errors with status 200 –
|
||||
the body must be checked."""
|
||||
if resp.status_code == 401:
|
||||
return True
|
||||
try:
|
||||
body = resp.json()
|
||||
err = str(body.get("error", "")).lower()
|
||||
return (
|
||||
"unauthorized" in err
|
||||
or "not logged" in err
|
||||
or "session" in err
|
||||
)
|
||||
except Exception:
|
||||
if not isinstance(body, dict):
|
||||
return False
|
||||
err = str(body.get("error", "")).lower()
|
||||
return (
|
||||
"unauthorized" in err
|
||||
or "not logged" in err
|
||||
or "session" in err
|
||||
)
|
||||
|
||||
def _parse(resp):
|
||||
try:
|
||||
return resp.json()
|
||||
except ValueError:
|
||||
return None
|
||||
|
||||
session = _get_session()
|
||||
resp = (session or requests).get(url, params=params, timeout=timeout)
|
||||
body = _parse(resp)
|
||||
|
||||
if _is_auth_error(resp):
|
||||
if _is_auth_error(resp, body):
|
||||
_log("Session vypršela během stahování – obnovuji přihlášení...",
|
||||
Qgis.MessageLevel.Warning)
|
||||
AMCR_SESSION = None # Invalidate the old session
|
||||
@@ -140,6 +171,7 @@ def _api_get(url, params, timeout=30) -> requests.Response:
|
||||
AMCR_SESSION = login_to_api(username, password)
|
||||
if AMCR_SESSION:
|
||||
resp = AMCR_SESSION.get(url, params=params, timeout=timeout)
|
||||
body = _parse(resp)
|
||||
else:
|
||||
_log("Opakované přihlášení selhalo.",
|
||||
Qgis.MessageLevel.Critical)
|
||||
@@ -147,7 +179,11 @@ def _api_get(url, params, timeout=30) -> requests.Response:
|
||||
_log("Přihlašovací údaje nejsou uloženy – pokračuji anonymně.",
|
||||
Qgis.MessageLevel.Warning)
|
||||
|
||||
return resp
|
||||
if body is None:
|
||||
raise ValueError(
|
||||
f"API nevrátilo platný JSON (HTTP {resp.status_code})"
|
||||
)
|
||||
return body
|
||||
|
||||
|
||||
def load_translations():
|
||||
@@ -165,7 +201,10 @@ def load_translations():
|
||||
if r.status_code == 200:
|
||||
TRANSLATIONS = r.json()
|
||||
except Exception as e:
|
||||
print(f"Error downloading vocabulary: {e}")
|
||||
QgsMessageLog.logMessage(
|
||||
f"Error downloading vocabulary: {e}",
|
||||
"AMČR", Qgis.MessageLevel.Warning
|
||||
)
|
||||
|
||||
|
||||
def tr_code(code):
|
||||
@@ -179,11 +218,12 @@ def tr_code(code):
|
||||
|
||||
|
||||
def komp_projde_filtrem(komp, filter_areal, filter_datace, filters):
|
||||
areal_id = komp.get('komponenta_areal', {}).get('id', "")
|
||||
# 'or {}' – the key may be present with a None value
|
||||
areal_id = (komp.get('komponenta_areal') or {}).get('id', "")
|
||||
if filter_areal and areal_id not in filters.get('f_areal', []):
|
||||
return False
|
||||
|
||||
obdobi_id = komp.get('komponenta_obdobi', {}).get('id', "")
|
||||
obdobi_id = (komp.get('komponenta_obdobi') or {}).get('id', "")
|
||||
if filter_datace and obdobi_id not in filters.get('f_obdobi', []):
|
||||
return False
|
||||
|
||||
@@ -198,6 +238,16 @@ def load_amcr_data(canvas, bb, filters=None,
|
||||
2. Fetches metadata and geometries from API
|
||||
3. Creates QGIS memory layers and populates them with features
|
||||
"""
|
||||
global _LOADING
|
||||
if _LOADING:
|
||||
iface.messageBar().pushMessage(
|
||||
"AMCR",
|
||||
"Stahování již probíhá, počkejte na jeho dokončení.",
|
||||
level=Qgis.MessageLevel.Warning
|
||||
)
|
||||
return
|
||||
_LOADING = True
|
||||
|
||||
load_translations()
|
||||
|
||||
# --- 1. COORDINATE TRANSFORMATION ---
|
||||
@@ -233,7 +283,7 @@ def load_amcr_data(canvas, bb, filters=None,
|
||||
base_params = {
|
||||
"mapa": "true",
|
||||
"sort": "ident_cely asc",
|
||||
"entity": typ_dat
|
||||
"entity": typ_dat,
|
||||
}
|
||||
|
||||
# Restrict search to map window if requested
|
||||
@@ -257,6 +307,7 @@ def load_amcr_data(canvas, bb, filters=None,
|
||||
MAX_LIMIT = 20000 # Safety limit to prevent QGIS from freezing
|
||||
|
||||
seen_ids = set()
|
||||
fetched_total = 0 # All downloaded records incl. duplicates
|
||||
target_pian_ids_count = 0
|
||||
|
||||
# Check if we should skip negative results based on filter
|
||||
@@ -266,10 +317,20 @@ def load_amcr_data(canvas, bb, filters=None,
|
||||
else False
|
||||
)
|
||||
|
||||
only_projektove_akce = (
|
||||
filters.get('proj_akce') == 'true'
|
||||
if filters
|
||||
else False
|
||||
)
|
||||
|
||||
# Check whether we should filter results based on component filters
|
||||
filter_areal = "f_areal" in filters if filters else False
|
||||
filter_datace = "f_obdobi" in filters if filters else False
|
||||
|
||||
# Set when a network error interrupts the download – the user
|
||||
# gets an explicit error/warning instead of a silent partial result
|
||||
network_error = False
|
||||
|
||||
# --- API PAGINATION LOOP ---
|
||||
while True:
|
||||
base_params['rows'] = BATCH_DOCS
|
||||
@@ -279,8 +340,7 @@ def load_amcr_data(canvas, bb, filters=None,
|
||||
del base_params['page']
|
||||
|
||||
try:
|
||||
resp_docs = _api_get(url, params=base_params, timeout=30)
|
||||
resp_json = resp_docs.json()
|
||||
resp_json = _api_get_json(url, params=base_params, timeout=30)
|
||||
data = resp_json.get('response', {})
|
||||
batch_docs = data.get('docs', [])
|
||||
num_found = data.get('numFound', 0)
|
||||
@@ -288,6 +348,8 @@ def load_amcr_data(canvas, bb, filters=None,
|
||||
if not batch_docs:
|
||||
break
|
||||
|
||||
fetched_total += len(batch_docs)
|
||||
|
||||
# Filter out duplicates and append to main list
|
||||
new_docs = []
|
||||
for d in batch_docs:
|
||||
@@ -297,12 +359,16 @@ def load_amcr_data(canvas, bb, filters=None,
|
||||
new_docs.append(d)
|
||||
|
||||
docs.extend(new_docs)
|
||||
print(
|
||||
QgsMessageLog.logMessage(
|
||||
f"Strana {current_page} stažena. "
|
||||
f"Celkem záznamů: {len(docs)} / {num_found}"
|
||||
f"Celkem záznamů: {len(docs)} / {num_found}",
|
||||
"AMČR", Qgis.MessageLevel.Info
|
||||
)
|
||||
|
||||
if len(docs) >= num_found:
|
||||
# Compare downloaded (not unique) records against numFound –
|
||||
# pages full of duplicates would otherwise trigger
|
||||
# needless extra requests
|
||||
if fetched_total >= num_found:
|
||||
break
|
||||
if len(docs) >= MAX_LIMIT:
|
||||
iface.messageBar().pushMessage(
|
||||
@@ -315,9 +381,29 @@ def load_amcr_data(canvas, bb, filters=None,
|
||||
current_page += 1
|
||||
QApplication.processEvents() # Keep UI responsive
|
||||
|
||||
except Exception as e:
|
||||
print(f"Chyba při stránkování na straně {current_page}: {e}")
|
||||
except requests.exceptions.RequestException as e:
|
||||
network_error = True
|
||||
QgsMessageLog.logMessage(
|
||||
f"Chyba sítě při stránkování na straně "
|
||||
f"{current_page}: {e}",
|
||||
"AMČR", Qgis.MessageLevel.Critical
|
||||
)
|
||||
break
|
||||
except Exception as e:
|
||||
QgsMessageLog.logMessage(
|
||||
f"Chyba při stránkování na straně {current_page}: {e}",
|
||||
"AMČR", Qgis.MessageLevel.Warning
|
||||
)
|
||||
break
|
||||
|
||||
if network_error and not docs:
|
||||
iface.messageBar().pushMessage(
|
||||
"AMCR",
|
||||
"Stahování selhalo: chyba sítě. "
|
||||
"Zkontrolujte připojení k internetu.",
|
||||
level=Qgis.MessageLevel.Critical
|
||||
)
|
||||
return
|
||||
|
||||
if not docs:
|
||||
iface.messageBar().pushMessage(
|
||||
@@ -359,10 +445,13 @@ def load_amcr_data(canvas, bb, filters=None,
|
||||
if not piani:
|
||||
continue
|
||||
|
||||
if only_projektove_akce and not doc.get("akce_projekt", False):
|
||||
continue
|
||||
|
||||
actions_with_geom += 1
|
||||
|
||||
# Extract protected fields
|
||||
az_chranene = doc.get('az_chranene_udaje', {})
|
||||
# Extract protected fields ('or {}' – key may hold None)
|
||||
az_chranene = doc.get('az_chranene_udaje') or {}
|
||||
chranene = (
|
||||
doc.get('akce_chranene_udaje')
|
||||
or doc.get('lokalita_chranene_udaje')
|
||||
@@ -390,7 +479,7 @@ def load_amcr_data(canvas, bb, filters=None,
|
||||
"katastr": g_list(doc, 'katastr'),
|
||||
"dalsi_katastr": dalsi_kat_str,
|
||||
"pristupnost": g(doc, 'pristupnost'),
|
||||
"loc": g_list(doc, 'loc')
|
||||
"loc": g_list(doc, 'loc'),
|
||||
}
|
||||
|
||||
# Add entity-specific metadata
|
||||
@@ -435,6 +524,11 @@ def load_amcr_data(canvas, bb, filters=None,
|
||||
if doc.get('akce_je_nz') is True
|
||||
else "Ne"
|
||||
),
|
||||
"projekt": g(
|
||||
doc,
|
||||
'akce_projekt',
|
||||
""
|
||||
),
|
||||
})
|
||||
|
||||
elif typ_dat == "lokalita":
|
||||
@@ -518,13 +612,13 @@ def load_amcr_data(canvas, bb, filters=None,
|
||||
'ident_cely',
|
||||
""
|
||||
),
|
||||
'komponenta_areal': komp.get(
|
||||
'komponenta_areal',
|
||||
{}
|
||||
'komponenta_areal': (
|
||||
komp.get('komponenta_areal')
|
||||
or {}
|
||||
).get('value', ""),
|
||||
'komponenta_obdobi': komp.get(
|
||||
'komponenta_obdobi',
|
||||
{}
|
||||
'komponenta_obdobi': (
|
||||
komp.get('komponenta_obdobi')
|
||||
or {}
|
||||
).get('value', ""),
|
||||
}
|
||||
pian_lookup[dj_pian_value].append(komp_meta)
|
||||
@@ -574,8 +668,10 @@ def load_amcr_data(canvas, bb, filters=None,
|
||||
)
|
||||
|
||||
fl_pian = [
|
||||
"ident_cely", "pian_typ",
|
||||
"pian_chranene_udaje", "pian_presnost"
|
||||
"ident_cely",
|
||||
"pian_typ",
|
||||
"pian_chranene_udaje",
|
||||
"pian_presnost",
|
||||
]
|
||||
|
||||
for i in range(0, total_pians, BATCH_PIAN):
|
||||
@@ -588,15 +684,26 @@ def load_amcr_data(canvas, bb, filters=None,
|
||||
"entity": "pian",
|
||||
"q": fq_pian,
|
||||
"rows": len(batch),
|
||||
"fl": ",".join(fl_pian)
|
||||
"fl": ",".join(fl_pian),
|
||||
}
|
||||
try:
|
||||
QApplication.processEvents()
|
||||
r_pian = _api_get(url, params=params_pian, timeout=15)
|
||||
batch_docs = r_pian.json().get('response', {}).get('docs', [])
|
||||
docs_pian.extend(batch_docs)
|
||||
r_json = _api_get_json(url, params=params_pian, timeout=15)
|
||||
docs_pian.extend(r_json.get('response', {}).get('docs', []))
|
||||
except requests.exceptions.RequestException as e:
|
||||
# Network is down – stop immediately instead of
|
||||
# uselessly retrying every remaining batch
|
||||
network_error = True
|
||||
QgsMessageLog.logMessage(
|
||||
f"Chyba sítě při stahování geometrií PIAN: {e}",
|
||||
"AMČR", Qgis.MessageLevel.Critical
|
||||
)
|
||||
break
|
||||
except Exception as e:
|
||||
print(f"Chyba PIAN: {e}")
|
||||
QgsMessageLog.logMessage(
|
||||
f"Chyba PIAN: {e}",
|
||||
"AMČR", Qgis.MessageLevel.Warning
|
||||
)
|
||||
|
||||
# ==========================================
|
||||
# D) LAYER CREATION (QGIS Memory Layers)
|
||||
@@ -634,7 +741,7 @@ def load_amcr_data(canvas, bb, filters=None,
|
||||
QgsField("odkaz_do_digiarchivu", QMetaType.Type.QString),
|
||||
QgsField("okres", QMetaType.Type.QString),
|
||||
QgsField("katastr", QMetaType.Type.QString),
|
||||
QgsField("dalsi_katastry", QMetaType.Type.QString)
|
||||
QgsField("dalsi_katastry", QMetaType.Type.QString),
|
||||
]
|
||||
|
||||
# Extend table based on data type
|
||||
@@ -650,6 +757,7 @@ def load_amcr_data(canvas, bb, filters=None,
|
||||
QgsField("vedlejsi_typ", QMetaType.Type.QString),
|
||||
QgsField("zjisteni", QMetaType.Type.QString),
|
||||
QgsField("nahrazuje_NZ", QMetaType.Type.QString),
|
||||
QgsField("projekt", QMetaType.Type.QString),
|
||||
]
|
||||
elif typ_dat == "lokalita":
|
||||
cols += [
|
||||
@@ -657,7 +765,7 @@ def load_amcr_data(canvas, bb, filters=None,
|
||||
QgsField("popis_lokality", QMetaType.Type.QString),
|
||||
QgsField("typ_lokality", QMetaType.Type.QString),
|
||||
QgsField("druh_lokality", QMetaType.Type.QString),
|
||||
QgsField("zachovalost", QMetaType.Type.QString)
|
||||
QgsField("zachovalost", QMetaType.Type.QString),
|
||||
]
|
||||
|
||||
cols.append(QgsField("Přístupnost", QMetaType.Type.QString))
|
||||
@@ -693,6 +801,7 @@ def load_amcr_data(canvas, bb, filters=None,
|
||||
"komponenta": "Komponenta",
|
||||
"komponenta_areal": "Areál",
|
||||
"komponenta_obdobi": "Období",
|
||||
"projekt": "Projekt",
|
||||
}
|
||||
|
||||
if komponenty == "true":
|
||||
@@ -713,6 +822,14 @@ def load_amcr_data(canvas, bb, filters=None,
|
||||
# Lists to hold features before batch-adding to layers
|
||||
feats_p, feats_l, feats_pt = [], [], []
|
||||
|
||||
# Transform for PIANs that only provide WGS-84 geometry (geom_wkt) –
|
||||
# the target layers are in S-JTSK (EPSG:5514)
|
||||
xform_wgs_to_sjtsk = QgsCoordinateTransform(
|
||||
QgsCoordinateReferenceSystem("EPSG:4326"),
|
||||
QgsCoordinateReferenceSystem("EPSG:5514"),
|
||||
QgsProject.instance()
|
||||
)
|
||||
|
||||
# --- FEATURE POPULATION ---
|
||||
for doc in docs_pian:
|
||||
try:
|
||||
@@ -733,25 +850,46 @@ def load_amcr_data(canvas, bb, filters=None,
|
||||
)
|
||||
|
||||
wkt = None
|
||||
wkt_is_wgs = False
|
||||
if jdata.get('geom_sjtsk_wkt'):
|
||||
wkt = jdata.get('geom_sjtsk_wkt', {}).get('value')
|
||||
elif jdata.get('geom_wkt'):
|
||||
# Fallback geometry is in WGS-84 and must be
|
||||
# transformed to S-JTSK before use
|
||||
wkt = jdata.get('geom_wkt', {}).get('value')
|
||||
wkt_is_wgs = True
|
||||
|
||||
pian_presnost = tr_code(str(doc.get('pian_presnost', '')))
|
||||
pian_typ = tr_code(str(doc.get('pian_typ', '')))
|
||||
# The API may return the value as a single-item list –
|
||||
# normalize before comparing against filter codes
|
||||
raw_presnost = doc.get('pian_presnost', '')
|
||||
if isinstance(raw_presnost, list):
|
||||
raw_presnost = raw_presnost[0] if raw_presnost else ''
|
||||
raw_typ = doc.get('pian_typ', '')
|
||||
if isinstance(raw_typ, list):
|
||||
raw_typ = raw_typ[0] if raw_typ else ''
|
||||
|
||||
pian_presnost = tr_code(str(raw_presnost))
|
||||
pian_typ = tr_code(str(raw_typ))
|
||||
|
||||
# Final precision filter check
|
||||
if (
|
||||
filters
|
||||
and filters.get('f_pian_presnost')
|
||||
and doc.get('pian_presnost')
|
||||
and str(raw_presnost)
|
||||
not in filters.get('f_pian_presnost')
|
||||
):
|
||||
continue
|
||||
|
||||
if wkt:
|
||||
geom = QgsGeometry.fromWkt(wkt)
|
||||
if geom.isNull():
|
||||
continue
|
||||
if wkt_is_wgs:
|
||||
geom.transform(xform_wgs_to_sjtsk)
|
||||
if not geom.isGeosValid():
|
||||
# Try to repair (e.g. self-intersections)
|
||||
# instead of silently dropping the feature
|
||||
geom = geom.makeValid()
|
||||
if geom.isGeosValid():
|
||||
t = geom.type()
|
||||
target_list = None
|
||||
@@ -784,7 +922,7 @@ def load_amcr_data(canvas, bb, filters=None,
|
||||
+ meta['ident_cely'],
|
||||
meta['az_okres'],
|
||||
meta['katastr'],
|
||||
meta['dalsi_katastr']
|
||||
meta['dalsi_katastr'],
|
||||
]
|
||||
if is_akce:
|
||||
atributy.extend([
|
||||
@@ -797,7 +935,8 @@ def load_amcr_data(canvas, bb, filters=None,
|
||||
meta['akce_hlavni_typ'],
|
||||
meta['akce_vedlejsi_typ'],
|
||||
meta['dj_negativni'],
|
||||
meta['akce_je_nz']
|
||||
meta['akce_je_nz'],
|
||||
meta['projekt'],
|
||||
])
|
||||
else:
|
||||
atributy.extend([
|
||||
@@ -805,7 +944,7 @@ def load_amcr_data(canvas, bb, filters=None,
|
||||
meta['lokalita_popis'],
|
||||
meta['lokalita_typ'],
|
||||
meta['lokalita_druh'],
|
||||
meta['lokalita_zachovalost']
|
||||
meta['lokalita_zachovalost'],
|
||||
])
|
||||
|
||||
atributy.append(meta['pristupnost'])
|
||||
@@ -821,8 +960,10 @@ def load_amcr_data(canvas, bb, filters=None,
|
||||
target_list.append(feat)
|
||||
|
||||
except Exception as ex:
|
||||
print(f"Chyba při tvorbě feature: {ex}")
|
||||
pass
|
||||
QgsMessageLog.logMessage(
|
||||
f"Chyba při tvorbě feature: {ex}",
|
||||
"AMČR", Qgis.MessageLevel.Warning
|
||||
)
|
||||
|
||||
# --- ADDING TO QGIS INTERFACE ---
|
||||
proj = QgsProject.instance()
|
||||
@@ -833,15 +974,27 @@ def load_amcr_data(canvas, bb, filters=None,
|
||||
(feats_pt, vl_point, "Body"),
|
||||
]
|
||||
|
||||
for f, l, n in layers_to_process:
|
||||
for f, L, n in layers_to_process:
|
||||
if f:
|
||||
l.dataProvider().addFeatures(f)
|
||||
l.updateExtents()
|
||||
l.setName(f"AMCR_{archeologicky_zaznam}_{n}")
|
||||
proj.addMapLayer(l)
|
||||
L.dataProvider().addFeatures(f)
|
||||
L.updateExtents()
|
||||
L.setName(f"AMCR_{archeologicky_zaznam}_{n}")
|
||||
proj.addMapLayer(L)
|
||||
added += len(f)
|
||||
|
||||
if added > 0:
|
||||
if network_error:
|
||||
iface.messageBar().pushMessage(
|
||||
"AMCR",
|
||||
"Stahování bylo přerušeno chybou sítě – "
|
||||
f"výsledek je neúplný (vykresleno {added} prvků). "
|
||||
"Zkontrolujte připojení a spusťte stahování znovu.",
|
||||
level=(
|
||||
Qgis.MessageLevel.Warning
|
||||
if added > 0
|
||||
else Qgis.MessageLevel.Critical
|
||||
)
|
||||
)
|
||||
elif added > 0:
|
||||
iface.messageBar().pushMessage(
|
||||
"AMCR",
|
||||
f"Hotovo. Záznamů: {len(docs)} (s geom: {actions_with_geom}). "
|
||||
@@ -862,5 +1015,6 @@ def load_amcr_data(canvas, bb, filters=None,
|
||||
level=Qgis.MessageLevel.Critical
|
||||
)
|
||||
finally:
|
||||
# Always restore cursor, even after failure
|
||||
# Always restore cursor and release the guard, even after failure
|
||||
_LOADING = False
|
||||
QApplication.restoreOverrideCursor()
|
||||
|
||||
@@ -6,7 +6,6 @@ from qgis.core import Qgis
|
||||
|
||||
from .amcr_tools import load_amcr_data, login_to_api
|
||||
from .amcr_dialog import AmcrFilterDialog, LoginDialog
|
||||
from .resources import *
|
||||
import os.path
|
||||
|
||||
|
||||
@@ -24,8 +23,9 @@ class AmcrViewer:
|
||||
self.iface = iface
|
||||
self.plugin_dir = os.path.dirname(__file__)
|
||||
|
||||
# Determine the user's locale to load appropriate translation files
|
||||
locale = QSettings().value('locale/userLocale')[0:2]
|
||||
# Determine the user's locale to load appropriate translation files.
|
||||
# The setting may be missing (None) on a fresh QGIS install.
|
||||
locale = str(QSettings().value('locale/userLocale') or 'en')[0:2]
|
||||
locale_path = os.path.join(
|
||||
self.plugin_dir,
|
||||
'i18n',
|
||||
|
||||
@@ -8,7 +8,7 @@ name=AMČR Viewer
|
||||
qgisMinimumVersion=3.44.0
|
||||
qgisMaximumVersion=4.99.0
|
||||
description=Viewing and downloading the AMČR data.
|
||||
version=2.0.1
|
||||
version=2.0.2
|
||||
author=David Spáčil
|
||||
email=spacil@arub.cz
|
||||
|
||||
@@ -26,6 +26,8 @@ changelog=
|
||||
Aktualizace na verzi 2.0.0 výrazně mění chování pluginu. Před updatem je doporučeno přečíst si seznam změn níže.
|
||||
Version 2.0.0 changes the plugin behavior dramatically. It is advised to check the changelog below.
|
||||
Plný seznam změn v češtině je dostupný zde: https://github.com/ARUP-CAS/aiscr-qgis-amcr-viewer/releases/tag/v2.0.0
|
||||
v2.0.2 (2026-06-13)
|
||||
* Plugin-wide fixes and optimalizations (details https://github.com/ARUP-CAS/aiscr-qgis-amcr-viewer/pull/49)
|
||||
v2.0.1 (2026-06-10)
|
||||
* Fixed QGIS minimum version
|
||||
v2.0.0 (2026-06-05)
|
||||
@@ -47,7 +49,7 @@ tags=python,AMCR,AIS CR,archaeology,PIAN,AMČR,archeologie
|
||||
|
||||
homepage=https://amcr-help.aiscr.cz/digiarchiv/qgis-viewer.html
|
||||
category=Vector
|
||||
icon=download.png
|
||||
icon=akce.png
|
||||
# experimental flag
|
||||
experimental=False
|
||||
|
||||
|
||||
Reference in New Issue
Block a user