def initialize(self): if len(self._segywidgets) == 0: return layout = QVBoxLayout() slice_data_source, slice_models = self._setup_model_source() self._context = SliceViewContext(slice_models, slice_data_source, has_data=False) self._context.show_indicators(True) self._context.data_changed.connect(self._data_changed) self._slice_view_widget = None # Required for settingswindow self._settings_window = SettingsWindow(self._context, self) self._settings_window.min_max_changed.connect(self._min_max_changed) self._settings_window.indicators_changed.connect(self._indicators_changed) self._settings_window.interpolation_changed.connect(self._interpolation_changed) self._settings_window.samples_unit_changed.connect(self._samples_unit_changed) self._modify_qtree(self._settings_window.qtree, [3, 5]) self._toolbar = self._create_toolbar() self._local_data_changed(self._segywidgets[0].context.models) for i, segywidget in enumerate(self._segywidgets): self.add_segy_view_widget(i, segywidget) self._tab_widget.currentChanged.connect(self._tab_changed) layout.addWidget(self._toolbar) layout.addWidget(self._tab_widget) self.setLayout(layout)
def __init__(self, filename, show_toolbar=True, color_maps=None, width=11.7, height=8.3, dpi=100, segyioargs = {}, parent=None): QWidget.__init__(self, parent) inline = SliceModel("Inline", SD.inline, SD.crossline, SD.depth) xline = SliceModel("Crossline", SD.crossline, SD.inline, SD.depth) depth = SliceModel("Depth", SD.depth, SD.inline, SD.crossline) slice_models = [inline, xline, depth] slice_data_source = SliceDataSource(filename, **segyioargs) self._slice_data_source = slice_data_source self._context = SliceViewContext(slice_models, slice_data_source) self._context.show_indicators(True) self._slice_view_widget = SliceViewWidget(self._context, width, height, dpi, self) layout = QVBoxLayout() self._settings_window = SettingsWindow(self._context, self) self._toolbar = self._create_toolbar(color_maps) self._toolbar.setVisible(show_toolbar) layout.addWidget(self._toolbar) layout.addWidget(self._slice_view_widget) self.setLayout(layout)
def __init__(self, segywidgets, show_toolbar=True, color_maps=None, width=11.7, height=8.3, dpi=100, parent=None): QWidget.__init__(self, parent) self._segywidgets = segywidgets """ :type: list[SegyViewWidget] """ self._tab_widget = QTabWidget() layout = QVBoxLayout() for i, segywidget in enumerate(self._segywidgets): segywidget.show_toolbar(False) self._tab_widget.insertTab(i, segywidget, 'File: ' + str(i + 1)) self._tab_widget.currentChanged.connect(self.update_views) slice_data_source = self.setup_datasource() inline = SliceModel("Inline", SD.inline, SD.crossline, SD.depth) xline = SliceModel("Crossline", SD.crossline, SD.inline, SD.depth) depth = SliceModel("Depth", SD.depth, SD.inline, SD.crossline) slice_models = [inline, xline, depth] self._context = SliceViewContext(slice_models, slice_data_source, has_data=False) self._context.data_changed.connect(self.data_changed) self._settings_window = SettingsWindow(self._context, self) self._toolbar = self._create_toolbar(color_maps) layout.addWidget(self._toolbar) layout.addWidget(self._tab_widget) self.setLayout(layout)
def _generate_mock_model_and_context(): model = SliceModel("test", SD.inline, SD.crossline, SD.depth) svc = SliceViewContext([model], SliceDataSource(None)) return model, svc