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


Python QtGui.QMenu类代码示例

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


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

示例1: init_notebooks

 def init_notebooks(self):
     frame = QFrame()
     layout = QVBoxLayout()
     frame.setLayout(layout)
     self.ui.scrollArea.setWidget(frame)
     for notebook_struct in self.app.provider.list_notebooks():
         notebook = Notebook.from_tuple(notebook_struct)
         count = self.app.provider.get_notebook_notes_count(notebook.id)
         widget = QWidget()
         menu = QMenu(self)
         menu.addAction(self.tr('Change Name'), Slot()(partial(
             self.change_notebook, notebook=notebook,
         )))
         action = menu.addAction(self.tr('Remove Notebook'), Slot()(partial(
             self.remove_notebook, notebook=notebook,
         )))
         action.setEnabled(False)
         widget.ui = Ui_Notebook()
         widget.ui.setupUi(widget)
         widget.ui.name.setText(notebook.name)
         widget.ui.content.setText(self.tr('Containts %d notes') % count)
         widget.ui.actionBtn.setIcon(QIcon.fromTheme('gtk-properties'))
         widget.setFixedHeight(50)
         layout.addWidget(widget)
         widget.ui.actionBtn.clicked.connect(Slot()(partial(
             self.show_notebook_menu,
             menu=menu, widget=widget,
         )))
开发者ID:fabianofranz,项目名称:everpad,代码行数:28,代码来源:management.py

示例2: __init__

    def __init__(self,prozor):
        
        QMenuBar.__init__(self)
        self.prozor=prozor
        menuBarActions.menuBarActions.mBarActions(self)
        #File
        self.fileMenu = QMenu()
        self.fileMenu.setTitle("File")
        self.fileMenu.addAction(self.newFileAction)
        self.fileMenu.addSeparator()
        self.fileMenu.addAction(self.openFileAction)
        self.fileMenu.addSeparator()
        self.fileMenu.addAction(self.saveAction)
        self.fileMenu.addSeparator()
        self.fileMenu.addAction(self.saveAsAction)
        self.fileMenu.addSeparator()
        self.fileMenu.addAction(self.exitProgramAction)
        self.addMenu(self.fileMenu)
        #Edit
        self.editMenu=QMenu()
        self.editMenu.setTitle("Edit")
        self.editMenu.addAction(self.undoAction)
        self.fileMenu.addSeparator()
        self.editMenu.addAction(self.redoAction)
        self.fileMenu.addSeparator()
        self.editMenu.addAction(self.cutAction)
        self.fileMenu.addSeparator()
        self.editMenu.addAction(self.copyAction)
        self.fileMenu.addSeparator()
        self.editMenu.addAction(self.pasteAction)
        self.fileMenu.addSeparator()
        self.addMenu(self.editMenu)

        self.addAction(self.optionsAction)
开发者ID:satishgoda,项目名称:SimulationZ,代码行数:34,代码来源:menuBar.py

示例3: 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

示例4: on_show_debug_menu

    def on_show_debug_menu(self):
        self.debug_menu.clear()

        if self.is_master_cmd or self.power_user:
            power_user_mode = QAction('Power User Mode', self)
            power_user_mode.setCheckable(True)
            power_user_mode.setChecked(MTTSettings.value('powerUser'))
            power_user_mode.triggered.connect(self.__on_toggle_power_user)
            self.debug_menu.addAction(power_user_mode)
            self.is_master_cmd = False

            self.debug_menu.addSeparator()

        open_pref_folder_action = QAction('Open Preferences Folder', self)
        open_pref_folder_action.setStatusTip('Open MTT preference folder')
        open_pref_folder_action.triggered.connect(self.on_open_preference_folder)
        self.debug_menu.addAction(open_pref_folder_action)

        self.debug_menu.addSeparator()

        database_dump_csv = QAction('Dump Database as CSV', self)
        database_dump_csv.triggered.connect(self.view.model.database_dump_csv)
        self.debug_menu.addAction(database_dump_csv)

        database_dump_sql = QAction('Dump Database as SQL', self)
        database_dump_sql.triggered.connect(self.view.model.database_dump_sql)
        self.debug_menu.addAction(database_dump_sql)

        self.debug_menu.addSeparator()

        support_info = QMenu(self)
        support_info.setTitle('Supported Node Type')
        support_info.aboutToShow.connect(self.on_show_supported_type)
        self.debug_menu.addMenu(support_info)
开发者ID:Bioeden,项目名称:dbMayaTextureToolkit,代码行数:34,代码来源:mttSettingsMenu.py

示例5: createVersionEveryWhereMenuForView

  def createVersionEveryWhereMenuForView(self, view):

    versionEverywhereMenu = QMenu(self.actionTitle)
    self._versionActions = []
    # We look to the activeView for a selection of Clips
    clips = self.clipSelectionFromView(view)
    
    # And bail if nothing is found
    if len(clips)==0:
      return versionEverywhereMenu

    # Now, if we have just one Clip selected, we'll form a special menu, which lists all versions
    if len(clips)==1:

      # Get a reversed list of Versions, so that bigger ones appear at top
      versions = list(reversed(clips[0].binItem().items()))
      for version in versions:
        self._versionActions+=[self.makeVersionActionForSingleClip(version)]

    elif len(clips)>1:
      # We will add Max/Min/Prev/Next options, which can be called on a TrackItem, without the need for a Version object
      self._versionActions+=[self.makeAction(self.eMaxVersion,self.setTrackItemVersionForClipSelection, icon=None)]
      self._versionActions+=[self.makeAction(self.eMinVersion,self.setTrackItemVersionForClipSelection, icon=None)]
      self._versionActions+=[self.makeAction(self.eNextVersion,self.setTrackItemVersionForClipSelection, icon=None)]
      self._versionActions+=[self.makeAction(self.ePreviousVersion,self.setTrackItemVersionForClipSelection, icon=None)]
    
    for act in self._versionActions:
      versionEverywhereMenu.addAction(act)

    return versionEverywhereMenu
开发者ID:Aeium,项目名称:dotStudio,代码行数:30,代码来源:version_everywhere.py

示例6: tag_context_menu

 def tag_context_menu(self, pos):
     index = self.ui.tagsList.currentIndex()
     item = self.tagsModel.itemFromIndex(index)
     if hasattr(item, 'tag'):
         menu = QMenu(self.ui.tagsList)
         menu.addAction(QIcon.fromTheme('gtk-delete'), self.tr('Remove'), self.remove_tag)
         menu.exec_(self.ui.tagsList.mapToGlobal(pos))
开发者ID:AnderSilva,项目名称:everpad,代码行数:7,代码来源:list.py

示例7: __init__

    def __init__(self, parent=None):
        super(MainWindow, self).__init__(parent)
        self.current_profileid = ""
        self.setupUi(self)
        self.logger = get_logger('desuratools', 'desuratools.log')
        self.logger.info('Logger Created')
        boldfont = QApplication.font()
        boldfont.setBold(True)
        self.addToSteam_action = self.action_factory("Add to Steam", self.add_to_steam)
        self.addToSteam_action.setFont(boldfont)

        self.installGame_action = self.action_factory("Install", self.install_game)
        self.installGame_action.setFont(boldfont)

        self.desuraPage_action = self.action_factory("View Profile", self.open_desura_page)
        self.uninstallGame_action = self.action_factory("Uninstall", self.uninstall_game)
        self.verifyGame_action = self.action_factory("Verify", self.verify_game)

        self.ownedGames_menu = QMenu(self)
        self.ownedGames_menu.addActions([
            self.installGame_action,
            self.desuraPage_action
        ])

        self.installedGames_menu = QMenu(self)
        self.installedGames_menu.addActions([
            self.addToSteam_action,
            self.desuraPage_action,
            self.uninstallGame_action,
            self.verifyGame_action
        ])

        self.selectAllButton.clicked.connect(self.select_all_games)
        self.desuraAccountName_verify.clicked.connect(self.populate_owned_games)
        self.installButton.clicked.connect(self.process_install_button)
        self.generateDesuraReport_action.activated.connect(self.generate_report)
        self.tabWidget.currentChanged.connect(self.swap_tabs)
        self.ownedGames_list.itemSelectionChanged.connect(self.update_gameinfo)
        self.installedGames_list.itemSelectionChanged.connect(self.update_gameinfo)
        self.refreshButton.clicked.connect(self.refresh_list)
        self.refreshLists_action.activated.connect(self.refresh_all)

        self.installedGames_list.customContextMenuRequested.connect(self.show_game_context)
        self.installedGames_list.doubleClicked.connect(self.add_to_steam)

        self.installedGames_list.setSelectionMode(QAbstractItemView.ExtendedSelection)
        self.ownedGames_list.setSelectionMode(QAbstractItemView.ExtendedSelection)

        self.steamID_input.addItems(steamutils.get_customurls_on_machine())
        self.ownedGames_list.addItem("Verify your Desura username to see your owned games")

        QApplication.processEvents()
        self.loading_dialog = ProgressBarDialog()
        self.loading_dialog.show()
        QApplication.processEvents()
        self.populate_installed_games()
        self.load_data()
        self.loading_dialog.close()
        self.raise_()
开发者ID:RonnChyran,项目名称:DesuraTools-py,代码行数:59,代码来源:gui.py

示例8: 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

示例9: sort_menu

 def sort_menu(self):
     sort_by=QMenu("Sort By")
     sort_by.setIcon( QIcon(appicon("default_menu")) )
     sorting=["Year","Title","Oldest","Newest","My Rating","IMDb Rating","ASC","DESC"]
     for i in sorting:
         k=SortbyAction(i,self)
         k.triggered.connect(self.click_event)
         sort_by.addAction(k)
     return sort_by
开发者ID:mkawserm,项目名称:iMovMan,代码行数:9,代码来源:moviemenu.py

示例10: _setupContextMenu

 def _setupContextMenu(self):
   from visualscrape.lib.data import ActionStore
   context_menu = QMenu(self)
   export_action = NamedAction(self.tr("Export ..."), self, name="export")
   export_action.triggered.connect(self._requestTabExport)
   context_menu.addAction(export_action)
   self.setTabBar(ContextMenuTabBar(context_menu))
   action_store = ActionStore.get_instance()
   action_store.register_action(export_action)
开发者ID:github-account-because-they-want-it,项目名称:VisualScrape,代码行数:9,代码来源:support.py

示例11: __LobbyListMenu

    def __LobbyListMenu( self, position ):
        lobby_menu      = QMenu()

        rm_from_lobby   = QAction( self )
        rm_from_lobby.setText( "Remove player from lobby" )
        rm_from_lobby.triggered.connect( self._RemoveFromLobbyListAction )

        lobby_menu.addAction( rm_from_lobby )

        lobby_menu.exec_( self.window.lobby_lst.viewport().mapToGlobal( position ) )
开发者ID:montreal91,项目名称:workshop,代码行数:10,代码来源:main.py

示例12: testMenu

 def testMenu(self):
     self._actionDestroyed = False
     w = QWidget()
     menu = QMenu(w)
     act = menu.addAction("MENU")
     _ref = weakref.ref(act, self.actionDestroyed)
     act = None
     self.assertFalse(self._actionDestroyed)
     menu.clear()
     self.assertTrue(self._actionDestroyed)
开发者ID:Hasimir,项目名称:PySide,代码行数:10,代码来源:action_clear.py

示例13: click

 def click(self, res, event):
     """Open resource"""
     button = event.button()
     if button == Qt.LeftButton:
         subprocess.Popen(['xdg-open', res.file_path])
     elif button == Qt.RightButton:
         menu = QMenu(self.parent)
         if res.mime.find('image') == 0:
             menu.addAction(
                 self.parent.tr('Put to Content'), Slot()(partial(
                     self.to_content, res=res,
                 )),
             )
         if not self.parent.note_edit.in_content(res):
             menu.addAction(
                 self.parent.tr('Remove Resource'), Slot()(partial(
                     self.remove, res=res,
                 ))
             )
         menu.addAction(
             self.parent.tr('Save As'), Slot()(partial(
                 self.save, res=res,
             ))
         )
         menu.exec_(event.globalPos())
开发者ID:altawu,项目名称:everpad,代码行数:25,代码来源:editor.py

示例14: __init__

 def __init__(self, parent=None):
     QMenu.__init__(self, "&Signals")
     self.parent = parent
     
     self.addSignalAction = self.addAction(self.trUtf8("&Add Signal"))
     
     self.addSignalAction.triggered.connect(self.addSignal)
     self.addSignalAction.setEnabled(False)
     
     self.applyOperationAction = self.addAction(self.trUtf8("&Apply Operation"))
     self.applyOperationAction.triggered.connect(self.applyOperation)    
     self.applyOperationAction.setEnabled(False)
开发者ID:hectorpinheiro,项目名称:DSP-Tool,代码行数:12,代码来源:MainWindow.py

示例15: __init__

 def __init__(self, parent=None):
     QMainWindow.__init__(self, parent)
     # activate the window and use the full screen
     self.setWindowState(Qt.WindowFullScreen | Qt.WindowActive)
     # empty the mouse cursor
     self.setCursor(Qt.BlankCursor)
     # add a menu to close the window
     appmenu = QMenu('&Application', self)
     quit = QAction('&Quit', self)
     appmenu.addAction(quit)
     self.menuBar().addMenu(appmenu)
     quit.triggered.connect(QApplication.instance().quit)
开发者ID:MiguelCarrilhoGT,项目名称:snippets,代码行数:12,代码来源:frameless_fullscreen.py


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