]> Softwares of Agnibho - medscript.git/commitdiff
Option to set age as default
authorAgnibho Mondal <mondal@agnibho.com>
Wed, 8 Nov 2023 12:40:46 +0000 (18:10 +0530)
committerAgnibho Mondal <mondal@agnibho.com>
Wed, 8 Nov 2023 12:40:46 +0000 (18:10 +0530)
config.py
setting.py
window.py

index 0f0c84a51032cf51381a89ef59bb93c13abc1b67..ae6b2b7773d79602c06987302f0fa29af7871b5c 100644 (file)
--- a/config.py
+++ b/config.py
@@ -34,6 +34,7 @@ default = {
         "template": "default_prescription",
         "preset_directory": "preset",
         "form_directory": "form",
+        "age_default": True,
         "enable_form": False,
         "plugin_directory": "plugin",
         "enable_plugin": False,
index 9a33bb74f19b3b1e3114661ceb936048eaaded69..f4aaf3cefdad13ea0f7f5ec5b11b9484fde97e99 100644 (file)
@@ -42,6 +42,7 @@ class EditConfiguration(QDialog):
             self.input_prescriber.setText(self.config["prescriber"])
             self.input_newline.setChecked(bool(self.config["preset_newline"]))
             self.input_delimiter.setCurrentText(self.config["preset_delimiter"])
+            self.input_agedob.setChecked(bool(self.config["age_default"]))
             self.input_markdown.setChecked(bool(self.config["markdown"]))
             self.input_update.setChecked(bool(self.config["check_update"]))
             self.input_form.setChecked(bool(self.config["enable_form"]))
@@ -52,7 +53,7 @@ class EditConfiguration(QDialog):
             self.input_root.setText(self.config["root_bundle"])
         except Exception as e:
             QMessageBox.critical(self,"Failed to load", "Failed to load the data into the application.")
-            raise(e)
+            logging.warning(e)
 
     def save(self):
         if(QMessageBox.StandardButton.Yes==QMessageBox.question(self,"Confirm Save", "This action will overwrite the previous configuration. Continue?")):
@@ -61,6 +62,7 @@ class EditConfiguration(QDialog):
                 self.config["prescriber"]=self.input_prescriber.text()
                 self.config["preset_newline"]=self.input_newline.isChecked()
                 self.config["preset_delimiter"]=self.input_delimiter.currentText()
+                self.config["age_default"]=self.input_agedob.isChecked()
                 self.config["markdown"]=self.input_markdown.isChecked()
                 self.config["check_update"]=self.input_update.isChecked()
                 self.config["enable_form"]=self.input_form.isChecked()
@@ -109,6 +111,8 @@ class EditConfiguration(QDialog):
         self.input_delimiter=QComboBox(self)
         self.input_delimiter.addItems([",", ";"])
         layout.addRow("Preset Delimiter", self.input_delimiter)
+        self.input_agedob=QCheckBox("Age default in new prescriptions", self)
+        layout.addRow("Age/DOB", self.input_agedob)
         self.input_markdown=QCheckBox("Enable markdown formatting", self)
         layout.addRow("Markdown", self.input_markdown)
         self.input_update=QCheckBox("Check update on startup", self)
index ca80b94556cc38a932e47b4b05e5f4e9e54ed664..30cdf44786b56e0b6ddd854574192ecc01c269ae 100644 (file)
--- a/window.py
+++ b/window.py
@@ -448,6 +448,9 @@ class MainWindow(QMainWindow):
         self.update_instance()
         self.plugin.new(self.prescription)
         self.load_interface_from_instance()
+        if(config["age_default"]):
+            self.btnAge.click()
+            self.update_instance()
         self.save_state=md5(self.prescription.get_json().encode()).hexdigest()
 
     def change_prescriber(self, file):