[Macro] Split property editor to another dockable panel

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
openBrain
Veteran
Posts: 9041
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

[Macro] Split property editor to another dockable panel

Post by openBrain »

Hi all,

Here a macro that hopefully can be useful to others. :)
This has been mainly designed for cases where user need to access alternatively tree view & p
The macro when run will split the property editor from the combo view to a new dockable panel.
Main characteristics are :
  • By default, the new panel is docked to the right of the window, but it can then be freely moved
  • When the new panel is closed, the property editor is set back to its location in the combo view
  • When the macro has been run once, the new widget is registered in FC UI and can (shall) be hidden/shown as original panels are
  • Mouse middle click on the panel title displays a temporary slider to change font size that allows to view more properties
I'll create the wiki page soon but macro is attached for early testing. :)

EDIT1 : bug fix in attached Macro
Attachments
SplitPropEditor.FCMacro
(3.61 KiB) Downloaded 74 times
Last edited by openBrain on Mon Sep 16, 2019 3:03 pm, edited 1 time in total.
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: [Macro] Split property editor to another dockable panel

Post by Kunda1 »

sweet, can you show short gif or at least a screenshot for the short-attention span folks ? ;)
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
wmayer
Founder
Posts: 20324
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: [Macro] Split property editor to another dockable panel

Post by wmayer »

SplitPropEditor.FCMacro", line 45, in __init__
self.oldIndex = self.oldParent.indexOf(self.ptWid)
<class 'AttributeError'>: 'PySide2.QtWidgets.QWidget' object has no attribute 'indexOf'
openBrain
Veteran
Posts: 9041
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: [Macro] Split property editor to another dockable panel

Post by openBrain »

wmayer wrote: Sun Sep 15, 2019 7:23 am
SplitPropEditor.FCMacro", line 45, in __init__
self.oldIndex = self.oldParent.indexOf(self.ptWid)
<class 'AttributeError'>: 'PySide2.QtWidgets.QWidget' object has no attribute 'indexOf'
Thanks for feedback but that's a bit short. :lol:
What it tells is that the 'propertyTab' widget grand-parent isn't a QSplitter in the version you use... I tested with both freecad-stable & freecad-daily, so I think you're using something different. Could you tell more about your version ? Staging ?
I'm interested in fixing that. I take advantage of you being a core dev to ask if you can point me to where in the code the ComboView UI is defined (I admit I didn't search yet) ?
Thanks
openBrain
Veteran
Posts: 9041
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: [Macro] Split property editor to another dockable panel

Post by openBrain »

Kunda1 wrote: Sun Sep 15, 2019 12:01 am sweet, can you show short gif or at least a screenshot for the short-attention span folks ? ;)
Sure. Here it is. ;)
PropEdit.gif
PropEdit.gif (936.55 KiB) Viewed 2235 times
wmayer
Founder
Posts: 20324
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: [Macro] Split property editor to another dockable panel

Post by wmayer »

openBrain wrote: Sun Sep 15, 2019 8:37 am
wmayer wrote: Sun Sep 15, 2019 7:23 am
SplitPropEditor.FCMacro", line 45, in __init__
self.oldIndex = self.oldParent.indexOf(self.ptWid)
<class 'AttributeError'>: 'PySide2.QtWidgets.QWidget' object has no attribute 'indexOf'
Thanks for feedback but that's a bit short. :lol:
What it tells is that the 'propertyTab' widget grand-parent isn't a QSplitter in the version you use... I tested with both freecad-stable & freecad-daily, so I think you're using something different. Could you tell more about your version ? Staging ?
I'm interested in fixing that. I take advantage of you being a core dev to ask if you can point me to where in the code the ComboView UI is defined (I admit I didn't search yet) ?
Thanks
All what I did is to execute the macro. The full error message is:
Traceback (most recent call last):
File "SplitPropEditor.FCMacro", line 97, in <module>
Gui.getMainWindow().addDockWidget(QtCore.Qt.RightDockWidgetArea, PropEditor())
File "SplitPropEditor.FCMacro", line 45, in __init__
self.oldIndex = self.oldParent.indexOf(self.ptWid)
<class 'AttributeError'>: 'PySide2.QtWidgets.QWidget' object has no attribute 'indexOf'
What kind of object is oldParent supposed to be that it has an "indexOf" method? Usually a QList has this method but not a QWidget.

OS: Windows 7 SP 1 (6.1)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.18227 (Git)
Build type: Release
Branch: master
Hash: a374ecc8ef2abf38b146a1013a0f9700d1cb5fe9
Python version: 3.6.8
Qt version: 5.12.1
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: German/Germany (de_DE)
openBrain
Veteran
Posts: 9041
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: [Macro] Split property editor to another dockable panel

Post by openBrain »

wmayer wrote: Sun Sep 15, 2019 9:12 am What kind of object is oldParent supposed to be that it has an "indexOf" method? Usually a QList has this method but not a QWidget.
As said, it expects oldParent to be a QSplitter, as this is how UI is designed both on 0.18.3 and latest daily I have here : ;)

Code: Select all

>>> Gui.getMainWindow().findChild(QtGui.QWidget,'propertyTab')
<PySide2.QtWidgets.QTabWidget object at 0x7fdbe039bc88>
>>> Gui.getMainWindow().findChild(QtGui.QWidget,'propertyTab').parent()
<PySide2.QtWidgets.QWidget object at 0x7fdbc92eb448>
>>> Gui.getMainWindow().findChild(QtGui.QWidget,'propertyTab').parent().parent()
<PySide2.QtWidgets.QSplitter object at 0x7fdbc92eb588>
Syres
Veteran
Posts: 2902
Joined: Thu Aug 09, 2018 11:14 am

Re: [Macro] Split property editor to another dockable panel

Post by Syres »

@openBrain, have you tried using the macro as a new user i.e. not using the config files that you may have customised over time? I was slightly bemused that I couldn't replicate @wmayer's error message on multiple Windows builds from 0.18.3 upwards. As soon as I moved my config files out to another folder and restarted FreeCAD, the error message was raised on executing the macro.
openBrain
Veteran
Posts: 9041
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: [Macro] Split property editor to another dockable panel

Post by openBrain »

Syres wrote: Sun Sep 15, 2019 10:41 am @openBrain, have you tried using the macro as a new user i.e. not using the config files that you may have customised over time? I was slightly bemused that I couldn't replicate @wmayer's error message on multiple Windows builds from 0.18.3 upwards. As soon as I moved my config files out to another folder and restarted FreeCAD, the error message was raised on executing the macro.
Great finding. Yes I tried but missed something. I blanked my configuration, but tested on 0.19 then on 0.18.3. And it worked. :)
But indeed if I blank config then start 0.18.3 first, I get the message.
Will investigate. :)
openBrain
Veteran
Posts: 9041
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: [Macro] Split property editor to another dockable panel

Post by openBrain »

OK. Found very weird things... Let's try to explain :

Walkthrough 1 :
  1. Blank the config
  2. Start FC 0.18.3 => The macro crashes with above message. BUT actually, the macro is pretty useless as having a separate property editor is natively available in Panels->Property view :!:
  3. Close FC 0.18 & start FC 0.19 (latest daily) => The native separate Property viewer is available so here again, macro is useless :!:
Walkthrough 2:
  1. Blank the config
  2. Start FC 0.19 (latest daily) => The native separate Property viewer isn't available in the panel list :!: Macro works correctly
  3. Close FC 0.19 & start FC 0.18.3 => Then native Property viewer isn't available anymore :!: :!: Macro works
This looks to me as something very weird. Especially because I didn't expect config file can so deeply tamper the UI...
Was the Property view panel intentionally removed in 0.19 or is it some regression somewhere ?
Post Reply