def __init__(self, filename=None, il = None, xl = None): QMainWindow.__init__(self) self.segyioargs = { k: v for k, v in [('iline', il), ('xline', xl)] if v is not None } self.setAttribute(Qt.WA_DeleteOnClose) title = filename if filename is not None else "SEG-Y Viewer" self.setWindowTitle(title) self._segy_view_widget = SegyViewWidget(filename, show_toolbar=True, segyioargs = self.segyioargs, parent = self) self.setCentralWidget(self._segy_view_widget) self.setWindowIcon(resource_icon("350px-SEGYIO.png")) toolbar = self._segy_view_widget.toolbar() open_button = QToolButton() open_button.setToolTip("Open a SEG-Y file") open_button.setIcon(resource_icon("folder.png")) open_button.clicked.connect(self._open_file) first_action = toolbar.actions()[0] toolbar.insertWidget(first_action, open_button) toolbar.insertSeparator(first_action)
def _create_toolbar(self, color_maps): toolbar = QToolBar() toolbar.setFloatable(False) toolbar.setMovable(False) self._layout_combo = LayoutCombo() self._layout_combo_action = QWidgetAction(self._layout_combo) self._layout_combo_action.setDefaultWidget(self._layout_combo) toolbar.addAction(self._layout_combo_action) self._layout_combo.layout_changed.connect( self._slice_view_widget.set_plot_layout) # self._colormap_combo = ColormapCombo(['seismic', 'spectral', 'RdGy', 'hot', 'jet', 'gray']) self._colormap_combo = ColormapCombo(color_maps) self._colormap_combo.currentIndexChanged[int].connect( self._colormap_changed) toolbar.addWidget(self._colormap_combo) self._save_button = QToolButton() self._save_button.setToolTip("Save as image") self._save_button.setIcon(resource_icon("table_export.png")) self._save_button.clicked.connect(self._save_figure) toolbar.addWidget(self._save_button) self._settings_button = QToolButton() self._settings_button.setToolTip("Toggle settings visibility") self._settings_button.setIcon(resource_icon("cog.png")) self._settings_button.setCheckable(True) self._settings_button.toggled.connect(self._show_settings) toolbar.addWidget(self._settings_button) self._help_button = QToolButton() self._help_button.setToolTip("View help") self._help_button.setIcon(resource_icon("help.png")) self._help_button.setCheckable(True) self._help_button.toggled.connect(self._show_help) toolbar.addWidget(self._help_button) def toggle_on_close(event): self._settings_button.setChecked(False) event.accept() def toggle_on_close_help(event): self._help_button.setChecked(False) event.accept() self._settings_window.closeEvent = toggle_on_close self._help_window.closeEvent = toggle_on_close_help self._colormap_combo.setCurrentIndex(45) self.set_default_layout() return toolbar
def __init__(self, filename=None): QMainWindow.__init__(self) self.setAttribute(Qt.WA_DeleteOnClose) self.setWindowTitle("SEG-Y Viewer") self._segy_view_widget = SegyViewWidget(filename, show_toolbar=True) self.setCentralWidget(self._segy_view_widget) toolbar = self._segy_view_widget.toolbar() open_button = QToolButton() open_button.setToolTip("Open a SEG-Y file") open_button.setIcon(resource_icon("folder.png")) open_button.clicked.connect(self._open_file) first_action = toolbar.actions()[0] toolbar.insertWidget(first_action, open_button) toolbar.insertSeparator(first_action)
def _create_toolbar(self, color_maps): toolbar = QToolBar() toolbar.setFloatable(False) toolbar.setMovable(False) self._settings_button = QToolButton() self._settings_button.setToolTip("Toggle settings visibility") self._settings_button.setIcon(resource_icon("cog.png")) self._settings_button.setCheckable(True) self._settings_button.toggled.connect(self._show_settings) toolbar.addWidget(self._settings_button) def toggle_on_close(event): self._settings_button.setChecked(False) event.accept() self._settings_window.closeEvent = toggle_on_close return toolbar
def add_layout_item(self, layout_item): self.addItem(resource_icon(layout_item['icon']), "", layout_item['spec'])