84 Commits

Author SHA1 Message Date
paul
eff608b9f5 updated tailwind build 2025-04-04 17:54:14 +05:30
paul
9efcd8a9c6 add tutorials and discord invite 2025-04-04 07:32:59 +05:30
paul
6af1d1f6e5 asset upload 2025-04-03 23:03:30 +05:30
paul
07f1320f6d added details 2025-04-03 21:09:21 +05:30
paul
5211faf140 working on landing page 2025-04-03 19:13:51 +05:30
paul
1f709a10be added contributing and updated readme 2025-04-03 09:13:30 +05:30
paul
382675c1ba fixed entry widget 2025-04-02 18:00:10 +05:30
paul
495083b416 fixed build command 2025-04-02 11:44:23 +05:30
paul
9dbfdacd9f fixed build step 2025-04-02 11:41:36 +05:30
paul
95321ced95 fixed peer conflicts 2025-04-02 11:35:15 +05:30
paul
d03c3de36b added override for picomatch 2025-04-02 11:15:30 +05:30
paul
fd78229570 fixed pickomatch 2025-04-02 06:01:16 +05:30
paul
e06a105a68 fixed package.json 2025-04-02 05:55:55 +05:30
paul
a82960ca15 added node version 2025-04-02 05:22:22 +05:30
paul
20d21c210e fixed webpack 2025-04-01 22:14:02 +05:30
paul
f1eddf1821 fixed build 2025-04-01 21:15:37 +05:30
paul
fff10097fd updated after time 2025-04-01 20:47:25 +05:30
paul
d10928bb5a fixed padx/y and ipadx/y 2025-04-01 20:42:14 +05:30
paul
0243b3b9e8 added license comment 2025-04-01 19:00:20 +05:30
paul
66d7dfc45f added webpack and fixed ImageLabel 2025-04-01 18:50:14 +05:30
paul
a38cd90c16 working on label image resize fix 2025-03-31 20:38:25 +05:30
paul
bdd3bab3a5 corrected grid weight and grid config position in toolbar 2025-03-30 05:46:03 +05:30
paul
53aaa8a670 fix: fixed grid row col on load 2025-03-30 05:23:18 +05:30
paul
64631caaaa fix: fixed setState warning 2025-03-29 21:03:02 +05:30
paul
8e1f042350 fix: fixed parentLayout taking place on changing layout 2025-03-29 21:00:45 +05:30
paul
128a7c49b9 updated readme 2025-03-28 18:48:41 +05:30
paul
e0fa421459 Merge branch 'customtk-fixes' 2025-03-28 17:14:51 +05:30
paul
0438480620 fixes: corrected tk to ctk in customtk 2025-03-28 17:14:03 +05:30
Art/Paul
d64f87847c Merge pull request #12 from PaulleDemon/customtk-fixes
fixing customtk layout
2025-03-28 17:13:21 +05:30
paul
c6fd4a8275 fixing customtk layout 2025-03-28 15:56:17 +05:30
paul
bfeb1c55b9 added discord invite 2025-03-28 11:17:48 +05:30
paul
9949fb8335 updated manifest 2025-03-27 18:43:56 +05:30
paul
86f84ef998 updated premium message 2025-03-27 17:18:30 +05:30
paul
fc68d407b7 added discord invite 2025-03-27 15:31:27 +05:30
paul
16e0b5862e fixe: the grid layout manager is now hidden when its pack 2025-03-27 07:15:17 +05:30
paul
d36fca5cc6 force renderTkinterLayout error if its not defined for elements with layout 2025-03-26 20:57:45 +05:30
paul
7f379c0ae6 fixed width and height problem with frame 2025-03-26 19:12:11 +05:30
paul
45847df63d fixed small bug related to expandValue for flexGrow / expand 2025-03-26 15:23:08 +05:30
paul
c177a16b33 fixed anchor and side for flex layout 2025-03-26 15:08:25 +05:30
paul
92a967721a added anchor code 2025-03-25 21:01:39 +05:30
paul
1b8ab3938d added label anchor 2025-03-25 20:53:38 +05:30
paul
dcc90dd954 added main window and toplevel logo 2025-03-25 19:11:37 +05:30
paul
565b69db9f fixed flex side issue 2025-03-25 15:34:18 +05:30
paul
5004dd140e fixed uncontrolled input radio list 2025-03-25 05:24:37 +05:30
paul
ede5f276cf fixed sticky problem for grid 2025-03-24 21:04:49 +05:30
paul
c7d30dc392 fixed tkinter output code for grid layout 2025-03-24 19:21:50 +05:30
paul
8b386e3263 worked on grid configure weights 2025-03-24 15:50:46 +05:30
paul
1912e53672 working on grid 2025-03-23 19:02:54 +05:30
paul
b9139469d4 fix: fixed input cursor problem 2025-03-22 21:16:13 +05:30
paul
c2b0532e96 fix: grid view count 2025-03-22 11:11:19 +05:30
paul
22718369e1 fixed resizing handles issue 2025-03-21 09:10:48 +05:30
paul
4403c27c76 fixed tkinter pack layout 2025-03-20 11:58:22 +05:30
paul
14866c8aaf worked on tkinter pack layout 2025-03-20 11:25:07 +05:30
paul
4a85f86c95 working on anchor 2025-03-18 21:29:41 +05:30
paul
a4365861c9 fix: fixed issue with pack manager 2025-03-18 18:08:25 +05:30
paul
81ddfc58c5 fix: added initialPosition to createWidget 2025-03-16 15:43:41 +05:30
paul
5f2d80755e fix: fixed uncontrolled state updates 2025-03-16 10:01:35 +05:30
paul
ee57b43d0e centered widget on open 2025-03-14 16:42:27 +05:30
paul
dc892e6f61 added demo video 2025-03-14 11:21:08 +05:30
paul
9fad1bc5a1 redid the waitlist 2025-03-11 20:18:52 +05:30
paul
ddb1bcae97 added waitlist 2025-03-11 19:12:45 +05:30
paul
e8ab297af0 updated readme 2025-03-11 14:54:31 +05:30
paul
94850c99b1 updated styling 2025-03-11 14:14:52 +05:30
Art/Paul
6d6ce019f1 Merge pull request #10 from PaulleDemon/styling-fixes
styling updates
2025-03-11 14:06:07 +05:30
paul
b3ab3b1193 styling updates 2025-03-11 14:00:09 +05:30
paul
81c3056a10 fixed display name in treeview 2025-03-11 07:23:17 +05:30
paul
80c384a57a Fixed small bugs with resizable rendering 2025-03-11 06:41:52 +05:30
paul
769615c2cc fixed sidebar drag and drop issue 2025-03-10 19:10:36 +05:30
paul
cce577add3 added panToWidget on Double click tree view 2025-03-10 11:58:27 +05:30
paul
16bfd244e6 fixed code engine bugs 2025-03-10 10:37:57 +05:30
paul
d1ef2fa3f8 fixed drag and drop issue 2025-03-09 17:48:23 +05:30
paul
b1abb4651d fixed plugin request yml 2025-03-09 12:24:21 +05:30
paul
da25b7692e added plugin request template 2025-03-09 12:15:45 +05:30
paul
0a2a8601c1 added tree view 2025-03-09 11:07:08 +05:30
paul
0f7d9944a8 working on sidebar and widget context 2025-03-08 20:11:22 +05:30
paul
aa54f9b0bb fixed swapping 2025-03-08 12:02:00 +05:30
paul
6aff8d37e4 removed console statements 2025-03-07 18:29:07 +05:30
paul
217dedc121 fixed drag and drop problem when within parent and dragImage problem 2025-03-07 17:09:35 +05:30
paul
71c2bfd949 fixed resize handles clipping problem 2025-03-07 05:26:36 +05:30
paul
76dd829a78 added a small message 2025-03-06 21:41:54 +05:30
paul
9439eface6 working on resize handler fix 2025-03-06 21:38:23 +05:30
paul
2898bdd817 fixing the resizable div 2025-03-06 19:20:40 +05:30
paul
f3cd37b1f9 fixed drag position 2025-03-06 14:32:00 +05:30
paul
ed333d6ee6 fixed Relief string 2025-01-01 16:43:25 +05:30
95 changed files with 15651 additions and 7049 deletions

View File

@@ -0,0 +1,27 @@
name: Plugin Request
description: Request support for a third-party library
title: "[Plugin Request]: "
labels: ["plugin"]
assignees:
- PaulleDemon
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to request a new plugin.
- type: input
id: plugin
attributes:
label: Name of the plugin
placeholder: Enter the plugin name
validations:
required: true
- type: input
id: plugin-link
attributes:
label: Link to the plugin
placeholder: Enter the plugin link
validations:
required: true

1
.gitignore vendored
View File

@@ -7,6 +7,7 @@
.env-cmdrc.json
build
dist
python-tests/

1
.nvmrc Normal file
View File

@@ -0,0 +1 @@
20

12
CONTRIBUTING.md Normal file
View File

@@ -0,0 +1,12 @@
## Contributing
Currently if you find bugs or typos, I request you to create an issue first, instead of a Pull request.
That is the best way to contribute to this repo in it's current state.
I may not get time to review every pull request, unless you are bringing in significant improvement that would have probably taken me weeks to do it myself, I may not be able to take time out of development to review it and don't take closing pull request personally. It's just that I currently don't have time.
Thank you for understanding.
## Other ways to contribute.
1. Creating tutorials and helping others on [discord server](https://discord.gg/dHXjrrCA7G)
2. Sharing the tool with others.

View File

@@ -5,11 +5,10 @@ Below is the License for source code of PyUIBuilder. For license regarding sourc
-----------------------
The source code for PyUIBuilder is Dual licensed, most parts of the code comes under AGPL,
The source code for PyUIBuilder is Dual licensed, some parts of the code comes under AGPL,
some parts under a different non-commercial use license. Read the second part after the definition of the AGPL license.
Sub-folders with non-commercial use license will contain the second license as well.
- Only the code inside src/canvas/ is kept under a non-commercial use license.
--------------------------
@@ -678,17 +677,11 @@ For more information on this, and how to apply and follow the GNU AGPL, see
--------------------------
Below is the license for code under src/canvas/
License for non-commercial use in short
* You are free fork, modify and redistribute it given the original or derived works is kept free and open-source and under the same licese.
* Another restriction is you can't redistribute in binary or executable formats without asking me first.
* If you plan on making money on this work or derived work you need permission first.
License was planned to be kept under one AGPL or less restrictive license, but since its difficult for me to continue providing free and open-source software without proper funding. It's under this license.
Once there enough money to fund this project and my upcoming FOSS projects, The license will be brought back to a single AGPL or much lesser restrictive license. The fastest way to make this happen is by purchasing a one-time license or fund me.
Read the full license below.
--------------------

View File

@@ -1,4 +1,6 @@
# PyUIBuilder - Build python GUIs like Webflow
# PyUIBuilder - Python GUI Builder
Build python GUIs like Webflow
<sub>Not affiliated to Webflow</sub>
<p align="center">
@@ -25,10 +27,10 @@ Build Python GUI's with ease of Drag and drop builders.
https://github.com/user-attachments/assets/ac91aa98-843d-4578-b646-88e66bc113de
<sub>**Don't like background music? fell free to mute it**</sub>
<sub>**Don't like background music? feel free to mute it**</sub>
## Try PyUIBuilder
Try [PyUIBuilder](https://pyuibuilder.pages.dev/)
Try [PyUIBuilder](https://pyuibuilder.com)
## Table of contents
@@ -49,9 +51,12 @@ Try [PyUIBuilder](https://pyuibuilder.pages.dev/)
- [Author](#author)
## Tutorials
1. Youtube - [PyUibuilder playlist](https://youtube.com/playlist?list=PL0VamwghCfX-KXtGKGLak-C_-Jcx_eOiK&si=vnVr8vdU_JkIEL2f)
2. [Creating sign up form Blog](https://medium.com/python-in-plain-english/create-tkinter-guis-using-tkinter-gui-builder-pyuibuilder-a7422489c55e)
## Docs - Getting started
Read the docs on the [Docs page](https://pyuibuilder-docs.pages.dev/)
Read the docs on the [Docs page](https://docs.pyuibuilder.com/)
## Example app
@@ -107,7 +112,7 @@ While there are a lot of features, here are few you need to know.
* Framework agnostic - Can outputs code in multiple frameworks.
* Pre-built UI widgets
* Plugins to extend 3rd party UI libraries
* Supports layout managers, such as flex, grid and absolute positioning [read docs](https://pyuibuilder-docs.pages.dev/)
* Supports layout managers, such as flex, grid and absolute positioning [read docs](https://docs.pyuibuilder.com/)
* Generates python Code.
* Support to upload local assets.
* Generates requirements.txt file when needed
@@ -121,7 +126,6 @@ While there are a lot of features, here are few you need to know.
## Roadmap
Here are some of the upcoming features.
* Treeview on the sidebar
* Support for Event Handlers
* Kivy Framework support
* Pyqt/PySide Support
@@ -129,13 +133,13 @@ Here are some of the upcoming features.
To learn more/ see upcoming features visit [roadmap](./roadmap.md)
To stay in loop, subscribe to the free [newsletter](https://paulfreeman.substack.com/subscribe?utm_source=Github-Pybuilder)
To stay in loop, subscribe to the free [newsletter](https://tally.so/r/mVDY7N)
## License - Fund the development
Help fund open-source work and development of this and upcoming projects by purchasing a one-time license.
Help fund development of this and upcoming projects by purchasing a one-time license.
Purchasing License will allow me to focus on development of this tool and provide you access to more advance features, early access and more.
Purchasing License will give you discounted price and provide you access to more advance features, early access and more.
The discount's will be available for limited time only on pre-orders.
@@ -146,6 +150,7 @@ The discount's will be available for limited time only on pre-orders.
| **Lifetime license** (one-time purchase) | 👍️ | ✅ | ✅ |
| **Early access** to upcoming features | ❌ | ✅ | ✅ |
| **Downloadable Electron App** (upcoming) | ❌ | ✅ | ✅ |
| **Premium widgets**(tabbed widget, scroll widget etc) (upcoming) | ❌ | ✅ | ✅ |
| **Run Preview live**(upcoming) | ❌ | ✅ | ✅ |
| **Save and Load UI files** (upcoming) | ❌ | ✅ | ✅ |
| **Load 3rd party plugins locally** | ❌ | ✅ | ✅ |

View File

@@ -10,7 +10,7 @@ Let's start with the basics of UI
![Layout basics](./assets/basics.jpg)
1. The sidebar on the left will have multiple buttons, each button will provide you with necessary tools.
1. The sidebar on the left will have multiple tabs, each tabs will provide you with necessary tools.
2. The Place where you drag and drop widgets is the canvas
3. The toolbar will only appear if a widget is selected.
@@ -26,7 +26,7 @@ Things you can do on canvas.
4. Delete widgets using `del` key or right clicking on the widget
## Project name
By default all project's are named untitled project, you can change this from the header input next to export code.
By default all project's are named `"untitled project"`, you can change this from the header input next to export code.
## Selecting a UI library
You can select the UI library from the header dropdown. Once selected changing the UI library in between your work, will erase the canvas.

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

View File

@@ -3,8 +3,8 @@
--bg-color: #fff;
--btn-color: #0F1727;/* button color*/
--btn-bg: #f1efef;/* button bg color*/
--btn-color: #ffffff;/* button color*/
--btn-bg: #0F1727;/* button bg color*/
--primary-text-color: #000;
--header-link-hover: #000;
@@ -181,7 +181,7 @@ header > .collapsible-header{
}
.footer-link:hover{
color: #fff;
color: #0b0b0b;
}
/* Navigation dots styling */

View File

@@ -7,7 +7,7 @@
<meta name="description" content="A Drag and Drop builder for Python GUIs, including Tkinter, Custom Tkinter and more" />
<link
rel="shortcut icon"
href="./assets/logo/icon48.png"
href="./assets/logo/logo.png"
type="image/x-icon"
/>
@@ -15,12 +15,12 @@
<meta property="og:title" content="PyUIBuilder - A Drag and Drop builder for python GUIs" />
<meta property="og:description" content="A Drag and Drop builder for Python GUIs, including Tkinter, Custom Tkinter and more" />
<meta property="og:type" content="website" />
<meta property="og:url" content="https://github.com/PaulleDemon/PyUIBuilder" />
<meta property="og:url" content="https://about.pyuibuilder.com" />
<!--Replace with the current website url-->
<meta property="og:image" content="" />
<link rel="stylesheet" href="../tailwind/tailwind-runtime.css" />
<!-- <link rel="stylesheet" href="./css/tailwind-build.css"> -->
<!-- <link rel="stylesheet" href="../tailwind/tailwind-runtime.css" /> -->
<link rel="stylesheet" href="./css/tailwind-build.css">
<link rel="stylesheet" href="css/index.css" />
<link
@@ -66,14 +66,17 @@
<a class="header-links" href=""> About </a>
<a class="header-links" href="#pricing"> Pricing </a>
<a class="header-links" href="#features"> Features </a>
<a class="header-links" href="https://github.com/PaulleDemon/PyUIBuilder"> Github </a>
<a class="header-links" target="_blank" rel="noopener noreferrer" href="https://docs.pyuibuilder.com"> Docs </a>
<a class="header-links" target="_blank" rel="noopener noreferrer" href="https://github.com/PaulleDemon/PyUIBuilder"> Github </a>
</div>
<div
class="tw-mx-4 tw-flex tw-place-items-center tw-gap-[20px] tw-text-base max-md:tw-w-full max-md:tw-flex-col max-md:tw-place-content-center"
>
<a
href="#pricing"
href="https://pyuibuilder.com"
aria-label="start"
target="_blank"
rel="noreferrer noopener"
class="tw-rounded-md tw-border-[1px] tw-border-black
tw-bg-[#0F1727] tw-px-3 tw-py-2 tw-text-white
tw-duration-[0.3s]
@@ -130,11 +133,11 @@
class="tw-flex tw-flex-col tw-place-content-center tw-items-center"
>
<div
class="reveal-up tw-text-center tw-text-6xl tw-font-semibold tw-uppercase tw-leading-[90px]
class="tw-text-center tw-text-6xl tw-font-semibold tw-uppercase tw-leading-[90px]
max-lg:tw-text-4xl tw-text-[#0F1727]
max-md:tw-leading-snug"
>
<span class=""> Build Python UI's using <span class="tw-px-3 t"></span>
<span class=""> Build Python UI's using <span class="tw-px-3"></span>
</span>
<br />
<span class=" tw-px-3 tw-text-5xl"> Drag and Drop editor </span>
@@ -146,7 +149,7 @@
<div
class="reveal-up tw-mt-3 tw-max-w-[450px] tw-p-2 tw-text-center tw-text-gray-700 max-lg:tw-max-w-full"
>
Tired of writing code to build you python GUIs, well now you can easily
The most awaited python tool is here. Now you can use Drag and drop to build Tkinter and customTk GUIs. Soon wil be made available for kivy and PySide
</div>
<div
@@ -154,7 +157,9 @@
>
<a
class="btn !tw-bg-[#0F1727] !tw-text-white tw-shadow-lg tw-shadow-[#4d395e] tw-transition-transform tw-duration-[0.3s] hover:tw-scale-x-[1.03]"
href="#pricing"
target="_blank"
rel="noopener noreferrer"
href="https://pyuibuilder.com"
>
Start for free
</a>
@@ -183,14 +188,152 @@
<div class="tw-relative tw-bg-black tw-min-w-full tw-min-h-full tw-overflow-clip tw-rounded-md">
<!-- <iframe class="tw-absolute tw-top-[50%] tw--translate-y-[50%] tw-left-[50%] tw--translate-x-[50%] tw-w-full tw-h-full" src="https://www.youtube.com/embed/aXq0A6iJoKU?si=dF3UZT2eTRDU8u7a?si=QOMSCki8Jl30_CkW&amp;controls=1&rel=0&showinfo=0&autoplay=1&loop=1&mute=1" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe> -->
<img class="tw-object-contain tw-w-full tw-h-full"
alt="font tester gif" src="./assets/images/home/promo.gif" >
alt="Pyui gif" src="./assets/images/home/promo.gif" >
</div>
</div>
</section>
<section
class="tw-relative tw-flex tw-w-full tw-min-h-[100vh] tw-max-w-[100vw] tw-flex-col tw-place-content-center tw-place-items-center tw-overflow-hidden tw-p-8"
id="features"
>
<h2 class="tw-text-5xl tw-text-center tw-font-medium tw-uppercase">
Everything you need <br>
to perfect Python GUIs
</h2>
<div
class="tw-flex tw-flex-col tw-max-w-[1150px] max-lg:tw-max-w-full tw-h-full
tw-p-4 tw-mt-4 max-lg:tw-place-content-center tw-gap-8"
>
<div class="max-xl:tw-flex max-xl:tw-flex-col tw-place-items-center tw-grid tw-grid-cols-3 tw-gap-8
tw-place-content-center tw-auto-rows-auto">
<div class="tw-w-[350px] tw-h-[500px] max-lg:tw-h-fit tw-flex max-md:tw-w-full">
<div href="#" class=" tw-relative tw-p-10 tw-transition-all tw-duration-300 tw-group/card tw-gap-5 tw-flex
tw-flex-col tw-w-full tw-h-full tw-bg-[#f2f2f2] tw-border-2 tw-border-white tw-rounded-3xl
hover:tw-scale-[1.02]">
<div class="tw-w-full tw-min-h-[200px] tw-h-[200px] tw-overflow-hidden">
<img src="./assets/images/home/benefits/1.png"
alt="Drag and drop" class="tw-w-full tw-h-full tw-object-contain">
<!-- <i class="bi bi-grid-1x2-fill"></i> -->
</div>
<h2 class="tw-text-3xl max-md:tw-text-2xl tw-font-medium tw-uppercase">Drag and Drop editor</h2>
<p class="tw-leading-normal tw-text-gray-800 tw-overflow-clip">
Easily drag and drop desired widgets from sidebar and create beautiful Python GUI's
</p>
</div>
</div>
<div class="tw-w-[350px] tw-h-[500px] max-lg:tw-h-fit tw-flex max-md:tw-w-full">
<div href="#" class=" tw-relative tw-p-10 tw-transition-all tw-duration-300 tw-group/card tw-gap-5 tw-flex
tw-flex-col tw-w-full tw-h-full tw-bg-[#f2f2f2] tw-border-2 tw-border-white tw-rounded-3xl
hover:tw-scale-[1.02]">
<div class="tw-w-full tw-min-h-[200px] tw-h-[200px] tw-overflow-hidden">
<img src="./assets/images/home/benefits/2.png"
alt="live preview" class="tw-w-full tw-h-full tw-object-contain">
<!-- <i class="bi bi-grid-1x2-fill"></i> -->
</div>
<h2 class="tw-text-3xl max-md:tw-text-2xl tw-font-medium tw-uppercase">Support for multiple UI libraries</h2>
<p class="tw-leading-normal tw-text-gray-800 tw-overflow-clip">
We currently support multiple UI libraries such as Tkinter, CustomTk and soon will offer support for PySide and
kivy.
</p>
</div>
</div>
<div class="tw-w-[350px] tw-h-[500px] max-lg:tw-h-fit tw-flex max-md:tw-w-full">
<div href="#" class=" tw-relative tw-p-10 tw-transition-all tw-duration-300 tw-group/card tw-gap-5 tw-flex
tw-flex-col tw-w-full tw-h-full tw-bg-[#f2f2f2] tw-border-2 tw-border-white tw-rounded-3xl
hover:tw-scale-[1.02]">
<div class="tw-w-full tw-min-h-[200px] tw-h-[200px] tw-overflow-hidden">
<img src="./assets/images/home/benefits/3.png"
alt="live preview" class="tw-w-full tw-h-full tw-object-contain">
<!-- <i class="bi bi-grid-1x2-fill"></i> -->
</div>
<h2 class="tw-text-3xl max-md:tw-text-2xl tw-font-medium tw-uppercase">Supports many UI Widgets</h2>
<p class="tw-leading-normal tw-text-gray-800 tw-overflow-clip">
Our editor includes pre-defined widgets like Buttons and Labels, compatible with Pack/Flex, Grid, and absolute layouts.
</p>
</div>
</div>
<div class="tw-w-[350px] tw-h-[500px] max-lg:tw-h-fit tw-flex max-md:tw-w-full">
<div href="#" class=" tw-relative tw-p-10 tw-transition-all tw-duration-300 tw-group/card tw-gap-5 tw-flex
tw-flex-col tw-w-full tw-h-full tw-bg-[#f2f2f2] tw-border-2 tw-border-white tw-rounded-3xl
hover:tw-scale-[1.02]">
<div class="tw-w-full tw-min-h-[200px] tw-h-[200px] tw-overflow-hidden">
<img src="./assets/images/home/benefits/4.png"
alt="live preview" class="tw-w-full tw-h-full tw-object-contain">
<!-- <i class="bi bi-grid-1x2-fill"></i> -->
</div>
<h2 class="tw-text-3xl max-md:tw-text-2xl tw-font-medium tw-uppercase">Generate clean Python code</h2>
<p class="tw-leading-normal tw-text-gray-800">
Our editor doesn't just let you drag and drop, but also lets you generate clean pyhon code in
library of your choice
</p>
</div>
</div>
<div class="tw-w-[350px] tw-h-[500px] max-lg:tw-h-fit tw-flex max-md:tw-w-full">
<div href="#" class=" tw-relative tw-p-10 tw-transition-all tw-duration-300 tw-group/card tw-gap-5 tw-flex
tw-flex-col tw-w-full tw-h-full tw-bg-[#f2f2f2] tw-border-2 tw-border-white tw-rounded-3xl
hover:tw-scale-[1.02]">
<div class="tw-w-full tw-min-h-[200px] tw-h-[200px] tw-overflow-hidden">
<img src="./assets/images/home/benefits/5.png"
alt="live preview" class="tw-w-full tw-h-full tw-object-contain">
<!-- <i class="bi bi-grid-1x2-fill"></i> -->
</div>
<h2 class="tw-text-3xl max-md:tw-text-2xl tw-font-medium tw-uppercase">3rd Party Plugin support</h2>
<p class="tw-leading-normal tw-text-gray-800">
We support your favorite 3rd party widgets such as video player, Map viewer and more.
</p>
</div>
</div>
<div class="tw-w-[350px] tw-h-[500px] max-lg:tw-h-fit tw-flex max-md:tw-w-full">
<div href="#" class=" tw-relative tw-p-10 tw-transition-all tw-duration-300 tw-group/card tw-gap-5 tw-flex
tw-flex-col tw-w-full tw-h-full tw-bg-[#f2f2f2] tw-border-2 tw-border-white tw-rounded-3xl
hover:tw-scale-[1.02]">
<div class="tw-w-full tw-min-h-[200px] tw-h-[200px] tw-overflow-hidden">
<img src="./assets/images/home/benefits/6.png"
alt="live preview" class="tw-w-full tw-h-full tw-object-contain">
<!-- <i class="bi bi-grid-1x2-fill"></i> -->
</div>
<h2 class="tw-text-3xl max-md:tw-text-2xl tw-font-medium tw-uppercase">Supports asset upload</h2>
<p class="tw-leading-normal tw-text-gray-800">
Adding images and logos is important while developing GUIs so we support asset uploads.
The best part is nothing is sent to server.
</p>
</div>
</div>
</div>
</div>
<a
class="tw-mt-6 btn tw-my-6 tw-flex tw-gap-1 tw-bg-[#0F1727]
tw-transition-transform tw-duration-[0.3s] hover:tw-scale-x-[1.03] tw-group"
href="#pricing"
>
Make it yours
<i class="bi bi-arrow-right tw-transition-transform group-hover:tw-translate-x-1 tw-duration-300"></i>
</a>
</section>
<section class="tw-mt-1 tw-flex tw-w-full tw-flex-col tw-place-items-center tw-p-[2%] max-lg:tw-p-2" id="pricing">
<h3 class="tw-text-2xl tw-font-medium max-md:tw-text-2xl">Pre-order your License</h3>
<div class="tw-max-w-[650px] tw-my-2">
Pre-orders for PyUiBuilder premium features are open. Premium features will start rolling out
from mid of April phase wise. This is your last chance to get it before price increase from mid of April.
</div>
<div class="tw-mt-10 tw-flex tw-place-content-center tw-gap-8 max-lg:tw-flex-col">
<div class="tw-flex tw-w-[380px] tw-border-[1px] tw-border-gray-300 tw-border-solid tw-flex-col
tw-place-items-center tw-gap-2 tw-rounded-lg tw-p-8 tw-shadow-xl max-lg:tw-w-[340px]">
@@ -214,6 +357,10 @@
<i class="bi bi-x-circle-fill tw-text-red-600 tw-text-base"></i>
<span>Downloadable UI builder exe for local development</span>
</li>
<li class="tw-flex tw-place-items-center tw-gap-2">
<i class="bi bi-x-circle-fill tw-text-red-600 tw-text-base"></i>
<span>Premium widgets <small class="tw-text-sm">(eg: scroll widget, tab widget, Canvas etc)</small></span>
</li>
<li class="tw-flex tw-place-items-center tw-gap-2">
<i class="bi bi-x-circle-fill tw-text-red-600 tw-text-base"></i>
<span>Support for PySlide/PyQt</span>
@@ -249,7 +396,7 @@
</ul>
<a
href="https://pyuibuilder.pages.dev/"
href="https://pyuibuilder.com"
target="_blank"
rel="noreferrer noopener"
class=" !tw-bg-[#0F1727] tw-duration-[0.3s] hover:tw-transition-transform hover:tw-scale-[1.01] !tw-mt-auto !tw-text-white tw-gap-2 tw-text-lg tw-rounded-md tw-w-full tw-flex tw-place-content-center tw-p-2 tw-mx-2"
@@ -287,6 +434,10 @@
<i class="bi bi-check-circle-fill tw-text-green-600 tw-text-base"></i>
<span>Downloadable UI builder exe for local development</span>
</li>
<li class="tw-flex tw-place-items-center tw-gap-2">
<i class="bi bi-check-circle-fill tw-text-green-600 tw-text-base"></i>
<span>Premium widgets <small class="tw-text-sm">(eg: scroll widget, tab widget, Canvas etc)</small></span>
</li>
<li class="tw-flex tw-place-items-center tw-gap-2">
<i class="bi bi-check-circle-fill tw-text-green-600 tw-text-base"></i>
<span>Preview live</span>
@@ -338,7 +489,7 @@
</div>
<div class="tw-flex tw-w-[380px] tw-flex-col tw-place-items-center tw-gap-2 tw-rounded-lg tw-border-[3px] tw-border-solid
!tw-border-green-600 tw-p-8 tw-shadow-xl max-lg:tw-w-[340px]">
!tw-border-blue-600 tw-p-8 tw-shadow-xl max-lg:tw-w-[340px]">
<div class="tw-text-white tw-p-1 tw-px-3 tw-bg-blue-500 tw-rounded-full">
Limited time offer
</div>
@@ -365,6 +516,10 @@
<i class="bi bi-check-circle-fill tw-text-green-600 tw-text-base"></i>
<span>Downloadable UI builder exe for local development</span>
</li>
<li class="tw-flex tw-place-items-center tw-gap-2">
<i class="bi bi-check-circle-fill tw-text-green-600 tw-text-base"></i>
<span>Premium widgets <small class="tw-text-sm">(eg: scroll widget, tab widget, Canvas etc)</small></span>
</li>
<li class="tw-flex tw-place-items-center tw-gap-2">
<i class="bi bi-check-circle-fill tw-text-green-600 tw-text-base"></i>
<span>Preview live</span>
@@ -483,25 +638,82 @@
<div
class="faq-accordion tw-flex tw-w-full tw-select-none tw-text-xl max-md:tw-text-lg"
>
<span>Where can I find the upcoming features?</span>
<span>When will premium features roll out</span>
<i class="bi bi-plus tw-ml-auto tw-font-semibold"></i>
</div>
<div class="content">
You can find the upcoming features on the
<a
target="_blank"
rel="noopener noreferrer"
href="https://github.com/PaulleDemon/font-tester-chrome/blob/main/roadmap.md"
class="tw-underline"
>Roadmap</a
>
Premium features will start rolling out from mid of April in phase wise.
</div>
</div>
<div
class="faq tw-w-full"
>
<div
class="faq-accordion tw-flex tw-w-full tw-select-none tw-text-xl max-md:tw-text-lg"
>
<span>Can I get a free license?</span>
<i class="bi bi-plus tw-ml-auto tw-font-semibold"></i>
</div>
<div class="content">
Yes, we have a program by which you can get a free license, <a href="https://tally.so/r/mJM22X">read more</a>
</div>
</div>
</div>
<div class="tw-flex tw-flex-col tw-gap-2 tw-place-items-center tw-mt-4">
<div class="tw-text-2xl">Want more help?</div>
<a class="btn hover:tw-scale-[1.02] tw-duration-75" target="_blank" rel="noopener noreferrer"
href="https://discord.gg/dHXjrrCA7G">Discord invite</a>
</div>
</section>
<section
class="tw-flex tw-w-full tw-flex-col tw-place-content-center tw-place-items-center tw-gap-[5%] tw-p-[3%] tw-px-[10%]"
id="blog-section"
>
<h3 class="tw-text-4xl tw-font-medium tw-text-gray-800 max-md:tw-text-2xl">Blogs & Tutorials</h3>
<div class="tw-mt-5 tw-flex tw-gap-8 tw-place-items-center max-lg:tw-flex-col
tw-place-content-center tw-min-h-[300px] tw-w-full">
<div class="tw-flex tw-gap-4" id="blogs">
</div>
<a href="https://youtu.be/MkeMv0X-w_4?si=qeutS58Js7Padd9m&t=49" target="_blank" rel="noopener noreferrer"
class="tw-w-[350px] tw-min-w-[350px] tw-max-w-[350px] max-lg:tw-w-full tw-h-[360px] tw-shadow-xl tw-rounded-md tw-overflow-hidden">
<div class="tw-h-[230px] tw-w-full tw-bg-gray-800 tw-flex tw-place-content-center">
<img src="https://img.youtube.com/vi/MkeMv0X-w_4/hqdefault.jpg"
alt="" class="tw-object-contain tw-w-full">
</div>
<div class="tw-flex tw-flex-col tw-gap-2 tw-p-3">
<h3 class="tw-text-lg tw-font-medium">Introduction to PyUiBuilder - YouTube</h3>
<p class="tw-text-bg-gray-500">Introduction to PyUIBuilder</p>
</div>
</a>
<a href="https://youtu.be/4w3Oy17FE8U?si=-0V0cD5DQAEzCkKm" target="_blank" rel="noopener noreferrer"
class="tw-w-[350px] tw-min-w-[350px] tw-max-w-[350px] max-lg:tw-w-full tw-h-[360px] tw-shadow-xl tw-rounded-md tw-overflow-hidden">
<div class="tw-h-[230px] tw-w-full tw-bg-gray-800 tw-flex tw-place-content-center">
<img src="https://img.youtube.com/vi/4w3Oy17FE8U/hqdefault.jpg"
alt="" class="tw-object-contain tw-w-full">
</div>
<div class="tw-flex tw-flex-col tw-gap-2 tw-p-3">
<h3 class="tw-text-lg tw-font-medium">Create Signup form using PyUIBuilder - YouTube</h3>
<p class="tw-text-bg-gray-500">Learn how to use this tool, via practical example</p>
</div>
</a>
</div>
</section>
<section
class="tw-flex tw-w-full tw-flex-col tw-place-content-center tw-place-items-center tw-gap-2 tw-p-[3%] tw-px-[10%]"
>
<h3 class="tw-text-xl">Get updates right in your mailbox</h3>
<button class="btn hover:tw-scale-[1.05] tw-duration-75" data-tally-open="mVDY7N" data-tally-layout="modal" data-tally-hide-title="1" data-tally-emoji-text="👋" data-tally-emoji-animation="wave" data-tally-auto-close="0">
Get updates
</button>
</section>
<footer
class="tw-mt-auto tw-flex tw-w-full tw-place-content-around tw-gap-3 tw-p-[5%] tw-px-[10%] tw-text-black max-md:tw-flex-col"
@@ -549,7 +761,7 @@
<div class="tw-flex tw-flex-col tw-gap-3 max-md:tw-text-sm">
<a href="#features" class="footer-link">Features</a>
<a href="#pricing" class="footer-link">Pricing</a>
<a href="https://github.com/PaulleDemon/font-tester-chrome/blob/main/roadmap.md" class="footer-link">Roadmap</a>
<a href="https://github.com/PaulleDemon/PyUIBuilder/blob/main/roadmap.md" class="footer-link">Roadmap</a>
</div>
</div>
@@ -557,12 +769,43 @@
<div class="tw-flex tw-flex-col tw-gap-3 max-md:tw-text-sm">
<a href="" class="footer-link">About</a>
<a href="#faq" class="footer-link">FAQ</a>
<a href="https://github.com/PaulleDemon/font-tester-chrome" class="footer-link">Github</a>
<a href="https://github.com/PaulleDemon/font-tester-chrome" class="footer-link">Report issue</a>
<a href="https://github.com/PaulleDemon/PyUIBuilder" class="footer-link">Github</a>
<a href="https://github.com/PaulleDemon/PyUIBuilder/issues" class="footer-link">Report issue</a>
<a href="https://discord.gg/dHXjrrCA7G" class="footer-link">Discord invite</a>
</div>
</div>
</footer>
</body>
<script async src="https://tally.so/widgets/embed.js"></script>
<script>
const blogsList = [
{
"title": "How to create Signup form - Blog",
"description": "If your starting out with tkinter, it can be overwhelming without prior understanding of GUIs....",
"url": "https://medium.com/python-in-plain-english/create-tkinter-guis-using-tkinter-gui-builder-pyuibuilder-a7422489c55e",
"image_url": "https://miro.medium.com/v2/resize:fit:720/format:webp/1*BaSis1UO3_zJeQtCnOe3Qg.png"
},
]
const blogContainer = document.getElementById('blogs');
blogContainer.innerHTML = blogsList.map(blog => {
return (`
<a href="${blog.url}" target="_blank" rel="noopener noreferrer"
class="tw-w-[350px] tw-h-[360px] tw-shadow-xl tw-rounded-md tw-overflow-hidden">
<div class="tw-h-[230px] tw-w-full tw-bg-gray-800 tw-flex tw-place-content-center">
<img src="${blog.image_url}" alt="${blog.title}" class="tw-object-contain tw-w-full">
</div>
<div class="tw-flex tw-flex-col tw-gap-2 tw-p-3">
<h3 class="tw-text-lg tw-font-medium">${blog.title}</h3>
<p class="tw-text-bg-gray-500">${blog.description}</p>
</div>
</a>
`)
}).join('')
</script>
<script
src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.0/gsap.min.js"

File diff suppressed because one or more lines are too long

View File

@@ -107,7 +107,7 @@
}
/*
! tailwindcss v3.4.13 | MIT License | https://tailwindcss.com
! tailwindcss v3.4.17 | MIT License | https://tailwindcss.com
*/
/*
@@ -541,7 +541,7 @@ video {
/* Make elements with the HTML hidden attribute stay hidden by default */
[hidden] {
[hidden]:where(:not([hidden="until-found"])) {
display: none;
}
@@ -619,6 +619,20 @@ video {
margin-right: 1rem;
}
.tw-my-2 {
margin-top: 0.5rem;
margin-bottom: 0.5rem;
}
.tw-my-6 {
margin-top: 1.5rem;
margin-bottom: 1.5rem;
}
.\!tw-mt-auto {
margin-top: auto !important;
}
.tw-ml-auto {
margin-left: auto;
}
@@ -643,6 +657,10 @@ video {
margin-top: 1.25rem;
}
.tw-mt-6 {
margin-top: 1.5rem;
}
.tw-mt-8 {
margin-top: 2rem;
}
@@ -651,14 +669,14 @@ video {
margin-top: auto;
}
.\!tw-mt-auto {
margin-top: auto !important;
}
.tw-flex {
display: flex;
}
.tw-grid {
display: grid;
}
.\!tw-hidden {
display: none !important;
}
@@ -683,10 +701,18 @@ video {
height: 150px;
}
.tw-h-\[200px\] {
height: 200px;
}
.tw-h-\[40px\] {
height: 40px;
}
.tw-h-\[500px\] {
height: 500px;
}
.tw-h-\[50px\] {
height: 50px;
}
@@ -707,6 +733,14 @@ video {
height: 100%;
}
.tw-h-\[230px\] {
height: 230px;
}
.tw-h-\[360px\] {
height: 360px;
}
.tw-max-h-\[120px\] {
max-height: 120px;
}
@@ -727,6 +761,10 @@ video {
min-height: 100vh;
}
.tw-min-h-\[200px\] {
min-height: 200px;
}
.tw-min-h-\[300px\] {
min-height: 300px;
}
@@ -739,22 +777,18 @@ video {
min-height: 550px;
}
.tw-min-h-\[60vh\] {
min-height: 60vh;
}
.tw-min-h-\[70vh\] {
min-height: 70vh;
}
.tw-min-h-full {
min-height: 100%;
}
.tw-min-h-\[80vh\] {
min-height: 80vh;
}
.tw-min-h-full {
min-height: 100%;
}
.tw-w-8 {
width: 2rem;
}
@@ -767,6 +801,10 @@ video {
width: 250px;
}
.tw-w-\[350px\] {
width: 350px;
}
.tw-w-\[380px\] {
width: 380px;
}
@@ -791,10 +829,18 @@ video {
min-width: 100%;
}
.tw-min-w-\[350px\] {
min-width: 350px;
}
.tw-max-w-\[100vw\] {
max-width: 100vw;
}
.tw-max-w-\[1150px\] {
max-width: 1150px;
}
.tw-max-w-\[120px\] {
max-width: 120px;
}
@@ -803,6 +849,10 @@ video {
max-width: 450px;
}
.tw-max-w-\[650px\] {
max-width: 650px;
}
.tw-max-w-\[80vw\] {
max-width: 80vw;
}
@@ -811,6 +861,10 @@ video {
max-width: 850px;
}
.tw-max-w-\[350px\] {
max-width: 350px;
}
.tw--translate-x-1\/2 {
--tw-translate-x: -50%;
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
@@ -856,6 +910,14 @@ video {
user-select: none;
}
.tw-auto-rows-auto {
grid-auto-rows: auto;
}
.tw-grid-cols-3 {
grid-template-columns: repeat(3, minmax(0, 1fr));
}
.tw-flex-col {
flex-direction: column;
}
@@ -920,6 +982,10 @@ video {
gap: 20px;
}
.tw-gap-\[5\%\] {
gap: 5%;
}
.tw-overflow-hidden {
overflow: hidden;
}
@@ -940,6 +1006,10 @@ video {
text-wrap: wrap;
}
.tw-rounded-3xl {
border-radius: 1.5rem;
}
.tw-rounded-full {
border-radius: 9999px;
}
@@ -968,10 +1038,6 @@ video {
border-width: 1px;
}
.tw-border-4 {
border-width: 4px;
}
.tw-border-\[3px\] {
border-width: 3px;
}
@@ -984,65 +1050,65 @@ video {
border-style: solid;
}
.\!tw-border-white {
--tw-border-opacity: 1 !important;
border-color: rgb(255 255 255 / var(--tw-border-opacity)) !important;
}
.tw-border-black {
--tw-border-opacity: 1;
border-color: rgb(0 0 0 / var(--tw-border-opacity));
}
.tw-border-blue-500 {
--tw-border-opacity: 1;
border-color: rgb(59 130 246 / var(--tw-border-opacity));
}
.tw-border-gray-300 {
--tw-border-opacity: 1;
border-color: rgb(209 213 219 / var(--tw-border-opacity));
}
.tw-border-green-600 {
--tw-border-opacity: 1;
border-color: rgb(22 163 74 / var(--tw-border-opacity));
}
.tw-border-white {
--tw-border-opacity: 1;
border-color: rgb(255 255 255 / var(--tw-border-opacity));
}
.\!tw-border-\[\#0F1727\] {
--tw-border-opacity: 1 !important;
border-color: rgb(15 23 39 / var(--tw-border-opacity)) !important;
border-color: rgb(15 23 39 / var(--tw-border-opacity, 1)) !important;
}
.\!tw-border-green-600 {
--tw-border-opacity: 1 !important;
border-color: rgb(22 163 74 / var(--tw-border-opacity)) !important;
border-color: rgb(22 163 74 / var(--tw-border-opacity, 1)) !important;
}
.\!tw-bg-\[\#7E22CE\] {
.tw-border-black {
--tw-border-opacity: 1;
border-color: rgb(0 0 0 / var(--tw-border-opacity, 1));
}
.tw-border-gray-300 {
--tw-border-opacity: 1;
border-color: rgb(209 213 219 / var(--tw-border-opacity, 1));
}
.tw-border-white {
--tw-border-opacity: 1;
border-color: rgb(255 255 255 / var(--tw-border-opacity, 1));
}
.\!tw-border-blue-600 {
--tw-border-opacity: 1 !important;
border-color: rgb(37 99 235 / var(--tw-border-opacity, 1)) !important;
}
.\!tw-bg-\[\#0F1727\] {
--tw-bg-opacity: 1 !important;
background-color: rgb(126 34 206 / var(--tw-bg-opacity)) !important;
background-color: rgb(15 23 39 / var(--tw-bg-opacity, 1)) !important;
}
.\!tw-bg-gray-100 {
--tw-bg-opacity: 1 !important;
background-color: rgb(243 244 246 / var(--tw-bg-opacity)) !important;
background-color: rgb(243 244 246 / var(--tw-bg-opacity, 1)) !important;
}
.\!tw-bg-purple-500 {
--tw-bg-opacity: 1 !important;
background-color: rgb(168 85 247 / var(--tw-bg-opacity)) !important;
background-color: rgb(168 85 247 / var(--tw-bg-opacity, 1)) !important;
}
.\!tw-bg-transparent {
background-color: transparent !important;
}
.tw-bg-\[\#0F1727\] {
--tw-bg-opacity: 1;
background-color: rgb(15 23 39 / var(--tw-bg-opacity, 1));
}
.tw-bg-\[\#eeeeee\] {
--tw-bg-opacity: 1;
background-color: rgb(238 238 238 / var(--tw-bg-opacity, 1));
}
.tw-bg-\[\#f0f0f0ef\] {
background-color: #f0f0f0ef;
}
@@ -1053,49 +1119,37 @@ video {
.tw-bg-black {
--tw-bg-opacity: 1;
background-color: rgb(0 0 0 / var(--tw-bg-opacity));
background-color: rgb(0 0 0 / var(--tw-bg-opacity, 1));
}
.tw-bg-blue-500 {
--tw-bg-opacity: 1;
background-color: rgb(59 130 246 / var(--tw-bg-opacity));
background-color: rgb(59 130 246 / var(--tw-bg-opacity, 1));
}
.tw-bg-gray-100 {
--tw-bg-opacity: 1;
background-color: rgb(243 244 246 / var(--tw-bg-opacity));
background-color: rgb(243 244 246 / var(--tw-bg-opacity, 1));
}
.tw-bg-green-700 {
--tw-bg-opacity: 1;
background-color: rgb(21 128 61 / var(--tw-bg-opacity));
}
.tw-bg-transparent {
background-color: transparent;
background-color: rgb(21 128 61 / var(--tw-bg-opacity, 1));
}
.tw-bg-white {
--tw-bg-opacity: 1;
background-color: rgb(255 255 255 / var(--tw-bg-opacity));
background-color: rgb(255 255 255 / var(--tw-bg-opacity, 1));
}
.\!tw-bg-\[\#0F1727\] {
--tw-bg-opacity: 1 !important;
background-color: rgb(15 23 39 / var(--tw-bg-opacity)) !important;
}
.tw-bg-\[\#0F1727\] {
.tw-bg-\[\#f2f2f2\] {
--tw-bg-opacity: 1;
background-color: rgb(15 23 39 / var(--tw-bg-opacity));
background-color: rgb(242 242 242 / var(--tw-bg-opacity, 1));
}
.\!tw-bg-\[\#\#0F1727\] {
background-color: ##0F1727 !important;
}
.tw-bg-\[\#\#0F1727\] {
background-color: ##0F1727;
.tw-bg-gray-800 {
--tw-bg-opacity: 1;
background-color: rgb(31 41 55 / var(--tw-bg-opacity, 1));
}
.tw-bg-opacity-0 {
@@ -1110,6 +1164,10 @@ video {
padding: 0.25rem;
}
.tw-p-10 {
padding: 2.5rem;
}
.tw-p-2 {
padding: 0.5rem;
}
@@ -1118,6 +1176,10 @@ video {
padding: 0.75rem;
}
.tw-p-4 {
padding: 1rem;
}
.tw-p-6 {
padding: 1.5rem;
}
@@ -1138,6 +1200,10 @@ video {
padding: 5%;
}
.tw-p-\[3\%\] {
padding: 3%;
}
.tw-px-2 {
padding-left: 0.5rem;
padding-right: 0.5rem;
@@ -1167,6 +1233,10 @@ video {
text-align: center;
}
.tw-align-middle {
vertical-align: middle;
}
.\!tw-text-4xl {
font-size: 2.25rem !important;
line-height: 2.5rem !important;
@@ -1216,6 +1286,11 @@ video {
line-height: 1.75rem;
}
.tw-text-sm {
font-size: 0.875rem;
line-height: 1.25rem;
}
.tw-text-xl {
font-size: 1.25rem;
line-height: 1.75rem;
@@ -1233,10 +1308,6 @@ video {
font-weight: 600;
}
.\!tw-font-medium {
font-weight: 500 !important;
}
.tw-uppercase {
text-transform: uppercase;
}
@@ -1250,84 +1321,73 @@ video {
line-height: 90px;
}
.\!tw-text-black {
--tw-text-opacity: 1 !important;
color: rgb(0 0 0 / var(--tw-text-opacity)) !important;
}
.\!tw-text-blue-500 {
--tw-text-opacity: 1 !important;
color: rgb(59 130 246 / var(--tw-text-opacity)) !important;
}
.\!tw-text-white {
--tw-text-opacity: 1 !important;
color: rgb(255 255 255 / var(--tw-text-opacity)) !important;
}
.tw-text-black {
--tw-text-opacity: 1;
color: rgb(0 0 0 / var(--tw-text-opacity));
}
.tw-text-gray-200 {
--tw-text-opacity: 1;
color: rgb(229 231 235 / var(--tw-text-opacity));
}
.tw-text-gray-300 {
--tw-text-opacity: 1;
color: rgb(209 213 219 / var(--tw-text-opacity));
}
.tw-text-gray-400 {
--tw-text-opacity: 1;
color: rgb(156 163 175 / var(--tw-text-opacity));
}
.tw-text-gray-600 {
--tw-text-opacity: 1;
color: rgb(75 85 99 / var(--tw-text-opacity));
}
.tw-text-gray-700 {
--tw-text-opacity: 1;
color: rgb(55 65 81 / var(--tw-text-opacity));
}
.tw-text-green-600 {
--tw-text-opacity: 1;
color: rgb(22 163 74 / var(--tw-text-opacity));
}
.tw-text-purple-500 {
--tw-text-opacity: 1;
color: rgb(168 85 247 / var(--tw-text-opacity));
}
.tw-text-red-600 {
--tw-text-opacity: 1;
color: rgb(220 38 38 / var(--tw-text-opacity));
}
.tw-text-white {
--tw-text-opacity: 1;
color: rgb(255 255 255 / var(--tw-text-opacity));
.tw-leading-normal {
line-height: 1.5;
}
.\!tw-text-\[\#0F1727\] {
--tw-text-opacity: 1 !important;
color: rgb(15 23 39 / var(--tw-text-opacity)) !important;
color: rgb(15 23 39 / var(--tw-text-opacity, 1)) !important;
}
.\!tw-text-black {
--tw-text-opacity: 1 !important;
color: rgb(0 0 0 / var(--tw-text-opacity, 1)) !important;
}
.\!tw-text-blue-500 {
--tw-text-opacity: 1 !important;
color: rgb(59 130 246 / var(--tw-text-opacity, 1)) !important;
}
.\!tw-text-white {
--tw-text-opacity: 1 !important;
color: rgb(255 255 255 / var(--tw-text-opacity, 1)) !important;
}
.tw-text-\[\#0F1727\] {
--tw-text-opacity: 1;
color: rgb(15 23 39 / var(--tw-text-opacity));
color: rgb(15 23 39 / var(--tw-text-opacity, 1));
}
.tw-text-black {
--tw-text-opacity: 1;
color: rgb(0 0 0 / var(--tw-text-opacity, 1));
}
.tw-text-gray-600 {
--tw-text-opacity: 1;
color: rgb(75 85 99 / var(--tw-text-opacity, 1));
}
.tw-text-gray-700 {
--tw-text-opacity: 1;
color: rgb(55 65 81 / var(--tw-text-opacity, 1));
}
.tw-text-gray-800 {
--tw-text-opacity: 1;
color: rgb(31 41 55 / var(--tw-text-opacity));
color: rgb(31 41 55 / var(--tw-text-opacity, 1));
}
.tw-text-green-600 {
--tw-text-opacity: 1;
color: rgb(22 163 74 / var(--tw-text-opacity, 1));
}
.tw-text-purple-500 {
--tw-text-opacity: 1;
color: rgb(168 85 247 / var(--tw-text-opacity, 1));
}
.tw-text-red-600 {
--tw-text-opacity: 1;
color: rgb(220 38 38 / var(--tw-text-opacity, 1));
}
.tw-text-white {
--tw-text-opacity: 1;
color: rgb(255 255 255 / var(--tw-text-opacity, 1));
}
.tw-underline {
@@ -1364,16 +1424,17 @@ video {
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
}
.tw-shadow-\[\#7E22CE\] {
--tw-shadow-color: #7E22CE;
--tw-shadow: var(--tw-shadow-colored);
}
.tw-shadow-\[\#4d395e\] {
--tw-shadow-color: #4d395e;
--tw-shadow: var(--tw-shadow-colored);
}
.tw-transition-all {
transition-property: all;
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
transition-duration: 150ms;
}
.tw-transition-colors {
transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
@@ -1392,12 +1453,6 @@ video {
transition-duration: 150ms;
}
.tw-transition-all {
transition-property: all;
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
transition-duration: 150ms;
}
.tw-duration-300 {
transition-duration: 300ms;
}
@@ -1410,9 +1465,8 @@ video {
transition-duration: 0.3s;
}
.hover\:tw-translate-x-1:hover {
--tw-translate-x: 0.25rem;
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
.tw-duration-75 {
transition-duration: 75ms;
}
.hover\:tw-translate-x-2:hover {
@@ -1432,6 +1486,18 @@ video {
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
}
.hover\:tw-scale-\[1\.05\]:hover {
--tw-scale-x: 1.05;
--tw-scale-y: 1.05;
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
}
.hover\:tw-scale-\[1\.1\]:hover {
--tw-scale-x: 1.1;
--tw-scale-y: 1.1;
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
}
.hover\:tw-scale-x-\[1\.03\]:hover {
--tw-scale-x: 1.03;
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
@@ -1439,47 +1505,22 @@ video {
.hover\:\!tw-bg-gray-100:hover {
--tw-bg-opacity: 1 !important;
background-color: rgb(243 244 246 / var(--tw-bg-opacity)) !important;
background-color: rgb(243 244 246 / var(--tw-bg-opacity, 1)) !important;
}
.hover\:\!tw-bg-gray-300:hover {
--tw-bg-opacity: 1 !important;
background-color: rgb(209 213 219 / var(--tw-bg-opacity)) !important;
background-color: rgb(209 213 219 / var(--tw-bg-opacity, 1)) !important;
}
.hover\:\!tw-bg-white:hover {
--tw-bg-opacity: 1 !important;
background-color: rgb(255 255 255 / var(--tw-bg-opacity)) !important;
}
.hover\:tw-bg-white:hover {
--tw-bg-opacity: 1;
background-color: rgb(255 255 255 / var(--tw-bg-opacity));
}
.hover\:tw-bg-black:hover {
--tw-bg-opacity: 1;
background-color: rgb(0 0 0 / var(--tw-bg-opacity));
}
.hover\:tw-bg-\[\#0F1727\]:hover {
--tw-bg-opacity: 1;
background-color: rgb(15 23 39 / var(--tw-bg-opacity));
background-color: rgb(255 255 255 / var(--tw-bg-opacity, 1)) !important;
}
.hover\:\!tw-text-black:hover {
--tw-text-opacity: 1 !important;
color: rgb(0 0 0 / var(--tw-text-opacity)) !important;
}
.hover\:tw-text-black:hover {
--tw-text-opacity: 1;
color: rgb(0 0 0 / var(--tw-text-opacity));
}
.hover\:tw-text-white:hover {
--tw-text-opacity: 1;
color: rgb(255 255 255 / var(--tw-text-opacity));
color: rgb(0 0 0 / var(--tw-text-opacity, 1)) !important;
}
.hover\:tw-transition-transform:hover {
@@ -1488,9 +1529,14 @@ video {
transition-duration: 150ms;
}
.tw-group:hover .group-hover\:tw-translate-x-1 {
--tw-translate-x: 0.25rem;
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
}
.dark\:tw-bg-\[\#16171A\]:is(.tw-dark *) {
--tw-bg-opacity: 1;
background-color: rgb(22 23 26 / var(--tw-bg-opacity));
background-color: rgb(22 23 26 / var(--tw-bg-opacity, 1));
}
.dark\:tw-bg-\[\#80808085\]:is(.tw-dark *) {
@@ -1498,6 +1544,14 @@ video {
}
@media not all and (min-width: 1280px) {
.max-xl\:tw-flex {
display: flex;
}
.max-xl\:tw-flex-col {
flex-direction: column;
}
.max-xl\:tw-place-items-center {
place-items: center;
}
@@ -1520,6 +1574,10 @@ video {
height: auto;
}
.max-lg\:tw-h-fit {
height: fit-content;
}
.max-lg\:tw-min-h-\[250px\] {
min-height: 250px;
}
@@ -1528,10 +1586,6 @@ video {
min-height: 400px;
}
.max-lg\:tw-min-h-\[60vh\] {
min-height: 60vh;
}
.max-lg\:tw-min-h-\[80vh\] {
min-height: 80vh;
}
@@ -1556,6 +1610,10 @@ video {
flex-direction: column;
}
.max-lg\:tw-place-content-center {
place-content: center;
}
.max-lg\:tw-place-items-end {
place-items: end;
}

15687
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -5,6 +5,10 @@
"engines": {
"node": ">=18"
},
"overrides": {
"picomatch": "^3.0.0",
"postcss-selector-parser": "7.1.0"
},
"dependencies": {
"@ant-design/icons": "^5.4.0",
"@dnd-kit/core": "^6.1.0",
@@ -22,6 +26,7 @@
"fabric": "^6.1.0",
"file-saver": "^2.0.5",
"jszip": "^3.10.1",
"lodash": "^4.17.21",
"postcss-cli": "^11.0.0",
"re-resizable": "^6.9.17",
"react": "^18.3.1",
@@ -34,9 +39,9 @@
"web-vitals": "^2.1.4"
},
"scripts": {
"start": "react-scripts start",
"build": "GENERATE_SOURCEMAP=false react-scripts build",
"build:local": "GENERATE_SOURCEMAP=false env-cmd -e production react-scripts build",
"start": "env-cmd -e development cross-env NODE_ENV=development webpack serve",
"build": "NODE_ENV=production webpack",
"build:local": "env-cmd -e production cross-env NODE_ENV=production webpack",
"test": "react-scripts test",
"eject": "react-scripts eject",
"start:tailwind": "cross-env NODE_ENV=development tailwindcss --postcss -i ./landingpages/tailwind/tailwind.css -o ./landingpages/tailwind/tailwind-runtime.css -w",
@@ -62,8 +67,29 @@
]
},
"devDependencies": {
"ajv": "^7.2.4",
"@babel/core": "^7.26.10",
"@babel/preset-env": "^7.26.9",
"@babel/preset-react": "^7.26.3",
"@svgr/webpack": "^8.1.0",
"@types/react": "^18.3.20",
"ajv": "^8.17.1",
"babel-loader": "^10.0.0",
"clean-webpack-plugin": "^4.0.0",
"copy-webpack-plugin": "^13.0.0",
"css-loader": "^7.1.2",
"css-minimizer-webpack-plugin": "^7.0.2",
"docsify-cli": "^4.4.4",
"typescript": "^4.9.5"
"file-loader": "^6.2.0",
"html-webpack-plugin": "^5.6.3",
"mini-css-extract-plugin": "^2.9.2",
"raw-loader": "^4.0.2",
"react-app-rewired": "^2.2.1",
"sass-loader": "^16.0.5",
"style-loader": "^4.0.0",
"terser-webpack-plugin": "^5.3.14",
"typescript": "^4.9.5",
"webpack": "^5.98.0",
"webpack-cli": "^6.0.1",
"webpack-dev-server": "^5.2.1"
}
}

View File

@@ -2,29 +2,31 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<link rel="icon" href="favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Web site created using create-react-app"
content="A python GUI builder. Create tkinter, Customtk, Kivy and PySide using GUI builder"
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<link rel="apple-touch-icon" href="logo192.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<link rel="manifest" href="manifest.json" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-icons/1.11.3/font/bootstrap-icons.min.css" integrity="sha512-dPXYcDub/aeb08c63jRq/k6GaKccl256JQy/AnOq7CAnEZ9FzSL9wSbcZkMp4R26vBsMLFYH4kQ67/bbV8XaCQ==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<script async src="https://tally.so/widgets/embed.js"></script>
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=%REACT_APP_ANALYTICS_SCRIPT_ID%"></script>
<script async src="https://www.googletagmanager.com/gtag/js?id=<%= REACT_APP_ANALYTICS_SCRIPT_ID %>"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '%REACT_APP_ANALYTICS_SCRIPT_ID%');
gtag('config', '<%= REACT_APP_ANALYTICS_SCRIPT_ID %>');
</script>
<!--
Notice the use of %PUBLIC_URL% in the tags above.
@@ -42,5 +44,6 @@
<div id="root"></div>
</body>
<!-- Author: Paul Github: PaulleDemon -->
</html>

View File

@@ -1,6 +1,6 @@
{
"short_name": "React App",
"name": "Create React App Sample",
"short_name": "PyUiBuilder",
"name": "PyUiBuilder - Python GUI Builder",
"icons": [
{
"src": "favicon.ico",

View File

@@ -9,11 +9,11 @@ Any feature that has 👑 beside it, is meant only for [premium users](./README.
### 1.2.0
- [ ] UI fixes and enhancement
- [ ] Documentation
- [ ] Tree view for elements on the canvas
- [X] Tree view for elements on the canvas
- [ ] Add text editor to support event handlers
- [ ] Support for Event handlers
- [ ] Support more pre-built widgets such as ttk.Notebook, multi-page etc.
- [ ] Rewrite DND for better feedback - (swappy/react-dnd-kit/ GSAP draggable)
- [ ] Rewrite DND for better feedback - (swappy/react-dnd-kit/ GSAP draggable) - least priority
- [ ] Duplicate widgets
### 1.5.0

View File

@@ -4,7 +4,7 @@
*/
import { useEffect, useRef, useState } from 'react'
import { LayoutFilled, ProductFilled, CloudUploadOutlined, DatabaseFilled } from "@ant-design/icons"
import { LayoutFilled, ProductFilled, CloudUploadOutlined, DatabaseFilled, AlignLeftOutlined } from "@ant-design/icons"
// import { DndContext, useSensors, useSensor, PointerSensor, closestCorners, DragOverlay, rectIntersection } from '@dnd-kit/core'
// import { snapCenterToCursor } from '@dnd-kit/modifiers'
@@ -31,6 +31,10 @@ import generateTkinterCode from './frameworks/tkinter/engine/code'
import TkMainWindow from './frameworks/tkinter/widgets/mainWindow'
import CTkMainWindow from './frameworks/customtk/widgets/mainWindow'
import TreeviewContainer from './sidebar/treeviewContainer'
import { WidgetContextProvider } from './canvas/context/widgetContext'
import { isChromium } from './utils/system'
import { Modal } from 'antd'
function App() {
@@ -42,6 +46,8 @@ function App() {
const [projectName, setProjectName] = useState('untitled project')
const [UIFramework, setUIFramework] = useState(FrameWorks.TKINTER)
const [shownNotChromiumAlert, setShownNotChromiumAlert] = useState(false) // if the user isn't using a chromium based browser alerts the user
// const [uploadedAssets, setUploadedAssets] = useState([]) // a global storage for assets, since redux can't store files(serialize files)
@@ -53,6 +59,28 @@ function App() {
// NOTE: the below reference is no longer required
const [canvasWidgets, setCanvasWidgets] = useState([]) // contains the reference to the widgets inside the canvas
useEffect(() => {
if (!shownNotChromiumAlert){
// this modal may rerender twice only in dev mode because of how react works
isChromium().then((isChrome) => {
if (!isChrome){
Modal.warning({
title: "Use Chromium browser",
onOk: () => setShownNotChromiumAlert(true),
content: (<span>We recommend using Chromium based browser such as Chrome, Brave, Edge etc for best results.
<br />
Join us on
<a href="https://discord.gg/dHXjrrCA7G" target='_blank' rel='noreferrer noopener'> Discord</a> for help and updates</span>)
})
}
})
}
setShownNotChromiumAlert(true)
}, [shownNotChromiumAlert])
const sidebarTabs = [
{
name: "Widgets",
@@ -64,6 +92,11 @@ function App() {
icon: <ProductFilled />,
content: <PluginsContainer sidebarContent={sidebarPlugins}/>
},
{
name: "Tree view",
icon: <AlignLeftOutlined />,
content: <TreeviewContainer />
},
{
name: "Uploads",
icon: <CloudUploadOutlined />,
@@ -78,15 +111,59 @@ function App() {
useEffect(() => {
if (!canvasRef)
return
const canvasBoundingBox = canvasRef.current.getCanvasContainerBoundingRect()
const canvasCenterX = (canvasBoundingBox.width - canvasBoundingBox.left) / 2
const canvasCenterY = (canvasBoundingBox.height - canvasBoundingBox.top) / 2
// console.log("position: ", TkMainWindow.)
if (UIFramework === FrameWorks.TKINTER){
canvasRef?.current?.createWidget(TkMainWindow)
const widgetCenterX = (TkMainWindow.initialSize.width - canvasBoundingBox.left) / 2
const widgetCenterY = (TkMainWindow.initialSize.height - canvasBoundingBox.top) / 2
canvasRef?.current?.createWidget(TkMainWindow, {x: canvasCenterX - widgetCenterX, y: canvasCenterY - widgetCenterY}, ({id, widgetRef}) => {
// center the widget when adding to canvas
if (!widgetRef.current){
return
}
const widgetBoundingBox = widgetRef.current?.getBoundingRect()
const widgetCenterX = (widgetBoundingBox.width - widgetBoundingBox.left) / 2
const widgetCenterY = (widgetBoundingBox.height - widgetBoundingBox.top) / 2
// widgetRef.current?.setPos(canvasCenterX-widgetCenterX, canvasCenterY-widgetCenterY)
})
}else if (UIFramework === FrameWorks.CUSTOMTK){
canvasRef?.current?.createWidget(CTkMainWindow)
const widgetCenterX = (TkMainWindow.initialSize.width - canvasBoundingBox.left) / 2
const widgetCenterY = (TkMainWindow.initialSize.height - canvasBoundingBox.top) / 2
canvasRef?.current?.createWidget(CTkMainWindow, {x: canvasCenterX - widgetCenterX, y: canvasCenterY - widgetCenterY}, ({id, widgetRef}) => {
// center the widget when adding to canvas
if (!widgetRef.current){
return
}
const widgetBoundingBox = widgetRef.current?.getBoundingRect()
const widgetCenterX = (widgetBoundingBox.width - widgetBoundingBox.left) / 2
const widgetCenterY = (widgetBoundingBox.height - widgetBoundingBox.top) / 2
// widgetRef.current?.setPos(canvasCenterX-widgetCenterX, canvasCenterY-widgetCenterY)
})
}
}, [UIFramework])
}, [UIFramework, canvasRef])
// const handleDragStart = (event) => {
// console.log("Drag start: ", event)
@@ -207,17 +284,21 @@ function App() {
onOk={handleOk} okType={okButtonType} onCancel={handleCancel}>
<p>Are you sure you want to change the framework? This will clear the canvas.</p>
</Modal> */}
<WidgetContextProvider>
<DragProvider>
<div className="tw-w-full tw-h-[94vh] tw-flex">
<Sidebar tabs={sidebarTabs}/>
{/* <ActiveWidgetProvider> */}
<Canvas ref={canvasRef} widgets={canvasWidgets} onWidgetAdded={handleWidgetAddedToCanvas}/>
<Canvas ref={canvasRef} widgets={canvasWidgets}
/>
{/* </ActiveWidgetProvider> */}
</div>
{/* dragOverlay (dnd-kit) helps move items from one container to another */}
</DragProvider>
</WidgetContextProvider>
</div>
)
}

View File

@@ -12,6 +12,7 @@ License in short
* You are free fork, modify and redistribute it given the original or derived works is kept free and open-source and under the same licese.
* Another restriction is you can't redistribute in binary or executable formats without asking me first.
* If you plan on making money on this work or derived work you need permission first.
* No AI Training on this source code
License was planned to be kept under one AGPL or less restrictive license, but since its difficult for me to continue providing free and open-source software without proper funding. It's under this license.

File diff suppressed because it is too large Load Diff

View File

@@ -11,6 +11,8 @@ const Tools = {
LAYOUT_MANAGER: "layout_manager",
UPLOADED_LIST: "uploaded_list",
CUSTOM: "Custom"
}

View File

@@ -0,0 +1,18 @@
import React, { createContext, useContext, useState } from 'react';
const selectedWidgetContext = createContext()
export const useSelectedWidgetContext = () => useContext(selectedWidgetContext)
// NOTE: not in use
export const SelectedWidgetProvider = ({ children }) => {
const [selectedWidget, setSelectedWidget] = useState(null)
// const []
return (
<selectedWidgetContext.Provider value={{ selectedWidget, setSelectedWidget }}>
{children}
</selectedWidgetContext.Provider>
)
}

View File

@@ -1,35 +1,23 @@
import React, { createContext, Component } from 'react'
import React, { createContext, useContext, useEffect, useRef, useState } from 'react'
const WidgetContext = createContext()
export const WidgetContext = createContext()
// NOTE: Don't use this context provider
export const useWidgetContext = () => useContext(WidgetContext)
class WidgetProvider extends Component {
state = {
activeWidget: null, // Keeps track of the active widget's data
widgetMethods: null, // Function to update active widget's state
}
setActiveWidget = (widgetData, widgetMethods) => {
this.setState({
activeWidget: widgetData,
widgetMethods: widgetMethods, // Store the update function of the active widget
})
}
export const WidgetContextProvider = ({ children }) => {
const [activeWidget, setActiveWidget] = useState(null)
const [widgets, setWidgets] = useState([]) // stores the mapping to widgetRefs, stores id and WidgetType, later used for rendering [{id: , widgetType: WidgetClass, children: [], parent: "", initialData: {}}]
render() {
return (
<WidgetContext.Provider
value={{
activeWidget: this.state.activeWidget,
setActiveWidget: this.setActiveWidget,
widgetMethods: this.state.widgetMethods, // Expose the update function
}}
>
{this.props.children}
</WidgetContext.Provider>
)
}
// don't useState here because the refs are changing often
const widgetRefs = useRef({}) // stores the actual refs to the widgets inside the canvas {id: ref, id2, ref2...}
return (
<WidgetContext.Provider value={{ widgets, setWidgets, widgetRefs,
activeWidget, setActiveWidget }}>
{children}
</WidgetContext.Provider>
)
}
export { WidgetContext, WidgetProvider }

View File

@@ -16,6 +16,8 @@ const ResizeWidgetContainer = ({selectedWidget, onResize}) => {
const [pos, setPos] = useState({x: 0, y: 0})
const [size, setSize] = useState({width: 0, height: 0})
console.log("selected widget: ", selectedWidget)
useEffect(() => {
if (selectedWidget){
@@ -25,15 +27,15 @@ const ResizeWidgetContainer = ({selectedWidget, onResize}) => {
console.log("selected widget resizable: ", selectedWidget)
}, [selectedWidget, selectedWidget?.getPos(), selectedWidget?.getSize()])
}, [selectedWidget])
console.log("pos: ", pos, size)
return (
<div className={`tw-absolute tw-bg-transparent tw-top-[-20px] tw-left-[-20px] tw-opacity-100
tw-w-full tw-h-full tw-z-[-1] tw-border-2 tw-border-solid tw-border-blue-500`}
<div className={`tw-absolute tw-opacity-100
tw-w-full tw-h-full tw-z-[2] tw-border-2 tw-border-solid tw-border-blue-500 tw-bg-red-300`}
style={{
top: `${pos.y - 40}px`,
top: `${pos.y - 20}px`,
left: `${pos.x - 20}px`,
width: `${size.width + 40}px`,
height: `${size.height + 40}px`,

View File

@@ -1,4 +1,4 @@
import { memo, useEffect, useMemo, useState } from "react"
import { memo, useEffect, useMemo, useRef, useState } from "react"
import {
Checkbox, ColorPicker, Input,
@@ -12,26 +12,67 @@ import { Layouts } from "./constants/layouts.js"
import { DynamicRadioInputList } from "../components/inputs.js"
import { useFileUploadContext } from "../contexts/fileUploadContext.js"
import { AudioOutlined, FileImageOutlined, FileTextOutlined, VideoCameraOutlined } from "@ant-design/icons"
import { useWidgetContext } from "./context/widgetContext.js"
// FIXME: Maximum recursion error
// FIXME: Every time the parent attrs are changed a remount happens, which causes input cursor to go to the end
/**
*
* @param {boolean} isOpen
* @param {string} widgetType
* @param {object} attrs - widget attributes
*/
const CanvasToolBar = memo(({ isOpen, widgetType, attrs = {} }) => {
const CanvasToolBar = memo(({ isOpen, widgetType, }) => {
// const { activeWidgetAttrs } = useActiveWidget()
const {activeWidget} = useWidgetContext()
// console.log("active widget context: ", activeWidgetAttrs)
const [toolbarOpen, setToolbarOpen] = useState(isOpen)
const [toolbarAttrs, setToolbarAttrs] = useState(attrs)
const [toolbarAttrs, setToolbarAttrs] = useState({})
const focusedInputRef = useRef()
const [cursorPos, setCursorPos] = useState(0) // store cursor position for focused input so during remount if the cursor position goes to end we can use this
const [activeInputKey, setActiveInputKey] = useState(null)
const {uploadedAssets} = useFileUploadContext()
useEffect(() => {
const stateUpdatedCallback = () => {
setToolbarAttrs(activeWidget.getToolbarAttrs())
}
if (activeWidget){
activeWidget.stateChangeSubscriberCallback(stateUpdatedCallback)
// console.log("sytate update: ", activeWidget.getToolbarAttrs())
setToolbarAttrs(activeWidget.getToolbarAttrs())
}
}, [activeWidget, focusedInputRef, cursorPos]) // , activeWidget?.state
useEffect(() => {
setToolbarOpen(isOpen)
}, [isOpen])
useEffect(() => {
if (focusedInputRef.current?.input && activeInputKey) {
// this fixes the cursor going to the end issue during remount
focusedInputRef.current.setSelectionRange(cursorPos, cursorPos)
}
}, [toolbarAttrs, focusedInputRef, cursorPos])
// useEffect(() => {
// setToolbarAttrs(activeWidget.getToolbarAttrs())
// }, [])
const uploadItems = useMemo(() => {
const returnComponentBasedOnFileType = (file) => {
@@ -81,19 +122,30 @@ const CanvasToolBar = memo(({ isOpen, widgetType, attrs = {} }) => {
}, [uploadedAssets])
useEffect(() => {
setToolbarOpen(isOpen)
}, [isOpen])
const handleInputFocus = (key, event) => {
useEffect(() => {
setToolbarAttrs(attrs)
}, [attrs])
const {value, target} = event
setActiveInputKey(key)
setCursorPos(target.selectionStart)
focusedInputRef.current = event.target
}
const handleInputBlur = () => {
setActiveInputKey(null);
focusedInputRef.current = null;
}
const handleChange = (value, callback) => {
if (callback) {
callback(value)
}
if (focusedInputRef.current?.input) {
setCursorPos(focusedInputRef.current.input.selectionStart)
}else{
setCursorPos(0)
}
}
function getUploadFileFromName(name){
@@ -119,6 +171,7 @@ const CanvasToolBar = memo(({ isOpen, widgetType, attrs = {} }) => {
placeholder="select content"
showSearch
className="tw-w-full"
notFoundContent="Start uploading from uploads tab"
value={val.value?.name || ""}
onChange={(value) => {
@@ -165,7 +218,7 @@ const CanvasToolBar = memo(({ isOpen, widgetType, attrs = {} }) => {
onChange={(value) => handleChange({ ...val.value, direction: value }, val.onChange)}
/>
</div>
<div className="tw-flex tw-flex-col tw-gap-1">
{/* <div className="tw-flex tw-flex-col tw-gap-1">
<span className="tw-text-sm">Align items</span>
<Select
options={[
@@ -178,7 +231,7 @@ const CanvasToolBar = memo(({ isOpen, widgetType, attrs = {} }) => {
placeholder={`${val.label}`}
onChange={(value) => handleChange({ ...val.value, align: value }, val.onChange)}
/>
</div>
</div> */}
<div className="tw-flex tw-flex-col">
<span className="tw-text-sm">Gap</span>
<InputNumber
@@ -186,6 +239,9 @@ const CanvasToolBar = memo(({ isOpen, widgetType, attrs = {} }) => {
min={1}
value={val.value?.gap || 10}
size="small"
onFocus={(e) => handleInputFocus(val.label, e)}
onBlur={handleInputBlur}
ref={activeInputKey === val.label ? focusedInputRef : null}
onChange={(value) => {
handleChange({ ...val.value, gap: value }, val.onChange)
}}
@@ -235,6 +291,18 @@ const CanvasToolBar = memo(({ isOpen, widgetType, attrs = {} }) => {
}
const renderCustomTool = (val) => {
return (
// NOTE: custom components must accept value and onChange
<val.Component
{...val.toolProps}
value={val.value}
onChange={(value) => handleChange(value, val.onChange)}>
</val.Component>
)
}
const renderTool = (keyName, val) => {
return (
@@ -242,6 +310,10 @@ const CanvasToolBar = memo(({ isOpen, widgetType, attrs = {} }) => {
{val.tool === Tools.INPUT && (
<Input
{...val.toolProps}
// value={val.value}
onFocus={(event) => handleInputFocus(val.label, event)}
onBlur={handleInputBlur}
ref={activeInputKey === val.label ? focusedInputRef : null}
value={val.value}
onChange={(e) => handleChange(e.target.value, val.onChange)}
/>
@@ -252,6 +324,9 @@ const CanvasToolBar = memo(({ isOpen, widgetType, attrs = {} }) => {
{...val.toolProps}
value={val.value || 0}
size="small"
onFocus={(event) => handleInputFocus(val.label, event)}
onBlur={handleInputBlur}
ref={activeInputKey === val.label ? focusedInputRef : null}
onChange={(value) => handleChange(value, val.onChange)}
/>
)}
@@ -277,7 +352,7 @@ const CanvasToolBar = memo(({ isOpen, widgetType, attrs = {} }) => {
showSearch
value={val.value || ""}
placeholder={`${val.label}`}
className="tw-w-full"
className="tw-w-full tw-min-w-[80px]"
filterOption={(input, option) =>
(option?.label ?? '').toLowerCase().includes(input.toLowerCase())
}
@@ -294,6 +369,7 @@ const CanvasToolBar = memo(({ isOpen, widgetType, attrs = {} }) => {
)}
{val.tool === Tools.INPUT_RADIO_LIST && (
// FIXME: problem with maximum recursion error
<DynamicRadioInputList
defaultInputs={val.value.inputs}
defaultSelected={val.value.selectedRadio}
@@ -312,6 +388,12 @@ const CanvasToolBar = memo(({ isOpen, widgetType, attrs = {} }) => {
)
}
{
val.tool === Tools.CUSTOM && (
renderCustomTool(val)
)
}
</>
)
@@ -319,10 +401,12 @@ const CanvasToolBar = memo(({ isOpen, widgetType, attrs = {} }) => {
const renderToolbar = (obj, parentKey = "", toolCount=0) => {
// console.log("obj: ", obj)
const keys = []
return Object.entries(obj).map(([key, val], i) => {
const keyName = parentKey ? `${parentKey}.${key}` : key
// console.log("obj2: ", key, val)
// Highlight outer labels in blue for first-level keys
const isFirstLevel = parentKey === ""
@@ -331,6 +415,10 @@ const CanvasToolBar = memo(({ isOpen, widgetType, attrs = {} }) => {
? "tw-text-sm tw-text-black tw-font-medium"
: "tw-text-sm"
if (!val?.label){
return null
}
// Render tool widgets
if (typeof val === "object" && val.tool) {
@@ -338,7 +426,7 @@ const CanvasToolBar = memo(({ isOpen, widgetType, attrs = {} }) => {
if (isFirstLevel){
return (
<Collapse key={keyName} ghost defaultActiveKey={keys}>
<Collapse key={keyName} defaultActiveKey={keys}>
<Collapse.Panel header={val.label} key={keyName}>
{renderTool(keyName, val)}
</Collapse.Panel>
@@ -367,7 +455,7 @@ const CanvasToolBar = memo(({ isOpen, widgetType, attrs = {} }) => {
if (isFirstLevel){
return (
<Collapse key={keyName} ghost defaultActiveKey={keys}>
<Collapse key={keyName} defaultActiveKey={keys}>
<Collapse.Panel header={val.label} key={keyName}>
<div className={`${containerClass} tw-px-2`}>
{renderToolbar(val, keyName, toolCount+1)}
@@ -394,18 +482,20 @@ const CanvasToolBar = memo(({ isOpen, widgetType, attrs = {} }) => {
return (
<div
className={`tw-absolute tw-top-20 tw-right-5 tw-bg-white
className={`tw-absolute tw-top-10 tw-right-5 tw-bg-white
${toolbarOpen ? "tw-translate-x-0" : "tw-translate-x-full"}
tw-w-[280px] tw-px-3 tw-p-2 tw-h-[600px] tw-rounded-md tw-z-[1000] tw-shadow-lg
tw-w-[280px] tw-px-3 tw-p-2 tw-h-[80vh] tw-rounded-md tw-z-[1000] tw-shadow-lg
tw-transition-transform tw-duration-[0.3s] tw-overflow-x-hidden
tw-flex tw-flex-col tw-gap-2 tw-overflow-y-auto`}
tw-flex tw-flex-col tw-gap-2 tw-overflow-y-auto tw-border-[2px]
tw-border-solid tw-border-gray-300`}
style={{
transform: toolbarOpen ? "translateX(0)" : "translateX(calc(100% + 50px))"
}}
>
<h3 className="tw-text-lg tw-text-center">
{capitalize(`${widgetType || ""}`).replace(/_/g, " ")}
<h3 className="tw-text-lg tw-text-center tw-bg-[#FAFAFA] tw-border-[1px] tw-border-solid tw-border-[#D9D9D9]
tw-p-1 tw-px-2 tw-rounded-md tw-font-medium">
{capitalize(`${activeWidget?.getDisplayName() || ""}`).replace(/_/g, " ")}
</h3>
<div className="tw-flex tw-flex-col tw-gap-2">

File diff suppressed because it is too large Load Diff

View File

@@ -3,6 +3,7 @@ import { useDragWidgetContext } from "./draggableWidgetContext"
import { useDragContext } from "../../components/draggable/draggableContext"
// NOTE: not in use
// FIXME: sometimes even after drag end the showDroppable is visible
/**
* @param {} - widgetRef - the widget ref for your widget

View File

@@ -1,13 +1,17 @@
import { useEffect, useMemo, useRef } from "react"
import { memo, useEffect, useMemo, useRef, useState } from "react"
import Draggable from "./utils/draggableDnd"
import { Button } from "antd"
import { GithubOutlined, GitlabOutlined, LinkOutlined,
AudioOutlined, FileTextOutlined,
DeleteFilled,
DeleteOutlined,
GlobalOutlined} from "@ant-design/icons"
GlobalOutlined,
EyeOutlined,
EyeInvisibleOutlined} from "@ant-design/icons"
import DraggableWrapper from "./draggable/draggable"
import { Button } from "antd"
import { useWidgetContext } from "../canvas/context/widgetContext"
export function SidebarWidgetCard({ name, img, url, license, widgetClass, innerRef}){
@@ -38,7 +42,7 @@ export function SidebarWidgetCard({ name, img, url, license, widgetClass, innerR
<div ref={innerRef} className="tw-select-none tw-h-[200px] tw-w-[230px] tw-flex tw-flex-col
tw-rounded-md tw-overflow-hidden
tw-gap-2 tw-text-gray-600 tw-bg-[#ffffff44] tw-border-solid tw-border-[1px]
tw-border-blue-500 tw-shadow-md">
tw-border-gray-500 tw-shadow-md">
<div className="tw-h-[200px] tw-pointer-events-none tw-w-full tw-overflow-hidden">
<img src={img} alt={name} className="tw-object-contain tw-h-full tw-w-full tw-select-none" />
</div>
@@ -148,4 +152,50 @@ export function DraggableAssetCard({file, onDelete}){
</div>
)
}
}
export const TreeViewCard = memo(({widgetRef, title, isTopLevel}) => {
const [widgetVisible, setWidgetVisible] = useState(widgetRef.current.isWidgetVisible)
const {activeWidget} = useWidgetContext()
const onDelete = () => {
widgetRef.current.deleteWidget()
}
const toggleHideShowWidget = () => {
setWidgetVisible(!widgetRef.current.isWidgetVisible())
if (widgetRef.current.isWidgetVisible())
widgetRef.current.hideFromViewport()
else{
widgetRef.current.unHideFromViewport()
}
}
const handleSingleClick = () => {
activeWidget?.deSelect()
widgetRef.current.select()
}
return (
<div className="tw-flex tw-place-items-center tw-px-2 tw-p-1 tw-place-content-between
tw-gap-4 tw-w-full" style={{width: "100%"}}
onClick={handleSingleClick}
onDoubleClick={() => widgetRef?.current.panToWidget()}
>
<div className={`tw-text-sm ${isTopLevel ? "tw-font-medium" : ""}`}>
{title}
</div>
<div className="tw-ml-auto tw-flex tw-gap-1">
<Button color="danger" title="delete" onClick={onDelete} size="small" variant="text" danger
icon={<DeleteOutlined />}></Button>
<Button variant="text" type="text" title="hide" onClick={toggleHideShowWidget} size="small"
icon={widgetVisible ? <EyeOutlined /> : <EyeInvisibleOutlined/>}></Button>
</div>
</div>
)
})

View File

@@ -0,0 +1,707 @@
License held by paul
Github username: PaulleDemon
Below is the License for source code of PyUIBuilder. For license regarding source code generated by PyUIBuilder Refer Readme.md file (it has basically no restrictions).
-----------------------
The source code for PyUIBuilder is Dual licensed, most parts of the code comes under AGPL,
some parts under a different non-commercial use license. Read the second part after the definition of the AGPL license.
Sub-folders with non-commercial use license will contain the second license as well.
--------------------------
GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU Affero General Public License is a free, copyleft license for
software and other kinds of works, specifically designed to ensure
cooperation with the community in the case of network server software.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
our General Public Licenses are intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
Developers that use our General Public Licenses protect your rights
with two steps: (1) assert copyright on the software, and (2) offer
you this License which gives you legal permission to copy, distribute
and/or modify the software.
A secondary benefit of defending all users' freedom is that
improvements made in alternate versions of the program, if they
receive widespread use, become available for other developers to
incorporate. Many developers of free software are heartened and
encouraged by the resulting cooperation. However, in the case of
software used on network servers, this result may fail to come about.
The GNU General Public License permits making a modified version and
letting the public access it on a server without ever releasing its
source code to the public.
The GNU Affero General Public License is designed specifically to
ensure that, in such cases, the modified source code becomes available
to the community. It requires the operator of a network server to
provide the source code of the modified version running there to the
users of that server. Therefore, public use of a modified version, on
a publicly accessible server, gives the public access to the source
code of the modified version.
An older license, called the Affero General Public License and
published by Affero, was designed to accomplish similar goals. This is
a different license, not a version of the Affero GPL, but Affero has
released a new version of the Affero GPL which permits relicensing under
this license.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
1. Definitions.
"This License" refers to version 3 of the GNU Affero General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Remote Network Interaction; Use with the GNU General Public License.
Notwithstanding any other provision of this License, if you modify the
Program, your modified version must prominently offer all users
interacting with it remotely through a computer network (if your version
supports such interaction) an opportunity to receive the Corresponding
Source of your version by providing access to the Corresponding Source
from a network server at no charge, through some standard or customary
means of facilitating copying of software. This Corresponding Source
shall include the Corresponding Source for any work covered by version 3
of the GNU General Public License that is incorporated pursuant to the
following paragraph.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the work with which it is combined will remain governed by version
3 of the GNU General Public License.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU Affero General Public License from time to time. Such new versions
will be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU Affero General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU Affero General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU Affero General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If your software can interact with users remotely through a computer
network, you should also make sure that it provides a way for users to
get its source. For example, if your program is a web application, its
interface could display a "Source" link that leads users to an archive
of the code. There are many ways you could offer source, and different
solutions will be better for different programs; see section 13 for the
specific requirements.
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU AGPL, see
<https://www.gnu.org/licenses/>.
--------------------------
License for non-commercial use in short
* You are free fork, modify and redistribute it given the original or derived works is kept free and open-source and under the same licese.
* Another restriction is you can't redistribute in binary or executable formats without asking me first.
* If you plan on making money on this work or derived work you need permission first.
Read the full license below.
--------------------
1. License Grant
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to use, copy, modify, merge, publish, and distribute the source code, subject to the following conditions:
2. Derived Work License
Any modifications, derivative works, or copies of the Software must retain this license. All derivative works must be open-sourced under the same license terms. You are not permitted to relicense or sub-license any portion of the Software under a different license without explicit prior written permission from the original author.
3. Distribution Restriction on Executables
You are not permitted to distribute the Software in compiled, executable, or binary form without prior written consent from the original author. This applies to both original and derivative works.
4. Commercial Use Restriction
The Software, in its original or modified form, cannot be used for any commercial purpose without prior written permission from the original author. This includes selling, licensing, or offering the Software as part of a service.
5. Non-Commercial Use
You may freely use, copy, modify, and distribute the source code of the Software for non-commercial purposes, provided that the same terms of this license are maintained in all copies or derivative works.
6. Changes to the License
The original author reserves the right to modify, amend, or update this license at any time. Any changes will apply only to future versions of the Software. Any prior versions of the Software, including derivative works, will continue to be governed by the version of the license in effect at the time the work was created.
7. Disclaimer
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING FROM, OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -7,12 +7,25 @@ import { useDragContext } from "./draggableContext"
* @param {string} - dragElementType - this will set the data-draggable-type which can be accessed on droppable to check if its allowed or not
* @returns
*/
const DraggableWrapper = memo(({dragElementType, dragWidgetClass=null, className, children, ...props}) => {
const DraggableWrapper = memo(({dragElementType, dragWidgetClass=null, currentPos, className, children, ...props}) => {
const { onDragStart, onDragEnd } = useDragContext()
const { onDragStart, onDragEnd, setPosMetaData } = useDragContext()
const draggableRef = useRef(null)
const setInitialPos = (e) => {
const {clientX, clientY} = e
const draggableRect = draggableRef.current.getBoundingClientRect()
const posMetaData = {
dragStartCursorPos: {x: clientX, y: clientY},
initialPos: {x: draggableRect.left, y: draggableRect.top}
}
setPosMetaData(posMetaData)
}
/**
*
* @param {DragEvent} event
@@ -38,6 +51,8 @@ const DraggableWrapper = memo(({dragElementType, dragWidgetClass=null, className
onDragStart={handleDragStart}
onDragEnd={handleDragEnd}
ref={draggableRef}
onPointerDown={setInitialPos}
onMouseDown={setInitialPos}
{...props}
>
{children}

View File

@@ -11,8 +11,12 @@ export const DragProvider = ({ children }) => {
const [draggedElement, setDraggedElement] = useState(null)
const [overElement, setOverElement] = useState(null) // the element the dragged items is over
const [widgetClass, setWidgetClass] = useState(null) // helper to help pass the widget type from sidebar to canvas
const [posMetaData, setPosMetaData] = useState({dragStartCursorPos: {x: 0, y: 0},
initialPos: {x: 0, y: 0}})
const [widgetClass, setWidgetClass] = useState(null) // helper to help pass the widget type from sidebar to canvas
const onDragStart = (element, widgetClass=null) => {
setDraggedElement(element)
@@ -29,7 +33,8 @@ export const DragProvider = ({ children }) => {
return (
<DragContext.Provider value={{ draggedElement, overElement, setOverElement,
widgetClass, onDragStart, onDragEnd }}>
widgetClass, onDragStart, onDragEnd, posMetaData,
setPosMetaData }}>
{children}
</DragContext.Provider>
)

View File

@@ -8,7 +8,7 @@ import { useDragContext } from "./draggableContext"
const DroppableWrapper = memo(({onDrop, droppableTags={}, ...props}) => {
const { draggedElement, overElement, setOverElement, widgetClass } = useDragContext()
const { draggedElement, posMetaData, setOverElement, widgetClass } = useDragContext()
const [showDroppable, setShowDroppable] = useState({
show: false,
@@ -101,7 +101,7 @@ const DroppableWrapper = memo(({onDrop, droppableTags={}, ...props}) => {
))
if(onDrop && allowDrop){
onDrop(e, draggedElement, widgetClass)
onDrop(e, draggedElement, widgetClass, posMetaData)
}
}

View File

@@ -1,9 +1,10 @@
import { useEffect, useState } from "react"
import { Select, Input, Button } from "antd"
import { CrownFilled, DownloadOutlined, DownOutlined } from "@ant-design/icons"
import { CrownFilled, DownloadOutlined, DownOutlined, PlayCircleFilled, VideoCameraOutlined } from "@ant-design/icons"
import FrameWorks from "../constants/frameworks"
import Premium from "../sidebar/utils/premium"
import VideoPopUp from "./video-popup"
const items = [
@@ -23,19 +24,36 @@ function Header({projectName, onProjectNameChange, framework, onFrameworkChange,
return (
<div className={`tw-w-full tw-bg-primaryBg tw-p-2 tw-flex tw-place-items-center
<div className={`tw-w-full tw-bg-primaryBg tw-gap-2 tw-overflow-x-auto tw-p-2 tw-flex tw-place-items-center
${className||''}`}>
<Select
// defaultValue={framework}
value={framework}
options={items}
// onSelect={(key) => {console.log("value: ", key); onFrameworkChange(key); }}
onChange={(key) => {onFrameworkChange(key)}}
className="tw-min-w-[150px]"
/>
<div className="tw-flex tw-gap-2 tw-place-content-center">
<Select
// defaultValue={framework}
value={framework}
options={items}
// onSelect={(key) => {console.log("value: ", key); onFrameworkChange(key); }}
onChange={(key) => {onFrameworkChange(key)}}
className="tw-min-w-[150px]"
/>
<VideoPopUp>
<div className="tw-p-1 tw-w-full tw-outline-none tw-bg-transparent tw-border-[1px]
tw-border-gray-400 tw-rounded-md tw-no-underline tw-border-solid hover:tw-bg-[#9333EA]
hover:tw-text-white tw-duration-200 tw-flex tw-gap-1
tw-text-black tw-text-center tw-px-4 tw-text-sm tw-cursor-pointer">
Watch demo
<PlayCircleFilled className="tw-text-lg"/>
</div>
</VideoPopUp>
</div>
<div className="tw-ml-auto tw-flex tw-gap-2 tw-place-content-center">
<button data-tally-open="mVDY7N" data-tally-layout="modal" data-tally-emoji-text="👋"
data-tally-emoji-animation="wave" className="tw-p-1 tw-w-full tw-outline-none tw-bg-transparent tw-border-[1px]
tw-border-gray-400 tw-rounded-md tw-no-underline tw-border-solid hover:tw-bg-[#9333EA]
hover:tw-text-white tw-duration-200
tw-text-black tw-text-center tw-px-4 tw-text-sm tw-cursor-pointer">
Get Updates
</button>
<Premium className="tw-text-2xl tw-bg-purple-600 tw-text-center
tw-w-[40px] tw-min-w-[40px] tw-h-[35px] tw-rounded-md
tw-cursor-pointer tw-text-white

View File

@@ -1,5 +1,5 @@
import React, { useEffect, useState, useRef } from "react"
import { Input, Button, Space, Radio } from "antd"
import { Input, Button, Space, Radio, InputNumber } from "antd"
import { MinusCircleOutlined, PlusOutlined } from "@ant-design/icons"
import { SearchOutlined, CloseCircleFilled } from '@ant-design/icons'
@@ -87,19 +87,20 @@ export const DynamicInputList = () => {
}
export const DynamicRadioInputList = React.memo(({defaultInputs=[""], defaultSelected=null, onChange}) => {
const [inputs, setInputs] = useState([""]) // Initialize with one input
const [selectedRadio, setSelectedRadio] = useState(null) // Tracks selected radio button
export const DynamicRadioInputList = React.memo(({defaultInputs, defaultSelected=null, onChange}) => {
const [inputs, setInputs] = useState(defaultInputs || [""]) // Initialize with one input
const [selectedRadio, setSelectedRadio] = useState(defaultSelected) // Tracks selected radio button
useEffect(() => {
setInputs(defaultInputs)
setInputs(defaultInputs || [""])
}, [defaultInputs])
useEffect(() => {
setSelectedRadio(defaultSelected)
}, [defaultSelected])
useEffect(() => {
@@ -165,4 +166,95 @@ export const DynamicRadioInputList = React.memo(({defaultInputs=[""], defaultSel
</Button>
</div>
)
})
/**
* defaultWeightMapping structure: {0: {gridNo: 0, weight: 0}}
*/
export const DynamicGridWeightInput = React.memo(({value, onChange, gridInputProps, weightInputProps}) => {
const [weightMapping, setWeightMapping] = useState(value) // Initialize with one input
useEffect(() => {
setWeightMapping(value || {})
}, [value])
useEffect(() => {
if(onChange){
onChange(weightMapping)
}
}, [weightMapping])
// Add a new input
const addInput = () => {
const newObjectIndex = Object.keys(weightMapping).length
setWeightMapping({...weightMapping, [newObjectIndex]: {gridNo: 1, weight: 0}})
}
// Remove an input by index, but keep the first one
const removeInput = (index) => {
const newInputs = { ...weightMapping }; // Create a shallow copy
delete newInputs[index]; // Remove the entry by key
setWeightMapping(newInputs); // Update state
}
// Update input value
const handleGridNoChange = (index, gridNo, weight) => {
const newInputs = {...weightMapping}
newInputs[index] = {
weight,
gridNo
}
setWeightMapping(newInputs)
}
return (
<div>
{weightMapping && Object.entries(weightMapping).map(([idx, {weight, gridNo}], index) => (
<Space key={index} style={{ display: "flex", marginBottom: 8 }} align="baseline">
<div className="tw-flex tw-flex-col tw-gap-2">
{ index === 0 &&
<span>Grid no</span>
}
<InputNumber
value={gridNo}
min={1}
onChange={(value) => handleGridNoChange(idx, value, weight)}
placeholder={`Input ${index + 1}`}
{...gridInputProps}
/>
</div>
<div className="tw-flex tw-flex-col tw-gap-2">
{ index === 0 &&
<span>Weight</span>
}
<InputNumber
min={0}
value={weight}
onChange={(value) => handleGridNoChange(idx, gridNo, value)}
placeholder={`Input ${index + 1}`}
{...weightInputProps}
/>
</div>
{/* {index !== 0 && ( // Do not show delete button for the first input */}
<div>
<MinusCircleOutlined className="tw-text-xl tw-text-red-500"
onClick={() => removeInput(index)} />
</div>
{/* )} */}
</Space>
))}
<Button type="dashed" onClick={addInput} icon={<PlusOutlined />}>
Add Weight
</Button>
</div>
)
})

View File

@@ -0,0 +1,47 @@
import { Modal } from "antd"
import { useState } from "react"
const VideoPopUp = ({children, url}) => {
const [popUpOpen, setPopUpOpen] = useState(false)
const handleVideoOpen = () => {
setPopUpOpen(true)
}
const handleVideoClose = (event) => {
event.stopPropagation()
setPopUpOpen(false)
}
return (
<div onClick={handleVideoOpen} >
{children}
<Modal title={"demo"}
style={{ zIndex: 14000, gap: '5px', placeContent: "center", }}
className="max-xl:tw-max-w-full max-lg:!tw-max-h-[450px]"
styles={{body: {height: "80vh", width: "100%"}, content: {width: "100%",}}}
onCancel={handleVideoClose}
centered
onOk={handleVideoClose}
footer={null}
width={'90%'}
height={1000}
open={popUpOpen}>
<div className="tw-mt-5 tw-text-lg tw-min-w-[350px] tw-rounded-md tw-overflow-hidden tw-h-full tw-w-full ">
<iframe src="https://www.youtube.com/embed/MkeMv0X-w_4?si=lJNCB18a2XKdY7Y6"
className="tw-w-full tw-h-full"
title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen>
</iframe>
</div>
</Modal>
</div>
)
}
export default VideoPopUp

View File

View File

@@ -0,0 +1,43 @@
License held by paul
Github username: PaulleDemon
Below is the License for source code of PyUIBuilder. For license regarding source code generated by PyUIBuilder Refer Readme.md file (it has basically no restrictions).
The source code for PyUIBuilder is Dual licensed, some parts of the code comes under AGPL,
some parts under a different non-commercial use license.
-----------------------
License in short
* You are free fork, modify and redistribute it given the original or derived works is kept free and open-source and under the same licese.
* Another restriction is you can't redistribute in binary or executable formats without asking me first.
* If you plan on making money on this work or derived work you need permission first.
* No AI Training on this source code
License was planned to be kept under one AGPL or less restrictive license, but since its difficult for me to continue providing free and open-source software without proper funding. It's under this license.
Once there enough money to fund this project and my upcoming FOSS projects, The license will be brought back to a single AGPL or much lesser restrictive license. The fastest way to make this happen is by purchasing a one-time license or fund me.
Read the full license below.
--------------------
1. License Grant
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to use, copy, modify, merge, publish, and distribute the source code, subject to the following conditions:
2. Derived Work License
Any modifications, derivative works, or copies of the Software must retain this license. All derivative works must be open-sourced under the same license terms. You are not permitted to relicense or sub-license any portion of the Software under a different license without explicit prior written permission from the original author.
3. Distribution Restriction on Executables
You are not permitted to distribute the Software in compiled, executable, or binary form without prior written consent from the original author. This applies to both original and derivative works.
4. Commercial Use Restriction
The Software, in its original or modified form, cannot be used for any commercial purpose without prior written permission from the original author. This includes selling, licensing, or offering the Software as part of a service.
5. Non-Commercial Use
You may freely use, copy, modify, and distribute the source code of the Software for non-commercial purposes, provided that the same terms of this license are maintained in all copies or derivative works.
6. Changes to the License
The original author reserves the right to modify, amend, or update this license at any time. Any changes will apply only to future versions of the Software. Any prior versions of the Software, including derivative works, will continue to be governed by the version of the license in effect at the time the work was created.
7. Disclaimer
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING FROM, OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -2,6 +2,7 @@
export const Tkinter_TO_WEB_CURSOR_MAPPING = {
"": "",
"arrow": "default",
"circle": "wait",
"clock": "wait",

View File

@@ -20,5 +20,25 @@ export const ANCHOR = [
"s",
"e",
"w",
"center"
]
"center",
"ne",
"se",
"sw",
"nw",
]
export const GRID_STICKY = {
N: "n",
S: "s",
E: "e",
W: "w",
WE: "we",
NS: "ns",
NW: "nw",
NE: "ne",
SW: "sw",
SE: "se",
NEWS: "news",
NONE: "",
}

View File

@@ -111,13 +111,13 @@ async function generateCustomTkCode(projectName, widgetList=[], widgetRefs=[], a
// widget - {id, widgetType: widgetComponentType, children: [], parent: "", initialData: {}}
const generatedObject = generateCustomTkCodeList(filteredWidgetList, widgetRefs, "", "")
const generatedObject = generateCustomTkCodeList(filteredWidgetList, widgetRefs.current, "", "")
const {code: codeLines, imports, requirements, mainVariable} = generatedObject
// TODO: avoid adding \n inside the list instead rewrite using code.join("\n")
const code = [
"# This code is generated by PyUIbuilder: https://github.com/PaulleDemon/PyUIBuilder",
"# This code is generated by PyUIbuilder: https://pyuibuilder.com",
"\n\n",
...imports.flatMap((item, index) => index < imports.length - 1 ? [item, "\n"] : [item]), //add \n to every line
"\n\n",

View File

@@ -20,6 +20,7 @@ const Themes = {
class AnalogTimePicker extends CustomTkBase{
static widgetType = "analog_timepicker"
static displayName = "Analog Timepicker"
static requiredImports = [
...CustomTkBase.requiredImports,

View File

@@ -13,6 +13,8 @@ import { CustomTkBase } from "../widgets/base"
class MapView extends CustomTkBase{
static widgetType = "map_view"
static displayName = "Map View"
static requiredImports = [
...CustomTkBase.requiredImports,

View File

@@ -70,6 +70,7 @@ const ResizableTable = ({minRows=5, minCols=5}) => {
class PandasTable extends CustomTkBase{
static widgetType = "pandas_table"
static displayName = "Pandas Table"
static requiredImports = [
...CustomTkBase.requiredImports,

View File

@@ -12,6 +12,7 @@ import { getPythonAssetPath } from "../../utils/pythonFilePath"
class VideoPlayer extends CustomTkBase{
static widgetType = "video_player"
static displayName = "Video Player"
static requiredImports = [
...CustomTkBase.requiredImports,

View File

@@ -7,7 +7,7 @@ import Label from "./widgets/label"
import Button from "./widgets/button"
import OptionMenu from "./widgets/optionMenu"
import Slider from "./widgets/slider"
import { CheckBox, RadioButton } from "./widgets/ checkButton"
import { CheckBox, RadioButton } from "./widgets/checkButton"
import { Input, Text } from "./widgets/input"
import SpinBox from "./widgets/spinBox"

File diff suppressed because it is too large Load Diff

View File

@@ -6,6 +6,7 @@ import { CustomTkWidgetBase } from "./base"
class Button extends CustomTkWidgetBase{
static widgetType = "button"
static displayName = "Button"
constructor(props) {
super(props)
@@ -69,6 +70,7 @@ class Button extends CustomTkWidgetBase{
<div className="tw-w-flex tw-flex-col tw-w-full tw-h-full tw-rounded-md
tw-border tw-border-solid tw-border-gray-400 tw-overflow-hidden">
<div className="tw-p-2 tw-w-full tw-flex tw-place-content-center tw-place-items-center tw-h-full tw-text-center"
ref={this.styleAreaRef}
style={this.getInnerRenderStyling()}>
{/* {this.props.children} */}
<div className="tw-text-sm" style={{color: this.getAttrValue("styling.foregroundColor")}}>

View File

@@ -8,6 +8,8 @@ import { CustomTkWidgetBase } from "./base"
export class CheckBox extends CustomTkWidgetBase{
static widgetType = "check_button"
static displayName = "Check Box"
constructor(props) {
super(props)
@@ -211,6 +213,7 @@ export class RadioButton extends CustomTkWidgetBase{
return (
<div className="tw-flex tw-p-1 tw-w-full tw-h-full tw-rounded-md tw-overflow-hidden"
ref={this.styleAreaRef}
style={this.getInnerRenderStyling()}
>
<div className="tw-flex tw-flex-col tw-gap-2 tw-w-fit tw-h-fit">

View File

@@ -1,3 +1,5 @@
import { Layouts } from "../../../canvas/constants/layouts"
import Tools from "../../../canvas/constants/tools"
import Widget from "../../../canvas/widgets/base"
import { CustomTkBase } from "./base"
@@ -5,6 +7,7 @@ import { CustomTkBase } from "./base"
class Frame extends CustomTkBase{
static widgetType = "frame"
static displayName = "Frame"
constructor(props) {
super(props)
@@ -16,7 +19,99 @@ class Frame extends CustomTkBase{
this.state = {
...this.state,
fitContent: {width: true, height: true},
widgetName: "Frame"
widgetName: "Frame",
attrs: {
...this.state.attrs,
padding: {
label: "padding",
padX: {
label: "Pad X",
tool: Tools.NUMBER_INPUT,
toolProps: {min: 0, max: 140},
value: null,
onChange: (value) => {
// this.setWidgetInnerStyle("paddingLeft", `${value}px`)
// this.setWidgetInnerStyle("paddingRight", `${value}px`)
// const widgetStyle = {
// }
this.setState((prevState) => ({
widgetInnerStyling: {
...prevState.widgetInnerStyling,
paddingLeft: `${value}px`,
paddingRight: `${value}px`
}
}))
this.setAttrValue("padding.padX", value)
}
},
padY: {
label: "Pad Y",
tool: Tools.NUMBER_INPUT,
toolProps: {min: 0, max: 140},
value: null,
onChange: (value) => {
this.setState((prevState) => ({
widgetInnerStyling: {
...prevState.widgetInnerStyling,
paddingTop: `${value}px`,
paddingBottom: `${value}px`
}
}))
// this.setState({
// widgetInnerStyling: widgetStyle
// })
this.setAttrValue("padding.padY", value)
}
},
},
margin: {
label: "Margin",
marginX: {
label: "Margin X",
tool: Tools.NUMBER_INPUT,
toolProps: {min: 0, max: 140},
value: null,
onChange: (value) => {
this.updateState((prev) => ({
widgetOuterStyling: {
...prev.widgetOuterStyling,
marginLeft: `${value}px`,
marginRight: `${value}px`
},
}))
this.setAttrValue("margin.marginX", value)
}
},
marginY: {
label: "Margin Y",
tool: Tools.NUMBER_INPUT,
toolProps: {min: 0, max: 140},
value: null,
onChange: (value) => {
this.updateState((prev) => ({
widgetOuterStyling: {
...prev.widgetOuterStyling,
marginTop: `${value}px`,
marginBottom: `${value}px`
},
}))
this.setAttrValue("margin.marginY", value)
}
},
},
}
}
}
@@ -26,6 +121,34 @@ class Frame extends CustomTkBase{
this.setAttrValue("styling.backgroundColor", "#EDECEC")
}
getConfigCode(){
const bg = this.getAttrValue("styling.backgroundColor")
const fitWidth = this.state.fitContent.width
const fitHeight = this.state.fitContent.height
const {width, height} = this.getSize()
const {layout} = this.getParentLayout()
const config = {
bg: `"${bg}"`
}
if (layout !== Layouts.PLACE){
if (!fitWidth){
config['width'] = width
}
if (!fitHeight){
config['height'] = height
}
}
return config
}
generateCode(variableName, parent){
const bg = this.getAttrValue("styling.backgroundColor")
@@ -33,20 +156,36 @@ class Frame extends CustomTkBase{
return [
`${variableName} = ctk.CTkFrame(master=${parent})`,
`${variableName}.configure(fg_color="${bg}")`,
`${variableName}.${this.getLayoutCode()}`
`${variableName}.${this.getLayoutCode()}`,
...this.getGridLayoutConfigurationCode(variableName)
]
}
getToolbarAttrs(){
const {layout, gridConfig, gridWeights, ...toolBarAttrs} = super.getToolbarAttrs()
// places layout at the end
return ({
id: this.__id,
...toolBarAttrs,
padding: this.state.attrs.padding,
margin: this.state.attrs.margin,
layout,
gridConfig,
gridWeights
})
}
renderContent(){
// console.log("bounding rect: ", this.getBoundingRect())
// console.log("widget styling: ", this.state.widgetInnerStyling)
return (
<div className="tw-w-flex tw-flex-col tw-w-full tw-h-full tw-relative tw-rounded-md tw-overflow-hidden">
<div className="tw-p-2 tw-w-full tw-h-full tw-content-start" style={this.getInnerRenderStyling()}>
{this.props.children}
<div className="tw-p-2 tw-w-full tw-h-full tw-content-start"
ref={this.styleAreaRef}
style={this.getInnerRenderStyling()}>
{this.renderTkinterLayout()}
</div>
</div>
)

View File

@@ -6,6 +6,7 @@ import { CustomTkWidgetBase } from "./base"
export class Input extends CustomTkWidgetBase{
static widgetType = "entry"
static displayName = "Entry"
constructor(props) {
super(props)
@@ -65,6 +66,7 @@ export class Input extends CustomTkWidgetBase{
return (
<div className="tw-w-flex tw-flex-col tw-w-full tw-h-full tw-rounded-md tw-overflow-hidden">
<div className="tw-p-2 tw-w-full tw-h-full tw-flex tw-place-items-center"
ref={this.styleAreaRef}
style={this.getInnerRenderStyling()}>
<div className="tw-text-sm tw-text-gray-300">
{this.getAttrValue("placeHolder")}

View File

@@ -7,7 +7,7 @@ import { CustomTkWidgetBase } from "./base"
class Label extends CustomTkWidgetBase{
static widgetType = "label"
static displayName = "Label"
constructor(props) {
super(props)
@@ -116,6 +116,22 @@ class Label extends CustomTkWidgetBase{
})
}
getAnchorStyle = (anchor) => {
const anchorStyles = {
n: { justifyContent: 'center', alignItems: 'flex-start' },
s: { justifyContent: 'center', alignItems: 'flex-end' },
e: { justifyContent: 'flex-end', alignItems: 'center' },
w: { justifyContent: 'flex-start', alignItems: 'center' },
ne: { justifyContent: 'flex-end', alignItems: 'flex-start' },
se: { justifyContent: 'flex-end', alignItems: 'flex-end' },
nw: { justifyContent: 'flex-start', alignItems: 'flex-start' },
sw: { justifyContent: 'flex-start', alignItems: 'flex-end' },
center: { justifyContent: 'center', alignItems: 'center' }
}
return anchorStyles[anchor] || anchorStyles["w"];
}
renderContent(){
const image = this.getAttrValue("imageUpload")
@@ -129,6 +145,7 @@ class Label extends CustomTkWidgetBase{
}}
>
<div className="tw-p-2 tw-w-full tw-h-full tw-flex tw-place-content-center tw-place-items-center "
ref={this.styleAreaRef}
style={this.getInnerRenderStyling()}>
{/* {this.props.children} */}
{
@@ -136,7 +153,10 @@ class Label extends CustomTkWidgetBase{
<img src={image.previewUrl} className="tw-bg-contain tw-w-full tw-h-full" />
)
}
<div className="" style={{color: this.getAttrValue("styling.foregroundColor")}}>
<div className={`tw-flex ${!image ? "tw-w-full tw-h-full" : ""}`} style={{
color: this.getAttrValue("styling.foregroundColor"),
...this.getAnchorStyle(this.getAttrValue("styling.anchor"))
}}>
{this.getAttrValue("labelWidget")}
</div>
</div>

View File

@@ -1,11 +1,20 @@
import Widget from "../../../canvas/widgets/base"
import Tools from "../../../canvas/constants/tools"
import { CustomTkBase } from "./base"
import { getPythonAssetPath } from "../../utils/pythonFilePath"
class MainWindow extends CustomTkBase{
static widgetType = "main_window"
static displayName = "Main Window"
static initialSize = {
width: 700,
height: 400
}
constructor(props) {
super(props)
@@ -26,6 +35,13 @@ class MainWindow extends CustomTkBase{
toolProps: {placeholder: "Window title", maxLength: 40},
value: "Main Window",
onChange: (value) => this.setAttrValue("title", value)
},
logo: {
label: "Window Logo",
tool: Tools.UPLOADED_LIST,
toolProps: {filterOptions: ["image/jpg", "image/jpeg", "image/png"]},
value: "",
onChange: (value) => this.setAttrValue("logo", value)
}
}
@@ -42,12 +58,48 @@ class MainWindow extends CustomTkBase{
generateCode(variableName, parent){
const backgroundColor = this.getAttrValue("styling.backgroundColor")
const logo = this.getAttrValue("logo")
return [
`${variableName} = ctk.CTk()`,
`${variableName}.configure(fg_color="${backgroundColor}")`,
`${variableName}.title("${this.getAttrValue("title")}")`
]
const {width, height} = this.getSize()
const code = [
`${variableName} = ctk.CTk()`,
`${variableName}.configure(fg_color="${backgroundColor}")`,
`${variableName}.title("${this.getAttrValue("title")}")`,
`${variableName}.geometry("${width}x${height}")`,
...this.getGridLayoutConfigurationCode(variableName)
]
if (logo?.name){
// code.push(`\n`)
code.push(`${variableName}_img = Image.open(${getPythonAssetPath(logo.name, "image")})`)
code.push(`${variableName}_img = ImageTk.PhotoImage(${variableName}_img)`)
code.push(`${variableName}.iconphoto(False, ${variableName}_img)`)
// code.push("\n")
}
return code
}
getImports(){
const imports = super.getImports()
if (this.getAttrValue("logo"))
imports.push("import os", "from PIL import Image, ImageTk", )
return imports
}
getRequirements(){
const requirements = super.getRequirements()
if (this.getAttrValue("logo"))
requirements.push("pillow")
return requirements
}
getToolbarAttrs(){
@@ -57,8 +109,8 @@ class MainWindow extends CustomTkBase{
id: this.__id,
widgetName: toolBarAttrs.widgetName,
title: this.state.attrs.title,
logo: this.state.attrs.logo,
size: toolBarAttrs.size,
...this.state.attrs,
})
@@ -80,8 +132,9 @@ class MainWindow extends CustomTkBase{
</div>
</div>
<div className="tw-p-2 tw-w-full tw-relative tw-h-full tw-overflow-hidden tw-content-start"
ref={this.styleAreaRef}
style={this.state.widgetInnerStyling}>
{this.props.children}
{this.renderTkinterLayout()}
</div>
</div>
)

View File

@@ -7,6 +7,7 @@ import { convertObjectToKeyValueString, removeKeyFromObject } from "../../../uti
class OptionMenu extends CustomTkWidgetBase{
static widgetType = "option_menu"
static displayName = "Option Menu"
constructor(props) {
super(props)
@@ -102,6 +103,7 @@ class OptionMenu extends CustomTkWidgetBase{
return (
<div className="tw-flex tw-p-1 tw-w-full tw-h-full tw-rounded-md tw-overflow-hidden"
ref={this.styleAreaRef}
style={this.getInnerRenderStyling()}
onClick={this.toggleDropDownOpen}
>

View File

@@ -7,6 +7,8 @@ import { CustomTkWidgetBase } from "./base"
class Slider extends CustomTkWidgetBase{
static widgetType = "scale"
static displayName = "Scale"
// FIXME: You provided a `value` prop to a form field without an `onChange` handler. This will render a read-only field. If the field should be mutable use
constructor(props) {
super(props)
@@ -141,7 +143,9 @@ class Slider extends CustomTkWidgetBase{
return (
<div className="tw-w-flex tw-flex-col tw-w-full tw-h-full tw-rounded-md tw-overflow-hidden">
<div className="flex flex-col items-center justify-center h-screen
bg-gray-100" style={this.getInnerRenderStyling()}>
bg-gray-100"
ref={this.styleAreaRef}
style={this.getInnerRenderStyling()}>
<div className="w-full max-w-md">
<input
type="range"

View File

@@ -8,6 +8,7 @@ import { CustomTkWidgetBase } from "./base"
class SpinBox extends CustomTkWidgetBase{
static widgetType = "spin_box"
static displayName = "Spin Box"
constructor(props) {
super(props)
@@ -109,6 +110,7 @@ class SpinBox extends CustomTkWidgetBase{
return (
<div className="tw-w-flex tw-flex-col tw-w-full tw-h-full tw-rounded-md tw-overflow-hidden">
<div className="tw-p-2 tw-w-full tw-h-full tw-flex tw-place-items-center tw-justify-between"
ref={this.styleAreaRef}
style={this.getInnerRenderStyling()}>
<div className="tw-text-sm ">
{this.getAttrValue("spinProps.default")}

View File

@@ -1,10 +1,13 @@
import Widget from "../../../canvas/widgets/base"
import Tools from "../../../canvas/constants/tools"
import { getPythonAssetPath } from "../../utils/pythonFilePath"
import { CustomTkBase } from "./base"
class TopLevel extends Widget{
class TopLevel extends CustomTkBase{
static widgetType = "toplevel"
static displayName = "Top Level"
constructor(props) {
super(props)
@@ -26,6 +29,13 @@ class TopLevel extends Widget{
toolProps: {placeholder: "Window title", maxLength: 40},
value: "Top level",
onChange: (value) => this.setAttrValue("title", value)
},
logo: {
label: "Toplevel Logo",
tool: Tools.UPLOADED_LIST,
toolProps: {filterOptions: ["image/jpg", "image/jpeg", "image/png"]},
value: "",
onChange: (value) => this.setAttrValue("logo", value)
}
}
@@ -41,11 +51,49 @@ class TopLevel extends Widget{
const backgroundColor = this.getAttrValue("styling.backgroundColor")
return [
`${variableName} = ctk.CTkToplevel(master=${parent})`,
`${variableName}.configure(fg_color="${backgroundColor}")`,
`${variableName}.title("${this.getAttrValue("title")}")`
]
const logo = this.getAttrValue("logo")
const {width, height} = this.getSize()
const code = [
`${variableName} = ctk.CTkToplevel(master=${parent})`,
`${variableName}.configure(fg_color="${backgroundColor}")`,
`${variableName}.title("${this.getAttrValue("title")}")`,
`${variableName}.geometry("${width}x${height}")`,
...this.getGridLayoutConfigurationCode(variableName)
]
if (logo?.name){
// code.push(`\n`)
code.push(`${variableName}_img = Image.open(${getPythonAssetPath(logo.name, "image")})`)
code.push(`${variableName}_img = ImageTk.PhotoImage(${variableName}_img)`)
code.push(`${variableName}.iconphoto(False, ${variableName}_img)`)
// code.push("\n")
}
return code
}
getImports(){
const imports = super.getImports()
if (this.getAttrValue("logo"))
imports.push("import os", "from PIL import Image, ImageTk", )
return imports
}
getRequirements(){
const requirements = super.getRequirements()
if (this.getAttrValue("logo"))
requirements.push("pillow")
return requirements
}
getToolbarAttrs(){
@@ -54,8 +102,8 @@ class TopLevel extends Widget{
return ({
widgetName: toolBarAttrs.widgetName,
title: this.state.attrs.title,
logo: this.state.attrs.logo,
size: toolBarAttrs.size,
...this.state.attrs,
})
@@ -76,8 +124,10 @@ class TopLevel extends Widget{
</div>
</div>
</div>
<div className="tw-p-2 tw-w-full tw-h-full tw-content-start" style={this.state.widgetInnerStyling}>
{this.props.children}
<div className="tw-p-2 tw-w-full tw-h-full tw-content-start"
ref={this.styleAreaRef}
style={this.state.widgetInnerStyling}>
{this.renderTkinterLayout()}
</div>
</div>
)

View File

@@ -2,6 +2,7 @@
export const Tkinter_TO_WEB_CURSOR_MAPPING = {
"": "",
"arrow": "default",
"circle": "wait",
"clock": "wait",

View File

@@ -20,5 +20,25 @@ export const ANCHOR = [
"s",
"e",
"w",
"center"
]
"center",
"ne",
"se",
"sw",
"nw",
]
export const GRID_STICKY = {
N: "n",
S: "s",
E: "e",
W: "w",
WE: "we",
NS: "ns",
NW: "nw",
NE: "ne",
SW: "sw",
SE: "se",
NEWS: "news",
NONE: "",
}

View File

@@ -4,6 +4,8 @@ import MainWindow from "../widgets/mainWindow"
import { message } from "antd"
import TopLevel from "../widgets/toplevel"
const pythonFiles = require.context("../pythonWidgets", false, /\.py$/)
// FIXME: if the toplevel comes first, before the MainWindow in widgetlist the root may become null
// Recursive function to generate the code list, imports, requirements, and track mainVariable
@@ -13,6 +15,8 @@ function generateTkinterCodeList(widgetList = [], widgetRefs = [], parentVariabl
let requirements = new Set([])
let code = []
let customPythonWidgets = new Set([])
for (let widget of widgetList) {
const widgetRef = widgetRefs[widget.id].current
let varName = widgetRef.getVariableName()
@@ -20,6 +24,7 @@ function generateTkinterCodeList(widgetList = [], widgetRefs = [], parentVariabl
// Add imports and requirements to sets
widgetRef.getImports().forEach(importItem => imports.add(importItem))
widgetRef.getRequirements().forEach(requirementItem => requirements.add(requirementItem))
widgetRef.getRequiredCustomPyFiles().forEach(customFile => customPythonWidgets.add(customFile))
// Set main variable if the widget is MainWindow
if (widget.widgetType === MainWindow) {
@@ -68,6 +73,8 @@ function generateTkinterCodeList(widgetList = [], widgetRefs = [], parentVariabl
// Merge child imports, requirements, and code
imports = new Set([...imports, ...childResult.imports])
requirements = new Set([...requirements, ...childResult.requirements])
customPythonWidgets = new Set([...customPythonWidgets, ...childResult.customPythonWidgets])
code.push(...childResult.code)
mainVariable = childResult.mainVariable || mainVariable // the main variable is the main window variable
@@ -78,6 +85,7 @@ function generateTkinterCodeList(widgetList = [], widgetRefs = [], parentVariabl
imports: Array.from(imports),
code: code,
requirements: Array.from(requirements),
customPythonWidgets: Array.from(customPythonWidgets),
mainVariable
}
}
@@ -111,13 +119,17 @@ async function generateTkinterCode(projectName, widgetList=[], widgetRefs=[], as
// widget - {id, widgetType: widgetComponentType, children: [], parent: "", initialData: {}}
const generatedObject = generateTkinterCodeList(filteredWidgetList, widgetRefs, "", "")
const generatedObject = generateTkinterCodeList(filteredWidgetList, widgetRefs.current, "", "")
const {code: codeLines, imports, requirements, mainVariable} = generatedObject
const {code: codeLines, imports, requirements, mainVariable, customPythonWidgets} = generatedObject
console.log("custom python widgets: ", customPythonWidgets)
// TODO: avoid adding \n inside the list instead rewrite using code.join("\n")
// TODO: import customWidgets
const code = [
"# This code is generated by PyUIbuilder: https://github.com/PaulleDemon/PyUIBuilder",
"# This code is generated by PyUIbuilder: https://pyuibuilder.com",
"\n\n",
...imports.flatMap((item, index) => index < imports.length - 1 ? [item, "\n"] : [item]), //add \n to every line
"\n\n",
@@ -147,6 +159,32 @@ async function generateTkinterCode(projectName, widgetList=[], widgetRefs=[], as
})
}
for (let customWidget of customPythonWidgets){
let [fileName, extension] = customWidget.split(".")
if (!extension){
fileName = `${fileName}.py`
}
const fileContent = pythonFiles(`./${fileName}`).default
createFileList.push({
fileData: new Blob([fileContent], { type: "text/plain" }),
fileName: fileName,
folder: "customWidgets"
})
}
if (customPythonWidgets.length > 0){
createFileList.push({
fileData: new Blob([''], { type: "text/plain" }),
fileName: '__init__.py',
folder: "customWidgets"
})
}
for (let asset of assetFiles){
if (asset.fileType === "image"){

View File

@@ -20,6 +20,7 @@ const Themes = {
class AnalogTimePicker extends TkinterBase{
static widgetType = "analog_timepicker"
static displayName = "Analog Timepicker"
static requiredImports = [
...TkinterBase.requiredImports,

View File

@@ -13,6 +13,7 @@ import { TkinterBase } from "../widgets/base"
class MapView extends TkinterBase{
static widgetType = "map_view"
static displayName = "Map View"
static requiredImports = [
...TkinterBase.requiredImports,

View File

@@ -70,6 +70,7 @@ const ResizableTable = ({minRows=5, minCols=5}) => {
class PandasTable extends TkinterBase{
static widgetType = "pandas_table"
static displayName = "Pandas Table"
static requiredImports = [
...TkinterBase.requiredImports,

View File

@@ -12,6 +12,7 @@ import { getPythonAssetPath } from "../../utils/pythonFilePath"
class VideoPlayer extends TkinterBase{
static widgetType = "video_player"
static displayName = "Video Player"
static requiredImports = [
...TkinterBase.requiredImports,

View File

@@ -0,0 +1,92 @@
# Author: Paul: https://github.com/PaulleDemon
# Made using PyUibuilder: https://pyuibuilder.com
# MIT License - keep the copy of this license
# By default Label grows to fit the image, which isn't ideal for many use cases (image should grow to fit/cover the image instead)
import tkinter as tk
from PIL import Image, ImageTk
class ImageLabel(tk.Label):
def __init__(self, master, image_path=None, mode="cover", width=100, height=100, *args, **kwargs):
"""
mode:
- "fit" -> Keeps aspect ratio, fits inside label
- "cover" -> Covers label fully, cropping excess
"""
super().__init__(master, width=width, height=height, *args, **kwargs)
self.parent = master
self.image_path = image_path
self.mode = mode
self.original_image = None
self.photo = None
self.resize_job = None # Debounce job reference
if mode not in ['fit', 'cover']:
raise Exception("Mode can only be fit or cover.")
if image_path:
try:
self.original_image = Image.open(image_path)
self.photo = ImageTk.PhotoImage(self.original_image)
self.config(image=self.photo)
self.force_resize()
except Exception as e:
print(f"Error loading image: {e}")
self.after(100, self.init_events)
def init_events(self):
self.parent.bind("<Configure>", self.on_resize)
def on_resize(self, event=None):
"""Debounce resizing to prevent rapid execution."""
if self.resize_job:
self.after_cancel(self.resize_job)
self.resize_job = self.after(1, self.force_resize) # Debounce
def force_resize(self):
"""Resize image using actual widget size."""
if self.original_image is None:
return # Do nothing if no image is loaded
width = self.winfo_width()
height = self.winfo_height()
if width < 5 or height < 5:
return
aspect_ratio = self.original_image.width / self.original_image.height
if self.mode == "fit":
if width / height > aspect_ratio:
new_width = int(height * aspect_ratio)
new_height = height
else:
new_width = width
new_height = int(width / aspect_ratio)
resized = self.original_image.resize((new_width, new_height), Image.LANCZOS)
elif self.mode == "cover":
if width / height > aspect_ratio:
new_width = width
new_height = int(width / aspect_ratio)
else:
new_width = int(height * aspect_ratio)
new_height = height
resized = self.original_image.resize((new_width, new_height), Image.LANCZOS)
# Crop excess
left = (new_width - width) // 2
top = (new_height - height) // 2
right = left + width
bottom = top + height
resized = resized.crop((left, top, right, bottom))
# Update image
self.photo = ImageTk.PhotoImage(resized)
self.config(image=self.photo)

View File

@@ -0,0 +1 @@
# contains python coded custom widgets

View File

@@ -7,7 +7,7 @@ import Label from "./widgets/label"
import Button from "./widgets/button"
import OptionMenu from "./widgets/optionMenu"
import Slider from "./widgets/slider"
import { CheckBox, RadioButton } from "./widgets/ checkButton"
import { CheckBox, RadioButton } from "./widgets/checkButton"
import { Input, Text } from "./widgets/input"
import SpinBox from "./widgets/spinBox"

File diff suppressed because it is too large Load Diff

View File

@@ -6,6 +6,7 @@ import { TkinterWidgetBase } from "./base"
class Button extends TkinterWidgetBase{
static widgetType = "button"
static displayName = "Button"
constructor(props) {
super(props)
@@ -68,6 +69,7 @@ class Button extends TkinterWidgetBase{
<div className="tw-w-flex tw-flex-col tw-w-full tw-h-full tw-rounded-md
tw-border tw-border-solid tw-border-gray-400 tw-overflow-hidden">
<div className="tw-p-2 tw-w-full tw-flex tw-place-content-center tw-place-items-center tw-h-full tw-text-center"
ref={this.styleAreaRef}
style={this.getInnerRenderStyling()}>
{/* {this.props.children} */}
<div className="tw-text-sm" style={{color: this.getAttrValue("styling.foregroundColor")}}>

View File

@@ -8,6 +8,8 @@ import { TkinterWidgetBase } from "./base"
export class CheckBox extends TkinterWidgetBase{
static widgetType = "check_button"
static displayName = "Check Box"
constructor(props) {
super(props)
@@ -96,6 +98,7 @@ export class CheckBox extends TkinterWidgetBase{
return (
<div className="tw-flex tw-p-1 tw-w-full tw-h-full tw-rounded-md tw-overflow-hidden"
style={this.getInnerRenderStyling()}
ref={this.styleAreaRef}
>
<div className="tw-flex tw-gap-2 tw-w-full tw-h-full tw-place-items-center tw-place-content-center">
@@ -124,25 +127,30 @@ export class RadioButton extends TkinterWidgetBase{
// FIXME: the radio buttons are not visible because of the default heigh provided
static widgetType = "radio_button"
static displayName = "Radio Button"
constructor(props) {
super(props)
this.minSize = {width: 50, height: 30}
let newAttrs = removeKeyFromObject("layout", this.state.attrs)
this.state = {
...this.state,
size: { width: 80, height: 30 },
fitContent: { width: true, height: true },
widgetName: "Radio button",
attrs: {
...this.state.attrs,
...newAttrs,
radios: {
label: "Radio Group",
tool: Tools.INPUT_RADIO_LIST,
value: {inputs: ["default"], selectedRadio: -1},
value: {inputs: ["default"], selectedRadio: null},
onChange: ({inputs, selectedRadio}) => {
this.setAttrValue("radios", {inputs, selectedRadio})
this.setAttrValue("radios", {inputs, selectedRadio}, () => {
console.log("attribute set: ", this.state.attrs.radios, {inputs, selectedRadio},)
})
}
}

View File

@@ -1,10 +1,14 @@
import { Layouts } from "../../../canvas/constants/layouts"
import Tools from "../../../canvas/constants/tools"
import Widget from "../../../canvas/widgets/base"
import { convertObjectToKeyValueString } from "../../../utils/common"
import {TkinterBase} from "./base"
class Frame extends TkinterBase{
static widgetType = "frame"
static displayName = "Frame"
constructor(props) {
super(props)
@@ -16,7 +20,99 @@ class Frame extends TkinterBase{
this.state = {
...this.state,
fitContent: {width: true, height: true},
widgetName: "Frame"
widgetName: "Frame",
attrs: {
...this.state.attrs,
padding: {
label: "padding",
padX: {
label: "Pad X",
tool: Tools.NUMBER_INPUT,
toolProps: {min: 0, max: 140},
value: null,
onChange: (value) => {
// this.setWidgetInnerStyle("paddingLeft", `${value}px`)
// this.setWidgetInnerStyle("paddingRight", `${value}px`)
// const widgetStyle = {
// }
this.setState((prevState) => ({
widgetInnerStyling: {
...prevState.widgetInnerStyling,
paddingLeft: `${value}px`,
paddingRight: `${value}px`
}
}))
this.setAttrValue("padding.padX", value)
}
},
padY: {
label: "Pad Y",
tool: Tools.NUMBER_INPUT,
toolProps: {min: 0, max: 140},
value: null,
onChange: (value) => {
this.setState((prevState) => ({
widgetInnerStyling: {
...prevState.widgetInnerStyling,
paddingTop: `${value}px`,
paddingBottom: `${value}px`
}
}))
// this.setState({
// widgetInnerStyling: widgetStyle
// })
this.setAttrValue("padding.padY", value)
}
},
},
margin: {
label: "Margin",
marginX: {
label: "Margin X",
tool: Tools.NUMBER_INPUT,
toolProps: {min: 0, max: 140},
value: null,
onChange: (value) => {
this.updateState((prev) => ({
widgetOuterStyling: {
...prev.widgetOuterStyling,
marginLeft: `${value}px`,
marginRight: `${value}px`
},
}))
this.setAttrValue("margin.marginX", value)
}
},
marginY: {
label: "Margin Y",
tool: Tools.NUMBER_INPUT,
toolProps: {min: 0, max: 140},
value: null,
onChange: (value) => {
this.updateState((prev) => ({
widgetOuterStyling: {
...prev.widgetOuterStyling,
marginTop: `${value}px`,
marginBottom: `${value}px`
},
}))
this.setAttrValue("margin.marginY", value)
}
},
},
}
}
}
@@ -26,18 +122,59 @@ class Frame extends TkinterBase{
this.setAttrValue("styling.backgroundColor", "#EDECEC")
}
getConfigCode(){
const bg = this.getAttrValue("styling.backgroundColor")
const fitWidth = this.state.fitContent.width
const fitHeight = this.state.fitContent.height
const {width, height} = this.getSize()
const {layout} = this.getParentLayout()
const config = {
bg: `"${bg}"`
}
if (layout !== Layouts.PLACE){
if (!fitWidth){
config['width'] = width
}
if (!fitHeight){
config['height'] = height
}
}
return config
}
generateCode(variableName, parent){
const bg = this.getAttrValue("styling.backgroundColor")
const config = convertObjectToKeyValueString(this.getConfigCode())
return [
`${variableName} = tk.Frame(master=${parent})`,
`${variableName}.config(bg="${bg}")`,
`${variableName}.${this.getLayoutCode()}`
`${variableName}.config(${config})`,
`${variableName}.${this.getLayoutCode()}`,
...this.getGridLayoutConfigurationCode(variableName)
]
}
getToolbarAttrs(){
const {layout, gridConfig, gridWeights, ...toolBarAttrs} = super.getToolbarAttrs()
// places layout at the end
return ({
id: this.__id,
...toolBarAttrs,
padding: this.state.attrs.padding,
margin: this.state.attrs.margin,
layout,
gridConfig,
gridWeights
})
}
renderContent(){
// console.log("bounding rect: ", this.getBoundingRect())
@@ -45,8 +182,10 @@ class Frame extends TkinterBase{
// console.log("widget styling: ", this.state.widgetInnerStyling)
return (
<div className="tw-w-flex tw-flex-col tw-w-full tw-h-full tw-relative tw-rounded-md tw-overflow-hidden">
<div className="tw-p-2 tw-w-full tw-h-full tw-content-start" style={this.getInnerRenderStyling()}>
{this.props.children}
<div className="tw-p-2 tw-w-full tw-h-full tw-content-start"
ref={this.styleAreaRef}
style={this.getInnerRenderStyling()}>
{this.renderTkinterLayout()} {/*This is required for pack layouts, so if your widget accepts child widgets, ensure to add this */}
</div>
</div>
)

View File

@@ -6,6 +6,7 @@ import { TkinterWidgetBase } from "./base"
export class Input extends TkinterWidgetBase{
static widgetType = "entry"
static displayName = "Entry"
constructor(props) {
super(props)
@@ -40,7 +41,7 @@ export class Input extends TkinterWidgetBase{
const config = convertObjectToKeyValueString(this.getConfigCode())
return [
`${variableName} = tk.Entry(master=${parent}, text="${placeHolderText}")`,
`${variableName} = tk.Entry(master=${parent})`,
`${variableName}.config(${config})`,
`${variableName}.${this.getLayoutCode()}`
]
@@ -65,6 +66,7 @@ export class Input extends TkinterWidgetBase{
return (
<div className="tw-w-flex tw-flex-col tw-w-full tw-h-full tw-rounded-md tw-overflow-hidden">
<div className="tw-p-2 tw-w-full tw-h-full tw-flex tw-place-items-center"
ref={this.styleAreaRef}
style={this.getInnerRenderStyling()}>
<div className="tw-text-sm tw-text-gray-300">
{this.getAttrValue("placeHolder")}
@@ -138,6 +140,7 @@ export class Text extends TkinterWidgetBase{
return (
<div className="tw-w-flex tw-flex-col tw-w-full tw-h-full tw-rounded-md tw-overflow-hidden">
<div className="tw-p-2 tw-w-full tw-h-full tw-content-start "
ref={this.styleAreaRef}
style={this.getInnerRenderStyling()}>
<div className="tw-text-sm tw-text-gray-300">
{this.getAttrValue("placeHolder")}

View File

@@ -1,13 +1,18 @@
import { useEffect, useState } from "react"
import { Layouts } from "../../../canvas/constants/layouts"
import Tools from "../../../canvas/constants/tools"
import { convertObjectToKeyValueString } from "../../../utils/common"
import { getPythonAssetPath } from "../../utils/pythonFilePath"
import { ANCHOR } from "../constants/styling"
import { TkinterWidgetBase } from "./base"
class Label extends TkinterWidgetBase{
static widgetType = "label"
static displayName = "Label"
// static requiredCustomPyFiles = ["imageLabel"]
constructor(props) {
super(props)
@@ -19,6 +24,26 @@ class Label extends TkinterWidgetBase{
size: { width: 80, height: 40 },
attrs: {
...this.state.attrs,
styling: {
...this.state.attrs.styling,
anchor: {
label: "Text align",
tool: Tools.SELECT_DROPDOWN,
options: ANCHOR.map((val) => ({value: val, label: val})),
value: "",
onChange: (value) => {
this.setAttrValue("styling.anchor", value)
this.setState((prevState) => ({
widgetInnerStyle: {
...prevState,
...this.getAnchorStyle(value)
}
}))
}
}
},
labelWidget: {
label: "Text",
tool: Tools.INPUT,
@@ -33,6 +58,34 @@ class Label extends TkinterWidgetBase{
value: "",
onChange: (value) => this.setAttrValue("imageUpload", value)
},
imageSize: {
label: "Image size",
display: "horizontal",
// width: {
// label: "Width",
// tool: Tools.NUMBER_INPUT, // the tool to display, can be either HTML ELement or a constant string
// toolProps: { placeholder: "width", max: 3000, min: 1 },
// value: 150,
// onChange: (value) => this.setWidgetSize(value, null)
// },
// height: {
// label: "Height",
// tool: Tools.NUMBER_INPUT,
// toolProps: { placeholder: "height", max: 3000, min: 1 },
// value: 150,
// onChange: (value) => this.setWidgetSize(null, value)
// },
mode: {
label: "Image mode",
tool: Tools.SELECT_DROPDOWN,
options: ["fit", "cover"].map((val) => ({value: val, label: val})),
value: "cover",
onChange: (value) => {
this.setAttrValue("imageSize.mode", value)
}
}
},
}
}
@@ -51,11 +104,20 @@ class Label extends TkinterWidgetBase{
const imports = super.getImports()
if (this.getAttrValue("imageUpload"))
imports.push("import os", "from PIL import Image, ImageTk", )
imports.push("import os", "from PIL import Image, ImageTk", "from customWidgets.imageLabel import ImageLabel")
return imports
}
getRequiredCustomPyFiles(){
const requiredCustomFiles = super.getRequiredCustomPyFiles()
if (this.getAttrValue("imageUpload"))
requiredCustomFiles.push("imageLabel")
return requiredCustomFiles
}
getRequirements(){
const requirements = super.getRequirements()
@@ -66,10 +128,40 @@ class Label extends TkinterWidgetBase{
return requirements
}
getConfigCode(){
const config = super.getConfigCode()
const anchor = this.getAttrValue("styling.anchor")
const fitWidth = this.state.fitContent.width
const fitHeight = this.state.fitContent.height
const {width, height} = this.getSize()
const {layout} = this.getParentLayout()
if (anchor)
config['anchor'] = `"${anchor}"`
// LABEL width and height are not pixel based instead its character based
// if (layout !== Layouts.PLACE){
// if (!fitWidth){
// config['width'] = width
// }
// if (!fitHeight){
// config['height'] = height
// }
// }
return config
}
generateCode(variableName, parent){
const labelText = this.getAttrValue("labelWidget")
const config = convertObjectToKeyValueString(this.getConfigCode())
const image = this.getAttrValue("imageUpload")
@@ -78,10 +170,10 @@ class Label extends TkinterWidgetBase{
const code = []
if (image?.name){
code.push(`${variableName}_img = Image.open(${getPythonAssetPath(image.name, "image")})`)
code.push(`${variableName}_img = ImageTk.PhotoImage(${variableName}_img)`)
// code.push(`${variableName}_img = Image.open(${getPythonAssetPath(image.name, "image")})`)
// code.push(`${variableName}_img = ImageTk.PhotoImage(${variableName}_img)`)
// code.push("\n")
labelInitialization = `${variableName} = tk.Label(master=${parent}, image=${variableName}_img, text="${labelText}", compound=tk.TOP)`
labelInitialization = `${variableName} = ImageLabel(master=${parent}, image_path=${getPythonAssetPath(image.name, "image")}, text="${labelText}", compound=tk.TOP, mode="${this.getAttrValue("imageSize.mode")}")`
}
// code.push("\n")
@@ -108,29 +200,66 @@ class Label extends TkinterWidgetBase{
})
}
renderContent(){
getAnchorStyle = (anchor) => {
const anchorStyles = {
n: { justifyContent: 'center', alignItems: 'flex-start' },
s: { justifyContent: 'center', alignItems: 'flex-end' },
e: { justifyContent: 'flex-end', alignItems: 'center' },
w: { justifyContent: 'flex-start', alignItems: 'center' },
ne: { justifyContent: 'flex-end', alignItems: 'flex-start' },
se: { justifyContent: 'flex-end', alignItems: 'flex-end' },
nw: { justifyContent: 'flex-start', alignItems: 'flex-start' },
sw: { justifyContent: 'flex-start', alignItems: 'flex-end' },
center: { justifyContent: 'center', alignItems: 'center' }
}
return anchorStyles[anchor] || anchorStyles["center"];
}
renderContent(){
//FIXME: label image causing issues
const image = this.getAttrValue("imageUpload")
const imageMode = this.getAttrValue("imageSize.mode") || "cover"
const imgClassName = imageMode === "fit" ? "tw-object-contain" : (imageMode === "cover" ? "tw-object-cover" : "")
return (
<div className="tw-w-flex tw-flex-col tw-w-full tw-content-start tw-h-full tw-rounded-md tw-overflow-hidden"
style={{
flexGrow: 1, // Ensure the content grows to fill the parent
minWidth: '100%', // Force the width to 100% of the parent
minHeight: '100%', // Force the height to 100% of the parent
}}
<div className="tw-flex tw-flex-col tw-w-full tw-relative tw-content-start tw-h-full tw-rounded-md tw-overflow-hidden"
// style={{
// flexGrow: 1, // Ensure the content grows to fill the parent
// minWidth: '100%', // Force the width to 100% of the parent
// minHeight: '100%', // Force the height to 100% of the parent
// }}
>
<div className="tw-p-2 tw-w-full tw-h-full tw-flex tw-place-content-center tw-place-items-center "
<div className="tw-p-2 tw-w-full tw-h-full tw-overflow-hidden tw-flex tw-place-content-center tw-place-items-center"
ref={this.styleAreaRef}
style={this.getInnerRenderStyling()}>
{/* {this.props.children} */}
{
image && (
<img src={image.previewUrl} className="tw-bg-contain tw-w-full tw-h-full" />
)
}
<div className="" style={{color: this.getAttrValue("styling.foregroundColor")}}>
{this.getAttrValue("labelWidget")}
</div>
{/* {this.props.children} */}
{
image ? (
<div className="tw-relative tw-w-full tw-h-full tw-overflow-hidden">
<img src={image.previewUrl}
className={`${imgClassName}`}
alt={this.getAttrValue("widgetName")}
style={{
width: "100%",
height: "100%",
position: "absolute",
top: '0px',
left: '0px',
}}
// className="tw-object-cover"
/>
</div>
) : null
}
<div className={`tw-flex ${!image ? "tw-w-full tw-h-full" : ""}`} style={{
color: this.getAttrValue("styling.foregroundColor"),
...this.getAnchorStyle(this.getAttrValue("styling.anchor"))
}}>
{this.getAttrValue("labelWidget")}
</div>
</div>
</div>
)
@@ -139,4 +268,44 @@ class Label extends TkinterWidgetBase{
}
function LabelImage({imageSrc, alt, styleAreaRef}){
const [size, setSize] = useState({
width: 0,
height: 0
})
useEffect(() => {
if (!styleAreaRef.current) return;
// Function to update size
const updateSize = () => {
const boundingBox = styleAreaRef.current.getBoundingClientRect();
setSize({ width: boundingBox.width, height: boundingBox.height });
};
// Initial size update
updateSize();
// Observe size changes
const resizeObserver = new ResizeObserver(updateSize);
resizeObserver.observe(styleAreaRef.current);
return () => resizeObserver.disconnect();
}, [styleAreaRef])
return (
<img src={imageSrc} alt={alt} className="tw-object-cover"
style={{
position: "absolute",
top: '0px',
left: '0px',
width: "100%", // Prevent overflow
height: "100%", // Prevent overflow
}}
/>
)
}
export default Label

View File

@@ -1,11 +1,19 @@
import Widget from "../../../canvas/widgets/base"
import Tools from "../../../canvas/constants/tools"
import { TkinterBase } from "./base"
import { removeKeyFromObject } from "../../../utils/common"
import { getPythonAssetPath } from "../../utils/pythonFilePath"
class MainWindow extends TkinterBase{
static widgetType = "main_window"
static displayName = "Main Window"
static initialSize = {
width: 700,
height: 400
}
constructor(props) {
super(props)
@@ -14,18 +22,27 @@ class MainWindow extends TkinterBase{
exclude: ["image", "video", "media", "main_window", "toplevel"]
}
const newAttrs = removeKeyFromObject("margin", this.state.attrs)
this.state = {
...this.state,
size: { width: 700, height: 400 },
size: { width: MainWindow.initialSize.width, height: MainWindow.initialSize.height },
widgetName: "main",
attrs: {
...this.state.attrs,
...newAttrs,
title: {
label: "Window Title",
tool: Tools.INPUT, // the tool to display, can be either HTML ELement or a constant string
toolProps: {placeholder: "Window title", maxLength: 40},
value: "Main Window",
onChange: (value) => this.setAttrValue("title", value)
},
logo: {
label: "Window Logo",
tool: Tools.UPLOADED_LIST,
toolProps: {filterOptions: ["image/jpg", "image/jpeg", "image/png"]},
value: "",
onChange: (value) => this.setAttrValue("logo", value)
}
}
@@ -33,29 +50,58 @@ class MainWindow extends TkinterBase{
}
// componentDidMount(){
// // this.setAttrValue("styling.backgroundColor", "#E4E2E2")
// super.componentDidMount()
// //this.setAttrValue("styling", { backgroundColor: "#E4E2E2" }) refactor to something like this?
// this.setAttrValue("styling.backgroundColor", "#E4E2E2")
// console.log("mounted: ", this.state)
// }
componentDidMount(){
this.setAttrValue("styling.backgroundColor", "#E4E2E2")
super.componentDidMount()
}
generateCode(variableName, parent){
const backgroundColor = this.getAttrValue("styling.backgroundColor")
return [
`${variableName} = tk.Tk()`,
`${variableName}.config(bg="${backgroundColor}")`,
`${variableName}.title("${this.getAttrValue("title")}")`
]
const logo = this.getAttrValue("logo")
const {width, height} = this.getSize()
const code = [
`${variableName} = tk.Tk()`,
`${variableName}.config(bg="${backgroundColor}")`,
`${variableName}.title("${this.getAttrValue("title")}")`,
`${variableName}.geometry("${width}x${height}")`,
...this.getGridLayoutConfigurationCode(variableName)
]
if (logo?.name){
// code.push(`\n`)
code.push(`${variableName}_img = Image.open(${getPythonAssetPath(logo.name, "image")})`)
code.push(`${variableName}_img = ImageTk.PhotoImage(${variableName}_img)`)
code.push(`${variableName}.iconphoto(False, ${variableName}_img)`)
// code.push("\n")
}
return code
}
getImports(){
const imports = super.getImports()
if (this.getAttrValue("logo"))
imports.push("import os", "from PIL import Image, ImageTk", )
return imports
}
getRequirements(){
const requirements = super.getRequirements()
if (this.getAttrValue("logo"))
requirements.push("pillow")
return requirements
}
getToolbarAttrs(){
@@ -65,18 +111,28 @@ class MainWindow extends TkinterBase{
id: this.__id,
widgetName: toolBarAttrs.widgetName,
title: this.state.attrs.title,
logo: this.state.attrs.logo,
size: toolBarAttrs.size,
...this.state.attrs,
})
}
renderContent(){
const logo = this.getAttrValue("logo")
return (
<div className="tw-w-flex tw-flex-col tw-w-full tw-h-full tw-rounded-md tw-overflow-hidden">
<div className="tw-flex tw-w-full tw-h-[25px] tw-bg-[#c7c7c7] tw-p-1
tw-overflow-hidden tw-shadow-xl tw-place-items-center">
tw-overflow-hidden tw-shadow-xl tw-place-items-center tw-gap-1">
{
logo && (
<img src={logo.previewUrl} alt={logo.name}
className="tw-bg-contain tw-w-[15px] tw-h-[15px] tw-rounded-sm" />
)
}
<div className="tw-text-sm">{this.getAttrValue("title")}</div>
<div className="tw-ml-auto tw-flex tw-gap-1 tw-place-items-center">
<div className="tw-bg-yellow-400 tw-rounded-full tw-w-[15px] tw-h-[15px]">
@@ -88,8 +144,10 @@ class MainWindow extends TkinterBase{
</div>
</div>
<div className="tw-p-2 tw-w-full tw-relative tw-h-full tw-overflow-hidden tw-content-start"
style={this.getInnerRenderStyling()}>
{this.props.children}
ref={this.styleAreaRef}
style={{...this.getInnerRenderStyling(), width: "100%", height: "calc(100% - 25px)"}}>
{/* {this.props.children} */}
{this.renderTkinterLayout()} {/* This is required for pack layouts, so if your widget accepts child widgets, ensure to add this */}
</div>
</div>
)

View File

@@ -7,6 +7,7 @@ import { convertObjectToKeyValueString } from "../../../utils/common"
class OptionMenu extends TkinterWidgetBase{
static widgetType = "option_menu"
static displayName = "Option Menu"
constructor(props) {
super(props)
@@ -100,6 +101,7 @@ class OptionMenu extends TkinterWidgetBase{
return (
<div className="tw-flex tw-p-1 tw-w-full tw-h-full tw-rounded-md tw-overflow-hidden"
style={this.getInnerRenderStyling()}
ref={this.styleAreaRef}
onClick={this.toggleDropDownOpen}
>
<div className="tw-flex tw-justify-between tw-gap-1">

View File

@@ -7,6 +7,8 @@ import {TkinterBase, TkinterWidgetBase} from "./base"
class Slider extends TkinterWidgetBase{
static widgetType = "scale"
static displayName = "Scale"
// FIXME: You provided a `value` prop to a form field without an `onChange` handler. This will render a read-only field. If the field should be mutable use
constructor(props) {
super(props)
@@ -136,7 +138,9 @@ class Slider extends TkinterWidgetBase{
return (
<div className="tw-w-flex tw-flex-col tw-w-full tw-h-full tw-rounded-md tw-overflow-hidden">
<div className="flex flex-col items-center justify-center h-screen
bg-gray-100" style={this.getInnerRenderStyling()}>
bg-gray-100"
ref={this.styleAreaRef}
style={this.getInnerRenderStyling()}>
<div className="w-full max-w-md">
<input
type="range"

View File

@@ -8,6 +8,7 @@ import {TkinterBase, TkinterWidgetBase} from "./base"
class SpinBox extends TkinterWidgetBase{
static widgetType = "spin_box"
static displayName = "Spin Box"
constructor(props) {
super(props)
@@ -109,6 +110,7 @@ class SpinBox extends TkinterWidgetBase{
return (
<div className="tw-w-flex tw-flex-col tw-w-full tw-h-full tw-rounded-md tw-overflow-hidden">
<div className="tw-p-2 tw-w-full tw-h-full tw-flex tw-place-items-center tw-justify-between"
ref={this.styleAreaRef}
style={this.getInnerRenderStyling()}>
<div className="tw-text-sm ">
{this.getAttrValue("spinProps.default")}

View File

@@ -1,10 +1,14 @@
import Widget from "../../../canvas/widgets/base"
import Tools from "../../../canvas/constants/tools"
import { getPythonAssetPath } from "../../utils/pythonFilePath"
import { TkinterBase } from "./base"
class TopLevel extends Widget{
class TopLevel extends TkinterBase{
static widgetType = "toplevel"
static displayName = "Top Level"
constructor(props) {
super(props)
@@ -26,6 +30,13 @@ class TopLevel extends Widget{
toolProps: {placeholder: "Window title", maxLength: 40},
value: "Top level",
onChange: (value) => this.setAttrValue("title", value)
},
logo: {
label: "Toplevel Logo",
tool: Tools.UPLOADED_LIST,
toolProps: {filterOptions: ["image/jpg", "image/jpeg", "image/png"]},
value: "",
onChange: (value) => this.setAttrValue("logo", value)
}
}
@@ -37,15 +48,54 @@ class TopLevel extends Widget{
super.componentDidMount()
}
generateCode(variableName, parent){
const backgroundColor = this.getAttrValue("styling.backgroundColor")
return [
`${variableName} = tk.Toplevel(master=${parent})`,
`${variableName}.config(bg="${backgroundColor}")`,
`${variableName}.title("${this.getAttrValue("title")}")`
]
const logo = this.getAttrValue("logo")
const {width, height} = this.getSize()
const code = [
`${variableName} = tk.Toplevel(master=${parent})`,
`${variableName}.config(bg="${backgroundColor}")`,
`${variableName}.title("${this.getAttrValue("title")}")`,
`${variableName}.geometry("${width}x${height}")`,
...this.getGridLayoutConfigurationCode(variableName)
]
if (logo?.name){
// code.push(`\n`)
code.push(`${variableName}_img = Image.open(${getPythonAssetPath(logo.name, "image")})`)
code.push(`${variableName}_img = ImageTk.PhotoImage(${variableName}_img)`)
code.push(`${variableName}.iconphoto(False, ${variableName}_img)`)
// code.push("\n")
}
return code
}
getImports(){
const imports = super.getImports()
if (this.getAttrValue("logo"))
imports.push("import os", "from PIL import Image, ImageTk", )
return imports
}
getRequirements(){
const requirements = super.getRequirements()
if (this.getAttrValue("logo"))
requirements.push("pillow")
return requirements
}
getToolbarAttrs(){
@@ -54,18 +104,26 @@ class TopLevel extends Widget{
return ({
widgetName: toolBarAttrs.widgetName,
title: this.state.attrs.title,
logo: this.state.attrs.logo,
size: toolBarAttrs.size,
...this.state.attrs,
})
}
renderContent(){
const logo = this.getAttrValue("logo")
return (
<div className="tw-w-flex tw-flex-col tw-w-full tw-h-full tw-rounded-md tw-overflow-hidden">
<div className="tw-flex tw-w-full tw-h-[25px] tw-bg-[#c7c7c7] tw-p-1
<div className="tw-flex tw-w-full tw-h-[25px] tw-bg-[#c7c7c7] tw-p-1 tw-gap-1
tw-overflow-hidden tw-shadow-xl tw-place-items-center">
{
logo && (
<img src={logo.previewUrl} alt={logo.name}
className="tw-bg-contain tw-w-[15px] tw-h-[15px] tw-rounded-sm" />
)
}
<div className="tw-text-sm">{this.getAttrValue("title")}</div>
<div className="tw-ml-auto tw-flex tw-gap-1 tw-place-items-center">
<div className="tw-bg-yellow-400 tw-rounded-full tw-w-[15px] tw-h-[15px]">
@@ -76,8 +134,10 @@ class TopLevel extends Widget{
</div>
</div>
</div>
<div className="tw-p-2 tw-w-full tw-h-full tw-content-start" style={this.state.widgetInnerStyling}>
{this.props.children}
<div className="tw-p-2 tw-w-full tw-h-full tw-content-start"
ref={this.styleAreaRef}
style={this.state.widgetInnerStyling}>
{this.renderTkinterLayout()}
</div>
</div>
)

View File

@@ -11,8 +11,12 @@ import { QueryClient, QueryClientProvider } from "react-query";
import "./styles/tailwind.css";
import "./styles/index.css";
import { FileUploadProvider } from "./contexts/fileUploadContext";
window.React = React
const originalSetItem = localStorage.setItem;
// triggers itemsChaned event whenever the item in localstorage is chanegd.
localStorage.setItem = function (key, value) {

View File

@@ -9,6 +9,7 @@ import ButtonWidget from "../assets/widgets/button.png"
import { filterObjectListStartingWith } from "../utils/filter"
import Widget from "../canvas/widgets/base"
import { SearchComponent } from "../components/inputs"
import { Button } from "antd"
/**
@@ -72,6 +73,13 @@ function PluginsContainer({sidebarContent, onWidgetsUpdate}){
})
}
</div>
<Button href="https://github.com/PaulleDemon/PyUIBuilder/issues"
target="_blank" rel="noopener noreferrer"
className="tw-flex tw-mt-6 btn"
>
Request new plugin
</Button>
</div>
)

View File

@@ -4,7 +4,7 @@
*/
import { useEffect, useRef, useMemo, useState } from "react";
import { BookOutlined, CloseCircleFilled, CrownFilled, GithubFilled, ShareAltOutlined } from "@ant-design/icons";
import { BookOutlined, CloseCircleFilled, CrownFilled, DiscordFilled, GithubFilled, ShareAltOutlined } from "@ant-design/icons";
import KO_FI from "../assets/logo/ko-fi.png"
import Premium from "./utils/premium";
@@ -62,7 +62,7 @@ function Sidebar({tabs}){
>
<div className="tw-min-w-[80px] tw-w-[80px] tw-h-full tw-flex tw-flex-col tw-gap-4 tw-p-3 tw-place-items-center">
<div className="tw-min-w-[80px] tw-w-[80px] tw-bg-gray-100 tw-h-full tw-flex tw-flex-col tw-gap-4 tw-p-3 tw-place-items-center">
{
sidebarTabs.map((tab, index) => {
return (
@@ -88,6 +88,11 @@ function Sidebar({tabs}){
}
<div className="tw-flex tw-flex-col tw-place-content-items tw-place-items-center tw-gap-3 tw-mt-auto">
<a href="https://discord.gg/dHXjrrCA7G" target="_blank"
title="discord invite"
rel="noopener noreferrer" className="tw-text-3xl tw-cursor-pointer tw-text-[#5562EA]">
<DiscordFilled />
</a>
<Premium className="tw-text-2xl tw-bg-purple-700 tw-text-center
tw-w-[35px] tw-h-[35px] tw-rounded-md
tw-cursor-pointer tw-text-white
@@ -99,7 +104,7 @@ function Sidebar({tabs}){
<ShareAltOutlined />
</Share>
<a className="tw-cursor-pointer tw-text-xl tw-text-gray-700"
href="https://pyuibuilder-docs.pages.dev/"
href="https://docs.pyuibuilder.com/"
target="_blank" rel="noopener noreferrer">
<i className="bi bi-book-half"></i>
</a>
@@ -107,13 +112,15 @@ function Sidebar({tabs}){
rel="noopener noreferrer" className="tw-text-2xl tw-cursor-pointer tw-text-black">
<GithubFilled />
</a>
<a href="https://ko-fi.com/artpaul" className="tw-cursor-pointer ">
{/* <a href="https://ko-fi.com/artpaul" className="tw-cursor-pointer ">
<img src={KO_FI} alt="ko-fi" className="tw-w-[30px] tw-h-[30px]"/>
</a>
</a> */}
</div>
</div>
<div className="tw-w-full tw-h-full tw-bg-inherit tw-flex tw-flex-col tw-overflow-x-hidden" ref={sideBarExtraRef}>
<div className="tw-w-full tw-h-full tw-bg-inherit tw-rounded-lg
tw-shadow-[rgb(207,207,207)] tw-shadow-[rgb(207,207,207,0.5)_-3px_0px_10px_] tw-flex tw-flex-col tw-overflow-x-hidden"
ref={sideBarExtraRef}>
<div className="tw-w-full tw-h-[50px] tw-flex tw-place-content-end tw-p-1">
<button className="tw-outline-none tw-bg-transparent tw-border-none tw-text-gray-600 tw-cursor-pointer tw-text-xl"
onClick={closeSidebar}

View File

@@ -50,10 +50,13 @@ function TemplatesContainer(){
<div className="tw-flex tw-flex-col tw-mt-6 tw-gap-2">
<div>Want to be notified of the release?</div>
<a href="https://paulfreeman.substack.com/subscribe?utm_source=pyGUIBuilder_web"
<button data-tally-open="mVDY7N" data-tally-layout="modal" data-tally-emoji-text="👋"
data-tally-emoji-animation="wave" className="tw-p-2 tw-w-full tw-outline-none tw-bg-blue-500 tw-rounded-md tw-no-underline
tw-text-white tw-text-center tw-py-3 tw-border-none tw-text-base tw-shadow-md tw-cursor-pointer">Join the waitlist</button>
{/* <a href="https://paulfreeman.substack.com/subscribe?utm_source=pyGUIBuilder_web"
className="tw-p-2 tw-w-full tw-bg-blue-500 tw-rounded-md tw-no-underline
tw-text-white tw-text-center tw-py-3"
target="_blank" rel="noreferrer noopener">Subscribe to newsletter</a>
target="_blank" rel="noreferrer noopener">Join the waitlist</a> */}
</div>
</div>

View File

@@ -0,0 +1,76 @@
import { useEffect, useMemo, useState } from "react"
import { CloseCircleFilled, SearchOutlined } from "@ant-design/icons"
import { SidebarWidgetCard, TreeViewCard } from "../components/cards"
import { Tree } from "antd"
import { useWidgetContext } from "../canvas/context/widgetContext"
function transformWidgets(widgets, widgetRefs, isTopLevel=true) {
// console.log("Wdiegts refs: ", widgetRefs)
return widgets.map(widget => ({
title: widgetRefs.current[widget.id].current.getDisplayName(), // Assuming widgetType is a class
key: widget.id,
isTopLevel: isTopLevel,
widgetRef: widgetRefs.current[widget.id],
children: widget.children.length > 0 ? transformWidgets(widget.children, widgetRefs, false) : []
}))
}
/**
*
* @param {function} onWidgetsUpdate - this is a callback that will be called once the sidebar is populated with widgets
* @returns
*/
function TreeviewContainer() {
const {widgets, widgetRefs} = useWidgetContext()
const transformedContent = useMemo(() => {
return (transformWidgets(widgets, widgetRefs))
}, [widgets, widgetRefs])
const topLevelKeys = transformedContent.filter(cont => cont.isTopLevel).map(cont => cont.key)
return (
<div className="tw-w-full tw-p-2 tw-gap-4 tw-flex tw-flex-col tw-overflow-x-hidden">
{/* <SearchComponent onSearch={onSearch} searchValue={searchValue}
onClear={() => setSearchValue("")} /> */}
<div className="tw-flex tw-flex-col tw-gap-2 tw-w-full tw-h-full tw-p-1">
<Tree showLine
treeData={transformedContent}
titleRender={(nodeData) =>
<TreeViewCard widgetId={nodeData.id} title={nodeData.title}
widgetRef={nodeData.widgetRef}
isTopLevel={nodeData.isTopLevel}/>
}
defaultExpandedKeys={topLevelKeys}
>
</Tree>
{
Object.keys(transformedContent || {}).length === 0 &&
<div className="tw-text-sm tw-place-content-center">
Start adding widgets to view it in tree view
</div>
}
</div>
</div>
)
}
export default TreeviewContainer

View File

@@ -33,24 +33,30 @@ function Premium({ children, className = "" }) {
open={premiumModalOpen}
>
<div className="tw-mt-5 tw-text-lg tw-max-w-[850px] tw-w-full ">
I am Paul, a indie open-source dev.
I am Paul, an indie open-source dev.
If you find this tool useful and want to fund and support it's development, consider buying a <b>one time license</b>.
<br />
<br />
By buying pre-order license, you get advance features, priority support, early access, upcoming features, and &nbsp;
By pre-ordering license, you get discounted price, advance features, priority support, early access, upcoming features, and &nbsp;
<a
href="https://github.com/PaulleDemon/tab=readme-ov-file"
href="https://github.com/PaulleDemon/PyUIBuilder/blob/main/roadmap.md"
target="_blank"
rel="noreferrer noopener"
className="!tw-text-blue-500"
>
more.
</a>
</a>
<br />
<br />
Premium features will start rolling out phase wise from mid of April, after which there would be a price increase.
</div>
<section className="tw-mt-1 tw-flex tw-w-full tw-flex-col tw-place-items-center tw-p-[2%] max-lg:tw-p-2" id="pricing">
<h3 className="tw-text-2xl tw-font-medium max-md:tw-text-2xl">Choose your plan</h3>
<div className="tw-mt-10 tw-flex tw-place-content-center tw-gap-8 max-lg:tw-flex-col">
<div className="tw-mt-6 tw-flex tw-place-content-center tw-gap-8 max-lg:tw-flex-col">
{/* Free Plan */}
<div className="tw-flex tw-w-[380px] tw-border-[1px] tw-border-gray-500 tw-border-solid tw-flex-col tw-place-items-center tw-gap-2 tw-rounded-lg tw-p-8 tw-shadow-xl max-lg:tw-w-[340px]">
<h3>
@@ -69,6 +75,16 @@ function Premium({ children, className = "" }) {
<i className="bi bi-check-circle-fill tw-text-green-600 tw-text-base"></i>
<span>Commercial use</span>
</li>
<li className="tw-flex tw-place-items-center tw-gap-2">
<i className="bi bi-x-circle-fill tw-text-red-600 tw-text-base"></i>
<span>Premium widgets &nbsp;
<span className="tw-text-sm">(eg: tab widget, file upload, multi-page support, 3rd party widget library support etc)</span>
</span>
</li>
<li className="tw-flex tw-place-items-center tw-gap-2">
<i className="bi bi-x-circle-fill tw-text-red-600 tw-text-base"></i>
<span>Premium Templates</span>
</li>
<li className="tw-flex tw-place-items-center tw-gap-2">
<i className="bi bi-x-circle-fill tw-text-red-600 tw-text-base"></i>
<span>Downloadable UI builder exe for local development</span>
@@ -113,7 +129,7 @@ function Premium({ children, className = "" }) {
<div className="tw-flex tw-w-[380px] tw-flex-col tw-place-items-center tw-gap-2 tw-rounded-lg tw-border-2 tw-border-solid
tw-border-blue-500 tw-p-8 tw-shadow-xl max-lg:tw-w-[340px]">
<div className="tw-text-white tw-p-1 tw-px-3 tw-bg-blue-500 tw-rounded-full">
Limited time offer
Pre-order offer
</div>
<div className="tw-text-white tw-font-medium tw-p-1 tw-px-3 tw-bg-green-700 tw-rounded-full">
Hobby
@@ -129,7 +145,7 @@ function Premium({ children, className = "" }) {
Support open-source development 🚀. Plus, get added benefits.
</p>
<hr />
<ul className="tw-mt-4 tw-flex tw-flex-col tw-gap-3 tw-text-xl tw-text-gray-600">
<ul className="tw-mt-4 tw-flex tw-flex-col tw-gap-3 tw-text-xl tw-text-black">
<li className="tw-flex tw-place-items-center tw-gap-2">
<i className="bi bi-check-circle-fill tw-text-green-600 tw-text-base"></i>
<span>Access to web-based editor</span>
@@ -138,6 +154,16 @@ function Premium({ children, className = "" }) {
<i className="bi bi-check-circle-fill tw-text-green-600 tw-text-base"></i>
<span>Downloadable UI builder exe for local development</span>
</li>
<li className="tw-flex tw-place-items-center tw-gap-2">
<i className="bi bi-check-circle-fill tw-text-green-600 tw-text-base"></i>
<span>Premium widgets &nbsp;
<span className="tw-text-sm">(eg: tab widget, file upload, multi-page support, 3rd party widget library support etc)</span>
</span>
</li>
<li className="tw-flex tw-place-items-center tw-gap-2">
<i className="bi bi-check-circle-fill tw-text-green-600 tw-text-base"></i>
<span>Premium Templates</span>
</li>
<li className="tw-flex tw-place-items-center tw-gap-2">
<i className="bi bi-check-circle-fill tw-text-green-600 tw-text-base"></i>
<span>Preview live</span>
@@ -192,7 +218,7 @@ function Premium({ children, className = "" }) {
<div className="tw-flex tw-w-[380px] tw-flex-col tw-place-items-center tw-gap-2 tw-rounded-lg tw-border-3 tw-border-solid
tw-border-green-600 tw-p-8 tw-shadow-xl max-lg:tw-w-[340px]">
<div className="tw-text-white tw-p-1 tw-px-3 tw-bg-blue-500 tw-rounded-full">
Limited time offer
Pre-order offer
</div>
<div className="tw-text-white tw-font-medium tw-p-1 tw-px-3 tw-bg-green-700 tw-rounded-full">
Commercial
@@ -208,7 +234,7 @@ function Premium({ children, className = "" }) {
Support open-source development 🚀. Plus, get added benefits.
</p>
<hr />
<ul className="tw-mt-4 tw-flex tw-flex-col tw-gap-3 tw-text-xl tw-text-gray-600">
<ul className="tw-mt-4 tw-flex tw-flex-col tw-gap-3 tw-text-xl">
<li className="tw-flex tw-place-items-center tw-gap-2">
<i className="bi bi-check-circle-fill tw-text-green-600 tw-text-base"></i>
<span>Access to web-based editor</span>
@@ -217,6 +243,16 @@ function Premium({ children, className = "" }) {
<i className="bi bi-check-circle-fill tw-text-green-600 tw-text-base"></i>
<span>Downloadable UI builder exe for local development</span>
</li>
<li className="tw-flex tw-place-items-center tw-gap-2">
<i className="bi bi-check-circle-fill tw-text-green-600 tw-text-base"></i>
<span>Premium widgets &nbsp;
<span className="tw-text-sm">(eg: tab widget, file upload, multi-page support, 3rd party widget library support etc)</span>
</span>
</li>
<li className="tw-flex tw-place-items-center tw-gap-2">
<i className="bi bi-check-circle-fill tw-text-green-600 tw-text-base"></i>
<span>Premium Templates</span>
</li>
<li className="tw-flex tw-place-items-center tw-gap-2">
<i className="bi bi-check-circle-fill tw-text-green-600 tw-text-base"></i>
<span>Preview live</span>
@@ -267,6 +303,11 @@ function Premium({ children, className = "" }) {
</a>
</div>
</div>
<div className="tw-text-sm tw-mt-4">
Or you could support development by sharing this tool on your socials and you'll be eligible for a
&nbsp;<a href="https://tally.so/r/mJM22X" target="_blank" rel="noreferrer noopener">free license</a>.
</div>
</section>

View File

@@ -45,6 +45,10 @@ function Share({children, className=""}){
footer={null}
open={shareModalOpen}>
<div className="tw-text-lg">
Share and help speed up development
</div>
<div className="tw-mt-5 tw-flex tw-place-content-center tw-w-full tw-place-items-center">
<a onClick={onCopy}
className="hover:!tw-bg-gray-100 hover:!tw-color-black !tw-text-4xl"

View File

@@ -13,7 +13,7 @@ body {
/* width */
::-webkit-scrollbar {
width: 8px;
width: 6px;
}
/* Track */

View File

@@ -69,4 +69,29 @@ export function convertObjectToKeyValueString(obj){
return Object.entries(obj)
.map(([key, value]) => `${key}=${value}`)
.join(', ')
}
/**
*
* @param {HTMLElement} widget
* @param {HTMLElement} gridContainer
* @returns
*/
export const getGridPosition = (widget, gridContainer) => {
if (!widget || !gridContainer) return null;
const widgets = Array.from(gridContainer.children); // Get all grid items
// const index = widgets.indexOf(widget);
const widgetIndex = widgets.indexOf(widget);
if (widgetIndex === -1) return null; // Widget not found
const gridStyles = getComputedStyle(gridContainer);
const columnCount = gridStyles.gridTemplateColumns.split(' ').length;
const row = Math.floor(widgetIndex / columnCount) + 1;
const column = (widgetIndex % columnCount) + 1;
return { row, column };
}

36
src/utils/hooks.js Normal file
View File

@@ -0,0 +1,36 @@
import { useLayoutEffect, useCallback, useState } from 'react';
export const useRect = (ref) => {
const [rect, setRect] = useState({ width: 0, height: 0, top: 0, left: 0, right: 0, bottom: 0 });
const updateRect = useCallback(() => {
if (ref.current) {
setRect(ref.current.getBoundingClientRect());
}
}, [ref]);
useLayoutEffect(() => {
if (!ref.current) return;
const timeout = setTimeout(updateRect, 0); // Delay to next event loop
const observer = new ResizeObserver(updateRect);
observer.observe(ref.current);
return () => {
observer.disconnect()
clearTimeout(timeout)
}
}, [updateRect, ref]);
return rect;
};
/**
* Higher order component to make use of the useRect
*/
export function WithRect({ forwardedRef, children }) {
const rect = useRect(forwardedRef)
return children(rect)
}

5
src/utils/random.js Normal file
View File

@@ -0,0 +1,5 @@
export function randomArrayChoice(arr){
return arr[Math.floor(Math.random() * arr.length)];
}

9
src/utils/system.js Normal file
View File

@@ -0,0 +1,9 @@
export async function isChromium() {
if (navigator.userAgentData) {
const brands = await navigator.userAgentData.getHighEntropyValues(["brands"])
return brands.brands.some(brand => /Chromium|Google Chrome|Microsoft Edge|Opera|Brave/i.test(brand.brand))
}
return false
}

110
webpack.config.js Normal file
View File

@@ -0,0 +1,110 @@
const webpack = require('webpack');
const path = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const CopyWebpackPlugin = require("copy-webpack-plugin");
const CssMinimizerPlugin = require("css-minimizer-webpack-plugin");
const dotenv = require('dotenv');
const fs = require('fs');
const isProduction = process.env.NODE_ENV === "production";
// Load environment variables
let envConfig = {};
if (!isProduction && fs.existsSync(".env-cmdrc.json")) {
const envFile = JSON.parse(fs.readFileSync(".env-cmdrc.json", "utf8"));
envConfig = envFile[process.env.NODE_ENV] || {};
} else {
envConfig = Object.fromEntries(Object.entries(process.env));
}
// Convert JSON to a format Webpack understands
const envKeys = Object.keys(envConfig).reduce((prev, next) => {
prev[`process.env.${next}`] = JSON.stringify(envConfig[next]);
return prev;
}, {});
module.exports = {
mode: isProduction ? "production" : "development",
watch: !isProduction,
watchOptions: {
ignored: /node_modules/,
},
entry: "./src/index.js",
output: {
path: path.resolve(__dirname, "dist"),
filename: isProduction ? "js/[name].[contenthash].js" : "js/[name].js",
publicPath: "./",
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: {
loader: "babel-loader",
options: {
presets: ["@babel/preset-env", "@babel/preset-react"],
},
},
},
{
test: /\.css$/,
use: [MiniCssExtractPlugin.loader, "css-loader", "postcss-loader",],
},
{
test: /\.py$/,
use: "raw-loader", // Load Python files as raw text
},
{
test: /\.svg$/,
use: ["@svgr/webpack"], // Enables importing SVGs as React components
},
{
test: /\.(png|jpe?g|gif|ico)$/,
type: "asset/resource", // Handles image files
},
],
},
plugins: [
new webpack.DefinePlugin(envKeys),
new HtmlWebpackPlugin({
template: "./public/index.html",
minify: isProduction,
inject: true,
templateParameters: envConfig
}),
(isProduction ? new MiniCssExtractPlugin({ filename: 'styles.[contenthash].css' }) : new MiniCssExtractPlugin()),
new CopyWebpackPlugin({
patterns: [
{
from: path.resolve(__dirname, "src/assets"),
to: "assets", // Copies to `dist/assets`
noErrorOnMissing: true, // Prevents errors if the folder is missing
},
{ from: 'public', to: '', noErrorOnMissing: true, globOptions: { ignore: ['**/index.html'] }}, // Copies everything else from public to dist
],
}),
],
optimization: isProduction
? {
minimize: true,
minimizer: [new CssMinimizerPlugin()],
}
: {},
devServer: {
static: path.join(__dirname, "public"),
port: 3000,
hot: true,
historyApiFallback: true,
},
};