Compare commits

..

9 Commits

Author SHA1 Message Date
deltragon c4c172ab5e
lock keyboard on wayland 2024-01-24 18:56:16 +01:00
deltragon 394028c14c
dont call x11 methods on wayland 2024-01-24 18:55:44 +01:00
deltragon 0cc4b127d1
gtk4: plugin settings 2024-01-02 13:36:47 +01:00
deltragon fdbc6a39c5
gtk4: new break 2024-01-02 13:36:46 +01:00
deltragon ca98ec90f3
gtk4: break settings 2024-01-02 13:36:45 +01:00
deltragon d234876123
gtk4: settings dialog 2024-01-02 13:36:45 +01:00
deltragon 09c4326120
gtk4: about dialog 2024-01-02 13:36:44 +01:00
deltragon b2b5344224
gtk4: get break screen ui running 2024-01-02 13:36:43 +01:00
deltragon eb027f7c06
gtk4: simple changes 2024-01-02 13:36:41 +01:00
1 changed files with 28 additions and 33 deletions

View File

@ -164,57 +164,52 @@ class SettingsDialog:
def on_reset_menu_clicked(self, button): def on_reset_menu_clicked(self, button):
self.popover.hide() self.popover.hide()
def __confirmation_dialog_response(dialog, result): def __confirmation_dialog_response(widget, response_id):
response_id = dialog.choose_finish(result) if response_id == Gtk.ResponseType.OK:
if response_id == 1:
utility.reset_config() utility.reset_config()
self.config = Config() self.config = Config()
# Remove breaks from the container # Remove breaks from the container
self.__clear_children(self.box_short_breaks) self.box_short_breaks.foreach(lambda element: self.box_short_breaks.remove(element))
self.__clear_children(self.box_long_breaks) self.box_long_breaks.foreach(lambda element: self.box_long_breaks.remove(element))
self.__clear_children(self.box_plugins) # Remove plugins from the container
self.box_plugins.foreach(lambda element: self.box_plugins.remove(element))
# Initialize again # Initialize again
self.__initialize(self.config) self.__initialize(self.config)
widget.destroy()
messagedialog = Gtk.AlertDialog() messagedialog = Gtk.MessageDialog(parent=self.window,
messagedialog.set_modal(True) flags=Gtk.DialogFlags.MODAL,
messagedialog.set_buttons(['_Cancel', _("Reset")]) type=Gtk.MessageType.WARNING,
messagedialog.set_message(_("Are you sure you want to reset all settings to default?")) buttons=(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
messagedialog.set_detail(_("You can't undo this action.")) _("Reset"), Gtk.ResponseType.OK),
message_format=_("Are you sure you want to reset all settings to default?"))
messagedialog.set_cancel_button(0) messagedialog.connect("response", __confirmation_dialog_response)
messagedialog.set_default_button(0) messagedialog.format_secondary_text(_("You can't undo this action."))
messagedialog.show()
messagedialog.choose(self.window, None, __confirmation_dialog_response)
def __clear_children(self, widget):
while widget.get_last_child() is not None:
widget.remove(widget.get_last_child())
def __delete_break(self, break_config, is_short, on_remove): def __delete_break(self, break_config, is_short, on_remove):
""" """
Remove the break after a confirmation. Remove the break after a confirmation.
""" """
def __confirmation_dialog_response(dialog, result): def __confirmation_dialog_response(widget, response_id):
response_id = dialog.choose_finish(result) if response_id == Gtk.ResponseType.OK:
if response_id == 1:
if is_short: if is_short:
self.config.get('short_breaks').remove(break_config) self.config.get('short_breaks').remove(break_config)
else: else:
self.config.get('long_breaks').remove(break_config) self.config.get('long_breaks').remove(break_config)
on_remove() on_remove()
widget.destroy()
messagedialog = Gtk.AlertDialog() messagedialog = Gtk.MessageDialog(parent=self.window,
messagedialog.set_modal(True) flags=Gtk.DialogFlags.MODAL,
messagedialog.set_buttons(['_Cancel', _("Delete")]) type=Gtk.MessageType.WARNING,
messagedialog.set_message(_("Are you sure you want to delete this break?")) buttons=(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
messagedialog.set_detail(_("You can't undo this action.")) _("Delete"), Gtk.ResponseType.OK),
message_format=_("Are you sure you want to delete this break?"))
messagedialog.set_cancel_button(0) messagedialog.connect("response", __confirmation_dialog_response)
messagedialog.set_default_button(0) messagedialog.format_secondary_text(_("You can't undo this action."))
messagedialog.show()
messagedialog.choose(self.window, None, __confirmation_dialog_response)
def __create_plugin_item(self, plugin_config): def __create_plugin_item(self, plugin_config):
""" """