This commit is contained in:
yumoqing 2020-11-27 01:45:57 -08:00
parent 09dc73554e
commit d9f56aa96a
3 changed files with 13 additions and 42 deletions

View File

@ -93,19 +93,19 @@ def closeWorkers():
app.workers.running = False
def appBlocksHack(app):
config = getConfig()
# app.on_close = on_close
app.getAuthHeader = getAuthHeader
app.__del__ = closeWorkers
Window.bind(on_request_close=app.on_close)
app.serverinfo = ServerInfo()
app.title = 'Test Title'
app.blocks = Blocks()
app.workers = Workers(maxworkers=config.maxworkers or 80)
app.workers.start()
app.hc = HttpClient()
WindowBase.softinput_mode='below_target'
config = getConfig()
# app.on_close = on_close
app.getAuthHeader = getAuthHeader
app.__del__ = closeWorkers
Window.bind(on_request_close=app.on_close)
app.serverinfo = ServerInfo()
app.title = 'Test Title'
app.blocks = Blocks()
app.workers = Workers(maxworkers=config.maxworkers or 80)
app.workers.start()
app.hc = HttpClient()
WindowBase.softinput_mode='below_target'
class BlocksApp(App):
def build(self):
appBlocksHack(self)

View File

@ -6,31 +6,6 @@ from kivy.uix.label import Label
from kivy.app import App
from .utils import CSize
class TwinShapeMenuBar(BoxLayout):
def __init__(self,**kw):
pass
class MultiPanel(BoxLayout):
def __init__(self,bar_width=CSize(2),**kw):
BoxLayout.__init__(self,**kw)
self.panels = []
self.bar_width = bar_width
self.menubar = TwinShapeMenuBar(self,bar_width=bar_width)
self.cur_panel = None
self.bind(on_size=self.sizeChanged)
def sizeChanged(self,*args):
if len(self.panels) == 0:
return
if len(self.panels) == 1:
self.cur_panel.height = self.height - self.menubar.height
self.cur_panel.width = self.height - self.menubar.width
return
self.menubar.sizeChanged(self)
self.cur_panel.height = self.height - self.menubar.height
self.cur_panel.width = self.height - self.menubar.width
class PageContainer(FloatLayout):
def __init__(self,**kw):
super().__init__(**kw)

View File

@ -217,7 +217,3 @@ class ToolPage(BGColorBehavior, BoxLayout):
self.add_widget(self.content)
self.add_widget(self.toolbar)
if __name__ == '__main__':
from blocksapp import BlocksApp
app = BlocksApp()
app.run()