本文整理匯總了Python中pyqtgraph.GraphicsLayoutWidget.useOpenGL方法的典型用法代碼示例。如果您正苦於以下問題:Python GraphicsLayoutWidget.useOpenGL方法的具體用法?Python GraphicsLayoutWidget.useOpenGL怎麽用?Python GraphicsLayoutWidget.useOpenGL使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pyqtgraph.GraphicsLayoutWidget
的用法示例。
在下文中一共展示了GraphicsLayoutWidget.useOpenGL方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: Aditi
# 需要導入模塊: from pyqtgraph import GraphicsLayoutWidget [as 別名]
# 或者: from pyqtgraph.GraphicsLayoutWidget import useOpenGL [as 別名]
class Aditi(QMainWindow):
def __init__(self):
QMainWindow.__init__(self)
# title
self.setWindowTitle("Aditi")
self.setDockOptions(QMainWindow.VerticalTabs | QMainWindow.AnimatedDocks)
#self.showMaximized()
# model
self.rawfiles_by_short_path = {}
self.xic_by_rawfile_short_path = {}
self.tic_by_rawfile_short_path = {}
self.spec_by_rawfile_short_path = {}
self.inf_line_tic_item = None
self.curr_scan_id_by_short_path = {}
# menu
self.file_menu = self.menuBar().addMenu('&File')
#self.file_menu.setTearOffEnabled(False)
open_action = QAction("&Open...", self)
open_action.setToolTip("Open a rawfile")
open_action.setShortcut(QKeySequence(Qt.CTRL + Qt.Key_O))
self.file_menu.addAction(open_action)
open_action.triggered.connect(self.show_open_dialog)
exit_action = QAction("&Exit", self)
exit_action.setShortcut(QKeySequence(Qt.CTRL + Qt.Key_Q))
self.file_menu.addAction(exit_action)
exit_action.triggered.connect(self.quit)
self.tab_widget = QTabWidget(self)
# spectrum plot Widget
self.graphics_layout_widget = GraphicsLayoutWidget(parent=self.tab_widget)
self.graphics_layout_widget.keyPressEvent = self.handle_key_press_event
self.graphics_layout_widget.useOpenGL(False)
self.graphics_layout_widget.setAntialiasing(False)
self.plot_widget_tic = self.graphics_layout_widget.addPlot(title="TIC(s)",
labels={'left': "Intensity",
'bottom': "Retention Time (sec)"})
self.plot_widget_tic.showGrid(x=True, y=True)
self.graphics_layout_widget.nextRow()
self.plot_widget_spectrum = self.graphics_layout_widget.addPlot(title="Spectrum", labels={'left': "Intensity",
'bottom': "m/z"})
self.plot_widget_spectrum.showGrid(x=True, y=True)
# finally add tab
self.tab_widget.addTab(self.graphics_layout_widget, "Spectrum")
# Xic plotWidget
self.plot_widget_xic = PlotWidget(name="MainPlot", labels={'left': "Intensity",
'bottom': "Retention Time (sec)"})
self.plot_widget_xic.showGrid(x=True, y=True)
self.tab_widget.addTab(self.plot_widget_xic, "Xic extraction")
self.setCentralWidget(self.tab_widget)
self.statusBar().showMessage("Ready")
# dock 1
self.rawfile_dock_widget = QDockWidget("Rawfiles")
self.rawfile_table_view = QTableView()
self.rawfile_table_view.horizontalHeader().setVisible(False)
self.rawfile_table_view.horizontalHeader().setResizeMode(QHeaderView.ResizeToContents)
self.rawfile_dock_widget.setWidget(self.rawfile_table_view)
self.rawfile_model = QStandardItemModel()
self.rawfile_model.setHorizontalHeaderLabels(["Rawfiles"])
self.rawfile_table_view.setModel(self.rawfile_model)
self.rawfile_model.itemChanged.connect(self.item_changed)
self.addDockWidget(0x2, self.rawfile_dock_widget)
# xic dock widget extraction parameter
self.xic_dock_widget = QDockWidget("Xic extraction")
self.xic_widget = XicWidget()
self.xic_widget.plotButton.clicked.connect(self.plot)
self.xic_dock_widget.setWidget(self.xic_widget)
self.addDockWidget(0x2, self.xic_dock_widget)
def handle_key_press_event(self, evt):
if self.inf_line_tic_item is None:
return
times = []
if evt.key() == Qt.Key_Left:
for rawfile in self.rawfiles_by_short_path.values()[:1]:
if not rawfile.is_checked:
#.........這裏部分代碼省略.........