def __init__(self, ws: [Workspace, _workspace_test_proxy]): super(ResourceSearchPathCollector, self).__init__() self._ws = ws self._paths = [] self._dir_mtimes = {} self._scheduled_files = [] self._timestamp_path = os.path.join(ws.cwd, '.last_collection_check') self._is_posix = sys.platform in {'linux', 'darwin'} self.satpy_readers = config.get('data_reading.readers') if not self.satpy_readers: self.satpy_readers = available_satpy_readers()
def _init_file_page(self): if self.AVAILABLE_READERS: readers = self.AVAILABLE_READERS else: satpy_readers = config.get('data_reading.readers') readers = available_satpy_readers(as_dict=True) readers = (r for r in readers if not satpy_readers or r['name'] in satpy_readers) readers = sorted(readers, key=lambda x: x.get('long_name', x['name'])) readers = OrderedDict((ri.get('long_name', ri['name']), ri['name']) for ri in readers) OpenFileWizard.AVAILABLE_READERS = readers for idx, (reader_short_name, reader_name) in enumerate(readers.items()): self.ui.readerComboBox.addItem(reader_short_name, reader_name) if self.config['default_reader'] == reader_name: self.ui.readerComboBox.setCurrentIndex(idx)
def __init__(self, base_dir=None, parent=None): super(OpenFileWizard, self).__init__(parent) # enable context menus self.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu) # assume this doesn't change through the lifetime of the wizard self.config = config.get('open_file_wizard') self.last_open_dir = base_dir self._all_filenames = set() self._filelist_changed = False # tuple(filenames) -> scene object self.scenes = {} self.all_available_products = None self._previous_reader = None self.file_groups = {} self.unknown_files = set() app = QtWidgets.QApplication.instance() self._unknown_icon = app.style().standardIcon( QtGui.QStyle.SP_DialogCancelButton) self._known_icon = QtGui.QIcon() # self._known_icon = app.style().standardIcon(QtGui.QStyle.SP_DialogApplyButton) self.ui = Ui_openFileWizard() self.ui.setupUi(self) self.ui.addButton.released.connect(self.add_file) self.ui.removeButton.released.connect(self.remove_file) # Connect signals so Next buttons are determined by selections on pages self._connect_next_button_signals(self.ui.fileList, self.ui.fileSelectionPage) # self.ui.fileList.model().rowsInserted.connect(self._file_selection_or_reader_changed) # self.ui.fileList.model().rowsRemoved.connect(self._file_selection_or_reader_changed) # self.ui.fileList.itemChanged.connect(self._file_selection_or_reader_changed) self.filesChanged.connect(self._file_selection_or_reader_changed) self.ui.readerComboBox.currentIndexChanged.connect( self._file_selection_or_reader_changed) self.ui.statusMessage.setText("") # Page 2 - Product selection self._connect_next_button_signals(self.ui.selectIDTable, self.ui.productSelectionPage) self._all_selected = True self.ui.selectAllButton.clicked.connect(self.select_all_products_state) self.ui.selectIDTable.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) self.ui.selectIDTable.customContextMenuRequested.connect( self._product_context_menu)