Skip to content

Commit

Permalink
pep8 fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
tito committed Mar 19, 2012
1 parent 601931a commit 71a5d04
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions examples/frameworks/twisted/twistd_app.py
@@ -1,11 +1,11 @@
from kivy.support import install_twisted_reactor
install_twisted_reactor()

import os, sys
import os
import sys

from kivy.app import App
from kivy.uix.gridlayout import GridLayout
from kivy.uix.button import Button
from kivy.properties import BooleanProperty
from kivy.lang import Builder

Expand All @@ -14,17 +14,21 @@

TWISTD = 'twistd web -p 8087'


class AndroidApplicationRunner(UnixApplicationRunner):

def run(self):

self.preApplication()
self.application = self.createOrGetApplication()
self.logger.start(self.application)
self.logger.start(self.application)
sc = IServiceCollection(self.application)

# reactor is already running, so we just start the service collection
sc.startService()
return self.application


Builder.load_string('''
<TwistedTwistd>:
cols: 1
Expand All @@ -33,9 +37,13 @@ def run(self):
on_release: root.cb_twistd()
''')


class TwistedTwistd(GridLayout):

running = BooleanProperty(False)
def cb_twistd(self,*la):

def cb_twistd(self, *la):

if self.running:
IServiceCollection(self.app).stopService()
self.running = False
Expand All @@ -48,9 +56,12 @@ def cb_twistd(self,*la):
self.app = AndroidApplicationRunner(config).run()
self.running = True


class TwistedTwistdApp(App):

def build(self):
return TwistedTwistd()



if __name__ == '__main__':
TwistedTwistdApp().run()

0 comments on commit 71a5d04

Please sign in to comment.