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


Python config.TweakSettings类代码示例

本文整理汇总了Python中ubuntutweak.common.config.TweakSettings的典型用法代码示例。如果您正苦于以下问题:Python TweakSettings类的具体用法?Python TweakSettings怎么用?Python TweakSettings使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: __init__

 def __init__(self, parent=None):
     DownloadDialog.__init__(
         self,
         url=TweakSettings.get_url(),
         title=_("Download Ubuntu Tweak %s") % TweakSettings.get_version(),
         parent=parent,
     )
开发者ID:actiononmail,项目名称:ubuntu-tweak,代码行数:7,代码来源:mainwindow.py

示例2: setup_window_preference

    def setup_window_preference(self):
        table = self.worker.get_object('table1')

        height, width = TweakSettings.get_window_size()

        win_width = WidgetFactory.create('GconfSpinButton',
                                        key = 'window_width', 
                                        min = 640, max = 1280, step = 1)
        win_width.show()
        win_width.connect('value-changed', self.on_value_changed)
        table.attach(win_width, 1, 3, 0, 1)

        win_height = WidgetFactory.create('GconfSpinButton',
                                          key = 'window_height', 
                                          min = 480, max = 1280, step = 1)
        win_height.show()
        win_height.connect('value-changed', self.on_value_changed)
        table.attach(win_height, 1, 3, 1, 2)

        toolbar_size = WidgetFactory.create('GconfSpinButton',
                                            key = 'toolbar_size', 
                                            min = 100, max = 500, step = 1)
        toolbar_size.show()
        toolbar_size.connect('value-changed', self.on_value_changed)
        table.attach(toolbar_size, 1, 3, 2, 3)
开发者ID:DigGe,项目名称:ubuntu-tweak,代码行数:25,代码来源:preferences.py

示例3: set_enable

    def set_enable(self, key, enable):
        # To make other module use the source enable feature, move the logical to here
        # So that other module can call
        gpg_key = self.get_key(key)
        url = self.get_url(key)
        distro = self.get_distro(key)
        comps = self.get_comps(key)
        comment = self.get_name(key)
        package = self.get_slug(key)

        if gpg_key:
            proxy.add_apt_key_from_content(gpg_key)

        if not comps and distro:
            distro = distro + '/'
        elif not comps and not distro:
            distro = './'

        if TweakSettings.get_separated_sources():
            result = proxy.set_separated_entry(url, distro, comps,
                                               comment, enable, package)
        else:
            result = proxy.set_entry(url, distro, comps, comment, enable)

        return str(result)
开发者ID:priteshdesai,项目名称:ubuntu-tweak,代码行数:25,代码来源:sourcecenter.py

示例4: __init__

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

        set_label_for_stock_button(self.sync_button, _('_Sync'))

        self.to_add = []
        self.to_rm = []

        self.package_worker = PACKAGE_WORKER
        self.url = APP_VERSION_URL

        self.cateview = CategoryView(os.path.join(APPCENTER_ROOT, 'cates.json'))
        self.cate_selection = self.cateview.get_selection()
        self.cate_selection.connect('changed', self.on_category_changed)
        self.left_sw.add(self.cateview)

        self.appview = AppView()
        self.appview.update_model()
        self.appview.sort_model()
        self.appview.connect('changed', self.on_app_status_changed)
        self.right_sw.add(self.appview)

        self.update_timestamp()
        self.show_all()

        UPDATE_SETTING.set_value(False)
        UPDATE_SETTING.connect_notify(self.on_have_update, data=None)

        if TweakSettings.get_sync_notify():
            thread.start_new_thread(self.check_update, ())
        gobject.timeout_add(60000, self.update_timestamp)

        self.reparent(self.main_vbox)
开发者ID:ubuntutweak,项目名称:ubuntu-tweak,代码行数:33,代码来源:appcenter.py

示例5: check_version

    def check_version(self):
        gtk.gdk.threads_enter()

        version = TweakSettings.get_version()
        if version > VERSION:
            dialog = QuestionDialog(
                _(
                    "A newer version: %s is available online.\nWould you like to update?\n\nNote: if you prefer to update from the source code, you can disable this feature in Preferences."
                )
                % version,
                title=_("Software Update"),
            )

            update = False

            if dialog.run() == gtk.RESPONSE_YES:
                update = True
            dialog.destroy()

            if update:
                dialog = UpdateDialog(parent=self.get_toplevel())
                dialog.run()
                dialog.destroy()

        gtk.gdk.threads_leave()
开发者ID:actiononmail,项目名称:ubuntu-tweak,代码行数:25,代码来源:mainwindow.py

示例6: __init__

    def __init__(self):
        TweakModule.__init__(self)

        self.__setting = TweakSettings()

        changeicon_hbox = self.create_change_icon_hbox()

        box = ListPack(_("Panel Settings"), (
                    WidgetFactory.create("GconfCheckButton", 
                                    label=_("Display warning when removing a panel"),
                                    enable_reset=True,
                                    key="confirm_panel_remove"),
                    WidgetFactory.create("GconfCheckButton", 
                                    label=_("Complete lockdown of all panels"),
                                    enable_reset=True,
                                    key="locked_down"),
                    WidgetFactory.create("GconfCheckButton", 
                                    label=_("Enable panel animations"),
                                    enable_reset=True,
                                    key="enable_animations"),
            ))
        self.add_start(box, False, False, 0)

        box = ListPack(_("Menu Settings"), (
                    WidgetFactory.create("GconfCheckButton", 
                                    label=_("Show Input Method menu in the context menu"),
                                    enable_reset=True,
                                    key="show_input_method_menu"),
                    WidgetFactory.create("GconfCheckButton",
                                    label=_("Show Unicode Control Character menu in the context menu"),
                                    enable_reset=True,
                                    key="show_unicode_menu"),
                    WidgetFactory.create("GconfCheckButton",
                                    label=_('Show icons in menus'),
                                    enable_reset=True,
                                    key='/desktop/gnome/interface/menus_have_icons'),
                    WidgetFactory.create("GconfCheckButton",
                                    label=_('Show icons on buttons'),
                                    enable_reset=True,
                                    key='/desktop/gnome/interface/buttons_have_icons'),
                    changeicon_hbox,
            ))
        self.add_start(box, False, False, 0)

        box = ListPack(_("Screensaver"), (
                    WidgetFactory.create("GconfCheckButton", 
                                         label=_("Enable user switching whilst screen is locked."),
                                         enable_reset=True,
                                         key="user_switch_enabled"),
            ))
        self.add_start(box, False, False, 0)

        self.recently_used = gtk.CheckButton(_('Enable system-wide "Recent Documents" list'))
        self.recently_used.connect('toggled', self.colleague_changed)
        self.recently_used.set_active(self.get_state())
        box = ListPack(_("History"), (
                    self.recently_used,
            ))
        self.add_start(box, False, False, 0)
开发者ID:jonolumb,项目名称:ubuntu-tweak,代码行数:59,代码来源:gnomesettings.py

示例7: __init__

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

        self.url = SOURCE_VERSION_URL
        set_label_for_stock_button(self.sync_button, _('_Sync'))

        self.cateview = CategoryView(os.path.join(SOURCE_ROOT, 'cates.json'))
        self.cate_selection = self.cateview.get_selection()
        self.cate_selection.connect('changed', self.on_category_changed)
        self.left_sw.add(self.cateview)

        self.sourceview = SourcesView()
        self.sourceview.connect('sourcechanged', self.on_source_changed)
        self.sourceview.selection.connect('changed', self.on_selection_changed)
        self.sourceview.set_sensitive(False)
        self.sourceview.set_rules_hint(True)
        self.right_sw.add(self.sourceview)

        self.expander = gtk.Expander(_('Details'))
        self.vbox1.pack_start(self.expander, False, False, 0)
        self.sourcedetail = SourceDetail()
        self.expander.set_sensitive(False)
        self.expander.add(self.sourcedetail)

        un_lock = PolkitButton()
        un_lock.connect('changed', self.on_polkit_action)
        self.hbox2.pack_end(un_lock, False, False, 0)
        self.hbox2.reorder_child(un_lock, 0)

        #TODO when server is ready, work on it again
#        try:
#            if os.getenv('LANG').startswith('zh_CN'):
#                if TweakSettings.get_use_mirror_ppa():
#                    gobject.idle_add(self.start_check_cn_ppa)
#                else:
#                    self.sourceview.unconver_ubuntu_cn_mirror()
#        except AttributeError:
#            pass

#        CONFIG.get_client().notify_add('/apps/ubuntu-tweak/use_mirror_ppa',
#                                       self.value_changed)

        self.update_timestamp()
        UPDATE_SETTING.set_value(False)
        UPDATE_SETTING.connect_notify(self.on_have_update, data=None)

        if TweakSettings.get_sync_notify():
            thread.start_new_thread(self.check_update, ())
        gobject.timeout_add(60000, self.update_timestamp)

        self.reparent(self.main_vbox)
开发者ID:ubuntutweak,项目名称:ubuntu-tweak,代码行数:51,代码来源:sourcecenter.py

示例8: do_source_enable

    def do_source_enable(self, iter, enable):
        """
        Do the really source enable or disable action by iter
        Only emmit signal when source is changed
        """
        model = self.modelfilter.get_model()

        url = model.get_value(iter, self.COLUMN_URL)
        icon = model.get_value(iter, self.COLUMN_LOGO)
        distro = model.get_value(iter, self.COLUMN_DISTRO)
        comment = model.get_value(iter, self.COLUMN_NAME)
        package = model.get_value(iter, self.COLUMN_SLUG)
        comps = model.get_value(iter, self.COLUMN_COMPS)
        key = model.get_value(iter, self.COLUMN_KEY)

        pre_status = self.get_sourcelist_status(url)

        if key:
            proxy.add_apt_key_from_content(key)

        if not comps and distro:
            distro = distro + "/"
        elif not comps and not distro:
            distro = "./"

        if TweakSettings.get_separated_sources():
            result = proxy.set_separated_entry(url, distro, comps, comment, enable, package)
        else:
            result = proxy.set_entry(url, distro, comps, comment, enable)

        if str(result) == "enabled":
            model.set(iter, self.COLUMN_ENABLED, True)
        else:
            model.set(iter, self.COLUMN_ENABLED, False)

        if pre_status != enable:
            self.emit("sourcechanged")

        if enable:
            notify = pynotify.Notification(
                _("New source has been enabled"),
                _("%s is enabled now, Please click the refresh button to update the application cache.") % comment,
            )
            notify.set_icon_from_pixbuf(icon)
            notify.set_hint_string("x-canonical-append", "")
            notify.show()
开发者ID:oldturkeybuzzard,项目名称:ubuntu-tweak,代码行数:46,代码来源:sourcecenter.py

示例9: do_source_enable

    def do_source_enable(self, iter, enable):
        '''
        Do the really source enable or disable action by iter
        Only emmit signal when source is changed
        '''
        model = self.modelfilter.get_model()

        url = model.get_value(iter, self.COLUMN_URL)
        icon = model.get_value(iter, self.COLUMN_LOGO)
        distro = model.get_value(iter, self.COLUMN_DISTRO)
        comment = model.get_value(iter, self.COLUMN_NAME)
        package = model.get_value(iter, self.COLUMN_SLUG)
        comps = model.get_value(iter, self.COLUMN_COMPS)
        key = model.get_value(iter, self.COLUMN_KEY)

        pre_status = self.get_sourcelist_status(url)

        if key:
            proxy.add_apt_key_from_content(key)

        if not comps and distro:
            distro = distro + '/'
        elif not comps and not distro:
            distro = './'

        if TweakSettings.get_separated_sources():
            result = proxy.set_separated_entry(url, distro, comps,
                                               comment, enable, package)
        else:
            result = proxy.set_entry(url, distro, comps, comment, enable)

        if str(result) == 'enabled':
            model.set(iter, self.COLUMN_ENABLED, True)
        else:
            model.set(iter, self.COLUMN_ENABLED, False)

        if pre_status != enable:
            self.emit('sourcechanged')

        if enable:
            notify.update(_('New source has been enabled'),
                          _('%s is enabled now, Please click the refresh button to update the application cache.') % comment)
            notify.set_icon_from_pixbuf(icon)
            notify.show()
开发者ID:ubuntutweak,项目名称:ubuntu-tweak,代码行数:44,代码来源:sourcecenter.py

示例10: setup_launch_function

    def setup_launch_function(self):
        from mainwindow import module_loader
        from mainwindow import ID_COLUMN, LOGO_COLUMN, TITLE_COLUMN
        function_box = self.worker.get_object('function_box')

        model = gtk.ListStore(
                gobject.TYPE_STRING,
                gtk.gdk.Pixbuf,
                gobject.TYPE_STRING)

        iter = model.append(None)
        model.set(iter,
                ID_COLUMN, 0,
                LOGO_COLUMN, None,
                TITLE_COLUMN, _('None')
        )
        for module in module_loader.get_all_module():
            iter = model.append(None)
            pixbuf = module_loader.get_pixbuf(module.__name__)

            model.set(iter,
                    ID_COLUMN, module.__name__,
                    LOGO_COLUMN, pixbuf,
                    TITLE_COLUMN, module.__title__,
            )

        function_box.set_model(model)
        textcell = gtk.CellRendererText()
        pixbufcell = gtk.CellRendererPixbuf()
        function_box.pack_start(pixbufcell, False)
        function_box.pack_start(textcell, True)
        function_box.add_attribute(textcell, 'text', TITLE_COLUMN)
        function_box.add_attribute(pixbufcell, 'pixbuf', LOGO_COLUMN)
        id = TweakSettings.get_default_launch()
        for i, row in enumerate(model):
            _id = model.get_value(row.iter, ID_COLUMN)
            if id == _id:
                function_box.set_active(i)
        function_box.connect('changed', self.on_launch_changed)
开发者ID:DigGe,项目名称:ubuntu-tweak,代码行数:39,代码来源:preferences.py

示例11: setup_launch_function

    def setup_launch_function(self):
        from ubuntutweak.mainwindow import MLOADER
        from ubuntutweak.mainwindow import MainWindow as MW
        function_box = self.worker.get_object('function_box')

        model = gtk.ListStore(
                gobject.TYPE_STRING,
                gtk.gdk.Pixbuf,
                gobject.TYPE_STRING)

        iter = model.append(None)
        model.set(iter,
                MW.ID_COLUMN, '',
                MW.LOGO_COLUMN, None,
                MW.TITLE_COLUMN, _('None')
        )
        for module in MLOADER.get_all_module():
            iter = model.append(None)

            model.set(iter,
                    MW.ID_COLUMN, module.get_name(),
                    MW.LOGO_COLUMN, module.get_pixbuf(),
                    MW.TITLE_COLUMN, module.get_title(),
            )

        function_box.set_model(model)
        textcell = gtk.CellRendererText()
        pixbufcell = gtk.CellRendererPixbuf()
        function_box.pack_start(pixbufcell, False)
        function_box.pack_start(textcell, True)
        function_box.add_attribute(textcell, 'text', MW.TITLE_COLUMN)
        function_box.add_attribute(pixbufcell, 'pixbuf', MW.LOGO_COLUMN)
        id = TweakSettings.get_default_launch()
        for i, row in enumerate(model):
            _id = model.get_value(row.iter, MW.ID_COLUMN)
            if id == _id:
                function_box.set_active(i)
        function_box.connect('changed', self.on_launch_changed)
开发者ID:Adriarson,项目名称:ubuntu-tweak,代码行数:38,代码来源:preferences.py

示例12: __init__

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

        self.cateview = CategoryView(os.path.join(SOURCE_ROOT, 'cates.json'))
        self.cate_selection = self.cateview.get_selection()
        self.cate_selection.connect('changed', self.on_category_changed)
        self.left_sw.add(self.cateview)

        self.sourceview = SourcesView()
        self.sourceview.connect('sourcechanged', self.colleague_changed)
        self.sourceview.selection.connect('changed', self.on_selection_changed)
        self.sourceview.set_sensitive(False)
        self.sourceview.set_rules_hint(True)
        self.right_sw.add(self.sourceview)

        self.expander = gtk.Expander(_('Details'))
        self.vbox1.pack_start(self.expander, False, False, 0)
        self.sourcedetail = SourceDetail()
        self.expander.set_sensitive(False)
        self.expander.add(self.sourcedetail)

        un_lock = PolkitButton()
        un_lock.connect('changed', self.on_polkit_action)
        self.hbox2.pack_end(un_lock, False, False, 0)
        self.hbox2.reorder_child(un_lock, 0)


        #FIXME China mirror hack
        if os.getenv('LANG').startswith('zh_CN'):
            if TweakSettings.get_use_mirror_ppa():
                gobject.idle_add(self.start_check_cn_ppa)
            else:
                self.sourceview.unconver_ubuntu_cn_mirror()

        config.get_client().notify_add('/apps/ubuntu-tweak/use_mirror_ppa', self.value_changed)

        gobject.idle_add(self.on_idle_check)
开发者ID:DigGe,项目名称:ubuntu-tweak,代码行数:37,代码来源:thirdsoft.py

示例13: on_reset_clicked

 def on_reset_clicked(self, widget, colorbutton):
     color = gtk.gdk.Color(32767, 32767, 32767)
     colorbutton.set_color(color)
     TweakSettings.set_toolbar_color(color.to_string())
开发者ID:DigGe,项目名称:ubuntu-tweak,代码行数:4,代码来源:preferences.py

示例14: on_launch_changed

 def on_launch_changed(self, widget):
     index = widget.get_active()
     liststore = widget.get_model()
     iter = liststore.get_iter(index)
     id = liststore.get_value(iter, 0)
     TweakSettings.set_default_launch(id)
开发者ID:DigGe,项目名称:ubuntu-tweak,代码行数:6,代码来源:preferences.py

示例15: Gnome

class Gnome(TweakModule):
    __title__ = _('GNOME Settings')
    __desc__ = _('A lot of GNOME settings about panel, menu and others')
    __icon__ = ['gnome-desktop-config', 'control-center2']
    __category__ = 'desktop'
    __desktop__ = 'gnome'

    def __init__(self):
        TweakModule.__init__(self)

        self.__setting = TweakSettings()

        changeicon_hbox = self.create_change_icon_hbox()

        box = ListPack(_("Panel Settings"), (
                    WidgetFactory.create("GconfCheckButton", 
                                    label=_("Display warning when removing a panel"),
                                    key="confirm_panel_remove"),
                    WidgetFactory.create("GconfCheckButton", 
                                    label=_("Complete lockdown of all panels"),
                                    key="locked_down"),
                    WidgetFactory.create("GconfCheckButton", 
                                    label=_("Enable panel animations"),
                                    key="enable_animations"),
            ))
        self.add_start(box, False, False, 0)

        box = ListPack(_("Menu Settings"), (
                    WidgetFactory.create("GconfCheckButton", 
                                    label=_("Show Input Method menu on the context menu"),
                                    key="show_input_method_menu"),
                    WidgetFactory.create("GconfCheckButton",
                                    label=_("Show Unicode Method menu on the context menu"),
                                    key="show_unicode_menu"),
                    WidgetFactory.create("GconfCheckButton",
                                    label=_('Menus have icons'),
                                    key='/desktop/gnome/interface/menus_have_icons'),
                    WidgetFactory.create("GconfCheckButton",
                                    label=_('Buttons have icons'),
                                    key='/desktop/gnome/interface/buttons_have_icons'),
                    changeicon_hbox,
            ))
        self.add_start(box, False, False, 0)

        box = ListPack(_("Screensaver"), (
                    WidgetFactory.create("GconfCheckButton", 
                                         label=_("Enable user switching when screen is locked."),
                                         key="user_switch_enabled"),
            ))
        self.add_start(box, False, False, 0)

        self.recently_used = gtk.CheckButton(_('Enable system-wide "Recently Documents" list'))
        self.recently_used.connect('toggled', self.colleague_changed)
        self.recently_used.set_active(self.get_state())
        box = ListPack(_("History"), (
                    self.recently_used,
            ))
        self.add_start(box, False, False, 0)

    def create_change_icon_hbox(self):
        hbox = gtk.HBox(False, 10)
        label = gtk.Label(_('Click the button to change the menu logo'))
        label.set_alignment(0, 0.5)
        hbox.pack_start(label, False, False, 0)

        button = gtk.Button()
        button.connect('clicked', self.on_change_icon_clicked)
        image = gtk.image_new_from_pixbuf(get_icon_with_name('start-here', 24))
        button.set_image(image)
        hbox.pack_end(button, False, False, 0)

        return hbox

    def on_change_icon_clicked(self, widget):
        dialog = gtk.FileChooserDialog(_('Choose a new logo'),
                                        action=gtk.FILE_CHOOSER_ACTION_OPEN,
                                        buttons=(gtk.STOCK_REVERT_TO_SAVED, gtk.RESPONSE_DELETE_EVENT,
                                                 gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
                                                 gtk.STOCK_OPEN, gtk.RESPONSE_ACCEPT))
        filter = gtk.FileFilter()
        filter.set_name(_("PNG image (*.png)"))
        filter.add_mime_type("image/png")
        dialog.set_current_folder(os.path.expanduser('~'))
        dialog.add_filter(filter)

        dest = os.path.expanduser('~/.icons/%s/places/24/start-here.png' % self.__setting.get_icon_theme())
        revert_button = dialog.action_area.get_children()[-1]
        if not os.path.exists(dest):
            revert_button.set_sensitive(False)

        filename = ''
        response = dialog.run()

        if response == gtk.RESPONSE_ACCEPT:
            filename = dialog.get_filename()
            dialog.destroy()

            if filename:
                pixbuf = gtk.gdk.pixbuf_new_from_file(filename)
                w, h = pixbuf.get_width(), pixbuf.get_height()
#.........这里部分代码省略.........
开发者ID:ubuntutweak,项目名称:ubuntu-tweak,代码行数:101,代码来源:gnomesettings.py


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