Separate keyboard shortcuts from strict mode
This commit is contained in:
parent
6ea693e5fe
commit
77770313cb
|
@ -112,7 +112,7 @@ class BreakScreen(object):
|
|||
"""
|
||||
Show/update the count down on all screens.
|
||||
"""
|
||||
self.enable_shortcut = not self.strict_break and self.shortcut_disable_time <= seconds
|
||||
self.enable_shortcut = self.shortcut_disable_time <= seconds
|
||||
mins, secs = divmod(countdown, 60)
|
||||
timeformat = '{:02d}:{:02d}'.format(mins, secs)
|
||||
GLib.idle_add(lambda: self.__update_count_down(timeformat))
|
||||
|
@ -123,7 +123,7 @@ class BreakScreen(object):
|
|||
"""
|
||||
message = break_obj.name
|
||||
image_path = break_obj.image
|
||||
self.enable_shortcut = not self.strict_break and self.shortcut_disable_time <= 0
|
||||
self.enable_shortcut = self.shortcut_disable_time <= 0
|
||||
GLib.idle_add(lambda: self.__show_break_screen(message, image_path, widget, tray_actions))
|
||||
|
||||
def close(self):
|
||||
|
@ -253,7 +253,7 @@ class BreakScreen(object):
|
|||
# Avoid waiting for next event by checking pending events
|
||||
event = self.display.next_event()
|
||||
if self.enable_shortcut and event.type == X.KeyPress:
|
||||
if event.detail == self.keycode_shortcut_skip:
|
||||
if event.detail == self.keycode_shortcut_skip and not self.strict_break:
|
||||
self.skip_break()
|
||||
break
|
||||
elif self.enable_postpone and event.detail == self.keycode_shortcut_postpone:
|
||||
|
|
|
@ -81,9 +81,7 @@ class SettingsDialog(object):
|
|||
# Update relative states
|
||||
# GtkSwitch state-set signal is available only from 3.14
|
||||
if Gtk.get_minor_version() >= 14:
|
||||
self.switch_strict_break.connect('state-set', self.on_switch_strict_break_activate)
|
||||
self.switch_postpone.connect('state-set', self.on_switch_postpone_activate)
|
||||
self.on_switch_strict_break_activate(self.switch_strict_break, self.switch_strict_break.get_active())
|
||||
self.on_switch_postpone_activate(self.switch_postpone, self.switch_postpone.get_active())
|
||||
self.initializing = False
|
||||
|
||||
|
@ -247,15 +245,6 @@ class SettingsDialog(object):
|
|||
"""
|
||||
self.window.show_all()
|
||||
|
||||
def on_switch_strict_break_activate(self, switch, state):
|
||||
"""
|
||||
Event handler to the state change of the postpone switch.
|
||||
Enable or disable the self.spin_postpone_duration based on the state of the postpone switch.
|
||||
"""
|
||||
strict_break_enable = state
|
||||
self.switch_postpone.set_sensitive(not strict_break_enable)
|
||||
self.spin_disable_keyboard_shortcut.set_sensitive(not strict_break_enable)
|
||||
|
||||
def on_switch_postpone_activate(self, switch, state):
|
||||
"""
|
||||
Event handler to the state change of the postpone switch.
|
||||
|
|
Loading…
Reference in New Issue