def on_press(self, *args, **kwargs): _screen = self._current_screen() menu_screen = ValidObject.menu_screen(_screen.manager.get_screen('menu')) bikes_screen = ValidObject.bikes_screen(_screen.manager.get_screen('bikes')) maps_screen = ValidObject.maps_screen(_screen.manager.get_screen('maps')) shop_screen = ValidObject.shop_screen(_screen.manager.get_screen('shop')) screens = [menu_screen, bikes_screen, maps_screen, shop_screen] if 'BikesScreen' == _screen.__class__.__name__: if not app_config('bike', 'title'): bike_model = get_bike_by_title(bikes_screen.ids['title'].text) rest_rm = calc_rest_rm(bike_model.price) if Bike.buy(bike_model): RightPanelBtn.change_rm(screens, rest_rm) RightPanelBtn.change_character_wrap(bikes_screen.ids['character_wrap_price'], bike_model.price) RightPanelBtn.change_character_wrap(bikes_screen.ids['character_wrap_power'], bike_model.power) RightPanelBtn.change_character_wrap(bikes_screen.ids['character_wrap_speed'], bike_model.speed) RightPanelBtn.change_character_wrap(bikes_screen.ids['character_wrap_acceleration'], bike_model.acceleration) RightPanelBtn.change_character_wrap(bikes_screen.ids['character_wrap_agility'], bike_model.agility) RightPanelBtn.cancel_animation_button(screens, 'left_panel_menu_bikes') self.init_item(menu_screen.init_bike) RightPanelBtn.change_bottom_right_btn(menu_screen) bikes_screen.ids['title'].color = UColor.hex(UColor.WHITE) else: Clock.schedule_once(self._create_animation_fail, 0) Clock.schedule_once(self._clear_animation, .5) elif 'MapsScreen' == _screen.__class__.__name__: if not app_config('map', 'title'): map_model = get_map_by_title(maps_screen.ids['title'].text) rest_rm = calc_rest_rm(map_model.price) if BaseLevel.buy(map_model): RightPanelBtn.change_rm(screens, rest_rm) RightPanelBtn.change_character_wrap(maps_screen.ids['character_wrap_price'], map_model.price) RightPanelBtn.change_character_wrap(maps_screen.ids['character_wrap_record'], '/dev/') RightPanelBtn.change_character_wrap(maps_screen.ids['character_wrap_level'], map_model.level) RightPanelBtn.change_character_wrap(maps_screen.ids['character_wrap_map'], map_model.map) RightPanelBtn.change_character_wrap(maps_screen.ids['character_wrap_total_way'], map_model.total_way) RightPanelBtn.cancel_animation_button(screens, 'left_panel_menu_maps') self.init_item(menu_screen.init_map) RightPanelBtn.change_bottom_right_btn(menu_screen) maps_screen.ids['title'].color = UColor.hex(UColor.WHITE) else: Clock.schedule_once(self._create_animation_fail, 0) Clock.schedule_once(self._clear_animation, .5)
def change_character_wrap(character_wrap, value, color=UColor.hex(UColor.WHITE)): if type(value) is int: progress_bar = ValidObject.progress_bar(character_wrap.children[0].children[0]) character_wrap.value = value character_wrap.max = progress_bar.max = value if character_wrap.has_value: character_wrap.title = character_wrap.format_number() else: character_wrap.title = character_wrap.format_string() RightPanelBtn.prop_buttons_show(character_wrap) RightPanelBtn.change_color_labels_right_panel(character_wrap, color)
def define_color(self, section): return UColor.hex(UColor.WHITE) if app_config(section, 'title') == self.current_slide.item['title']\ else UColor.hex(UColor.GRAY)