|
4 | 4 | from Infrastructure.TimeOptionsManager import TimeOptionsManager |
5 | 5 | from Frames.ScreenBlockerFrame import ScreenBlockerFrame |
6 | 6 | from Frames.TransparentCountdownFrame import TransparentCountdownFrame |
| 7 | +from screeninfo import * |
7 | 8 |
|
8 | 9 |
|
9 | 10 | class MobTimerController(Tk): |
10 | 11 | def __init__(self, *args, **kwargs): |
11 | 12 | Tk.__init__(self, *args, **kwargs) |
12 | 13 |
|
13 | | - |
14 | | - |
| 14 | + self.iconbitmap(default='C:\\Users\\Chris\\OneDrive\\Git\\Pycharm\\MobTimer\\time-bomb.ico') |
15 | 15 | self.time_options_manager = TimeOptionsManager() |
16 | 16 | self.mobber_manager = MobberManager() |
17 | 17 | self.countdown_manager = CountdownManager(self) |
18 | 18 |
|
19 | | - self.containers = [self, Toplevel(self)] |
| 19 | + monitors = get_monitors() |
| 20 | + num_monitors = monitors.__len__() |
| 21 | + self.containers = [self] |
| 22 | + for monitor_index in range(1, num_monitors): |
| 23 | + monitor_screen_blocker = Toplevel(self) |
| 24 | + self.containers.append(monitor_screen_blocker) |
20 | 25 | self.frame_types = (ScreenBlockerFrame, TransparentCountdownFrame) |
21 | 26 | self.frames = {} |
22 | 27 | for frame_type in self.frame_types: |
23 | | - self.frames[frame_type] = [] |
24 | | - for s in self.containers: |
25 | | - container = Frame(s) |
26 | | - container.grid(row=0, column=0, sticky=N + S + E + W) |
27 | | - container.grid_rowconfigure(0, weight=1) |
28 | | - container.grid_columnconfigure(0, weight=1) |
| 28 | + self.frames[frame_type] = [] |
| 29 | + for container in self.containers: |
| 30 | + container_frame = Frame(container) |
| 31 | + container_frame.grid(row=0, column=0, sticky=N + S + E + W) |
| 32 | + container_frame.grid_rowconfigure(0, weight=1) |
| 33 | + container_frame.grid_columnconfigure(0, weight=1) |
29 | 34 | for frame_type in self.frame_types: |
30 | | - frame_instance = frame_type(container, self, self.time_options_manager, self.mobber_manager, self.countdown_manager) |
| 35 | + frame_instance = frame_type(container_frame, self, self.time_options_manager, self.mobber_manager, |
| 36 | + self.countdown_manager) |
31 | 37 | self.frames[frame_type].append(frame_instance) |
32 | 38 | frame_instance.grid(row=0, column=0, sticky="nsew") |
33 | 39 | self.last_frame = None |
34 | 40 | self.show_screen_blocker_frame() |
35 | 41 | for frame_instance in self.frames[TransparentCountdownFrame]: |
36 | 42 | frame_instance.bind("<Enter>", self.toggle_transparent_frame_position) |
37 | 43 | self.transparent_frame_position = 0 |
| 44 | + self.title("Mob Timer") |
38 | 45 |
|
39 | 46 | def show_frame(self, frame_class): |
40 | 47 | switched_frames = False |
41 | 48 | if self.last_frame != frame_class: |
42 | 49 | for frame_instances in self.frames[frame_class]: |
43 | | - # for frame in frame_instances: |
44 | | - frame_instances.tkraise() |
| 50 | + frame_instances.tkraise() |
45 | 51 | switched_frames = True |
46 | 52 | self.last_frame = frame_class |
47 | 53 | return switched_frames |
@@ -76,9 +82,11 @@ def set_full_screen_always_on_top(self): |
76 | 82 | self.remove_title_bar() |
77 | 83 | self.disable_resizing() |
78 | 84 | top_left_screen = "+0+0" |
79 | | - for container in self.containers: |
80 | | - container.geometry(self.get_current_window_geometry()) |
81 | | - container.geometry(top_left_screen) |
| 85 | + monitors = get_monitors() |
| 86 | + |
| 87 | + for container, monitor in zip(self.containers, monitors): |
| 88 | + monitor_string = "{}x{}+{}+{}".format(monitor.width, monitor.height, monitor.x, monitor.y) |
| 89 | + container.geometry(monitor_string) |
82 | 90 | container.wait_visibility(container) |
83 | 91 | container.attributes("-alpha", 1) |
84 | 92 |
|
|
0 commit comments