Example #1
0
    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)
Example #2
0
    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)
Example #3
0
 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)
Example #4
0
    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)