def filter_documents(self): dialog = Qt.QDialog() layout = Qt.QVBoxLayout() dialog.setLayout(layout) table_data = TableDataBrowser( self.project, self, self.project.session.get_shown_tags(), False, True, link_viewer=False) layout.addWidget(table_data) hlay = Qt.QHBoxLayout() layout.addLayout(hlay) ok = Qt.QPushButton('Display') hlay.addWidget(ok) ok.clicked.connect(dialog.accept) ok.setDefault(True) cancel = Qt.QPushButton('Cancel') hlay.addWidget(cancel) cancel.clicked.connect(dialog.reject) hlay.addStretch(1) # Reducing the list of scans to selection all_scans = table_data.scans_to_visualize table_data.scans_to_visualize = self.documents table_data.scans_to_search = self.documents table_data.update_visualized_rows(all_scans) res = dialog.exec_() if res == Qt.QDialog.Accepted: points = table_data.selectedIndexes() result_names = [] for point in points: row = point.row() # We get the FileName of the scan from the first row scan_name = table_data.item(row, 0).text() value = self.project.session.get_value(COLLECTION_CURRENT, scan_name, TAG_FILENAME) value = os.path.abspath(os.path.join(self.project.folder, value)) result_names.append(value) self.display_files(result_names)
def preferences(self): '''Preferences for the dataviewer ''' #Get initial config: im_sec = Config().getViewerFramerate() config = Config().getViewerConfig() ref = Config().get_referential() dialog = Qt.QDialog() dialog.setWindowTitle('Preferences') dialog.resize(600, 400) layout = Qt.QVBoxLayout() layout.setContentsMargins(25, 25, 25, 25) dialog.setLayout(layout) #Change Neuro/Radio configuration config_layout = QHBoxLayout() title_config = Qt.QLabel() title_config.setText('Configuration: ') box = Qt.QComboBox() box.addItem('Neuro') box.addItem('Radio') config_layout.addWidget(title_config) config_layout.addWidget(box) if config == 'radio': box.setCurrentIndex(1) #set automatic time frame rate frame_rate_layout = QHBoxLayout() title = Qt.QLabel() title.setText('Automatic time image display:') slider = Qt.QSlider(Qt.Qt.Horizontal) slider.setRange(1, 100) slider.setValue(int(im_sec)) size = QtCore.QSize(180, 15) slider.setMinimumSize(size) slow_label = Qt.QLabel() fast_label = Qt.QLabel() slow_label.setText('slow') fast_label.setText('fast') frame_rate_layout.addWidget(title) frame_rate_layout.addWidget(slow_label) frame_rate_layout.addWidget(slider) frame_rate_layout.addWidget(fast_label) frame_rate_layout.insertSpacing(1, 200) #Change referential ref_layout = QHBoxLayout() title_ref = Qt.QLabel() title_ref.setText('Referential: ') box2 = Qt.QComboBox() box2.addItem('World Coordinates') box2.addItem('Image referential') ref_layout.addWidget(title_ref) ref_layout.addWidget(box2) box2.setCurrentIndex(int(ref)) #Set general vertical layout layout.addLayout(config_layout) layout.addLayout(frame_rate_layout) layout.addLayout(ref_layout) layout.addStretch(1) #Save and cancel buttons hlay = Qt.QHBoxLayout() layout.addLayout(hlay) ok = Qt.QPushButton('Save') hlay.addStretch(1) hlay.addWidget(ok) ok.clicked.connect(dialog.accept) ok.setDefault(True) cancel = Qt.QPushButton('Cancel') hlay.addWidget(cancel) cancel.clicked.connect(dialog.reject) hlay.addStretch(1) res = dialog.exec_() if res == Qt.QDialog.Accepted: new_config = box.currentText().lower() new_ref = box2.currentIndex() #Save Config parameters and reload images #when config and referential have changed Config().setViewerFramerate(slider.value()) Config().setViewerConfig(new_config) Config().set_referential(new_ref) if new_config != config: self.anaviewer.changeConfig(new_config) if new_ref != ref: self.anaviewer.changeRef()
def filter_documents(self): '''Filter documents already loaded in the Databrowser ''' dialog = Qt.QDialog() dialog.setWindowTitle('Filter documents') dialog.resize(1150, 500) layout = Qt.QVBoxLayout() dialog.setLayout(layout) #Some specific filtering #QLineEdit for research self.search_bar = RapidSearch(dialog) self.search_bar.textChanged.connect(self.search_str) #Cancel search button sources_images_dir = Config().getSourceImageDir() button_cross = QToolButton() button_cross.setStyleSheet('background-color:rgb(255, 255, 255);') button_cross.setIcon( QIcon(os.path.join(sources_images_dir, 'gray_cross.png'))) button_cross.clicked.connect(self.reset_search_bar) title = Qt.QLabel() title.setText('Search by FileName: ') layout.addWidget(title) search_bar_layout = QHBoxLayout() search_bar_layout.addWidget(self.search_bar) search_bar_layout.addSpacing(3) search_bar_layout.addWidget(button_cross) #Add layout to dialogBox layout.addLayout(search_bar_layout) layout.addSpacing(8) self.table_data = TableDataBrowser( self.project, self, self.project.session.get_shown_tags(), False, True, link_viewer=False) layout.addWidget(self.table_data) hlay = Qt.QHBoxLayout() layout.addLayout(hlay) ok = Qt.QPushButton('Import') hlay.addWidget(ok) ok.clicked.connect(dialog.accept) ok.setDefault(True) cancel = Qt.QPushButton('Cancel') hlay.addWidget(cancel) cancel.clicked.connect(dialog.reject) hlay.addStretch(1) # Reducing the list of scans to selection all_scans = self.table_data.scans_to_visualize self.table_data.scans_to_visualize = self.documents self.table_data.scans_to_search = self.documents self.table_data.update_visualized_rows(all_scans) res = dialog.exec_() if res == Qt.QDialog.Accepted: points = self.table_data.selectedIndexes() result_names = [] for point in points: row = point.row() # We get the FileName of the scan from the first row scan_name = self.table_data.item(row, 0).text() value = self.project.session.get_value(COLLECTION_CURRENT, scan_name, TAG_FILENAME) value = os.path.abspath( os.path.join(self.project.folder, value)) result_names.append(value) self.display_files(result_names)