mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +01:00
fix(tools): dealing with Qt.py
This commit is contained in:
parent
2b6ea31d12
commit
352f1d4173
1 changed files with 9 additions and 10 deletions
|
|
@ -1,12 +1,11 @@
|
||||||
|
from Qt import QtWidgets
|
||||||
import sys
|
import sys
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from avalon.vendor.Qt.QtWidgets import QApplication, QWidget, QPushButton, QMessageBox
|
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class Window(QWidget):
|
class Window(QtWidgets.QWidget):
|
||||||
def __init__(self, parent, title, message, level):
|
def __init__(self, parent, title, message, level):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.parent = parent
|
self.parent = parent
|
||||||
|
|
@ -14,30 +13,30 @@ class Window(QWidget):
|
||||||
self.message = message
|
self.message = message
|
||||||
self.level = level
|
self.level = level
|
||||||
|
|
||||||
if self.level is "info":
|
if self.level == "info":
|
||||||
self._info()
|
self._info()
|
||||||
elif self.level is "warning":
|
elif self.level == "warning":
|
||||||
self._warning()
|
self._warning()
|
||||||
elif self.level is "critical":
|
elif self.level == "critical":
|
||||||
self._critical()
|
self._critical()
|
||||||
|
|
||||||
def _info(self):
|
def _info(self):
|
||||||
self.setWindowTitle(self.title)
|
self.setWindowTitle(self.title)
|
||||||
rc = QMessageBox.information(
|
rc = QtWidgets.QMessageBox.information(
|
||||||
self, self.title, self.message)
|
self, self.title, self.message)
|
||||||
if rc:
|
if rc:
|
||||||
self.exit()
|
self.exit()
|
||||||
|
|
||||||
def _warning(self):
|
def _warning(self):
|
||||||
self.setWindowTitle(self.title)
|
self.setWindowTitle(self.title)
|
||||||
rc = QMessageBox.warning(
|
rc = QtWidgets.QMessageBox.warning(
|
||||||
self, self.title, self.message)
|
self, self.title, self.message)
|
||||||
if rc:
|
if rc:
|
||||||
self.exit()
|
self.exit()
|
||||||
|
|
||||||
def _critical(self):
|
def _critical(self):
|
||||||
self.setWindowTitle(self.title)
|
self.setWindowTitle(self.title)
|
||||||
rc = QMessageBox.critical(
|
rc = QtWidgets.QMessageBox.critical(
|
||||||
self, self.title, self.message)
|
self, self.title, self.message)
|
||||||
if rc:
|
if rc:
|
||||||
self.exit()
|
self.exit()
|
||||||
|
|
@ -51,7 +50,7 @@ class Window(QWidget):
|
||||||
|
|
||||||
def message(title=None, message=None, level="info"):
|
def message(title=None, message=None, level="info"):
|
||||||
global app
|
global app
|
||||||
app = QApplication(sys.argv)
|
app = QtWidgets.QApplication(sys.argv)
|
||||||
ex = Window(app, title, message, level)
|
ex = Window(app, title, message, level)
|
||||||
ex.show()
|
ex.show()
|
||||||
# sys.exit(app.exec_())
|
# sys.exit(app.exec_())
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue