示例#1
0
 def test_rmdir(self):
     temp_test_dir = Util.path_conversion("tests/temp/temp_test")
     Util.mkdir(temp_test_dir)
     self.assertTrue(Util.is_dir(temp_test_dir))
     Util.rmdir(temp_test_dir)
     self.assertFalse(Util.is_dir(temp_test_dir))
     Util.rmdir(Util.path_conversion("tests/temp"))
示例#2
0
    def load_settings(self):
        """Load settings values into memory on startup.
        """
        # If settings file doesnt exist
        if not Util.is_file(SettingsManager.file_path):
            # If directory doesnt exist
            if not Util.is_dir(SettingsManager.settings_path):
                Util.mkdir(SettingsManager.settings_path)
            # Create user settings with default
            SettingsManager.create_settings(SettingsManager.filename)

        with open(SettingsManager.file_path, "r") as file:
            file_settings = json.load(file)
            self.stl_dir = file_settings["stl_dir"]
            self.part_name = file_settings["part_name"]
            self.part_dir = file_settings["part_dir"]
            self.author_default = file_settings["author"]
            self.license_default = file_settings["license"]