(self)
return controls
Display sidebar controls. i.e. buttons, and controls
Display sidebar controls. i.e. buttons, and controls
Display sidebar controls . i . e . buttons and controls
def _generate_graph_controls(self):
        """ Display sidebar controls. i.e. buttons, and controls"""
        # setup mode radio buttons
        stress_modes = self.controller.stress_conroller.get_modes()
        group = []
        for mode in stress_modes:
            self.mode_buttons.append(radio_button(group, mode,
                                                  self.on_mode_button))

        # Set default radio button to "Monitor" mode
        self.mode_buttons[0].set_state(True, do_callback=False)

        # Create list of buttons
        control_options = list()
        control_options.append(button('Graphs',
                                      self.on_graphs_menu_open))
        control_options.append(button('Summaries',
                                      self.on_summary_menu_open))
        if self.controller.stress_exe:
            control_options.append(button('Stress Options',
                                          self.on_stress_menu_open))
        control_options.append(button("Reset", self.on_reset_button))
        control_options.append(button('Help', self.on_help_menu_open))
        control_options.append(button('About', self.on_about_menu_open))
        control_options.append(button("Save Settings",
                                      self.on_save_settings))
        control_options.append(button("Quit", self.on_exit_program))

        # Create the menu
        animate_controls = urwid.GridFlow(control_options, 18, 2, 0, 'center')

        # Create smooth graph selection button
        default_smooth = self.controller.smooth_graph_mode
        if urwid.get_encoding_mode() == "utf8":
            unicode_checkbox = urwid.CheckBox(
                "UTF-8", state=default_smooth,
                on_state_change=self.on_unicode_checkbox)
            # Init the state of the graph accoding to the selected mode
            self.on_unicode_checkbox(state=default_smooth)
        else:
            unicode_checkbox = urwid.Text(
                "[N/A] UTF-8")

        install_stress_message = urwid.Text("")
        if not self.controller.firestarter and not self.controller.stress_exe:
            install_stress_message = urwid.Text(
                ('button normal', u"(N/A) install stress"))

        clock_widget = []
        # if self.controller.stress_exe or self.controller.firestarter:
        if self.controller.stress_exe or self.controller.firestarter:
            clock_widget = [
                urwid.Text(('bold text', u"Stress Timer"), align="center"),
                self.clock_view
                ]

        controls = [urwid.Text(('bold text', u"Modes"), align="center")]
        controls += self.mode_buttons
        controls += [install_stress_message]
        controls += clock_widget
        controls += [
            urwid.Divider(),
            urwid.Text(('bold text', u"Control Options"), align="center"),
            animate_controls,
            urwid.Divider(),
            urwid.Text(('bold text', u"Visual Options"), align="center"),
            unicode_checkbox,
            self.refresh_rate_ctrl,
            urwid.Divider(),
            urwid.Text(('bold text', u"Summaries"), align="center"),
        ]

        return controls
def _generate_graph_controls ( self ) : # setup mode radio buttons stress_modes = self . controller . stress_conroller . get_modes ( ) group = [ ] for mode in stress_modes : self . mode_buttons . append ( radio_button ( group , mode , self . on_mode_button ) ) # Set default radio button to "Monitor" mode self . mode_buttons [ 0 ] . set_state ( True , do_callback = False ) # Create list of buttons control_options = list ( ) control_options . append ( button ( 'Graphs' , self . on_graphs_menu_open ) ) control_options . append ( button ( 'Summaries' , self . on_summary_menu_open ) ) if self . controller . stress_exe : control_options . append ( button ( 'Stress Options' , self . on_stress_menu_open ) ) control_options . append ( button ( "Reset" , self . on_reset_button ) ) control_options . append ( button ( 'Help' , self . on_help_menu_open ) ) control_options . append ( button ( 'About' , self . on_about_menu_open ) ) control_options . append ( button ( "Save Settings" , self . on_save_settings ) ) control_options . append ( button ( "Quit" , self . on_exit_program ) ) # Create the menu animate_controls = urwid . GridFlow ( control_options , 18 , 2 , 0 , 'center' ) # Create smooth graph selection button default_smooth = self . controller . smooth_graph_mode if urwid . get_encoding_mode ( ) == "utf8" : unicode_checkbox = urwid . CheckBox ( "UTF-8" , state = default_smooth , on_state_change = self . on_unicode_checkbox ) # Init the state of the graph accoding to the selected mode self . on_unicode_checkbox ( state = default_smooth ) else : unicode_checkbox = urwid . Text ( "[N/A] UTF-8" ) install_stress_message = urwid . Text ( "" ) if not self . controller . firestarter and not self . controller . stress_exe : install_stress_message = urwid . Text ( ( 'button normal' , u"(N/A) install stress" ) ) clock_widget = [ ] # if self.controller.stress_exe or self.controller.firestarter: if self . controller . stress_exe or self . controller . firestarter : clock_widget = [ urwid . Text ( ( 'bold text' , u"Stress Timer" ) , align = "center" ) , self . clock_view ] controls = [ urwid . Text ( ( 'bold text' , u"Modes" ) , align = "center" ) ] controls += self . mode_buttons controls += [ install_stress_message ] controls += clock_widget controls += [ urwid . Divider ( ) , urwid . Text ( ( 'bold text' , u"Control Options" ) , align = "center" ) , animate_controls , urwid . Divider ( ) , urwid . Text ( ( 'bold text' , u"Visual Options" ) , align = "center" ) , unicode_checkbox , self . refresh_rate_ctrl , urwid . Divider ( ) , urwid . Text ( ( 'bold text' , u"Summaries" ) , align = "center" ) , ] return controls