2025-12-01
This commit is contained in:
@@ -25,13 +25,15 @@ except Exception:
|
||||
import configparser as ConfigParser
|
||||
|
||||
from . import reporting
|
||||
from .modules.poliigon_core.addon import PoliigonUser
|
||||
from .modules.poliigon_core.api_remote_control_params import (
|
||||
CATEGORY_ALL,
|
||||
KEY_TAB_IMPORTED,
|
||||
KEY_TAB_MY_ASSETS,
|
||||
KEY_TAB_ONLINE)
|
||||
KEY_TAB_RECENT_DOWNLOADS,
|
||||
KEY_TAB_ONLINE,
|
||||
KEY_TAB_LOCAL)
|
||||
from .modules.poliigon_core.plan_manager import PoliigonSubscription
|
||||
from .modules.poliigon_core.user import PoliigonUser
|
||||
|
||||
from .dialogs.utils_dlg import check_dpi
|
||||
from .notifications import build_writing_settings_failed_notification
|
||||
@@ -47,7 +49,9 @@ DEFAULT_SETTINGS = {
|
||||
"category": {
|
||||
KEY_TAB_IMPORTED: [CATEGORY_ALL],
|
||||
KEY_TAB_MY_ASSETS: [CATEGORY_ALL],
|
||||
KEY_TAB_ONLINE: [CATEGORY_ALL]
|
||||
KEY_TAB_RECENT_DOWNLOADS: [CATEGORY_ALL],
|
||||
KEY_TAB_ONLINE: [CATEGORY_ALL],
|
||||
KEY_TAB_LOCAL: [CATEGORY_ALL]
|
||||
},
|
||||
"conform": 0,
|
||||
"default_lod": "LOD1",
|
||||
@@ -69,7 +73,7 @@ DEFAULT_SETTINGS = {
|
||||
"new_top": 1,
|
||||
"notify": 5,
|
||||
"one_click_purchase": 1,
|
||||
"page": 10,
|
||||
"page": 6,
|
||||
"popup_welcome": 0,
|
||||
"popup_download": 0,
|
||||
"popup_preview": 0,
|
||||
@@ -184,7 +188,8 @@ def _get_settings_section_user(cTB, config: ConfigParser) -> bool:
|
||||
user_id_config = config.get("user", _key)
|
||||
user.user_id = int(user_id_config)
|
||||
except ValueError:
|
||||
cTB.logger.exception(f"Couldn't set user '{user_id_config}':")
|
||||
if user_id_config not in [None, "None"]: # Typical logged out case
|
||||
cTB.logger.exception(f"Couldn't set user '{user_id_config}':")
|
||||
user.user_id = None # mark user not existent
|
||||
elif _key == "user_id":
|
||||
pass # ignore, likely a remnant from a bug during development
|
||||
@@ -224,12 +229,11 @@ def _get_settings_section_settings(cTB, config: ConfigParser) -> None:
|
||||
for _key in config.options("settings"):
|
||||
if _key.startswith("category"):
|
||||
try:
|
||||
vArea = _key.replace("category_", "")
|
||||
cTB.settings["category"][vArea] = config.get(
|
||||
cTB.settings["category"] = config.get(
|
||||
"settings", _key
|
||||
).split("/")
|
||||
if "" in cTB.settings[_key]:
|
||||
cTB.settings["category"][vArea].remove("")
|
||||
cTB.settings["category"].remove("")
|
||||
except Exception:
|
||||
pass
|
||||
else:
|
||||
@@ -365,11 +369,7 @@ def get_settings(cTB) -> None:
|
||||
cTB.settings["mat_props_edit"] = 0
|
||||
|
||||
cTB.settings["area"] = KEY_TAB_ONLINE
|
||||
cTB.settings["category"] = {
|
||||
KEY_TAB_ONLINE: [CATEGORY_ALL],
|
||||
KEY_TAB_IMPORTED: [CATEGORY_ALL],
|
||||
KEY_TAB_MY_ASSETS: [CATEGORY_ALL]
|
||||
}
|
||||
cTB.settings["category"] = [CATEGORY_ALL]
|
||||
|
||||
save_settings(cTB)
|
||||
|
||||
@@ -397,12 +397,7 @@ def _save_settings_section_settings(cTB, config: ConfigParser) -> None:
|
||||
|
||||
for _key in cTB.settings.keys():
|
||||
if _key == "category":
|
||||
for _key_asset_type in cTB.settings[_key].keys():
|
||||
config.set(
|
||||
"settings",
|
||||
_key + "_" + _key_asset_type,
|
||||
"/".join(cTB.settings[_key][_key_asset_type])
|
||||
)
|
||||
config.set("settings", _key, "/".join(cTB.settings[_key]))
|
||||
elif _key in ["add_dirs", "disabled_dirs", "mat_props", "mix_props"]:
|
||||
config.set("settings", _key, ";".join(cTB.settings[_key]))
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user