DirectGui Designer

Hey all,

here are some updates on the editor. I’ve been using it and working on it every now and then and I think there is enough new stuff to post about it.

Aside of a lot of bugfixes, the property editor has been enhanced and gathered a few more properties to edit the gui elements. It now includes properties for DirectScrolledFrames, the transparency attribute and the state attribute.
Aside of that the properties panel has also been made more stable to not crash the whole application if something went wrong.

The python file exporter has been enhanced to now include a show, hide and delete function to simpler work with these common functions. It will respectively show, hide and delete all toplevel elements in the gui.

The filebrowser has been updated and can show and hide hidden files (unix style files with a leading dot) and also saw a few bugfixes.

3 Likes

The designer now has a very handy copy and paste functionality for widgets as well as widgets’ designs. Simply use the usual ctrl-c ctrl-v for copying full elements (including all child elements) and ctrl-shift-c and ctrl-shift-v for copying and pasting designs.

The properties panel also got a few improvements and more properties to set on the individual GUI elements.

Saving has also seen a fix where elements weren’t in the correct order in exported python scripts.

1 Like

Super Good! But it is a little laggy on my device. Also, can you make a tutorial on how to export it?

Thanks for the feedback. A tutorial is probably a good idea, maybe some short videos might work. As for the performance, I’m not sure what I can do here, but I’ll take a look into it.

1 Like

I think the performance is my computer’s problem. I currently running it on Windows 7. So I will try to run it on my Windows 10 computer.

Well, actually I think it is the directGUI system which just isn’t very optimized for such large UIs. Eben though it runs fluent in my system which isn’t the most modern either, it does tend to make the fans go really fast compared to running almost any other Software. So that’s definitely a point I have to and will investigate further in the future.

I am trying to export the file with an error:

.
(-0.1, 10.1, -0.3962500154972076, 1.087500011920929)
(-0.1, 10.1, -0.3962500154972076, 1.087500011920929)
Looking for Root: None
CHECK IF CHILD pg471 None
Looking for Root: <DirectGuiDesignerElementHandler.ElementInfo object at 0x0CC05F58>
CHECK IF CHILD pg471 None
Try to save file after unhandled exception. Please restart the app to automatically load the exception save file!
Looking for Root: None
CHECK IF CHILD pg471 None
Looking for Root: <DirectGuiDesignerElementHandler.ElementInfo object at 0x0CC05F58>
CHECK IF CHILD pg471 None
Traceback (most recent call last):
File “C:\DirectGuiDesigner-master\DirectGuiDesigner.py”, line 1188, in
designer.run()
File “C:\Users\Rahul\AppData\Local\Programs\Python\Python38-32\lib\site-packages\direct\showbase\ShowBase.py”, line 3325, in run
self.taskMgr.run()
File “C:\Users\Rahul\AppData\Local\Programs\Python\Python38-32\lib\site-packages\direct\task\Task.py”, line 541, in run
self.step()
File “C:\Users\Rahul\AppData\Local\Programs\Python\Python38-32\lib\site-packages\direct\task\Task.py”, line 495, in step
self.mgr.poll()
File “C:\Users\Rahul\AppData\Local\Programs\Python\Python38-32\lib\site-packages\direct\showbase\EventManager.py”, line 49, in eventLoopTask
self.doEvents()
File “C:\Users\Rahul\AppData\Local\Programs\Python\Python38-32\lib\site-packages\direct\showbase\EventManager.py”, line 43, in doEvents
processFunc(dequeueFunc())
File “C:\Users\Rahul\AppData\Local\Programs\Python\Python38-32\lib\site-packages\direct\showbase\EventManager.py”, line 99, in processEvent
messenger.send(eventName, paramList)
File “C:\Users\Rahul\AppData\Local\Programs\Python\Python38-32\lib\site-packages\direct\showbase\Messenger.py”, line 337, in send
self.__dispatch(acceptorDict, event, sentArgs, foundWatch)
File “C:\Users\Rahul\AppData\Local\Programs\Python\Python38-32\lib\site-packages\direct\showbase\Messenger.py”, line 422, in __dispatch
result = method ((extraArgs + sentArgs))
File “C:\Users\Rahul\AppData\Local\Programs\Python\Python38-32\lib\site-packages\direct\gui\DirectButton.py”, line 107, in commandFunc
self’command’
File “C:\Users\Rahul\AppData\Local\Programs\Python\Python38-32\lib\site-packages\direct\showbase\Messenger.py”, line 337, in send
self.__dispatch(acceptorDict, event, sentArgs, foundWatch)
File “C:\Users\Rahul\AppData\Local\Programs\Python\Python38-32\lib\site-packages\direct\showbase\Messenger.py”, line 422, in __dispatch
result = method (
(extraArgs + sentArgs))
File “C:\DirectGuiDesigner-master\DirectGuiDesigner.py”, line 876, in export
DirectGuiDesignerExporterPy(os.path.join(self.lastDirPath, self.lastFileNameWOExtension + “.py”), self.elementDict, self.customWidgetsHandler, self.getEditorFrame, self.tt, not self.editorFrame.visEditorInAspect2D)
File “C:\DirectGuiDesigner-master\DirectGuiDesignerExporterPy.py”, line 154, in init
self.dlgPathSelect = DirectGuiDesignerPathSelect(
File “C:\DirectGuiDesigner-master\DirectGuiDesignerPathSelect.py”, line 93, in init
self.browser = DirectFolderBrowser(self.selectPath, True, os.path.dirname(filePath), os.path.split(filePath)[1], tooltip=tooltip)
File “C:\Users\Rahul\AppData\Local\Programs\Python\Python38-32\lib\site-packages\DirectFolderBrowser\DirectFolderBrowser.py”, line 146, in init
self.btnFolderUp = DirectButton(
File “C:\Users\Rahul\AppData\Local\Programs\Python\Python38-32\lib\site-packages\direct\gui\DirectButton.py”, line 66, in init
self.initialiseoptions(DirectButton)
File “C:\Users\Rahul\AppData\Local\Programs\Python\Python38-32\lib\site-packages\direct\gui\DirectGuiBase.py”, line 253, in initialiseoptions
func()
File “C:\Users\Rahul\AppData\Local\Programs\Python\Python38-32\lib\site-packages\direct\gui\DirectFrame.py”, line 210, in setImage
self.createcomponent(
File “C:\Users\Rahul\AppData\Local\Programs\Python\Python38-32\lib\site-packages\direct\gui\DirectGuiBase.py”, line 572, in createcomponent
widget = widgetClass(*widgetArgs, **kw)
File “C:\Users\Rahul\AppData\Local\Programs\Python\Python38-32\lib\site-packages\direct\gui\OnscreenImage.py”, line 60, in init
self.setImage(image, parent = parent, sort = sort)
File “C:\Users\Rahul\AppData\Local\Programs\Python\Python38-32\lib\site-packages\direct\gui\OnscreenImage.py”, line 117, in setImage
tex = loader.loadTexture(image)
File “C:\Users\Rahul\AppData\Local\Programs\Python\Python38-32\lib\site-packages\direct\showbase\Loader.py”, line 756, in loadTexture
raise IOError(message)
OSError: Could not load texture: ./icons/FolderUp.png

It seems the folder browser doesn’t find the icons. I thought I’ve fixed that a while ago. Will take a look into it.

The same thing happens when I try to save it.

When I run setup.py build_apps and run the .exe file, then I am able to export the project. But how do you implement it in a program?

That’s good to know. I still have no idea why it won’t find the icon folder as the setup should point to the icon folder on the path, where pip has installed the directFolderBrowser package.

Regarding the use of the exported, GUI, there is a sample description on the githubs readme. In short, simply import your exported python script and call it. Here’s the example from the readme:

from myGui import GUI as MyGui
myGui = MyGui()

Every exported script has a class called GUI which, if you instantiate will directly create and display the GUI.

This is totally cool. It is so helpful. How come no body told me about this before?

I’m glad you find it useful and I guess, as this project is relatively new, there aren’t that many who know it yet. It probably could use some more promotion.

There is one issue which I think that you can rectify. When a DirectLabel’s text is bigger than it’s container, The text is showing outside the container rather than the container resizing.

Automatically resizing the frame to the text is not a good idea. The frame may contain different information like background images which have a specific size and hence need to be specifically set. I could add a button to fit the frame to the text as a manual step though.

I am talking about a DirectLabel.

I know, but the by default gray background you’ll see on those DirectLabels or as you call it container is just a DirectFrame internally.

Oh.

EDIT: But it is ruining the presentation, so how should I make it resized?

Hm, currently there is no simple way to recalculate the size to the text’s size, so either manually set it to a fitting size or hide/disable the background by either setting it to a transparent color and enable transparency or set the relief to None (note, that you won’t be able to select the item in the editor frame but only in the structure view with that relief style).
I’ll see if I can add a convenient function to resize the frame appropriately in the next release.

After quite a while working on the core and UI rewrite, it’s finally done and merged into the master branch.
The Designer will now be faster, give you a little more flexibility in it’s UI and provide some additional features especially in the area of editing properties of widgets. Also saving and loading designer projects and python scripts has been improved a lot.

I hope this will be of use to you.

In addition to that I’d like to ask, how would you prefer to get the designer running on your system. Should I provide release packages on github, distribute through pypi and/or software stores as installable/runnable packages like snap, exe, and so on?

2 Likes