• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python misc.get_release函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: on_language_selection_changed

    def on_language_selection_changed(self):
        lang = self.selected_language()
        if not lang:
            return
        # strip encoding; we use UTF-8 internally no matter what
        lang = lang.split('.')[0]
        self.controller.translate(lang)
        if not self.only:
            release = misc.get_release()
            install_medium = misc.get_install_medium()
            install_medium = i18n.get_string(install_medium, lang)
            for widget in (self.page.try_install_text_label,
                           self.page.try_ubuntu,
                           self.page.install_ubuntu,
                           self.page.alpha_warning_label):
                text = widget.text()
                text = text.replace('${RELEASE}', release.name)
                text = text.replace('${MEDIUM}', install_medium)
                text = text.replace('Ubuntu', 'Kubuntu')
                widget.setText(text)

        self.update_release_notes_label()
        for w in self.widgetHidden:
            w.show()
        self.widgetHidden = []
开发者ID:IbpTeam,项目名称:ubiquity,代码行数:25,代码来源:ubi-language.py


示例2: changed

    def changed(self, entry):
        from gi.repository import Gtk, GObject, GLib, Soup

        text = misc.utf8(self.city_entry.get_text())
        if not text:
            return
        # TODO if the completion widget has a selection, return?  How do we
        # determine this?
        if text in self.geoname_cache:
            model = self.geoname_cache[text]
            self.city_entry.get_completion().set_model(model)
        else:
            model = Gtk.ListStore(GObject.TYPE_STRING, GObject.TYPE_STRING,
                                  GObject.TYPE_STRING, GObject.TYPE_STRING,
                                  GObject.TYPE_STRING)

            if self.geoname_session is None:
                self.geoname_session = Soup.SessionAsync()
            url = _geoname_url % (quote(text), misc.get_release().version)
            message = Soup.Message.new('GET', url)
            message.request_headers.append('User-agent', 'Ubiquity/1.0')
            self.geoname_session.abort()
            if self.geoname_timeout_id is not None:
                GLib.source_remove(self.geoname_timeout_id)
            self.geoname_timeout_id = \
                GLib.timeout_add_seconds(2, self.geoname_timeout,
                                         (text, model))
            self.geoname_session.queue_message(message, self.geoname_cb,
                                               (text, model))
开发者ID:linuxmint,项目名称:ubiquity,代码行数:29,代码来源:ubi-timezone.py


示例3: plugin_translate

 def plugin_translate(self, lang):
     PreparePageBase.plugin_translate(self, lang)
     release = misc.get_release()
     from gi.repository import Gtk
     for widget in [self.prepare_foss_disclaimer]:
         text = i18n.get_string(Gtk.Buildable.get_name(widget), lang)
         text = text.replace('${RELEASE}', release.name)
         widget.set_label(text)
开发者ID:IbpTeam,项目名称:ubiquity,代码行数:8,代码来源:ubi-prepare.py


示例4: test_get_release

 def test_get_release(self, mock_open):
     magic = mock.MagicMock(spec=io.TextIOBase)
     magic.__enter__.return_value = magic
     mock_open.return_value = magic
     magic.readline.return_value = _disk_info
     release = misc.get_release()
     self.assertEqual(release.name, 'Ubuntu Server')
     self.assertEqual(release.version, '10.04.1 LTS')
开发者ID:swem,项目名称:ubiquity,代码行数:8,代码来源:test_misc.py


示例5: plugin_translate

    def plugin_translate(self, lang):
        PreparePageBase.plugin_translate(self, lang)
        release = misc.get_release()

        from gi.repository import Gtk
        for widget in [self.prepare_download_updates,
                       self.label_required_space,
                       self.label_free_space]:
            text = i18n.get_string(Gtk.Buildable.get_name(widget), lang)
            text = text.replace('${RELEASE}', release.name)
            widget.set_label(text)
开发者ID:maui-linux,项目名称:ubiquity,代码行数:11,代码来源:ubi-prepare.py


示例6: plugin_translate

 def plugin_translate(self, lang):
     PreparePageBase.plugin_translate(self, lang)
     #gtk does the ${RELEASE} replace for the title in gtk_ui but we do it per plugin because our title widget is per plugin
     #also add Bold here (not sure how the gtk side keeps that formatting)
     release = misc.get_release()
     for widget in (self.page.prepare_heading_label, self.page.prepare_best_results, self.page.prepare_foss_disclaimer):
         text = widget.text()
         text = text.replace('${RELEASE}', release.name)
         text = text.replace('Ubuntu', 'Kubuntu')
         text = "<b>" + text + "</b>"
         widget.setText(text)
开发者ID:pkt,项目名称:ubiquity.squibby,代码行数:11,代码来源:ubi-prepare.py


示例7: plugin_translate

 def plugin_translate(self, lang):
     PreparePageBase.plugin_translate(self, lang)
     # gtk does the ${RELEASE} replace for the title in gtk_ui but we do
     # it per plugin because our title widget is per plugin
     release = misc.get_release()
     widgets = (
         self.page.prepare_heading_label,
         self.page.prepare_best_results,
         self.page.prepare_foss_disclaimer,
     )
     for widget in widgets:
         text = widget.text()
         text = text.replace('${RELEASE}', release.name)
         text = text.replace('Ubuntu', 'Linux Mint')
         widget.setText(text)
开发者ID:hamonikr-root,项目名称:ubiquity,代码行数:15,代码来源:ubi-prepare.py


示例8: changed

        def changed(entry):
            text = entry.get_text()
            if not text:
                return
            # TODO if the completion widget has a selection, return?  How do we determine this?
            if text in changed.cache:
                model = changed.cache[text]
            else:
                # fetch
                model = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING,
                                      gobject.TYPE_STRING, gobject.TYPE_STRING,
                                      gobject.TYPE_STRING)
                changed.cache[text] = model
                # TODO benchmark this
                results = [(name, self.tzdb.get_loc(city))
                            for (name, city) in
                                [(x[0], x[1]) for x in self.zones
                                    if x[0].lower().split('(', 1)[-1] \
                                                    .startswith(text.lower())]]
                for result in results:
                    # We use name rather than loc.human_zone for i18n.
                    # TODO this looks pretty awful for US results:
                    # United States (New York) (United States)
                    # Might want to match the debconf format.
                    name, loc = result
                    model.append([name, '', loc.human_country,
                                  loc.latitude, loc.longitude])

                try:
                    import urllib2, urllib, json
                    opener = urllib2.build_opener()
                    opener.addheaders = [('User-agent', 'Ubiquity/1.0')]
                    url = opener.open(_geoname_url %
                        (urllib.quote(text), misc.get_release().version))
                    for result in json.loads(url.read()):
                        model.append([result['name'],
                                      result['admin1'],
                                      result['country'],
                                      result['latitude'],
                                      result['longitude']])
                except Exception, e:
                    print 'exception:', e
开发者ID:cjenkin2,项目名称:ubiquity,代码行数:42,代码来源:ubi-timezone.py


示例9: setupChoices

    def setupChoices(self, choices, extra_options, resize_choice,
                     manual_choice, biggest_free_choice, use_device_choice,
                     lvm_choice, crypto_choice):
        self._clearInfo()

        self.resizeChoice = resize_choice
        self.manualChoice = manual_choice
        self.useDeviceChoice = use_device_choice
        self.extra_options = extra_options
        self.lvm_choice = lvm_choice
        self.crypto_choice = crypto_choice

        # remove any previous autopartition selections
        for child in self.autopart_selection_frame.children():
            if isinstance(child, QtGui.QWidget):
                child.setParent(None)
                del child

        for child in self.barsFrame.children():
            if isinstance(child, QtGui.QWidget):
                self.barsFrame.layout().removeWidget(child)
                child.setParent(None)
                del child

        release_name = misc.get_release().name

        bId = 0
        if 'resize' in extra_options:
            button = QtGui.QRadioButton(
                self.resizeChoice, self.autopart_selection_frame)
            self.autopart_selection_frame.layout().addWidget(button)
            self.autopartition_buttongroup.addButton(button, bId)
            self.autopartitionTexts.append(resize_choice)
            button.clicked.connect(self.controller.setNextButtonTextInstallNow)
            bId += 1

            disks = []
            for disk_id in extra_options['resize']:
                # information about what can be resized
                unused, min_size, max_size, pref_size, \
                resize_path, unused, unused = \
                    extra_options['resize'][disk_id]

                for text, path in extra_options['use_device'][1].items():
                    path = path[0]
                    if path.rsplit('/', 1)[1] == disk_id:
                        bar_frame = QtGui.QFrame()
                        bar_frame.setLayout(QtGui.QVBoxLayout())
                        bar_frame.setVisible(False)
                        bar_frame.layout().setSpacing(0)
                        self.barsFrame.layout().addWidget(bar_frame)
                        self.bar_frames.append(bar_frame)

                        disks.append((text, bar_frame))
                        self.resizeSize = pref_size
                        dev = self.diskLayout[disk_id]
                        before_bar = PartitionsBar()
                        after_bar = PartitionsBar()

                        for p in dev:
                            before_bar.addPartition(p[0], int(p[1]), p[3])
                            after_bar.addPartition(p[0], int(p[1]), p[3])

                        after_bar.setResizePartition(
                            resize_path, min_size, max_size, pref_size,
                            release_name)
                        after_bar.partitionResized.connect(
                            self.on_partitionResized)
                        addBars(bar_frame, before_bar, after_bar)
            self.disks.append(disks)

        # TODO biggest_free_choice

        # Use entire disk.
        button = QtGui.QRadioButton(
            self.useDeviceChoice, self.autopart_selection_frame)
        self.autopartitionTexts.append(self.useDeviceChoice)
        self.autopart_selection_frame.layout().addWidget(button)
        self.autopartition_buttongroup.addButton(button, bId)
        button.clicked.connect(self.controller.setNextButtonTextInstallNow)
        bId += 1

        disks = []
        for text, path in extra_options['use_device'][1].items():
            path = path[0]
            bar_frame = QtGui.QFrame()
            bar_frame.setLayout(QtGui.QVBoxLayout())
            bar_frame.setVisible(False)
            bar_frame.layout().setSpacing(0)
            self.barsFrame.layout().addWidget(bar_frame)
            self.bar_frames.append(bar_frame)

            disks.append((text, bar_frame))

            dev = self.diskLayout[path.rsplit('/', 1)[1]]
            before_bar = PartitionsBar()
            after_bar = PartitionsBar()

            for p in dev:
                before_bar.addPartition(p.device, int(p.size), p.filesystem)
#.........这里部分代码省略.........
开发者ID:johannesthoma,项目名称:ubiquity,代码行数:101,代码来源:PartAuto.py


示例10: apply_debconf_branding

 def apply_debconf_branding(self):
     release = misc.get_release()
     for template in ['ubiquity/text/required_space',
                      'ubiquity/text/free_space']:
         self.db.subst(template, 'RELEASE', release.name)
开发者ID:maui-linux,项目名称:ubiquity,代码行数:5,代码来源:ubi-prepare.py


示例11: test_get_release_fail

 def test_get_release_fail(self, mock_open):
     mock_open.side_effect = Exception('Pow!')
     release = misc.get_release()
     self.assertEqual(release.name, 'Ubuntu')
     self.assertEqual(release.version, '')
开发者ID:swem,项目名称:ubiquity,代码行数:5,代码来源:test_misc.py


示例12: setupChoices

    def setupChoices (self, choices, extra_options, resize_choice,
                      manual_choice, biggest_free_choice, use_device_choice):
        self._clearInfo()

        self.resizeChoice = resize_choice
        self.manualChoice = manual_choice
        self.useDeviceChoice = use_device_choice
        self.extra_options = extra_options

        # remove any previous autopartition selections
        for child in self.autopart_selection_frame.children():
            if isinstance(child, QtGui.QWidget):
                child.setParent(None)
                del child

        for child in self.barsFrame.children():
            if isinstance(child, QtGui.QWidget):
                self.barsFrame.layout().removeWidget(child)
                child.setParent(None)
                del child

        release_name = misc.get_release().name

        bId = 0
        if 'resize' in extra_options:
            button = QtGui.QRadioButton(self.resizeChoice, self.autopart_selection_frame)
            self.autopart_selection_frame.layout().addWidget(button)
            self.autopartition_buttongroup.addButton(button, bId)
            self.autopartitionTexts.append(resize_choice)
            button.clicked.connect(self.controller.setNextButtonTextInstallNow)
            bId += 1

            disks = []
            for disk_id in extra_options['resize']:
                # information about what can be resized
                unused, min_size, max_size, pref_size, \
                resize_path, unused, unused = \
                    extra_options['resize'][disk_id]

                for text, path in extra_options['use_device'][1].items():
                    path = path[0]
                    if path.rsplit('/', 1)[1] == disk_id:
                        bar_frame = QtGui.QFrame()
                        bar_frame.setLayout(QtGui.QVBoxLayout())
                        bar_frame.setVisible(False)
                        bar_frame.layout().setSpacing(0)
                        self.barsFrame.layout().addWidget(bar_frame)
                        self.bar_frames.append(bar_frame)

                        disks.append((text, bar_frame))
                        self.resizeSize = pref_size
                        dev = self.diskLayout[disk_id]
                        before_bar = PartitionsBar()
                        after_bar = PartitionsBar()

                        for p in dev:
                            before_bar.addPartition(p[0], int(p[1]), p[3])
                            after_bar.addPartition(p[0], int(p[1]), p[3])

                        after_bar.setResizePartition(resize_path,
                            min_size, max_size, pref_size, release_name)
                        after_bar.partitionResized.connect(self.on_partitionResized)
                        addBars(bar_frame, before_bar, after_bar)
            self.disks.append(disks)

        # TODO biggest_free_choice

        # Use entire disk.
        button = QtGui.QRadioButton(self.useDeviceChoice, self.autopart_selection_frame)
        self.autopartitionTexts.append(self.useDeviceChoice)
        self.autopart_selection_frame.layout().addWidget(button)
        self.autopartition_buttongroup.addButton(button, bId)
        button.clicked.connect(self.controller.setNextButtonTextInstallNow)
        bId += 1

        disks = []
        for text, path in extra_options['use_device'][1].items():
            path = path[0]
            bar_frame = QtGui.QFrame()
            bar_frame.setLayout(QtGui.QVBoxLayout())
            bar_frame.setVisible(False)
            bar_frame.layout().setSpacing(0)
            self.barsFrame.layout().addWidget(bar_frame)
            self.bar_frames.append(bar_frame)

            disks.append((text, bar_frame))

            dev = self.diskLayout[path.rsplit('/', 1)[1]]
            before_bar = PartitionsBar()
            after_bar = PartitionsBar()

            for p in dev:
                before_bar.addPartition(p.device, int(p.size), p.filesystem)
            if before_bar.diskSize > 0:
                after_bar.addPartition(release_name, before_bar.diskSize, 'auto')
            else:
                after_bar.addPartition(release_name, 1, 'auto')

            addBars(bar_frame, before_bar, after_bar)
        self.disks.append(disks)
#.........这里部分代码省略.........
开发者ID:guadalinex-archive,项目名称:guadalinex-v8,代码行数:101,代码来源:PartAuto.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python misc.utf8函数代码示例发布时间:2022-05-27
下一篇:
Python misc.execute函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap