当前位置: 首页>>代码示例>>Python>>正文


Python QActionGroup.setExclusive方法代码示例

本文整理汇总了Python中PyQt5.QtWidgets.QActionGroup.setExclusive方法的典型用法代码示例。如果您正苦于以下问题:Python QActionGroup.setExclusive方法的具体用法?Python QActionGroup.setExclusive怎么用?Python QActionGroup.setExclusive使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt5.QtWidgets.QActionGroup的用法示例。


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

示例1: create_size_actions

# 需要导入模块: from PyQt5.QtWidgets import QActionGroup [as 别名]
# 或者: from PyQt5.QtWidgets.QActionGroup import setExclusive [as 别名]
 def create_size_actions(self):
     """Creates window size actions."""
     group = QActionGroup(self)
     group.setExclusive(True)
     for num, size in enumerate(
             sorted(self.sizes.keys()), 1):
         width, height = size
         action = self.sizes[size]
         action.setActionGroup(group)
         w, h = width, height+self.widgets_height
         action.setText("%dX" % num)
         action.setToolTip("%sx%s" % (width, height))
         action.triggered.connect(lambda t, wi=w, he=h: self.resize(wi, he))
开发者ID:Agent21,项目名称:mupen64plus-ui-python,代码行数:15,代码来源:mainwindow.py

示例2: createActionGroup

# 需要导入模块: from PyQt5.QtWidgets import QActionGroup [as 别名]
# 或者: from PyQt5.QtWidgets.QActionGroup import setExclusive [as 别名]
def createActionGroup(parent, name=None, exclusive=False):
    """
    Module function to create an action group.
    
    @param parent parent object of the action group (QObject)
    @param name name of the action group object (string)
    @param exclusive flag indicating an exclusive action group (boolean)
    @return reference to the created action group (QActionGroup)
    """
    actGrp = QActionGroup(parent)
    if name:
        actGrp.setObjectName(name)
    actGrp.setExclusive(exclusive)
    return actGrp
开发者ID:Darriall,项目名称:eric,代码行数:16,代码来源:E5Action.py

示例3: create_state_slots

# 需要导入模块: from PyQt5.QtWidgets import QActionGroup [as 别名]
# 或者: from PyQt5.QtWidgets.QActionGroup import setExclusive [as 别名]
 def create_state_slots(self):
     """Creates state slot actions."""
     group = QActionGroup(self)
     group.setExclusive(True)
     for slot in range(10):
         self.slots[slot] = QAction(self)
         self.slots[slot].setCheckable(True)
         self.slots[slot].setText("Slot %d" % slot)
         self.slots[slot].setShortcut(QKeySequence(str(slot)))
         self.slots[slot].setActionGroup(group)
         self.menuStateSlot.addAction(self.slots[slot])
     self.slots[0].setChecked(True)
     for slot, action in self.slots.items():
         action.triggered.connect(lambda t, s=slot: self.worker.state_set_slot(s))
开发者ID:Agent21,项目名称:mupen64plus-ui-python,代码行数:16,代码来源:mainwindow.py

示例4: on_main_window_start

# 需要导入模块: from PyQt5.QtWidgets import QActionGroup [as 别名]
# 或者: from PyQt5.QtWidgets.QActionGroup import setExclusive [as 别名]
def on_main_window_start(main_window):
    main_window.theme_menu = main_window.menuBar().addMenu(
        main_window.tr('Themes'))
    themes_directory = QFileInfo('themes')
    if themes_directory.exists():
        active_theme = ThemeManager.get_active_theme()
        path = themes_directory.absoluteFilePath()
        group_action = QActionGroup(main_window)
        group_action.setExclusive(True)
        for theme in os.listdir(path):
            action = QAction(theme, main_window)
            action.setData(theme)
            action.setCheckable(True)
            if theme == active_theme:
                action.setChecked(True)
            action.changed.connect(ThemeManager.wrapper(main_window))
            group_action.addAction(action)
            group_action.addAction(action)
            main_window.theme_menu.addAction(action)
开发者ID:FlorianPerrot,项目名称:Mojuru,代码行数:21,代码来源:theme_manager.py

示例5: __init__

# 需要导入模块: from PyQt5.QtWidgets import QActionGroup [as 别名]
# 或者: from PyQt5.QtWidgets.QActionGroup import setExclusive [as 别名]
    def __init__(self, win):
        super(PathToolManager, self).__init__()
        self.window = win
        self._active_tool = None
        self._active_part = None
        self.select_tool = SelectTool(self)
        self.pencil_tool = PencilTool(self)
        self.break_tool = BreakTool(self)
        self.erase_tool = EraseTool(self)
        self.insertion_tool = InsertionTool(self)
        self.skip_tool = SkipTool(self)
        self.paint_tool = PaintTool(self) # (self, win.path_graphics_view.toolbar)
        self.add_seq_tool = AddSeqTool(self)
        self.mods_tool = ModsTool(self)

        def installTool(tool_name, window):
            l_tool_name = tool_name.lower()
            tool_widget = getattr(window, 'action_path_' + l_tool_name)
            tool = getattr(self, l_tool_name + '_tool')
            tool.action_name = 'action_path_' + tool_name

            def clickHandler(self):
                tool_widget.setChecked(True)
                self.setActiveTool(tool)
                if hasattr(tool, 'widgetClicked'):
                    tool.widgetClicked()
            # end def

            select_tool_method_name = 'choose' + tool_name + 'Tool'
            setattr(self.__class__, select_tool_method_name, clickHandler)
            handler = getattr(self, select_tool_method_name)
            tool_widget.triggered.connect(handler)
            return tool_widget
        # end def
        tools = ('Select', 'Pencil', 'Break', 'Erase', 'Insertion', 'Skip', 'Paint', 'Add_Seq', 'Mods')
        ag = QActionGroup(win)
        # Call installTool on every tool
        list(map((lambda tool_name: ag.addAction(installTool(tool_name, win))), tools))
        ag.setExclusive(True)
        # Select the preferred Startup tool
        startup_tool_name = app().prefs.getStartupToolName()
        getattr(self, 'choose' + startup_tool_name + 'Tool')()
开发者ID:nate-w,项目名称:cadnano2.5,代码行数:44,代码来源:pathtoolmanager.py

示例6: __init__

# 需要导入模块: from PyQt5.QtWidgets import QActionGroup [as 别名]
# 或者: from PyQt5.QtWidgets.QActionGroup import setExclusive [as 别名]
	def __init__(self, supported_exts, parent=None):
		super().__init__(parent)

		self._diasshowRunning = False
		# a dummy widget to center actions
		spacer1 = QWidget()
		spacer1.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred)
		self.addWidget(spacer1)

		self.supportedExts = supported_exts
		self._fromFile = self.addAction(QIcon("icons/image-outline.svg"), "", self.chooseFile) # load images from file
		self._fromFile.setToolTip("Load image")
		self._fromFolder = self.addAction(QIcon("icons/folder-open.svg"), "", self.chooseFolder) # load images from folder
		self._fromFolder.setToolTip("Load from directory")

		# View in native size, fit width, fit height or fit image
		self._imageMode = QToolButton(self)
		self._imageMode.setIcon(QIcon("icons/eye-outline.svg"))
		self._imageMode.setToolTip("Image view mode")
		self._imageMode.setPopupMode(QToolButton.InstantPopup)
		self.addWidget(self._imageMode)
		
		# imageMode menu
		imageModeMenu = QMenu(self)
		imageModeActions = QActionGroup(imageModeMenu)
		imModeAct1 = imageModeActions.addAction("Native size")
		imModeAct1.setCheckable(True)
		imModeAct1.triggered.connect(lambda: self.imageModeChanged.emit(0))
		imModeAct2 = imageModeActions.addAction("Fit in view")
		imModeAct2.setCheckable(True)
		imModeAct2.triggered.connect(lambda: self.imageModeChanged.emit(1))
		imModeAct3 = imageModeActions.addAction("Fit width")
		imModeAct3.setCheckable(True)
		imModeAct3.triggered.connect(lambda: self.imageModeChanged.emit(2))
		imModeAct4 = imageModeActions.addAction("Fit height")
		imModeAct4.setCheckable(True)
		imModeAct4.triggered.connect(lambda: self.imageModeChanged.emit(3))
		imageModeActions.setExclusive(True)
		imageModeMenu.addActions(imageModeActions.actions())
		self._imageMode.setMenu(imageModeMenu)

		
		self._imgDirection = self.addAction(QIcon("icons/arrow-move-outline.svg"), "", self.imageDirectionChanged.emit) # Horizontal or Vertical
		self._imgDirection.setToolTip("Toggle image direction")

		# start or stop diasshow
		self._playDias = self.addAction(QIcon("icons/media-play-outline.svg"), "", self.diasshowState)
		self._playDias.setToolTip("Start/stop diasshow")

		#diasshow menu
		self._diasMenu = QMenu(self)
		self._diasMenu.addAction("5 seconds", lambda: self.diasshowState(5))
		self._diasMenu.addAction("10 seconds", lambda: self.diasshowState(10))
		self._diasMenu.addAction("30 seconds", lambda: self.diasshowState(30))
		self._diasMenu.addAction("5 minutes", lambda: self.diasshowState(60*5))
		self._diasMenu.addAction("10 minutes", lambda: self.diasshowState(600))
		self._playDias.setMenu(self._diasMenu)


		self._zoomIn = self.addAction(QIcon("icons/zoom-in-outline.svg"), "", lambda: self.zoomChanged.emit(True))
		self._zoomOut = self.addAction(QIcon("icons/zoom-out-outline.svg"), "", lambda: self.zoomChanged.emit(False))
		self._rotateCW = self.addAction(QIcon("icons/rotate-cw-outline.svg"), "", self.rotateChanged.emit) # Clockwise
		self._rotateCW.setToolTip("Rotate Clockwise")
		#self._rotateCCW = self.addAction("Rotate Left") # Counter clockwise

		# a dummy widget to center actions
		spacer2 = QWidget()
		spacer2.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred)
		self.addWidget(spacer2)
开发者ID:iSplasher,项目名称:happyview,代码行数:71,代码来源:controls.py

示例7: MainWindow

# 需要导入模块: from PyQt5.QtWidgets import QActionGroup [as 别名]
# 或者: from PyQt5.QtWidgets.QActionGroup import setExclusive [as 别名]
class MainWindow(QMainWindow, Ui_MainWindow):
    """docstring for MainWindow."""
    def __init__(self, parent=None):
        super(MainWindow, self).__init__()
        self._csvFilePath = ""
        self.serialport = serial.Serial()
        self.receiver_thread = readerThread(self)
        self.receiver_thread.setPort(self.serialport)
        self._localEcho = None
        self._viewMode = None
        self._quickSendOptRow = 1

        self.setupUi(self)
        self.setCorner(Qt.TopLeftCorner, Qt.LeftDockWidgetArea)
        self.setCorner(Qt.BottomLeftCorner, Qt.LeftDockWidgetArea)
        font = QtGui.QFont()
        font.setFamily(EDITOR_FONT)
        font.setPointSize(9)
        self.txtEdtOutput.setFont(font)
        self.txtEdtInput.setFont(font)
        #self.quickSendTable.setFont(font)
        if UI_FONT is not None:
            font = QtGui.QFont()
            font.setFamily(UI_FONT)
            font.setPointSize(9)
            self.dockWidget_PortConfig.setFont(font)
            self.dockWidget_SendHex.setFont(font)
            self.dockWidget_QuickSend.setFont(font)
        self.setupMenu()
        self.setupFlatUi()
        self.onEnumPorts()

        icon = QtGui.QIcon(":/MyTerm.ico")
        self.setWindowIcon(icon)
        self.actionAbout.setIcon(icon)

        self.defaultStyleWidget = QWidget()
        self.defaultStyleWidget.setWindowIcon(icon)

        icon = QtGui.QIcon(":/qt_logo_16.ico")
        self.actionAbout_Qt.setIcon(icon)

        self._viewGroup = QActionGroup(self)
        self._viewGroup.addAction(self.actionAscii)
        self._viewGroup.addAction(self.actionHex_lowercase)
        self._viewGroup.addAction(self.actionHEX_UPPERCASE)
        self._viewGroup.setExclusive(True)

        # bind events
        self.actionOpen_Cmd_File.triggered.connect(self.openQuickSend)
        self.actionSave_Log.triggered.connect(self.onSaveLog)
        self.actionExit.triggered.connect(self.onExit)

        self.actionOpen.triggered.connect(self.openPort)
        self.actionClose.triggered.connect(self.closePort)

        self.actionPort_Config_Panel.triggered.connect(self.onTogglePrtCfgPnl)
        self.actionQuick_Send_Panel.triggered.connect(self.onToggleQckSndPnl)
        self.actionSend_Hex_Panel.triggered.connect(self.onToggleHexPnl)
        self.dockWidget_PortConfig.visibilityChanged.connect(self.onVisiblePrtCfgPnl)
        self.dockWidget_QuickSend.visibilityChanged.connect(self.onVisibleQckSndPnl)
        self.dockWidget_SendHex.visibilityChanged.connect(self.onVisibleHexPnl)
        self.actionLocal_Echo.triggered.connect(self.onLocalEcho)
        self.actionAlways_On_Top.triggered.connect(self.onAlwaysOnTop)

        self.actionAscii.triggered.connect(self.onViewChanged)
        self.actionHex_lowercase.triggered.connect(self.onViewChanged)
        self.actionHEX_UPPERCASE.triggered.connect(self.onViewChanged)

        self.actionAbout.triggered.connect(self.onAbout)
        self.actionAbout_Qt.triggered.connect(self.onAboutQt)

        self.btnOpen.clicked.connect(self.onOpen)
        self.btnClear.clicked.connect(self.onClear)
        self.btnSaveLog.clicked.connect(self.onSaveLog)
        self.btnEnumPorts.clicked.connect(self.onEnumPorts)
        self.btnSendHex.clicked.connect(self.onSend)

        self.receiver_thread.read.connect(self.onReceive)
        self.receiver_thread.exception.connect(self.onReaderExcept)
        self._signalMapQuickSendOpt = QSignalMapper(self)
        self._signalMapQuickSendOpt.mapped[int].connect(self.onQuickSendOptions)
        self._signalMapQuickSend = QSignalMapper(self)
        self._signalMapQuickSend.mapped[int].connect(self.onQuickSend)

        # initial action
        self.actionHEX_UPPERCASE.setChecked(True)
        self.receiver_thread.setViewMode(VIEWMODE_HEX_UPPERCASE)
        self.initQuickSend()
        self.restoreLayout()
        self.moveScreenCenter()
        self.syncMenu()
        
        if self.isMaximized():
            self.setMaximizeButton("restore")
        else:
            self.setMaximizeButton("maximize")
            
        self.loadSettings()

#.........这里部分代码省略.........
开发者ID:gamesun,项目名称:MyTerm,代码行数:103,代码来源:myterm_qt5.py


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