Kunda1 wrote: ↑Fri Dec 27, 2019 10:05 pm
What's the usecase for it?
Basically :
Property editor split : when you need an intensive access to properties (eg. to enter expressions), having it in a separated dock widget allows to use the whole height of the window, thus to display much more properties on the screen and get better access to it
Task tab split : as soon as you use functions that need to either select things in the tree or play with show/hide objects, you have to constantly switch between Task tab and Model tab (to get the tree view). Having both separated prevent this permanent switching
Power users seem to need very different tools. So it may be sensible to think about configurable buttons. E.g. I don't need several of the existing buttons, but I want to toggle the "EnableSelection" parameter from the preferences, which is probably useless for others.
My knowledge of FreeCAD-Python is very limited so I'm still struggling with the code, and it would be great if there was an easy to handle possibility to assign buttons to a few lines of code.
openBrain wrote: ↑Fri Dec 27, 2019 10:37 pm
Basically :
Property editor split : when you need an intensive access to properties (eg. to enter expressions), having it in a separated dock widget allows to use the whole height of the window, thus to display much more properties on the screen and get better access to it
Task tab split : as soon as you use functions that need to either select things in the tree or play with show/hide objects, you have to constantly switch between Task tab and Model tab (to get the tree view). Having both separated prevent this permanent switching
Hope this may explain a bit.
Thank you, that was very helpful. It can also be copy/pasted and added to the documentation because it is very thorough. I see the usefulness of this for sure. It reminds me of the user that is doing their Ph.D. thesis(?) on Multi Body Systems and how many times they have to switch dialogs off and on screen as part of their workflow. It also remind me of the problem that @microelly2 has with pyflow node editor, in other words we're talking 'screen real-estate'
chrisb wrote: ↑Sat Dec 28, 2019 8:42 am
My knowledge of FreeCAD-Python is very limited so I'm still struggling with the code, and it would be great if there was an easy to handle possibility to assign buttons to a few lines of code.
This would be a great topic for a tutorial + I remember someone making a feature request perhaps the Addon Manager or FreeCAD Macros repo of adding buttons for macros as an option when installing them (need to confirm this).
To make it clear: I didn't mean the general possibility to assign a macro to an icon. I meant openBrains SU tool, where I would like to assign my own stuff to one of the buttons. It's in fact only two lines (could be reduced to one):
chrisb wrote: ↑Sat Dec 28, 2019 2:39 pm
To make it clear: I didn't mean the general possibility to assign a macro to an icon. I meant openBrains SU tool, where I would like to assign my own stuff to one of the buttons. It's in fact only two lines (could be reduced to one:
This is clear. Let me do a bit of work on the macro and you should be able to tune things by yourself without deep Python knowledge.
Just notice that in the example you give, you can get a toggling mechanism with :
Thanks (in my case it probably needs a bit more to show the state of the button).
I could imagine something like an XML, or json file, which is read by SU where an entry has two or three values; ButtonText, FunctionName, (optional ToolText). I have no idea though, if Python has the possibility to execute a function if the name is given as string.
chrisb wrote: ↑Sat Dec 28, 2019 5:31 pm
...I have no idea though, if Python has the possibility to execute a function if the name is given as string.
Basically all scripting languages can do this. In Python use the exec() function.
It is a bit dangerous because if you don't check your string, somebody could potentially inject harmful code. So make sure you can only execute a string that you want, and not arbitrary code.
chrisb wrote: ↑Sat Dec 28, 2019 5:31 pm
Thanks (in my case it probably needs a bit more to show the state of the button).
I could imagine something like an XML, or json file, which is read by SU where an entry has two or three values; ButtonText, FunctionName, (optional ToolText). I have no idea though, if Python has the possibility to execute a function if the name is given as string.
Hi chrisb, I'm currently working a bit on your request.
In your case it's pretty easy but I'd like to enlarge a bit around your need :
In your case, how do you imagine the UI ? The button is a "push" type and it switches value between True & False each time it's pressed (with a "tooltip" indicating the value) ? Or something like a "toggle" type that is pushed for True and released for False ?
If we go further, do you imagine cases where it would deal with other that boolean (eg. integers, floats, strings) ? In this case the button could round-switch between a set of values each time it's pressed.
Even dealing with integers with a slider (in the way the Visibility tool works) ? A use case would be eg. to live change pick radius ?
Obviously the more cases is handled, the more complex is the code. But I prefer to match the full need.
EDIT : actually there is a difficult case to handle. It's when the user goes to the Parameter Editor and manually changes the value there. the button will lose the sync. But I guess we can ignore this.
openBrain wrote: ↑Sun Dec 29, 2019 6:06 pm
In your case, how do you imagine the UI ? The button is a "push" type and it switches value between True & False each time it's pressed (with a "tooltip" indicating the value) ? Or something like a "toggle" type that is pushed for True and released for False ?
Thanks for working on this. I would like to see the state immediately like I do now. Tooltip help is nice, but not for quick use.