本文整理汇总了Python中matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg.setFixedSize方法的典型用法代码示例。如果您正苦于以下问题:Python FigureCanvasQTAgg.setFixedSize方法的具体用法?Python FigureCanvasQTAgg.setFixedSize怎么用?Python FigureCanvasQTAgg.setFixedSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg
的用法示例。
在下文中一共展示了FigureCanvasQTAgg.setFixedSize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg import setFixedSize [as 别名]
def __init__(self, streamline, parent=None, width=5, height=4, dpi=50, subs=1):
self.fig = Figure(figsize=(width - 50, height), dpi=dpi)
pos = 0
self.sl = streamline
self.subs = subs
self.cpunum = self.sl.mDevice.cpu_num
self.gpu_pos = 0
self.fps_pos = 0
self.temp_pos = 0
self.axes = []
for i in range(self.cpunum):
self.axes.append(self.fig.add_subplot(self.subs, 1, i + 1)) # For CPU CORES
# We want the axes cleared every time plot() is called
self.axes[i].set_title("CPU" + str(i))
# self.axes[i].set_xticks([]) # not show x
self.axes[i].set_xlim(0, 20000)
self.axes[i].set_ylim(0, 2500)
if self.sl.mDevice.show_gpu == 1:
self.gpu_pos = pos
self.axes.append(self.fig.add_subplot(self.subs, 1, self.cpunum + pos + 1)) # FOR GPU
self.axes[self.cpunum + self.gpu_pos].set_title("GPU")
self.axes[self.cpunum + self.gpu_pos].set_xlim(0, 20000)
self.axes[self.cpunum + self.gpu_pos].set_ylim(0, 850)
pos += 1
if self.sl.mDevice.show_fps == 1:
self.fps_pos = pos
self.axes.append(self.fig.add_subplot(self.subs, 1, self.cpunum + self.fps_pos + 1)) # FOR FPS
self.axes[self.cpunum + self.fps_pos].set_title("FPS")
self.axes[self.cpunum + self.fps_pos].set_xlim(0, 20000)
self.axes[self.cpunum + self.fps_pos].set_ylim(0, 100)
pos += 1
if self.sl.mDevice.show_temp == 1:
self.temp_pos = pos
self.axes.append(self.fig.add_subplot(self.subs, 1, self.cpunum + self.temp_pos + 1)) # FOR CPU TEMP
self.axes[self.cpunum + self.temp_pos].set_title("CPU Temperature")
self.axes[self.cpunum + self.temp_pos].set_xlim(0, 20000)
self.axes[self.cpunum + self.temp_pos].set_ylim(0, 100)
self.axes.append(self.fig.add_subplot(self.subs, 1, self.cpunum + self.temp_pos + 2)) # FOR BOARD TEMP
self.axes[self.cpunum + self.temp_pos + 1].set_title("Board Temperature")
self.axes[self.cpunum + self.temp_pos + 1].set_xlim(0, 20000)
self.axes[self.cpunum + self.temp_pos + 1].set_ylim(0, 100)
self.fig.set_tight_layout(True)
self.compute_initial_figure()
FigureCanvas.__init__(self, self.fig)
self.setParent(parent)
FigureCanvas.setFixedSize(self, width - 50, subs * 100)
FigureCanvas.setSizePolicy(self, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
FigureCanvas.updateGeometry(self)
示例2: _create_plot
# 需要导入模块: from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg import setFixedSize [as 别名]
def _create_plot(self):
dpi = plt.rcParams['figure.dpi']
figsize = (self._plot_width / dpi, self._plot_height / dpi)
figure = plt.figure(frameon=False, figsize=figsize)
axes = figure.add_subplot(111)
canvas = FigureCanvas(figure)
canvas.setFocusPolicy(QtCore.Qt.ClickFocus)
canvas.setFixedSize(self._plot_width, self._plot_height)
canvas.setStyleSheet("background: transparent")
return axes, canvas
示例3: GUI
# 需要导入模块: from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg import setFixedSize [as 别名]
class GUI(QtGui.QWidget):
def __init__(self):
super(GUI, self).__init__()
self.setWindowTitle( 'AP-DV Analaysis' )
self.lbltxt = '"wheel" press: change side, currently %s\n"i" or "u" press: change cell sides'
self.initUI()
#-----------------------------------------------------------------------------------------------
# INITIALIZATION OF THE WINDOW - DEFINE AND PLACE ALL THE WIDGETS
#-----------------------------------------------------------------------------------------------
def initUI(self):
# SET THE GEOMETRY
mainWindow = QtGui.QVBoxLayout()
mainWindow.setSpacing(15)
fileBox = QtGui.QHBoxLayout()
spaceBox1 = QtGui.QHBoxLayout()
rawDataBox = QtGui.QHBoxLayout()
mainWindow.addLayout(fileBox)
mainWindow.addLayout(spaceBox1)
mainWindow.addLayout(rawDataBox)
Col1 = QtGui.QGridLayout()
Col2 = QtGui.QHBoxLayout()
rawDataBox.addLayout(Col1)
rawDataBox.addLayout(Col2)
self.setLayout(mainWindow)
# DEFINE ALL WIDGETS AND BUTTONS
loadBtn = QtGui.QPushButton('Load DataSet')
saveBtn = QtGui.QPushButton('Save data (F12)')
tpLbl = QtGui.QLabel('Relative Tp:')
fNameLbl = QtGui.QLabel('File name:')
self.tp = QtGui.QSpinBox(self)
self.tp.setValue(0)
self.tp.setMinimum(-100000)
self.tp.setMaximum(100000)
self.fName = QtGui.QLabel('')
self._488nmBtn = QtGui.QRadioButton('488nm')
self._561nmBtn = QtGui.QRadioButton('561nm')
self.CoolLEDBtn = QtGui.QRadioButton('CoolLED')
self.sld1 = QtGui.QSlider(QtCore.Qt.Vertical, self)
self.sld1.setMaximum(2**16-1)
self.sld1.setValue(0)
self.sld2 = QtGui.QSlider(QtCore.Qt.Vertical, self)
self.sld2.setMaximum(2**16)
self.sld2.setValue(2**16-1)
self.fig1 = Figure((8.0, 8.0), dpi=100)
self.fig1.subplots_adjust(left=0., right=1., top=1., bottom=0.)
self.ax1 = self.fig1.add_subplot(111)
self.canvas1 = FigureCanvas(self.fig1)
self.canvas1.setFocusPolicy( QtCore.Qt.ClickFocus )
self.canvas1.setFocus()
self.canvas1.setFixedSize(QtCore.QSize(600,600))
self.canvas1.setSizePolicy( QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding )
# PLACE ALL THE WIDGET ACCORDING TO THE GRIDS
fileBox.addWidget(loadBtn)
fileBox.addWidget(saveBtn)
spaceBox1.addWidget(self.HLine())
Col1.addWidget(tpLbl, 0, 0)#, 1, 1, Qt.AlignTop)
Col1.addWidget(self.tp, 0, 1)#, 1, 1, Qt.AlignTop)
Col1.addWidget(fNameLbl, 1, 0)#, 1, 1, Qt.AlignTop)
Col1.addWidget(self.fName, 1, 1)#, 1, 1, Qt.AlignTop)
Col1.addWidget(self._488nmBtn, 2, 0 )
Col1.addWidget(self._561nmBtn, 3, 0 )
Col1.addWidget(self.CoolLEDBtn, 4, 0 )
Col2.addWidget(self.sld1)
Col2.addWidget(self.sld2)
Col2.addWidget(self.canvas1)
self.setFocus()
self.show()
# BIND BUTTONS TO FUNCTIONS
loadBtn.clicked.connect(self.selectWorm)
saveBtn.clicked.connect(self.saveData)
self.tp.valueChanged.connect(self.updateAllCanvas)
#.........这里部分代码省略.........
示例4: GUI
# 需要导入模块: from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg import setFixedSize [as 别名]
class GUI(QtGui.QWidget):
def __init__(self):
super(GUI, self).__init__()
self.setWindowTitle( 'Outline Cells' )
self.cellNames = ['1.p','4.a','1.pp','4.aa','1.ppa','1.ppp','4.aaa','4.aap','b_1','b_4']
self.initUI()
#-----------------------------------------------------------------------------------------------
# INITIALIZATION OF THE WINDOW - DEFINE AND PLACE ALL THE WIDGETS
#-----------------------------------------------------------------------------------------------
def initUI(self):
# SET THE GEOMETRY
mainWindow = QtGui.QVBoxLayout()
mainWindow.setSpacing(15)
fileBox = QtGui.QHBoxLayout()
spaceBox1 = QtGui.QHBoxLayout()
rawDataBox = QtGui.QHBoxLayout()
mainWindow.addLayout(fileBox)
mainWindow.addLayout(spaceBox1)
mainWindow.addLayout(rawDataBox)
Col1 = QtGui.QGridLayout()
Col2 = QtGui.QHBoxLayout()
Col3 = QtGui.QVBoxLayout()
rawDataBox.addLayout(Col1)
rawDataBox.addLayout(Col2)
rawDataBox.addLayout(Col3)
self.setLayout(mainWindow)
# DEFINE ALL WIDGETS AND BUTTONS
loadBtn = QtGui.QPushButton('Load DataSet')
saveBtn = QtGui.QPushButton('Save data (F12)')
tpLbl = QtGui.QLabel('Relative Tp:')
slLbl = QtGui.QLabel('Slice:')
fNameLbl = QtGui.QLabel('File name:')
self.tp = QtGui.QSpinBox(self)
self.tp.setValue(-5)
self.tp.setMaximum(100000)
self.sl = QtGui.QSpinBox(self)
self.sl.setValue(0)
self.sl.setMaximum(100000)
self.fName = QtGui.QLabel('')
self._488nmBtn = QtGui.QRadioButton('488nm')
self._561nmBtn = QtGui.QRadioButton('561nm')
self.CoolLEDBtn = QtGui.QRadioButton('CoolLED')
self.sld1 = QtGui.QSlider(QtCore.Qt.Vertical, self)
self.sld1.setMaximum(2**16-1)
self.sld1.setValue(0)
self.sld2 = QtGui.QSlider(QtCore.Qt.Vertical, self)
self.sld2.setMaximum(2**16)
self.sld2.setValue(2**16-1)
self.fig1 = Figure((8.0, 8.0), dpi=100)
self.fig1.subplots_adjust(left=0., right=1., top=1., bottom=0.)
self.ax1 = self.fig1.add_subplot(111)
self.canvas1 = FigureCanvas(self.fig1)
self.canvas1.setFocusPolicy( QtCore.Qt.ClickFocus )
self.canvas1.setFocus()
self.canvas1.setFixedSize(QtCore.QSize(600,600))
self.canvas1.setSizePolicy( QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding )
self.cellTbl = QtGui.QTableWidget()
self.fig2 = Figure((4.0, 4.0), dpi=100)
self.fig2.subplots_adjust(left=0., right=1., top=1., bottom=0.)
self.ax2 = self.fig2.add_subplot(111)
self.canvas2 = FigureCanvas(self.fig2)
self.canvas2.setFixedSize(QtCore.QSize(300,300))
self.canvas2.setSizePolicy( QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding )
# PLACE ALL THE WIDGET ACCORDING TO THE GRIDS
fileBox.addWidget(loadBtn)
fileBox.addWidget(saveBtn)
spaceBox1.addWidget(self.HLine())
Col1.addWidget(tpLbl, 0, 0)#, 1, 1, Qt.AlignTop)
Col1.addWidget(self.tp, 0, 1)#, 1, 1, Qt.AlignTop)
Col1.addWidget(slLbl, 1, 0)#, 1, 1, Qt.AlignTop)
Col1.addWidget(self.sl, 1, 1)#, 1, 1, Qt.AlignTop)
Col1.addWidget(fNameLbl, 2, 0)
Col1.addWidget(self.fName, 2, 1)
Col1.addWidget(self._488nmBtn, 3, 0 )
#.........这里部分代码省略.........
示例5: GUI
# 需要导入模块: from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg import setFixedSize [as 别名]
class GUI(QtGui.QWidget):
def __init__(self):
super(GUI, self).__init__()
self.setWindowTitle( 'Label Cells' )
self.cellNames = ['1.p','4.a','1.pp','4.aa','1.ppa','1.ppp','4.aaa','4.aap','b_1','b_4']
self.initUI()
#-----------------------------------------------------------------------------------------------
# INITIALIZATION OF THE WINDOW - DEFINE AND PLACE ALL THE WIDGETS
#-----------------------------------------------------------------------------------------------
def initUI(self):
# SET THE GEOMETRY
mainWindow = QtGui.QVBoxLayout()
mainWindow.setSpacing(15)
fileBox = QtGui.QHBoxLayout()
spaceBox1 = QtGui.QHBoxLayout()
rawDataBox = QtGui.QHBoxLayout()
mainWindow.addLayout(fileBox)
mainWindow.addLayout(spaceBox1)
mainWindow.addLayout(rawDataBox)
Col1 = QtGui.QGridLayout()
Col2 = QtGui.QHBoxLayout()
Col3 = QtGui.QVBoxLayout()
rawDataBox.addLayout(Col1)
rawDataBox.addLayout(Col2)
rawDataBox.addLayout(Col3)
self.setLayout(mainWindow)
# DEFINE ALL WIDGETS AND BUTTONS
loadBtn = QtGui.QPushButton('Load DataSet')
saveBtn = QtGui.QPushButton('Save data (F12)')
tpLbl = QtGui.QLabel('Relative Tp:')
slLbl = QtGui.QLabel('Slice:')
fNameLbl = QtGui.QLabel('File name:')
self.tp = QtGui.QSpinBox(self)
self.tp.setValue(0)
self.tp.setMaximum(100000)
self.sl = QtGui.QSpinBox(self)
self.sl.setValue(0)
self.sl.setMaximum(100000)
self.fName = QtGui.QLabel('')
self._488nmBtn = QtGui.QRadioButton('488nm')
self._561nmBtn = QtGui.QRadioButton('561nm')
self.CoolLEDBtn = QtGui.QRadioButton('CoolLED')
self.sld1 = QtGui.QSlider(QtCore.Qt.Vertical, self)
self.sld1.setMaximum(2**16-1)
self.sld1.setValue(0)
self.sld2 = QtGui.QSlider(QtCore.Qt.Vertical, self)
self.sld2.setMaximum(2**16)
self.sld2.setValue(2**16-1)
self.fig1 = Figure((8.0, 8.0), dpi=100)
self.fig1.subplots_adjust(left=0., right=1., top=1., bottom=0.)
self.ax1 = self.fig1.add_subplot(111)
self.canvas1 = FigureCanvas(self.fig1)
self.canvas1.setFocusPolicy( QtCore.Qt.ClickFocus )
self.canvas1.setFocus()
self.canvas1.setFixedSize(QtCore.QSize(600,600))
self.canvas1.setSizePolicy( QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding )
self.cellTbl = QtGui.QTableWidget()
self.fig2 = Figure((4.0, 4.0), dpi=100)
self.fig2.subplots_adjust(left=0., right=1., top=1., bottom=0.)
self.ax2 = self.fig2.add_subplot(111)
self.canvas2 = FigureCanvas(self.fig2)
self.canvas2.setFixedSize(QtCore.QSize(300,300))
self.canvas2.setSizePolicy( QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding )
# PLACE ALL THE WIDGET ACCORDING TO THE GRIDS
fileBox.addWidget(loadBtn)
fileBox.addWidget(saveBtn)
spaceBox1.addWidget(self.HLine())
Col1.addWidget(tpLbl, 0, 0)#, 1, 1, Qt.AlignTop)
Col1.addWidget(self.tp, 0, 1)#, 1, 1, Qt.AlignTop)
Col1.addWidget(slLbl, 1, 0)#, 1, 1, Qt.AlignTop)
Col1.addWidget(self.sl, 1, 1)#, 1, 1, Qt.AlignTop)
Col1.addWidget(fNameLbl, 2, 0)
Col1.addWidget(self.fName, 2, 1)
#.........这里部分代码省略.........
示例6: Data_Visualization_GUI
# 需要导入模块: from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg import setFixedSize [as 别名]
class Data_Visualization_GUI(object):
def __init__(self,Data_Visualization):
object.__init__(self)
Data_Visualization.resize(1000,650)
Data_Visualization.setWindowTitle("Didi's Data Visualizer")
self.mainLayout = QtGui.QGridLayout(Data_Visualization)
self.mainLayout.setSpacing(5)
self.trackingPlotWidget = QtGui.QWidget()
self.fig = pylab.figure()
self.axes = pylab.Axes(self.fig, [.1,.1,.8,.8])
self.fig.add_axes(self.axes)
self.plot, = pylab.plot([0],[0],'ro')
self.axes.set_xlim(-5, 5)
self.axes.set_ylim(-5, 5)
self.plotTitle = pylab.title('Tracking Data')
self.plotxLabel = pylab.xlabel('X')
self.plotyLabel = pylab.ylabel('Z')
self.canvas = FigureCanvas(self.fig)
self.canvas.setParent(self.trackingPlotWidget)
self.canvas.setFixedSize(400,400)
self.mpl_toolbar = NavigationToolbar(self.canvas, self.trackingPlotWidget)
##
##
## self.XYZPlotWidget = QtGui.QWidget()
## pylab.subplot(311)
## self.fig2 = pylab.figure()
## self.axes2 = pylab.Axes(self.fig2, [.1,.1,.8,.8])
## self.fig2.add_axes(self.axes2)
## self.plot2 = pylab.plot([0],[0],'r', [0],[0],'g', [0],[0],'b')
## self.axes2.set_xlim(-200, 0)
## self.axes2.set_ylim(-5, 5)
## pylab.legend([self.plot2[0], self.plot2[1], self.plot2[2]], ["X", "Y", "Z"], loc=3)
## self.plotxLabel2 = pylab.xlabel('Time')
## self.plotyLabel2 = pylab.ylabel('XYZ')
## self.canvas2 = FigureCanvas(self.fig2)
## self.canvas2.setParent(self.XYZPlotWidget)
## self.canvas2.setFixedSize(500,150)
##
## pylab.subplot(312)
## self.fig3 = pylab.figure()
## self.axes3 = pylab.Axes(self.fig3, [.1,.1,.8,.8])
## self.fig3.add_axes(self.axes3)
## self.plot3 = pylab.plot([0],[0],'g', [0],[0],'r')
## self.axes3.set_xlim(-200, 0)
## self.axes3.set_ylim(-12, 12)
## pylab.legend([self.plot3[0], self.plot3[1]], ["Pitch", "Roll"], loc=3)
## self.plotxLabel3 = pylab.xlabel('Time')
## self.plotyLabel3 = pylab.ylabel('PR')
## self.canvas3 = FigureCanvas(self.fig3)
## self.canvas3.setParent(self.XYZPlotWidget)
## self.canvas3.setFixedSize(500,150)
##
## pylab.subplot(313)
## self.fig4 = pylab.figure()
## self.axes4 = pylab.Axes(self.fig4, [.1,.1,.8,.8])
## self.fig4.add_axes(self.axes4)
## self.plot4 = pylab.plot([0],[0],'r', [0],[0],'g', [0],[0],'b', [0],[0],'y')
## pylab.legend([self.plot4[0], self.plot4[1], self.plot4[2], self.plot4[3]], ["w1", "w2", "w3", "w4"], loc=3)
## self.axes4.set_xlim(-200, 0)
## self.axes4.set_ylim(-0.5, 0.5)
## self.plotxLabel4 = pylab.xlabel('Time')
## self.plotyLabel4 = pylab.ylabel('WWWW')
## self.canvas4 = FigureCanvas(self.fig4)
## self.canvas4.setParent(self.XYZPlotWidget)
## self.canvas4.setFixedSize(500,150)
self.XYZPlotWidget = QtGui.QWidget()
self.fig2 = pylab.figure()
self.axes2 = pylab.Axes(self.fig2, [.1,.1,.8,.8])
self.fig2.add_axes(self.axes2)
self.plot2 = pylab.plot([0],[0],'r', [0],[0],'g', [0],[0],'b')
self.axes2.set_xlim(-200, 0)
self.axes2.set_ylim(-5, 5)
pylab.legend([self.plot2[0], self.plot2[1], self.plot2[2]], ["X", "Y", "Z"], loc=3)
# self.plotTitle2 = pylab.title('XYZ Data')
self.plotxLabel2 = pylab.xlabel('Time')
self.plotyLabel2 = pylab.ylabel('XYZ')
self.canvas2 = FigureCanvas(self.fig2)
self.canvas2.setParent(self.XYZPlotWidget)
self.canvas2.setFixedSize(500,150)
self.PRPlotWidget = QtGui.QWidget()
self.fig3 = pylab.figure()
self.axes3 = pylab.Axes(self.fig3, [.1,.1,.8,.8])
self.fig3.add_axes(self.axes3)
self.plot3 = pylab.plot([0],[0],'g', [0],[0],'r')
self.axes3.set_xlim(-200, 0)
self.axes3.set_ylim(-12, 12)
pylab.legend([self.plot3[0], self.plot3[1]], ["Pitch", "Roll"], loc=3)
# self.plotTitle3 = pylab.title('Pitch/Roll Data')
self.plotxLabel3 = pylab.xlabel('Time')
self.plotyLabel3 = pylab.ylabel('PR')
self.canvas3 = FigureCanvas(self.fig3)
self.canvas3.setParent(self.PRPlotWidget)
self.canvas3.setFixedSize(500,150)
#.........这里部分代码省略.........
示例7: GUI
# 需要导入模块: from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg import setFixedSize [as 别名]
class GUI(QtGui.QWidget):
def __init__(self):
super(GUI, self).__init__()
self.setWindowTitle( 'Compute Cell Fluorescence' )
self.cellNames = ['1.p','4.a','1.pp','4.aa','1.ppa','1.ppp','4.aaa','4.aap','b_1','b_4']
self.imgpxl = 80
self.initUI()
#-----------------------------------------------------------------------------------------------
# INITIALIZATION OF THE WINDOW - DEFINE AND PLACE ALL THE WIDGETS
#-----------------------------------------------------------------------------------------------
def initUI(self):
# SET THE GEOMETRY
mainWindow = QtGui.QVBoxLayout()
mainWindow.setSpacing(15)
fileBox = QtGui.QHBoxLayout()
spaceBox1 = QtGui.QHBoxLayout()
rawDataBox = QtGui.QHBoxLayout()
mainWindow.addLayout(fileBox)
mainWindow.addLayout(spaceBox1)
mainWindow.addLayout(rawDataBox)
Col1 = QtGui.QGridLayout()
Col2 = QtGui.QHBoxLayout()
Col3 = QtGui.QVBoxLayout()
rawDataBox.addLayout(Col1)
rawDataBox.addLayout(Col2)
rawDataBox.addLayout(Col3)
self.setLayout(mainWindow)
# DEFINE ALL WIDGETS AND BUTTONS
loadBtn = QtGui.QPushButton('Load DataSet')
computeBtn = QtGui.QPushButton('Compute current image')
computeBtn.setFixedWidth(200)
self.computeAllBtn = QtGui.QPushButton('Compute %s signal for all the images' %'???')
self.computeAllBtn.setFixedWidth(200)
saveBtn = QtGui.QPushButton('Save data (F12)')
tpLbl = QtGui.QLabel('Relative Tp:')
slLbl = QtGui.QLabel('Slice:')
fNameLbl = QtGui.QLabel('File name:')
gridLbl = QtGui.QLabel('Grid size:')
self.tp = QtGui.QSpinBox(self)
self.tp.setValue(-5)
self.tp.setMaximum(100000)
self.sl = QtGui.QSpinBox(self)
self.sl.setValue(0)
self.sl.setMaximum(100000)
self.gridsize = QtGui.QSpinBox(self)
self.gridsize.setValue(5)
self.gridsize.setMaximum(20)
self.fName = QtGui.QLabel('')
self._488nmBtn = QtGui.QRadioButton('488nm')
self._561nmBtn = QtGui.QRadioButton('561nm')
self.CoolLEDBtn = QtGui.QRadioButton('CoolLED')
self.sld1 = QtGui.QSlider(QtCore.Qt.Vertical, self)
self.sld1.setMaximum(2**16-1)
self.sld1.setValue(0)
self.sld2 = QtGui.QSlider(QtCore.Qt.Vertical, self)
self.sld2.setMaximum(2**16)
self.sld2.setValue(2**16-1)
self.fig1 = Figure((8.0, 8.0), dpi=100)
self.fig1.subplots_adjust(left=0., right=1., top=1., bottom=0.)
self.ax1 = self.fig1.add_subplot(111)
self.canvas1 = FigureCanvas(self.fig1)
self.canvas1.setFocusPolicy( QtCore.Qt.ClickFocus )
self.canvas1.setFocus()
self.canvas1.setFixedSize(QtCore.QSize(600,600))
self.canvas1.setSizePolicy( QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding )
self.fig2 = Figure((4.0, 4.0), dpi=100)
self.fig2.subplots_adjust(left=0., right=1., top=1., bottom=0.)
self.ax2 = self.fig2.add_subplot(111)
self.canvas2 = FigureCanvas(self.fig2)
self.canvas2.setFixedSize(QtCore.QSize(300,300))
self.canvas2.setSizePolicy( QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding )
# PLACE ALL THE WIDGET ACCORDING TO THE GRIDS
fileBox.addWidget(loadBtn)
fileBox.addWidget(saveBtn)
spaceBox1.addWidget(self.HLine())
#.........这里部分代码省略.........
示例8: GUI
# 需要导入模块: from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg import setFixedSize [as 别名]
class GUI(QtGui.QWidget):
def __init__(self):
super(GUI, self).__init__()
self.setWindowTitle( 'Outline Cells' )
self.cellNames = ['1.p','4.a','1.pp','4.aa','1.ppa','1.ppp','4.aaa','4.aap','b_1','b_4']
self.initUI()
#-----------------------------------------------------------------------------------------------
# INITIALIZATION OF THE WINDOW - DEFINE AND PLACE ALL THE WIDGETS
#-----------------------------------------------------------------------------------------------
def initUI(self):
# SET THE GEOMETRY
mainWindow = QtGui.QVBoxLayout()
mainWindow.setSpacing(15)
fileBox = QtGui.QHBoxLayout()
spaceBox1 = QtGui.QHBoxLayout()
rawDataBox = QtGui.QHBoxLayout()
mainWindow.addLayout(fileBox)
mainWindow.addLayout(spaceBox1)
mainWindow.addLayout(rawDataBox)
Col1 = QtGui.QGridLayout()
Col2 = QtGui.QHBoxLayout()
Col3 = QtGui.QVBoxLayout()
rawDataBox.addLayout(Col1)
rawDataBox.addLayout(Col2)
rawDataBox.addLayout(Col3)
self.setLayout(mainWindow)
# DEFINE ALL WIDGETS AND BUTTONS
loadBtn = QtGui.QPushButton('Load DataSet')
saveBtn = QtGui.QPushButton('Save data (F12)')
tpLbl = QtGui.QLabel('Relative Tp:')
slLbl = QtGui.QLabel('Slice:')
fNameLbl = QtGui.QLabel('File name:')
zoomLbl = QtGui.QLabel('Zoom (imgPxl):')
self.tp = QtGui.QSpinBox(self)
self.tp.setValue(-5)
self.tp.setMaximum(100000)
self.sl = QtGui.QSpinBox(self)
self.sl.setValue(0)
self.sl.setMaximum(100000)
self.fName = QtGui.QLabel('')
self.zoom = QtGui.QSpinBox(self)
self.zoom.setValue(50)
self.zoom.setMinimum(10)
self.zoom.setMaximum(150)
self.zoom.setSingleStep(10)
self._488nmBtn = QtGui.QRadioButton('488nm')
self._561nmBtn = QtGui.QRadioButton('561nm')
self.CoolLEDBtn = QtGui.QRadioButton('CoolLED')
self.sld1 = QtGui.QSlider(QtCore.Qt.Vertical, self)
self.sld1.setMaximum(2**16-1)
self.sld1.setValue(0)
self.sld2 = QtGui.QSlider(QtCore.Qt.Vertical, self)
self.sld2.setMaximum(2**16)
self.sld2.setValue(2**16-1)
self.fig1 = Figure((8.0, 8.0), dpi=100)
self.fig1.subplots_adjust(left=0., right=1., top=1., bottom=0.)
self.ax1 = self.fig1.add_subplot(111)
self.canvas1 = FigureCanvas(self.fig1)
self.canvas1.setFocusPolicy( QtCore.Qt.ClickFocus )
self.canvas1.setFocus()
self.canvas1.setFixedSize(QtCore.QSize(600,600))
self.canvas1.setSizePolicy( QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding )
self.fig2 = Figure((4.0, 4.0), dpi=100)
self.fig2.subplots_adjust(left=0., right=1., top=1., bottom=0.)
self.ax2 = self.fig2.add_subplot(111)
self.canvas2 = FigureCanvas(self.fig2)
self.canvas2.setFixedSize(QtCore.QSize(300,300))
self.canvas2.setSizePolicy( QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding )
# PLACE ALL THE WIDGET ACCORDING TO THE GRIDS
fileBox.addWidget(loadBtn)
fileBox.addWidget(saveBtn)
spaceBox1.addWidget(self.HLine())
Col1.addWidget(tpLbl, 0, 0)#, 1, 1, Qt.AlignTop)
Col1.addWidget(self.tp, 0, 1)#, 1, 1, Qt.AlignTop)
#.........这里部分代码省略.........
示例9: plot_data
# 需要导入模块: from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg import setFixedSize [as 别名]
#.........这里部分代码省略.........
if prev_year == cur_year and prev_month == cur_month:
# We can guarantee that we have consumed cur_index - prev_index
# on this month;
interpolated_consumptions[-1] = (cur_year, cur_month, cur_day, prev_cons + (cur_index - prev_index), cur_index)
elif prev_year == cur_year:
# and prev_month != cur_month
#print("Last entry : %i - %i - %i" % (prev_year, prev_month, prev_day))
tot_cons = cur_index - prev_index
tot_days = 0
nb_days = []
# For the first month
nb_days.append((prev_year, prev_month, nb_days_in_month(prev_year, prev_month) - prev_day))
tot_days += nb_days_in_month(prev_year, prev_month) - prev_day
# For the months in between
for m in range(prev_month+1, cur_month):
days = nb_days_in_month(prev_year, m)
nb_days.append((prev_year, m, days))
tot_days += days
# For the last month
tot_days += cur_day
nb_days.append((prev_year, cur_month, cur_day))
#print(nb_days)
#print(" A total of %i days" % tot_days)
# We can now provide the interpolated values for interpolated_consumptions
# The last entry has to be modified to close the month
interpolated_consumptions[-1] = (prev_year, prev_month, nb_days_in_month(prev_year, prev_month), prev_cons + float(nb_days[0][2])/tot_days * tot_cons, -1)
for (yr, mth, nbd) in nb_days[1:-1]:
interpolated_consumptions.append((yr, mth, nb_days_in_month(yr, mth), float(nbd) / tot_days * tot_cons, -1))
# For the last month, we need to take the correct day..
(yr, mth, nbd) = nb_days[-1]
interpolated_consumptions.append((yr, mth, cur_day, float(nbd) / tot_days * tot_cons, cur_index))
else:
# we are not in the same year
tot_cons = cur_index - prev_index
tot_days = 0
nb_days = []
#####
## Deal with the consummption until the end of the year
# For the first month
nb_days.append((prev_year, prev_month, nb_days_in_month(prev_year, prev_month) - prev_day))
tot_days += nb_days_in_month(prev_year, prev_month) - prev_day
for m in range(prev_month, 13):
nb_days.append((prev_year, m, nb_days_in_month(prev_year, m)))
tot_days += nb_days_in_month(prev_year, m)
# Deal with the years in between
for yr in range(prev_year+1, cur_year):
for m in range(1, 13):
nb_days.append((yr, m, nb_days_in_month(yr, m)))
tot_days += nb_days_in_month(yr, m)
# Deal with the months until the current month and year
for m in range(1, cur_month):
nb_days.append((cur_year, m, nb_days_in_month(cur_year, m)))
tot_days += nb_days_in_month(cur_year, m)
# Deal with the last month
nb_days.append((cur_year, cur_month, cur_day))
tot_days += cur_day
interpolated_consumptions[-1] = (prev_year, prev_month, nb_days_in_month(prev_year, prev_month), prev_cons + float(nb_days[0][2])/tot_days * tot_cons, -1)
for (yr, mth, nbd) in nb_days[1:-1]:
interpolated_consumptions.append((yr, mth, nb_days_in_month(yr, mth), float(nbd) / tot_days * tot_cons, -1))
# For the last month, we need to take the correct day..
(yr, mth, nbd) = nb_days[-1]
interpolated_consumptions.append((yr, mth, cur_day, float(nbd) / tot_days * tot_cons, cur_index))
# We now have the interpolated_consumptions
# We split them by year ;
years = []
for yr,mth,day,cons,index in interpolated_consumptions:
if yr not in years:
years.append(yr)
nyears = len(years)
data = np.zeros((len(years),12))
data.fill(np.nan)
for yr, mth, day, cons, index in interpolated_consumptions:
data[years.index(yr), mth-1] = cons
ax.plot(range(1,13), data.T)
ax.set_xlim([1,12])
ylim = ax.get_ylim()
ax.set_ylim([0, ylim[1]])
ax.legend(years, loc='upper center')
ax.set_xticks(range(1,13))
ax.set_xticklabels( ['Jan.','Feb.','March', 'April', 'May', 'June', 'July', 'Aug.', 'Sept.', 'Oct.', 'Nov.', 'Dec.'], rotation=45 )
ax.set_ylabel('Delta index')
#fig.autofmt_xdate()
#ax.fmt_xdata = mdates.DateFormatter('%m')
# generate the canvas to display the plot
canvas = FigureCanvas(fig)
canvas.setFixedSize(QSize(600,400))
return canvas
示例10: GUI
# 需要导入模块: from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg import setFixedSize [as 别名]
class GUI(QtGui.QWidget):
#-----------------------------------------------------------------------------------------------
# INITIALIZATION OF THE WINDOW - DEFINE AND PLACE ALL THE WIDGETS
#-----------------------------------------------------------------------------------------------
def __init__(self):
super(GUI, self).__init__()
self.setWindowTitle('Seam Cells Analysis')
self.scaleFactor = 4
self.side = 'L'
self.lbltxt = '"wheel" press: change side, currently %s\n"i" or "u" press: change cell sides'
self.initUI()
def initUI(self):
# SET THE GEOMETRY
mainWindow = QtGui.QVBoxLayout()
mainWindow.setSpacing(15)
fileBox = QtGui.QHBoxLayout()
spaceBox1 = QtGui.QHBoxLayout()
rawDataBox = QtGui.QHBoxLayout()
spaceBox2 = QtGui.QHBoxLayout()
straightBox = QtGui.QVBoxLayout()
mainWindow.addLayout(fileBox)
mainWindow.addLayout(spaceBox1)
mainWindow.addLayout(rawDataBox)
mainWindow.addLayout(spaceBox2)
mainWindow.addLayout(straightBox)
Col1 = QtGui.QGridLayout()
Col2 = QtGui.QHBoxLayout()
Col3 = QtGui.QVBoxLayout()
Col4 = QtGui.QVBoxLayout()
rawDataBox.addLayout(Col1)
rawDataBox.addLayout(Col2)
rawDataBox.addLayout(Col3)
rawDataBox.addLayout(Col4)
Raw1 = QtGui.QHBoxLayout()
Raw2 = QtGui.QHBoxLayout()
Raw3 = QtGui.QHBoxLayout()
straightBox.addLayout(Raw1)
straightBox.addLayout(Raw2)
straightBox.addLayout(Raw3)
self.setLayout(mainWindow)
# DEFINE ALL WIDGETS AND BUTTONS
loadBtn = QtGui.QPushButton('Load DataSet')
saveBtn = QtGui.QPushButton('Save data (F12)')
tpLbl = QtGui.QLabel('Timepoint:')
slLbl = QtGui.QLabel('Slice:')
hatchLbl = QtGui.QLabel('Hatching Time:')
self.tp = QtGui.QSpinBox(self)
self.tp.setValue(0)
self.tp.setMaximum(100000)
self.sl = QtGui.QSpinBox(self)
self.sl.setValue(0)
self.sl.setMaximum(100000)
self.hatch = QtGui.QSpinBox(self)
self.hatch.setValue(0)
self.hatch.setMaximum(100000)
self._488nmBtn = QtGui.QRadioButton('488nm')
self._561nmBtn = QtGui.QRadioButton('561nm')
self.CoolLEDBtn = QtGui.QRadioButton('CoolLED')
automaticOutlineBtn = QtGui.QPushButton('Automatic Outline')
straightenBtn = QtGui.QPushButton('Straighten images')
self.sld1 = QtGui.QSlider(QtCore.Qt.Vertical, self)
self.sld1.setMaximum(2**16-1)
self.sld1.setValue(0)
self.sld2 = QtGui.QSlider(QtCore.Qt.Vertical, self)
self.sld2.setMaximum(2**16)
self.sld2.setValue(2**16-1)
self.fig1 = Figure((8.0, 8.0), dpi=100)
self.fig1.subplots_adjust(left=0., right=1., top=1., bottom=0.)
self.ax1 = self.fig1.add_subplot(111)
self.canvas1 = FigureCanvas(self.fig1)
self.canvas1.setFocusPolicy( QtCore.Qt.ClickFocus )
self.canvas1.setFocus()
self.canvas1.setFixedSize(QtCore.QSize(500,500)) ############################# change this value to set the figure size
self.canvas1.setSizePolicy( QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding )
self.cellTbl = QtGui.QTableWidget()
#.........这里部分代码省略.........
示例11: Ui_MainWindow
# 需要导入模块: from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg import setFixedSize [as 别名]
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
# self._fig = figure(facecolor="white")
# self._ax = self._fig.add_subplot(111)
screen = QtGui.QDesktopWidget().screenGeometry()
MainWindow.setObjectName(_fromUtf8("MainWindow"))
MainWindow.resize(screen.width(), screen.height())
self.centralwidget = QtGui.QWidget(MainWindow)
self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
MainWindow.setCentralWidget(self.centralwidget)
# self.frame = QtGui.QFrame(self.centralwidget)
# self.frame.setGeometry(QtCore.QRect(200, 0, 4*320, 4*240))
# self.frame.setFrameShape(QtGui.QFrame.Box)
# self.frame.setFrameShadow(QtGui.QFrame.Plain)
# self.frame.setObjectName(_fromUtf8("frame"))
# self.gridLayout = QtGui.QGridLayout(self.frame)
# self.gridLayout.setSpacing(10)
# self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
self.videoFrame = QtGui.QLabel(self.centralwidget)
self.videoFrame.setGeometry(QtCore.QRect(500, 0, 2*320, 2*240))
self.videoFrame.setObjectName(_fromUtf8("videoFrame"))
#self.gridLayout.addWidget(self.videoFrame,0,0)
layout = QtGui.QVBoxLayout(self.centralwidget)
layout.setAlignment(QtCore.Qt.AlignTop)
self.figure = matplot.figure(figsize=(5, 4), dpi=100)
matplot.ylim(0,0.5)
self.canvas = FigureCanvas(self.figure)
self.canvas.setFixedSize(440, 470)
self.axes = self.figure.add_subplot(111)
self.axes.hold(False)
layout.addWidget(self.canvas)
self.label1 = QtGui.QLabel(self.centralwidget)
font = QtGui.QFont()
font.setBold(True)
font.setWeight(75)
font.setPointSize(70)
self.label1.setFont(font)
self.label1.setGeometry(QtCore.QRect(700,600, 800, 200))
self.label1.setText('')
# self.histogram = QtGui.QLabel(self.can)
# self.histogram.setGeometry(QtCore.QRect(500, 400, 2*320, 2*240))
# self.histogram.setObjectName(_fromUtf8("histogram"))
# self.label1 = QtGui.QLabel(self.centralwidget)
# self.label1.setGeometry(QtCore.QRect(1300,100, 200, 10))
# self.label1.setText('TEST')
# self.label2 = QtGui.QLabel(self.centralwidget)
# self.label2.setGeometry(QtCore.QRect(1300,200, 200, 10))
# self.label2.setText('TEST')
# self.label3 = QtGui.QLabel(self.centralwidget)
# self.label3.setGeometry(QtCore.QRect(1300,300, 200, 10))
# self.label3.setText('TEST')
# self.label4 = QtGui.QLabel(self.centralwidget)
# self.label4.setGeometry(QtCore.QRect(1300,400, 200, 10))
# self.label4.setText('TEST')
# self.label5 = QtGui.QLabel(self.centralwidget)
# self.label5.setGeometry(QtCore.QRect(1300,500, 200, 10))
# self.label5.setText('TEST')
self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
def retranslateUi(self, MainWindow):
MainWindow.setWindowTitle(QtGui.QApplication.translate("MainWindow", "MainWindow", None, QtGui.QApplication.UnicodeUTF8))
self.videoFrame.setText(QtGui.QApplication.translate("MainWindow", "TextLabel", None, QtGui.QApplication.UnicodeUTF8))
示例12: GUI
# 需要导入模块: from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg import setFixedSize [as 别名]
class GUI(QtGui.QWidget):
def __init__(self):
super(GUI, self).__init__()
self.setWindowTitle( 'Mark Gonad' )
self.initUI()
#-----------------------------------------------------------------------------------------------
# INITIALIZATION OF THE WINDOW - DEFINE AND PLACE ALL THE WIDGETS
#-----------------------------------------------------------------------------------------------
def initUI(self):
# SET THE GEOMETRY
mainWindow = QtGui.QVBoxLayout()
mainWindow.setSpacing(15)
fileBox = QtGui.QHBoxLayout()
spaceBox1 = QtGui.QHBoxLayout()
rawDataBox = QtGui.QHBoxLayout()
mainWindow.addLayout(fileBox)
mainWindow.addLayout(spaceBox1)
mainWindow.addLayout(rawDataBox)
Col1 = QtGui.QGridLayout()
Col2 = QtGui.QHBoxLayout()
rawDataBox.addLayout(Col1)
rawDataBox.addLayout(Col2)
self.setLayout(mainWindow)
# DEFINE ALL WIDGETS AND BUTTONS
loadBtn = QtGui.QPushButton('Load DataSet')
saveBtn = QtGui.QPushButton('Save data (F12)')
tpLbl = QtGui.QLabel('Relative Tp:')
fNameLbl = QtGui.QLabel('File name:')
self.tp = QtGui.QSpinBox(self)
self.tp.setValue(0)
self.tp.setMinimum(-100000)
self.tp.setMaximum(100000)
self.fName = QtGui.QLabel('')
self._488nmBtn = QtGui.QRadioButton('488nm')
self._561nmBtn = QtGui.QRadioButton('561nm')
self.CoolLEDBtn = QtGui.QRadioButton('CoolLED')
self.sld1 = QtGui.QSlider(QtCore.Qt.Vertical, self)
self.sld1.setMaximum(2**16-1)
self.sld1.setValue(0)
self.sld2 = QtGui.QSlider(QtCore.Qt.Vertical, self)
self.sld2.setMaximum(2**16)
self.sld2.setValue(2**16-1)
self.fig1 = Figure((8.0, 8.0), dpi=100)
self.fig1.subplots_adjust(left=0., right=1., top=1., bottom=0.)
self.ax1 = self.fig1.add_subplot(111)
self.canvas1 = FigureCanvas(self.fig1)
self.canvas1.setFocusPolicy( QtCore.Qt.ClickFocus )
self.canvas1.setFocus()
self.canvas1.setFixedSize(QtCore.QSize(600,600))
self.canvas1.setSizePolicy( QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding )
# PLACE ALL THE WIDGET ACCORDING TO THE GRIDS
fileBox.addWidget(loadBtn)
fileBox.addWidget(saveBtn)
spaceBox1.addWidget(self.HLine())
Col1.addWidget(tpLbl, 0, 0)#, 1, 1, Qt.AlignTop)
Col1.addWidget(self.tp, 0, 1)#, 1, 1, Qt.AlignTop)
Col1.addWidget(fNameLbl, 1, 0)#, 1, 1, Qt.AlignTop)
Col1.addWidget(self.fName, 1, 1)#, 1, 1, Qt.AlignTop)
Col1.addWidget(self._488nmBtn, 2, 0 )
Col1.addWidget(self._561nmBtn, 3, 0 )
Col1.addWidget(self.CoolLEDBtn, 4, 0 )
Col2.addWidget(self.sld1)
Col2.addWidget(self.sld2)
Col2.addWidget(self.canvas1)
self.setFocus()
self.show()
# BIND BUTTONS TO FUNCTIONS
loadBtn.clicked.connect(self.selectWorm)
saveBtn.clicked.connect(self.saveData)
self.tp.valueChanged.connect(self.updateCanvas1)
#.........这里部分代码省略.........
示例13: GUI
# 需要导入模块: from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg import setFixedSize [as 别名]
class GUI(QtGui.QWidget):
def __init__(self):
super(GUI, self).__init__()
self.setWindowTitle( 'Label Cells' )
self.cellNames = ['1.p','4.a','1.pp','4.aa','1.ppa','1.ppp','4.aaa','4.aap','b_1','b_4']
self.initUI()
#-----------------------------------------------------------------------------------------------
# INITIALIZATION OF THE WINDOW - DEFINE AND PLACE ALL THE WIDGETS
#-----------------------------------------------------------------------------------------------
def initUI(self):
# SET THE GEOMETRY
mainWindow = QtGui.QVBoxLayout()
mainWindow.setSpacing(15)
fileBox = QtGui.QHBoxLayout()
spaceBox1 = QtGui.QHBoxLayout()
rawDataBox = QtGui.QHBoxLayout()
mainWindow.addLayout(fileBox)
mainWindow.addLayout(spaceBox1)
mainWindow.addLayout(rawDataBox)
Col1 = QtGui.QGridLayout()
Col2 = QtGui.QHBoxLayout()
Col3 = QtGui.QVBoxLayout()
rawDataBox.addLayout(Col1)
rawDataBox.addLayout(Col2)
rawDataBox.addLayout(Col3)
self.setLayout(mainWindow)
# DEFINE ALL WIDGETS AND BUTTONS
loadBtn = QtGui.QPushButton('Load DataSet')
saveBtn = QtGui.QPushButton('Save data (F12)')
tpLbl = QtGui.QLabel('Relative Tp:')
slLbl = QtGui.QLabel('Slice:')
fNameLbl = QtGui.QLabel('File name:')
self.tp = QtGui.QSpinBox(self)
self.tp.setValue(0)
self.tp.setMaximum(100000)
self.sl = QtGui.QSpinBox(self)
self.sl.setValue(0)
self.sl.setMaximum(100000)
self.fName = QtGui.QLabel('')
self._488nmBtn = QtGui.QRadioButton('488nm')
self._561nmBtn = QtGui.QRadioButton('561nm')
self.CoolLEDBtn = QtGui.QRadioButton('CoolLED')
self.sld1 = QtGui.QSlider(QtCore.Qt.Vertical, self)
self.sld1.setMaximum(2**16-1)
self.sld1.setValue(0)
self.sld2 = QtGui.QSlider(QtCore.Qt.Vertical, self)
self.sld2.setMaximum(2**16)
self.sld2.setValue(2**16-1)
self.fig1 = Figure((8.0, 8.0), dpi=100)
self.fig1.subplots_adjust(left=0., right=1., top=1., bottom=0.)
self.ax1 = self.fig1.add_subplot(111)
self.canvas1 = FigureCanvas(self.fig1)
self.canvas1.setFocusPolicy( QtCore.Qt.ClickFocus )
self.canvas1.setFocus()
self.canvas1.setFixedSize(QtCore.QSize(600,600))
self.canvas1.setSizePolicy( QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding )
self.cellTbl = QtGui.QTableWidget()
self.fig2 = Figure((4.0, 4.0), dpi=100)
self.fig2.subplots_adjust(left=0., right=1., top=1., bottom=0.)
self.ax2 = self.fig2.add_subplot(111)
self.canvas2 = FigureCanvas(self.fig2)
self.canvas2.setFixedSize(QtCore.QSize(300,300))
self.canvas2.setSizePolicy( QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding )
# PLACE ALL THE WIDGET ACCORDING TO THE GRIDS
fileBox.addWidget(loadBtn)
fileBox.addWidget(saveBtn)
spaceBox1.addWidget(self.HLine())
Col1.addWidget(tpLbl, 0, 0)#, 1, 1, Qt.AlignTop)
Col1.addWidget(self.tp, 0, 1)#, 1, 1, Qt.AlignTop)
Col1.addWidget(slLbl, 1, 0)#, 1, 1, Qt.AlignTop)
Col1.addWidget(self.sl, 1, 1)#, 1, 1, Qt.AlignTop)
Col1.addWidget(fNameLbl, 2, 0)
Col1.addWidget(self.fName, 2, 1)
#.........这里部分代码省略.........
示例14: GUI
# 需要导入模块: from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg import setFixedSize [as 别名]
class GUI(QtGui.QWidget):
def __init__(self):
super(GUI, self).__init__()
self.setWindowTitle( 'Body Length Analysis' )
self.scaleFactor = 4
self.side = 'L'
self.lbltxt = '"wheel" press: change side, currently %s\n"i" or "u" press: change cell sides'
self.seamCellNames = ['a','b','c','1','2','3','4','5','6','t']
self.initUI()
#-----------------------------------------------------------------------------------------------
# INITIALIZATION OF THE WINDOW - DEFINE AND PLACE ALL THE WIDGETS
#-----------------------------------------------------------------------------------------------
def initUI(self):
# SET THE GEOMETRY
mainWindow = QtGui.QVBoxLayout()
mainWindow.setSpacing(15)
fileBox = QtGui.QHBoxLayout()
spaceBox1 = QtGui.QHBoxLayout()
rawDataBox = QtGui.QHBoxLayout()
spaceBox2 = QtGui.QHBoxLayout()
mainWindow.addLayout(fileBox)
mainWindow.addLayout(spaceBox1)
mainWindow.addLayout(rawDataBox)
mainWindow.addLayout(spaceBox2)
Col1 = QtGui.QGridLayout()
Col2 = QtGui.QHBoxLayout()
Col3 = QtGui.QVBoxLayout()
Col4 = QtGui.QVBoxLayout()
rawDataBox.addLayout(Col1)
rawDataBox.addLayout(Col2)
rawDataBox.addLayout(Col3)
rawDataBox.addLayout(Col4)
self.setLayout(mainWindow)
# DEFINE ALL WIDGETS AND BUTTONS
loadBtn = QtGui.QPushButton('Load DataSet')
saveBtn = QtGui.QPushButton('Save data (F12)')
tpLbl = QtGui.QLabel('Timepoint:')
slLbl = QtGui.QLabel('Slice:')
hatchLbl = QtGui.QLabel('Hatching Time:')
widthLbl = QtGui.QLabel('Straightening Width:')
self.tp = QtGui.QSpinBox(self)
self.tp.setValue(0)
self.tp.setMaximum(100000)
self.sl = QtGui.QSpinBox(self)
self.sl.setValue(0)
self.sl.setMaximum(100000)
self.hatch = QtGui.QSpinBox(self)
self.hatch.setValue(0)
self.hatch.setMaximum(100000)
self.straightWidth = QtGui.QSpinBox(self)
self.straightWidth.setMaximum(1000)
self.straightWidth.setValue(100)
self._488nmBtn = QtGui.QRadioButton('488nm')
self._561nmBtn = QtGui.QRadioButton('561nm')
self.CoolLEDBtn = QtGui.QRadioButton('CoolLED')
automaticOutlineBtn = QtGui.QPushButton('Automatic Outline')
straightenBtn = QtGui.QPushButton('Straighten images')
self.sld1 = QtGui.QSlider(QtCore.Qt.Vertical, self)
self.sld1.setMaximum(2**16-1)
self.sld1.setValue(0)
self.sld2 = QtGui.QSlider(QtCore.Qt.Vertical, self)
self.sld2.setMaximum(2**16)
self.sld2.setValue(2**16-1)
self.fig1 = Figure((8.0, 8.0), dpi=100)
self.fig1.subplots_adjust(left=0., right=1., top=1., bottom=0.)
self.ax1 = self.fig1.add_subplot(111)
self.canvas1 = FigureCanvas(self.fig1)
self.canvas1.setFocusPolicy( QtCore.Qt.ClickFocus )
self.canvas1.setFocus()
self.canvas1.setFixedSize(QtCore.QSize(600,600))
self.canvas1.setSizePolicy( QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding )
self.cellTbl = QtGui.QTableWidget()
# PLACE ALL THE WIDGET ACCORDING TO THE GRIDS
fileBox.addWidget(loadBtn)
#.........这里部分代码省略.........
示例15: PomoWindow
# 需要导入模块: from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg import setFixedSize [as 别名]
class PomoWindow(QtGui.QWidget):
def __init__(self, pomo):
"""
Makes necessary variable initializations and calls other init methods.
"""
super(PomoWindow, self).__init__()
self.pomo = pomo
# Enhance readability
self.getString = self.pomo.getString
self.initUI()
self.initAudio()
self.timerActive = False
self.timer = QtCore.QTimer()
self.timer.timeout.connect(self.tick)
def initUI(self):
"""
Initializes the UI.
"""
# Set some general window settings.
self.setFixedSize(480, 310)
self.move(250, 250)
self.setWindowTitle(self.getString("app_name"))
self.setWindowIcon(QtGui.QIcon("/usr/share/icons/pomodorino.png"))
self.trayIcon = QtGui.QSystemTrayIcon(QtGui.QIcon("/usr/share/icons/pomodorino.png"), self)
self.trayIcon.setVisible(True)
self.trayIcon.activated.connect(self.trayClick)
# Add a minimal context menu for the tray icon.
# trayMenu = QtGui.QMenu(self)
# trayMenu.addAction("Quit", self.close)
# self.trayIcon.setContextMenu(trayMenu)
# Initialize and display the tabs
pomoTab = self.initPomoTab()
tasksTab = self.initTasksTab()
activityTab = self.initActivityTab()
tabWidget = QtGui.QTabWidget(self)
tabWidget.resize(479, 309)
tabWidget.addTab(pomoTab, self.getString("tab_pomo"))
tabWidget.addTab(tasksTab, self.getString("tab_tasks"))
tabWidget.addTab(activityTab, self.getString("tab_activity"))
self.show()
def initAudio(self):
"""
Detects an ALSA audio device and buffers our ringtone.
"""
# Detect an ALSA audio device
self.audioDevice = alsaaudio.PCM()
# Open the ringtone and set some audio settings.
ring = wave.open("/usr/share/pomodorino/ring.wav", "rb")
self.audioDevice.setchannels(ring.getnchannels())
self.audioDevice.setrate(ring.getframerate())
self.audioDevice.setformat(alsaaudio.PCM_FORMAT_S16_LE)
self.audioDevice.setperiodsize(320)
# Read the audio data of the ringtone.
self.audioData = list()
buf = ring.readframes(320)
while buf:
self.audioData.append(buf)
buf = ring.readframes(320)
def closeEvent(self, event):
"""
Prevents accidental shutdowns by asking the user.
"""
if self.timerActive:
self.stopTimer()
if self.promptUser("ask_paused"):
event.accept()
else:
event.ignore()
self.startTimer(0, restart=True)
else:
event.accept()
def setTitle(self, title):
"""
Sets the window title.
"""
if title is None:
title = self.getString("app_name")
else:
title += " - " + self.getString("app_name")
self.window().setWindowTitle(title)
def startTimer(self, timeSpan, restart=False):
"""
Starts the timer.
"""
if restart is False:
self.timerType = timeSpan
#.........这里部分代码省略.........