2222
2323import os
2424import sys
25- import time
25+ # import time
2626from PyQt5 .QtGui import *
2727from PyQt5 .QtWidgets import *
2828from PyQt5 .QtCore import *
@@ -60,10 +60,10 @@ def __init__(self):
6060 response .setText (msg )
6161 response .exec_ ()
6262 raise SystemExit
63- iconPath = 'share/qtvcp/images/qtplasmac/images/Chips_Plasma.png'
63+ self . iconPath = 'share/qtvcp/images/qtplasmac/images/Chips_Plasma.png'
6464 appPath = os .path .realpath (os .path .dirname (sys .argv [0 ]))
65- iconBase = '/usr' if appPath == '/bin' else appPath .replace ('/bin' , '' )
66- self .setWindowIcon (QIcon (os .path .join (iconBase , iconPath )))
65+ self . iconBase = '/usr' if appPath == '/bin' else appPath .replace ('/bin' , '' )
66+ self .setWindowIcon (QIcon (os .path .join (self . iconBase , self . iconPath )))
6767 self .setWindowTitle ('Powermax Communicator' )
6868 qtRectangle = self .frameGeometry ()
6969 centerPoint = QDesktopWidget ().availableGeometry ().center ()
@@ -113,7 +113,7 @@ def periodic(self):
113113 self .openPort .close ()
114114 except :
115115 pass
116- result = self .dialog_ok (
116+ self .dialog_ok (
117117 QMessageBox .Warning ,\
118118 'Error' ,\
119119 '\n Communications device lost.\n ' \
@@ -177,7 +177,7 @@ def write_to_register(self, reg, data):
177177 if errors == 3 :
178178 self .connected = False
179179 self .usePanel .setChecked (True )
180- result = self .dialog_ok (
180+ self .dialog_ok (
181181 QMessageBox .Warning ,\
182182 'Error' ,\
183183 '\n No reply while writing to plasma unit.\n ' \
@@ -197,7 +197,7 @@ def read_from_register(self, reg):
197197 else :
198198 self .connected = False
199199 self .usePanel .setChecked (True )
200- result = self .dialog_ok (QMessageBox .Warning ,\
200+ self .dialog_ok (QMessageBox .Warning ,\
201201 'Error' ,\
202202 '\n No reply while reading from plasma unit.\n ' \
203203 '\n Check connections and retry when ready.\n ' )
@@ -372,7 +372,7 @@ def on_port_changed(self):
372372 )
373373 print ('\n {} is open...\n ' .format (self .portName .currentText ()))
374374 except :
375- result = self .dialog_ok (
375+ self .dialog_ok (
376376 QMessageBox .Warning ,\
377377 'Error' ,\
378378 '\n Could not open {}\n ' .format (self .portName .currentText ()))
@@ -400,8 +400,7 @@ def clear_text(self):
400400 def dialog_ok (self ,icon ,title ,text ):
401401 response = QMessageBox ()
402402 response .setIcon (icon )
403- if self .windowIcon :
404- response .setWindowIcon (self .windowIcon )
403+ response .setWindowIcon (QIcon (os .path .join (self .iconBase , self .iconPath )))
405404 response .setWindowTitle (title )
406405 response .setText (text );
407406 response .exec_ ()
0 commit comments