ui changes, loan quit with hotkey q if no lineedit in focus
This commit is contained in:
@@ -374,7 +374,6 @@ class MainUI(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||
self.btn_show_lentmedia.setText(
|
||||
self.db.getActiveLoans(self.activeUser.id)
|
||||
)
|
||||
#
|
||||
else:
|
||||
# print("Book not loaned")
|
||||
self.setStatusTipMessage("Buch nicht entliehen")
|
||||
|
||||
@@ -70,9 +70,16 @@ class Ui_MainWindow(object):
|
||||
self.menubar = QtWidgets.QMenuBar(parent=MainWindow)
|
||||
self.menubar.setGeometry(QtCore.QRect(0, 0, 899, 22))
|
||||
self.menubar.setObjectName("menubar")
|
||||
self.menuDatei = QtWidgets.QMenu(parent=self.menubar)
|
||||
self.menuDatei.setObjectName("menuDatei")
|
||||
MainWindow.setMenuBar(self.menubar)
|
||||
self.actionBeenden = QtGui.QAction(parent=MainWindow)
|
||||
self.actionBeenden.setObjectName("actionBeenden")
|
||||
self.menuDatei.addAction(self.actionBeenden)
|
||||
self.menubar.addAction(self.menuDatei.menuAction())
|
||||
|
||||
self.retranslateUi(MainWindow)
|
||||
self.actionBeenden.triggered.connect(MainWindow.close) # type: ignore
|
||||
QtCore.QMetaObject.connectSlotsByName(MainWindow)
|
||||
|
||||
def retranslateUi(self, MainWindow):
|
||||
@@ -98,3 +105,6 @@ class Ui_MainWindow(object):
|
||||
item.setText(_translate("MainWindow", "entliehen bis"))
|
||||
item = self.loanTable.horizontalHeaderItem(6)
|
||||
item.setText(_translate("MainWindow", "Zurückgegeben am"))
|
||||
self.menuDatei.setTitle(_translate("MainWindow", "Datei"))
|
||||
self.actionBeenden.setText(_translate("MainWindow", "Beenden"))
|
||||
self.actionBeenden.setShortcut(_translate("MainWindow", "Q"))
|
||||
|
||||
@@ -141,8 +141,40 @@
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuDatei">
|
||||
<property name="title">
|
||||
<string>Datei</string>
|
||||
</property>
|
||||
<addaction name="actionBeenden"/>
|
||||
</widget>
|
||||
<addaction name="menuDatei"/>
|
||||
</widget>
|
||||
<action name="actionBeenden">
|
||||
<property name="text">
|
||||
<string>Beenden</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Q</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>actionBeenden</sender>
|
||||
<signal>triggered()</signal>
|
||||
<receiver>MainWindow</receiver>
|
||||
<slot>close()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>-1</x>
|
||||
<y>-1</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>449</x>
|
||||
<y>328</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
|
||||
@@ -4,6 +4,7 @@ from src.logic import Database
|
||||
from src.schemas import User
|
||||
from .extendLoan import ExtendLoan
|
||||
from src.utils import stringToDate, Icon
|
||||
from src.utils import debugMessage as dbg
|
||||
|
||||
TABLETOFIELDTRANSLATE = {
|
||||
"Titel": "title",
|
||||
@@ -128,7 +129,7 @@ class UserUI(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||
if self.radio_currentlyLoaned.isChecked()
|
||||
else "overdue"
|
||||
)
|
||||
# print(mode)
|
||||
print(mode)
|
||||
if self.userMedia == []:
|
||||
books = self.db.getAllMedia(self.userno)
|
||||
for book in books:
|
||||
@@ -145,12 +146,15 @@ class UserUI(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||
continue
|
||||
elif mode == "overdue":
|
||||
# book not returned and todays date is greater than todate
|
||||
if book.returned_date != "":
|
||||
dbg(book=book)
|
||||
if book.returned_date is not None:
|
||||
continue
|
||||
# if todate is greater than current date, continue
|
||||
if todate > QtCore.QDate.currentDate():
|
||||
continue
|
||||
self.addBookToTable(book)
|
||||
|
||||
self.addBookToTable(book)
|
||||
print(book.title)
|
||||
def addBookToTable(self, book):
|
||||
self.UserMediaTable.insertRow(0)
|
||||
# item0 = isbn
|
||||
|
||||
Reference in New Issue
Block a user