From 3d148ae0b84ebfae191759ae1e639ac02df86369 Mon Sep 17 00:00:00 2001 From: strubium <113206902+strubium@users.noreply.github.com> Date: Wed, 15 May 2024 10:06:04 -0500 Subject: [PATCH 1/3] popup for entity browser --- QtPyHammer/ui/entity.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/QtPyHammer/ui/entity.py b/QtPyHammer/ui/entity.py index 7c44a78..d70b7dd 100644 --- a/QtPyHammer/ui/entity.py +++ b/QtPyHammer/ui/entity.py @@ -16,7 +16,8 @@ def __init__(self, parent): self.setGeometry(780, 220, 360, 640) app = QtWidgets.QApplication.instance() if len(app.fgd.entities) == 0: - raise RuntimeError("No entites to browse!") + error_popup = popup.browser(parent=self, popuptext="Error", msgtext="No entites to browse!") + error_popup.show() def is_point_or_solid(e): return e.class_type in ("PointClass", "SolidClass") From b24b45cb0975d6ff56a4db2de19f4e18809556f3 Mon Sep 17 00:00:00 2001 From: strubium <113206902+strubium@users.noreply.github.com> Date: Wed, 15 May 2024 10:19:12 -0500 Subject: [PATCH 2/3] Default arguments --- QtPyHammer/ui/popup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/QtPyHammer/ui/popup.py b/QtPyHammer/ui/popup.py index 079adbe..a261f92 100644 --- a/QtPyHammer/ui/popup.py +++ b/QtPyHammer/ui/popup.py @@ -1,7 +1,7 @@ from PyQt5 import QtCore, QtGui, QtWidgets class browser(QtWidgets.QDialog): - def __init__(self, parent, popuptext, msgtext): + def __init__(self, parent, popuptext='Error', msgtext='Something's wrong, but we don't know what'): super(browser, self).__init__(parent, QtCore.Qt.Tool) self.setWindowTitle(popuptext) @@ -25,4 +25,4 @@ def __init__(self, parent, popuptext, msgtext): self.setLayout(base_layout) # Resize the dialog to fit the text - self.adjustSize() \ No newline at end of file + self.adjustSize() From 9594025433e62c0ee1cb140db94b8b4dd795b39c Mon Sep 17 00:00:00 2001 From: strubium <113206902+strubium@users.noreply.github.com> Date: Wed, 15 May 2024 11:12:18 -0500 Subject: [PATCH 3/3] "" --- QtPyHammer/ui/popup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/QtPyHammer/ui/popup.py b/QtPyHammer/ui/popup.py index a261f92..4aa9c37 100644 --- a/QtPyHammer/ui/popup.py +++ b/QtPyHammer/ui/popup.py @@ -1,7 +1,7 @@ from PyQt5 import QtCore, QtGui, QtWidgets class browser(QtWidgets.QDialog): - def __init__(self, parent, popuptext='Error', msgtext='Something's wrong, but we don't know what'): + def __init__(self, parent, popuptext="Error", msgtext="Something's wrong, but we don't know what"): super(browser, self).__init__(parent, QtCore.Qt.Tool) self.setWindowTitle(popuptext)