def __init__(self, file_path):
        super().__init__(file_path)

        self.file_type = FileType.Project_Settings

        # Read this data in first as the U.I will need it to initialize properly
        self.project_settings = Reader.ReadAll(self.file_path)
        self.project_settings_schema = Reader.ReadAll(
            Settings.getInstance().ConvertPartialToAbsolutePath(
                "Config/ProjectSettingsSchema.yaml"))

        self.editor_ui = EditorProjectSettingsUI(self)
        Logger.getInstance().Log("Editor initialized")
Esempio n. 2
0
    def Evaluate(self, data_path):
        """ Reads in the provided project settings file path """
        self.project_settings = Reader.ReadAll(data_path)

        self.resolution = self.project_settings['Window']['resolution']
        self.resolution_options = self.project_settings['Window']['resolution_options']
        self.active_resolution = tuple(self.resolution_options[self.resolution])
Esempio n. 3
0
    def Import(self):
        super().Import()
        Logger.getInstance().Log(
            f"Importing Dialogue data for: {self.file_path}")

        file_data = Reader.ReadAll(self.file_path)

        # Skip importing if the file has no data to load
        if file_data:
            db_manager = DBManager()
            converted_data = db_manager.ConvertDialogueFileToEditorFormat(
                file_data["dialogue"])

            # The main branch is treated specially since we don't need to create it
            for branch_name, branch_data in converted_data.items():
                if not branch_name == "Main":
                    self.editor_ui.branches.CreateBranch(
                        branch_name, branch_data["description"])

                for action in branch_data["entries"]:
                    self.editor_ui.dialogue_sequence.AddEntry(
                        action, None, True)

            # Select the main branch by default
            self.editor_ui.branches.ChangeBranch(0)
Esempio n. 4
0
    def LoadStyleSettings(self, data_path):
        """ Load the editor style settings """
        #@TODO: Investigate QPalette use

        self.style_data = Reader.ReadAll(data_path)

        # Text and Font
        self.header_1_font = QtGui.QFont(self.style_data["EditorTextSettings"]["header_1_font"],self.style_data["EditorTextSettings"]["header_1_text_size"],)
        self.header_1_color = f"color: rgb({self.style_data['EditorTextSettings']['header_1_color']})"
        self.header_1_font.setBold(self.style_data["EditorTextSettings"]["header_1_is_bold"])
        self.header_1_font.setItalic(self.style_data["EditorTextSettings"]["header_1_is_italicized"])

        self.header_2_font = QtGui.QFont(self.style_data["EditorTextSettings"]["header_2_font"],self.style_data["EditorTextSettings"]["header_2_text_size"])
        self.header_2_color = f"color: rgb({self.style_data['EditorTextSettings']['header_2_color']})"
        self.header_2_font.setBold(self.style_data["EditorTextSettings"]["header_2_is_bold"])
        self.header_2_font.setItalic(self.style_data["EditorTextSettings"]["header_2_is_italicized"])

        self.editor_info_title_font = QtGui.QFont(self.style_data["EditorTextSettings"]["editor_info_title_font"],self.style_data["EditorTextSettings"]["editor_info_title_text_size"])
        self.editor_info_title_color = f"color: rgb({self.style_data['EditorTextSettings']['editor_info_title_color']})"
        self.editor_info_title_font.setBold(self.style_data["EditorTextSettings"]["editor_info_title_is_bold"])
        self.editor_info_title_font.setItalic(self.style_data["EditorTextSettings"]["editor_info_title_is_italicized"])

        self.paragraph_font = QtGui.QFont(self.style_data["EditorTextSettings"]["paragraph_font"],self.style_data["EditorTextSettings"]["paragraph_text_size"])
        self.paragraph_color = f"color: rgb({self.style_data['EditorTextSettings']['paragraph_color']})"
        self.paragraph_font.setBold(self.style_data["EditorTextSettings"]["paragraph_is_bold"])
        self.paragraph_font.setItalic(self.style_data["EditorTextSettings"]["paragraph_is_italicized"])

        self.editor_info_paragraph_font = QtGui.QFont(self.style_data["EditorTextSettings"]["editor_info_paragraph_font"],self.style_data["EditorTextSettings"]["editor_info_paragraph_text_size"])
        self.editor_info_paragraph_color = f"color: rgb({self.style_data['EditorTextSettings']['editor_info_paragraph_color']})"
        self.editor_info_paragraph_font.setBold(self.style_data["EditorTextSettings"]["editor_info_paragraph_is_bold"])
        self.editor_info_paragraph_font.setItalic(self.style_data["EditorTextSettings"]["editor_info_paragraph_is_italicized"])

        self.subtext_font = QtGui.QFont(self.style_data["EditorTextSettings"]["subtext_font"], self.style_data["EditorTextSettings"]["subtext_text_size"],QtGui.QFont.Bold)
        self.subtext_color = f"color: rgb({self.style_data['EditorTextSettings']['subtext_color']})"
        self.subtext_font.setBold(self.style_data["EditorTextSettings"]["subtext_is_bold"])
        self.subtext_font.setItalic(self.style_data["EditorTextSettings"]["subtext_is_italicized"])

        self.button_font = QtGui.QFont(self.style_data["EditorTextSettings"]["button_font"], self.style_data["EditorTextSettings"]["button_text_size"])
        self.button_color = f"color: rgb({self.style_data['EditorTextSettings']['button_color']})"
        self.button_font.setBold(self.style_data["EditorTextSettings"]["button_is_bold"])
        self.button_font.setItalic(self.style_data["EditorTextSettings"]["button_is_italicized"])

        self.button_font = QtGui.QFont(self.style_data["EditorTextSettings"]["button_font"], self.style_data["EditorTextSettings"]["button_text_size"])
        self.button_color = f"color: rgb({self.style_data['EditorTextSettings']['button_color']})"
        self.button_font.setBold(self.style_data["EditorTextSettings"]["button_is_bold"])
        self.button_font.setItalic(self.style_data["EditorTextSettings"]["button_is_italicized"])

        # Widget Misc
        self.toolbar_background_color = self.style_data["EditorInterfaceSettings"]["toolbar_background_color"]

        # Buttons
        self.general_button_background_color = self.style_data["EditorInterfaceSettings"]["general_button_background_color"]
        self.general_button_border_color = self.style_data["EditorInterfaceSettings"]["general_button_border_color"]

        self.toolbar_button_background_color = self.style_data["EditorInterfaceSettings"]["toolbar_button_background_color"]

        # State
        self.read_only_background_color = f"background-color: rgb({self.style_data['EditorStateSettings']['read_only_background_color']})"
        self.selection_color = f"selection-background-color: rgb({self.style_data['EditorStateSettings']['selection_color']})"
Esempio n. 5
0
 def ReadFromTemp(self, temp_file: str, key: str) -> str:
     """ Read from the provided temp file using the provided key, returning the results if found """
     if not os.path.exists(temp_file):
         Logger.getInstance().Log(
             f"The temp file '{temp_file}' was not found")
         return ""
     try:
         req_data = Reader.ReadAll(temp_file)[key]
         return req_data
     except Exception as exc:
         Logger.getInstance().Log(f"Failed to read '{temp_file}'")
         Logger.getInstance().Log(str(exc), 4)
         return ""
Esempio n. 6
0
 def WriteToTemp(self, temp_file: str, data: dict) -> bool:
     """ Write to the provided temp file, creating it if it doesn't already exist """
     if not os.path.exists(temp_file):
         try:
             if not os.path.exists(Settings.editor_temp_root):
                 os.mkdir(Settings.editor_temp_root)
             with open(temp_file, "w"):
                 pass
         except Exception as exc:
             Logger.getInstance().Log(f"Unable to create '{temp_file}'", 4)
             Logger.getInstance().Log(str(exc), 4)
             return False
     temp_data = Reader.ReadAll(temp_file)
     if not temp_data:
         temp_data = {}
     try:
         for key, val in data.items():
             temp_data[key] = val
     except Exception as exc:
         Logger.getInstance().Log(f"Failed to update '{temp_file}'", 4)
         Logger.getInstance().Log(str(exc), 4)
         return False
     Writer.WriteFile(temp_data, temp_file)
     return True
Esempio n. 7
0
    def __init__(self, scene_data_file, window, scene_manager):

        self.window = window
        self.scene_manager = scene_manager
        self.active_renderables = RenderableGroup()
        self.active_sounds = {}
        self.active_music = None  # Only one music stream is supported. Stores a 'SoundAction'
        self.a_manager = ActionManager(self)

        self.pause_menu = None

        # Keep track of delta time so time-based actions can be more accurate across systems
        self.delta_time = 0

        # Read in the active scene data
        self.scene_data = Reader.ReadAll(Settings.getInstance().ConvertPartialToAbsolutePath(scene_data_file))

        # Load any cached data on the scene manager
        if not self.scene_manager.resolution_multiplier:
            self.resolution_multiplier = 1
        else:
            self.resolution_multiplier = self.scene_manager.resolution_multiplier

        self.LoadSceneData()
Esempio n. 8
0
 def LoadEditorSettings(self, data_path):
     """ Reads in the main editor settings """
     self.editor_data = Reader.ReadAll(data_path)
Esempio n. 9
0
 def LoadActionDatabase(self, data_path):
     """ Reads in the 'ActionsDatabase.yaml' file """
     self.action_database = Reader.ReadAll(data_path)
Esempio n. 10
0
 def LoadProjectSettings(self):
     """ Reads the 'Game.yaml' file for the active project """
     self.user_project_data = Reader.ReadAll(self.user_project_dir + "/" + self.project_default_files['Config'])