예제 #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)
예제 #2
0
 def get_pane(self):
     if self.plugin_panel is None:
         o = self.builder.get_object
         r_text = Gtk.CellRendererText()
         r_pixbuf = Gtk.CellRendererPixbuf()
         store = Gtk.ListStore(GdkPixbuf.Pixbuf, str, str)
         store.append(
             [load_pixbuf('info'),
              _("Information"), 'dialog-information'])
         store.append(
             [load_pixbuf('questions'),
              _("Question"), 'dialog-question'])
         store.append(
             [load_pixbuf('high_priority'),
              _("Warning"), 'dialog-warning'])
         store.append([load_pixbuf('cancel'), _("Error"), 'dialog-error'])
         cb = o('cbIcon')
         cb.pack_start(r_text, True)
         cb.add_attribute(r_text, 'text', 1)
         cb.pack_start(r_pixbuf, False)
         cb.add_attribute(r_pixbuf, 'pixbuf', 0)
         cb.set_model(store)
         self.plugin_panel = o('viewPlugin')
         self.builder.connect_signals(self)
     return self.plugin_panel
예제 #3
0
 def refresh_Summary(self):
     p = self.builder_panes.get_object
     store = Gtk.ListStore(GdkPixbuf.Pixbuf, str, str)
     description = self.plugin_cond.summary_description
     if description:
         store.append([load_pixbuf(self.plugin_cond.icon),
                       RESOURCES.UI_SUMMARY_CONDITION, description])
     description = self.plugin_task.summary_description
     if description:
         store.append([load_pixbuf(self.plugin_task.icon),
                       RESOURCES.UI_SUMMARY_CONSEQUENCE, description])
     l = p('listSummary')
     l.set_model(store)
예제 #4
0
    def __init__(self):
        self.builder = Gtk.Builder().new_from_string(ui_app_wizard_master, -1)
        self.builder.connect_signals(self)
        self.builder.set_translation_domain(APP_NAME)
        self.builder_panes = Gtk.Builder().new_from_string(
            ui_app_wizard_panes, -1)
        self.builder_panes.connect_signals(self)
        self.builder_panes.set_translation_domain(APP_NAME)
        o = self.builder.get_object
        p = self.builder_panes.get_object
        self.dialog = o('dlgWhenWizardMaster')
        icon = load_pixbuf(_WIZARD_WIZARD_ICON)
        o('imgDeco').set_from_file(
            os.path.join(APP_GRAPHICS_FOLDER, 'wizard-side.png'))
        self.dialog.set_icon(icon)

        self.dialog_about = o('dlgAbout')
        self.dialog_about.set_icon(icon)
        self.dialog_about.set_logo(load_pixbuf(_WIZARD_WIZARD_ICON))
        self.dialog_about.set_program_name(APP_SHORTNAME)
        self.dialog_about.set_website(APP_URL)
        self.dialog_about.set_copyright(APP_COPYRIGHT)
        self.dialog_about.set_comments(APP_LONGDESC)
        self.dialog_about.set_version(APP_VERSION)

        self.pane_TaskSel = self.get_view_TaskSel()
        self.pane_TaskDef = None
        self.pane_CondSel = self.get_view_CondSel()
        self.pane_CondDef = None
        self.pane_Summary = self.get_view_Summary()
        self.pane_Finish = self.get_view_Finish()
        self.pane_TaskDef_changed = False
        self.pane_CondDef_changed = False
        self.pane_CondSel_selected = False

        self.btntext_prev = o('btnBack').get_label()
        self.btntext_next = o('btnForward').get_label()

        self.step_index = 0
        self.current_pane = None
        self.plugin_task = None
        self.plugin_cond = None
        self.enable_next = False
        self.enable_prev = True
        self.register_error = False
        self.change_pane()
        self.refresh_buttons()

        # configuration
        self.direct_register = True
예제 #5
0
 def changed_cbCondType(self, cb):
     p = self.builder_panes.get_object
     v = cb.get_active()
     model = cb.get_model()
     category = model[v][1]
     store = Gtk.ListStore(str, GdkPixbuf.Pixbuf, str, str)
     related_plugins = (
         m for m in all_plugins if
         all_plugins[m].category == category and
         all_plugins[m].plugin_type == PLUGIN_CONST.PLUGIN_TYPE_CONDITION)
     sorted_plugins = [(all_plugins[m].name, m) for m in related_plugins]
     sorted_plugins.sort()
     for x in sorted_plugins:
         m = x[1]
         if all_plugins[m].enabled:
             elem = [
                 all_plugins[m].basename,
                 load_pixbuf(all_plugins[m].icon),
                 all_plugins[m].name,
                 all_plugins[m].description,
             ]
             store.append(elem)
     l = p('listConditions')
     l.set_model(store)
     self.pane_CondSel_selected = True
     self.enable_next = False    # register action to the system
     self.refresh_buttons()
예제 #6
0
    def __init__(self, params):
        self.builder = Gtk.Builder().new_from_string(
            ui_app_manager_paramidf, -1)
        self.builder.connect_signals(self)
        self.builder.set_translation_domain(APP_NAME)
        o = self.builder.get_object
        self.dialog = o('dlgConfigItems')
        icon = load_pixbuf(_WIZARD_MANAGER_DLGICON)
        self.dialog.set_icon(icon)
        self.ctl_dict = {}
        self.chk_dict = {}
        self.values = None

        scroll = o('boxEntries')
        for param in params:
            param_name = param[1:]
            param_type, desc, default, ctl, choices = params[param]
            if param_type == 'string':
                entry = entry_Text(param_name, desc, default)
            elif param_type == 'integer':
                entry = entry_Integer(param_name, desc, str(default))
            elif param_type == 'real':
                entry = entry_Real(param_name, desc, str(default))
            elif param_type == 'choice':
                entry = entry_Choice(param_name, desc, default, choices)
            elif param_type == 'file':
                entry = entry_File(param_name, desc, default)
            elif param_type == 'directory':
                entry = entry_Dir(param_name, desc, default)
            self.ctl_dict[param] = entry
            self.chk_dict[param] = ctl
            scroll.pack_start(entry.widget, False, False, 0)
        scroll.pack_start(o('fixFiller'), True, True, 0)
예제 #7
0
def retrieve_action_history():
    proxy = when_proxy()
    if proxy is None:
        return None
    history = []
    when_history = proxy.GetHistoryEntries()
    when_history.reverse()
    for x in when_history:
        e = x.split(';')
        if e[3].startswith(_PLUGIN_UNIQUE_ID_MAGIC) and \
           e[4].startswith(_PLUGIN_UNIQUE_ID_MAGIC):
            plugin_task = retrieve_plugin(e[3])
            plugin_cond = retrieve_plugin(e[4])
            if plugin_task and plugin_cond:
                d = {
                    'datetime':
                    e[1],
                    'duration':
                    float(e[2]),
                    'task_id':
                    e[3],
                    'task_name':
                    plugin_task.name,
                    'task_icon':
                    load_pixbuf(plugin_task.icon, not plugin_task.stock),
                    'cond_id':
                    e[4],
                    'cond_name':
                    plugin_cond.name,
                    'cond_icon':
                    load_pixbuf(plugin_cond.icon, not plugin_cond.stock),
                    'success':
                    bool(e[5] == 'success'),
                }
                history.append(d)
    return history
예제 #8
0
 def fill_cbSelectUninstallPlugin(self, obj):
     o = self.builder.get_object
     store = Gtk.ListStore(str, GdkPixbuf.Pixbuf)
     user_plugins = user_plugins_names()
     active_plugins = active_plugins_names()
     removable_plugins = []
     for x in user_plugins:
         if x not in active_plugins:
             removable_plugins.append(x)
     for x in removable_plugins:
         store.append([
             x,
             load_pixbuf(all_plugins[x].icon),
         ])
     o('cbSelectUninstallPlugin').set_model(store)
     self.selected_uninstallplugin = None
예제 #9
0
 def fill_listHistory(self, obj):
     o = self.builder.get_object
     h = retrieve_action_history()
     l = o('listHistory')
     store = Gtk.ListStore(str,
                           GdkPixbuf.Pixbuf, str,
                           GdkPixbuf.Pixbuf,
                           GdkPixbuf.Pixbuf, str,
                           GdkPixbuf.Pixbuf)
     arrow = load_pixbuf('right')
     for x in h:
         store.append([
             "%s (%.2fs)" % (x['datetime'].split()[1], x['duration']),
             x['cond_icon'],
             x['cond_name'],
             arrow,
             x['task_icon'],
             x['task_name'],
             self.glyph_success if x['success'] else self.glyph_failure,
         ])
     l.set_model(store)
예제 #10
0
 def get_view_CondSel(self):
     p = self.builder_panes.get_object
     store = Gtk.ListStore(GdkPixbuf.Pixbuf, str, str)
     store.append([load_pixbuf('clock'),
                   PLUGIN_CONST.CATEGORY_COND_TIME,
                   RESOURCES.UI_COMBO_CATEGORY_COND_TIME])
     store.append([load_pixbuf('folder'),
                   PLUGIN_CONST.CATEGORY_COND_FILESYSTEM,
                   RESOURCES.UI_COMBO_CATEGORY_COND_FILESYSTEM])
     store.append([load_pixbuf('link'),
                   PLUGIN_CONST.CATEGORY_COND_NETWORK,
                   RESOURCES.UI_COMBO_CATEGORY_COND_NETWORK])
     store.append([load_pixbuf('electricity'),
                   PLUGIN_CONST.CATEGORY_COND_POWER,
                   RESOURCES.UI_COMBO_CATEGORY_COND_POWER])
     store.append([load_pixbuf('clapperboard'),
                   PLUGIN_CONST.CATEGORY_COND_EVENT,
                   RESOURCES.UI_COMBO_CATEGORY_COND_EVENT])
     store.append([load_pixbuf('mind_map'),
                   PLUGIN_CONST.CATEGORY_COND_MISC,
                   RESOURCES.UI_COMBO_CATEGORY_COND_MISC])
     r_text = Gtk.CellRendererText()
     r_text_e = Gtk.CellRendererText()
     r_text_e.set_property("ellipsize", Pango.EllipsizeMode.MIDDLE)
     r_pixbuf = Gtk.CellRendererPixbuf()
     cb = p('cbCondType')
     cb.pack_start(r_text, True)
     cb.add_attribute(r_text, 'text', 2)
     cb.pack_start(r_pixbuf, False)
     cb.add_attribute(r_pixbuf, 'pixbuf', 0)
     cb.set_model(store)
     l = p('listConditions')
     column_icon = Gtk.TreeViewColumn("Icon", r_pixbuf, pixbuf=1)
     column_name = Gtk.TreeViewColumn("Name", r_text, text=2)
     column_desc = Gtk.TreeViewColumn("Description", r_text_e, text=3)
     l.append_column(column_icon)
     l.append_column(column_name)
     l.append_column(column_desc)
     return p('viewCondSel')
예제 #11
0
 def get_view_TaskSel(self):
     p = self.builder_panes.get_object
     store = Gtk.ListStore(GdkPixbuf.Pixbuf, str, str)
     store.append([load_pixbuf('process'),
                   PLUGIN_CONST.CATEGORY_TASK_APPS,
                   RESOURCES.UI_COMBO_CATEGORY_APPLICATIONS])
     store.append([load_pixbuf('settings'),
                   PLUGIN_CONST.CATEGORY_TASK_SETTINGS,
                   RESOURCES.UI_COMBO_CATEGORY_SETTINGS])
     store.append([load_pixbuf('key'),
                   PLUGIN_CONST.CATEGORY_TASK_SESSION,
                   RESOURCES.UI_COMBO_CATEGORY_SESSION])
     store.append([load_pixbuf('electricity'),
                   PLUGIN_CONST.CATEGORY_TASK_POWER,
                   RESOURCES.UI_COMBO_CATEGORY_POWER])
     store.append([load_pixbuf('folder'),
                   PLUGIN_CONST.CATEGORY_TASK_FILEOPS,
                   RESOURCES.UI_COMBO_CATEGORY_FILEOPS])
     store.append([load_pixbuf('mind_map'),
                   PLUGIN_CONST.CATEGORY_TASK_MISC,
                   RESOURCES.UI_COMBO_CATEGORY_MISC])
     r_text = Gtk.CellRendererText()
     r_text_e = Gtk.CellRendererText()
     r_text_e.set_property("ellipsize", Pango.EllipsizeMode.MIDDLE)
     r_pixbuf = Gtk.CellRendererPixbuf()
     cb = p('cbCategory')
     cb.pack_start(r_text, True)
     cb.add_attribute(r_text, 'text', 2)
     cb.pack_start(r_pixbuf, False)
     cb.add_attribute(r_pixbuf, 'pixbuf', 0)
     cb.set_model(store)
     l = p('listActions')
     column_icon = Gtk.TreeViewColumn("Icon", r_pixbuf, pixbuf=1)
     column_name = Gtk.TreeViewColumn("Name", r_text, text=2)
     column_desc = Gtk.TreeViewColumn("Description", r_text_e, text=3)
     l.append_column(column_icon)
     l.append_column(column_name)
     l.append_column(column_desc)
     return p('viewTaskSel')
예제 #12
0
    def __init__(self):
        self.builder = Gtk.Builder().new_from_string(ui_app_manager, -1)
        self.builder.connect_signals(self)
        self.builder.set_translation_domain(APP_NAME)
        o = self.builder.get_object
        self.dialog = o('dlgManager')
        icon = load_pixbuf(_WIZARD_MANAGER_DLGICON)
        self.glyph_success = load_pixbuf('success')
        self.glyph_failure = load_pixbuf('failure')
        self.glyph_enabled = load_pixbuf('enabled')
        self.glyph_disabled = load_pixbuf('disabled')
        self.dialog.set_icon(icon)

        self.dialog_about = o('dlgAbout')
        self.dialog_about.set_icon(icon)
        self.dialog_about.set_logo(load_pixbuf(_WIZARD_MANAGER_ICON))
        self.dialog_about.set_program_name(APP_SHORTNAME)
        self.dialog_about.set_website(APP_URL)
        self.dialog_about.set_copyright(APP_COPYRIGHT)
        self.dialog_about.set_comments(APP_LONGDESC)
        self.dialog_about.set_version(APP_VERSION)

        # dialog data
        self.selected_association = None
        self.selected_uninstallplugin = None
        self.selected_unimportidf = None
        self.install_package = None
        self.import_idf = None

        # default sensitivity and checked states
        o('btnDelete').set_sensitive(False)
        o('btnDeleteAll').set_sensitive(False)
        o('btnInstall').set_sensitive(False)
        o('btnUninstall').set_sensitive(False)
        o('btnImport').set_sensitive(False)
        o('btnUnimport').set_sensitive(False)
        if APP_BIN_FOLDER.startswith('/usr'):
            o('chkDesktopIcons').set_sensitive(False)

        # prepare controls
        r_text = Gtk.CellRendererText()
        r_text_e = Gtk.CellRendererText()
        r_text_e.set_property('ellipsize', Pango.EllipsizeMode.MIDDLE)
        r_pixbuf = Gtk.CellRendererPixbuf()
        column_cond_active = Gtk.TreeViewColumn(
            RESOURCES.UI_COLUMN_HEAD_ICON, r_pixbuf, pixbuf=6)
        column_cond_icon = Gtk.TreeViewColumn(
            RESOURCES.UI_COLUMN_HEAD_ICON, r_pixbuf, pixbuf=1)
        column_cond_name = Gtk.TreeViewColumn(
            RESOURCES.UI_COLUMN_HEAD_CONDITION, r_text, text=2)
        column_cond_name.set_expand(True)
        column_arrow = Gtk.TreeViewColumn(
            RESOURCES.UI_COLUMN_HEAD_ICON, r_pixbuf, pixbuf=3)
        column_task_icon = Gtk.TreeViewColumn(
            RESOURCES.UI_COLUMN_HEAD_ICON, r_pixbuf, pixbuf=4)
        column_task_name = Gtk.TreeViewColumn(
            RESOURCES.UI_COLUMN_HEAD_TASK, r_text, text=5)
        column_task_name.set_expand(True)
        l = o('listAssociation')
        l.append_column(column_cond_active)
        l.append_column(column_cond_icon)
        l.append_column(column_cond_name)
        l.append_column(column_arrow)
        l.append_column(column_task_icon)
        l.append_column(column_task_name)
        self.fill_listAssociations(None)

        column_cond_time = Gtk.TreeViewColumn(
            RESOURCES.UI_COLUMN_HEAD_TIME, r_text, text=0)
        column_cond_icon = Gtk.TreeViewColumn(
            RESOURCES.UI_COLUMN_HEAD_ICON, r_pixbuf, pixbuf=1)
        column_cond_name = Gtk.TreeViewColumn(
            RESOURCES.UI_COLUMN_HEAD_CONDITION, r_text, text=2)
        column_cond_name.set_expand(True)
        column_arrow = Gtk.TreeViewColumn(
            RESOURCES.UI_COLUMN_HEAD_ICON, r_pixbuf, pixbuf=3)
        column_task_icon = Gtk.TreeViewColumn(
            RESOURCES.UI_COLUMN_HEAD_ICON, r_pixbuf, pixbuf=4)
        column_task_name = Gtk.TreeViewColumn(
            RESOURCES.UI_COLUMN_HEAD_TASK, r_text, text=5)
        column_task_name.set_expand(True)
        column_outcome = Gtk.TreeViewColumn(
            RESOURCES.UI_COLUMN_HEAD_OUTCOME, r_pixbuf, pixbuf=6)
        l = o('listHistory')
        l.append_column(column_cond_time)
        l.append_column(column_cond_icon)
        l.append_column(column_cond_name)
        l.append_column(column_arrow)
        l.append_column(column_task_icon)
        l.append_column(column_task_name)
        l.append_column(column_outcome)
        self.fill_listHistory(None)

        cb = o('cbSelectUninstallPlugin')
        cb.pack_start(r_text, True)
        cb.add_attribute(r_text, 'text', 0)
        cb.pack_start(r_pixbuf, False)
        cb.add_attribute(r_pixbuf, 'pixbuf', 1)
        self.fill_cbSelectUninstallPlugin(None)

        cb = o('cbSelectUnimport')
        cb.pack_start(r_text, True)
        cb.add_attribute(r_text, 'text', 0)
        self.fill_cbSelectUnimport(None)

        # visible sections of multi-pane pages
        self.changed_action_rbInstall(None)
        self.changed_action_rbImport(None)