mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-09 13:52:23 +00:00
fixes #4780: added preference for default location for schedule's css.
Also added a `border` class to style the schedule's border with css. That is `fill`, `stroke-width`, and `stroke` are no longer hard-coded.
This commit is contained in:
@@ -364,6 +364,9 @@ class DocProperties(PropertyGroup):
|
|||||||
stylesheet_path: StringProperty(
|
stylesheet_path: StringProperty(
|
||||||
default=os.path.join("drawings", "assets", "default.css"), name="Default Stylesheet"
|
default=os.path.join("drawings", "assets", "default.css"), name="Default Stylesheet"
|
||||||
)
|
)
|
||||||
|
schedules_stylesheet_path: StringProperty(
|
||||||
|
default=os.path.join("drawings", "assets", "schedule.css"), name="Default Stylesheet for Schedules"
|
||||||
|
)
|
||||||
markers_path: StringProperty(default=os.path.join("drawings", "assets", "markers.svg"), name="Default Markers")
|
markers_path: StringProperty(default=os.path.join("drawings", "assets", "markers.svg"), name="Default Markers")
|
||||||
symbols_path: StringProperty(default=os.path.join("drawings", "assets", "symbols.svg"), name="Default Symbols")
|
symbols_path: StringProperty(default=os.path.join("drawings", "assets", "symbols.svg"), name="Default Symbols")
|
||||||
patterns_path: StringProperty(default=os.path.join("drawings", "assets", "patterns.svg"), name="Default Patterns")
|
patterns_path: StringProperty(default=os.path.join("drawings", "assets", "patterns.svg"), name="Default Patterns")
|
||||||
|
|||||||
@@ -69,10 +69,16 @@ class Scheduler:
|
|||||||
elif infile.endswith("xlsx"):
|
elif infile.endswith("xlsx"):
|
||||||
self.schedule_xlsx(infile, outfile)
|
self.schedule_xlsx(infile, outfile)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def parse_css(self, infile):
|
def parse_css(self, infile):
|
||||||
stylesheet_path = os.path.splitext(infile)[0] + ".css"
|
stylesheet_path = os.path.splitext(infile)[0] + ".css"
|
||||||
if not os.path.exists(stylesheet_path):
|
if not os.path.exists(stylesheet_path):
|
||||||
stylesheet_path = os.path.join(bpy.context.scene.BIMProperties.data_dir, "assets", "schedule.css")
|
stylesheet_rel_path = getattr(bpy.context.scene.DocProperties, "schedules_stylesheet_path")
|
||||||
|
infile_directory = os.path.dirname(infile)
|
||||||
|
stylesheet_path = infile_directory + "\\" + stylesheet_rel_path
|
||||||
|
if not os.path.exists(stylesheet_path):
|
||||||
|
stylesheet_path = os.path.join(bpy.context.scene.BIMProperties.data_dir, "assets", "schedule.css")
|
||||||
with open(stylesheet_path, "r") as stylesheet:
|
with open(stylesheet_path, "r") as stylesheet:
|
||||||
css = stylesheet.read()
|
css = stylesheet.read()
|
||||||
|
|
||||||
@@ -153,7 +159,7 @@ class Scheduler:
|
|||||||
self.svg.rect(
|
self.svg.rect(
|
||||||
insert=(x, y),
|
insert=(x, y),
|
||||||
size=(width, height),
|
size=(width, height),
|
||||||
style=f"fill: {background_color}; stroke-width:.125; stroke: #000000;",
|
class_="border",
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -429,7 +435,7 @@ class Scheduler:
|
|||||||
self.svg.rect(
|
self.svg.rect(
|
||||||
insert=(x, y),
|
insert=(x, y),
|
||||||
size=(width, height),
|
size=(width, height),
|
||||||
style=f"fill: {background_color}; stroke-width:.125; stroke: #000000;",
|
class_="border",
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -358,6 +358,8 @@ class BIM_ADDON_preferences(bpy.types.AddonPreferences):
|
|||||||
row = self.layout.row()
|
row = self.layout.row()
|
||||||
row.prop(context.scene.DocProperties, "stylesheet_path")
|
row.prop(context.scene.DocProperties, "stylesheet_path")
|
||||||
row = self.layout.row()
|
row = self.layout.row()
|
||||||
|
row.prop(context.scene.DocProperties, "schedules_stylesheet_path")
|
||||||
|
row = self.layout.row()
|
||||||
row.prop(context.scene.DocProperties, "markers_path")
|
row.prop(context.scene.DocProperties, "markers_path")
|
||||||
row = self.layout.row()
|
row = self.layout.row()
|
||||||
row.prop(context.scene.DocProperties, "symbols_path")
|
row.prop(context.scene.DocProperties, "symbols_path")
|
||||||
|
|||||||
Reference in New Issue
Block a user