Refactor UI and remove unused tests
- Deleted the generated UI file `untitled_ui.py` as it is no longer needed. - Updated `search_statistic_page.ui` to enhance table properties, including grid style and sort indicators. - Modified `search_statistic_page_ui.py` to reflect changes in the UI file and improve table header settings. - Improved cleanup logic in `richtext.py` to ensure files are only deleted if they exist. - Adjusted spacing in document generation for better formatting. - Removed obsolete test files: `database_test.py`, `many_webrequest_test.py`, `test_database.py`, and `webrequest_test.py` to clean up the test suite.
This commit is contained in:
@@ -108,14 +108,14 @@ class SemesterDocument:
|
||||
self.filename = filename
|
||||
if full:
|
||||
logger.info("Full document generation")
|
||||
self.cleanup
|
||||
logger.info("Cleanup done")
|
||||
self.make_document()
|
||||
logger.info("Document created")
|
||||
self.create_pdf()
|
||||
logger.info("PDF created")
|
||||
print_document(self.filename + ".pdf")
|
||||
# print_document(self.filename + ".pdf")
|
||||
logger.info("Document printed")
|
||||
self.cleanup
|
||||
logger.info("Cleanup done")
|
||||
|
||||
def set_table_border(self, table):
|
||||
"""
|
||||
@@ -146,7 +146,7 @@ class SemesterDocument:
|
||||
table.alignment = WD_PARAGRAPH_ALIGNMENT.CENTER
|
||||
|
||||
# Set column widths by directly modifying the cell properties
|
||||
widths = [Cm(1.19), Cm(18)]
|
||||
widths = [Cm(1.19), Cm(10)]
|
||||
for col_idx, width in enumerate(widths):
|
||||
for cell in table.columns[col_idx].cells:
|
||||
cell_width_element = cell._element.xpath(".//w:tcPr")[0]
|
||||
@@ -251,8 +251,9 @@ class SemesterDocument:
|
||||
|
||||
@property
|
||||
def cleanup(self):
|
||||
os.remove(f"{self.filename}.docx")
|
||||
os.remove(f"{self.filename}.pdf")
|
||||
if os.path.exists(f"{self.filename}.docx"):
|
||||
os.remove(f"{self.filename}.docx")
|
||||
os.remove(f"{self.filename}.pdf")
|
||||
|
||||
@property
|
||||
def send(self):
|
||||
@@ -295,9 +296,9 @@ class SemapSchilder:
|
||||
for entry in self.entries:
|
||||
paragraph = self.doc.add_paragraph(entry)
|
||||
paragraph.alignment = WD_PARAGRAPH_ALIGNMENT.CENTER
|
||||
paragraph.paragraph_format.line_spacing = Pt(20) # Set fixed line spacing
|
||||
paragraph.paragraph_format.space_before = Pt(4) # Remove spacing before
|
||||
paragraph.paragraph_format.space_after = Pt(4) # Remove spacing after
|
||||
paragraph.paragraph_format.line_spacing = Pt(23) # Set fixed line spacing
|
||||
paragraph.paragraph_format.space_before = Pt(2) # Remove spacing before
|
||||
paragraph.paragraph_format.space_after = Pt(2) # Remove spacing after
|
||||
|
||||
run = paragraph.runs[0]
|
||||
run.font.name = self.font_name
|
||||
@@ -308,16 +309,11 @@ class SemapSchilder:
|
||||
# Add a line to be used as a guideline for cutting
|
||||
line = self.doc.add_paragraph()
|
||||
line.alignment = WD_PARAGRAPH_ALIGNMENT.CENTER
|
||||
line.paragraph_format.line_spacing = Pt(20) # Match line spacing
|
||||
line.paragraph_format.space_before = Pt(4) # Remove spacing before
|
||||
line.paragraph_format.space_after = Pt(4) # Remove spacing after
|
||||
line.paragraph_format.line_spacing = Pt(23) # Match line spacing
|
||||
line.paragraph_format.space_before = Pt(2) # Remove spacing before
|
||||
line.paragraph_format.space_after = Pt(2) # Remove spacing after
|
||||
line.add_run("--------------------------")
|
||||
|
||||
for paragraph in self.doc.paragraphs:
|
||||
content = paragraph.text.strip()
|
||||
if len(content) > 45:
|
||||
paragraph.runs[0].font.size = Pt(20)
|
||||
|
||||
def save_document(self):
|
||||
# Save the document
|
||||
self.doc.save(f"{self.filename}.docx")
|
||||
@@ -351,10 +347,35 @@ class SemapSchilder:
|
||||
|
||||
if __name__ == "__main__":
|
||||
entries = [
|
||||
"Schlenke (Glaube und Handels. Luthers Freiheitsschrift)",
|
||||
"Lüsebrink (Theorie und Praxis der Leichtathletik)",
|
||||
"Tester (Apparatstester)",
|
||||
"Entry 4",
|
||||
"Entry 5",
|
||||
"Kulovics (ISP-Betreuung)",
|
||||
"Köhler (Ausgewählte Aspekte der materiellen Kultur Textil)",
|
||||
"Grau (Young Adult Literature)",
|
||||
"Schiebel (Bewegung II:Ausgewählte Problemfelder)",
|
||||
"Schiebel (Ernährungswiss. Perspektive)",
|
||||
"Park (Kommunikation und Kooperation)",
|
||||
"Schiebel (Schwimmen)",
|
||||
"Huppertz (Philosophieren mit Kindern)",
|
||||
"Heyl (Heyl)",
|
||||
"Reuter (Verschiedene Veranstaltungen)",
|
||||
"Reinhold (Arithmetik und mathematisches Denken)",
|
||||
"Wirtz (Forschungsmethoden)",
|
||||
"Schleider (Essstörungen)",
|
||||
"Schleider (Klinische Psychologie)",
|
||||
"Schleider (Doktorandenkolloquium)",
|
||||
"Schleider (Störungen Sozialverhaltens/Delinquenz)",
|
||||
"Burth (EU Forschung im Int. Vergleich/EU Gegenstand biling. Didaktik)",
|
||||
"Reinhardt (Einführung Politikdidaktik)",
|
||||
"Schleider (Psychologische Interventionsmethoden)",
|
||||
"Schleider (ADHS)",
|
||||
"Schleider (Beratung und Teamarbeit)",
|
||||
"Schleider (LRS)",
|
||||
"Schleider (Gesundheitspsychologie)",
|
||||
"Schleider (Elterntraining)",
|
||||
"Wulff (Hochschulzertifikat DaZ)",
|
||||
"Dinkelaker ( )",
|
||||
"Droll (Einführung in die Sprachwissenschaft)",
|
||||
"Karoß (Gymnastik - Sich Bewegen mit und ohne Handgeräte)",
|
||||
"Sahrai (Kindheit und Gesellschaft)",
|
||||
]
|
||||
doc = SemapSchilder(entries).send
|
||||
doc = SemapSchilder(entries)
|
||||
Reference in New Issue
Block a user