[Glade-users] Possible bug with File-chooser dialog?
alsaf
alfraealba at googlemail.com
Sat Jan 9 11:18:07 EST 2010
On Thu, 2010-01-07 at 23:26 -0200, Tristan Van Berkom wrote:
> On Thu, Jan 7, 2010 at 9:03 PM, alsaf <alfraealba at googlemail.com> wrote:
> [...]
> >
> > I am in the process of converting pyGTK code to glade in my program. The
> > program is split into a number of files stored in packages. I want to
> > store the glade files in the packages and call them up on the fly inside
> > the packages. Is this possible or do I have to create all widgets at
> > startup and pass the builder objects to the package classes?
> >
>
> Sure, some people like to write an object class to handle a portion
> of the interface, and distribute separate Glade files for each of these
> portions, whether they are distributed together or separately shouldnt
> change the fact that you can mesh the interfaces together by way
> of parenting them or having separate toplevels etc.
>
> Cheers,
> -Tristan
Thanks for taking the time to reply to this.
I wasn't thinking this through properly. I set up the builder object in
the class initiation function and in in this class I amended the
relevant function to show and then hide it when destroyed. In the main
program I created only one instance of the class globally rather than
creating it again and again in the button callback
For reference, a brief description of what I did is as follows:
##############################################################################
# main.py
# This is the main program
...
...
# Imports the class file containing delete dialog which is in
delete_dialog package
import delete_dialog.dialog_tree
....
# Global variable
dd_ins = delete_dialog.dialog_tree.delete_folder_dialog_class()
...
other code
...
# button callback which calls the function in class
def del_button_cb(self, widget, data=None):
self.dd_ins.create_dialog()
...
other code
...
# end of main.py
#####################################################################
#####################################################################
#dialog_tree.py (in delete_dialog package)
class delete_folder_dialog_class:
def __init__( self):
self.builder = gtk.Builder()
self.builder.add_from_file("delete_dialog/delete_dialog.glade")
self.dialog = self.builder.get_object("delete_dialog")
self.dd_treeview = self.builder.get_object("dd_treeview")
self.dd_treestore = self.builder.get_object("dd_treestore")
self.del_button = self.builder.get_object("del_button")
self.cancel_buton = self.builder.get_object("cancel_button")
self.dd_error_message = self.builder.get_object("dd_error_message")
self.dd_info_message = self.builder.get_object("dd_info_message")
self.builder.connect_signals(self)
...
other code
...
def create_dialog(self):
self.dialog.run()
self.dialog.show()
self.dialog.hide()
#end of dialog_tree.py
############################################################################
More information about the Glade-users
mailing list