def setupColors(self): def colorForColorValue(val): v = [((val >> n) & 0xff) / 255. for n in [24, 16, 8, 0]] return coin.SbColor(v[0], v[1], v[2]) pref = PathPreferences.preferences() # R G B A npc = pref.GetUnsigned('DefaultPathMarkerColor', ((85*256 + 255)*256 + 0) * 256 + 255) hpc = pref.GetUnsigned('DefaultHighlightPathColor', ((255*256 + 125)*256 + 0)*256 + 255) dpc = pref.GetUnsigned('DefaultDisabledPathColor', ((205*256 + 205)*256 + 205)*256 + 154) self.colors = [colorForColorValue(npc), colorForColorValue(dpc), colorForColorValue(hpc)]
def saveSettings(self): pref = PathPreferences.preferences() pref.SetFloat(self.DefaultHoldingTagWidth, FreeCAD.Units.Quantity(self.form.ifWidth.text()).Value) pref.SetFloat(self.DefaultHoldingTagHeight, FreeCAD.Units.Quantity(self.form.ifHeight.text()).Value) pref.SetFloat(self.DefaultHoldingTagAngle, self.form.dsbAngle.value()) pref.SetFloat(self.DefaultHoldingTagRadius, FreeCAD.Units.Quantity(self.form.ifRadius.text())) pref.SetUnsigned(self.DefaultHoldingTagCount, self.form.sbCount.value())
def defaultRadius(cls, ifNotSet=0.0): return PathPreferences.preferences().GetFloat( cls.DefaultHoldingTagRadius, ifNotSet)
def defaultCount(cls, ifNotSet=4): value = PathPreferences.preferences().GetUnsigned( cls.DefaultHoldingTagCount, ifNotSet) if value < 2: return float(ifNotSet) return float(value)
def defaultAngle(cls, ifNotSet=45.0): value = PathPreferences.preferences().GetFloat( cls.DefaultHoldingTagAngle, ifNotSet) if value < 10.0: return ifNotSet return value
def defaultHeight(cls, ifNotSet): value = PathPreferences.preferences().GetFloat( cls.DefaultHoldingTagHeight, ifNotSet) if value == 0.0: return ifNotSet return value