Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
160af9de88
|
|
@ -20,8 +20,8 @@ digital_io: present
|
|||
external_flush_blow: absent
|
||||
|
||||
[archive_synchronizer]
|
||||
#archive_endpoint: https://dev.r5portal.it/api/st-ten-save/
|
||||
archive_endpoint: https://r5portal.it/api/st-ten-save/
|
||||
archive_endpoint: https://dev.r5portal.it/api/st-ten-save/
|
||||
status_endpoint: https://dev.r5portal.it/api/device-info-update/
|
||||
poll_time: 10
|
||||
hold_time: 10
|
||||
|
||||
|
|
|
|||
|
|
@ -32,10 +32,10 @@ class ArchiveSynchronizer(Component):
|
|||
self.machine_id = self.config.machine_id
|
||||
if "--dev-portal" in sys.argv:
|
||||
self.archive_endpoint = f"https://dev.r5portal.it/api/st-ten-save/"
|
||||
#self.url = f"https://dev.r5portal.it/media/uploads/warning_images/st-ten-10/st-ten-11.csv"
|
||||
self.status_endpoint = f"https://dev.r5portal.it/api/device-info-update/"
|
||||
else:
|
||||
self.archive_endpoint = self.config[self.name]["archive_endpoint"]
|
||||
#self.browse_folder_endpoint = self.config[self.name]["browse_folder_endpoint"]
|
||||
self.status_endpoint = self.config[self.name]["status_endpoint"]
|
||||
self._do_set_period({"period": float(self.config[self.name]["poll_time"])})
|
||||
self.hold_time = round(float(self.config[self.name]["hold_time"]) * 1000)
|
||||
self.gcs_client = storage.Client.from_service_account_json(self.config[self.name]["service_account_json"])
|
||||
|
|
@ -59,21 +59,20 @@ class ArchiveSynchronizer(Component):
|
|||
QThread.msleep(self.hold_time)
|
||||
self.gcs_bucket = None
|
||||
|
||||
|
||||
# UPDATE MACHINE STATUS
|
||||
self.update_machine_status()
|
||||
|
||||
super()._get()
|
||||
|
||||
def update_machine_status(self):
|
||||
self.status_endpoint = f"https://r5portal.it/api/device-info-update?machine-id={self.machine_id.upper()}&status={self.machine_status}"
|
||||
|
||||
status_dict = {"last_status": self.machine_status}
|
||||
status_call = f"{self.status_endpoint}?machine-id={self.machine_id.upper()}&status={self.machine_status}"
|
||||
|
||||
response = None
|
||||
try:
|
||||
if not self.simulate:
|
||||
with requests.Session() as s:
|
||||
s.mount("", HTTPAdapter(max_retries=Retry(total=0))) # this disables retries
|
||||
response = requests.post(self.status_endpoint, json=status_dict, timeout=5, verify=False)
|
||||
response = requests.post(status_call, timeout=5, verify=False)
|
||||
if response.status_code != 200:
|
||||
raise AssertionError("bad status response")
|
||||
except AssertionError as e:
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ from src.components.os_label_printer import *
|
|||
from src.lib.helpers import ConfigReader
|
||||
|
||||
SYSTEM_ID = "test-linux"
|
||||
CSV_PATH="tmp/ferrari_labels4.csv"
|
||||
CSV_PATH="tmp/ferrari_labels5.csv"
|
||||
TEMPLATE="ferrari_flag_qr_only.prn"
|
||||
config = ConfigReader(system_id=SYSTEM_ID)
|
||||
printer=Os_Label_Printer(config=config,name="label_printer")
|
||||
|
|
|
|||
|
|
@ -10,14 +10,12 @@ from PyQt5.QtCore import QTimer, pyqtSignal
|
|||
from PyQt5.QtGui import QKeySequence
|
||||
from PyQt5.QtWidgets import QFileDialog, QMessageBox, QShortcut
|
||||
import shutil
|
||||
from lib.helpers.step import Step
|
||||
from ui.crud import Crud, Json_External_Dialog_Editor_Cell_Widget
|
||||
from ui.helpers import replace_widget
|
||||
from ui.recipe_spec_and_step_editor import Recipe_Spec_And_Step_Editor
|
||||
from ui.widget import Widget
|
||||
|
||||
from datetime import datetime
|
||||
from components import ArchiveSynchronizer
|
||||
|
||||
class Noner:
|
||||
def __getitem__(self, key):
|
||||
|
|
@ -34,7 +32,6 @@ class Recipe_Selection(Widget):
|
|||
global noner
|
||||
super().__init__()
|
||||
self.config = config
|
||||
self.archive_synch = ArchiveSynchronizer(config=config)
|
||||
self.second_leak_test_enabled = self.config["hardware_config"]["second_leak_test"] == "present"
|
||||
self.defaults = self.config.get("recipes_defaults", noner)
|
||||
self.unsupported_steps = unsupported_steps
|
||||
|
|
@ -140,9 +137,6 @@ class Recipe_Selection(Widget):
|
|||
self.export_b.setVisible(False)
|
||||
self.delete_all_b.setVisible(False)
|
||||
|
||||
self.archive_synch.machine_status = "logged-in"
|
||||
self.archive_synch.machine_id = self.archive_synch.config.machine_id
|
||||
self.archive_synch.update_machine_status()
|
||||
# TESTING
|
||||
if "--auto-select" in sys.argv:
|
||||
recipe = "R56738/1"
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user