Esempio n. 1
0
 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)
Esempio n. 2
0
 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)
Esempio n. 3
0
 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("")
Esempio n. 4
0
 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("")
Esempio n. 5
0
 def changed_listAssociation(self, sel):
     o = self.builder.get_object
     m, i = sel.get_selected()
     if i is not None:
         self.selected_association = m[i][0]
         enabled = m[i][7]
         li = retrieve_association(self.selected_association)
         data_cond = retrieve_plugin_data(li[0])
         data_task = retrieve_plugin_data(li[1])
         o('txtCondition').set_text(data_cond['summary_description'])
         o('txtConsequence').set_text(data_task['summary_description'])
         o('btnDelete').set_sensitive(True)
         if enabled:
             o('btnEnable').set_sensitive(False)
             o('btnDisable').set_sensitive(True)
         else:
             o('btnEnable').set_sensitive(True)
             o('btnDisable').set_sensitive(False)
     else:
         o('txtCondition').set_text("")
         o('txtConsequence').set_text("")
         o('btnDelete').set_sensitive(False)
         o('btnEnable').set_sensitive(False)
         o('btnDisable').set_sensitive(False)
Esempio n. 6
0
 def changed_listAssociation(self, sel):
     o = self.builder.get_object
     m, i = sel.get_selected()
     if i is not None:
         self.selected_association = m[i][0]
         enabled = m[i][7]
         li = retrieve_association(self.selected_association)
         data_cond = retrieve_plugin_data(li[0])
         data_task = retrieve_plugin_data(li[1])
         o('txtCondition').set_text(data_cond['summary_description'])
         o('txtConsequence').set_text(data_task['summary_description'])
         o('btnDelete').set_sensitive(True)
         if enabled:
             o('btnEnable').set_sensitive(False)
             o('btnDisable').set_sensitive(True)
         else:
             o('btnEnable').set_sensitive(True)
             o('btnDisable').set_sensitive(False)
     else:
         o('txtCondition').set_text("")
         o('txtConsequence').set_text("")
         o('btnDelete').set_sensitive(False)
         o('btnEnable').set_sensitive(False)
         o('btnDisable').set_sensitive(False)