FreeCAD Logo FreeCAD 1.0
  • English Afrikaans Arabic Belarusian Catalan Czech German Greek Spanish Spanish Basque Finnish Filipino French Galician Croatian Hungarian Indonesian Italian Japanese Kabyle Korean Lithuanian Dutch Norwegian Bokmal Polish Portuguese Portuguese Romanian Russian Slovak Slovenian Serbian Swedish Turkish Ukrainian Valencian Vietnamese Chinese Chinese
  • Features
  • Download
  • Blog
  • Documentation
    Documentation index Getting started Users documentation The FreeCAD manual Workbenches documentation Python coding documentation C++ coding documentation Tutorials Frequently asked questions Privacy policy About FreeCAD
  • Contribute
    How to help Sponsor Report a bug Make a pull request Jobs and funding Contribution guidelines Developers handbook Translations
  • Community
    Code of conduct Forum The FPA GitHub GitLab Codeberg Mastodon Matrix IRC IRC via Webchat Gitter Discord Reddit Twitter Facebook LinkedIn Calendar
  • ♥ Donate

Donate

$
SEPA Information
Please set up your SEPA bank transfer to:
Beneficiary: The FreeCAD project association
IBAN: BE04 0019 2896 4531
BIC/SWIFT: GEBABEBBXXX
Bank agency: BNP Paribas Fortis
Address: Rue de la Station 64, 1360 Perwez, Belgium

While Stripe doesn't support monthly donations, you can still become a sponsor! Simply make a one-time donation equivalent to 12 months of support, and you'll gain access to the corresponding sponsoring tier. It's an easy and flexible way to contribute.

If you are not sure or not able to commit to a regular donation, but still want to help the project, you can do a one-time donation, of any amount.

Choose freely the amount you wish to donate one time only.

You can support FreeCAD by sponsoring it as an individual or organization through various platforms. Sponsorship provides a steady income for developers, allowing the FPA to plan ahead and enabling greater investment in FreeCAD. To encourage sponsorship, we offer different tiers, and unless you choose to remain anonymous, your name or company logo will be featured on our website accordingly.

from 1 USD / 1 EUR per month. You will not have your name displayed here, but you will have helped the project a lot anyway. Together, normal sponsors maintain the project on its feet as much as the bigger sponsors.

from 25 USD / 25 EUR per month. Your name or company name is displayed on this page.

from 100 USD / 100 EUR per month. Your name or company name is displayed on this page, with a link to your website, and a one-line description text.

from 200 USD / 200 EUR per month. Your name or company name and logo displayed on this page, with a link to your website and a custom description text. Companies that have helped FreeCAD early on also appear under Gold sponsors.

Instead of donating each month, you might find it more comfortable to make a one-time donation that, when divided by twelve, would give you right to enter a sponsoring tier. Don't hesitate to do so!

Choose freely the amount you wish to donate each month.

Please inform your forum name or twitter handle as a notein your transfer, or reach to us, so we can give you proper credits!

Generic macro icon. Create your personal icon with the same name of the macro SplitPropEditor

Description
This macro has been written because some operations in FreeCAD need to get a frequent access to the property editor. Its limited height in the combo view can be a problem, especially when access to the tree view is also needed at the same time.

The macro solves this by allowing the user to temporarily split the property editor widget to a separated dock widget. The newly created widget is set to the right of the window at creation but can be moved (docked or floating) as any other dock widget.
When separated property editor is no more needed, user can close the extra widget and property editor is set back to the combo view automatically. Notice that when the property editor is detached from the combo view, its height is stored and is then restored when it's back to the combo view.
Moreover, when the property editor is split, it provides a font sizing mechanism so even more properties can be displayed.

Macro version: 0.63
Last modified: 2019-12-27
FreeCAD version: 0.17+
Author: OpenBrain

Author
OpenBrain
Download
Links
Macros recipes
How to install macros
How to customize toolbars
Macro Version
0.63
Date last modified
2019-12-27
FreeCAD Version(s)
0.17+
Default shortcut
None
See also

Description

Context

This macro has been written because some operations in FreeCAD need to get a frequent access to the property editor. Its limited height in the combo view can be a problem, especially when access to the tree view is also needed at the same time. The macro solves this by allowing the user to temporarily split the property editor widget to a separated dock widget. The newly created widget is set to the right of the window at creation but can be moved (docked or floating) as any other dock widget. When separated property editor is no more needed, user can close the extra widget and property editor is set back to the combo view automatically. Notice that when the property editor is detached from the combo view, its height is stored and is then restored when it's back to the combo view. Moreover, when the property editor is split, it provides a font sizing mechanism so even more properties can be displayed.

Usage

To split the property editor, just run the macro. When the macro has been run once in the session, different ways to split/reset the property editor exists :

  • When the property editor is split, closing the extra dock widget will reset it to the combo view
  • Run the macro again : at each run, property editor split will be toggled. This is a useful way if you attach the macro to a custom icon in a toolbar
  • Double-click the 'Model' tab label in the Combo view : each double-click will toggle property editor split
  • Go to View->Panels and toggle the 'Property editor' panel

When the property editor is split in its separated widget, perform a mouse middle click on the widget title bar to get access to the font sizer.

Installation

The macro is available through Addon Manager. Code is provided on this page for convenience in case user system doesn't have git-python. Though it should be up-to-date, latest release is always available at FreeCAD-macro repository

For more detailed explanations, see the How to install macros page. Notice that macro is ready to be set as Macro at Startup

Script

Forum discussion

For any feedback (bug, feature request, comments, ...), please use this forum thread : https://forum.freecad.org/viewtopic.php?f=22&t=39345

Code

Macro_SplitPropEditor.FCMacro

#!/usr/bin/python
#####################################
# Copyright (c) openBrain 2019
# Licensed under LGPL v2
#
# This FreeCAD macro will split the property editor from the combo view to a new dockable widget (panel)
# * The default widget is docked to the right of the window but can be freely moved
# * When the new widget 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
#
# Version history :
# *0.63 : add comments in the code
# *0.62 : property edit subpanel height is recorded and restored
# *0.61 : property editor split is toggles when 'Model' tab label is double clicked in Combo View
# *0.6 : improve behavior of macro so it toggles property editor split at each run
# *0.52 : stop timer when no more needed
# *0.51 : fix issue when separate Property View is enabled
# *0.5 : beta release
#
#####################################

__Name__ = 'SplitPropEditor'
__Comment__ = 'Splits the property editor from the combo view to a new dock widget (panel)'
__Author__ = 'openBrain'
__Version__ = '0.63'
__Date__ = '2019-12-27'
__License__ = 'LGPL v2'
__Web__ = 'https://wiki.freecad.org/Macro_SplitPropEditor'
__Wiki__ = 'https://wiki.freecad.org/Macro_SplitPropEditor'
__Icon__ = ''
__Help__ = 'Run macro once to create the new property editor panel'
__Status__ = 'Beta'
__Requires__ = 'FreeCAD >= 0.17'
__Communication__ = 'https://forum.freecad.org/viewtopic.php?f=22&t=39345'

### Perform needed imports
from PySide import QtCore, QtGui
import FreeCAD as App
import FreeCADGui as Gui

### Define a custom QDockWidget class
class PropEditor(QtGui.QDockWidget):

    def __init__(self):
        mw = Gui.getMainWindow() 
        pt = mw.findChild(QtGui.QWidget,'Combo View').findChild(QtGui.QWidget, 'propertyTab') # look for the property editor
        if not pt:
            raise Exception("Can't find property editor widget, exiting") 
        self.ptWid = pt.parent() # find property editor widget
        self.oldParent = pt.parent().parent() # find property editor parent (is a QSplitter)
        self.oldIndex = self.oldParent.indexOf(self.ptWid) # store index of property editor in the QSplitter
        self.font = QtGui.QFont(pt.font()) # store current font
        super(PropEditor, self).__init__() # run inherited class constructor
        self.setParent(mw)
        self.setObjectName("PropEdit")
        self.setWindowTitle("Property Editor")
        ### create a custom title bar widget so font can be sized when property editor is split
        self.titleWid = QtGui.QWidget()
        lay = QtGui.QHBoxLayout()
        self.fs = QtGui.QSlider(QtCore.Qt.Horizontal) # slider to size font
        oldPs = self.font.pointSize()
        self.fs.setSliderPosition(oldPs) # set default slider position
        self.fs.setMaximum(oldPs) # maximum font size is default one
        self.fs.setMinimum(int(oldPs/2+1)) # minimum font size is almost half the default one
        self.fs.setPageStep(1) # needed so mouse wheel step is 1
        self.fs.valueChanged.connect(self.changeFs)
        self.fs.sliderReleased.connect(self.changeFs) # needed to manage font sizer hiding when slider is held by user
        lay.addWidget(QtGui.QLabel("Size : "))
        lay.addWidget(self.fs)
        self.titleWid.setLayout(lay)
        self.timer = QtCore.QTimer(self) # set a timer so font sizer is hidden after some time
        self.timer.setInterval(2500)
        self.timer.timeout.connect(self.titleBarTo)
        ### connect to 'Model' tab label double-clicking to toggle split
        self.tb = mw.findChild(QtGui.QWidget,'Combo View').findChild(QtGui.QWidget, 'combiTab')
        self.tb.tabBarDoubleClicked.connect(self.toggleVisibility)

    def changeFs(self, fs=0): # called when font sizer slider is moved
        self.timer.start() # restart timeout timer
        if fs != 0:
            self.font.setPointSize(fs) # compute new font ...
            self.ptWid.setFont(self.font) # ... then apply

    def showEvent(self, event): # called when custom dock widget is shown
        self.ptHeight=self.oldParent.sizes() # record property editor height (handled at QSplitter to prevent opaque resizing)
        self.setWidget(self.ptWid) # transfer property editor widget to custom dock widget
        self.ptWid.setFont(self.font) # apply custom font size

    def hideEvent(self, event): # called when custom dock widget is hidden
        self.oldParent.insertWidget(self.oldIndex, self.ptWid) # reset property editor widget to combo view
        self.oldParent.setSizes(self.ptHeight) # restore property editor height
        self.ptWid.setFont(QtGui.QFont()) # restore default font of combo view

    def mousePressEvent(self, event): # called when mouse is pressed on the custom dock widget
        if event.button() == QtCore.Qt.MouseButton.MidButton: # if button is middle one
            self.setTitleBarWidget(self.titleWid) # show the font sizer in the title bar
            self.timer.start() # start timeout timer

    def titleBarTo(self): # called when timeout timer expires
        if not self.fs.isSliderDown(): # if slider is no more held by user
            self.resetTitleBar() # reset title bar

    def resetTitleBar(self):
        self.setTitleBarWidget(None) # set title bar to 'None' so it get back its default aspect
        self.timer.stop() # stop timeout timer

    def toggleVisibility(self, index = -2): # called to toggle property editor split ...
    # ... 'index' is needed when used as slot for 'Model' tab double-click ...
    # ... '-2' value can't be sent by signal so we know its a 'manual' call
        if index == -2 or self.tb.tabText(index).replace('&','') == 'Model': # if manual call or double-click on 'Model' tab label
            self.setVisible(self.isHidden()) # toggle custom dock widget visibility (behavior handled by show/hide events)

def run() : # define main function
    pe = Gui.getMainWindow().findChild(QtGui.QWidget, 'PropEdit') # check if a custom property editor dock widget already exist
    if not pe: # if doesn't exist yet
        Gui.getMainWindow().addDockWidget(QtCore.Qt.RightDockWidgetArea, PropEditor()) # create it
    else: # if already exists
        pe.toggleVisibility() # toggle property editor split

if __name__ == '__main__': # if macro called to run
    run()

This page is retrieved from https://wiki.freecad.org/Macro_SplitPropEditor

Get in touch!
Forum GitHub Mastodon Matrix IRC Gitter.im Discord Reddit Twitter Facebook LinkedIn

© The FreeCAD Team. Homepage image credits (top to bottom): ppemawm, r-frank, epileftric, regis, rider_mortagnais, bejant.

This project is supported by: , KiCad Services Corp. and other sponsors

GitHubImprove this page on GitHub