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()
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)
def insert_header(self, title, subtitle, bmp_file): ''' Inserts a header with image, title and subtitle ''' hbh = 57 hbw = 150 self.header = ui.Panel( self, 0, 0 , self.width, hbh+2) if bmp_file: self.header.image = ui.Bitmap( self.header, 0, 0, hbw, hbh) self.header.image.set_image( os.path.join(unicode(str(self.info.image_dir), 'mbcs'), unicode(str(bmp_file), 'mbcs'))) if title: self.header.title = ui.Label( self.header, hbw + 20, 10, self.width - 200, 16, text = title) self.header.title.set_font(bold=True) if subtitle: self.header.subtitle = ui.Label( self.header, hbw + 20, 26, self.width - 200, 26, text = subtitle) self.header.line = ui.EtchedRectangle(self.header,0, hbh,self.width, 2) self.header.height = hbh + 2 self.header.set_background_color(255,255,255)
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
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) #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)
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)
def add_controls_block(self, parent, left, top, bmp, label, is_listbox): picture = ui.Bitmap(parent, left, top + 6, 32, 32) picture.set_image( os.path.join(unicode(str(self.info.image_dir), 'mbcs'), unicode(str(bmp), 'mbcs'))) label = ui.Label(parent, left + 32 + 10, top, 150, 12, label) if is_listbox: combo = ui.ComboBox(parent, left + 32 + 10, top + 20, 150, 200, "") else: combo = None return picture, label, combo
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)
def insert_navigation(self, button1_text=None, button2_text=None, button3_text=None, default=None): ''' Inserts navigation buttons starting from the leftmost button ''' nbw = 90 nbh = 24 sep_top = 6 sep_height = 2 if hasattr(self, "vertical_image"): sep_top = 0 self.navigation = ui.Panel( self, 0, self.height - nbh - 20 - sep_top - sep_height, self.width, nbh + 20 + sep_top + sep_height) if not hasattr(self, "vertical_image"): self.revision_label = ui.Label(self.navigation, 10, 0, 40, 20, "Rev %s" % self.info.revision) self.revision_label.disable() self.line = ui.EtchedRectangle(self.navigation, 50, sep_top, self.width - 60, sep_height) else: self.line = ui.EtchedRectangle(self.navigation, 0, sep_top, self.width, sep_height) for i, text in enumerate((button1_text, button2_text, button3_text)): if not text: continue if default and i + 1 == default: Button = ui.DefaultButton else: Button = ui.Button n = 0 for other in (button1_text, button2_text, button3_text)[i:]: if other: n += 1 button = Button(self.navigation, self.width - (nbw + 10) * n, 10 + sep_top + sep_height, nbw, nbh, text=text) if default and i + 1 == default: button.set_focus() setattr(self.navigation, "button%s" % (i + 1), button) self.navigation.height = nbh + 20 + sep_top + sep_height
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)
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:"******"lock.bmp", _("Password:"******"" if self.info.password: password = self.info.password elif self.info.test: password = "******" 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()