mirror of
https://gitee.com/Lyon1998/pikapython.git
synced 2025-02-05 17:28:23 +08:00
support user compotnents
This commit is contained in:
parent
a5836d258c
commit
b4f563cfe3
2
port/linux/.vscode/launch.json
vendored
2
port/linux/.vscode/launch.json
vendored
@ -11,7 +11,7 @@
|
|||||||
"program": "${workspaceFolder}/build/test/pikascript_test",
|
"program": "${workspaceFolder}/build/test/pikascript_test",
|
||||||
// "program": "${workspaceFolder}/build/boot/demo06-pikamain/pikascript_demo06-pikamain",
|
// "program": "${workspaceFolder}/build/boot/demo06-pikamain/pikascript_demo06-pikamain",
|
||||||
"args": [
|
"args": [
|
||||||
"--gtest_filter=pikaMain.mem_now"
|
// "--gtest_filter=pikaMain.mem_now"
|
||||||
],
|
],
|
||||||
"stopAtEntry": false,
|
"stopAtEntry": false,
|
||||||
"cwd": "${workspaceFolder}",
|
"cwd": "${workspaceFolder}",
|
||||||
|
@ -1735,11 +1735,10 @@ PikaObj* obj_importModuleWithByteCodeFrame(PikaObj* self,
|
|||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
PikaObj* obj_linkLibraryFile(PikaObj* self, char* input_file_name) {
|
int obj_linkLibraryFile(PikaObj* self, char* input_file_name) {
|
||||||
obj_newMetaObj(self, "@lib", New_LibObj);
|
obj_newMetaObj(self, "@lib", New_LibObj);
|
||||||
LibObj* lib = obj_getObj(self, "@lib");
|
LibObj* lib = obj_getObj(self, "@lib");
|
||||||
LibObj_loadLibraryFile(lib, input_file_name);
|
return LibObj_loadLibraryFile(lib, input_file_name);
|
||||||
return self;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PikaObj* obj_linkLibrary(PikaObj* self, uint8_t* library_bytes) {
|
PikaObj* obj_linkLibrary(PikaObj* self, uint8_t* library_bytes) {
|
||||||
|
@ -408,7 +408,7 @@ PikaObj* pks_eventListener_getEventHandleObj(PikaEventListener* self,
|
|||||||
void pks_eventListener_init(PikaEventListener** p_self);
|
void pks_eventListener_init(PikaEventListener** p_self);
|
||||||
void pks_eventListener_deinit(PikaEventListener** p_self);
|
void pks_eventListener_deinit(PikaEventListener** p_self);
|
||||||
PikaObj* methodArg_getDefContext(Arg* method_arg);
|
PikaObj* methodArg_getDefContext(Arg* method_arg);
|
||||||
PikaObj* obj_linkLibraryFile(PikaObj* self, char* input_file_name);
|
int obj_linkLibraryFile(PikaObj* self, char* input_file_name);
|
||||||
NewFun obj_getClass(PikaObj* obj);
|
NewFun obj_getClass(PikaObj* obj);
|
||||||
|
|
||||||
void pks_printVersion(void);
|
void pks_printVersion(void);
|
||||||
|
@ -2607,6 +2607,7 @@ static char* _Parser_linesToBytesOrAsm(Args* outBuffs,
|
|||||||
parse_after:
|
parse_after:
|
||||||
if (NULL == single_ASM) {
|
if (NULL == single_ASM) {
|
||||||
out_ASM = NULL;
|
out_ASM = NULL;
|
||||||
|
pika_platform_printf(" -> %s\r\n", line);
|
||||||
strsDeinit(&buffs);
|
strsDeinit(&buffs);
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -3743,8 +3743,9 @@ PikaObj* pikaVM_runFile(PikaObj* self, char* file_name) {
|
|||||||
pikaMemMaxReset();
|
pikaMemMaxReset();
|
||||||
char* libfile_path =
|
char* libfile_path =
|
||||||
strsPathJoin(&buffs, pwd, "pikascript-api/pikaModules_cache.py.a");
|
strsPathJoin(&buffs, pwd, "pikascript-api/pikaModules_cache.py.a");
|
||||||
obj_linkLibraryFile(self, libfile_path);
|
if (PIKA_RES_OK == obj_linkLibraryFile(self, libfile_path)) {
|
||||||
self = pikaVM_runSingleFile(self, file_name);
|
self = pikaVM_runSingleFile(self, file_name);
|
||||||
|
}
|
||||||
strsDeinit(&buffs);
|
strsDeinit(&buffs);
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
@ -1,33 +1,38 @@
|
|||||||
import PikaUI as ui
|
import PikaUI as ui
|
||||||
from PikaStdLib import MemChecker as mem
|
from PikaStdLib import MemChecker as mem
|
||||||
|
|
||||||
class Page1(ui.Page):
|
|
||||||
|
class MainContainer(ui.Container):
|
||||||
def onclick_next(self, event):
|
def onclick_next(self, event):
|
||||||
print('Page1: onclick_next')
|
print('Page1: onclick_next')
|
||||||
app.pageManager.enter(Page2())
|
app.pageManager.enter(Page2())
|
||||||
mem.now()
|
mem.now()
|
||||||
|
|
||||||
def build(self):
|
def build(self):
|
||||||
main = ui.Container(
|
text = ui.Text(
|
||||||
|
text='Hello Page1',
|
||||||
|
align=ui.ALIGN.CENTER
|
||||||
|
)
|
||||||
|
btn = ui.Button(
|
||||||
|
text='Next',
|
||||||
|
align=ui.ALIGN.CENTER,
|
||||||
|
pos=(0, 50),
|
||||||
|
height=30,
|
||||||
|
width=80,
|
||||||
|
onclick=self.onclick_next
|
||||||
|
)
|
||||||
|
return [text, btn]
|
||||||
|
|
||||||
|
|
||||||
|
class Page1(ui.Page):
|
||||||
|
def build(self):
|
||||||
|
mainCtn = MainContainer(
|
||||||
width=300,
|
width=300,
|
||||||
height=200,
|
height=200,
|
||||||
pos=(0, 50)
|
pos=(0, 50)
|
||||||
).add(
|
|
||||||
ui.Text(
|
|
||||||
text='Hello Page1',
|
|
||||||
align=ui.ALIGN.CENTER
|
|
||||||
),
|
|
||||||
ui.Button(
|
|
||||||
text='Next',
|
|
||||||
align=ui.ALIGN.CENTER,
|
|
||||||
pos=(0, 50),
|
|
||||||
height=30,
|
|
||||||
width=80,
|
|
||||||
onclick=self.onclick_next
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
title = ui.Text("Title")
|
title = ui.Text("Title")
|
||||||
return [main, title]
|
return [mainCtn, title]
|
||||||
|
|
||||||
|
|
||||||
class Page2(ui.Page):
|
class Page2(ui.Page):
|
||||||
@ -37,8 +42,8 @@ class Page2(ui.Page):
|
|||||||
|
|
||||||
def build(self):
|
def build(self):
|
||||||
return ui.Container(
|
return ui.Container(
|
||||||
width= 400,
|
width=400,
|
||||||
height= 200,
|
height=200,
|
||||||
pos=(0, 50)
|
pos=(0, 50)
|
||||||
).add(
|
).add(
|
||||||
ui.Text(
|
ui.Text(
|
||||||
@ -55,6 +60,7 @@ class Page2(ui.Page):
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
app = ui.App()
|
app = ui.App()
|
||||||
app.pageManager.enter(Page1())
|
app.pageManager.enter(Page1())
|
||||||
app.timer.cb(0)
|
app.timer.cb(0)
|
||||||
@ -74,4 +80,3 @@ mem.now()
|
|||||||
# app.pageManager.back()
|
# app.pageManager.back()
|
||||||
# app.timer.cb(0)
|
# app.timer.cb(0)
|
||||||
# mem.now()
|
# mem.now()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user