diff options
author | Papoteur <papoteur@mageia.org> | 2024-05-15 22:52:18 +0200 |
---|---|---|
committer | Papoteur <papoteur@mageia.org> | 2024-05-15 23:10:30 +0200 |
commit | 2a1db6b52214ea916e499f3dbd8915a7808c793e (patch) | |
tree | 71aabdf0b82a9883dd3a020ea4e673121ef8c764 | |
parent | 30d6ae8c1eb646b3e42fe0a171e89c2a8058b015 (diff) | |
download | msec-2a1db6b52214ea916e499f3dbd8915a7808c793e.tar msec-2a1db6b52214ea916e499f3dbd8915a7808c793e.tar.gz msec-2a1db6b52214ea916e499f3dbd8915a7808c793e.tar.bz2 msec-2a1db6b52214ea916e499f3dbd8915a7808c793e.tar.xz msec-2a1db6b52214ea916e499f3dbd8915a7808c793e.zip |
Fix deprecation warning on gtk.dialog creation
-rwxr-xr-x | src/msec/msecgui.py | 43 |
1 files changed, 15 insertions, 28 deletions
diff --git a/src/msec/msecgui.py b/src/msec/msecgui.py index 19bd387..97424fd 100755 --- a/src/msec/msecgui.py +++ b/src/msec/msecgui.py @@ -339,20 +339,11 @@ class MsecGui: curperms = self.permconfig # creating preview window + dialog = Gtk.Dialog(_('Saving changes...'), self.window, Gtk.DialogFlags.MODAL) + dialog.add_action_widget(Gtk.Button(label=_('Cancel')), Gtk.ResponseType.CANCEL) if ask_ignore: - dialog = Gtk.Dialog(_("Saving changes.."), - self.window, Gtk.DialogFlags.MODAL, - (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, - _("Ignore and quit"), Gtk.ResponseType.REJECT, - Gtk.STOCK_OK, Gtk.ResponseType.OK) - ) - else: - dialog = Gtk.Dialog(_("Saving changes.."), - self.window, Gtk.DialogFlags.MODAL, - (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, - Gtk.STOCK_OK, Gtk.ResponseType.OK) - ) - + dialog.add_action_widget(Gtk.Button(label=_("Ignore and quit")), Gtk.ResponseType.REJECT) + dialog.add_action_widget(Gtk.Button(label=_('OK')), Gtk.ResponseType.OK) dialog.set_default_size(640, 300) dialog.set_default_response(Gtk.ResponseType.OK) @@ -693,10 +684,8 @@ class MsecGui: data = fd.readlines() except: data = [_("Unable to read log file: %s") % sys.exc_info()[1]] - dialog = Gtk.Dialog(_("Periodic check results"), - self.window, - 0, - (Gtk.STOCK_OK, Gtk.ResponseType.OK)) + dialog = Gtk.Dialog((_("Periodic check results"), parent=self.window, flags=0) + dialog.add_button(Gtk.STOCK_OK, Gtk.ResponseType.OK) dialog.set_size_request(640, 280) view = Gtk.TextView() buffer = view.get_buffer() @@ -1427,10 +1416,9 @@ class MsecGui: title = _("Adding new exception") # asks for new parameter value - dialog = Gtk.Dialog(title, - self.window, 0, - (Gtk.STOCK_OK, Gtk.ResponseType.OK, - Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL)) + dialog = Gtk.Dialog(title, parent=self.window, flags=0) + dialog.add_button(Gtk.STOCK_OK, Gtk.ResponseType.OK, + Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL) label = Gtk.Label(label=_("Editing exception. Please select the correspondent msec check and exception value\n")) label.set_line_wrap(True) label.set_use_markup(True) @@ -1505,10 +1493,9 @@ class MsecGui: force = "force" # asks for new parameter value - dialog = Gtk.Dialog(title, - self.window, 0, - (Gtk.STOCK_OK, Gtk.ResponseType.OK, - Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL)) + dialog = Gtk.Dialog(title, parent=self.window, flags=0) + dialog.add_button(Gtk.STOCK_OK, Gtk.ResponseType.OK, + Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL) label = Gtk.Label(label=_("Changing permissions on <b>%s</b>") % (file or _("new file"))) label.set_line_wrap(True) label.set_use_markup(True) @@ -1643,9 +1630,9 @@ class MsecGui: # asks for new parameter value dialog = Gtk.Dialog(_("Select new value for %s") % (param), - self.window, 0, - (Gtk.STOCK_OK, Gtk.ResponseType.OK, - Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL)) + parent=self.window, flags=0) + dialog.add_button(Gtk.STOCK_OK, Gtk.ResponseType.OK, + Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL) # option title label = Gtk.Label(label="<b>%s</b>\n" % param) label.set_use_markup(True) |