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


Python NavigationToolbar2QT.setFixedHeight方法代码示例

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


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

示例1: smileiQtPlot

# 需要导入模块: from matplotlib.backends.backend_qt4agg import NavigationToolbar2QT [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.NavigationToolbar2QT import setFixedHeight [as 别名]
class smileiQtPlot(QWidget):
    scalarDict=dict()
    fieldDict=dict()
    phaseDict=dict()
    nplots=0
    ax={}
    dirName='.'
    someCheckBoxChanged=True
    pauseSignal=pyqtSignal()
    shiftPressed=False
    title=''
    
    def __init__(self,parent,dirName):
        super(smileiQtPlot, self).__init__()   
        self.setParent(parent)
        uiFile=os.path.dirname(os.path.realpath(__file__))+'/smileiQtPlot.ui'
        self.ui=uic.loadUi(uiFile,self)
        
        self.dirName=dirName
        self.smilei=Smilei(self.dirName)
        
        self.parent=parent

        self.parent.timer.timeout.connect(self.next)
        self.parent.ui.next.released.connect(self.next)
        self.parent.ui.previous.released.connect(self.previous)
        self.parent.ui.first.released.connect(self.first)
        self.parent.ui.last.released.connect(self.last)
        
        self.pauseSignal.connect(self.parent.pause)

        self.setWindowFlags(Qt.Window)
        self.setWindowTitle(dirName)

        self.step=0
        
        self.ui.savePoints.setIcon(self.ui.style().standardIcon(QStyle.SP_DialogSaveButton))
        self.ui.savePoints.released.connect(self.doSavePoints)
                
        self.ui.tabWidget.currentChanged.connect(self.changeTab)
        self.ui.autoScale.stateChanged.connect(self.doPlots)
        
        self.fig = Figure()
        
        self.ui.reload.setIcon(self.ui.style().standardIcon(QStyle.SP_BrowserReload))
        self.ui.reload.released.connect(self.reloadAll)

        
        self.canvas = FigureCanvas(self.fig)
        self.canvas.setFocusPolicy(Qt.StrongFocus)
        self.canvas.setFocus()
        self.canvas.mpl_connect('motion_notify_event', self.on_movement)
        self.canvas.mpl_connect('key_press_event', self.on_key_press)
        self.canvas.mpl_connect('key_release_event', self.on_key_release)
        self.canvas.mpl_connect('button_press_event', self.on_button_press)
        
        self.toolbar = NavigationToolbar(self.canvas, self)
        self.toolbar.setFixedHeight(18)
        self.canvas.setCursor(Qt.CrossCursor)

        self.ui.plotLayout.addWidget(self.toolbar)
        self.ui.plotLayout.addWidget(self.canvas)

#retrieve stuff from namelist
        self.cell_length=self.smilei.namelist.Main.cell_length[0]
        self.timestep=self.smilei.namelist.Main.timestep
        self.sim_length=self.smilei.namelist.Main.sim_length

#scalars
        scalarSteps=[]
        for scalar in self.smilei.Scalar().getScalars():
            if len(scalarSteps) ==0:
                scalarSteps=self.smilei.Scalar(scalar).getAvailableTimesteps()
            else:
                if not np.array_equal(scalarSteps,self.smilei.Scalar(scalar).getAvailableTimesteps()):
                    log.error("Problem reading scalarSteps %s"%scalar)
            my_button= QCheckBox(scalar)
            my_button.stateChanged.connect(self.checkBoxChanged)
            self.ui.layoutScalars.addWidget(my_button)
            
        self.ui.layoutScalars.addStretch()

#fields
        self.fieldSteps=self.smilei.Field().getAvailableTimesteps()
        if not np.array_equal(scalarSteps,self.fieldSteps): 
            newfieldSteps=[]
            for i in range(0,min(len(scalarSteps),len(self.fieldSteps))):
                if scalarSteps[i] == self.fieldSteps[i]:
                    newfieldSteps.append(scalarSteps[i])
                else:
                    break
            self.fieldSteps=newfieldSteps
            log.warning("Problem reading fieldSteps")
        for field in self.smilei.Field().getFields():
            my_button= QCheckBox(field)
            my_button.stateChanged.connect(self.checkBoxChanged)
            self.ui.layoutFields.addWidget(my_button)

        self.ui.layoutFields.addStretch()

#.........这里部分代码省略.........
开发者ID:iltommi,项目名称:TPUPMC,代码行数:103,代码来源:smileiQt.py

示例2: smileiQtPlot

# 需要导入模块: from matplotlib.backends.backend_qt4agg import NavigationToolbar2QT [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.NavigationToolbar2QT import setFixedHeight [as 别名]
class smileiQtPlot(QWidget):
    scalarDict=dict()
    fieldDict=dict()
    phaseDict=dict()
    fieldFile=None
    phaseFile=None
    nplots=0
    ax={}
    dirName=None
    someCheckBoxChanged=True
    pauseSignal=pyqtSignal()
    shiftPressed=False
    title=''
    
    def __init__(self,parent,dirName):
        super(smileiQtPlot, self).__init__()   
        self.setParent(parent)
        uiFile=os.path.dirname(os.path.realpath(__file__))+'/smileiQtPlot.ui'
        self.ui=uic.loadUi(uiFile,self)
        
        self.dirName=dirName
        self.parent=parent

        self.parent.timer.timeout.connect(self.next)
        self.parent.ui.next.released.connect(self.next)
        self.parent.ui.previous.released.connect(self.previous)
        self.parent.ui.first.released.connect(self.first)
        self.parent.ui.last.released.connect(self.last)
        
        self.pauseSignal.connect(self.parent.pause)

        self.setWindowFlags(Qt.Window)
        self.setWindowTitle(dirName)

        self.step=0
        
        self.ui.savePoints.setIcon(self.ui.style().standardIcon(QStyle.SP_DialogSaveButton))
        self.ui.savePoints.released.connect(self.doSavePoints)
                
        self.ui.tabWidget.currentChanged.connect(self.changeTab)
        self.ui.autoScale.stateChanged.connect(self.doPlots)
        
        self.fig = Figure()
        
        self.ui.reload.setIcon(self.ui.style().standardIcon(QStyle.SP_BrowserReload))
        self.ui.reload.released.connect(self.reloadAll)

        
        self.canvas = FigureCanvas(self.fig)
        self.canvas.setFocusPolicy(Qt.StrongFocus)
        self.canvas.setFocus()
        self.canvas.mpl_connect('motion_notify_event', self.on_movement)
        self.canvas.mpl_connect('key_press_event', self.on_key_press)
        self.canvas.mpl_connect('key_release_event', self.on_key_release)
        self.canvas.mpl_connect('button_press_event', self.on_button_press)

        self.toolbar = NavigationToolbar(self.canvas, self)
        self.toolbar.setFixedHeight(18)
        self.canvas.setCursor(Qt.CrossCursor)

        self.ui.plotLayout.addWidget(self.canvas)
        self.ui.plotLayout.addWidget(self.toolbar)

        fname=os.path.join(dirName, "scalars.txt")
        if os.path.isfile(fname) :
            self.scalarData = np.loadtxt(fname)
            names=[]
            for line in open(fname):
                li=line.strip()
                if li.startswith("#"):
                    list=line.split()
                    names.append(list[-1])
       
            scalars_names=names[1:-2]
            for i in range(len(scalars_names)):
                my_button= QCheckBox(scalars_names[i])
                my_button.stateChanged.connect(self.checkBoxChanged)

                self.ui.layoutScalars.addWidget(my_button)
                
            self.ui.layoutScalars.addStretch()
        else :
            print "Problem reading ",fname
#             self.deleteLater()

        self.fieldSteps=[]
        fname=os.path.join(dirName, "Fields.h5")
        if os.path.isfile(fname) :

            self.fieldFile=tb.openFile(fname)
            self.cell_length=self.fieldFile.root._v_attrs.cell_length[0]
            self.res_time=self.fieldFile.root._v_attrs.res_time
            self.sim_length=self.fieldFile.root._v_attrs.sim_length
            # JDT self.fieldEvery=self.fieldFile.root._v_attrs.every
            
            first=True
            for group in self.fieldFile.listNodes("/", classname='Group'):
                self.fieldSteps.append(group._v_name)
                if first:
                    first=False
#.........这里部分代码省略.........
开发者ID:auterpe,项目名称:Smilei,代码行数:103,代码来源:smileiQt.py


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