From e122413a676995c4b422db41e68820945ae8e422 Mon Sep 17 00:00:00 2001 From: Agnibho Mondal Date: Fri, 8 Sep 2023 23:28:41 +0530 Subject: [PATCH] MainWindow Icons --- renderbox.py | 3 ++- setting.py | 4 +++- viewbox.py | 3 +++ window.py | 5 +++-- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/renderbox.py b/renderbox.py index 124233e..990c25a 100644 --- a/renderbox.py +++ b/renderbox.py @@ -7,7 +7,7 @@ from PyQt6.QtWidgets import QMainWindow, QToolBar, QFileDialog from PyQt6.QtWebEngineWidgets import QWebEngineView -from PyQt6.QtGui import QAction +from PyQt6.QtGui import QAction, QIcon from PyQt6.QtCore import QUrl import os, webbrowser @@ -41,6 +41,7 @@ class RenderBox(QMainWindow): self.webview=QWebEngineView() self.setCentralWidget(self.webview) + self.setWindowIcon(QIcon(os.path.join("resource", "icon_medscript.ico"))) def update(self, file): try: diff --git a/setting.py b/setting.py index 307a7ad..b50c7c9 100644 --- a/setting.py +++ b/setting.py @@ -6,7 +6,8 @@ # You should have received a copy of the GNU General Public License along with MedScript. If not, see . from PyQt6.QtWidgets import QWidget, QMainWindow, QFormLayout, QPushButton, QLabel, QLineEdit, QTextEdit, QStatusBar, QMessageBox -import json +from PyQt6.QtGui import QIcon +import os, json from config import config class EditPrescriber(QMainWindow): @@ -75,5 +76,6 @@ class EditPrescriber(QMainWindow): self.setStatusBar(self.statusbar) self.setCentralWidget(widget) + self.setWindowIcon(QIcon(os.path.join("resource", "icon_medscript.ico"))) self.load() diff --git a/viewbox.py b/viewbox.py index f6fa3d3..6aaa2ed 100644 --- a/viewbox.py +++ b/viewbox.py @@ -9,6 +9,7 @@ import os from PyQt6.QtWidgets import QMainWindow from PyQt6.QtWebEngineWidgets import QWebEngineView from PyQt6.QtCore import QUrl +from PyQt6.QtGui import QIcon class ViewBox(QMainWindow): def __init__(self, *args, **kwargs): @@ -20,6 +21,8 @@ class ViewBox(QMainWindow): self.webview=QWebEngineView() self.setCentralWidget(self.webview) + self.setWindowIcon(QIcon(os.path.join("resource", "icon_medscript.ico"))) + def open(self, file): self.webview.load(QUrl("file:///"+os.path.abspath(file).replace(os.sep, "/"))) diff --git a/window.py b/window.py index e9dcd9d..3c3d611 100644 --- a/window.py +++ b/window.py @@ -93,7 +93,7 @@ class MainWindow(QMainWindow): if(self.save_state==md5(self.prescription.get_json().encode()).hexdigest()): target=self.renderer.render(self.current_file.directory.name) self.signal_view.emit(target) - self.renderbox.show() + self.renderbox.showMaximized() else: QMessageBox.information(self,"Save first", "Please save the file before rendering.") @@ -554,4 +554,5 @@ class MainWindow(QMainWindow): self.cmd_open(config["filename"]) else: self.cmd_new() - self.show() + self.setWindowIcon(QIcon(os.path.join("resource", "icon_medscript.ico"))) + self.showMaximized() -- 2.39.2