How to access parent window in dialog
Posted
by
Bruce
on Ask Ubuntu
See other posts from Ask Ubuntu
or by Bruce
Published on 2012-09-01T09:00:30Z
Indexed on
2012/09/01
9:49 UTC
Read the original article
Hit count: 166
I am using Quickly and created the main window and a dialog. In the main window I am setting access to database (u1db) in the finish_initializing method (self.db=...). After an action I open a dialog where I need access to the database.
I thought that I can use self.get_parent() in the dialog to get instance of the main window and access the database, but return value of the get_parent() is None.
My question is, how can I access the instance of the parent window in the dialog or perhaps where should I place the instance of the database wrapper?
Shortened code:
class GuitestWindow(Window):
def finish_initializing(self, builder):
...
self.db = u1db.open(
db_path,
create=True
)
def on_addaccountbutton_clicked(self, widget):
dialog = NewAccountDialog.NewAccountDialog()
result = dialog.run()
dialog.hide()
© Ask Ubuntu or respective owner