[Om...] Posted December 3 Share Posted December 3 Hello Community, I'm working on a project and need some assistance with adding a filter in the dialogue window of my code. Specifically, I want the window to only display .vgl files. Here's the current code snippet I'm using: "columns": 2, "name": "filesystem", "root": "Pfad_Ordner", "rows": 1, "show_date": True, "show_size": True, "filter_type": ['*.vgl'], "show_type": True, "tooltip": { "id": "", "text": "", "translatable": True }, "type": "special::filesystem", "use_multiselection": False, I’ve attempted to implement this based on the provided documentation, but so far, I haven’t been able to achieve the desired result. Could anyone guide me on how to correctly add the filter to ensure that only .vgl files are shown in the dialogue window? Your help would be greatly appreciated! Thank you in advance, Omar Link to comment Share on other sites More sharing options...
[Om...] Posted December 4 Author Share Posted December 4 I have mainly problems with the user defined dialog. it actually never give the expected result back. for a simple code import gom RESULT=gom.script.sys.execute_user_defined_dialog (file='dialog.gdlg') print(RESULT) i become this result even after choosing a file gom.dialog.DialogResult ('filesystem': None) Link to comment Share on other sites More sharing options...
[Ma...] Posted December 4 Share Posted December 4 Hi, the filters consist of the file extension and the file type description, e.g. # Show only specified file types; each list item must consist of [<filename_extension>, <description>] DIALOG.inputFile.file_types = [[‘*.g3d’, ‘Mesh data’], [‘*.stp’, ‘CAD data’]] See File widget. There are two different widgets for selecting files: File widget File system browser widget While the file widget (1) returns the selected file as the dialog result, the file system browser widget (2) provides the selected files as DIALOG.filesystemWidget.selected while the dialog is open, e.g. for using in a dialog handler. It seems that the file widget (1) is most likely what you need. Besides, ZEISS INSPECT 2025 provides the new choose_file() command, which might be sufficient for your application. Best regards, Matthias Link to comment Share on other sites More sharing options...
[Om...] Posted December 4 Author Share Posted December 4 (edited) Hi Please sign in to view this username. , Thank you very much for your response and the detailed explanation. Could you please clarify in which scenarios the file system browser widget would be useful over the file widget? My primary goal is to provide a clear view of all the files in the selected path, enabling the user to easily choose the file they wish to import into a new project. Looking forward to your insights! Best regards, Omar Edited December 4 Link to comment Share on other sites More sharing options...
[Ma...] Posted December 4 Share Posted December 4 Hi Please sign in to view this username. , I think the file system browser is useful if further examination of file properties or contents is required to allow the user to make a selection. E.g. you could summarize the size of the selected files or read a file mesh file to show its number of nodes in another widget. It might also be useful, that the file system browser shows some file properties next to the filenames and shows part of the file system structure at a glance. For showing all (filtered) files in a folder and selecting one or even multiple files, the file widget is sufficient. Best regards, Matthias Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in