def refresh(self): from mainscreen import RightClickMenu user = App.get_running_app().get_user() location_manager.is_loaded = False location_manager.get_locations() RightClickMenu.on_loc_select(None, None, user.location.name) self.refresh_characters() main_scr = App.get_running_app().get_main_screen() toolbar = main_scr.get_toolbar() toolbar.sfx_dropdown.clear_widgets() toolbar.sfx_list = [] toolbar.load_sfx() toolbar.create_sfx_dropdown() main_scr.left_tab.music_list.music_list_view.music_box_layout.clear_widgets( ) main_scr.left_tab.music_list.ready() user.get_char().nsfw_sprites = {} user.get_char().spoiler_sprites = {} user.get_char().cg_sprites = {} try: user.get_char().read_config() except AttributeError: pass user.set_char(user.get_char()) user.get_char().load() main_scr.on_new_char(user.get_char())
def _create_options(self, loc): self.options.clear() selected_loc = location_manager.get_locations()[loc.text] for location in location_manager.get_locations(): location = location_manager.get_locations()[location] for sublocation in location.sublocations: self.options.append(location.name + '_' + sublocation) self.popup.scroll_lay.clear_widgets() self.popup.dismiss() self._create_sub_popup(self, selected_loc) App.get_running_app().set_fav_subloc(self)
def on_ready(self, *args): """Called when mainscreen becomes active""" self.msg_input.ready(self) self.left_tab.ready(self) self.ooc_window.ready(self) self.log_window.ready() user_handler = App.get_running_app().get_user_handler() locations = location_manager.get_locations() config = ConfigParser() config.read('mysteryonline.ini') try: user_handler.set_current_loc(locations[str( config.get('other', 'last_location'))]) self.sprite_settings.update_sub(locations[str( config.get('other', 'last_location'))]) except KeyError: user_handler.set_current_loc(locations['Hakuryou']) self.sprite_settings.update_sub(locations['Hakuryou']) self.toolbar.set_user(self.user) self.toolbar.create_sfx_dropdown() self.sprite_preview.set_subloc(user_handler.get_current_subloc()) char = self.user.get_char() if char is not None: self.on_new_char(char) App.get_running_app().keyboard_listener.bind_keyboard()
def set_loc(self, loc, from_string=False): if from_string: locations = location_manager.get_locations() if loc in locations: self.location = locations[loc] else: self.location= None else: self.location = loc
def on_loc_select(self, inst, loc_name): main_scr = App.get_running_app().get_main_screen() user_handler = App.get_running_app().get_user_handler() try: loc = location_manager.get_locations()[loc_name] except KeyError: return user_handler.set_current_loc(loc) main_scr.sprite_settings.update_sub(loc) main_scr.sprite_preview.set_subloc(user_handler.get_current_subloc())
def create_location_buttons(self, loc_list): for l in location_manager.get_locations(): btn = Button(text=l, size_hint=(None, None), size=(200, 30)) btn.bind(on_release=lambda btn_: self.loc_drop.select(btn_.text)) loc_list.add_widget(btn) loc_list.bind(on_select=self.on_loc_select)