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


Python Main.getIconPath方法代码示例

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


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

示例1: __init__

# 需要导入模块: import Main [as 别名]
# 或者: from Main import getIconPath [as 别名]
    def __init__(self):
        #Build out UI
        QtGui.QMainWindow.__init__(self)
        self.setupUi(self)
        
        #Setup Inherited Tab Classes
        ManagementTasks.ManagementTasks.__init__(self)
        Slabs.Slabs.__init__(self)
        Stats.Stats.__init__(self)
        self.currentTab = 'MTasks'
        
        #Startup the Dialogs
        self.addDialog = Add.AddServersClusters()
        self.preferencesDialog = Preferences.Preferences()
        self.aboutDialog = About.About()
        self.cachedItemDialog = CachedItem.CachedItem()
        
        #Load Settings
        self.settings = Settings()
        
        #Bind to events
        self.connect(self.actionAddClusterServer, QtCore.SIGNAL("triggered()"), self.displayAdd)
        self.connect(self.actionAbout, QtCore.SIGNAL("triggered()"), self.displayAbout)
        self.connect(self.addDialog, QtCore.SIGNAL('savedCluster'), self.addCluster)
        
        self.connect(self.actionSave, QtCore.SIGNAL('triggered()'), self.save)
        self.connect(self.actionPreferences, QtCore.SIGNAL('triggered()'), self.displayPreferences)
        self.connect(self.tabsMain, QtCore.SIGNAL('currentChanged(QWidget*)'), self.mainTabChanged)
        
        self.treeCluster.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
        self.connect(self.treeCluster, QtCore.SIGNAL('itemDoubleClicked(QTreeWidgetItem*, int)'), self.setClusterByTree)
        self.connect(self.treeCluster, QtCore.SIGNAL('customContextMenuRequested(QPoint)'), self.displayTreeContextMenu)
        
        self.currentCluster = None
        
        #Build out Cluster Tree
        for cluster in self.settings.servers.getClusters():
            self.addCluster(cluster)
            
        #Create the Icons
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(Main.getIconPath("memLogo.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        addIcon = QtGui.QIcon()
        addIcon.addPixmap(QtGui.QPixmap(Main.getIconPath("Add.png")), QtGui.QIcon.Normal, QtGui.QIcon.On)
        removeIcon = QtGui.QIcon()
        removeIcon.addPixmap(QtGui.QPixmap(Main.getIconPath("Remove.png")), QtGui.QIcon.Normal, QtGui.QIcon.On)
        activeIcon = QtGui.QIcon()
        activeIcon.addPixmap(QtGui.QPixmap(Main.getIconPath("Active.png")), QtGui.QIcon.Normal, QtGui.QIcon.On)
        
        #Reset the Window Icon as paths change
        self.setWindowIcon(icon)
        
        #Build out the Cluster Tree Context Menus
        self.treeCMServer = QtGui.QMenu()
        self.treeCMServerActions = {"addServer": QtGui.QAction(self),
                                "deleteServer": QtGui.QAction(self)}
        
        self.treeCMServerActions['addServer'].setText("Add Server/Cluster")
        self.treeCMServerActions['addServer'].setIcon(addIcon)
        self.treeCMServer.addAction(self.treeCMServerActions['addServer'])
        
        self.treeCMServerActions['deleteServer'].setText("Delete")
        self.treeCMServerActions['deleteServer'].setIcon(removeIcon)
        self.treeCMServer.addAction(self.treeCMServerActions['deleteServer'])
        
        self.connect(self.treeCMServerActions['addServer'], QtCore.SIGNAL("triggered()"), self.displayAdd)
        self.connect(self.treeCMServerActions['deleteServer'], QtCore.SIGNAL("triggered()"), self.deleteServer)


        self.treeCMCluster = QtGui.QMenu()
        self.treeCMClusterActions = {"addServer": QtGui.QAction(self),
                                    "deleteCluster": QtGui.QAction(self), 
                                    "makeActive": QtGui.QAction(self)}
        
        self.treeCMClusterActions['addServer'].setText("Add Server/Cluster")
        self.treeCMClusterActions['addServer'].setIcon(addIcon)
        self.treeCMCluster.addAction(self.treeCMClusterActions['addServer'])
        
        self.treeCMClusterActions['deleteCluster'].setText("Delete")
        self.treeCMClusterActions['deleteCluster'].setIcon(removeIcon)
        self.treeCMCluster.addAction(self.treeCMClusterActions['deleteCluster'])
        
        self.treeCMClusterActions['makeActive'].setText("Make Active")
        self.treeCMClusterActions['makeActive'].setIcon(activeIcon)
        self.treeCMCluster.addAction(self.treeCMClusterActions['makeActive'])
        
        self.connect(self.treeCMClusterActions['addServer'], QtCore.SIGNAL("triggered()"), self.displayAdd)
        self.connect(self.treeCMClusterActions['deleteCluster'], QtCore.SIGNAL("triggered()"), self.deleteCluster)
        self.connect(self.treeCMClusterActions['makeActive'], QtCore.SIGNAL("triggered()"), self.setClusterByContextMenu)
开发者ID:hungud,项目名称:MemcachedManager,代码行数:91,代码来源:MainWindow.py


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