From 5d40894a4026ab3fb960b333c76e376b9f7f7567 Mon Sep 17 00:00:00 2001 From: paul Date: Mon, 23 Sep 2024 12:31:01 +0530 Subject: [PATCH] feat: added checkbox and other widgets for tkinter --- .vscode/settings.json | 2 + README.md | 21 ++- roadmap.md | 3 +- src/canvas/canvas.js | 26 +++- src/canvas/constants/tools.js | 1 + src/canvas/toolbar.js | 12 +- src/canvas/widgets/base.js | 64 +++------ src/components/cards.js | 2 +- src/components/draggable/droppable.js | 9 +- src/components/modals.js | 51 +++++++ src/frameworks/tkinter/sidebarWidgets.js | 45 ++++++- .../tkinter/widgets/ checkButton.js | 106 +++++++++++++++ src/frameworks/tkinter/widgets/button.js | 41 ++---- src/frameworks/tkinter/widgets/input.js | 125 +++++++++++++----- src/frameworks/tkinter/widgets/label.js | 40 ++---- src/frameworks/tkinter/widgets/mainWindow.js | 30 +---- src/frameworks/tkinter/widgets/toplevel.js | 31 +---- src/utils/common.js | 51 +++++-- 18 files changed, 437 insertions(+), 223 deletions(-) create mode 100644 src/components/modals.js create mode 100644 src/frameworks/tkinter/widgets/ checkButton.js diff --git a/.vscode/settings.json b/.vscode/settings.json index 8bf92bf..5bc2692 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,3 +1,5 @@ { "prettier.configPath": ".vscode/.prettierrc", + "markdown.extension.toc.updateOnSave": false + } \ No newline at end of file diff --git a/README.md b/README.md index c2de931..50e0539 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ # PyUIBuilder - The only Python GUI builder you'll ever need +

@@ -18,6 +19,20 @@ Build Python GUI's with the ease of Canva +## Table of contents + +- [Features](#features) +- [Roadmap](#roadmap) +- [License](#license) +- [Newsletter](#newsletter) +- [FAQ](#faq) +- [License Information](#license-information) + - [Webbased Editor](#webbased-editor) + - [Electron App - Hobbyist License](#electron-app---hobbyist-license) + - [Electron App - Commercial License](#electron-app---commercial-license) + + + ## Features * Framework agnostic - Can outputs code in multiple frameworks. @@ -37,7 +52,7 @@ To learn more/ see upcoming features visit [roadmap](./roadmap.md) ## License -To support open-source and development of this tool, consider buying a one-time license. +To support open-source and development of this tool and upcoming free open-source tools, consider buying a one-time license. License will give you access to upcoming features, early access and more. @@ -66,6 +81,10 @@ Join the free newsletter to know about upcoming updates, learn how I built this [Join free newsletter](https://paulfreeman.substack.com/subscribe?utm_source=Github-Pybuilder) +#### Keep yourself updated + +To keep up with the latest developments considering starting ⭐️ this repo + ## FAQ diff --git a/roadmap.md b/roadmap.md index 538f58d..b009f45 100644 --- a/roadmap.md +++ b/roadmap.md @@ -1,12 +1,13 @@ ## Road map for PyUIBuilder -Any feature that has 👑 beside it, is meant only for [premium users](./readme.md#license--support) +Any feature that has 👑 beside it, is meant only for [premium users](./readme.md#license) ### 1.0.0 - [x] Create the initial version for UI builder ### 1.2.0 - [ ] UI fixes and enhancement +- [ ] Documentation - [ ] Tree view for elements on the canvas - [ ] Add text editor to support event handlers - [ ] Support more widgets diff --git a/src/canvas/canvas.js b/src/canvas/canvas.js index 17c9163..5cf3bc8 100644 --- a/src/canvas/canvas.js +++ b/src/canvas/canvas.js @@ -26,6 +26,7 @@ import { DragWidgetProvider } from "./widgets/draggableWidgetContext" import { PosType } from "./constants/layouts" import WidgetContainer from "./constants/containers" import { isSubClassOfWidget } from "../utils/widget" +import { ButtonModal } from "../components/modals" // const DotsBackground = require("../assets/background/dots.svg") @@ -115,8 +116,6 @@ class Canvas extends React.Component { componentDidMount() { this.initEvents() - this.createWidget(Widget) - } componentWillUnmount() { @@ -636,7 +635,7 @@ class Canvas extends React.Component { // Find the dragged widget object let dragWidgetObj = this.findWidgetFromListById(dragElementID) - console.log("Drag widget obj: ", dragWidgetObj) + // console.log("Drag widget obj: ", dragWidgetObj) if (dropWidgetObj && dragWidgetObj) { const dragWidget = this.widgetRefs[dragWidgetObj.id] @@ -713,7 +712,7 @@ class Canvas extends React.Component { throw new Error("widgetComponentType must be a subclass of Widget class") } - console.log("componete: ", widgetComponentType) + // console.log("componete: ", widgetComponentType) const widgetRef = React.createRef() @@ -759,6 +758,11 @@ class Canvas extends React.Component { let activeWidgets = removeDuplicateObjects([...widgets, this.state.selectedWidget], "__id") + this.setState({ + toolbarAttrs: null, + selectedWidget: null + }) + const widgetIds = activeWidgets.map(widget => widget.__id) for (let widgetId of widgetIds) { @@ -963,9 +967,17 @@ class Canvas extends React.Component {