|
26 | 26 | # Modules used for overriding AllSettingsWindow |
27 | 27 | import logging |
28 | 28 |
|
29 | | -PLUGIN_MANAGER_VERSION = "1.1.6" |
| 29 | +PLUGIN_MANAGER_VERSION = "1.1.7" |
30 | 30 | REPOSITORY_URL = "https://github.com/bombsquad-community/plugin-manager" |
31 | 31 | # Current tag can be changed to "staging" or any other branch in |
32 | 32 | # plugin manager repo for testing purpose. |
|
35 | 35 | _env = babase.env() |
36 | 36 | _app_api_version = babase.app.env.api_version |
37 | 37 |
|
38 | | -PLUGIN_ISSUE_TEMPLATE = "plugin-bug-report.md" |
39 | | -GITHUB_ISSUE_META = "{repository_url}/issues/new?template={issue_template}" |
| 38 | +PLUGIN_ISSUE_TEMPLATE = "plugin-bug-report.yml" |
| 39 | +GITHUB_PLUGIN_ISSUE_META = "{repository_url}/issues/new?template={issue_template}" |
40 | 40 | INDEX_META = "{repository_url}/{content_type}/{tag}/index.json" |
41 | 41 | CHANGELOG_META = "{repository_url}/{content_type}/{tag}/CHANGELOG.md" |
42 | 42 | HEADERS = { |
@@ -1798,8 +1798,10 @@ async def update(self): |
1798 | 1798 |
|
1799 | 1799 |
|
1800 | 1800 | class MoreWindow: |
1801 | | - def __init__(self, plugin, origin=None): |
| 1801 | + def __init__(self, plugin: Plugin, origin=None): |
1802 | 1802 | _add_popup(self) |
| 1803 | + |
| 1804 | + self.plugin = plugin |
1803 | 1805 | # collect info |
1804 | 1806 | last_updated = None |
1805 | 1807 | for value in plugin.info['versions'].values(): |
@@ -1912,13 +1914,7 @@ def __init__(self, plugin, origin=None): |
1912 | 1914 | button_type='square', |
1913 | 1915 | color=(0.6, 0.53, 0.63), |
1914 | 1916 | label='', |
1915 | | - on_activate_call=bui.CallPartial( |
1916 | | - bui.open_url, |
1917 | | - GITHUB_ISSUE_META.format( |
1918 | | - repository_url=REPOSITORY_URL, |
1919 | | - issue_template=PLUGIN_ISSUE_TEMPLATE |
1920 | | - ) |
1921 | | - ) |
| 1917 | + on_activate_call=self._open_bug_report_url |
1922 | 1918 | ) |
1923 | 1919 | bui.imagewidget( |
1924 | 1920 | parent=self._root_widget, |
@@ -1985,6 +1981,36 @@ def __init__(self, plugin, origin=None): |
1985 | 1981 | down_widget=source_button |
1986 | 1982 | ) |
1987 | 1983 |
|
| 1984 | + def _open_bug_report_url(self): |
| 1985 | + import platform |
| 1986 | + import urllib.parse |
| 1987 | + import baenv |
| 1988 | + |
| 1989 | + LOGS_LENGTH_LIMIT = 5000 |
| 1990 | + _logs = "" |
| 1991 | + for entry in baenv._EnvGlobals.get().config.log_handler.get_cached().entries: |
| 1992 | + _logs += entry.message + "\n" |
| 1993 | + |
| 1994 | + # reduce this more if it's too long |
| 1995 | + error_logs = f"""```py |
| 1996 | +{_logs[:LOGS_LENGTH_LIMIT]} |
| 1997 | +```""" |
| 1998 | + |
| 1999 | + params = { |
| 2000 | + "title": "[PLUGIN BUG]: " + self.plugin.name, |
| 2001 | + "plugin-name": self.plugin.name, |
| 2002 | + "plugin-version": self.plugin.create_local().version if self.plugin.is_installed else 'Not Installed', |
| 2003 | + "plugin-manager-version": 'v' + PLUGIN_MANAGER_VERSION, |
| 2004 | + "bombsquad-version": 'v' + babase.app.env.engine_version + " (" + str(babase.app.env.engine_build_number) + ")", |
| 2005 | + "os-version": platform.platform() if platform else babase.app.env.platform.value + babase.app.env.os_version, |
| 2006 | + "console-log": error_logs |
| 2007 | + } |
| 2008 | + query_string = urllib.parse.urlencode(params, quote_via=urllib.parse.quote) |
| 2009 | + base_url = GITHUB_PLUGIN_ISSUE_META.format( |
| 2010 | + repository_url=REPOSITORY_URL, issue_template=PLUGIN_ISSUE_TEMPLATE) |
| 2011 | + final_url = f"{base_url}&{query_string}" |
| 2012 | + bui.open_url(final_url) |
| 2013 | + |
1988 | 2014 | def _back(self) -> None: |
1989 | 2015 | _remove_popup(self) |
1990 | 2016 | bui.getsound('swish').play() |
|
0 commit comments