Skip to content

Commit 2760a8c

Browse files
committed
Merge branch '2.9'
2 parents 7ee0045 + fd03980 commit 2760a8c

4 files changed

Lines changed: 101 additions & 0 deletions

File tree

docs/src/gui/qtdragon.adoc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,7 @@ You must also set the MAX_SPINDLE_POWER in the INI.
447447

448448
[source,{hal}]
449449
----
450+
qtdragon.spindle-modbus-connection
450451
qtdragon.spindle-modbus-errors
451452
qtdragon.spindle-amps
452453
qtdragon.spindle-fault
@@ -1233,6 +1234,18 @@ qproperty-styleFont7: "Times,15,-1,5,90,0,0,1,1,0";
12331234
}
12341235
----
12351236

1237+
To have the manual spindle buttons also incrementally increase/decrease speed:
1238+
1239+
[source,{ini}]
1240+
----
1241+
#action_spindle_fwd{
1242+
qproperty-spindle_up_action: true;
1243+
}
1244+
#action_spindle_rev{
1245+
qproperty-spindle_down_action: true;
1246+
}
1247+
----
1248+
12361249
=== Qt Designer and Python code
12371250

12381251
All aspects of the GUI are fully customization through Qt Designer and/or Python code.

docs/src/gui/qtvcp-vcp-panels.adoc

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,4 +305,75 @@ start
305305
<1> In this case we load `qtvcp` using *`-Wn`* which waits for the panel to finish loading before continuing to run the next HAL command. +
306306
This is to _ensure that the panel created HAL pins are actually done_ in case they are used in the rest of the file.
307307

308+
== Embedding QtVCP Virtual Control Panels into QtVCP Screens
309+
Qtvcp panels can be embedded into most Qtvcp screens and avoids problems such as focus transferring that can be a problem in non-native embedding.
310+
311+
=== Embedding Commands
312+
A typical screen such as QtDragon will search the INI file under the heading [DISPLAY] for commands to embed a panel.
313+
314+
[source,{ini}]
315+
----
316+
[DISPLAY]
317+
EMBED_TAB_NAME=Embedding demo
318+
EMBED_TAB_COMMAND=qtvcp simple_hal
319+
EMBED_TAB_LOCATION=tabWidget_utilities
320+
----
321+
322+
*'EMBED_TAB_NAME'*:: will typically be the title of the tab.
323+
*'EMBED_TAB_LOCATION'*:: will be specific to the screen and specifies the tabWidget or stackedWidget to embed into.
324+
*'EMBED_TAB_COMMAND'*:: is the command used to invoke loading of the panel. For native embedded panels the first word will always be 'qtvcp', the second will be the panel to load. You cannot currently add any switches to the command line. The panel will follow the debugging mode setting of the main screen.
325+
326+
=== Location of builtin Panels
327+
There are panels available that are included with linuxcnc. To see a list open a terminal and type 'qtvcp' and press return. +
328+
You will get a help printout and a list of builtin screen and panels. +
329+
Pick any of the names from the panel list and add that to the COMMAND entry after 'qtvcp'. +
330+
The builtin panel search path is 'share/qtvcp/panels/PANELNAME'. +
331+
Run-In-Place and installed versions of linuxcnc have these in different locations on the system.
332+
333+
=== Location of Custom Panels
334+
Custom panels can be embedded too -either a modified builtin panel or a new user-built one. +
335+
When loading panels, QtVCP looks in the configuration folders path for 'qtvcp/panels/PANELNAME/PANELNAME.ui'. +
336+
'PANNELNAME' being any valid string with no spaces. If no path is found there, then looks in the builtin file path. +
337+
QtVCP will do the same process for the optional handler file: 'qtvcp/panels/PANELNAME/PANELNAME_handler.py'
338+
339+
=== Handler Programming Tips
340+
In a screen handler file, the reference used for the window is 'self.w'. +
341+
In QtVCP panels, that reference will refers to the panel's window. +
342+
To reference the main window use 'self.w.MAIN'
343+
If your panel is to be able to run independently and embedded, you must trap errors from referencing objects not available.
344+
(ie main screen objects are not available in an independent panel.)
345+
346+
eg. This would use the panels preference file if there is one.
347+
[source,{hal}]
348+
----
349+
try:
350+
belt_en = self.w.PREFS_.getpref('Front_Belt_enabled', 1, int, 'SPINDLE_EXTRAS')
351+
exception:
352+
belt_en = 1
353+
----
354+
355+
This would use the main screen preference file if there is one.
356+
[source,{hal}]
357+
----
358+
try:
359+
belt_en = self.w.MAIN.PREFS_.getpref('Front_Belt_enabled', 1, int, 'SPINDLE_EXTRAS')
360+
exception:
361+
belt_en = 1
362+
----
363+
364+
=== Designer Widget Tips
365+
366+
When using python command option in Action Button widgets of an embedded panel:
367+
368+
*`INSTANCE`*::
369+
refers to the panel window
370+
E.g., `INSTANCE.my_panel_handler_function_call(True)`
371+
372+
*'MAIN_INSTANCE'*::
373+
refers to the main screen window.
374+
E.g., `INSTANCE.my_main_screen_handler_function_call(True)`
375+
376+
If the panel is not embedded, both refer to the panel window. +
377+
378+
308379
// vim: set syntax=asciidoc:

share/qtvcp/screens/qtdragon/qtdragon_handler.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,8 @@ def init_pins(self):
253253
pin.value_changed.connect(self.spindle_fault_changed)
254254
pin = QHAL.newpin("spindle-modbus-errors", QHAL.HAL_U32, QHAL.HAL_IN)
255255
pin.value_changed.connect(self.mb_errors_changed)
256+
pin = QHAL.newpin("spindle-modbus-connection", QHAL.HAL_U32, QHAL.HAL_IN)
257+
pin.value_changed.connect(self.mb_connection_changed)
256258
QHAL.newpin("spindle-inhibit", QHAL.HAL_BIT, QHAL.HAL_OUT)
257259
# external offset control pins
258260
QHAL.newpin("eoffset-enable", QHAL.HAL_BIT, QHAL.HAL_OUT)
@@ -470,6 +472,12 @@ def mb_errors_changed(self, data):
470472
errors = self.h['spindle-modbus-errors']
471473
self.w.lbl_mb_errors.setText(str(errors))
472474

475+
def mb_connection_changed(self, data):
476+
if data:
477+
self.w.lbl_mb_errors.setStyleSheet('')
478+
else:
479+
self.w.lbl_mb_errors.setStyleSheet('''background-color:rgb(202, 0, 0);''')
480+
473481
def dialog_return(self, w, message):
474482
rtn = message.get('RETURN')
475483
name = message.get('NAME')

share/qtvcp/screens/qtdragon_hd/qtdragon_hd_handler.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,9 @@ def init_pins(self):
214214
pin = QHAL.newpin("spindle-modbus-errors", QHAL.HAL_U32, QHAL.HAL_IN)
215215
pin.value_changed.connect(self.mb_errors_changed)
216216
QHAL.newpin("spindle-inhibit", QHAL.HAL_BIT, QHAL.HAL_OUT)
217+
pin = QHAL.newpin("spindle-modbus-connection", QHAL.HAL_U32, QHAL.HAL_IN)
218+
pin.value_changed.connect(self.mb_connection_changed)
219+
217220
# external offset control pins
218221
QHAL.newpin("eoffset-enable", QHAL.HAL_BIT, QHAL.HAL_OUT)
219222
QHAL.newpin("eoffset-clear", QHAL.HAL_BIT, QHAL.HAL_OUT)
@@ -501,6 +504,12 @@ def mb_errors_changed(self, data):
501504
errors = self.h['spindle-modbus-errors']
502505
self.w.lbl_mb_errors.setText(str(errors))
503506

507+
def mb_connection_changed(self, data):
508+
if data:
509+
self.w.lbl_mb_errors.setStyleSheet('')
510+
else:
511+
self.w.lbl_mb_errors.setStyleSheet('''background-color:rgb(202, 0, 0);''')
512+
504513
def eoffset_changed(self, data):
505514
self.w.z_comp_eoffset_value.setText(format(data*.001, '.3f'))
506515

0 commit comments

Comments
 (0)