def load_categories(self): for category in os.listdir(EXPERIMENTS_DIR): category_dir = os.path.join(EXPERIMENTS_DIR, category) if os.path.isdir(category_dir): if os.path.isfile(os.path.join(category_dir, 'category.json')): button = CatalogItem() button.load(category_dir, 'category.json') button.bind(on_press=self.on_category) self.grid.add_widget(button)
def load_experiments(self, category): path = os.path.join('./experiments/', category) self.experiments_dir = path self.grid.clear_widgets() for experiment in os.listdir(self.experiments_dir): experiment_dir = os.path.join(self.experiments_dir, experiment) if os.path.isdir(experiment_dir): if os.path.isfile( os.path.join(experiment_dir, 'experiment.json')): button = CatalogItem() button.category = category button.load(experiment_dir, 'experiment.json') self.title = button.title button.bind(on_press=self.open_experiment) self.grid.add_widget(button)
def load_experiments(self, category): path = os.path.join('./experiments/', category) self.experiments_dir = path self.grid.clear_widgets() for experiment in os.listdir(self.experiments_dir): experiment_dir = os.path.join(self.experiments_dir, experiment) if os.path.isdir(experiment_dir): if os.path.isfile(os.path.join(experiment_dir, 'experiment.json')): button = CatalogItem() button.category = category button.load(experiment_dir, 'experiment.json') self.title = button.title button.bind(on_press=self.open_experiment) self.grid.add_widget(button)