Skip to content

Commit

Permalink
fix build error
Browse files Browse the repository at this point in the history
  • Loading branch information
mvladic committed Oct 17, 2024
1 parent 56556a9 commit 457e308
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 15 deletions.
7 changes: 4 additions & 3 deletions packages/home/open-projects.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,9 @@ class OpenProjectsStore {
mruItem =>
mruItem.filePath
.toLowerCase()
.indexOf(openProjectsStore.searchText.toLowerCase()) !=
-1
.indexOf(
openProjectsStore.searchText.trim().toLowerCase()
) != -1
)
.map(mruItem => ({
id: mruItem.filePath,
Expand All @@ -187,7 +188,7 @@ class OpenProjectsStore {
};

onSearchChange = (event: any) => {
this.searchText = ($(event.target).val() as string).trim();
this.searchText = $(event.target).val() as string;
if (this.allMruItems.length > 0) {
this.selectedMruItem = this.allMruItems[0].data;
}
Expand Down
59 changes: 47 additions & 12 deletions packages/project-editor/lvgl/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,7 @@ import type { Font } from "project-editor/features/font/font";
import { Page } from "project-editor/features/page/page";
import { ProjectEditor } from "project-editor/project-editor-interface";
import { Project, findAction } from "project-editor/project/project";
import {
Section,
getAncestorOfType,
getObjectPathAsString
} from "project-editor/store";
import { Section, getAncestorOfType } from "project-editor/store";
import type { LVGLWidget } from "./widgets";
import type { Assets } from "project-editor/build/assets";
import { isDev, writeTextFile } from "eez-studio-shared/util-electron";
Expand Down Expand Up @@ -484,7 +480,12 @@ export class LVGLBuild extends Build {
const pageIdentifiers =
this.lvglObjectIdentifiers.fromUserWidgets.get(flow);
if (!pageIdentifiers) {
throw "Page identifiers not found";
this.assets.projectStore.outputSectionsStore.write(
Section.OUTPUT,
MessageType.ERROR,
"Page identifiers not found",
object
);
}
return pageIdentifiers;
}
Expand All @@ -498,12 +499,19 @@ export class LVGLBuild extends Build {
}

const pageIdentifiers = this.getPageIdentifiers(widget);
if (!pageIdentifiers) {
return "";
}

const identifier = pageIdentifiers.widgetToIdentifier.get(widget);
if (identifier == undefined) {
throw `Widget identifier not found: ${getObjectPathAsString(
this.assets.projectStore.outputSectionsStore.write(
Section.OUTPUT,
MessageType.ERROR,
`Widget identifier not found`,
widget
)}`;
);
return "";
}

return identifier;
Expand All @@ -516,10 +524,20 @@ export class LVGLBuild extends Build {
}

const pageIdentifiers = this.getPageIdentifiers(widget);
if (!pageIdentifiers) {
return 0;
}

const index = pageIdentifiers.widgetToIndex.get(widget);

if (index == undefined) {
throw `Widget index not found: ${getObjectPathAsString(widget)}`;
this.assets.projectStore.outputSectionsStore.write(
Section.OUTPUT,
MessageType.ERROR,
`Widget index not found`,
widget
);
return 0;
}

return index;
Expand All @@ -531,12 +549,20 @@ export class LVGLBuild extends Build {
}

const pageIdentifiers = this.getPageIdentifiers(fromObject);

if (!pageIdentifiers) {
return 0;
}
const index = pageIdentifiers.identifiers.indexOf(objectName);

if (index == -1) {
if (!this.isFirstPass) {
throw `Widget index not found for "${objectName}"`;
this.assets.projectStore.outputSectionsStore.write(
Section.OUTPUT,
MessageType.ERROR,
`Widget index not found for "${objectName}"`,
fromObject
);
return 0;
}
}

Expand All @@ -550,10 +576,19 @@ export class LVGLBuild extends Build {
}

const pageIdentifiers = this.getPageIdentifiers(widget);
if (!pageIdentifiers) {
return 0;
}

const accessor = pageIdentifiers.widgetToAccessor.get(widget);
if (accessor == undefined) {
throw `Widget accessor not found: ${getObjectPathAsString(widget)}`;
this.assets.projectStore.outputSectionsStore.write(
Section.OUTPUT,
MessageType.ERROR,
`Widget accessor not found`,
widget
);
return "";
}

return accessor;
Expand Down

0 comments on commit 457e308

Please sign in to comment.