From 377454b683e686d12c981b2c648529e84944053e Mon Sep 17 00:00:00 2001 From: Dominik Demuth Date: Mon, 28 Nov 2022 20:37:06 +0100 Subject: [PATCH] menu item for easier bug reports; renaming of plot to graph; fixes T237; fixes T241; --- src/gui_qt/_py/basewindow.py | 8 ++++++-- src/gui_qt/main/mainwindow.py | 5 +++++ src/nmreval/configs.py | 4 +++- src/nmreval/lib/utils.py | 20 ++++++++++++++++++++ src/resources/_ui/basewindow.ui | 10 ++++++++-- 5 files changed, 42 insertions(+), 5 deletions(-) diff --git a/src/gui_qt/_py/basewindow.py b/src/gui_qt/_py/basewindow.py index 9574c57..beaee0b 100644 --- a/src/gui_qt/_py/basewindow.py +++ b/src/gui_qt/_py/basewindow.py @@ -368,6 +368,8 @@ class Ui_BaseWindow(object): self.actionMine.setObjectName("actionMine") self.action_draw_object = QtWidgets.QAction(BaseWindow) self.action_draw_object.setObjectName("action_draw_object") + self.actionBugs = QtWidgets.QAction(BaseWindow) + self.actionBugs.setObjectName("actionBugs") self.menuSave.addAction(self.actionSave) self.menuSave.addAction(self.actionExportGraphic) self.menuSave.addAction(self.action_save_fit_parameter) @@ -394,6 +396,7 @@ class Ui_BaseWindow(object): self.menuData.addAction(self.actionChange_datatypes) self.menuHelp.addAction(self.actionDocumentation) self.menuHelp.addAction(self.actionUpdate) + self.menuHelp.addAction(self.actionBugs) self.menuNormalize.addAction(self.action_norm_max) self.menuNormalize.addAction(self.action_norm_max_abs) self.menuNormalize.addSeparator() @@ -576,8 +579,8 @@ class Ui_BaseWindow(object): self.actionMaximize.setText(_translate("BaseWindow", "Maximize")) self.actionTile.setText(_translate("BaseWindow", "Tile windows")) self.actionMinimize.setText(_translate("BaseWindow", "Minimize")) - self.actionNew_window.setText(_translate("BaseWindow", "New plot")) - self.actionDelete_window.setText(_translate("BaseWindow", "Delete plot")) + self.actionNew_window.setText(_translate("BaseWindow", "New graph")) + self.actionDelete_window.setText(_translate("BaseWindow", "Delete graph")) self.actionCascade_windows.setText(_translate("BaseWindow", "Cascade windows")) self.actionNext_window.setText(_translate("BaseWindow", "Next")) self.actionNext_window.setShortcut(_translate("BaseWindow", "Alt+Right")) @@ -619,6 +622,7 @@ class Ui_BaseWindow(object): self.actionUpdate.setText(_translate("BaseWindow", "Look for updates")) self.actionMine.setText(_translate("BaseWindow", "Mine")) self.action_draw_object.setText(_translate("BaseWindow", "Draw objects...")) + self.actionBugs.setText(_translate("BaseWindow", "Bugs! Problems! Wishes!")) from ..data.datawidget.datawidget import DataWidget from ..data.integral_widget import IntegralWidget from ..data.point_select import PointSelectWidget diff --git a/src/gui_qt/main/mainwindow.py b/src/gui_qt/main/mainwindow.py index e8b58a2..8f6334e 100644 --- a/src/gui_qt/main/mainwindow.py +++ b/src/gui_qt/main/mainwindow.py @@ -8,6 +8,7 @@ from numpy import geomspace, linspace from pyqtgraph import ViewBox, PlotDataItem from nmreval.configs import * +from nmreval.lib.utils import open_bug_report from .management import UpperManagement from ..Qt import QtCore, QtGui, QtPrintSupport, QtWidgets @@ -994,3 +995,7 @@ class NMRMainWindow(QtWidgets.QMainWindow, Ui_BaseWindow): def read_state(self): opts = read_state() self.path = pathlib.Path(opts.get('recent_path', Path.home())) + + @QtCore.pyqtSlot(name='on_actionBugs_triggered') + def report_bug(self): + open_bug_report() diff --git a/src/nmreval/configs.py b/src/nmreval/configs.py index ae86ed5..408f171 100644 --- a/src/nmreval/configs.py +++ b/src/nmreval/configs.py @@ -75,8 +75,10 @@ allowed_values = { def write_state(opts: dict): config_file = config_paths() / 'guistate.ini' + old_opts = read_state() + old_opts.update(opts) with config_file.open('wb') as f: - pickle.dump(opts, f) + pickle.dump(old_opts, f) def read_state() -> dict: diff --git a/src/nmreval/lib/utils.py b/src/nmreval/lib/utils.py index 0f90963..38c941e 100644 --- a/src/nmreval/lib/utils.py +++ b/src/nmreval/lib/utils.py @@ -16,3 +16,23 @@ def valid_function(expr: str, extra_namespace: dict = None): return ne.evaluate(expr, {}, local), True except: return None, False + + +def open_bug_report(): + form_entries = { + 'description': 'Please state the nature of the medical emergency.', + 'title': 'Everything is awesome?', + 'assign[0]': 'dominik', + 'subscribers[0]': 'dominik', + 'tag': 'nmreval', + 'priority': 'normal', + 'status': 'open', + } + full_url = 'https://chaos3.fkp.physik.tu-darmstadt.de/maniphest/task/edit/?' + + for k, v in form_entries.items(): + full_url += f'{k}={v}&' + full_url.replace(' ', '+') + + import webbrowser + webbrowser.open(full_url) diff --git a/src/resources/_ui/basewindow.ui b/src/resources/_ui/basewindow.ui index 12ea544..39a4059 100644 --- a/src/resources/_ui/basewindow.ui +++ b/src/resources/_ui/basewindow.ui @@ -191,6 +191,7 @@ + @@ -774,7 +775,7 @@ - New plot + New graph @@ -783,7 +784,7 @@ ../../../../../.designer/backup../../../../../.designer/backup - Delete plot + Delete graph @@ -1016,6 +1017,11 @@ Draw objects... + + + Bugs! Problems! Wishes! + +