format code
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
# LibrarySystem
|
# LibrarySystem
|
||||||
|
|
||||||
universal library system for facilities in the university. Currently hard-coded for the Library of the University of Education in Freiburg, Germany.
|
universal library system for facilities in the university. Currently hard-coded for the Library of the University of Education in Freiburg, Germany, but can be adapted to fit other libraries as long as the catalogue has a suitable format, or an open API
|
||||||
|
|
||||||
Other Libraries can be supported by rewriting the catalog and it's corresponding functions.
|
Other Libraries can be supported by rewriting the catalog and it's corresponding functions.
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "librarysystem"
|
name = "librarysystem"
|
||||||
version = "0.2.3"
|
version = "0.2.3"
|
||||||
description = "Add your description here"
|
description = "A library system for loaning books and managing the users."
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
requires-python = ">=3.12"
|
requires-python = ">=3.12"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
@@ -23,4 +23,17 @@ dev = [
|
|||||||
"bump-my-version>=0.29.0",
|
"bump-my-version>=0.29.0",
|
||||||
"icecream>=2.1.4",
|
"icecream>=2.1.4",
|
||||||
"nuitka>=2.5.9",
|
"nuitka>=2.5.9",
|
||||||
|
"ruff>=0.9.2",
|
||||||
]
|
]
|
||||||
|
[tool.ruff]
|
||||||
|
exclude = [
|
||||||
|
"dist",
|
||||||
|
".git",
|
||||||
|
".vscode",
|
||||||
|
|
||||||
|
]
|
||||||
|
indent-width = 4
|
||||||
|
include = ["pyproject.toml", "src/**/*.py", "scripts/**/*.py","tests/**/*.py"]
|
||||||
|
|
||||||
|
[tool.ruff.lint]
|
||||||
|
fixable = ["ALL"]
|
||||||
@@ -4,6 +4,7 @@ from loguru import logger
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import atexit
|
import atexit
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
__version__ = "0.2.5"
|
__version__ = "0.2.5"
|
||||||
__author__ = "Alexander Kirchner"
|
__author__ = "Alexander Kirchner"
|
||||||
__email__ = "alexander.kirchner@ph-freiburg.de"
|
__email__ = "alexander.kirchner@ph-freiburg.de"
|
||||||
@@ -66,9 +67,10 @@ if config.debug:
|
|||||||
|
|
||||||
def restore_config():
|
def restore_config():
|
||||||
log.debug("Restoring configuration")
|
log.debug("Restoring configuration")
|
||||||
print("Changes made: ", changes_made)
|
|
||||||
if not changes_made:
|
if not changes_made:
|
||||||
return
|
return
|
||||||
|
values = config.get_changes(_config)
|
||||||
config._config = _config
|
config._config = _config
|
||||||
config.save()
|
config.save()
|
||||||
log.info("Restored configuration, changed values: {config.get_changes(_config)}")
|
log.debug(f"Restored configuration, changed values: {values}")
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import requests
|
|||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
from src import config, log
|
from src import config, log
|
||||||
from src.schemas import Book
|
from src.schemas import Book
|
||||||
|
|
||||||
URL = "https://rds.ibs-bw.de/phfreiburg/opac/RDSIndex/Search?type0%5B%5D=allfields&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND&type0%5B%5D=au&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND&type0%5B%5D=ti&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND&type0%5B%5D=ct&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND&type0%5B%5D=isn&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND&type0%5B%5D=ta&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND&type0%5B%5D=co&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND&type0%5B%5D=py&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND&type0%5B%5D=pp&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND&type0%5B%5D=pu&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND&type0%5B%5D=si&lookfor0%5B%5D={}&join=AND&bool0%5B%5D=AND&type0%5B%5D=zr&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND&type0%5B%5D=cc&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND"
|
URL = "https://rds.ibs-bw.de/phfreiburg/opac/RDSIndex/Search?type0%5B%5D=allfields&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND&type0%5B%5D=au&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND&type0%5B%5D=ti&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND&type0%5B%5D=ct&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND&type0%5B%5D=isn&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND&type0%5B%5D=ta&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND&type0%5B%5D=co&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND&type0%5B%5D=py&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND&type0%5B%5D=pp&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND&type0%5B%5D=pu&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND&type0%5B%5D=si&lookfor0%5B%5D={}&join=AND&bool0%5B%5D=AND&type0%5B%5D=zr&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND&type0%5B%5D=cc&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND"
|
||||||
BASE = "https://rds.ibs-bw.de"
|
BASE = "https://rds.ibs-bw.de"
|
||||||
|
|
||||||
@@ -22,6 +23,7 @@ class Catalogue:
|
|||||||
return True
|
return True
|
||||||
except requests.exceptions.RequestException as e:
|
except requests.exceptions.RequestException as e:
|
||||||
log.error(f"Could not connect to google.com: {e}")
|
log.error(f"Could not connect to google.com: {e}")
|
||||||
|
|
||||||
def search_book(self, searchterm: str):
|
def search_book(self, searchterm: str):
|
||||||
response = requests.get(URL.format(searchterm), timeout=self.timeout)
|
response = requests.get(URL.format(searchterm), timeout=self.timeout)
|
||||||
return response.text
|
return response.text
|
||||||
|
|||||||
@@ -7,16 +7,20 @@ from src.utils import stringToDate
|
|||||||
from PyQt6 import QtCore
|
from PyQt6 import QtCore
|
||||||
|
|
||||||
FILE = config.database.name
|
FILE = config.database.name
|
||||||
|
|
||||||
|
|
||||||
class Database:
|
class Database:
|
||||||
def __init__(self, db_path: str = None):
|
def __init__(self, db_path: str = None):
|
||||||
'''
|
"""
|
||||||
Default constructor for the database class
|
Default constructor for the database class
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
db_path (str, optional): Optional Path for testing / specific purposes. Defaults to None.
|
db_path (str, optional): Optional Path for testing / specific purposes. Defaults to None.
|
||||||
'''
|
"""
|
||||||
if db_path is None:
|
if db_path is None:
|
||||||
self.db_path = self.handle_folder_reachability(config.database.path, config.database.backupLocation)
|
self.db_path = self.handle_folder_reachability(
|
||||||
|
config.database.path, config.database.backupLocation
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
self.db_path = db_path
|
self.db_path = db_path
|
||||||
|
|
||||||
@@ -28,7 +32,7 @@ class Database:
|
|||||||
if not os.path.exists(config.database.backupLocation):
|
if not os.path.exists(config.database.backupLocation):
|
||||||
os.makedirs(config.database.backupLocation)
|
os.makedirs(config.database.backupLocation)
|
||||||
|
|
||||||
#if main path does not exist, try to create it. if that fails, use the backuplocation
|
# if main path does not exist, try to create it. if that fails, use the backuplocation
|
||||||
log.debug("Checking Database Path {}", self.db_path)
|
log.debug("Checking Database Path {}", self.db_path)
|
||||||
self.checkDatabaseStatus()
|
self.checkDatabaseStatus()
|
||||||
|
|
||||||
@@ -48,50 +52,59 @@ class Database:
|
|||||||
backup_file = os.path.join(backup_path, ".backup")
|
backup_file = os.path.join(backup_path, ".backup")
|
||||||
|
|
||||||
if not os.path.exists(original_path):
|
if not os.path.exists(original_path):
|
||||||
#original folder not reachable, use backup path and create .backup file
|
# original folder not reachable, use backup path and create .backup file
|
||||||
if not os.path.exists(backup_path):
|
if not os.path.exists(backup_path):
|
||||||
os.makedirs(backup_path)
|
os.makedirs(backup_path)
|
||||||
with open(backup_file, "w") as f:
|
with open(backup_file, "w") as f:
|
||||||
f.write("")
|
f.write("")
|
||||||
|
|
||||||
# Create an empty backup file as a marker
|
# Create an empty backup file as a marker
|
||||||
return backup_path +"/" + FILE
|
return backup_path + "/" + FILE
|
||||||
|
|
||||||
else:
|
else:
|
||||||
log.info("Original Path Exists, using this path")
|
log.info("Original Path Exists, using this path")
|
||||||
# Original folder is reachable, check for backup
|
# Original folder is reachable, check for backup
|
||||||
if os.path.exists(backup_file):
|
if os.path.exists(backup_file):
|
||||||
# Restore backup
|
# Restore backup
|
||||||
shutil.rmtree(original_path) # Remove original folder to avoid conflicts
|
shutil.rmtree(
|
||||||
|
original_path
|
||||||
|
) # Remove original folder to avoid conflicts
|
||||||
os.rename(backup_path, original_path)
|
os.rename(backup_path, original_path)
|
||||||
# (backup_path, original_path)
|
# (backup_path, original_path)
|
||||||
#os.remove(backup_file)
|
# os.remove(backup_file)
|
||||||
#remove backup file from original path
|
# remove backup file from original path
|
||||||
os.remove(original_path + "/.backup")
|
os.remove(original_path + "/.backup")
|
||||||
os.makedirs(backup_path)
|
os.makedirs(backup_path)
|
||||||
return original_path +"/" + FILE
|
return original_path + "/" + FILE
|
||||||
|
|
||||||
def checkDatabasePath(self):
|
def checkDatabasePath(self):
|
||||||
self.db_path = config.database.path + "/" + config.database.name
|
self.db_path = config.database.path + "/" + config.database.name
|
||||||
#if backup file in backup location, move database to main location, delete backup file
|
# if backup file in backup location, move database to main location, delete backup file
|
||||||
if os.path.exists(config.database.backupLocation + "/backup"):
|
if os.path.exists(config.database.backupLocation + "/backup"):
|
||||||
if os.path.exists(self.db_path):
|
if os.path.exists(self.db_path):
|
||||||
os.remove(self.db_path)
|
os.remove(self.db_path)
|
||||||
os.rename(f"{config.database.backupLocation}/{config.database.name}", self.db_path)
|
os.rename(
|
||||||
#remove backup file
|
f"{config.database.backupLocation}/{config.database.name}",
|
||||||
|
self.db_path,
|
||||||
|
)
|
||||||
|
# remove backup file
|
||||||
os.remove(config.database.backupLocation + "/backup")
|
os.remove(config.database.backupLocation + "/backup")
|
||||||
return self.db_path
|
return self.db_path
|
||||||
else:
|
else:
|
||||||
#keep using backup file
|
# keep using backup file
|
||||||
self.db_path = config.database.backupLocation + "/" + config.database.name
|
self.db_path = (
|
||||||
|
config.database.backupLocation + "/" + config.database.name
|
||||||
|
)
|
||||||
if not os.path.exists(config.database.path):
|
if not os.path.exists(config.database.path):
|
||||||
try:
|
try:
|
||||||
os.makedirs(config.database.path)
|
os.makedirs(config.database.path)
|
||||||
except:
|
except:
|
||||||
self.db_path = config.database.backupLocation + "/" + config.database.name
|
self.db_path = (
|
||||||
|
config.database.backupLocation + "/" + config.database.name
|
||||||
|
)
|
||||||
if not os.path.exists(config.database.backupLocation):
|
if not os.path.exists(config.database.backupLocation):
|
||||||
os.makedirs(config.database.backupLocation)
|
os.makedirs(config.database.backupLocation)
|
||||||
#create a backup file in the backup location
|
# create a backup file in the backup location
|
||||||
with open(f"{config.database.backupLocation}/backup.txt", "w") as f:
|
with open(f"{config.database.backupLocation}/backup.txt", "w") as f:
|
||||||
f.write("Backup File")
|
f.write("Backup File")
|
||||||
return self.db_path
|
return self.db_path
|
||||||
@@ -104,27 +117,27 @@ class Database:
|
|||||||
# self.insertSubjects()
|
# self.insertSubjects()
|
||||||
|
|
||||||
def connect(self) -> sql.Connection:
|
def connect(self) -> sql.Connection:
|
||||||
'''
|
"""
|
||||||
Connect to the database
|
Connect to the database
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
sql.Connection: The active connection to the database
|
sql.Connection: The active connection to the database
|
||||||
'''
|
"""
|
||||||
return sql.connect(self.db_path)
|
return sql.connect(self.db_path)
|
||||||
|
|
||||||
def close_connection(self, conn: sql.Connection):
|
def close_connection(self, conn: sql.Connection):
|
||||||
'''
|
"""
|
||||||
closes the connection to the database
|
closes the connection to the database
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
----
|
----
|
||||||
- conn (sql.Connection): the connection to be closed
|
- conn (sql.Connection): the connection to be closed
|
||||||
'''
|
"""
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
def createDatabase(self):
|
def createDatabase(self):
|
||||||
log.info("Creating Database")
|
log.info("Creating Database")
|
||||||
#print("Creating Database")
|
# print("Creating Database")
|
||||||
if not os.path.exists(self.db_path):
|
if not os.path.exists(self.db_path):
|
||||||
os.makedirs(self.db_path)
|
os.makedirs(self.db_path)
|
||||||
conn = self.connect()
|
conn = self.connect()
|
||||||
@@ -149,12 +162,12 @@ class Database:
|
|||||||
|
|
||||||
def tableCheck(self):
|
def tableCheck(self):
|
||||||
# check if database has tables
|
# check if database has tables
|
||||||
'''
|
"""
|
||||||
Get the contents of the
|
Get the contents of the
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
Union[List[Tuple], None]: Returns a list of tuples containing the table names or None if no tables are present
|
Union[List[Tuple], None]: Returns a list of tuples containing the table names or None if no tables are present
|
||||||
'''
|
"""
|
||||||
try:
|
try:
|
||||||
with sql.connect(self.db_path) as conn:
|
with sql.connect(self.db_path) as conn:
|
||||||
cursor = conn.cursor()
|
cursor = conn.cursor()
|
||||||
@@ -170,6 +183,7 @@ class Database:
|
|||||||
result = cursor.fetchall()
|
result = cursor.fetchall()
|
||||||
self.close_connection(conn)
|
self.close_connection(conn)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def checkUserExists(self, key, value) -> list[User] | bool:
|
def checkUserExists(self, key, value) -> list[User] | bool:
|
||||||
query = f"SELECT * FROM users WHERE {key} like '%{value}%'"
|
query = f"SELECT * FROM users WHERE {key} like '%{value}%'"
|
||||||
conn = self.connect()
|
conn = self.connect()
|
||||||
@@ -181,7 +195,9 @@ class Database:
|
|||||||
|
|
||||||
users = cursor.fetchall()
|
users = cursor.fetchall()
|
||||||
for index, user in enumerate(users):
|
for index, user in enumerate(users):
|
||||||
users[index] = User(userid=user[1], username=user[2], email=user[3], id=user[0])
|
users[index] = User(
|
||||||
|
userid=user[1], username=user[2], email=user[3], id=user[0]
|
||||||
|
)
|
||||||
self.close_connection(conn)
|
self.close_connection(conn)
|
||||||
return users
|
return users
|
||||||
|
|
||||||
@@ -209,7 +225,6 @@ class Database:
|
|||||||
return user
|
return user
|
||||||
|
|
||||||
def getUser(self, user_id) -> User:
|
def getUser(self, user_id) -> User:
|
||||||
|
|
||||||
conn = self.connect()
|
conn = self.connect()
|
||||||
cursor = conn.cursor()
|
cursor = conn.cursor()
|
||||||
cursor.execute(f"SELECT * FROM users")
|
cursor.execute(f"SELECT * FROM users")
|
||||||
@@ -230,7 +245,7 @@ class Database:
|
|||||||
log.info(f"Returning User {user}")
|
log.info(f"Returning User {user}")
|
||||||
return user
|
return user
|
||||||
raise ValueError(f"User {user_id} not found")
|
raise ValueError(f"User {user_id} not found")
|
||||||
#return User(userid="gelöscht", username="gelöscht", email="gelöscht", id="gelöscht")
|
# return User(userid="gelöscht", username="gelöscht", email="gelöscht", id="gelöscht")
|
||||||
# user = User(userid=result[1], username=result[2], email=result[3],id = result[0])
|
# user = User(userid=result[1], username=result[2], email=result[3],id = result[0])
|
||||||
# return user
|
# return user
|
||||||
|
|
||||||
@@ -240,7 +255,7 @@ class Database:
|
|||||||
cursor.execute(f"SELECT * FROM users WHERE username = '{username}'")
|
cursor.execute(f"SELECT * FROM users WHERE username = '{username}'")
|
||||||
result = cursor.fetchone()
|
result = cursor.fetchone()
|
||||||
self.close_connection(conn)
|
self.close_connection(conn)
|
||||||
user = User(userid=result[1], username=result[2], email=result[3],id = result[0])
|
user = User(userid=result[1], username=result[2], email=result[3], id=result[0])
|
||||||
log.info(f"Returning User {user}")
|
log.info(f"Returning User {user}")
|
||||||
return user
|
return user
|
||||||
|
|
||||||
@@ -254,7 +269,7 @@ class Database:
|
|||||||
conn.commit()
|
conn.commit()
|
||||||
self.close_connection(conn)
|
self.close_connection(conn)
|
||||||
|
|
||||||
def setUserActiveDate(self, userid,date):
|
def setUserActiveDate(self, userid, date):
|
||||||
query = f"UPDATE users SET lastActive = '{date}' WHERE user_id = '{userid}'"
|
query = f"UPDATE users SET lastActive = '{date}' WHERE user_id = '{userid}'"
|
||||||
conn = self.connect()
|
conn = self.connect()
|
||||||
cursor = conn.cursor()
|
cursor = conn.cursor()
|
||||||
@@ -263,7 +278,11 @@ class Database:
|
|||||||
log.debug(f"Setting User {userid} to active on {date}")
|
log.debug(f"Setting User {userid} to active on {date}")
|
||||||
|
|
||||||
def renameInactiveUsers(self):
|
def renameInactiveUsers(self):
|
||||||
lastYear = QtCore.QDate.currentDate().addDays(int(f"-{config.delete_inactive_user_duration}")).toString("yyyy-MM-dd")
|
lastYear = (
|
||||||
|
QtCore.QDate.currentDate()
|
||||||
|
.addDays(int(f"-{config.delete_inactive_user_duration}"))
|
||||||
|
.toString("yyyy-MM-dd")
|
||||||
|
)
|
||||||
query = f"SELECT id FROM users WHERE lastActive < '{lastYear}'"
|
query = f"SELECT id FROM users WHERE lastActive < '{lastYear}'"
|
||||||
conn = self.connect()
|
conn = self.connect()
|
||||||
cursor = conn.cursor()
|
cursor = conn.cursor()
|
||||||
@@ -276,7 +295,7 @@ class Database:
|
|||||||
if not hasLoans:
|
if not hasLoans:
|
||||||
self.deleteUser(user)
|
self.deleteUser(user)
|
||||||
|
|
||||||
def hasLoans(self, userid)->bool:
|
def hasLoans(self, userid) -> bool:
|
||||||
query = f"SELECT * FROM loans WHERE user_id = '{userid}' AND returned = 0"
|
query = f"SELECT * FROM loans WHERE user_id = '{userid}' AND returned = 0"
|
||||||
conn = self.connect()
|
conn = self.connect()
|
||||||
cursor = conn.cursor()
|
cursor = conn.cursor()
|
||||||
@@ -289,7 +308,9 @@ class Database:
|
|||||||
log.debug(f"Deleting User {userid}")
|
log.debug(f"Deleting User {userid}")
|
||||||
conn = self.connect()
|
conn = self.connect()
|
||||||
cursor = conn.cursor()
|
cursor = conn.cursor()
|
||||||
cursor.execute(f"UPDATE users SET username='gelöscht', usermail = 'gelöscht', user_id='gelöscht' WHERE id = '{userid}'")
|
cursor.execute(
|
||||||
|
f"UPDATE users SET username='gelöscht', usermail = 'gelöscht', user_id='gelöscht' WHERE id = '{userid}'"
|
||||||
|
)
|
||||||
conn.commit()
|
conn.commit()
|
||||||
self.close_connection(conn)
|
self.close_connection(conn)
|
||||||
|
|
||||||
@@ -313,6 +334,7 @@ class Database:
|
|||||||
result = self.query(query)
|
result = self.query(query)
|
||||||
|
|
||||||
return [res[0] for res in result]
|
return [res[0] for res in result]
|
||||||
|
|
||||||
def getAllLoans(self):
|
def getAllLoans(self):
|
||||||
loan_data = []
|
loan_data = []
|
||||||
query = "SELECT * FROM loans"
|
query = "SELECT * FROM loans"
|
||||||
@@ -334,6 +356,7 @@ class Database:
|
|||||||
)
|
)
|
||||||
loan_data.append(l)
|
loan_data.append(l)
|
||||||
return loan_data
|
return loan_data
|
||||||
|
|
||||||
def insertLoan(self, userid, mediaid, loandate, duedate):
|
def insertLoan(self, userid, mediaid, loandate, duedate):
|
||||||
log.debug(f"Inserting Loan {userid}, {mediaid}, {loandate}, {duedate}")
|
log.debug(f"Inserting Loan {userid}, {mediaid}, {loandate}, {duedate}")
|
||||||
query = f"INSERT INTO loans (user_id, media_id, loan_date, return_date) Values ('{userid}', '{mediaid}', '{loandate}', '{duedate}')"
|
query = f"INSERT INTO loans (user_id, media_id, loan_date, return_date) Values ('{userid}', '{mediaid}', '{loandate}', '{duedate}')"
|
||||||
@@ -359,6 +382,7 @@ class Database:
|
|||||||
def getLoansBy(self, field, value):
|
def getLoansBy(self, field, value):
|
||||||
# query all loans, sort by date descending and return
|
# query all loans, sort by date descending and return
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def getMediaSimilarSignatureByID(self, media_id) -> list[Book]:
|
def getMediaSimilarSignatureByID(self, media_id) -> list[Book]:
|
||||||
log.info(f"Getting Media Similar to {media_id}")
|
log.info(f"Getting Media Similar to {media_id}")
|
||||||
query = f"SELECT * FROM media WHERE id = '{media_id}'"
|
query = f"SELECT * FROM media WHERE id = '{media_id}'"
|
||||||
@@ -367,7 +391,7 @@ class Database:
|
|||||||
cursor.execute(query)
|
cursor.execute(query)
|
||||||
result = cursor.fetchone()
|
result = cursor.fetchone()
|
||||||
signature = result[1]
|
signature = result[1]
|
||||||
#print(signature)
|
# print(signature)
|
||||||
query = f"SELECT * FROM media WHERE signature LIKE '%{signature}%'"
|
query = f"SELECT * FROM media WHERE signature LIKE '%{signature}%'"
|
||||||
cursor.execute(query)
|
cursor.execute(query)
|
||||||
result = cursor.fetchall()
|
result = cursor.fetchall()
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
from PyQt6.QtCore import QThread, pyqtSignal
|
from PyQt6.QtCore import QThread, pyqtSignal
|
||||||
from src.utils import launch_documentation
|
from src.utils import launch_documentation
|
||||||
|
|
||||||
|
|
||||||
class DocumentationThread(QThread):
|
class DocumentationThread(QThread):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import requests
|
import requests
|
||||||
|
|
||||||
URL = "https://sru.k10plus.de/opac-de-627!rec=1?version=1.1&operation=searchRetrieve&query="
|
URL = "https://sru.k10plus.de/opac-de-627!rec=1?version=1.1&operation=searchRetrieve&query="
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ username TEXT NOT NULL,
|
|||||||
usermail TEXT NOT NULL,
|
usermail TEXT NOT NULL,
|
||||||
lastActive TEXT);
|
lastActive TEXT);
|
||||||
""" # id == matrikelnr,
|
""" # id == matrikelnr,
|
||||||
#matrikelnr TEXT NOT NULL,
|
# matrikelnr TEXT NOT NULL,
|
||||||
MEDIA = """CREATE TABLE IF NOT EXISTS media (
|
MEDIA = """CREATE TABLE IF NOT EXISTS media (
|
||||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
signature TEXT NOT NULL,
|
signature TEXT NOT NULL,
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class User:
|
class User:
|
||||||
username: str
|
username: str
|
||||||
userid: Any
|
userid: Any
|
||||||
email: str
|
email: str
|
||||||
id : int = None
|
id: int = None
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return f"Name: {self.username}\nMatrikelnr.: {self.userid}\neMail: {self.email}"
|
return f"Name: {self.username}\nMatrikelnr.: {self.userid}\neMail: {self.email}"
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ from PyQt6.QtGui import QRegularExpressionValidator
|
|||||||
from src.logic import Database
|
from src.logic import Database
|
||||||
from src.utils import Icon
|
from src.utils import Icon
|
||||||
|
|
||||||
|
|
||||||
class CreateUser(QtWidgets.QDialog, Ui_Dialog):
|
class CreateUser(QtWidgets.QDialog, Ui_Dialog):
|
||||||
def __init__(self, fieldname, data):
|
def __init__(self, fieldname, data):
|
||||||
super(CreateUser, self).__init__()
|
super(CreateUser, self).__init__()
|
||||||
@@ -40,6 +41,7 @@ class CreateUser(QtWidgets.QDialog, Ui_Dialog):
|
|||||||
lambda: self.validateInputUserno(self.userno.text(), "int")
|
lambda: self.validateInputUserno(self.userno.text(), "int")
|
||||||
)
|
)
|
||||||
log.info("User creation dialog opened")
|
log.info("User creation dialog opened")
|
||||||
|
|
||||||
def checkFields(self):
|
def checkFields(self):
|
||||||
if (
|
if (
|
||||||
self.username.hasAcceptableInput()
|
self.username.hasAcceptableInput()
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ from .sources.Ui_dialog_extendLoanDuration import Ui_Dialog
|
|||||||
from PyQt6 import QtWidgets, QtCore
|
from PyQt6 import QtWidgets, QtCore
|
||||||
from src.utils import Icon
|
from src.utils import Icon
|
||||||
|
|
||||||
|
|
||||||
class ExtendLoan(QtWidgets.QDialog, Ui_Dialog):
|
class ExtendLoan(QtWidgets.QDialog, Ui_Dialog):
|
||||||
def __init__(self, user, media):
|
def __init__(self, user, media):
|
||||||
super(ExtendLoan, self).__init__()
|
super(ExtendLoan, self).__init__()
|
||||||
@@ -17,9 +18,9 @@ class ExtendLoan(QtWidgets.QDialog, Ui_Dialog):
|
|||||||
self.buttonBox.accepted.connect(self.extendLoan)
|
self.buttonBox.accepted.connect(self.extendLoan)
|
||||||
|
|
||||||
def extendLoan(self):
|
def extendLoan(self):
|
||||||
#print("Extend Loan")
|
# print("Extend Loan")
|
||||||
selectedDate = self.extenduntil.selectedDate()
|
selectedDate = self.extenduntil.selectedDate()
|
||||||
#print(selectedDate)
|
# print(selectedDate)
|
||||||
self.extendDate = selectedDate
|
self.extendDate = selectedDate
|
||||||
self.close()
|
self.close()
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,6 @@ class LoanWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
|||||||
def selfpass(self):
|
def selfpass(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
def insertRow(self, data):
|
def insertRow(self, data):
|
||||||
log.debug(f"Inserting row: {data}")
|
log.debug(f"Inserting row: {data}")
|
||||||
|
|
||||||
|
|||||||
@@ -22,10 +22,12 @@ from .reportUi import ReportUi
|
|||||||
backup = Backup()
|
backup = Backup()
|
||||||
cat = Catalogue()
|
cat = Catalogue()
|
||||||
|
|
||||||
|
|
||||||
def getShortcut(shortcuts, name):
|
def getShortcut(shortcuts, name):
|
||||||
shortcut = [cut for cut in shortcuts if cut["name"] == name][0]
|
shortcut = [cut for cut in shortcuts if cut["name"] == name][0]
|
||||||
return shortcut["current"]
|
return shortcut["current"]
|
||||||
|
|
||||||
|
|
||||||
class MainUI(QtWidgets.QMainWindow, Ui_MainWindow):
|
class MainUI(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super(MainUI, self).__init__()
|
super(MainUI, self).__init__()
|
||||||
@@ -43,10 +45,12 @@ class MainUI(QtWidgets.QMainWindow, Ui_MainWindow):
|
|||||||
self.actionBericht_erstellen.triggered.connect(self.generateReport)
|
self.actionBericht_erstellen.triggered.connect(self.generateReport)
|
||||||
self.actionDokumentation_ffnen.triggered.connect(self.openDocumentation)
|
self.actionDokumentation_ffnen.triggered.connect(self.openDocumentation)
|
||||||
self.actionBeenden.triggered.connect(self.shutdown)
|
self.actionBeenden.triggered.connect(self.shutdown)
|
||||||
|
|
||||||
def __mail():
|
def __mail():
|
||||||
webbrowser.open(f"mailto:{__email__}")
|
webbrowser.open(f"mailto:{__email__}")
|
||||||
|
|
||||||
self.actionProblem_melden.triggered.connect(__mail)
|
self.actionProblem_melden.triggered.connect(__mail)
|
||||||
#if close button is pressed call shutdown
|
# if close button is pressed call shutdown
|
||||||
self.closeEvent = self.shutdown
|
self.closeEvent = self.shutdown
|
||||||
# Buttons
|
# Buttons
|
||||||
self.btn_show_lentmedia.clicked.connect(self.showUser)
|
self.btn_show_lentmedia.clicked.connect(self.showUser)
|
||||||
@@ -98,21 +102,24 @@ class MainUI(QtWidgets.QMainWindow, Ui_MainWindow):
|
|||||||
self.show()
|
self.show()
|
||||||
|
|
||||||
def shutdown(self, *args):
|
def shutdown(self, *args):
|
||||||
#kill documentation thread
|
# kill documentation thread
|
||||||
log.info("Shutting down")
|
log.info("Shutting down")
|
||||||
if config.documentation:
|
if config.documentation:
|
||||||
self.docu.terminate()
|
self.docu.terminate()
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
|
|
||||||
def assignShortcuts(self):
|
def assignShortcuts(self):
|
||||||
shortcuts = config.shortcuts
|
shortcuts = config.shortcuts
|
||||||
shortcuts = OmegaConf.to_container(shortcuts)
|
shortcuts = OmegaConf.to_container(shortcuts)
|
||||||
#convert to dictconfig
|
# convert to dictconfig
|
||||||
|
|
||||||
self.actionDokumentation_ffnen.setShortcut(getShortcut(shortcuts, "Hilfe"))
|
self.actionDokumentation_ffnen.setShortcut(getShortcut(shortcuts, "Hilfe"))
|
||||||
self.actionAusleihhistorie.setShortcut(getShortcut(shortcuts, "Ausleihhistorie"))
|
self.actionAusleihhistorie.setShortcut(
|
||||||
self.actionBericht_erstellen.setShortcut(getShortcut(shortcuts, "Bericht_erstellen"))
|
getShortcut(shortcuts, "Ausleihhistorie")
|
||||||
|
)
|
||||||
|
self.actionBericht_erstellen.setShortcut(
|
||||||
|
getShortcut(shortcuts, "Bericht_erstellen")
|
||||||
|
)
|
||||||
self.actionNutzer.setShortcut(getShortcut(shortcuts, "Nutzer"))
|
self.actionNutzer.setShortcut(getShortcut(shortcuts, "Nutzer"))
|
||||||
self.actionRueckgabemodus.setShortcut(getShortcut(shortcuts, "Rueckgabemodus"))
|
self.actionRueckgabemodus.setShortcut(getShortcut(shortcuts, "Rueckgabemodus"))
|
||||||
|
|
||||||
@@ -138,20 +145,22 @@ class MainUI(QtWidgets.QMainWindow, Ui_MainWindow):
|
|||||||
settings = Settings()
|
settings = Settings()
|
||||||
settings.exec()
|
settings.exec()
|
||||||
result = settings.result()
|
result = settings.result()
|
||||||
print(settings.settingschanged, settings.restart_required)
|
# print(settings.settingschanged, settings.restart_required)
|
||||||
if result == 1:
|
if result == 1 and settings.restart_required:
|
||||||
#dialog to ask if program should be restarted
|
# dialog to ask if program should be restarted
|
||||||
dialog = QtWidgets.QMessageBox()
|
dialog = QtWidgets.QMessageBox()
|
||||||
dialog.setWindowTitle("Einstellungen geändert")
|
dialog.setWindowTitle("Einstellungen geändert")
|
||||||
dialog.setIcon(QtWidgets.QMessageBox.Icon.Information)
|
dialog.setIcon(QtWidgets.QMessageBox.Icon.Information)
|
||||||
dialog.setWindowIcon(Icon("settings").icon)
|
dialog.setWindowIcon(Icon("restart").icon)
|
||||||
dialog.setText("Einstellungen wurden geändert\nProgramm neu starten?")
|
dialog.setText(
|
||||||
|
"Einstellungen wurden geändert\nDas Programm muss neu gestartet werden?"
|
||||||
|
)
|
||||||
dialog.setStandardButtons(
|
dialog.setStandardButtons(
|
||||||
QtWidgets.QMessageBox.StandardButton.Yes
|
QtWidgets.QMessageBox.StandardButton.Yes
|
||||||
| QtWidgets.QMessageBox.StandardButton.No
|
| QtWidgets.QMessageBox.StandardButton.No
|
||||||
)
|
)
|
||||||
dialog.setDefaultButton(QtWidgets.QMessageBox.StandardButton.No)
|
dialog.setDefaultButton(QtWidgets.QMessageBox.StandardButton.No)
|
||||||
#translate buttons
|
# translate buttons
|
||||||
yes = dialog.button(QtWidgets.QMessageBox.StandardButton.Yes)
|
yes = dialog.button(QtWidgets.QMessageBox.StandardButton.Yes)
|
||||||
yes.setText("Ja")
|
yes.setText("Ja")
|
||||||
no = dialog.button(QtWidgets.QMessageBox.StandardButton.No)
|
no = dialog.button(QtWidgets.QMessageBox.StandardButton.No)
|
||||||
@@ -161,7 +170,7 @@ class MainUI(QtWidgets.QMainWindow, Ui_MainWindow):
|
|||||||
if result == QtWidgets.QMessageBox.StandardButton.Yes:
|
if result == QtWidgets.QMessageBox.StandardButton.Yes:
|
||||||
self.restart()
|
self.restart()
|
||||||
# reload settings
|
# reload settings
|
||||||
#print(config)
|
# print(config)
|
||||||
|
|
||||||
def openDocumentation(self):
|
def openDocumentation(self):
|
||||||
log.info("Opening Documentation")
|
log.info("Opening Documentation")
|
||||||
@@ -175,19 +184,16 @@ class MainUI(QtWidgets.QMainWindow, Ui_MainWindow):
|
|||||||
dialog.setText("Dokumentation nicht verfügbar")
|
dialog.setText("Dokumentation nicht verfügbar")
|
||||||
dialog.exec()
|
dialog.exec()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def restart(self):
|
def restart(self):
|
||||||
#log restart
|
# log restart
|
||||||
log.info("Restarting Program")
|
log.info("Restarting Program")
|
||||||
import os
|
import os
|
||||||
|
|
||||||
python_executable = sys.executable
|
python_executable = sys.executable
|
||||||
args = sys.argv[:]
|
args = sys.argv[:]
|
||||||
args.insert(0, sys.executable)
|
args.insert(0, sys.executable)
|
||||||
os.execvp(python_executable, args)
|
os.execvp(python_executable, args)
|
||||||
|
|
||||||
|
|
||||||
def changeMode(self):
|
def changeMode(self):
|
||||||
log.info("Changing Mode, current mode is {}", self.activeState)
|
log.info("Changing Mode, current mode is {}", self.activeState)
|
||||||
self.input_username.clear()
|
self.input_username.clear()
|
||||||
@@ -201,12 +207,12 @@ class MainUI(QtWidgets.QMainWindow, Ui_MainWindow):
|
|||||||
self.label_7.hide()
|
self.label_7.hide()
|
||||||
self.nextReturnDate.hide()
|
self.nextReturnDate.hide()
|
||||||
self.mediaOverview.setRowCount(0)
|
self.mediaOverview.setRowCount(0)
|
||||||
self.activeUser = None #! remove if last user should be kept
|
self.activeUser = None #! remove if last user should be kept
|
||||||
if self.activeState == "Rückgabe":
|
if self.activeState == "Rückgabe":
|
||||||
if stayReturn:
|
if stayReturn:
|
||||||
self.activateReturnMode()
|
self.activateReturnMode()
|
||||||
else: self.activateLoanMode()
|
else:
|
||||||
|
self.activateLoanMode()
|
||||||
|
|
||||||
else:
|
else:
|
||||||
self.activateReturnMode()
|
self.activateReturnMode()
|
||||||
@@ -225,7 +231,9 @@ class MainUI(QtWidgets.QMainWindow, Ui_MainWindow):
|
|||||||
self.activeState = "Ausleihe"
|
self.activeState = "Ausleihe"
|
||||||
if self.input_userno.text() == "" or self.input_username.text() == "":
|
if self.input_userno.text() == "" or self.input_username.text() == "":
|
||||||
self.input_file_ident.setEnabled(False)
|
self.input_file_ident.setEnabled(False)
|
||||||
self.input_file_ident.setPlaceholderText("Bitte zuerst Nutzerdaten eingeben")
|
self.input_file_ident.setPlaceholderText(
|
||||||
|
"Bitte zuerst Nutzerdaten eingeben"
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
self.input_file_ident.setEnabled(True)
|
self.input_file_ident.setEnabled(True)
|
||||||
|
|
||||||
@@ -240,7 +248,9 @@ class MainUI(QtWidgets.QMainWindow, Ui_MainWindow):
|
|||||||
self.mode.setText("Rückgabe")
|
self.mode.setText("Rückgabe")
|
||||||
self.input_file_ident.setEnabled(True)
|
self.input_file_ident.setEnabled(True)
|
||||||
self.input_file_ident.setPlaceholderText("Buchidentifikation eingeben")
|
self.input_file_ident.setPlaceholderText("Buchidentifikation eingeben")
|
||||||
self.input_username.setPlaceholderText("Bitte erst in den Ausleihmodus wechseln")
|
self.input_username.setPlaceholderText(
|
||||||
|
"Bitte erst in den Ausleihmodus wechseln"
|
||||||
|
)
|
||||||
self.input_userno.setPlaceholderText("Bitte erst in den Ausleihmodus wechseln")
|
self.input_userno.setPlaceholderText("Bitte erst in den Ausleihmodus wechseln")
|
||||||
|
|
||||||
def showUser(self):
|
def showUser(self):
|
||||||
@@ -256,9 +266,7 @@ class MainUI(QtWidgets.QMainWindow, Ui_MainWindow):
|
|||||||
dialog.exec()
|
dialog.exec()
|
||||||
return
|
return
|
||||||
|
|
||||||
self.user_ui = UserUI(
|
self.user_ui = UserUI(self.activeUser)
|
||||||
self.activeUser
|
|
||||||
)
|
|
||||||
# self.user_ui.setFields("John Doe", "123456789", "test@mail.com")
|
# self.user_ui.setFields("John Doe", "123456789", "test@mail.com")
|
||||||
self.user_ui.show()
|
self.user_ui.show()
|
||||||
|
|
||||||
@@ -291,7 +299,7 @@ class MainUI(QtWidgets.QMainWindow, Ui_MainWindow):
|
|||||||
|
|
||||||
def checkUser(self, fieldname, data):
|
def checkUser(self, fieldname, data):
|
||||||
log.info(f"Checking User {fieldname}, {data}")
|
log.info(f"Checking User {fieldname}, {data}")
|
||||||
#print("Checking User", fieldname, data)
|
# print("Checking User", fieldname, data)
|
||||||
# set fieldname as key and data as variable
|
# set fieldname as key and data as variable
|
||||||
user = self.db.checkUserExists(fieldname, data)
|
user = self.db.checkUserExists(fieldname, data)
|
||||||
if not user:
|
if not user:
|
||||||
@@ -311,16 +319,16 @@ class MainUI(QtWidgets.QMainWindow, Ui_MainWindow):
|
|||||||
multi.exec()
|
multi.exec()
|
||||||
self.activeUser = multi.userdata
|
self.activeUser = multi.userdata
|
||||||
else:
|
else:
|
||||||
#print("User found", user[0])
|
# print("User found", user[0])
|
||||||
self.activeUser = user[0]
|
self.activeUser = user[0]
|
||||||
|
|
||||||
if self.activeUser is not None:
|
if self.activeUser is not None:
|
||||||
log.info(f"User found {self.activeUser}")
|
log.info(f"User found {self.activeUser}")
|
||||||
#print("User found", self.activeUser)
|
# print("User found", self.activeUser)
|
||||||
self.setUserData()
|
self.setUserData()
|
||||||
self.input_file_ident.setFocus()
|
self.input_file_ident.setFocus()
|
||||||
self.mode.setText("Ausleihe")
|
self.mode.setText("Ausleihe")
|
||||||
#print(self.activeUser.__dict__)
|
# print(self.activeUser.__dict__)
|
||||||
loans = self.db.getActiveLoans(self.activeUser.id)
|
loans = self.db.getActiveLoans(self.activeUser.id)
|
||||||
log.debug("Active Loans", loans)
|
log.debug("Active Loans", loans)
|
||||||
self.btn_show_lentmedia.setText(loans)
|
self.btn_show_lentmedia.setText(loans)
|
||||||
@@ -339,6 +347,7 @@ class MainUI(QtWidgets.QMainWindow, Ui_MainWindow):
|
|||||||
self.input_file_ident.setEnabled(True)
|
self.input_file_ident.setEnabled(True)
|
||||||
self.input_file_ident.setPlaceholderText("Buchidentifikation eingeben")
|
self.input_file_ident.setPlaceholderText("Buchidentifikation eingeben")
|
||||||
self.input_file_ident.setFocus()
|
self.input_file_ident.setFocus()
|
||||||
|
|
||||||
def moveToLine(self, line):
|
def moveToLine(self, line):
|
||||||
log.debug("Moving to Line", line)
|
log.debug("Moving to Line", line)
|
||||||
line.setFocus()
|
line.setFocus()
|
||||||
@@ -356,7 +365,9 @@ class MainUI(QtWidgets.QMainWindow, Ui_MainWindow):
|
|||||||
dialog.setWindowTitle("Ungültige Eingabe")
|
dialog.setWindowTitle("Ungültige Eingabe")
|
||||||
dialog.setIcon(QtWidgets.QMessageBox.Icon.Warning)
|
dialog.setIcon(QtWidgets.QMessageBox.Icon.Warning)
|
||||||
dialog.setWindowIcon(Icon("warning").overwriteColor("#EA3323"))
|
dialog.setWindowIcon(Icon("warning").overwriteColor("#EA3323"))
|
||||||
dialog.setText("Eingabe ist nicht in der Datenbank\nBitte prüfen und erneut eingeben")
|
dialog.setText(
|
||||||
|
"Eingabe ist nicht in der Datenbank\nBitte prüfen und erneut eingeben"
|
||||||
|
)
|
||||||
dialog.exec()
|
dialog.exec()
|
||||||
self.input_file_ident.setFocus()
|
self.input_file_ident.setFocus()
|
||||||
self.input_file_ident.clear()
|
self.input_file_ident.clear()
|
||||||
@@ -376,6 +387,7 @@ class MainUI(QtWidgets.QMainWindow, Ui_MainWindow):
|
|||||||
return
|
return
|
||||||
self.mediaAdd(value)
|
self.mediaAdd(value)
|
||||||
self.input_file_ident.setFocus()
|
self.input_file_ident.setFocus()
|
||||||
|
|
||||||
def mediaAdd(self, identifier):
|
def mediaAdd(self, identifier):
|
||||||
log.info("Adding Media", identifier=identifier)
|
log.info("Adding Media", identifier=identifier)
|
||||||
self.input_file_ident.clear()
|
self.input_file_ident.clear()
|
||||||
@@ -404,7 +416,7 @@ class MainUI(QtWidgets.QMainWindow, Ui_MainWindow):
|
|||||||
|
|
||||||
elif book_id:
|
elif book_id:
|
||||||
if isinstance(book_id, list) and len(book_id) > 1:
|
if isinstance(book_id, list) and len(book_id) > 1:
|
||||||
#print("Multiple Books found")
|
# print("Multiple Books found")
|
||||||
# TODO: implement book selection dialog
|
# TODO: implement book selection dialog
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
@@ -413,7 +425,7 @@ class MainUI(QtWidgets.QMainWindow, Ui_MainWindow):
|
|||||||
# check if book is already loaned
|
# check if book is already loaned
|
||||||
loaned = self.db.checkLoanState(book_id[0])
|
loaned = self.db.checkLoanState(book_id[0])
|
||||||
if loaned:
|
if loaned:
|
||||||
#print("Book already loaned")
|
# print("Book already loaned")
|
||||||
self.setStatusTipMessage("Buch bereits entliehen")
|
self.setStatusTipMessage("Buch bereits entliehen")
|
||||||
# dialog with yes no to create new entry
|
# dialog with yes no to create new entry
|
||||||
dialog = QtWidgets.QMessageBox()
|
dialog = QtWidgets.QMessageBox()
|
||||||
@@ -434,9 +446,11 @@ class MainUI(QtWidgets.QMainWindow, Ui_MainWindow):
|
|||||||
return
|
return
|
||||||
newentry = NewEntry([book_id[0]])
|
newentry = NewEntry([book_id[0]])
|
||||||
newentry.exec()
|
newentry.exec()
|
||||||
if newentry.result() == 1: # only create dialog if new entry was created
|
if (
|
||||||
|
newentry.result() == 1
|
||||||
|
): # only create dialog if new entry was created
|
||||||
self.setStatusTipMessage("Neues Exemplar hinzugefügt")
|
self.setStatusTipMessage("Neues Exemplar hinzugefügt")
|
||||||
#print(created_ids)
|
# print(created_ids)
|
||||||
self.input_file_ident.setEnabled(True)
|
self.input_file_ident.setEnabled(True)
|
||||||
newentries = newentry.newIds
|
newentries = newentry.newIds
|
||||||
if newentries:
|
if newentries:
|
||||||
@@ -446,7 +460,7 @@ class MainUI(QtWidgets.QMainWindow, Ui_MainWindow):
|
|||||||
log.info("inserted duplicated book into database")
|
log.info("inserted duplicated book into database")
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
#print("Book not loaned, loaning now")
|
# print("Book not loaned, loaning now")
|
||||||
self.loanMedia(user_id, book_id)
|
self.loanMedia(user_id, book_id)
|
||||||
|
|
||||||
def loanMedia(self, user_id, book_id):
|
def loanMedia(self, user_id, book_id):
|
||||||
@@ -457,7 +471,7 @@ class MainUI(QtWidgets.QMainWindow, Ui_MainWindow):
|
|||||||
self.duedate.date().toString("yyyy-MM-dd"),
|
self.duedate.date().toString("yyyy-MM-dd"),
|
||||||
)
|
)
|
||||||
media = self.db.getMedia(book_id[0])
|
media = self.db.getMedia(book_id[0])
|
||||||
#print(media)
|
# print(media)
|
||||||
self.mediaOverview.insertRow(0)
|
self.mediaOverview.insertRow(0)
|
||||||
self.mediaOverview.setItem(0, 0, QtWidgets.QTableWidgetItem(media.signature))
|
self.mediaOverview.setItem(0, 0, QtWidgets.QTableWidgetItem(media.signature))
|
||||||
self.mediaOverview.setItem(0, 1, QtWidgets.QTableWidgetItem(media.title))
|
self.mediaOverview.setItem(0, 1, QtWidgets.QTableWidgetItem(media.title))
|
||||||
@@ -473,19 +487,19 @@ class MainUI(QtWidgets.QMainWindow, Ui_MainWindow):
|
|||||||
self.input_file_ident.setEnabled(True)
|
self.input_file_ident.setEnabled(True)
|
||||||
|
|
||||||
def returnMedia(self, identifier):
|
def returnMedia(self, identifier):
|
||||||
#print("Returning Media", identifier)
|
# print("Returning Media", identifier)
|
||||||
# get book id from database
|
# get book id from database
|
||||||
# self.
|
# self.
|
||||||
identifier = Book(
|
identifier = Book(
|
||||||
isbn=identifier, title=identifier, signature=identifier, ppn=identifier
|
isbn=identifier, title=identifier, signature=identifier, ppn=identifier
|
||||||
)
|
)
|
||||||
book_id = self.db.checkMediaExists(identifier)
|
book_id = self.db.checkMediaExists(identifier)
|
||||||
#print(book_id)
|
# print(book_id)
|
||||||
if book_id:
|
if book_id:
|
||||||
# check if book is already loaned
|
# check if book is already loaned
|
||||||
loaned = self.db.checkLoanState(book_id[0])
|
loaned = self.db.checkLoanState(book_id[0])
|
||||||
if loaned:
|
if loaned:
|
||||||
#print("Book already loaned, returning now")
|
# print("Book already loaned, returning now")
|
||||||
user = self.db.getUserByLoan(book_id[0])
|
user = self.db.getUserByLoan(book_id[0])
|
||||||
# set userdata in lineedits
|
# set userdata in lineedits
|
||||||
self.activeUser = user
|
self.activeUser = user
|
||||||
@@ -494,7 +508,9 @@ class MainUI(QtWidgets.QMainWindow, Ui_MainWindow):
|
|||||||
book_id[0], self.currentDate.toString("yyyy-MM-dd")
|
book_id[0], self.currentDate.toString("yyyy-MM-dd")
|
||||||
)
|
)
|
||||||
self.mediaOverview.insertRow(0)
|
self.mediaOverview.insertRow(0)
|
||||||
self.mediaOverview.setItem(0, 0, QtWidgets.QTableWidgetItem(book.signature))
|
self.mediaOverview.setItem(
|
||||||
|
0, 0, QtWidgets.QTableWidgetItem(book.signature)
|
||||||
|
)
|
||||||
self.mediaOverview.setItem(0, 1, QtWidgets.QTableWidgetItem(book.title))
|
self.mediaOverview.setItem(0, 1, QtWidgets.QTableWidgetItem(book.title))
|
||||||
self.mediaOverview.setItem(
|
self.mediaOverview.setItem(
|
||||||
0, 2, QtWidgets.QTableWidgetItem("Zurückgegeben")
|
0, 2, QtWidgets.QTableWidgetItem("Zurückgegeben")
|
||||||
@@ -504,15 +520,13 @@ class MainUI(QtWidgets.QMainWindow, Ui_MainWindow):
|
|||||||
self.db.getActiveLoans(self.activeUser.id)
|
self.db.getActiveLoans(self.activeUser.id)
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
#print("Book not loaned")
|
# print("Book not loaned")
|
||||||
self.setStatusTipMessage("Buch nicht entliehen")
|
self.setStatusTipMessage("Buch nicht entliehen")
|
||||||
self.input_file_ident.clear()
|
self.input_file_ident.clear()
|
||||||
else:
|
else:
|
||||||
log.error("Book not found, identifier", identifier)
|
log.error("Book not found, identifier", identifier)
|
||||||
#print("Book not found")
|
# print("Book not found")
|
||||||
#self.input_file_ident.setPlaceholderText(f"Buch {identifier} nicht gefunden")
|
# self.input_file_ident.setPlaceholderText(f"Buch {identifier} nicht gefunden")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def setStatusTipMessage(self, message):
|
def setStatusTipMessage(self, message):
|
||||||
dialog = QtWidgets.QMessageBox()
|
dialog = QtWidgets.QMessageBox()
|
||||||
@@ -521,13 +535,15 @@ class MainUI(QtWidgets.QMainWindow, Ui_MainWindow):
|
|||||||
dialog.setWindowIcon(Icon("error").overwriteColor("#EA3323"))
|
dialog.setWindowIcon(Icon("error").overwriteColor("#EA3323"))
|
||||||
dialog.setText(message)
|
dialog.setText(message)
|
||||||
dialog.exec()
|
dialog.exec()
|
||||||
|
|
||||||
|
|
||||||
def exit_handler():
|
def exit_handler():
|
||||||
log.info(
|
log.info(
|
||||||
"Exiting, creating backup, renaming inactive users, creating report if day matches"
|
"Exiting, creating backup, renaming inactive users, creating report if day matches"
|
||||||
)
|
)
|
||||||
restore_config()
|
restore_config()
|
||||||
app = QtWidgets.QApplication(sys.argv)
|
app = QtWidgets.QApplication(sys.argv)
|
||||||
#print(backup.backup)
|
# print(backup.backup)
|
||||||
# generate report if monday
|
# generate report if monday
|
||||||
if datetime.datetime.now().weekday() == config.report.report_day:
|
if datetime.datetime.now().weekday() == config.report.report_day:
|
||||||
log.info("Generating Report")
|
log.info("Generating Report")
|
||||||
@@ -561,6 +577,8 @@ def exit_handler():
|
|||||||
dialog.exec()
|
dialog.exec()
|
||||||
log.info("Exiting")
|
log.info("Exiting")
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
|
|
||||||
def launch(*argv):
|
def launch(*argv):
|
||||||
options = sys.argv
|
options = sys.argv
|
||||||
if argv:
|
if argv:
|
||||||
@@ -588,18 +606,20 @@ def launch(*argv):
|
|||||||
atexit.register(exit_handler)
|
atexit.register(exit_handler)
|
||||||
sys.exit(app.exec())
|
sys.exit(app.exec())
|
||||||
# sys.exit(app.exec())
|
# sys.exit(app.exec())
|
||||||
#print("Launching Main UI")
|
# print("Launching Main UI")
|
||||||
#print(options)
|
# print(options)
|
||||||
QtCore.QLocale().setDefault(QtCore.QLocale(QtCore.QLocale.Language.German, QtCore.QLocale.Country.Germany))
|
QtCore.QLocale().setDefault(
|
||||||
|
QtCore.QLocale(QtCore.QLocale.Language.German, QtCore.QLocale.Country.Germany)
|
||||||
|
)
|
||||||
SYSTEM_LANGUAGE = QtCore.QLocale().system().name()
|
SYSTEM_LANGUAGE = QtCore.QLocale().system().name()
|
||||||
|
|
||||||
# Load base QT translations from the normal place
|
# Load base QT translations from the normal place
|
||||||
app = QtWidgets.QApplication([])
|
app = QtWidgets.QApplication([])
|
||||||
main_ui = MainUI()
|
main_ui = MainUI()
|
||||||
#translate ui to system language
|
# translate ui to system language
|
||||||
if SYSTEM_LANGUAGE:
|
if SYSTEM_LANGUAGE:
|
||||||
translator = QtCore.QTranslator()
|
translator = QtCore.QTranslator()
|
||||||
#do not use ascii encoding
|
# do not use ascii encoding
|
||||||
translator.load(f"qt_{SYSTEM_LANGUAGE}", "translations")
|
translator.load(f"qt_{SYSTEM_LANGUAGE}", "translations")
|
||||||
translator.load("app.qm", "translations")
|
translator.load("app.qm", "translations")
|
||||||
app.installTranslator(translator)
|
app.installTranslator(translator)
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ class MultiUserFound(QtWidgets.QDialog, Ui_Dialog):
|
|||||||
self.tableWidget.cellClicked.connect(self.selectUser)
|
self.tableWidget.cellClicked.connect(self.selectUser)
|
||||||
|
|
||||||
def selectUser(self, row, column):
|
def selectUser(self, row, column):
|
||||||
#print(row, column)
|
# print(row, column)
|
||||||
user = User(
|
user = User(
|
||||||
userid=self.tableWidget.item(row, 0).text(),
|
userid=self.tableWidget.item(row, 0).text(),
|
||||||
username=self.tableWidget.item(row, 1).text(),
|
username=self.tableWidget.item(row, 1).text(),
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ from src.logic import Database
|
|||||||
from src.schemas import Book
|
from src.schemas import Book
|
||||||
from src.utils import Icon
|
from src.utils import Icon
|
||||||
|
|
||||||
|
|
||||||
class NewEntry(QtWidgets.QDialog, Ui_Dialog):
|
class NewEntry(QtWidgets.QDialog, Ui_Dialog):
|
||||||
def __init__(self, title_id: list[int]):
|
def __init__(self, title_id: list[int]):
|
||||||
super(NewEntry, self).__init__()
|
super(NewEntry, self).__init__()
|
||||||
@@ -19,15 +20,15 @@ class NewEntry(QtWidgets.QDialog, Ui_Dialog):
|
|||||||
self.populateTable()
|
self.populateTable()
|
||||||
self.btn_addNewBook.clicked.connect(self.addEntry)
|
self.btn_addNewBook.clicked.connect(self.addEntry)
|
||||||
self.buttonBox.accepted.connect(self.insertEntry)
|
self.buttonBox.accepted.connect(self.insertEntry)
|
||||||
#disable buttonbox accepted
|
# disable buttonbox accepted
|
||||||
self.buttonBox.button(
|
self.buttonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Ok).setEnabled(
|
||||||
QtWidgets.QDialogButtonBox.StandardButton.Ok
|
False
|
||||||
).setEnabled(False)
|
)
|
||||||
|
|
||||||
def addEntry(self):
|
def addEntry(self):
|
||||||
self.buttonBox.button(
|
self.buttonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Ok).setEnabled(
|
||||||
QtWidgets.QDialogButtonBox.StandardButton.Ok
|
True
|
||||||
).setEnabled(True)
|
)
|
||||||
# clone last row and its data
|
# clone last row and its data
|
||||||
row = self.tableWidget.rowCount()
|
row = self.tableWidget.rowCount()
|
||||||
self.tableWidget.insertRow(row)
|
self.tableWidget.insertRow(row)
|
||||||
@@ -45,9 +46,10 @@ class NewEntry(QtWidgets.QDialog, Ui_Dialog):
|
|||||||
self.tableWidget.item(row, i).text().split("+")[0] + "+" + entry
|
self.tableWidget.item(row, i).text().split("+")[0] + "+" + entry
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
def populateTable(self):
|
def populateTable(self):
|
||||||
for title in self.titles:
|
for title in self.titles:
|
||||||
#print(title)
|
# print(title)
|
||||||
entries = self.db.getMediaSimilarSignatureByID(title)
|
entries = self.db.getMediaSimilarSignatureByID(title)
|
||||||
# sort by signature
|
# sort by signature
|
||||||
entries.sort(key=lambda x: x.signature, reverse=True)
|
entries.sort(key=lambda x: x.signature, reverse=True)
|
||||||
@@ -73,7 +75,7 @@ class NewEntry(QtWidgets.QDialog, Ui_Dialog):
|
|||||||
signature=signature,
|
signature=signature,
|
||||||
ppn=eval(ppn),
|
ppn=eval(ppn),
|
||||||
)
|
)
|
||||||
#print(book)
|
# print(book)
|
||||||
if not self.db.checkMediaExists(book):
|
if not self.db.checkMediaExists(book):
|
||||||
newBookId = self.db.insertMedia(book)
|
newBookId = self.db.insertMedia(book)
|
||||||
self.newIds.append(newBookId)
|
self.newIds.append(newBookId)
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ class ReportUi(QtWidgets.QDialog, Ui_Dialog):
|
|||||||
def report_generated(self):
|
def report_generated(self):
|
||||||
self.reportlink.setOpenExternalLinks(True)
|
self.reportlink.setOpenExternalLinks(True)
|
||||||
fileformat = self.rthread.format
|
fileformat = self.rthread.format
|
||||||
#print(fileformat)
|
# print(fileformat)
|
||||||
self.reportlink.setText(
|
self.reportlink.setText(
|
||||||
f'<a href="file:///{os.getcwd()}/report.{fileformat}">Report</a>'
|
f'<a href="file:///{os.getcwd()}/report.{fileformat}">Report</a>'
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -5,13 +5,14 @@ from src.utils import Icon
|
|||||||
from omegaconf import OmegaConf
|
from omegaconf import OmegaConf
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
|
||||||
class Settings(QtWidgets.QDialog, Ui_Dialog):
|
class Settings(QtWidgets.QDialog, Ui_Dialog):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super(Settings, self).__init__()
|
super(Settings, self).__init__()
|
||||||
self.setupUi(self)
|
self.setupUi(self)
|
||||||
self.setWindowTitle("Einstellungen")
|
self.setWindowTitle("Einstellungen")
|
||||||
self.setWindowIcon(Icon("settings").icon)
|
self.setWindowIcon(Icon("settings").icon)
|
||||||
#variables
|
# variables
|
||||||
self.originalSettings = config.to_Omegaconf()
|
self.originalSettings = config.to_Omegaconf()
|
||||||
self.changedSettings = config.to_Omegaconf()
|
self.changedSettings = config.to_Omegaconf()
|
||||||
self.shortcuts = config.shortcuts
|
self.shortcuts = config.shortcuts
|
||||||
@@ -19,13 +20,11 @@ class Settings(QtWidgets.QDialog, Ui_Dialog):
|
|||||||
self.settingschanged = False
|
self.settingschanged = False
|
||||||
self.restart_required = False
|
self.restart_required = False
|
||||||
|
|
||||||
|
|
||||||
# buttonbox
|
# buttonbox
|
||||||
self.buttonBox.accepted.connect(self.saveSettings)
|
self.buttonBox.accepted.connect(self.saveSettings)
|
||||||
self.buttonBox.rejected.connect(self.close)
|
self.buttonBox.rejected.connect(self.close)
|
||||||
self.loadSettings()
|
self.loadSettings()
|
||||||
|
|
||||||
|
|
||||||
self.populateShortcuts()
|
self.populateShortcuts()
|
||||||
# buttons
|
# buttons
|
||||||
self.btn_select_database_backupLocation.clicked.connect(
|
self.btn_select_database_backupLocation.clicked.connect(
|
||||||
@@ -36,10 +35,12 @@ class Settings(QtWidgets.QDialog, Ui_Dialog):
|
|||||||
self.btn_select_report_path.clicked.connect(self.selectReportPath)
|
self.btn_select_report_path.clicked.connect(self.selectReportPath)
|
||||||
self.returnMode.clicked.connect(self.returnModeSetting)
|
self.returnMode.clicked.connect(self.returnModeSetting)
|
||||||
|
|
||||||
|
# other
|
||||||
|
# stretch columns
|
||||||
|
self.shortcutchanger.horizontalHeader().setSectionResizeMode(
|
||||||
|
0, QtWidgets.QHeaderView.ResizeMode.Stretch
|
||||||
|
)
|
||||||
|
|
||||||
#other
|
|
||||||
#stretch columns
|
|
||||||
self.shortcutchanger.horizontalHeader().setSectionResizeMode(0, QtWidgets.QHeaderView.ResizeMode.Stretch)
|
|
||||||
def returnModeSetting(self):
|
def returnModeSetting(self):
|
||||||
currentstate = self.returnMode.isChecked()
|
currentstate = self.returnMode.isChecked()
|
||||||
if self.originalSettings.advanced_refresh != currentstate:
|
if self.originalSettings.advanced_refresh != currentstate:
|
||||||
@@ -51,16 +52,17 @@ class Settings(QtWidgets.QDialog, Ui_Dialog):
|
|||||||
default = shortcut["default"]
|
default = shortcut["default"]
|
||||||
current = shortcut["current"]
|
current = shortcut["current"]
|
||||||
self.addShortcut(name, default, current)
|
self.addShortcut(name, default, current)
|
||||||
#assume the shortcuts will be changed
|
# assume the shortcuts will be changed
|
||||||
self.settingschanged = True
|
self.settingschanged = True
|
||||||
|
|
||||||
def addShortcut(self, name, default, current):
|
def addShortcut(self, name, default, current):
|
||||||
#remove all pages from shortcutchanger
|
# remove all pages from shortcutchanger
|
||||||
#add new page with name, default and current
|
# add new page with name, default and current
|
||||||
|
|
||||||
self.shortcutchanger.insertRow(0)
|
self.shortcutchanger.insertRow(0)
|
||||||
self.shortcutchanger.setItem(0, 0, QtWidgets.QTableWidgetItem(name))
|
self.shortcutchanger.setItem(0, 0, QtWidgets.QTableWidgetItem(name))
|
||||||
self.shortcutchanger.setItem(0, 1, QtWidgets.QTableWidgetItem(default))
|
self.shortcutchanger.setItem(0, 1, QtWidgets.QTableWidgetItem(default))
|
||||||
#add keysequenceedit
|
# add keysequenceedit
|
||||||
keysequenceedit = QtWidgets.QKeySequenceEdit()
|
keysequenceedit = QtWidgets.QKeySequenceEdit()
|
||||||
keysequenceedit.setKeySequence(current)
|
keysequenceedit.setKeySequence(current)
|
||||||
self.shortcutchanger.setCellWidget(0, 2, keysequenceedit)
|
self.shortcutchanger.setCellWidget(0, 2, keysequenceedit)
|
||||||
@@ -160,16 +162,13 @@ class Settings(QtWidgets.QDialog, Ui_Dialog):
|
|||||||
report_path = self.report_path.text()
|
report_path = self.report_path.text()
|
||||||
refresh_state = self.returnMode.isChecked()
|
refresh_state = self.returnMode.isChecked()
|
||||||
shortcuts = self.getShortcuts()
|
shortcuts = self.getShortcuts()
|
||||||
#shortcuts to omegaconf.DictConfig
|
# shortcuts to omegaconf.DictConfig
|
||||||
shortcuts = OmegaConf.create(shortcuts)
|
shortcuts = OmegaConf.create(shortcuts)
|
||||||
|
|
||||||
|
if database_path != self.originalSettings.database.path:
|
||||||
if database_path != self.originalSettings.database.path :
|
|
||||||
os.makedirs(database_path, exist_ok=True)
|
os.makedirs(database_path, exist_ok=True)
|
||||||
self.restart_required = True
|
self.restart_required = True
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# create new Settings
|
# create new Settings
|
||||||
self.changedSettings.institution_name = institution_name
|
self.changedSettings.institution_name = institution_name
|
||||||
self.changedSettings.loan_duration = default_loan_duration
|
self.changedSettings.loan_duration = default_loan_duration
|
||||||
@@ -186,74 +185,66 @@ class Settings(QtWidgets.QDialog, Ui_Dialog):
|
|||||||
changed = self.changedSettings
|
changed = self.changedSettings
|
||||||
original = self.originalSettings
|
original = self.originalSettings
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if changed == original:
|
if changed == original:
|
||||||
self.settingschanged = False
|
self.settingschanged = False
|
||||||
self.restart_required = False
|
self.restart_required = False
|
||||||
log.info("Settings not changed")
|
log.info("Settings not changed")
|
||||||
else:
|
else:
|
||||||
self.settingschanged = True
|
self.settingschanged = True
|
||||||
#compare if database or shortcuts were changed
|
# compare if database or shortcuts were changed
|
||||||
database = original.database == changed.database
|
database = original.database == changed.database
|
||||||
shortcuts = self.shortcuts == self.sortShortcuts(changed.shortcuts)
|
shortcuts = self.shortcuts == self.sortShortcuts(changed.shortcuts)
|
||||||
if not database or not shortcuts:
|
if not database or not shortcuts:
|
||||||
self.restart_required = True
|
self.restart_required = True
|
||||||
log.info(
|
log.info(
|
||||||
f"Settings changed, restart required: {self.restart_required}",
|
f"Settings changed, restart required: {self.restart_required}",
|
||||||
database=database,
|
|
||||||
shortcuts=shortcuts,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# save the new settings
|
# save the new settings
|
||||||
if self.settingschanged:
|
if self.settingschanged:
|
||||||
# save the settings
|
# save the settings
|
||||||
config.updateValue("institution_name", self.changedSettings.institution_name)
|
config.updateValue(
|
||||||
config.updateValue("default_loan_duration", self.changedSettings.loan_duration)
|
"institution_name", self.changedSettings.institution_name
|
||||||
config.updateValue("database.backupLocation", self.changedSettings.database.backupLocation)
|
)
|
||||||
|
config.updateValue(
|
||||||
|
"default_loan_duration", self.changedSettings.loan_duration
|
||||||
|
)
|
||||||
|
config.updateValue(
|
||||||
|
"database.backupLocation", self.changedSettings.database.backupLocation
|
||||||
|
)
|
||||||
config.updateValue("database.path", self.changedSettings.database.path)
|
config.updateValue("database.path", self.changedSettings.database.path)
|
||||||
config.updateValue("database.name", self.changedSettings.database.name)
|
config.updateValue("database.name", self.changedSettings.database.name)
|
||||||
config.updateValue("inactive_user_deletion", self.changedSettings.inactive_user_deletion)
|
config.updateValue(
|
||||||
config.updateValue("report.report_day", self.changedSettings.report.report_day)
|
"inactive_user_deletion", self.changedSettings.inactive_user_deletion
|
||||||
config.updateValue("report.generate_report", self.changedSettings.report.generate_report)
|
)
|
||||||
|
config.updateValue(
|
||||||
|
"report.report_day", self.changedSettings.report.report_day
|
||||||
|
)
|
||||||
|
config.updateValue(
|
||||||
|
"report.generate_report", self.changedSettings.report.generate_report
|
||||||
|
)
|
||||||
config.updateValue("report.path", self.changedSettings.report.path)
|
config.updateValue("report.path", self.changedSettings.report.path)
|
||||||
config.updateValue("advanced_refresh", self.changedSettings.advanced_refresh)
|
config.updateValue(
|
||||||
|
"advanced_refresh", self.changedSettings.advanced_refresh
|
||||||
|
)
|
||||||
config.updateValue("shortcuts", self.changedSettings.shortcuts)
|
config.updateValue("shortcuts", self.changedSettings.shortcuts)
|
||||||
self.originalSettings = self.changedSettings
|
self.originalSettings = self.changedSettings
|
||||||
config.save()
|
config.save()
|
||||||
|
|
||||||
if self.restart_required:
|
|
||||||
self.restart()
|
|
||||||
self.close()
|
self.close()
|
||||||
|
|
||||||
def restart(self):
|
|
||||||
dialog = QtWidgets.QMessageBox()
|
|
||||||
dialog.setIcon(QtWidgets.QMessageBox.Icon.Information)
|
|
||||||
dialog.setText("Neustart erforderlich")
|
|
||||||
dialog.setInformativeText(
|
|
||||||
"Das Programm muss neu gestartet werden, um die Änderungen zu übernehmen."
|
|
||||||
)
|
|
||||||
dialog.setStandardButtons(QtWidgets.QMessageBox.StandardButton.Ok)
|
|
||||||
dialog.setDefaultButton(QtWidgets.QMessageBox.StandardButton.Ok)
|
|
||||||
dialog.setWindowTitle("Neustart erforderlich")
|
|
||||||
dialog.setWindowIcon(Icon("restart").icon)
|
|
||||||
dialog.exec()
|
|
||||||
|
|
||||||
def DiscardSettings(self):
|
def DiscardSettings(self):
|
||||||
self.loadSettings()
|
self.loadSettings()
|
||||||
self.restart_required = False
|
self.restart_required = False
|
||||||
self.settingschanged = False
|
self.settingschanged = False
|
||||||
|
|
||||||
def loadSettings(self):
|
def loadSettings(self):
|
||||||
self.institution_name.setText(config.institution_name)
|
self.institution_name.setText(config.institution_name)
|
||||||
self.default_loan_duration.setValue(
|
self.default_loan_duration.setValue(int(config.loan_duration))
|
||||||
int(config.loan_duration)
|
|
||||||
)
|
|
||||||
self.delete_inactive_user_duration.setValue(
|
self.delete_inactive_user_duration.setValue(
|
||||||
int(config.delete_inactive_user_duration)
|
int(config.delete_inactive_user_duration)
|
||||||
)
|
)
|
||||||
self.database_backupLocation.setText(
|
self.database_backupLocation.setText(config.database.backupLocation)
|
||||||
config.database.backupLocation
|
|
||||||
)
|
|
||||||
self.database_path.setText(config.database.path)
|
self.database_path.setText(config.database.path)
|
||||||
self.database_name.setText(config.database.name)
|
self.database_name.setText(config.database.name)
|
||||||
self.report_day.setCurrentIndex(config.report.report_day)
|
self.report_day.setCurrentIndex(config.report.report_day)
|
||||||
|
|||||||
@@ -17,7 +17,12 @@ class Ui_Dialog(object):
|
|||||||
self.verticalLayout.setObjectName("verticalLayout")
|
self.verticalLayout.setObjectName("verticalLayout")
|
||||||
self.horizontalLayout = QtWidgets.QHBoxLayout()
|
self.horizontalLayout = QtWidgets.QHBoxLayout()
|
||||||
self.horizontalLayout.setObjectName("horizontalLayout")
|
self.horizontalLayout.setObjectName("horizontalLayout")
|
||||||
spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Minimum)
|
spacerItem = QtWidgets.QSpacerItem(
|
||||||
|
40,
|
||||||
|
20,
|
||||||
|
QtWidgets.QSizePolicy.Policy.Expanding,
|
||||||
|
QtWidgets.QSizePolicy.Policy.Minimum,
|
||||||
|
)
|
||||||
self.horizontalLayout.addItem(spacerItem)
|
self.horizontalLayout.addItem(spacerItem)
|
||||||
self.btn_addNewBook = QtWidgets.QToolButton(parent=Dialog)
|
self.btn_addNewBook = QtWidgets.QToolButton(parent=Dialog)
|
||||||
self.btn_addNewBook.setObjectName("btn_addNewBook")
|
self.btn_addNewBook.setObjectName("btn_addNewBook")
|
||||||
@@ -38,13 +43,16 @@ class Ui_Dialog(object):
|
|||||||
self.verticalLayout.addWidget(self.tableWidget)
|
self.verticalLayout.addWidget(self.tableWidget)
|
||||||
self.buttonBox = QtWidgets.QDialogButtonBox(parent=Dialog)
|
self.buttonBox = QtWidgets.QDialogButtonBox(parent=Dialog)
|
||||||
self.buttonBox.setOrientation(QtCore.Qt.Orientation.Horizontal)
|
self.buttonBox.setOrientation(QtCore.Qt.Orientation.Horizontal)
|
||||||
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.buttonBox.setObjectName("buttonBox")
|
||||||
self.verticalLayout.addWidget(self.buttonBox)
|
self.verticalLayout.addWidget(self.buttonBox)
|
||||||
|
|
||||||
self.retranslateUi(Dialog)
|
self.retranslateUi(Dialog)
|
||||||
self.buttonBox.accepted.connect(Dialog.accept) # type: ignore
|
self.buttonBox.accepted.connect(Dialog.accept) # type: ignore
|
||||||
self.buttonBox.rejected.connect(Dialog.reject) # type: ignore
|
self.buttonBox.rejected.connect(Dialog.reject) # type: ignore
|
||||||
QtCore.QMetaObject.connectSlotsByName(Dialog)
|
QtCore.QMetaObject.connectSlotsByName(Dialog)
|
||||||
|
|
||||||
def retranslateUi(self, Dialog):
|
def retranslateUi(self, Dialog):
|
||||||
|
|||||||
@@ -37,15 +37,23 @@ class Ui_Dialog(object):
|
|||||||
self.gridLayout.addWidget(self.username, 0, 1, 1, 1)
|
self.gridLayout.addWidget(self.username, 0, 1, 1, 1)
|
||||||
self.buttonBox = QtWidgets.QDialogButtonBox(parent=Dialog)
|
self.buttonBox = QtWidgets.QDialogButtonBox(parent=Dialog)
|
||||||
self.buttonBox.setOrientation(QtCore.Qt.Orientation.Horizontal)
|
self.buttonBox.setOrientation(QtCore.Qt.Orientation.Horizontal)
|
||||||
self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.StandardButton.Cancel|QtWidgets.QDialogButtonBox.StandardButton.Save)
|
self.buttonBox.setStandardButtons(
|
||||||
|
QtWidgets.QDialogButtonBox.StandardButton.Cancel
|
||||||
|
| QtWidgets.QDialogButtonBox.StandardButton.Save
|
||||||
|
)
|
||||||
self.buttonBox.setObjectName("buttonBox")
|
self.buttonBox.setObjectName("buttonBox")
|
||||||
self.gridLayout.addWidget(self.buttonBox, 4, 1, 1, 1)
|
self.gridLayout.addWidget(self.buttonBox, 4, 1, 1, 1)
|
||||||
spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Policy.Minimum, QtWidgets.QSizePolicy.Policy.Expanding)
|
spacerItem = QtWidgets.QSpacerItem(
|
||||||
|
20,
|
||||||
|
40,
|
||||||
|
QtWidgets.QSizePolicy.Policy.Minimum,
|
||||||
|
QtWidgets.QSizePolicy.Policy.Expanding,
|
||||||
|
)
|
||||||
self.gridLayout.addItem(spacerItem, 3, 0, 1, 1)
|
self.gridLayout.addItem(spacerItem, 3, 0, 1, 1)
|
||||||
|
|
||||||
self.retranslateUi(Dialog)
|
self.retranslateUi(Dialog)
|
||||||
self.buttonBox.accepted.connect(Dialog.accept) # type: ignore
|
self.buttonBox.accepted.connect(Dialog.accept) # type: ignore
|
||||||
self.buttonBox.rejected.connect(Dialog.reject) # type: ignore
|
self.buttonBox.rejected.connect(Dialog.reject) # type: ignore
|
||||||
QtCore.QMetaObject.connectSlotsByName(Dialog)
|
QtCore.QMetaObject.connectSlotsByName(Dialog)
|
||||||
Dialog.setTabOrder(self.username, self.userno)
|
Dialog.setTabOrder(self.username, self.userno)
|
||||||
Dialog.setTabOrder(self.userno, self.user_mail)
|
Dialog.setTabOrder(self.userno, self.user_mail)
|
||||||
|
|||||||
@@ -21,7 +21,10 @@ class Ui_Dialog(object):
|
|||||||
self.gridLayout.addWidget(self.extenduntil, 1, 2, 1, 1)
|
self.gridLayout.addWidget(self.extenduntil, 1, 2, 1, 1)
|
||||||
self.buttonBox = QtWidgets.QDialogButtonBox(parent=Dialog)
|
self.buttonBox = QtWidgets.QDialogButtonBox(parent=Dialog)
|
||||||
self.buttonBox.setOrientation(QtCore.Qt.Orientation.Horizontal)
|
self.buttonBox.setOrientation(QtCore.Qt.Orientation.Horizontal)
|
||||||
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.buttonBox.setObjectName("buttonBox")
|
||||||
self.gridLayout.addWidget(self.buttonBox, 2, 2, 1, 1)
|
self.gridLayout.addWidget(self.buttonBox, 2, 2, 1, 1)
|
||||||
self.label = QtWidgets.QLabel(parent=Dialog)
|
self.label = QtWidgets.QLabel(parent=Dialog)
|
||||||
@@ -33,11 +36,13 @@ class Ui_Dialog(object):
|
|||||||
self.gridLayout.addWidget(self.label, 0, 2, 1, 1)
|
self.gridLayout.addWidget(self.label, 0, 2, 1, 1)
|
||||||
|
|
||||||
self.retranslateUi(Dialog)
|
self.retranslateUi(Dialog)
|
||||||
self.buttonBox.accepted.connect(Dialog.accept) # type: ignore
|
self.buttonBox.accepted.connect(Dialog.accept) # type: ignore
|
||||||
self.buttonBox.rejected.connect(Dialog.reject) # type: ignore
|
self.buttonBox.rejected.connect(Dialog.reject) # type: ignore
|
||||||
QtCore.QMetaObject.connectSlotsByName(Dialog)
|
QtCore.QMetaObject.connectSlotsByName(Dialog)
|
||||||
|
|
||||||
def retranslateUi(self, Dialog):
|
def retranslateUi(self, Dialog):
|
||||||
_translate = QtCore.QCoreApplication.translate
|
_translate = QtCore.QCoreApplication.translate
|
||||||
Dialog.setWindowTitle(_translate("Dialog", "Dialog"))
|
Dialog.setWindowTitle(_translate("Dialog", "Dialog"))
|
||||||
self.label.setText(_translate("Dialog", "Bitte das Verlängerungsdatum auswählen"))
|
self.label.setText(
|
||||||
|
_translate("Dialog", "Bitte das Verlängerungsdatum auswählen")
|
||||||
|
)
|
||||||
|
|||||||
@@ -37,7 +37,9 @@ class Ui_Dialog(object):
|
|||||||
self.horizontalLayout.addWidget(self.radio_year)
|
self.horizontalLayout.addWidget(self.radio_year)
|
||||||
self.gridLayout.addLayout(self.horizontalLayout, 1, 1, 1, 1)
|
self.gridLayout.addLayout(self.horizontalLayout, 1, 1, 1, 1)
|
||||||
self.dayValue = QtWidgets.QLineEdit(parent=Dialog)
|
self.dayValue = QtWidgets.QLineEdit(parent=Dialog)
|
||||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Fixed, QtWidgets.QSizePolicy.Policy.Fixed)
|
sizePolicy = QtWidgets.QSizePolicy(
|
||||||
|
QtWidgets.QSizePolicy.Policy.Fixed, QtWidgets.QSizePolicy.Policy.Fixed
|
||||||
|
)
|
||||||
sizePolicy.setHorizontalStretch(0)
|
sizePolicy.setHorizontalStretch(0)
|
||||||
sizePolicy.setVerticalStretch(0)
|
sizePolicy.setVerticalStretch(0)
|
||||||
sizePolicy.setHeightForWidth(self.dayValue.sizePolicy().hasHeightForWidth())
|
sizePolicy.setHeightForWidth(self.dayValue.sizePolicy().hasHeightForWidth())
|
||||||
@@ -107,7 +109,9 @@ class Ui_Dialog(object):
|
|||||||
def retranslateUi(self, Dialog):
|
def retranslateUi(self, Dialog):
|
||||||
_translate = QtCore.QCoreApplication.translate
|
_translate = QtCore.QCoreApplication.translate
|
||||||
Dialog.setWindowTitle(_translate("Dialog", "Dialog"))
|
Dialog.setWindowTitle(_translate("Dialog", "Dialog"))
|
||||||
self.label.setText(_translate("Dialog", "Wieviele Tage sollen im Bericht erfasst werden?"))
|
self.label.setText(
|
||||||
|
_translate("Dialog", "Wieviele Tage sollen im Bericht erfasst werden?")
|
||||||
|
)
|
||||||
self.label_2.setText(_translate("Dialog", "Tage"))
|
self.label_2.setText(_translate("Dialog", "Tage"))
|
||||||
self.radio_week.setText(_translate("Dialog", "Woche"))
|
self.radio_week.setText(_translate("Dialog", "Woche"))
|
||||||
self.radio_month.setText(_translate("Dialog", "Monat"))
|
self.radio_month.setText(_translate("Dialog", "Monat"))
|
||||||
|
|||||||
@@ -20,13 +20,16 @@ class Ui_Dialog(object):
|
|||||||
self.horizontalLayout.addWidget(self.textEdit)
|
self.horizontalLayout.addWidget(self.textEdit)
|
||||||
self.buttonBox = QtWidgets.QDialogButtonBox(parent=Dialog)
|
self.buttonBox = QtWidgets.QDialogButtonBox(parent=Dialog)
|
||||||
self.buttonBox.setOrientation(QtCore.Qt.Orientation.Vertical)
|
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.buttonBox.setObjectName("buttonBox")
|
||||||
self.horizontalLayout.addWidget(self.buttonBox)
|
self.horizontalLayout.addWidget(self.buttonBox)
|
||||||
|
|
||||||
self.retranslateUi(Dialog)
|
self.retranslateUi(Dialog)
|
||||||
self.buttonBox.accepted.connect(Dialog.accept) # type: ignore
|
self.buttonBox.accepted.connect(Dialog.accept) # type: ignore
|
||||||
self.buttonBox.rejected.connect(Dialog.reject) # type: ignore
|
self.buttonBox.rejected.connect(Dialog.reject) # type: ignore
|
||||||
QtCore.QMetaObject.connectSlotsByName(Dialog)
|
QtCore.QMetaObject.connectSlotsByName(Dialog)
|
||||||
|
|
||||||
def retranslateUi(self, Dialog):
|
def retranslateUi(self, Dialog):
|
||||||
|
|||||||
@@ -19,8 +19,12 @@ class Ui_Dialog(object):
|
|||||||
self.label.setObjectName("label")
|
self.label.setObjectName("label")
|
||||||
self.verticalLayout.addWidget(self.label)
|
self.verticalLayout.addWidget(self.label)
|
||||||
self.tableWidget = QtWidgets.QTableWidget(parent=Dialog)
|
self.tableWidget = QtWidgets.QTableWidget(parent=Dialog)
|
||||||
self.tableWidget.setEditTriggers(QtWidgets.QAbstractItemView.EditTrigger.NoEditTriggers)
|
self.tableWidget.setEditTriggers(
|
||||||
self.tableWidget.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectionBehavior.SelectRows)
|
QtWidgets.QAbstractItemView.EditTrigger.NoEditTriggers
|
||||||
|
)
|
||||||
|
self.tableWidget.setSelectionBehavior(
|
||||||
|
QtWidgets.QAbstractItemView.SelectionBehavior.SelectRows
|
||||||
|
)
|
||||||
self.tableWidget.setObjectName("tableWidget")
|
self.tableWidget.setObjectName("tableWidget")
|
||||||
self.tableWidget.setColumnCount(3)
|
self.tableWidget.setColumnCount(3)
|
||||||
self.tableWidget.setRowCount(0)
|
self.tableWidget.setRowCount(0)
|
||||||
@@ -33,19 +37,27 @@ class Ui_Dialog(object):
|
|||||||
self.verticalLayout.addWidget(self.tableWidget)
|
self.verticalLayout.addWidget(self.tableWidget)
|
||||||
self.buttonBox = QtWidgets.QDialogButtonBox(parent=Dialog)
|
self.buttonBox = QtWidgets.QDialogButtonBox(parent=Dialog)
|
||||||
self.buttonBox.setOrientation(QtCore.Qt.Orientation.Horizontal)
|
self.buttonBox.setOrientation(QtCore.Qt.Orientation.Horizontal)
|
||||||
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.buttonBox.setObjectName("buttonBox")
|
||||||
self.verticalLayout.addWidget(self.buttonBox)
|
self.verticalLayout.addWidget(self.buttonBox)
|
||||||
|
|
||||||
self.retranslateUi(Dialog)
|
self.retranslateUi(Dialog)
|
||||||
self.buttonBox.accepted.connect(Dialog.accept) # type: ignore
|
self.buttonBox.accepted.connect(Dialog.accept) # type: ignore
|
||||||
self.buttonBox.rejected.connect(Dialog.reject) # type: ignore
|
self.buttonBox.rejected.connect(Dialog.reject) # type: ignore
|
||||||
QtCore.QMetaObject.connectSlotsByName(Dialog)
|
QtCore.QMetaObject.connectSlotsByName(Dialog)
|
||||||
|
|
||||||
def retranslateUi(self, Dialog):
|
def retranslateUi(self, Dialog):
|
||||||
_translate = QtCore.QCoreApplication.translate
|
_translate = QtCore.QCoreApplication.translate
|
||||||
Dialog.setWindowTitle(_translate("Dialog", "Dialog"))
|
Dialog.setWindowTitle(_translate("Dialog", "Dialog"))
|
||||||
self.label.setText(_translate("Dialog", "Es wurden mehrere passende Personen gefunden. Bitte die richtige Person auswählen."))
|
self.label.setText(
|
||||||
|
_translate(
|
||||||
|
"Dialog",
|
||||||
|
"Es wurden mehrere passende Personen gefunden. Bitte die richtige Person auswählen.",
|
||||||
|
)
|
||||||
|
)
|
||||||
item = self.tableWidget.horizontalHeaderItem(0)
|
item = self.tableWidget.horizontalHeaderItem(0)
|
||||||
item.setText(_translate("Dialog", "Matrikelnr."))
|
item.setText(_translate("Dialog", "Matrikelnr."))
|
||||||
item = self.tableWidget.horizontalHeaderItem(1)
|
item = self.tableWidget.horizontalHeaderItem(1)
|
||||||
|
|||||||
@@ -17,13 +17,19 @@ class Ui_Dialog(object):
|
|||||||
self.formLayout.setObjectName("formLayout")
|
self.formLayout.setObjectName("formLayout")
|
||||||
self.label = QtWidgets.QLabel(parent=Dialog)
|
self.label = QtWidgets.QLabel(parent=Dialog)
|
||||||
self.label.setObjectName("label")
|
self.label.setObjectName("label")
|
||||||
self.formLayout.setWidget(0, QtWidgets.QFormLayout.ItemRole.LabelRole, self.label)
|
self.formLayout.setWidget(
|
||||||
|
0, QtWidgets.QFormLayout.ItemRole.LabelRole, self.label
|
||||||
|
)
|
||||||
self.institution_name = QtWidgets.QLineEdit(parent=Dialog)
|
self.institution_name = QtWidgets.QLineEdit(parent=Dialog)
|
||||||
self.institution_name.setObjectName("institution_name")
|
self.institution_name.setObjectName("institution_name")
|
||||||
self.formLayout.setWidget(0, QtWidgets.QFormLayout.ItemRole.FieldRole, self.institution_name)
|
self.formLayout.setWidget(
|
||||||
|
0, QtWidgets.QFormLayout.ItemRole.FieldRole, self.institution_name
|
||||||
|
)
|
||||||
self.label_2 = QtWidgets.QLabel(parent=Dialog)
|
self.label_2 = QtWidgets.QLabel(parent=Dialog)
|
||||||
self.label_2.setObjectName("label_2")
|
self.label_2.setObjectName("label_2")
|
||||||
self.formLayout.setWidget(1, QtWidgets.QFormLayout.ItemRole.LabelRole, self.label_2)
|
self.formLayout.setWidget(
|
||||||
|
1, QtWidgets.QFormLayout.ItemRole.LabelRole, self.label_2
|
||||||
|
)
|
||||||
self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
|
self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
|
||||||
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
|
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
|
||||||
self.default_loan_duration = QtWidgets.QSpinBox(parent=Dialog)
|
self.default_loan_duration = QtWidgets.QSpinBox(parent=Dialog)
|
||||||
@@ -34,29 +40,41 @@ class Ui_Dialog(object):
|
|||||||
self.label_13.setMaximumSize(QtCore.QSize(43, 16777215))
|
self.label_13.setMaximumSize(QtCore.QSize(43, 16777215))
|
||||||
self.label_13.setObjectName("label_13")
|
self.label_13.setObjectName("label_13")
|
||||||
self.horizontalLayout_2.addWidget(self.label_13)
|
self.horizontalLayout_2.addWidget(self.label_13)
|
||||||
self.formLayout.setLayout(1, QtWidgets.QFormLayout.ItemRole.FieldRole, self.horizontalLayout_2)
|
self.formLayout.setLayout(
|
||||||
|
1, QtWidgets.QFormLayout.ItemRole.FieldRole, self.horizontalLayout_2
|
||||||
|
)
|
||||||
self.label_7 = QtWidgets.QLabel(parent=Dialog)
|
self.label_7 = QtWidgets.QLabel(parent=Dialog)
|
||||||
self.label_7.setObjectName("label_7")
|
self.label_7.setObjectName("label_7")
|
||||||
self.formLayout.setWidget(3, QtWidgets.QFormLayout.ItemRole.LabelRole, self.label_7)
|
self.formLayout.setWidget(
|
||||||
|
3, QtWidgets.QFormLayout.ItemRole.LabelRole, self.label_7
|
||||||
|
)
|
||||||
self.horizontalLayout = QtWidgets.QHBoxLayout()
|
self.horizontalLayout = QtWidgets.QHBoxLayout()
|
||||||
self.horizontalLayout.setObjectName("horizontalLayout")
|
self.horizontalLayout.setObjectName("horizontalLayout")
|
||||||
self.delete_inactive_user_duration = QtWidgets.QSpinBox(parent=Dialog)
|
self.delete_inactive_user_duration = QtWidgets.QSpinBox(parent=Dialog)
|
||||||
self.delete_inactive_user_duration.setMaximum(9999)
|
self.delete_inactive_user_duration.setMaximum(9999)
|
||||||
self.delete_inactive_user_duration.setProperty("value", 365)
|
self.delete_inactive_user_duration.setProperty("value", 365)
|
||||||
self.delete_inactive_user_duration.setObjectName("delete_inactive_user_duration")
|
self.delete_inactive_user_duration.setObjectName(
|
||||||
|
"delete_inactive_user_duration"
|
||||||
|
)
|
||||||
self.horizontalLayout.addWidget(self.delete_inactive_user_duration)
|
self.horizontalLayout.addWidget(self.delete_inactive_user_duration)
|
||||||
self.label_12 = QtWidgets.QLabel(parent=Dialog)
|
self.label_12 = QtWidgets.QLabel(parent=Dialog)
|
||||||
self.label_12.setMaximumSize(QtCore.QSize(43, 16777215))
|
self.label_12.setMaximumSize(QtCore.QSize(43, 16777215))
|
||||||
self.label_12.setObjectName("label_12")
|
self.label_12.setObjectName("label_12")
|
||||||
self.horizontalLayout.addWidget(self.label_12)
|
self.horizontalLayout.addWidget(self.label_12)
|
||||||
self.formLayout.setLayout(3, QtWidgets.QFormLayout.ItemRole.FieldRole, self.horizontalLayout)
|
self.formLayout.setLayout(
|
||||||
|
3, QtWidgets.QFormLayout.ItemRole.FieldRole, self.horizontalLayout
|
||||||
|
)
|
||||||
self.returnMode = QtWidgets.QCheckBox(parent=Dialog)
|
self.returnMode = QtWidgets.QCheckBox(parent=Dialog)
|
||||||
self.returnMode.setTristate(False)
|
self.returnMode.setTristate(False)
|
||||||
self.returnMode.setObjectName("returnMode")
|
self.returnMode.setObjectName("returnMode")
|
||||||
self.formLayout.setWidget(4, QtWidgets.QFormLayout.ItemRole.FieldRole, self.returnMode)
|
self.formLayout.setWidget(
|
||||||
|
4, QtWidgets.QFormLayout.ItemRole.FieldRole, self.returnMode
|
||||||
|
)
|
||||||
self.label_3 = QtWidgets.QLabel(parent=Dialog)
|
self.label_3 = QtWidgets.QLabel(parent=Dialog)
|
||||||
self.label_3.setObjectName("label_3")
|
self.label_3.setObjectName("label_3")
|
||||||
self.formLayout.setWidget(5, QtWidgets.QFormLayout.ItemRole.LabelRole, self.label_3)
|
self.formLayout.setWidget(
|
||||||
|
5, QtWidgets.QFormLayout.ItemRole.LabelRole, self.label_3
|
||||||
|
)
|
||||||
self.databasesettings = QtWidgets.QGridLayout()
|
self.databasesettings = QtWidgets.QGridLayout()
|
||||||
self.databasesettings.setObjectName("databasesettings")
|
self.databasesettings.setObjectName("databasesettings")
|
||||||
self.database_name = QtWidgets.QLineEdit(parent=Dialog)
|
self.database_name = QtWidgets.QLineEdit(parent=Dialog)
|
||||||
@@ -84,12 +102,20 @@ class Ui_Dialog(object):
|
|||||||
self.btn_select_database_name.setObjectName("btn_select_database_name")
|
self.btn_select_database_name.setObjectName("btn_select_database_name")
|
||||||
self.databasesettings.addWidget(self.btn_select_database_name, 1, 2, 1, 1)
|
self.databasesettings.addWidget(self.btn_select_database_name, 1, 2, 1, 1)
|
||||||
self.btn_select_database_backupLocation = QtWidgets.QToolButton(parent=Dialog)
|
self.btn_select_database_backupLocation = QtWidgets.QToolButton(parent=Dialog)
|
||||||
self.btn_select_database_backupLocation.setObjectName("btn_select_database_backupLocation")
|
self.btn_select_database_backupLocation.setObjectName(
|
||||||
self.databasesettings.addWidget(self.btn_select_database_backupLocation, 2, 2, 1, 1)
|
"btn_select_database_backupLocation"
|
||||||
self.formLayout.setLayout(5, QtWidgets.QFormLayout.ItemRole.FieldRole, self.databasesettings)
|
)
|
||||||
|
self.databasesettings.addWidget(
|
||||||
|
self.btn_select_database_backupLocation, 2, 2, 1, 1
|
||||||
|
)
|
||||||
|
self.formLayout.setLayout(
|
||||||
|
5, QtWidgets.QFormLayout.ItemRole.FieldRole, self.databasesettings
|
||||||
|
)
|
||||||
self.label_9 = QtWidgets.QLabel(parent=Dialog)
|
self.label_9 = QtWidgets.QLabel(parent=Dialog)
|
||||||
self.label_9.setObjectName("label_9")
|
self.label_9.setObjectName("label_9")
|
||||||
self.formLayout.setWidget(6, QtWidgets.QFormLayout.ItemRole.LabelRole, self.label_9)
|
self.formLayout.setWidget(
|
||||||
|
6, QtWidgets.QFormLayout.ItemRole.LabelRole, self.label_9
|
||||||
|
)
|
||||||
self.gridLayout = QtWidgets.QGridLayout()
|
self.gridLayout = QtWidgets.QGridLayout()
|
||||||
self.gridLayout.setObjectName("gridLayout")
|
self.gridLayout.setObjectName("gridLayout")
|
||||||
self.btn_select_report_path = QtWidgets.QToolButton(parent=Dialog)
|
self.btn_select_report_path = QtWidgets.QToolButton(parent=Dialog)
|
||||||
@@ -119,12 +145,20 @@ class Ui_Dialog(object):
|
|||||||
self.report_day.addItem("")
|
self.report_day.addItem("")
|
||||||
self.report_day.addItem("")
|
self.report_day.addItem("")
|
||||||
self.gridLayout.addWidget(self.report_day, 0, 1, 1, 1)
|
self.gridLayout.addWidget(self.report_day, 0, 1, 1, 1)
|
||||||
self.formLayout.setLayout(6, QtWidgets.QFormLayout.ItemRole.FieldRole, self.gridLayout)
|
self.formLayout.setLayout(
|
||||||
|
6, QtWidgets.QFormLayout.ItemRole.FieldRole, self.gridLayout
|
||||||
|
)
|
||||||
self.buttonBox = QtWidgets.QDialogButtonBox(parent=Dialog)
|
self.buttonBox = QtWidgets.QDialogButtonBox(parent=Dialog)
|
||||||
self.buttonBox.setOrientation(QtCore.Qt.Orientation.Horizontal)
|
self.buttonBox.setOrientation(QtCore.Qt.Orientation.Horizontal)
|
||||||
self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.StandardButton.Cancel|QtWidgets.QDialogButtonBox.StandardButton.Discard|QtWidgets.QDialogButtonBox.StandardButton.Ok)
|
self.buttonBox.setStandardButtons(
|
||||||
|
QtWidgets.QDialogButtonBox.StandardButton.Cancel
|
||||||
|
| QtWidgets.QDialogButtonBox.StandardButton.Discard
|
||||||
|
| QtWidgets.QDialogButtonBox.StandardButton.Ok
|
||||||
|
)
|
||||||
self.buttonBox.setObjectName("buttonBox")
|
self.buttonBox.setObjectName("buttonBox")
|
||||||
self.formLayout.setWidget(9, QtWidgets.QFormLayout.ItemRole.FieldRole, self.buttonBox)
|
self.formLayout.setWidget(
|
||||||
|
9, QtWidgets.QFormLayout.ItemRole.FieldRole, self.buttonBox
|
||||||
|
)
|
||||||
self.shortcutchanger = QtWidgets.QTableWidget(parent=Dialog)
|
self.shortcutchanger = QtWidgets.QTableWidget(parent=Dialog)
|
||||||
self.shortcutchanger.setObjectName("shortcutchanger")
|
self.shortcutchanger.setObjectName("shortcutchanger")
|
||||||
self.shortcutchanger.setColumnCount(3)
|
self.shortcutchanger.setColumnCount(3)
|
||||||
@@ -135,7 +169,9 @@ class Ui_Dialog(object):
|
|||||||
self.shortcutchanger.setHorizontalHeaderItem(1, item)
|
self.shortcutchanger.setHorizontalHeaderItem(1, item)
|
||||||
item = QtWidgets.QTableWidgetItem()
|
item = QtWidgets.QTableWidgetItem()
|
||||||
self.shortcutchanger.setHorizontalHeaderItem(2, item)
|
self.shortcutchanger.setHorizontalHeaderItem(2, item)
|
||||||
self.formLayout.setWidget(8, QtWidgets.QFormLayout.ItemRole.FieldRole, self.shortcutchanger)
|
self.formLayout.setWidget(
|
||||||
|
8, QtWidgets.QFormLayout.ItemRole.FieldRole, self.shortcutchanger
|
||||||
|
)
|
||||||
self.verticalLayout = QtWidgets.QVBoxLayout()
|
self.verticalLayout = QtWidgets.QVBoxLayout()
|
||||||
self.verticalLayout.setObjectName("verticalLayout")
|
self.verticalLayout.setObjectName("verticalLayout")
|
||||||
self.label_14 = QtWidgets.QLabel(parent=Dialog)
|
self.label_14 = QtWidgets.QLabel(parent=Dialog)
|
||||||
@@ -144,18 +180,22 @@ class Ui_Dialog(object):
|
|||||||
self.label_15 = QtWidgets.QLabel(parent=Dialog)
|
self.label_15 = QtWidgets.QLabel(parent=Dialog)
|
||||||
self.label_15.setObjectName("label_15")
|
self.label_15.setObjectName("label_15")
|
||||||
self.verticalLayout.addWidget(self.label_15)
|
self.verticalLayout.addWidget(self.label_15)
|
||||||
self.formLayout.setLayout(8, QtWidgets.QFormLayout.ItemRole.LabelRole, self.verticalLayout)
|
self.formLayout.setLayout(
|
||||||
|
8, QtWidgets.QFormLayout.ItemRole.LabelRole, self.verticalLayout
|
||||||
|
)
|
||||||
|
|
||||||
self.retranslateUi(Dialog)
|
self.retranslateUi(Dialog)
|
||||||
self.buttonBox.accepted.connect(Dialog.accept) # type: ignore
|
self.buttonBox.accepted.connect(Dialog.accept) # type: ignore
|
||||||
self.buttonBox.rejected.connect(Dialog.reject) # type: ignore
|
self.buttonBox.rejected.connect(Dialog.reject) # type: ignore
|
||||||
QtCore.QMetaObject.connectSlotsByName(Dialog)
|
QtCore.QMetaObject.connectSlotsByName(Dialog)
|
||||||
Dialog.setTabOrder(self.institution_name, self.database_path)
|
Dialog.setTabOrder(self.institution_name, self.database_path)
|
||||||
Dialog.setTabOrder(self.database_path, self.database_name)
|
Dialog.setTabOrder(self.database_path, self.database_name)
|
||||||
Dialog.setTabOrder(self.database_name, self.database_backupLocation)
|
Dialog.setTabOrder(self.database_name, self.database_backupLocation)
|
||||||
Dialog.setTabOrder(self.database_backupLocation, self.btn_select_database_path)
|
Dialog.setTabOrder(self.database_backupLocation, self.btn_select_database_path)
|
||||||
Dialog.setTabOrder(self.btn_select_database_path, self.btn_select_database_name)
|
Dialog.setTabOrder(self.btn_select_database_path, self.btn_select_database_name)
|
||||||
Dialog.setTabOrder(self.btn_select_database_name, self.btn_select_database_backupLocation)
|
Dialog.setTabOrder(
|
||||||
|
self.btn_select_database_name, self.btn_select_database_backupLocation
|
||||||
|
)
|
||||||
|
|
||||||
def retranslateUi(self, Dialog):
|
def retranslateUi(self, Dialog):
|
||||||
_translate = QtCore.QCoreApplication.translate
|
_translate = QtCore.QCoreApplication.translate
|
||||||
@@ -163,10 +203,14 @@ class Ui_Dialog(object):
|
|||||||
self.label.setText(_translate("Dialog", "Name der Einrichtung"))
|
self.label.setText(_translate("Dialog", "Name der Einrichtung"))
|
||||||
self.label_2.setText(_translate("Dialog", "Leihdauer"))
|
self.label_2.setText(_translate("Dialog", "Leihdauer"))
|
||||||
self.label_13.setText(_translate("Dialog", "Tage(n)"))
|
self.label_13.setText(_translate("Dialog", "Tage(n)"))
|
||||||
self.label_7.setText(_translate("Dialog", "Inaktive Nutzer\n"
|
self.label_7.setText(_translate("Dialog", "Inaktive Nutzer\nLöschen nach"))
|
||||||
"Löschen nach"))
|
|
||||||
self.label_12.setText(_translate("Dialog", "Tage(n)"))
|
self.label_12.setText(_translate("Dialog", "Tage(n)"))
|
||||||
self.returnMode.setToolTip(_translate("Dialog", "Wenn aktiv: Wenn ein Medium zurückgegeben wird, wird die nächste Aktion des Moduswechsels zum normalen Rückgabemodus führen"))
|
self.returnMode.setToolTip(
|
||||||
|
_translate(
|
||||||
|
"Dialog",
|
||||||
|
"Wenn aktiv: Wenn ein Medium zurückgegeben wird, wird die nächste Aktion des Moduswechsels zum normalen Rückgabemodus führen",
|
||||||
|
)
|
||||||
|
)
|
||||||
self.returnMode.setText(_translate("Dialog", "Erweiterter Rückgabemodus"))
|
self.returnMode.setText(_translate("Dialog", "Erweiterter Rückgabemodus"))
|
||||||
self.label_3.setText(_translate("Dialog", "Datenbank"))
|
self.label_3.setText(_translate("Dialog", "Datenbank"))
|
||||||
self.label_4.setText(_translate("Dialog", "Speicherort"))
|
self.label_4.setText(_translate("Dialog", "Speicherort"))
|
||||||
@@ -192,5 +236,4 @@ class Ui_Dialog(object):
|
|||||||
item = self.shortcutchanger.horizontalHeaderItem(2)
|
item = self.shortcutchanger.horizontalHeaderItem(2)
|
||||||
item.setText(_translate("Dialog", "Aktuell"))
|
item.setText(_translate("Dialog", "Aktuell"))
|
||||||
self.label_14.setText(_translate("Dialog", "Shortcuts"))
|
self.label_14.setText(_translate("Dialog", "Shortcuts"))
|
||||||
self.label_15.setText(_translate("Dialog", "(Erst nach Neustart\n"
|
self.label_15.setText(_translate("Dialog", "(Erst nach Neustart\nwirksam)"))
|
||||||
"wirksam)"))
|
|
||||||
|
|||||||
@@ -29,7 +29,12 @@ class Ui_MainWindow(object):
|
|||||||
self.radio_overdue = QtWidgets.QRadioButton(parent=self.centralwidget)
|
self.radio_overdue = QtWidgets.QRadioButton(parent=self.centralwidget)
|
||||||
self.radio_overdue.setObjectName("radio_overdue")
|
self.radio_overdue.setObjectName("radio_overdue")
|
||||||
self.horizontalLayout.addWidget(self.radio_overdue)
|
self.horizontalLayout.addWidget(self.radio_overdue)
|
||||||
spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Minimum)
|
spacerItem = QtWidgets.QSpacerItem(
|
||||||
|
40,
|
||||||
|
20,
|
||||||
|
QtWidgets.QSizePolicy.Policy.Expanding,
|
||||||
|
QtWidgets.QSizePolicy.Policy.Minimum,
|
||||||
|
)
|
||||||
self.horizontalLayout.addItem(spacerItem)
|
self.horizontalLayout.addItem(spacerItem)
|
||||||
self.verticalLayout.addLayout(self.horizontalLayout)
|
self.verticalLayout.addLayout(self.horizontalLayout)
|
||||||
self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
|
self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
|
||||||
@@ -45,9 +50,15 @@ class Ui_MainWindow(object):
|
|||||||
self.horizontalLayout_2.addWidget(self.searchFields)
|
self.horizontalLayout_2.addWidget(self.searchFields)
|
||||||
self.verticalLayout.addLayout(self.horizontalLayout_2)
|
self.verticalLayout.addLayout(self.horizontalLayout_2)
|
||||||
self.loanTable = QtWidgets.QTableWidget(parent=self.centralwidget)
|
self.loanTable = QtWidgets.QTableWidget(parent=self.centralwidget)
|
||||||
self.loanTable.setEditTriggers(QtWidgets.QAbstractItemView.EditTrigger.NoEditTriggers)
|
self.loanTable.setEditTriggers(
|
||||||
self.loanTable.setSelectionMode(QtWidgets.QAbstractItemView.SelectionMode.SingleSelection)
|
QtWidgets.QAbstractItemView.EditTrigger.NoEditTriggers
|
||||||
self.loanTable.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectionBehavior.SelectRows)
|
)
|
||||||
|
self.loanTable.setSelectionMode(
|
||||||
|
QtWidgets.QAbstractItemView.SelectionMode.SingleSelection
|
||||||
|
)
|
||||||
|
self.loanTable.setSelectionBehavior(
|
||||||
|
QtWidgets.QAbstractItemView.SelectionBehavior.SelectRows
|
||||||
|
)
|
||||||
self.loanTable.setObjectName("loanTable")
|
self.loanTable.setObjectName("loanTable")
|
||||||
self.loanTable.setColumnCount(7)
|
self.loanTable.setColumnCount(7)
|
||||||
self.loanTable.setRowCount(0)
|
self.loanTable.setRowCount(0)
|
||||||
@@ -79,14 +90,16 @@ class Ui_MainWindow(object):
|
|||||||
self.menubar.addAction(self.menuDatei.menuAction())
|
self.menubar.addAction(self.menuDatei.menuAction())
|
||||||
|
|
||||||
self.retranslateUi(MainWindow)
|
self.retranslateUi(MainWindow)
|
||||||
self.actionBeenden.triggered.connect(MainWindow.close) # type: ignore
|
self.actionBeenden.triggered.connect(MainWindow.close) # type: ignore
|
||||||
QtCore.QMetaObject.connectSlotsByName(MainWindow)
|
QtCore.QMetaObject.connectSlotsByName(MainWindow)
|
||||||
|
|
||||||
def retranslateUi(self, MainWindow):
|
def retranslateUi(self, MainWindow):
|
||||||
_translate = QtCore.QCoreApplication.translate
|
_translate = QtCore.QCoreApplication.translate
|
||||||
MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
|
MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
|
||||||
self.radio_all.setText(_translate("MainWindow", "Alle Ausleihen"))
|
self.radio_all.setText(_translate("MainWindow", "Alle Ausleihen"))
|
||||||
self.radio_current.setText(_translate("MainWindow", "Aktuell Entliehene Medien"))
|
self.radio_current.setText(
|
||||||
|
_translate("MainWindow", "Aktuell Entliehene Medien")
|
||||||
|
)
|
||||||
self.radio_overdue.setText(_translate("MainWindow", "Überzogene Medien"))
|
self.radio_overdue.setText(_translate("MainWindow", "Überzogene Medien"))
|
||||||
self.searchFields.setItemText(0, _translate("MainWindow", "Titel"))
|
self.searchFields.setItemText(0, _translate("MainWindow", "Titel"))
|
||||||
self.searchFields.setItemText(1, _translate("MainWindow", "Signatur"))
|
self.searchFields.setItemText(1, _translate("MainWindow", "Signatur"))
|
||||||
|
|||||||
@@ -22,7 +22,9 @@ class Ui_MainWindow(object):
|
|||||||
self.horizontalLayout_4 = QtWidgets.QHBoxLayout()
|
self.horizontalLayout_4 = QtWidgets.QHBoxLayout()
|
||||||
self.horizontalLayout_4.setObjectName("horizontalLayout_4")
|
self.horizontalLayout_4.setObjectName("horizontalLayout_4")
|
||||||
self.duedate = QtWidgets.QDateEdit(parent=self.centralwidget)
|
self.duedate = QtWidgets.QDateEdit(parent=self.centralwidget)
|
||||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Fixed)
|
sizePolicy = QtWidgets.QSizePolicy(
|
||||||
|
QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Fixed
|
||||||
|
)
|
||||||
sizePolicy.setHorizontalStretch(0)
|
sizePolicy.setHorizontalStretch(0)
|
||||||
sizePolicy.setVerticalStretch(0)
|
sizePolicy.setVerticalStretch(0)
|
||||||
sizePolicy.setHeightForWidth(self.duedate.sizePolicy().hasHeightForWidth())
|
sizePolicy.setHeightForWidth(self.duedate.sizePolicy().hasHeightForWidth())
|
||||||
@@ -32,14 +34,23 @@ class Ui_MainWindow(object):
|
|||||||
self.duedate.setBaseSize(QtCore.QSize(70, 0))
|
self.duedate.setBaseSize(QtCore.QSize(70, 0))
|
||||||
self.duedate.setObjectName("duedate")
|
self.duedate.setObjectName("duedate")
|
||||||
self.horizontalLayout_4.addWidget(self.duedate)
|
self.horizontalLayout_4.addWidget(self.duedate)
|
||||||
spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Minimum)
|
spacerItem = QtWidgets.QSpacerItem(
|
||||||
|
40,
|
||||||
|
20,
|
||||||
|
QtWidgets.QSizePolicy.Policy.Expanding,
|
||||||
|
QtWidgets.QSizePolicy.Policy.Minimum,
|
||||||
|
)
|
||||||
self.horizontalLayout_4.addItem(spacerItem)
|
self.horizontalLayout_4.addItem(spacerItem)
|
||||||
self.gridLayout.addLayout(self.horizontalLayout_4, 5, 1, 1, 1)
|
self.gridLayout.addLayout(self.horizontalLayout_4, 5, 1, 1, 1)
|
||||||
self.label_3 = QtWidgets.QLabel(parent=self.centralwidget)
|
self.label_3 = QtWidgets.QLabel(parent=self.centralwidget)
|
||||||
self.label_3.setObjectName("label_3")
|
self.label_3.setObjectName("label_3")
|
||||||
self.gridLayout.addWidget(self.label_3, 3, 0, 1, 1)
|
self.gridLayout.addWidget(self.label_3, 3, 0, 1, 1)
|
||||||
self.label_6 = QtWidgets.QLabel(parent=self.centralwidget)
|
self.label_6 = QtWidgets.QLabel(parent=self.centralwidget)
|
||||||
self.label_6.setAlignment(QtCore.Qt.AlignmentFlag.AlignLeading|QtCore.Qt.AlignmentFlag.AlignLeft|QtCore.Qt.AlignmentFlag.AlignVCenter)
|
self.label_6.setAlignment(
|
||||||
|
QtCore.Qt.AlignmentFlag.AlignLeading
|
||||||
|
| QtCore.Qt.AlignmentFlag.AlignLeft
|
||||||
|
| QtCore.Qt.AlignmentFlag.AlignVCenter
|
||||||
|
)
|
||||||
self.label_6.setObjectName("label_6")
|
self.label_6.setObjectName("label_6")
|
||||||
self.gridLayout.addWidget(self.label_6, 5, 0, 1, 1)
|
self.gridLayout.addWidget(self.label_6, 5, 0, 1, 1)
|
||||||
self.horizontalLayout = QtWidgets.QHBoxLayout()
|
self.horizontalLayout = QtWidgets.QHBoxLayout()
|
||||||
@@ -66,7 +77,12 @@ class Ui_MainWindow(object):
|
|||||||
self.gridLayout.addWidget(self.input_file_ident, 3, 1, 1, 1)
|
self.gridLayout.addWidget(self.input_file_ident, 3, 1, 1, 1)
|
||||||
self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
|
self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
|
||||||
self.horizontalLayout_3.setObjectName("horizontalLayout_3")
|
self.horizontalLayout_3.setObjectName("horizontalLayout_3")
|
||||||
spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Minimum)
|
spacerItem1 = QtWidgets.QSpacerItem(
|
||||||
|
40,
|
||||||
|
20,
|
||||||
|
QtWidgets.QSizePolicy.Policy.Expanding,
|
||||||
|
QtWidgets.QSizePolicy.Policy.Minimum,
|
||||||
|
)
|
||||||
self.horizontalLayout_3.addItem(spacerItem1)
|
self.horizontalLayout_3.addItem(spacerItem1)
|
||||||
self.btn_createNewUser = QtWidgets.QPushButton(parent=self.centralwidget)
|
self.btn_createNewUser = QtWidgets.QPushButton(parent=self.centralwidget)
|
||||||
self.btn_createNewUser.setObjectName("btn_createNewUser")
|
self.btn_createNewUser.setObjectName("btn_createNewUser")
|
||||||
@@ -104,7 +120,11 @@ class Ui_MainWindow(object):
|
|||||||
self.btn_show_lentmedia.setObjectName("btn_show_lentmedia")
|
self.btn_show_lentmedia.setObjectName("btn_show_lentmedia")
|
||||||
self.gridLayout_2.addWidget(self.btn_show_lentmedia, 0, 1, 1, 1)
|
self.gridLayout_2.addWidget(self.btn_show_lentmedia, 0, 1, 1, 1)
|
||||||
self.label_4 = QtWidgets.QLabel(parent=self.groupBox_2)
|
self.label_4 = QtWidgets.QLabel(parent=self.groupBox_2)
|
||||||
self.label_4.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight|QtCore.Qt.AlignmentFlag.AlignTrailing|QtCore.Qt.AlignmentFlag.AlignVCenter)
|
self.label_4.setAlignment(
|
||||||
|
QtCore.Qt.AlignmentFlag.AlignRight
|
||||||
|
| QtCore.Qt.AlignmentFlag.AlignTrailing
|
||||||
|
| QtCore.Qt.AlignmentFlag.AlignVCenter
|
||||||
|
)
|
||||||
self.label_4.setObjectName("label_4")
|
self.label_4.setObjectName("label_4")
|
||||||
self.gridLayout_2.addWidget(self.label_4, 0, 0, 1, 1)
|
self.gridLayout_2.addWidget(self.label_4, 0, 0, 1, 1)
|
||||||
self.label_7 = QtWidgets.QLabel(parent=self.groupBox_2)
|
self.label_7 = QtWidgets.QLabel(parent=self.groupBox_2)
|
||||||
@@ -179,7 +199,7 @@ class Ui_MainWindow(object):
|
|||||||
self.menubar.addAction(self.menuHilfe.menuAction())
|
self.menubar.addAction(self.menuHilfe.menuAction())
|
||||||
|
|
||||||
self.retranslateUi(MainWindow)
|
self.retranslateUi(MainWindow)
|
||||||
self.actionBeenden.triggered.connect(MainWindow.close) # type: ignore
|
self.actionBeenden.triggered.connect(MainWindow.close) # type: ignore
|
||||||
QtCore.QMetaObject.connectSlotsByName(MainWindow)
|
QtCore.QMetaObject.connectSlotsByName(MainWindow)
|
||||||
MainWindow.setTabOrder(self.btn_createNewUser, self.input_userno)
|
MainWindow.setTabOrder(self.btn_createNewUser, self.input_userno)
|
||||||
MainWindow.setTabOrder(self.input_userno, self.input_username)
|
MainWindow.setTabOrder(self.input_userno, self.input_username)
|
||||||
@@ -217,8 +237,12 @@ class Ui_MainWindow(object):
|
|||||||
self.actionNutzer.setShortcut(_translate("MainWindow", "F6"))
|
self.actionNutzer.setShortcut(_translate("MainWindow", "F6"))
|
||||||
self.actionAusleihhistorie.setText(_translate("MainWindow", "Ausleihhistorie"))
|
self.actionAusleihhistorie.setText(_translate("MainWindow", "Ausleihhistorie"))
|
||||||
self.actionAusleihhistorie.setShortcut(_translate("MainWindow", "F8"))
|
self.actionAusleihhistorie.setShortcut(_translate("MainWindow", "F8"))
|
||||||
self.actionBericht_erstellen.setText(_translate("MainWindow", "Bericht erstellen"))
|
self.actionBericht_erstellen.setText(
|
||||||
|
_translate("MainWindow", "Bericht erstellen")
|
||||||
|
)
|
||||||
self.actionBericht_erstellen.setShortcut(_translate("MainWindow", "F7"))
|
self.actionBericht_erstellen.setShortcut(_translate("MainWindow", "F7"))
|
||||||
self.actionDokumentation_ffnen.setText(_translate("MainWindow", "Dokumentation öffnen"))
|
self.actionDokumentation_ffnen.setText(
|
||||||
|
_translate("MainWindow", "Dokumentation öffnen")
|
||||||
|
)
|
||||||
self.actionDokumentation_ffnen.setShortcut(_translate("MainWindow", "F1"))
|
self.actionDokumentation_ffnen.setShortcut(_translate("MainWindow", "F1"))
|
||||||
self.actionProblem_melden.setText(_translate("MainWindow", "Problem melden"))
|
self.actionProblem_melden.setText(_translate("MainWindow", "Problem melden"))
|
||||||
|
|||||||
@@ -26,7 +26,12 @@ class Ui_MainWindow(object):
|
|||||||
self.frame.setObjectName("frame")
|
self.frame.setObjectName("frame")
|
||||||
self.horizontalLayout = QtWidgets.QHBoxLayout(self.frame)
|
self.horizontalLayout = QtWidgets.QHBoxLayout(self.frame)
|
||||||
self.horizontalLayout.setObjectName("horizontalLayout")
|
self.horizontalLayout.setObjectName("horizontalLayout")
|
||||||
spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Minimum)
|
spacerItem = QtWidgets.QSpacerItem(
|
||||||
|
40,
|
||||||
|
20,
|
||||||
|
QtWidgets.QSizePolicy.Policy.Expanding,
|
||||||
|
QtWidgets.QSizePolicy.Policy.Minimum,
|
||||||
|
)
|
||||||
self.horizontalLayout.addItem(spacerItem)
|
self.horizontalLayout.addItem(spacerItem)
|
||||||
self.btn_userChange_save = QtWidgets.QPushButton(parent=self.frame)
|
self.btn_userChange_save = QtWidgets.QPushButton(parent=self.frame)
|
||||||
self.btn_userChange_save.setStatusTip("")
|
self.btn_userChange_save.setStatusTip("")
|
||||||
@@ -35,7 +40,12 @@ class Ui_MainWindow(object):
|
|||||||
self.btn_userchange_cancel = QtWidgets.QPushButton(parent=self.frame)
|
self.btn_userchange_cancel = QtWidgets.QPushButton(parent=self.frame)
|
||||||
self.btn_userchange_cancel.setObjectName("btn_userchange_cancel")
|
self.btn_userchange_cancel.setObjectName("btn_userchange_cancel")
|
||||||
self.horizontalLayout.addWidget(self.btn_userchange_cancel)
|
self.horizontalLayout.addWidget(self.btn_userchange_cancel)
|
||||||
spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Minimum)
|
spacerItem1 = QtWidgets.QSpacerItem(
|
||||||
|
40,
|
||||||
|
20,
|
||||||
|
QtWidgets.QSizePolicy.Policy.Expanding,
|
||||||
|
QtWidgets.QSizePolicy.Policy.Minimum,
|
||||||
|
)
|
||||||
self.horizontalLayout.addItem(spacerItem1)
|
self.horizontalLayout.addItem(spacerItem1)
|
||||||
self.gridLayout.addWidget(self.frame, 3, 1, 1, 1)
|
self.gridLayout.addWidget(self.frame, 3, 1, 1, 1)
|
||||||
self.label = QtWidgets.QLabel(parent=self.centralwidget)
|
self.label = QtWidgets.QLabel(parent=self.centralwidget)
|
||||||
@@ -94,7 +104,12 @@ class Ui_MainWindow(object):
|
|||||||
self.radio_overdueLoans = QtWidgets.QRadioButton(parent=self.centralwidget)
|
self.radio_overdueLoans = QtWidgets.QRadioButton(parent=self.centralwidget)
|
||||||
self.radio_overdueLoans.setObjectName("radio_overdueLoans")
|
self.radio_overdueLoans.setObjectName("radio_overdueLoans")
|
||||||
self.horizontalLayout_2.addWidget(self.radio_overdueLoans)
|
self.horizontalLayout_2.addWidget(self.radio_overdueLoans)
|
||||||
spacerItem2 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Minimum)
|
spacerItem2 = QtWidgets.QSpacerItem(
|
||||||
|
40,
|
||||||
|
20,
|
||||||
|
QtWidgets.QSizePolicy.Policy.Expanding,
|
||||||
|
QtWidgets.QSizePolicy.Policy.Minimum,
|
||||||
|
)
|
||||||
self.horizontalLayout_2.addItem(spacerItem2)
|
self.horizontalLayout_2.addItem(spacerItem2)
|
||||||
self.verticalLayout.addLayout(self.horizontalLayout_2)
|
self.verticalLayout.addLayout(self.horizontalLayout_2)
|
||||||
self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
|
self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
|
||||||
@@ -107,7 +122,12 @@ class Ui_MainWindow(object):
|
|||||||
self.searchfilter.addItem("")
|
self.searchfilter.addItem("")
|
||||||
self.searchfilter.addItem("")
|
self.searchfilter.addItem("")
|
||||||
self.horizontalLayout_3.addWidget(self.searchfilter)
|
self.horizontalLayout_3.addWidget(self.searchfilter)
|
||||||
spacerItem3 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Minimum)
|
spacerItem3 = QtWidgets.QSpacerItem(
|
||||||
|
40,
|
||||||
|
20,
|
||||||
|
QtWidgets.QSizePolicy.Policy.Expanding,
|
||||||
|
QtWidgets.QSizePolicy.Policy.Minimum,
|
||||||
|
)
|
||||||
self.horizontalLayout_3.addItem(spacerItem3)
|
self.horizontalLayout_3.addItem(spacerItem3)
|
||||||
self.btn_extendSelectedMedia = QtWidgets.QPushButton(parent=self.centralwidget)
|
self.btn_extendSelectedMedia = QtWidgets.QPushButton(parent=self.centralwidget)
|
||||||
self.btn_extendSelectedMedia.setEnabled(False)
|
self.btn_extendSelectedMedia.setEnabled(False)
|
||||||
@@ -117,10 +137,16 @@ class Ui_MainWindow(object):
|
|||||||
self.UserMediaTable = QtWidgets.QTableWidget(parent=self.centralwidget)
|
self.UserMediaTable = QtWidgets.QTableWidget(parent=self.centralwidget)
|
||||||
self.UserMediaTable.setMouseTracking(True)
|
self.UserMediaTable.setMouseTracking(True)
|
||||||
self.UserMediaTable.setFocusPolicy(QtCore.Qt.FocusPolicy.NoFocus)
|
self.UserMediaTable.setFocusPolicy(QtCore.Qt.FocusPolicy.NoFocus)
|
||||||
self.UserMediaTable.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff)
|
self.UserMediaTable.setHorizontalScrollBarPolicy(
|
||||||
self.UserMediaTable.setEditTriggers(QtWidgets.QAbstractItemView.EditTrigger.NoEditTriggers)
|
QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff
|
||||||
|
)
|
||||||
|
self.UserMediaTable.setEditTriggers(
|
||||||
|
QtWidgets.QAbstractItemView.EditTrigger.NoEditTriggers
|
||||||
|
)
|
||||||
self.UserMediaTable.setAlternatingRowColors(True)
|
self.UserMediaTable.setAlternatingRowColors(True)
|
||||||
self.UserMediaTable.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectionBehavior.SelectRows)
|
self.UserMediaTable.setSelectionBehavior(
|
||||||
|
QtWidgets.QAbstractItemView.SelectionBehavior.SelectRows
|
||||||
|
)
|
||||||
self.UserMediaTable.setObjectName("UserMediaTable")
|
self.UserMediaTable.setObjectName("UserMediaTable")
|
||||||
self.UserMediaTable.setColumnCount(6)
|
self.UserMediaTable.setColumnCount(6)
|
||||||
self.UserMediaTable.setRowCount(0)
|
self.UserMediaTable.setRowCount(0)
|
||||||
@@ -177,11 +203,15 @@ class Ui_MainWindow(object):
|
|||||||
self.label_5.setText(_translate("MainWindow", "Nutzer Löschen"))
|
self.label_5.setText(_translate("MainWindow", "Nutzer Löschen"))
|
||||||
self.label_4.setText(_translate("MainWindow", "Medien"))
|
self.label_4.setText(_translate("MainWindow", "Medien"))
|
||||||
self.radio_allLoanedMedia.setText(_translate("MainWindow", "Alle Ausleihen"))
|
self.radio_allLoanedMedia.setText(_translate("MainWindow", "Alle Ausleihen"))
|
||||||
self.radio_currentlyLoaned.setText(_translate("MainWindow", "Aktuell entliehen"))
|
self.radio_currentlyLoaned.setText(
|
||||||
|
_translate("MainWindow", "Aktuell entliehen")
|
||||||
|
)
|
||||||
self.radio_overdueLoans.setText(_translate("MainWindow", "Überzogen"))
|
self.radio_overdueLoans.setText(_translate("MainWindow", "Überzogen"))
|
||||||
self.searchfilter.setItemText(0, _translate("MainWindow", "Titel"))
|
self.searchfilter.setItemText(0, _translate("MainWindow", "Titel"))
|
||||||
self.searchfilter.setItemText(1, _translate("MainWindow", "Signatur"))
|
self.searchfilter.setItemText(1, _translate("MainWindow", "Signatur"))
|
||||||
self.btn_extendSelectedMedia.setText(_translate("MainWindow", "Ausgewählte Verlängern"))
|
self.btn_extendSelectedMedia.setText(
|
||||||
|
_translate("MainWindow", "Ausgewählte Verlängern")
|
||||||
|
)
|
||||||
self.UserMediaTable.setSortingEnabled(True)
|
self.UserMediaTable.setSortingEnabled(True)
|
||||||
item = self.UserMediaTable.horizontalHeaderItem(0)
|
item = self.UserMediaTable.horizontalHeaderItem(0)
|
||||||
item.setText(_translate("MainWindow", "ISBN"))
|
item.setText(_translate("MainWindow", "ISBN"))
|
||||||
|
|||||||
@@ -34,7 +34,9 @@ class UserUI(QtWidgets.QMainWindow, Ui_MainWindow):
|
|||||||
self.deleteUser.clicked.connect(self.userDelete)
|
self.deleteUser.clicked.connect(self.userDelete)
|
||||||
self.deleteUser.setIcon(Icon("delete").overwriteColor("red"))
|
self.deleteUser.setIcon(Icon("delete").overwriteColor("red"))
|
||||||
self.deleteUser.setEnabled(False)
|
self.deleteUser.setEnabled(False)
|
||||||
self.deleteUser.setToolTip("Nutzer löschen nicht möglich, solange Medien ausgeliehen sind")
|
self.deleteUser.setToolTip(
|
||||||
|
"Nutzer löschen nicht möglich, solange Medien ausgeliehen sind"
|
||||||
|
)
|
||||||
self.btn_extendSelectedMedia.setEnabled(False)
|
self.btn_extendSelectedMedia.setEnabled(False)
|
||||||
|
|
||||||
# radioButtons
|
# radioButtons
|
||||||
@@ -46,8 +48,9 @@ class UserUI(QtWidgets.QMainWindow, Ui_MainWindow):
|
|||||||
self.frame.hide()
|
self.frame.hide()
|
||||||
if self.UserMediaTable.rowCount() == 0:
|
if self.UserMediaTable.rowCount() == 0:
|
||||||
self.btn_extendSelectedMedia.setEnabled(False)
|
self.btn_extendSelectedMedia.setEnabled(False)
|
||||||
self.deleteUser.setEnabled( True)
|
self.deleteUser.setEnabled(True)
|
||||||
else: self.btn_extendSelectedMedia.setEnabled(True)
|
else:
|
||||||
|
self.btn_extendSelectedMedia.setEnabled(True)
|
||||||
|
|
||||||
# table
|
# table
|
||||||
self.UserMediaTable.horizontalHeader().setSectionResizeMode(
|
self.UserMediaTable.horizontalHeader().setSectionResizeMode(
|
||||||
@@ -63,7 +66,6 @@ class UserUI(QtWidgets.QMainWindow, Ui_MainWindow):
|
|||||||
self.user_no.textChanged.connect(self.showFrame)
|
self.user_no.textChanged.connect(self.showFrame)
|
||||||
self.mail.textChanged.connect(self.showFrame)
|
self.mail.textChanged.connect(self.showFrame)
|
||||||
|
|
||||||
|
|
||||||
self.show()
|
self.show()
|
||||||
|
|
||||||
def check_book(self, book: Book):
|
def check_book(self, book: Book):
|
||||||
@@ -97,7 +99,7 @@ class UserUI(QtWidgets.QMainWindow, Ui_MainWindow):
|
|||||||
for item in self.UserMediaTable.selectedItems():
|
for item in self.UserMediaTable.selectedItems():
|
||||||
if item.column() == 1:
|
if item.column() == 1:
|
||||||
signature = item.text()
|
signature = item.text()
|
||||||
#print(signature)
|
# print(signature)
|
||||||
self.db.extendLoanDuration(signature, extendDate)
|
self.db.extendLoanDuration(signature, extendDate)
|
||||||
self.userMedia = []
|
self.userMedia = []
|
||||||
self.UserMediaTable.setRowCount(0)
|
self.UserMediaTable.setRowCount(0)
|
||||||
@@ -111,7 +113,7 @@ class UserUI(QtWidgets.QMainWindow, Ui_MainWindow):
|
|||||||
|
|
||||||
self.UserMediaTable.setRowCount(0)
|
self.UserMediaTable.setRowCount(0)
|
||||||
for loan in self.userMedia:
|
for loan in self.userMedia:
|
||||||
#print("looping loans")
|
# print("looping loans")
|
||||||
fielddata = eval(f"loan.{searchfield}")
|
fielddata = eval(f"loan.{searchfield}")
|
||||||
if isinstance(fielddata, str):
|
if isinstance(fielddata, str):
|
||||||
fielddata = fielddata.lower()
|
fielddata = fielddata.lower()
|
||||||
@@ -161,12 +163,12 @@ class UserUI(QtWidgets.QMainWindow, Ui_MainWindow):
|
|||||||
if self.radio_currentlyLoaned.isChecked()
|
if self.radio_currentlyLoaned.isChecked()
|
||||||
else "overdue"
|
else "overdue"
|
||||||
)
|
)
|
||||||
#print(mode)
|
# print(mode)
|
||||||
if self.userMedia == []:
|
if self.userMedia == []:
|
||||||
books = self.db.getAllMedia(self.user_id)
|
books = self.db.getAllMedia(self.user_id)
|
||||||
for book in books:
|
for book in books:
|
||||||
self.userMedia.append(book)
|
self.userMedia.append(book)
|
||||||
#print(self.userMedia)
|
# print(self.userMedia)
|
||||||
self.UserMediaTable.setRowCount(0)
|
self.UserMediaTable.setRowCount(0)
|
||||||
|
|
||||||
for book in self.userMedia:
|
for book in self.userMedia:
|
||||||
@@ -186,7 +188,8 @@ class UserUI(QtWidgets.QMainWindow, Ui_MainWindow):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
self.addBookToTable(book)
|
self.addBookToTable(book)
|
||||||
#print(book.title)
|
# print(book.title)
|
||||||
|
|
||||||
def addBookToTable(self, book):
|
def addBookToTable(self, book):
|
||||||
self.UserMediaTable.insertRow(0)
|
self.UserMediaTable.insertRow(0)
|
||||||
# item0 = isbn
|
# item0 = isbn
|
||||||
|
|||||||
@@ -7,13 +7,14 @@ from PyQt6.QtCore import QDate
|
|||||||
from src import config
|
from src import config
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
|
|
||||||
# query all loans that happened in the last 7 days
|
# query all loans that happened in the last 7 days
|
||||||
def generate_report():
|
def generate_report():
|
||||||
'''Generate an excel report for all actions that happened in the last seven days
|
"""Generate an excel report for all actions that happened in the last seven days
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
str: a string represeting the generated table
|
str: a string represeting the generated table
|
||||||
'''
|
"""
|
||||||
db = Database()
|
db = Database()
|
||||||
path = db.db_path
|
path = db.db_path
|
||||||
year = datetime.datetime.now().year
|
year = datetime.datetime.now().year
|
||||||
@@ -23,7 +24,7 @@ def generate_report():
|
|||||||
report_path = os.path.join(config.report.path, f"report_{year}_{week}.tsv")
|
report_path = os.path.join(config.report.path, f"report_{year}_{week}.tsv")
|
||||||
day = QDate.currentDate().addDays(-7).toString("yyyy-MM-dd")
|
day = QDate.currentDate().addDays(-7).toString("yyyy-MM-dd")
|
||||||
query = f"""SELECT * FROM loans WHERE loan_date >= '{day}';"""
|
query = f"""SELECT * FROM loans WHERE loan_date >= '{day}';"""
|
||||||
#print(query)
|
# print(query)
|
||||||
|
|
||||||
colnames = ["UserId", "Title", "Action", "Datum"]
|
colnames = ["UserId", "Title", "Action", "Datum"]
|
||||||
table = PrettyTable(colnames)
|
table = PrettyTable(colnames)
|
||||||
|
|||||||
@@ -3,18 +3,23 @@ from wsgiref.simple_server import make_server
|
|||||||
from src import docport, log
|
from src import docport, log
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
||||||
def website():
|
def website():
|
||||||
config = Configurator()
|
config = Configurator()
|
||||||
|
|
||||||
# Set up static file serving from the 'site/' directory
|
# Set up static file serving from the 'site/' directory
|
||||||
config.add_static_view(name='/', path=os.path.join(os.getcwd(), 'site'), cache_max_age=3600)
|
config.add_static_view(
|
||||||
|
name="/", path=os.path.join(os.getcwd(), "site"), cache_max_age=3600
|
||||||
|
)
|
||||||
|
|
||||||
app = config.make_wsgi_app()
|
app = config.make_wsgi_app()
|
||||||
return app
|
return app
|
||||||
|
|
||||||
|
|
||||||
def launch_documentation():
|
def launch_documentation():
|
||||||
app = website()
|
app = website()
|
||||||
server = make_server('localhost', 6543, app)
|
server = make_server("localhost", 6543, app)
|
||||||
log.info("Serving MkDocs documentation on http://0.0.0.0:{}".format(docport))
|
log.info("Serving MkDocs documentation on http://0.0.0.0:{}".format(docport))
|
||||||
with open(os.devnull, "w") as devnull:
|
with open(os.devnull, "w") as devnull:
|
||||||
old_stdout = sys.stdout
|
old_stdout = sys.stdout
|
||||||
@@ -27,6 +32,6 @@ def launch_documentation():
|
|||||||
sys.stdout = old_stdout
|
sys.stdout = old_stdout
|
||||||
sys.stderr = old_stderr
|
sys.stderr = old_stderr
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
pass
|
||||||
|
|||||||
0
src/utils/filepicker.py
Normal file
0
src/utils/filepicker.py
Normal file
@@ -58,7 +58,7 @@ class ReportThread(QThread):
|
|||||||
# # wruitng the table to a file
|
# # wruitng the table to a file
|
||||||
if self.format == "tsv":
|
if self.format == "tsv":
|
||||||
table = table.get_csv_string()
|
table = table.get_csv_string()
|
||||||
tsv_table = table.replace(",", "\t")#.replace("Rückgabe", "Rückgabe")
|
tsv_table = table.replace(",", "\t") # .replace("Rückgabe", "Rückgabe")
|
||||||
# write the file
|
# write the file
|
||||||
with open("report.tsv", "w") as f:
|
with open("report.tsv", "w") as f:
|
||||||
f.write(tsv_table)
|
f.write(tsv_table)
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
# import qdate
|
# import qdate
|
||||||
from PyQt6 import QtCore
|
from PyQt6 import QtCore
|
||||||
from src import log
|
from src import log
|
||||||
|
|
||||||
|
|
||||||
def stringToDate(date: str) -> QtCore.QDate:
|
def stringToDate(date: str) -> QtCore.QDate:
|
||||||
"""Takes an input string and returns a QDate object.
|
"""Takes an input string and returns a QDate object.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user