From 6383df8dcaa210f742f42363ed4099c5ad2cc9f1 Mon Sep 17 00:00:00 2001 From: Xodetaetl Date: Mon, 17 Aug 2015 23:01:31 +0200 Subject: [PATCH] Replace deprecated Gtk.Stock stuff (partial fix #194), standardize some dialogs --- lutris/gui/config_boxes.py | 4 +- lutris/gui/dialogs.py | 12 +-- lutris/gui/logwindow.py | 2 +- lutris/gui/runnerinstalldialog.py | 2 +- lutris/gui/sidebar.py | 3 +- lutris/gui/widgets.py | 9 +- share/lutris/ui/LutrisWindow.ui | 110 ++++++++++++++++------- share/lutris/ui/dialog-lutris-login.ui | 33 +++++-- share/lutris/ui/dialog-pga-sources.ui | 51 +++++++---- share/lutris/ui/dialog-uninstall-game.ui | 24 ++++- 10 files changed, 173 insertions(+), 77 deletions(-) diff --git a/lutris/gui/config_boxes.py b/lutris/gui/config_boxes.py index 5544fac05..8fd522a63 100644 --- a/lutris/gui/config_boxes.py +++ b/lutris/gui/config_boxes.py @@ -79,8 +79,8 @@ class ConfigBox(VBox): self.call_widget_generator(option, option_key, value, default) # Reset button - icon = Gtk.Image(stock=Gtk.STOCK_CLEAR) - reset_btn = Gtk.Button(image=icon) + reset_btn = Gtk.Button.new_from_icon_name('edit-clear', + Gtk.IconSize.MENU) reset_btn.set_relief(Gtk.ReliefStyle.NONE) reset_btn.set_tooltip_text("Reset option to global or " "default config") diff --git a/lutris/gui/dialogs.py b/lutris/gui/dialogs.py index 928a6d624..daedc3c04 100644 --- a/lutris/gui/dialogs.py +++ b/lutris/gui/dialogs.py @@ -81,8 +81,8 @@ class DirectoryDialog(Gtk.FileChooserDialog): super(DirectoryDialog, self).__init__( title=message, action=Gtk.FileChooserAction.SELECT_FOLDER, - buttons=(Gtk.STOCK_CLOSE, Gtk.ResponseType.CLOSE, - Gtk.STOCK_OK, Gtk.ResponseType.OK) + buttons=('_Cancel', Gtk.ResponseType.CLOSE, + '_OK', Gtk.ResponseType.OK) ) self.result = self.run() self.folder = self.get_current_folder() @@ -96,8 +96,8 @@ class FileDialog(Gtk.FileChooserDialog): message = "Please choose a file" super(FileDialog, self).__init__( message, None, Gtk.FileChooserAction.OPEN, - (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, - Gtk.STOCK_OPEN, Gtk.ResponseType.OK) + ('_Cancel', Gtk.ResponseType.CANCEL, + '_OK', Gtk.ResponseType.OK) ) self.set_local_only(False) response = self.run() @@ -171,8 +171,8 @@ class PgaSourceDialog(GtkBuilderDialog): chooser = Gtk.FileChooserDialog( "Select directory", self.dialog, Gtk.FileChooserAction.SELECT_FOLDER, - (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, - "Select", Gtk.ResponseType.OK) + ('_Cancel', Gtk.ResponseType.CANCEL, + '_OK', Gtk.ResponseType.OK) ) chooser.set_local_only(False) response = chooser.run() diff --git a/lutris/gui/logwindow.py b/lutris/gui/logwindow.py index ab300ae92..c1d7e212a 100644 --- a/lutris/gui/logwindow.py +++ b/lutris/gui/logwindow.py @@ -34,7 +34,7 @@ class LogTextView(Gtk.TextView): class LogWindow(Dialog): def __init__(self, title, parent): super(LogWindow, self).__init__(title, parent, 0, - (Gtk.STOCK_OK, Gtk.ResponseType.OK)) + ('_OK', Gtk.ResponseType.OK)) self.set_size_request(640, 480) self.grid = Gtk.Grid() self.logtextview = LogTextView() diff --git a/lutris/gui/runnerinstalldialog.py b/lutris/gui/runnerinstalldialog.py index 344ded940..090297e0c 100644 --- a/lutris/gui/runnerinstalldialog.py +++ b/lutris/gui/runnerinstalldialog.py @@ -18,7 +18,7 @@ class RunnerInstallDialog(Dialog): def __init__(self, title, parent, runner): super(RunnerInstallDialog, self).__init__( - title, parent, 0, (Gtk.STOCK_OK, Gtk.ResponseType.OK) + title, parent, 0, ('_OK', Gtk.ResponseType.OK) ) self.runner = runner self.runner_info = api.get_runners(self.runner) diff --git a/lutris/gui/sidebar.py b/lutris/gui/sidebar.py index 9be03a05c..6c5cd2968 100644 --- a/lutris/gui/sidebar.py +++ b/lutris/gui/sidebar.py @@ -91,8 +91,7 @@ class ContextualMenu(Gtk.Menu): for entry in entries: name = entry[0] label = entry[1] - action = Gtk.Action(name=name, label=label, - tooltip=None, stock_id=None) + action = Gtk.Action(name=name, label=label) action.connect('activate', entry[2]) menuitem = action.create_menu_item() menuitem.action_id = name diff --git a/lutris/gui/widgets.py b/lutris/gui/widgets.py index 6bc6e97ba..bd6fcf347 100644 --- a/lutris/gui/widgets.py +++ b/lutris/gui/widgets.py @@ -100,8 +100,7 @@ class ContextualMenu(Gtk.Menu): for entry in entries: name = entry[0] label = entry[1] - action = Gtk.Action(name=name, label=label, - tooltip=None, stock_id=None) + action = Gtk.Action(name=name, label=label) action.connect('activate', entry[2]) menuitem = action.create_menu_item() menuitem.action_id = name @@ -485,7 +484,7 @@ class DownloadProgressBox(Gtk.VBox): self.progressbar.set_margin_right(10) progress_box.pack_start(self.progressbar, True, True, 0) - self.cancel_button = Gtk.Button(stock=Gtk.STOCK_CANCEL) + self.cancel_button = Gtk.Button('_Cancel') self.cancel_button.connect('clicked', self.cancel) if not cancelable: self.cancel_button.set_sensitive(False) @@ -574,8 +573,8 @@ class FileChooserEntry(Gtk.Box): ) self.file_chooser_dlg.add_buttons( - Gtk.STOCK_CLOSE, Gtk.ResponseType.CLOSE, - Gtk.STOCK_OPEN, Gtk.ResponseType.OK + '_Cancel', Gtk.ResponseType.CLOSE, + '_OK', Gtk.ResponseType.OK ) if default: self.file_chooser_dlg.set_current_folder( diff --git a/share/lutris/ui/LutrisWindow.ui b/share/lutris/ui/LutrisWindow.ui index f1c8e54a7..2520f0c57 100644 --- a/share/lutris/ui/LutrisWindow.ui +++ b/share/lutris/ui/LutrisWindow.ui @@ -6,12 +6,57 @@ True False - gtk-media-play + preferences-desktop + True + 1 True False - gtk-file + text-x-generic + True + 1 + + + True + False + application-exit + True + 1 + + + True + False + media-playback-start + True + 1 + + + True + False + media-playback-stop + True + 1 + + + True + False + list-add + True + 1 + + + True + False + list-remove + True + 1 + + + True + False + help-about + True 1 @@ -126,24 +171,26 @@ - gtk-preferences + _Preferences True False True configure the default options configure the default options True - True + image1 + False - gtk-quit + _Quit True False True - True + image3 + False @@ -165,7 +212,7 @@ True False - Grid + _Grid True True True @@ -176,7 +223,7 @@ True False - List + _List True True gridview_menuitem @@ -192,7 +239,7 @@ True False - Icon style + _Icon style True @@ -248,7 +295,7 @@ True False - Installed games only + I_nstalled games only True @@ -269,20 +316,23 @@ False - Start + _Play True False + True + image4 False - gtk-media-stop + _Stop True False True - True + image5 + False @@ -294,21 +344,23 @@ - gtk-add + _Add True False True - True + image6 + False - gtk-remove + _Remove True False True - True + image7 + False @@ -320,9 +372,10 @@ - View log of last game + View last game's _log True False + True image2 False @@ -344,11 +397,12 @@ False - gtk-about + _About True False True - True + image8 + False @@ -375,8 +429,7 @@ False Play game Play - True - gtk-media-play + media-playback-start @@ -390,8 +443,7 @@ False Stop game Stop - True - gtk-media-stop + media-playback-stop @@ -405,8 +457,7 @@ False Manually add a game Add Game - True - gtk-add + list-add @@ -420,8 +471,7 @@ False Remove game from library Remove - True - gtk-delete + edit-delete @@ -452,8 +502,8 @@ True 30 - gtk-find - gtk-clear + edit-find + edit-clear False False Filter the list of games diff --git a/share/lutris/ui/dialog-lutris-login.ui b/share/lutris/ui/dialog-lutris-login.ui index ea8c066ef..cff715652 100644 --- a/share/lutris/ui/dialog-lutris-login.ui +++ b/share/lutris/ui/dialog-lutris-login.ui @@ -2,6 +2,18 @@ + + True + False + network-wired + True + + + True + False + dialog-cancel + True + False 5 @@ -19,7 +31,7 @@ Forgot password? True - False + True False True none @@ -33,11 +45,12 @@ - gtk-cancel + C_ancel True - False + True True - True + image2 + True False @@ -47,11 +60,14 @@ - gtk-connect + _Connect True - False + True + True + True True - True + image1 + True False @@ -85,8 +101,7 @@ True False - 30 - 40 + 14 True diff --git a/share/lutris/ui/dialog-pga-sources.ui b/share/lutris/ui/dialog-pga-sources.ui index 9e0d8a660..3a8d8a0df 100644 --- a/share/lutris/ui/dialog-pga-sources.ui +++ b/share/lutris/ui/dialog-pga-sources.ui @@ -2,6 +2,18 @@ + + True + False + dialog-ok + True + + + True + False + dialog-cancel + True + 640 400 @@ -18,13 +30,14 @@ False end - - gtk-apply + + _Cancel True - False + True True - True - + image2 + True + False @@ -33,13 +46,16 @@ - - gtk-close + + Appl_y True - False + True + True + True True - True - + image1 + True + False @@ -124,11 +140,12 @@ start - gtk-add + _Add True - False + True + True True - True + True @@ -139,11 +156,11 @@ - gtk-remove + _Remove True - False + True True - True + True @@ -176,8 +193,8 @@ - button2 button1 + button2 diff --git a/share/lutris/ui/dialog-uninstall-game.ui b/share/lutris/ui/dialog-uninstall-game.ui index 020db157c..f9133198f 100644 --- a/share/lutris/ui/dialog-uninstall-game.ui +++ b/share/lutris/ui/dialog-uninstall-game.ui @@ -2,6 +2,18 @@ + + True + False + dialog-ok + True + + + True + False + dialog-cancel + True + 300 300 @@ -25,12 +37,13 @@ end - gtk-cancel + _Cancel False True True True - True + image2 + True False @@ -40,12 +53,15 @@ - gtk-apply + _Apply False True True + True + True True - True + image1 + True False