refactor: clean up unused imports and improve code organization
This commit is contained in:
@@ -179,7 +179,8 @@ class Database:
|
||||
log_message = f"Querying database with query {logs_query}, args: {logs_args}"
|
||||
# if "INSERT" in query:
|
||||
# log_message = f"Querying database with query {query}"
|
||||
|
||||
if "INTO user" in query:
|
||||
log_message = f"Querying database with query {query}"
|
||||
logger.debug(log_message)
|
||||
try:
|
||||
cursor.execute(query, args)
|
||||
@@ -793,6 +794,7 @@ class Database:
|
||||
"SELECT appnr FROM semesterapparat WHERE deletion_status=0"
|
||||
)
|
||||
numbers = [i[0] for i in numbers]
|
||||
numbers.sort()
|
||||
logger.info(f"Currently used apparat numbers: {numbers}")
|
||||
return numbers
|
||||
|
||||
@@ -962,6 +964,7 @@ class Database:
|
||||
app_id (Union[str, int]): the id of the apparat
|
||||
semester (str): the semester the apparat should be deleted from
|
||||
"""
|
||||
logger.info(f"Deleting apparat with id {app_id} in semester {semester}")
|
||||
self.query_db(
|
||||
"UPDATE semesterapparat SET deletion_status=1, deleted_date=? WHERE appnr=?",
|
||||
(semester, app_id),
|
||||
@@ -1064,7 +1067,6 @@ class Database:
|
||||
Returns:
|
||||
list: the result of the query
|
||||
"""
|
||||
logger.debug(query)
|
||||
logger.debug(f"Query: {query}")
|
||||
conn = self.connect()
|
||||
cursor = conn.cursor()
|
||||
@@ -1086,7 +1088,7 @@ class Database:
|
||||
WHERE deletion_status=0 AND dauer=0 AND
|
||||
(
|
||||
(erstellsemester!='{kwargs["deletesemester"]}' AND verlängerung_bis IS NULL) OR
|
||||
(erstellsemester!='{kwargs["deletesemester"]}' AND verlängerung_bis!='{kwargs["deletesemester"]}' AND verlängerung_bis!='{Semester()}')
|
||||
(erstellsemester!='{kwargs["deletesemester"]}' AND verlängerung_bis!='{kwargs["deletesemester"]}' AND verlängerung_bis!='{Semester().next}')
|
||||
)"""
|
||||
return __query(query)
|
||||
if "dauer" in kwargs.keys():
|
||||
@@ -1563,11 +1565,13 @@ class Database:
|
||||
apprarat_id (int): Number of the apparat
|
||||
|
||||
Returns:
|
||||
|
||||
int | None: The id of the prof or None if not found
|
||||
"""
|
||||
query = f"SELECT prof_id from semesterapparat WHERE id = '{apprarat_id}' and deletion_status = 0"
|
||||
query = f"SELECT prof_id from semesterapparat WHERE appnr = '{apprarat_id}' and deletion_status = 0"
|
||||
data = self.query_db(query)
|
||||
if data:
|
||||
logger.info("Prof ID: " + str(data[0][0]))
|
||||
return data[0][0]
|
||||
else:
|
||||
return None
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
# add depend path to system path
|
||||
import os
|
||||
import sys
|
||||
|
||||
import pandas as pd
|
||||
from pdfquery import PDFQuery
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import os
|
||||
import sqlite3
|
||||
import time
|
||||
|
||||
# from icecream import ic
|
||||
from omegaconf import OmegaConf
|
||||
@@ -25,7 +23,6 @@ class BackgroundChecker(QThread):
|
||||
|
||||
|
||||
class MockAvailCheck:
|
||||
|
||||
def __init__(
|
||||
self, links: list = None, appnumber: int = None, parent=None, books=list[dict]
|
||||
):
|
||||
@@ -83,7 +80,6 @@ class MockAvailCheck:
|
||||
|
||||
|
||||
class Mailer(Ui_eMailPreview):
|
||||
|
||||
updateSignal = Signal(int)
|
||||
|
||||
def __init__(self, data=None, parent=None):
|
||||
@@ -149,7 +145,6 @@ class Mailer(Ui_eMailPreview):
|
||||
|
||||
def createAndSendMail(self):
|
||||
import smtplib
|
||||
import ssl
|
||||
from email.mime.multipart import MIMEMultipart
|
||||
from email.mime.text import MIMEText
|
||||
|
||||
@@ -180,7 +175,6 @@ class Mailer(Ui_eMailPreview):
|
||||
|
||||
|
||||
class MailThread(QThread):
|
||||
|
||||
updateSignal = Signal(int)
|
||||
|
||||
def __init__(self, data=None, parent=None):
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import os
|
||||
import sqlite3
|
||||
import threading
|
||||
import time
|
||||
|
||||
from PyQt6.QtCore import QThread, pyqtSignal
|
||||
@@ -8,7 +6,6 @@ from PyQt6.QtCore import QThread, pyqtSignal
|
||||
from src.backend.database import Database
|
||||
from src.logic.log import MyLogger
|
||||
from src.logic.webrequest import BibTextTransformer, WebRequest
|
||||
from src.transformers import RDS_AVAIL_DATA
|
||||
|
||||
# from icecream import ic
|
||||
|
||||
@@ -213,7 +210,6 @@ class AutoAdder(QThread):
|
||||
|
||||
|
||||
class MockAvailCheck:
|
||||
|
||||
def __init__(
|
||||
self, links: list = None, appnumber: int = None, parent=None, books=list[dict]
|
||||
):
|
||||
|
||||
@@ -4,9 +4,8 @@ import json
|
||||
import re
|
||||
from dataclasses import dataclass
|
||||
from dataclasses import field as dataclass_field
|
||||
from typing import Any, List, Optional
|
||||
from typing import Any, List
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
from src.logic.dataclass import BookData
|
||||
@@ -171,13 +170,13 @@ class ARRAYData:
|
||||
)
|
||||
signature_data = eval(sig_data)
|
||||
return signature_data["signatur"]
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
return None
|
||||
|
||||
def _get_author(data):
|
||||
try:
|
||||
array = data.split("[au_display_short]")[1].split(")\n")[0].strip()
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
return ""
|
||||
entries = array.split("\n")
|
||||
authors = []
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
# run again. Do not edit this file unless you know what you are doing.
|
||||
|
||||
|
||||
from PyQt6 import QtCore, QtGui, QtWidgets
|
||||
from PyQt6 import QtCore, QtWidgets
|
||||
|
||||
|
||||
class Ui_MainWindow(object):
|
||||
@@ -44,7 +44,9 @@ class Ui_MainWindow(object):
|
||||
def retranslateUi(self, MainWindow):
|
||||
_translate = QtCore.QCoreApplication.translate
|
||||
MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
|
||||
self.select_action_box.setItemText(0, _translate("MainWindow", "Aktion auswählen"))
|
||||
self.select_action_box.setItemText(
|
||||
0, _translate("MainWindow", "Aktion auswählen")
|
||||
)
|
||||
self.select_action_box.setItemText(1, _translate("MainWindow", "edit_prof"))
|
||||
self.select_action_box.setItemText(2, _translate("MainWindow", "add_user"))
|
||||
self.select_action_box.setItemText(3, _translate("MainWindow", "edit_user"))
|
||||
|
||||
@@ -2,7 +2,6 @@ from .dialog_sources.Ui_about import Ui_about
|
||||
from PyQt6 import QtWidgets
|
||||
from PyQt6.QtCore import PYQT_VERSION_STR
|
||||
from src import Icon, __version__, __author__
|
||||
from omegaconf import OmegaConf
|
||||
|
||||
|
||||
class About(QtWidgets.QDialog, Ui_about):
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
from PyQt6 import QtWidgets
|
||||
from .dialog_sources.Ui_apparat_extend import Ui_Dialog
|
||||
from src import Icon
|
||||
from src.backend import Semester
|
||||
|
||||
|
||||
class ApparatExtendDialog(QtWidgets.QDialog, Ui_Dialog):
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
from PyQt6 import QtCore, QtWidgets
|
||||
from PyQt6 import QtWidgets
|
||||
|
||||
from src.logic.dataclass import BookData
|
||||
|
||||
from .dialog_sources.Ui_edit_bookdata import Ui_Dialog
|
||||
from src import Icon
|
||||
|
||||
|
||||
class BookDataUI(QtWidgets.QDialog, Ui_Dialog):
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
# run again. Do not edit this file unless you know what you are doing.
|
||||
|
||||
|
||||
from PyQt6 import QtCore, QtGui, QtWidgets
|
||||
from PyQt6 import QtCore
|
||||
|
||||
|
||||
class Ui_Form(object):
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
# run again. Do not edit this file unless you know what you are doing.
|
||||
|
||||
|
||||
from PyQt6 import QtCore, QtGui, QtWidgets
|
||||
from PyQt6 import QtCore, QtWidgets
|
||||
|
||||
|
||||
class Ui_extend_confirm(object):
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
# run again. Do not edit this file unless you know what you are doing.
|
||||
|
||||
|
||||
from PyQt6 import QtCore, QtGui, QtWidgets
|
||||
from PyQt6 import QtCore, QtWidgets
|
||||
|
||||
|
||||
class Ui_Dialog(object):
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
# run again. Do not edit this file unless you know what you are doing.
|
||||
|
||||
|
||||
from PyQt6 import QtCore, QtGui, QtWidgets
|
||||
from PyQt6 import QtCore, QtWidgets
|
||||
|
||||
|
||||
class Ui_Dialog(object):
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
# run again. Do not edit this file unless you know what you are doing.
|
||||
|
||||
|
||||
from PyQt6 import QtCore, QtGui, QtWidgets
|
||||
from PyQt6 import QtCore, QtWidgets
|
||||
|
||||
|
||||
class Ui_Erinnerung(object):
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
# run again. Do not edit this file unless you know what you are doing.
|
||||
|
||||
|
||||
from PyQt6 import QtCore, QtGui, QtWidgets
|
||||
from PyQt6 import QtCore, QtWidgets
|
||||
|
||||
|
||||
class Ui_Dialog(object):
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from .dialog_sources.Ui_elsa_generator_confirm import Ui_Dialog
|
||||
from PyQt6 import QtCore, QtWidgets, QtGui
|
||||
from PyQt6 import QtWidgets
|
||||
|
||||
|
||||
class ElsaGenConfirm(QtWidgets.QDialog, Ui_Dialog):
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
from PyQt6 import QtWidgets
|
||||
from PyQt6.QtCore import Qt
|
||||
|
||||
from src.logic.webrequest import BibTextTransformer, WebRequest
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import hashlib
|
||||
|
||||
from PyQt6 import QtCore, QtGui, QtWidgets
|
||||
from PyQt6 import QtCore, QtWidgets
|
||||
|
||||
from src import Icon, logger
|
||||
from src.backend.admin_console import AdminCommands
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
# run again. Do not edit this file unless you know what you are doing.
|
||||
|
||||
|
||||
from PyQt6 import QtCore, QtGui, QtWidgets
|
||||
from PyQt6 import QtCore, QtWidgets
|
||||
|
||||
|
||||
class Ui_Dialog(object):
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from PyQt6 import QtCore, QtWidgets
|
||||
from PyQt6 import QtWidgets
|
||||
|
||||
from src.backend import AutoAdder
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
# run again. Do not edit this file unless you know what you are doing.
|
||||
|
||||
|
||||
from PyQt6 import QtCore, QtGui, QtWidgets
|
||||
from PyQt6 import QtWidgets
|
||||
|
||||
from src import Icon
|
||||
|
||||
|
||||
@@ -906,7 +906,8 @@ class Ui(Ui_Semesterapparat):
|
||||
).setToolTip("Das Medium wurde nicht im Apparat gefunden")
|
||||
|
||||
# make table link clickable
|
||||
self.tableWidget_apparat_media.itemClicked.connect(self.open_link)
|
||||
#self.tableWidget_apparat_media.itemClicked.connect(self.open_link)
|
||||
# self.tableWidget_apparat_media.
|
||||
|
||||
def open_link(self, item):
|
||||
def __openLink(link):
|
||||
@@ -924,7 +925,8 @@ class Ui(Ui_Semesterapparat):
|
||||
if columnname == "Link":
|
||||
link = __openLink(item.text())
|
||||
if link is not None:
|
||||
os.system("start " + link)
|
||||
webbrowser.open(link)
|
||||
#os.system("start " + link)
|
||||
return
|
||||
else:
|
||||
pass
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from PyQt6 import QtWidgets, QtCore, QtGui
|
||||
from PyQt6 import QtWidgets
|
||||
from PyQt6.QtCore import pyqtSignal
|
||||
from .widget_sources.Ui_admin_create_user import Ui_Dialog
|
||||
from src.backend import AdminCommands, Database
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
from .widget_sources.Ui_admin_edit_prof import Ui_Dialog #
|
||||
from PyQt6 import QtWidgets, QtCore
|
||||
from PyQt6.QtCore import pyqtSignal
|
||||
from PyQt6 import QtWidgets
|
||||
from src import logger
|
||||
from src.logic import Prof
|
||||
from src.backend import Database
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
from .widget_sources.Ui_admin_edit_user import Ui_Dialog
|
||||
from PyQt6 import QtWidgets, QtCore
|
||||
from PyQt6.QtCore import pyqtSignal
|
||||
from PyQt6 import QtWidgets
|
||||
from src.backend import Database
|
||||
from src.backend import AdminCommands
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from .widget_sources.Ui_calendar_entry import Ui_Dialog
|
||||
from PyQt6 import QtWidgets, QtCore
|
||||
from PyQt6.QtCore import pyqtSignal, QDate
|
||||
from PyQt6 import QtWidgets
|
||||
from PyQt6.QtCore import pyqtSignal
|
||||
from src.backend.database import Database
|
||||
from src import Icon
|
||||
|
||||
|
||||
@@ -134,7 +134,7 @@ class ElsaDialog(QtWidgets.QDialog, Ui_Dialog):
|
||||
return profs
|
||||
|
||||
def elsa_context_menu(self, position):
|
||||
menu = QtWidgets.QMenu()
|
||||
QtWidgets.QMenu()
|
||||
# TODO: add functions
|
||||
pass
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
from .widget_sources.Ui_icon_widget import Ui_Dialog
|
||||
from PyQt6 import QtWidgets, QtCore, QtGui
|
||||
from PyQt6.QtCore import Qt
|
||||
from PyQt6 import QtWidgets
|
||||
from src import logger
|
||||
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ from PyQt6.QtCore import pyqtSignal
|
||||
from src.backend import Database, Semester
|
||||
from src import logger
|
||||
from src.logic import custom_sort, Prof, sort_semesters_list
|
||||
from src.ui.dialogs import Mail_Dialog, ApparatExtendDialog
|
||||
from src.ui.dialogs import Mail_Dialog, ApparatExtendDialog, reminder_ui
|
||||
from src.ui.widgets import DataGraph, StatusWidget
|
||||
|
||||
from natsort import natsorted
|
||||
@@ -19,6 +19,7 @@ class SearchStatisticPage(QtWidgets.QDialog, Ui_Dialog):
|
||||
apparat_open = pyqtSignal(str)
|
||||
reloadSignal = pyqtSignal()
|
||||
refreshSignal = pyqtSignal()
|
||||
updateCalendar = pyqtSignal(int, list)
|
||||
|
||||
def __init__(self):
|
||||
logger.info("SearchStatisticPage started")
|
||||
@@ -46,7 +47,8 @@ class SearchStatisticPage(QtWidgets.QDialog, Ui_Dialog):
|
||||
self.tableWidget.resizeColumnsToContents()
|
||||
self.tableWidget.resizeRowsToContents()
|
||||
self.db = Database()
|
||||
self.box_appnrs.addItems(str(i) for i in self.db.getUnavailableApparatNumbers())
|
||||
self.appnrs = self.db.getUnavailableApparatNumbers()
|
||||
self.box_appnrs.addItems(str(i) for i in self.appnrs)
|
||||
self.splitter = QtWidgets.QSplitter(QtCore.Qt.Orientation.Horizontal)
|
||||
# insert splitter in apparatResult to allow resizing of the columns
|
||||
self.splitter.addWidget(self.app_results)
|
||||
@@ -54,6 +56,8 @@ class SearchStatisticPage(QtWidgets.QDialog, Ui_Dialog):
|
||||
self.apparatResult.layout().removeWidget(self.stats)
|
||||
self.apparatResult.layout().removeWidget(self.app_results)
|
||||
self.apparatResult.layout().addWidget(self.splitter)
|
||||
# set tableWidget column 0 to be 50px wide
|
||||
self.tableWidget.setColumnWidth(0, 50)
|
||||
self.semester = Semester().value
|
||||
self.populate_tab()
|
||||
|
||||
@@ -83,9 +87,12 @@ class SearchStatisticPage(QtWidgets.QDialog, Ui_Dialog):
|
||||
menu = QtWidgets.QMenu()
|
||||
restore_action = menu.addAction("Wiederherstellen")
|
||||
extend_action = menu.addAction("Verlängern")
|
||||
remind_action = menu.addAction("Erinnerung")
|
||||
|
||||
menu.addAction(restore_action)
|
||||
restore_action.triggered.connect(self.restore_apparat)
|
||||
extend_action.triggered.connect(self.extend_apparat)
|
||||
remind_action.triggered.connect(self.reminder)
|
||||
menu.exec(self.tableWidget.mapToGlobal(position))
|
||||
|
||||
def extend_apparat(self):
|
||||
@@ -101,6 +108,23 @@ class SearchStatisticPage(QtWidgets.QDialog, Ui_Dialog):
|
||||
self.tableWidget.removeRow(self.tableWidget.currentRow())
|
||||
self.refreshSignal.emit()
|
||||
|
||||
def reminder(self):
|
||||
logger.info("Opening reminder dialog")
|
||||
reminder = reminder_ui()
|
||||
reminder.exec()
|
||||
tableposition = self.tableWidget.currentRow()
|
||||
appnr = self.tableWidget.item(tableposition, 2).text()
|
||||
if reminder.result() == QtWidgets.QDialog.DialogCode.Accepted:
|
||||
data = reminder.return_message()
|
||||
# #print(data)
|
||||
self.db.addMessage(
|
||||
data,
|
||||
"admin",
|
||||
appnr,
|
||||
)
|
||||
self.updateCalendar.emit(data)
|
||||
logger.info("committed message to database")
|
||||
|
||||
def tabW2_changed(self):
|
||||
if self.tabWidget_2.currentIndex() == 0:
|
||||
self.stackedWidget_4.setCurrentIndex(0)
|
||||
@@ -228,7 +252,7 @@ class SearchStatisticPage(QtWidgets.QDialog, Ui_Dialog):
|
||||
self.box_dauerapp.addItems(["Ja", "Nein", ""])
|
||||
self.box_dauerapp.setCurrentText("")
|
||||
# add custom vaules
|
||||
appnrs = self.db.getUnavailableApparatNumbers()
|
||||
appnrs = self.appnrs
|
||||
apparats = natsorted(appnrs)
|
||||
apparats = [str(apparat) for apparat in apparats]
|
||||
self.box_appnrs.addItems(apparats)
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
# run again. Do not edit this file unless you know what you are doing.
|
||||
|
||||
|
||||
from PyQt6 import QtCore, QtGui, QtWidgets
|
||||
from PyQt6 import QtCore, QtWidgets
|
||||
|
||||
|
||||
class Ui_Dialog(object):
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
# run again. Do not edit this file unless you know what you are doing.
|
||||
|
||||
|
||||
from PyQt6 import QtCore, QtGui, QtWidgets
|
||||
from PyQt6 import QtCore, QtWidgets
|
||||
|
||||
|
||||
class Ui_Dialog(object):
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
# run again. Do not edit this file unless you know what you are doing.
|
||||
|
||||
|
||||
from PyQt6 import QtCore, QtGui, QtWidgets
|
||||
from PyQt6 import QtCore, QtWidgets
|
||||
|
||||
|
||||
class Ui_Dialog(object):
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
# run again. Do not edit this file unless you know what you are doing.
|
||||
|
||||
|
||||
from PyQt6 import QtCore, QtGui, QtWidgets
|
||||
from PyQt6 import QtCore, QtWidgets
|
||||
|
||||
|
||||
class Ui_Dialog(object):
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
# run again. Do not edit this file unless you know what you are doing.
|
||||
|
||||
|
||||
from PyQt6 import QtCore, QtGui, QtWidgets
|
||||
from PyQt6 import QtCore, QtWidgets
|
||||
|
||||
|
||||
class Ui_Dialog(object):
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
# run again. Do not edit this file unless you know what you are doing.
|
||||
|
||||
|
||||
from PyQt6 import QtCore, QtGui, QtWidgets
|
||||
from PyQt6 import QtCore, QtWidgets
|
||||
|
||||
|
||||
class Ui_Dialog(object):
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
# run again. Do not edit this file unless you know what you are doing.
|
||||
|
||||
|
||||
from PyQt6 import QtCore, QtGui, QtWidgets
|
||||
from PyQt6 import QtCore, QtWidgets
|
||||
|
||||
|
||||
class Ui_Dialog(object):
|
||||
|
||||
@@ -10,43 +10,11 @@
|
||||
|
||||
from PyQt6.QtCore import (
|
||||
QCoreApplication,
|
||||
QDate,
|
||||
QDateTime,
|
||||
QLocale,
|
||||
QMetaObject,
|
||||
QObject,
|
||||
QPoint,
|
||||
QRect,
|
||||
QSize,
|
||||
Qt,
|
||||
QTime,
|
||||
QUrl,
|
||||
)
|
||||
from PyQt6.QtGui import (
|
||||
QBrush,
|
||||
QColor,
|
||||
QConicalGradient,
|
||||
QCursor,
|
||||
QFont,
|
||||
QFontDatabase,
|
||||
QGradient,
|
||||
QIcon,
|
||||
QImage,
|
||||
QKeySequence,
|
||||
QLinearGradient,
|
||||
QPainter,
|
||||
QPalette,
|
||||
QPixmap,
|
||||
QRadialGradient,
|
||||
QTransform,
|
||||
)
|
||||
from PyQt6.QtWidgets import (
|
||||
QApplication,
|
||||
QDialog,
|
||||
QGridLayout,
|
||||
QSizePolicy,
|
||||
QTabWidget,
|
||||
QWidget,
|
||||
)
|
||||
|
||||
|
||||
|
||||
15
src/utils/documentation.py
Normal file
15
src/utils/documentation.py
Normal file
@@ -0,0 +1,15 @@
|
||||
import os
|
||||
import sys
|
||||
|
||||
|
||||
def run_mkdocs():
|
||||
with open(os.devnull, "w") as devnull:
|
||||
old_stdout = sys.stdout
|
||||
old_stderr = sys.stderr
|
||||
sys.stdout = devnull
|
||||
sys.stderr = devnull
|
||||
try:
|
||||
os.system("mkdocs serve -q")
|
||||
finally:
|
||||
sys.stdout = old_stdout
|
||||
sys.stderr = old_stderr
|
||||
@@ -2,7 +2,6 @@ import os
|
||||
import sys
|
||||
|
||||
# from PyQt6 import Webview
|
||||
from PyQt6.QtWebEngineWidgets import QWebEngineView
|
||||
from PyQt6.QtWidgets import QApplication, QMainWindow, QTabWidget
|
||||
|
||||
documentation_path = "docs"
|
||||
@@ -36,9 +35,8 @@ class DocumentationViewer(QMainWindow):
|
||||
tab_name="Documentation",
|
||||
html_content="<h1>Documentation</h1><p>Your HTML documentation content goes here.</p>",
|
||||
):
|
||||
documentation_tab = QWebEngineView()
|
||||
documentation_tab.setHtml(html_content)
|
||||
self.tabs.addTab(documentation_tab, tab_name)
|
||||
# open documentation
|
||||
name = tab_name
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
@@ -1,14 +1,9 @@
|
||||
from datetime import datetime
|
||||
from docx import Document
|
||||
from docx.enum.text import WD_PARAGRAPH_ALIGNMENT
|
||||
from docx.enum.table import WD_ROW_HEIGHT_RULE
|
||||
from docx.shared import Pt, RGBColor, Cm, Inches
|
||||
from docx.shared import Pt, RGBColor, Cm
|
||||
from docx.oxml import OxmlElement
|
||||
from docx.oxml.ns import qn
|
||||
from docx2pdf import convert
|
||||
import win32print
|
||||
import win32api
|
||||
import tempfile
|
||||
import os
|
||||
from os.path import basename
|
||||
|
||||
|
||||
Reference in New Issue
Block a user