31 lines
833 B
Python
31 lines
833 B
Python
from typing import NoReturn, cast
|
|
|
|
from PySide6.QtCore import QCoreApplication, QObject, QRect, Signal
|
|
from PySide6.QtGui import QColor, QFont
|
|
from PySide6.QtSql import QSqlQuery
|
|
from PySide6.QtWidgets import QStyleOptionViewItem, QWidget
|
|
|
|
translate = QCoreApplication.translate
|
|
|
|
|
|
def query_error(query: QSqlQuery) -> NoReturn:
|
|
"""Standarized query error reporter."""
|
|
print(
|
|
translate("MainWindow", "SQL Error:\n")
|
|
+ "{}\n{}\n{}:{}".format(
|
|
query.executedQuery(),
|
|
query.boundValues(),
|
|
query.lastError().type(),
|
|
query.lastError().text(),
|
|
)
|
|
)
|
|
raise Exception(translate("MainWindow", "SQL Error"))
|
|
|
|
|
|
class QStyleOptionViewItemInit(QStyleOptionViewItem):
|
|
backgroundBrush: QColor
|
|
rect: QRect
|
|
widget: QWidget
|
|
font: QFont
|
|
text: str
|