Move features dialog into gtk folder

This commit is contained in:
Philipp Hörist 2018-07-29 23:50:37 +02:00
parent 137bf1f831
commit b3f1416c24
4 changed files with 130 additions and 155 deletions

View File

@ -21,7 +21,6 @@ from gajim.common.app import interface
from gajim.common.exceptions import GajimGeneralException from gajim.common.exceptions import GajimGeneralException
from gajim import config from gajim import config
from gajim import dialogs from gajim import dialogs
from gajim import features_window
from gajim import shortcuts_window from gajim import shortcuts_window
from gajim import accounts_window from gajim import accounts_window
import gajim.plugins.gui import gajim.plugins.gui
@ -38,6 +37,7 @@ from gajim.gtk import XMLConsoleWindow
from gajim.gtk import AboutDialog from gajim.gtk import AboutDialog
from gajim.gtk import PrivacyListsWindow from gajim.gtk import PrivacyListsWindow
from gajim.gtk import ManageBookmarksWindow from gajim.gtk import ManageBookmarksWindow
from gajim.gtk import FeaturesDialog
# General Actions # General Actions
@ -283,7 +283,7 @@ def on_keyboard_shortcuts(action, param):
def on_features(action, param): def on_features(action, param):
features_window.FeaturesWindow() FeaturesDialog()
def on_about(action, param): def on_about(action, param):

View File

@ -1,125 +1,90 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.0 --> <!-- Generated with glade 3.22.1 -->
<interface> <interface>
<requires lib="gtk+" version="3.12"/> <requires lib="gtk+" version="3.12"/>
<object class="GtkWindow" id="features_window"> <object class="GtkBox" id="features_box">
<property name="width_request">300</property>
<property name="height_request">530</property>
<property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="border_width">12</property> <property name="margin_left">18</property>
<property name="title" translatable="yes">Features</property> <property name="margin_right">18</property>
<property name="default_width">300</property> <property name="margin_top">18</property>
<property name="default_height">530</property> <property name="margin_bottom">18</property>
<property name="type_hint">dialog</property> <property name="orientation">vertical</property>
<signal name="key-press-event" handler="on_key_press_event" swapped="no"/> <property name="spacing">6</property>
<child> <child>
<object class="GtkBox" id="vbox1"> <object class="GtkLabel">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="orientation">vertical</property> <property name="label" translatable="yes">&lt;b&gt;List of possible features in Gajim:&lt;/b&gt;</property>
<property name="spacing">6</property> <property name="use_markup">True</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="vexpand">True</property>
<property name="shadow_type">out</property>
<child> <child>
<object class="GtkLabel" id="label1"> <object class="GtkTreeView" id="features_treeview">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">&lt;b&gt;List of possible features in Gajim:&lt;/b&gt;</property>
<property name="use_markup">True</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow1">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="shadow_type">out</property> <signal name="cursor-changed" handler="on_features_treeview_cursor_changed" swapped="no"/>
<child> <child internal-child="selection">
<object class="GtkTreeView" id="features_treeview"> <object class="GtkTreeSelection" id="treeview-selection1"/>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<signal name="cursor-changed" handler="on_features_treeview_cursor_changed" swapped="no"/>
<child internal-child="selection">
<object class="GtkTreeSelection" id="treeview-selection1"/>
</child>
</object>
</child> </child>
</object> </object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButtonBox" id="hbuttonbox1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="close_button">
<property name="label">gtk-close</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="on_close_button_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkFrame" id="frame2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">3</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>
<object class="GtkLabel" id="feature_desc_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">12</property>
<property name="wrap">True</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
</object>
</child>
<child type="label">
<object class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">&lt;b&gt;Description&lt;/b&gt;</property>
<property name="use_markup">True</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child> </child>
</object> </object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkFrame">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">3</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>
<object class="GtkLabel" id="feature_desc_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">12</property>
<property name="wrap">True</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
</object>
</child>
<child type="label">
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">&lt;b&gt;Description&lt;/b&gt;</property>
<property name="use_markup">True</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child> </child>
</object> </object>
</interface> </interface>

View File

@ -57,3 +57,4 @@ from gajim.gtk.server_info import ServerInfoDialog
from gajim.gtk.pep_config import ManagePEPServicesWindow from gajim.gtk.pep_config import ManagePEPServicesWindow
from gajim.gtk.bookmarks import ManageBookmarksWindow from gajim.gtk.bookmarks import ManageBookmarksWindow
from gajim.gtk.profile import ProfileWindow from gajim.gtk.profile import ProfileWindow
from gajim.gtk.features import FeaturesDialog

View File

@ -1,83 +1,93 @@
# -*- coding:utf-8 -*- # Copyright (C) 2007 Jean-Marie Traissard <jim AT lapin.org>
## src/features_window.py # Julien Pivotto <roidelapluie AT gmail.com>
## # Stefan Bethge <stefan AT lanpartei.de>
## Copyright (C) 2007 Jean-Marie Traissard <jim AT lapin.org> # Stephan Erb <steve-e AT h3c.de>
## Julien Pivotto <roidelapluie AT gmail.com> # Copyright (C) 2007-2014 Yann Leboulanger <asterix AT lagaule.org>
## Stefan Bethge <stefan AT lanpartei.de> # Copyright (C) 2008 Jonathan Schleifer <js-gajim AT webkeks.org>
## Stephan Erb <steve-e AT h3c.de> #
## Copyright (C) 2007-2014 Yann Leboulanger <asterix AT lagaule.org> # This file is part of Gajim.
## Copyright (C) 2008 Jonathan Schleifer <js-gajim AT webkeks.org> #
## # Gajim is free software; you can redistribute it and/or modify
## This file is part of Gajim. # it under the terms of the GNU General Public License as published
## # by the Free Software Foundation; version 3 only.
## Gajim is free software; you can redistribute it and/or modify #
## it under the terms of the GNU General Public License as published # Gajim is distributed in the hope that it will be useful,
## by the Free Software Foundation; version 3 only. # but WITHOUT ANY WARRANTY; without even the implied warranty of
## # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## Gajim is distributed in the hope that it will be useful, # GNU General Public License for more details.
## but WITHOUT ANY WARRANTY; without even the implied warranty of #
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # You should have received a copy of the GNU General Public License
## GNU General Public License for more details. # along with Gajim. If not, see <http://www.gnu.org/licenses/>.
##
## You should have received a copy of the GNU General Public License
## along with Gajim. If not, see <http://www.gnu.org/licenses/>.
##
import os import os
import gi import gi
from gi.repository import Gtk, Gdk from gi.repository import Gtk, Gdk
from gajim import gtkgui_helpers
from gajim.common import app from gajim.common import app
from gajim.common.i18n import Q_ 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): def __init__(self):
self.xml = gtkgui_helpers.get_gtk_builder('features_window.ui') flags = Gtk.DialogFlags.DESTROY_WITH_PARENT
self.window = self.xml.get_object('features_window') super().__init__(_('Features'), None, flags)
self.window.set_transient_for(app.interface.roster.window)
treeview = self.xml.get_object('features_treeview') self.connect('key-press-event', self.on_key_press_event)
self.desc_label = self.xml.get_object('feature_desc_label') 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)} # {name: (available_function, unix_text, windows_text)}
self.features = { self.features = {
_('Bonjour / Zeroconf'): (self.zeroconf_available, _('Bonjour / Zeroconf'): (
self.zeroconf_available,
_('Serverless chatting with autodetected clients in a local network.'), _('Serverless chatting with autodetected clients in a local network.'),
_('Requires python-dbus.'), _('Requires python-dbus.'),
_('Requires pybonjour and bonjour SDK running (%(url)s)') % {'url': 'https://developer.apple.com/opensource/).'}), _('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.'), _('A script to control Gajim via commandline.'),
_('Requires python-dbus.'), _('Requires python-dbus.'),
_('Feature not available under Windows.')), _('Feature not available under Windows.')),
_('OpenPGP message encryption'): (self.gpg_available, _('OpenPGP message encryption'): (
self.gpg_available,
_('Ability to encrypting chat messages with OpenPGP.'), _('Ability to encrypting chat messages with OpenPGP.'),
_('Requires gpg and python-gnupg (%(url)s).') % {'url': 'https://bitbucket.org/vinay.sajip/python-gnupg'}, _('Requires gpg and python-gnupg (%(url)s).') % {'url': 'https://bitbucket.org/vinay.sajip/python-gnupg'},
_('Requires gpg.exe in PATH.')), _('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.'), _('Passwords can be stored securely and not just in plaintext.'),
_('Requires libsecret and a provider (such as GNOME Keyring and KSecretService).'), _('Requires libsecret and a provider (such as GNOME Keyring and KSecretService).'),
_('On Windows the Windows Credential Vault is used.')), _('On Windows the Windows Credential Vault is used.')),
_('Spell Checker'): (self.speller_available, _('Spell Checker'): (
self.speller_available,
_('Spellchecking of composed messages.'), _('Spellchecking of composed messages.'),
_('Requires Gspell'), _('Requires Gspell'),
_('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.'), _('Ability to measure idle time, in order to set auto status.'),
_('Requires libxss library.'), _('Requires libxss library.'),
_('Requires python2.5.')), _('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).'), _('Generate XHTML output from RST code (see http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html).'),
_('Requires python-docutils.'), _('Requires python-docutils.'),
_('Requires python-docutils.')), _('Requires python-docutils.')),
_('Audio / Video'): (self.farstream_available, _('Audio / Video'): (
self.farstream_available,
_('Ability to start audio and video chat.'), _('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.'), _('Requires gir1.2-farstream-0.2, gir1.2-gstreamer-1.0, gstreamer1.0-libav and gstreamer1.0-plugins-ugly.'),
_('Feature not available under Windows.')), _('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.'), _('Ability to request your router to forward port for file transfer.'),
_('Requires gir1.2-gupnpigd-1.0.'), _('Requires gir1.2-gupnpigd-1.0.'),
_('Feature not available under Windows.')), _('Feature not available under Windows.')),
@ -108,16 +118,15 @@ class FeaturesWindow:
self.model.set_sort_column_id(0, Gtk.SortType.ASCENDING) self.model.set_sort_column_id(0, Gtk.SortType.ASCENDING)
self.xml.connect_signals(self) self.builder.connect_signals(self)
self.window.show_all() self.show_all()
self.xml.get_object('close_button').grab_focus()
def on_key_press_event(self, widget, event): def on_key_press_event(self, widget, event):
if event.keyval == Gdk.KEY_Escape: if event.keyval == Gdk.KEY_Escape:
self.window.destroy() self.destroy()
def on_close_button_clicked(self, widget): def on_close_button_clicked(self, widget):
self.window.destroy() self.destroy()
def on_features_treeview_cursor_changed(self, widget): def on_features_treeview_cursor_changed(self, widget):
selection = widget.get_selection() selection = widget.get_selection()