From 8a9013eb74fb0fb11a2612cc06600d53c3de6f42 Mon Sep 17 00:00:00 2001 From: Jeffery To Date: Tue, 17 Oct 2017 06:28:09 +0800 Subject: [PATCH 1/8] minor configurable tweak --- ex-mortis/__init__.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ex-mortis/__init__.py b/ex-mortis/__init__.py index 3c8d478..966d9e5 100644 --- a/ex-mortis/__init__.py +++ b/ex-mortis/__init__.py @@ -434,6 +434,7 @@ class ExMortisConfigurable(GObject.Object, PeasGtk.Configurable): __gtype_name__ = 'ExMortisConfigurable' + def do_create_configure_widget(self): if log.query(log.INFO): Gedit.debug_plugin_message(log.format("")) @@ -454,8 +455,10 @@ def do_create_configure_widget(self): widget.set_active(settings.restore_between_sessions) else: - widget = Gtk.Box() - widget.add(Gtk.Label.new(_("Could not load settings schema"))) + label = Gtk.Label.new(_("Could not load settings schema")) + + widget = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0) + widget.add(label) widget.set_border_width(5) From bdbaf5d9e90e297d6b4f47065d1b9d709c476cd2 Mon Sep 17 00:00:00 2001 From: Jeffery To Date: Wed, 18 Oct 2017 18:48:26 +0800 Subject: [PATCH 2/8] don't change the global gettext domain --- Changelog.md | 3 +++ ex-mortis/__init__.py | 3 +-- ex-mortis/existingmixin.py | 3 +-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Changelog.md b/Changelog.md index 9a48bad..7367886 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,5 +1,8 @@ # Changelog +## Unreleased +* Fixed (potentially) affecting the translations of other plugins + ## 0.1.1 (2017-10-13) * Added .pot file diff --git a/ex-mortis/__init__.py b/ex-mortis/__init__.py index 966d9e5..548dc92 100644 --- a/ex-mortis/__init__.py +++ b/ex-mortis/__init__.py @@ -39,8 +39,7 @@ try: import gettext gettext.bindtextdomain('gedit-ex-mortis', LOCALE_PATH) - gettext.textdomain('gedit-ex-mortis') - _ = gettext.gettext + _ = lambda s: gettext.dgettext('gedit-ex-mortis', s) except: _ = lambda s: s diff --git a/ex-mortis/existingmixin.py b/ex-mortis/existingmixin.py index c905399..c688749 100644 --- a/ex-mortis/existingmixin.py +++ b/ex-mortis/existingmixin.py @@ -29,8 +29,7 @@ try: import gettext gettext.bindtextdomain('gedit-ex-mortis', LOCALE_PATH) - gettext.textdomain('gedit-ex-mortis') - _ = gettext.gettext + _ = lambda s: gettext.dgettext('gedit-ex-mortis', s) except: _ = lambda s: s From 15889cf2c3a1d35f2cd862822d452b3e40b3ffe8 Mon Sep 17 00:00:00 2001 From: Jeffery To Date: Wed, 1 Nov 2017 21:58:34 +0800 Subject: [PATCH 3/8] log tweak --- ex-mortis/log.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/ex-mortis/log.py b/ex-mortis/log.py index 723cb9e..44744cf 100644 --- a/ex-mortis/log.py +++ b/ex-mortis/log.py @@ -97,14 +97,13 @@ def query(log_level): return highest(log_level) <= output_level -def prefix(log_level=None): +def name(log_level=None): if log_level is None: log_level = last_queried_level - name = LEVELS_TO_NAMES[highest(log_level)] if log_level is not None else 'unknown' - - return '[' + name + '] ' + return LEVELS_TO_NAMES[highest(log_level)] if log_level is not None else 'unknown' def format(message, *args): - return prefix() + (message % tuple(debug_str(arg) for arg in args)) + msg = message % tuple(debug_str(arg) for arg in args) + return '[%s] %s' % (name(), msg) From 6cfbd6fc66bc3c77f50ef849cda98d83c8ee822a Mon Sep 17 00:00:00 2001 From: Jeffery To Date: Wed, 1 Nov 2017 22:02:06 +0800 Subject: [PATCH 4/8] double quotes --- ex-mortis/log.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ex-mortis/log.py b/ex-mortis/log.py index 44744cf..79a0a75 100644 --- a/ex-mortis/log.py +++ b/ex-mortis/log.py @@ -105,5 +105,5 @@ def name(log_level=None): def format(message, *args): msg = message % tuple(debug_str(arg) for arg in args) - return '[%s] %s' % (name(), msg) + return "[%s] %s" % (name(), msg) From 5b5fa48b3ee6661125b353b69a2776b52e6c999a Mon Sep 17 00:00:00 2001 From: Jeffery To Date: Tue, 13 Mar 2018 19:57:59 +0800 Subject: [PATCH 5/8] don't auto close empty tab if there are no windows to restore, fixes #1 --- Changelog.md | 1 + ex-mortis/quittingmixin.py | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Changelog.md b/Changelog.md index 7367886..c1220e8 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,6 +1,7 @@ # Changelog ## Unreleased +* Fixed auto-closing gedit if there are no windows to restore (#1) * Fixed (potentially) affecting the translations of other plugins ## 0.1.1 (2017-10-13) diff --git a/ex-mortis/quittingmixin.py b/ex-mortis/quittingmixin.py index 2a9e7e0..1937680 100644 --- a/ex-mortis/quittingmixin.py +++ b/ex-mortis/quittingmixin.py @@ -339,7 +339,7 @@ def restore_windows(self, window_manager, settings, do_restore): settings.remove_window(window_id) - if do_restore: + if do_restore and states: if log.query(log.MESSAGE): Gedit.debug_plugin_message(log.format("restoring %s windows", len(states))) @@ -372,10 +372,14 @@ def restore_windows(self, window_manager, settings, do_restore): for window, state in zip(windows, states): self.setup_restore_window(window, state) - else: + elif not do_restore: if log.query(log.MESSAGE): Gedit.debug_plugin_message(log.format("not restoring windows")) + else: + if log.query(log.MESSAGE): + Gedit.debug_plugin_message(log.format("no windows to restore")) + def setup_restore_window(self, window, state=None): if log.query(log.INFO): Gedit.debug_plugin_message(log.format("%s", window)) From 82cdf01cada6579d1a5f60b8c8e0dd933b6ed25a Mon Sep 17 00:00:00 2001 From: Jeffery To Date: Tue, 13 Mar 2018 19:58:29 +0800 Subject: [PATCH 6/8] made pref panel nicer --- ex-mortis/__init__.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/ex-mortis/__init__.py b/ex-mortis/__init__.py index 548dc92..b6060b2 100644 --- a/ex-mortis/__init__.py +++ b/ex-mortis/__init__.py @@ -452,16 +452,14 @@ def do_create_configure_widget(self): ) widget.set_active(settings.restore_between_sessions) + widget._settings = settings else: - label = Gtk.Label.new(_("Could not load settings schema")) + widget = Gtk.Label.new(_("Could not load settings schema")) - widget = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0) - widget.add(label) + box = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0) + box.set_border_width(5) + box.add(widget) - widget.set_border_width(5) - - widget._settings = settings - - return widget + return box From c7f0e7195d928b1f089a158534247f5a9b27ab0b Mon Sep 17 00:00:00 2001 From: Jeffery To Date: Tue, 13 Mar 2018 20:04:48 +0800 Subject: [PATCH 7/8] new year --- README.md | 2 +- ex-mortis.plugin | 2 +- ex-mortis/__init__.py | 2 +- ex-mortis/closingmixin.py | 2 +- ex-mortis/existingmixin.py | 2 +- ex-mortis/log.py | 2 +- ex-mortis/quittingmixin.py | 2 +- ex-mortis/settings.py | 2 +- ex-mortis/windowmanager.py | 2 +- ex-mortis/windowstate.py | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 242e69b..310947f 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,7 @@ Inspired by: ## License -Copyright © 2017 Jeffery To +Copyright © 2017-2018 Jeffery To Available under GNU General Public License version 3 diff --git a/ex-mortis.plugin b/ex-mortis.plugin index 54105fc..e4f7426 100644 --- a/ex-mortis.plugin +++ b/ex-mortis.plugin @@ -6,6 +6,6 @@ Name=Ex-Mortis Description=Reopen closed windows and optionally restore windows between sessions Icon=window-new Authors=Jeffery To -Copyright=Copyright © 2017 Jeffery To +Copyright=Copyright © 2017-2018 Jeffery To Website=https://github.com/jefferyto/gedit-ex-mortis Version=0.1.1 diff --git a/ex-mortis/__init__.py b/ex-mortis/__init__.py index b6060b2..27c5d64 100644 --- a/ex-mortis/__init__.py +++ b/ex-mortis/__init__.py @@ -3,7 +3,7 @@ # __init__.py # This file is part of Ex-Mortis, a plugin for gedit # -# Copyright (C) 2017 Jeffery To +# Copyright (C) 2017-2018 Jeffery To # https://github.com/jefferyto/gedit-ex-mortis # # This program is free software: you can redistribute it and/or modify diff --git a/ex-mortis/closingmixin.py b/ex-mortis/closingmixin.py index bce6630..16b73f5 100644 --- a/ex-mortis/closingmixin.py +++ b/ex-mortis/closingmixin.py @@ -3,7 +3,7 @@ # closingmixin.py # This file is part of Ex-Mortis, a plugin for gedit # -# Copyright (C) 2017 Jeffery To +# Copyright (C) 2017-2018 Jeffery To # https://github.com/jefferyto/gedit-ex-mortis # # This program is free software: you can redistribute it and/or modify diff --git a/ex-mortis/existingmixin.py b/ex-mortis/existingmixin.py index c688749..dad5a71 100644 --- a/ex-mortis/existingmixin.py +++ b/ex-mortis/existingmixin.py @@ -3,7 +3,7 @@ # existingmixin.py # This file is part of Ex-Mortis, a plugin for gedit # -# Copyright (C) 2017 Jeffery To +# Copyright (C) 2017-2018 Jeffery To # https://github.com/jefferyto/gedit-ex-mortis # # This program is free software: you can redistribute it and/or modify diff --git a/ex-mortis/log.py b/ex-mortis/log.py index 79a0a75..fd6959d 100644 --- a/ex-mortis/log.py +++ b/ex-mortis/log.py @@ -3,7 +3,7 @@ # log.py # This file is part of Ex-Mortis, a plugin for gedit # -# Copyright (C) 2017 Jeffery To +# Copyright (C) 2017-2018 Jeffery To # https://github.com/jefferyto/gedit-ex-mortis # # This program is free software: you can redistribute it and/or modify diff --git a/ex-mortis/quittingmixin.py b/ex-mortis/quittingmixin.py index 1937680..4767810 100644 --- a/ex-mortis/quittingmixin.py +++ b/ex-mortis/quittingmixin.py @@ -3,7 +3,7 @@ # quittingmixin.py # This file is part of Ex-Mortis, a plugin for gedit # -# Copyright (C) 2017 Jeffery To +# Copyright (C) 2017-2018 Jeffery To # https://github.com/jefferyto/gedit-ex-mortis # # This program is free software: you can redistribute it and/or modify diff --git a/ex-mortis/settings.py b/ex-mortis/settings.py index ba03193..6e7eb34 100644 --- a/ex-mortis/settings.py +++ b/ex-mortis/settings.py @@ -3,7 +3,7 @@ # settings.py # This file is part of Ex-Mortis, a plugin for gedit # -# Copyright (C) 2017 Jeffery To +# Copyright (C) 2017-2018 Jeffery To # https://github.com/jefferyto/gedit-ex-mortis # # This program is free software: you can redistribute it and/or modify diff --git a/ex-mortis/windowmanager.py b/ex-mortis/windowmanager.py index 6be0883..9cd161e 100644 --- a/ex-mortis/windowmanager.py +++ b/ex-mortis/windowmanager.py @@ -3,7 +3,7 @@ # windowmanager.py # This file is part of Ex-Mortis, a plugin for gedit # -# Copyright (C) 2017 Jeffery To +# Copyright (C) 2017-2018 Jeffery To # https://github.com/jefferyto/gedit-ex-mortis # # This program is free software: you can redistribute it and/or modify diff --git a/ex-mortis/windowstate.py b/ex-mortis/windowstate.py index 6ce1fd6..b7da88a 100644 --- a/ex-mortis/windowstate.py +++ b/ex-mortis/windowstate.py @@ -3,7 +3,7 @@ # windowstate.py # This file is part of Ex-Mortis, a plugin for gedit # -# Copyright (C) 2017 Jeffery To +# Copyright (C) 2017-2018 Jeffery To # https://github.com/jefferyto/gedit-ex-mortis # # This program is free software: you can redistribute it and/or modify From e5160d8f0813f006a223c6b302f607a09e6b027e Mon Sep 17 00:00:00 2001 From: Jeffery To Date: Tue, 13 Mar 2018 20:09:45 +0800 Subject: [PATCH 8/8] new version --- Changelog.md | 2 +- README.md | 2 +- ex-mortis.plugin | 2 +- ex-mortis/locale/gedit-ex-mortis.pot | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Changelog.md b/Changelog.md index c1220e8..5e274d1 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,6 +1,6 @@ # Changelog -## Unreleased +## 0.1.2 (2018-03-13) * Fixed auto-closing gedit if there are no windows to restore (#1) * Fixed (potentially) affecting the translations of other plugins diff --git a/README.md b/README.md index 310947f..de5b8e5 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Reopen closed windows and optionally restore windows between sessions -0.1.1 +0.1.2 All bug reports, feature requests and miscellaneous comments are welcome at the [project issue tracker][]. diff --git a/ex-mortis.plugin b/ex-mortis.plugin index e4f7426..1a30904 100644 --- a/ex-mortis.plugin +++ b/ex-mortis.plugin @@ -8,4 +8,4 @@ Icon=window-new Authors=Jeffery To Copyright=Copyright © 2017-2018 Jeffery To Website=https://github.com/jefferyto/gedit-ex-mortis -Version=0.1.1 +Version=0.1.2 diff --git a/ex-mortis/locale/gedit-ex-mortis.pot b/ex-mortis/locale/gedit-ex-mortis.pot index 6524c9b..83c1c69 100644 --- a/ex-mortis/locale/gedit-ex-mortis.pot +++ b/ex-mortis/locale/gedit-ex-mortis.pot @@ -1,7 +1,7 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: gedit-ex-mortis 0.1.1\n" +"Project-Id-Version: gedit-ex-mortis 0.1.2\n" "POT-Creation-Date: 2017-10-13 22:50+0800\n" "PO-Revision-Date: 2017-10-13 22:50+0800\n" "Last-Translator: Jeffery To \n"