def display_help(self): '''Display the single file help screen''' # customize header help_header = "%s: %s" logging.debug("self.screen is =%s", self.screen) if self.screen in self.help_dict: help_header = help_header % (_("Help"), self.help_dict[self.screen][1]) help_text = self.get_help_text(self.help_dict[self.screen][0]) else: help_header = help_header % (_("Help"), _("Not Available")) help_text = _("Help for this screen is not available") self.main_win.set_header_text(help_header) help_text = convert_paragraph(help_text, self.win_size_x - 5) logging.debug("help_text #lines=%d, text is \n%s", len(help_text), help_text) area = WindowArea(x_loc=0, y_loc=1, scrollable_lines=(len(help_text) + 1)) area.lines = self.win_size_y - 1 area.columns = self.win_size_x self.scroll_region = ScrollWindow(area, window=self.center_win) self.scroll_region.add_paragraph(help_text, start_x=(area.x_loc + 3)) self.center_win.activate_object(self.scroll_region)
def display_help_topics(self): '''Display the help topics screen.''' self.main_win.set_header_text(HelpScreen.HELP_HEADER) y_loc = 1 y_loc += self.center_win.add_paragraph(HelpScreen.INTRO, y_loc, 1, max_x=(self.win_size_x - 1)) y_loc += 1 area = WindowArea(scrollable_lines=(len(self.help_info) + 1), y_loc=y_loc, x_loc=0) logging.debug("lines=%s", len(self.help_dict)) area.lines = self.win_size_y - (y_loc + 1) area.columns = self.win_size_x self.scroll_region = ScrollWindow(area, window=self.center_win) # add the entries to the screen logging.debug("range=%s", len(self.help_info)) for idx, info in enumerate(self.help_info): # create ListItem for each help topic topic_format = info[1] help_topic = self.get_help_topic(info[0]) help_topic = topic_format % help_topic hilite = min(self.win_size_x, textwidth(help_topic) + 1) list_item = ListItem(WindowArea(1, hilite, idx, 0), window=self.scroll_region, text=help_topic) help_screens = info[0] logging.debug("help_screens=%s", list(help_screens)) logging.debug("self.screen_last=%s", self.screen_last) if self.screen_last in help_screens: logging.debug("Set cur_help_idx = %s", idx) self.cur_help_idx = idx logging.debug("beg_y=%d, beg_x=%d", *list_item.window.getbegyx()) self.center_win.activate_object(self.scroll_region) self.scroll_region.activate_object(self.cur_help_idx)
def _show(self): '''Prepare a text summary from the install_profile and display it to the user in a ScrollWindow ''' y_loc = 1 y_loc += self.center_win.add_paragraph(SummaryScreen.PARAGRAPH, y_loc) y_loc += 1 summary_text = self.build_summary() # Wrap the summary text, accounting for the INDENT (used below in # the call to add_paragraph) max_chars = self.win_size_x - SummaryScreen.INDENT - 1 summary_text = convert_paragraph(summary_text, max_chars) area = WindowArea(x_loc=0, y_loc=y_loc, scrollable_lines=(len(summary_text)+1)) area.lines = self.win_size_y - y_loc area.columns = self.win_size_x scroll_region = ScrollWindow(area, window=self.center_win) scroll_region.add_paragraph(summary_text, start_x=SummaryScreen.INDENT) self.center_win.activate_object(scroll_region)
def _show(self): '''Display partition data for selected disk, and present the two choices ''' if self.install_profile.install_to_pool: raise SkipException if self.x86_slice_mode: if len(self.install_profile.disks) > 1: # When installing on multiple disks use only whole disk EFI type logging.error("Not looking at partitions on multi-dev install") raise SkipException disk = self.install_profile.disks[0] self.disk_info = disk.get_solaris_data() if self.disk_info is None: # No partitions selected - it's whole disk EFI install logging.error("No partitions were selected. Continuing.") raise SkipException logging.debug("bool(self.disk_info.slices)=%s", bool(self.disk_info.slices)) logging.debug("self.disk_info.modified()=%s", self.disk_info.modified()) if not self.disk_info.slices or self.disk_info.modified(): logging.debug("Setting partition.use_whole_segment," "creating default layout, and skipping") self.disk_info.use_whole_segment = True # We only do slice level editing on x86 if there are # existing slices on an existing (unmodified)Solaris # partition self.disk_info.create_default_layout() raise SkipException disp_disk = self.install_profile.original_disks[ 0].get_solaris_data() logging.debug("Preserved partition with existing slices:" " presenting option to install into a slice") else: if len(self.install_profile.disks) > 1: suggested_pool_types = ['mirror'] if len(self.install_profile.disks) > 2: suggested_pool_types.append('raidz') if len(self.install_profile.disks) > 3: suggested_pool_types.append('raidz2') if len(self.install_profile.disks) > 4: suggested_pool_types.append('raidz3') # Show selected disks header_text = self.HEADER_ZPOOL % (SliceInfo.DEFAULT_POOL.data) self.main_win.set_header_text(header_text) y_loc = 1 y_loc += self.center_win.add_paragraph(self.SELECTED_DISKS, start_y=y_loc) for disk in self.install_profile.disks: y_loc += self.center_win.add_paragraph(self.DISK_INFO % { "name": disk.name, "size": disk.size }, start_y=y_loc) y_loc += 2 y_loc += self.center_win.add_paragraph(self.SELECT_POOL_TYPE, start_y=y_loc) pool_type_win_area = WindowArea(1, 1, y_loc, 0) selected_pool_type = 0 for pool_type in suggested_pool_types: pool_type_win_area.y_loc = y_loc pool_type_win_area.columns = len(pool_type) + 1 list_item = ListItem(pool_type_win_area, window=self.center_win, text=pool_type, data_obj=pool_type) if pool_type == self.selected_pool_type_name: selected_pool_type = list_item y_loc += 1 self.main_win.do_update() self.center_win.activate_object(selected_pool_type) else: self.disk_info = self.install_profile.disks[0] disp_disk = self.install_profile.original_disks[0] if self.disk_info.boot: bootable = FDiskPart.BOOT_TEXT else: bootable = "" header_text = self.header_text % \ {"size" : self.disk_info.size.size_as("gb"), "type" : self.disk_info.type, "bootable" : bootable} self.main_win.set_header_text(header_text) if len(self.install_profile.disks) == 1: y_loc = 1 y_loc += self.center_win.add_paragraph(self.paragraph, start_y=y_loc) y_loc += 1 if self.is_x86 and not self.x86_slice_mode: found_parts = bool(self.disk_info.partitions) else: found_parts = bool(self.disk_info.slices) if found_parts: next_line = self.found else: next_line = self.proposed y_loc += self.center_win.add_paragraph(next_line, start_y=y_loc) y_loc += 1 disk_win_area = WindowArea(6, 70, y_loc, 0) self.disk_win = DiskWindow(disk_win_area, disp_disk, window=self.center_win) y_loc += disk_win_area.lines y_loc += 3 whole_disk_width = textwidth(self.use_whole) + 3 cols = int((self.win_size_x - whole_disk_width) / 2) whole_disk_item_area = WindowArea(1, whole_disk_width, y_loc, cols) self.whole_disk_item = ListItem(whole_disk_item_area, window=self.center_win, text=self.use_whole, centered=True) y_loc += 1 partial_width = textwidth(self.use_part) + 3 cols = int((self.win_size_x - partial_width) / 2) partial_item_area = WindowArea(1, partial_width, y_loc, cols) self.partial_disk_item = ListItem(partial_item_area, window=self.center_win, text=self.use_part, centered=True) self.main_win.do_update() if self.disk_info.use_whole_segment: self.center_win.activate_object(self.whole_disk_item) else: self.center_win.activate_object(self.partial_disk_item)
def _show(self): '''Create the list of time zones''' logging.debug("self.screen %s", self.screen) if self.install_profile.system is None: self.install_profile.system = SystemInfo() self.sys_info = self.install_profile.system self.cur_country = self.sys_info.tz_country self.cur_continent = self.sys_info.tz_region if self.cur_continent == SystemInfo.UTC and self.screen != "regions": raise SkipException self.center_win.border_size = TimeZone.BORDER_WIDTH if self.screen == TimeZone.LOCATIONS: self.cur_timezone_parent = self.cur_continent elif self.screen == TimeZone.TIMEZONE: self.cur_timezone_parent = self.cur_country logging.debug("cur_continent %s, cur_country %s", self.cur_continent, self.cur_country) y_loc = 1 y_loc += self.center_win.add_paragraph(self.intro, y_loc) y_loc += 1 menu_item_max_width = self.win_size_x - TimeZone.SCROLL_SIZE self.center_win.add_text(self.title, y_loc, TimeZone.SCROLL_SIZE) y_loc += 1 self.center_win.window.hline(y_loc, 3, curses.ACS_HLINE, 40) y_loc += 1 tz_list = self.get_timezones(self.cur_continent, self.cur_country) area = WindowArea(x_loc=0, y_loc=y_loc, scrollable_lines=len(tz_list) + 1) area.lines = self.win_size_y - (y_loc + 1) area.columns = self.win_size_x logging.debug("area.lines=%d, area.columns=%d", area.lines, area.columns) self.scroll_region = ScrollWindow(area, window=self.center_win) utc = 0 if self.screen == TimeZone.REGIONS: utc_area = WindowArea(1, len(TimeZone.UTC_TEXT) + 1, 0, TimeZone.SCROLL_SIZE) utc_item = ListItem(utc_area, window=self.scroll_region, text=TimeZone.UTC_TEXT, data_obj=SystemInfo.UTC) utc = 1 # add the entries to the screen for idx, timezone in enumerate(tz_list): logging.log(LOG_LEVEL_INPUT, "tz idx = %i name= %s", idx, tz_list[idx]) hilite = min(menu_item_max_width, len(timezone) + 1) win_area = WindowArea(1, hilite, idx + utc, TimeZone.SCROLL_SIZE) list_item = ListItem(win_area, window=self.scroll_region, text=timezone, data_obj=timezone) y_loc += 1 self.main_win.do_update() self.center_win.activate_object(self.scroll_region) logging.debug("self.cur_timezone_idx=%s", self.cur_timezone_idx) self.scroll_region.activate_object_force(self.cur_timezone_idx, force_to_top=True)