autotest on logout tbt
This commit is contained in:
parent
068cf7b973
commit
3629f86c2d
@ -23,7 +23,7 @@ class Archive(BaseModel):
|
||||
@db.atomic()
|
||||
def archive(cls, test_data, result, overridden):
|
||||
time=datetime.now()
|
||||
test_data["time"]=time.strftime("%Y/%m/%dT %H:%M:%S")
|
||||
test_data["time"]=time.strftime("%d/%m/%Y %H:%M:%S")
|
||||
test_data["user"]=Users.get_session().username
|
||||
return cls.create(
|
||||
time=time,
|
||||
|
||||
18
src/main.py
18
src/main.py
@ -68,7 +68,7 @@ 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
|
||||
from ui import About, Archive, Login, Main_Window, Test, Users_Management, Recipe_Selection
|
||||
|
||||
if "--vision" in sys.argv:
|
||||
from components import GalaxyCamera, NeoPixels, UVCCamera, Vision, VisionSaver
|
||||
@ -218,17 +218,23 @@ try:
|
||||
else:
|
||||
self.main_window.admin_m.menuAction().setVisible(False)
|
||||
# open test
|
||||
self.main_window.open_tab(Test(self.config, self.components))
|
||||
self.main_window.open_tab(Test(self.config, self.components,self))
|
||||
else:
|
||||
self.main_window.admin_m.menuAction().setVisible(False)
|
||||
|
||||
def logout(self):
|
||||
if type(self.main_window.centralWidget) is Test:
|
||||
self.main_window.centralWidget.change_recipe()
|
||||
self.main_window.centralWidget.request_autotest("logout")
|
||||
Users.logout()
|
||||
self.main_window.admin_m.menuAction().setVisible(False)
|
||||
self.open_login()
|
||||
if type(self.main_window.centralWidget().centralWidget.widget) is Recipe_Selection:
|
||||
# LOGOUT IMMEDIATELY IF NOT TESTING
|
||||
self.open_login()
|
||||
else:
|
||||
if not self.main_window.centralWidget().autotesting:
|
||||
self.main_window.centralWidget().change_recipe() # STOP CURRENT TEST
|
||||
self.main_window.centralWidget().request_autotest("logout")
|
||||
else:
|
||||
# LOGOUT IMMEDIATELY IF AUTOTESTING
|
||||
self.open_login()
|
||||
|
||||
def set_recipe_mode_table(self):
|
||||
self.main_window.centralWidget().set_recipe_mode_table()
|
||||
|
||||
@ -29,8 +29,9 @@ from ui.widget import Widget
|
||||
|
||||
|
||||
class Test(Widget):
|
||||
def __init__(self, config, components=None):
|
||||
def __init__(self, config, components=None,main_window=None):
|
||||
super().__init__()
|
||||
self.main_window=main_window
|
||||
self.config = config
|
||||
self.components = components
|
||||
# GET LOGGER
|
||||
@ -506,6 +507,11 @@ class Test(Widget):
|
||||
self.pieces["ok"] += 1
|
||||
else:
|
||||
self.pieces["ko"] += 1
|
||||
else:
|
||||
if self.autotesting_reason == "logout":
|
||||
if ok:
|
||||
self.main_window.show_login()
|
||||
|
||||
return archived
|
||||
|
||||
@staticmethod
|
||||
|
||||
Loading…
Reference in New Issue
Block a user