QtPyVCP - Max_Velocity Override - Button Group Freebie
13 Dec 2019 04:29 #152586
by KCJ
Yes, I am that poor soul.
Great stuff here. Pull requests are always welcome and greatly appreciated if you'd like to contribute your enhancements back to QtPyVCP.
I really like the idea of adding it as a custom widget. It's quite easy to do, but we don't have any documentation on doing that, yet...
Replied by KCJ on topic QtPyVCP - Max_Velocity Override - Button Group Freebie
Thank you Kurt.
Were you the original victim who developed the QtPyVCP code?
Yes, I am that poor soul.
Great stuff here. Pull requests are always welcome and greatly appreciated if you'd like to contribute your enhancements back to QtPyVCP.
I really like the idea of adding it as a custom widget. It's quite easy to do, but we don't have any documentation on doing that, yet...
The following user(s) said Thank You: tommylight
Please Log in or Create an account to join the conversation.
13 Dec 2019 04:42 #152588
by Donb9261
Replied by Donb9261 on topic QtPyVCP - Max_Velocity Override - Button Group Freebie
Found it.
In order to use connect it must be in the super declarations or the main window cannot see them.
Simply move this in your mainwindow.py: (You have it within the child section)
to below here:
Lastly, you have 2 __init__ definitions. You need only one. In the second one, take:
and put it here:
Delete the second __init_ so that you full code looks like this: ( You can copy/paste over your entire mainwindow.py code)
Lastly, you have the header set twice: (Your header originally): Many times programmers will only show the parts you need to change/add to your files but assume you know that if it is already there you will only change/add what is not. I should have been more explicit in my example code. The way you inserted the examples resulted in 3 super calls and 3 __init_ functions. All overwriting the next.
It should work after that.
Just always remember that all super declarations MUST be present in the __init__ function definition in order to be recognized by lower level or child functions. connect is a function to connect a parent declaration to a child function.
I think I explained that correctly. Lol. It is late.
In order to use connect it must be in the super declarations or the main window cannot see them.
Simply move this in your mainwindow.py: (You have it within the child section)
#rapid mod Start below here
self.rapidZero.clicked.connect(self.buttonRapidZero)
self.rapidTwentyFive.clicked.connect(self.buttonRapidTwentyFive)
self.rapidFifty.clicked.connect(self.buttonRapidFifty)
self.rapidSeventyFive.clicked.connect(self.buttonRapidSeventyFive)
self.rapidHundred.clicked.connect(self.buttonRapidHundred)
to below here:
class MyMainWindow(VCPMainWindow):
"""Main window class for the VCP."""
def __init__(self, *args, **kwargs):
super(MyMainWindow, self).__init__(*args, **kwargs)
## Here
self.rapidZero.clicked.connect(self.buttonRapidZero)
self.rapidTwentyFive.clicked.connect(self.buttonRapidTwentyFive)
self.rapidFifty.clicked.connect(self.buttonRapidFifty)
self.rapidSeventyFive.clicked.connect(self.buttonRapidSeventyFive)
self.rapidHundred.clicked.connect(self.buttonRapidHundred)
Lastly, you have 2 __init__ definitions. You need only one. In the second one, take:
self.offsetButtonGroup.buttonClicked.connect(self.offsetHandleKeys)
self.mdiButtonGroup.buttonClicked.connect(self.mdiHandleKeys)
self.mdiBackSpaceKey.clicked.connect(self.mdiBackSpace)
self.toolOffsetGroup.buttonClicked.connect(self.toolHandleKeys)
self.toolOffsetBackspace.clicked.connect(self.toolBackSpace)
and put it here:
class MyMainWindow(VCPMainWindow):
"""Main window class for the VCP."""
def __init__(self, *args, **kwargs):
super(MyMainWindow, self).__init__(*args, **kwargs)
## Here
self.rapidZero.clicked.connect(self.buttonRapidZero)
self.rapidTwentyFive.clicked.connect(self.buttonRapidTwentyFive)
self.rapidFifty.clicked.connect(self.buttonRapidFifty)
self.rapidSeventyFive.clicked.connect(self.buttonRapidSeventyFive)
self.rapidHundred.clicked.connect(self.buttonRapidHundred)
self.offsetButtonGroup.buttonClicked.connect(self.offsetHandleKeys)
self.mdiButtonGroup.buttonClicked.connect(self.mdiHandleKeys)
self.mdiBackSpaceKey.clicked.connect(self.mdiBackSpace)
self.toolOffsetGroup.buttonClicked.connect(self.toolHandleKeys)
self.toolOffsetBackspace.clicked.connect(self.toolBackSpace)
Delete the second __init_ so that you full code looks like this: ( You can copy/paste over your entire mainwindow.py code)
from qtpyvcp.widgets.form_widgets.main_window import VCPMainWindow
# Setup logging
from qtpyvcp.utilities import logger
LOG = logger.getLogger('qtpyvcp.' + __name__)
class MyMainWindow(VCPMainWindow):
"""Main window class for the VCP."""
def __init__(self, *args, **kwargs): ## PARENT
super(MyMainWindow, self).__init__(*args, **kwargs)
## Your Parent Declaration
self.offsetButtonGroup.buttonClicked.connect(self.offsetHandleKeys)
self.mdiButtonGroup.buttonClicked.connect(self.mdiHandleKeys)
self.mdiBackSpaceKey.clicked.connect(self.mdiBackSpace)
self.toolOffsetGroup.buttonClicked.connect(self.toolHandleKeys)
self.toolOffsetBackspace.clicked.connect(self.toolBackSpace)
## Rapid Parent Declaration
self.rapidZero.clicked.connect(self.buttonRapidZero)
self.rapidTwentyFive.clicked.connect(self.buttonRapidTwentyFive)
self.rapidFifty.clicked.connect(self.buttonRapidFifty)
self.rapidSeventyFive.clicked.connect(self.buttonRapidSeventyFive)
self.rapidHundred.clicked.connect(self.buttonRapidHundred)
# add any custom methods here
## AKA Child Definitions/Functions
def offsetHandleKeys(self, button):
char = str(button.text())
text = self.offsetLabel.text() or '0'
if text != '0':
text += char
else:
text = char
self.offsetLabel.setText(text)
def mdiHandleKeys(self, button):
char = str(button.text())
text = self.mdiEntry.text() or '0'
if text != '0':
text += char
else:
text = char
self.mdiEntry.setText(text)
def mdiBackSpace(self):
if len(self.mdiEntry.text()) > 0:
text = self.mdiEntry.text()[:-1]
self.mdiEntry.setText(text)
def toolHandleKeys(self, button):
text = self.toolOffsetLabel.text()
if len(text) > 0:
self.toolOffsetLabel.setText(text + button.text())
else:
self.toolOffsetLabel.setText(button.text())
def toolBackSpace(self):
text = self.toolOffsetLabel.text()[:-1]
self.toolOffsetLabel.setText(text)
def buttonRapidZero(self):
self.rapidZero.setChecked(True)
self.rapidTwentyFive.setChecked(False)
self.rapidFifty.setChecked(False)
self.rapidSeventyFive.setChecked(False)
self.rapidHundred.setChecked(False)
def buttonRapidTwentyFive(self):
self.rapidZero.setChecked(False)
self.rapidTwentyFive.setChecked(True)
self.rapidFifty.setChecked(False)
self.rapidSeventyFive.setChecked(False)
self.rapidHundred.setChecked(False)
def buttonRapidFifty(self):
self.rapidZero.setChecked(False)
self.rapidTwentyFive.setChecked(False)
self.rapidFifty.setChecked(True)
self.rapidSeventyFive.setChecked(False)
self.rapidHundred.setChecked(False)
def buttonRapidSeventyFive(self):
self.rapidZero.setChecked(False)
self.rapidTwentyFive.setChecked(False)
self.rapidFifty.setChecked(False)
self.rapidSeventyFive.setChecked(True)
self.rapidHundred.setChecked(False)
def buttonRapidHundred(self):
self.rapidZero.setChecked(False)
self.rapidTwentyFive.setChecked(False)
self.rapidFifty.setChecked(False)
self.rapidSeventyFive.setChecked(False)
self.rapidHundred.setChecked(True)
Lastly, you have the header set twice: (Your header originally): Many times programmers will only show the parts you need to change/add to your files but assume you know that if it is already there you will only change/add what is not. I should have been more explicit in my example code. The way you inserted the examples resulted in 3 super calls and 3 __init_ functions. All overwriting the next.
from qtpyvcp.widgets.form_widgets.main_window import VCPMainWindow
# Setup logging
from qtpyvcp.utilities import logger
LOG = logger.getLogger('qtpyvcp.' + __name__)
class MyMainWindow(VCPMainWindow):
"""Main window class for the VCP."""
def __init__(self, *args, **kwargs):
super(MyMainWindow, self).__init__(*args, **kwargs)
# add any custom methods here
from qtpyvcp.widgets.form_widgets.main_window import VCPMainWindow
# Setup logging
from qtpyvcp.utilities import logger
LOG = logger.getLogger('qtpyvcp.' + __name__)
class MyMainWindow(VCPMainWindow):
"""Main window class for the VCP."""
def __init__(self, *args, **kwargs):
super(MyMainWindow, self).__init__(*args, **kwargs)
# add any custom methods here
It should work after that.
Just always remember that all super declarations MUST be present in the __init__ function definition in order to be recognized by lower level or child functions. connect is a function to connect a parent declaration to a child function.
I think I explained that correctly. Lol. It is late.
The following user(s) said Thank You: Leon82
Please Log in or Create an account to join the conversation.
13 Dec 2019 04:48 #152589
by Donb9261
Replied by Donb9261 on topic QtPyVCP - Max_Velocity Override - Button Group Freebie
Kurt,
I will do a pull request once I get my code more presentable. I would fell most shameful if my crap code made into the main base. I will help with the docs if you can submit how to do custom widgets directly.
At present I am simply learning your style and paradigm so that I can ensure code linearity for you and others. Makes it easier to fix for all as you well know.
Thanks for the labor of love. Your code is very good and worth study.
I will do a pull request once I get my code more presentable. I would fell most shameful if my crap code made into the main base. I will help with the docs if you can submit how to do custom widgets directly.
At present I am simply learning your style and paradigm so that I can ensure code linearity for you and others. Makes it easier to fix for all as you well know.
Thanks for the labor of love. Your code is very good and worth study.
The following user(s) said Thank You: tommylight
Please Log in or Create an account to join the conversation.
13 Dec 2019 10:16 #152596
by Leon82
Replied by Leon82 on topic QtPyVCP - Max_Velocity Override - Button Group Freebie
Awesome, thanks
I'll try it out when I get home from work
I'll try it out when I get home from work
The following user(s) said Thank You: tommylight
Please Log in or Create an account to join the conversation.
13 Dec 2019 22:10 #152614
by Leon82
Replied by Leon82 on topic QtPyVCP - Max_Velocity Override - Button Group Freebie
I overwrote the main window.py and still only zero works..
I removed my Max velocity slider and Max velocity reset button.
Could it be something in the machine actions file?
I removed my Max velocity slider and Max velocity reset button.
Could it be something in the machine actions file?
Please Log in or Create an account to join the conversation.
13 Dec 2019 22:20 #152615
by Donb9261
Replied by Donb9261 on topic QtPyVCP - Max_Velocity Override - Button Group Freebie
Are all the buttons enabled on the object viewer and actionNames set?
Please Log in or Create an account to join the conversation.
13 Dec 2019 22:35 - 13 Dec 2019 22:39 #152616
by Leon82
Yes. They are the same as your post.
They're all checkable and they're all enabled.
In the machine actions if I change the value for the zero button to .2 It will set the velocity to 20%
Replied by Leon82 on topic QtPyVCP - Max_Velocity Override - Button Group Freebie
Are all the buttons enabled on the object viewer and actionNames set?
Yes. They are the same as your post.
They're all checkable and they're all enabled.
In the machine actions if I change the value for the zero button to .2 It will set the velocity to 20%
Last edit: 13 Dec 2019 22:39 by Leon82.
Please Log in or Create an account to join the conversation.
13 Dec 2019 22:38 #152617
by Donb9261
Replied by Donb9261 on topic QtPyVCP - Max_Velocity Override - Button Group Freebie
I just did a file compare on both and as long as you copied over your original mainwindow.py with what I sent you it should work if everything is solid in Qt with how you placed the widget.
I am pretty sure we have the same qtpyvcp versions based on the code.
Linuxcnc signals are the same on both ends. Hmmmm...
I am pretty sure we have the same qtpyvcp versions based on the code.
Linuxcnc signals are the same on both ends. Hmmmm...
Please Log in or Create an account to join the conversation.
13 Dec 2019 22:40 - 13 Dec 2019 22:40 #152618
by Leon82
Replied by Leon82 on topic QtPyVCP - Max_Velocity Override - Button Group Freebie
I'm on the newest release..
Once I click the zero button it goes to zero but won't go out until I hit a reset button for max velocity
Once I click the zero button it goes to zero but won't go out until I hit a reset button for max velocity
Last edit: 13 Dec 2019 22:40 by Leon82.
Please Log in or Create an account to join the conversation.
13 Dec 2019 22:48 #152619
by Leon82
Replied by Leon82 on topic QtPyVCP - Max_Velocity Override - Button Group Freebie
The group box currently resides inside of a tab widget I got to go out to dinner maybe after I'll play around with its location
Please Log in or Create an account to join the conversation.
Time to create page: 0.194 seconds