system info copied when clicking in Bonsai Version (#6660)

This commit is contained in:
falken10vdl
2025-05-09 23:09:37 +02:00
committed by GitHub
parent f5e41d18c6
commit 809a20dc99
3 changed files with 35 additions and 2 deletions
+1
View File
@@ -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,
+30
View File
@@ -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.)")
+4 -2
View File
@@ -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: