I am trying to add a window to me app, not a dialog. As I didn't find a way to do it straightforwardly, I thought of a possible solution: add a dialog, then turn it into a window. But when I do so, that window can't be initialized:
Traceback (most recent call last): File "/home/ilya/Projects/online-translator/online_translator/Indicator.py", line 184, in show_popup_window PopUpWindow = PopupDialog.PopupDialog() File "/home/ilya/Projects/online-translator/online_translator/PopupDialog.py", line 37, in __new__ new_object.finish_initializing(builder) AttributeError: 'Window' object has no attribute 'finish_initializing'
This is the code there:
class PopupDialog(Gtk.Window): __gtype_name__ = "PopupDialog" def __new__(cls): """Special static method that's automatically called by Python when constructing a new instance of this class. Returns a fully instantiated PopupDialog object. """ builder = get_builder('PopupDialog') new_object = builder.get_object('popup_dialog') new_object.finish_initializing(builder) return new_object def finish_initializing(self, builder): """Called when we're finished initializing. finish_initalizing should be called after parsing the ui definition and creating a PopupDialog object with it in order to finish initializing the start of the new PopupDialog instance. """ # Get a reference to the builder and set up the signals. self.builder = builder self.ui = builder.get_ui(self) Some other stuff...
I have a glade file named PopupDialog,ui with a popup_dialog window in it in my Project's folder.
What is wrong there? I really don't quiet understand, how that code works, because it is generated by Quickly automatically.