本文整理汇总了Python中pyanaconda.ui.gui.utils.escape_markup函数的典型用法代码示例。如果您正苦于以下问题:Python escape_markup函数的具体用法?Python escape_markup怎么用?Python escape_markup使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了escape_markup函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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)
示例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()
示例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])
示例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])
示例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
示例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)
示例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])
示例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)
示例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")
示例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")
示例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")
示例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
示例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)
示例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])
示例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)