From 2ec21209d8f3f7533ff2c67a7554a85decf8f454 Mon Sep 17 00:00:00 2001 From: Jonathan Harris Date: Sat, 9 Jan 2016 01:02:02 +0000 Subject: [PATCH] "Always on top" option in system menu on Windows. --- EDMarketConnector.py | 12 ++++++++++++ L10n/de.strings | 3 +++ L10n/en.template | 3 +++ L10n/es.strings | 3 +++ L10n/fr.strings | 3 +++ L10n/it.strings | 3 +++ L10n/lv.strings | 3 +++ L10n/nl.strings | 3 +++ L10n/pl.strings | 3 +++ L10n/ru.strings | 3 +++ L10n/sl.strings | 3 +++ L10n/uk.strings | 3 +++ 12 files changed, 45 insertions(+) diff --git a/EDMarketConnector.py b/EDMarketConnector.py index c7cb45ea..98e165e8 100755 --- a/EDMarketConnector.py +++ b/EDMarketConnector.py @@ -143,8 +143,15 @@ class AppWindow: self.edit_menu = tk.Menu(menubar, tearoff=tk.FALSE) self.edit_menu.add_command(label=_('Copy'), accelerator='Ctrl+C', state=tk.DISABLED, command=self.copy) # As in Copy and Paste menubar.add_cascade(label=_('Edit'), menu=self.edit_menu) # Menu title + if platform == 'win32': + self.always_ontop = tk.BooleanVar(value = config.getint('always_ontop')) + system_menu = tk.Menu(menubar, name='system', tearoff=tk.FALSE) + system_menu.add_separator() + system_menu.add_checkbutton(label=_('Always on top'), variable = self.always_ontop, command=self.ontop_changed) # System menu entry on Windows + menubar.add_cascade(menu=system_menu) self.w.bind('', self.copy) self.w.protocol("WM_DELETE_WINDOW", self.onexit) + if platform == 'linux2': # Fix up menu to use same styling as everything else (fg, bg, afg, abg) = (style.lookup('TLabel.label', 'foreground'), @@ -157,6 +164,7 @@ class AppWindow: self.w['menu'] = menubar # update geometry + self.ontop_changed() if config.get('geometry'): match = re.match('\+([\-\d]+)\+([\-\d]+)', config.get('geometry')) if match and (platform!='darwin' or int(match.group(2))>0): # http://core.tcl.tk/tk/tktview/c84f660833546b1b84e7 @@ -478,6 +486,10 @@ class AppWindow: self.button['text'] = _('Update') # Update button in main window self.button['state'] = tk.NORMAL + def ontop_changed(self, event=None): + config.set('always_ontop', self.always_ontop.get()) + self.w.wm_attributes('-topmost', self.always_ontop.get()) + def copy(self, event=None): if self.system['text']: self.w.clipboard_clear() diff --git a/L10n/de.strings b/L10n/de.strings index 5bde2e49..e3c6d0da 100644 --- a/L10n/de.strings +++ b/L10n/de.strings @@ -10,6 +10,9 @@ /* Explorer rank. [stats.py] */ "Aimless" = "Total planlos"; +/* System menu entry on Windows. [EDMarketConnector.py] */ +"Always on top" = "Immer im Vordergrund"; + /* CQC rank. [stats.py] */ "Amateur" = "Anfänger"; diff --git a/L10n/en.template b/L10n/en.template index b4d81c0a..c9385220 100644 --- a/L10n/en.template +++ b/L10n/en.template @@ -10,6 +10,9 @@ /* Explorer rank. [stats.py] */ "Aimless" = "Aimless"; +/* System menu entry on Windows. [EDMarketConnector.py] */ +"Always on top" = "Always on top"; + /* CQC rank. [stats.py] */ "Amateur" = "Amateur"; diff --git a/L10n/es.strings b/L10n/es.strings index 668b6fcf..3df4c75b 100644 --- a/L10n/es.strings +++ b/L10n/es.strings @@ -10,6 +10,9 @@ /* Explorer rank. [stats.py] */ "Aimless" = "Perdido"; +/* System menu entry on Windows. [EDMarketConnector.py] */ +"Always on top" = "Siempre visible"; + /* CQC rank. [stats.py] */ "Amateur" = "Aficionado"; diff --git a/L10n/fr.strings b/L10n/fr.strings index 09251180..ab6436dc 100644 --- a/L10n/fr.strings +++ b/L10n/fr.strings @@ -10,6 +10,9 @@ /* Explorer rank. [stats.py] */ "Aimless" = "Vagabond"; +/* System menu entry on Windows. [EDMarketConnector.py] */ +"Always on top" = "Toujours visible"; + /* CQC rank. [stats.py] */ "Amateur" = "Amateur"; diff --git a/L10n/it.strings b/L10n/it.strings index 492678fa..f0f64981 100644 --- a/L10n/it.strings +++ b/L10n/it.strings @@ -10,6 +10,9 @@ /* Explorer rank. [stats.py] */ "Aimless" = "Aimless"; +/* System menu entry on Windows. [EDMarketConnector.py] */ +"Always on top" = "Sempre in primo piano"; + /* CQC rank. [stats.py] */ "Amateur" = "Amateur"; diff --git a/L10n/lv.strings b/L10n/lv.strings index bf66d1ac..ddeefd6c 100644 --- a/L10n/lv.strings +++ b/L10n/lv.strings @@ -10,6 +10,9 @@ /* Explorer rank. [stats.py] */ "Aimless" = "Aimless"; +/* System menu entry on Windows. [EDMarketConnector.py] */ +"Always on top" = "Vienmēr virspusē"; + /* CQC rank. [stats.py] */ "Amateur" = "Amateur"; diff --git a/L10n/nl.strings b/L10n/nl.strings index 9e7fcddc..71e02207 100644 --- a/L10n/nl.strings +++ b/L10n/nl.strings @@ -10,6 +10,9 @@ /* Explorer rank. [stats.py] */ "Aimless" = "Aimless"; +/* System menu entry on Windows. [EDMarketConnector.py] */ +"Always on top" = "Altijd op voorgrond"; + /* CQC rank. [stats.py] */ "Amateur" = "Amateur"; diff --git a/L10n/pl.strings b/L10n/pl.strings index c0a08d35..eaf61101 100644 --- a/L10n/pl.strings +++ b/L10n/pl.strings @@ -10,6 +10,9 @@ /* Explorer rank. [stats.py] */ "Aimless" = "Aimless"; +/* System menu entry on Windows. [EDMarketConnector.py] */ +"Always on top" = "Zawsze na wierzchu"; + /* CQC rank. [stats.py] */ "Amateur" = "Amateur"; diff --git a/L10n/ru.strings b/L10n/ru.strings index 4cdd2df3..24f71e52 100644 --- a/L10n/ru.strings +++ b/L10n/ru.strings @@ -10,6 +10,9 @@ /* Explorer rank. [stats.py] */ "Aimless" = "Бесцельный"; +/* System menu entry on Windows. [EDMarketConnector.py] */ +"Always on top" = "Поверх остальных окон"; + /* CQC rank. [stats.py] */ "Amateur" = "Любитель"; diff --git a/L10n/sl.strings b/L10n/sl.strings index fc515a35..bb130e7f 100644 --- a/L10n/sl.strings +++ b/L10n/sl.strings @@ -10,6 +10,9 @@ /* Explorer rank. [stats.py] */ "Aimless" = "Aimless"; +/* System menu entry on Windows. [EDMarketConnector.py] */ +"Always on top" = "Vedno na vrhu"; + /* CQC rank. [stats.py] */ "Amateur" = "Amateur"; diff --git a/L10n/uk.strings b/L10n/uk.strings index b46dd9f7..ece9464e 100644 --- a/L10n/uk.strings +++ b/L10n/uk.strings @@ -10,6 +10,9 @@ /* Explorer rank. [stats.py] */ "Aimless" = "Безцільний"; +/* System menu entry on Windows. [EDMarketConnector.py] */ +"Always on top" = "Zawsze na wierzchu"; + /* CQC rank. [stats.py] */ "Amateur" = "Аматор";