From ca6b63fea8712f3be33e08c503bb9d3ec7fc8fcd Mon Sep 17 00:00:00 2001 From: KatKatKateryna Date: Fri, 29 Sep 2023 19:50:24 +0100 Subject: [PATCH] cancel and logo metrics; error-proof report btn --- qt_ui/LogWidget.py | 17 +++++++++++------ qt_ui/dockwidget_main.py | 4 ++++ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/qt_ui/LogWidget.py b/qt_ui/LogWidget.py index 337c4e8..4b0c28f 100644 --- a/qt_ui/LogWidget.py +++ b/qt_ui/LogWidget.py @@ -61,7 +61,6 @@ class LogWidget(QWidget): button = QPushButton(f"👌 Error") # to '{streamName}' Sent , v #button.setStyleSheet("QPushButton {color: black; border: 0px;border-radius: 17px;padding: 20px;height: 40px;text-align: left;"+ f"{BACKGR_COLOR_GREY}" + "}") button.clicked.connect(lambda: self.btnClicked()) - #button.clicked.connect(lambda: self.hide()) self.btns.append(button) # overriding the mouseReleaseEvent method @@ -124,11 +123,12 @@ class LogWidget(QWidget): if report is True: # color report btn reportList = self.dataStorage.latestActionReport - for item in reportList: - if item["errors"] != "": - reportBtn.setText("⚠️ Report") - #reportBtn.setStyleSheet("QPushButton {color: white; border-radius: 17px;padding:0px;padding-left: 10px;padding-right: 10px;text-align: center;"+ f"{BACKGR_ERROR_COLOR}" + "} QPushButton:hover { "+ f"{BACKGR_ERROR_COLOR_LIGHT}" + " }") - break + if reportList is not None: + for item in reportList: + if item["errors"] != "": + reportBtn.setText("⚠️ Report") + #reportBtn.setStyleSheet("QPushButton {color: white; border-radius: 17px;padding:0px;padding-left: 10px;padding-right: 10px;text-align: center;"+ f"{BACKGR_ERROR_COLOR}" + "} QPushButton:hover { "+ f"{BACKGR_ERROR_COLOR_LIGHT}" + " }") + break boxLayout.addWidget(reportBtn) boxLayout.addWidget(spacer) @@ -179,6 +179,11 @@ class LogWidget(QWidget): if url.startswith("http"): self.openURL(url) elif url.startswith("cancel"): + + try: metrics.track("Connector Action", self.dataStorage.active_account, {"name": "Cancel Operation", "connector_version": str(self.dataStorage.plugin_version)}) + except Exception as e: print(e) + self.hide() + self.parentWidget.cancelOperations() except Exception as e: diff --git a/qt_ui/dockwidget_main.py b/qt_ui/dockwidget_main.py index c3f6694..014d788 100644 --- a/qt_ui/dockwidget_main.py +++ b/qt_ui/dockwidget_main.py @@ -309,6 +309,10 @@ class SpeckleQGISDialog(QtWidgets.QDockWidget, FORM_CLASS): import webbrowser url = "https://speckle.systems/" webbrowser.open(url, new=0, autoraise=True) + + try: metrics.track("Connector Action", self.dataStorage.active_account, {"name": "Logo Click", "connector_version": str(self.dataStorage.plugin_version)}) + except Exception as e: print(e) + def refreshClicked(self, plugin): try: