-
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
Lomakkeen tuottaminen templaatista #38
Lomakkeen tuottaminen templaatista #38
Conversation
4b60927
to
2349588
Compare
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.
Nice!
Let's go with this one and modify later on. I added few minor comments.
We should probably at some point change more towards a mvc pattern and create/fill a model from the template and create the form from the model.
class PlanRegulationGroupWidget(QWidget, FormClass): # type: ignore | ||
"""A widget representation of a plan regulation group.""" | ||
|
||
delete_signal = pyqtSignal(QWidget) | ||
|
||
def __init__(self, feature: Feature): | ||
super().__init__() | ||
self.setupUi(self) | ||
|
||
# TYPES | ||
self.frame: QFrame | ||
self.heading: QLineEdit | ||
self.del_btn: QPushButton |
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.
My understanding is that its a common practice to define the types in the class section as following:
class PlanRegulationGroupWidget(QWidget, FormClass): # type: ignore | |
"""A widget representation of a plan regulation group.""" | |
delete_signal = pyqtSignal(QWidget) | |
def __init__(self, feature: Feature): | |
super().__init__() | |
self.setupUi(self) | |
# TYPES | |
self.frame: QFrame | |
self.heading: QLineEdit | |
self.del_btn: QPushButton | |
class PlanRegulationGroupWidget(QWidget, FormClass): # type: ignore | |
"""A widget representation of a plan regulation group.""" | |
# TYPES | |
frame: QFrame | |
heading: QLineEdit | |
del_btn: QPushButton | |
delete_signal = pyqtSignal(QWidget) | |
def __init__(self, feature: Feature): | |
super().__init__() | |
self.setupUi(self) | |
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 used to do it like this too, until at some point VSCode stopped recognizing this sort of typing for me... If it is an editor bug, I will look into it more
|
||
# TYPES | ||
self.regulation_kind: QLineEdit | ||
self.form_layout: QFormLayout = self.layout() |
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 think layouts are accessible by the layout name defined in QtDesigner so no need the function call.
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 think it depends whether the layout is added as a separate item or only set to a widget unless I am mistaken. The top-level layout in this widget was only "set" and not as a separate entry in the widget tree.
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.
The "main" layouts of widgets are not shown in the widget tree but the name of the used layout is configurable in the widget's property editor under the layout section.
… simple feature saving (WIP)
e92f907
to
fda2581
Compare
No description provided.