[Bf-blender-cvs] [60c0c47] master: Save sys-info to file instead of a text block
Campbell Barton
noreply at git.blender.org
Wed Jan 6 14:31:47 CET 2016
Commit: 60c0c47dba97ef2bdbc4bdb6e936da0297a0c1f9
Author: Campbell Barton
Date: Thu Jan 7 00:18:40 2016 +1100
Branches: master
https://developer.blender.org/rB60c0c47dba97ef2bdbc4bdb6e936da0297a0c1f9
Save sys-info to file instead of a text block
The main reason for this change is this file is typically used when making bug reports,
its best if users attach this file to reports directly.
===================================================================
M release/scripts/modules/sys_info.py
M release/scripts/startup/bl_operators/wm.py
===================================================================
diff --git a/release/scripts/modules/sys_info.py b/release/scripts/modules/sys_info.py
index 1b5de95..c4b2d9f 100644
--- a/release/scripts/modules/sys_info.py
+++ b/release/scripts/modules/sys_info.py
@@ -21,7 +21,7 @@
# classes for extracting info from blenders internal classes
-def write_sysinfo(op):
+def write_sysinfo(filepath):
import sys
import textwrap
@@ -30,14 +30,6 @@ def write_sysinfo(op):
import bpy
import bgl
- output_filename = "system-info.txt"
-
- output = bpy.data.texts.get(output_filename)
- if output:
- output.clear()
- else:
- output = bpy.data.texts.new(name=output_filename)
-
# pretty repr
def prepr(v):
r = repr(v)
@@ -49,6 +41,8 @@ def write_sysinfo(op):
return r
+ output = open(filepath, 'w', encoding="utf-8")
+
header = "= Blender %s System Information =\n" % bpy.app.version_string
lilies = "%s\n\n" % ((len(header) - 1) * "=")
output.write(lilies[:-1])
@@ -204,6 +198,5 @@ def write_sysinfo(op):
output.write(title("Cycles"))
output.write(cycles.engine.system_info())
- output.current_line_index = 0
+ output.close()
- op.report({'INFO'}, "System information generated in 'system-info.txt'")
diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py
index 1ebe726..b9dc691 100644
--- a/release/scripts/startup/bl_operators/wm.py
+++ b/release/scripts/startup/bl_operators/wm.py
@@ -1388,16 +1388,32 @@ class WM_OT_appconfig_activate(Operator):
class WM_OT_sysinfo(Operator):
- """Generate system info text, accessible from Blender's internal text editor"""
+ """Generate system information, saved into a text file"""
bl_idname = "wm.sysinfo"
- bl_label = "System Info"
+ bl_label = "Save System Info"
+
+ filepath = StringProperty(
+ subtype='FILE_PATH',
+ options={'SKIP_SAVE'},
+ )
def execute(self, context):
import sys_info
- sys_info.write_sysinfo(self)
+ sys_info.write_sysinfo(self.filepath)
return {'FINISHED'}
+ def invoke(self, context, event):
+ import os
+
+ if not self.filepath:
+ self.filepath = os.path.join(
+ os.path.expanduser("~"), "system-info.txt")
+
+ wm = context.window_manager
+ wm.fileselect_add(self)
+ return {'RUNNING_MODAL'}
+
class WM_OT_copy_prev_settings(Operator):
"""Copy settings from previous version"""
More information about the Bf-blender-cvs
mailing list