codeQl and suggestions from discussion.

This commit is contained in:
sliptonic
2025-09-22 08:47:48 -05:00
parent 9c81c71728
commit 21fa5facbf
4 changed files with 8 additions and 15 deletions

View File

@@ -126,13 +126,12 @@ class AssetOpenDialog(QFileDialog):
# Import the external toolbits into local store
self._import_external_toolbits(external_toolbits)
# After importing, use regular deserialization since toolbits are now in local store
use_context_deserialize = False
else:
# User declined import, use context-aware deserialization for external loading
use_context_deserialize = True
pass
else:
# No external toolbits found, use regular deserialization
use_context_deserialize = False
pass
except Exception as e:
QMessageBox.critical(self, "Error", f"{file_path}: Failed to check dependencies: {e}")
return None
@@ -211,7 +210,6 @@ class AssetOpenDialog(QFileDialog):
toolbit.id = dependency_uri.asset_id
# Import the toolbit into local store
imported_uri = self.asset_manager.add(toolbit, store="local")
imported_count += 1
except Exception as e:

View File

@@ -58,7 +58,7 @@ class AssetPreferencesPage:
translate(
"CAM_PreferencesAssets",
"Note: Select the directory that will contain the "
"Bit/, Shape/, and Library/ subfolders.",
"Tool folder with Bit/, Shape/, and Library/ subfolders.",
)
)
self.asset_path_note_label.setWordWrap(True)

View File

@@ -27,7 +27,7 @@ from Path import Preferences
from Path.Preferences import addToolPreferenceObserver
from .assets import AssetManager, AssetUri, Asset, FileStore
if True:
if False:
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
Path.Log.trackModule(Path.Log.thisModule())
else:

View File

@@ -33,7 +33,7 @@ import Path.Preferences
import pathlib
# Logging setup - same pattern as Job.py
if True:
if False:
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
Path.Log.trackModule(Path.Log.thisModule())
else:
@@ -41,8 +41,8 @@ else:
if FreeCAD.GuiUp:
import FreeCADGui
from PySide.QtWidgets import QMessageBox
from PySide.QtWidgets import QApplication, QMessageBox
from PySide.QtCore import Qt
class CAMAssetMigrator:
"""
@@ -57,13 +57,8 @@ class CAMAssetMigrator:
def __init__(self):
self.pref_group_path = "User parameter:BaseApp/Preferences/Mod/CAM/Migration"
def check_migration_needed(self):
"""
Public method to check and handle CAM asset migration.
"""
self._check_migration_needed()
def _check_migration_needed(self):
def check_migration_needed(self):
"""
Check if CAM asset migration is needed for version upgrade.