Update main.py, MainPresenter.py

Added PEP8 compliance (E712)
This commit is contained in:
S0Ulle33 2019-01-24 13:14:50 +03:00
parent 7c8356ca4d
commit 436a8ebbe6
2 changed files with 12 additions and 10 deletions

View File

@ -34,13 +34,13 @@ class MainPresenter:
thread.start()
def on_thread_exit(self, is_last):
if is_last == True:
if is_last:
self.isScanEnabled = False
self.ui.startButton.setText("Start")
return
count = 0
for thr in self.threads:
if thr.is_running == True:
if thr.is_running:
count = count + 1
self.setCurrentThreadsLabel(count)
@ -52,7 +52,7 @@ class MainPresenter:
count = 0
is_last_thread = False
for i in self.threads:
if i.is_running != True:
if not i.is_running:
count += 1
if count == len(self.threads):
is_last_thread = True
@ -90,7 +90,7 @@ class ScanThread(QThread):
count = 0
is_last_thread = False
for i in self.presenter.threads:
if i.isRunning() != True:
if not i.isRunning():
count += 1
if count == len(self.presenter.threads):
is_last_thread = True

14
main.py
View File

@ -19,15 +19,17 @@ class MyWin(QtWidgets.QMainWindow):
self.isScanActive = False
def startButtonClicked(self):
if self.presenter.isScanEnabled == False:
self.presenter.isScanEnabled = True
self.ui.startButton.setText("Stop")
self.presenter.startScan(self.ui.ipLine.text(), self.ui.portsLine.text(), self.ui.threadsLine.text(),
self.ui.timeoutLine.text())
else:
if self.presenter.isScanEnabled:
self.presenter.isScanEnabled = False
self.ui.startButton.setText("Start")
self.presenter.stopScan()
else:
self.presenter.isScanEnabled = True
self.ui.startButton.setText("Stop")
self.presenter.startScan(self.ui.ipLine.text(),
self.ui.portsLine.text(),
self.ui.threadsLine.text(),
self.ui.timeoutLine.text())
if __name__ == "__main__":