mirror of
https://github.com/kivy/kivy.git
synced 2025-02-26 20:46:29 +00:00
pep8 fixes
This commit is contained in:
parent
601931aaa8
commit
71a5d04fe1
@ -1,11 +1,11 @@
|
|||||||
from kivy.support import install_twisted_reactor
|
from kivy.support import install_twisted_reactor
|
||||||
install_twisted_reactor()
|
install_twisted_reactor()
|
||||||
|
|
||||||
import os, sys
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
from kivy.app import App
|
from kivy.app import App
|
||||||
from kivy.uix.gridlayout import GridLayout
|
from kivy.uix.gridlayout import GridLayout
|
||||||
from kivy.uix.button import Button
|
|
||||||
from kivy.properties import BooleanProperty
|
from kivy.properties import BooleanProperty
|
||||||
from kivy.lang import Builder
|
from kivy.lang import Builder
|
||||||
|
|
||||||
@ -14,8 +14,11 @@ from twisted.application.service import IServiceCollection
|
|||||||
|
|
||||||
TWISTD = 'twistd web -p 8087'
|
TWISTD = 'twistd web -p 8087'
|
||||||
|
|
||||||
|
|
||||||
class AndroidApplicationRunner(UnixApplicationRunner):
|
class AndroidApplicationRunner(UnixApplicationRunner):
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
|
|
||||||
self.preApplication()
|
self.preApplication()
|
||||||
self.application = self.createOrGetApplication()
|
self.application = self.createOrGetApplication()
|
||||||
self.logger.start(self.application)
|
self.logger.start(self.application)
|
||||||
@ -25,6 +28,7 @@ class AndroidApplicationRunner(UnixApplicationRunner):
|
|||||||
sc.startService()
|
sc.startService()
|
||||||
return self.application
|
return self.application
|
||||||
|
|
||||||
|
|
||||||
Builder.load_string('''
|
Builder.load_string('''
|
||||||
<TwistedTwistd>:
|
<TwistedTwistd>:
|
||||||
cols: 1
|
cols: 1
|
||||||
@ -33,9 +37,13 @@ Builder.load_string('''
|
|||||||
on_release: root.cb_twistd()
|
on_release: root.cb_twistd()
|
||||||
''')
|
''')
|
||||||
|
|
||||||
|
|
||||||
class TwistedTwistd(GridLayout):
|
class TwistedTwistd(GridLayout):
|
||||||
|
|
||||||
running = BooleanProperty(False)
|
running = BooleanProperty(False)
|
||||||
def cb_twistd(self,*la):
|
|
||||||
|
def cb_twistd(self, *la):
|
||||||
|
|
||||||
if self.running:
|
if self.running:
|
||||||
IServiceCollection(self.app).stopService()
|
IServiceCollection(self.app).stopService()
|
||||||
self.running = False
|
self.running = False
|
||||||
@ -48,9 +56,12 @@ class TwistedTwistd(GridLayout):
|
|||||||
self.app = AndroidApplicationRunner(config).run()
|
self.app = AndroidApplicationRunner(config).run()
|
||||||
self.running = True
|
self.running = True
|
||||||
|
|
||||||
|
|
||||||
class TwistedTwistdApp(App):
|
class TwistedTwistdApp(App):
|
||||||
|
|
||||||
def build(self):
|
def build(self):
|
||||||
return TwistedTwistd()
|
return TwistedTwistd()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
TwistedTwistdApp().run()
|
TwistedTwistdApp().run()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user