bugfix
This commit is contained in:
parent
a0c34a17b8
commit
20f00688a8
6
docs/changelog.md
Normal file
6
docs/changelog.md
Normal file
@ -0,0 +1,6 @@
|
||||
# Change log
|
||||
|
||||
## version 0.3.0
|
||||
add script to support local .tmpl and .dspy file translation. it can build dynamic user interface without remote server.
|
||||
|
||||
|
@ -32,7 +32,7 @@ from .newvideo import Video
|
||||
from .orientationlayout import OrientationLayout
|
||||
from .threadcall import HttpClient
|
||||
from .register import *
|
||||
from .script import Script
|
||||
from .script import Script, set_script_env
|
||||
|
||||
class WidgetNotFoundById(Exception):
|
||||
def __init__(self, id):
|
||||
@ -242,7 +242,6 @@ class Blocks(EventDispatcher):
|
||||
return obj
|
||||
|
||||
def w_build(self,desc) -> Widget:
|
||||
# print('w_build(),desc=',desc)
|
||||
widgetClass = desc.get('widgettype',None)
|
||||
if not widgetClass:
|
||||
Logger.info("Block: w_build(), desc invalid", desc)
|
||||
@ -787,6 +786,36 @@ class Blocks(EventDispatcher):
|
||||
def on_failed(self,e=None):
|
||||
return
|
||||
|
||||
def buildKlass(self, desc):
|
||||
"""
|
||||
desc = {
|
||||
"classname":"MyClass",
|
||||
"base":["Box", "WidgetReady"],
|
||||
"properties":[
|
||||
{
|
||||
"name":"aaa",
|
||||
"type":"str",
|
||||
"default":1
|
||||
}
|
||||
]
|
||||
"subwidgets":[
|
||||
],
|
||||
|
||||
"""
|
||||
codes = """
|
||||
{% for b in bases %}
|
||||
{{b}} = Factory.{{b}}
|
||||
{% endfor %}
|
||||
|
||||
class {{ classname }}({% for b in bases -%}{{b}}{% endfor %})
|
||||
{% for p in properties %}
|
||||
{{p.name}} {{p.type}}({{p.default}})
|
||||
{% endfor %}
|
||||
def __init__(self, **kw):
|
||||
super({{classname}}, self).__init__(**kw)
|
||||
|
||||
"""
|
||||
|
||||
Factory.register('Blocks',Blocks)
|
||||
Factory.register('Video',Video)
|
||||
Factory.register('OrientationLayout', OrientationLayout)
|
||||
|
@ -6,6 +6,16 @@ from os.path import join, sep, dirname, basename
|
||||
from appPublic.Singleton import GlobalEnv
|
||||
from appPublic.jsonConfig import getConfig
|
||||
from appPublic.myTE import MyTemplateEngine
|
||||
from appPublic.Singleton import SingletonDecorator
|
||||
from appPublic.dictObject import DictObject
|
||||
|
||||
@SingletonDecorator
|
||||
class ScriptEnv(DictObject):
|
||||
pass
|
||||
|
||||
def set_script_env(n,v):
|
||||
env = ScriptEnv()
|
||||
env.update({n:v})
|
||||
|
||||
class Script:
|
||||
def __init__(self, root):
|
||||
@ -26,6 +36,7 @@ class Script:
|
||||
for suffix, handler in self.handlers.items():
|
||||
if filepath.endswith(suffix):
|
||||
env = self.env.copy()
|
||||
env.update(ScriptEnv())
|
||||
env.update(kw)
|
||||
env['root_path'] = self.root
|
||||
env['url'] = url
|
||||
|
@ -1 +1 @@
|
||||
__version__ = '0.2.17'
|
||||
__version__ = '0.3.0'
|
||||
|
Loading…
Reference in New Issue
Block a user