7777from robotide .publish .messages import RideTestSelectedForRunningChanged
7878from robotide .pluginapi import Plugin , ActionInfo
7979from robotide .ui .notebook import NoteBook
80- from robotide .widgets import Label , ImageProvider , RIDEDialog
80+ from robotide .widgets import Label , ImageProvider , ButtonWithHandler , RIDEDialog
8181from robotide .robotapi import LOG_LEVELS
8282from robotide .utils import robottime
83+ from robotide .preferences import PreferenceEditor
8384from robotide .preferences .editors import read_fonts
8485from sys import getfilesystemencoding , platform
8586from robotide .lib .robot .utils .encodingsniffer import (get_console_encoding ,
@@ -134,6 +135,7 @@ class TestRunnerPlugin(Plugin):
134135 "profile_name" : "robot" ,
135136 "show_console_log" : True ,
136137 "show_message_log" : True ,
138+ "active_status_bar" : True ,
137139 "sash_position" : 200 ,
138140 "run_profiles" :
139141 [('jybot' , 'jybot' + ('.bat' if os .name == 'nt' else '' )),
@@ -155,6 +157,7 @@ class TestRunnerPlugin(Plugin):
155157 title = 'Run'
156158
157159 def __init__ (self , application = None ):
160+ self .app = application
158161 self .title = _ ('Run' )
159162 Plugin .__init__ (self , application , initially_enabled = True ,
160163 default_settings = self .defaults )
@@ -178,6 +181,7 @@ def __init__(self, application=None):
178181 self ._initmemory = None
179182 self ._limitmemory = None # This will be +80%
180183 self ._maxmemmsg = None
184+ self .active_status_bar = self .__getattr__ ('active_status_bar' )
181185 self .use_colors = self .__getattr__ ('use colors' )
182186 self .fail_color = self .__getattr__ ('fail color' )
183187 self .pass_color = self .__getattr__ ('pass color' )
@@ -321,30 +325,40 @@ def on_stop(self, event):
321325 self ._append_to_console_log (_ ('[ SENDING STOP SIGNAL ]\n ' ),
322326 source = 'stderr' )
323327 self ._test_runner .send_stop_signal ()
328+ if self .active_status_bar :
329+ self .statusbar_message (_ ('[ SENDING STOP SIGNAL ]\n ' ), 5000 )
324330
325331 def on_pause (self , event ):
326332 __ = event
327333 self ._reset_memory_calc ()
328334 self ._append_to_console_log (_ ('[ SENDING PAUSE SIGNAL ]\n ' ))
329335 self ._test_runner .send_pause_signal ()
336+ if self .active_status_bar :
337+ self .statusbar_message (_ ('[ SENDING PAUSE SIGNAL ]\n ' ), 5000 )
330338
331339 def on_continue (self , event ):
332340 __ = event
333341 self ._reset_memory_calc ()
334342 self ._append_to_console_log (_ ('[ SENDING CONTINUE SIGNAL ]\n ' ))
335343 self ._test_runner .send_continue_signal ()
344+ if self .active_status_bar :
345+ self .statusbar_message (_ ('[ SENDING CONTINUE SIGNAL ]\n ' ), 5000 )
336346
337347 def on_step_next (self , event ):
338348 __ = event
339349 self ._reset_memory_calc ()
340350 self ._append_to_console_log (_ ('[ SENDING STEP NEXT SIGNAL ]\n ' ))
341351 self ._test_runner .send_step_next_signal ()
352+ if self .active_status_bar :
353+ self .statusbar_message (_ ('[ SENDING STEP NEXT SIGNAL ]\n ' ), 5000 )
342354
343355 def on_step_over (self , event ):
344356 __ = event
345357 self ._reset_memory_calc ()
346358 self ._append_to_console_log (_ ('[ SENDING STEP OVER SIGNAL ]\n ' ))
347359 self ._test_runner .send_step_over_signal ()
360+ if self .active_status_bar :
361+ self .statusbar_message (_ ('[ SENDING STEP OVER SIGNAL ]\n ' ), 5000 )
348362
349363 def on_run (self , event ):
350364 """ Called when the user clicks or presses the F8, Run Tests """
@@ -735,8 +749,11 @@ def _remove_from_notebook(self):
735749 def _build_runner_toolbar (self , parent ):
736750 toolbar = wx .ToolBar (parent , wx .ID_ANY ,
737751 style = wx .TB_HORIZONTAL | wx .TB_HORZ_TEXT | wx .TB_NODIVIDER )
752+ toolbar .SetThemeEnabled (True )
738753 toolbar .SetBackgroundColour (self ._mysettings .color_background )
739754 toolbar .SetForegroundColour (self ._mysettings .color_foreground )
755+ toolbar .SetOwnBackgroundColour (self ._mysettings .color_background )
756+ toolbar .SetOwnForegroundColour (self ._mysettings .color_foreground )
740757 toolbar .AddTool (ID_RUN , _ ("Start" ), ImageProvider ().TOOLBAR_PLAY ,
741758 wx .NullBitmap , wx .ITEM_NORMAL , shortHelp = _ ("Start robot" ),
742759 longHelp = _ ("Start running the robot test suite" ))
@@ -763,6 +780,10 @@ def _build_runner_toolbar(self, parent):
763780 toolbar .AddTool (ID_STEP_OVER , STEP_OVER , ImageProvider ().TOOLBAR_NEXT ,
764781 wx .NullBitmap , wx .ITEM_NORMAL , shortHelp = STEP_OVER ,
765782 longHelp = STEP_OVER )
783+ for i in toolbar .GetChildren ():
784+ i .SetBackgroundColour (self ._mysettings .color_secondary_background )
785+ i .SetOwnBackgroundColour (self ._mysettings .color_secondary_background )
786+ i .SetForegroundColour (self ._mysettings .color_secondary_foreground )
766787 toolbar .Realize ()
767788 self ._bind_runner_toolbar_events (toolbar )
768789 return toolbar
@@ -778,10 +799,18 @@ def _bind_runner_toolbar_events(self, toolbar):
778799 (wx .EVT_TOOL , self .on_step_over , ID_STEP_OVER )):
779800 toolbar .Bind (event , callback , id = idd )
780801
802+ @property
803+ def general_font_size (self ):
804+ fsize = self .app .settings .get ('General' , None )['font size' ]
805+ return fsize
806+
781807 def _build_local_toolbar (self , parent ):
782808 toolbar = wx .ToolBar (parent , wx .ID_ANY ,
783809 style = wx .TB_HORIZONTAL | wx .TB_HORZ_TEXT | wx .TB_NODIVIDER | wx .TB_DOCKABLE )
784810 # print(f"DEBUG: toolbar before {toolbar.UseBackgroundColour()}")
811+ toolbar .SetThemeEnabled (True )
812+ toolbar .SetBackgroundColour (self ._mysettings .color_background )
813+ toolbar .SetForegroundColour (self ._mysettings .color_foreground )
785814 toolbar .SetOwnBackgroundColour (self ._mysettings .color_background )
786815 toolbar .SetOwnForegroundColour (self ._mysettings .color_foreground )
787816 profile_label = Label (toolbar , label = _ ("Execution Profile: " ))
@@ -817,12 +846,19 @@ def _build_local_toolbar(self, parent):
817846 _ (" Pause after failure " ), False ,
818847 _ ("Automatically pause after failing keyword" ))
819848 toolbar .AddControl (self .pause_on_failure_cb )
820-
849+ config_button = ButtonWithHandler (toolbar , _ ('Settings' ), bitmap = 'wrench.png' , fsize = self .general_font_size ,
850+ handler = lambda e : self .on_config_panel ())
851+ config_button .SetBackgroundColour (self ._mysettings .color_background )
852+ config_button .SetOwnBackgroundColour (self ._mysettings .color_background )
853+ config_button .SetForegroundColour (self ._mysettings .color_foreground )
854+ toolbar .AddStretchableSpace ()
855+ toolbar .AddControl (config_button )
821856 toolbar .EnableTool (ID_OPEN_LOGS_DIR , False )
822857 toolbar .EnableTool (ID_SHOW_LOG , False )
823858 toolbar .EnableTool (ID_SHOW_REPORT , False )
824859 for i in toolbar .GetChildren ():
825860 i .SetBackgroundColour (self ._mysettings .color_background )
861+ i .SetOwnBackgroundColour (self ._mysettings .color_background )
826862 i .SetForegroundColour (self ._mysettings .color_foreground )
827863 toolbar .Realize ()
828864 self ._bind_local_toolbar_events (toolbar )
@@ -921,7 +957,8 @@ def _build_output_panel(self, parent):
921957 panel = wx .Panel (parent )
922958 panel .SetBackgroundColour (self ._mysettings .color_background )
923959 panel .SetForegroundColour (self ._mysettings .color_foreground )
924- self ._progress_bar = ProgressBar (panel , self .fail_color , self .pass_color , self .skip_color )
960+ self ._progress_bar = ProgressBar (panel , self .fail_color , self .pass_color , self .skip_color ,
961+ self .active_status_bar , caller = self )
925962 self ._console_log_panel , self ._console_log_ctrl = \
926963 self ._create_collapsible_pane (panel , _ ('Console log' ),
927964 self .show_console_log ,
@@ -1092,11 +1129,15 @@ def _handle_paused(self, args):
10921129 __ = args
10931130 wx .CallAfter (self ._set_paused )
10941131 self ._log_message_queue .put (_ ('<< PAUSED >>' ))
1132+ if self .active_status_bar :
1133+ self .statusbar_message (_ ('<< PAUSED >>' ))
10951134
10961135 def _handle_continue (self , args ):
10971136 __ = args
10981137 wx .CallAfter (self ._set_continue )
10991138 self ._log_message_queue .put (_ ('<< CONTINUE >>' ))
1139+ if self .active_status_bar :
1140+ self .statusbar_message (_ ('<< CONTINUE >>' ), 5000 )
11001141
11011142 def _set_running (self ):
11021143 self ._run_action .disable ()
@@ -1105,6 +1146,8 @@ def _set_running(self):
11051146 self .get_current_profile ().disable_toolbar ()
11061147 self ._running = True
11071148 self ._test_runner .test_execution_started ()
1149+ if self .active_status_bar :
1150+ self .statusbar_clear ()
11081151
11091152 def _set_paused (self ):
11101153 self ._run_action .disable ()
@@ -1122,6 +1165,8 @@ def _set_stopped(self):
11221165 self ._enable_runner_toolbar (True , False )
11231166 self .get_current_profile ().enable_toolbar ()
11241167 self ._running = False
1168+ if self .active_status_bar :
1169+ self .statusbar_clear ()
11251170
11261171 def _enable_runner_toolbar (self , run , paused ):
11271172 stop = not run
@@ -1142,11 +1187,24 @@ def _notify_user_no_logs_directory():
11421187 _ ("No logs directory" ),
11431188 wx .ICON_INFORMATION | wx .OK )
11441189
1190+ def on_config_panel (self ):
1191+ dlg = self .config_panel (self .frame )
1192+ dlg .Show (True )
1193+
1194+ def config_panel (self , parent ):
1195+ __ = parent
1196+ _parent = wx .GetTopLevelWindows ()
1197+ dlg = PreferenceEditor (_parent [0 ], _ ("RIDE - Preferences" ),
1198+ self .app .preferences , style = 'single' , index = 5 )
1199+ dlg .Show (False )
1200+ return dlg
1201+
11451202
11461203class ProgressBar (wx .Panel ):
11471204 """A progress bar for the test runner plugin"""
11481205
1149- def __init__ (self , parent , fail_color = '#FF8E8E' , pass_color = "#9FCC9F" , skip_color = 'yellow' ):
1206+ def __init__ (self , parent , fail_color = '#FF8E8E' , pass_color = "#9FCC9F" , skip_color = 'yellow' ,
1207+ active_status_bar = False , caller = None ):
11501208 wx .Panel .__init__ (self , parent , wx .ID_ANY )
11511209 self ._sizer = wx .BoxSizer (wx .HORIZONTAL )
11521210 self ._gauge = wx .Gauge (self , size = (100 , 15 ), style = wx .GA_HORIZONTAL )
@@ -1158,6 +1216,8 @@ def __init__(self, parent, fail_color='#FF8E8E', pass_color="#9FCC9F", skip_colo
11581216 self ._gauge .Hide ()
11591217 self ._default_colour = parent .GetBackgroundColour ()
11601218 self ._foreground_colour = parent .GetForegroundColour ()
1219+ self .active_status_bar = active_status_bar
1220+ self .caller = caller
11611221 self .fail_color = fail_color
11621222 self .pass_color = pass_color
11631223 self .skip_color = skip_color
@@ -1227,7 +1287,8 @@ def _update_message(self):
12271287 elapsed = time .time () - self ._start_time
12281288 message = _ ("elapsed time: %s pass: %s skip: %s fail: %s" ) % (
12291289 self ._seconds_to_string (elapsed ), self ._pass , self ._skip , self ._fail )
1230- message += self ._get_current_keyword_text ()
1290+ current_keyword = self ._get_current_keyword_text ()
1291+ message += current_keyword
12311292 if self ._fail > 0 :
12321293 self .SetForegroundColour (self .get_visible_color (self .fail_color ))
12331294 self .SetBackgroundColour (self .fail_color )
@@ -1249,6 +1310,8 @@ def _update_message(self):
12491310 self ._label .SetForegroundColour (self ._foreground_colour )
12501311 self ._label .SetBackgroundColour (self ._default_colour )
12511312 self ._label .SetLabel (message )
1313+ if self .active_status_bar and self .caller :
1314+ self .caller .statusbar_message (current_keyword )
12521315 # not sure why this is required, but without it the background
12531316 # colors don't look right on Windows
12541317 self .Refresh ()
0 commit comments