autotest on logout beta
This commit is contained in:
parent
fe320af13e
commit
4c7981910e
11
src/main.py
11
src/main.py
@ -69,7 +69,8 @@ try:
|
||||
from lib.helpers import ConfigReader
|
||||
from PyQt5.QtCore import QObject, QThread, pyqtSignal
|
||||
from PyQt5.QtWidgets import QApplication, QMessageBox
|
||||
from ui import About, Archive, Login, Main_Window, Test, Users_Management, Recipe_Selection
|
||||
from ui import About, Archive, Login, Main_Window, Test, Users_Management, Recipe_Selection, \
|
||||
Barcode_Recipe_Selection
|
||||
|
||||
if "--vision" in sys.argv:
|
||||
from components import GalaxyCamera, NeoPixels, UVCCamera, Vision, VisionSaver
|
||||
@ -228,17 +229,19 @@ try:
|
||||
self.main_window.admin_m.menuAction().setVisible(False)
|
||||
|
||||
def logout(self):
|
||||
Users.logout()
|
||||
#Users.logout()
|
||||
self.main_window.admin_m.menuAction().setVisible(False)
|
||||
if type(self.main_window.centralWidget().centralWidget.widget) is Recipe_Selection:
|
||||
if type(self.main_window.centralWidget().centralWidget.widget) in (Recipe_Selection,Barcode_Recipe_Selection):
|
||||
# LOGOUT IMMEDIATELY IF NOT TESTING
|
||||
Users.logout()
|
||||
self.open_login()
|
||||
else:
|
||||
if not self.main_window.centralWidget().autotesting:
|
||||
self.main_window.centralWidget().change_recipe() # STOP CURRENT TEST
|
||||
# LOGOUT AFTER AUTOTEST IF TESTING
|
||||
self.main_window.centralWidget().request_autotest("logout")
|
||||
else:
|
||||
# LOGOUT IMMEDIATELY IF AUTOTESTING
|
||||
Users.logout()
|
||||
self.open_login()
|
||||
|
||||
def set_recipe_mode_table(self):
|
||||
|
||||
@ -201,6 +201,9 @@ class Test(Widget):
|
||||
self.autotest_timer.timeout.connect(self.request_periodic_autotest)
|
||||
self.autotest_timer.start(self.autotest_period)
|
||||
reason = "boot"
|
||||
if reason == "logout":
|
||||
self.next(action="abort")
|
||||
|
||||
self.autotest_request = reason
|
||||
|
||||
def request_periodic_autotest(self):
|
||||
@ -222,13 +225,14 @@ class Test(Widget):
|
||||
# COUNT RESET
|
||||
self.pieces["ok"] = 0
|
||||
self.pieces["ko"] = 0
|
||||
elif action == "fail":
|
||||
elif action in ("fail","abort"):
|
||||
self.log.info(f"cycle next: action: {action!r}")
|
||||
# FAIL AND RESTART TEST
|
||||
self.step = Steps(type="fail")
|
||||
self.cycle_index = -1
|
||||
# COUNT FAIL
|
||||
self.done(ok=False)
|
||||
if action == "fail":
|
||||
self.done(ok=False)
|
||||
elif action is not None:
|
||||
raise NotImplementedError(f"cycle next: action {action!r} is not a valid action")
|
||||
# if action did not set the next cycle step
|
||||
@ -256,6 +260,10 @@ class Test(Widget):
|
||||
else:
|
||||
# autotest ended
|
||||
self.autotesting = False
|
||||
if self.autotesting_reason == "logout":
|
||||
Users.logout()
|
||||
self.main_window.open_login()
|
||||
|
||||
self.autotesting_reason = None
|
||||
self.cycle_index = -1
|
||||
self.config["autotest_done"] = True
|
||||
@ -517,7 +525,7 @@ class Test(Widget):
|
||||
else:
|
||||
if self.autotesting_reason == "logout":
|
||||
if ok:
|
||||
self.main_window.show_login()
|
||||
self.main_window.open_login()
|
||||
|
||||
return archived
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@ import sys
|
||||
import time
|
||||
import weakref
|
||||
|
||||
from PyQt5.QtWidgets import QMessageBox, QDialog
|
||||
from PyQt5.QtWidgets import QMessageBox, QDialog, QApplication
|
||||
|
||||
from ui import Dialog
|
||||
from ui.test_test import Test_Test
|
||||
@ -107,14 +107,13 @@ class Test_Leak(Test_Test):
|
||||
|
||||
# TESTING
|
||||
if self.simulate:
|
||||
if self.step.spec.get("autotest", False) is not True:
|
||||
data["tecna_t3"] = {
|
||||
"Running test: result": "-----TESTING----- passed",
|
||||
}
|
||||
else:
|
||||
data["tecna_t3"] = {
|
||||
"Running test: result": "-----TESTING----- failed",
|
||||
}
|
||||
data["tecna_t3"] = {
|
||||
"Running test: active phase": "WAITING START",
|
||||
"Running test: result": "-----TESTING----- passed",
|
||||
"Running test: filling pressure":"5000",
|
||||
"Running test: measured leak":"5",
|
||||
"Running test: pressure at the end of settling":"4999",
|
||||
}
|
||||
|
||||
if "Running test: result" in data["tecna_t3"]:
|
||||
result = data["tecna_t3"]["Running test: result"]
|
||||
@ -180,6 +179,10 @@ class Test_Leak(Test_Test):
|
||||
else:
|
||||
if self.parent_assembly_widget is not None:
|
||||
self.parent_assembly_widget().set_text(text="COLLEGARE GLI ATTACCHI PNEUMATICI E PREMERE START PER INIZIARE LA PROVA TENUTA")
|
||||
if self.simulate:
|
||||
QApplication.processEvents()
|
||||
time.sleep(2)
|
||||
|
||||
self.start_b.setEnabled(True)
|
||||
self.start_b.setDefault(True)
|
||||
self.start_b.setFocus()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user