Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
mvladic committed Oct 11, 2024
1 parent 228164f commit f4cf371
Show file tree
Hide file tree
Showing 8 changed files with 319 additions and 37 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"author": "Envox <[email protected]>",
"description": "Cross-platform visual development tool and SCPI instrument controller",
"homepage": "https://www.envox.hr/eez/studio/studio-introduction.html",
"version": "0.18.2",
"version": "0.19.0",
"revision": "1",
"license": "GPL-3.0-only",
"repository": "https://github.com/eez-open/studio",
Expand Down
18 changes: 0 additions & 18 deletions packages/eez-studio-ui/_stylesheets/app.less
Original file line number Diff line number Diff line change
Expand Up @@ -1168,24 +1168,6 @@ button.EezStudio_Action {
padding-top: 15px;
}

.EezStudio_ToolbarNav {
padding: 3px;
background-color: @panelHeaderColor;
border-bottom: 1px solid @borderColor;

.btn {
padding: 0.25rem 0.75rem;
}

.btn-group:not(:last-child) {
margin-right: 20px;
}

select {
height: 36px;
}
}

.EezStudio_PanelHeader {
border: 0 solid @borderColor;
border-bottom-width: 1px;
Expand Down
53 changes: 51 additions & 2 deletions packages/eez-studio-ui/_stylesheets/project-editor.less
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,47 @@
}
}

.EezStudio_ProjectEditorMainContentWrapper {
.EezStudio_ProjectEditor_MainContentWrapper {
flex-grow: 1;
display: flex;
flex-direction: column;

> .EezStudio_ToolbarNav {
> .EezStudio_ProjectEditor_ToolbarNav {
padding: 3px;
background-color: @panelHeaderColor;
border-bottom: 1px solid @borderColor;
min-height: 45px;

.btn {
padding: 0.25rem 0.75rem;
}

.btn-group:not(:last-child) {
margin-right: 20px;
}

select {
height: 36px;
}

.EezStudio_ProjectEditor_ToolbarNav_EditorButtons {
@media (min-width: 1600px) {
width: 0;
}
justify-content: flex-start;
display: flex;
}

.EezStudio_ProjectEditor_ToolbarNav_RunEditSwitchControls {
display: flex;
}

.EezStudio_ProjectEditor_ToolbarNav_FlowRuntimeControls {
@media (min-width: 1600px) {
width: 0;
}
justify-content: "flex-end";
}
}
}

Expand Down Expand Up @@ -3691,3 +3725,18 @@
}
}
}

.EezStudio_LVGLBuildImageInfoDialog {
.modal-body {
font-size: 120%;

li {
margin-bottom: 20px;
}

pre {
margin: 5px 0;
user-select: text !important;
}
}
}
206 changes: 206 additions & 0 deletions packages/project-editor/lvgl/build-image-info-dialog.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,206 @@
import os from "os";
import React from "react";
import { observer } from "mobx-react";

import { Dialog, showDialog } from "eez-studio-ui/dialog";
import { makeObservable } from "mobx";

export function showBuildImageInfoDialog() {
showDialog(<BuildImageInfoDialog />);
}

const BuildImageInfoDialog = observer(
class NewLVGLActionDialog extends React.Component {
constructor(props: any) {
super(props);

makeObservable(this, {});
}

get isWindows() {
return os.platform() == "win32";
}

get isLinux() {
return os.platform() == "linux";
}

get isMac() {
return os.platform() == "darwin";
}

get pyhonInstallationInfo() {
if (this.isWindows) {
return (
<li>
<p>
<b>Python 3</b> is installed on your system
</p>
<p>
You can install it from:{" "}
<a
href="#"
onClick={event => {
event.preventDefault();
openLink(
"https://www.python.org/downloads/"
);
}}
>
https://www.python.org/downloads/
</a>
.
</p>
</li>
);
}

return (
<li>
<p>
<b>Python 3</b> is installed on your system
</p>
</li>
);
}

get pythonModulesInfo() {
if (this.isWindows) {
return (
<li>
<p>
Install <b>pypng</b> and <b>lz4</b> Python modules:
</p>
<pre>python -m pip install pypng==0.20220715.0</pre>
<pre>python -m pip install lz4</pre>
<p>
To install <b>lz4</b> module you will also need{" "}
<a
href="#"
onClick={event => {
event.preventDefault();
openLink(
"https://visualstudio.microsoft.com/visual-cpp-build-tools/"
);
}}
>
Microsoft Visual C++ Build Tools
</a>
.
</p>
</li>
);
}

if (this.isLinux) {
return (
<li>
<p>
Install <b>pypng</b> and <b>lz4</b> Python modules:
</p>
<pre>python3 -m pip install pypng==0.20220715.0</pre>
<pre>python3 -m pip install lz4</pre>
</li>
);
}

return (
<li>
<p>
Install <b>pypng</b> and <b>lz4</b> Python modules:
</p>
<pre>python3 -m pip install pypng==0.20220715.0</pre>
<pre>python3 -m pip install lz4</pre>
<p>
<a
href="#"
onClick={event => {
event.preventDefault();
openLink(
"https://github.com/eez-open/studio/issues/346"
);
}}
>
Check this
</a>{" "}
if Studio has trouble finding these modules.
</p>
</li>
);
}

get pngquantInfo() {
if (this.isLinux) {
return (
<li>
<p>
Install <b>pngquant</b> tool:
</p>
<pre>sudo apt install pngquant</pre>
</li>
);
}

if (this.isMac) {
return (
<li>
<p>
Install <b>pngquant</b> tool:
</p>
<pre>brew install pngquant</pre>
</li>
);
}

return null;
}

render() {
return (
<Dialog
modal={true}
size="large"
title={
"An error occured while building images for the LVGL 9.x!"
}
cancelButtonText="Close"
className="EezStudio_LVGLBuildImageInfoDialog"
>
<p>
To convert images to C source files, EEZ Studio is using{" "}
<a
href="#"
onClick={event => {
event.preventDefault();
openLink(
"https://github.com/lvgl/lvgl/blob/master/scripts/LVGLImage.py"
);
}}
>
LVGLImage.py
</a>{" "}
script provided by the LVGL team.
</p>

<p>
To be able to execute this script the following
requirements must be fulfilled:
</p>

<ol>
{this.pyhonInstallationInfo}
{this.pythonModulesInfo}
{this.pngquantInfo}
</ol>

<div className="EezStudio_LVGLBuildImageInfo"></div>
</Dialog>
);
}
}
);

function openLink(url: string) {
const { shell } = require("electron");
shell.openExternal(url);
}
10 changes: 10 additions & 0 deletions packages/project-editor/lvgl/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import {
import { sourceRootDir } from "eez-studio-shared/util";
import { getSelectorBuildCode } from "project-editor/lvgl/style-helper";
import type { LVGLGroup } from "./groups";
import { showBuildImageInfoDialog } from "./build-image-info-dialog";

export class LVGLBuild extends Build {
project: Project;
Expand Down Expand Up @@ -1371,6 +1372,8 @@ extern const ext_img_desc_t images[${this.bitmaps.length || 1}];
return;
}

let showInfoDialog = false;

await Promise.all(
this.bitmaps.map(bitmap =>
(async () => {
Expand Down Expand Up @@ -1411,10 +1414,17 @@ ${source}`;
MessageType.ERROR,
`Error genereting bitmap file '${output}.c': ${err}`
);
if (this.isV9) {
showInfoDialog = true;
}
}
})()
)
);

if (showInfoDialog) {
showBuildImageInfoDialog();
}
}

async copyFontFiles() {
Expand Down
2 changes: 1 addition & 1 deletion packages/project-editor/project/ui/ProjectEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export const ProjectEditorView = observer(

return (
<div className="EezStudio_ProjectEditorWrapper">
<div className="EezStudio_ProjectEditorMainContentWrapper">
<div className="EezStudio_ProjectEditor_MainContentWrapper">
{this.props.showToolbar && <Toolbar />}
<Content />
</div>
Expand Down
17 changes: 4 additions & 13 deletions packages/project-editor/project/ui/Toolbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export const Toolbar = observer(
}

return (
<nav className="navbar justify-content-between EezStudio_ToolbarNav">
<nav className="navbar justify-content-between EezStudio_ProjectEditor_ToolbarNav">
{showEditorButtons ? <EditorButtons /> : <div />}

{showRunEditSwitchControls ? (
Expand All @@ -132,10 +132,7 @@ export const Toolbar = observer(
<div />
)}

<div
className="EezStudio_FlowRuntimeControls"
style={{ width: 0, justifyContent: "flex-end" }}
>
<div className="EezStudio_ProjectEditor_ToolbarNav_FlowRuntimeControls">
{globalVariablesStatuses}
</div>
</nav>
Expand Down Expand Up @@ -257,13 +254,7 @@ const EditorButtons = observer(
);

return (
<div
style={{
width: 0,
justifyContent: "flex-start",
display: "flex"
}}
>
<div className="EezStudio_ProjectEditor_ToolbarNav_EditorButtons">
{!this.context.runtime && (
<div className="btn-group" role="group">
<IconAction
Expand Down Expand Up @@ -845,7 +836,7 @@ const RunEditSwitchControls = observer(
render() {
const iconSize = 30;
return (
<div className="EezStudio_ProjectEditor_RunEditSwitchControls d-flex">
<div className="EezStudio_ProjectEditor_ToolbarNav_RunEditSwitchControls">
<ButtonAction
text="Edit"
title="Enter edit mode (Shift+F5)"
Expand Down
Loading

0 comments on commit f4cf371

Please sign in to comment.