'bugfix
This commit is contained in:
parent
97da3d6207
commit
08f34c65e7
@ -9,7 +9,7 @@ from functools import partial
|
|||||||
from appPublic.dictExt import dictExtend
|
from appPublic.dictExt import dictExtend
|
||||||
from appPublic.folderUtils import ProgramPath
|
from appPublic.folderUtils import ProgramPath
|
||||||
from appPublic.dictObject import DictObject
|
from appPublic.dictObject import DictObject
|
||||||
from appPublic.Singleton import SingletonDecorator
|
from appPublic.Singleton import SingletonDecorator, GlobalEnv
|
||||||
from appPublic.datamapping import keyMapping
|
from appPublic.datamapping import keyMapping
|
||||||
|
|
||||||
from kivy.config import Config
|
from kivy.config import Config
|
||||||
@ -117,6 +117,7 @@ class Blocks(EventDispatcher):
|
|||||||
self.action_id = 0
|
self.action_id = 0
|
||||||
self.register_event_type('on_built')
|
self.register_event_type('on_built')
|
||||||
self.register_event_type('on_failed')
|
self.register_event_type('on_failed')
|
||||||
|
self.env = GlobalEnv()
|
||||||
|
|
||||||
def register_widget(self,name,widget):
|
def register_widget(self,name,widget):
|
||||||
globals()[name] = widget
|
globals()[name] = widget
|
||||||
@ -158,6 +159,7 @@ class Blocks(EventDispatcher):
|
|||||||
g['__builtins__']['__import__'] = None
|
g['__builtins__']['__import__'] = None
|
||||||
g['__builtins__']['__loader__'] = None
|
g['__builtins__']['__loader__'] = None
|
||||||
g['__builtins__']['open'] = None
|
g['__builtins__']['open'] = None
|
||||||
|
g.update(self.env)
|
||||||
|
|
||||||
return eval(s,g,l)
|
return eval(s,g,l)
|
||||||
|
|
||||||
@ -180,12 +182,14 @@ class Blocks(EventDispatcher):
|
|||||||
|
|
||||||
def strValueExpr(self,s:str,localnamespace:dict={}):
|
def strValueExpr(self,s:str,localnamespace:dict={}):
|
||||||
if not s.startswith('py::'):
|
if not s.startswith('py::'):
|
||||||
|
print('normal value')
|
||||||
return s
|
return s
|
||||||
|
s = s[4:]
|
||||||
try:
|
try:
|
||||||
v = self.eval(s[4:],localnamespace)
|
v = self.eval(s[4:],localnamespace)
|
||||||
|
print('return result')
|
||||||
return v
|
return v
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
if s.startswith('CSize'):
|
|
||||||
print('Exception .... ',e,s)
|
print('Exception .... ',e,s)
|
||||||
print_exc()
|
print_exc()
|
||||||
return s
|
return s
|
||||||
@ -227,11 +231,18 @@ class Blocks(EventDispatcher):
|
|||||||
return d
|
return d
|
||||||
def valueExpr(self,obj,localnamespace={}):
|
def valueExpr(self,obj,localnamespace={}):
|
||||||
if type(obj) == type(''):
|
if type(obj) == type(''):
|
||||||
|
print('1')
|
||||||
return self.strValueExpr(obj,localnamespace)
|
return self.strValueExpr(obj,localnamespace)
|
||||||
if type(obj) == type([]):
|
if type(obj) == type([]):
|
||||||
|
print('2')
|
||||||
return self.arrayValueExpr(obj,localnamespace)
|
return self.arrayValueExpr(obj,localnamespace)
|
||||||
if type(obj) in [ type({}), type(DictObject) ]:
|
if type(obj) == type({}):
|
||||||
|
print('3')
|
||||||
return self.dictValueExpr(obj,localnamespace)
|
return self.dictValueExpr(obj,localnamespace)
|
||||||
|
if isinstance(obj,DictObject):
|
||||||
|
print('4')
|
||||||
|
return self.dictValueExpr(obj,localnamespace)
|
||||||
|
print('5',type(obj))
|
||||||
return obj
|
return obj
|
||||||
|
|
||||||
def __build(self,desc:dict,ancestor=None):
|
def __build(self,desc:dict,ancestor=None):
|
||||||
@ -427,7 +438,9 @@ class Blocks(EventDispatcher):
|
|||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
def doit(desc):
|
def doit(desc):
|
||||||
|
Logger.info("blocks:%s",str(desc))
|
||||||
desc = self.valueExpr(desc)
|
desc = self.valueExpr(desc)
|
||||||
|
Logger.info("blocks:%s",str(desc))
|
||||||
try:
|
try:
|
||||||
widget = self.__build(desc,ancestor=ancestor)
|
widget = self.__build(desc,ancestor=ancestor)
|
||||||
self.dispatch('on_built',widget)
|
self.dispatch('on_built',widget)
|
||||||
|
@ -38,11 +38,10 @@ logger_func = {'quiet': Logger.critical, 'panic': Logger.critical,
|
|||||||
|
|
||||||
othersplatforms=['ios','android']
|
othersplatforms=['ios','android']
|
||||||
|
|
||||||
class BaseVPlayer(FloatLayout, SwipeBehavior):
|
class BaseVPlayer(FloatLayout):
|
||||||
fullscreen = BooleanProperty(False)
|
fullscreen = BooleanProperty(False)
|
||||||
def __init__(self,vfile=None,loop=None,mute=False):
|
def __init__(self,vfile=None,loop=None,mute=False):
|
||||||
FloatLayout.__init__(self)
|
FloatLayout.__init__(self)
|
||||||
SwipeBehavior.__init__(self)
|
|
||||||
self.loop = loop
|
self.loop = loop
|
||||||
self.muteFlg = mute
|
self.muteFlg = mute
|
||||||
self.register_event_type('on_source_error')
|
self.register_event_type('on_source_error')
|
||||||
@ -61,8 +60,8 @@ class BaseVPlayer(FloatLayout, SwipeBehavior):
|
|||||||
if loop:
|
if loop:
|
||||||
self.eos = 'loop'
|
self.eos = 'loop'
|
||||||
|
|
||||||
self.bind(on_swipe_down=self.previous)
|
# self.bind(on_swipe_down=self.previous)
|
||||||
self.bind(on_swipe_up=self.next)
|
# self.bind(on_swipe_up=self.next)
|
||||||
set_log_callback(self.ffplayerLog)
|
set_log_callback(self.ffplayerLog)
|
||||||
if hasattr(self._video._video, '_ffplayer'):
|
if hasattr(self._video._video, '_ffplayer'):
|
||||||
self.ffplayer = self._video._video._ffplayer
|
self.ffplayer = self._video._video._ffplayer
|
||||||
@ -227,7 +226,14 @@ class BaseVPlayer(FloatLayout, SwipeBehavior):
|
|||||||
def __del__(self):
|
def __del__(self):
|
||||||
self.stop()
|
self.stop()
|
||||||
|
|
||||||
class OSCController:
|
class Swipe_VPlayer(BaseVPlayer, SwipeBehavior):
|
||||||
|
def __init__(self,vfile=None, loop=False, mute=False):
|
||||||
|
BaseVPlayer.__init__(self,vfile=vfile, loop=loop, mute=mute)
|
||||||
|
SwipeBehavior.__init__(self)
|
||||||
|
self.bind(on_swipe_down=self.previous)
|
||||||
|
self.bind(on_swipe_up=self.next)
|
||||||
|
|
||||||
|
class OSC_VPlayer(BaseVPlayer):
|
||||||
def __init__(self,ip,port,vfile=None):
|
def __init__(self,ip,port,vfile=None):
|
||||||
self.ip = ip
|
self.ip = ip
|
||||||
self.port = port
|
self.port = port
|
||||||
@ -250,7 +256,7 @@ class OSCController:
|
|||||||
def map(self,p,f):
|
def map(self,p,f):
|
||||||
self.dispatcher.map(p,f,None)
|
self.dispatcher.map(p,f,None)
|
||||||
|
|
||||||
class VPlayer(BaseVPlayer):
|
class VPlayer(Swipe_VPlayer):
|
||||||
def __init__(self,vfile=None, loop=False,mute=False, opbar=True):
|
def __init__(self,vfile=None, loop=False,mute=False, opbar=True):
|
||||||
self.opbar = opbar
|
self.opbar = opbar
|
||||||
self.menubar = None
|
self.menubar = None
|
||||||
|
Loading…
Reference in New Issue
Block a user