triplus / ShortCuts

Shortcuts overlay for FreeCAD
10 stars 4 forks source link

IndexError: list index out of range #6

Closed j-wiedemann closed 4 years ago

j-wiedemann commented 4 years ago

Hello,

I was looking for a list of all shortcut and try this shortcut addon. But i get this output error :

Traceback (most recent call last): File "/home/jo/.FreeCAD/Mod/ShortCuts/ShortCuts_Gui.py", line 422, in onPreferences dia = preferences() File "/home/jo/.FreeCAD/Mod/ShortCuts/ShortCuts_Gui.py", line 356, in preferences cBox = comboBox() File "/home/jo/.FreeCAD/Mod/ShortCuts/ShortCuts_Gui.py", line 187, in comboBox icon = wbIcon(Gui.listWorkbenches()[i].Icon) File "/home/jo/.FreeCAD/Mod/ShortCuts/ShortCuts_Gui.py", line 50, in wbIcon .split('"', 1)[1]) IndexError: list index out of range

FreeCAD Version :

OS: Ubuntu 18.04.3 LTS Word size of OS: 64-bit Word size of FreeCAD: 64-bit Version: 0.18.4. Build type: Release Python version: 3.6.8 Qt version: 5.9.5 Coin version: 4.0.0a OCC version: 7.3.0 Locale: French/France (fr_FR)

triplus commented 4 years ago

Hi.

Could you provide the output of this code snippet:

for w in Gui.listWorkbenches():
    print(w)

Thanks.

j-wiedemann commented 4 years ago

Hello, thanks for your reply. Here is the output:

for w in Gui.listWorkbenches():
...     print(w)
... 
NoneWorkbench
ArchWorkbench
CompleteWorkbench
DraftWorkbench
DrawingWorkbench
FemWorkbench
ImageWorkbench
InspectionWorkbench
MeshWorkbench
OpenSCADWorkbench
PartWorkbench
PartDesignWorkbench
PathWorkbench
PointsWorkbench
RaytracingWorkbench
ReverseEngineeringWorkbench
RobotWorkbench
SketcherWorkbench
SpreadsheetWorkbench
StartWorkbench
SurfaceWorkbench
TechDrawWorkbench
TestWorkbench
WebWorkbench
dodo
CurvedShapesWB
NurbsWorkbench
WebToolsWorkbench
BIMWorkbench
FastenersWorkbench
TimberWorkbench
RenderWorkbench
ScriptXWorkbench
A2plusWorkbench
DefeaturingWB
ExplodedAssembly
MoocWorkbench
flamingoToolsWorkbench
AirPlaneDesignWorkbench
Silk
CfdWorkbench
SMWorkbench
ManipulatorWB
ArchTextureWorkbench
WFrame
PCB
KiCadStepUpWB
CurvesWorkbench
template_workbench
frame_workbench
PlotWorkbench
ShipWorkbench
pallet_workbench
triplus commented 4 years ago

I suspect one of the modules has a workbench icon in XPM format and an icon itself likely has some "special structure". As all modules from the list are not available from Addon manager i didn't try to find the module with such XPM icon, instead i just implemented a fix, that uses default FreeCAD icon. In cases where workbench XPM icon parsing doesn't work as expected.

Please update the ShortCuts module and test if the reported issue is fixed.

j-wiedemann commented 4 years ago

Hi triplus ! It's working now, thanks. Indeed the new wood-frame wb (which is not in the addon manager list) have xpm icon.

Can we get a printable shortcuts list with your addon ?

triplus commented 4 years ago

Best if you open a new "issue" report (feature request) for that. Describing more in detail on what such feature should do. For example to print a list of command names and set shortcuts to Report view? In the future there will likely be import/export functionality, but your feature request seems more basic.

Thanks.

j-wiedemann commented 4 years ago

Done : https://github.com/triplus/ShortCuts/issues/7