2008-08-15 19:31:51 +02:00
|
|
|
# -*- coding:utf-8 -*-
|
2008-08-15 05:20:23 +02:00
|
|
|
## src/features_window.py
|
2007-06-27 11:37:31 +02:00
|
|
|
##
|
2008-08-15 05:20:23 +02:00
|
|
|
## Copyright (C) 2007 Jean-Marie Traissard <jim AT lapin.org>
|
|
|
|
## Julien Pivotto <roidelapluie AT gmail.com>
|
|
|
|
## Stefan Bethge <stefan AT lanpartei.de>
|
|
|
|
## Stephan Erb <steve-e AT h3c.de>
|
2012-01-11 22:20:34 +01:00
|
|
|
## Copyright (C) 2007-2012 Yann Leboulanger <asterix AT lagaule.org>
|
2008-08-15 05:20:23 +02:00
|
|
|
## Copyright (C) 2008 Jonathan Schleifer <js-gajim AT webkeks.org>
|
2007-06-27 11:37:31 +02:00
|
|
|
##
|
2007-10-22 13:13:13 +02:00
|
|
|
## This file is part of Gajim.
|
|
|
|
##
|
|
|
|
## Gajim is free software; you can redistribute it and/or modify
|
2007-06-27 11:37:31 +02:00
|
|
|
## it under the terms of the GNU General Public License as published
|
2007-10-22 13:13:13 +02:00
|
|
|
## by the Free Software Foundation; version 3 only.
|
2007-06-27 11:37:31 +02:00
|
|
|
##
|
2007-10-22 13:13:13 +02:00
|
|
|
## Gajim is distributed in the hope that it will be useful,
|
2007-06-27 11:37:31 +02:00
|
|
|
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2008-08-15 05:20:23 +02:00
|
|
|
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2007-06-27 11:37:31 +02:00
|
|
|
## GNU General Public License for more details.
|
|
|
|
##
|
2007-10-22 13:13:13 +02:00
|
|
|
## You should have received a copy of the GNU General Public License
|
2008-08-15 05:20:23 +02:00
|
|
|
## along with Gajim. If not, see <http://www.gnu.org/licenses/>.
|
2007-10-22 13:13:13 +02:00
|
|
|
##
|
2007-06-27 11:37:31 +02:00
|
|
|
|
|
|
|
import os
|
2007-11-14 20:47:52 +01:00
|
|
|
import sys
|
2012-12-23 16:23:43 +01:00
|
|
|
from gi.repository import Gtk
|
2007-06-27 11:37:31 +02:00
|
|
|
import gtkgui_helpers
|
|
|
|
|
|
|
|
from common import gajim
|
|
|
|
from common import helpers
|
2009-07-15 21:02:47 +02:00
|
|
|
from common import kwalletbinding
|
2010-04-03 13:38:12 +02:00
|
|
|
from common.i18n import Q_
|
2007-06-27 11:37:31 +02:00
|
|
|
|
|
|
|
class FeaturesWindow:
|
2010-02-08 15:08:40 +01:00
|
|
|
"""
|
|
|
|
Class for features window
|
|
|
|
"""
|
2007-06-27 11:37:31 +02:00
|
|
|
|
2010-02-08 15:08:40 +01:00
|
|
|
def __init__(self):
|
|
|
|
self.xml = gtkgui_helpers.get_gtk_builder('features_window.ui')
|
|
|
|
self.window = self.xml.get_object('features_window')
|
2012-12-28 21:59:53 +01:00
|
|
|
self.window.set_transient_for(gajim.interface.roster.window)
|
2010-02-08 15:08:40 +01:00
|
|
|
treeview = self.xml.get_object('features_treeview')
|
|
|
|
self.desc_label = self.xml.get_object('feature_desc_label')
|
2007-06-27 11:37:31 +02:00
|
|
|
|
2010-02-08 15:08:40 +01:00
|
|
|
# {name: (available_function, unix_text, windows_text)}
|
|
|
|
self.features = {
|
2011-06-22 20:29:15 +02:00
|
|
|
_('SSL certificate validation'): (self.pyopenssl_available,
|
|
|
|
_('A library used to validate server certificates to ensure a secure connection.'),
|
2012-01-04 11:38:09 +01:00
|
|
|
_('Requires python-pyopenssl > 0.12 and pyasn1.'),
|
|
|
|
_('Requires python-pyopenssl > 0.12 and pyasn1.')),
|
2011-06-22 20:29:15 +02:00
|
|
|
_('Bonjour / Zeroconf'): (self.zeroconf_available,
|
|
|
|
_('Serverless chatting with autodetected clients in a local network.'),
|
|
|
|
_('Requires python-avahi.'),
|
2012-01-12 21:44:53 +01:00
|
|
|
_('Requires pybonjour and bonjour SDK running (http://developer.apple.com/opensource/).')),
|
2011-06-22 20:29:15 +02:00
|
|
|
_('Command line'): (self.dbus_available,
|
|
|
|
_('A script to control Gajim via commandline.'),
|
|
|
|
_('Requires python-dbus.'),
|
|
|
|
_('Feature not available under Windows.')),
|
|
|
|
_('OpenGPG message encryption'): (self.gpg_available,
|
|
|
|
_('Encrypting chat messages with gpg keys.'),
|
|
|
|
_('Requires gpg and python-gnupg (http://code.google.com/p/python-gnupg/).'),
|
|
|
|
_('Requires gpg.exe in PATH.')),
|
|
|
|
_('Network-manager'): (self.network_manager_available,
|
|
|
|
_('Autodetection of network status.'),
|
|
|
|
_('Requires gnome-network-manager and python-dbus.'),
|
|
|
|
_('Feature not available under Windows.')),
|
|
|
|
_('Password encryption'): (self.some_keyring_available,
|
|
|
|
_('Passwords can be stored securely and not just in plaintext.'),
|
|
|
|
_('Requires gnome-keyring and python-gnome2-desktop, or kwalletcli.'),
|
|
|
|
_('Feature not available under Windows.')),
|
|
|
|
_('SRV'): (self.srv_available,
|
|
|
|
_('Ability to connect to servers which are using SRV records.'),
|
|
|
|
_('Requires dnsutils.'),
|
|
|
|
_('Requires nslookup to use SRV records.')),
|
|
|
|
_('Spell Checker'): (self.speller_available,
|
|
|
|
_('Spellchecking of composed messages.'),
|
|
|
|
_('Requires libgtkspell.'),
|
2011-12-19 10:05:34 +01:00
|
|
|
_('Requires libgtkspell and libenchant.')),
|
2011-06-22 20:29:15 +02:00
|
|
|
_('Notification'): (self.notification_available,
|
|
|
|
_('Passive popups notifying for new events.'),
|
|
|
|
_('Requires python-notify or instead python-dbus in conjunction with notification-daemon.'),
|
|
|
|
_('Feature not available under Windows.')),
|
|
|
|
_('Automatic status'): (self.idle_available,
|
|
|
|
_('Ability to measure idle time, in order to set auto status.'),
|
|
|
|
_('Requires libxss library.'),
|
|
|
|
_('Requires python2.5.')),
|
|
|
|
_('End to End message encryption'): (self.pycrypto_available,
|
|
|
|
_('Encrypting chat messages.'),
|
|
|
|
_('Requires python-crypto.'),
|
|
|
|
_('Requires python-crypto.')),
|
|
|
|
_('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.')),
|
2012-04-01 19:49:52 +02:00
|
|
|
_('Audio / Video'): (self.farstream_available,
|
2011-06-22 20:29:15 +02:00
|
|
|
_('Ability to start audio and video chat.'),
|
2012-04-01 19:49:52 +02:00
|
|
|
_('Requires python-farstream and gstreamer-plugins-bad.'),
|
2011-06-22 20:29:15 +02:00
|
|
|
_('Feature not available under Windows.')),
|
2011-08-24 11:04:31 +02:00
|
|
|
_('UPnP-IGD'): (self.gupnp_igd_available,
|
|
|
|
_('Ability to request your router to forward port for file transfer.'),
|
|
|
|
_('Requires python-gupnp-igd.'),
|
|
|
|
_('Feature not available under Windows.')),
|
2011-11-14 06:13:36 +01:00
|
|
|
_('UPower'): (self.upower_available,
|
2011-09-05 22:00:23 +02:00
|
|
|
_('Ability to disconnect properly just before suspending the machine.'),
|
|
|
|
_('Requires upower and python-dbus.'),
|
|
|
|
_('Feature not available under Windows.')),
|
2010-02-08 15:08:40 +01:00
|
|
|
}
|
2007-06-27 11:37:31 +02:00
|
|
|
|
2010-02-08 15:08:40 +01:00
|
|
|
# name, supported
|
2012-12-23 16:23:43 +01:00
|
|
|
self.model = Gtk.ListStore(str, bool)
|
2010-02-08 15:08:40 +01:00
|
|
|
treeview.set_model(self.model)
|
2007-06-27 11:37:31 +02:00
|
|
|
|
2012-12-23 16:23:43 +01:00
|
|
|
col = Gtk.TreeViewColumn(Q_('?features:Available'))
|
2010-02-08 15:08:40 +01:00
|
|
|
treeview.append_column(col)
|
2012-12-23 16:23:43 +01:00
|
|
|
cell = Gtk.CellRendererToggle()
|
2010-02-08 15:08:40 +01:00
|
|
|
cell.set_property('radio', True)
|
2012-12-28 21:59:53 +01:00
|
|
|
col.pack_start(cell, True)
|
|
|
|
col.add_attribute(cell, 'active', 1)
|
2007-06-27 11:37:31 +02:00
|
|
|
|
2012-12-23 16:23:43 +01:00
|
|
|
col = Gtk.TreeViewColumn(_('Feature'))
|
2010-02-08 15:08:40 +01:00
|
|
|
treeview.append_column(col)
|
2012-12-23 16:23:43 +01:00
|
|
|
cell = Gtk.CellRendererText()
|
2012-12-28 21:59:53 +01:00
|
|
|
col.pack_start(cell, True)
|
2010-02-08 15:08:40 +01:00
|
|
|
col.add_attribute(cell, 'text', 0)
|
2007-07-07 01:51:41 +02:00
|
|
|
|
2010-02-08 15:08:40 +01:00
|
|
|
# Fill model
|
|
|
|
for feature in self.features:
|
|
|
|
func = self.features[feature][0]
|
|
|
|
rep = func()
|
|
|
|
self.model.append([feature, rep])
|
2009-01-11 10:55:39 +01:00
|
|
|
|
2012-12-23 16:23:43 +01:00
|
|
|
self.model.set_sort_column_id(0, Gtk.SortType.ASCENDING)
|
2009-01-11 10:55:39 +01:00
|
|
|
|
2010-02-08 15:08:40 +01:00
|
|
|
self.xml.connect_signals(self)
|
|
|
|
self.window.show_all()
|
|
|
|
self.xml.get_object('close_button').grab_focus()
|
2007-06-27 11:37:31 +02:00
|
|
|
|
2010-02-08 15:08:40 +01:00
|
|
|
def on_close_button_clicked(self, widget):
|
|
|
|
self.window.destroy()
|
2007-06-27 11:37:31 +02:00
|
|
|
|
2010-02-08 15:08:40 +01:00
|
|
|
def on_features_treeview_cursor_changed(self, widget):
|
|
|
|
selection = widget.get_selection()
|
|
|
|
if not selection:
|
|
|
|
return
|
|
|
|
rows = selection.get_selected_rows()[1]
|
|
|
|
if not rows:
|
|
|
|
return
|
|
|
|
path = rows[0]
|
|
|
|
feature = self.model[path][0].decode('utf-8')
|
|
|
|
text = self.features[feature][1] + '\n'
|
|
|
|
if os.name == 'nt':
|
|
|
|
text = text + self.features[feature][3]
|
|
|
|
else:
|
|
|
|
text = text + self.features[feature][2]
|
|
|
|
self.desc_label.set_text(text)
|
2007-06-27 11:37:31 +02:00
|
|
|
|
2010-02-08 15:08:40 +01:00
|
|
|
def pyopenssl_available(self):
|
|
|
|
try:
|
|
|
|
import OpenSSL.SSL
|
|
|
|
import OpenSSL.crypto
|
2012-01-05 13:50:15 +01:00
|
|
|
ver = OpenSSL.__version__
|
|
|
|
ver_l = [int(i) for i in ver.split('.')]
|
|
|
|
if ver_l < [0, 12]:
|
|
|
|
raise ImportError
|
|
|
|
import pyasn1
|
2010-02-08 15:08:40 +01:00
|
|
|
except Exception:
|
|
|
|
return False
|
|
|
|
return True
|
2007-06-27 11:37:31 +02:00
|
|
|
|
2010-02-08 15:08:40 +01:00
|
|
|
def zeroconf_available(self):
|
2010-12-18 09:11:58 +01:00
|
|
|
return gajim.HAVE_ZEROCONF
|
2007-06-27 11:37:31 +02:00
|
|
|
|
2010-02-08 15:08:40 +01:00
|
|
|
def dbus_available(self):
|
|
|
|
if os.name == 'nt':
|
|
|
|
return False
|
|
|
|
from common import dbus_support
|
|
|
|
return dbus_support.supported
|
2007-06-27 11:37:31 +02:00
|
|
|
|
2010-02-08 15:08:40 +01:00
|
|
|
def gpg_available(self):
|
|
|
|
return gajim.HAVE_GPG
|
2007-06-27 11:37:31 +02:00
|
|
|
|
2010-02-08 15:08:40 +01:00
|
|
|
def network_manager_available(self):
|
|
|
|
if os.name == 'nt':
|
|
|
|
return False
|
|
|
|
import network_manager_listener
|
|
|
|
return network_manager_listener.supported
|
2007-06-27 11:37:31 +02:00
|
|
|
|
2010-02-08 15:08:40 +01:00
|
|
|
def some_keyring_available(self):
|
|
|
|
if os.name == 'nt':
|
|
|
|
return False
|
|
|
|
if kwalletbinding.kwallet_available():
|
|
|
|
return True
|
|
|
|
try:
|
2012-12-26 23:55:53 +01:00
|
|
|
from gi.repository import GnomeKeyring
|
2010-02-08 15:08:40 +01:00
|
|
|
except Exception:
|
|
|
|
return False
|
|
|
|
return True
|
2007-06-27 11:37:31 +02:00
|
|
|
|
2010-02-08 15:08:40 +01:00
|
|
|
def srv_available(self):
|
2010-10-26 17:28:08 +02:00
|
|
|
if os.name == 'nt':
|
|
|
|
return True
|
2010-02-08 15:08:40 +01:00
|
|
|
return helpers.is_in_path('nslookup')
|
2007-06-27 11:37:31 +02:00
|
|
|
|
2010-02-08 15:08:40 +01:00
|
|
|
def speller_available(self):
|
|
|
|
try:
|
2010-12-18 09:11:58 +01:00
|
|
|
__import__('gtkspell')
|
2010-02-08 15:08:40 +01:00
|
|
|
except ImportError:
|
|
|
|
return False
|
|
|
|
return True
|
2007-06-27 11:37:31 +02:00
|
|
|
|
2010-02-08 15:08:40 +01:00
|
|
|
def notification_available(self):
|
|
|
|
if os.name == 'nt':
|
|
|
|
return False
|
|
|
|
from common import dbus_support
|
|
|
|
if self.dbus_available() and dbus_support.get_notifications_interface():
|
|
|
|
return True
|
|
|
|
try:
|
2010-12-18 09:11:58 +01:00
|
|
|
__import__('pynotify')
|
2010-02-08 15:08:40 +01:00
|
|
|
except Exception:
|
|
|
|
return False
|
|
|
|
return True
|
2007-06-27 11:37:31 +02:00
|
|
|
|
2010-02-08 15:08:40 +01:00
|
|
|
def idle_available(self):
|
|
|
|
from common import sleepy
|
|
|
|
return sleepy.SUPPORTED
|
2007-07-20 01:36:25 +02:00
|
|
|
|
2010-02-08 15:08:40 +01:00
|
|
|
def pycrypto_available(self):
|
|
|
|
return gajim.HAVE_PYCRYPTO
|
2007-09-02 11:34:21 +02:00
|
|
|
|
2010-02-08 15:08:40 +01:00
|
|
|
def docutils_available(self):
|
|
|
|
try:
|
2010-12-18 09:11:58 +01:00
|
|
|
__import__('docutils')
|
2010-02-08 15:08:40 +01:00
|
|
|
except Exception:
|
|
|
|
return False
|
|
|
|
return True
|
2007-10-09 19:48:22 +02:00
|
|
|
|
2012-04-01 19:49:52 +02:00
|
|
|
def farstream_available(self):
|
|
|
|
return gajim.HAVE_FARSTREAM
|
2011-08-24 11:04:31 +02:00
|
|
|
|
|
|
|
def gupnp_igd_available(self):
|
|
|
|
return gajim.HAVE_UPNP_IGD
|
2011-11-14 06:13:36 +01:00
|
|
|
|
|
|
|
def upower_available(self):
|
|
|
|
if os.name == 'nt':
|
|
|
|
return False
|
|
|
|
import upower_listener
|
|
|
|
return upower_listener.supported
|