Пример #1
0
 def create_and_open_view(sources):
     v = self.controller.create_static_view(elements=sources)
     p = get_edit_popup(v, controller=self.controller)
     self.add_view(p,
                   name=_("Edit %s") %
                   self.controller.get_title(v, max_size=40))
     # FIXME: put focus on edit window
     return True
Пример #2
0
    def edit(self, element):
        e = get_edit_popup(element, self.controller)
        if e._widget:
            # The edit popup is already open
            return True
        w = e.compact()

        # Buttons hbox
        hbox = Gtk.HBox()

        def handle_ok(b, w):
            e.apply_cb()
            #self.undisplay_cb(b, w)
            return True

        # OK button
        b = get_pixmap_button('small_ok.png', handle_ok, w)
        b.set_relief(Gtk.ReliefStyle.NONE)
        b.set_tooltip_text(_("Validate"))
        hbox.pack_start(b, False, True, 0)

        # Close button
        b = get_pixmap_button('small_close.png', self.undisplay_cb, w)
        b.set_relief(Gtk.ReliefStyle.NONE)
        b.set_tooltip_text(_("Close"))
        hbox.pack_start(b, False, True, 0)

        t = self.get_short_title(element)
        l = Gtk.Label()
        l.set_markup('<b>%s</b>' % t.replace('<', '&lt;'))
        hbox.pack_start(l, True, True, 0)

        self.edited_elements[element] = w
        w._title_label = l
        self.display(w, title=hbox)

        def handle_destroy(*p):
            if self.controller and self.controller.gui:
                self.controller.gui.unregister_edit_popup(e)
            self.undisplay_cb(None, w)
            return True

        w.connect('destroy', handle_destroy)

        self.controller.gui.make_pane_visible(
            getattr(self, '_destination', None))

        if self.controller and self.controller.gui:
            self.controller.gui.register_edit_popup(e)
Пример #3
0
    def edit(self, element):
        e=get_edit_popup(element, self.controller)
        if e._widget:
            # The edit popup is already open
            return True
        w=e.compact()

        # Buttons hbox
        hbox=Gtk.HBox()

        def handle_ok(b, w):
            e.apply_cb()
            #self.undisplay_cb(b, w)
            return True

        # OK button
        b=get_pixmap_button('small_ok.png', handle_ok, w)
        b.set_relief(Gtk.ReliefStyle.NONE)
        b.set_tooltip_text(_("Validate"))
        hbox.pack_start(b, False, True, 0)

        # Close button
        b=get_pixmap_button('small_close.png', self.undisplay_cb, w)
        b.set_relief(Gtk.ReliefStyle.NONE)
        b.set_tooltip_text(_("Close"))
        hbox.pack_start(b, False, True, 0)

        t=self.get_short_title(element)
        l=Gtk.Label()
        l.set_markup('<b>%s</b>' % t.replace('<', '&lt;'))
        hbox.pack_start(l, True, True, 0)

        self.edited_elements[element]=w
        w._title_label=l
        self.display(w, title=hbox)

        def handle_destroy(*p):
            if self.controller and self.controller.gui:
                self.controller.gui.unregister_edit_popup(e)
            self.undisplay_cb(None, w)
            return True

        w.connect('destroy', handle_destroy)

        self.controller.gui.make_pane_visible(getattr(self, '_destination', None))

        if self.controller and self.controller.gui:
            self.controller.gui.register_edit_popup(e)
Пример #4
0
 def edit_annotation(a):
     p=get_edit_popup(a, controller=self.controller)
     self.add_view(p, name=_("Edit %s") % self.controller.get_title(a, max_size=40))
     return True
Пример #5
0
 def create_and_open_view(sources):
     v=self.controller.create_static_view(elements=sources)
     p=get_edit_popup(v, controller=self.controller)
     self.add_view(p, name=_("Edit %s") % self.controller.get_title(v, max_size=40))
     # FIXME: put focus on edit window
     return True
Пример #6
0
 def edit_annotation(a):
     p = get_edit_popup(a, controller=self.controller)
     self.add_view(p,
                   name=_("Edit %s") %
                   self.controller.get_title(a, max_size=40))
     return True