def open_store(url): """ Open the url using the first matching registered Store class. Returns True if the url was successfully opened, False otherwise. """ stores = [x for x in compass_model.getstores() if x.canhandle(url)] if len(stores) > 0: instance = stores[0](url) open_node(instance.root) return True return False
def make_filter_string(): """ Make a wxPython dialog filter string segment from dict """ filter_string = [] hdf_filter_string = [] # put HDF filters in the front for store in compass_model.getstores(): if len(store.file_extensions) == 0: continue for key in store.file_extensions: s = "{name} ({pattern_c})|{pattern_sc}".format( name=key, pattern_c=",".join(store.file_extensions[key]), pattern_sc=";".join(store.file_extensions[key])) if s.startswith("HDF"): hdf_filter_string.append(s) else: filter_string.append(s) filter_string = hdf_filter_string + filter_string filter_string.append('All Files (*.*)|*.*') pipe = "|" return pipe.join(filter_string)
def make_filter_string(): """ Make a wxPython dialog filter string segment from dict """ filter_string = [] hdf_filter_string = [] # put HDF filters in the front for store in compass_model.getstores(): if len(store.file_extensions) == 0: continue for key in store.file_extensions: s = "{name} ({pattern_c})|{pattern_sc}".format( name=key, pattern_c=",".join(store.file_extensions[key]), pattern_sc=";".join(store.file_extensions[key]) ) if s.startswith("HDF"): hdf_filter_string.append(s) else: filter_string.append(s) filter_string = hdf_filter_string + filter_string filter_string.append('All Files (*.*)|*.*'); pipe = "|" return pipe.join(filter_string)