1818from Infrastructure .TipsManager import TipsManager
1919
2020
21+ class OuterFrame (ttk .Frame ):
22+ def __init__ (self ,monitor , parent ):
23+ super ().__init__ (parent )
24+ self .monitor = monitor
25+
26+
2127class MobTimerController (Tk ):
2228 def __init__ (self , * args , ** kwargs ):
2329 Tk .__init__ (self , * args , ** kwargs )
@@ -36,34 +42,35 @@ def __init__(self, *args, **kwargs):
3642 self .quit_and_destroy_session ()
3743
3844 self .session_manager .create_session ()
39- # self.iconbitmap(default='time-bomb.ico')
45+ self .iconbitmap (default = 'time-bomb.ico' )
4046 self .countdown_manager .subscribe_to_time_changes (self .show_screen_blocker_when_session_interupted )
4147
4248 self .theme_manager = ThemeManager ()
4349 theme = self .settings_manager .get_general_theme ()
4450 if not theme == 'none' :
4551 self .theme_manager .set_theme (theme )
46-
47- num_monitors = ScreenUtility .get_monitors_or_default (self ).__len__ ()
48- self .containers = [self ]
52+ monitors = ScreenUtility .get_monitors_or_default ()
53+ num_monitors = monitors .__len__ ()
54+ self .parent_containers = [self ]
55+ self .containers = []
4956 for monitor_index in range (1 , num_monitors ):
5057 monitor_screen_blocker = Toplevel (self )
51- self .containers .append (monitor_screen_blocker )
58+ self .parent_containers .append (monitor_screen_blocker )
5259 self .frame_types = (ScreenBlockerFrame , TransparentCountdownFrame , MinimalScreenBlockerFrame )
5360 self .frames = {}
5461 for frame_type in self .frame_types :
5562 self .frames [frame_type ] = []
56- for container in self .containers :
63+ for parent_container , monitor in zip (self .parent_containers , monitors ):
64+ parent_container .grid_rowconfigure (0 , weight = 1 )
65+ parent_container .grid_columnconfigure (0 , weight = 1 )
66+
67+ container = OuterFrame (parent = parent_container , monitor = monitor )
68+ self .containers .append (container )
69+ container .grid (row = 0 , column = 0 , sticky = (N , S , E , W ))
5770 container .grid_rowconfigure (0 , weight = 1 )
5871 container .grid_columnconfigure (0 , weight = 1 )
59-
60- container_frame = ttk .Frame (container )
61-
62- container_frame .grid (row = 0 , column = 0 , sticky = (N , S , E , W ))
63- container_frame .grid_rowconfigure (0 , weight = 1 )
64- container_frame .grid_columnconfigure (0 , weight = 1 )
6572 for frame_type in self .frame_types :
66- frame_instance = frame_type (container_frame , self , self .time_options_manager , self .mobber_manager ,
73+ frame_instance = frame_type (container , self , self .time_options_manager , self .mobber_manager ,
6774 self .countdown_manager , self .settings_manager , self .tips_manager , self .theme_manager )
6875 self .frames [frame_type ].append (frame_instance )
6976 frame_instance .grid (row = 0 , column = 0 , sticky = (N , S , E , W ))
@@ -146,35 +153,34 @@ def get_current_window_geometry(self):
146153
147154 def disable_resizing (self ):
148155 for container in self .containers :
149- container .resizable (0 , 0 )
156+ container .master . resizable (0 , 0 )
150157
151158 def remove_title_bar (self ):
152159 if PlatformUtility .platform_is_mac ():
153160 return
154161 for container in self .containers :
155- container .overrideredirect (1 )
162+ container .master . overrideredirect (1 )
156163
157164 def set_always_on_top (self ):
158165 for container in self .containers :
159- container .wm_attributes ("-topmost" , True )
166+ container .master . wm_attributes ("-topmost" , True )
160167 if PlatformUtility .platform_is_mac ():
161168 os .system ('''/usr/bin/osascript -e 'tell app "Finder" to set frontmost of process "Python" to true' ''' )
162169 self .focus_force ()
163170 self .focus ()
164- container .focus_force ()
171+ container .master . focus_force ()
165172
166173 def set_full_screen_always_on_top (self ):
167174 self .set_always_on_top ()
168175 self .remove_title_bar ()
169176 self .disable_resizing ()
170- monitors = ScreenUtility .get_monitors_or_default (self )
171-
172- for container , monitor in zip (self .containers , monitors ):
177+ for container in self .containers :
178+ monitor = container .monitor
173179 monitor_string = "{}x{}+{}+{}" .format (monitor .width , monitor .height , monitor .x , monitor .y )
174- container .geometry (monitor_string )
180+ container .master . geometry (monitor_string )
175181 if not PlatformUtility .platform_is_mac ():
176- container .wait_visibility (container ) # Mac removing this prevented the issue with the continue screen visibility
177- container .attributes ("-alpha" , 1 )
182+ container .master . wait_visibility (container ) # Mac removing this prevented the issue with the continue screen visibility
183+ container .master . attributes ("-alpha" , 1 )
178184
179185 def set_partial_screen_transparent (self ):
180186 self .set_always_on_top ()
@@ -189,17 +195,17 @@ def set_partial_screen_transparent(self):
189195 window_width = int (screenwidth * size_percentage )
190196 window_height = int (screenheight * size_percentage )
191197 window_size = "{0}x{1}+0+0" .format (window_width , window_height )
192- controller .geometry (window_size )
193- controller .attributes ("-alpha" , alpha )
198+ controller .master . geometry (window_size )
199+ controller .master . attributes ("-alpha" , alpha )
194200 self .toggle_transparent_frame_position ()
195201
196202 def fade_app (self ):
197203 for controller in self .containers :
198- controller .attributes ("-alpha" , self .settings_manager .get_continue_screen_blocker_window_alpha_percent ())
204+ controller .master . attributes ("-alpha" , self .settings_manager .get_continue_screen_blocker_window_alpha_percent ())
199205
200206 def unfade_app (self ):
201207 for controller in self .containers :
202- controller .attributes ("-alpha" , 1 )
208+ controller .master . attributes ("-alpha" , 1 )
203209
204210 def toggle_transparent_frame_position (self , e = None ):
205211 if self .state () == "withdrawn" :
0 commit comments