Ejemplo n.º 1
0
    def mergeTracks(self, unused=None):
        (track1Id, ok) = QInputDialog.getInteger(
            self.widget, "Merge two tracks",
            "Please enter the ID of the 1st person track you want to merge.")
        if not ok:
            return

        (track2Id, ok) = QInputDialog.getInteger(
            self.widget, "Merge two tracks",
            "Please enter the ID of the 2nd person track you want to merge.")
        if not ok:
            return

        if track1Id == track2Id:
            QMessageBox.critical(self.widget, "Merge two tracks",
                                 "Track IDs cannot be identical!")
            return

        if self.verifyTrackExists(track1Id) and self.verifyTrackExists(
                track2Id):
            self.editor.mergeTracks(track1Id, track2Id)
            self.updateTrackCount()
            QMessageBox.information(
                self.widget, "Merge two tracks",
                "Person tracks %d and %d have been merged!" %
                (track1Id, track2Id))
Ejemplo n.º 2
0
 def click_btnSaveRos(self):
     if self.txtVariableRos.isEnabled():
         if self.txtVariableRos.text().strip(
         ) != "" and self.txtValueRos.text().strip() != "":
             if not self.validate_item(self.txtVariableRos.text()):
                 xml_info = XmlInfo()
                 xml_info.add_variable_ros(self.txtVariableRos.text(),
                                           self.txtValueRos.text())
                 message_instance = None
                 self._recursive_create_widget_items(
                     self.env_ros_tree_widget, self.txtVariableRos.text(),
                     self.txtValueRos.text(), message_instance)
             else:
                 QMessageBox.information(
                     self, 'Variable exists',
                     self.txtVariableRos.text() + " exists in list")
     else:
         message_instance = None
         xml_info = XmlInfo()
         xml_info.modify_variable_ros(self.txtVariableRos.text(),
                                      self.txtValueRos.text())
         self.env_ros_tree_widget.clear()
         self.refresh_env()
     self.btnSaveRos.setEnabled(False)
     self.btnRemoveRos.setEnabled(True)
     self.txtVariableRos.setText("")
     self.txtValueRos.setText("")
     self.txtVariableRos.setEnabled(False)
     self.txtValueRos.setEnabled(False)
     self.btnRemoveRos.setEnabled(False)
     self.btnNewRos.setEnabled(True)
Ejemplo n.º 3
0
 def click_btn_apply(self):
     
     if self.validate_checked():
         quit_msg = "Are you sure you want to Apply this configuration?"
         reply = QMessageBox.question(self, 'Message', quit_msg, QMessageBox.Yes, QMessageBox.No)
         self.get_selected_robot_checked()
         if reply == QMessageBox.Yes:
             xml_info = XmlInfo()
             env_os = EnvOs()
             dialog_xml = DialogXml()
             deleted_general_items = xml_info.get_deleted_general_variable()  #get deleted general items (deleted status = 1 in xml)
             variable_general_items = xml_info.get_general_variables()
             dialog_xml.get_deleted_variable_robot()
             deleted_robots_items=dialog_xml.get_deleted_variable_robot()
             variable_robot_items,active_robot=dialog_xml.get_general_variable_robot()
             deleted_robot=dialog_xml.get_deleted_robot()
             asociative_variable_robot = dialog_xml.get_asociative_robot_variable()
             env_os.unset_to_htbash(deleted_robots_items+deleted_robots_items)
             env_os.export_to_general_htbash(variable_general_items)
             env_os.export_to_robot_htbash(variable_robot_items,active_robot)
             dialog_xml.remove_asociative_robot_variable(asociative_variable_robot)
             for item in deleted_robot:
                 dialog_xml.remove_robot_list_variable(item)
             for item in deleted_general_items:   
                 xml_info.remove_general_variable(item)   
             env_os.include_htbash()
             self.lblmsg.setText("write file .htbash successfully")
         else:
              pass
     else:
         QMessageBox.information(self, 'Checked validate',"You only must select one active robot")
Ejemplo n.º 4
0
    def click_btnSaveRobot(self):
        if self.txtVariableRobot.text() == 'ROS_MASTER_URI':
            parse = urlparse(self.txtValueRobot.text())
            if not self.validate_ip(parse.netloc.split(':')[0]):
                QMessageBox.information(self, 'ROS_MASTER_URI format',
                                        "ROS_MASTER_URI must have http://")
                return False
        if self.txtVariableRobot.text() == 'ROS_HOSTNAME':
            if not self.validate_hostname_value(
                    self.txtValueRobot.text().split(":")[0]):
                QMessageBox.information(
                    self, 'ROS_HOSTNAME format',
                    "ROS_HOSTNAME must have localhost or IP")
                return False
            else:
                if self.txtValueRobot.text().split(
                        ":")[0].lower() == "localhost":
                    self.txtValueRobot.setText(
                        self.txtValueRobot.text().lower())
        if self.txtVariableRobot.isEnabled():
            if self.txtAlias.text().strip() != "":
                if self.txtVariableRobot.text().strip(
                ) != "" and self.txtValueRobot.text().strip() != "":
                    if not self.exist_item(self.txtVariableRobot.text()):
                        dialog_xml = DialogXml()
                        dialog_xml.add_variable_robot(
                            self.txtAlias.text().strip(),
                            self.txtVariableRobot.text(),
                            self.txtValueRobot.text())
                        message_instance = None
                        variable_item = self._recursive_create_widget_items(
                            self.treeWidgetRobot, self.txtVariableRobot.text(),
                            self.txtValueRobot.text(), message_instance)
                    else:
                        QMessageBox.information(
                            self, 'Variable exists',
                            self.txtVariableRobot.text() + " exists in list")
            else:
                QMessageBox.information(self, 'Alias is empty',
                                        "Please, insert a value for alias")
                self.txtAlias.setFocus()
        else:
            xml_dialog = DialogXml()
            xml_dialog.modify_variable_robot(self.txtVariableRobot.text(),
                                             self.txtValueRobot.text(),
                                             self.txtAlias.text().strip())
            self.treeWidgetRobot.clear()
            self.refresh_variables()

        self.btnSaveRobot.setEnabled(False)
        self.btnRemoveRobot.setEnabled(True)
        self.txtVariableRobot.setText("")
        self.txtValueRobot.setText("")
        self.txtVariableRobot.setEnabled(False)
        self.txtValueRobot.setEnabled(False)
        self.btnRemoveRobot.setEnabled(False)
        self.btnAddRobot.setEnabled(True)
        self.btnAddRobot.setFocus()
Ejemplo n.º 5
0
    def click_btn_apply(self):

        if self.validate_checked():
            quit_msg = "Are you sure you want to Apply this configuration?"
            reply = QMessageBox.question(self, 'Message', quit_msg,
                                         QMessageBox.Yes, QMessageBox.No)
            self.get_selected_robot_checked()
            if reply == QMessageBox.Yes:
                xml_info = XmlInfo()
                env_os = EnvOs()
                dialog_xml = DialogXml()
                deleted_general_items = xml_info.get_deleted_general_variable(
                )  #get deleted general items (deleted status = 1 in xml)
                variable_general_items = xml_info.get_general_variables()
                dialog_xml.get_deleted_variable_robot()
                deleted_robots_items = dialog_xml.get_deleted_variable_robot()
                variable_robot_items, active_robot = dialog_xml.get_general_variable_robot(
                )
                deleted_robot = dialog_xml.get_deleted_robot()
                asociative_variable_robot = dialog_xml.get_asociative_robot_variable(
                )
                env_os.unset_to_htbash(deleted_robots_items +
                                       deleted_robots_items)
                env_os.export_to_general_htbash(variable_general_items)
                env_os.export_to_robot_htbash(variable_robot_items,
                                              active_robot)
                dialog_xml.remove_asociative_robot_variable(
                    asociative_variable_robot)
                for item in deleted_robot:
                    dialog_xml.remove_robot_list_variable(item)
                for item in deleted_general_items:
                    xml_info.remove_general_variable(item)
                env_os.include_htbash()
                self.lblmsg.setText("write file .htbash successfully")
            else:
                pass
        else:
            QMessageBox.information(self, 'Checked validate',
                                    "You only must select one active robot")
Ejemplo n.º 6
0
 def click_btnSaveRos(self):
     if self.txtVariableRos.isEnabled():
         if self.txtVariableRos.text().strip() != "" and self.txtValueRos.text().strip() != "" :
             if not self.validate_item(self.txtVariableRos.text()):
                 xml_info = XmlInfo()
                 xml_info.add_variable_general(self.txtVariableRos.text(),self.txtValueRos.text())
                 message_instance = None
                 self._recursive_create_widget_items(self.env_ros_tree_widget, self.txtVariableRos.text(), self.txtValueRos.text(), message_instance)
             else:
                  QMessageBox.information(self, 'Variable exists',self.txtVariableRos.text()+" exists in list")
     else:
         message_instance = None
         xml_info = XmlInfo()
         xml_info.modify_variable_general(self.txtVariableRos.text(),self.txtValueRos.text())
         self.env_ros_tree_widget.clear()
         self.refresh_env()
     self.btnSaveRos.setEnabled(False)
     self.btnRemoveRos.setEnabled(True)
     self.txtVariableRos.setText("")
     self.txtValueRos.setText("")
     self.txtVariableRos.setEnabled(False)
     self.txtValueRos.setEnabled(False)
     self.btnRemoveRos.setEnabled(False)
     self.btnNewRos.setEnabled(True)
Ejemplo n.º 7
0
	def click_btnSaveRobot(self):
		if self.txtVariableRobot.text() == 'ROS_MASTER_URI':
			parse = urlparse(self.txtValueRobot.text())
			if not self.validate_ip(parse.netloc.split(':')[0]):
				QMessageBox.information(self, 'ROS_MASTER_URI format',"ROS_MASTER_URI must have http://")
				return False
		if self.txtVariableRobot.text()=='ROS_HOSTNAME':
			if not self.validate_hostname_value(self.txtValueRobot.text().split(":")[0]):
				QMessageBox.information(self, 'ROS_HOSTNAME format',"ROS_HOSTNAME must have localhost or IP")
				return False
			else:
				if self.txtValueRobot.text().split(":")[0].lower()=="localhost":
					self.txtValueRobot.setText(self.txtValueRobot.text().lower())
		if self.txtVariableRobot.isEnabled():
			if self.txtAlias.text().strip() != "":
				if self.txtVariableRobot.text().strip() != "" and self.txtValueRobot.text().strip() != "" :
				    if not self.exist_item(self.txtVariableRobot.text()):
				    	dialog_xml = DialogXml()					    	
				     	dialog_xml.add_variable_robot(self.txtAlias.text().strip(),self.txtVariableRobot.text(),self.txtValueRobot.text())
				    	message_instance = None
				    	variable_item = self._recursive_create_widget_items(self.treeWidgetRobot, self.txtVariableRobot.text(), self.txtValueRobot.text(), message_instance)
				    else:
				         QMessageBox.information(self, 'Variable exists',self.txtVariableRobot.text()+" exists in list")
			else:
				QMessageBox.information(self, 'Alias is empty',"Please, insert a value for alias")
				self.txtAlias.setFocus()
		else: 
			xml_dialog = DialogXml()
			xml_dialog.modify_variable_robot(self.txtVariableRobot.text(),self.txtValueRobot.text(),self.txtAlias.text().strip())
			self.treeWidgetRobot.clear()
  			self.refresh_variables()

		self.btnSaveRobot.setEnabled(False)
		self.btnRemoveRobot.setEnabled(True)
		self.txtVariableRobot.setText("")
		self.txtValueRobot.setText("")
		self.txtVariableRobot.setEnabled(False)
		self.txtValueRobot.setEnabled(False)
		self.btnRemoveRobot.setEnabled(False)
		self.btnAddRobot.setEnabled(True)
		self.btnAddRobot.setFocus()
Ejemplo n.º 8
0
 def closeEvent(self, event):
     uri, hostname = self.validate_uri_hostname()
     if uri and hostname:
         self.destroy()
     elif not uri and not hostname:
         event.ignore()
         QMessageBox.information(
             self, 'ROS_HOSTNAME and ROS_MASTER_URI not exists',
             "You must add ROS_HOSTNAME AND ROS_MASTER_URI to initial variables"
         )
     elif not uri:
         event.ignore()
         QMessageBox.information(
             self, 'ROS_MASTER_URI not exists',
             "You must add ROS_MASTER_URI to initial variables")
     elif not hostname:
         event.ignore()
         QMessageBox.information(
             self, 'ROS_HOSTNAME not exists',
             "You must add ROS_HOSTNAME to initial variables")