当前位置: 首页>>代码示例>>Python>>正文


Python GSetting.set_value方法代码示例

本文整理汇总了Python中ubuntutweak.settings.GSetting.set_value方法的典型用法代码示例。如果您正苦于以下问题:Python GSetting.set_value方法的具体用法?Python GSetting.set_value怎么用?Python GSetting.set_value使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ubuntutweak.settings.GSetting的用法示例。


在下文中一共展示了GSetting.set_value方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: UbuntuTweakWindow

# 需要导入模块: from ubuntutweak.settings import GSetting [as 别名]
# 或者: from ubuntutweak.settings.GSetting import set_value [as 别名]

#.........这里部分代码省略.........
        self.search_page.connect('module_selected', self.on_module_selected)
        admins_page.connect('module_selected', self.on_module_selected)
        self.apps_page.connect('loaded', self.show_apps_page)
        clip_page.connect('load_module', lambda widget, name: self.do_load_module(name))
        clip_page.connect('load_feature', lambda widget, name: self.select_target_feature(name))

        self.mainwindow.show()

        if module:
            self.do_load_module(module)
        elif feature:
            self.select_target_feature(feature)

        accel_group = Gtk.AccelGroup()
        self.search_entry.add_accelerator('activate',
                                          accel_group,
                                          Gdk.KEY_f,
                                          Gdk.ModifierType.CONTROL_MASK,
                                          Gtk.AccelFlags.VISIBLE)
        self.mainwindow.add_accel_group(accel_group)
        thread.start_new_thread(self.preload_proxy_cache, ())

    def show_apps_page(self, widget):
        self.notebook.set_current_page(self.feature_dict['apps'])

    def preload_proxy_cache(self):
        #This function just called to make sure the cache is loaded as soon as possible
        proxy.is_package_installed('ubuntu-tweak')

    def on_search_entry_activate(self, widget):
        widget.grab_focus()
        self.on_search_entry_changed(widget)

    def on_search_entry_changed(self, widget):
        text = widget.get_text()
        self.set_current_module(None, None)

        if text:
            self.notebook.set_current_page(self.feature_dict['search'])
            self.search_page.search(text)
            self.search_entry.set_property('secondary-icon-name', 'edit-clear')
        else:
            self.on_feature_button_clicked(getattr(self, '%s_button' % self.current_feature), self.current_feature)
            self.search_page.clean()
            self.search_entry.set_property('secondary-icon-name', 'edit-find')

    def on_search_entry_icon_press(self, widget, icon_pos, event):
        widget.set_text('')

    def get_module_and_index(self, name):
        index = self.loaded_modules[name]

        return self.modules_index[index], index

    def select_target_feature(self, text):
        toggle_button = getattr(self, '%s_button' % text, None)
        log.info("select_target_feature: %s" % text)
        if toggle_button:
            self.current_feature = text
            toggle_button.set_active(True)

    def _initialize_ui_states(self, widget, splash_window):
        self.window_size_setting = GSetting('com.ubuntu-tweak.tweak.window-size')
        width, height = self.window_size_setting.get_value()
        if width >= 900 and height >= 506:
            self.mainwindow.set_default_size(width, height)

        for feature_button in ('overview_button', 'apps_button', 'admins_button', \
                               'tweaks_button', 'janitor_button'):
            button = getattr(self, feature_button)

            label = button.get_child().get_label()
            button.get_child().set_markup('<b>%s</b>' % label)
            button.get_child().set_use_underline(True)
        splash_window.destroy()

    def _crete_wait_page(self):
        vbox = Gtk.VBox()

        label = Gtk.Label()
        label.set_markup("<span size=\"xx-large\">%s</span>" % \
                        _('Please wait a moment...'))
        label.set_justify(Gtk.Justification.FILL)
        vbox.pack_start(label, False, False, 50)
        hbox = Gtk.HBox()
        vbox.pack_start(hbox, False, False, 0)

        vbox.show_all()

        return vbox

    def on_mainwindow_destroy(self, widget=None):
        allocation = widget.get_allocation()
        self.window_size_setting.set_value((allocation.width, allocation.height))

        Gtk.main_quit()
        try:
            proxy.exit()
        except Exception, e:
            log.error(e)
开发者ID:0xBADCA7,项目名称:ubuntu-tweak,代码行数:104,代码来源:main.py

示例2: JanitorPage

# 需要导入模块: from ubuntutweak.settings import GSetting [as 别名]
# 或者: from ubuntutweak.settings.GSetting import set_value [as 别名]
class JanitorPage(Gtk.VBox, GuiBuilder):
    (JANITOR_CHECK,
     JANITOR_ICON,
     JANITOR_NAME,
     JANITOR_DISPLAY,
     JANITOR_PLUGIN,
     JANITOR_SPINNER_ACTIVE,
     JANITOR_SPINNER_PULSE) = range(7)

    (RESULT_CHECK,
     RESULT_ICON,
     RESULT_NAME,
     RESULT_DISPLAY,
     RESULT_DESC,
     RESULT_PLUGIN,
     RESULT_CRUFT) = range(7)

    max_janitor_view_width = 0

    def __init__(self):
        GObject.GObject.__init__(self)

        self.scan_tasks = []
        self.clean_tasks = []
        self._total_count = 0

        self.set_border_width(6)
        GuiBuilder.__init__(self, 'janitorpage.ui')

        self.autoscan_setting = GSetting('com.ubuntu-tweak.janitor.auto-scan')
        self.autoscan_setting.connect_notify(self.on_autoscan_button_toggled)
        self.plugins_setting = GSetting('com.ubuntu-tweak.janitor.plugins')
        self.view_width_setting = GSetting('com.ubuntu-tweak.janitor.janitor-view-width')

        self.pack_start(self.vbox1, True, True, 0)

        self.connect('realize', self.setup_ui_tasks)
        self.janitor_view.get_selection().connect('changed', self.on_janitor_selection_changed)
        self.plugins_setting.connect_notify(self.update_model, True)

        self.show()

    def on_move_handle(self, widget, gproperty):
        log.debug("on_move_handle: %d", widget.get_property('position'))
        self.view_width_setting.set_value(widget.get_property('position'))

        # cancel the size request, or it will fail to resize
        # TODO why the first scan will make it fail? 
        self.janitor_view.set_size_request(self.max_janitor_view_width, -1)

    def is_auto_scan(self):
        return self.autoscan_setting.get_value()

    @log_func(log)
    def on_result_view_row_activated(self, treeview, path, column):
        iter = self.result_model.get_iter(path)
        cruft = self.result_model[iter][self.RESULT_CRUFT]
        display = self.result_model[iter][self.RESULT_DISPLAY]

        if 'red' in display:
            plugin = self.result_model[iter][self.RESULT_PLUGIN]
            error = plugin.get_property('error')
            self.result_model[iter][self.RESULT_DISPLAY] = '<span color="red"><b>%s</b></span>' % error
        elif hasattr(cruft, 'get_path'):
            path = cruft.get_path()
            if not os.path.isdir(path):
                path = os.path.dirname(path)
            os.system("xdg-open '%s' &" % path)

    def setup_ui_tasks(self, widget):
        self.janitor_model.set_sort_column_id(self.JANITOR_NAME, Gtk.SortType.ASCENDING)

        #add janitor columns
        janitor_column = Gtk.TreeViewColumn()

        renderer = Gtk.CellRendererToggle()
        renderer.connect('toggled', self.on_janitor_check_button_toggled)
        janitor_column.pack_start(renderer, False)
        janitor_column.add_attribute(renderer, 'active', self.JANITOR_CHECK)

        self.janitor_view.append_column(janitor_column)

        janitor_column = Gtk.TreeViewColumn()

        renderer = Gtk.CellRendererPixbuf()
        janitor_column.pack_start(renderer, False)
        janitor_column.add_attribute(renderer, 'pixbuf', self.JANITOR_ICON)
        janitor_column.set_cell_data_func(renderer,
                                          self.icon_column_view_func,
                                          self.JANITOR_ICON)

        renderer = Gtk.CellRendererText()
        renderer.set_property('ellipsize', Pango.EllipsizeMode.END)
        janitor_column.pack_start(renderer, True)
        janitor_column.add_attribute(renderer, 'markup', self.JANITOR_DISPLAY)

        renderer = Gtk.CellRendererSpinner()
        janitor_column.pack_start(renderer, False)
        janitor_column.add_attribute(renderer, 'active', self.JANITOR_SPINNER_ACTIVE)
        janitor_column.add_attribute(renderer, 'pulse', self.JANITOR_SPINNER_PULSE)
#.........这里部分代码省略.........
开发者ID:0tli4nitsa,项目名称:ubuntu-tweak,代码行数:103,代码来源:__init__.py

示例3: JanitorPage

# 需要导入模块: from ubuntutweak.settings import GSetting [as 别名]
# 或者: from ubuntutweak.settings.GSetting import set_value [as 别名]

#.........这里部分代码省略.........

            if cruft_list:
                plugin_dict[plugin] = cruft_list

        self.clean_tasks = list(plugin_dict.items())

        self.do_real_clean_task()
        log.debug("All finished!")

    def do_real_clean_task(self):
        plugin, cruft_list = self.clean_tasks.pop(0)

        log.debug("Call %s to clean cruft" % plugin)
        self._plugin_handler = plugin.connect('cleaned', self.on_plugin_cleaned)
        self._error_handler = plugin.connect('error', self.on_clean_error)
        plugin.clean_cruft(self.get_toplevel(), cruft_list)

    def on_plugin_cleaned(self, plugin, cleaned):
        for handler in (self._plugin_handler, self._error_handler):
            if plugin.handler_is_connected(handler):
                log.debug("Disconnect the cleaned signal, or it will clean many times")
                plugin.disconnect(handler)

        if len(self.clean_tasks) == 0:
            self.on_scan_button_clicked()
        else:
            GObject.timeout_add(300, self.do_real_clean_task)

    def on_clean_error(self, plugin, error):
        self.clean_tasks = []

    def on_autoscan_button_toggled(self, widget):
        if widget.get_active():
            self.autoscan_setting.set_value(True)
            self.scan_button.hide()
        else:
            self.autoscan_setting.set_value(False)
            self.scan_button.show()

    def icon_column_view_func(self, cell_layout, renderer, model, iter, id):
        if model[iter][id] == None:
            renderer.set_property("visible", False)
        else:
            renderer.set_property("visible", True)

    def update_model(self, a=None, b=None, expand=False):
        self.janitor_model.clear()
        self.result_model.clear()
        size_list = []

        loader = ModuleLoader('janitor')
        plugin_to_load = self.janitor_setting.get_value()

        system_text = _('System')
        iter = self.janitor_model.append(None, (None,
                                                icon.get_from_name('ubuntu-logo'),
                                                system_text,
                                                "<b><big>%s</big></b>" % system_text,
                                                None,
                                                None,
                                                None))

        for plugin in loader.get_modules_by_category('system'):
            if plugin.is_user_extension() and plugin.get_name() not in plugin_to_load:
                log.debug("User extension: %s not in setting to load" % plugin.get_name())
                continue
开发者ID:juzerdana,项目名称:ubuntu-tweak,代码行数:70,代码来源:__init__.py

示例4: UbuntuTweakWindow

# 需要导入模块: from ubuntutweak.settings import GSetting [as 别名]
# 或者: from ubuntutweak.settings.GSetting import set_value [as 别名]
class UbuntuTweakWindow(GuiBuilder):
    current_feature = "overview"
    feature_dict = {}
    navigation_dict = {"tweaks": [None, None]}
    # the module name and page index: 'Compiz': 2
    loaded_modules = {}
    # reversed dict: 2: 'CompizClass'
    modules_index = {}

    def __init__(self, feature="", module=""):
        GuiBuilder.__init__(self, file_name="mainwindow.ui")

        tweaks_page = FeaturePage("tweaks")
        admins_page = FeaturePage("admins")
        clip_page = ClipPage()
        apps_page = AppsPage()
        janitor_page = JanitorPage()
        self.preferences_dialog = PreferencesDialog(self.mainwindow)

        self.rencently_used_settings = GSetting("com.ubuntu-tweak.tweak.rencently-used")

        self.feature_dict["overview"] = self.notebook.append_page(clip_page, Gtk.Label())
        self.feature_dict["apps"] = self.notebook.append_page(apps_page, Gtk.Label())
        self.feature_dict["tweaks"] = self.notebook.append_page(tweaks_page, Gtk.Label())
        self.feature_dict["admins"] = self.notebook.append_page(admins_page, Gtk.Label())
        self.feature_dict["janitor"] = self.notebook.append_page(janitor_page, Gtk.Label())
        self.feature_dict["wait"] = self.notebook.append_page(self._crete_wait_page(), Gtk.Label())

        # Always show welcome page at first
        self.mainwindow.connect("realize", self._initialize_ui_states)
        tweaks_page.connect("module_selected", self.on_module_selected)
        admins_page.connect("module_selected", self.on_module_selected)
        clip_page.connect("load_module", lambda widget, name: self.do_load_module(name))
        clip_page.connect("load_feature", lambda widget, name: self.select_target_feature(name))
        self.mainwindow.show()
        self.link_button.hide()

        if module:
            self.do_load_module(module)
        elif feature:
            self.select_target_feature(feature)

    # TODO remove when natty is deprecated
    def on_header_button_press_event(self, widget, event):
        self.mainwindow.begin_move_drag(event.button, event.x_root, event.y_root, event.time)

    def get_module_and_index(self, name):
        index = self.loaded_modules[name]

        return self.modules_index[index], index

    def select_target_feature(self, text):
        toggle_button = getattr(self, "%s_button" % text, None)
        log.info("select_target_feature: %s" % text)
        if toggle_button:
            self.current_feature = text
            toggle_button.set_active(True)

    def _initialize_ui_states(self, widget):
        # TODO implement the search feature
        self.window_size_setting = GSetting("com.ubuntu-tweak.tweak.window-size")
        width, height = self.window_size_setting.get_value()
        if width >= 800 and height >= 480:
            self.mainwindow.set_default_size(width, height)

        self.search_entry.hide()

    def _crete_wait_page(self):
        vbox = Gtk.VBox()

        label = Gtk.Label()
        label.set_markup('<span size="xx-large">%s</span>' % _("Please wait a moment..."))
        label.set_justify(Gtk.Justification.FILL)
        vbox.pack_start(label, False, False, 50)
        hbox = Gtk.HBox()
        vbox.pack_start(hbox, False, False, 0)

        vbox.show_all()

        return vbox

    def on_mainwindow_destroy(self, widget):
        allocation = widget.get_allocation()
        self.window_size_setting.set_value((allocation.width, allocation.height))

        Gtk.main_quit()
        try:
            proxy.exit()
        except Exception, e:
            log.error(e)
开发者ID:nayanapriyankara,项目名称:ubuntu-tweak,代码行数:92,代码来源:main.py

示例5: PreferencesDialog

# 需要导入模块: from ubuntutweak.settings import GSetting [as 别名]
# 或者: from ubuntutweak.settings.GSetting import set_value [as 别名]
class PreferencesDialog(GuiBuilder):
    (CLIP_CHECK,
     CLIP_ICON,
     CLIP_NAME) = range(3)

    (TWEAKS_CHECK,
     TWEAKS_ICON,
     TWEAKS_NAME) = range(3)

    (JANITOR_CHECK,
     JANITOR_NAME) = range(2)

    page_dict = {'overview': 0,
                 'tweaks': 1,
                 'admins': 2,
                 'janitor': 3}

    def __init__(self, parent):
        GuiBuilder.__init__(self, file_name='preferences.ui')

        self.preferences_dialog.set_transient_for(parent)
        self.clips_setting = GSetting('com.ubuntu-tweak.tweak.clips')
        self.tweaks_setting = GSetting('com.ubuntu-tweak.tweak.tweaks')
        self.admins_setting = GSetting('com.ubuntu-tweak.tweak.admins')
        self.janitor_setting = GSetting('com.ubuntu-tweak.janitor.plugins')
        self.clips_location_setting = GSetting('com.ubuntu-tweak.tweak.last-clip-location')
        
        auto_scan_label, auto_scan_switch = WidgetFactory.create("Switch",
                                                label=_("Auto scan:"),
                                                key='com.ubuntu-tweak.janitor.auto-scan',
                                                backend="gsettings")
        pack = GridPack((auto_scan_label, auto_scan_switch))
        self.generic_alignment.add(pack)

        self.generic_alignment.show_all()

    def on_clip_toggle_render_toggled(self, cell, path):
        log.debug("on_clip_toggle_render_toggled")
        self.on_toggle_renderer_toggled(self.clip_model,
                                        path,
                                        self.CLIP_CHECK,
                                        self.CLIP_NAME,
                                        self.clips_setting)

    def on_tweak_toggle_renderer_toggled(self, cell, path):
        log.debug("on_tweaks_toggle_render_toggled")
        self.on_toggle_renderer_toggled(self.tweaks_model,
                                        path,
                                        self.TWEAKS_CHECK,
                                        self.TWEAKS_NAME,
                                        self.tweaks_setting)

    def on_admins_toggle_renderer_toggled(self, cell, path):
        log.debug("on_admins_toggle_render_toggled")
        self.on_toggle_renderer_toggled(self.admins_model,
                                        path,
                                        self.TWEAKS_CHECK,
                                        self.TWEAKS_NAME,
                                        self.admins_setting)

    def on_janitor_cell_renderer_toggled(self, cell, path):
        log.debug("on_admins_toggle_render_toggled")
        self.on_toggle_renderer_toggled(self.janitor_model,
                                        path,
                                        self.JANITOR_CHECK,
                                        self.JANITOR_NAME,
                                        self.janitor_setting)

    def on_toggle_renderer_toggled(self, model, path, check_id, name_id, setting):
        iter = model.get_iter(path)
        checked = not model[iter][check_id]
        model[iter][check_id] = checked

        self._do_update_model(model, check_id, name_id, setting)

    def _do_update_model(self, model, check_id, name_id, setting):
        model_list = []
        for row in model:
            if row[check_id]:
                model_list.append(row[name_id])

        log.debug("on_clip_toggle_render_toggled: %s" % model_list)
        setting.set_value(model_list)

    def run(self, feature='overview'):
        self._update_clip_model()

        for _feature in ModuleLoader.default_features:
            self._update_feature_model(_feature)

        if feature in self.page_dict:
            self.preference_notebook.set_current_page(self.page_dict[feature])

        return self.preferences_dialog.run()

    def hide(self):
        return self.preferences_dialog.hide()

    def on_move_up_button_clicked(self, widget):
        model, iter = self.clip_view.get_selection().get_selected()
#.........这里部分代码省略.........
开发者ID:0tli4nitsa,项目名称:ubuntu-tweak,代码行数:103,代码来源:preferences.py

示例6: SourceEditor

# 需要导入模块: from ubuntutweak.settings import GSetting [as 别名]
# 或者: from ubuntutweak.settings.GSetting import set_value [as 别名]
class SourceEditor(TweakModule):
    __title__ = _('Source Editor')
    __desc__ = _('Manually edit your software sources to suit your needs.')
    __icon__ = 'system-software-update'
    __category__ = 'system'

    def __init__(self):
        TweakModule.__init__(self, 'sourceeditor.ui')

        self.auto_backup_setting = GSetting('com.ubuntu-tweak.tweak.auto-backup')

        self.textview = SourceView(SOURCES_LIST)
        self.textview.set_sensitive(False)
        self.sw1.add(self.textview)
        self.textview.get_buffer().connect('changed', self.on_buffer_changed)

        un_lock = PolkitButton(PK_ACTION_SOURCE)
        un_lock.connect('authenticated', self.on_polkit_action)
        self._authenticated = False
        self.hbuttonbox2.pack_end(un_lock, False, False, 0)

        self.list_selection = self.list_view.get_selection()
        self.list_selection.connect("changed", self.on_selection_changed)

        self.infobar = Gtk.InfoBar()
        self.info_label = Gtk.Label('Current view the list')
        self.info_label.set_alignment(0, 0.5)
        self.infobar.get_content_area().add(self.info_label)
        self.infobar.connect("response", self.on_infobar_response)
        self.infobar.add_button(Gtk.STOCK_CLOSE, Gtk.ResponseType.CLOSE)
        self.infobar.hide()
        self.text_vbox.pack_start(self.infobar, False, False, 0)

        self.connect('realize', self.on_ui_realize)
        self.add_start(self.hbox1)

    def on_ui_realize(self, widget):
        self.infobar.hide()
        self.update_source_model()
        self.list_selection.select_iter(self.list_model.get_iter_first())
        self.auto_backup_button.set_active(self.auto_backup_setting.get_value())
        self.auto_backup_button.connect('toggled', self.on_auto_backup_button_toggled)

    def set_infobar_backup_info(self, name, list_name):
        self.info_label.set_markup(_('You\'re viewing the backup "<b>%s</b>" for'
                                   '"<b>%s</b>"') % (name, list_name))

    def on_auto_backup_button_toggled(self, widget):
        self.auto_backup_setting.set_value(widget.get_active())

    def on_infobar_response(self, widget, response_id):
        model, iter = self.list_selection.get_selected()

        if iter:
            list_path = model[iter][0]

            self.textview.set_path(list_path)
            self.textview.update_content()

            self.save_button.set_sensitive(False)
            self.redo_button.set_sensitive(False)

            self.infobar.hide()

    def on_selection_changed(self, selection):
        model, iter = selection.get_selected()

        if iter:
            self.textview.set_path(model[iter][0])
            self.update_sourceslist()
            self.update_backup_model()

    def update_source_model(self):
        model = self.list_model

        model.clear()

        model.append(('/etc/apt/sources.list', 'sources.list'))

        SOURCE_LIST_D = '/etc/apt/sources.list.d'

        if not os.path.exists(SOURCE_LIST_D):
            self.source_combo.set_active(0)
            return

        files = glob.glob(SOURCE_LIST_D + '/*.list')
        files.sort()

        for file in files:
            if os.path.isdir(file):
                continue
            model.append((file, os.path.basename(file)))

    def update_backup_model(self):
        def file_cmp(f1, f2):
            return cmp(os.stat(f1).st_ctime, os.stat(f2).st_ctime)

        model, iter = self.list_selection.get_selected()

        if iter:
#.........这里部分代码省略.........
开发者ID:Thongor,项目名称:ubuntu-tweak,代码行数:103,代码来源:sourceeditor.py

示例7: UbuntuTweakWindow

# 需要导入模块: from ubuntutweak.settings import GSetting [as 别名]
# 或者: from ubuntutweak.settings.GSetting import set_value [as 别名]
class UbuntuTweakWindow(GuiBuilder):
    current_feature = 'overview'
    feature_dict = {}
    navigation_dict = {'tweaks': [None, None]}
    # the module name and page index: 'Compiz': 2
    loaded_modules = {}
    # reversed dict: 2: 'CompizClass'
    modules_index = {}

    def __init__(self, feature='', module=''):
        GuiBuilder.__init__(self, file_name='mainwindow.ui')

        self.window_size_setting = GSetting('com.ubuntu-tweak.tweak.window-size')
        width, height = self.window_size_setting.get_value()
        if width >= 800 and height >= 480:
            self.mainwindow.set_default_size(width, height)

        Gtk.rc_parse(os.path.join(DATA_DIR, 'theme/ubuntu-tweak.rc'))

        tweaks_page = FeaturePage('tweaks')
        admins_page = FeaturePage('admins')
        clip_page = ClipPage()
#        apps_page = AppsPage()
        janitor_page = JanitorPage()
        self.preferences_dialog = PreferencesDialog(self.mainwindow)

        self.rencently_used_settings = GSetting('com.ubuntu-tweak.tweak.rencently-used')

        self.feature_dict['overview'] = self.notebook.append_page(clip_page, Gtk.Label())
#        self.feature_dict['apps'] = self.notebook.append_page(apps_page, Gtk.Label())
        self.feature_dict['tweaks'] = self.notebook.append_page(tweaks_page, Gtk.Label())
        self.feature_dict['admins'] = self.notebook.append_page(admins_page, Gtk.Label())
        self.feature_dict['janitor'] = self.notebook.append_page(janitor_page, Gtk.Label())
        self.feature_dict['wait'] = self.notebook.append_page(self._crete_wait_page(),
                                                           Gtk.Label())

        # Always show welcome page at first
        self.mainwindow.connect('realize', self._initialize_ui_states)
        tweaks_page.connect('module_selected', self.on_module_selected)
        admins_page.connect('module_selected', self.on_module_selected)
        clip_page.connect('load_module', lambda widget, name: self.load_module(name))
        clip_page.connect('load_feature', lambda widget, name: self.select_target_feature(name))
        self.mainwindow.show()
        self.link_button.hide()

        if module:
            self.load_module(module)
        elif feature:
            self.select_target_feature(feature)

    def on_header_button_press_event(self, widget, event):
        self.mainwindow.begin_move_drag(event.button,
                                        event.x_root,
                                        event.y_root,
                                        event.time)

    def get_module_and_index(self, name):
        index = self.loaded_modules[name]

        return self.modules_index[index], index

    def select_target_feature(self, text):
        toggle_button = getattr(self, '%s_button' % text, None)
        log.info("select_target_feature: %s" % text)
        if toggle_button:
            self.current_feature = text
            toggle_button.set_active(True)

    def _initialize_ui_states(self, widget):
        #TODO implement the search feature
        self.search_entry.hide()

    def _crete_wait_page(self):
        vbox = Gtk.VBox()

        label = Gtk.Label()
        label.set_markup("<span size=\"xx-large\">%s</span>" % \
                        _('Please wait a moment...'))
        label.set_justify(Gtk.Justification.FILL)
        vbox.pack_start(label, False, False, 50)
        hbox = Gtk.HBox()
        vbox.pack_start(hbox, False, False, 0)

        vbox.show_all()

        return vbox

    def on_mainwindow_destroy(self, widget):
        allocation = widget.get_allocation()
        self.window_size_setting.set_value((allocation.width, allocation.height))

        Gtk.main_quit()
        try:
            proxy.exit()
        except Exception, e:
            log.error(e)
开发者ID:Thongor,项目名称:ubuntu-tweak,代码行数:98,代码来源:main.py


注:本文中的ubuntutweak.settings.GSetting.set_value方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。