2222class MobTimerController (Tk ):
2323 def __init__ (self , * args , ** kwargs ):
2424 Tk .__init__ (self , * args , ** kwargs )
25+ self .toggle_transparent_frame_position_function = self .toggle_transparent_frame_position_enabled
2526 self .transparent_frame_monitor_index = 0
2627 self .transparent_frame_position_index = 0
2728 self .settings_manager = SettingsManager ()
@@ -33,8 +34,8 @@ def __init__(self, *args, **kwargs):
3334 self .timer_extension_count = self .settings_manager .get_timer_extension_count ()
3435 self .extensions_used = 0
3536 atexit .register (self .session_manager .clear_sessions )
36- # if self.session_manager.get_active_sessions().__len__() > 0:
37- # self.quit_and_destroy_session()
37+ if self .session_manager .get_active_sessions ().__len__ () > 0 :
38+ self .quit_and_destroy_session ()
3839
3940 self .session_manager .create_session ()
4041 self .iconbitmap (default = 'time-bomb.ico' )
@@ -91,6 +92,8 @@ def frame_is_screen_blocking(self):
9192 return self .last_frame == ScreenBlockerFrame or self .last_frame == MinimalScreenBlockerFrame
9293
9394 def show_minimal_screen_blocker_frame (self ):
95+ self .toggle_transparent_frame_position_function = self .toggle_transparent_frame_position_enabled
96+ self .theme_manager .reset_flashing_background_colors_to_normal ()
9497 if self .last_frame != MinimalScreenBlockerFrame :
9598 self .launch_blocking_Frame (MinimalScreenBlockerFrame )
9699 self .mobber_manager .switch_next_driver ()
@@ -122,7 +125,8 @@ def show_frame(self, frame_class):
122125 container .deiconify ()
123126 else :
124127 container .withdraw ()
125-
128+ container .focus_force ()
129+ container .focus_set ()
126130 return switched_frames
127131
128132 def show_screen_blocker_frame (self ):
@@ -207,22 +211,30 @@ def unfade_app(self):
207211 for controller in self .containers :
208212 controller .master .attributes ("-alpha" , 1 )
209213
214+ def flash_unobtrusive_transparent_countdown_frame (self ):
215+ self .toggle_transparent_frame_position_function = self .toggle_transparent_frame_position_disabled
216+ for container in self .containers :
217+ container .master .attributes ("-alpha" , 1 )
218+ container .focus_force ()
219+ container .focus_set ()
220+
221+ def toggle_transparent_frame_position_disabled (self ):
222+ pass
223+
210224 def toggle_transparent_frame_position (self , e = None ):
211225 if self .state () == "withdrawn" :
212226 return
227+ self .toggle_transparent_frame_position_function ()
213228
229+ def toggle_transparent_frame_position_enabled (self ):
214230 monitors = ScreenUtility .get_monitors_or_default (self )
215231 monitor = monitors [self .transparent_frame_monitor_index ]
216-
217232 screenwidth = monitor .width
218233 screenheight = monitor .height
219-
220234 self .set_always_on_top ()
221235 self .remove_title_bar ()
222236 self .disable_resizing ()
223-
224237 size_percentage = self .settings_manager .get_transparent_window_screen_size_percent ()
225-
226238 window_width = int (screenwidth * size_percentage )
227239 window_height = int (screenheight * size_percentage )
228240 if self .transparent_frame_position_index == 0 :
@@ -231,8 +243,8 @@ def toggle_transparent_frame_position(self, e=None):
231243 else :
232244 self .transparent_frame_position = monitor .x + 0
233245 self .transparent_frame_position_index = (self .transparent_frame_position_index + 1 ) % 2
234-
235- bottom_left_screen = "{}x{}+{}+{}" . format ( window_width , window_height , self . transparent_frame_position , monitor .y +
246+ bottom_left_screen = "{}x{}+{}+{}" . format ( window_width , window_height , self . transparent_frame_position ,
247+ monitor .y +
236248 screenheight - window_height )
237249 self .geometry (bottom_left_screen )
238250
0 commit comments