def add_properties_to_dimension_object( self, obj ): KWs = self.dimensioningProcess.dimensionConstructorKWs obj.addProperty("App::PropertyEnumeration", 'unit_scheme', 'Units') obj.unit_scheme = [ encode_if_py2(v) for v in ['Edit->Preference->Unit','mm','inch','m','custom'] ] obj.unit_scheme = encode_if_py2(self.unitSelected_combobox.currentText()) obj.addProperty("App::PropertyFloat", 'unit_custom_scale', 'Units') obj.unit_custom_scale = self.customScaleValue
def add_properties_to_dimension_object( self, obj ): obj.addProperty("App::PropertyString", self.name+ '_family', self.category) obj.addProperty("App::PropertyString", self.name+ '_size', self.category) obj.addProperty("App::PropertyString", self.name+ '_color', self.category) textRenderer = self.dimensioningProcess.dimensionConstructorKWs[ self.name ] setattr( obj, self.name + '_family', encode_if_py2(textRenderer.font_family) ) setattr( obj, self.name + '_size', encode_if_py2(textRenderer.font_size) ) setattr( obj, self.name + '_color', encode_if_py2(textRenderer.fill) )
def hoverMoveEvent(self, event): try: x, y = preview.applyTransform( event.scenePos() ) debugPrint(4, 'hoverMoveEvent: x %f, y %f' % (x, y) ) x, y= applyGridRounding( x, y) XML = '<svg width="%i" height="%i"> %s </svg>' % (preview.drawingVars.width, preview.drawingVars.height, self.dimensionSvgFun( x, y )) if isinstance(XML, unicode_type): XML = encode_if_py2(XML) debugPrint(5, XML) preview.SVGRenderer.load( QtCore.QByteArray( XML ) ) preview.SVG.update() except: App.Console.PrintError(traceback.format_exc())
def hoverMoveEvent(self, event): try: x, y = preview.applyTransform(event.scenePos()) debugPrint(4, 'hoverMoveEvent: x %f, y %f' % (x, y)) x, y = applyGridRounding(x, y) XML = '<svg width="%i" height="%i"> %s </svg>' % ( preview.drawingVars.width, preview.drawingVars.height, self.dimensionSvgFun(x, y)) if isinstance(XML, unicode_type): XML = encode_if_py2(XML) debugPrint(5, XML) preview.SVGRenderer.load(QtCore.QByteArray(XML)) preview.SVG.update() except: App.Console.PrintError(traceback.format_exc())
def add_properties_to_dimension_object( self, obj ): obj.addProperty("App::PropertyString", 'text', 'Parameters') obj.text = encode_if_py2(d.text)
def add_properties_to_dimension_object( self, obj ): obj.addProperty("App::PropertyString", self.name+'_text', 'Parameters') setattr( obj, self.name+'_text', encode_if_py2(getattr( d, self.name )) )
def add_properties_to_dimension_object( self, obj ): obj.addProperty("App::PropertyStringList", self.name, self.category) KWs = self.dimensioningProcess.dimensionConstructorKWs setattr( obj, self.name, [ encode_if_py2(v) for v in KWs[ self.name ] ] )
def val_to_FreeCAD_parm( self, val ): return '\n'.join(encode_if_py2(text) for text in val )
def add_properties_to_dimension_object( self, obj ): obj.addProperty("App::PropertyEnumeration", self.name, self.category) setattr( obj, self.name, [ encode_if_py2(v) for v in self.defaultValue ]) KWs = self.dimensioningProcess.dimensionConstructorKWs setattr( obj, self.name, encode_if_py2(KWs[ self.name ]) )
def getDefaultValue(self): encoded_value = self.dd_parms.GetString( self.name, encode_if_py2(self.defaultValue[0]) ) return unicode( encoded_value, 'utf8' )
def updateDefault(self): self.dd_parms.SetString( self.name, encode_if_py2(self.dimensioningProcess.dimensionConstructorKWs[ self.name ]) )
def add_properties_to_dimension_object(self, obj): obj.addProperty("App::PropertyString", self.name + '_text', 'Parameters') setattr(obj, self.name + '_text', encode_if_py2(getattr(d, self.name)))