mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 09:21:46 +00:00
system info copied when clicking in Bonsai Version (#6660)
This commit is contained in:
@@ -123,6 +123,7 @@ classes = [
|
||||
operator.SelectURIAttribute,
|
||||
operator.SetTab,
|
||||
operator.SwitchTab,
|
||||
operator.Show_system_info,
|
||||
prop.StrProperty,
|
||||
operator.BIM_OT_enum_property_search, # /!\ Register AFTER prop.StrProperty
|
||||
prop.ObjProperty,
|
||||
|
||||
@@ -1286,3 +1286,33 @@ class CopyTextToClipboard(bpy.types.Operator):
|
||||
def execute(self, context):
|
||||
context.window_manager.clipboard = self.text
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
class Show_system_info(bpy.types.Operator):
|
||||
bl_idname = "bim.show_system_info"
|
||||
bl_label = "System Info"
|
||||
bl_options = {"REGISTER", "UNDO"}
|
||||
|
||||
info_text: bpy.props.StringProperty()
|
||||
|
||||
def execute(self, context):
|
||||
context.window_manager.clipboard = self.info_text
|
||||
self.report({"INFO"}, "System information copied to clipboard.")
|
||||
return {"FINISHED"}
|
||||
|
||||
def invoke(self, context, event):
|
||||
# Invoke the bim.copy_debug_information operator to get the info to the clipboard
|
||||
bpy.ops.bim.copy_debug_information()
|
||||
self.info_text = context.window_manager.clipboard
|
||||
|
||||
return context.window_manager.invoke_popup(self, width=600)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
col = layout.column()
|
||||
|
||||
for line in self.info_text.split("\n"):
|
||||
col.label(text=line)
|
||||
|
||||
col.separator()
|
||||
col.label(text="(The information has been copied to the clipboard.)")
|
||||
|
||||
@@ -1182,8 +1182,10 @@ class UIData:
|
||||
def draw_statusbar(self, context):
|
||||
if not UIData.is_loaded:
|
||||
UIData.load()
|
||||
text = f"Bonsai v{UIData.data['version']}"
|
||||
self.layout.label(text=text)
|
||||
bonsai_version = f"Bonsai v{UIData.data['version']}"
|
||||
layout = self.layout
|
||||
row = layout.row()
|
||||
row.operator("bim.show_system_info", text=bonsai_version, emboss=False)
|
||||
|
||||
|
||||
def draw_custom_context_menu(self: bpy.types.Menu, context: bpy.types.Context) -> None:
|
||||
|
||||
Reference in New Issue
Block a user