Skip to content

Commit b02d1ed

Browse files
committed
minor gui enhancements. remove sizes config
1 parent cf0f3bb commit b02d1ed

21 files changed

+714
-570
lines changed

README.md

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ Use this module to convert a CLI program to a GUI
2828
- [gui (optional)](#gui-optional)
2929
- [theme (optional)](#theme-optional)
3030
- [darkTheme (optional)](#darktheme-optional)
31-
- [sizes (optional)](#sizes-optional)
3231
- [image (optional)](#image-optional)
3332
- [program\_name (optional)](#program_name-optional)
3433
- [program\_description (optional)](#program_description-optional)
@@ -268,21 +267,6 @@ Set a base24 dark theme variant. Can also pass a base24 scheme file. eg.
268267
"#e48bff"])
269268
```
270269

271-
### sizes (optional)
272-
273-
Set the UI sizes such as the button size
274-
275-
```python
276-
@Cli2Gui(sizes={
277-
"title_size": 28,
278-
"label_size": (30, None),
279-
"input_size": (30, 1),
280-
"button":(10, 1),
281-
"padding":(5, 10),
282-
"helpText_size": 14,
283-
"text_size": 11})
284-
```
285-
286270
### image (optional)
287271

288272
Set the program icon. File extensions can be any that PIL supports

cli2gui/decorators.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ def Click2Gui(
107107
gui: str | GUIType = "dearpygui",
108108
theme: str | list[str] = "",
109109
darkTheme: str | list[str] = "",
110-
sizes: str | dict[str, int] = "",
111110
image: str = "",
112111
program_name: str = "",
113112
program_description: str = "",
@@ -129,8 +128,6 @@ def Click2Gui(
129128
darkTheme (Union[str, list[str]], optional): Set a base24 dark
130129
theme variant. Can also pass a base24 scheme file. eg. one-dark.yaml.
131130
Defaults to "".
132-
sizes (Union[dict[str, int]], optional): Set the UI sizes such as
133-
the button size. Defaults to "".
134131
image (str, optional): Set the program icon. File
135132
extensions can be any that PIL supports. Defaults to "".
136133
program_name (str, optional): Override the program name.
@@ -155,7 +152,6 @@ def Click2Gui(
155152
gui=gui,
156153
theme=theme,
157154
darkTheme=darkTheme,
158-
sizes=sizes,
159155
image=image,
160156
program_name=program_name,
161157
program_description=program_description,
@@ -176,7 +172,6 @@ def Cli2Gui(
176172
gui: str | ParserType = "dearpygui",
177173
theme: str | list[str] = "",
178174
darkTheme: str | list[str] = "",
179-
sizes: str | dict[str, int] = "",
180175
image: str = "",
181176
program_name: str = "",
182177
program_description: str = "",
@@ -203,8 +198,6 @@ def Cli2Gui(
203198
darkTheme (Union[str, list[str]], optional): Set a base24 dark
204199
theme variant. Can also pass a base24 scheme file. eg. one-dark.yaml.
205200
Defaults to "".
206-
sizes (Union[dict[str, int]], optional): Set the UI sizes such as
207-
the button size. Defaults to "".
208201
image (str, optional): Set the program icon. File
209202
extensions can be any that PIL supports. Defaults to "".
210203
program_name (str, optional): Override the program name.
@@ -228,7 +221,6 @@ def Cli2Gui(
228221
gui=gui,
229222
theme=theme,
230223
darkTheme=darkTheme,
231-
sizes=sizes,
232224
image=image,
233225
program_name=program_name,
234226
program_description=program_description,

cli2gui/gui/dearpygui_wrapper.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ def main(
186186
)
187187
dpg.add_theme_color(
188188
dpg.mvThemeCol_MenuBarBg,
189-
hex_to_rgb(self.base24Theme[2]),
189+
hex_to_rgb(self.base24Theme[0]),
190190
category=dpg.mvThemeCat_Core,
191191
)
192192
dpg.add_theme_color(
@@ -284,7 +284,11 @@ def main(
284284
# Create Window, set up Menu and Widgets
285285
################
286286

287-
dpg.create_viewport(title=buildSpec["program_name"], width=875, height=600)
287+
dpg.create_viewport(
288+
title=buildSpec["program_name"],
289+
width=875,
290+
height=min(max(400, 120 * buildSpec["max_args_shown"]), 1080),
291+
)
288292

289293
with dpg.window(label="", tag="primary"):
290294
if len(buildSpec["menu"]) > 0:

cli2gui/gui/pysimplegui_wrapper.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def __init__(self, base24Theme: list[str], psg_lib: str) -> None:
4040

4141
if psg_lib in ["pysimpleguiqt", "pysimpleguiweb"]:
4242
self.sizes = {
43-
"title_size": 28,
43+
"title_size": 18,
4444
"label_size": (600, None),
4545
"input_size": (30, 1),
4646
"button": (10, 1),
@@ -387,9 +387,15 @@ def createLayout(
387387
argConstruct,
388388
size=(
389389
850,
390-
buildSpec["max_args_shown"]
391-
* 3.5
392-
* (self.sizes["help_text_size"] + self.sizes["text_size"]),
390+
min(
391+
max(
392+
280,
393+
buildSpec["max_args_shown"]
394+
* 3.5
395+
* (self.sizes["help_text_size"] + self.sizes["text_size"]),
396+
),
397+
700,
398+
),
393399
),
394400
pad=(0, 0),
395401
scrollable=True,

cli2gui/types.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ class BuildSpec(TypedDict):
1818
gui: str | GUIType
1919
theme: str | list[str]
2020
darkTheme: str | list[str]
21-
sizes: str | dict[str, Any]
2221
image: str
2322
program_name: str
2423
program_description: str
@@ -83,7 +82,6 @@ class FullBuildSpec(TypedDict):
8382
gui: str
8483
theme: str | list[str]
8584
darkTheme: str | list[str]
86-
sizes: str | dict[str, Any]
8785
image: str
8886
program_name: str
8987
program_description: str

documentation/reference/README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,13 @@ A full list of `Cli2gui` project modules.
77
- [Cli2gui](cli2gui/index.md#cli2gui)
88
- [Application](cli2gui/application/index.md#application)
99
- [Application](cli2gui/application/application.md#application)
10-
- [Pysimplegui2args](cli2gui/application/pysimplegui2args.md#pysimplegui2args)
11-
- [Widgets](cli2gui/application/widgets.md#widgets)
10+
- [Application2args](cli2gui/application/application2args.md#application2args)
1211
- [Decorators](cli2gui/decorators.md#decorators)
12+
- [Gui](cli2gui/gui/index.md#gui)
13+
- [AbstractGUI](cli2gui/gui/abstract_gui.md#abstractgui)
14+
- [DearPyGuiWrapper](cli2gui/gui/dearpygui_wrapper.md#dearpyguiwrapper)
15+
- [Helpers](cli2gui/gui/helpers.md#helpers)
16+
- [PySimpleGUIWrapper](cli2gui/gui/pysimplegui_wrapper.md#pysimpleguiwrapper)
1317
- [Tojson](cli2gui/tojson/index.md#tojson)
1418
- [Argparse2json](cli2gui/tojson/argparse2json.md#argparse2json)
1519
- [Click2json](cli2gui/tojson/click2json.md#click2json)

documentation/reference/cli2gui/application/application.md

Lines changed: 1 addition & 207 deletions
Original file line numberDiff line numberDiff line change
@@ -5,140 +5,11 @@
55
> Auto-generated documentation for [cli2gui.application.application](../../../../cli2gui/application/application.py) module.
66
77
- [Application](#application)
8-
- [addItemsAndGroups](#additemsandgroups)
9-
- [createLayout](#createlayout)
10-
- [generatePopup](#generatepopup)
11-
- [isDarkMode](#isdarkmode)
128
- [run](#run)
13-
- [setBase24Theme](#setbase24theme)
14-
- [setupWidgets](#setupwidgets)
15-
- [themeFromFile](#themefromfile)
16-
17-
## addItemsAndGroups
18-
19-
[Show source in application.py:178](../../../../cli2gui/application/application.py#L178)
20-
21-
Add arg_items and groups to the argConstruct list.
22-
23-
#### Arguments
24-
25-
----
26-
- `section` *types.Group* - contents/ section containing name, arg_items
27-
and groups
28-
- `argConstruct` *list[list[Element]]* - list of widgets to
29-
add to the program window
30-
- `widgets` *Widgets* - widgets object used to generate widgets to add to
31-
argConstruct
32-
33-
#### Returns
34-
35-
-------
36-
- `list[list[Element]]` - updated argConstruct
37-
38-
#### Signature
39-
40-
```python
41-
def addItemsAndGroups(
42-
section: types.Group, argConstruct: list[list[Element]], widgets: Widgets
43-
) -> list[list[Element]]: ...
44-
```
45-
46-
#### See also
47-
48-
- [Widgets](./widgets.md#widgets)
49-
50-
51-
52-
## createLayout
53-
54-
[Show source in application.py:284](../../../../cli2gui/application/application.py#L284)
55-
56-
Create the pysimplegui layout from the build spec.
57-
58-
#### Arguments
59-
60-
----
61-
- `buildSpec` *types.FullBuildSpec* - build spec containing widget
62-
- `widgets` *Widgets* - class to build widgets
63-
- `pySimpleGui` *Any* - version of PySimpleGui to use
64-
- `menu` *list[str]]* - menu data
65-
66-
#### Returns
67-
68-
-------
69-
- `list[list[Element]]` - list of widgets (layout list)
70-
71-
#### Signature
72-
73-
```python
74-
def createLayout(
75-
buildSpec: types.FullBuildSpec,
76-
widgets: Widgets,
77-
pySimpleGui: Any,
78-
menu: str | list[str],
79-
) -> list[list[Element]]: ...
80-
```
81-
82-
#### See also
83-
84-
- [Widgets](./widgets.md#widgets)
85-
86-
87-
88-
## generatePopup
89-
90-
[Show source in application.py:212](../../../../cli2gui/application/application.py#L212)
91-
92-
Create the popup window.
93-
94-
#### Arguments
95-
96-
----
97-
- `buildSpec` *types.FullBuildSpec* - [description]
98-
values (Union[dict[Any, Any]): Returned when a button is clicked. Such
99-
as the menu
100-
- `widgets` *Widgets* - class to build widgets
101-
- `pySimpleGui` *Any* - PySimpleGui class
102-
103-
#### Returns
104-
105-
-------
106-
- `pySimpleGui.Window` - A PySimpleGui Window
107-
108-
#### Signature
109-
110-
```python
111-
def generatePopup(
112-
buildSpec: types.FullBuildSpec,
113-
values: dict[Any, Any] | list[Any],
114-
widgets: Widgets,
115-
pySimpleGui: Any,
116-
) -> Window: ...
117-
```
118-
119-
#### See also
120-
121-
- [Widgets](./widgets.md#widgets)
122-
123-
124-
125-
## isDarkMode
126-
127-
[Show source in application.py:15](../../../../cli2gui/application/application.py#L15)
128-
129-
Monkeypatch for getostheme.isDarkMode.
130-
131-
#### Signature
132-
133-
```python
134-
def isDarkMode() -> bool: ...
135-
```
136-
137-
1389

13910
## run
14011

141-
[Show source in application.py:350](../../../../cli2gui/application/application.py#L350)
12+
[Show source in application.py:17](../../../../cli2gui/application/application.py#L17)
14213

14314
Establish the main entry point.
14415

@@ -152,81 +23,4 @@ Establish the main entry point.
15223

15324
```python
15425
def run(buildSpec: types.FullBuildSpec) -> None: ...
155-
```
156-
157-
158-
159-
## setBase24Theme
160-
161-
[Show source in application.py:44](../../../../cli2gui/application/application.py#L44)
162-
163-
Set the base24 theme to the application.
164-
165-
#### Arguments
166-
167-
----
168-
theme (Union[str, list[str]]): the light theme
169-
darkTheme (Union[str, list[str]]): the dark theme
170-
- `pySimpleGui` *Any* - pysimplegui module
171-
172-
#### Signature
173-
174-
```python
175-
def setBase24Theme(
176-
theme: str | list[str], darkTheme: str | list[str], pySimpleGui: Any
177-
) -> None: ...
178-
```
179-
180-
181-
182-
## setupWidgets
183-
184-
[Show source in application.py:135](../../../../cli2gui/application/application.py#L135)
185-
186-
Set the widget sizes to the application.
187-
188-
#### Arguments
189-
190-
----
191-
- `gui` *str* - user selected gui eg. pysimpleguiqt
192-
sizes (Union[dict[str, Any]]): widget sizes
193-
- `pySimpleGui` *Any* - pysimplegui module
194-
195-
#### Returns
196-
197-
-------
198-
- `Widgets` - widgets object all set up nicely
199-
200-
#### Signature
201-
202-
```python
203-
def setupWidgets(gui: str, sizes: dict[str, Any], pySimpleGui: Any) -> Widgets: ...
204-
```
205-
206-
#### See also
207-
208-
- [Widgets](./widgets.md#widgets)
209-
210-
211-
212-
## themeFromFile
213-
214-
[Show source in application.py:28](../../../../cli2gui/application/application.py#L28)
215-
216-
Set the base24 theme from a base24 scheme.yaml to the application.
217-
218-
#### Arguments
219-
220-
----
221-
- `themeFile` *str* - path to file
222-
223-
#### Returns
224-
225-
-------
226-
- `list[str]` - theme to set
227-
228-
#### Signature
229-
230-
```python
231-
def themeFromFile(themeFile: str) -> list[str]: ...
23226
```

0 commit comments

Comments
 (0)