Skip to content

Commit c00a669

Browse files
committed
Do not show font extract notification first 3 seconds
1 parent 421ddfa commit c00a669

11 files changed

Lines changed: 48 additions & 14 deletions

File tree

packages/project-editor/features/font/font-extract/lvgl.ts

Lines changed: 38 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,21 @@ export class ExtractFont implements IFontExtract {
121121
extractBusy = true;
122122

123123
const fontName = this.params.name || "font";
124-
const toastId = notification.info(
125-
`Extracting font "${fontName}"...`,
126-
{ autoClose: false, isLoading: true }
127-
);
124+
125+
// show notification only if this takes longer than 1 second
126+
const NOTIFICATION_TIMEOUT = 3000;
127+
let toastId;
128+
function createToast() {
129+
toastId = notification.info(
130+
`Extracting font "${fontName}"...`,
131+
{ autoClose: false, isLoading: true }
132+
);
133+
}
134+
let timeout: any = setTimeout(() => {
135+
timeout = undefined;
136+
createToast();
137+
}, NOTIFICATION_TIMEOUT);
138+
//
128139

129140
try {
130141
const workerResult = await new Promise<any>((resolve, reject) => {
@@ -178,13 +189,30 @@ export class ExtractFont implements IFontExtract {
178189
lvglSourceFile
179190
};
180191

181-
notification.update(toastId!, {
182-
render: `Font "${fontName}" extracted successfully.`,
183-
type: notification.SUCCESS,
184-
isLoading: false,
185-
autoClose: 1000
186-
});
192+
if (timeout) {
193+
clearTimeout(timeout);
194+
timeout = undefined;
195+
}
196+
197+
if (toastId) {
198+
notification.update(toastId!, {
199+
render: `Font "${fontName}" extracted successfully.`,
200+
type: notification.SUCCESS,
201+
isLoading: false,
202+
autoClose: 1000
203+
});
204+
}
187205
} catch (err: any) {
206+
if (timeout) {
207+
clearTimeout(timeout);
208+
timeout = undefined;
209+
}
210+
211+
if (!toastId) {
212+
// always show notification if it fails
213+
createToast();
214+
}
215+
188216
notification.update(toastId!, {
189217
render: `Font "${fontName}" extraction failed: ${err.message}`,
190218
type: notification.ERROR,

packages/project-editor/flow/runtime/wasm-runtime.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,12 @@ export class WasmRuntime extends RemoteRuntime {
175175
////////////////////////////////////////////////////////////////////////////////
176176

177177
async doStartRuntime(isDebuggerActive: boolean) {
178+
if (this.projectStore.projectTypeTraits.isLVGL) {
179+
for (const font of this.projectStore.project.fonts) {
180+
await font.getLvglBinFileAsync();
181+
}
182+
}
183+
178184
let result;
179185

180186
if (this.projectStore.context.type == "standalone") {

packages/project-editor/flow/runtime/wasm/eez_runtime.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
125 Bytes
Binary file not shown.
28 Bytes
Binary file not shown.
28 Bytes
Binary file not shown.
28 Bytes
Binary file not shown.
28 Bytes
Binary file not shown.
28 Bytes
Binary file not shown.

resources/eez-framework-amalgamation/eez-flow.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Autogenerated on March 12, 2026 12:32:35 PM from eez-framework commit ebf2121dd538ff6ac43919a4b5213a7eab566491 */
1+
/* Autogenerated on April 6, 2026 10:38:01 AM from eez-framework commit d9ff0db4a7472d1c101572ee06516c429bbdadc7 */
22
/*
33
* eez-framework
44
*
@@ -9342,7 +9342,7 @@ static FlowState *initFlowState(Assets *assets, int flowIndex, FlowState *parent
93429342
}
93439343
for (unsigned i = 0; i < flow->localVariables.count; i++) {
93449344
auto value = flow->localVariables[i];
9345-
flowState->values[flow->componentInputs.count + i] = *value;
9345+
flowState->values[flow->componentInputs.count + i] = value->clone();
93469346
}
93479347
for (unsigned i = 0; i < flow->components.count; i++) {
93489348
flowState->componenentExecutionStates[i] = nullptr;

0 commit comments

Comments
 (0)