Load EditableTexts in Drawing

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
ian.rees
Posts: 696
Joined: Sun Jun 15, 2014 3:28 am
Contact:

Load EditableTexts in Drawing

Post by ian.rees »

https://github.com/ianrrees/FreeCAD_tin ... ee/fix2064 has a potential solution for http://www.freecadweb.org/tracker/view.php?id=2064 . I think there's probably a better way to do it, but don't want to put too much work into the old Drawing ;).

If it'a possible to suppress the call to FeaturePage::onChanged() at the end of FeaturePage::onDocumentRestored(), that might be better? -Ian-
User avatar
shoogen
Veteran
Posts: 2823
Joined: Thu Dec 01, 2011 5:24 pm

Re: Load EditableTexts in Drawing

Post by shoogen »

Why is this topic archived?
ian.rees
Posts: 696
Joined: Sun Jun 15, 2014 3:28 am
Contact:

Re: Load EditableTexts in Drawing

Post by ian.rees »

Dunno - it's entirely possible that I put it here by accident... -Ian-
wmayer
Founder
Posts: 20324
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Load EditableTexts in Drawing

Post by wmayer »

According to the moderator logs there has been moved only one post to the archive and this was about the PropertyEnumeration. So, I guess this post must have been created here. I'll move it to the Developers corner.
ian.rees
Posts: 696
Joined: Sun Jun 15, 2014 3:28 am
Contact:

Re: Load EditableTexts in Drawing

Post by ian.rees »

Does anyone have a better idea of how to fix issue 2064, or should this one be merged? Thanks! -Ian-
wmayer
Founder
Posts: 20324
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Load EditableTexts in Drawing

Post by wmayer »

The old check for !isRestoring() in FeaturePage::onChanged() doesn't work as intended, because by the point that onDocumentRestored() is called, isRestoring() returns false.
The isRestoring() method queries a certain bit from the StatusBits bitset and this is set before calling a feature's Restore() method and unset afterwards. So, inside your onDocoumentRestored() method you can call "StatusBits.set(4);" at the beginning and "StatusBits.reset(4);" at the end.
wmayer
Founder
Posts: 20324
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Load EditableTexts in Drawing

Post by wmayer »

OK, I tried it and it works pretty well: git commit 74c912f
ian.rees
Posts: 696
Joined: Sun Jun 15, 2014 3:28 am
Contact:

Re: Load EditableTexts in Drawing

Post by ian.rees »

Cool, thanks! -Ian-
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: Load EditableTexts in Drawing

Post by triplus »

I compiled FreeCAD today and tested:

I can confirm edited text does not get replaced anymore. Thanks for fixing this. Issue 2064 therefore is fixed. In other thread i mentioned one more consequence i found regarding changes introduced in issue report 1963:

- Insert drawing template. Original Template
- Change drawing template (Property Template). Changed Template
- Save the FreeCAD document.

Inside .fcstd file Changed Template will be saved but it will have Original Template file name. Trying to edit titleblock text after FreeCAD restart will therefore result in loading default Original Template. Should i make new issue report?
ian.rees
Posts: 696
Joined: Sun Jun 15, 2014 3:28 am
Contact:

Re: Load EditableTexts in Drawing

Post by ian.rees »

triplus wrote:Inside .fcstd file Changed Template will be saved but it will have Original Template file name. Trying to edit titleblock text after FreeCAD restart will therefore result in loading default Original Template. Should i make new issue report?
Yeah, probably a good idea to make a new ticket for this. I'm personally going to try and stay focused on the new Drawing, which I think will handle this situation differently by design. -Ian-
Post Reply