22import uuid
33from tkinter import *
44from tkinter import ttk
5-
65from screeninfo import *
7-
86from Frames .ScreenBlockerFrame import ScreenBlockerFrame
97from Frames .TransparentCountdownFrame import TransparentCountdownFrame
108from Infrastructure .CountdownManager import CountdownManager
@@ -53,14 +51,14 @@ def __init__(self, *args, **kwargs):
5351
5452 container_frame = ttk .Frame (container )
5553
56- container_frame .grid (row = 0 , column = 0 , sticky = (N , S , E , W ))
54+ container_frame .grid (row = 0 , column = 0 , sticky = (N , S , E , W ))
5755 container_frame .grid_rowconfigure (0 , weight = 1 )
5856 container_frame .grid_columnconfigure (0 , weight = 1 )
5957 for frame_type in self .frame_types :
6058 frame_instance = frame_type (container_frame , self , self .time_options_manager , self .mobber_manager ,
6159 self .countdown_manager , self .settings_manager )
6260 self .frames [frame_type ].append (frame_instance )
63- frame_instance .grid (row = 0 , column = 0 , sticky = (N , S , E , W ))
61+ frame_instance .grid (row = 0 , column = 0 , sticky = (N , S , E , W ))
6462 frame_instance .grid_rowconfigure (0 , weight = 1 )
6563 frame_instance .grid_columnconfigure (0 , weight = 1 )
6664 self .last_frame = None
@@ -69,6 +67,11 @@ def __init__(self, *args, **kwargs):
6967 frame_instance .bind ("<Enter>" , self .toggle_transparent_frame_position )
7068 self .transparent_frame_position = 0
7169 self .title ("Mob Timer" )
70+ self .bind_all ("<Control-Return>" , self .launch_transparent_countdown_if_blocking )
71+
72+ def launch_transparent_countdown_if_blocking (self , event ):
73+ if self .last_frame == ScreenBlockerFrame :
74+ self .show_transparent_countdown_frame ()
7275
7376 def quit_and_destroy_session (self ):
7477 self .session_manager .clear_sessions ()
@@ -85,7 +88,10 @@ def show_frame(self, frame_class):
8588 if self .last_frame != frame_class :
8689 for frame_instances in self .frames [frame_class ]:
8790 frame_instances .tkraise ()
91+
8892 switched_frames = True
93+ self .focus_force ()
94+ self .focus_set ()
8995 self .last_frame = frame_class
9096 return switched_frames
9197
@@ -96,6 +102,8 @@ def show_screen_blocker_frame(self):
96102
97103 def show_transparent_countdown_frame (self ):
98104 if self .show_frame (TransparentCountdownFrame ):
105+ self .countdown_manager .set_countdown_duration (self .time_options_manager .minutes ,
106+ self .time_options_manager .seconds )
99107 self .set_partial_screen_transparent ()
100108
101109 def get_current_window_geometry (self ):
@@ -113,6 +121,7 @@ def remove_title_bar(self):
113121 def set_always_on_top (self ):
114122 for container in self .containers :
115123 container .wm_attributes ("-topmost" , 1 )
124+ container .focus_force ()
116125
117126 def set_full_screen_always_on_top (self ):
118127 self .set_always_on_top ()
0 commit comments