testing
This commit is contained in:
parent
4d5c654707
commit
e2b0912aa8
|
|
@ -31,6 +31,10 @@ printer:
|
|||
address: COM3
|
||||
baudrate: 115200
|
||||
|
||||
[neo_pixels]
|
||||
address: COM1
|
||||
baudrate: 9600
|
||||
|
||||
[vision]
|
||||
detection_threshold: 0.3
|
||||
; recipes_path: ./config/vision_test_recipes
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ python -B -u "./src/main.py" \
|
|||
--sim-camera \
|
||||
--sim-modbus \
|
||||
--sim-os-label-printer \
|
||||
--sim-serial-neo-pixels \
|
||||
--style windows \
|
||||
$* 2> >(sed $'s/.*/\e[31m&\e[m/' >&2) # &
|
||||
# --about \
|
||||
|
|
@ -27,6 +28,8 @@ $* 2> >(sed $'s/.*/\e[31m&\e[m/' >&2) # &
|
|||
# --auto-login-user \
|
||||
# --autotests-archive \
|
||||
# --camera-edits \
|
||||
# --interact \
|
||||
# --no-gui \
|
||||
# --no-tflite \
|
||||
# --sim-archiver \
|
||||
# --sim-serial-label-printer \
|
||||
|
|
|
|||
|
|
@ -14,5 +14,12 @@ class Serial:
|
|||
self.log.debug(f"read: {d!r}")
|
||||
return d
|
||||
|
||||
def readline(self, n=-1):
|
||||
if n < 0:
|
||||
n = 8
|
||||
d = b"\x00" * n
|
||||
self.log.debug(f"readline: {d!r}")
|
||||
return d
|
||||
|
||||
def close(self):
|
||||
self.log.debug("close")
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
import serial
|
||||
|
||||
from .serial import Serial
|
||||
from .Serial import Serial
|
||||
|
||||
serial.Serial = Serial
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import sys
|
|||
import traceback
|
||||
|
||||
if "--sim-serial-neo-pixels" in sys.argv:
|
||||
import components.dummies.serial as serial
|
||||
from components.dummies.serial import serial
|
||||
else:
|
||||
import serial
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import sys
|
||||
|
||||
if "--sim-serial-label-printer" in sys.argv:
|
||||
import components.dummies.serial as serial
|
||||
from components.dummies.serial import serial
|
||||
else:
|
||||
import serial
|
||||
|
||||
|
|
|
|||
79
src/main.py
79
src/main.py
|
|
@ -10,8 +10,8 @@ from datetime import datetime
|
|||
from pathlib import Path
|
||||
|
||||
|
||||
def quit_app(signalnum, handler):
|
||||
print(signalnum, handler)
|
||||
def quit_app(signalnum=None, handler=None):
|
||||
logging.info(f"quitting app. signal: {signalnum!r}, handler: {handler!r}")
|
||||
global app
|
||||
app.quit()
|
||||
quit()
|
||||
|
|
@ -48,7 +48,7 @@ logging.basicConfig(
|
|||
|
||||
try:
|
||||
# IMPORT PROJECT ONLY AFTER SETTING UP SIGNAL, FAULTHANDLER AND LOGGHING
|
||||
from components import (ArchiveSynchronizer, GalaxyCamera,
|
||||
from components import (ArchiveSynchronizer, GalaxyCamera, NeoPixels,
|
||||
Os_Label_Printer, RemoteAPI,
|
||||
TecnaMarpossProvasetT3, TestComponent, Vision,
|
||||
VisionSaver)
|
||||
|
|
@ -78,6 +78,7 @@ try:
|
|||
"archive_synchronizer": {"c": ArchiveSynchronizer},
|
||||
"galaxy_camera": {"c": GalaxyCamera, "k": {"paused": True}},
|
||||
"label_printer": {"c": Os_Label_Printer, "t": False},
|
||||
"neo_pixels": {"c": NeoPixels, "t": False},
|
||||
"remote_api": {"c": RemoteAPI, "k": {"main": self}},
|
||||
"tecna_marposs_provaset_t3": {"c": TecnaMarpossProvasetT3},
|
||||
"vision_saver": {"c": VisionSaver, "t": False},
|
||||
|
|
@ -104,35 +105,38 @@ try:
|
|||
QMessageBox.critical(None, "Errore Banco", f"Non e stato possibile connettersi al banco:\n\n{e}")
|
||||
quit()
|
||||
# connect camera frames to vision
|
||||
self.components["vision"].set_sources({"galaxy_camera": self.components["galaxy_camera"].out})
|
||||
if "vision" in self.components and "galaxy_camera" in self.components:
|
||||
self.components["vision"].set_sources({"galaxy_camera": self.components["galaxy_camera"].out})
|
||||
# GUI INIT
|
||||
# self.main_window = Main_Window(self.bench)
|
||||
self.main_window = Main_Window()
|
||||
# CONNECT MAIN WINDOW ACTIONS
|
||||
self.main_window.archive_a.triggered.connect(self.open_archive)
|
||||
if "--archive" in sys.argv:
|
||||
self.main_window.archive_a.trigger()
|
||||
self.main_window.autotests_archive_a.triggered.connect(self.open_autotests_archive)
|
||||
if "--autotests-archive" in sys.argv:
|
||||
self.main_window.autotests_archive_a.trigger()
|
||||
self.main_window.about_a.triggered.connect(self.open_about)
|
||||
if "--about" in sys.argv:
|
||||
self.main_window.about_a.trigger()
|
||||
self.main_window.admin_m.menuAction().setVisible(False) # admin menu should not be visible before an admin logs in
|
||||
self.main_window.users_management_a.triggered.connect(self.open_users_management)
|
||||
if "--users-management" in sys.argv:
|
||||
self.main_window.users_management_a.trigger()
|
||||
# OPEN LOGIN TAB
|
||||
self.open_login()
|
||||
# SHOW MAIN WINDOW
|
||||
if "--panel" in sys.argv:
|
||||
self.main_window.show()
|
||||
elif "--maximized" in sys.argv:
|
||||
self.main_window.showMaximized()
|
||||
elif "--full-screen" in sys.argv:
|
||||
self.main_window.showFullScreen()
|
||||
else:
|
||||
self.main_window.showFullScreen()
|
||||
if "--no-gui" not in sys.argv:
|
||||
# self.main_window = Main_Window(self.bench)
|
||||
self.main_window = Main_Window()
|
||||
# CONNECT MAIN WINDOW ACTIONS
|
||||
self.main_window.archive_a.triggered.connect(self.open_archive)
|
||||
if "--archive" in sys.argv:
|
||||
self.main_window.archive_a.trigger()
|
||||
self.main_window.autotests_archive_a.triggered.connect(self.open_autotests_archive)
|
||||
if "--autotests-archive" in sys.argv:
|
||||
self.main_window.autotests_archive_a.trigger()
|
||||
self.main_window.about_a.triggered.connect(self.open_about)
|
||||
if "--about" in sys.argv:
|
||||
self.main_window.about_a.trigger()
|
||||
self.main_window.admin_m.menuAction().setVisible(False) # admin menu should not be visible before an admin logs in
|
||||
self.main_window.quit_a.triggered.connect(quit_app)
|
||||
self.main_window.users_management_a.triggered.connect(self.open_users_management)
|
||||
if "--users-management" in sys.argv:
|
||||
self.main_window.users_management_a.trigger()
|
||||
# OPEN LOGIN TAB
|
||||
self.open_login()
|
||||
# SHOW MAIN WINDOW
|
||||
if "--panel" in sys.argv:
|
||||
self.main_window.show()
|
||||
elif "--maximized" in sys.argv:
|
||||
self.main_window.showMaximized()
|
||||
elif "--full-screen" in sys.argv:
|
||||
self.main_window.showFullScreen()
|
||||
else:
|
||||
self.main_window.showFullScreen()
|
||||
|
||||
def open_archive(self):
|
||||
self.main_window.open_dialog(Archive())
|
||||
|
|
@ -164,10 +168,21 @@ try:
|
|||
def open_test(self):
|
||||
self.main_window.open_tab(Test(self.config.machine_id, self.components))
|
||||
|
||||
def open_test(self):
|
||||
self.main_window.open_tab(Test(self.config.machine_id, self.components))
|
||||
|
||||
if __name__ == "__main__":
|
||||
app = QApplication(sys.argv)
|
||||
main = Main()
|
||||
app.exec()
|
||||
if "--no-gui" not in sys.argv:
|
||||
app.exec()
|
||||
if "--interact" in sys.argv:
|
||||
import code
|
||||
import readline
|
||||
variables = globals().copy()
|
||||
variables.update(locals())
|
||||
shell = code.InteractiveConsole(variables)
|
||||
shell.interact()
|
||||
except Exception:
|
||||
logging.exception(traceback.format_exc())
|
||||
# extype, value, tb = sys.exc_info()
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@
|
|||
<string>Amministrazione</string>
|
||||
</property>
|
||||
<addaction name="users_management_a"/>
|
||||
<addaction name="quit_a"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuStrumenti">
|
||||
<property name="title">
|
||||
|
|
@ -63,6 +64,11 @@
|
|||
<string>Archivio autotest</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="quit_a">
|
||||
<property name="text">
|
||||
<string>Esci</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user