def __init__(self, **kwargs): BetterLogger.__init__(self) FloatLayout.__init__(self, **kwargs) self.size_hint = None, None self.register_event_type("on_items")
def __init__(self, **kwargs): BetterLogger.__init__(self) FloatLayout.__init__(self, **kwargs) GlobalEvents.bind(mine_batch_finished=self.batch_finished) GlobalEvents.bind(remove_mine_finished_icon=self.remove_finished_icon) GlobalEvents.bind(on_scatter_transformed=self.update_positions)
def __init__(self, path: str): BetterLogger.__init__(self) self.path = path self.log_debug("Loading file", path) self.array = json.load(open(path))
def __init__(self, **kwargs): BetterLogger.__init__(self) ScreenManager.__init__(self, **kwargs) self.log_info("Using NoTransition") self.transition: TransitionBase = NoTransition() self.set_screen("LoadingScreen")
def __init__(self, *args, **kwargs): BetterLogger.__init__(self, *args, **kwargs) self.audio.__log_name_prefix__ = "Audio_" self.font.__log_name_prefix__ = "Font_" self.language.__log_name_prefix__ = "Language_" self.texture.__log_name_prefix__ = "Textures_" self.model.__log_name_prefix__ = "Models_" self.gameConfig.__log_name_prefix__ = "GameConfig_"
def __init__(self, **kwargs): BetterLogger.__init__(self) ScreenManager.__init__(self, **kwargs) self.log_info("Using NoTransition") self.transition: TransitionBase = NoTransition() self.transition.duration = 0 Audio.loop("main_theme")
def __init__(self, **kwargs): BetterLogger.__init__(self) ButtonBehavior.__init__(self) BoxLayout.__init__(self, **kwargs) self.label = MultiLangLabel(font_name="Buttons-merge_options_text", color=self.label_color, font_size=graphicsConfig.getint("Buttons", "flat_font_size"), size_hint=(1, 1)) self.add_widget(self.label)
def __init__(self, loader, name=''): self.name = name self.faces = [] self.loader = loader self.mtl_name = None BetterLogger.__init__(self) from resources import Textures # Circular import fix self.textures = Textures kv3WaveObject.__init__(self, loader, name='')
def __init__(self, *args, **kwargs): BetterLogger.__init__(self) self.log_deep_debug("Creating building with args", args, kwargs) self.on_building___type__(self, self.__type__) EventDispatcher.__init__(self, *args, **kwargs) SaveManager.register_update_game_data_function(self.update_game_data) if self.__type__ == "None": self.log_warning("BuildingBase needs to have a __type__, this should've be set when overridden")
def __init__(self, **kwargs): self.bg_image = Image(allow_stretch=True, keep_ratio=True) self.fg_image = Image(allow_stretch=True, keep_ratio=True) BetterLogger.__init__(self) ButtonBehavior.__init__(self) FloatLayout.__init__(self, **kwargs) self.add_widget(self.bg_image) self.add_widget(self.fg_image) self.bg_image.texture = Textures.get("Buttons", "bg_" + str(self.bg_type)) self.size_hint_x = None self.size_hint_y = graphicsConfig.getfloat("Buttons", "size_hint_y_" + str(self.size_type))
def __init__(self, **kwargs): self.bg_image = Image(allow_stretch=True, keep_ratio=True) self.fg_image = Image(allow_stretch=True, keep_ratio=True) BetterLogger.__init__(self) FloatLayout.__init__(self, **kwargs) self.bg_image.texture = Textures.get("ResourceMiner", "finished_icon_bg") self.size_hint_x = None self.size_hint_y = 0.1 self.add_widget(self.bg_image) self.add_widget(self.fg_image)
def convert(array: {str: str}): path: {str: str} = {} def loop_inner(a: {str: str}, p: str): # array, path for i in a: if isinstance(a[i], dict): loop_inner(a[i], p + str(i) + ".") else: path[p + str(i)] = a[i] loop_inner(array, "") BetterLogger(name="lang_converter").log_deep_debug("Converted", array) BetterLogger(name="lang_converter").log_deep_debug("to", path) return path
class _SaveManager(EventDispatcher, BetterLogger): tick_logger = BetterLogger(name="SaveManager_tick() | ") save_clock: ClockEvent = None _game_data_updaters: list[callable] = list() def __init__(self): EventDispatcher.__init__(self) BetterLogger.__init__(self, name="SaveManager") def setup(self): pass def start_clock(self): self.save_clock = Clock.schedule_interval(lambda _elapsed_time: self.tick(), userSettings.getint("time_between_save")) self.log_info("Clock started") def end_clock(self): self.save_clock.cancel() self.tick() self.log_info("Clock stopped") def tick(self): t = Thread(target=self._tick) self.log_deep_debug("Created thread -", t, " Starting now") self.tick_logger.__log_name_suffix__ = str(t.getName()) t.start() def _tick(self): logger = self.tick_logger logger.log_debug("Getting info to save for gameData") for updater in self._game_data_updaters: updater() logger.log_debug("Getting info to save for userSettings") logger.log_info("Saving...") gameData.save() userSettings.save() logger.log_info("Saved") def register_update_game_data_function(self, function: callable): self._game_data_updaters.append(function) self.log_deep_debug("Registered save function -", function) def un_register_update_game_data_function(self, function: callable): self._game_data_updaters.remove(function) self.log_deep_debug("Unregistered save function -", function)
def __init__(self, **kwargs): BetterLogger.__init__(self) FloatLayout.__init__(self, **kwargs) self.create_renderer() if userSettings.get("debug", "building_hit_boxes"): self.bind(buildings=lambda _instance, _value: self.redraw_hit_boxes()) GlobalEvents.bind(building_moved=lambda _instance, _x, _y: self.redraw_hit_boxes(), building_rotated=lambda _instance, _rotation: self.redraw_hit_boxes()) self.log_info("Created renderer, starting to create building objects") for building_id in gameData.get("placed_buildings"): building_info = gameData.get("placed_buildings", building_id) building_class = str_to_building[building_info.pop("type")] building = building_class(**building_info) building.id = building_id self.log_debug("Created building object for building", building_id, "with info", building_info) self.add_building(building) self.log_info("Created objects -", self.buildings)
def __init__(self): BetterLogger.__init__(self)
def __init__(self, *args, **kwargs): BetterLogger.__init__(self) ConfigParser.__init__(self, *args, **kwargs)
def __init__(self, **kwargs): BetterLogger.__init__(self) Screen.__init__(self, **kwargs)
def __init__(self, **kwargs): ScatterLayout.__init__(self, **kwargs) BetterLogger.__init__(self)
os.environ["KCFG_KIVY_WINDOW_ICON"] = AppInfo.window_icon_path # noinspection PyUnresolvedReferences import kivy # noinspection PyUnresolvedReferences import kivy3 # noinspection PyUnresolvedReferences import kivy.core.window # Fixes sigsegv error when loading images because openGL was not initiated-https://github.com/kivy/kivy/issues/6173 from kivy.logger import Logger Logger.info("Base: Kivy module fully loaded") from lib.betterLogger import redo_logger_formatting, BetterLogger redo_logger_formatting() Logger.info("Base: Kivy logger overwritten") base_logger: BetterLogger = BetterLogger(name="Base") """ from resources import Resources, setup setup() Resources.load_all() Logger.info("Base: resources setup and loaded")""" from lib.saveManager import SaveManager SaveManager.setup() base_logger.log_info("SaveManager setup") import graphics graphics.setup()
def __init__(self, **kwargs): BetterLogger.__init__(self) FloatLayout.__init__(self, **kwargs) self.add_widget(self.move_buttons_holder) self.add_widget(self.custom_buttons_holder)
from __future__ import annotations from typing import TYPE_CHECKING if TYPE_CHECKING: pass from lib.betterLogger import BetterLogger logger = BetterLogger(name="GlobalEvents") class GlobalEvents: bindings: dict[str, list] = {} @classmethod def bind(cls, **kwargs): for event_name, function in kwargs.items(): cls.check_binding(event_name) cls.bindings[event_name].append(function) logger.log_debug(function, "was bound to event '", event_name, "'") @classmethod def register(cls, event_name: str): cls.bindings[event_name] = list() logger.log_debug("Event '", event_name, "' has been created") @classmethod def dispatch(cls, event_name: str, *args, **kwargs): cls.check_binding(event_name)
def get_sm() -> SpaceBuilderMergeGameScreenManager: BetterLogger().log_deep_debug("get_sm(): Returning screen manager") return App.get_running_app().root.current
def __init__(self): EventDispatcher.__init__(self) BetterLogger.__init__(self, name="SaveManager")
def __init__(self, **kwargs): BetterLogger.__init__(self) kv3OBJLoader.__init__(self, **kwargs)
def __init__(self, **kwargs: any): BetterLogger.__init__(self) Image.__init__(self, **kwargs) self.on_text_id(self, self.text_id)
def __init__(self): BetterLogger.__init__(self) EventDispatcher.__init__(self) self.language_code = userSettings.get("UI", "language")
def get_sm() -> APP_NAME_ScreenManager: BetterLogger().log_deep_debug("get_sm(): Returning screen manager") return App.get_running_app().root.current