This commit is contained in:
yumoqing 2021-05-07 22:17:56 +08:00
parent 55d4374b3b
commit 34c7c5a6f7
3 changed files with 17 additions and 7 deletions

View File

@ -38,7 +38,7 @@ class MenuContainer(VBox):
if not self.collide_point(touch.x, touch.y): if not self.collide_point(touch.x, touch.y):
self.dismiss() self.dismiss()
return True return True
return True return False
class PagePanel(VBox): class PagePanel(VBox):
""" """

View File

@ -16,7 +16,8 @@ class PressableBox(TouchRippleButtonBehavior, Box):
normal_css = StringProperty("default") normal_css = StringProperty("default")
actived_css = StringProperty("default") actived_css = StringProperty("default")
box_actived = BooleanProperty(False) box_actived = BooleanProperty(False)
def __init__(self,border_width=1, def __init__(self,
border_width=1,
color_level=-1, color_level=-1,
user_data=None, user_data=None,
radius=[], radius=[],

View File

@ -1,6 +1,7 @@
import traceback import traceback
from kivy.app import App from kivy.app import App
from kivy.factory import Factory
from kivy.properties import ListProperty, BooleanProperty from kivy.properties import ListProperty, BooleanProperty
from kivy.core.window import Window from kivy.core.window import Window
from kivy.logger import Logger from kivy.logger import Logger
@ -482,7 +483,11 @@ class TextTree(Tree):
class MenuTreeNode(TextTreeNode): class MenuTreeNode(TextTreeNode):
def on_size(self, *args): def on_size(self, *args):
Logger.info('Tree:%s:on_size() called', self.__class__.__name__) Logger.info('%s:on_size(),bgcolor=%s, fgcolor=%s,css=%s',
self.__class__.__name__,
self.content.bgcolor,
self.content.fgcolor,
self.content.csscls)
self.node_box.width = self.width self.node_box.width = self.width
self.content.width = self.node_box.width - self.trigger.width self.content.width = self.node_box.width - self.trigger.width
self.text_widget.width = self.content.width - CSize(1) self.text_widget.width = self.content.width - CSize(1)
@ -491,7 +496,8 @@ class MenuTreeNode(TextTreeNode):
txt = self.data.get(self.treeObj.textField, txt = self.data.get(self.treeObj.textField,
self.data.get(self.treeObj.idField,'defaulttext')) self.data.get(self.treeObj.idField,'defaulttext'))
icon = self.data.get('icon') icon = self.data.get('icon')
self.content = PressableBox(csscls=self.treeObj.normal_css, self.content = PressableBox(normal_css=self.treeObj.normal_css,
actived_css=self.treeObj.selected_css,
size_hint_y=None, size_hint_y=None,
height=self.treeObj.rowheight height=self.treeObj.rowheight
) )
@ -551,8 +557,10 @@ class MenuTree(TextTree):
url = node.data.get('url') url = node.data.get('url')
if url: if url:
params = node.data.get('params',{}) params = node.data.get('params',{})
target = Blocks.getWidgetById(self.target,self) target = Factory.Blocks.getWidgetById(self.target,self)
blocks = Blocks() if not target:
return
blocks = Factory.Blocks()
desc = { desc = {
"widgettype":"urlwidget", "widgettype":"urlwidget",
"options":{ "options":{
@ -561,7 +569,8 @@ class MenuTree(TextTree):
} }
} }
w = blocks.widgetBuild(desc) w = blocks.widgetBuild(desc)
target.add_widget(w) if w:
target.add_widget(w)
return return
rfname = node.data.get('rfname') rfname = node.data.get('rfname')