Пример #1
0
    def __on_activate(self, *args):

        def run_old_one(*args):
        
            client.open_display_with_id(path, ident)

        def run_new_one(*args):

            client.open_display(path)


        found_display = False
        item = self.__browser.get_selected_item()
        if (item):
            client = self._get_plugin("Core_Client")
            path = os.path.abspath(item.path)

            if self.__displays:
                for ident in self.__displays:
                    saved_path = _DSPLIST.lookup_display(ident)[1]

                    if saved_path == path:
                        found_display = True
                        break

            if found_display is True:

                dialog.question(_("There is a saved instance of this display."),
                            _("Would you like to open this?"),
                            (gtk.STOCK_YES, run_old_one),
                            (gtk.STOCK_NO, run_new_one))
            
            else: run_new_one()
Пример #2
0
    def __on_remove(self, *args):

        def remove(*args):
            try:
                self.__remove_display(item.path)
            except OSError:
                dialog.warning(_("Could not remove"),
                               _("The desklet file could not be removed. "
                                 "This most likely means that you do not have "
                                 "write permission on it."))
            else:
                self.__collection.remove(item)
                self.set_location(self.__location)


        item = self.__browser.get_selected_item()
        if (item):
            dialog.question(None,
                            _("Do you really want to remove this desklet ?"),
                            _("The desklet will be removed from your system "
                              "and no longer be available."),
                            (gtk.STOCK_CANCEL, None),
                            (gtk.STOCK_DELETE, remove))