[Bug] "Save As" namechange not reflected in Python console

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
Post Reply
Malendryn
Posts: 14
Joined: Wed Apr 06, 2016 6:44 pm

[Bug] "Save As" namechange not reflected in Python console

Post by Malendryn »

I found an anomaly in the latest 0.20 version (may have existed in prior versions too) reguarding saving a document under a new name using "File->Save As"

OS: Windows 10 Version 2009
Word size of FreeCAD: 64-bit
Version: 0.20.27422 (Git)
Build type: Release
Branch: master
Hash: d938733eaf2c2ce7cb18d1cbb56147185c473530
Python version: 3.8.6+
Qt version: 5.15.2
Coin version: 4.0.1
OCC version: 7.5.3
Locale: English/United States (en_US)

Steps to reproduce:
1) open FreeCad and close all current projects.
2) Open View->Panels->Python console
3) Create a new document, name is now 'Unnamed'
4) Select 'File->Save As' and save this document under a new name.
5) Verify the name changed in the Combo View->Model window as well as the bar at the bottom.
6) Verify in the Python console that it called App.getDocument("Unnamed").saveAs(....) with the new document name.

7) Select 'File->Save' (or Ctrl+S) and verify in the Python console that it still says 'App.getDocument("Unnamed").save'

8) quit/close the document and reopen it off disk ('File->Open') and now if you hit Ctrl+S it will show the correct name in the Python console

It appears to not have renamed the python object in-memory that's housing the document to match its new name. I realize this is relatively harmless, but at first glance it was a little unnerving, and I had to run further tests just to be sure it wasn't overwriting the original file!
wmayer
Founder
Posts: 20324
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: [Bug] "Save As" namechange not reflected in Python console

Post by wmayer »

It appears to not have renamed the python object in-memory that's housing the document to match its new name. I realize this is relatively harmless, but at first glance it was a little unnerving, and I had to run further tests just to be sure it wasn't overwriting the original file!
Unnamed is the internal name of the document and it will never be renamed. Only closing and reopening a document will change its name.
Post Reply