[Shtoom] Finishing the WxWidgets GUI
James 'J.C.' Jones
jamesj at bebr.ufl.edu
Wed Jun 14 18:34:20 CEST 2006
I'm quite happy with Shtoom and the Gnome UI in particular, but for my
application I need to use the WxWidgets UI, including the DTMF dialpad.
The dialpad was never enabled in the WxWidgets UI, so, like any dutiful
coder I added the code for it. Unfortunately I've found a bit of a snag:
I can't get the current call's cookie. The SVN version of the Wx UI
never sets self.cookie from the app.placeCall() call.
The normal means for starting a call with Shtoom appears to be something
like this:
===---===---===---===---===---===---===---===---===---===---===---===
def doCall(...):
...
deferred = self.app.placeCall(uri)
deferred.addCallbacks(self.callConnected, self.callFailed
).addErrback(log.err)
===---===---===---===---===---===---===---===---===---===---===---===
(paraphrased from the gnomeui/main.py)
So, in wxui/main.py I changed PlaceCall() to the following:
===---===---===---===---===---===---===---===---===---===---===---===
def PlaceCall(self, event):
sipURL = self.getCurrentAddress()
sipURL = self.addrlookup.lookup(sipURL)
if not sipURL.startswith('sip'):
dlg = wxMessageDialog(self,
'%s %s'%(sipURL, _('is a invalid address. The address
must begin with "sip".')),
_("Address error"), wxOK)
dlg.ShowModal()
return
# have hang up and call buttons toggle
self.updateCallButton(do_call=False)
# Make request for the call
print "**** Calling app.placeCall on ", sipURL
deferred = self.app.placeCall(sipURL)
print "**** RESULT: Deferred is ", deferred
if deferred is not None:
deferred.addCallbacks(self.callStarted,
self.callFailed).addErrback(log.err)
else:
self.callFailed(False, "Twisted did not place the call")
===---===---===---===---===---===---===---===---===---===---===---===
I also added a few debug print statements to sip.py and phone.py in
their placeCall() functions.
Now, sip.placeCall *does* return a deferred object which is intended for
asynchronous processing, but I'm pretty sure that phone.placeCall itself
is not asynchronous. So imagine my frustration to see logfiles like this:
===---===---===---===---===---===---===---===---===---===---===---===
2006-06-14T12:04:02.236290 [-] **** Calling app.placeCall on sip:4321 at pbx
2006-06-14T12:04:02.236735 [-] **** RESULT: Deferred is None
2006-06-14T12:04:02.241966 [-] *** PHONE.PY PLACECALL: Starting for
sip:4321 at pbx
2006-06-14T12:04:02.243743 [-] ** SIP.PY PLACECALL: No Failures,
returning <Deferred at 0xB78F68CCL>
2006-06-14T12:04:02.244046 [-] *** PHONE.PY PLACECALL: Returning
<Deferred at 0xB78F68CCL>
===---===---===---===---===---===---===---===---===---===---===---===
So the line
deferred = self.app.placeCall(sipURL)
immediately sets deferred to None and continues processing to call
self.callFailed(). Sometime after that, phone.placeCall() is executed
which calls sip.placeCall() which returns a Deferred.
Things are happening out of order and I don't know why. Please help me
fix this so that I can continue polishing the wxWidgets UI. :)
Attached is the full log of one run of shtoomphone.py. System setup is:
WxWidgets 2.6.3
Python 2.4.2
Twisted 2.0.1
Shtoom SVN HEAD
Gentoo Linux
Cheers,
--
James 'J.C.' Jones
Bureau of Economic and Business Research
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: shtoom-wxui-error-log.txt
URL: <http://mail.python.org/pipermail/shtoom/attachments/20060614/61c993dc/attachment.txt>
More information about the Shtoom
mailing list