how to make my own custom page for qtdragon_hd?

More
25 Jan 2023 15:59 #262888 by travis036
Running Debian 11, with LCNC 2.9, for a 48" X 48" (working area) CNC router table (woodworking).

i have not worked with QT, and very little with python. what i would like to do is add a page to qtdragon_hd where i can display some status info, like air-compressor PSI, power supply voltage for the DC power busses, and whatnot. the info will come from an Arduino ModBus slave, and pulled in via mb2hal. it would be nice to have some fancy looking presentation, but really if i just had the text labels and text data display, i would be happy.

so, with that introduction, where can i find the information to learn how to do what i would like to do?

Please Log in or Create an account to join the conversation.

More
25 Jan 2023 17:35 #262892 by travis036
well... had a did some more in-depth digging before posting....
found what i need, i think. i need to install qtcreator to make the ui file, and make a HAL files to connect pins... best i can tell anyway.
then embed it with something like:
[color=#000000][DISPLAY][/color]
[color=#0000ff]EMBED_TAB_NAME [/color][color=#000000]=[/color][color=#009900] demo[/color]
[color=#0000ff]EMBED_TAB_COMMAND [/color][color=#000000]=[/color][color=#009900] qtvcp myui.ui[/color]
[color=#0000ff]EMBED_TAB_LOCATION [/color][color=#000000]=[/color][color=#009900] tabWidget_utilities[/color]

is that correct?

Please Log in or Create an account to join the conversation.

More
25 Jan 2023 17:37 #262894 by travis036
don't know where the color tag BS came from... in the code block...

Please Log in or Create an account to join the conversation.

More
25 Jan 2023 17:49 #262895 by persei8
I'm not aware that such information exists. Since qtdragon is literally built on pyqt5 and python, you pretty much need to know at least the basics. By examining the source code, you can see how other pages are built and then use it as a pattern to add your own pages. Having said that, there are several options you could take. For example:

Option A - add a new page to the main tab widget. The page UI and python support code would be embedded into the main code.

Option B - add a new page to the UTILS tab widget. The page UI and python support code can be written as a separate library and imported into the main code. Prepare a layout in the main UI that your page can be imported into.

Option C - depending on how much data you want to display, there may be some room on the SETTINGS page to add some labels and lineedit widgets.

Option D - rearrange the main display and add the info there. That way, you can keep an eye on it while the machine is running.

When I refer to 'page UI', I mean your custom page. It can be built graphically using qtdesigner or if it is simple enough, just build it with qt widget classes in python. Hope this helps, at least a little bit.
Jim
The following user(s) said Thank You: travis036

Please Log in or Create an account to join the conversation.

More
25 Jan 2023 17:54 #262896 by persei8
I don't think you want qtcreator. You want qtdesigner. To get that, you have to install pyqt5. You get the linuxcnc widgets when you install qtvcp. You will also need to run python3, not python2.
The following user(s) said Thank You: travis036

Please Log in or Create an account to join the conversation.

More
27 Jan 2023 07:59 #262988 by cmorley
Persei8 is referring to customizing the handler and .ui files of qtdragon.

You can embed separate qtvcp panels in qtdragon, which is easier but less flexible.
linuxcnc.org/docs/2.9/html/gui/qtdragon....ed_custom_vcp_panels

I will soon add the ability to add a panel to the main tab too.

Chris
The following user(s) said Thank You: travis036

Please Log in or Create an account to join the conversation.

More
23 Apr 2023 12:53 #269680 by rodw
I'm a bit lost here and it seems the file path bug that affected linuxcnc.var I found earlier in the week is in play.
I want to add a custom panel in place of vismach on the utilities tab.
You say that a custom .ui file should live in ~/linuxcnc/configs/myconfig/qtvcp/screens/mypanel/mypanel.ui
But the system only searches /usr/share on startup

Also, I am unsure of what I am meant to be building. I take it I should make a mainwindow?
All I want to do is replicate a small side panel I was using in axis that has buttons to define which of 8 belts installed to scale the spindle (using a custom component)

Is the best method to extend the ui?

I don't really want to be customising the main .ui becasue I want to stay in step with your development.

Please Log in or Create an account to join the conversation.

More
24 Apr 2023 08:17 #269736 by cmorley
Try:
~/linuxcnc/configs/myconfig/qtvcp/panels/mypanel/mypanel.ui

run linuxcnc from terminal with qtdragon -d to see what paths it is searching.

a panel is made from a QMainWindow yes.
If you are happy with a panel in one of the optional places then that is easiest.
It maybe possible to put it other places if I do a bit of ui work. let me know so i can look and decide if it's easy to add.

Obviously changing the ui gives the most power, but also takes the most effort and then will not get updated if the ui file is changed in the repo later.

Please Log in or Create an account to join the conversation.

More
24 Apr 2023 10:01 - 24 Apr 2023 10:03 #269745 by rodw
Thanks Chris,
One of my proposed panels could be useful in the core as it contains additional modbus VFD data from vfdmod.
this includes a button to reset fault count and an LED to show its connected on the rs485 bus. I had one instance with axis where the USB TTY decided to move from 1 to 2, then it never missed a beat so it can be handy for troubleshooting.
During testing today, I shut off power to the VFD for a while, then enabled it again but it was annoying to have a functioning spindle with 56 errors displayed! The button would clear them.

Its possible the led could be replaced by styling the error count a different colour if its not connected (red and green background). There appeared to be room on some tabs in qtdragon_hd but a seperate, possibly optional or hidden if a modbus VFD was not used

I've attached the VFD panel in the spoiler...

Warning: Spoiler!


The other panel is specific to my machine so it should stay on one of the optional panel
Last edit: 24 Apr 2023 10:03 by rodw.

Please Log in or Create an account to join the conversation.

More
24 Apr 2023 21:57 #269788 by rodw

Try:
~/linuxcnc/configs/myconfig/qtvcp/panels/mypanel/mypanel.ui

run linuxcnc from terminal with qtdragon -d to see what paths it is searching.

 


I'm still lost. 

I made a main window with a single button in the folder you suggested called belts.ui containing a single push button
I copied the default handler file from the qtvcp example (I expected some python errors)
I opened with the -d parameter
The panel is found but it errors as its not found under /usr/share....
It would be nice to have a simple hello world example panel with one element on it we could copy
Warning: Spoiler!


any guidance would be appreciated...

Please Log in or Create an account to join the conversation.

Moderators: cmorley
Time to create page: 0.337 seconds
Powered by Kunena Forum