From d1e11d69e2027e256096681c1b1309f1530e7a3d Mon Sep 17 00:00:00 2001 From: Agnibho Mondal Date: Sat, 16 Sep 2023 03:21:43 +0530 Subject: [PATCH] Added stylesheet --- medscript.py | 4 +++- renderbox.py | 28 ++++++++++++++-------------- resource/style.qss | 7 +++++++ window.py | 8 ++++++++ 4 files changed, 32 insertions(+), 15 deletions(-) create mode 100644 resource/style.qss diff --git a/medscript.py b/medscript.py index 7c0bd27..0659c46 100644 --- a/medscript.py +++ b/medscript.py @@ -5,11 +5,13 @@ # 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 . -import sys +import sys, os from PyQt6.QtWidgets import QApplication from window import MainWindow if __name__=="__main__": app=QApplication(sys.argv) + with open(os.path.join("resource", "style.qss")) as qss: + app.setStyleSheet(qss.read()) window=MainWindow() sys.exit(app.exec()) diff --git a/renderbox.py b/renderbox.py index c0f19a0..037b9de 100644 --- a/renderbox.py +++ b/renderbox.py @@ -5,9 +5,9 @@ # 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 . -from PyQt6.QtWidgets import QWidget, QMainWindow, QToolBar, QFileDialog, QComboBox, QSizePolicy +from PyQt6.QtWidgets import QWidget, QMainWindow, QToolBar, QFileDialog, QComboBox, QPushButton, QSizePolicy from PyQt6.QtWebEngineWidgets import QWebEngineView -from PyQt6.QtGui import QAction, QIcon, QPageLayout, QPageSize +from PyQt6.QtGui import QIcon, QPageLayout, QPageSize from PyQt6.QtCore import QUrl, QMarginsF from PyQt6.QtPrintSupport import QPrinter, QPrintDialog import os @@ -35,15 +35,15 @@ class RenderBox(QMainWindow): self.printer=QPrinter(QPrinter.PrinterMode.HighResolution) - action_pdf=QAction("Save PDF", self) - action_pdf.setShortcut("Ctrl+S") - action_pdf.triggered.connect(self.cmd_pdf) - action_print=QAction("Print Document", self) - action_print.setShortcut("Ctrl+P") - action_print.triggered.connect(self.cmd_print) - action_close=QAction("Close Window", self) - action_close.setShortcut("Ctrl+Q") - action_close.triggered.connect(self.hide) + button_pdf=QPushButton("Save PDF", self) + button_pdf.setShortcut("Ctrl+S") + button_pdf.clicked.connect(self.cmd_pdf) + button_print=QPushButton("Print Document", self) + button_print.setShortcut("Ctrl+P") + button_print.clicked.connect(self.cmd_print) + button_close=QPushButton("Close Window", self) + button_close.setShortcut("Ctrl+Q") + button_close.clicked.connect(self.hide) page_size=[] for size in QPageSize.PageSizeId: @@ -53,12 +53,12 @@ class RenderBox(QMainWindow): toolbar=QToolBar("View Toolbar", floatable=False, movable=False) toolbar.addWidget(self.input_size) - toolbar.addAction(action_pdf) + toolbar.addWidget(button_pdf) spacer=QWidget(self) spacer.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Expanding) toolbar.addWidget(spacer) - toolbar.addAction(action_print) - toolbar.addAction(action_close) + toolbar.addWidget(button_print) + toolbar.addWidget(button_close) self.addToolBar(toolbar) self.webview=QWebEngineView() diff --git a/resource/style.qss b/resource/style.qss new file mode 100644 index 0000000..f6f8b63 --- /dev/null +++ b/resource/style.qss @@ -0,0 +1,7 @@ +QLabel, QLineEdit, QTextEdit, QPushButton, QCheckBox, QComboBox { +font-size: 14px; +} + +.info_head { +font-weight: bold; +} diff --git a/window.py b/window.py index 3a7e09c..78091ea 100644 --- a/window.py +++ b/window.py @@ -502,6 +502,7 @@ 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) @@ -552,6 +553,7 @@ class MainWindow(QMainWindow): layout_note=QVBoxLayout(tab_note) layout_note2=QHBoxLayout() label_note=QLabel("Clinical Notes") + label_note.setProperty("class", "info_head") self.input_note_preset=QComboBox(self) self.input_note_preset.addItems(self.preset_note.data.keys()) self.input_note_preset.setCurrentIndex(-1) @@ -572,6 +574,7 @@ class MainWindow(QMainWindow): layout_report=QVBoxLayout(tab_report) layout_report2=QHBoxLayout() label_report=QLabel("Available Reports") + label_report.setProperty("class", "info_head") self.input_report_preset=QComboBox(self) self.input_report_preset.addItems(self.preset_report.data.keys()) self.input_report_preset.setCurrentIndex(-1) @@ -592,6 +595,7 @@ class MainWindow(QMainWindow): layout_advice=QVBoxLayout(tab_advice) layout_advice2=QHBoxLayout() label_advice=QLabel("Advice") + label_advice.setProperty("class", "info_head") self.input_advice_preset=QComboBox(self) self.input_advice_preset.addItems(self.preset_advice.data.keys()) self.input_advice_preset.setCurrentIndex(-1) @@ -612,6 +616,7 @@ class MainWindow(QMainWindow): layout_investigation=QVBoxLayout(tab_investigation) layout_investigation2=QHBoxLayout() label_investigation=QLabel("Recommended Investigations") + label_investigation.setProperty("class", "info_head") self.input_investigation_preset=QComboBox(self) self.input_investigation_preset.addItems(self.preset_investigation.data.keys()) self.input_investigation_preset.setCurrentIndex(-1) @@ -632,6 +637,7 @@ class MainWindow(QMainWindow): layout_medication=QVBoxLayout(tab_medication) layout_medication2=QHBoxLayout() label_medication=QLabel("Medication Advice") + label_medication.setProperty("class", "info_head") self.input_medication_preset=QComboBox(self) self.input_medication_preset.addItems(self.preset_medication.data.keys()) self.input_medication_preset.setCurrentIndex(-1) @@ -652,6 +658,7 @@ class MainWindow(QMainWindow): layout_additional=QVBoxLayout(tab_additional) layout_additional2=QHBoxLayout() label_additional=QLabel("Additional Advice") + label_additional.setProperty("class", "info_head") self.input_additional_preset=QComboBox(self) self.input_additional_preset.addItems(self.preset_additional.data.keys()) self.input_additional_preset.setCurrentIndex(-1) @@ -672,6 +679,7 @@ class MainWindow(QMainWindow): layout_attachment=QVBoxLayout(tab_attachment) layout_attachment2=QHBoxLayout() label_attachment=QLabel("Attached files") + label_attachment.setProperty("class", "info_head") self.input_attachment=QListWidget(self) button_add=QPushButton("Add") button_add.clicked.connect(self.add_attachment) -- 2.39.2