コード例 #1
0
    def __init__(self, napari_viewer):
        super().__init__()
        self.viewer = napari_viewer

        napari_viewer.events.layers_change.connect(self._on_layer_change)

        # tracks layer select
        tracks_selector = QWidget()
        tracks_selector.setStyleSheet(".QWidget{border: none;}")
        tracks_select_layout = QHBoxLayout()
        tracks_selector.setLayout(tracks_select_layout)
        self._tracks_layer_box = QComboBox()
        tracks_select_layout.addWidget(QLabel('Tracks layer'))
        tracks_select_layout.addWidget(self._tracks_layer_box)

        tracks_select_layout.setContentsMargins(0, 0, 0, 0)

        # header widget (add filter from list)
        header_widget = QWidget()
        header_widget.setStyleSheet(".QWidget{border: 1px solid #3d4851;}")
        header_layout = QHBoxLayout()
        header_layout.addWidget(QLabel("Add filter:"))
        self.filters_names = QComboBox()
        self.filters_names.addItems(['Features'])
        header_layout.addWidget(self.filters_names)
        add_filter_button = QPushButton("Add")
        add_filter_button.released.connect(self._on_add)
        header_layout.addWidget(add_filter_button)
        header_widget.setLayout(header_layout)

        # FilterListWidget
        list_widget = QWidget()
        list_layout = QVBoxLayout()
        list_layout.setContentsMargins(0, 0, 0, 0)
        list_widget.setLayout(list_layout)
        list_widget.setStyleSheet(".QWidget{border: 1px solid #3d4851;}")
        self.pipeline_list_widget = SPipelineListWidget()
        self.pipeline_list_widget.setMinimumHeight(350)
        list_layout.addWidget(self.pipeline_list_widget)

        layout = QVBoxLayout()
        layout.setContentsMargins(0, 0, 0, 0)
        layout.addWidget(tracks_selector)
        self._advanced_check = QCheckBox('Advanced')
        self._advanced_check.stateChanged.connect(self.toggle_advanced)
        layout.addWidget(self._advanced_check)
        layout.addWidget(header_widget)
        layout.addWidget(list_widget)
        layout.insertSpacing(2, -9)
        self.setLayout(layout)
        self.init_layer_list()
        self.toggle_advanced(False)
コード例 #2
0
    def __init__(self, napari_viewer):
        super().__init__()
        self.viewer = napari_viewer

        napari_viewer.events.layers_change.connect(self._on_layer_change)

        # viewers
        self.features_viewer = SFeaturesViewer(napari_viewer)
        self.features_viewer.setVisible(False)
        self.features_viewer.setWindowFlag(qtpy.QtCore.Qt.WindowStaysOnTopHint,
                                           True)

        # create the dict of the filters
        global_layout = QVBoxLayout()
        global_layout.setContentsMargins(5, 5, 5, 5)
        self.setLayout(global_layout)
        filter_frame = QWidget()
        global_layout.addWidget(filter_frame)
        filter_frame.setStyleSheet(".QWidget{border: none;}")

        layout = QVBoxLayout()
        layout.setContentsMargins(0, 0, 0, 0)

        # layer select
        tracks_selector = QWidget()
        tracks_selector.setStyleSheet(".QWidget{border: none;}")
        tracks_select_layout = QGridLayout()
        tracks_selector.setLayout(tracks_select_layout)
        self._tracks_layer_box = QComboBox()
        self._tracks_layer_box.currentTextChanged.connect(
            self._on_tracks_layer_change)
        tracks_select_layout.addWidget(QLabel('Tracks layer'), 0, 0)
        tracks_select_layout.addWidget(self._tracks_layer_box, 0, 1)
        tracks_select_layout.setContentsMargins(0, 0, 0, 0)

        # header widget (add filter from list)
        header_widget = QWidget()
        header_widget.setStyleSheet(".QWidget{border: 1px solid #3d4851;}")
        header_layout = QHBoxLayout()
        header_layout.addWidget(QLabel("Add feature:"))
        self.filters_names = QComboBox()
        self.filters_names.addItems(['Length', 'Distance', 'Displacement'])
        header_layout.addWidget(self.filters_names)
        add_filter_button = QPushButton("Add")
        add_filter_button.released.connect(self._on_add)
        header_layout.addWidget(add_filter_button)
        header_widget.setLayout(header_layout)

        # FilterListWidget
        list_widget = QWidget()
        list_layout = QVBoxLayout()
        list_layout.setContentsMargins(0, 0, 0, 0)
        list_widget.setLayout(list_layout)
        list_widget.setStyleSheet(".QWidget{border: 1px solid #3d4851;}")
        self.pipeline_list_widget = SPipelineListWidget()
        self.pipeline_list_widget.setMinimumHeight(350)
        list_layout.addWidget(self.pipeline_list_widget)

        # viewer buttons
        viewer_bar = QWidget()
        viewer_layout = QHBoxLayout()
        self.properties_btn = QPushButton('tracks features')
        self.properties_btn.released.connect(self._on_show_features)
        viewer_layout.addWidget(self.properties_btn)
        viewer_bar.setLayout(viewer_layout)
        viewer_layout.setContentsMargins(0, 0, 0, 0)

        self._advanced_check = QCheckBox('Advanced')
        self._advanced_check.stateChanged.connect(self.toggle_advanced)

        layout.addWidget(tracks_selector, 0)
        layout.addWidget(self._advanced_check, 0)
        layout.addWidget(header_widget, 0)
        layout.addWidget(list_widget, 1)
        layout.addWidget(viewer_bar, 0)
        layout.insertSpacing(2, -9)
        filter_frame.setLayout(layout)
        self.init_layer_list()
        self.toggle_advanced(False)