Beispiel #1
0
 def set_POINT(self):
     """Set the inching time of all selected devices by user ."""
     # Check if the user has selected the device
     if len(self.select_name) <= 0:
         QMessageBox.information(
                 self,
                 "Ошибка отправки",
                 "Не выбрано устройство!",
                 QMessageBox.Yes,
                 QMessageBox.Yes)
         return
     vrg = {}
     # The pop-up dialog box waits for user input
     set_time_dialog = SetTimeDialog()
     set_time_dialog.show()
     ret = set_time_dialog.exec_()
     if ret:
         if set_time_dialog.set_sta:
             all_time = set_time_dialog.all_time()
             print("all_time", all_time)
             if all_time == 0:
                 QMessageBox.critical(
                         self, "set time fail", "input time error!")
                 return
             vrg["pulseWidth"] = all_time
             vrg["pulse"] = "on"
         else:
             vrg["pulse"] = "off"
             vrg["pulseWidth"] = 500
         set_time_dialog.destroy()
         self.run_detection(command_num=5, command_vrg=vrg)
 def set_POINT_a_sub(self, sub_id):
     """
     Set the inching time of all selected devices by user .
     :param sub_id: You need to set the device ID for the inching mode
     :return:
     """
     # Parses the mDNS to get the inching information to the current device
     # and adds it to the dialog box
     vrg = {}
     pass
     vrg["pulse"] = "on"
     sub_info = self.mDNS_info_sta[sub_id]
     all_time = sub_info["pulseWidth"]
     min_time = all_time // 60000
     sec_time = all_time % 60000 // 1000
     if all_time % 1000 == 500:
         sec_sta = True
     else:
         sec_sta = False
     if sub_info["pulse"]:
         sta = True
     else:
         sta = False
     #  The pop-up dialog box waits for user input
     set_time_dialog = SetTimeDialog(min=min_time,
                                     sec=sec_time,
                                     pulse=sta,
                                     sec_sta=sec_sta)
     set_time_dialog.show()
     ret = set_time_dialog.exec_()
     if ret != 0:
         all_time = set_time_dialog.all_time()
         print("all_time", all_time)
         if all_time == 0:
             QMessageBox.critical(self, "set time fail",
                                  "input time error!")
             return
         if set_time_dialog.set_sta:
             vrg["pulseWidth"] = all_time
             vrg["pulse"] = "on"
         else:
             vrg["pulse"] = "off"
             vrg["pulseWidth"] = all_time
         # print("send:", vrg)
         self.run_a_dev(sub_id, command_num=5, command_vrg=vrg)
     set_time_dialog.destroy()