Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reorganize plugin folder structure, cleanup #85

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions arho_feature_template/core/exceptions.py

This file was deleted.

4 changes: 4 additions & 0 deletions arho_feature_template/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@ def __init__(self, layer_name: str):
class LayerNotVectorTypeError(Exception):
def __init__(self, layer_name: str):
super().__init__(f"Layer {layer_name} is not a vector layer")


class UnexpectedNoneError(Exception):
"""Internal QGIS errors that should not be happened"""
35 changes: 0 additions & 35 deletions arho_feature_template/gui/feature_attribute_form.py

This file was deleted.

80 changes: 0 additions & 80 deletions arho_feature_template/gui/feature_attribute_form.ui

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from qgis.PyQt.QtGui import QStandardItem, QStandardItemModel
from qgis.PyQt.QtWidgets import QComboBox, QDialog, QDialogButtonBox, QLineEdit, QMessageBox, QPushButton, QTableView

from arho_feature_template.core.exceptions import UnexpectedNoneError
from arho_feature_template.exceptions import UnexpectedNoneError

ui_path = resources.files(__package__) / "load_plan_dialog.ui"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
from qgis.PyQt.QtWidgets import QDialog, QMessageBox
from qgis.utils import iface

from arho_feature_template.core.lambda_service import LambdaService
from arho_feature_template.gui.load_plan_dialog import LoadPlanDialog
from arho_feature_template.gui.serialize_plan import SerializePlan
from arho_feature_template.plan.load_plan_dialog import LoadPlanDialog
from arho_feature_template.plan.serialize_plan import SerializePlan
from arho_feature_template.utils.db_utils import get_existing_database_connection_names
from arho_feature_template.utils.lambda_service import LambdaService
from arho_feature_template.utils.misc_utils import get_active_plan_id, get_layer_by_name, handle_unsaved_changes

logger = logging.getLogger(__name__)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@
from qgis.PyQt.QtGui import QStandardItem, QStandardItemModel
from qgis.utils import iface

from arho_feature_template.core.template_library_config import (
from arho_feature_template.exceptions import LayerNotFoundError, LayerNotVectorTypeError
from arho_feature_template.plan_feature.plan_feature_form import PlanFeatureForm
from arho_feature_template.plan_feature.template_dock import TemplateLibraryDock
from arho_feature_template.plan_feature.template_library_config import (
FeatureTemplate,
TemplateLibraryConfig,
TemplateLibraryVersionError,
TemplateSyntaxError,
parse_template_library_config,
)
from arho_feature_template.exceptions import LayerNotFoundError, LayerNotVectorTypeError
from arho_feature_template.gui.template_attribute_form import TemplateAttributeForm
from arho_feature_template.gui.template_dock import TemplateLibraryDock
from arho_feature_template.resources.template_libraries import library_config_files
from arho_feature_template.utils.project_utils import get_layer_from_project

Expand Down Expand Up @@ -157,7 +157,7 @@ def ask_for_feature_attributes(self, feature: QgsFeature) -> None:
if not self.active_template:
return

attribute_form = TemplateAttributeForm(self.active_template.config)
attribute_form = PlanFeatureForm(self.active_template.config)

if attribute_form.exec_():
layer = get_layer_from_project(self.active_template.config.feature.layer)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,23 @@
QTreeWidgetItem,
)

from arho_feature_template.core.plan_regulation_group_config import (
from arho_feature_template.plan_regulation_group.plan_regulation_group_config import (
PlanRegulationGroupDefinition,
PlanRegulationGroupLibrary,
)
from arho_feature_template.gui.plan_regulation_group_widget import PlanRegulationGroupWidget
from arho_feature_template.plan_regulation_group.plan_regulation_group_widget import PlanRegulationGroupWidget
from arho_feature_template.qgis_plugin_tools.tools.resources import resources_path

if TYPE_CHECKING:
from qgis.PyQt.QtWidgets import QWidget

from arho_feature_template.core.template_library_config import FeatureTemplate
from arho_feature_template.plan_feature.template_library_config import FeatureTemplate

ui_path = resources.files(__package__) / "template_attribute_form.ui"
ui_path = resources.files(__package__) / "plan_feature_form.ui"
FormClass, _ = uic.loadUiType(ui_path)


class TemplateAttributeForm(QDialog, FormClass): # type: ignore
class PlanFeatureForm(QDialog, FormClass): # type: ignore
"""Parent class for feature template forms for adding and modifying feature attribute data."""

def __init__(self, feature_template_config: FeatureTemplate):
Expand Down
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@
QWidget,
)

from arho_feature_template.core.plan_regulation_config import PlanRegulationConfig, ValueType
from arho_feature_template.plan_regulation.plan_regulation_config import PlanRegulationConfig, ValueType
from arho_feature_template.utils.misc_utils import get_additional_information_name, get_layer_by_name

if TYPE_CHECKING:
from qgis.PyQt.QtWidgets import QPushButton

from arho_feature_template.core.plan_regulation_group_config import PlanRegulationDefinition
from arho_feature_template.plan_regulation_group.plan_regulation_group_config import PlanRegulationDefinition

ui_path = resources.files(__package__) / "plan_regulation_widget.ui"
FormClass, _ = uic.loadUiType(ui_path)
Expand Down
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import yaml
from qgis.utils import iface

from arho_feature_template.core.plan_regulation_config import PlanRegulationDefinition, PlanRegulationsSet
from arho_feature_template.plan_regulation.plan_regulation_config import PlanRegulationDefinition, PlanRegulationsSet

if TYPE_CHECKING:
from pathlib import Path
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@
from qgis.PyQt.QtCore import Qt
from qgis.PyQt.QtWidgets import QDialog, QTextBrowser, QTreeWidget, QTreeWidgetItem

from arho_feature_template.core.plan_regulation_config import PlanRegulationConfig, PlanRegulationsSet
from arho_feature_template.gui.plan_regulation_widget import PlanRegulationWidget
from arho_feature_template.plan_regulation.plan_regulation_config import PlanRegulationConfig, PlanRegulationsSet
from arho_feature_template.plan_regulation.plan_regulation_widget import PlanRegulationWidget

if TYPE_CHECKING:
from qgis.PyQt.QtWidgets import QBoxLayout, QWidget

ui_path = resources.files(__package__) / "new_plan_regulation_group_form.ui"
ui_path = resources.files(__package__) / "plan_regulation_group_form.ui"
FormClass, _ = uic.loadUiType(ui_path)


class NewPlanRegulationGroupForm(QDialog, FormClass): # type: ignore
class PlanRegulationGroupForm(QDialog, FormClass): # type: ignore
"""Form to create a new plan regulation group."""

def __init__(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
from qgis.PyQt.QtCore import pyqtSignal
from qgis.PyQt.QtWidgets import QWidget

from arho_feature_template.gui.plan_regulation_widget import PlanRegulationWidget
from arho_feature_template.plan_regulation.plan_regulation_widget import PlanRegulationWidget

if TYPE_CHECKING:
from qgis.PyQt.QtWidgets import QFrame, QLineEdit, QPushButton

from arho_feature_template.core.plan_regulation_config import PlanRegulationDefinition
from arho_feature_template.core.plan_regulation_group_config import PlanRegulationGroupDefinition
from arho_feature_template.plan_regulation.plan_regulation_config import PlanRegulationDefinition
from arho_feature_template.plan_regulation_group.plan_regulation_group_config import PlanRegulationGroupDefinition

ui_path = resources.files(__package__) / "plan_regulation_group_widget.ui"
FormClass, _ = uic.loadUiType(ui_path)
Expand Down
13 changes: 8 additions & 5 deletions arho_feature_template/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@
from qgis.PyQt.QtWidgets import QAction, QWidget
from qgis.utils import iface

from arho_feature_template.core.feature_template_library import FeatureTemplater, TemplateGeometryDigitizeMapTool
from arho_feature_template.core.plan_manager import PlanManager
from arho_feature_template.gui.new_plan_regulation_group_form import NewPlanRegulationGroupForm
from arho_feature_template.gui.plugin_settings import PluginSettings
from arho_feature_template.plan.plan_manager import PlanManager
from arho_feature_template.plan_feature.feature_template_library import (
FeatureTemplater,
TemplateGeometryDigitizeMapTool,
)
from arho_feature_template.plan_regulation_group.plan_regulation_group_form import PlanRegulationGroupForm
from arho_feature_template.qgis_plugin_tools.tools.custom_logging import setup_logger, teardown_logger
from arho_feature_template.qgis_plugin_tools.tools.i18n import setup_translation
from arho_feature_template.qgis_plugin_tools.tools.resources import plugin_name
from arho_feature_template.utils.plugin_settings import PluginSettings

if TYPE_CHECKING:
from qgis.gui import QgisInterface, QgsMapTool
Expand Down Expand Up @@ -225,5 +228,5 @@ def toggle_template_dock(self, show: bool) -> None: # noqa: FBT001
self.templater.template_dock.setUserVisible(show)

def open_plan_regulation_group_form(self):
self.new_plan_regulation_group_dialog = NewPlanRegulationGroupForm()
self.new_plan_regulation_group_dialog = PlanRegulationGroupForm()
self.new_plan_regulation_group_dialog.exec_()
Empty file.
2 changes: 1 addition & 1 deletion arho_feature_template/utils/db_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from qgis.core import QgsProviderRegistry

from arho_feature_template.core.exceptions import UnexpectedNoneError
from arho_feature_template.exceptions import UnexpectedNoneError

LOGGER = logging.getLogger("LandUsePlugin")

Expand Down
Loading