diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-03-13 15:02:51 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-03-13 15:20:48 +0300 |
commit | d555f6a4abc50ab7fbf5ecd9d85965aeef0f4335 (patch) | |
tree | b664ed422d0aa858d143a2829935f1d2911f6b02 /release | |
parent | 3afc77655e94aea3ba56ca71cee2f89ec640dc2b (diff) |
WM: pre-fill bug-reports
D4507 by @LazyDodo w/ edits & moved into own module.
Diffstat (limited to 'release')
-rw-r--r-- | release/scripts/modules/bl_ui_utils/__init__.py | 0 | ||||
-rw-r--r-- | release/scripts/modules/bl_ui_utils/bug_report_url.py | 76 | ||||
-rw-r--r-- | release/scripts/startup/bl_ui/space_topbar.py | 6 |
3 files changed, 81 insertions, 1 deletions
diff --git a/release/scripts/modules/bl_ui_utils/__init__.py b/release/scripts/modules/bl_ui_utils/__init__.py new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/release/scripts/modules/bl_ui_utils/__init__.py diff --git a/release/scripts/modules/bl_ui_utils/bug_report_url.py b/release/scripts/modules/bl_ui_utils/bug_report_url.py new file mode 100644 index 00000000000..510ea5d7e57 --- /dev/null +++ b/release/scripts/modules/bl_ui_utils/bug_report_url.py @@ -0,0 +1,76 @@ +# ##### BEGIN GPL LICENSE BLOCK ##### +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# ##### END GPL LICENSE BLOCK ##### + +# <pep8-80 compliant> + +def url_prefill_from_blender(): + import bpy + import bgl + import struct + import platform + import urllib.parse + import io + + fh = io.StringIO() + + fh.write("**System Information**\n") + fh.write( + "Operating system: {!s} {!s} Bits\n".format( + platform.platform(), + struct.calcsize("P") * 8, + ) + ) + fh.write( + "Graphics card: {!s} {!s} {!s}\n".format( + bgl.glGetString(bgl.GL_RENDERER), + bgl.glGetString(bgl.GL_VENDOR), + bgl.glGetString(bgl.GL_VERSION), + ) + ) + fh.write( + "\n" + "\n**Blender Version**\n" + ) + fh.write( + "Broken: version: {!s}, branch: {!s}, commit date: {!s} {!s}, hash: `rB{!s}`\n".format( + bpy.app.version_string, + bpy.app.build_branch.decode('utf-8', 'replace'), + bpy.app.build_commit_date.decode('utf-8', 'replace'), + bpy.app.build_commit_time.decode('utf-8', 'replace'), + bpy.app.build_hash.decode('ascii'), + ) + ) + fh.write( + "Worked: (optional)\n" + "\n" + "\n" + "**Short description of error**\n" + "[Please fill out a short description of the error here]\n" + "\n" + "**Exact steps for others to reproduce the error**\n" + "[Please describe the exact steps needed to reproduce the issue]\n" + "[Based on the default startup or an attached .blend file (as simple as possible)]\n" + "\n" + ) + + fh.seek(0) + + return ( + "https://developer.blender.org/maniphest/task/edit/form/1?description=" + + urllib.parse.quote(fh.read()) + ) diff --git a/release/scripts/startup/bl_ui/space_topbar.py b/release/scripts/startup/bl_ui/space_topbar.py index 1414278b159..48922911507 100644 --- a/release/scripts/startup/bl_ui/space_topbar.py +++ b/release/scripts/startup/bl_ui/space_topbar.py @@ -868,6 +868,10 @@ class TOPBAR_MT_help(Menu): bl_label = "Help" def draw(self, context): + # If 'url_prefill_from_blender' becomes slow it could be made into a separate operator + # to avoid constructing the bug report just to show this menu. + from bl_ui_utils.bug_report_url import url_prefill_from_blender + layout = self.layout show_developer = context.preferences.view.show_developer_ui @@ -878,7 +882,7 @@ class TOPBAR_MT_help(Menu): layout.operator( "wm.url_open", text="Report a Bug", icon='URL', - ).url = "https://developer.blender.org/maniphest/task/edit/form/1" + ).url = url_prefill_from_blender() layout.separator() |