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


Python QtGui.QAction类代码示例

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


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

示例1: __init__

 def __init__(self, parent=None):
     QMainWindow.__init__(self, parent)
     self.setWindowFilePath('No file')
     # the media object controls the playback
     self.media = Phonon.MediaObject(self)
     # the audio output does the actual sound playback
     self.audio_output = Phonon.AudioOutput(Phonon.MusicCategory, self)
     # a slider to seek to any given position in the playback
     self.seeker = Phonon.SeekSlider(self)
     self.setCentralWidget(self.seeker)
     # link media objects together.  The seeker will seek in the created
     # media object
     self.seeker.setMediaObject(self.media)
     # audio data from the media object goes to the audio output object
     Phonon.createPath(self.media, self.audio_output)
     # set up actions to control the playback
     self.actions = self.addToolBar('Actions')
     for name, label, icon_name in self.ACTIONS:
         icon = self.style().standardIcon(icon_name)
         action = QAction(icon, label, self)
         action.setObjectName(name)
         self.actions.addAction(action)
         if name == 'open':
             action.triggered.connect(self._ask_open_filename)
         else:
             action.triggered.connect(getattr(self.media, name))
     # whenever the playback state changes, show a message to the user
     self.media.stateChanged.connect(self._show_state_message)
开发者ID:MiguelCarrilhoGT,项目名称:snippets,代码行数:28,代码来源:phonon_audio.py

示例2: __CreateActions

    def __CreateActions(self):
        """ Function to create actions for menus """
        self.stdAction = QAction(QIcon('convert.png'), 
                                'Create MKV files',
                                self, shortcut = "Ctrl+K",
                                statusTip = "File format set to MKV container",
                                triggered = self.stdConversion,
                                checkable = True)

        self.altAction = QAction(QIcon('convert.png'), 
                                'Create MP4 files',
                                self, shortcut = "Ctrl+P",
                                statusTip = "File format set to MP4 file",
                                triggered = self.altConversion,
                                checkable = True)

        self.exitAction = QAction(QIcon('exit.png'),
                                  '&Quit',
                                  self, shortcut="Ctrl+Q",
                                  statusTip = "Exit the Application",
                                  triggered=self.exitFile)

        #self.copyAction = QAction(QIcon('copy.png'), 'C&opy',
                                  #self, shortcut="Ctrl+C",
                                  #statusTip="Copy",
                                  #triggered=self.CopyFunction)

        self.aboutAction = QAction(QIcon('about.png'), 'A&bout',
                                   self, statusTip="Displays info about ManageHD",
                                   triggered=self.aboutHelp)
开发者ID:DominicanKnight,项目名称:ManageHD,代码行数:30,代码来源:ManageHD_GUI.py

示例3: __init__

	def __init__(self,args,continuous):
		self.continuous = continuous
		gobject.GObject.__init__(self)
		#start by making our app
		self.app = QApplication(args)
		#make a window
		self.window = QMainWindow()
		#give the window a name
		self.window.setWindowTitle("BlatherQt")
		self.window.setMaximumSize(400,200)
		center = QWidget()
		self.window.setCentralWidget(center)

		layout = QVBoxLayout()
		center.setLayout(layout)
		#make a listen/stop button
		self.lsbutton = QPushButton("Listen")
		layout.addWidget(self.lsbutton)
		#make a continuous button
		self.ccheckbox = QCheckBox("Continuous Listen")
		layout.addWidget(self.ccheckbox)

		#connect the buttons
		self.lsbutton.clicked.connect(self.lsbutton_clicked)
		self.ccheckbox.clicked.connect(self.ccheckbox_clicked)

		#add a label to the UI to display the last command
		self.label = QLabel()
		layout.addWidget(self.label)

		#add the actions for quiting
		quit_action = QAction(self.window)
		quit_action.setShortcut('Ctrl+Q')
		quit_action.triggered.connect(self.accel_quit)
		self.window.addAction(quit_action)
开发者ID:Narcolapser,项目名称:blather,代码行数:35,代码来源:QtUI.py

示例4: on_show_prompt_instance_delay_menu

    def on_show_prompt_instance_delay_menu(self):
        prompt_instance_state = cmds.optionVar(query='MTT_prompt_instance_state')

        if prompt_instance_state == PROMPT_INSTANCE_WAIT:
            elapsed_time = time() - cmds.optionVar(query='MTT_prompt_instance_suspend')
            if elapsed_time > PROMPT_INSTANCE_WAIT_DURATION:
                prompt_instance_state = PROMPT_INSTANCE_ASK
                cmds.optionVar(iv=['MTT_prompt_instance_state', prompt_instance_state])
            else:
                mtt_log('Remaining %.2fs' % (PROMPT_INSTANCE_WAIT_DURATION - elapsed_time))
        elif prompt_instance_state == PROMPT_INSTANCE_SESSION:
            if 'mtt_prompt_session' not in __main__.__dict__:
                prompt_instance_state = PROMPT_INSTANCE_ASK
                cmds.optionVar(iv=['MTT_prompt_instance_state', prompt_instance_state])

        self.instance_menu.clear()

        prompt_delay = QActionGroup(self)
        prompt_delay.setExclusive(True)
        for i in range(len(PROMPT_INSTANCE_STATE.keys())):
            current_delay_action = QAction(PROMPT_INSTANCE_STATE[i], prompt_delay)
            current_delay_action.setCheckable(True)
            current_delay_action.setChecked(prompt_instance_state == i)
            current_delay_action.triggered.connect(
                partial(self.view.on_choose_instance_delay, i, prompt=i != 0))
            self.instance_menu.addAction(current_delay_action)
开发者ID:Bioeden,项目名称:dbMayaTextureToolkit,代码行数:26,代码来源:mttSettingsMenu.py

示例5: updateRecentFilesMenu

    def updateRecentFilesMenu(self):
        #If there is a current file open, add it to the recent files list.
        if self.file_name and MainWindow.recentFiles.count(self.file_name) == 0:
            #Prepend the file to recentFiles
            MainWindow.recentFiles.insert(0, self.file_name)
            #This this is the only time files get added to recentFiles,
            #enforce the maximum length of recentFiles now.
            while len(MainWindow.recentFiles) > 9:
                MainWindow.recentFiles.pop()

        recent_files = []

        #For each file in recentFiles, check that it exists and is readable.
        for fname in MainWindow.recentFiles:
            if os.access(fname, os.F_OK):
                recent_files.append(fname)

        MainWindow.recentFiles = recent_files

        #Now create an action for each file.
        if recent_files:
            action_list = []
            for i, fname in enumerate(recent_files):
                new_action = QAction("%d. %s"%(i, fname), self, triggered=self.openRecentFile)
                new_action.setData(fname)
                action_list.append(new_action)
            #Now update the recent files menu on every window.
            for window in MainWindow.instances:
                window.menuRecent.clear()
                window.menuRecent.addActions(action_list)
开发者ID:rljacobson,项目名称:Guru-NB,代码行数:30,代码来源:MainWindow.py

示例6: _create_theme_menu

    def _create_theme_menu(self):
        theme_menu = QMenu(self)
        theme_menu.setTitle('Buttons Theme')
        theme_menu.setTearOffEnabled(True)
        theme_menu.setWindowTitle(TAG)
        theme_actions = QActionGroup(self)
        theme_actions.setExclusive(True)
        # create ordered theme list
        custom_order_theme = sorted(THEMES.iterkeys())
        custom_order_theme.remove('Maya Theme')
        custom_order_theme.insert(0, 'Maya Theme')
        default_item = True
        for theme in custom_order_theme:
            current_theme_action = QAction(theme, theme_actions)
            current_theme_action.setCheckable(True)
            current_theme_action.setChecked(
                MTTSettings.value('theme', 'Maya Theme') == theme)
            current_theme_action.triggered.connect(self.on_change_theme)
            theme_menu.addAction(current_theme_action)

            if default_item:
                theme_menu.addSeparator()
                default_item = False

        return theme_menu
开发者ID:Bioeden,项目名称:dbMayaTextureToolkit,代码行数:25,代码来源:mttSettingsMenu.py

示例7: testSignal

 def testSignal(self):
     o = QWidget()
     act = QAction(o)
     self._called = False
     act.triggered.connect(self._cb)
     act.trigger()
     self.assert_(self._called)
开发者ID:Hasimir,项目名称:PySide,代码行数:7,代码来源:qaction_test.py

示例8: __init__

 def __init__(self):
     QAction.__init__(self, "Set Poster Frame", None)
     self.triggered.connect(self.setPosterFrameForActiveSequence)
     hiero.core.events.registerInterest("kShowContextMenu/kViewer", self.eventHandler)
     self.setObjectName("foundry.viewer.setPosterFrame")
     self.setShortcut("Shift+P")
     self.currentViewer = None
开发者ID:Aeium,项目名称:dotStudio,代码行数:7,代码来源:set_poster_frame.py

示例9: createUserInfoContextMenu

    def createUserInfoContextMenu(self):
        '''添加用户信息快捷菜单'''
        #pylint: disable=W0201
        self.addUserAct = QAction(self)
#        self.addUserAct.setText("add User")
        
        self.delUserAct = QAction(self)
#        self.delUserAct.setText("del User")

        self.undoDelUserAct = QAction(self)
#        self.undoDelUserAct.setText("undo del User")
        
        self.saveDataRowAct = QAction(self)
#        self.saveDataRowAct.setText("save Data")
        
        self.ui.userInfo_tableView.addAction(self.addUserAct)
        self.ui.userInfo_tableView.addAction(self.delUserAct)
        self.ui.userInfo_tableView.addAction(self.undoDelUserAct)
        self.ui.userInfo_tableView.addAction(self.saveDataRowAct)
        
        QObject.connect(self.addUserAct, SIGNAL("activated()"), self, SLOT("userInfoAddRow()"))
        QObject.connect(self.delUserAct, SIGNAL("activated()"), self, SLOT("userInfoDelRow()"))
        QObject.connect(self.undoDelUserAct, SIGNAL("activated()"), self, SLOT("userInfoUndoDelRow()"))        
        QObject.connect(self.saveDataRowAct, SIGNAL("activated()"), self, SLOT("userInfoSaveData()"))
        
        self.ui.userInfo_tableView.setContextMenuPolicy(Qt.ActionsContextMenu)
开发者ID:xiaomdong,项目名称:xdIm,代码行数:26,代码来源:serverManager.py

示例10: showContextMenu

 def showContextMenu(self, point):
     'Show the Columns context menu'
     if self.model() is None:
         return
     
     # If we are viewing a proxy model, skip to the source model
     mdl = self.model()
     while isinstance(mdl, QAbstractProxyModel):
         mdl = mdl.sourceModel()
     
     if mdl is None or not hasattr(mdl, 'columns'):
         return
     
     # Generate and show the Menu
     m = QMenu()
     for i in range(len(mdl.columns)):
         c = mdl.columns[i]
         if c.internal:
             continue
         
         a = QAction(mdl.headerData(i, Qt.Horizontal, Qt.DisplayRole), m)
         a.setCheckable(True)
         a.setChecked(not self.isColumnHidden(i))
         a.triggered.connect(partial(self.showHideColumn, c=i, s=self.isColumnHidden(i)))
         m.addAction(a)
         
     m.exec_(self.header().mapToGlobal(point))
开发者ID:asymworks,项目名称:python-divelog,代码行数:27,代码来源:views.py

示例11: testPythonStringAsQKeySequence

 def testPythonStringAsQKeySequence(self):
     '''Passes a Python string to an argument expecting a QKeySequence.'''
     keyseq = py3k.unicode_('Ctrl+A')
     action = QAction(None)
     action.setShortcut(keyseq)
     shortcut = action.shortcut()
     self.assert_(isinstance(shortcut, QKeySequence))
     self.assertEqual(shortcut.toString(), keyseq)
开发者ID:Hasimir,项目名称:PySide,代码行数:8,代码来源:qstring_qkeysequence_test.py

示例12: addExitButton

 def addExitButton(self):
     """ Adds the Exit Button to the ToolBar """
     exitAction = QAction(self.getQIcon('exit.png'), 'Exit the Application', self)
     exitAction.setShortcut('Ctrl+Q')
     exitAction.setStatusTip("Exit the Application.")
     exitAction.triggered.connect(QtCore.QCoreApplication.instance().quit)
     
     self.addAction(exitAction)
开发者ID:cloew,项目名称:PersonalAccountingSoftware,代码行数:8,代码来源:tab_toolbar.py

示例13: popup

    def popup(self,pos):
        menu = QMenu()

        saveRepAction = QAction(self)
        saveRepAction.setText('Save representation...')
        saveRepAction.triggered.connect(lambda: self.saveRep(self.indexAt(pos)))
        menu.addAction(saveRepAction)
        action = menu.exec_(self.mapToGlobal(pos))
开发者ID:mmcauliffe,项目名称:exemplar-network-explorer,代码行数:8,代码来源:views.py

示例14: __init__

 def __init__(self):
   QAction.__init__(self, "Copy Python Selection", None)
   self.triggered.connect(self.getPythonSelection)
   hiero.core.events.registerInterest("kShowContextMenu/kTimeline", self.eventHandler)
   hiero.core.events.registerInterest("kShowContextMenu/kBin", self.eventHandler)
   hiero.core.events.registerInterest("kShowContextMenu/kSpreadsheet", self.eventHandler)
   self.setShortcut("Ctrl+Alt+C")
   self._selection = ()
开发者ID:Aeium,项目名称:dotStudio,代码行数:8,代码来源:selection_helpers.py

示例15: addNewTransactionButton

 def addNewTransactionButton(self):
     """ Adds the New Transaction Button to the ToolBar """
     newIcon = self.getQIcon('money.png')
     newTransactionAction = QAction(newIcon, 'New Transaction', self)
     newTransactionAction.setShortcut('Ctrl+N')
     newTransactionAction.setStatusTip("Create a New Transaction.")
     newTransactionAction.triggered.connect(self.newTransaction)
     
     self.addAction(newTransactionAction)
开发者ID:cloew,项目名称:PersonalAccountingSoftware,代码行数:9,代码来源:transaction_toolbar.py


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