Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
mvladic committed Nov 8, 2024
1 parent 3ed3d37 commit 683d0e8
Show file tree
Hide file tree
Showing 31 changed files with 887 additions and 741 deletions.
285 changes: 202 additions & 83 deletions package-lock.json

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@
"@types/pg": "^8.6.5",
"@types/plotly.js-dist-min": "^2.3.4",
"@types/react": "^18.2.0",
"@types/react-color": "^3.0.6",
"@types/react-dom": "^18.2.0",
"@types/react-virtualized-auto-sizer": "^1.0.1",
"@types/react-window": "^1.8.5",
Expand Down Expand Up @@ -123,6 +122,7 @@
"@emotion/react": "^11.11.0",
"@popperjs/core": "^2.9.2",
"@types/d3-format": "^3.0.4",
"@uiw/react-color-chrome": "^2.3.2",
"adm-zip": "^0.5.9",
"app-module-path": "^2.2.0",
"archiver": "^5.3.0",
Expand Down Expand Up @@ -166,10 +166,9 @@
"python-shell": "^3.0.1",
"quill": "^1.3.7",
"react": "^18.2.0",
"react-color": "^2.19.3",
"react-dom": "^18.2.0",
"react-select": "^5.8.1",
"react-toastify": "^8.2.0",
"react-toastify": "^10.0.6",
"react-virtualized-auto-sizer": "^1.0.7",
"react-window": "^1.8.8",
"rimraf": "^3.0.2",
Expand Down
11 changes: 5 additions & 6 deletions packages/eez-studio-ui/_stylesheets/project-editor.less
Original file line number Diff line number Diff line change
Expand Up @@ -540,13 +540,12 @@
}

.EezStudio_ThemedColorInput_DropdownContent {
font-size: 0.8rem;

padding: 0;
margin: 0;
background: transparent;
border: none;

border-radius: 4px;
overflow: hidden;
.w-color-chrome {
color: #333;
}
}

.EezStudio_ObjectReferenceInput_DropdownButton {
Expand Down
6 changes: 3 additions & 3 deletions packages/eez-studio-ui/generic-dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ export const GenericDialog = observer(
this.errorMessages = undefined;

if (this.props.setOnChangeCallback) {
this.props.setOnChangeCallback(this.onChange.bind(this));
this.props.setOnChangeCallback(this.onChange);
}
}

Expand Down Expand Up @@ -320,7 +320,7 @@ export const GenericDialog = observer(
return true;
}

onChange(fieldProperties: any, value: any) {
onChange = (fieldProperties: any, value: any) => {
this.fieldValues[fieldProperties.name] = value;

if (this.errorMessages) {
Expand All @@ -337,7 +337,7 @@ export const GenericDialog = observer(
}

this.progressType = "none";
}
};

validate() {
let errorMessages: any;
Expand Down
10 changes: 2 additions & 8 deletions packages/eez-studio-ui/properties-electron.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,7 @@ export const FileInputProperty = observer(
},
{}
> {
constructor(props: any) {
super(props);

this.onSelectFile = this.onSelectFile.bind(this);
}

async onSelectFile(event: any) {
onSelectFile = async (event: any) => {
event.preventDefault();

const result = await dialog.showOpenDialog(getCurrentWindow(), {
Expand All @@ -36,7 +30,7 @@ export const FileInputProperty = observer(
if (filePaths && filePaths[0]) {
this.props.onChange(filePaths[0]);
}
}
};

render() {
let id = this.props.id || guid();
Expand Down
12 changes: 5 additions & 7 deletions packages/eez-studio-ui/properties.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -665,11 +665,9 @@ export const KeybindingProperty = observer(
makeObservable(this, {
keybinding: computed
});

this.onKeyDown = this.onKeyDown.bind(this);
}

onKeyDown(event: any) {
onKeyDown = (event: any) => {
if (
event.nativeEvent.key === "Escape" ||
event.nativeEvent.key === "Enter" ||
Expand Down Expand Up @@ -715,7 +713,7 @@ export const KeybindingProperty = observer(
}

this.props.onChange(keybinding.join("+"));
}
};

get keybinding() {
return (
Expand Down Expand Up @@ -946,7 +944,7 @@ export class AbsoluteFileInputProperty extends React.Component<
},
{}
> {
async onSelect() {
onSelect = async () => {
const result = await dialog.showOpenDialog({
properties: ["openFile"],
filters: [{ name: "All Files", extensions: ["*"] }]
Expand All @@ -955,7 +953,7 @@ export class AbsoluteFileInputProperty extends React.Component<
if (result.filePaths && result.filePaths[0]) {
this.props.onChange(result.filePaths[0]);
}
}
};

render() {
return (
Expand All @@ -968,7 +966,7 @@ export class AbsoluteFileInputProperty extends React.Component<
<button
className="btn btn-secondary"
type="button"
onClick={this.onSelect.bind(this)}
onClick={this.onSelect}
>
&hellip;
</button>
Expand Down
Loading

0 comments on commit 683d0e8

Please sign in to comment.