def reconnect_categories(self, category, category_id):
    self.side_view[category_id] = category
    GObject.signal_handlers_destroy(self.side_view[category_id])
             
    self.side_view[category_id].connect("item-activated", self.side_view_nav, category_id)
    self.side_view[category_id].connect("button-release-event", self.button_press, category_id)
    self.side_view[category_id].connect("keynav-failed", self.on_keynav_failed, category_id)
    self.side_view[category_id].connect("selection-changed", self.on_selection_changed, category_id)
    self.create_cinnamon_order(category_id)
Ejemplo n.º 2
0
    def test_signal_handlers_destroy(self):
        obj = F()
        obj.connect('signal', self._callback)
        obj.connect('signal', self._callback)
        obj.connect('signal', self._callback)

        obj.emit('signal')
        self.assertEqual(self.count, 3)

        # count should remain at 3 after all handlers are destroyed
        GObject.signal_handlers_destroy(obj)
        obj.emit('signal')
        self.assertEqual(self.count, 3)
Ejemplo n.º 3
0
    def test_signal_handlers_destroy(self):
        obj = F()
        obj.connect('signal', self._callback)
        obj.connect('signal', self._callback)
        obj.connect('signal', self._callback)

        obj.emit('signal')
        self.assertEqual(self.count, 3)

        # count should remain at 3 after all handlers are destroyed
        GObject.signal_handlers_destroy(obj)
        obj.emit('signal')
        self.assertEqual(self.count, 3)
Ejemplo n.º 4
0
 def destroy_handler(self):
     # remove the PreviewWindow from preview_worker
     preview_worker.remove_client(self.id)
     
     # This fixes a bug where references to the PreviewWindow still
     # existed in the signal handler functions of the actions.
     # (like self.action_rotate_left_handler) GTK did not remove these
     # handlers and thus the PreviewWindow was not garbage collected.
     # So the weakref was never released from the model emitter.
     actions = self._global_actions.list_actions() + self._document_actions.list_actions()
     for action in actions:
         GObject.signal_handlers_destroy(action)
     self.disconnect(destroy_handler_id)
     return True
Ejemplo n.º 5
0
    def fly_mode(self, button, scale, presetlist):
        # objects relevant for fly mode
        tochange = [
            "left", "leftup", "leftdown", "right", "rightup", "rightdown",
            "up", "down", "home"
        ]

        # fly mode turned on
        if button.get_active():
            logger.debug("fly mode turned on")

            for i in tochange:
                button = builder.get_object(i)
                GObject.signal_handlers_destroy(button)
                if i == "home":
                    button.set_image(get_stock_icon("stop"))
                    button.connect("clicked", self.stop_move)
                else:
                    button.connect(
                        "clicked", str_to_module("onvif_interface",
                                                 "move_" + i), scale,
                        presetlist)

        # fly mode turned off
        else:
            logger.debug("fly mode turned off")

            for i in tochange:
                button = builder.get_object(i)
                GObject.signal_handlers_destroy(button)
                if i == "home":
                    button.set_image(get_icon("home"))
                    button.connect("clicked", self.move_home)
                else:
                    button.connect(
                        "pressed", str_to_module("onvif_interface",
                                                 "move_" + i), scale,
                        presetlist)
                    button.connect("released", self.stop_move)
Ejemplo n.º 6
0
    def __init__(self, uuid, parent, _type):
        self.parent = parent
        self.type = _type
        self.current_id = None
        #self.activeDBus = False
        self.builder = self.parent.builder
        self.content = self.builder.get_object("content")
        self.xlet_main_box = self.builder.get_object("xlet_main_box")
        self.xletsettings_btt_box = self.builder.get_object("xletsettings_btt_box")
        self.back_to_list_button = self.builder.get_object("back_to_list")

        self.highlight_button = self.builder.get_object("highlight_button")#self.highlight_button self.more_button
        self.more_button = self.builder.get_object("more_button")
        self.remove_button = self.builder.get_object("remove_xlet")
        GObject.signal_handlers_destroy(self.highlight_button)
        GObject.signal_handlers_destroy(self.more_button)
        GObject.signal_handlers_destroy(self.remove_button)

        self.uuid = uuid
        GObject.signal_handlers_destroy(self.xlet_main_box)
        self.xlet_main_box.connect("hide", self.on_hide)

        self.applet_meta = {}
        self.applet_settings = collections.OrderedDict()
        self.setting_factories = collections.OrderedDict()
        self.isload = self.load_applet_data (self.uuid)
        if "icon" in self.applet_meta:
            image = Gtk.Image().new_from_icon_name(self.applet_meta["icon"], Gtk.IconSize.BUTTON)
            self.back_to_list_button.set_image(image)
            self.back_to_list_button.get_property("image").set_padding(5, 0)
        self.back_to_list_button.set_label(self.applet_meta["name"])
        self.back_to_list_button.set_tooltip_text(_("Back to list"))
        self.more_button.set_tooltip_text(_("More actions..."))
        self.remove_button.set_label(_("Remove"))
        self.remove_button.set_tooltip_text(_("Remove the current instance of this %s") % self.type)
        self.highlight_button.set_label(_("Highlight"))
        self.highlight_button.set_tooltip_text(_("Momentarily highlight the %s on your desktop") % self.type)
        if len(self.applet_settings.keys()) > 1:
            self.build_notebook()
        else:
            self.build_single()
        if self.type != "extension":
            self.highlight_button.connect("clicked", self.on_highlight_button_clicked)
            self.highlight_button.show()
        else:
            self.highlight_button.hide()
        self.more_button.connect("clicked", self.on_more_button_clicked)
        self.remove_button.connect("clicked", self.on_remove_button_clicked)
    def __init__(self, uuid, parent, _type):
        self.parent = parent
        self.type = _type
        self.current_id = None
        self.builder = self.parent.builder
        self.content = self.builder.get_object("content")
        self.xlet_main_box = self.builder.get_object("xlet_main_box")
        self.xletsettings_btt_box = self.builder.get_object("xletsettings_btt_box")
        self.back_to_list_button = self.builder.get_object("back_to_list")

        self.highlight_button = self.builder.get_object("highlight_button")#self.highlight_button self.more_button
        self.more_button = self.builder.get_object("more_button")
        self.remove_button = self.builder.get_object("remove_xlet")
        GObject.signal_handlers_destroy(self.highlight_button)
        GObject.signal_handlers_destroy(self.more_button)
        GObject.signal_handlers_destroy(self.remove_button)

        self.uuid = uuid
        GObject.signal_handlers_destroy(self.xlet_main_box)
        self.xlet_main_box.connect("hide", self.on_hide)

        self.applet_meta = {}
        self.applet_settings = collections.OrderedDict()
        self.setting_factories = collections.OrderedDict()
        self.isload = self.load_applet_data (self.uuid)
        if "icon" in self.applet_meta:
            image = Gtk.Image().new_from_icon_name(self.applet_meta["icon"], Gtk.IconSize.BUTTON)
            self.back_to_list_button.set_image(image)
            self.back_to_list_button.get_property("image").set_padding(5, 0)
        self.back_to_list_button.set_label(self.applet_meta["name"])
        self.back_to_list_button.set_tooltip_text(_("Back to list"))
        self.more_button.set_tooltip_text(_("More actions..."))
        self.remove_button.set_label(_("Remove"))
        self.remove_button.set_tooltip_text(_("Remove the current instance of this %s") % self.type)
        self.highlight_button.set_label(_("Highlight"))
        self.highlight_button.set_tooltip_text(_("Momentarily highlight the %s on your desktop") % self.type)
        if len(self.applet_settings.keys()) > 1:
            self.build_notebook()
        else:
            self.build_single()
        if self.type != "extension":
            self.highlight_button.connect("clicked", self.on_highlight_button_clicked)
            self.highlight_button.show()
        else:
            self.highlight_button.hide()
        self.more_button.connect("clicked", self.on_more_button_clicked)
        self.remove_button.connect("clicked", self.on_remove_button_clicked)