本文整理汇总了Python中OMBManagerLocale._函数的典型用法代码示例。如果您正苦于以下问题:Python _函数的具体用法?Python _怎么用?Python _使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, session, mount_point):
Screen.__init__(self, session)
self.setTitle(_('openMultiboot Manager'))
self.session = session
self.mount_point = mount_point
self.data_dir = mount_point + '/' + OMB_DATA_DIR
self.upload_dir = mount_point + '/' + OMB_UPLOAD_DIR
self.select = None
self["label1"] = Label(_("Current Running Image:"))
self["label2"] = Label("")
self.populateImagesList()
self["list"] = List(self.images_list)
self["list"].onSelectionChanged.append(self.onSelectionChanged)
self["background"] = Pixmap()
self["key_red"] = Button(_('Rename'))
self["key_yellow"] = Button()
self["key_blue"] = Button(_('Menu'))
if BRANDING:
self["key_green"] = Button(_('Install'))
else:
self["key_green"] = Button('')
self["actions"] = ActionMap(["OkCancelActions", "ColorActions", "MenuActions"],
{
"cancel": self.close,
"red": self.keyRename,
"yellow": self.keyDelete,
"green": self.keyInstall,
"blue": self.showMen,
"ok": self.KeyOk,
"menu": self.showMen,
})
示例2: __init__
def __init__(self, session, mount_point):
Screen.__init__(self, session)
self.setTitle(_('openMultiboot Manager'))
self.session = session
self.mount_point = mount_point
self.data_dir = mount_point + '/' + OMB_DATA_DIR
self.upload_dir = mount_point + '/' + OMB_UPLOAD_DIR
self.populateImagesList()
self["list"] = List(self.images_list)
self["list"].onSelectionChanged.append(self.onSelectionChanged)
self["background"] = Pixmap()
self["key_red"] = Button(_('Rename'))
self["key_yellow"] = Button()
self["key_blue"] = Button(_('About'))
if BRANDING:
self["key_green"] = Button(_('Install'))
else:
self["key_green"] = Button('')
self["config_actions"] = ActionMap(["OkCancelActions", "ColorActions"],
{
"cancel": self.close,
"red": self.keyRename,
"yellow": self.keyDelete,
"green": self.keyInstall,
"blue": self.keyAbout
})
示例3: __init__
def __init__(self, session, kernel_module):
self.session = session
self.kernel_module = kernel_module
message = _("You need the module ") + self.kernel_module + _(" to use openMultiboot\nDo you want install it?")
disks_list = []
for partition in harddiskmanager.getMountedPartitions():
if partition.mountpoint != '/':
disks_list.append((partition.description, partition.mountpoint))
self.session.openWithCallback(self.installCallback, MessageBox, message, MessageBox.TYPE_YESNO)
示例4: installPrepare
def installPrepare(self):
self.timer.stop()
selected_image = self.selected_image
selected_image_identifier = self.guessIdentifierName(selected_image)
source_file = self.mount_point + '/' + OMB_UPLOAD_DIR + '/' + selected_image + '.zip'
target_folder = self.mount_point + '/' + OMB_DATA_DIR + '/' + selected_image_identifier
kernel_target_folder = self.mount_point + '/' + OMB_DATA_DIR + '/.kernels'
kernel_target_file = kernel_target_folder + '/' + selected_image_identifier + '.bin'
if not os.path.exists(kernel_target_folder):
try:
os.makedirs(kernel_target_folder)
except OSError as exception:
self.showError(_("Cannot create kernel folder %s") % kernel_target_folder)
return
if os.path.exists(target_folder):
self.showError(_("The folder %s already exist") % target_folder)
return
try:
os.makedirs(target_folder)
except OSError as exception:
self.showError(_("Cannot create folder %s") % target_folder)
return
tmp_folder = self.mount_point + '/' + OMB_TMP_DIR
if os.path.exists(tmp_folder):
os.system(OMB_RM_BIN + ' -rf ' + tmp_folder)
try:
os.makedirs(tmp_folder)
os.makedirs(tmp_folder + '/ubi')
os.makedirs(tmp_folder + '/jffs2')
except OSError as exception:
self.showError(_("Cannot create folder %s") % tmp_folder)
return
if os.system(OMB_UNZIP_BIN + ' ' + source_file + ' -d ' + tmp_folder) != 0:
self.showError(_("Cannot deflate image"))
return
if self.installImage(tmp_folder, target_folder, kernel_target_file, tmp_folder):
os.system(OMB_RM_BIN + ' -f ' + source_file)
self.messagebox.close()
self.close()
os.system(OMB_RM_BIN + ' -rf ' + tmp_folder)
示例5: __init__
def __init__(self, session, mount_point, upload_list):
Screen.__init__(self, session)
self.setTitle(_('openMultiboot Install'))
self.session = session
self.mount_point = mount_point
self['info'] = Label(_("Choose the image to install"))
self["list"] = List(upload_list)
self["actions"] = ActionMap(["SetupActions"],
{
"cancel": self.keyCancel,
"ok": self.keyInstall
})
示例6: doFormatDevice
def doFormatDevice(self):
self.timer.stop()
self.error_message = ''
if os.system('umount /dev/' + self.response.device) != 0:
self.error_message = _('Cannot umount the device')
else:
if os.system('/sbin/mkfs.ext4 /dev/' + self.response.device) != 0:
self.error_message = _('Cannot format the device')
else:
if os.system('mount /dev/' + self.response.device + ' ' + self.response.mountpoint) != 0:
self.error_message = _('Cannot remount the device')
self.messagebox.close()
self.timer = eTimer()
self.timer.callback.append(self.afterFormat)
self.timer.start(100)
示例7: keyRename
def keyRename(self):
self.renameIndex = self["list"].getIndex()
name = self["list"].getCurrent()
if self["list"].getIndex() == 0:
if name.endswith('(Flash)'):
name = name[:-8]
self.session.openWithCallback(self.renameEntryCallback, VirtualKeyBoard, title=_("Please enter new name:"), text=name)
示例8: installImageTARBZ2
def installImageTARBZ2(self, src_path, dst_path, kernel_dst_path, tmp_folder):
base_path = src_path + '/' + OMB_GETIMAGEFOLDER
rootfs_path = base_path + '/' + OMB_GETMACHINEROOTFILE
kernel_path = base_path + '/' + OMB_GETMACHINEKERNELFILE
if os.system(OMB_TAR_BIN + ' jxf %s -C %s' % (rootfs_path,dst_path)) != 0:
self.showError(_("Error unpacking rootfs"))
return False
if os.path.exists(dst_path + '/usr/bin/enigma2'):
if os.system(OMB_CP_BIN + ' ' + kernel_path + ' ' + kernel_dst_path) != 0:
self.showError(_("Error copying kernel"))
return False
self.dirtyHack(dst_path)
return True
示例9: installImage
def installImage(self, src_path, dst_path, kernel_dst_path, tmp_folder):
if OMB_GETIMAGEFILESYSTEM == "ubi":
return self.installImageUBI(src_path, dst_path, kernel_dst_path, tmp_folder)
elif OMB_GETIMAGEFILESYSTEM == "jffs2":
return self.installImageJFFS2(src_path, dst_path, kernel_dst_path, tmp_folder)
else:
self.showError(_("Your STB doesn\'t seem supported"))
return False
示例10: keyDelete
def keyDelete(self):
if len(self.images_entries) == 0:
return
index = self["list"].getIndex()
if index >= 0 and index < len(self.images_entries):
self.entry_to_delete = self.images_entries[index]
if self.canDeleteEntry(self.entry_to_delete):
self.session.openWithCallback(self.deleteConfirm, MessageBox, _("Do you want to delete %s?") % self.entry_to_delete['label'], MessageBox.TYPE_YESNO)
示例11: __init__
def __init__(self, session):
self.session = session
message = _("Where do you want to install openMultiboot?")
disks_list = []
for partition in harddiskmanager.getMountedPartitions():
if partition and partition.mountpoint and partition.device and partition.mountpoint != '/' and partition.device[:2] == 'sd':
disks_list.append((partition.description, partition))
if len(disks_list) > 0:
disks_list.append((_("Cancel"), None))
self.session.openWithCallback(self.initCallback, MessageBox, message, list=disks_list)
else:
self.session.open(
MessageBox,
_("No suitable devices found"),
type = MessageBox.TYPE_ERROR
)
示例12: confirmNextbootCB
def confirmNextbootCB(self, ret):
if ret:
image = self.images_entries[self.select]['identifier']
print "[OMB] set nextboot to %s" % image
file_entry = self.data_dir + '/.nextboot'
f = open(file_entry, 'w')
f.write(image)
f.close()
self.session.openWithCallback(self.confirmRebootCB, MessageBox,_('Do you want to reboot now ?'), MessageBox.TYPE_YESNO)
示例13: Plugins
def Plugins(**kwargs):
return [
PluginDescriptor(
name="OpenMultiboot",
description=_("OpenMultiboot Manager"),
icon="plugin.png",
where=[PluginDescriptor.WHERE_EXTENSIONSMENU, PluginDescriptor.WHERE_PLUGINMENU],
fnc=OMBManager,
)
]
示例14: __init__
def __init__(self, session, mount_point, upload_list):
Screen.__init__(self, session)
self.setTitle(_('openMultiboot Install'))
self.session = session
self.mount_point = mount_point
self.esize = "128KiB"
self.vid_offset = "2048"
self.nandsim_parm = "first_id_byte=0x20 second_id_byte=0xac third_id_byte=0x00 fourth_id_byte=0x15"
self['info'] = Label(_("Choose the image to install"))
self["list"] = List(upload_list)
self["actions"] = ActionMap(["SetupActions"],
{
"cancel": self.keyCancel,
"ok": self.keyInstall
})
示例15: installModule
def installModule(self):
self.timer.stop()
self.error_message = ''
if os.system('opkg update && opkg install ' + self.kernel_module) != 0:
self.error_message = _('Cannot install ' + self.kernel_module)
self.messagebox.close()
self.timer = eTimer()
self.timer.callback.append(self.afterInstall)
self.timer.start(100)