Re: [gedit-list] Possible bug with configure dialog in plugins?



Thanks guys.

For those who stumble across this, the solution was to use Gtk.Builder.add_objects_from_file() rather than Gtk.Builder.add_from_file() so that the UI is built from the configure widget as root instead of the toplevel. Here is a simplified version:

def do_create_configure_widget(self):
    filename = os.path.join(DATA_DIR, 'configure_dialog.xml')
    builder = Gtk.Builder()
    builder.add_objects_from_file(filename, ["configure_widget"])
    return builder.get_object("configure_widget")



On Sat, May 7, 2011 at 7:40 AM, Nacho <nacho resa gmail com> wrote:
Hey,

with builder you can set which one is the root, so just take the main box and you return this.

Regards

On Sat, May 7, 2011 at 4:22 PM, Micah Carrick <micah greentackle com> wrote:
One other note, and this may be more of a Peas or Glade thing, but...

Since we now return a widget instead of a dialog, it is a little more difficult to use Glade to build the configure dialog. Peas does not like a widget with a parent and Glade doesn't like a widget without a parent. I have to manually go into the glade interface file and remove the top level window so that Gtk.Builder does not build a parent for the configure widget.

But, it's now working. Thanks!


On Sat, May 7, 2011 at 6:59 AM, Nacho <nacho resa gmail com> wrote:
Hey,

Yeah, now you need to implement PeasGtk.Configurable. See:

Regards.

PS: I know we need to update the tutorial for this.

On Sat, May 7, 2011 at 3:49 PM, Micah Carrick <micah greentackle com> wrote:
I was going to submit a bug but I figured I would check here first.

I'm running Gedit 3.0.2 and the configure dialog doesn't seem to work for Python plugins. Neither is_configurable() nor create_configure_dialog() are being called. Here is a test:

from gi.repository import GObject, Gedit

class ConfigurePlugin(GObject.Object, Gedit.WindowActivatable):
    __gtype_name__ = "ConfigurePlugin"
    window = GObject.property(type=Gedit.Window)

    def __init__(self):
        GObject.Object.__init__(self)
    
    def create_configure_dialog(self):
        print "create_configure_dialog"
        return None
        
    def is_configurable(self):
        print "is_configurable"
        return False
        
    def do_activate(self):
        pass

    def do_deactivate(self):
        pass

    def do_update_state(self):
        pass



_______________________________________________
gedit-list mailing list
gedit-list gnome org
http://mail.gnome.org/mailman/listinfo/gedit-list





--
    Green Tackle - Environmentally Friendly Fishing Tackle
    www.GreenTackle.com

     Email: micah greentackle com
     Phone: 971.270.2206
     Toll Free: 877.580.9165
     Fax: 503.946.3106







--
    Green Tackle - Environmentally Friendly Fishing Tackle
    www.GreenTackle.com

     Email: micah greentackle com
     Phone: 971.270.2206
     Toll Free: 877.580.9165
     Fax: 503.946.3106





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