Compare commits

..

2 Commits

Author SHA1 Message Date
e83769090b fix: use Qt enum for setWindowModality instead of raw integer
PySide6 requires the proper enum type QtCore.Qt.WindowModal, not the
raw integer 2. The integer form was accepted by PySide2/Qt5 but raises
TypeError in PySide6.
2026-02-11 07:40:05 -06:00
6c9789fdf3 fix: use FreeCADGui.Document.Modified instead of App.Document.IsModified()
App.Document has no IsModified() method, causing Silo_Pull to crash with
AttributeError. The correct API is to get the Gui document and check its
Modified property, consistent with the pattern used elsewhere in this file
(lines 891, 913).
2026-02-10 10:39:13 -06:00
2 changed files with 7 additions and 7 deletions

View File

@@ -990,8 +990,10 @@ def _check_pull_conflicts(part_number, local_path, doc=None):
conflicts = []
# Check for unsaved changes in an open document
if doc is not None and doc.IsModified():
conflicts.append("Document has unsaved local changes.")
if doc is not None:
gui_doc = FreeCADGui.getDocument(doc.Name) if doc.Name else None
if gui_doc and gui_doc.Modified:
conflicts.append("Document has unsaved local changes.")
# Check local revision vs server latest
if doc is not None:
@@ -1213,7 +1215,7 @@ class Silo_Pull:
progress = QtGui.QProgressDialog(
f"Downloading {part_number} rev {rev_num}...", "Cancel", 0, 100
)
progress.setWindowModality(2) # Qt.WindowModal
progress.setWindowModality(QtCore.Qt.WindowModal)
progress.setMinimumDuration(0)
progress.setValue(0)

View File

@@ -392,10 +392,8 @@ class SiloOrigin:
obj.SiloPartNumber, str(file_path), properties, comment=""
)
# Clear modified flag (Modified is on Gui.Document, not App.Document)
gui_doc = FreeCADGui.getDocument(doc.Name)
if gui_doc:
gui_doc.Modified = False
# Clear modified flag
doc.Modified = False
return True
except Exception as e: