View Issue Details

IDProjectCategoryView StatusLast Update
0002073FreeCADFeaturepublic2015-05-14 15:28
Reportertriplus Assigned Toyorik  
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
PlatformLinuxOSUbuntuOS Version14.04
Fixed in Version0.16 
Summary0002073: PartsLibrary.FCMacro Thumbnails
DescriptionI am not sure where to open this feature request but as i consider FreeCAD-library an official part of FreeCAD i opened this feature request here. If it should be opened on GitHub close this report and i will do that.

I use PartsLibrary.FCMacro as a tool that scan my project directory and lists all .fcstd files:

https://github.com/yorikvanhavre/FreeCAD-library

I made two variants. One enables me to add parts to current document (default behaviour):

if path.lower().endswith(".stp") or path.lower().endswith(".step") or path.lower().endswith(".brep"):
Part.show(Part.read(path))
else:
FreeCADGui.ActiveDocument.mergeProject(path)

And one that enables me to open the part inside new document:

FreeCAD.open(path)

I could probably invest time to find a solution that would add both options inside Context Menu or something similar and i could add part in active document or open it as new document from single sidebar. Anyway i am very happy for having this solution as i don't have to use file manager any more to manage FreeCAD projects.

There is one feature missing i would like to have but feel it would take me long to investigate and implement.

class ExpFileSystemModel(QtGui.QFileSystemModel):
    "a custom QFileSystemModel that displays freecad file icons"
    def __init__(self):
        QtGui.QFileSystemModel.__init__(self)

    def data(self, index, role):
        if index.column() == 0 and role == QtCore.Qt.DecorationRole:
            if index.data().lower().endswith('.fcstd'):
                return QtGui.QIcon(':icons/freecad-doc.png')
        return super(ExpFileSystemModel, self).data(index, role)

Could this logic be extended and to use for example Python zipfile module to check if thumbnail is stored inside .fcstd file and if it is use it instead of the default icon? Size of the preview icon could be controlled by setting is dimension inside macro?

Simmilar behaviour could be provided to FreeCAD-symbols sidebar?

https://github.com/FreeCAD/FreeCAD-symbols

Cheers.
TagsNo tags attached.
FreeCAD Information

Activities

triplus

2015-04-28 23:58

developer   ~0006101

Well i thought this would be simpler task to achieve but after spending few hours on it and haven't yet find solution that would actually work and to only change icon size... And i consider this should be much simpler task compared to enabling actual thumbnail support. I read Qt documentation and google for suggestions and nothing worked...

Anyway it would be nice feature to have and it would provide cross-platform simple "file manager" with .fcstd thumbnail support but as i see it now this requires much more effort and it makes more sense ATM to ignore or close this feature request and maybe somebody will tackle it in the future by having strong personal motivation to do it instead of rather working on something else.

triplus

2015-05-14 15:22

developer   ~0006135

Last edited: 2015-05-14 15:26

Done:

http://forum.freecadweb.org/viewtopic.php?f=9&t=7089&start=30#p88031

Edit:

Unless you feel FreeCAD-symbols sidebar would deserve the same treatment!

Issue History

Date Modified Username Field Change
2015-04-28 17:00 triplus New Issue
2015-04-28 23:58 triplus Note Added: 0006101
2015-05-14 15:22 triplus Note Added: 0006135
2015-05-14 15:26 triplus Note Edited: 0006135
2015-05-14 15:28 yorik Status new => closed
2015-05-14 15:28 yorik Assigned To => yorik
2015-05-14 15:28 yorik Resolution open => fixed
2015-05-14 15:28 yorik Fixed in Version => 0.16