how to make my own custom page for qtdragon_hd?
25 Jan 2023 15:59 #262888
by travis036
how to make my own custom page for qtdragon_hd? was created 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?
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.
25 Jan 2023 17:35 #262892
by travis036
Replied by travis036 on topic how to make my own custom page for qtdragon_hd?
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:
is that correct?
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.
25 Jan 2023 17:37 #262894
by travis036
Replied by travis036 on topic how to make my own custom page for qtdragon_hd?
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.
25 Jan 2023 17:49 #262895
by persei8
Replied by persei8 on topic how to make my own custom page for qtdragon_hd?
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
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.
25 Jan 2023 17:54 #262896
by persei8
Replied by persei8 on topic how to make my own custom page for qtdragon_hd?
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.
27 Jan 2023 07:59 #262988
by cmorley
Replied by cmorley on topic how to make my own custom page for qtdragon_hd?
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
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.
23 Apr 2023 12:53 #269680
by rodw
Replied by rodw on topic how to make my own custom page for qtdragon_hd?
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.
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.
24 Apr 2023 08:17 #269736
by cmorley
Replied by cmorley on topic how to make my own custom page for qtdragon_hd?
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.
~/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.
24 Apr 2023 10:01 - 24 Apr 2023 10:03 #269745
by rodw
Replied by rodw on topic how to make my own custom page for qtdragon_hd?
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...
The other panel is specific to my machine so it should stay on one of the optional panel
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!
#
# Communication - LED
#
net pyvcp-is-connected vfdmod.rs485.is-connected => pyvcp.is-connected
#
# Fault reset! Button to reset faults
#
# Because of ordinary button click is too short, it's necessary
# to prolong fault reset output in active state for a while.
loadrt oneshot names=fault-reset-delay
addf fault-reset-delay servo-thread
# Two seconds delay should be enough.
setp fault-reset-delay.width 2
net pyvcp-fault-reset-short pyvcp.fault-reset => fault-reset-delay.in
net pyvcp-fault-reset-long fault-reset-delay.out => vfdmod.control.fault-reset
#
# User parameters not in qtdragon
#
net pyvcp-freq-running vfdmod.parameters.freq-running => pyvcp.freq-running
net pyvcp-output-torque vfdmod.parameters.output-torque => pyvcp.output-torque
net pyvcp-power-on-time vfdmod.parameters.power-on-time => pyvcp.power-on-time
net pyvcp-spindle-load-speed vfdmod.parameters.spindle-load-speed => pyvcp.spindle-load-speed
net pyvcp-spindle-run-time vfdmod.parameters.spindle-run-time => pyvcp.spindle-run-time
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.
24 Apr 2023 21:57 #269788
by rodw
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
any guidance would be appreciated...
Replied by rodw on topic how to make my own custom page for qtdragon_hd?
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!
[QTvcp.QTVCP.QT_MAKEPINS][INFO] QTVCP: Found external qtvcp belts panel to instantiate (qt_makepins.py:86)
[QTvcp][CRITICAL] Aborted from Error Dialog
Qtvcp encountered an error. The following information may be useful in troubleshooting:
LinuxCNC Version : 2.9.0-pre1-683-g5585d6c36
Traceback (most recent call last):
File "/usr/bin/qtvcp", line 509, in <module>
_qtvcp = QTVCP()
File "/usr/bin/qtvcp", line 279, in __init__
self.panel = qt_makepins.QTPanel(self.hal, self.PATH, window, opts.debug)
File "/usr/lib/python3/dist-packages/qtvcp/qt_makepins.py", line 95, in __init__
window[pName].instance(os.path.join(path.PANELDIR , cmd, cmd+'.ui'))
File "/usr/lib/python3/dist-packages/qtvcp/qt_makegui.py", line 382, in instance
instance = uic.loadUi(filename, self)
File "/usr/lib/python3/dist-packages/PyQt5/uic/__init__.py", line 238, in loadUi
return DynamicUILoader(package).loadUi(uifile, baseinstance, resource_suffix)
File "/usr/lib/python3/dist-packages/PyQt5/uic/Loader/loader.py", line 66, in loadUi
return self.parse(filename, resource_suffix)
File "/usr/lib/python3/dist-packages/PyQt5/uic/uiparser.py", line 1020, in parse
document = parse(filename)
File "/usr/lib/python3.9/xml/etree/ElementTree.py", line 1229, in parse
tree.parse(source, parser)
File "/usr/lib/python3.9/xml/etree/ElementTree.py", line 569, in parse
source = open(source, "rb")
FileNotFoundError: [Errno 2] No such file or directory: '/usr/share/qtvcp/panels/belts/belts.ui'
(qtvcp:465)
[QTvcp][DEBUG] Exiting HAL (qtvcp:428)
Shutting down and cleaning up LinuxCNC...
task: 2266 cycles, min=0.000012, max=0.041365, avg=0.010462, 0 latency excursions (> 10x expected cycle time of 0.010000s)
Note: Using POSIX non-realtime
LinuxCNC terminated with an error. You can find more information in the log:
/home/rod/linuxcnc_debug.txt
and
/home/rod/linuxcnc_print.txt
as well as in the output of the shell command 'dmesg' and in the terminal
any guidance would be appreciated...
Please Log in or Create an account to join the conversation.
Moderators: cmorley
Time to create page: 0.273 seconds