def setup_ui(self, name):
        self._min_spin_box = QtWidgets.QDoubleSpinBox()
        self._min_spin_box.setMaximum(10000)
        self._min_spin_box.setMinimum(-10000)
        self._min_spin_box.setValue(self.DEFAULT_MIN_VALUE)
        self._slider = QtWidgets.QSlider(QtCore.Qt.Horizontal)
        self._slider.setTickPosition(QtWidgets.QSlider.TicksBelow)
        self._slider.valueChanged.connect(self.slider_changed)
        self._max_spin_box = QtWidgets.QDoubleSpinBox()
        self._max_spin_box.setMaximum(10000)
        self._max_spin_box.setMinimum(-10000)
        self._max_spin_box.setValue(self.DEFAULT_MAX_VALUE)
        self._lcd = QtWidgets.QLCDNumber()
        self._lcd.setMaximumHeight(self.LCD_HEIGHT)
        self._slider.setValue(50)
        zero_button = QtWidgets.QPushButton('reset')
        zero_button.clicked.connect(
            lambda x: self._slider.setValue(self.value_to_slider(0.0)))
        self._horizontal_layout.addWidget(self._min_spin_box)
        self._horizontal_layout.addWidget(self._slider)
        self._horizontal_layout.addWidget(self._max_spin_box)
        self._horizontal_layout.addWidget(self._lcd)
        self._horizontal_layout.addWidget(zero_button)

        self.setLayout(self._horizontal_layout)
Example #2
0
    def __init__(self, frame_editor):
        self.editor = frame_editor
        self.editor.observers.append(self)

        self.old_frame = None

        self.layout = QtWidgets.QGridLayout()
        self.widget = QWidget()
        self.widget.setLayout(self.layout)

        self.mesh_label = QtWidgets.QLineEdit("File:")
        self.mesh_label.setSizePolicy(QtWidgets.QSizePolicy.Ignored,
                                      QtWidgets.QSizePolicy.Fixed)
        self.mesh_button = QtWidgets.QPushButton("Open")
        self.mesh_button.clicked.connect(lambda: self.btn_open_mesh_clicked())

        self.diameter_label = QtWidgets.QLabel("Diameter:")
        self.diameter_spinbox = QtWidgets.QDoubleSpinBox()
        self.diameter_spinbox.editingFinished.connect(
            lambda: self.diameter_changed())

        self.length_label = QtWidgets.QLabel("Length:")
        self.length_spinbox = QtWidgets.QDoubleSpinBox()
        self.length_spinbox.editingFinished.connect(
            lambda: self.length_changed())

        self.width_label = QtWidgets.QLabel("Width:")
        self.width_spinbox = QtWidgets.QDoubleSpinBox()
        self.width_spinbox.editingFinished.connect(
            lambda: self.width_changed())

        self.height_label = QtWidgets.QLabel("Height:")
        self.height_spinbox = QtWidgets.QDoubleSpinBox()
        self.height_spinbox.editingFinished.connect(
            lambda: self.height_changed())

        self.color_label = QtWidgets.QLabel()
        self.color_label.setAutoFillBackground(True)
        self.update_color_label(None)
        self.color_button = QtWidgets.QPushButton("Set Color")
        self.color_button.clicked.connect(lambda: self.btn_color_clicked())

        self.layout.addWidget(self.mesh_label, 0, 0)
        self.layout.addWidget(self.mesh_button, 0, 1)
        self.layout.addWidget(self.diameter_label, 1, 0)
        self.layout.addWidget(self.diameter_spinbox, 1, 1)
        self.layout.addWidget(self.length_label, 2, 0)
        self.layout.addWidget(self.length_spinbox, 2, 1)
        self.layout.addWidget(self.width_label, 3, 0)
        self.layout.addWidget(self.width_spinbox, 3, 1)
        self.layout.addWidget(self.height_label, 4, 0)
        self.layout.addWidget(self.height_spinbox, 4, 1)
        self.layout.addWidget(self.color_label, 5, 0)
        self.layout.addWidget(self.color_button, 5, 1)

        print("init")
        self.update_widget(None)
Example #3
0
    def chained_tasks_drop_cb(self, event):
        '''
        Called when a task is dropped from the available_tasks_list to the chained_tasks_table,
        or when a task is moved (reordered) within the chained_tasks_table.
        '''
        idx = self.chained_tasks_table.indexAt(event.pos()).row()
        if idx == -1:  # Handle insertion at end of table
            idx = self.chained_tasks_table.rowCount()

        # If drop is from itself, do a reorder
        if event.source() == self.chained_tasks_table:
            # Now swap the two rows
            selected_index = self.chained_tasks_table.selectedIndexes()[0].row(
            )
            if idx == selected_index:
                return
            self.chained_tasks_table.insertRow(idx)
            if selected_index > idx:
                selected_index += 1
            for i in range(self.chained_tasks_table.columnCount()):
                self.chained_tasks_table.setCellWidget(
                    idx, i,
                    self.chained_tasks_table.cellWidget(selected_index, i))
            self.chained_tasks_table.removeRow(selected_index)

        # If drop is from available list, insert it at the dropped row
        elif event.source() == self.available_tasks_list:
            selected_item = self.available_tasks_list.selectedItems()[0]
            task = QtWidgets.QLabel(selected_item.text())
            required = CenteredCheckBox()
            required.setChecked(True)  # Start with default required
            timeout = QtWidgets.QDoubleSpinBox()
            timeout.setValue(0)
            timeout.setMaximum(10000)
            timeout.setSuffix('s')
            parameters = QtWidgets.QLineEdit('')
            self.chained_tasks_table.insertRow(idx)
            self.chained_tasks_table.setCellWidget(idx, 0, task)
            self.chained_tasks_table.setCellWidget(idx, 1, required)
            self.chained_tasks_table.setCellWidget(idx, 2, timeout)
            self.chained_tasks_table.setCellWidget(idx, 3, parameters)
Example #4
0
 def load_chained_missions(self, list_of_missions):
     for i in reversed(range(self.chained_missions_table.rowCount())):
         self.chained_missions_table.removeRow(i)
     for idx, m in enumerate(list_of_missions):
         mission = m['mission']
         timeout = m['timeout']
         required = m['required']
         parameters = m['parameters']
         mission = QtWidgets.QLabel(m['mission'])
         required = CenteredCheckBox()
         required.setChecked(m['required'])  # Start with default required
         timeout = QtWidgets.QDoubleSpinBox()
         timeout.setValue(m['timeout'])
         timeout.setMaximum(10000)
         timeout.setSuffix('s')
         parameters = QtWidgets.QLineEdit(m['parameters'])
         self.chained_missions_table.insertRow(idx)
         self.chained_missions_table.setCellWidget(idx, 0, mission)
         self.chained_missions_table.setCellWidget(idx, 1, required)
         self.chained_missions_table.setCellWidget(idx, 2, timeout)
         self.chained_missions_table.setCellWidget(idx, 3, parameters)
    def setupUi(self, MainWindow):
###############################################################################################
        self.lock = Lock()
        self.talker = Talker('gui')
        rospy.Subscriber('bbBackup',bbBackup,self.backupFunction)   
        rospy.Subscriber('clicked_point',PointStamped,self.clickedPintRviz)
###############################################################################################


        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(560, 440)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.gBnewTask = QtWidgets.QGroupBox(self.centralwidget)
        self.gBnewTask.setGeometry(QtCore.QRect(10, 60, 541, 291))
        self.gBnewTask.setObjectName("gBnewTask")
        self.gBc = QtWidgets.QGroupBox(self.gBnewTask)
        self.gBc.setEnabled(False)
        self.gBc.setGeometry(QtCore.QRect(420, 80, 111, 151))
        self.gBc.setObjectName("gBc")
        self.label_29 = QtWidgets.QLabel(self.gBc)
        self.label_29.setGeometry(QtCore.QRect(10, 30, 16, 21))
        self.label_29.setObjectName("label_29")
        self.label_30 = QtWidgets.QLabel(self.gBc)
        self.label_30.setGeometry(QtCore.QRect(10, 90, 21, 21))
        self.label_30.setObjectName("label_30")
        self.label_31 = QtWidgets.QLabel(self.gBc)
        self.label_31.setGeometry(QtCore.QRect(10, 60, 16, 21))
        self.label_31.setObjectName("label_31")
        self.cx = QtWidgets.QDoubleSpinBox(self.gBc)
        self.cx.setGeometry(QtCore.QRect(30, 30, 69, 26))
        self.cx.setObjectName("cx")
        self.cx.setRange(-100.0,100.0)
        self.cy = QtWidgets.QDoubleSpinBox(self.gBc)
        self.cy.setGeometry(QtCore.QRect(30, 60, 69, 26))
        self.cy.setObjectName("cy")
        self.cy.setRange(-100.0,100.0)
        self.cz = QtWidgets.QDoubleSpinBox(self.gBc)
        self.cz.setGeometry(QtCore.QRect(30, 90, 69, 26))
        self.cz.setObjectName("cz")
        self.cz.setRange(-100.0,100.0)
        self.cw = QtWidgets.QDoubleSpinBox(self.gBc)
        self.cw.setGeometry(QtCore.QRect(30, 120, 69, 26))
        self.cw.setObjectName("cw")
        self.cw.setRange(-100.0,100.0)
        self.label_39 = QtWidgets.QLabel(self.gBc)
        self.label_39.setGeometry(QtCore.QRect(10, 120, 21, 21))
        self.label_39.setObjectName("label_39")
        self.gBb = QtWidgets.QGroupBox(self.gBnewTask)
        self.gBb.setEnabled(False)
        self.gBb.setGeometry(QtCore.QRect(300, 80, 111, 151))
        self.gBb.setObjectName("gBb")
        self.label_40 = QtWidgets.QLabel(self.gBb)
        self.label_40.setGeometry(QtCore.QRect(10, 30, 16, 21))
        self.label_40.setObjectName("label_40")
        self.label_41 = QtWidgets.QLabel(self.gBb)
        self.label_41.setGeometry(QtCore.QRect(10, 90, 21, 21))
        self.label_41.setObjectName("label_41")
        self.label_42 = QtWidgets.QLabel(self.gBb)
        self.label_42.setGeometry(QtCore.QRect(10, 60, 16, 21))
        self.label_42.setObjectName("label_42")
        self.bx = QtWidgets.QDoubleSpinBox(self.gBb)
        self.bx.setGeometry(QtCore.QRect(30, 30, 69, 26))
        self.bx.setObjectName("bx")
        self.bx.setRange(-100.0,100.0)
        self.by = QtWidgets.QDoubleSpinBox(self.gBb)
        self.by.setGeometry(QtCore.QRect(30, 60, 69, 26))
        self.by.setObjectName("by")
        self.by.setRange(-100.0,100.0)
        self.bz = QtWidgets.QDoubleSpinBox(self.gBb)
        self.bz.setGeometry(QtCore.QRect(30, 90, 69, 26))
        self.bz.setObjectName("bz")
        self.bz.setRange(-100.0,100.0)
        self.bw = QtWidgets.QDoubleSpinBox(self.gBb)
        self.bw.setGeometry(QtCore.QRect(30, 120, 69, 26))
        self.bw.setObjectName("bw")
        self.bw.setRange(-100.0,100.0)
        self.label_43 = QtWidgets.QLabel(self.gBb)
        self.label_43.setGeometry(QtCore.QRect(10, 120, 21, 21))
        self.label_43.setObjectName("label_43")
        self.gBtaskType = QtWidgets.QGroupBox(self.gBnewTask)
        self.gBtaskType.setGeometry(QtCore.QRect(10, 80, 161, 151))
        self.gBtaskType.setObjectName("gBtaskType")
        self.radioButton = QtWidgets.QRadioButton(self.gBtaskType)
        self.radioButton.setEnabled(True)
        self.radioButton.setGeometry(QtCore.QRect(10, 30, 131, 23))
        self.radioButton.setChecked(True)
        self.radioButton.setObjectName("radioButton")
        self.radioButton_2 = QtWidgets.QRadioButton(self.gBtaskType)
        self.radioButton_2.setGeometry(QtCore.QRect(10, 60, 101, 23))
        self.radioButton_2.setObjectName("radioButton_2")
        self.radioButton_3 = QtWidgets.QRadioButton(self.gBtaskType)
        self.radioButton_3.setGeometry(QtCore.QRect(10, 90, 131, 23))
        self.radioButton_3.setObjectName("radioButton_3")
        self.radioButton_4 = QtWidgets.QRadioButton(self.gBtaskType)
        self.radioButton_4.setGeometry(QtCore.QRect(10, 120, 141, 23))
        self.radioButton_4.setObjectName("radioButton_4")
        self.gBa = QtWidgets.QGroupBox(self.gBnewTask)
        self.gBa.setEnabled(True)
        self.gBa.setGeometry(QtCore.QRect(180, 80, 111, 151))
        self.gBa.setObjectName("gBa")
        self.label_25 = QtWidgets.QLabel(self.gBa)
        self.label_25.setGeometry(QtCore.QRect(10, 30, 16, 21))
        self.label_25.setObjectName("label_25")
        self.label_26 = QtWidgets.QLabel(self.gBa)
        self.label_26.setGeometry(QtCore.QRect(10, 90, 21, 21))
        self.label_26.setObjectName("label_26")
        self.label_27 = QtWidgets.QLabel(self.gBa)
        self.label_27.setGeometry(QtCore.QRect(10, 60, 16, 21))
        self.label_27.setObjectName("label_27")
        self.ax = QtWidgets.QDoubleSpinBox(self.gBa)
        self.ax.setGeometry(QtCore.QRect(30, 30, 69, 26))
        self.ax.setObjectName("ax")
        self.ax.setRange(-100.0,100.0)
        self.ay = QtWidgets.QDoubleSpinBox(self.gBa)
        self.ay.setGeometry(QtCore.QRect(30, 60, 69, 26))
        self.ay.setObjectName("ay")
        self.ay.setRange(-100.0,100.0)
        self.az = QtWidgets.QDoubleSpinBox(self.gBa)
        self.az.setGeometry(QtCore.QRect(30, 90, 69, 26))
        self.az.setObjectName("az")
        self.az.setRange(-100.0,100.0)
        self.aw = QtWidgets.QDoubleSpinBox(self.gBa)
        self.aw.setGeometry(QtCore.QRect(30, 120, 69, 26))
        self.aw.setObjectName("aw")
        self.aw.setRange(-100.0,100.0)
        self.label_28 = QtWidgets.QLabel(self.gBa)
        self.label_28.setGeometry(QtCore.QRect(10, 120, 21, 21))
        self.label_28.setObjectName("label_28")
        self.btnAddTask = QtWidgets.QPushButton(self.gBnewTask)
        self.btnAddTask.setEnabled(True)
        self.btnAddTask.setGeometry(QtCore.QRect(10, 240, 521, 31))
        self.btnAddTask.setObjectName("btnAddTask")
        self.widget = QtWidgets.QWidget(self.gBnewTask)
        self.widget.setGeometry(QtCore.QRect(10, 30, 521, 28))
        self.widget.setObjectName("widget")
        self.horizontalLayout = QtWidgets.QHBoxLayout(self.widget)
        self.horizontalLayout.setContentsMargins(0, 0, 0, 0)
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.label_3 = QtWidgets.QLabel(self.widget)
        self.label_3.setObjectName("label_3")
        self.horizontalLayout.addWidget(self.label_3)
        self.sBtaskid = QtWidgets.QSpinBox(self.widget)
        self.sBtaskid.setObjectName("sBtaskid")
        self.horizontalLayout.addWidget(self.sBtaskid)
        self.label_4 = QtWidgets.QLabel(self.widget)
        self.label_4.setObjectName("label_4")
        self.horizontalLayout.addWidget(self.label_4)
        self.sbtaskPriority = QtWidgets.QSpinBox(self.widget)
        self.sbtaskPriority.setObjectName("sbtaskPriority")
        self.horizontalLayout.addWidget(self.sbtaskPriority)
        self.label_5 = QtWidgets.QLabel(self.widget)
        self.label_5.setObjectName("label_5")
        self.horizontalLayout.addWidget(self.label_5)
        self.sbtaskPayload = QtWidgets.QSpinBox(self.widget)
        self.sbtaskPayload.setObjectName("sbtaskPayload")
        self.horizontalLayout.addWidget(self.sbtaskPayload)
        self.gBrobotState = QtWidgets.QGroupBox(self.centralwidget)
        self.gBrobotState.setGeometry(QtCore.QRect(10, 360, 541, 71))
        self.gBrobotState.setObjectName("gBrobotState")
        self.sBrobotId = QtWidgets.QSpinBox(self.gBrobotState)
        self.sBrobotId.setGeometry(QtCore.QRect(80, 30, 48, 31))
        self.sBrobotId.setObjectName("sBrobotId")
        self.radioButton_5 = QtWidgets.QRadioButton(self.gBrobotState)
        self.radioButton_5.setGeometry(QtCore.QRect(140, 32, 61, 31))
        self.radioButton_5.setChecked(True)
        self.radioButton_5.setObjectName("radioButton_5")
        self.radioButton_6 = QtWidgets.QRadioButton(self.gBrobotState)
        self.radioButton_6.setGeometry(QtCore.QRect(280, 32, 71, 31))
        self.radioButton_6.setObjectName("radioButton_6")
        self.radioButton_7 = QtWidgets.QRadioButton(self.gBrobotState)
        self.radioButton_7.setGeometry(QtCore.QRect(210, 32, 51, 31))
        self.radioButton_7.setObjectName("radioButton_7")
        self.btnsetRobotState = QtWidgets.QPushButton(self.gBrobotState)
        self.btnsetRobotState.setEnabled(True)
        self.btnsetRobotState.setGeometry(QtCore.QRect(380, 30, 151, 31))
        self.btnsetRobotState.setObjectName("btnsetRobotState")
        self.label_32 = QtWidgets.QLabel(self.gBrobotState)
        self.label_32.setGeometry(QtCore.QRect(10, 30, 81, 31))
        self.label_32.setObjectName("label_32")
        self.label = QtWidgets.QLabel(self.centralwidget)
        self.label.setGeometry(QtCore.QRect(10, 20, 81, 17))
        self.label.setObjectName("label")
        self.label_2 = QtWidgets.QLabel(self.centralwidget)
        self.label_2.setGeometry(QtCore.QRect(300, 20, 141, 17))
        self.label_2.setObjectName("label_2")
        self.lblblackBoard = QtWidgets.QLabel(self.centralwidget)
        self.lblblackBoard.setGeometry(QtCore.QRect(100, 20, 141, 17))
        font = QtGui.QFont()
        font.setItalic(True)
        self.lblblackBoard.setFont(font)
        self.lblblackBoard.setObjectName("lblblackBoard")
        self.lblbackupBlackboard = QtWidgets.QLabel(self.centralwidget)
        self.lblbackupBlackboard.setGeometry(QtCore.QRect(450, 20, 91, 17))
        font = QtGui.QFont()
        font.setItalic(True)
        self.lblbackupBlackboard.setFont(font)
        self.lblbackupBlackboard.setObjectName("lblbackupBlackboard")
        MainWindow.setCentralWidget(self.centralwidget)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)
        self.currentpint = 1