本文整理汇总了Python中matplotlib.backends.backend_qt4agg.NavigationToolbar2QTAgg.setDisabled方法的典型用法代码示例。如果您正苦于以下问题:Python NavigationToolbar2QTAgg.setDisabled方法的具体用法?Python NavigationToolbar2QTAgg.setDisabled怎么用?Python NavigationToolbar2QTAgg.setDisabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.backends.backend_qt4agg.NavigationToolbar2QTAgg
的用法示例。
在下文中一共展示了NavigationToolbar2QTAgg.setDisabled方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: RMSDPlotUi
# 需要导入模块: from matplotlib.backends.backend_qt4agg import NavigationToolbar2QTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.NavigationToolbar2QTAgg import setDisabled [as 别名]
class RMSDPlotUi(QWidget):
def __init__(self, parent=None):
QMainWindow.__init__(self, parent)
self.loadSettings()
self.createUi()
# self.update()
def loadSettings(self):
settings = QSettings(organizationName, applicationName)
self.trajDir = settings.value('ui/trajDir', '')
self.topoDir = settings.value('ui/topoDir', '')
def saveSettings(self):
settings = QSettings(organizationName, applicationName)
settings.setValue('ui/topoDir', self.topoDir)
settings.setValue('ui/trajDir', self.trajDir)
def closeEvent(self, event): # callback
self.saveSettings()
event.accept()
def createUi(self):
# input
self.topoEdit = QLineEdit()
self.topoEdit.setPlaceholderText('<topo.psf>')
self.connect(self.topoEdit, SIGNAL('textChanged(QString)'), self.update)
self.topoButt = QPushButton('...')
self.connect(self.topoButt, SIGNAL('clicked()'), self.chooseTopologyFileName)
self.topoLab = QLabel('To&pology:')
self.topoLab.setBuddy(self.topoButt)
self.trajEdit = QLineEdit()
self.trajEdit.setPlaceholderText('<traj.dcd>')
self.connect(self.trajEdit, SIGNAL('textChanged(QString)'), self.update)
self.trajButt = QPushButton('...')
self.connect(self.trajButt, SIGNAL('clicked()'), self.chooseTrajectoryFileName)
self.trajLab = QLabel('Tra&jectory:')
self.trajLab.setBuddy(self.trajButt)
self.resetToolTips()
# output
self.figure = Figure((6.0, 4.0), dpi=100)
self.canvas = FigureCanvas(self.figure)
self.canvas.setParent(self)
self.canvas.setFocusPolicy(Qt.StrongFocus)
self.canvas.setFocus()
self.mpl_toolbar = NavigationToolbar(self.canvas, self)
self.mpl_toolbar.setDisabled(True)
# layout widgets
layout = QGridLayout()
layout.addWidget(self.topoLab, 0, 0)
layout.addWidget(self.topoEdit, 0, 1)
layout.addWidget(self.topoButt, 0, 2)
layout.addWidget(self.trajLab, 1, 0)
layout.addWidget(self.trajEdit, 1, 1)
layout.addWidget(self.trajButt, 1, 2)
# plot spans 3 columns
layout.addWidget(self.canvas, 2, 0, 1, 3)
layout.addWidget(self.mpl_toolbar, 3, 0, 1, 3)
# add widgets
self.setLayout(layout)
# squeeze buttons
self.topoButt.setFixedWidth(self.topoButt.sizeHint().height())
self.trajButt.setFixedWidth(self.trajButt.sizeHint().height())
self.topoButt.setFocus() # choose topology with initial keypress
self.setWindowTitle('RMSDPlot')
def chooseTopologyFileName(self):
fileName = QFileDialog.getOpenFileName(self, 'Select Topology File',
self.topoDir,
'CHARMM Topology Files (*.psf);;All Topology Files (*.PDBQT *.PQR *.PRMTOP *.CRD *.GRO *.TOP *.PSF *.PDB);;All Files(*)')
if fileName:
self.topoEdit.setText(fileName)
self.topoDir = os.path.abspath(os.path.dirname(fileName))
if not self.trajDir:
self.trajDir = self.topoDir
def chooseTrajectoryFileName(self):
fileName = QFileDialog.getOpenFileName(self, 'Select Trajectory File',
self.trajDir,
'CHARMM Trajectory Files (*.dcd);;All Trajectory Files (*.TRJ *.MDCRD *.XTC *.CRD *.GRO *.TRR *.PDB *.CHAIN *.LAMMPS *.DCD *.PDBQT *.PQR *.XYZ *.NCDF);;All files(*)')
if fileName:
self.trajEdit.setText(fileName)
self.trajDir = os.path.abspath(os.path.dirname(fileName))
if not self.topoDir:
self.topoDir = self.trajDir
def resetToolTips(self):
blackLabels = 'QLabel { color : black; }'
self.topoLab.setStyleSheet(blackLabels)
self.trajLab.setStyleSheet(blackLabels)
#.........这里部分代码省略.........