FreeCAD Python
Classes | Functions
DraftGui Namespace Reference

Detailed Description

GUI elements and utilities of the Draft workbench.

This module provides GUI tools for the Draft workbench, such as toolbars and task panels, and Qt-dependent utilities such as a delayed (todo) commit system

Classes

class  FacebinderTaskPanel
 
class  ScaleTaskPanel
 
class  ShapeStringTaskPanel
 for debugging: else: msg = "TranslateWidget: Can not translate widget: {0} type: {1}\n".format(w.objectName(),w.metaObject().className()) FreeCAD.Console.PrintMessage(msg) More...
 
class  todo
 

Functions

def translate (context, text, utf8_decode=True)
 
def utf8_decode (text)
 
def getDefaultUnit (dim)
 
def makeFormatSpec (decimals=4, dim='Length')
 
def displayExternal (internValue, decimals=None, dim='Length', showUnit=True, unit=None)
 

Function Documentation

◆ displayExternal()

def DraftGui.displayExternal (   internValue,
  decimals = None,
  dim = 'Length',
  showUnit = True,
  unit = None 
)
return an internal value (ie mm) Length or Angle converted for display according
to Units Schema in use. Unit can be used to force the value to express in a certain unit

◆ getDefaultUnit()

def DraftGui.getDefaultUnit (   dim)
return default Unit of Measure for a Dimension based on user preference
Units Schema

◆ makeFormatSpec()

def DraftGui.makeFormatSpec (   decimals = 4,
  dim = 'Length' 
)
return a % format spec with specified decimals for a specified
dimension based on on user preference Units Schema

◆ translate()

def DraftGui.translate (   context,
  text,
  utf8_decode = True 
)
convenience function for Qt translator
    context: str
        context is typically a class name (e.g., "MyDialog")
    text: str
        text which gets translated
    utf8_decode: bool [False]
        if set to true utf8 encoded unicode will be returned. This option does not have influence
        on python3 as for python3 we are returning utf-8 encoded unicode by default!

◆ utf8_decode()

def DraftGui.utf8_decode (   text)
py2: str     -> unicode
        unicode -> unicode
   py3: str     -> str
        bytes   -> str