]> Softwares of Agnibho - medscript.git/commitdiff
Multiple bugfixes
authorAgnibho Mondal <mondal@agnibho.com>
Sun, 17 Sep 2023 19:17:16 +0000 (00:47 +0530)
committerAgnibho Mondal <mondal@agnibho.com>
Sun, 17 Sep 2023 19:17:16 +0000 (00:47 +0530)
config.py
medscript.py
window.py

index 24f1c1ee997d6c81266ccbef8ca0db5f3e29aaae..d363eba23edeeac1d2f3c53c8f105e1d954264da 100644 (file)
--- a/config.py
+++ b/config.py
@@ -79,7 +79,25 @@ os.makedirs(config["document_directory"], exist_ok=True)
 os.makedirs(config["prescriber_directory"], exist_ok=True)
 os.makedirs(config["preset_directory"], exist_ok=True)
 os.makedirs(config["template_directory"], exist_ok=True)
+if not os.path.exists(os.path.join(config["data_directory"], "config.json")):
+    shutil.copyfile(os.path.abspath(os.path.join(real_dir, "data", "config.json")), os.path.join(config["data_directory"], "config.json"))
 if not os.path.exists(os.path.join(config["prescriber_directory"], "prescriber.json")):
     shutil.copyfile(os.path.abspath(os.path.join(real_dir, "data", "prescriber", "prescriber.json")), os.path.join(config["prescriber_directory"], "prescriber.json"))
 if not os.path.exists(os.path.join(config["template_directory"], "default")):
     shutil.copytree(os.path.abspath(os.path.join(real_dir, "data", "template", "default")), os.path.join(config["template_directory"], "default"))
+if not os.path.exists(os.path.join(config["template_directory"], "medcert")):
+    shutil.copytree(os.path.abspath(os.path.join(real_dir, "data", "template", "medcert")), os.path.join(config["template_directory"], "medcert"))
+if not os.path.exists(os.path.join(config["preset_directory"], "certify.csv")):
+    shutil.copyfile(os.path.abspath(os.path.join(real_dir, "data", "preset", "certify.csv")), os.path.join(config["preset_directory"], "certify.csv"))
+if not os.path.exists(os.path.join(config["preset_directory"], "note.csv")):
+    shutil.copyfile(os.path.abspath(os.path.join(real_dir, "data", "preset", "note.csv")), os.path.join(config["preset_directory"], "note.csv"))
+if not os.path.exists(os.path.join(config["preset_directory"], "report.csv")):
+    shutil.copyfile(os.path.abspath(os.path.join(real_dir, "data", "preset", "report.csv")), os.path.join(config["preset_directory"], "report.csv"))
+if not os.path.exists(os.path.join(config["preset_directory"], "investigation.csv")):
+    shutil.copyfile(os.path.abspath(os.path.join(real_dir, "data", "preset", "investigation.csv")), os.path.join(config["preset_directory"], "investigation.csv"))
+if not os.path.exists(os.path.join(config["preset_directory"], "advice.csv")):
+    shutil.copyfile(os.path.abspath(os.path.join(real_dir, "data", "preset", "advice.csv")), os.path.join(config["preset_directory"], "advice.csv"))
+if not os.path.exists(os.path.join(config["preset_directory"], "medication.csv")):
+    shutil.copyfile(os.path.abspath(os.path.join(real_dir, "data", "preset", "medication.csv")), os.path.join(config["preset_directory"], "medication.csv"))
+if not os.path.exists(os.path.join(config["preset_directory"], "additional.csv")):
+    shutil.copyfile(os.path.abspath(os.path.join(real_dir, "data", "preset", "additional.csv")), os.path.join(config["preset_directory"], "additional.csv"))
index 0659c46d1ace9cf2a8045daf8c161fcbd0bd79e9..af40c40c938ae20131c0a9df53692767a9cf3a13 100644 (file)
@@ -8,10 +8,11 @@
 import sys, os
 from PyQt6.QtWidgets import QApplication
 from window import MainWindow
+from config import config
 
 if __name__=="__main__":
     app=QApplication(sys.argv)
-    with open(os.path.join("resource", "style.qss")) as qss:
+    with open(os.path.join(config["resource"], "style.qss")) as qss:
         app.setStyleSheet(qss.read())
     window=MainWindow()
     sys.exit(app.exec())
index 05c9710105e95198b1f736b180d7980a07bf8f0d..2416ff8856fb24e9a23339a9dfafbb5ae56110ea 100644 (file)
--- a/window.py
+++ b/window.py
@@ -12,7 +12,7 @@ from PyQt6.QtGui import QAction, QIcon
 from pathlib import Path
 from hashlib import md5
 
-from config import config, sign_available
+from config import config, real_dir, sign_available
 from prescription import Prescription
 from renderer import Renderer
 from filehandler import FileHandler
@@ -194,7 +194,7 @@ class MainWindow(QMainWindow):
         QMessageBox.about(self,"MedScript", txt)
 
     def cmd_help(self):
-        self.viewbox.md("README")
+        self.viewbox.md(os.path.join(real_dir, "README"))
         self.viewbox.show()
 
     def insert_preset_extra(self):
@@ -511,7 +511,6 @@ class MainWindow(QMainWindow):
         spacer.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Expanding)
         toolbar.addWidget(spacer)
         self.label_prescriber=QLabel(self)
-        self.label_prescriber=QLabel(self)
         toolbar.addWidget(self.label_prescriber)
         self.addToolBar(toolbar)