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


Python NavigationToolbar2QT.setEnabled方法代码示例

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


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

示例1: Main

# 需要导入模块: from matplotlib.backends.backend_qt4agg import NavigationToolbar2QT [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.NavigationToolbar2QT import setEnabled [as 别名]
class Main(QMainWindow, Ui_MainWindow):
    def __init__(self, ):
        super(Main, self).__init__()
        self.setupUi(self)
#data_dict stores all loaded data sets
        self.data_dict = {}
        self.mplfigs.itemSelectionChanged.connect(self.changefig)
        self.folderSelect.clicked.connect(self.onSelectFolder)
        self.saveFit.clicked.connect(self.onSaveFit)
        self.cancelFit.clicked.connect(self.onCancelFit)
        self.fitSelectedData.clicked.connect(self.onFit)
        self.fitSelectedData.setEnabled(False)
        self.selectPandasDB.clicked.connect(self.onSelectPandasDB)
        self.QEntry.setValidator(QtGui.QIntValidator(1,1000000)) 
        self.widthEdit.setValidator(QtGui.QIntValidator(1,10000))
        self.widthEdit.setText(str(0))
        self.powerType.setText(str(0))
        self.powerValue.setText(str(0))
        self.QEntry.setText(str(100))
        self.fNumber.setValue(1)
        self.degeneracySelect.setCurrentIndex(0)
        fig = Figure()
        self.addmpl(fig)
        self.activefig=None
        self.activeDataSet=None
        self.fittingWindow = None
        self.df=pd.DataFrame()
        self.testdf=pd.DataFrame()
        self.onSelectPandasDB()
    
    def onSelectPandasDB(self,):
        """Select a folder, the selected folder will be parsed for sub-folders.
        Each of these subfolders will be turned into a xyData class which is 
        then stored in main with the adddata command"""
        fileDialog=QtGui.QFileDialog(self)
        fileName=fileDialog.getSaveFileName(self,
        "Choose a pandasDB", homedir, filter ="csv (*.csv)")
        self.pathtopandas=fileName
        self.chipEdit.setText(self.pathtopandas)
        print self.pathtopandas
    def onSelectFolder(self,):
        """Select a folder, the selected folder will be parsed for sub-folders.
        Each of these subfolders will be turned into a xyData class which is 
        then stored in main with the adddata command"""
        self.fileDialog=QtGui.QFileDialog(self)
        folderName=self.fileDialog.getExistingDirectory(self,
        "Choose a folder", homedir, QtGui.QFileDialog.ShowDirsOnly)
        for i in os.listdir(folderName):
            for ii in os.listdir(os.path.join(folderName,i)):
                if ii[-4:] == ".csv":            
                    self.adddata(i, xyData(os.path.join(folderName,i)))        
                                    
    def changefig(self, ):
        item=self.mplfigs.currentItem()
        
        if self.activefig==None:
            pass
        else:
            self.activefig.canvas.mpl_disconnect(self.cid)
        if self.fitSelectedData.isEnabled()==True:
            pass
        else:
            self.fitSelectedData.setEnabled(True)        
        
        text = item.text()
        self.rmmpl()
        fig=self.data_dict[text].fig
        self.addmpl(fig)
        self.cid = fig.canvas.mpl_connect('button_press_event', self.onclick)
        try:
            self.widthEdit.setText(str(self.data_dict[text].deviceWid))           
        except ValueError:
            pass
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
        try:
            self.rowEdit.setValue(int(self.data_dict[text].deviceRow))          
        except ValueError:
            pass
        try:
            self.powerType.setText(str(self.data_dict[text].laserPowerType))          
        except ValueError:
            pass
        try:
            self.powerValue.setText(str(self.data_dict[text].laserPower))          
        except ValueError:
            pass
        try:
            self.columnEdit.setValue(int(self.data_dict[text].deviceCol))          
        except ValueError:
            pass
        try:
            ind = self.deviceType.findText(str(self.data_dict[text].deviceType).strip())        
            self.deviceType.setCurrentIndex(ind)          
        except ValueError:
            pass           
        self.activefig=fig
        self.activeDataSet=self.data_dict[text]

    def addmpl(self, fig):
        self.canvas = FigureCanvas(fig)
#.........这里部分代码省略.........
开发者ID:davidmiller3,项目名称:plotterGUI,代码行数:103,代码来源:custommpl.py


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