Re: [Twisted-Python] Twisted and wxPython

2009-11-05 Thread Kevin Horn
On Thu, Nov 5, 2009 at 12:14 PM, Jon Mills  wrote:

> Can anybody point me towards a nice up-to-date example of the use of
> Twisted with wxPython?
>
> I assume (hope) there's some way to bind the wx event loop into
> Twisted's Reactor? Or do they need to run in separate
> threads/processes?
>
> Thanks in advance,
>
> Jon Mills
>
>
I typically base my code the example that comes with Twisted.
http://twistedmatrix.com/trac/browser/trunk/doc/core/examples/wxdemo.py

Is this not working for you, or had you just not seen it? (It took me quite
a while to find... ;) )

Kevin Horn
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Twisted and wxPython

2009-11-05 Thread Jon Mills
Thanks Kevin,

I often find it difficult to know which Twisted examples to follow.
Googling around gives several different approaches to Twisted and wx
integration - and the recommended solution seems to have evolved over
time.

I'll take a look at the example in your link.

Thanks again

On Thu, Nov 5, 2009 at 6:43 PM, Kevin Horn  wrote:
> On Thu, Nov 5, 2009 at 12:14 PM, Jon Mills  wrote:
>>
>> Can anybody point me towards a nice up-to-date example of the use of
>> Twisted with wxPython?
>>
>> I assume (hope) there's some way to bind the wx event loop into
>> Twisted's Reactor? Or do they need to run in separate
>> threads/processes?
>>
>> Thanks in advance,
>>
>> Jon Mills
>>
>
> I typically base my code the example that comes with Twisted.
> http://twistedmatrix.com/trac/browser/trunk/doc/core/examples/wxdemo.py
>
> Is this not working for you, or had you just not seen it? (It took me quite
> a while to find... ;) )
>
> Kevin Horn
>
>
> ___
> Twisted-Python mailing list
> Twisted-Python@twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>
>



-- 
Jon Mills
jonmi...@moosesoup.com

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Twisted and wxPython

2009-11-05 Thread David Ripton
On 2009.11.05 18:14:57 +, Jon Mills wrote:
> Can anybody point me towards a nice up-to-date example of the use of
> Twisted with wxPython?
> 
> I assume (hope) there's some way to bind the wx event loop into
> Twisted's Reactor? Or do they need to run in separate
> threads/processes?

wx has multiple event loops so reactor integration isn't as easy as it
should be.

Longer version of that answer here:

http://wiki.wxpython.org/wxPythonAndTwisted

Here's an example of doing it with threads:

https://pangalactic.us/repo/ampchat

-- 
David Riptondrip...@ripton.net

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] help needed with flow-control for push protocol

2009-11-05 Thread exarkun
On 05:52 pm, piem...@tiscali.it wrote:
>Hi,
>
>I need assistance figuring out how to create a push protocol that 
>implements
>flow control.
>
>To keep things simple, I'm trying to build a push-based echo server. 
>It
>should
>(1) accept incoming tcp connections
>(2) on each connection, all data rec'd should be echo'd unchanged.
>(3) should the output transport request that transmission be "paused,"
>the input transport (in this case, the same socket) should be similarly
>blocked.
>
>This would seem to be a simple problem.  I think my "PushEcho" class
>should implement both IConsumer and IProducer interfaces;

It doesn't need to implement IConsumer.  Protocols are hooked up to 
transports via the protocol's dataReceived method.  The protocol does 
not also need to be an IConsumer implementation with a write method.
>As a consumer,
>its dataRecieved method would cause it to act like a producer and call
>the transport's dataReceived method.

TCP transports, on the other hand, are IConsumer implementations.  So 
you meant the transport's write method (it has no dataReceived method). 
So, yes, the protocol should pass all data it receives back to the 
transport.
>Similarly, as a producer, it's
>pause, and resume methods would be called, and they would (as a
>consumer) just call the same functions in the transport.

This sounds right.
>However, I can't get the plumbing right.
>
>Can someone help by providing pointers or some sample code?

Here's some untested code:

class SmartEcho(Protocol):
implements(IProducer)

def pauseProducing(self):
self.transport.pauseProducing()

def resumeProducing(self):
self.transport.resumeProducing()

def stopProducing(self):
self.transport.stopProducing()

def connectionMade(self):
self.transport.registerProducer(self, True)

def dataReceived(self, bytes):
self.transport.write(bytes)

A careful examination of this code should also reveal the fact that it 
can be shortened to a more obscure form:

class SmartEcho(Protocol):
def connectionMade(self):
self.transport.registerProducer(self.transport, True)

def dataReceived(self, bytes):
self.transport.write(bytes)

Hope this helps,
Jean-Paul

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


[Twisted-Python] R: help needed with flow-control for push protocol

2009-11-05 Thread Pietro Niccoli
> Here's some untested code:
> 
> class SmartEcho(Protocol):
> implements(IProducer)
> 
> def pauseProducing(self):
> self.transport.pauseProducing()
> 
> def resumeProducing(self):
> self.transport.resumeProducing()
> 
> def stopProducing(self):
> self.transport.stopProducing()
> 
> def connectionMade(self):
> self.transport.registerProducer(self, True)
> 
> def dataReceived(self, bytes):
> self.transport.write(bytes)
> 
> A careful examination of this code should also reveal the 
> fact that it can be shortened to a more obscure form:
> 
> class SmartEcho(Protocol):
> def connectionMade(self):
> self.transport.registerProducer(self.transport, True)
> 
> def dataReceived(self, bytes):
> self.transport.write(bytes)
> 
> Hope this helps,
> Jean-Paul
> 
Thanks a lot. It definitely helped me. I knew how to set up a producer, I
just didn't know that my class was automatically going to be registered as a
consumer for transport. And I didn't know that i could call
transport.registerProducer(self.transport)! Unfortunately twisted is as
powerful as poorly documented sometimes.

Pietro


___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


[Twisted-Python] Twisted 9, do you want it

2009-11-05 Thread Christopher Armstrong
I'm working on it. The core NEWS file is done I think. NEWS for other
projects will be worked on tomorrow.

-- 
Christopher Armstrong
http://radix.twistedmatrix.com/
http://planet-if.com/

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Twisted 9, do you want it

2009-11-05 Thread Glyph Lefkowitz
On Thu, Nov 5, 2009 at 11:00 PM, Christopher Armstrong <
ra...@twistedmatrix.com> wrote:

> Subject: Twisted 9, do you want it


YES


> I'm working on it. The core NEWS file is done I think. NEWS for other
> projects will be worked on tomorrow.
>

WOO
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Twisted 9, do you want it

2009-11-05 Thread Alex Clemesha
Yes, do want! Thanks for doing this.

On Thu, Nov 5, 2009 at 8:00 PM, Christopher Armstrong <
ra...@twistedmatrix.com> wrote:

> I'm working on it. The core NEWS file is done I think. NEWS for other
> projects will be worked on tomorrow.
>
> --
> Christopher Armstrong
> http://radix.twistedmatrix.com/
> http://planet-if.com/
>
> ___
> Twisted-Python mailing list
> Twisted-Python@twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>



-- 
Alex Clemesha
clemesha.org
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Twisted 9, do you want it

2009-11-05 Thread Nathan
On Thu, Nov 5, 2009 at 9:00 PM, Christopher Armstrong
 wrote:
> I'm working on it. The core NEWS file is done I think. NEWS for other
> projects will be worked on tomorrow.

For those of us who don't know, where's the new core NEWS file
located?  I checked trunk/, tags/, and branches/ on the trac source
browser and couldn't a 9.0 NEWS file...

~ Nathan

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Twisted 9, do you want it

2009-11-05 Thread Christopher Armstrong
It's here:

http://twistedmatrix.com/trac/browser/branches/releases/release-9.0.x-3860-2/twisted/topfiles/NEWS

On Fri, Nov 6, 2009 at 12:36 AM, Nathan  wrote:
> On Thu, Nov 5, 2009 at 9:00 PM, Christopher Armstrong
>  wrote:
>> I'm working on it. The core NEWS file is done I think. NEWS for other
>> projects will be worked on tomorrow.
>
> For those of us who don't know, where's the new core NEWS file
> located?  I checked trunk/, tags/, and branches/ on the trac source
> browser and couldn't a 9.0 NEWS file...
>
> ~ Nathan
>
> ___
> Twisted-Python mailing list
> Twisted-Python@twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>



-- 
Christopher Armstrong
http://radix.twistedmatrix.com/
http://planet-if.com/

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Twisted 9, do you want it

2009-11-05 Thread Cary Hull
Yes. (thanks!)

On Thu, Nov 5, 2009 at 8:00 PM, Christopher Armstrong <
ra...@twistedmatrix.com> wrote:

> I'm working on it. The core NEWS file is done I think. NEWS for other
> projects will be worked on tomorrow.
>
> --
> Christopher Armstrong
> http://radix.twistedmatrix.com/
> http://planet-if.com/
>
> ___
> Twisted-Python mailing list
> Twisted-Python@twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>



-- 
01100011 0111 01110010 0001
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Gridspy - a new project using Twisted

2009-11-05 Thread Tom Leys
Just a quick update, since the last time I mentioned our system the 
dashboard was still rather rough. Since then I have added a better UI, 
exposed the live data more, added little JQuery graphs along with 
history and CSV export. All that in 1 week worth of evenings - isn't 
Python great?


Please check out the dashboard and drop me an email if your company 
wants to cut its power bill by 10 - 20% through monitoring its power usage:

http://your.gridspy.co.nz/powertech

Could someone add me to the projects page? You could use the above link 
and the following text

Gridspy - Live power monitoring and analysis

The Nexus costs $685 USD, monitors 3 different circuits and uplinks 
collected data to the site via ethernet. We also have a wireless device 
called the Gridspy that costs $495 USD, monitors 6 circuits (or a 
variety of other things) and talks to the Nexus wirelessly to upload data.


More info on the devices here:
http://www.gridspy.co.nz/nexus-and-gridspy-our-sensor-solution.html

Any comments, questions or suggestions are welcome.

Thanks!

-Tom


My previous email:

Hi Everyone

I would like to introduce my project for the 
http://twistedmatrix.com/trac/wiki/ProjectsUsingTwisted page. We use 
twisted as the central server that talks to many power measurement 
sensors in the field.


"
Gridspy provides you with an interactive view of resource usage in 
your building. It gives you hard data on your consumption patterns and 
helps you to make informed decisions.

...
The Gridspy allows you to access and monitor your consumption patterns 
in real-time using a standard web browser on your PC, laptop or mobile 
phone. The data is presented in high resolution and updated each 
second as you watch. The moment a light is turned on in your house, 
you can see the change on your Gridspy dashboard from across the room 
or across the planet.

"
Our homepage is here http://www.gridspy.co.nz/
a running demo is here http://your.gridspy.co.nz/powertech

And you can read more about the role of our twisted backend here: 
http://blog.gridspy.co.nz/2009/10/realtime-data-from-sensors-to-browsers.html


"
... The nexus then collects those sensor samples from the nearby 
Gridspies, bundles it up with its own data and uploads it to our 
central servers. To collect the data we use a custom application 
written using the excellent Twisted framework 
. Every single reading gets instant 
attention: it is evaluated for real-time events, queued to be stored 
in the database and finally forwarded to watching dashboard users. 
Processing the data stream live on the server opens up many exciting 
possible features that I look forward to discussing in future blog 
posts. By the time that the sample reaches the server, it is about 0.2 
seconds old. ...

"

It has been a great framework to work with. My sincere thanks goes to 
everyone who has ever contributed to this project. Job very well done!


-Tom



___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


[Twisted-Python] twisted server for recording streaming audio

2009-11-05 Thread Josef Novak
Hi,

  I'm interested  in using twisted to build a server for recording streaming
audio.  I've spent some time googling and looking through the archives but
haven't been able to find much in the way of examples for this sort of
usage.  To be clear, I'm not trying to stream media from the server to the
client, but want to stream the audio from (potentially multiple) clients to
the server, where it will be recorded and possibly later annotated for
reference.

  The closest possible example of this sort of usage scenario that I was
able to find was shtoom, but I wasn't able to get very far with that, as the
source does not seem to be available, despite the site still being up
(perhaps I just couldn't find it ).

   Does anyone know of any working examples of such usage that might be
easily adapted.  I'm really only looking for the simplest possible base
example that would allow me to connect one or more clients over localhost
and stream the audio to the server.
   On the other hand, perhaps it is better to just go with the bundled
SocketServer module to start with?

Cheers
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python