Setup LSP and clear all lint
This commit is contained in:
49
main.py
49
main.py
@@ -9,56 +9,22 @@
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
from datetime import datetime, timedelta
|
||||
from typing import Optional
|
||||
|
||||
from PyQt6.QtCore import (
|
||||
QCoreApplication,
|
||||
QEvent,
|
||||
QModelIndex,
|
||||
QResource,
|
||||
Qt,
|
||||
QTimer,
|
||||
pyqtSignal,
|
||||
pyqtSlot,
|
||||
)
|
||||
from PyQt6.QtGui import (
|
||||
QAction,
|
||||
QFont,
|
||||
QTextCharFormat,
|
||||
QTextCursor,
|
||||
QTextDocument,
|
||||
QTextListFormat,
|
||||
)
|
||||
from PyQt6.QtCore import (QCoreApplication, QEvent, QModelIndex, QResource,
|
||||
pyqtSignal, pyqtSlot)
|
||||
from PyQt6.QtSql import QSqlDatabase, QSqlQuery, QSqlQueryModel
|
||||
from PyQt6.QtWidgets import (
|
||||
QApplication,
|
||||
QFileDialog,
|
||||
QMainWindow,
|
||||
QMessageBox,
|
||||
QPushButton,
|
||||
)
|
||||
from PyQt6.QtWidgets import QApplication, QFileDialog, QMainWindow
|
||||
|
||||
|
||||
from lib import *
|
||||
from lib.preferences import Preferences
|
||||
from lib import PersonDialog, Book, SessionDialog, ReadDialog, query_error
|
||||
|
||||
from ui.MainWindow import Ui_MainWindow
|
||||
|
||||
translate = QCoreApplication.translate
|
||||
|
||||
|
||||
def query_error(query: QSqlQuery) -> None:
|
||||
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 MainWindow(QMainWindow, Ui_MainWindow):
|
||||
def __init__(self) -> None:
|
||||
super(MainWindow, self).__init__()
|
||||
@@ -97,7 +63,6 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
||||
|
||||
@pyqtSlot(QModelIndex)
|
||||
def selectedPerson(self, index: QModelIndex) -> None:
|
||||
person_id = index.siblingAtColumn(0).data()
|
||||
self.actionEditPerson.setEnabled(True)
|
||||
book_id = index.siblingAtColumn(3).data()
|
||||
if not book_id or book_id < 0:
|
||||
@@ -324,7 +289,7 @@ def main() -> int:
|
||||
)
|
||||
schema_update(db)
|
||||
Preferences()
|
||||
window: QMainWindow = MainWindow()
|
||||
window = MainWindow() # noqa: F841
|
||||
return app.exec()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user