本文整理汇总了Python中test_screen._函数的典型用法代码示例。如果您正苦于以下问题:Python _函数的具体用法?Python _怎么用?Python _使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: validate
def validate(self, element, value):
""" Check that what the user is typing is ok """
if len(value) == 0:
self.is_ok[element].set_from_stock("gtk-no", Gtk.IconSize.BUTTON)
self.is_ok[element].show()
self.error_label[element].show()
else:
result = validation.check(element, value)
if len(result) == 0:
self.is_ok[element].set_from_stock("gtk-yes", Gtk.IconSize.BUTTON)
self.is_ok[element].show()
self.error_label[element].hide()
else:
self.is_ok[element].set_from_stock("gtk-no", Gtk.IconSize.BUTTON)
self.is_ok[element].show()
if validation.NAME_BADCHAR in result:
txt = _("Invalid characters entered")
txt = "<small><span color='darkred'>%s</span></small>" % txt
self.error_label[element].set_markup(txt)
elif validation.NAME_BADDOTS in result:
txt = _("Username can't contain dots")
txt = "<small><span color='darkred'>%s</span></small>" % txt
self.error_label[element].set_markup(txt)
elif validation.NAME_LENGTH in result:
txt = _("Too many characters")
txt = "<small><span color='darkred'>%s</span></small>" % txt
self.error_label[element].set_markup(txt)
self.error_label[element].show()
开发者ID:nhold,项目名称:Cnchi,代码行数:30,代码来源:user_info.py
示例2: validate
def validate(self, element, value):
""" Check that what the user is typing is ok """
if len(value) == 0:
self.image_is_ok[element].set_from_icon_name(
ICON_WARNING,
Gtk.IconSize.LARGE_TOOLBAR)
self.image_is_ok[element].show()
self.error_label[element].show()
else:
result = validation.check(element, value)
if not result:
self.image_is_ok[element].set_from_icon_name(
ICON_OK,
Gtk.IconSize.LARGE_TOOLBAR)
self.image_is_ok[element].show()
self.error_label[element].hide()
else:
self.image_is_ok[element].set_from_icon_name(
ICON_WARNING,
Gtk.IconSize.LARGE_TOOLBAR)
self.image_is_ok[element].show()
if validation.NAME_BADCHAR in result:
txt = _("Invalid characters entered")
elif validation.NAME_BADDOTS in result:
txt = _("Username can't contain dots")
elif validation.NAME_LENGTH in result:
txt = _("Too many characters")
else:
txt = _("Unknown error")
my_format = "<small><span color='darkred'>{0}</span></small>"
txt = my_format.format(txt)
self.error_label[element].set_markup(txt)
self.error_label[element].show()
开发者ID:EntityOS,项目名称:Cnchi,代码行数:35,代码来源:user_info.py
示例3: set_keymap
def set_keymap(self):
""" Uses selected keymap """
if self.keyboard_layout['code']:
self.settings.set("keyboard_layout", self.keyboard_layout['code'])
self.settings.set("keyboard_variant", self.keyboard_variant['code'])
cmd = ['setxkbmap', '-layout', self.keyboard_layout['code']]
if self.keyboard_variant['code']:
cmd.extend(["-variant", self.keyboard_variant['code']])
try:
subprocess.check_call(cmd)
except subprocess.CalledProcessError as process_error:
logging.warning(process_error)
# Show logs to inform of keymap change
if self.keyboard_variant['code']:
cmd.extend(["-variant", self.keyboard_variant['code']])
txt = _("Set keyboard to layout name '{0}' ({1}) and variant name '{2}' ({3})").format(
self.keyboard_layout['description'],
self.keyboard_layout['code'],
self.keyboard_variant['description'],
self.keyboard_variant['code'])
else:
txt = _("Set keyboard to layout name '{0}' ({1})").format(
self.keyboard_layout['description'],
self.keyboard_layout['code'])
logging.debug(txt)
开发者ID:KGkotzamanidis,项目名称:DSGos-Installer,代码行数:29,代码来源:keymap.py
示例4: start_installation
def start_installation(self):
#self.install_progress.set_sensitive(True)
self.settings.set('auto_device', self.auto_device)
logging.info(_("Cnchi will install Antergos on %s") % self.auto_device)
# In automatic installation we always install Grub
self.settings.set('install_bootloader', True)
if os.path.exists("/sys/firmware/efi/systab"):
bootloader_type = "UEFI_x86_64"
else:
bootloader_type = "GRUB2"
self.settings.set('bootloader_type', bootloader_type)
self.settings.set('bootloader_device', self.auto_device)
logging.info(_("Antergos will install the %s bootloader on %s"), bootloader_type, self.auto_device)
# We don't need to pass which devices will be mounted nor which filesystems
# the devices will be formatted with, as auto_partition.py takes care of everything
# in an automatic installation.
mount_devices = {}
fs_devices = {}
if not self.testing:
self.process = installation_process.InstallationProcess( \
self.settings, \
self.callback_queue, \
mount_devices, \
fs_devices, \
None, \
self.alternate_package_list)
self.process.start()
else:
logging.warning(_("Testing mode. Cnchi will not change anything!"))
开发者ID:triplem,项目名称:Cnchi,代码行数:34,代码来源:automatic.py
示例5: show_info_dialog
def show_info_dialog(self, feature):
""" Some features show an information dialog when this screen is accepted """
if feature == "aur":
# Aur disclaimer
txt1 = _("Arch User Repository - Disclaimer")
txt2 = _("The Arch User Repository is a collection of user-submitted PKGBUILDs\n" \
"that supplement software available from the official repositories.\n\n" \
"The AUR is community driven and NOT supported by Arch or Antergos.\n")
elif feature == "ufw":
# Ufw rules info
txt1 = _("Uncomplicated Firewall will be installed with these rules:")
toallow = misc.get_network()
txt2 = _("ufw default deny\nufw allow from %s\nufw allow Transmission\nufw allow SSH") % toallow
txt1 = "<big>%s</big>" % txt1
txt2 = "<i>%s</i>" % txt2
info = Gtk.MessageDialog(transient_for=None,
modal=True,
destroy_with_parent=True,
message_type=Gtk.MessageType.INFO,
buttons=Gtk.ButtonsType.CLOSE)
info.set_markup(txt1)
info.format_secondary_markup(txt2)
info.run()
info.destroy()
开发者ID:triplem,项目名称:Cnchi,代码行数:26,代码来源:features.py
示例6: set_keymap
def set_keymap(self):
""" Uses selected keymap """
if self.keyboard_layout['code']:
self.settings.set("keyboard_layout", self.keyboard_layout['code'])
self.settings.set("keyboard_variant", self.keyboard_variant['code'])
# setxkbmap sets the keyboard layout for the current X session only
cmd = ['setxkbmap', '-layout', self.keyboard_layout['code']]
if self.keyboard_variant['code']:
cmd.extend(["-variant", self.keyboard_variant['code']])
txt = _("Set keyboard to '{0}' ({1}), wvariant '{2}' ({3})")
txt = txt.format(
self.keyboard_layout['description'],
self.keyboard_layout['code'],
self.keyboard_variant['description'],
self.keyboard_variant['code'])
else:
txt = _("Set keyboard to '{0}' ({1})").format(
self.keyboard_layout['description'],
self.keyboard_layout['code'])
try:
subprocess.check_call(cmd)
logging.debug(txt)
except (OSError, subprocess.CalledProcessError) as setxkbmap_error:
logging.warning(setxkbmap_error)
开发者ID:satriani-vai,项目名称:Cnchi,代码行数:27,代码来源:keymap.py
示例7: show_pool_type_help
def show_pool_type_help(self, pool_type):
""" Show pool type help to the user """
msg = ""
if pool_type == "None":
msg = _("'None' pool will use ZFS on a single selected disk.")
elif pool_type == "Stripe":
msg = _("When created together, with equal capacity, ZFS "
"space-balancing makes a span act like a RAID0 stripe. "
"The space is added together. Provided all the devices "
"are of the same size, the stripe behavior will "
"continue regardless of fullness level. If "
"devices/vdevs are not equally sized, then they will "
"fill mostly equally until one device/vdev is full.")
elif pool_type == "Mirror":
msg = _("A mirror consists of two or more devices, all data "
"will be written to all member devices. Cnchi will "
"try to group devices in groups of two.")
elif pool_type.startswith("RAID-Z"):
msg = _("ZFS implements RAID-Z, a variation on standard "
"RAID-5. ZFS supports three levels of RAID-Z which "
"provide varying levels of redundancy in exchange for "
"decreasing levels of usable storage. The types are "
"named RAID-Z1 through RAID-Z3 based on the number of "
"parity devices in the array and the number of disks "
"which can fail while the pool remains operational.")
if msg:
show.message(self.get_main_window(), msg)
开发者ID:FrankDev14,项目名称:Cnchi,代码行数:27,代码来源:zfs.py
示例8: prepare_device_list
def prepare_device_list(self):
""" Create columns for our treeview """
# Use check | Disk (sda) | Size(GB) | Name (device name) | Device ID
use_toggle = Gtk.CellRendererToggle()
use_toggle.connect("toggled", self.on_use_device_toggled)
col = Gtk.TreeViewColumn(
_("Use"), use_toggle, active=COL_USE_ACTIVE, visible=COL_USE_VISIBLE, sensitive=COL_USE_SENSITIVE
)
self.device_list.append_column(col)
render_text = Gtk.CellRendererText()
col = Gtk.TreeViewColumn(_("Disk"), render_text, text=COL_DISK)
self.device_list.append_column(col)
render_text_right = Gtk.CellRendererText()
render_text_right.set_property("xalign", 1)
col = Gtk.TreeViewColumn(_("Size (GB)"), render_text_right, text=COL_SIZE)
self.device_list.append_column(col)
col = Gtk.TreeViewColumn(_("Device"), render_text, text=COL_DEVICE_NAME)
self.device_list.append_column(col)
col = Gtk.TreeViewColumn(_("Disk ID"), render_text, text=COL_DISK_ID)
self.device_list.append_column(col)
开发者ID:satriani-vai,项目名称:Cnchi,代码行数:28,代码来源:zfs.py
示例9: get_changes
def get_changes(self):
""" Grab all changes for confirmation """
change_list = [action.Action("delete", self.auto_device)]
auto = auto_partition.AutoPartition(dest_dir=DEST_DIR,
auto_device=self.auto_device,
use_luks=self.settings.get("use_luks"),
luks_password=self.settings.get("luks_root_password"),
use_lvm=self.settings.get("use_lvm"),
use_home=self.settings.get("use_home"),
bootloader=self.settings.get("bootloader"),
callback_queue=self.callback_queue)
devices = auto.get_devices()
mount_devices = auto.get_mount_devices()
fs_devices = auto.get_fs_devices()
mount_points = {}
for mount_point in mount_devices:
device = mount_devices[mount_point]
mount_points[device] = mount_point
for device in sorted(fs_devices.keys()):
try:
txt = _("Device {0} will be created ({1} filesystem) as {2}").format(device, fs_devices[device], mount_points[device])
except KeyError:
txt = _("Device {0} will be created ({1} filesystem)").format(device, fs_devices[device])
act = action.Action("info", txt)
change_list.append(act)
return change_list
开发者ID:KGkotzamanidis,项目名称:DSGos-Installer,代码行数:31,代码来源:automatic.py
示例10: fill_choose_partition_combo
def fill_choose_partition_combo(self):
self.choose_partition_combo.remove_all()
devices = []
for device in sorted(self.oses.keys()):
# if "Swap" not in self.oses[device]:
if "windows" in self.oses[device].lower():
devices.append(device)
if len(devices) > 1:
new_device_found = False
for device in sorted(devices):
if self.get_new_device(device):
new_device_found = True
line = "{0} ({1})".format(self.oses[device], device)
self.choose_partition_combo.append_text(line)
self.select_first_combobox_item(self.choose_partition_combo)
self.show_all()
if not new_device_found:
txt = _("Can't find any spare partition number.\nAlongside installation can't continue.")
self.choose_partition_label.hide()
self.choose_partition_combo.hide()
self.label.set_markup(txt)
show.error(self.get_toplevel(), txt)
elif len(devices) == 1:
self.set_resize_widget(devices[0])
self.show_all()
self.choose_partition_label.hide()
self.choose_partition_combo.hide()
else:
logging.warning(_("Can't find any installed OS!"))
开发者ID:Gyruman,项目名称:thus,代码行数:32,代码来源:alongside.py
示例11: translate_ui
def translate_ui(self):
self.header.set_subtitle(_("Select Your Keyboard Layout"))
lbl = self.ui.get_object("label_layouts")
lbl.set_markup(_("Keyboard Layouts"))
lbl = self.ui.get_object("label_variants")
lbl.set_markup(_("Keyboard Variants"))
开发者ID:triplem,项目名称:Cnchi,代码行数:8,代码来源:keymap.py
示例12: check_pool_type
def check_pool_type(self, show_warning=False):
""" Check that the user has selected the right number
of devices for the selected pool type """
num_drives = 0
msg = ""
pool_type = self.zfs_options["pool_type"]
for row in self.device_list_store:
if row[COL_USE_ACTIVE]:
num_drives += 1
if pool_type == "None":
is_ok = num_drives == 1
if not is_ok:
msg = _("You must select one drive")
elif pool_type in ["Stripe", "Mirror"]:
is_ok = num_drives > 1
if not is_ok:
msg = _("For the {0} pool_type, you must select at least two "
"drives").format(pool_type)
elif "RAID" in pool_type:
pool_types = {
'RAID-Z': {'min_drives': 3, 'min_parity_drives': 1},
'RAID-Z2': {'min_drives': 4, 'min_parity_drives': 2},
'RAID-Z3': {'min_drives': 5, 'min_parity_drives': 3}
}
min_drives = pool_types[pool_type]['min_drives']
min_parity_drives = pool_types[pool_type]['min_parity_drives']
if num_drives < min_drives:
is_ok = False
msg = _("You must select at least {0} drives")
msg = msg.format(min_drives)
else:
num = math.log2(num_drives - min_parity_drives)
if not is_int(num):
msg = _("For the {0} pool type, you must use a 'power of "
"two' (2,4,8,...) plus the appropriate number of "
"drives for the parity. RAID-Z = 1 disk, RAIDZ-2 "
"= 2 disks, and so on.")
msg = msg.format(pool_type, min_parity_drives)
is_ok = False
else:
is_ok = True
else:
# If we get here, something is wrong.
msg = _('An unknown error occurred while processing chosen ZFS options.')
is_ok = False
if not is_ok and show_warning:
show.message(self.get_main_window(), msg)
return is_ok
开发者ID:FrankDev14,项目名称:Cnchi,代码行数:57,代码来源:zfs.py
示例13: translate_ui
def translate_ui(self):
""" Translates all ui elements """
txt = _("Installing Manjaro...")
txt = "<span weight='bold' size='large'>{0}</span>".format(txt)
self.title.set_markup(txt)
if len(self.info_label.get_label()) <= 0:
self.set_message(_("Please wait..."))
开发者ID:Gyruman,项目名称:thus,代码行数:9,代码来源:slides.py
示例14: translate_ui
def translate_ui(self):
txt = _("Select the OS you would like Antergos installed next to.")
txt = '<span size="large">%s</span>' % txt
self.label.set_markup(txt)
self.header.set_subtitle(_("Antergos Alongside Installation"))
txt = _("Install Now!")
self.forward_button.set_label(txt)
开发者ID:Acidburn0zzz,项目名称:Cnchi,代码行数:9,代码来源:alongside.py
示例15: translate_ui
def translate_ui(self, desktop, set_header=True):
""" Translates all ui elements """
label = self.ui.get_object("desktop_info")
txt = "<span weight='bold'>{0}</span>\n".format(desktop_info.NAMES[desktop])
description = desktop_info.DESCRIPTIONS[desktop]
txt = txt + _(description)
label.set_markup(txt)
# This sets the desktop's image
path = os.path.join(self.desktops_dir, desktop + ".png")
if self.desktop_image is None:
self.desktop_image = Gtk.Image.new_from_file(path)
overlay = self.ui.get_object("image_overlay")
overlay.add(self.desktop_image)
else:
self.desktop_image.set_from_file(path)
# and this sets the icon
filename = "desktop-environment-" + desktop.lower() + ".svg"
icon_path = os.path.join(desktop_info.DESKTOP_ICONS_PATH, "scalable", filename)
icon_exists = os.path.exists(icon_path)
if self.icon_desktop_image is None:
if icon_exists:
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(icon_path, 48, 48)
self.icon_desktop_image = Gtk.Image.new_from_pixbuf(pixbuf)
else:
filename = desktop.lower() + ".png"
icon_path = os.path.join(desktop_info.DESKTOP_ICONS_PATH, "48x48", filename)
icon_exists = os.path.exists(icon_path)
if icon_exists:
self.icon_desktop_image = Gtk.Image.new_from_file(icon_path)
else:
self.icon_desktop_image = Gtk.Image.new_from_icon_name(
"image-missing",
Gtk.IconSize.DIALOG)
overlay = self.ui.get_object("image_overlay")
overlay.add_overlay(self.icon_desktop_image)
else:
if icon_exists:
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(icon_path, 48, 48)
self.icon_desktop_image.set_from_pixbuf(pixbuf)
else:
filename = desktop.lower() + ".png"
icon_path = os.path.join(desktop_info.DESKTOP_ICONS_PATH, "48x48", filename)
icon_exists = os.path.exists(icon_path)
if icon_exists:
self.icon_desktop_image.set_from_file(icon_path)
else:
self.icon_desktop_image.set_from_icon_name("image-missing", Gtk.IconSize.DIALOG)
if set_header:
# set header text
txt = _("Choose Your Desktop")
self.header.set_subtitle(txt)
开发者ID:EntityOS,项目名称:Cnchi,代码行数:56,代码来源:desktop.py
示例16: check_pool_type
def check_pool_type(self, show_warning=False):
""" Check that the user has selected the right number
of devices for the selected pool type """
num_drives = 0
msg = ""
pool_type = self.zfs_options["pool_type"]
for row in self.device_list_store:
if row[COL_USE_ACTIVE]:
num_drives += 1
if pool_type == "None":
if num_drives == 1:
is_ok = True
else:
is_ok = False
msg = _("You must select one drive")
elif pool_type in ["Stripe", "Mirror"]:
if num_drives > 1:
is_ok = True
else:
is_ok = False
msg = _("For the {0} pool_type, you must select at least two " "drives").format(pool_type)
elif "RAID" in pool_type:
min_drives = 3
min_parity_drives = 1
if pool_type == "RAID-Z2":
min_drives = 4
min_parity_drives = 2
elif pool_type == "RAID-Z3":
min_drives = 5
min_parity_drives = 3
if num_drives < min_drives:
is_ok = False
msg = _("You must select at least {0} drives")
msg = msg.format(min_drives)
else:
num = math.log2(num_drives - min_parity_drives)
if not is_int(num):
msg = _(
"For the {0} pool type, you must use a 'power of "
"two' (2,4,8,...) plus the appropriate number of "
"drives for the parity. RAID-Z = 1 disk, RAIDZ-2 "
"= 2 disks, and so on."
)
msg = msg.format(pool_type, min_parity_drives)
else:
is_ok = True
if not is_ok and show_warning:
show.message(self.get_main_window(), msg)
return is_ok
开发者ID:satriani-vai,项目名称:Cnchi,代码行数:56,代码来源:zfs.py
示例17: translate_ui
def translate_ui(self):
""" Translates all ui elements """
txt = _("Choose the new size of your installation")
txt = '<span size="large">{0}</span>'.format(txt)
self.label.set_markup(txt)
txt = _("Choose the partition that you want to shrink:")
self.choose_partition_label.set_markup(txt)
self.header.set_subtitle(_("DSGos Alongside Installation"))
开发者ID:KGkotzamanidis,项目名称:DSGos-Installer,代码行数:10,代码来源:alongside.py
示例18: translate_ui
def translate_ui(self):
txt = _("The location you select will be used to help determine the system locale.\n" \
"This should normally be the country in which you reside.\n" \
"Here is a shortlist of locations based on the language you selected.")
self.label_help.set_markup(txt)
txt = _("Country, territory or area:")
txt = "<span weight='bold'>%s</span>" % txt
self.label_choose_country.set_markup(txt)
self.header.set_subtitle(_("Select your location"))
开发者ID:triplem,项目名称:Cnchi,代码行数:11,代码来源:location.py
示例19: translate_ui
def translate_ui(self):
""" Translates all ui elements """
txt = _("Select your keyboard layout")
txt = "<span weight='bold' size='large'>{0}</span>".format(txt)
self.title.set_markup(txt)
lbl = self.ui.get_object("label_layouts")
lbl.set_markup(_("Keyboard Layouts"))
lbl = self.ui.get_object("label_variants")
lbl.set_markup(_("Keyboard Variants"))
开发者ID:Gyruman,项目名称:thus,代码行数:11,代码来源:keymap.py
示例20: create_toolviews
def create_toolviews(self):
render = Gtk.CellRendererText()
col = Gtk.TreeViewColumn(_("Layouts"),render,text=0)
liststore = Gtk.ListStore(str)
self.layout_treeview.append_column(col)
self.layout_treeview.set_model(liststore)
render = Gtk.CellRendererText()
col = Gtk.TreeViewColumn(_("Variants"),render,text=0)
liststore = Gtk.ListStore(str)
self.variant_treeview.append_column(col)
self.variant_treeview.set_model(liststore)
开发者ID:Acidburn0zzz,项目名称:Cnchi,代码行数:12,代码来源:keymap.py
注:本文中的test_screen._函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论