Skip to content

Commit 138ac02

Browse files
committed
Added Config File and Ctrl + Enter to Start Timermer
1 parent 666e0ed commit 138ac02

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

Frames/MobTimerController.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
import uuid
33
from tkinter import *
44
from tkinter import ttk
5-
65
from screeninfo import *
7-
86
from Frames.ScreenBlockerFrame import ScreenBlockerFrame
97
from Frames.TransparentCountdownFrame import TransparentCountdownFrame
108
from 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()

Frames/ScreenBlockerFrame.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,8 @@ def build_window_content(self):
129129

130130
center_frame.grid(row=0, column=0, sticky="nsew")
131131

132+
self.add_mobber_entry.focus_set()
133+
132134
def launch_transparent_countdown(self, event):
133135
self.countdown_manager.set_countdown_duration(self.time_options_manager.minutes,
134136
self.time_options_manager.seconds)

Infrastructure/Sessions/46c7a918-af9e-11e5-8536-20c9d042e8c0

Whitespace-only changes.

0 commit comments

Comments
 (0)