From 9dc8404158cc3250eb1262369e325d1eb0ee4c1b Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Wed, 27 Jun 2007 09:37:31 +0000 Subject: [PATCH] add features window in help menu. fixes #2783 --- data/glade/features_window.glade | 72 +++ data/glade/roster_window.glade | 784 ++++++++++++++----------------- src/features_window.py | 200 ++++++++ src/roster_window.py | 4 + 4 files changed, 618 insertions(+), 442 deletions(-) create mode 100644 data/glade/features_window.glade create mode 100644 src/features_window.py diff --git a/data/glade/features_window.glade b/data/glade/features_window.glade new file mode 100644 index 000000000..0e06e2717 --- /dev/null +++ b/data/glade/features_window.glade @@ -0,0 +1,72 @@ + + + + + + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 12 + Features + 200 + 350 + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 6 + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + List of possible features in Gajim: + + + False + + + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + True + + + + + + 1 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + GTK_BUTTONBOX_END + + + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + gtk-close + True + + + + + + False + 2 + + + + + + diff --git a/data/glade/roster_window.glade b/data/glade/roster_window.glade index 5e393ae45..21265b3d6 100644 --- a/data/glade/roster_window.glade +++ b/data/glade/roster_window.glade @@ -1,444 +1,344 @@ - - - + + + - - - 85 - 200 - Gajim - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - 200 - 400 - True - False - roster - True - False - False - GDK_WINDOW_TYPE_HINT_NORMAL - GDK_GRAVITY_NORTH_WEST - True - False - - - - - - - - - True - False - 0 - - - - True - GTK_PACK_DIRECTION_LTR - GTK_PACK_DIRECTION_LTR - - - - True - _Actions - True - - - - - - - - True - _Start Chat - True - - - - True - gtk-jump-to - 1 - 0.5 - 0.5 - 0 - 0 - - - - - - - - True - _Group Chat - True - - - - True - gtk-connect - 1 - 0.5 - 0.5 - 0 - 0 - - - - - - - - True - - - - - - True - Add _Contact - True - - - - True - gtk-add - 1 - 0.5 - 0.5 - 0 - 0 - - - - - - - - True - _Discover Services - True - - - - True - gtk-find - 1 - 0.5 - 0.5 - 0 - 0 - - - - - - - - True - _Advanced - True - - - - - - True - - - - - - True - _Quit - True - - - - - - True - gtk-quit - 1 - 0.5 - 0.5 - 0 - 0 - - - - - - - - - - - - True - _Edit - True - - - - - - - - True - A_ccounts - True - - - - - - True - gtk-network - 1 - 0.5 - 0.5 - 0 - 0 - - - - - - - - True - Profile, A_vatar - True - - - - True - gtk-properties - 1 - 0.5 - 0.5 - 0 - 0 - - - - - - - - True - - - - - - True - _Preferences - True - - - - - - True - gtk-preferences - 1 - 0.5 - 0.5 - 0 - 0 - - - - - - - - - - - - True - _View - True - - - - - - - - True - Show _Offline Contacts - True - False - - - - - - - - True - Show Trans_ports - True - False - - - - - - - True - - - - - - True - File _Transfers - True - - - - - - True - gtk-file - 1 - 0.5 - 0.5 - 0 - 0 - - - - - - - - - - - - True - _Help - True - - - - - - - True - Help online - _Contents - True - - - - - True - gtk-help - 1 - 0.5 - 0.5 - 0 - 0 - - - - - - - - True - Frequently Asked Questions (online) - _FAQ - True - - - - - - - True - gtk-about - True - - - - - - - - - - 0 - False - False - - - - - - 2 - True - True - GTK_POLICY_NEVER - GTK_POLICY_AUTOMATIC - GTK_SHADOW_NONE - GTK_CORNER_TOP_LEFT - - - - True - True - False - False - True - True - False - False - False - - - - - - - - - - - - - - 0 - True - True - - - - - - True - False - True - - - - 0 - False - True - - - - - - + + 85 + 200 + Gajim + roster + 200 + 400 + + + + + + + + True + + + True + + + True + _Actions + True + + + + + + True + _Start Chat + True + + + True + gtk-jump-to + 1 + + + + + + + True + _Group Chat + True + + + True + gtk-connect + 1 + + + + + + + True + + + + + True + Add _Contact + True + + + True + gtk-add + 1 + + + + + + + True + _Discover Services + True + + + True + gtk-find + 1 + + + + + + + True + _Advanced + True + + + + + True + + + + + True + _Quit + True + + + + + True + gtk-quit + 1 + + + + + + + + + + + True + _Edit + True + + + + + + True + A_ccounts + True + + + + + True + gtk-network + 1 + + + + + + + True + Profile, A_vatar + True + + + True + gtk-properties + 1 + + + + + + + True + + + + + True + _Preferences + True + + + + + True + gtk-preferences + 1 + + + + + + + + + + + True + _View + True + + + + + + True + Show _Offline Contacts + True + + + + + + + True + Show Trans_ports + True + + + + + + True + + + + + True + File _Transfers + True + + + + + True + gtk-missing-image + 1 + + + + + + + + + + + True + _Help + True + + + + + True + Help online + _Contents + True + + + + True + gtk-help + 1 + + + + + + + True + Frequently Asked Questions (online) + _FAQ + True + + + + + + True + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Fea_tures + True + + + + + + True + gtk-about + True + True + + + + + + + + + + False + False + + + + + True + True + 2 + GTK_POLICY_NEVER + GTK_POLICY_AUTOMATIC + + + True + True + False + True + + + + + + + + + + + + + + 1 + + + + + True + + + + False + 2 + + + + + diff --git a/src/features_window.py b/src/features_window.py new file mode 100644 index 000000000..171043c72 --- /dev/null +++ b/src/features_window.py @@ -0,0 +1,200 @@ +## features_window.py +## +## Copyright (C) 2007 Yann Le Boulanger +## +## This program 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 2 only. +## +## This program 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. +## + +import os +import gtk +import gobject +import gtkgui_helpers + +import dialogs + +from common import gajim +from common import helpers + +class FeaturesWindow: + '''Class for features window''' + + def __init__(self): + self.xml = gtkgui_helpers.get_glade('features_window.glade') + self.window = self.xml.get_widget('features_window') + treeview = self.xml.get_widget('features_treeview') + + # {name: (available_function, unix_text, windows_text)} + self.features = { + _('PyOpenSSL'): (self.pyopenssl_available, + _('You need to install python-pyopenssl to have a more secure connection.'), + _('You need to install python-pyopenssl to have a more secure connection.')), + _('Bonjour / Zeroconf'): (self.zeroconf_available, + _('You need to install python-avahai to use Zeroconf network.'), + _('This feature is not available under Windows.')), + _('Gajim-remote'): (self.dbus_available, + _('You need to install python-dbus to control gajim from a script.'), + _('This feature is not available under Windows.')), + _('OpenGPG'): (self.gpg_available, + _('You need to install gpg and python-GnuPGIntergace to use OpenGPG.'), + _('This feature is not available under Windows.')), + _('Network Manager'): (self.network_manager_available, + _('You need to install network-manager and python-dbus to use Network Manager.'), + _('This feature is not available under Windows.')), + _('Session Management'): (self.session_management_available, + _('You need to install python-gnome2 to use Session Management.'), + _('This feature is not available under Windows.')), + _('Gnome-Keyring'): (self.gnome_keyring_available, + _('You need to install python-gnome2-desktop to use Gnome Keyring.'), + _('This feature is not available under Windows.')), + _('SRV'): (self.srv_available, + _('You need to install dnsutils to have nslookup to use SRV records.'), + _('You need to have nslookup to use SRV records.')), + _('Spell Checker'): (self.speller_available, + _('You need to install python-gnome2-extras or compile gtkspell module from Gajim sources to use spell checker.'), + _('This feature is not available under Windows.')), + _('Notification-daemon'): (self.notification_available, + _('You need to have dbus available and to install notification-daemon. Another solution is to install python-notify.'), + _('This feature is not available under Windows.')), + _('Trayicon'): (self.trayicon_available, + _('You need to install python-gnome2-extras or compile trayicon module from Gajim sources to use the trayicon.'), + _('You need PyGTK > 2.10 to use the trayicon.')), + _('Idle'): (self.idle_available, + _('You need to compile idle module from Gajim sources to use it.'), + _('You need to compile idle module from Gajim sources to use it.')), + } + + # name, supported + self.model = gtk.ListStore(str, bool) + treeview.set_model(self.model) + + col = gtk.TreeViewColumn(_('Feature')) + treeview.append_column(col) + cell = gtk.CellRendererText() + col.pack_start(cell, expand = True) + col.add_attribute(cell, 'text', 0) + + col = gtk.TreeViewColumn(_('Available')) + treeview.append_column(col) + cell = gtk.CellRendererToggle() + col.pack_start(cell) + col.set_attributes(cell, active = 1) + + # Fill model + for feature in self.features: + func = self.features[feature][0] + rep = func() + self.model.append([feature, rep]) + self.xml.signal_autoconnect(self) + self.window.show_all() + self.xml.get_widget('close_button').grab_focus() + + def on_close_button_clicked(self, widget): + self.window.destroy() + + def on_features_treeview_row_activated(self, widget, path, col): + available = self.model[path][1] + if available: + return + feature = self.model[path][0] + if os.name == 'nt': + text = self.features[feature][2] + else: + text = self.features[feature][1] + dialogs.InformationDialog(_('Feature not available'), text) + + def pyopenssl_available(self): + try: + import OpenSSL.SSL + import OpenSSL.crypto + except: + return False + return True + + def zeroconf_available(self): + if os.name == 'nt': + return False + try: + import avahi + except: + return False + return True + + def dbus_available(self): + if os.name == 'nt': + return False + from common import dbus_support + return dbus_support.supported + + def gpg_available(self): + if os.name == 'nt': + return False + from common import GnuPG + return GnuPG.USE_GPG + + def network_manager_available(self): + if os.name == 'nt': + return False + import network_manager_listener + return network_manager_listener.supported + + def session_management_available(self): + if os.name == 'nt': + return False + try: + import gnome.ui + except: + return False + return True + + def gnome_keyring_available(self): + if os.name == 'nt': + return False + try: + import gnomekeyring + except: + return False + return True + + def srv_available(self): + return helpers.is_in_path('nslookup') + + def speller_available(self): + if os.name == 'nt': + return False + try: + import gtkspell + except: + return False + return True + + def notification_available(self): + if os.name == 'nt': + return False + if self.dbus_available() and dbus_support.get_notifications_interface(): + return True + try: + import pynotify + except: + return False + return True + + def trayicon_available(self): + if os.name == 'nt' and gtk.pygtk_version >= (2, 10, 0) and \ + gtk.gtk_version >= (2, 10, 0): + return True + try: + import systray + except: + return False + return True + + def idle_available(self): + from common import sleepy + return sleepy.SUPPORTED diff --git a/src/roster_window.py b/src/roster_window.py index b15dea360..46e6fbe4a 100644 --- a/src/roster_window.py +++ b/src/roster_window.py @@ -34,6 +34,7 @@ import tooltips import message_control import adhoc_commands import notify +import features_window from common import gajim from common import helpers @@ -3832,6 +3833,9 @@ class RosterWindow: helpers.launch_browser_mailer('url', 'http://trac.gajim.org/wiki/GajimFaq') + def on_features_menuitem_activate(self, widget): + features_window.FeaturesWindow() + def on_about_menuitem_activate(self, widget): dialogs.AboutDialog()