better PEP-8 compliance
This commit is contained in:
parent
ee26391a11
commit
1eeddf5900
8 changed files with 16 additions and 14 deletions
|
|
@ -446,15 +446,17 @@ class PrimitivusApp(QuickApp, InputHistory):
|
|||
"""
|
||||
if data is None:
|
||||
data = dict()
|
||||
|
||||
def action_cb(data):
|
||||
if not data:
|
||||
# action was a one shot, nothing to do
|
||||
pass
|
||||
elif "xmlui" in data:
|
||||
ui = XMLUI(self, xml_data = data['xmlui'])
|
||||
ui = XMLUI(self, xml_data=data['xmlui'])
|
||||
ui.show()
|
||||
else:
|
||||
self.showPopUp(sat_widgets.Alert(_("Error"), _(u"Unmanaged action result"), ok_cb=self.removePopUp))
|
||||
|
||||
def action_eb(failure):
|
||||
self.showPopUp(sat_widgets.Alert(_("Error"), unicode(failure), ok_cb=self.removePopUp))
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
from sat.core.i18n import _
|
||||
import urwid
|
||||
from urwid_satext.sat_widgets import AdvancedEdit,Password,List,InputDialog,ConfirmDialog,Alert
|
||||
from urwid_satext.sat_widgets import AdvancedEdit, Password, List, InputDialog, ConfirmDialog, Alert
|
||||
from sat.tools.jid import JID
|
||||
|
||||
|
||||
|
|
@ -32,8 +32,8 @@ class ProfileManager(urwid.WidgetWrap):
|
|||
profiles.sort()
|
||||
|
||||
#login & password box must be created before list because of onProfileChange
|
||||
self.login_wid = AdvancedEdit(_('Login:'),align='center')
|
||||
self.pass_wid = Password(_('Password:'),align='center')
|
||||
self.login_wid = AdvancedEdit(_('Login:'), align='center')
|
||||
self.pass_wid = Password(_('Password:'), align='center')
|
||||
|
||||
self.list_profile = List(profiles, style=['single'], align='center', on_change=self.onProfileChange)
|
||||
|
||||
|
|
@ -107,6 +107,7 @@ class ProfileManager(urwid.WidgetWrap):
|
|||
def setJID(jabberID):
|
||||
self.login_wid.set_edit_text(jabberID)
|
||||
self.host.redraw()
|
||||
|
||||
def setPassword(password):
|
||||
self.pass_wid.set_edit_text(password)
|
||||
self.host.redraw()
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ from sat.core.exceptions import BridgeExceptionNoService, BridgeInitError
|
|||
from sat_frontends.quick_frontend.quick_utils import escapePrivate, unescapePrivate
|
||||
from optparse import OptionParser
|
||||
|
||||
from sat_frontends.quick_frontend.constants import Const
|
||||
from sat_frontends.quick_frontend.constants import Const as C
|
||||
|
||||
|
||||
class QuickApp(object):
|
||||
|
|
@ -281,7 +281,7 @@ class QuickApp(object):
|
|||
self.chat_wins[win.bare].printMessage(from_jid, msg, profile, float(timestamp) if timestamp else '')
|
||||
|
||||
def sendMessage(self, to_jid, message, subject='', mess_type="auto", extra={}, callback=None, errback=None, profile_key="@NONE@"):
|
||||
if to_jid.startswith(Const.PRIVATE_PREFIX):
|
||||
if to_jid.startswith(C.PRIVATE_PREFIX):
|
||||
to_jid = unescapePrivate(to_jid)
|
||||
mess_type = "chat"
|
||||
if callback is None:
|
||||
|
|
@ -527,7 +527,7 @@ class QuickApp(object):
|
|||
|
||||
if from_jid_s == '@ALL@':
|
||||
target = '@ALL@'
|
||||
nick = Const.ALL_OCCUPANTS
|
||||
nick = C.ALL_OCCUPANTS
|
||||
else:
|
||||
from_jid = JID(from_jid_s)
|
||||
target = from_jid.bare
|
||||
|
|
|
|||
|
|
@ -218,7 +218,6 @@ errback is called with error constant as parameter:
|
|||
- ProfileUnknownError: the profile name is unknown
|
||||
- ConnectedProfileError: a connected profile would not be deleted
|
||||
|
||||
|
||||
[registerNewAccount]
|
||||
deprecated=
|
||||
type=method
|
||||
|
|
|
|||
|
|
@ -85,5 +85,6 @@ class BridgeInitError(Exception):
|
|||
class BridgeExceptionNoService(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class DatabaseError(Exception):
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -205,7 +205,7 @@ class SAT(service.Service):
|
|||
"""
|
||||
profile = self.memory.getProfileName(profile_key)
|
||||
if not profile:
|
||||
log.error(_('Trying to connect a non-exsitant profile'))
|
||||
log.error(_('Trying to connect a non-existant profile'))
|
||||
raise exceptions.ProfileUnknownError(profile_key)
|
||||
|
||||
if self.isConnected(profile):
|
||||
|
|
@ -219,6 +219,7 @@ class SAT(service.Service):
|
|||
except ValueError:
|
||||
log.error(_("Can't parse port value, using default value"))
|
||||
port = 5222
|
||||
|
||||
current = self.profiles[profile] = xmpp.SatXMPPClient(
|
||||
self, profile,
|
||||
jid.JID(self.memory.getParamA("JabberID", "Connection", profile_key=profile), profile),
|
||||
|
|
@ -279,7 +280,6 @@ class SAT(service.Service):
|
|||
list_d.addCallback(logPluginResults)
|
||||
return list_d
|
||||
|
||||
|
||||
d.addCallback(pluginsConnection)
|
||||
return d
|
||||
|
||||
|
|
|
|||
|
|
@ -598,11 +598,11 @@ class Params(object):
|
|||
"""Return a node from the param_xml
|
||||
@param name: name of the node
|
||||
@param category: category of the node
|
||||
@type_: keyword for search:
|
||||
@param type_: keyword for search:
|
||||
@ALL@ search everywhere
|
||||
@GENERAL@ only search in general type
|
||||
@INDIVIDUAL@ only search in individual type
|
||||
@return: a tuple with the node type and the the node, or None if not found"""
|
||||
@return: a tuple (node type, node) or None if not found"""
|
||||
|
||||
for type_node in self.dom.documentElement.childNodes:
|
||||
if (((type_ == "@ALL@" or type_ == "@GENERAL@") and type_node.nodeName == C.GENERAL)
|
||||
|
|
|
|||
|
|
@ -127,7 +127,6 @@ class SqliteStorage(object):
|
|||
for statement in statements:
|
||||
interaction.execute(statement)
|
||||
|
||||
|
||||
#Profiles
|
||||
def _profilesCache(self, profiles_result):
|
||||
"""Fill the profiles cache
|
||||
|
|
@ -544,7 +543,7 @@ class Updater(object):
|
|||
# Database is not up-to-date, we'll do the update
|
||||
log.info(_("Database schema has changed, local database will be updated"))
|
||||
update_raw = []
|
||||
for version in xrange(local_version+1, CURRENT_DB_VERSION+1):
|
||||
for version in xrange(local_version + 1, CURRENT_DB_VERSION + 1):
|
||||
try:
|
||||
update_data = DATABASE_SCHEMAS[version]
|
||||
except KeyError:
|
||||
|
|
|
|||
Loading…
Reference in a new issue