def GetResources(self): path = str( Path(__file__).parent / "Resources" / "icons" / "base_plate.svg") return { 'Pixmap': path, 'MenuText': QT_TRANSLATE_NOOP("civiltools_baseplate", "Base Plate"), 'Accel': "B, P", 'ToolTip': QT_TRANSLATE_NOOP("civiltools_baseplate", "Creates a Base Plate") }
def setProperties(self, obj): """Add properties to ReinforcementDrawingView object.""" self.Type = "ReinforcementDrawingView" if not hasattr(obj, "Structure"): obj.addProperty( "App::PropertyLink", "Structure", "ReinforcementDrawingView", QT_TRANSLATE_NOOP( "App::Property", "The structure object acting as Host for rebars", ), ) if not hasattr(obj, "Rebars"): obj.addProperty( "App::PropertyLinkList", "Rebars", "ReinforcementDrawingView", QT_TRANSLATE_NOOP( "App::Property", "The list of rebar objects to be included in drawing", ), ) if not hasattr(obj, "View"): obj.addProperty( "App::PropertyEnumeration", "View", "ReinforcementDrawingView", QT_TRANSLATE_NOOP( "App::Property", "The reinforcement drawing view", ), ).View = ["Front", "Rear", "Left", "Right", "Top", "Bottom"] if not hasattr(obj, "PositionType"): obj.addProperty( "App::PropertyEnumeration", "PositionType", "Base", QT_TRANSLATE_NOOP( "App::Property", "The position type of Reinforcement Drawing on Template", ), ).PositionType = ["Automatic", "Custom"] obj.PositionType = "Automatic" if not hasattr(obj, "RebarsStrokeWidth"): obj.addProperty( "App::PropertyLength", "RebarsStrokeWidth", "ReinforcementDrawingView", QT_TRANSLATE_NOOP( "App::Property", "The stroke width of rebars in Reinforcement Drawing svg", ), ) obj.RebarsStrokeWidth = 0.35 if not hasattr(obj, "RebarsColorStyle"): obj.addProperty( "App::PropertyEnumeration", "RebarsColorStyle", "ReinforcementDrawingView", QT_TRANSLATE_NOOP( "App::Property", "The color style of rebars in Reinforcement Drawing svg", ), ).RebarsColorStyle = ["Automatic", "Custom"] obj.RebarsColorStyle = "Automatic" if not hasattr(obj, "RebarsColor"): obj.addProperty( "App::PropertyColor", "RebarsColor", "ReinforcementDrawingView", QT_TRANSLATE_NOOP( "App::Property", "The color of rebars in Reinforcement Drawing svg", ), ) obj.RebarsColor = (0.67, 0.0, 0.0) if not hasattr(obj, "StructureStrokeWidth"): obj.addProperty( "App::PropertyLength", "StructureStrokeWidth", "ReinforcementDrawingView", QT_TRANSLATE_NOOP( "App::Property", "The stroke width of structure in Reinforcement Drawing " "svg", ), ) obj.StructureStrokeWidth = 0.35 if not hasattr(obj, "StructureColorStyle"): obj.addProperty( "App::PropertyEnumeration", "StructureColorStyle", "ReinforcementDrawingView", QT_TRANSLATE_NOOP( "App::Property", "The color style of structure in Reinforcement Drawing svg", ), ).StructureColorStyle = ["Automatic", "Custom", "None"] obj.StructureColorStyle = "Automatic" if not hasattr(obj, "StructureColor"): obj.addProperty( "App::PropertyColor", "StructureColor", "ReinforcementDrawingView", QT_TRANSLATE_NOOP( "App::Property", "The color of structure in Reinforcement Drawing svg", ), ) obj.StructureColor = (0.3, 0.9, 0.91) if not hasattr(obj, "Template"): obj.addProperty( "App::PropertyLink", "Template", "ReinforcementDrawingView", QT_TRANSLATE_NOOP( "App::Property", "The template for Reinforcement Drawing view", ), ) if not hasattr(obj, "Width"): obj.addProperty( "App::PropertyLength", "Width", "ReinforcementDrawingView", QT_TRANSLATE_NOOP( "App::Property", "The width of Reinforcement Drawing view svg", ), 8, ) obj.setEditorMode("Width", 2) if not hasattr(obj, "Height"): obj.addProperty( "App::PropertyLength", "Height", "ReinforcementDrawingView", QT_TRANSLATE_NOOP( "App::Property", "The height of Reinforcement Drawing view svg", ), 8, ) obj.setEditorMode("Height", 2) if not hasattr(obj, "LeftOffset"): obj.addProperty( "App::PropertyLength", "LeftOffset", "ReinforcementDrawingView", QT_TRANSLATE_NOOP( "App::Property", "The left offset of Reinforcement Drawing view", ), ) obj.LeftOffset = 6 if not hasattr(obj, "TopOffset"): obj.addProperty( "App::PropertyLength", "TopOffset", "ReinforcementDrawingView", QT_TRANSLATE_NOOP( "App::Property", "The top offset of Reinforcement Drawing view", ), ) obj.TopOffset = 6 if not hasattr(obj, "MinRightOffset"): obj.addProperty( "App::PropertyLength", "MinRightOffset", "ReinforcementDrawingView", QT_TRANSLATE_NOOP( "App::Property", "The minimum right offset of Reinforcement Drawing view", ), ) obj.MinRightOffset = 6 if not hasattr(obj, "MinBottomOffset"): obj.addProperty( "App::PropertyLength", "MinBottomOffset", "ReinforcementDrawingView", QT_TRANSLATE_NOOP( "App::Property", "The minimum bottom offset of Reinforcement Drawing view", ), ) obj.MinBottomOffset = 6 if not hasattr(obj, "MaxWidth"): obj.addProperty( "App::PropertyLength", "MaxWidth", "ReinforcementDrawingView", QT_TRANSLATE_NOOP( "App::Property", "The maximum width of Reinforcement Drawing view", ), ) obj.MaxWidth = 190 if not hasattr(obj, "MaxHeight"): obj.addProperty( "App::PropertyLength", "MaxHeight", "ReinforcementDrawingView", QT_TRANSLATE_NOOP( "App::Property", "The maximum height of Reinforcement Drawing view", ), ) obj.MaxHeight = 250 if not hasattr(obj, "VisibleRebars"): obj.addProperty( "App::PropertyLinkList", "VisibleRebars", "ReinforcementDrawingView", QT_TRANSLATE_NOOP( "App::Property", "The list of visible rebar objects in drawing", ), 8, ) obj.setEditorMode("VisibleRebars", 2) # These offsets are used by ReinforcementDimensioning objects to # auto-calculate rebars dimension points to align dimension text to # left, right, top or bottom line if not hasattr(obj, "DimensionLeftOffset"): obj.addProperty( "App::PropertyLength", "DimensionLeftOffset", "ReinforcementDimensioning", QT_TRANSLATE_NOOP( "App::Property", "The left offset for each new ReinforcementDimensioning " "object", ), 8, ) obj.DimensionLeftOffset = DIMENSION_LEFT_OFFSET obj.setEditorMode("DimensionLeftOffset", 2) if not hasattr(obj, "DimensionRightOffset"): obj.addProperty( "App::PropertyLength", "DimensionRightOffset", "ReinforcementDimensioning", QT_TRANSLATE_NOOP( "App::Property", "The right offset for each new ReinforcementDimensioning " "object", ), 8, ) obj.DimensionRightOffset = DIMENSION_RIGHT_OFFSET obj.setEditorMode("DimensionRightOffset", 2) if not hasattr(obj, "DimensionTopOffset"): obj.addProperty( "App::PropertyLength", "DimensionTopOffset", "ReinforcementDimensioning", QT_TRANSLATE_NOOP( "App::Property", "The top offset for each new ReinforcementDimensioning " "object", ), 8, ) obj.DimensionTopOffset = DIMENSION_TOP_OFFSET obj.setEditorMode("DimensionTopOffset", 2) if not hasattr(obj, "DimensionBottomOffset"): obj.addProperty( "App::PropertyLength", "DimensionBottomOffset", "ReinforcementDimensioning", QT_TRANSLATE_NOOP( "App::Property", "The bottom offset for each new ReinforcementDimensioning " "object", ), 8, ) obj.DimensionBottomOffset = DIMENSION_BOTTOM_OFFSET obj.setEditorMode("DimensionBottomOffset", 2)
def setProperties(self, obj): """Add properties to BOMContent object.""" self.Type = "BOMContent" if not hasattr(obj, "Font"): obj.addProperty( "App::PropertyFont", "Font", "BOMContent", QT_TRANSLATE_NOOP( "App::Property", "The font family of Bill of Material content", ), ) obj.Font = "DejaVu Sans" if not hasattr(obj, "FontFilename"): obj.addProperty( "App::PropertyFile", "FontFilename", "BOMContent", QT_TRANSLATE_NOOP( "App::Property", "The font filename for font of Bill of Material content and" " is required for working in pure console mode", ), ) obj.FontFilename = "DejaVuSans.ttf" obj.setEditorMode("FontFilename", 2) if not hasattr(obj, "FontSize"): obj.addProperty( "App::PropertyLength", "FontSize", "BOMContent", QT_TRANSLATE_NOOP( "App::Property", "The font size of Bill of Material content", ), ) obj.FontSize = 3 if not hasattr(obj, "Template"): obj.addProperty( "App::PropertyLink", "Template", "BOMContent", QT_TRANSLATE_NOOP( "App::Property", "The template for Bill of Material content", ), ) if not hasattr(obj, "Width"): obj.addProperty( "App::PropertyLength", "Width", "BOMContent", QT_TRANSLATE_NOOP( "App::Property", "The width of Bill of Material content", ), ) obj.setEditorMode("Width", 2) if not hasattr(obj, "Height"): obj.addProperty( "App::PropertyLength", "Height", "BOMContent", QT_TRANSLATE_NOOP( "App::Property", "The height of Bill of Material content", ), ) obj.setEditorMode("Height", 2) if not hasattr(obj, "LeftOffset"): obj.addProperty( "App::PropertyLength", "LeftOffset", "BOMContent", QT_TRANSLATE_NOOP( "App::Property", "The left offset of Bill of Material content", ), ) obj.LeftOffset = 6 if not hasattr(obj, "TopOffset"): obj.addProperty( "App::PropertyLength", "TopOffset", "BOMContent", QT_TRANSLATE_NOOP( "App::Property", "The top offset of Bill of Material content", ), ) obj.TopOffset = 6 if not hasattr(obj, "MinRightOffset"): obj.addProperty( "App::PropertyLength", "MinRightOffset", "BOMContent", QT_TRANSLATE_NOOP( "App::Property", "The minimum right offset of Bill of Material content", ), ) obj.MinRightOffset = 6 if not hasattr(obj, "MinBottomOffset"): obj.addProperty( "App::PropertyLength", "MinBottomOffset", "BOMContent", QT_TRANSLATE_NOOP( "App::Property", "The minimum bottom offset of Bill of Material content", ), ) obj.MinBottomOffset = 6 if not hasattr(obj, "MaxWidth"): obj.addProperty( "App::PropertyLength", "MaxWidth", "BOMContent", QT_TRANSLATE_NOOP( "App::Property", "The maximum width of Bill of Material content", ), ) obj.MaxWidth = 190 if not hasattr(obj, "MaxHeight"): obj.addProperty( "App::PropertyLength", "MaxHeight", "BOMContent", QT_TRANSLATE_NOOP( "App::Property", "The maximum height of Bill of Material content", ), ) obj.MaxHeight = 250 if not hasattr(obj, "PrefColumnWidth"): obj.addProperty( "App::PropertyLength", "PrefColumnWidth", "BOMContent", QT_TRANSLATE_NOOP( "App::Property", "The preferred column width of table of Bill of Material " "content", ), ) obj.PrefColumnWidth = 30 if not hasattr(obj, "ColumnWidth"): obj.addProperty( "App::PropertyLength", "ColumnWidth", "BOMContent", QT_TRANSLATE_NOOP( "App::Property", "The column width of table of Bill of Material content", ), ) obj.ColumnWidth = 30 obj.setEditorMode("ColumnWidth", 2) if not hasattr(obj, "PrefRowHeight"): obj.addProperty( "App::PropertyLength", "PrefRowHeight", "BOMContent", QT_TRANSLATE_NOOP( "App::Property", "The preferred row height of table of Bill of Material " "content", ), ) obj.PrefRowHeight = 10 if not hasattr(obj, "RowHeight"): obj.addProperty( "App::PropertyLength", "RowHeight", "BOMContent", QT_TRANSLATE_NOOP( "App::Property", "The row height of table of Bill of Material content", ), ) obj.RowHeight = 10 obj.setEditorMode("RowHeight", 2)
def testQtTranslateNoop(self): refcnt = sys.getrefcount(self.txt) result = QT_TRANSLATE_NOOP(None, self.txt) self.assertEqual(result, self.txt) self.assertEqual(sys.getrefcount(result), refcnt + 1)
def setProperties(self, obj): """Add properties to RebarDimensioning object.""" self.Type = "ReinforcementDimensioning" if not hasattr(obj, "ParentDrawingView"): obj.addProperty( "App::PropertyLink", "ParentDrawingView", "ReinforcementDimensioning", QT_TRANSLATE_NOOP( "App::Property", "The parent ReinforcementDrawingView object", ), ) if not hasattr(obj, "Rebar"): obj.addProperty( "App::PropertyLink", "Rebar", "ReinforcementDimensioning", QT_TRANSLATE_NOOP( "App::Property", "The ArchRebar object to generate dimensioning", ), ) if not hasattr(obj, "WayPointsType"): obj.addProperty( "App::PropertyEnumeration", "WayPointsType", "ReinforcementDimensioning", QT_TRANSLATE_NOOP( "App::Property", "The way points type of dimension line", ), ).WayPointsType = ["Automatic", "Custom"] if not hasattr(obj, "WayPoints"): obj.addProperty( "App::PropertyVectorList", "WayPoints", "ReinforcementDimensioning", QT_TRANSLATE_NOOP( "App::Property", "The way points of dimension line", ), ) obj.WayPoints = [(0.00, 0.00, 0.00), (50.00, 0.00, 0.00)] if not hasattr(obj, "TextPositionType"): obj.addProperty( "App::PropertyEnumeration", "TextPositionType", "ReinforcementDimensioning", QT_TRANSLATE_NOOP( "App::Property", "The position type of dimension text", ), ).TextPositionType = [ "MidOfLine", "StartOfLine", "EndOfLine", ] if not hasattr(obj, "DimensionFormat"): obj.addProperty( "App::PropertyString", "DimensionFormat", "ReinforcementDimensioning", QT_TRANSLATE_NOOP( "App::Property", "The dimension label format", ), ) obj.DimensionFormat = DIMENSION_LABEL_FORMAT if not hasattr(obj, "Font"): obj.addProperty( "App::PropertyFont", "Font", "ReinforcementDimensioning", QT_TRANSLATE_NOOP( "App::Property", "The font family of dimension text", ), ) obj.Font = DIMENSION_FONT_FAMILY if not hasattr(obj, "FontSize"): obj.addProperty( "App::PropertyLength", "FontSize", "ReinforcementDimensioning", QT_TRANSLATE_NOOP( "App::Property", "The font size of dimension text", ), ) obj.FontSize = DIMENSION_FONT_SIZE if not hasattr(obj, "StrokeWidth"): obj.addProperty( "App::PropertyLength", "StrokeWidth", "ReinforcementDimensioning", QT_TRANSLATE_NOOP( "App::Property", "The stroke width of dimension line", ), ) obj.StrokeWidth = DIMENSION_STROKE_WIDTH if not hasattr(obj, "LineStyle"): obj.addProperty( "App::PropertyEnumeration", "LineStyle", "ReinforcementDimensioning", QT_TRANSLATE_NOOP( "App::Property", "The stroke style of dimension line", ), ).LineStyle = [ "Continuous", "Dash", "Dot", "DashDot", "DashDotDot", ] obj.LineStyle = DIMENSION_LINE_STYLE if not hasattr(obj, "LineColor"): obj.addProperty( "App::PropertyColor", "LineColor", "ReinforcementDimensioning", QT_TRANSLATE_NOOP( "App::Property", "The color of dimension line", ), ) obj.LineColor = DIMENSION_LINE_COLOR if not hasattr(obj, "TextColor"): obj.addProperty( "App::PropertyColor", "TextColor", "ReinforcementDimensioning", QT_TRANSLATE_NOOP( "App::Property", "The color of dimension text", ), ) obj.TextColor = DIMENSION_TEXT_COLOR if not hasattr(obj, "LineStartSymbol"): obj.addProperty( "App::PropertyEnumeration", "LineStartSymbol", "ReinforcementDimensioning", QT_TRANSLATE_NOOP( "App::Property", "The start symbol of dimension line", ), ).LineStartSymbol = [ "FilledArrow", "Tick", "Dot", "None", ] # TODO: Implement "Open Arrow", "Open Circle" and "Fork" obj.LineStartSymbol = DIMENSION_SINGLE_REBAR_LINE_START_SYMBOL if not hasattr(obj, "LineEndSymbol"): obj.addProperty( "App::PropertyEnumeration", "LineEndSymbol", "ReinforcementDimensioning", QT_TRANSLATE_NOOP( "App::Property", "The end symbol of dimension line", ), ).LineEndSymbol = [ "FilledArrow", "Tick", "Dot", "None", ] # TODO: Implement "Open Arrow", "Open Circle" and "Fork" obj.LineEndSymbol = DIMENSION_SINGLE_REBAR_LINE_END_SYMBOL if not hasattr(obj, "LineMidPointSymbol"): obj.addProperty( "App::PropertyEnumeration", "LineMidPointSymbol", "ReinforcementDimensioning", QT_TRANSLATE_NOOP( "App::Property", "The mid points symbol of dimension line", ), ).LineMidPointSymbol = [ "Tick", "Dot", "None", ] obj.LineMidPointSymbol = DIMENSION_LINE_MID_POINT_SYMBOL # TODO: Implement "Open Circle" and "Cross" if not hasattr(obj, "DimensionLeftOffset"): obj.addProperty( "App::PropertyLength", "DimensionLeftOffset", "AutomaticDimensioning", QT_TRANSLATE_NOOP( "App::Property", "The left offset for automated reinforcement dimensioning", ), ) if not hasattr(obj, "DimensionRightOffset"): obj.addProperty( "App::PropertyLength", "DimensionRightOffset", "AutomaticDimensioning", QT_TRANSLATE_NOOP( "App::Property", "The right offset for automated reinforcement " "dimensioning", ), ) if not hasattr(obj, "DimensionTopOffset"): obj.addProperty( "App::PropertyLength", "DimensionTopOffset", "AutomaticDimensioning", QT_TRANSLATE_NOOP( "App::Property", "The top offset for automated reinforcement dimensioning", ), ) if not hasattr(obj, "DimensionBottomOffset"): obj.addProperty( "App::PropertyLength", "DimensionBottomOffset", "AutomaticDimensioning", QT_TRANSLATE_NOOP( "App::Property", "The bottom offset for automated reinforcement " "dimensioning", ), ) if not hasattr(obj, "SingleRebar_LineStartSymbol"): obj.addProperty( "App::PropertyEnumeration", "SingleRebar_LineStartSymbol", "AutomaticDimensioning", QT_TRANSLATE_NOOP( "App::Property", "The dimension line start symbol, in case of single rebar " "is visible", ), ).SingleRebar_LineStartSymbol = [ "FilledArrow", "Tick", "Dot", "None", ] obj.SingleRebar_LineStartSymbol = ( DIMENSION_SINGLE_REBAR_LINE_START_SYMBOL ) if not hasattr(obj, "SingleRebar_LineEndSymbol"): obj.addProperty( "App::PropertyEnumeration", "SingleRebar_LineEndSymbol", "AutomaticDimensioning", QT_TRANSLATE_NOOP( "App::Property", "The dimension line end symbol, in case of single rebar is " "visible", ), ).SingleRebar_LineEndSymbol = [ "FilledArrow", "Tick", "Dot", "None", ] obj.SingleRebar_LineEndSymbol = ( DIMENSION_SINGLE_REBAR_LINE_END_SYMBOL ) if not hasattr(obj, "MultiRebar_LineStartSymbol"): obj.addProperty( "App::PropertyEnumeration", "MultiRebar_LineStartSymbol", "AutomaticDimensioning", QT_TRANSLATE_NOOP( "App::Property", "The dimension line start symbol, in case of multiple " "rebars are visible", ), ).MultiRebar_LineStartSymbol = [ "FilledArrow", "Tick", "Dot", "None", ] obj.MultiRebar_LineStartSymbol = ( DIMENSION_MULTI_REBAR_LINE_START_SYMBOL ) if not hasattr(obj, "MultiRebar_LineEndSymbol"): obj.addProperty( "App::PropertyEnumeration", "MultiRebar_LineEndSymbol", "AutomaticDimensioning", QT_TRANSLATE_NOOP( "App::Property", "The dimension line end symbol, in case of multiple rebars " "are visible", ), ).MultiRebar_LineEndSymbol = [ "FilledArrow", "Tick", "Dot", "None", ] obj.MultiRebar_LineEndSymbol = DIMENSION_MULTI_REBAR_LINE_END_SYMBOL if not hasattr(obj, "SingleRebar_OuterDimension"): obj.addProperty( "App::PropertyBool", "SingleRebar_OuterDimension", "AutomaticDimensioning", QT_TRANSLATE_NOOP( "App::Property", "True if dimension lines to be outside of reinforcement " "drawing for automated reinforcement dimensioning, " "in case of single rebar is visible", ), ) obj.SingleRebar_OuterDimension = DIMENSION_SINGLE_REBAR_OUTER_DIM if not hasattr(obj, "MultiRebar_OuterDimension"): obj.addProperty( "App::PropertyBool", "MultiRebar_OuterDimension", "AutomaticDimensioning", QT_TRANSLATE_NOOP( "App::Property", "True if dimension lines to be outside of reinforcement " "drawing for automated reinforcement dimensioning, " "in case of multiple rebars are visible", ), ) obj.MultiRebar_OuterDimension = DIMENSION_MULTI_REBAR_OUTER_DIM if not hasattr(obj, "SingleRebar_TextPositionType"): obj.addProperty( "App::PropertyEnumeration", "SingleRebar_TextPositionType", "AutomaticDimensioning", QT_TRANSLATE_NOOP( "App::Property", "The position type of dimension text, in case of single " "rebar is visible", ), ).SingleRebar_TextPositionType = [ "MidOfLine", "StartOfLine", "EndOfLine", ] obj.SingleRebar_TextPositionType = ( DIMENSION_SINGLE_REBAR_TEXT_POSITION_TYPE ) if not hasattr(obj, "MultiRebar_TextPositionType"): obj.addProperty( "App::PropertyEnumeration", "MultiRebar_TextPositionType", "AutomaticDimensioning", QT_TRANSLATE_NOOP( "App::Property", "The position type of dimension text, in case of multiple " "rebars are visible", ), ).MultiRebar_TextPositionType = [ "MidOfLine", "StartOfLine", "EndOfLine", ] obj.MultiRebar_TextPositionType = ( DIMENSION_MULTI_REBAR_TEXT_POSITION_TYPE )