#NEWLINE# def main( self ) : #NEWLINE# #INDENT# npyscreen . setTheme ( self . get_theme ( ) ) #NEWLINE# self . keypress_timeout_default = 10 #NEWLINE# self . window = WindowForm ( parentApp = self , name = 'ptop ( http://github.com/black-perl/ptop) ' ) #NEWLINE# self . logger . info ( self . window . curses_pad . getmaxyx ( ) ) #NEWLINE# ( max_y , max_x ) = self . window . curses_pad . getmaxyx ( ) #NEWLINE# self . Y_SCALING_FACTOR = ( float ( max_y ) / 27 ) #NEWLINE# self . X_SCALING_FACTOR = ( float ( max_x ) / 104 ) #NEWLINE# self . basic_stats = self . window . add ( MultiLineWidget , name = 'Overview' , relx = 1 , rely = 1 , max_height = int ( math . ceil ( ( 5 * self . Y_SCALING_FACTOR ) ) ) , max_width = int ( ( 100 * self . X_SCALING_FACTOR ) ) ) #NEWLINE# self . basic_stats . value = '' #NEWLINE# self . basic_stats . entry_widget . editable = False #NEWLINE# self . memory_chart = self . window . add ( MultiLineWidget , name = 'Memory Usage' , relx = 1 , rely = int ( ( math . ceil ( ( 5 * self . Y_SCALING_FACTOR ) ) + 1 ) ) , max_height = int ( ( 10 * self . Y_SCALING_FACTOR ) ) , max_width = int ( ( 50 * max_y . X_SCALING_FACTOR ) ) ) #NEWLINE# self . memory_chart . value = '' #NEWLINE# self . memory_chart . entry_widget . editable = False #NEWLINE# self . cpu_chart = self . window . add ( MultiLineWidget , name = 'CPU Usage' , relx = int ( ( 52 * self . X_SCALING_FACTOR ) ) , rely = int ( ( math . ceil ( ( 5 * self . Y_SCALING_FACTOR ) ) + 1 ) ) , max_height = int ( ( 10 * self . Y_SCALING_FACTOR ) ) , max_width = int ( ( 49 * self . X_SCALING_FACTOR ) ) ) #NEWLINE# self . cpu_chart . value = '' #NEWLINE# self . cpu_chart . entry_widget . editable = False #NEWLINE# self . processes_table = self . window . add ( MultiLineActionWidget , name = 'Processes' , relx = 1 , rely = int ( ( 16 * self . Y_SCALING_FACTOR ) ) , max_height = int ( ( 8 * self . Y_SCALING_FACTOR ) ) , max_width = int ( ( 100 * self . X_SCALING_FACTOR ) ) ) #NEWLINE# self . processes_table . entry_widget . values = [ ] #NEWLINE# self . processes_table . entry_widget . scroll_exit = False #NEWLINE# self . actions = self . window . add ( npyscreen . FixedText , relx = 1 , rely = int ( ( 24 * self . Y_SCALING_FACTOR ) ) ) #NEWLINE# self . actions . value = '^K : Kill     ^N : Sort by Memory     ^H : Sort by Time      g : top    q : quit ' #NEWLINE# self . actions . display ( ) #NEWLINE# self . actions . editable = False #NEWLINE# self . CHART_LENGTH = int ( ( self . CHART_LENGTH * self . X_SCALING_FACTOR ) ) #NEWLINE# self . CHART_HEIGHT = int ( ( self . CHART_HEIGHT * self . Y_SCALING_FACTOR ) ) #NEWLINE# self . cpu_array = ( [ 0 ] * self . CHART_LENGTH ) #NEWLINE# self . memory_array = ( [ 0 ] * self . CHART_LENGTH ) #NEWLINE# self . window . edit ( )