From 23e39dc9e69138294880126b80a9ebacbc7a2f76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20H=C3=B6rist?= Date: Mon, 30 Jul 2018 00:24:43 +0200 Subject: [PATCH] Move shortcuts dialog into gtk folder --- gajim/app_actions.py | 2 +- gajim/gtk/shortcuts_window.py | 43 ++++++++++++++++++++++++++++++ gajim/shortcuts_window.py | 50 ----------------------------------- 3 files changed, 44 insertions(+), 51 deletions(-) create mode 100644 gajim/gtk/shortcuts_window.py delete mode 100644 gajim/shortcuts_window.py diff --git a/gajim/app_actions.py b/gajim/app_actions.py index e8a2673a2..96a1f763b 100644 --- a/gajim/app_actions.py +++ b/gajim/app_actions.py @@ -21,7 +21,7 @@ from gajim.common.app import interface from gajim.common.exceptions import GajimGeneralException from gajim import config from gajim import dialogs -from gajim import shortcuts_window +from gajim.gtk import shortcuts_window from gajim import accounts_window import gajim.plugins.gui from gajim import history_window diff --git a/gajim/gtk/shortcuts_window.py b/gajim/gtk/shortcuts_window.py new file mode 100644 index 000000000..5303c1731 --- /dev/null +++ b/gajim/gtk/shortcuts_window.py @@ -0,0 +1,43 @@ +# This file is part of Gajim. +# +# Gajim is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published +# by the Free Software Foundation; version 3 only. +# +# Gajim is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Gajim. If not, see . + +from gajim.gtk.util import get_builder +from gajim.common import helpers + +__all__ = ['show'] + + +class ShortcutsWindow: + def __init__(self): + self.window = None + + def show(self, parent=None): + if self.window is None: + builder = get_builder('shortcuts_window.ui') + self.window = builder.get_object('shortcuts_window') + self.window.connect('destroy', self._on_window_destroy) + self.window.set_transient_for(parent) + self.window.show_all() + self.window.present() + + def _on_window_destroy(self, widget): + self.window = None + + +def show_shortcuts_webpage(self, parent=None): + helpers.launch_browser_mailer( + 'url', + 'https://dev.gajim.org/gajim/gajim/wikis/help/keyboardshortcuts') + +show = ShortcutsWindow().show diff --git a/gajim/shortcuts_window.py b/gajim/shortcuts_window.py deleted file mode 100644 index 49701d530..000000000 --- a/gajim/shortcuts_window.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding:utf-8 -*- -## src/shortcuts_window.py -## -## This file is part of Gajim. -## -## Gajim is free software; you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published -## by the Free Software Foundation; version 3 only. -## -## Gajim is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Gajim. If not, see . -## - -from gi.repository import Gtk - -from gajim import gtkgui_helpers - -from gajim.common import helpers - -__all__ = ['show'] - -class ShortcutsWindow: - def __init__(self): - self.window = None - - def show(self, parent=None): - if self.window is None: - builder = gtkgui_helpers.get_gtk_builder('shortcuts_window.ui') - self.window = builder.get_object('shortcuts_window') - self.window.connect('destroy', self._on_window_destroy) - self.window.set_transient_for(parent) - self.window.show_all() - self.window.present() - - def _on_window_destroy(self, widget): - self.window = None - -def show_shortcuts_webpage(self, parent=None): - helpers.launch_browser_mailer('url', - 'https://dev.gajim.org/gajim/gajim/wikis/help/keyboardshortcuts') - -if (3, 19) <= (Gtk.get_major_version(), Gtk.get_minor_version()): - show = ShortcutsWindow().show -else: - show = show_shortcuts_webpage