Dec-17-2018, 10:57 AM
This is my code so far. Any suggestions?
# -*- coding: utf-8 -*- """ Created on Mon Dec 03 11:12:09 2018 @author: Matthias Hochholzer """ import sys import os import subprocess import time from PyQt4.QtCore import * from PyQt4.QtGui import * from PyQt4.uic import * class HexChecker(): # def getLines(): different approche # global filePath, toolPath, gotPath # filePath = w.hexLine.text() # toolPath = w.consolLine.text() # gotPath = 1 # print filePath def checkHex(self): global filePath, toolPath filePath = w.hexLine.text() toolPath = w.consolLine.text() while go: global oldDate newDate = time.strftime('%Y-%m-%d %H:%M:%S', time.gmtime(os.path.getmtime(filePath))) if newDate != oldDate: subprocess.Popen([toolPath, "-c", "SWD", "-P", filePath, "-v", "-Rst"], shell = True) oldDate = newDate time.sleep(1) def cancelFlashing(self): global go go = 0 filePath = "start" toolPath = "start" oldDate = "0000-00-00 00:00:00" go = 1 hexChecker = HexChecker() app = QApplication(sys.argv) w = loadUi("Autoflash.ui") w.startButton.clicked.connect(hexChecker.checkHex) w.closeButton.clicked.connect(hexChecker.cancelFlashing) w.show() sys.exit(app.exec_())