• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python QtGui.QMenu类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中python_qt_binding.QtGui.QMenu的典型用法代码示例。如果您正苦于以下问题:Python QMenu类的具体用法?Python QMenu怎么用?Python QMenu使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了QMenu类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: add_plugin

    def add_plugin(self, plugin_descriptor):
        base_path = plugin_descriptor.attributes().get('plugin_path')

        menu_manager = self._plugin_menu_manager
        # create submenus
        for group in plugin_descriptor.groups():
            label = group['label']
            if menu_manager.contains_menu(label):
                submenu = menu_manager.get_menu(label)
            else:
                submenu = QMenu(label, menu_manager.menu)
                menu_action = submenu.menuAction()
                self._enrich_action(menu_action, group, base_path)
                menu_manager.add_item(submenu)
            menu_manager = MenuManager(submenu)
        # create action
        action_attributes = plugin_descriptor.action_attributes()
        action = QAction(action_attributes['label'], menu_manager.menu)
        self._enrich_action(action, action_attributes, base_path)

        self._plugin_mapper.setMapping(action, plugin_descriptor.plugin_id())
        action.triggered.connect(self._plugin_mapper.map)

        not_available = plugin_descriptor.attributes().get('not_available')
        if not_available:
            action.setEnabled(False)
            action.setStatusTip(self.tr('Plugin is not available: %s') % not_available)

        # add action to menu
        menu_manager.add_item(action)
开发者ID:twighk,项目名称:ROS-Pi3,代码行数:30,代码来源:plugin_menu.py


示例2: glview_mouseReleaseEvent

 def glview_mouseReleaseEvent(self, event):
     if event.button() == Qt.RightButton:
         menu = QMenu(self._glview)
         action = QAction(self._glview.tr("Reset view"), self._glview)
         menu.addAction(action)
         action.triggered.connect(self.set_default_view)
         menu.exec_(self._glview.mapToGlobal(event.pos()))
开发者ID:my-garbage-collection,项目名称:rqt_test,代码行数:7,代码来源:theta_view_widget.py


示例3: handle_header_view_customContextMenuRequested

    def handle_header_view_customContextMenuRequested(self, pos):

        # create context menu
        menu = QMenu(self)

        action_toggle_auto_resize = menu.addAction('Auto-Resize')
        action_toggle_auto_resize.setCheckable(True)
        auto_resize_flag = (self.header().resizeMode(0) == QHeaderView.ResizeToContents)
        action_toggle_auto_resize.setChecked(auto_resize_flag)

        action_toggle_sorting = menu.addAction('Sorting')
        action_toggle_sorting.setCheckable(True)
        action_toggle_sorting.setChecked(self.isSortingEnabled())

        # show menu
        action = menu.exec_(self.header().mapToGlobal(pos))

        # evaluate user action
        if action is action_toggle_auto_resize:
            if auto_resize_flag:
                self.header().setResizeMode(QHeaderView.Interactive)
            else:
                self.header().setResizeMode(QHeaderView.ResizeToContents)

        elif action is action_toggle_sorting:
            self.setSortingEnabled(not self.isSortingEnabled())
开发者ID:OSUrobotics,项目名称:rqt_common_plugins,代码行数:26,代码来源:message_tree_widget.py


示例4: _create_context_menu_for_tag

 def _create_context_menu_for_tag(self):
     if isinstance(self.hl, XmlHighlighter):
         tag = self.hl.get_tag_of_current_block(self.textCursor().block(), self.textCursor().positionInBlock())
         if tag:
             try:
                 menu = QMenu("ROS <%s>" % tag, self)
                 menu.triggered.connect(self._context_activated)
                 # create a menu with attributes
                 menu_attr = QMenu("attributes", menu)
                 attributes = sorted(list(set(XmlHighlighter.LAUNCH_ATTR[tag])))
                 for attr in attributes:
                     action = menu_attr.addAction(attr.rstrip('='))
                     action.setData('%s""' % attr)
                 menu.addMenu(menu_attr)
                 # create a menu with tags
                 tags = sorted(XmlHighlighter.LAUNCH_CHILDS[tag])
                 if tags:
                     menu_tags = QMenu("tags", menu)
                     for tag in tags:
                         data = '<%s></%s>' % (tag, tag) if XmlHighlighter.LAUNCH_CHILDS[tag] else '<%s/>' % tag
                         action = menu_tags.addAction(tag)
                         action.setData(data)
                     menu.addMenu(menu_tags)
                 return menu
             except:
                 import traceback
                 print traceback.format_exc(1)
                 return None
     return None
开发者ID:zhouchengming1,项目名称:multimaster_fkie,代码行数:29,代码来源:text_edit.py


示例5: __init__

 def __init__(self, menu_button):
     QMenu.__init__(self)
     self.button = menu_button
     try:
         rqt_icon_path = roslib.packages.find_resource('rqt_gui', 'rqt.png').pop()
         menu_button.setText('')
         menu_button.setIcon(QIcon(rqt_icon_path))
         # creates a default config menu
         self.action_rqt_console = QAction(QIcon.fromTheme('mail-message-new'),
                                           "&Console", self,
                                           statusTip='"<p>Starts a python GUI plugin for displaying and filtering '
                                           'ROS log messages that is connected to the selected master.</p>"',
                                           triggered=self.on_show_console_clicked)
         self.addAction(self.action_rqt_console)
         self.action_rqt_logger_level = QAction(QIcon.fromTheme('format-indent-more'),
                                                "&Logger Level", self,
                                                statusTip='"<p>Starts a python GUI plugin for configuring the level of '
                                                'ROS loggers that is connected to the selected master.</p>"',
                                                triggered=self.on_show_logger_level_clicked)
         self.addAction(self.action_rqt_logger_level)
         self.action_rqt_tf_tree = QAction(QIcon.fromTheme('preferences-system-network'),
                                           "&TF Tree", self,
                                           statusTip='"<p>Starts a python GUI plugin for visualizing the TF tree'
                                           'that is connected to the selected master.</p>"',
                                           triggered=self.on_show_tf_tree_clicked)
         self.addAction(self.action_rqt_tf_tree)
         self.action_rqt_ros_graph = QAction(QIcon(":/icons/button_graph.png"),
                                             "Ros &Graph", self,
                                             statusTip='"<p>Starts a python GUI plugin for visualizing the ROS computation graph'
                                             'that is connected to the selected master</p>"',
                                             triggered=self.on_show_ros_graph_clicked)
         self.addAction(self.action_rqt_ros_graph)
         self.action_rosbag_record = QAction(QIcon.fromTheme('media-record'),
                                             "rosbag record", self,
                                             statusTip='"<p>Starts the rosbag record with selected topics</p>"',
                                             triggered=self.on_start_rosbag_clicked)
         self.addAction(self.action_rosbag_record)
         self.action_rqt_rviz = QAction(QIcon.fromTheme('image-x-generic'),
                                        "R&Viz", self,
                                        statusTip='"<p>Starts RViz</p>"',
                                        triggered=self.on_show_rviz_clicked)
         self.addAction(self.action_rqt_rviz)
         self.addSeparator()
         self.action_rqt = QAction(QIcon(rqt_icon_path),
                                   "&Rqt GUI", self,
                                   statusTip='"<p>Start the rqt GUI'
                                   'that is connected to the selected master</p>"',
                                   triggered=self.on_start_rqt_clicked)
         self.addAction(self.action_rqt)
         menu_button.setMenu(self)
     except Exception as e:
         print '%s' % e
         menu_button.setEnabled(False)
         menu_button.setToolTip('rqt_gui not found! Please install rqt to use its plugins!')
开发者ID:fkie,项目名称:multimaster_fkie,代码行数:54,代码来源:menu_rqt.py


示例6: _on_header_menu

    def _on_header_menu(self, pos):
        header = self._widget.table_view.horizontalHeader()

        # Show context menu
        menu = QMenu(self._widget.table_view)
        action_toggle_auto_resize = menu.addAction('Toggle Auto-Resize')
        action = menu.exec_(header.mapToGlobal(pos))

        # Evaluate user action
        if action is action_toggle_auto_resize:
            if header.resizeMode(0) == QHeaderView.ResizeToContents:
                header.setResizeMode(QHeaderView.Interactive)
            else:
                header.setResizeMode(QHeaderView.ResizeToContents)
开发者ID:CMUBOOST,项目名称:testing456,代码行数:14,代码来源:controller_manager.py


示例7: handle_header_view_customContextMenuRequested

    def handle_header_view_customContextMenuRequested(self, pos):
        header = self.topics_tree_widget.header()

        # show context menu
        menu = QMenu(self)
        action_toggle_auto_resize = menu.addAction('Toggle Auto-Resize')
        action = menu.exec_(header.mapToGlobal(pos))

        # evaluate user action
        if action is action_toggle_auto_resize:
            if header.resizeMode(0) == QHeaderView.ResizeToContents:
                header.setResizeMode(QHeaderView.Interactive)
            else:
                header.setResizeMode(QHeaderView.ResizeToContents)
开发者ID:suryaprakaz,项目名称:rospy_android,代码行数:14,代码来源:topic_widget.py


示例8: eventFilter

 def eventFilter(self, obj, event):
     if event.type() in self._event_callbacks:
         ret_val = self._event_callbacks[event.type()](obj, event)
         if ret_val is not None:
             return ret_val
     if event.type() == event.ContextMenu and obj == self.title_label:
         menu = QMenu(self)
         rename_action = menu.addAction(self.tr('Rename dock widget'))
         action = menu.exec_(self.mapToGlobal(event.pos()))
         if action == rename_action:
             self.title_label.hide()
             self.title_edit.setText(self.title_label.text())
             self.title_edit.show()
             self.title_edit.setFocus()
         return True
     return QObject.eventFilter(self, obj, event)
开发者ID:twighk,项目名称:ROS-Pi3,代码行数:16,代码来源:dock_widget_title_bar.py


示例9: __init__

    def __init__(self, initial_topics=None, start_paused=False):
        super(PlotWidget, self).__init__()
        self.setObjectName('PlotWidget')

        self._initial_topics = initial_topics

        rp = rospkg.RosPack()
        ui_file = os.path.join(rp.get_path('rqt_plot'), 'resource', 'plot.ui')
        loadUi(ui_file, self)
        self.subscribe_topic_button.setIcon(QIcon.fromTheme('list-add'))
        self.remove_topic_button.setIcon(QIcon.fromTheme('list-remove'))
        self.pause_button.setIcon(QIcon.fromTheme('media-playback-pause'))
        self.clear_button.setIcon(QIcon.fromTheme('edit-clear'))
        self.data_plot = None

        self.subscribe_topic_button.setEnabled(False)
        if start_paused:
            self.pause_button.setChecked(True)

        self._topic_completer = TopicCompleter(self.topic_edit)
        self._topic_completer.update_topics()
        self.topic_edit.setCompleter(self._topic_completer)

        self._start_time = rospy.get_time()
        self._rosdata = {}
        self._remove_topic_menu = QMenu()

        # init and start update timer for plot
        self._update_plot_timer = QTimer(self)
        self._update_plot_timer.timeout.connect(self.update_plot)
开发者ID:harmishhk,项目名称:rqt_common_plugins,代码行数:30,代码来源:plot_widget.py


示例10: _add_exclude_filter

    def _add_exclude_filter(self, filter_index=False):
        """
        :param filter_index: if false then this function shows a QMenu to allow the user to choose a type of message filter. ''bool''
        OR
        :param filter_index: the index of the filter to be added, ''int''
        :return: if a filter was added then the index is returned, ''int''
        OR
        :return: if no filter was added then None is returned, ''NoneType''
        """
        if filter_index is False:
            filter_index = -1
            filter_select_menu = QMenu()
            for index in self._filter_factory_order:
                # flattens the _exclude filters list and only adds the item if it doesn't already exist
                if index in ['message', 'location'] or not self.filter_factory[index][1] in [type(item) for sublist in self._exclude_filters for item in sublist]:
                    filter_select_menu.addAction(self.filter_factory[index][0])
            action = filter_select_menu.exec_(QCursor.pos())
            if action is None:
                return None
            for index in self._filter_factory_order:
                if self.filter_factory[index][0] == action.text():
                    filter_index = index
            if filter_index == -1:
                return None

        index = len(self._exclude_filters)
        newfilter = self.filter_factory[filter_index][1]()
        if len(self.filter_factory[filter_index]) >= 4:
            newwidget = self.filter_factory[filter_index][2](newfilter, self._rospack, self.filter_factory[filter_index][3])
        else:
            newwidget = self.filter_factory[filter_index][2](newfilter, self._rospack)

        # pack the new filter tuple onto the filter list
        self._exclude_filters.append((newfilter, FilterWrapperWidget(newwidget, self.filter_factory[filter_index][0]), filter_index))
        self._proxy_model.add_exclude_filter(newfilter)
        newfilter.filter_changed_signal.connect(self._proxy_model.handle_exclude_filters_changed)
        self._exclude_filters[index][1].delete_button.clicked.connect(self._delete_exclude_filter)
        self._model.rowsInserted.connect(self._exclude_filters[index][1].repopulate)

        # place the widget in the proper location
        self.exclude_table.insertRow(index)
        self.exclude_table.setCellWidget(index, 0, self._exclude_filters[index][1])
        self.exclude_table.resizeColumnsToContents()
        self.exclude_table.resizeRowsToContents()
        newfilter.filter_changed_signal.emit()
        return index
开发者ID:OSUrobotics,项目名称:rqt_common_plugins,代码行数:46,代码来源:console_widget.py


示例11: _create_context_substitution_menu

 def _create_context_substitution_menu(self, force_all=True):
     if isinstance(self.hl, XmlHighlighter):
         text = self.toPlainText()
         pos = self.textCursor().position() - 1
         try:
             if force_all or (text[pos] == '$' or (text[pos] == '(' and text[pos - 1] == '$')):
                 menu = QMenu("ROS substitution args", self)
                 menu.triggered.connect(self._context_activated)
                 for arg in self.SUBSTITUTION_ARGS:
                     action = menu.addAction("%s" % arg)
                     if force_all:
                         action.setData("$(%s )" % arg)
                     else:
                         action.setData("(%s" % arg if text[pos] == '$' else "%s" % arg)
                 return menu
         except:
             pass
     return None
开发者ID:zhouchengming1,项目名称:multimaster_fkie,代码行数:18,代码来源:text_edit.py


示例12: _show_context_menu

    def _show_context_menu(self, item, global_pos):
        if item is None:
            return

        # show context menu
        menu = QMenu(self)
        action_item_expand = menu.addAction(QIcon.fromTheme('zoom-in'), "Expand All Children")
        action_item_collapse = menu.addAction(QIcon.fromTheme('zoom-out'), "Collapse All Children")
        action = menu.exec_(global_pos)

        # evaluate user action
        if action in (action_item_expand, action_item_collapse):
            expanded = (action is action_item_expand)

            def recursive_set_expanded(item):
                item.setExpanded(expanded)
                for index in range(item.childCount()):
                    recursive_set_expanded(item.child(index))
            recursive_set_expanded(item)
开发者ID:OSUrobotics,项目名称:rqt_common_plugins,代码行数:19,代码来源:service_caller_widget.py


示例13: on_topics_tree_widget_customContextMenuRequested

    def on_topics_tree_widget_customContextMenuRequested(self, pos):
        item = self.topics_tree_widget.itemAt(pos)
        if item is None:
            return

        # show context menu
        menu = QMenu(self)
        action_item_expand = menu.addAction(QIcon.fromTheme('zoom-in'), 'Expand All Children')
        action_item_collapse = menu.addAction(QIcon.fromTheme('zoom-out'), 'Collapse All Children')
        action = menu.exec_(self.topics_tree_widget.mapToGlobal(pos))

        # evaluate user action
        if action in (action_item_expand, action_item_collapse):
            expanded = (action is action_item_expand)

            def recursive_set_expanded(item):
                item.setExpanded(expanded)
                for index in range(item.childCount()):
                    recursive_set_expanded(item.child(index))
            recursive_set_expanded(item)
开发者ID:suryaprakaz,项目名称:rospy_android,代码行数:20,代码来源:topic_widget.py


示例14: positions_list_context_menu

    def positions_list_context_menu(self, group_type, pos):
        list_widget = self.list_widgets[group_type]
        list_item = list_widget.itemAt(pos)
        if list_item is None:
            return

        menu = QMenu()
        move_to = {}
        for group in self.robot_config.group_list():
            if list_item._type == group.group_type:
                move_to[menu.addAction('move "%s"' % group.name)] = [group.name]
        # move_to[menu.addAction('move all')] = list(move_to.itervalues())
        move_to[menu.addAction('move all')] = [group_list[0] for group_list in list(move_to.itervalues())]
        result = menu.exec_(list_widget.mapToGlobal(pos))
        if result in move_to:
            group_names = move_to[result]
            for group_name in group_names:
                target_positions = self.robot_config.groups[group_name].adapt_to_side(list_item._data)
                self._motion_publisher.move_to_position(group_name, target_positions, self.time_factor_spin.value())
                print '[Motion Editor] Moving %s to: %s' % (group_name, zip(self.robot_config.groups[group_name].joints_sorted(), target_positions))
开发者ID:tu-darmstadt-ros-pkg,项目名称:motion_editor,代码行数:20,代码来源:motion_editor_widget.py


示例15: on_ctrl_list_tree_widget_customContextMenuRequested

    def on_ctrl_list_tree_widget_customContextMenuRequested(self, pos):
        ctrlman_ns = self.cm_namespace_combo.currentText()
        item = self.ctrl_list_tree_widget.itemAt(pos)
        if item is None:
            return
        ctrl_name = item.data(0, Qt.UserRole)
        ctrl_state = self._ctrlers[ctrl_name]['state']

        # show context menu
        menu = QMenu(self)
        if ctrl_state == 'running':
            action_stop = menu.addAction(
                    QIcon.fromTheme('media-playback-stop'), 'Stop Controller')
            action_kill = menu.addAction(
                    QIcon.fromTheme('list-remove'), 'Stop and Unload Controller')
        elif ctrl_state == 'stopped':
            action_start = menu.addAction(
                    QIcon.fromTheme('media-playback-start'), 'Start Controller')
            action_unload = menu.addAction(
                    QIcon.fromTheme('list-remove'), 'Unload Controller')

        action = menu.exec_(self.ctrl_list_tree_widget.mapToGlobal(pos))

        # evaluate user action
        if ctrl_state == 'running':
            if action is action_stop:
                self.start_stop_controller(ctrlman_ns, ctrl_name, False)
            elif action is action_kill:
                self.start_stop_controller(ctrlman_ns, ctrl_name, False)
                self.unload_controller(ctrlman_ns, ctrl_name)
        elif ctrl_state == 'stopped':
            if action is action_start:
                self.start_stop_controller(ctrlman_ns, ctrl_name, True)
            elif action is action_unload:
                self.unload_controller(ctrlman_ns, ctrl_name)
开发者ID:tnn9,项目名称:nurse_robot,代码行数:35,代码来源:controller_manager_gui.py


示例16: __init__

    def __init__(self, parent=None):
        '''
        Creates the window, connects the signals and init the class.
        '''
        QDockWidget.__init__(self, parent)
        # initialize parameter
        self.__current_path = os.path.expanduser('~')
        # load the UI file
        ui_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'LaunchFilesDockWidget.ui')
        loadUi(ui_file, self)
        # initialize the view for the launch files
        self.launchlist_model = LaunchListModel()
        self.launchlist_proxyModel = QSortFilterProxyModel(self)
        self.launchlist_proxyModel.setSourceModel(self.launchlist_model)
        self.xmlFileView.setModel(self.launchlist_proxyModel)
        self.xmlFileView.setAlternatingRowColors(True)
        self.xmlFileView.activated.connect(self.on_launch_selection_activated)
        self.xmlFileView.setDragDropMode(QAbstractItemView.DragOnly)
        self.xmlFileView.setDragEnabled(True)
        sm = self.xmlFileView.selectionModel()
        sm.selectionChanged.connect(self.on_xmlFileView_selection_changed)
#    self.searchPackageLine.setVisible(False)
        self.searchPackageLine.textChanged.connect(self.set_package_filter)
        self.searchPackageLine.focusInEvent = self._searchline_focusInEvent
        # connect to the button signals
        self.refreshXmlButton.clicked.connect(self.on_refresh_xml_clicked)
        self.editXmlButton.clicked.connect(self.on_edit_xml_clicked)
        self.newXmlButton.clicked.connect(self.on_new_xml_clicked)
        self.openXmlButton.clicked.connect(self.on_open_xml_clicked)
        self.transferButton.clicked.connect(self.on_transfer_file_clicked)
        self.loadXmlButton.clicked.connect(self.on_load_xml_clicked)
        self.loadXmlAsDefaultButton.clicked.connect(self.on_load_as_default)
        # creates a default config menu
        start_menu = QMenu(self)
        self.loadDeafaultAtHostAct = QAction("&Load default config on host", self, statusTip="Loads the default config at given host", triggered=self.on_load_as_default_at_host)
        start_menu.addAction(self.loadDeafaultAtHostAct)
        self.loadXmlAsDefaultButton.setMenu(start_menu)
        # initialize the progress queue
        self.progress_queue = ProgressQueue(self.progressFrame_cfg, self.progressBar_cfg, self.progressCancelButton_cfg)
开发者ID:fkie,项目名称:multimaster_fkie,代码行数:39,代码来源:launch_files_widget.py


示例17: contextMenuEvent

 def contextMenuEvent(self, event):
     menu = QMenu()
     clip = menu.addAction('clip')
     clip.setEnabled(False)
     menu.addSeparator()
     remove = menu.addAction('remove clip')
     result = menu.exec_(event.screenPos())
     if result == remove:
         self.scene().removeItem(self)
开发者ID:tu-darmstadt-ros-pkg,项目名称:motion_editor,代码行数:9,代码来源:timeline_widget.py


示例18: eventFilter

 def eventFilter(self, obj, event):
     if event.type() in self._event_callbacks:
         ret_val = self._event_callbacks[event.type()](obj, event)
         if ret_val is not None:
             return ret_val
     if event.type() == event.ContextMenu and obj == self.title_label:
         menu = QMenu(self)
         rename_action = menu.addAction(self.tr('Rename dock widget'))
         hide_action = QAction("Hide title bar", self)
         hide_action.setCheckable(True)
         hide_action.setChecked(self.hide_title_bar)
         if self._dock_widget.features() & QDockWidget.DockWidgetFloatable and \
                 self._dock_widget.features() & QDockWidget.DockWidgetMovable:
             menu.addAction(hide_action)
         action = menu.exec_(self.mapToGlobal(event.pos()))
         if action == rename_action:
             self.title_label.hide()
             self.title_edit.setText(self.title_label.text())
             self.title_edit.show()
             self.title_edit.setFocus()
         if action == hide_action:
             self.hide_title_bar = not self.hide_title_bar
         return True
     return QObject.eventFilter(self, obj, event)
开发者ID:ethz-asl,项目名称:qt_gui_core,代码行数:24,代码来源:dock_widget_title_bar.py


示例19: __init__

    def __init__(self, updater, config):
        '''
        @param updater: A class that extends threading.Thread.
        @type updater: rqt_reconfigure.param_updater.ParamUpdater
        '''

        super(EditorWidget, self).__init__()

        self._updater = updater
        self.param_name = config['name']
        self.param_default = config['default']
        self.param_description = config['description']

        self.old_value = None

        self.cmenu = QMenu()
        self.cmenu.addAction(self.tr('Set to Default')).triggered.connect(self._set_to_default)
开发者ID:OSUrobotics,项目名称:rqt_common_plugins,代码行数:17,代码来源:param_editors.py


示例20: _on_ctrl_menu

    def _on_ctrl_menu(self, pos):
        # Get data of selected controller
        row = self._widget.table_view.rowAt(pos.y())
        if row < 0:
            return  # Cursor is not under a valid item

        ctrl = self._controllers[row]

        # Show context menu
        menu = QMenu(self._widget.table_view)
        if ctrl.state == 'running':
            action_stop = menu.addAction(self._icons['stopped'], 'Stop')
            action_kill = menu.addAction(self._icons['uninitialized'],
                                         'Stop and Unload')
        elif ctrl.state == 'stopped':
            action_start = menu.addAction(self._icons['running'], 'Start')
            action_unload = menu.addAction(self._icons['uninitialized'],
                                           'Unload')
        elif ctrl.state == 'uninitialized':
            action_load = menu.addAction(self._icons['stopped'], 'Load')
            action_spawn = menu.addAction(self._icons['running'],
                                          'Load and Start')

        action = menu.exec_(self._widget.table_view.mapToGlobal(pos))

        # Evaluate user action
        if ctrl.state == 'running':
            if action is action_stop:
                self._stop_controller(ctrl.name)
            elif action is action_kill:
                self._stop_controller(ctrl.name)
                self._unload_controller(ctrl.name)
        elif ctrl.state == 'stopped':
            if action is action_start:
                self._start_controller(ctrl.name)
            elif action is action_unload:
                self._unload_controller(ctrl.name)
        elif ctrl.state == 'uninitialized':
            if action is action_load:
                self._load_controller(ctrl.name)
            if action is action_spawn:
                self._load_controller(ctrl.name)
                self._start_controller(ctrl.name)
开发者ID:CMUBOOST,项目名称:testing456,代码行数:43,代码来源:controller_manager.py



注:本文中的python_qt_binding.QtGui.QMenu类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python QtGui.QMessageBox类代码示例发布时间:2022-05-27
下一篇:
Python QtGui.QIcon类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap