Skip to content

Commit

Permalink
Add a preference for particular app to open sheet layout
Browse files Browse the repository at this point in the history
  • Loading branch information
theoryshaw committed Oct 16, 2023
1 parent c48c1c3 commit 6e96394
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/blenderbim/blenderbim/bim/ui.py
Expand Up @@ -132,6 +132,7 @@ class BIM_ADDON_preferences(bpy.types.AddonPreferences):
description='E.g. [["inkscape", "svg", "-o", "eps"], ["pstoedit", "-dt", "-f", "dxf:-polyaslines -mm", "eps", "dxf", "-psarg", "-dNOSAFER"]]',
)
svg_command: StringProperty(name="SVG Command", description='E.g. [["firefox", "path"]]')
layout_svg_command: StringProperty(name="Layout SVG Command", description='E.g. [["firefox", "path"]]')
pdf_command: StringProperty(name="PDF Command", description='E.g. [["firefox", "path"]]')
spreadsheet_command: StringProperty(name="Spreadsheet Command", description='E.g. [["libreoffice", "path"]]')
openlca_port: IntProperty(name="OpenLCA IPC Port", default=8080)
Expand Down Expand Up @@ -205,6 +206,8 @@ def draw(self, context):
row = layout.row()
row.prop(self, "svg_command")
row = layout.row()
row.prop(self, "layout_svg_command")
row = layout.row()
row.prop(self, "pdf_command")
row = layout.row()
row.prop(self, "spreadsheet_command")
Expand Down
2 changes: 1 addition & 1 deletion src/blenderbim/blenderbim/core/drawing.py
Expand Up @@ -90,7 +90,7 @@ def add_sheet(ifc, drawing, titleblock=None):


def open_sheet(drawing, sheet=None):
drawing.open_svg(drawing.get_document_uri(sheet, "LAYOUT"))
drawing.open_layout_svg(drawing.get_document_uri(sheet, "LAYOUT"))


def remove_sheet(ifc, drawing, sheet=None):
Expand Down
4 changes: 4 additions & 0 deletions src/blenderbim/blenderbim/tool/drawing.py
Expand Up @@ -848,6 +848,10 @@ def open_spreadsheet(cls, uri):
def open_svg(cls, uri):
cls.open_with_user_command(bpy.context.preferences.addons["blenderbim"].preferences.svg_command, uri)

@classmethod
def open_layout_svg(cls, uri):
cls.open_with_user_command(bpy.context.preferences.addons["blenderbim"].preferences.layout_svg_command, uri)

@classmethod
def run_root_assign_class(
cls,
Expand Down

2 comments on commit 6e96394

@theoryshaw
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry, this was meant to be a PR. Thought i'd figured out the whole PR thing.. apparently not, yet.

This commit proposes a preference for setting the app that opens sheet layouts.

Reason being, for drawings and sheets I use the browser to view, as it's quick to open.

But for layouts, I'd like something like Inkscape to open the file, as typically you're modifying the svg.

@Moult
Copy link
Contributor

@Moult Moult commented on 6e96394 Oct 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes sense :)

Please sign in to comment.