Skip to content
Snippets Groups Projects
Commit 22422541 authored by Alexandre Savard's avatar Alexandre Savard
Browse files

Refactoring Python code, PEP8

parent 2d9b8fc7
Branches
Tags
No related merge requests found
......@@ -215,18 +215,18 @@ dbus_connect ()
/* Create a proxy object for the "bus driver" (name "org.freedesktop.DBus") */
/*
instanceProxy = dbus_g_proxy_new_for_name (connection,
"org.sflphone.SFLphone",
"/org/sflphone/SFLphone/Instance",
"org.sflphone.SFLphone.Instance");
/*
*/
instanceProxy = dbus_g_proxy_new_for_name_owner (connection,
"org.sflphone.SFLphone",
"/org/sflphone/SFLphone/Instance",
"org.sflphone.SFLphone.Instance",
&error);
*/
if (instanceProxy==NULL)
{
......@@ -237,18 +237,19 @@ dbus_connect ()
DEBUG ("DBus connected to Instance");
/*
callManagerProxy = dbus_g_proxy_new_for_name (connection,
"org.sflphone.SFLphone",
"/org/sflphone/SFLphone/CallManager",
"org.sflphone.SFLphone.CallManager");
/*
*/
callManagerProxy = dbus_g_proxy_new_for_name_owner (connection,
"org.sflphone.SFLphone",
"/org/sflphone/SFLphone/CallManager",
"org.sflphone.SFLphone.CallManager",
&error);
*/
if (callManagerProxy==NULL)
{
ERROR ("Failed to get proxy to CallManagers");
......@@ -299,20 +300,20 @@ dbus_connect ()
dbus_g_proxy_connect_signal (callManagerProxy,
"volumeChanged", G_CALLBACK(volume_changed_cb), NULL, NULL);
/*
configurationManagerProxy = dbus_g_proxy_new_for_name (connection,
"org.sflphone.SFLphone",
"/org/sflphone/SFLphone/ConfigurationManager",
"org.sflphone.SFLphone.ConfigurationManager");
/*
*/
configurationManagerProxy = dbus_g_proxy_new_for_name_owner (connection,
"org.sflphone.SFLphone",
"/org/sflphone/SFLphone/ConfigurationManager",
"org.sflphone.SFLphone.ConfigurationManager",
&error);
*/
if (!configurationManagerProxy)
{
ERROR ("Failed to get proxy to ConfigurationManager");
......
......@@ -100,9 +100,7 @@ class SflPhoneCtrlSimple(object):
except dbus.DBusException, e:
raise SPdbusError("Unable to bind to sflphoned api,
ask core-dev team to implement getVersion method and
start to pray.")
raise SPdbusError("Unable to bind to sflphoned api, ask core-dev team to implement getVersion method and start to pray.")
try:
self.instance.Register(os.getpid(), self.name)
......@@ -142,7 +140,8 @@ class SflPhoneCtrlSimple(object):
print "Incoming call: " + account + ", " + callid + ", " + to
self.activeCalls[callid] = {'Account': account, 'To': to, 'State': '' }
# On call state changed event, set the values for new calls, or delete the call from the list of active calls
# On call state changed event, set the values for new calls,
# or delete the call from the list of active calls
def onCallStateChanged(self, callid, state):
print "Call state changed: " + callid + ", " + state
if state == "HUNGUP":
......@@ -150,6 +149,7 @@ class SflPhoneCtrlSimple(object):
del self.activeCalls[callid]
except KeyError:
print "Call " + callid + " didn't exist. Cannot delete."
elif state in [ "RINGING", "CURRENT", "INCOMING", "HOLD" ]:
try:
self.activeCalls[callid]['State'] = state
......@@ -195,6 +195,7 @@ class SflPhoneCtrlSimple(object):
return self.configurationmanager.getAccountDetails(self.account)
else:
if self.checkAccountExists(account):
return self.configurationmanager.getAccountDetails(account)
......@@ -203,7 +204,8 @@ class SflPhoneCtrlSimple(object):
for testedaccount in self.getAllAccounts():
details = self.getAccountDetails(testedaccount)
if ( details['Account.enable'] == "TRUE" and details['Account.alias'] == alias ):
if ( details['Account.enable'] == "TRUE" and
details['Account.alias'] == alias ):
self.account = testedaccount
return
raise SPaccountError("No enabled account matched with alias")
......@@ -216,6 +218,7 @@ class SflPhoneCtrlSimple(object):
details = self.getAccountDetails(account)
if details['Account.alias'] == alias:
return account
raise SPaccountError("No account matched with alias")
def setAccount(self, account):
......@@ -345,7 +348,6 @@ class SflPhoneCtrlSimple(object):
else:
self.configurationmanager.sendRegister(account, int(0))
#self.setFirstRegisteredAccount()
except SflPhoneError, e:
print e
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment