-
Notifications
You must be signed in to change notification settings - Fork 0
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
Alustava arkkitehtuurisuunnitelma #1
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good start! Let's build on this and change things later if needed.
from arho_feature_template.qgis_plugin_tools.tools.resources import load_ui | ||
|
||
|
||
class FeatureAttributeForm(QDialog, load_ui("feature_attribute_form.ui")): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a fan of using the load_ui
util from the plugin_tools. IMHO it is cleaner to have the ui files next to the corresponding python module than in a fixed arbitrary location. What do you think?
I would to suggest something like this:
from importlib import resources
from qgis.PyQt import uic
ui_path = resources.files() / "feature_attribute_form.ui" # files() without arguments looks resources adjacent to the caller module
FormClass, _ = uic.loadUiType(ui_path)
class FeatureAttributeForm(QDialog, FormClass):
...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have strong preference for the UI loading, but I like the idea that the ui files are next to the python module. Changed to this (but gave __package__
as an argument for files()
since it seems to be needed in older Python versions).
from arho_feature_template.qgis_plugin_tools.tools.resources import load_ui | ||
|
||
|
||
class AddFeaturePanel(QWidget, load_ui("add_feature_panel.ui")): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would rename to something like TemplateLibraryPanel
feature_attribte_group: str | ||
attribute_layer: QgsMapLayer # Is this correct type? | ||
additional_information: str | ||
input_field_type: QLineEdit | QgsSpinBox | QgsDoubleSpinBox | None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably be read at form rendering time from the layer settings.
|
||
|
||
@dataclass | ||
class FeatureTemplate: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is now missing possible child features. But that's totally fine for now! Let's first try to get this working with the most simple one feature case. Probably the library config should be updated accordingly.
- Renamed AddFeaturePanel to TemplateLibraryPanel - Changed how UI files are loaded and placed - Commented out attribute_layer from FeatureTemplate
No description provided.