annotate frontends/src/quick_frontend/quick_gateways.py @ 802:9007bb133009

core, frontends: XMLUI refactoring: - XMLUI now use objects with 2 main classes: widgets (button, label, etc), and container which contain widgets according to a layout - widgets and containers classes are found through introspection, thereby it's really easy to add a new one - there is still the AddWidgetName helper, for example AddText('jid', 'test@example.net') will add a StringWidget with name "jid" and default value "test@example.net" - container can be inside other containers. changeContainer change the first parent container
author Goffi <goffi@goffi.org>
date Tue, 04 Feb 2014 18:19:00 +0100
parents bfabeedbf32e
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
173
ec6611445a5b Primitivus: added Gateways support
Goffi <goffi@goffi.org>
parents:
diff changeset
1 #!/usr/bin/python
ec6611445a5b Primitivus: added Gateways support
Goffi <goffi@goffi.org>
parents:
diff changeset
2 # -*- coding: utf-8 -*-
ec6611445a5b Primitivus: added Gateways support
Goffi <goffi@goffi.org>
parents:
diff changeset
3
609
84a6e83157c2 fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents: 588
diff changeset
4 # helper class for making a SAT frontend
84a6e83157c2 fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents: 588
diff changeset
5 # Copyright (C) 2009, 2010, 2011, 2012, 2013 Jérôme Poisson (goffi@goffi.org)
173
ec6611445a5b Primitivus: added Gateways support
Goffi <goffi@goffi.org>
parents:
diff changeset
6
609
84a6e83157c2 fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents: 588
diff changeset
7 # This program is free software: you can redistribute it and/or modify
84a6e83157c2 fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents: 588
diff changeset
8 # it under the terms of the GNU Affero General Public License as published by
84a6e83157c2 fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents: 588
diff changeset
9 # the Free Software Foundation, either version 3 of the License, or
84a6e83157c2 fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents: 588
diff changeset
10 # (at your option) any later version.
173
ec6611445a5b Primitivus: added Gateways support
Goffi <goffi@goffi.org>
parents:
diff changeset
11
609
84a6e83157c2 fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents: 588
diff changeset
12 # This program is distributed in the hope that it will be useful,
84a6e83157c2 fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents: 588
diff changeset
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
84a6e83157c2 fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents: 588
diff changeset
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
84a6e83157c2 fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents: 588
diff changeset
15 # GNU Affero General Public License for more details.
173
ec6611445a5b Primitivus: added Gateways support
Goffi <goffi@goffi.org>
parents:
diff changeset
16
609
84a6e83157c2 fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents: 588
diff changeset
17 # You should have received a copy of the GNU Affero General Public License
84a6e83157c2 fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents: 588
diff changeset
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
173
ec6611445a5b Primitivus: added Gateways support
Goffi <goffi@goffi.org>
parents:
diff changeset
19
ec6611445a5b Primitivus: added Gateways support
Goffi <goffi@goffi.org>
parents:
diff changeset
20
ec6611445a5b Primitivus: added Gateways support
Goffi <goffi@goffi.org>
parents:
diff changeset
21
ec6611445a5b Primitivus: added Gateways support
Goffi <goffi@goffi.org>
parents:
diff changeset
22
771
bfabeedbf32e core: i18n refactoring:
Goffi <goffi@goffi.org>
parents: 609
diff changeset
23 from sat.core.i18n import _
588
beaf6bec2fcd Remove every old-style class.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 587
diff changeset
24 class QuickGatewaysManager(object):
173
ec6611445a5b Primitivus: added Gateways support
Goffi <goffi@goffi.org>
parents:
diff changeset
25
587
952322b1d490 Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 572
diff changeset
26
173
ec6611445a5b Primitivus: added Gateways support
Goffi <goffi@goffi.org>
parents:
diff changeset
27 def __init__(self, host, gateways, title=_("Gateways manager"), server=None):
ec6611445a5b Primitivus: added Gateways support
Goffi <goffi@goffi.org>
parents:
diff changeset
28 self.WARNING_MSG = _(u"""Be careful ! Gateways allow you to use an external IM (legacy IM), so you can see your contact as jabber contacts.
ec6611445a5b Primitivus: added Gateways support
Goffi <goffi@goffi.org>
parents:
diff changeset
29 But when you do this, all your messages go throught the external legacy IM server, it is a huge privacy issue (i.e.: all your messages throught the gateway can be monitored, recorded, analyzed by the external server, most of time a private company).""")
ec6611445a5b Primitivus: added Gateways support
Goffi <goffi@goffi.org>
parents:
diff changeset
30 self.host = host
ec6611445a5b Primitivus: added Gateways support
Goffi <goffi@goffi.org>
parents:
diff changeset
31
ec6611445a5b Primitivus: added Gateways support
Goffi <goffi@goffi.org>
parents:
diff changeset
32 def getGatewayDesc(self, gat_type):
ec6611445a5b Primitivus: added Gateways support
Goffi <goffi@goffi.org>
parents:
diff changeset
33 """Return a human readable description of gateway type
ec6611445a5b Primitivus: added Gateways support
Goffi <goffi@goffi.org>
parents:
diff changeset
34 @param gat_type: type of gateway, as given by SàT"""
ec6611445a5b Primitivus: added Gateways support
Goffi <goffi@goffi.org>
parents:
diff changeset
35 desc = _('Unknown IM')
ec6611445a5b Primitivus: added Gateways support
Goffi <goffi@goffi.org>
parents:
diff changeset
36
ec6611445a5b Primitivus: added Gateways support
Goffi <goffi@goffi.org>
parents:
diff changeset
37 if gat_type == 'irc':
ec6611445a5b Primitivus: added Gateways support
Goffi <goffi@goffi.org>
parents:
diff changeset
38 desc = "Internet Relay Chat"
ec6611445a5b Primitivus: added Gateways support
Goffi <goffi@goffi.org>
parents:
diff changeset
39 elif gat_type == 'xmpp':
ec6611445a5b Primitivus: added Gateways support
Goffi <goffi@goffi.org>
parents:
diff changeset
40 desc = "XMPP"
ec6611445a5b Primitivus: added Gateways support
Goffi <goffi@goffi.org>
parents:
diff changeset
41 elif gat_type == 'qq':
ec6611445a5b Primitivus: added Gateways support
Goffi <goffi@goffi.org>
parents:
diff changeset
42 desc = "Tencent QQ"
ec6611445a5b Primitivus: added Gateways support
Goffi <goffi@goffi.org>
parents:
diff changeset
43 elif gat_type == 'simple':
ec6611445a5b Primitivus: added Gateways support
Goffi <goffi@goffi.org>
parents:
diff changeset
44 desc = "SIP/SIMPLE"
ec6611445a5b Primitivus: added Gateways support
Goffi <goffi@goffi.org>
parents:
diff changeset
45 elif gat_type == 'icq':
ec6611445a5b Primitivus: added Gateways support
Goffi <goffi@goffi.org>
parents:
diff changeset
46 desc = "ICQ"
ec6611445a5b Primitivus: added Gateways support
Goffi <goffi@goffi.org>
parents:
diff changeset
47 elif gat_type == 'yahoo':
ec6611445a5b Primitivus: added Gateways support
Goffi <goffi@goffi.org>
parents:
diff changeset
48 desc = "Yahoo! Messenger"
ec6611445a5b Primitivus: added Gateways support
Goffi <goffi@goffi.org>
parents:
diff changeset
49 elif gat_type == 'gadu-gadu':
ec6611445a5b Primitivus: added Gateways support
Goffi <goffi@goffi.org>
parents:
diff changeset
50 desc = "Gadu-Gadu"
ec6611445a5b Primitivus: added Gateways support
Goffi <goffi@goffi.org>
parents:
diff changeset
51 elif gat_type == 'aim':
ec6611445a5b Primitivus: added Gateways support
Goffi <goffi@goffi.org>
parents:
diff changeset
52 desc = "AOL Instant Messenger"
ec6611445a5b Primitivus: added Gateways support
Goffi <goffi@goffi.org>
parents:
diff changeset
53 elif gat_type == 'msn':
ec6611445a5b Primitivus: added Gateways support
Goffi <goffi@goffi.org>
parents:
diff changeset
54 desc = 'Windows Live Messenger'
ec6611445a5b Primitivus: added Gateways support
Goffi <goffi@goffi.org>
parents:
diff changeset
55
ec6611445a5b Primitivus: added Gateways support
Goffi <goffi@goffi.org>
parents:
diff changeset
56 return desc