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

Python utils.escape_markup函数代码示例

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

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



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

示例1: on_start_clicked

    def on_start_clicked(self, *args):
        # First, update some widgets to not be usable while discovery happens.
        self._startButton.hide()
        self._cancelButton.set_sensitive(False)
        self._okButton.set_sensitive(False)

        self._conditionNotebook.set_current_page(1)
        self._set_configure_sensitive(False)
        self._initiatorEntry.set_sensitive(False)

        # Now get the node discovery credentials.
        credentials = discoverMap[self._authNotebook.get_current_page()](self.builder)

        discoveredLabelText = _("The following nodes were discovered using the iSCSI initiator "\
                                "<b>%(initiatorName)s</b> using the target IP address "\
                                "<b>%(targetAddress)s</b>.  Please select which nodes you "\
                                "wish to log into:") % \
                                {"initiatorName": escape_markup(credentials.initiator),
                                 "targetAddress": escape_markup(credentials.targetIP)}

        discoveredLabel = self.builder.get_object("discoveredLabel")
        discoveredLabel.set_markup(discoveredLabelText)

        bind = self._bindCheckbox.get_active()

        spinner = self.builder.get_object("waitSpinner")
        spinner.start()

        threadMgr.add(AnacondaThread(name=constants.THREAD_ISCSI_DISCOVER, target=self._discover,
                                     args=(credentials, bind)))
        GLib.timeout_add(250, self._check_discover)
开发者ID:mairin,项目名称:anaconda,代码行数:31,代码来源:iscsi.py


示例2: refresh

    def refresh(self):
        NormalSpoke.refresh(self)

        threadMgr.wait(constants.THREAD_PAYLOAD_MD)

        self._environmentStore.clear()
        if self.environment not in self.payload.environments:
            self.environment = None

        firstEnvironment = True
        for environment in self.payload.environments:
            (name, desc) = self.payload.environmentDescription(environment)

            itr = self._environmentStore.append([environment == self.environment, "<b>%s</b>\n%s" % \
                    (escape_markup(name), escape_markup(desc)), environment])
            # Either:
            # (1) Select the environment given by kickstart or selected last
            #     time this spoke was displayed; or
            # (2) Select the first environment given by display order as the
            #     default if nothing is selected.
            if (environment == self.environment) or \
               (not self.environment and firstEnvironment):
                self.environment = environment
                sel = self.builder.get_object("environmentSelector")
                sel.select_iter(itr)

            firstEnvironment = False

        self.refreshAddons()
开发者ID:mairin,项目名称:anaconda,代码行数:29,代码来源:software.py


示例3: initialize

    def initialize(self, actions):
        for (i, action) in enumerate(actions, start=1):
            mountpoint = ""

            if action.type in [ACTION_TYPE_DESTROY, ACTION_TYPE_RESIZE]:
                typeString = """<span foreground='red'>%s</span>""" % \
                        escape_markup(action.type_desc.title())
            else:
                typeString = """<span foreground='green'>%s</span>""" % \
                        escape_markup(action.type_desc.title())
                if action.obj == ACTION_OBJECT_FORMAT:
                    mountpoint = getattr(action.device.format, "mountpoint", "")

            if hasattr(action.device, "description"):
                desc = _("%(description)s (%(deviceName)s)") % {"deviceName": action.device.name,
                                                                "description": action.device.description}
                serial = action.device.serial
            elif hasattr(action.device, "disk"):
                desc = _("%(deviceName)s on %(container)s") % {"deviceName": action.device.name,
                                                               "container": action.device.disk.description}
                serial = action.device.disk.serial
            else:
                desc = action.device.name
                serial = action.device.serial

            self._store.append([i,
                                typeString,
                                action.object_type_string,
                                desc,
                                mountpoint,
                                serial])
开发者ID:bwann,项目名称:anaconda,代码行数:31,代码来源:summary.py


示例4: _add_locale

    def _add_locale(self, store, native, locale):
        native_span = '<span lang="%s">%s</span>' % \
                (escape_markup(re.sub(r'\..*', '', locale)),
                 escape_markup(native))

        # native, locale, selected, additional
        store.append([native_span, locale, locale in self._selected_locales,
                      locale != self.data.lang.lang])
开发者ID:galleguindio,项目名称:anaconda,代码行数:8,代码来源:langsupport.py


示例5: _get_sw_needs_text

 def _get_sw_needs_text(self, required_space, auto_swap):
     sw_text = (_("Your current <a href=\"\"><b>%(product)s</b> software "
                  "selection</a> requires <b>%(total)s</b> of available "
                  "space, including <b>%(software)s</b> for software and "
                  "<b>%(swap)s</b> for swap space.")
                % {"product": escape_markup(productName),
                   "total": escape_markup(str(required_space + auto_swap)),
                   "software": escape_markup(str(required_space)),
                   "swap": escape_markup(str(auto_swap))})
     return sw_text
开发者ID:akozumpl,项目名称:anaconda,代码行数:10,代码来源:storage.py


示例6: _update_labels

    def _update_labels(self, nDisks=None, totalReclaimable=None, selectedReclaimable=None):
        if nDisks is not None and totalReclaimable is not None:
            text = P_("<b>%(count)s disk; %(size)s reclaimable space</b> (in file systems)",
                      "<b>%(count)s disks; %(size)s reclaimable space</b> (in file systems)",
                      nDisks) % {"count" : escape_markup(str(nDisks)),
                                 "size" : escape_markup(totalReclaimable)}
            self._reclaimable_label.set_markup(text)

        if selectedReclaimable is not None:
            text = _("Total selected space to reclaim: <b>%s</b>") % \
                    escape_markup(selectedReclaimable)
            self._selected_label.set_markup(text)
开发者ID:bwann,项目名称:anaconda,代码行数:12,代码来源:resize.py


示例7: _addAddon

    def _addAddon(self, grp):
        (name, desc) = self.payload.groupDescription(grp)

        # If the add-on was previously selected by the user, select it
        if self._addonStates[grp] == self._ADDON_SELECTED:
            selected = True
        # If the add-on was previously de-selected by the user, de-select it
        elif self._addonStates[grp] == self._ADDON_DESELECTED:
            selected = False
        # Otherwise, use the default state
        else:
            selected = self.payload.environmentOptionIsDefault(self.environment, grp)

        self._addonStore.append([selected, "<b>%s</b>\n%s" % \
                (escape_markup(name), escape_markup(desc)), grp, False])
开发者ID:mairin,项目名称:anaconda,代码行数:15,代码来源:software.py


示例8: _add_row

    def _add_row(self, listbox, name, desc, button, clicked):
        row = Gtk.ListBoxRow()
        box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=6)

        button.set_valign(Gtk.Align.START)
        button.connect("toggled", clicked, row)
        box.add(button)

        label = Gtk.Label(label="<b>%s</b>\n%s" % (escape_markup(name), escape_markup(desc)),
                          use_markup=True, wrap=True, wrap_mode=Pango.WrapMode.WORD_CHAR,
                          hexpand=True, xalign=0, yalign=0.5)
        box.add(label)

        row.add(box)
        listbox.insert(row, -1)
开发者ID:KosiehBarter,项目名称:anaconda,代码行数:15,代码来源:software.py


示例9: __init__

    def __init__(self, data, storage, payload):
        GUIObject.__init__(self, data)
        self.storage = storage
        self.payload = payload

        self._initialFreeSpace = Size(0)
        self._selectedReclaimableSpace = Size(0)

        self._actionStore = self.builder.get_object("actionStore")
        self._diskStore = self.builder.get_object("diskStore")

        self._selection = self.builder.get_object("diskView-selection")

        self._view = self.builder.get_object("diskView")
        self._diskStore = self.builder.get_object("diskStore")
        self._reclaimable_label = self.builder.get_object("reclaimableSpaceLabel")
        self._selected_label = self.builder.get_object("selectedSpaceLabel")

        self._required_label = self.builder.get_object("requiredSpaceLabel")
        markup = _("Installation requires a total of <b>%s</b> for system data.")
        required_dev_size = self.payload.requiredDeviceSize(FS.biggest_overhead_FS())
        self._required_label.set_markup(markup % escape_markup(str(required_dev_size)))

        self._reclaimDescLabel = self.builder.get_object("reclaimDescLabel")

        self._resizeButton = self.builder.get_object("resizeButton")

        self._preserveButton = self.builder.get_object("preserveButton")
        self._shrinkButton = self.builder.get_object("shrinkButton")
        self._deleteButton = self.builder.get_object("deleteButton")
        self._resizeSlider = self.builder.get_object("resizeSlider")
开发者ID:bwann,项目名称:anaconda,代码行数:31,代码来源:resize.py


示例10: __init__

    def __init__(self, data, storage, payload):
        GUIObject.__init__(self, data)
        self.storage = storage
        self.payload = payload

        self._initialFreeSpace = Size(0)
        self._selectedReclaimableSpace = Size(0)

        self._actionStore = self.builder.get_object("actionStore")
        self._diskStore = self.builder.get_object("diskStore")

        self._selection = self.builder.get_object("diskView-selection")

        self._view = self.builder.get_object("diskView")
        self._diskStore = self.builder.get_object("diskStore")
        self._reclaimable_label = self.builder.get_object("reclaimableSpaceLabel")
        self._selected_label = self.builder.get_object("selectedSpaceLabel")

        self._required_label = self.builder.get_object("requiredSpaceLabel")
        markup = self._required_label.get_label()
        self._required_label.set_markup(markup % escape_markup(str(self.payload.spaceRequired)))

        self._reclaimDescLabel = self.builder.get_object("reclaimDescLabel")

        self._resizeButton = self.builder.get_object("resizeButton")

        self._preserveButton = self.builder.get_object("preserveButton")
        self._shrinkButton = self.builder.get_object("shrinkButton")
        self._deleteButton = self.builder.get_object("deleteButton")
        self._resizeSlider = self.builder.get_object("resizeSlider")
开发者ID:cyclefusion,项目名称:anaconda,代码行数:30,代码来源:resize.py


示例11: refresh

    def refresh(self, required_space, auto_swap, disk_free, fs_free, autoPartType, encrypted):
        self.autoPartType = autoPartType
        self.autoPartTypeCombo.set_active(self.autoPartType)

        self.encrypted = encrypted
        self.encryptCheckbutton.set_active(self.encrypted)

        sw_text = self._get_sw_needs_text(required_space, auto_swap)
        label_text = _("%s The disks you've selected have the following "
                       "amounts of free space:") % sw_text
        label = self.builder.get_object("options2_label1")
        label.set_markup(label_text)
        label.set_tooltip_text(_("Please wait... software metadata still loading."))
        label.connect("activate-link", self._modify_sw_link_clicked)

        self._set_free_space_labels(disk_free, fs_free)

        label_text = _("<b>You don't have enough space available to install "
                       "%s</b>.  You can shrink or remove existing partitions "
                       "via our guided reclaim space tool, or you can adjust your "
                       "partitions on your own in the custom partitioning "
                       "interface.") % escape_markup(productName)
        self.builder.get_object("options2_label2").set_markup(label_text)

        self._add_modify_watcher("options2_label1")
开发者ID:mairin,项目名称:anaconda,代码行数:25,代码来源:storage.py


示例12: _make_category_label

 def _make_category_label(self, name):
     label = Gtk.Label()
     label.set_markup("""<span fgcolor='dark grey' size='large' weight='bold'>%s</span>""" %
             escape_markup(name))
     label.set_halign(Gtk.Align.START)
     label.set_margin_left(24)
     return label
开发者ID:nandakishore1006,项目名称:anaconda,代码行数:7,代码来源:accordion.py


示例13: _update_summary

    def _update_summary(self):
        count = 0
        size = Size(0)
        free = Size(0)
        for row in self._store:
            count += 1
            size += Size(row[SIZE_COL])
            free += Size(row[FREE_SPACE_COL])

        # pylint: disable=unescaped-markup
        text = P_("<b>%(count)d disk; %(size)s capacity; %(free)s free space</b> "
                   "(unpartitioned and in file systems)",
                  "<b>%(count)d disks; %(size)s capacity; %(free)s free space</b> "
                   "(unpartitioned and in file systems)",
                   count) % {"count" : count,
                             "size" : escape_markup(size),
                             "free" : escape_markup(free)}
        self._summary_label.set_markup(text)
开发者ID:cyclefusion,项目名称:anaconda,代码行数:18,代码来源:cart.py


示例14: initialize

    def initialize(self, actions):
        for (i, action) in enumerate(actions, start=1):
            mountpoint = ""

            if action.type in [ACTION_TYPE_DESTROY, ACTION_TYPE_RESIZE]:
                typeString = """<span foreground='red'>%s</span>""" % \
                        escape_markup(action.typeDesc.title())
            else:
                typeString = """<span foreground='green'>%s</span>""" % \
                        escape_markup(action.typeDesc.title())
                if action.obj == ACTION_OBJECT_FORMAT:
                    mountpoint = getattr(action.device.format, "mountpoint", "")

            self._store.append([i,
                                typeString,
                                action.objectTypeString,
                                action.device.name,
                                mountpoint])
开发者ID:mairin,项目名称:anaconda,代码行数:18,代码来源:summary.py


示例15: _add_row

    def _add_row(self, listbox, name, desc, button):
        row = Gtk.ListBoxRow()
        box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
        box.set_spacing(6)

        button.set_valign(Gtk.Align.START)
        button.connect("clicked", self.on_button_toggled, row)
        box.add(button)

        label = Gtk.Label()
        label.set_line_wrap(True)
        label.set_line_wrap_mode(Pango.WrapMode.WORD_CHAR)
        label.set_markup("<b>%s</b>\n%s" % (escape_markup(name), escape_markup(desc)))
        label.set_hexpand(True)
        label.set_alignment(0, 0.5)
        box.add(label)

        row.add(box)
        listbox.insert(row, -1)
开发者ID:pombreda,项目名称:anaconda,代码行数:19,代码来源:software.py


示例16: _update_summary

    def _update_summary(self):
        count = 0
        size = 0
        free = 0
        for row in self._store:
            count += 1
            size += Size(spec=row[SIZE_COL])
            free += Size(spec=row[FREE_SPACE_COL])

        size = str(Size(bytes=long(size))).upper()
        free = str(Size(bytes=long(free))).upper()

        text = P_("<b>%(count)d disk; %(size)s capacity; %(free)s free space</b> "
                   "(unpartitioned and in filesystems)",
                  "<b>%(count)d disks; %(size)s capacity; %(free)s free space</b> "
                   "(unpartitioned and in filesystems)",
                   count) % {"count" : count,
                             "size" : escape_markup(size),
                             "free" : escape_markup(free)}
        self._summary_label.set_markup(text)
开发者ID:mairin,项目名称:anaconda,代码行数:20,代码来源:cart.py


示例17: addPage

    def addPage(self, contents, cb):
        label = Gtk.Label(label="""<span size='large' weight='bold' fgcolor='black'>%s</span>""" %
                          escape_markup(contents.pageTitle), use_markup=True,
                          xalign=0, yalign=0.5, wrap=True)

        expander = Gtk.Expander()
        expander.set_label_widget(label)
        expander.add(contents)

        self.add(expander)
        self._expanders.append(expander)
        expander.connect("activate", self._onExpanded, cb)
        expander.show_all()
开发者ID:nandakishore1006,项目名称:anaconda,代码行数:13,代码来源:accordion.py


示例18: addPage

    def addPage(self, contents, cb=None):
        label = Gtk.Label()
        label.set_markup("""<span size='large' weight='bold' fgcolor='black'>%s</span>""" %
                escape_markup(contents.pageTitle))
        label.set_alignment(0, 0.5)
        label.set_line_wrap(True)

        expander = Gtk.Expander()
        expander.set_label_widget(label)
        expander.add(contents)

        self.add(expander)
        self._expanders.append(expander)
        expander.connect("activate", self._onExpanded, cb)
        expander.show_all()
开发者ID:mairin,项目名称:anaconda,代码行数:15,代码来源:accordion.py


示例19: _storageResetHandler

 def _storageResetHandler(self, exn):
     message = (_("There is a problem with your existing storage "
                  "configuration: <b>%(errortxt)s</b>\n\n"
                  "You must resolve this matter before the installation can "
                  "proceed. There is a shell available for use which you "
                  "can access by pressing ctrl-alt-f1 and then ctrl-b 2."
                  "\n\nOnce you have resolved the issue you can retry the "
                  "storage scan. If you do not fix it you will have to exit "
                  "the installer.") % {"errortxt": escape_markup(exn.message)})
     details = _(exn.suggestion)
     buttons = (_("_Exit Installer"), _("_Retry"))
     if self.ui.showDetailedError(message, details, buttons=buttons):
         return ERROR_RETRY
     else:
         return ERROR_RAISE
开发者ID:cyclefusion,项目名称:anaconda,代码行数:15,代码来源:errors.py


示例20: refresh

    def refresh(self, required_space, auto_swap, disk_free, fs_free):
        label_text = self._get_sw_needs_text(required_space, auto_swap)
        label_text += (_("  You don't have enough space available to install "
                         "<b>%(product)s</b>, even if you used all of the free space "
                         "available on the selected disks.")
                       % {"product": escape_markup(productName)})
        label = self.builder.get_object("no_space_desc_label")
        label.set_markup(label_text)

        if not flags.livecdInstall:
            label.connect("activate-link", self._modify_sw_link_clicked)

        self._set_free_space_labels(disk_free, fs_free)

        label_text = _("<b>You don't have enough space available to install "
                       "%(productName)s</b>, even if you used all of the free space "
                       "available on the selected disks.  You could add more "
                       "disks for additional space, "
                       "modify your software selection to install a smaller "
                       "version of <b>%(productName)s</b>, or quit the installer.") % \
                               {"productName": escape_markup(productName)}
        self.builder.get_object("no_space_options_label").set_markup(label_text)

        self._add_modify_watcher(label)
开发者ID:fabiand,项目名称:anaconda-1,代码行数:24,代码来源:storage.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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