예제 #1
0
 def focus_out(self, value):
     if value.get() != '':
         current_time_ms = int(round(time.time() * 1000))
         current_time = current_time_ms - SessionCore.get_offset_time()
         currentSeconed = current_time / 1000
         location_time = time.localtime(currentSeconed)
         date_time = (
             f"{location_time.tm_year}-{location_time.tm_mon}-{location_time.tm_mday} {location_time.tm_hour}:{location_time.tm_min}:{location_time.tm_sec}"
         )
         if value == self.tn_txt:
             Readings.set_tn({
                 'value': value.get(),
                 'source': 'manual',
                 'Accuracy': '100',
                 'time_stamp': date_time
             })
         elif value == self.trn_txt:
             Readings.set_trn({
                 'value': value.get(),
                 'source': 'manual',
                 'Accuracy': '100',
                 'time_stamp': date_time
             })
         elif value == self.nn_txt:
             print('inside nn in focus')
             Readings.set_nn({
                 'value': value.get(),
                 'source': 'manual',
                 'Accuracy': '100',
                 'time_stamp': date_time
             })
예제 #2
0
 def render(self,controller):
     Header.render(self)
     tn_lbl = tk.Label(self, text=arabic("رقم الشاحنة"),font=self.controller.title_font,bg="#fff")
     tn_lbl.grid(column=2, row=1)
     tn_txt= tk.Label(self, text=SessionCore.get_tn()[0]['value'], font=self.controller.title_font, justify="right",bg="#fff")
     tn_txt.grid(column=1, row=1,sticky='e')
     ##################################################################################################
     trn_lbl = tk.Label(self, text=arabic("رقم المقطورة"),font=self.controller.title_font, justify="right",bg="#fff")
     trn_lbl.grid(column=2, row=2)
     trn_txt=tk.Label(self, text=SessionCore.get_trn()[0]['value'], font=self.controller.title_font, justify="right",bg="#fff")
     trn_txt.grid(column=1,row=2,sticky='e')
     ###################################################################################################
     nn_lbl = tk.Label(self, text=arabic("الرقم الوطني"), font=self.controller.title_font, justify="right",bg="#fff")
     nn_lbl.grid(column=2, row=3)
     nn_txt=tk.Label(self, text=SessionCore.get_nn()[0]['value'], font=self.controller.title_font, justify="right",bg="#fff")
     nn_txt.grid(column=1,row=3,sticky='e')
     ##########
     button = ttk.Button(self,width=10 ,text=arabic("تقديم"),command=self.send_session)
     button.grid(column=0, row=7,columnspan=2)
     button = ttk.Button(self,width=10, text=arabic("رجوع"), command=lambda: self.controller.show_frame("TruckReception"))
     button.grid(column=1, row=7)
예제 #3
0
 def handle_message_scenario(self):
     message_type = self.msg.get('message_type')
     if message_type == SERVER_CONFIG_MESSAGE:
         # config_message = self.msg.get_config_data()
         config_message = self.msg.get('config_data')
         print(config_message, 'config_message')
         Config.extract_config(self, config_message)
     if message_type == SESSION_START:
         start_session_msg = self.msg.get('session_id')
         server_time = self.msg.get('timestamp')
         currentmillis = int(round(time.time() * 1000))
         offset = server_time - currentmillis
         SessionCore.set_offset_time(offset)
         SessionCore.set_server_time(server_time)
         SessionCore.set_session_id(start_session_msg)
         ################################################3
     if message_type == SESSION_TICKET:
         create_ticket_msg = self.msg.get('ticket_id')
         SessionCore.set_ticket_id(create_ticket_msg)
         # PrintWaiting(self)
         ticketStatusMonitoring.refresh()
예제 #4
0
 def send_session(self):
     session_data = Session()
     session_data.set_type(SESSION_DATA)
     session_data.set_session_data(SessionCore.get_session())
     self.client_socket.send_msg(session_data.json())
     self.controller.show_frame("ticketStatusMonitoring")
예제 #5
0
 def set_nn(value):
     Readings.nn.append(value)
     if SessionCore.get_session()['id']:
         SessionCore.set_nn(Readings.nn)