App::PropertyFile is for getting a file that exists. Is there a property for getting save file? also applying filter to extension of files?
I think setFilter is for filtering extension, but don't know how can I use it. Thanks.
https://freecad.github.io/SourceDoc/d9/ ... yFile.html
App::PropertyFile for getting save file
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
- ebrahim raeyat
- Posts: 619
- Joined: Sun Sep 09, 2018 7:00 pm
- Location: Iran
- Contact:
Re: App::PropertyFile for getting save file
ebrahim raeyat wrote: ↑Sat Jul 30, 2022 10:16 pm App::PropertyFile is for getting a file that exists. Is there a property for getting save file? also applying filter to extension of files?
In what sense, "save file"
If you have not saved a file, FC could have created one "Unamed" and when you try to save FC will ask you for a "proper name" to assign it.
If you have saved it is in the "document tree" as a "file object".
Not knowing much more if there are some settings to activate autosaving files automatically, or making backup files.
Regards
Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.
Blog: https://okkmkblog.wordpress.com/
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.
Blog: https://okkmkblog.wordpress.com/
- ebrahim raeyat
- Posts: 619
- Joined: Sun Sep 09, 2018 7:00 pm
- Location: Iran
- Contact:
Re: App::PropertyFile for getting save file
Thanks. I mean Property for the object like this:onekk wrote: ↑Mon Aug 01, 2022 3:40 pm
In what sense, "save file"
If you have not saved a file, FC could have created one "Unamed" and when you try to save FC will ask you for a "proper name" to assign it.
If you have saved it is in the "document tree" as a "file object".
Not knowing much more if there are some settings to activate autosaving files automatically, or making backup files.
Regards
Carlo D.
Code: Select all
import FreeCAD
class SafeF2k:
def __init__(self, obj):
self.set_properties(obj)
def set_properties(self, obj):
self.Type = "f2k"
obj.Proxy = self
if not hasattr(obj, "input"):
obj.addProperty(
"App::PropertyFile",
"input",
"Safe",
)
if not hasattr(obj, "output"):
obj.addProperty(
"App::PropertyFile",
"output",
"Safe",
)
complete link: https://github.com/ebrahimraeyat/OSAFE/ ... _object.py
Re: App::PropertyFile for getting save file
I have to check but from what i know filedialog could be use to save files, there is a flag during invocation.
But now I'm not at my computer and I can't get more information.
Plus I don't know if the "App::PropertyFile" with "output" will trigger a filedialog already configured to save files.
Another think is that FileDialog if I remeber well could be set to use the standard QFileDialog and the one supplid from the OS.
Probably I'm not to being of big help, sorry!
Regards.
Carlo D.
But now I'm not at my computer and I can't get more information.
Plus I don't know if the "App::PropertyFile" with "output" will trigger a filedialog already configured to save files.
Another think is that FileDialog if I remeber well could be set to use the standard QFileDialog and the one supplid from the OS.
Probably I'm not to being of big help, sorry!
Regards.
Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.
Blog: https://okkmkblog.wordpress.com/
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.
Blog: https://okkmkblog.wordpress.com/
- ebrahim raeyat
- Posts: 619
- Joined: Sun Sep 09, 2018 7:00 pm
- Location: Iran
- Contact:
Re: App::PropertyFile for getting save file
Thanks @onekk .
I still did not know how can I do that. any Idea?
I still did not know how can I do that. any Idea?