updates
This commit is contained in:
1
icons/dark/notification.svg
Normal file
1
icons/dark/notification.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#c0c0c0"><path d="M160-200v-80h80v-280q0-83 50-147.5T420-792v-28q0-25 17.5-42.5T480-880q25 0 42.5 17.5T540-820v28q80 20 130 84.5T720-560v280h80v80H160Zm320-300Zm0 420q-33 0-56.5-23.5T400-160h160q0 33-23.5 56.5T480-80ZM320-280h320v-280q0-66-47-113t-113-47q-66 0-113 47t-47 113v280Z"/></svg>
|
||||
|
After Width: | Height: | Size: 387 B |
@@ -17,3 +17,4 @@ offAction: shutdown.svg
|
||||
info: info.svg
|
||||
help: help.svg
|
||||
close: close.svg
|
||||
notification: notification.svg
|
||||
1
icons/light/notification.svg
Normal file
1
icons/light/notification.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#000000"><path d="M160-200v-80h80v-280q0-83 50-147.5T420-792v-28q0-25 17.5-42.5T480-880q25 0 42.5 17.5T540-820v28q80 20 130 84.5T720-560v280h80v80H160Zm320-300Zm0 420q-33 0-56.5-23.5T400-160h160q0 33-23.5 56.5T480-80ZM320-280h320v-280q0-66-47-113t-113-47q-66 0-113 47t-47 113v280Z"/></svg>
|
||||
|
After Width: | Height: | Size: 387 B |
@@ -76,7 +76,6 @@ class Database:
|
||||
Returns:
|
||||
sql.Connection: The active connection to the database
|
||||
"""
|
||||
print(self.db_path)
|
||||
return sql.connect(self.db_path)
|
||||
|
||||
def close_connection(self, conn: sql.Connection):
|
||||
@@ -501,6 +500,31 @@ class Database:
|
||||
(message["message"], user_id, message["remind_at"], app_id),
|
||||
)
|
||||
|
||||
def getAllMessages(self) -> list[dict[str, str, str, str]]:
|
||||
"""Get all the messages in the database
|
||||
|
||||
Returns:
|
||||
list[dict[str, str, str, str]]: a list of dictionaries containing the message, the user who added the message, the apparat id and the id of the message
|
||||
"""
|
||||
|
||||
def __get_user_name(user_id):
|
||||
return self.query_db(
|
||||
"SELECT username FROM user WHERE id=?", (user_id,), one=True
|
||||
)[0]
|
||||
|
||||
messages = self.query_db("SELECT * FROM messages")
|
||||
ret = [
|
||||
{
|
||||
"message": i[2],
|
||||
"user": __get_user_name(i[4]),
|
||||
"appnr": i[5],
|
||||
"id": i[0],
|
||||
"remind_at": i[3],
|
||||
}
|
||||
for i in messages
|
||||
]
|
||||
return ret
|
||||
|
||||
def getMessages(self, date: str) -> list[dict[str, str, str, str]]:
|
||||
"""Get all the messages for a specific date
|
||||
|
||||
@@ -529,6 +553,7 @@ class Database:
|
||||
Args:
|
||||
message_id (str): the id of the message
|
||||
"""
|
||||
logger.log_info(f"Deleting message with id {message_id}")
|
||||
self.query_db("DELETE FROM messages WHERE id=?", (message_id,))
|
||||
|
||||
# Prof data
|
||||
|
||||
@@ -891,7 +891,7 @@ class Ui_MainWindow(object):
|
||||
self.elsa_semester.setObjectName("elsa_semester")
|
||||
self.gridLayout_7.addWidget(self.elsa_semester, 2, 1, 1, 1)
|
||||
self.table_elsa_list = QtWidgets.QTableWidget(parent=self.tab_8)
|
||||
self.table_elsa_list.setGeometry(QtCore.QRect(20, 410, 771, 271))
|
||||
self.table_elsa_list.setGeometry(QtCore.QRect(20, 410, 771, 321))
|
||||
self.table_elsa_list.setFrameShape(QtWidgets.QFrame.Shape.StyledPanel)
|
||||
self.table_elsa_list.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken)
|
||||
self.table_elsa_list.setEditTriggers(QtWidgets.QAbstractItemView.EditTrigger.NoEditTriggers)
|
||||
@@ -908,15 +908,15 @@ class Ui_MainWindow(object):
|
||||
self.table_elsa_list.setHorizontalHeaderItem(3, item)
|
||||
self.table_elsa_list.horizontalHeader().setStretchLastSection(True)
|
||||
self.elsa_statistic_frame = QtWidgets.QFrame(parent=self.tab_8)
|
||||
self.elsa_statistic_frame.setGeometry(QtCore.QRect(810, 410, 431, 271))
|
||||
self.elsa_statistic_frame.setGeometry(QtCore.QRect(800, 410, 451, 321))
|
||||
self.elsa_statistic_frame.setObjectName("elsa_statistic_frame")
|
||||
self.elsa_statistics = QtWidgets.QTabWidget(parent=self.elsa_statistic_frame)
|
||||
self.elsa_statistics.setGeometry(QtCore.QRect(0, 0, 431, 271))
|
||||
self.elsa_statistics.setGeometry(QtCore.QRect(10, 0, 431, 321))
|
||||
self.elsa_statistics.setObjectName("elsa_statistics")
|
||||
self.tab_9 = QtWidgets.QWidget()
|
||||
self.tab_9.setObjectName("tab_9")
|
||||
self.elsa_statistics_table = QtWidgets.QTableWidget(parent=self.tab_9)
|
||||
self.elsa_statistics_table.setGeometry(QtCore.QRect(0, 0, 421, 241))
|
||||
self.elsa_statistics_table.setGeometry(QtCore.QRect(0, 0, 421, 291))
|
||||
self.elsa_statistics_table.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff)
|
||||
self.elsa_statistics_table.setEditTriggers(QtWidgets.QAbstractItemView.EditTrigger.NoEditTriggers)
|
||||
self.elsa_statistics_table.setTextElideMode(QtCore.Qt.TextElideMode.ElideRight)
|
||||
|
||||
14
src/ui/dialogs/confirm_extend.py
Normal file
14
src/ui/dialogs/confirm_extend.py
Normal file
@@ -0,0 +1,14 @@
|
||||
from .dialog_sources.Ui_confirm_extend import Ui_extend_confirm
|
||||
from PyQt6 import QtWidgets
|
||||
|
||||
class ConfirmExtend(QtWidgets.QDialog, Ui_extend_confirm):
|
||||
def __init__(self, parent=None):
|
||||
super().__init__(parent)
|
||||
self.setupUi(self)
|
||||
|
||||
|
||||
def launch():
|
||||
app = QtWidgets.QApplication([])
|
||||
window = ConfirmExtend()
|
||||
window.show()
|
||||
app.exec()
|
||||
@@ -16,18 +16,15 @@ class Ui_extend_confirm(object):
|
||||
self.buttonBox = QtWidgets.QDialogButtonBox(parent=extend_confirm)
|
||||
self.buttonBox.setGeometry(QtCore.QRect(290, 20, 81, 241))
|
||||
self.buttonBox.setOrientation(QtCore.Qt.Orientation.Vertical)
|
||||
self.buttonBox.setStandardButtons(
|
||||
QtWidgets.QDialogButtonBox.StandardButton.Cancel
|
||||
| QtWidgets.QDialogButtonBox.StandardButton.Ok
|
||||
)
|
||||
self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.StandardButton.Cancel|QtWidgets.QDialogButtonBox.StandardButton.Ok)
|
||||
self.buttonBox.setObjectName("buttonBox")
|
||||
self.textEdit = QtWidgets.QTextEdit(parent=extend_confirm)
|
||||
self.textEdit.setGeometry(QtCore.QRect(10, 10, 271, 81))
|
||||
self.textEdit.setObjectName("textEdit")
|
||||
|
||||
self.retranslateUi(extend_confirm)
|
||||
self.buttonBox.accepted.connect(extend_confirm.accept) # type: ignore
|
||||
self.buttonBox.rejected.connect(extend_confirm.reject) # type: ignore
|
||||
self.buttonBox.accepted.connect(extend_confirm.accept) # type: ignore
|
||||
self.buttonBox.rejected.connect(extend_confirm.reject) # type: ignore
|
||||
QtCore.QMetaObject.connectSlotsByName(extend_confirm)
|
||||
|
||||
def retranslateUi(self, extend_confirm):
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
from PyQt6 import QtWidgets
|
||||
|
||||
from .dialog_sources.Ui_reminder import Ui_Dialog
|
||||
|
||||
from src import Icon
|
||||
|
||||
class ReminderDialog(QtWidgets.QDialog, Ui_Dialog):
|
||||
def __init__(self, parent=None):
|
||||
super().__init__(parent)
|
||||
self.setupUi(self)
|
||||
self.windowIcon(Icon("notification").icon)
|
||||
|
||||
def return_message(self) -> dict:
|
||||
return {
|
||||
|
||||
@@ -2169,7 +2169,7 @@
|
||||
<x>20</x>
|
||||
<y>410</y>
|
||||
<width>771</width>
|
||||
<height>271</height>
|
||||
<height>321</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
@@ -2208,19 +2208,19 @@
|
||||
<widget class="QFrame" name="elsa_statistic_frame">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>810</x>
|
||||
<x>800</x>
|
||||
<y>410</y>
|
||||
<width>431</width>
|
||||
<height>271</height>
|
||||
<width>451</width>
|
||||
<height>321</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QTabWidget" name="elsa_statistics">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<x>10</x>
|
||||
<y>0</y>
|
||||
<width>431</width>
|
||||
<height>271</height>
|
||||
<height>321</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab_9">
|
||||
@@ -2233,7 +2233,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>421</width>
|
||||
<height>241</height>
|
||||
<height>291</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="horizontalScrollBarPolicy">
|
||||
|
||||
2444
src/ui/userInterface.py
Normal file
2444
src/ui/userInterface.py
Normal file
File diff suppressed because it is too large
Load Diff
@@ -30,22 +30,31 @@ class CalendarEntry(QtWidgets.QDialog, Ui_Dialog):
|
||||
if self.messages[i] == message:
|
||||
return self.messages[i]["id"]
|
||||
|
||||
def __message_index(self, id):
|
||||
for i in range(len(self.messages)):
|
||||
if self.messages[i]["id"] == id:
|
||||
return i
|
||||
|
||||
def delete_message(self):
|
||||
print(self.spin_select_message.value())
|
||||
value = self.spin_select_message.value()
|
||||
print(value)
|
||||
if value > 0:
|
||||
value = value - 1
|
||||
message = self.messages[value]
|
||||
|
||||
print(message)
|
||||
id = self.__get_id(message)
|
||||
print("id", id)
|
||||
del self.messages[value - 1]
|
||||
# del self.messages[value - 1]
|
||||
self.spin_select_message.setMaximum(len(self.messages))
|
||||
self.message_box.clear()
|
||||
if value > 0:
|
||||
self.set_message()
|
||||
self.deleteSignal.emit(id)
|
||||
else:
|
||||
return
|
||||
self.set_message()
|
||||
|
||||
self.deleteSignal.emit(id)
|
||||
self.messages.pop(self.__message_index(id))
|
||||
if len(self.messages) == 0:
|
||||
self.repaintSignal.emit()
|
||||
self.close()
|
||||
else:
|
||||
#
|
||||
self.repaintSignal.emit()
|
||||
|
||||
Reference in New Issue
Block a user