From b3f1416c245a419784413605be2ba0bf8e0c738f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20H=C3=B6rist?= Date: Sun, 29 Jul 2018 23:50:37 +0200 Subject: [PATCH] Move features dialog into gtk folder --- gajim/app_actions.py | 4 +- gajim/data/gui/features_window.ui | 175 +++++++----------- gajim/gtk/__init__.py | 1 + gajim/{features_window.py => gtk/features.py} | 105 ++++++----- 4 files changed, 130 insertions(+), 155 deletions(-) rename gajim/{features_window.py => gtk/features.py} (66%) diff --git a/gajim/app_actions.py b/gajim/app_actions.py index f671e8c7f..335c4fa2d 100644 --- a/gajim/app_actions.py +++ b/gajim/app_actions.py @@ -21,7 +21,6 @@ from gajim.common.app import interface from gajim.common.exceptions import GajimGeneralException from gajim import config from gajim import dialogs -from gajim import features_window from gajim import shortcuts_window from gajim import accounts_window import gajim.plugins.gui @@ -38,6 +37,7 @@ from gajim.gtk import XMLConsoleWindow from gajim.gtk import AboutDialog from gajim.gtk import PrivacyListsWindow from gajim.gtk import ManageBookmarksWindow +from gajim.gtk import FeaturesDialog # General Actions @@ -283,7 +283,7 @@ def on_keyboard_shortcuts(action, param): def on_features(action, param): - features_window.FeaturesWindow() + FeaturesDialog() def on_about(action, param): diff --git a/gajim/data/gui/features_window.ui b/gajim/data/gui/features_window.ui index a09677ce4..51e33c58b 100644 --- a/gajim/data/gui/features_window.ui +++ b/gajim/data/gui/features_window.ui @@ -1,125 +1,90 @@ - + - + + 300 + 530 + True False GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 12 - Features - 300 - 530 - dialog - + 18 + 18 + 18 + 18 + vertical + 6 - + True False GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - vertical - 6 + <b>List of possible features in Gajim:</b> + True + 0 + + + False + False + 0 + + + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + True + out - - True - False - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - <b>List of possible features in Gajim:</b> - True - 0 - - - False - False - 0 - - - - + True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - out - - - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - - - + + + - - True - True - 1 - - - - - True - False - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - end - - - gtk-close - True - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - True - - - - False - False - 0 - - - - - False - True - end - 2 - - - - - True - False - 3 - 0 - none - - - True - False - 12 - True - True - 0 - - - - - True - False - <b>Description</b> - True - - - - - False - True - 3 - + + True + True + 1 + + + + + True + False + 3 + 0 + none + + + True + False + 12 + True + True + 0 + + + + + True + False + <b>Description</b> + True + + + + + False + True + 2 + diff --git a/gajim/gtk/__init__.py b/gajim/gtk/__init__.py index e7644bf1c..d427079e2 100644 --- a/gajim/gtk/__init__.py +++ b/gajim/gtk/__init__.py @@ -57,3 +57,4 @@ from gajim.gtk.server_info import ServerInfoDialog from gajim.gtk.pep_config import ManagePEPServicesWindow from gajim.gtk.bookmarks import ManageBookmarksWindow from gajim.gtk.profile import ProfileWindow +from gajim.gtk.features import FeaturesDialog diff --git a/gajim/features_window.py b/gajim/gtk/features.py similarity index 66% rename from gajim/features_window.py rename to gajim/gtk/features.py index 734c0b3c0..3bafd657e 100644 --- a/gajim/features_window.py +++ b/gajim/gtk/features.py @@ -1,83 +1,93 @@ -# -*- coding:utf-8 -*- -## src/features_window.py -## -## Copyright (C) 2007 Jean-Marie Traissard -## Julien Pivotto -## Stefan Bethge -## Stephan Erb -## Copyright (C) 2007-2014 Yann Leboulanger -## Copyright (C) 2008 Jonathan Schleifer -## -## 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 . -## +# Copyright (C) 2007 Jean-Marie Traissard +# Julien Pivotto +# Stefan Bethge +# Stephan Erb +# Copyright (C) 2007-2014 Yann Leboulanger +# Copyright (C) 2008 Jonathan Schleifer +# +# 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 . import os + import gi from gi.repository import Gtk, Gdk -from gajim import gtkgui_helpers from gajim.common import app from gajim.common.i18n import Q_ +from gajim.gtk.util import get_builder -class FeaturesWindow: - """ - Class for features window - """ +class FeaturesDialog(Gtk.Dialog): def __init__(self): - self.xml = gtkgui_helpers.get_gtk_builder('features_window.ui') - self.window = self.xml.get_object('features_window') - self.window.set_transient_for(app.interface.roster.window) - treeview = self.xml.get_object('features_treeview') - self.desc_label = self.xml.get_object('feature_desc_label') + flags = Gtk.DialogFlags.DESTROY_WITH_PARENT + super().__init__(_('Features'), None, flags) + + self.connect('key-press-event', self.on_key_press_event) + self.set_transient_for(app.interface.roster.window) + + self.builder = get_builder('features_window.ui') + content = self.get_content_area() + content.add(self.builder.get_object('features_box')) + + treeview = self.builder.get_object('features_treeview') + self.desc_label = self.builder.get_object('feature_desc_label') # {name: (available_function, unix_text, windows_text)} self.features = { - _('Bonjour / Zeroconf'): (self.zeroconf_available, + _('Bonjour / Zeroconf'): ( + self.zeroconf_available, _('Serverless chatting with autodetected clients in a local network.'), _('Requires python-dbus.'), _('Requires pybonjour and bonjour SDK running (%(url)s)') % {'url': 'https://developer.apple.com/opensource/).'}), - _('Command line'): (self.dbus_available, + _('Command line'): ( + self.dbus_available, _('A script to control Gajim via commandline.'), _('Requires python-dbus.'), _('Feature not available under Windows.')), - _('OpenPGP message encryption'): (self.gpg_available, + _('OpenPGP message encryption'): ( + self.gpg_available, _('Ability to encrypting chat messages with OpenPGP.'), _('Requires gpg and python-gnupg (%(url)s).') % {'url': 'https://bitbucket.org/vinay.sajip/python-gnupg'}, _('Requires gpg.exe in PATH.')), - _('Password encryption'): (self.some_keyring_available, + _('Password encryption'): ( + self.some_keyring_available, _('Passwords can be stored securely and not just in plaintext.'), _('Requires libsecret and a provider (such as GNOME Keyring and KSecretService).'), _('On Windows the Windows Credential Vault is used.')), - _('Spell Checker'): (self.speller_available, + _('Spell Checker'): ( + self.speller_available, _('Spellchecking of composed messages.'), _('Requires Gspell'), _('Requires Gspell')), - _('Automatic status'): (self.idle_available, + _('Automatic status'): ( + self.idle_available, _('Ability to measure idle time, in order to set auto status.'), _('Requires libxss library.'), _('Requires python2.5.')), - _('RST Generator'): (self.docutils_available, + _('RST Generator'): ( + self.docutils_available, _('Generate XHTML output from RST code (see http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html).'), _('Requires python-docutils.'), _('Requires python-docutils.')), - _('Audio / Video'): (self.farstream_available, + _('Audio / Video'): ( + self.farstream_available, _('Ability to start audio and video chat.'), _('Requires gir1.2-farstream-0.2, gir1.2-gstreamer-1.0, gstreamer1.0-libav and gstreamer1.0-plugins-ugly.'), _('Feature not available under Windows.')), - _('UPnP-IGD'): (self.gupnp_igd_available, + _('UPnP-IGD'): ( + self.gupnp_igd_available, _('Ability to request your router to forward port for file transfer.'), _('Requires gir1.2-gupnpigd-1.0.'), _('Feature not available under Windows.')), @@ -108,16 +118,15 @@ class FeaturesWindow: self.model.set_sort_column_id(0, Gtk.SortType.ASCENDING) - self.xml.connect_signals(self) - self.window.show_all() - self.xml.get_object('close_button').grab_focus() + self.builder.connect_signals(self) + self.show_all() def on_key_press_event(self, widget, event): if event.keyval == Gdk.KEY_Escape: - self.window.destroy() + self.destroy() def on_close_button_clicked(self, widget): - self.window.destroy() + self.destroy() def on_features_treeview_cursor_changed(self, widget): selection = widget.get_selection()