setting a dialog to popup instead of toplevel



I'm working on the linuxcnc project using Pygtk 2.6-

The operator screen I am working on is in fullscreen.
When we use gtk.FileChooserDialog(), the menu bars show.

I have discovered that setting dialogs to popup instead of toplevel
fixes this problem. I did this in the GLADE file (for a different dialog) .

The filechooser is not build from a  GLADE file. I can not find an example
of how to set the FileChooserDialog to popup.

I seems that I must set the property of the dialog window.
I cannot find a 'window type' property, nor a clear example of how to do it.
The closest I found was:

desktop_type = gtk.gdk.atom_intern("_NET_WM_WINDOW_TYPE_DESKTOP", False)
 win = gtk.Window()
 win.show()
 win.realize()
 win.window.property_change(gtk.gdk.atom_intern("_NET_WM_WINDOW_TYPE", False),
                            gtk.gdk.atom_intern("ATOM", False), 32,
                            gtk.gdk.PROP_MODE_REPLACE,
                            [desktop_type])

The relevant code I'm working on is:

class EMC_FileChooserDialog(gtk.FileChooserDialog, _EMC_FileChooser):
    __gtype_name__ = 'EMC_FileChooserDialog'
    def __init__(self, *a, **kw):
        gtk.FileChooserDialog.__init__(self, *a, **kw)
        _EMC_FileChooser._hal_init(self)
        self.connect('response', self.on_response)

    def on_response(self, w, response):
        pass

    def on_activate(self, w):
        if self.fixed_file:
            self.load_file(self.fixed_file)
            return
        dialog = EMC_FileChooserDialog(title="Open File",action=""
                buttons=(gtk.STOCK_CANCEL,gtk.RESPONSE_CANCEL,gtk.STOCK_OPEN,gtk.RESPONSE_OK))
        dialog.set_current_folder(self.currentfolder)
        dialog.show()
        r = dialog.run()
        fn = dialog.get_filename()
        dialog.hide()
        if r == gtk.RESPONSE_OK:
            dialog.load_file(fn)
            self.currentfolder = os.path.dirname(fn)
        dialog.destroy()


Any help is appreciated

Chris Morley



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]