def initialise_user_interface(self): ''' Initialises the main window. ''' grid = QGridLayout() grid.setSpacing(10) self.grid = grid #self.file_items_list = ht.titledTree('File Tree') self.file_items_list = ht.tree() self.file_items_list_property = {} self.file_items_list.tree.itemClicked.connect(self.item_clicked) #self.file_items_list.tree.itemDoubleClicked.connect(self.item_double_clicked) # Make dataset table self.dataset_table = ht.titledTable('Values') # Make attribute table self.attribute_table = ht.titledTable('Attribute') # QTableWidget() self.attribute_table.table.setShowGrid(True) #dataset type to set buttons layout self.dataset_type_obj_string = self.default_dataset_type # Initialise all buttons self.open_button = self.add_open_button() self.dataset_type_box = self.add_dataset_type_box() self.plot_curve_button = self.add_plot_curve_button() self.plot_img_button = self.add_plot_img_button() self.plot_surface_button = self.add_plot_surface_button() self.setX_button = self.add_setX_button() self.resetX_button = self.add_resetX_button() self.setlogX_box = self.add_setlogX_box() self.setlogY_box = self.add_setlogY_box() #self.clr_plot_checkbox = self.add_clr_plot_box() self.clr_plot_button = self.add_clr_plot_button() self.resizeEvent = self.onresize # Add 'extra' window components self.make_menu_bar() self.filename_label = QLabel('H5FileName') ## Add plot window self.guiplot = pg.PlotWidget() #self.guiplot = pg.ImageView() # Add the created layouts and widgets to the window grid.addLayout(self.open_button, 1, 0, 1, 1, QtCore.Qt.AlignLeft) grid.addLayout(self.dataset_type_box, 1, 0, 1, 1, QtCore.Qt.AlignRight) grid.addLayout(self.plot_curve_button, 1, 1, 1, 1, QtCore.Qt.AlignLeft) grid.addLayout(self.plot_img_button, 1, 2, 1, 1, QtCore.Qt.AlignLeft) grid.addLayout(self.plot_surface_button, 1, 3, 1, 1, QtCore.Qt.AlignLeft) grid.addLayout(self.clr_plot_button, 1, 4, 1, 1, QtCore.Qt.AlignLeft) grid.addLayout(self.setX_button, 1, 8, 1, 1, QtCore.Qt.AlignLeft) grid.addLayout(self.resetX_button, 2, 8, 1, 1, QtCore.Qt.AlignLeft) grid.addLayout(self.setlogX_box, 1, 7, 1, 1, QtCore.Qt.AlignLeft) grid.addLayout(self.setlogY_box, 2, 7, 1, 1, QtCore.Qt.AlignLeft) grid.addWidget(self.filename_label, 2, 0, 1, 1) #filename list #grid.addLayout(self.file_items_list.layout, 4, 0, 3, 1) grid.addLayout(self.file_items_list.datalayout, 4, 0, 3, 1) #data dataset table grid.addLayout(self.dataset_table.layout, 4, 1, 1, 8) ## Add guiplot window grid.addWidget(self.guiplot, 5, 1, 4, 8) # attribute tabel grid.addLayout(self.attribute_table.layout, 7, 0, 2, 1) #grid.addWidget(self.attribute_table, 7, 0, 2, 1 ) #self.ipython_widget = ConsoleWidget() ##add a ipython widget #grid.addLayout(self.ipython_widget, 7, 0, 4, 1) self.dev_cur_layout(plot_type='curve') self.dev_cur_layout(plot_type='image') self.setCentralWidget(QWidget(self)) self.centralWidget().setLayout(grid) # Other tweaks to the window such as icons etc self.setWindowTitle('XSH5View--Ver1') #QtGui.QApplication.setStyle(QtGui.QStyleFactory.create('Cleanlooks')) self.initialise_layout( ) #to add different type of layout based on self.dataset_type_obj_string
def initialise_user_interface(self): ''' Initialises the main window. ''' grid = QGridLayout() grid.setSpacing(10) self.grid = grid #self.file_items_list = ht.titledTree('File Tree') self.file_items_list = ht.tree() self.file_items_list_property = {} self.file_items_list.tree.itemClicked.connect(self.item_clicked) #self.file_items_list.tree.itemDoubleClicked.connect(self.item_double_clicked) self.guiplot_grid_fromRow = 5 self.guiplot_grid_fromColumn = 1 self.guiplot_grid_rowSpan = 5 self.guiplot_grid_columnSpan = 8 self.testplot_grid_fromRow = 6 self.testplot_grid_fromColumn = 1 self.testplot_grid_rowSpan = 4 self.testplot_grid_columnSpan = 8 self.plotLibrary = 'matplotlib' self.plot_buttons_array = [] # Make dataset table self.dataset_table = ht.titledTable('Values') # Make attribute table self.attribute_table = ht.titledTable('Attribute') # QTableWidget() self.attribute_table.table.setShowGrid(True) #dataset type to set buttons layout self.dataset_type_obj_string = self.default_dataset_type # Initialise all buttons self.open_button = self.add_open_button() self.remove_button = self.add_remove_button() self.create_button = self.add_create_button() self.dataset_type_box = self.add_dataset_type_box() self.add_all_plot_buttons() self.setX_button = self.add_setX_button() self.resetX_button = self.add_resetX_button() self.setlogX_box = self.add_setlogX_box() self.setlogY_box = self.add_setlogY_box() #self.clr_plot_checkbox = self.add_clr_plot_box() self.clr_plot_button = self.add_clr_plot_button() self.resizeEvent = self.onresize # Add 'extra' window components self.make_menu_bar() self.filename_label = QLabel('H5FileName') ## Add plot window self.guiplot = pg.PlotWidget() ##using pg self.testplot = Figure() self.ax = self.testplot.add_subplot(111) self.canvas = FigureCanvas(self.testplot) self.toolbar = NavigationToolbar(self.canvas, self) self.cbWidget = None #self.guiplot = pg.ImageView() # Add the created layouts and widgets to the window grid.addLayout(self.open_button, 1, 0, 1, 1, QtCore.Qt.AlignLeft) grid.addLayout(self.remove_button, 6, 0, 1, 1, QtCore.Qt.AlignLeft) grid.addLayout(self.create_button, 7, 0, 1, 1, QtCore.Qt.AlignLeft) grid.addLayout(self.dataset_type_box, 1, 0, 1, 1, QtCore.Qt.AlignRight) grid.addLayout(self.clr_plot_button, 1, 4, 1, 1, QtCore.Qt.AlignLeft) grid.addLayout(self.setX_button, 1, 8, 1, 1, QtCore.Qt.AlignLeft) grid.addLayout(self.resetX_button, 2, 8, 1, 1, QtCore.Qt.AlignLeft) grid.addLayout(self.setlogX_box, 1, 7, 1, 1, QtCore.Qt.AlignLeft) grid.addLayout(self.setlogY_box, 2, 7, 1, 1, QtCore.Qt.AlignLeft) grid.addWidget(self.filename_label, 2, 0, 1, 1) #filename list #grid.addLayout(self.file_items_list.layout, 4, 0, 3, 1) grid.addLayout(self.file_items_list.datalayout, 4, 0, 2, 1) #data dataset table grid.addLayout(self.dataset_table.layout, 4, 1, 1, 8) # Add toolbar grid.addWidget(self.toolbar, 5, 1, 1, 7) ## Add guiplot window, it's not the default so hide grid.addWidget(self.guiplot, self.guiplot_grid_fromRow, self.guiplot_grid_fromColumn, self.guiplot_grid_rowSpan, self.guiplot_grid_columnSpan) self.guiplot.setWindowOpacity(0) self.guiplot.hide() grid.addWidget(self.canvas, self.testplot_grid_fromRow, self.testplot_grid_fromColumn, self.testplot_grid_rowSpan, self.testplot_grid_columnSpan) # attribute tabel grid.addLayout(self.attribute_table.layout, 8, 0, 3, 1) #grid.addWidget(self.attribute_table, 7, 0, 2, 1 ) self.dev_cur_layout(plot_type='curve') self.dev_cur_layout(plot_type='image') self.setCentralWidget(QWidget(self)) self.centralWidget().setLayout(grid) # Other tweaks to the window such as icons etc self.setWindowTitle('XSH5View--Ver1') #QtGui.QApplication.setStyle(QtGui.QStyleFactory.create('Cleanlooks')) self.initialise_layout( ) #to add different type of layout based on self.dataset_type_obj_string