From ef404375f06fcaac77ba873dc97132d3af60b090 Mon Sep 17 00:00:00 2001 From: Agnibho Mondal Date: Mon, 4 Sep 2023 00:46:02 +0530 Subject: [PATCH] Arbitrary text entry if preset unavailable --- window.py | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/window.py b/window.py index 1ce90d8..ed9234d 100644 --- a/window.py +++ b/window.py @@ -108,47 +108,52 @@ class MainWindow(QMainWindow): def insert_preset_note(self): try: self.input_note.insertPlainText(self.preset_note.data[self.input_note_preset.currentText()]) + except KeyError: + self.input_note.insertPlainText(self.input_note_preset.currentText()) + finally: self.input_note_preset.setCurrentIndex(-1) if config["preset_newline"]: self.input_note.insertPlainText("\n") - except KeyError: - pass def insert_preset_report(self): try: self.input_report.insertPlainText(self.preset_report.data[self.input_report_preset.currentText()]) + except KeyError: + self.input_report.insertPlainText(self.input_report_preset.currentText()) + finally: self.input_report_preset.setCurrentIndex(-1) if config["preset_newline"]: self.input_report.insertPlainText("\n") - except KeyError: - pass def insert_preset_investigation(self): try: self.input_investigation.insertPlainText(self.preset_investigation.data[self.input_investigation_preset.currentText()]) + except KeyError: + self.input_investigation.insertPlainText(self.input_investigation_preset.currentText()) + finally: self.input_investigation_preset.setCurrentIndex(-1) if config["preset_newline"]: self.input_investigation.insertPlainText("\n") - except KeyError: - pass def insert_preset_medication(self): try: self.input_medication.insertPlainText(self.preset_medication.data[self.input_medication_preset.currentText()]) + except KeyError: + self.input_medication.insertPlainText(self.input_medication_preset.currentText()) + finally: self.input_medication_preset.setCurrentIndex(-1) if config["preset_newline"]: self.input_medication.insertPlainText("\n") - except KeyError: - pass def insert_preset_advice(self): try: self.input_advice.insertPlainText(self.preset_advice.data[self.input_advice_preset.currentText()]) + except KeyError: + self.input_advice.insertPlainText(self.input_advice_preset.currentText()) + finally: self.input_advice_preset.setCurrentIndex(-1) if config["preset_newline"]: self.input_advice.insertPlainText("\n") - except KeyError: - pass def load_interface(self, file="", date=None, id="", name="", age="", sex="", address="", contact="", extra="", mode="", daw="", note="", report="", investigation="", medication="", advice=""): try: -- 2.39.5