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 lib.helpers import ConfigReader
|
||||||
from PyQt5.QtCore import QObject, QThread, pyqtSignal
|
from PyQt5.QtCore import QObject, QThread, pyqtSignal
|
||||||
from PyQt5.QtWidgets import QApplication, QMessageBox
|
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:
|
if "--vision" in sys.argv:
|
||||||
from components import GalaxyCamera, NeoPixels, UVCCamera, Vision, VisionSaver
|
from components import GalaxyCamera, NeoPixels, UVCCamera, Vision, VisionSaver
|
||||||
@ -228,17 +229,19 @@ try:
|
|||||||
self.main_window.admin_m.menuAction().setVisible(False)
|
self.main_window.admin_m.menuAction().setVisible(False)
|
||||||
|
|
||||||
def logout(self):
|
def logout(self):
|
||||||
Users.logout()
|
#Users.logout()
|
||||||
self.main_window.admin_m.menuAction().setVisible(False)
|
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
|
# LOGOUT IMMEDIATELY IF NOT TESTING
|
||||||
|
Users.logout()
|
||||||
self.open_login()
|
self.open_login()
|
||||||
else:
|
else:
|
||||||
if not self.main_window.centralWidget().autotesting:
|
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")
|
self.main_window.centralWidget().request_autotest("logout")
|
||||||
else:
|
else:
|
||||||
# LOGOUT IMMEDIATELY IF AUTOTESTING
|
# LOGOUT IMMEDIATELY IF AUTOTESTING
|
||||||
|
Users.logout()
|
||||||
self.open_login()
|
self.open_login()
|
||||||
|
|
||||||
def set_recipe_mode_table(self):
|
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.timeout.connect(self.request_periodic_autotest)
|
||||||
self.autotest_timer.start(self.autotest_period)
|
self.autotest_timer.start(self.autotest_period)
|
||||||
reason = "boot"
|
reason = "boot"
|
||||||
|
if reason == "logout":
|
||||||
|
self.next(action="abort")
|
||||||
|
|
||||||
self.autotest_request = reason
|
self.autotest_request = reason
|
||||||
|
|
||||||
def request_periodic_autotest(self):
|
def request_periodic_autotest(self):
|
||||||
@ -222,13 +225,14 @@ class Test(Widget):
|
|||||||
# COUNT RESET
|
# COUNT RESET
|
||||||
self.pieces["ok"] = 0
|
self.pieces["ok"] = 0
|
||||||
self.pieces["ko"] = 0
|
self.pieces["ko"] = 0
|
||||||
elif action == "fail":
|
elif action in ("fail","abort"):
|
||||||
self.log.info(f"cycle next: action: {action!r}")
|
self.log.info(f"cycle next: action: {action!r}")
|
||||||
# FAIL AND RESTART TEST
|
# FAIL AND RESTART TEST
|
||||||
self.step = Steps(type="fail")
|
self.step = Steps(type="fail")
|
||||||
self.cycle_index = -1
|
self.cycle_index = -1
|
||||||
# COUNT FAIL
|
# COUNT FAIL
|
||||||
self.done(ok=False)
|
if action == "fail":
|
||||||
|
self.done(ok=False)
|
||||||
elif action is not None:
|
elif action is not None:
|
||||||
raise NotImplementedError(f"cycle next: action {action!r} is not a valid action")
|
raise NotImplementedError(f"cycle next: action {action!r} is not a valid action")
|
||||||
# if action did not set the next cycle step
|
# if action did not set the next cycle step
|
||||||
@ -256,6 +260,10 @@ class Test(Widget):
|
|||||||
else:
|
else:
|
||||||
# autotest ended
|
# autotest ended
|
||||||
self.autotesting = False
|
self.autotesting = False
|
||||||
|
if self.autotesting_reason == "logout":
|
||||||
|
Users.logout()
|
||||||
|
self.main_window.open_login()
|
||||||
|
|
||||||
self.autotesting_reason = None
|
self.autotesting_reason = None
|
||||||
self.cycle_index = -1
|
self.cycle_index = -1
|
||||||
self.config["autotest_done"] = True
|
self.config["autotest_done"] = True
|
||||||
@ -517,7 +525,7 @@ class Test(Widget):
|
|||||||
else:
|
else:
|
||||||
if self.autotesting_reason == "logout":
|
if self.autotesting_reason == "logout":
|
||||||
if ok:
|
if ok:
|
||||||
self.main_window.show_login()
|
self.main_window.open_login()
|
||||||
|
|
||||||
return archived
|
return archived
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import sys
|
|||||||
import time
|
import time
|
||||||
import weakref
|
import weakref
|
||||||
|
|
||||||
from PyQt5.QtWidgets import QMessageBox, QDialog
|
from PyQt5.QtWidgets import QMessageBox, QDialog, QApplication
|
||||||
|
|
||||||
from ui import Dialog
|
from ui import Dialog
|
||||||
from ui.test_test import Test_Test
|
from ui.test_test import Test_Test
|
||||||
@ -107,14 +107,13 @@ class Test_Leak(Test_Test):
|
|||||||
|
|
||||||
# TESTING
|
# TESTING
|
||||||
if self.simulate:
|
if self.simulate:
|
||||||
if self.step.spec.get("autotest", False) is not True:
|
data["tecna_t3"] = {
|
||||||
data["tecna_t3"] = {
|
"Running test: active phase": "WAITING START",
|
||||||
"Running test: result": "-----TESTING----- passed",
|
"Running test: result": "-----TESTING----- passed",
|
||||||
}
|
"Running test: filling pressure":"5000",
|
||||||
else:
|
"Running test: measured leak":"5",
|
||||||
data["tecna_t3"] = {
|
"Running test: pressure at the end of settling":"4999",
|
||||||
"Running test: result": "-----TESTING----- failed",
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if "Running test: result" in data["tecna_t3"]:
|
if "Running test: result" in data["tecna_t3"]:
|
||||||
result = data["tecna_t3"]["Running test: result"]
|
result = data["tecna_t3"]["Running test: result"]
|
||||||
@ -180,6 +179,10 @@ class Test_Leak(Test_Test):
|
|||||||
else:
|
else:
|
||||||
if self.parent_assembly_widget is not None:
|
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")
|
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.setEnabled(True)
|
||||||
self.start_b.setDefault(True)
|
self.start_b.setDefault(True)
|
||||||
self.start_b.setFocus()
|
self.start_b.setFocus()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user