Skip to content

Commit

Permalink
add title and icon to MSGBOX
Browse files Browse the repository at this point in the history
  • Loading branch information
Furtif committed Mar 3, 2024
1 parent 316f5da commit d2f01a4
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 0 deletions.
6 changes: 6 additions & 0 deletions dataeditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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(
_("<center>This Software is free, but I need money to buy cables/ECUs and make this application more reliable</center>"))
okbutton = widgets.QPushButton(_('Yes I contribute'))
Expand All @@ -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(
Expand Down Expand Up @@ -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
Expand All @@ -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_()

Expand Down Expand Up @@ -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_()

Expand All @@ -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:
Expand Down
29 changes: 29 additions & 0 deletions parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ def __init__(self, paramview, ecurequestparser, sds):
text += "<center>Use it at your own risk</center>\n"
text += "<center>and if you know exactely what you do</center>\n"
msgbox = widgets.QMessageBox()
appIcon = gui.QIcon("dtt4all_data/icons/obd.png")
msgbox.setWindowIcon(appIcon)
msgbox.setWindowTitle("DTT4ALL")
msgbox.setText(text)
msgbox.exec_()

Expand All @@ -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"
Expand All @@ -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
Expand Down Expand Up @@ -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_()

Expand Down Expand Up @@ -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("<center>BLOCKED COMMAND</center>\nActivate expert mode to unlock")
msgbox.exec_()
Expand Down Expand Up @@ -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(_("<center>You are about to clear diagnostic troubles codes</center>") +
_("<center>Ae you sure this is what you want.</center>"))

Expand Down Expand Up @@ -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("<font color=red>Clear DTC failed</font>")
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit d2f01a4

Please sign in to comment.