From d2f01a4e7641c2e7d4ad609c9cd382df259390a4 Mon Sep 17 00:00:00 2001 From: Furtif Date: Sun, 3 Mar 2024 21:55:46 +0100 Subject: [PATCH] add title and icon to MSGBOX --- dataeditor.py | 6 ++++++ main.py | 9 +++++++++ parameters.py | 29 +++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+) diff --git a/dataeditor.py b/dataeditor.py index 61d4247c..01f582e6 100644 --- a/dataeditor.py +++ b/dataeditor.py @@ -1088,12 +1088,18 @@ def remove_selected(self): for rcvname, rcvdi in request.dataitems.items(): if rcvname == dataname: msgbox = widgets.QMessageBox() + appIcon = gui.QIcon("dtt4all_data/icons/obd.png") + msgbox.setWindowIcon(appIcon) + msgbox.setWindowTitle("DTT4ALL") msgbox.setText(_("Data is used by request %s") % reqname) msgbox.exec_() return for sndname, snddi in request.sendbyte_dataitems.items(): if sndname == dataname: msgbox = widgets.QMessageBox() + appIcon = gui.QIcon("dtt4all_data/icons/obd.png") + msgbox.setWindowIcon(appIcon) + msgbox.setWindowTitle("DTT4ALL") msgbox.setText(_("Data is used by request %s") % reqname) msgbox.exec_() return diff --git a/main.py b/main.py index 6b707e69..d55893bb 100644 --- a/main.py +++ b/main.py @@ -285,6 +285,7 @@ def __init__(self, parent=None): msgbox = widgets.QMessageBox() appIcon = gui.QIcon("dtt4all_data/icons/obd.png") msgbox.setWindowIcon(appIcon) + msgbox.setWindowTitle("DTT4ALL") msgbox.setIcon(widgets.QMessageBox.Warning) msgbox.setText(_("No database found")) msgbox.setInformativeText(_("Check documentation")) @@ -679,6 +680,7 @@ def zipdb(self): mbox = widgets.QMessageBox() appIcon = gui.QIcon("dtt4all_data/icons/obd.png") mbox.setWindowIcon(appIcon) + mbox.setWindowTitle("DTT4ALL") mbox.setText("Cannot write to directory " + os.path.dirname(filename)) mbox.exec_() return @@ -804,6 +806,7 @@ def scan(self): msgBox = widgets.QMessageBox() appIcon = gui.QIcon("dtt4all_data/icons/obd.png") msgBox.setWindowIcon(appIcon) + msgBox.setWindowTitle("DTT4ALL") msgBox.setText(_('Scan options')) scancan = False scancan2 = False @@ -1124,6 +1127,7 @@ def mousePressEvent(self, mousevent): msgbox = widgets.QMessageBox() appIcon = gui.QIcon("dtt4all_data/icons/obd.png") msgbox.setWindowIcon(appIcon) + msgbox.setWindowTitle("DTT4ALL") msgbox.setText( _("
This Software is free, but I need money to buy cables/ECUs and make this application more reliable
")) okbutton = widgets.QPushButton(_('Yes I contribute')) @@ -1138,6 +1142,7 @@ def donate(self): core.QUrl.TolerantMode) gui.QDesktopServices().openUrl(url) msgbox = widgets.QMessageBox() + msgbox.setWindowTitle("DTT4ALL") appIcon = gui.QIcon("dtt4all_data/icons/obd.png") msgbox.setWindowIcon(appIcon) msgbox.setText( @@ -1506,6 +1511,7 @@ def connectedMode(self): msgbox = widgets.QMessageBox() appIcon = gui.QIcon("dtt4all_data/icons/obd.png") msgbox.setWindowIcon(appIcon) + msgbox.setWindowTitle("DTT4ALL") msgbox.setText(_("You must check the recommandations")) msgbox.exec_() return @@ -1527,6 +1533,7 @@ def connectedMode(self): msgbox = widgets.QMessageBox() appIcon = gui.QIcon("dtt4all_data/icons/obd.png") msgbox.setWindowIcon(appIcon) + msgbox.setWindowTitle("DTT4ALL") msgbox.setText(_("Please select a communication port")) msgbox.exec_() @@ -1598,6 +1605,7 @@ def demoMode(self): msgbox = widgets.QMessageBox() appIcon = gui.QIcon("dtt4all_data/icons/obd.png") msgbox.setWindowIcon(appIcon) + msgbox.setWindowTitle("DTT4ALL") msgbox.setText(_("No COM port selected")) msgbox.exec_() @@ -1609,6 +1617,7 @@ def demoMode(self): msgbox = widgets.QMessageBox() appIcon = gui.QIcon("dtt4all_data/icons/obd.png") msgbox.setWindowIcon(appIcon) + msgbox.setWindowTitle("DTT4ALL") msgbox.setText(_("No ELM327 or OBDLINK-SX detected on COM port ") + options.port) msgbox.exec_() else: diff --git a/parameters.py b/parameters.py index cc6f5ac2..2fd9ff5c 100644 --- a/parameters.py +++ b/parameters.py @@ -89,6 +89,9 @@ def __init__(self, paramview, ecurequestparser, sds): text += "
Use it at your own risk
\n" text += "
and if you know exactely what you do
\n" msgbox = widgets.QMessageBox() + appIcon = gui.QIcon("dtt4all_data/icons/obd.png") + msgbox.setWindowIcon(appIcon) + msgbox.setWindowTitle("DTT4ALL") msgbox.setText(text) msgbox.exec_() @@ -108,6 +111,9 @@ def compute_frame(self, check=True): else: if check: msgbox = widgets.QMessageBox() + appIcon = gui.QIcon("dtt4all_data/icons/obd.png") + msgbox.setWindowIcon(appIcon) + msgbox.setWindowTitle("DTT4ALL") msgbox.setText("Missing data in table") msgbox.exec_() return "Missing input data" @@ -132,6 +138,9 @@ def execute(self): reveived_stream = self.paramview.sendElm(stream_to_send, False, True) if reveived_stream.startswith("WRONG"): msgbox = widgets.QMessageBox() + appIcon = gui.QIcon("dtt4all_data/icons/obd.png") + msgbox.setWindowIcon(appIcon) + msgbox.setWindowTitle("DTT4ALL") msgbox.setText("ECU returned error (check logview)") msgbox.exec_() return @@ -1100,6 +1109,9 @@ def buttonClicked(self, txt): messages = self.button_messages[txt] for message in messages: msgbox = widgets.QMessageBox() + appIcon = gui.QIcon("dtt4all_data/icons/obd.png") + msgbox.setWindowIcon(appIcon) + msgbox.setWindowTitle("DTT4ALL") msgbox.setText(message) msgbox.exec_() @@ -1170,6 +1182,8 @@ def buttonClicked(self, txt): elm_response = self.sendElm(' '.join(elm_data_stream)) if elm_response == "BLOCKED": msgbox = widgets.QMessageBox() + appIcon = gui.QIcon("dtt4all_data/icons/obd.png") + msgbox.setWindowIcon(appIcon) msgbox.setWindowTitle("For your safety") msgbox.setText("
BLOCKED COMMAND
\nActivate expert mode to unlock") msgbox.exec_() @@ -1407,6 +1421,9 @@ def clearDTC(self): request = "14FF00" msgbox = widgets.QMessageBox() + appIcon = gui.QIcon("dtt4all_data/icons/obd.png") + msgbox.setWindowIcon(appIcon) + msgbox.setWindowTitle("DTT4ALL") msgbox.setText(_("
You are about to clear diagnostic troubles codes
") + _("
Ae you sure this is what you want.
")) @@ -1434,6 +1451,9 @@ def clearDTC(self): if 'WRONG' in response: msgbox = widgets.QMessageBox() + appIcon = gui.QIcon("dtt4all_data/icons/obd.png") + msgbox.setWindowIcon(appIcon) + msgbox.setWindowTitle("DTT4ALL") msgbox.setText("There was an error clearing DTC") msgbox.exec_() options.main_window.logview.append("Clear DTC failed") @@ -1469,6 +1489,9 @@ def readDTC(self): if "RESPONSE" in can_response: msgbox = widgets.QMessageBox() + appIcon = gui.QIcon("dtt4all_data/icons/obd.png") + msgbox.setWindowIcon(appIcon) + msgbox.setWindowTitle("DTT4ALL") msgbox.setText(_("Invalid response for ReadDTC command")) msgbox.exec_() return @@ -1478,6 +1501,9 @@ def readDTC(self): # Handle error if can_response[0].upper() == "7F": msgbox = widgets.QMessageBox() + appIcon = gui.QIcon("dtt4all_data/icons/obd.png") + msgbox.setWindowIcon(appIcon) + msgbox.setWindowTitle("DTT4ALL") msgbox.setText(_("Read DTC returned an error")) msgbox.exec_() return @@ -1486,6 +1512,9 @@ def readDTC(self): if len(can_response) == 2: # No errors msgbox = widgets.QMessageBox() + appIcon = gui.QIcon("dtt4all_data/icons/obd.png") + msgbox.setWindowIcon(appIcon) + msgbox.setWindowTitle("DTT4ALL") msgbox.setText(_("No DTC")) msgbox.exec_() return