Added feature to fully unlock keyboard shortcuts after the timer
This commit is contained in:
parent
a003ade51e
commit
15bda8dc47
|
@ -53,6 +53,7 @@ class BreakScreen(object):
|
|||
self.on_postpone = on_postpone
|
||||
self.on_skip = on_skip
|
||||
self.shortcut_disable_time = 2
|
||||
self.full_unlock_shortcuts = True
|
||||
self.strict_break = False
|
||||
self.windows = []
|
||||
|
||||
|
@ -70,6 +71,7 @@ class BreakScreen(object):
|
|||
self.keycode_shortcut_postpone = config.get('shortcut_postpone', 65)
|
||||
self.keycode_shortcut_skip = config.get('shortcut_skip', 9)
|
||||
self.shortcut_disable_time = config.get('shortcut_disable_time', 2)
|
||||
self.full_unlock_shortcuts = config.get('full_unlock_shortcuts', True)
|
||||
self.strict_break = config.get('strict_break', False)
|
||||
|
||||
def skip_break(self):
|
||||
|
@ -113,6 +115,8 @@ class BreakScreen(object):
|
|||
Show/update the count down on all screens.
|
||||
"""
|
||||
self.enable_shortcut = self.shortcut_disable_time <= seconds
|
||||
if self.enable_shortcut and self.full_unlock_shortcuts:
|
||||
self.__release_keyboard()
|
||||
mins, secs = divmod(countdown, 60)
|
||||
timeformat = '{:02d}:{:02d}'.format(mins, secs)
|
||||
GLib.idle_add(lambda: self.__update_count_down(timeformat))
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
"use_rpc_server": true,
|
||||
"rpc_port": 7200,
|
||||
"shortcut_disable_time": 2,
|
||||
"full_unlock_shortcuts": true,
|
||||
"shortcut_skip": 9,
|
||||
"shortcut_postpone": 65,
|
||||
"strict_break": false,
|
||||
|
@ -129,4 +130,4 @@
|
|||
"version": "0.0.1"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -755,6 +755,44 @@
|
|||
<property name="position">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="box16">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="spacing">5</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="lbl_full_unlock_shortcuts">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Fully unlock keyboard after timer</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSwitch" id="switch_full_unlock_shortcuts">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="valign">center</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="pack_type">end</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="box1">
|
||||
<property name="visible">True</property>
|
||||
|
@ -1161,4 +1199,4 @@
|
|||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
||||
</interface>
|
||||
|
|
|
@ -70,6 +70,7 @@ class SettingsDialog(object):
|
|||
self.spin_time_to_prepare = builder.get_object('spin_time_to_prepare')
|
||||
self.spin_postpone_duration = builder.get_object('spin_postpone_duration')
|
||||
self.spin_disable_keyboard_shortcut = builder.get_object('spin_disable_keyboard_shortcut')
|
||||
self.switch_full_unlock_shortcuts = builder.get_object('switch_full_unlock_shortcuts')
|
||||
self.switch_strict_break = builder.get_object('switch_strict_break')
|
||||
self.switch_postpone = builder.get_object('switch_postpone')
|
||||
self.switch_persist = builder.get_object('switch_persist')
|
||||
|
@ -111,6 +112,7 @@ class SettingsDialog(object):
|
|||
self.spin_time_to_prepare.set_value(config.get('pre_break_warning_time'))
|
||||
self.spin_postpone_duration.set_value(config.get('postpone_duration'))
|
||||
self.spin_disable_keyboard_shortcut.set_value(config.get('shortcut_disable_time'))
|
||||
self.switch_full_unlock_shortcuts.set_active(config.get('full_unlock_shortcuts'))
|
||||
self.switch_strict_break.set_active(config.get('strict_break'))
|
||||
self.switch_postpone.set_active(config.get('allow_postpone'))
|
||||
self.switch_persist.set_active(config.get('persist_state'))
|
||||
|
@ -324,6 +326,7 @@ class SettingsDialog(object):
|
|||
self.config.set('pre_break_warning_time', self.spin_time_to_prepare.get_value_as_int())
|
||||
self.config.set('postpone_duration', self.spin_postpone_duration.get_value_as_int())
|
||||
self.config.set('shortcut_disable_time', self.spin_disable_keyboard_shortcut.get_value_as_int())
|
||||
self.config.set('full_unlock_shortcuts', self.switch_full_unlock_shortcuts.get_active())
|
||||
self.config.set('strict_break', self.switch_strict_break.get_active())
|
||||
self.config.set('allow_postpone', self.switch_postpone.get_active())
|
||||
self.config.set('persist_state', self.switch_persist.get_active())
|
||||
|
|
Loading…
Reference in New Issue