0
Answered
How to access data entered into a dialog?
Hi,
I am developing a plugin for Ajenti, which needs a (modal/popup) dialog to appear in which the user can enter data, such as a name, choose from a list of templates, etc. I can design the dialog in XML, and bind the id of the dialog to the python code in a file main.py, but how do I access the data which was entered by the user?
By binding the UI element to an object in main.py, does it store once it is saved?
For example, if in main.py, I have...
....
self.container.name = ' '
self.container.status= ' '
self.binder = Binder(self, self)
....
and in layout/main.xml:
...
<dialog id="foo" visible="False" buttons="
{'id': 'save', 'text': _('Create')},
{'id': 'cancel', 'text': _('Cancel')},">
</dialog>
...
Will these items be bound?
I am developing a plugin for Ajenti, which needs a (modal/popup) dialog to appear in which the user can enter data, such as a name, choose from a list of templates, etc. I can design the dialog in XML, and bind the id of the dialog to the python code in a file main.py, but how do I access the data which was entered by the user?
By binding the UI element to an object in main.py, does it store once it is saved?
For example, if in main.py, I have...
....
self.container.name = ' '
self.container.status= ' '
self.binder = Binder(self, self)
....
and in layout/main.xml:
...
<dialog id="foo" visible="False" buttons="
{'id': 'save', 'text': _('Create')},
{'id': 'cancel', 'text': _('Cancel')},">
<vc>
<textbox bind="name" />
<textbox bind="status" />
<textbox bind="status" />
</vc>
</dialog>
...
Will these items be bound?
Answer
0
Answer
Answered
Eugene Pankov (Project coordinator) 10 years ago
Hi, you when your dialog is done (i.e., fires 'button' event), you need to .update() the binder, so that your data objects are updated with the new data from UI. Example: https://github.com/Eugeny/ajenti/blob/master/ajenti/plugins/configurator/configurator.py#L228-L248
Answer
Answered
Hi, you when your dialog is done (i.e., fires 'button' event), you need to .update() the binder, so that your data objects are updated with the new data from UI. Example: https://github.com/Eugeny/ajenti/blob/master/ajenti/plugins/configurator/configurator.py#L228-L248
Customer support service by UserEcho