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


Python TweakSettings.get_separated_sources方法代码示例

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


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

示例1: set_enable

# 需要导入模块: from ubuntutweak.common.config import TweakSettings [as 别名]
# 或者: from ubuntutweak.common.config.TweakSettings import get_separated_sources [as 别名]
    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,代码行数:27,代码来源:sourcecenter.py

示例2: do_source_enable

# 需要导入模块: from ubuntutweak.common.config import TweakSettings [as 别名]
# 或者: from ubuntutweak.common.config.TweakSettings import get_separated_sources [as 别名]
    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,代码行数:48,代码来源:sourcecenter.py

示例3: do_source_enable

# 需要导入模块: from ubuntutweak.common.config import TweakSettings [as 别名]
# 或者: from ubuntutweak.common.config.TweakSettings import get_separated_sources [as 别名]
    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,代码行数:46,代码来源:sourcecenter.py

示例4: __init__

# 需要导入模块: from ubuntutweak.common.config import TweakSettings [as 别名]
# 或者: from ubuntutweak.common.config.TweakSettings import get_separated_sources [as 别名]
    def __init__(self):
        gtk.Window.__init__(self)

        self.notify_func = None

        self.connect("destroy", self.destroy)
        self.set_title(APP)
        self.set_default_size(740, 480)
        self.set_position(gtk.WIN_POS_CENTER)
        self.set_border_width(10)

        vbox = gtk.VBox(False, 6)
        self.add(vbox)

        self.hpaned = gtk.HPaned()
        vbox.pack_start(self.hpaned, True, True, 0)

        swindow = gtk.ScrolledWindow()
        swindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
        swindow.set_size_request(150, -1)
        self.hpaned.pack1(swindow)

        self.model = self.__create_model()
        self.update_model()
        self.treeview = gtk.TreeView(self.model)
        self.treeview.set_enable_tree_lines(True)

        self.__add_columns(self.treeview)
        selection = self.treeview.get_selection()
        selection.connect("changed", self.selection_cb)
        self.treeview.expand_all()

        swindow.add(self.treeview)

        self.notebook = self.create_notebook()
        self.moduletable = {"0": 0}
        self.modules = {}
        self.hpaned.pack2(self.notebook)

        hbox = gtk.HBox(False, 12)
        vbox.pack_start(hbox, False, False, 0)

        l_hbutton_box = gtk.HButtonBox()
        l_hbutton_box.set_spacing(12)
        hbox.pack_start(l_hbutton_box, False, False, 0)

        button = gtk.Button(stock=gtk.STOCK_ABOUT)
        button.connect("clicked", self.show_about)
        l_hbutton_box.pack_start(button, False, False, 0)

        d_button = gtk.Button(stock=gtk.STOCK_YES)
        set_label_for_stock_button(d_button, _("_Donate"))
        d_button.connect("clicked", self.on_d_clicked)
        l_hbutton_box.pack_start(d_button, False, False, 0)

        r_hbutton_box = gtk.HButtonBox()
        r_hbutton_box.set_spacing(12)
        hbox.pack_end(r_hbutton_box, False, False, 0)

        button = gtk.Button(stock=gtk.STOCK_PREFERENCES)
        button.connect("clicked", self.on_preferences_clicked)
        r_hbutton_box.pack_end(button, False, False, 0)

        button = gtk.Button(stock=gtk.STOCK_QUIT)
        button.connect("clicked", self.destroy)
        r_hbutton_box.pack_end(button, False, False, 0)

        self.get_gui_state()
        self.set_icon(icon.get_from_name("ubuntu-tweak", size=48))
        self.show_all()

        if TweakSettings.get_check_update():
            log.debug("get_check_update will start after 5 seconds")
            gobject.timeout_add(5000, self.on_timeout)

        launch = TweakSettings.get_default_launch()
        try:
            if launch and not launch.isdigit():
                self.__create_newpage(launch)
        except:
            pass

        # Only check if the distribution is supported
        if system.is_supported():
            gobject.idle_add(self.notify_stable_source)

        try:
            log.debug("Check the sources list to make it valid")
            valid, disabled_list = proxy.check_sources_is_valid(TweakSettings.get_separated_sources())
            if not valid:
                gobject.idle_add(self.notify_invalid_sources, disabled_list)
        except Exception, e:
            log.error(e)
开发者ID:leeight,项目名称:ubuntu-tweak,代码行数:95,代码来源:mainwindow.py


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