self.input_newline.setChecked(bool(self.config["preset_newline"]))
self.input_delimiter.setCurrentText(self.config["preset_delimiter"])
self.input_markdown.setChecked(bool(self.config["markdown"]))
+ self.input_update.setChecked(bool(self.config["check_update"]))
self.input_smime.setChecked(bool(self.config["smime"]))
self.input_key.setText(self.config["private_key"])
self.input_certificate.setText(self.config["certificate"])
self.config["preset_newline"]=self.input_newline.isChecked()
self.config["preset_delimiter"]=self.input_delimiter.currentText()
self.config["markdown"]=self.input_markdown.isChecked()
+ self.config["check_update"]=self.input_update.isChecked()
self.config["smime"]=self.input_smime.isChecked()
self.config["private_key"]=self.input_key.text()
self.config["certificate"]=self.input_certificate.text()
self.hide()
except Exception as e:
QMessageBox.critical(self,"Failed to save", "Failed to save the data to the file.")
- raise(e)
+ print(e)
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
try:
with open(config_file) as f:
- self.config=json.loads(f.read())
+ self.config=json.loads(f.read()) | config
except Exception as e:
print(e)
self.config=config
layout.addRow("Preset Delimiter", self.input_delimiter)
self.input_markdown=QCheckBox("Enable markdown formatting", self)
layout.addRow("Markdown", self.input_markdown)
+ self.input_update=QCheckBox("Check update on startup", self)
+ layout.addRow("Check Update", self.input_update)
self.input_smime=QCheckBox("Enable digital signature (experimental)", self)
layout.addRow("S/MIME", self.input_smime)
self.input_key=QLineEdit(self)
# MedScript is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along with MedScript. If not, see <https://www.gnu.org/licenses/>.
-import os, sys, datetime, dateutil.parser, shutil, json
+import os, sys, datetime, dateutil.parser, shutil, json, threading
from PyQt6.QtCore import Qt, QDateTime, QSize, pyqtSignal
from PyQt6.QtWidgets import QWidget, QMainWindow, QMessageBox, QLabel, QPushButton, QLineEdit, QTextEdit, QDateTimeEdit, QListWidget, QComboBox, QCheckBox, QVBoxLayout, QHBoxLayout, QFormLayout, QToolBar, QTabWidget, QStatusBar, QFileDialog, QInputDialog, QCompleter, QSizePolicy
from PyQt6.QtGui import QAction, QIcon
if(len(self.prescription.prescriber.name.strip())<1):
self.cmd_prescriber()
+ if(config["check_update"]):
+ threading.Thread(target=self.cmd_update, args=[True]).start()
+
self.setWindowIcon(QIcon(os.path.join(config["resource"], "icon_medscript.ico")))
self.showMaximized()