Add a dialog with bug report information.

This commit is contained in:
Dan Albert 2022-10-15 13:07:55 -07:00
parent 575cbf659c
commit b63ecc59fb
6 changed files with 83 additions and 22 deletions

View File

@ -33,10 +33,10 @@ body:
options: options:
- 5.2.0 - 5.2.0
- Development build - Development build
- type: input - type: textarea
attributes: attributes:
label: Development build label: Build information
description: A link to the development build, if applicable. description: The build information from the Help -> Report an issue window.
- type: textarea - type: textarea
attributes: attributes:
label: Description label: Description

View File

@ -41,10 +41,10 @@ body:
options: options:
- 5.2.0 - 5.2.0
- Development build - Development build
- type: input - type: textarea
attributes: attributes:
label: Development build label: Build information
description: A link to the development build, if applicable. description: The build information from the Help -> Report an issue window.
- type: input - type: input
attributes: attributes:
label: Campaign name label: Campaign name

View File

@ -4,6 +4,7 @@ from pathlib import Path
MAJOR_VERSION = 6 MAJOR_VERSION = 6
MINOR_VERSION = 0 MINOR_VERSION = 0
MICRO_VERSION = 0 MICRO_VERSION = 0
VERSION_NUMBER = ".".join(str(v) for v in (MAJOR_VERSION, MINOR_VERSION, MICRO_VERSION))
def _optional_build_id_component(path: Path) -> str | None: def _optional_build_id_component(path: Path) -> str | None:
@ -17,9 +18,7 @@ GIT_SHA = _optional_build_id_component(Path("resources/gitsha"))
def _build_version_string() -> str: def _build_version_string() -> str:
components = [ components = [VERSION_NUMBER]
".".join(str(v) for v in (MAJOR_VERSION, MINOR_VERSION, MICRO_VERSION))
]
if BUILD_NUMBER is not None: if BUILD_NUMBER is not None:
components.append(BUILD_NUMBER) components.append(BUILD_NUMBER)
if GIT_SHA is not None: if GIT_SHA is not None:

View File

@ -5,13 +5,6 @@ from PySide2.QtGui import QPixmap
from .liberation_theme import get_theme_icons from .liberation_theme import get_theme_icons
URLS: Dict[str, str] = {
"Manual": "https://github.com/dcs-liberation/dcs_liberation/wiki",
"Repository": "https://github.com/dcs-liberation/dcs_liberation",
"ForumThread": "https://forums.eagle.ru/showthread.php?t=214834",
"Issues": "https://github.com/dcs-liberation/dcs_liberation/issues",
}
LABELS_OPTIONS = ["Full", "Abbreviated", "Dot Only", "Neutral Dot", "Off"] LABELS_OPTIONS = ["Full", "Abbreviated", "Dot Only", "Neutral Dot", "Off"]
SKILL_OPTIONS = ["Average", "Good", "High", "Excellent"] SKILL_OPTIONS = ["Average", "Good", "High", "Excellent"]

View File

@ -0,0 +1,58 @@
import webbrowser
from PySide2.QtCore import Qt
from PySide2.QtGui import QGuiApplication
from PySide2.QtWidgets import QDialog, QLabel, QPushButton, QVBoxLayout, QWidget
from game.version import BUILD_NUMBER, GIT_SHA, VERSION_NUMBER
class BugReportDialog(QDialog):
def __init__(self, parent: QWidget) -> None:
super().__init__(parent)
self.setWindowTitle("Report an issue")
self.setModal(True)
self.setMaximumWidth(600)
layout = QVBoxLayout()
self.setLayout(layout)
components = [f"DCS Liberation {VERSION_NUMBER}"]
if BUILD_NUMBER is not None:
components.append(f"Build {BUILD_NUMBER}")
if GIT_SHA is not None:
components.append(f"Git revision {GIT_SHA}")
self.report_data = "\n".join(components)
label = QLabel(
"Use the button below to file a bug. The version information will be "
"automatically copied to your clipboard. Paste that information into the "
"box in the bug template that asks for the version.<br />"
"<br />"
"<strong>Look for duplicate bugs before filing.</strong><br />"
"<br />"
"<strong>If the template asks for a save game, it is required. No matter "
"how easily reproducible the bug may appear, it rarely is. If it were "
"obvious you wouldn't be the first to find it.</strong><br />"
"<br />"
f"{'<br />'.join(components)}<br />"
)
label.setTextInteractionFlags(
Qt.TextSelectableByMouse
| Qt.LinksAccessibleByMouse
| Qt.LinksAccessibleByKeyboard
)
label.setWordWrap(True)
label.setOpenExternalLinks(True)
layout.addWidget(label)
copy_button = QPushButton("Copy details to clipboard and go to bug page")
copy_button.clicked.connect(self.on_file_bug)
layout.addWidget(copy_button)
def on_file_bug(self) -> None:
QGuiApplication.clipboard().setText(self.report_data)
webbrowser.open_new_tab(
"https://github.com/dcs-liberation/dcs_liberation/issues/new/choose"
)

View File

@ -29,11 +29,11 @@ from qt_ui import liberation_install
from qt_ui.dialogs import Dialog from qt_ui.dialogs import Dialog
from qt_ui.models import GameModel from qt_ui.models import GameModel
from qt_ui.simcontroller import SimController from qt_ui.simcontroller import SimController
from qt_ui.uiconstants import URLS
from qt_ui.uncaughtexceptionhandler import UncaughtExceptionHandler from qt_ui.uncaughtexceptionhandler import UncaughtExceptionHandler
from qt_ui.widgets.QTopPanel import QTopPanel from qt_ui.widgets.QTopPanel import QTopPanel
from qt_ui.widgets.ato import QAirTaskingOrderPanel from qt_ui.widgets.ato import QAirTaskingOrderPanel
from qt_ui.widgets.map.QLiberationMap import QLiberationMap from qt_ui.widgets.map.QLiberationMap import QLiberationMap
from qt_ui.windows.BugReportDialog import BugReportDialog
from qt_ui.windows.GameUpdateSignal import GameUpdateSignal from qt_ui.windows.GameUpdateSignal import GameUpdateSignal
from qt_ui.windows.QDebriefingWindow import QDebriefingWindow from qt_ui.windows.QDebriefingWindow import QDebriefingWindow
from qt_ui.windows.basemenu.QBaseMenu2 import QBaseMenu2 from qt_ui.windows.basemenu.QBaseMenu2 import QBaseMenu2
@ -193,6 +193,9 @@ class QLiberationWindow(QMainWindow):
lambda: webbrowser.open_new_tab("https://shdwp.github.io/ukraine/") lambda: webbrowser.open_new_tab("https://shdwp.github.io/ukraine/")
) )
self.bug_report_action = QAction("Report an &issue", self)
self.bug_report_action.triggered.connect(self.show_bug_report_dialog)
self.openLogsAction = QAction("Show &logs", self) self.openLogsAction = QAction("Show &logs", self)
self.openLogsAction.triggered.connect(self.showLogsDialog) self.openLogsAction.triggered.connect(self.showLogsDialog)
@ -268,14 +271,18 @@ class QLiberationWindow(QMainWindow):
), ),
) )
help_menu.addAction( help_menu.addAction(
"&Online Manual", lambda: webbrowser.open_new_tab(URLS["Manual"]) "&Online Manual",
lambda: webbrowser.open_new_tab(
"https://github.com/dcs-liberation/dcs_liberation/wiki"
),
) )
help_menu.addAction( help_menu.addAction(
"&ED Forum Thread", lambda: webbrowser.open_new_tab(URLS["ForumThread"]) "&ED Forum Thread",
) lambda: webbrowser.open_new_tab(
help_menu.addAction( "https://forums.eagle.ru/showthread.php?t=214834"
"Report an &issue", lambda: webbrowser.open_new_tab(URLS["Issues"]) ),
) )
help_menu.addAction(self.bug_report_action)
help_menu.addAction(self.openLogsAction) help_menu.addAction(self.openLogsAction)
help_menu.addSeparator() help_menu.addSeparator()
@ -483,6 +490,10 @@ class QLiberationWindow(QMainWindow):
def import_templates(self): def import_templates(self):
LAYOUTS.import_templates() LAYOUTS.import_templates()
def show_bug_report_dialog(self) -> None:
self.dialog = BugReportDialog(self)
self.dialog.show()
def showLogsDialog(self): def showLogsDialog(self):
self.dialog = QLogsWindow() self.dialog = QLogsWindow()
self.dialog.show() self.dialog.show()