def __init__(self, tabwidget, parent=None):
     QDockWidget.__init__(self, "Find", parent)
     self.setObjectName('SearchFrame')
     self.setFeatures(QDockWidget.DockWidgetMovable
                      | QDockWidget.DockWidgetFloatable)
     self._dockwidget = QFrame(self)
     self.vbox_layout = QVBoxLayout(self._dockwidget)
     self.layout().setContentsMargins(0, 0, 0, 0)
     self.layout().setSpacing(1)
     # frame with two rows for find and replace
     find_replace_frame = QFrame(self)
     find_replace_vbox_layout = QVBoxLayout(find_replace_frame)
     find_replace_vbox_layout.setContentsMargins(0, 0, 0, 0)
     find_replace_vbox_layout.setSpacing(1)
     #        find_replace_vbox_layout.addSpacerItem(QSpacerItem(1, 1, QSizePolicy.Expanding, QSizePolicy.Expanding))
     # create frame with find row
     find_frame = self._create_find_frame()
     find_replace_vbox_layout.addWidget(find_frame)
     rplc_frame = self._create_replace_frame()
     find_replace_vbox_layout.addWidget(rplc_frame)
     # frame for find&replace and search results
     self.vbox_layout.addWidget(find_replace_frame)
     self.vbox_layout.addWidget(self._create_found_frame())
     #        self.vbox_layout.addStretch(2024)
     self.setWidget(self._dockwidget)
     # intern search parameters
     self._tabwidget = tabwidget
     self.current_search_text = ''
     self.search_results = []
     self.search_results_fileset = set()
     self._search_result_index = -1
     self._search_recursive = False
     self._search_thread = None
    def setup_group_frame(self, group):
        layout = QVBoxLayout()

        # grid for buttons for named targets
        grid = QGridLayout()
        grid.setSpacing(1)

        self.button_group = QButtonGroup(self)

        row = 0
        column = 0
        named_targets = self.get_named_targets(group)
        for target in named_targets:
            button = QPushButton(target)
            self.button_group.addButton(button)
            grid.addWidget(button, row, column)
            column += 1
            if column >= self.MAX_COLUMNS:
                row += 1
                column = 0

        self.button_group.buttonClicked.connect(self._handle_button_clicked)

        # grid for show joint value and move arm buttons/text field
        joint_values_grid = QGridLayout()
        joint_values_grid.setSpacing(1)

        button_show_joint_values = QPushButton('Current Joint Values')
        button_show_joint_values.clicked[bool].connect(
            self._handle_show_joint_values_clicked)

        line_edit = QLineEdit()
        self.text_joint_values.append(line_edit)

        button_move_to = QPushButton('Move to')
        button_move_to.clicked[bool].connect(self._handle_move_to_clicked)

        joint_values_grid.addWidget(button_show_joint_values, 0, 1)
        joint_values_grid.addWidget(line_edit, 0, 2)
        joint_values_grid.addWidget(button_move_to, 0, 3)

        layout.addLayout(grid)
        line = QFrame()
        line.setFrameShape(QFrame.HLine)
        line.setFrameShadow(QFrame.Sunken)
        layout.addWidget(line)
        layout.addLayout(joint_values_grid)

        frame = QFrame()
        frame.setLayout(layout)
        return frame
 def __init__(self, parent=None, info=False):
     QFrame.__init__(self, parent=parent)
     self.setObjectName('MessageFrame')
     self.questionid = self.TYPE_INVALID
     self.text = ""
     self.data = MessageData(None)
     self.IMAGES = {1: QPixmap(),
                    2: QPixmap(':/icons/crystal_clear_question.png').scaled(self.ICON_SIZE, self.ICON_SIZE, Qt.IgnoreAspectRatio, Qt.SmoothTransformation),
                    3: QPixmap(':/icons/crystal_clear_launch_file.png').scaled(self.ICON_SIZE, self.ICON_SIZE, Qt.IgnoreAspectRatio, Qt.SmoothTransformation),
                    4: QPixmap(":/icons/default_cfg.png").scaled(self.ICON_SIZE, self.ICON_SIZE, Qt.IgnoreAspectRatio, Qt.SmoothTransformation),
                    5: QPixmap(":/icons/crystal_clear_nodelet_q.png").scaled(self.ICON_SIZE, self.ICON_SIZE, Qt.IgnoreAspectRatio, Qt.SmoothTransformation),
                    6: QPixmap(":/icons/crystal_clear_launch_file_transfer.png").scaled(self.ICON_SIZE, self.ICON_SIZE, Qt.IgnoreAspectRatio, Qt.SmoothTransformation),
                    7: QPixmap(":/icons/crystal_clear_question.png").scaled(self.ICON_SIZE, self.ICON_SIZE, Qt.IgnoreAspectRatio, Qt.SmoothTransformation),
                    8: QPixmap(":/icons/crystal_clear_no_io.png").scaled(self.ICON_SIZE, self.ICON_SIZE, Qt.IgnoreAspectRatio, Qt.SmoothTransformation)
                    }
     self._new_request = False
     self.frameui = QFrame()
     ui_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'MessageFrame.ui')
     loadUi(ui_file, self.frameui)
     color = QColor(255, 207, 121)
     self.frameui.setVisible(False)
     self.frameui.listLabel.setVisible(False)
     self.frameui.questionOkButton.clicked.connect(self._on_question_ok)
     self.frameui.questionCancelButton.clicked.connect(self._on_question_cancel)
     self.frameui.checkBox_dnaa.stateChanged.connect(self._on_checkbox_state_changed)
     self._ask = 'ask'
     if info:
         color = QColor(232, 104, 80)
         self.frameui.questionCancelButton.setVisible(False)
         self._ask = 'show'
     bg_style = "QFrame#questionFame { background-color: %s;}" % color.name()
     self.frameui.setStyleSheet("%s" % (bg_style))
     self._queue = MessageQueue()
     self._do_not_ask = {}
Exemplo n.º 4
0
 def get_horizontal_line(self):
     """
     http://stackoverflow.com/questions/5671354/how-to-programmatically-make-a-horizontal-line-in-qt
     """
     hline = QFrame()
     hline.setFrameShape(QFrame.HLine)
     hline.setFrameShadow(QFrame.Sunken)
     return hline
Exemplo n.º 5
0
    def __init__(self, masteruri, cfg, ns, nodes, parent=None):
        QFrame.__init__(self, parent)
        self._masteruri = masteruri
        self._nodes = {cfg: {ns: nodes}}
        frame_layout = QVBoxLayout(self)
        frame_layout.setContentsMargins(0, 0, 0, 0)
        # create frame for warning label
        self.warning_frame = warning_frame = QFrame(self)
        warning_layout = QHBoxLayout(warning_frame)
        warning_layout.setContentsMargins(0, 0, 0, 0)
        warning_layout.addItem(
            QSpacerItem(0, 0, QSizePolicy.Expanding, QSizePolicy.Expanding))
        self.warning_label = QLabel()
        icon = nm.settings().icon('crystal_clear_warning.png')
        self.warning_label.setPixmap(icon.pixmap(QSize(40, 40)))
        self.warning_label.setToolTip(
            'Multiple configuration for same node found!\nA first one will be selected for the start a node!'
        )
        warning_layout.addWidget(self.warning_label)
        warning_layout.addItem(
            QSpacerItem(0, 0, QSizePolicy.Expanding, QSizePolicy.Expanding))
        frame_layout.addItem(
            QSpacerItem(0, 0, QSizePolicy.Expanding, QSizePolicy.Expanding))
        frame_layout.addWidget(warning_frame)
        # create frame for start/stop buttons
        buttons_frame = QFrame()
        buttons_layout = QHBoxLayout(buttons_frame)
        buttons_layout.setContentsMargins(0, 0, 0, 0)
        buttons_layout.addItem(QSpacerItem(20, 20))
        self.on_button = QPushButton()
        self.on_button.setFlat(False)
        self.on_button.setText("On")
        self.on_button.clicked.connect(self.on_on_clicked)
        buttons_layout.addWidget(self.on_button)

        self.off_button = QPushButton()
        self.off_button.setFlat(True)
        self.off_button.setText("Off")
        self.off_button.clicked.connect(self.on_off_clicked)
        buttons_layout.addWidget(self.off_button)
        buttons_layout.addItem(QSpacerItem(20, 20))
        frame_layout.addWidget(buttons_frame)
        frame_layout.addItem(
            QSpacerItem(0, 0, QSizePolicy.Expanding, QSizePolicy.Expanding))
        self.warning_frame.setVisible(False)
Exemplo n.º 6
0
    def beginGui(self, obj):
        self.parent = QScrollArea()
        self.frame = QFrame(self.parent)
        if obj.layout == "vertical":
            self.tl = QVBoxLayout()
        else:
            self.tl = QHBoxLayout()

        self.__increase_nesting_level(self.frame, self.tl)
Exemplo n.º 7
0
    def beginRosLabel(self, obj):
        pm, lm = self.__get_immediate_parent()

        fr = QFrame(pm)
        layout = QGridLayout()
        nlb = QLabel(obj.label_name + ":", fr)
        nlb.setToolTip(obj.topic_name)
        layout.addWidget(nlb, 1, 1)
        layout.addWidget(
            RosLabel(fr, obj.label_name, obj.topic_name, obj.topic_type,
                     obj.topic_field), 1, 2)
        fr.setLayout(layout)

        lm.addWidget(fr)
 def _create_replace_frame(self):
     # create frame with replace row
     self.rplc_frame = rplc_frame = QFrame(self)
     rplc_hbox_layout = QHBoxLayout(rplc_frame)
     rplc_hbox_layout.setContentsMargins(0, 0, 0, 0)
     rplc_hbox_layout.setSpacing(1)
     self.replace_field = EnchancedLineEdit(rplc_frame)
     self.replace_field.setPlaceholderText('replace text')
     self.replace_field.returnPressed.connect(self.on_replace)
     rplc_hbox_layout.addWidget(self.replace_field)
     self.replace_result_label = QLabel(rplc_frame)
     self.replace_result_label.setText(' ')
     rplc_hbox_layout.addWidget(self.replace_result_label)
     self.replace_button = replace_button = QPushButton("> &Replace >")
     replace_button.setFixedWidth(90)
     replace_button.clicked.connect(self.on_replace_click)
     rplc_hbox_layout.addWidget(replace_button)
     rplc_frame.setVisible(False)
     return rplc_frame
Exemplo n.º 9
0
 def __init__(self, parent=None):
     QFrame.__init__(self, parent=parent)
     self.setObjectName('MessageFrame')
     self.questionid = self.QuestionInvalid
     self.text = ""
     self.iconid = self.IconEmpty
     self.data = MessageData(None)
     self.IMAGES = {
         0:
         QPixmap(),
         1:
         QPixmap(':/icons/crystal_clear_question.png').scaled(
             self.ICON_SIZE, self.ICON_SIZE, Qt.IgnoreAspectRatio,
             Qt.SmoothTransformation),
         2:
         QPixmap(':/icons/crystal_clear_launch_file.png').scaled(
             self.ICON_SIZE, self.ICON_SIZE, Qt.IgnoreAspectRatio,
             Qt.SmoothTransformation),
         3:
         QPixmap(":/icons/default_cfg.png").scaled(self.ICON_SIZE,
                                                   self.ICON_SIZE,
                                                   Qt.IgnoreAspectRatio,
                                                   Qt.SmoothTransformation),
         4:
         QPixmap(":/icons/crystal_clear_nodelet_q.png").scaled(
             self.ICON_SIZE, self.ICON_SIZE, Qt.IgnoreAspectRatio,
             Qt.SmoothTransformation),
         5:
         QPixmap(":/icons/crystal_clear_question.png").scaled(
             self.ICON_SIZE, self.ICON_SIZE, Qt.IgnoreAspectRatio,
             Qt.SmoothTransformation)
     }
     self._new_request = False
     self.frameui = QFrame()
     ui_file = os.path.join(os.path.dirname(os.path.realpath(__file__)),
                            'MessageFrame.ui')
     loadUi(ui_file, self.frameui)
     self.frameui.setVisible(False)
     self.frameui.questionOkButton.clicked.connect(self._on_question_ok)
     self.frameui.questionCancelButton.clicked.connect(
         self._on_question_cancel)
Exemplo n.º 10
0
 def __init__(self, parent=None, info=False):
     QFrame.__init__(self, parent=parent)
     self.setObjectName('MessageFrame')
     self.questionid = self.TYPE_INVALID
     self.text = ""
     self.data = MessageData(None)
     self.IMAGES = {1: QPixmap(),
                    2: nm.settings().pixmap('question.png').scaled(self.ICON_SIZE, self.ICON_SIZE, Qt.IgnoreAspectRatio, Qt.SmoothTransformation),
                    3: nm.settings().pixmap('crystal_clear_launch_file.png').scaled(self.ICON_SIZE, self.ICON_SIZE, Qt.IgnoreAspectRatio, Qt.SmoothTransformation),
                    4: nm.settings().pixmap('default_cfg.png').scaled(self.ICON_SIZE, self.ICON_SIZE, Qt.IgnoreAspectRatio, Qt.SmoothTransformation),
                    5: nm.settings().pixmap('crystal_clear_nodelet_q.png').scaled(self.ICON_SIZE, self.ICON_SIZE, Qt.IgnoreAspectRatio, Qt.SmoothTransformation),
                    6: nm.settings().pixmap('crystal_clear_launch_file_transfer.png').scaled(self.ICON_SIZE, self.ICON_SIZE, Qt.IgnoreAspectRatio, Qt.SmoothTransformation),
                    7: nm.settings().pixmap('crystal_clear_binary.png').scaled(self.ICON_SIZE, self.ICON_SIZE, Qt.IgnoreAspectRatio, Qt.SmoothTransformation),
                    8: nm.settings().pixmap('crystal_clear_no_io.png').scaled(self.ICON_SIZE, self.ICON_SIZE, Qt.IgnoreAspectRatio, Qt.SmoothTransformation),
                    9: nm.settings().pixmap('crystal_clear_run_zeroconf.png').scaled(self.ICON_SIZE, self.ICON_SIZE, Qt.IgnoreAspectRatio, Qt.SmoothTransformation),
                    10: nm.settings().pixmap('sekkyumu_restart.png').scaled(self.ICON_SIZE, self.ICON_SIZE, Qt.IgnoreAspectRatio, Qt.SmoothTransformation)
                    }
     self._new_request = False
     self._in_resp_process = False
     self.ui = QFrame()
     ui_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'ui', 'MessageFrame.ui')
     loadUi(ui_file, self.ui)
     color = QColor(255, 207, 121)
     self.ui.questionOkButton.setIcon(nm.settings().icon('crystal_clear_button_apply.png'))
     self.ui.questionCancelButton.setIcon(nm.settings().icon('crystal_clear_button_close.png'))
     self.ui.listLabel.setTextInteractionFlags(Qt.TextSelectableByMouse)
     self.ui.questionLabel.setTextInteractionFlags(Qt.TextSelectableByMouse)
     self.ui.setVisible(False)
     self.ui.listLabel.setVisible(False)
     self.ui.questionOkButton.clicked.connect(self._on_question_ok)
     self.ui.questionCancelButton.clicked.connect(self._on_question_cancel)
     self.ui.checkBox_dnaa.stateChanged.connect(self._on_checkbox_state_changed)
     self._ask = 'ask'
     if info:
         color = QColor(232, 104, 80)
         self.ui.questionCancelButton.setVisible(False)
         self._ask = 'show'
     bg_style = "QFrame#questionFame { background-color: %s;}" % color.name()
     self.ui.setStyleSheet("%s" % (bg_style))
     self._queue = MessageQueue()
     self._do_not_ask = {}
 def _create_found_frame(self):
     ff_frame = QFrame(self)
     self.found_files_vbox_layout = QVBoxLayout(ff_frame)
     self.found_files_vbox_layout.setContentsMargins(0, 0, 0, 0)
     self.recursive_search_box = QCheckBox("recursive search")
     self.found_files_vbox_layout.addWidget(self.recursive_search_box)
     self.found_files_list = QTreeWidget(ff_frame)
     self.found_files_list.setColumnCount(1)
     self.found_files_list.setFrameStyle(QFrame.StyledPanel)
     self.found_files_list.setHeaderHidden(True)
     self.found_files_list.itemActivated.connect(self.on_itemActivated)
     self.found_files_list.setStyleSheet("QTreeWidget {"
                                         "background-color:transparent;"
                                         "}"
                                         "QTreeWidget::item {"
                                         "background-color:transparent;"
                                         "}"
                                         "QTreeWidget::item:selected {"
                                         "background-color: darkgray;"
                                         "}")
     self.found_files_vbox_layout.addWidget(self.found_files_list)
     self.recursive_search_box.setChecked(False)
     return ff_frame
 def _create_find_frame(self):
     find_frame = QFrame(self)
     find_hbox_layout = QHBoxLayout(find_frame)
     find_hbox_layout.setContentsMargins(0, 0, 0, 0)
     find_hbox_layout.setSpacing(1)
     self.search_field = EnchancedLineEdit(find_frame)
     self.search_field.setPlaceholderText('search text')
     self.search_field.textChanged.connect(self.on_search_text_changed)
     self.search_field.returnPressed.connect(self.on_search)
     find_hbox_layout.addWidget(self.search_field)
     self.search_result_label = QLabel(find_frame)
     self.search_result_label.setText(' ')
     find_hbox_layout.addWidget(self.search_result_label)
     self.find_button_back = QPushButton("<")
     self.find_button_back.setFixedWidth(44)
     self.find_button_back.clicked.connect(self.on_search_back)
     find_hbox_layout.addWidget(self.find_button_back)
     self.find_button = QPushButton(">")
     self.find_button.setDefault(True)
     # self.find_button.setFlat(True)
     self.find_button.setFixedWidth(44)
     self.find_button.clicked.connect(self.on_search)
     find_hbox_layout.addWidget(self.find_button)
     return find_frame
Exemplo n.º 13
0
  def __init__(self, caller, jointstate, parent=None, stored_topic=None):
    super(JointStateGroup, self).__init__(parent)
    ti = TopicInfo()
    # create a new group
    ui_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'iop_rqt_velocity_joint_group.ui')
    loadUi(ui_file, self)
    group_layout = QVBoxLayout(self.frame)
    group_layout.setContentsMargins(0, 0, 0, 0)
    group_layout.setSpacing(0)
    self._cmd_type = Float64MultiArray
    if len(jointstate.name) == 1:
      self._cmd_type = Float64
    ti.fill_subscribed_topics(self.comboBox_cmdTopic, self._cmd_type._type, stored_topic)
    for joint_name in jointstate.name:
      joint_frame = QFrame()
      ui_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'iop_rqt_velocity_joint.ui')
      loadUi(ui_file, joint_frame)
      joint_frame.setObjectName(joint_name)
      joint_frame.labelJointName.setText(joint_name)
      joint_frame.lineEditCurrentValue.setText('0.0')
      joint_frame.doubleSpinBoxNewValue.setValue(0.0)
      joint_frame.layout().setContentsMargins(0, 0, 0, 0)
      joint_frame.layout().setSpacing(0)
      group_layout.addWidget(joint_frame)
#    self._widget.layout().insertWidget(self._widget.layout().count() - 1, group_frame)
#    self._jointgroups[caller] = group_frame
    self.setObjectName(caller)
    self._caller = caller
    self._jointstate = jointstate
    self._topic_command = self.comboBox_cmdTopic.currentText()
    self.pushButtonSend.clicked.connect(self.on_clicked_send)
    self.pushButtonSendZero.clicked.connect(self.on_clicked_send_zero)
    self.comboBox_cmdTopic.activated.connect(self.on_activated_topic)
    self._cmd_publisher = None
    if self._cmd_type and self._topic_command:
      self._cmd_publisher = rospy.Publisher(self._topic_command, self._cmd_type, queue_size=1)
Exemplo n.º 14
0
    def __init__(self,
                 items=list(),
                 buttons=QDialogButtonBox.Cancel | QDialogButtonBox.Ok,
                 exclusive=False,
                 preselect_all=False,
                 title='',
                 description='',
                 icon='',
                 parent=None,
                 select_if_single=True,
                 checkitem1='',
                 checkitem2='',
                 closein=0):
        '''
        Creates an input dialog.
        @param items: a list with strings
        @type items: C{list()}
        '''
        QDialog.__init__(self, parent=parent)
        self.setObjectName(' - '.join(['SelectDialog', utf8(items)]))

        self.verticalLayout = QVBoxLayout(self)
        self.verticalLayout.setObjectName("verticalLayout")
        self.verticalLayout.setContentsMargins(1, 1, 1, 1)

        # add filter row
        self.filter_frame = QFrame(self)
        filterLayout = QHBoxLayout(self.filter_frame)
        filterLayout.setContentsMargins(1, 1, 1, 1)
        label = QLabel("Filter:", self.filter_frame)
        self.filter_field = EnchancedLineEdit(self.filter_frame)
        filterLayout.addWidget(label)
        filterLayout.addWidget(self.filter_field)
        self.filter_field.textChanged.connect(self._on_filter_changed)
        self.verticalLayout.addWidget(self.filter_frame)

        if description:
            self.description_frame = QFrame(self)
            descriptionLayout = QHBoxLayout(self.description_frame)
            #      descriptionLayout.setContentsMargins(1, 1, 1, 1)
            if icon:
                self.icon_label = QLabel(self.description_frame)
                self.icon_label.setSizePolicy(QSizePolicy.Fixed,
                                              QSizePolicy.Fixed)
                self.icon_label.setPixmap(
                    QPixmap(icon).scaled(30, 30, Qt.KeepAspectRatio))
                descriptionLayout.addWidget(self.icon_label)
            self.description_label = QLabel(self.description_frame)
            self.description_label.setWordWrap(True)
            self.description_label.setText(description)
            descriptionLayout.addWidget(self.description_label)
            self.verticalLayout.addWidget(self.description_frame)

        # create area for the parameter
        self.content = MainBox(self)
        if items:
            self.scroll_area = QScrollArea(self)
            self.scroll_area.setFocusPolicy(Qt.NoFocus)
            self.scroll_area.setObjectName("scroll_area")
            self.scroll_area.setWidgetResizable(True)
            self.scroll_area.setWidget(self.content)
            self.verticalLayout.addWidget(self.scroll_area)

        self.checkitem1 = checkitem1
        self.checkitem1_result = False
        self.checkitem2 = checkitem2
        self.checkitem2_result = False

        # add select all option
        if not exclusive and items:
            self._ignore_next_toggle = False
            self.select_all_checkbox = QCheckBox('all entries')
            self.select_all_checkbox.setTristate(True)
            self.select_all_checkbox.stateChanged.connect(
                self._on_select_all_checkbox_stateChanged)
            self.verticalLayout.addWidget(self.select_all_checkbox)
            self.content.toggled.connect(self._on_main_toggle)
        if self.checkitem1:
            self.checkitem1_checkbox = QCheckBox(self.checkitem1)
            self.checkitem1_checkbox.stateChanged.connect(
                self._on_select_checkitem1_checkbox_stateChanged)
            self.verticalLayout.addWidget(self.checkitem1_checkbox)
        if self.checkitem2:
            self.checkitem2_checkbox = QCheckBox(self.checkitem2)
            self.checkitem2_checkbox.stateChanged.connect(
                self._on_select_checkitem2_checkbox_stateChanged)
            self.verticalLayout.addWidget(self.checkitem2_checkbox)
        if not items:
            spacerItem = QSpacerItem(1, 1, QSizePolicy.Expanding,
                                     QSizePolicy.Expanding)
            self.verticalLayout.addItem(spacerItem)

        self._close_timer = None
        self._closein = closein - 1
        if closein > 0:
            self.closein_label = QLabel("OK in %d sec..." % closein)
            self.closein_label.setAlignment(Qt.AlignRight)
            self.verticalLayout.addWidget(self.closein_label)
            self._close_timer = threading.Timer(1.0, self._on_close_timer)
            self._close_timer.start()

        # create buttons
        self.buttonBox = QDialogButtonBox(self)
        self.buttonBox.setObjectName("buttonBox")
        self.buttonBox.setOrientation(Qt.Horizontal)
        self.buttonBox.setStandardButtons(buttons)
        self.buttonBox.accepted.connect(self.accept)
        self.buttonBox.rejected.connect(self.reject)
        self.verticalLayout.addWidget(self.buttonBox)

        # set the input fields
        if items:
            self.content.createFieldsFromValues(items, exclusive)
            if (select_if_single and len(items) == 1) or preselect_all:
                self.select_all_checkbox.setCheckState(Qt.Checked)

        if not items or len(items) < 7:
            self.filter_frame.setVisible(False)