add button to drawings panel to open documentation web ui page

might need a different icon since the URL icon is used by the open_drawing button
This commit is contained in:
Ziad-I
2024-08-25 21:38:15 +03:00
parent f26f6dfe5e
commit 47a15011f6
3 changed files with 17 additions and 0 deletions
@@ -88,6 +88,7 @@ classes = (
operator.SelectAllDrawings,
operator.SelectAssignedProduct,
operator.SelectDocIfcFile,
operator.OpenDocumentationWebUi,
prop.Variable,
prop.Drawing,
prop.Document,
@@ -2857,3 +2857,16 @@ class ConvertSVGToDXF(bpy.types.Operator):
self.report({"INFO"}, f"{len(drawing_uris)} drawings were converted to .dxf.")
return {"FINISHED"}
class OpenDocumentationWebUi(bpy.types.Operator):
bl_idname = "bim.open_documentation_web_ui"
bl_label = "Open Documentation Web UI"
bl_description = "Open the documentation web UI page"
def execute(self, context):
if not context.scene.WebProperties.is_connected:
bpy.ops.bim.connect_websocket_server(page="documentation")
else:
bpy.ops.bim.bim.open_web_browser(page="documentation")
return {"FINISHED"}
@@ -289,6 +289,9 @@ class BIM_PT_drawings(Panel):
create_drawing_button = row.row(align=True)
create_drawing_button.operator("bim.create_drawing", text="", icon="OUTPUT")
create_drawing_button.enabled = active_drawing.ifc_definition_id > 0
# might need a different icon since the URL icon is already used by the open_drawing
row.operator("bim.open_documentation_web_ui", icon="URL", text="")
self.layout.template_list(
"BIM_UL_drawinglist", "", self.props, "drawings", self.props, "active_drawing_index"
)