def fill_listAssociations(self, obj): o = self.builder.get_object store = Gtk.ListStore(str, GdkPixbuf.Pixbuf, str, GdkPixbuf.Pixbuf, GdkPixbuf.Pixbuf, str, GdkPixbuf.Pixbuf, bool) association_ids = retrieve_association_ids() suspended = retrieve_association_ids_suspended() arrow = load_pixbuf('right') l = o('listAssociation') delall_sensitive = False for x in association_ids: li = retrieve_association(x) cond_name = li[0] cond_active = bool(x not in suspended) cond_active_pixbuf = \ self.glyph_enabled if cond_active else self.glyph_disabled cond_data = retrieve_plugin_data(cond_name) cond_pixbuf = load_pixbuf(cond_data['icon']) task_name = li[1] task_data = retrieve_plugin_data(task_name) task_pixbuf = load_pixbuf(task_data['icon']) store.append([x, cond_pixbuf, cond_data['name'], arrow, task_pixbuf, task_data['name'], cond_active_pixbuf, cond_active]) delall_sensitive = True l.set_model(store) o('btnDeleteAll').set_sensitive(delall_sensitive)
def click_btnDeleteAll(self, obj): o = self.builder.get_object confirmbox = Gtk.MessageDialog(type=Gtk.MessageType.QUESTION, buttons=Gtk.ButtonsType.YES_NO) confirmbox.set_markup( RESOURCES.MSGBOX_CONFIRM_DELETE_ALL_ASSOCIATIONS) ret = confirmbox.run() confirmbox.hide() confirmbox.destroy() if ret == Gtk.ResponseType.YES: association_ids = retrieve_association_ids() for x in association_ids: li = retrieve_association(x) plugin_cond = retrieve_plugin(li[0]) plugin_task = retrieve_plugin(li[1]) unregister_plugin_data(plugin_cond) unregister_plugin_data(plugin_task) if plugin_cond.stock: plugin_cond.remove_action() else: try: plugin_cond.remove_action() except Exception: if PLUGIN_TEMP_FOLDER: _x_info = sys.exc_info() sys.stderr.write( "%s: %s\n" % (_x_info[0].__name__, _x_info[1])) traceback.print_tb(_x_info[2]) if plugin_task.stock: plugin_task.remove_action() else: try: plugin_task.remove_action() except Exception: if PLUGIN_TEMP_FOLDER: _x_info = sys.exc_info() sys.stderr.write( "%s: %s\n" % (_x_info[0].__name__, _x_info[1])) traceback.print_tb(_x_info[2]) unstore_association(x) self.selected_association = None self.fill_listAssociations(None) self.fill_cbSelectUninstallPlugin(None) o('txtCondition').set_text("") o('txtConsequence').set_text("")