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


Python QAction.setData方法代码示例

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


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

示例1: updateFileMenu

# 需要导入模块: from PySide.QtGui import QAction [as 别名]
# 或者: from PySide.QtGui.QAction import setData [as 别名]
    def updateFileMenu(self):
        """
        Updates the file menu dynamically, so that recent files can be shown.
        """
        self.menuFile.clear()
        #        self.menuFile.addAction(self.actionNew)    # disable for now
        self.menuFile.addAction(self.actionOpen)
        self.menuFile.addAction(self.actionSave)
        self.menuFile.addAction(self.actionSave_as)
        self.menuFile.addAction(self.actionClose_Model)

        recentFiles = []
        for filename in self.recentFiles:
            if QFile.exists(filename):
                recentFiles.append(filename)

        if len(self.recentFiles) > 0:
            self.menuFile.addSeparator()
            for i, filename in enumerate(recentFiles):
                action = QAction("&%d %s" % (i + 1, QFileInfo(filename).fileName()), self)
                action.setData(filename)
                action.setStatusTip("Opens recent file %s" % QFileInfo(filename).fileName())
                action.setShortcut(QKeySequence(Qt.CTRL | (Qt.Key_1 + i)))
                action.triggered.connect(self.load_model)
                self.menuFile.addAction(action)

        self.menuFile.addSeparator()
        self.menuFile.addAction(self.actionQuit)
开发者ID:CSB-at-ZIB,项目名称:BioPARKIN,代码行数:30,代码来源:BioPARKIN.py

示例2: updateRecentFilesMenu

# 需要导入模块: from PySide.QtGui import QAction [as 别名]
# 或者: from PySide.QtGui.QAction import setData [as 别名]
    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,代码行数:32,代码来源:MainWindow.py

示例3: updateWindowMenu

# 需要导入模块: from PySide.QtGui import QAction [as 别名]
# 或者: from PySide.QtGui.QAction import setData [as 别名]
    def updateWindowMenu(self):
        #aboutToShow() does not do what Mark Summerfield thinks it does--at least in PySide.

        #Generate a list of actions to add to the Window menu.
        window_menu_actions = []
        for i, window in enumerate(MainWindow.instances):
            #The following line removes the "[*]" from the titleName.
            title_name = ''.join(window.titleName.split("[*]"))
            action_text = "%d. %s" % (i, title_name)
            new_action = QAction(action_text, self, triggered=self.raiseWindow)
            new_action.setData(window.titleName)
            window_menu_actions.append(new_action)

        for window in MainWindow.instances:
            window.menuWindow.clear()
            for new_action in window_menu_actions:
                window.menuWindow.addAction(new_action)
开发者ID:rljacobson,项目名称:Guru-NB,代码行数:19,代码来源:MainWindow.py

示例4: makeVersionActionForSingleClip

# 需要导入模块: from PySide.QtGui import QAction [as 别名]
# 或者: from PySide.QtGui.QAction import setData [as 别名]
  def makeVersionActionForSingleClip(self, version):
    """This is used to populate the QAction list of Versions when a single Clip is selected in the BinView. 
    It also triggers the Version Update action based on the version passed to it. 
    (Not sure if this is good design practice, but it's compact!)"""
    action = QAction(version.name(),None)
    action.setData(lambda: version)

    def updateAllTrackItems():
      currentClip = version.item()
      trackItems = currentClip.whereAmI()
      if not trackItems:
        return

      proj = currentClip.project()

      # A Sequence-Shot manifest dictionary
      sequenceShotManifest = {}

      # Make this all undo-able in a single Group undo
      with proj.beginUndo("Update All Versions for %s" % currentClip.name()):
        for shot in trackItems:
          seq = shot.parentSequence()
          if seq not in sequenceShotManifest.keys():
            sequenceShotManifest[seq] = [shot]
          else:
            sequenceShotManifest[seq]+=[shot]                    
          shot.setCurrentVersion(version)

        # We also should update the current Version of the selected Clip for completeness...
        currentClip.binItem().setActiveVersion(version)

      # Now disaplay a Dialog which informs the user of where and what was changed
      self.showVersionUpdateReportFromShotManifest(sequenceShotManifest)
    
    action.triggered.connect( updateAllTrackItems )
    return action
开发者ID:Aeium,项目名称:dotStudio,代码行数:38,代码来源:version_everywhere.py

示例5: QAction

# 需要导入模块: from PySide.QtGui import QAction [as 别名]
# 或者: from PySide.QtGui.QAction import setData [as 别名]
from hiero.ui import registerAction
from PySide.QtGui import QAction, QIcon

# This creates an action with an icon and effect named 'Awesome OCIO'
action = QAction(QIcon("icons:TCStop.png"), "Slug", None)

# Soft effect actions can be found by prefixing the QAction's objectName with: 'foundry.timeline.effect'
action.setObjectName("foundry.timeline.effect.addSlug")

# You can optionally set a tooltip for this action
action.setToolTip("Will apply a Slug Gizmo")

# Setting of Data here will point to the Nuke node class name.
# Here, we assume there is a plugin with a Class name 'AwesomeOCIO'
# Note: for soft effects to work, the Nuke node must use a gpuEngine implementation.
action.setData("Slug")

# This registers your custom action with the Effects Menu
registerAction(action)

# This creates an action with an icon and effect named 'SuperGrade'
action = QAction(QIcon("icons:LUT.png"), "SuperGrade", None)

# Soft effect actions can be found by prefixing the QAction's objectName with: 'foundry.timeline.effect.'
action.setObjectName("foundry.timeline.effect.addCustomGrade")

# You can optionally set a tooltip for this action
action.setToolTip("Will apply a Custom Grade soft effect")

action.setData("SuperGrade")
开发者ID:weijer,项目名称:dotHiero,代码行数:32,代码来源:custom_soft_effect.py


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