本文整理汇总了Python中page.Page.on_init方法的典型用法代码示例。如果您正苦于以下问题:Python Page.on_init方法的具体用法?Python Page.on_init怎么用?Python Page.on_init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类page.Page
的用法示例。
在下文中一共展示了Page.on_init方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: on_init
# 需要导入模块: from page import Page [as 别名]
# 或者: from page.Page import on_init [as 别名]
def on_init(self):
Page.on_init(self)
self.frontend.set_title(_("%s Uninstaller") % self.info.previous_distro_name)
#header
msg = _("You Sure ?")
self.insert_header(
msg,
"",
"StartOS-header.bmp")#% self.info.previous_distro_name[0:7])
#navigation
self.insert_navigation(_("Uninstall"), _("Cancel"), default=2)
self.navigation.button2.on_click = self.on_cancel
self.navigation.button1.on_click = self.on_continue
msg = _("Uninstaller will remove below directroys, if them contain your\
usefull things ,please click <cancel> and backup them")
msg = msg + "\r\n\r\n" + self.info.previous_target_dir
if self.info.pre_install_path and os.path.isdir(self.info.pre_install_path)\
and self.info.previous_target_dir.lower() != self.info.pre_install_path.lower():
msg = msg + "\r\n" + self.info.pre_install_path # 这里确定要不要增加X:\startos-loop
if self.info.pre_install_path2 and os.path.isdir(self.info.pre_install_path2)\
and self.info.previous_target_dir.lower() != self.info.pre_install_path2.lower():
msg = msg + "\r\n" + self.info.pre_install_path2 # 这里确定要不要增加X:\startos-livecd
#Main control container
self.insert_main()
self.uninstall_label = ui.Label(
self.main,
40, 40, self.main.width - 80, 80,# x,y, width, height
"")
self.uninstall_label.set_text(msg)
示例2: on_init
# 需要导入模块: from page import Page [as 别名]
# 或者: from page.Page import on_init [as 别名]
def on_init(self):
Page.on_init(self)
self.set_background_color(255,255,255)
self.frontend.set_title(_("%s CD Boot Helper") % self.info.cd_distro.name)
self.insert_vertical_image("%s-vertical.bmp" % self.info.cd_distro.name)
#sanity checks
self.info.distro = self.info.cd_distro
self.info.target_drive = None
for drive in [self.info.system_drive] + self.info.drives:
if drive.free_space_mb > self.info.distro.max_iso_size/1000000:
self.info.target_drive = drive
break
if not self.info.target_drive:
self.frontend.show_error_message(_("Not enough disk space to proceed"))
#navigation
self.insert_navigation(_("Accessibility"), _("Install"), _("Cancel"), default=2)
self.navigation.button3.on_click = self.on_cancel
self.navigation.button2.on_click = self.on_install
self.navigation.button1.on_click = self.on_accessibility
#main container
self.insert_main()
self.main.set_background_color(255,255,255)
self.main.title = ui.Label(self.main, 40, 20, self.main.width - 80, 60, _("Install CD boot helper"))
self.main.title.set_font(size=20, bold=True, family="Arial")
txt = _("If your machine cannot boot off the CD, this program will install a new boot menu entry to help you boot from CD. In most cases this program is not needed, and it is sufficient to reboot with the CD-Rom in the tray.\n\nDo you want to proceed and install the CD booter?")
self.main.label = ui.Label(self.main, 40, 90, self.main.width - 80, 80, txt)
示例3: on_init
# 需要导入模块: from page import Page [as 别名]
# 或者: from page.Page import on_init [as 别名]
def on_init(self):
Page.on_init(self)
self.frontend.set_title(_("%s Uninstaller") % self.info.previous_distro_name)
#header
if self.info.uninstall_before_install:
msg = _("Uninstallation required")
else:
msg = _("You are about to uninstall %s") % self.info.previous_distro_name
self.insert_header(
msg,
"",
"%s-header.bmp" % self.info.previous_distro_name)
#navigation
self.insert_navigation(_("Uninstall"), _("Cancel"), default=2)
self.navigation.button2.on_click = self.on_cancel
self.navigation.button1.on_click = self.on_uninstall
#Main control container
self.insert_main()
if self.info.uninstall_before_install:
msg = _("A previous installation was detected, it needs to be uninstalled before continuing")
else:
msg = _("Are you sure you want to uninstall?")
self.uninstall_label = ui.Label(
self.main,
40, 40, self.main.width - 80, 30,
msg)
示例4: on_init
# 需要导入模块: from page import Page [as 别名]
# 或者: from page.Page import on_init [as 别名]
def on_init(self):
Page.on_init(self)
self.set_background_color(255, 255, 255)
self.insert_vertical_image("%s-vertical.bmp" % self.info.cd_distro.name)
# navigation
self.insert_navigation(_("< Back"), _("Finish"), _("Cancel"), default=2)
self.navigation.button1.on_click = self.on_back
self.navigation.button2.on_click = self.on_finish
self.navigation.button3.on_click = self.on_cancel
# main container
self.insert_main()
self.main.set_background_color(255, 255, 255)
self.main.title = ui.Label(self.main, 40, 20, self.main.width - 80, 60, _("Reboot required"))
self.main.title.set_font(size=20, bold=True, family="Arial")
txt = _(
"To start the Live CD you need to reboot your machine leaving the CD in the tray. If your machine cannot boot from the CD, the last option should work in most cases."
)
self.main.label = ui.Label(self.main, 40, 90, self.main.width - 80, 40, txt)
self.main.reboot_now = ui.RadioButton(self.main, 60, 150, self.main.width - 100, 20, _("Reboot now"))
self.main.reboot_later = ui.RadioButton(
self.main, 60, 180, self.main.width - 100, 20, _("I want to manually reboot Later")
)
self.main.cd_boot = ui.RadioButton(self.main, 60, 210, self.main.width - 100, 20, _("Help me to boot from CD"))
self.main.reboot_later.set_check(True)
示例5: on_init
# 需要导入模块: from page import Page [as 别名]
# 或者: from page.Page import on_init [as 别名]
def on_init(self):
Page.on_init(self)
#header
if self.info.distro:
distro_name = self.info.distro.name
elif self.info.previous_distro_name:
distro_name = self.info.previous_distro_name
self.insert_header(
_("Installing %(distro)s-%(version)s") % dict(distro=distro_name, version=self.info.version),
_("Please wait"),
"%s-header.bmp" % distro_name)
#navigation
self.insert_navigation(_("Cancel"))
self.navigation.button1.on_click = self.on_cancel
#main container
self.insert_main()
self.main.task_label = ui.Label(self.main, 20, 20, self.width - 40, 20)
self.main.progressbar = ui.ProgressBar(self.main, 20, 50, self.width - 40, 20)
self.main.subtask_label = ui.Label(self.main, 20, 80, self.width - 40, 20)
self.main.subprogressbar = ui.ProgressBar(self.main, 20, 110, self.width - 40, 20)
self.main.localiso_button = ui.Button(self.main, 20, 150, 200, 20, _("Do not download, use a local file"))
self.main.localiso_button.hide()
self.main.subtask_label.hide()
self.main.subprogressbar.hide()
示例6: on_init
# 需要导入模块: from page import Page [as 别名]
# 或者: from page.Page import on_init [as 别名]
def on_init(self):
Page.on_init(self)
if self.info.needfix != 0:
wintitle = _("%s Uninstaller/Fixer") % self.info.previous_distro_name
if self.info.uninstall_before_install:
msg = _("Uninstallation/fixed required")
else:
msg = _("You are about to uninstall/Fix %s") % self.info.previous_distro_name
else:
wintitle = _("%s Uninstaller") % self.info.previous_distro_name
#header
if self.info.uninstall_before_install:
msg = _("Uninstallation required")
else:
msg = _("You are about to uninstall %s") % self.info.previous_distro_name
self.frontend.set_title(wintitle)
self.insert_header(
msg,
"",
"StartOS-header.bmp")#% self.info.previous_distro_name[0:7])
#navigation
if self.info.needfix != 0:# and self.info.registry:
self.insert_navigation(_("Fix"), _("Uninstall"), _("Cancel"), default=3)
self.navigation.button3.on_click = self.on_cancel
self.navigation.button2.on_click = self.on_uninstall
self.navigation.button1.on_click = self.run_fixboot
else:
self.insert_navigation(_("Uninstall"), _("Cancel"), default=2)
self.navigation.button2.on_click = self.on_cancel
self.navigation.button1.on_click = self.on_uninstall
#Main control container
self.insert_main()
if self.info.uninstall_before_install:
if self.info.inst == "uninstall.exe":
msg = _("Do you want to uninstall %s?") % self.info.previous_distro_name
else:
msg = _("A previous installation was detected, it needs to be uninstalled before continuing")
else:
msg = _("Are you sure you want to uninstall?")
FIXLABEL_HEIGHT = 60
self.uninstall_label = ui.Label(
self.main,
40, 40, self.main.width - 80, 30 + FIXLABEL_HEIGHT,# x,y, width, height
"")
if self.info.needfix:
msg = msg + _("\r\n\r\nNote: Installer found that your previous installation was broken, but the loop device is still exists, and advises you to <fix> first !")
self.uninstall_label.set_text(msg)
self.backup_iso = ui.CheckButton(
self.main, 80, 70, self.main.width - 120, 12,
_("Backup the downloaded files (ISO)"))
self.backup_iso.set_check(False)
self.backup_iso.hide()
示例7: on_init
# 需要导入模块: from page import Page [as 别名]
# 或者: from page.Page import on_init [as 别名]
def on_init(self):
Page.on_init(self)
self.set_background_color(255,255,255)
self.insert_vertical_image("%s-vertical.bmp" % self.info.cd_distro.name)
distro_name = self.info.cd_distro.name
self.frontend.set_title(_("%s Menu") % distro_name)
cd_drive = self.info.drives_dict.get(self.info.cd_path[:2].lower())
#navigation
self.insert_navigation(_("Cancel"))
self.navigation.button1.on_click = self.on_cancel
#main container
self.insert_main()
self.main.set_background_color(255,255,255)
x = 10
sep = 8
y = 10
bw = 200
lw = self.main.width - x*2
bh = 30
lh = 66
#boot from cd
self.main.boot_cd_button = ui.FlatButton(self.main, x, y, bw, bh, _("Demo and full installation"))
y += bh + 2
txt = _("Try %(distro)s without installing! Simply reboot your machine with the CD in the tray. You may perform a full installation from within the demo to install %(distro)s either alongside Windows or as the only operating system.")
txt = txt % dict(distro=distro_name)
self.main.boot_cd_label = ui.Label(self.main, x, y, lw, lh, txt)
self.main.boot_cd_button.on_click = self.on_cd_boot
#wubi
used = ((cd_drive.total_space_mb - cd_drive.free_space_mb)*1024*1024)
# Hide Wubi from the autorun page, per bug #975251.
#if self.info.force_wubi:
y += lh + sep
self.main.wubi_button = ui.FlatButton(self.main, x, y, bw, bh, _("Install inside Windows"))
y += bh + 2
txt = _("Install and uninstall %(distro)s like any other application, without the need for a dedicated partition. You will be able to boot into either Windows or %(distro)s. Hibernation is not enabled in this mode and disk performance is slightly reduced.")
txt = txt % dict(distro=distro_name)
self.main.wubi_label = ui.Label(self.main, x, y, lw, lh, txt)
self.main.wubi_button.on_click = self.on_wubi
#info
y += lh + sep
self.main.info_button = ui.FlatButton(self.main, x, y, bw, bh, _("Learn more"))
y += bh + 2
txt = _("%(distro)s is a free, community developed, linux-based operating system complete with a web browser, productivity software, instant messaging, and much more.")
txt = txt % dict(distro=distro_name)
self.main.info_label = ui.Label(self.main, x, y, lw, lh, txt)
self.main.info_button.on_click = self.on_info
示例8: on_init
# 需要导入模块: from page import Page [as 别名]
# 或者: from page.Page import on_init [as 别名]
def on_init(self):
Page.on_init(self)
self.set_background_color(255,255,255)
self.insert_vertical_image("%s-vertical.bmp" % self.info.previous_distro_name[0:7])
#navigation
self.insert_navigation(_("Finish"), default=1)
self.navigation.button1.on_click = self.on_finish
#main container
self.insert_main()
self.main.set_background_color(255,255,255)
self.main.title = ui.Label(self.main, 40, 20, self.main.width - 80, 60, _("Uninstallation completed"))
self.main.title.set_font(size=20, bold=True, family="Arial")
self.main.label = ui.Label(self.main, 40, 90, self.main.width - 80, 40, _("%s has been successfully uninstalled") % self.info.previous_distro_name)
示例9: on_init
# 需要导入模块: from page import Page [as 别名]
# 或者: from page.Page import on_init [as 别名]
def on_init(self):
Page.on_init(self)
#shorter list
self.language2lang_country = {
_("Chinese (CN)"): "zh_CN",
_("Chinese (TW)"): "zh_TW",
_("English (US)"): "en_US",
}
self.lang_country2language = dict([(v,k) for k,v in self.language2lang_country.items()])
#header
#The title and image are overridden in on_distro_change, the following are stubs
self.insert_header(
"Installing",
_("In LiveCD,you can try and decide whether to install StartOS.Please select a partition,and the rest of the space must be greater than 1G"),
"header.bmp")
#navigation
self.insert_navigation(_("Rollback"), _("Install"), _("Cancel"), default=2)
self.navigation.button3.on_click = self.on_cancel
self.navigation.button2.on_click = self.on_install
self.navigation.button1.on_click = self.on_rollback
#Main control container
self.insert_main()
h=24
w=150
#目标驱动器选择
picture, label, self.target_drive_list = self.add_controls_block(
self.main, h, h,
"install.bmp", _("Installation drive:"), False)
#桌面环境选择
picture, label, self.distro_list = self.add_controls_block(
self.main, h, h*4,
"desktop.bmp", _("Desktop environment:"), True)
self.populate_distro_list()
self.distro_list.on_change = self.on_distro_change
#语言选择
picture, label, self.language_list = self.add_controls_block(
self.main, h*4 + w, h,
"language.bmp", _("Language:"), True)
self.populate_language_list()
self.language_list.on_change = self.on_language_change
示例10: on_init
# 需要导入模块: from page import Page [as 别名]
# 或者: from page.Page import on_init [as 别名]
def on_init(self):
Page.on_init(self)
self.set_background_color(255,255,255)
self.insert_vertical_image("%s-vertical.bmp" % self.info.distro.name)
#navigation
self.insert_navigation(_("Finish"), default=1)
self.navigation.button1.on_click = self.on_finish
#main container
self.insert_main()
self.main.set_background_color(255,255,255)
self.main.title = ui.Label(self.main, 40, 20, self.main.width - 80, 60, _("Completing the %s Setup Wizard") % self.info.distro.name)
self.main.title.set_font(size=20, bold=True, family="Arial")
self.main.label = ui.Label(self.main, 40, 90, self.main.width - 80, 40, _("You need to reboot to complete the installation"))
self.main.reboot_now = ui.RadioButton(self.main, 60, 150, self.main.width - 100, 20, _("Reboot now"))
self.main.reboot_later = ui.RadioButton(self.main, 60, 180, self.main.width - 100, 20, _("I want to manually reboot later"))
self.main.reboot_later.set_check(True)
示例11: on_init
# 需要导入模块: from page import Page [as 别名]
# 或者: from page.Page import on_init [as 别名]
def on_init(self):
Page.on_init(self)
self.frontend.set_title(_("%s Uninstaller") % self.info.previous_distro_name)
#header
if self.info.uninstall_before_install:
msg = _("Uninstallation required")
else:
msg = _("You are about to uninstall %s") % self.info.previous_distro_name
self.insert_header(
msg,
"",
"StartOS-header.bmp")#% self.info.previous_distro_name[0:7])
#navigation
self.insert_navigation(_("Uninstall"), _("Cancel"), default=2)
self.navigation.button2.on_click = self.on_cancel
self.navigation.button1.on_click = self.on_uninstall
#Main control container
self.insert_main()
if self.info.uninstall_before_install:
if self.info.inst == "uninstall.exe":
msg = _("Do you want to uninstall %s?") % self.info.previous_distro_name
else:
msg = _("A previous installation was detected, it needs to be uninstalled before continuing")
else:
msg = _("Are you sure you want to uninstall?")
self.uninstall_label = ui.Label(
self.main,
40, 40, self.main.width - 80, 30,
msg)
self.backup_iso = ui.CheckButton(
self.main, 80, 70, self.main.width - 120, 12,
_("Backup the downloaded files (ISO)"))
self.backup_iso.set_check(False)
self.backup_iso.hide()
install_dir = os.path.join(self.info.previous_target_dir, 'install')
示例12: on_init
# 需要导入模块: from page import Page [as 别名]
# 或者: from page.Page import on_init [as 别名]
def on_init(self):
Page.on_init(self)
self.info.accessibility = ""
#header
self.insert_header(
_("Accessibility profile"),
_("Please select the appropriate accessibility profile"),
"%s-header.bmp" % self.info.distro)
#navigation
self.insert_navigation(_("Next >>"), _("Cancel"), default=1)
self.navigation.button2.on_click = self.on_cancel
self.navigation.button1.on_click = self.on_next
#Main control container
self.insert_main()
#visibility aids
h=30
w = (self.width - h*7)/2
self.main.visibility_group = ui.GroupBox(self.main, h, h*1, w+h*2, h*6 - 10, text=_("Visibility Aids"))
self.main.visibility1_button = ui.RadioButton(self.main, h*2, h*2, w, h, text = _("Visibility1"))
self.main.visibility2_button = ui.RadioButton(self.main, h*2, h*3, w, h, text = _("Visibility2"))
self.main.visibility3_button = ui.RadioButton(self.main, h*2, h*4, w, h, text = _("Visibility3"))
self.main.braille_button = ui.RadioButton(self.main, h*2, h*5, w, h, text = _("Braille"))
#mobility aids
self.main.mobility_group = ui.GroupBox(self.main, w+h*4, h*1, w+h*2, h*4 - 10, text=_("Mobility Aids"))
self.main.mobility1_button = ui.RadioButton(self.main, w+h*5, h*2, w, h, text = _("Mobility1"))
self.main.mobility2_button = ui.RadioButton(self.main, w+h*5, h*3, w, h, text = _("Mobility2"))
#no aids
self.main.no_aids_button = ui.RadioButton(self.main, w+h*5, h*5 + 6, w, 20, text=_("None"))
self.main.no_aids_button.set_check(True)
示例13: on_init
# 需要导入模块: from page import Page [as 别名]
# 或者: from page.Page import on_init [as 别名]
def on_init(self):
Page.on_init(self)
#header
#The title and image are overridden in on_distro_change, the following are stubs
self.insert_header(
"Installing",
_("Please select username and password for the new account"),
"header.bmp")
#navigation
self.insert_navigation(_("Accessibility"), _("Install"), _("Cancel"), default=2)
self.navigation.button3.on_click = self.on_cancel
self.navigation.button2.on_click = self.on_install
self.navigation.button1.on_click = self.on_accessibility
#Main control container
self.insert_main()
h=24
w=150
picture, label, self.target_drive_list = self.add_controls_block(
self.main, h, h,
"install.bmp", _("Installation drive:"), True)
# populated by on_distro_change
self.target_drive_list.on_change = self.on_drive_change
picture, label, self.size_list = self.add_controls_block(
self.main, h, h*4,
"disksize.bmp", _("Installation size:"), True)
# populated by on_drive_change
self.size_list.on_change = self.on_size_change
picture, label, self.distro_list = self.add_controls_block(
self.main, h, h*7,
"desktop.bmp", _("Desktop environment:"), True)
self.populate_distro_list()
self.distro_list.on_change = self.on_distro_change
picture, label, self.language_list = self.add_controls_block(
self.main, h*4 + w, h,
"language.bmp", _("Language:"), True)
self.populate_language_list()
self.language_list.on_change = self.on_language_change
if self.info.username:
username = self.info.username
else:
username = self.info.host_username
username = re.sub('[^-a-z0-9_]', '', username.strip().lower())
picture, label, combo = self.add_controls_block(
self.main, h*4 + w, h*4,
"user.bmp", _("Username:"), None)
self.username = ui.Edit(
self.main,
h*4 + w + 42, h*4+20, 150, 20,
username, False)
picture, label, combo = self.add_controls_block(
self.main, h*4 + w, h*7,
"lock.bmp", _("Password:"), None)
label.move(h*4 + w + 42, h*7 - 24)
password = ""
if self.info.password:
password = self.info.password
elif self.info.test:
password = "test"
self.password1 = ui.PasswordEdit(
self.main,
h*4 + w + 42, h*7-4, 150, 20,
password, False)
self.password2 = ui.PasswordEdit(
self.main,
h*4 + w + 42, h*7+20, 150, 20,
password, False)
self.error_label = ui.Label(
self.main,
40, self.main.height - 20, self.main.width - 80, 12,
"")
self.error_label.set_text_color(255, 0, 0)
if self.info.non_interactive:
self.on_install()
示例14: on_init
# 需要导入模块: from page import Page [as 别名]
# 或者: from page.Page import on_init [as 别名]
def on_init(self):
Page.on_init(self)
#shorter list
self.language2lang_country = {
_("Chinese (CN)"): "zh_CN",
_("Chinese (TW)"): "zh_TW",
_("English (US)"): "en_US",
}
self.lang_country2language = dict([(v,k) for k,v in self.language2lang_country.items()])
#header
#The title and image are overridden in on_distro_change, the following are stubs
self.insert_header(
"Installing",
_("Please select a partition,and the rest of the space must be greater than 5G."),
"header.bmp")
#navigation
self.insert_navigation(_("Install LiveCD"), _("Install"), _("Cancel"), default=2)
self.navigation.button3.on_click = self.on_cancel
self.navigation.button2.on_click = self.on_install
self.navigation.button1.on_click = self.on_accessibility
#Main control container
self.insert_main()
self.h=24
self.w=150
#目标驱动器选择
##print "目标驱动器选择"
picture, label = self.add_controls_block(
self.main, self.h, self.h - 5,
"install.bmp", _("Installation drive:"))#, True)
#分区大小选择
##print "分区大小选择"
picture, label = self.add_controls_block(
self.main, self.h, self.h*4 - 10,
"disksize.bmp", _("Installation size:"))#, True)
#桌面环境选择
##print "桌面环境选择"
picture, label = self.add_controls_block(
self.main, self.h, self.h*7 - 15,
"desktop.bmp", _("Desktop environment:"))#, True)
self.populate_distro_list(self.h,self.h*7)
#语言选择
##print "语言选择"
picture, label = self.add_controls_block(
self.main, self.h*4 + self.w, self.h - 5,
"language.bmp", _("Language:"))
self.populate_language_list(self.h*4 + self.w,self.h )
username = self.info.host_username.strip().lower()
#正则表达式,re.sub把信念含有^-a-z0-9_的username对应替换成空
username = re.sub('[^-a-z0-9_]', '', username)
#用户名
##print "用户名"
picture, label = self.add_controls_block(
self.main, self.h*4 + self.w, self.h*4 - 12,
"user.bmp", _("Username:"))
self.username = ui.Edit(
self.main,
self.h*4 + self.w + 42, self.h*4+20 - 13, 150, 20,
username, False)
#密码
##print "密码"
picture, label = self.add_controls_block(
self.main, self.h*4 + self.w, self.h*7 - 15,
"lock.bmp", _("Password:"))
label.move(self.h*4 + self.w + 42, self.h*7 - 24 - 12)
# 安装模式
self.chk_bt_instmod = ui.CheckButton(
self.main,
self.h * 3 - 6, self.w + 58, 12, 12,
None)
self.chk_bt_instmod_label = ui.Label(
self.main,
self.h * 3 + 11, self.w + 57, 60, 16,
_("Fast Install"))
self.chk_bt_instmod.set_check(False)
self.chk_bt_instmod.hide()
self.chk_bt_instmod_label.hide()
# 自动登录
self.chk_bt_autologin = ui.CheckButton(self.main,
# self.h * 12, self.w + 58, 12, 12,# x,y,width,height
self.h * 3 - 6, self.w + 58, 12, 12,
None)
self.chk_bt_autologin_label = ui.Label(
self.main,
# self.h * 12 + 17, self.w + 57, 60, 16,
self.h * 3 + 11, self.w + 57, 60, 16,
_("Auto Login"))
self.chk_bt_autologin.set_check(False)
#.........这里部分代码省略.........