This commit is contained in:
yumoqing 2020-07-24 14:32:32 +08:00
parent 63a4bfdb93
commit f0061e1918
2 changed files with 17 additions and 16 deletions

View File

@ -67,6 +67,7 @@ from .charts.bar import Bar
from .bgcolorbehavior import BGColorBehavior from .bgcolorbehavior import BGColorBehavior
from .utils import NeedLogin, InsufficientPrivilege, HTTPError from .utils import NeedLogin, InsufficientPrivilege, HTTPError
from .login import LoginForm from .login import LoginForm
from .tab import TabsPanel
if platform == 'android': if platform == 'android':
from .widgetExt.phonebutton import PhoneButton from .widgetExt.phonebutton import PhoneButton
from .widgetExt.androidwebview import AWebView from .widgetExt.androidwebview import AWebView

View File

@ -1,29 +1,29 @@
""" """
{ {
"widgettype":"BLKTabbedPanel", "widgettype":"TabsPanel",
"options":{ "options":{
"tab_pos":"top_left" "tab_pos":"top_left"
}, "tabs":[
"tabs":[ {
{ "text":"tab1",
"text":"tab1", "icon":"/img/hhhh.png",
"icon":"/img/hhhh.png", "refresh_press":Fasle,
"refresh_press":Fasle, "content":{
"content":{ "widgettype":"urlwidegt",
"widgettype":"urlwidegt", "url":"reggtY",
"url":"reggtY", }
},
{
} }
}, ]
{ },
}
]
} }
""" """
from kivy.uix.tabbedpanel import TabbedPanel from kivy.uix.tabbedpanel import TabbedPanel
from kivy.clock import Clock from kivy.clock import Clock
from kivy.factory import Factory from kivy.factory import Factory
from kivyblocks.blocks import Blocks from .bgcolorbehavior import BGColorBehavior
class TabsPanel(BGColorBehavior, TabbedPanel): class TabsPanel(BGColorBehavior, TabbedPanel):
def __init__(self,**options): def __init__(self,**options):
@ -37,7 +37,7 @@ class TabsPanel(BGColorBehavior, TabbedPanel):
def add_tab(self,text,desc): def add_tab(self,text,desc):
def add(o,w): def add(o,w):
self.add_widget(TabbedPanelItem(text=text,content=w)) self.add_widget(TabbedPanelItem(text=text,content=w))
blocks = Blocks() blocks = Factory.Blocks()
blocks.bind(on_built=add) blocks.bind(on_built=add)
blocks.widgetBuild(desc,ancestor=self) blocks.widgetBuild(desc,ancestor=self)