def searchList(self, mistakes_id): self.ids.container.clear_widgets() if len(mistakes_id) == 0: accordItem = AccordionItem( background_normal='images/accordion_normal.png', background_selected='images/accordion_selected.png', background_disabled_normal='images/accordion_normal.png', background_disabled_selected='images/accordion_selected.png') accordItem.title = "No archive found!" self.ids.container.add_widget(accordItem) dates = {} for id in mistakes_id: mistake_date = get_mistake_date(id).strftime("%Y-%m-%d") if mistake_date not in dates: dates[mistake_date] = [id] else: dates[mistake_date].append(id) for date in dates: accordItem = AccordionItem( background_normal='images/accordion_normal.png', background_selected='images/accordion_selected.png', background_disabled_normal='images/accordion_normal.png', background_disabled_selected='images/accordion_selected.png') scroll = ScrollView() grid = GridLayout(id='grid', size_hint_y=None, cols=1, row_default_height='80dp', row_force_default=True, spacing=20, padding=20) grid.bind(minimum_height=grid.setter('height')) scroll.add_widget(grid) accordItem.add_widget(scroll) accordItem.title = date self.ids.container.add_widget(accordItem) id_list = dates[date] # go through all mistakes for the day for id in id_list: mistake_noun = get_mistake_noun(id) mistake_verb = get_mistake_verb(id) mistake_time = get_mistake_date(id).strftime("%H:%M:%S") mistake_cost = str(get_mistake_cost(id)) new = Entry(name=mistake_noun, verb=mistake_verb, time=mistake_time, cost=mistake_cost) grid.add_widget(new)
def set_sections(self): for each in sections: item = AccordionItem() item.pos = (0, 0) item.title = sections[each] detail = DetailedData(each) item.add_widget(detail) self.ids.container.add_widget(item)
def searchList(self, mistakes_id): self.ids.container.clear_widgets() if len(mistakes_id) == 0: accordItem = AccordionItem(background_normal='images/accordion_normal.png', background_selected='images/accordion_selected.png', background_disabled_normal='images/accordion_normal.png', background_disabled_selected='images/accordion_selected.png') accordItem.title = "No archive found!" self.ids.container.add_widget(accordItem) dates = {} for id in mistakes_id: mistake_date = get_mistake_date(id).strftime("%Y-%m-%d") if mistake_date not in dates: dates[mistake_date] = [id] else: dates[mistake_date].append(id) for date in dates: accordItem = AccordionItem(background_normal='images/accordion_normal.png', background_selected='images/accordion_selected.png', background_disabled_normal='images/accordion_normal.png', background_disabled_selected='images/accordion_selected.png') scroll = ScrollView() grid = GridLayout(id='grid', size_hint_y=None, cols=1, row_default_height='80dp', row_force_default=True, spacing=20, padding=20) grid.bind(minimum_height=grid.setter('height')) scroll.add_widget(grid) accordItem.add_widget(scroll) accordItem.title = date self.ids.container.add_widget(accordItem) id_list = dates[date] # go through all mistakes for the day for id in id_list: mistake_noun = get_mistake_noun(id) mistake_verb = get_mistake_verb(id) mistake_time = get_mistake_date(id).strftime("%H:%M:%S") mistake_cost = str(get_mistake_cost(id)) new = Entry(name=mistake_noun, verb=mistake_verb, time=mistake_time, cost=mistake_cost) grid.add_widget(new)
def order_by_category(self): self.ids.container.clear_widgets() self.ids.search_holder.clear_widgets() self.ids.search_holder.size_hint = (1, 0) if self.searchFlag: self.searchFlag = False for cate in self.category: if cate == 'omission': accordItem = AccordionItem( background_normal='images/accordion_normal.png', background_selected='images/accordion_selected.png', background_disabled_normal='images/accordion_normal.png', background_disabled_selected='images/accordion_selected.png' ) else: accordItem = AccordionItem( background_normal='images/accordion_normal.png', background_selected='images/accordion_selected.png', background_disabled_normal='images/accordion_normal.png', background_disabled_selected='images/accordion_selected.png' ) scroll = ScrollView() grid = GridLayout(id='grid', size_hint_y=None, cols=1, row_default_height='80dp', row_force_default=True, spacing=20, padding=20) grid.bind(minimum_height=grid.setter('height')) scroll.add_widget(grid) accordItem.add_widget(scroll) accordItem.title = cate accordItem.font_name = 'Ubuntu' self.ids.container.add_widget(accordItem) id_list = self.category[cate] for id in id_list: mistake_noun = get_mistake_noun(id) mistake_verb = get_mistake_verb(id) mistake_time = get_mistake_date(id).strftime("%H:%M:%S") mistake_cost = str(get_mistake_cost(id)) new = Entry(name=mistake_noun, verb=mistake_verb, time=mistake_time, cost=mistake_cost) grid.add_widget(new) self.ids.by_day.background_color = get_color_from_hex('#5D535E') self.ids.by_cat.background_color = get_color_from_hex('#669999') self.ids.by_search.background_color = get_color_from_hex('#5D535E')
def __init__(self, **kwargs): super(Favorites, self).__init__(**kwargs) self.mistakes_list = {'2016-02-31': 'Missed the morning class', '2016-01-31': 'Overslept', '2015-02-31': 'Forgot to call papaw'} accordItem1 = AccordionItem() accordItem1.add_widget(Slide().build()) accordItem1.title = 'Stats' self.ids.container.add_widget(accordItem1) accordItem2 = AccordionItem() scroll = ScrollView() grid = GridLayout(id='grid', size_hint_y=None, cols=1, row_default_height='20dp', row_force_default=True, spacing=20, padding=20) grid.bind(minimum_height=grid.setter('height')) scroll.add_widget(grid) accordItem2.add_widget(scroll) accordItem2.title = 'History Mistakes' self.ids.container.add_widget(accordItem2) # self.add_widget(scroll) for date, mistake in self.mistakes_list.iteritems(): new = Mistake(date=date, mistake=mistake) grid.add_widget(new)
def order_by_category(self): self.ids.container.clear_widgets() self.ids.search_holder.clear_widgets() self.ids.search_holder.size_hint=(1, 0) if self.searchFlag: self.searchFlag = False for cate in self.category: if cate == 'omission': accordItem = AccordionItem(background_normal='images/accordion_normal.png', background_selected='images/accordion_selected.png', background_disabled_normal='images/accordion_normal.png', background_disabled_selected='images/accordion_selected.png') else: accordItem = AccordionItem(background_normal='images/accordion_normal.png', background_selected='images/accordion_selected.png', background_disabled_normal='images/accordion_normal.png', background_disabled_selected='images/accordion_selected.png') scroll = ScrollView() grid = GridLayout(id='grid', size_hint_y=None, cols=1, row_default_height='80dp', row_force_default=True, spacing=20, padding=20) grid.bind(minimum_height=grid.setter('height')) scroll.add_widget(grid) accordItem.add_widget(scroll) accordItem.title = cate accordItem.font_name = 'Ubuntu' self.ids.container.add_widget(accordItem) id_list = self.category[cate] for id in id_list: mistake_noun = get_mistake_noun(id) mistake_verb = get_mistake_verb(id) mistake_time = get_mistake_date(id).strftime("%H:%M:%S") mistake_cost = str(get_mistake_cost(id)) new = Entry(name=mistake_noun, verb=mistake_verb, time=mistake_time, cost= mistake_cost) grid.add_widget(new) self.ids.by_day.background_color = get_color_from_hex('#5D535E') self.ids.by_cat.background_color = get_color_from_hex('#669999') self.ids.by_search.background_color = get_color_from_hex('#5D535E')
def fill_accordion_item(self, store): storage_butt = AccordionItem() storage_butt.id = str(store.id) storage_butt.height = 22 storage_butt.title = str(store.name) scroll = ScrollView() scroll.do_scroll_x = False scroll.size_hint = (1, 1) scroll.bar_color = [.5, .10, .15, .8] scroll.bar_inactive_color = [.5, .20, .10, .5] scroll.scroll_type = ['bars'] # [‘bars’, ‘content’] tree_obj = TreeView() tree_obj.size_hint = (1, None) tree_obj.hide_root = True store.tree_view = WeakProxy(tree_obj) scroll.add_widget(tree_obj) storage_butt.add_widget(scroll) return storage_butt
def order_by_time(self): self.all_entries = [] self.dates = {} self.category = {} self.ids.container.clear_widgets() self.ids.search_holder.clear_widgets() self.ids.search_holder.size_hint = (1, 0) self.all_entries = get_all_entries_id() if self.all_entries is None: self.list_empty_archive() return # Get all mistakes and get date list for ind, eid in enumerate(self.all_entries): mistakes_id = get_entry_mistakes_id(eid) if mistakes_id is None: continue # parse all mistakes by date and categories for id in mistakes_id: mistake_date = get_mistake_date(id).strftime("%Y-%m-%d") if mistake_date not in self.dates: self.dates[mistake_date] = [id] else: self.dates[mistake_date].append(id) self.category['omission'] = get_mistakes_category_id(True) self.category['commission'] = get_mistakes_category_id(False) if self.searchFlag: self.searchFlag = False self.sortedDate = [] for date in self.dates: self.sortedDate.append( datetime.datetime.strptime(date, '%Y-%m-%d').date()) print("date: " + str(sorted(self.sortedDate))) # Iterate over date list and order mistakes by date for date in sorted(self.sortedDate): accordItem = AccordionItem( background_normal='images/accordion_normal.png', background_selected='images/accordion_selected.png', background_disabled_normal='images/accordion_normal.png', background_disabled_selected='images/accordion_selected.png') scroll = ScrollView() grid = GridLayout(id='grid', size_hint_y=None, cols=1, row_default_height='80dp', row_force_default=True, spacing=20, padding=20) grid.bind(minimum_height=grid.setter('height')) scroll.add_widget(grid) accordItem.add_widget(scroll) accordItem.title = date.strftime("%Y-%m-%d") self.ids.container.add_widget(accordItem) id_list = self.dates[date.strftime("%Y-%m-%d")] # go through all mistakes for the day for id in id_list: mistake_noun = get_mistake_noun(id) mistake_verb = get_mistake_verb(id) mistake_time = get_mistake_date(id).strftime("%H:%M:%S") mistake_cost = str(get_mistake_cost(id)) new = Entry(name=mistake_noun, verb=mistake_verb, time=mistake_time, cost=mistake_cost) grid.add_widget(new) self.ids.by_day.background_color = get_color_from_hex('#669999') self.ids.by_cat.background_color = get_color_from_hex('#5D535E') self.ids.by_search.background_color = get_color_from_hex('#5D535E')
def order_by_time(self): self.all_entries = [] self.dates = {} self.category = {} self.ids.container.clear_widgets() self.ids.search_holder.clear_widgets() self.ids.search_holder.size_hint=(1, 0) self.all_entries = get_all_entries_id() if self.all_entries is None: self.list_empty_archive() return # Get all mistakes and get date list for ind, eid in enumerate(self.all_entries): mistakes_id = get_entry_mistakes_id(eid) if mistakes_id is None: continue # parse all mistakes by date and categories for id in mistakes_id: mistake_date = get_mistake_date(id).strftime("%Y-%m-%d") if mistake_date not in self.dates: self.dates[mistake_date] = [id] else: self.dates[mistake_date].append(id) self.category['omission'] = get_mistakes_category_id(True) self.category['commission'] = get_mistakes_category_id(False) if self.searchFlag: self.searchFlag = False self.sortedDate= [] for date in self.dates: self.sortedDate.append(datetime.datetime.strptime(date, '%Y-%m-%d').date()) print("date: " + str(sorted(self.sortedDate))) # Iterate over date list and order mistakes by date for date in sorted(self.sortedDate): accordItem = AccordionItem(background_normal='images/accordion_normal.png', background_selected='images/accordion_selected.png', background_disabled_normal='images/accordion_normal.png', background_disabled_selected='images/accordion_selected.png') scroll = ScrollView() grid = GridLayout(id='grid', size_hint_y=None, cols=1, row_default_height='80dp', row_force_default=True, spacing=20, padding=20) grid.bind(minimum_height=grid.setter('height')) scroll.add_widget(grid) accordItem.add_widget(scroll) accordItem.title = date.strftime("%Y-%m-%d") self.ids.container.add_widget(accordItem) id_list = self.dates[date.strftime("%Y-%m-%d")] # go through all mistakes for the day for id in id_list: mistake_noun = get_mistake_noun(id) mistake_verb = get_mistake_verb(id) mistake_time = get_mistake_date(id).strftime("%H:%M:%S") mistake_cost = str(get_mistake_cost(id)) new = Entry(name=mistake_noun, verb=mistake_verb, time=mistake_time, cost=mistake_cost) grid.add_widget(new) self.ids.by_day.background_color = get_color_from_hex('#669999') self.ids.by_cat.background_color = get_color_from_hex('#5D535E') self.ids.by_search.background_color = get_color_from_hex('#5D535E')