New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Shortcuts #3710
Shortcuts #3710
Conversation
….getCommandShortcut() and Gui.getCommandInfo() where user has changed shortcut via customize dialog, but these 2 commands returned previous default information
src/Gui/ApplicationPy.cpp
Outdated
#endif | ||
std::string shortcutTxt = action->shortcut().toString().toStdString(); | ||
|
||
#if PY_MAJOR_VERSION >= 3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems to me that all pre-processor directives in this project are placed at column 1, so it should probably stay this way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, thanks for reviewing. I was thinking I had accidentally moved them during editing. Not sure if people are still building for python 2 anyway at this point. In retrospect we should have made all the #if's read #if python 2 instead of #if python 3 as that would simplify removing them when it comes time to do so.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, our test matrix in Travis does build for Python 2; so until we completely deactivate this test, we should still maintain Python 2 compatibility. And about removing Python 2 support, I'm not sure how that will be handled. I guess we will passively ignore Python 2 rather than actively remove Python 2 code.
src/Gui/ApplicationPy.cpp
Outdated
|
||
#if PY_MAJOR_VERSION >= 3 | ||
PyObject* strMenuTxt = PyUnicode_FromString(menuTxt ? menuTxt : ""); | ||
PyObject* strMenuTxt = PyUnicode_FromString(menuTxt ? menuTxt : ""); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a tab character. It should be spaces.
src/Gui/ApplicationPy.cpp
Outdated
|
||
#if PY_MAJOR_VERSION >= 3 | ||
PyObject* strMenuTxt = PyUnicode_FromString(menuTxt ? menuTxt : ""); | ||
PyObject* strTooltipTxt = PyUnicode_FromString(tooltipTxt ? tooltipTxt : ""); | ||
PyObject* strWhatsThisTxt = PyUnicode_FromString(whatsThisTxt ? whatsThisTxt : ""); | ||
PyObject* strStatustipTxt = PyUnicode_FromString(statustipTxt ? statustipTxt : ""); | ||
PyObject* strPixMapTxt = PyUnicode_FromString(pixMapTxt ? pixMapTxt : ""); | ||
PyObject* strShortcutTxt = PyUnicode_FromString(shortcutTxt ? shortcutTxt : ""); | ||
PyObject* strShortcutTxt = PyUnicode_FromString(!shortcutTxt.empty() ? shortcutTxt.c_str() : "") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems the final semi-colon ;
is missing here. The unit test with Python 3 fails because of it.
Some shortcuts are unable to be set, but after loading all of my installed workbenches and testing setting shortcuts for all commands it succeeds about 84.5% of the time. Randomly, I tried to set the shortcuts for some of the failed commands using the customize dialog, which also fails for these same commands (assign button is always grayed out). In the terminal window I get a warning message that these commands are not yet implemented. From what I can tell with limited testing if you can't set the shortcut in the python console with Gui.setCommandShortcut() you can't do it from the customize dialog either. I used this macro to do the tests:
|
…ck for if setting shortcut was success
Excellent addition anyway! The commands that fail to get a shortcut indeed seem like another problem. |
Thank you for creating a pull request to contribute to FreeCAD! To ease integration, please confirm the following:
git pull --rebase upstream master
./bin/FreeCAD --run-test 0
issue #<id>
orfixes #<id>
where<id>
is the associated MantisBT issue id if one existsAnd please remember to update the Wiki with the features added or changed once this PR is merged.
Note: If you don't have wiki access, then please mention your contribution on the 0.19 Changelog Forum Thread.