dev gg
This commit is contained in:
parent
0401f26cad
commit
09ce995866
@ -79,7 +79,10 @@ class Component(QObject):
|
||||
self._set_sources.connect(self._do_set_sources)
|
||||
self._set_period.connect(self._do_set_period)
|
||||
if self.config is not None:
|
||||
self.config.updated.connect(self._config_changed)
|
||||
try:
|
||||
self.config.updated.connect(self._config_changed)
|
||||
except AttributeError:
|
||||
pass
|
||||
self._config_changed()
|
||||
self._init_periodic()
|
||||
self._started = True
|
||||
|
||||
@ -9,9 +9,10 @@ from .component import Component
|
||||
class Os_Label_Printer(Component):
|
||||
def __init__(self, config=None, name=None):
|
||||
super().__init__(config=config, name=name, threaded=False)
|
||||
self.simulate = False
|
||||
if "--sim-os-label-printer" in sys.argv:
|
||||
self.simulate = True
|
||||
|
||||
self.platform = "windows"
|
||||
def config_changed(self):
|
||||
self.platform = self.config[self.name]["platform"]
|
||||
# for windows:
|
||||
@ -31,7 +32,7 @@ class Os_Label_Printer(Component):
|
||||
label = f.read()
|
||||
# LABEL PRINT
|
||||
label = label.format(**context)
|
||||
label_file = "/tmp/label.prn"
|
||||
label_file = "tmp/label.prn"
|
||||
with open(label_file, "w", errors="surrogateescape") as f:
|
||||
label = f.write(label)
|
||||
if self.platform == "windows":
|
||||
|
||||
@ -152,10 +152,10 @@ try:
|
||||
|
||||
def open_login(self):
|
||||
tab = Login()
|
||||
tab.successful_login.connect(self.logghed_in)
|
||||
tab.successful_login.connect(self.logged_in)
|
||||
self.main_window.open_tab(tab)
|
||||
|
||||
def logghed_in(self):
|
||||
def logged_in(self):
|
||||
session = Users.get_session()
|
||||
if session is not None:
|
||||
if session.is_admin:
|
||||
|
||||
BIN
src/test/data/database/sqlite.db
Normal file
BIN
src/test/data/database/sqlite.db
Normal file
Binary file not shown.
27
src/test/label_printer.py
Normal file
27
src/test/label_printer.py
Normal file
@ -0,0 +1,27 @@
|
||||
from datetime import datetime
|
||||
|
||||
from components import Os_Label_Printer
|
||||
dmtx="0AG554457062203314"
|
||||
context = {
|
||||
"DATAMATRIX": dmtx,
|
||||
"DATAMATRIX_TEXT": dmtx,
|
||||
"PIECE_NUM": str(3314),
|
||||
"DATETIME": str(datetime.now().isoformat()),
|
||||
"SHIFT": "01",
|
||||
"STATION": "ST-TEN-1",
|
||||
"OPERATOR": "albano",
|
||||
"PMAX": "6,13",
|
||||
"PMIN": "6,13",
|
||||
"LEAK": "0,00",
|
||||
"TFILL": "5",
|
||||
"TSTAB": "10",
|
||||
"TTEST": "20",
|
||||
"MAXLEAK": "0,03",
|
||||
"PTESTMIN": "6,00",
|
||||
"RESULT_L1": "ESITO",
|
||||
"RESULT_L2": "CONFORME",
|
||||
}
|
||||
|
||||
config={"test":{"platform":"windows","printer":"zd421"}}
|
||||
printer=Os_Label_Printer(config=config,name="test")
|
||||
printer.print_label("EtichettaR5", context=context)
|
||||
@ -191,7 +191,7 @@
|
||||
<item row="2" column="1">
|
||||
<widget class="QSpinBox" name="settling_pressure_min_percent_sb">
|
||||
<property name="maximum">
|
||||
<number>100</number>
|
||||
<number>150</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user