Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions share/qtvcp/screens/qtplasmac/qtplasmac_handler.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION = '016.089'
VERSION = '016.090'
LCNCVER = '2.10'

'''
Expand Down Expand Up @@ -3907,7 +3907,7 @@ def user_button_setup(self):
'probe-test', 'single-cut', 'torch-pulse', 'user-manual', 'latest-file', 'toggle-joint']
head = _translate('HandlerClass', 'User Button Error')
for bNum in range(1, 21):
self.w[f'button_{bNum}'].setCheckable(False)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line was also what reset a lit indicator whenever the buttons were rebuilt. What happens if a dual-code button with ;; true is lit when the user saves or reloads the user buttons? user_button_setup() sets the text back to n Name, but what clears the button_active style? And on the next press, which branch runs, and does the indicator still match the text after that?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are absolutely correct; thank you for catching that! I added the missing line, all should be well now.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, that fixes the reload case. One follow-up: button_normal() now gives all 20 user buttons their own stylesheet, with the colors from that moment. At startup this runs before set_color_styles(), so what color do the user buttons get with a custom stylesheet? And after a color change in Settings, what restyles them? Would self.w[f'button_{bNum}'].setStyleSheet('') reset the indicator just as well, while leaving the colors to the global sheet?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is more correct, but it does highlight (pun intended) some other issues. For example, if a button is active when you change the highlight color, it didn't update. It also brings up that if the user changes a user button that was controlling a halpin, and it was active, nothing would stop you. Maybe that's ok maybe it isn't. Sometimes I do wonder how far is appropriate to save the user from themself, and it's definitely an edge case...

At any rate, I have the first issue fixed and ran out of time tonight for the second, but I am not sure if we should commit this as is, and I'll follow up with a commit to address this as well as the other stuff in a bit, or keep force committing to this pr?

@grandixximo grandixximo Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Force push here works, or whatever floats your boat really, we do like to merge somewhat clean history if possible...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I clearly needed to go to bed when I wrote that confusing message ... to clarify what I meant:

I will force-push the self.w[f'button_{bNum}'].setStyleSheet('') change. Then I will address the other issues in separate commits as they are beyond the scope of this PR.

self.w[f'button_{bNum}'].setStyleSheet('')
bName = self.PREFS.getpref(f'{bNum} Name', '', str, 'BUTTONS') or None
bCode = self.PREFS.getpref(f'{bNum} Code', '', str, 'BUTTONS') or None
if bName or bCode:
Expand Down Expand Up @@ -4136,7 +4136,7 @@ def user_button_setup(self):
self.interlockRules[self.jtButton] = self.interlockRules['toggle-joint_template'].copy()
else:
if 'dual-code' in bCode:
# incoming code is: "dual-code" ;; code1 ;; label1 ;; code2 ;; checked (optional = true)
# incoming code is: "dual-code" ;; code1 ;; label1 ;; code2 ;; indicator (optional = true)
data = bCode.split(';;')
if len(data) not in [4, 5]:
head = _translate('HandlerClass', 'User Button Error')
Expand All @@ -4146,12 +4146,11 @@ def user_button_setup(self):
continue
else:
if len(data) == 5 and data[4].strip().lower() == 'true':
self.w[f'button_{bNum}'].setCheckable(True)
checked = True
indicator = True
else:
checked = True
self.dualCodeButtons[bNum] = [data[1], data[2], data[3], bLabel, checked]
# dualCodeButtons format is: code1 ;; label1 ;; code2 ;; label2 ;; checked
indicator = False
self.dualCodeButtons[bNum] = [data[1], data[2], data[3], bLabel, indicator]
# dualCodeButtons format is: code1 ;; label1 ;; code2 ;; label2 ;; indicator
self.interlockRules[f'button_{bNum}'] = self.interlockRules['dual-code_template'].copy()
commands = f'{data[1]}\\{data[3]}'
else:
Expand Down Expand Up @@ -4293,15 +4292,17 @@ def user_button_down(self, bNum):
else:
self.reloadRequired = False
if bCode.lower().startswith('dual-code'):
# dualCodeButtons format is: code1 ;; label1 ;; code2 ;; label2 ;; checked
# dualCodeButtons format is: code1 ;; label1 ;; code2 ;; label2 ;; indicator
if self.w[f'button_{bNum}'].text() == self.dualCodeButtons[bNum][3]:
bCode = self.dualCodeButtons[bNum][0]
self.w[f'button_{bNum}'].setText(self.dualCodeButtons[bNum][1])
self.w[f'button_{bNum}'].setChecked(True)
if self.dualCodeButtons[bNum][4]:
self.button_active(f'button_{bNum}')
else:
bCode = self.dualCodeButtons[bNum][2]
self.w[f'button_{bNum}'].setText(self.dualCodeButtons[bNum][3])
self.w[f'button_{bNum}'].setChecked(False)
if self.dualCodeButtons[bNum][4]:
self.button_normal(f'button_{bNum}')
for command in bCode.split('\\'):
command = command.strip()
self.user_button_command(bNum, command)
Expand Down
7 changes: 7 additions & 0 deletions share/qtvcp/screens/qtplasmac/versions.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ <h2>QtPlasmaC Version History - LinuxCNC 2.10</h2>
</table>
<br>
<!--- ****** ADD NEXT VERSION BELOW THIS LINE ****** --->
<br><b><u>016.090 2026 Sep 27</u></b>
<ul style="margin:0;">
<li>fix dual-code button's optional indicator</li>
<li>fix pmx485 0210 fault</li>
<li>clean up error message formatting</li>
</ul>

<br><b><u>016.089 2026 Sep 22</u></b>
<ul style="margin:0;">
<li>fix conversational circle M3 vs M03 bug</li>
Expand Down
Loading