MitjaNemec / Kicad_action_plugins

Kicad action plugins
413 stars 62 forks source link

Crash on kicad 5.0.1 Windows 10 #22

Closed GasDotto closed 5 years ago

GasDotto commented 5 years ago

Hi, I encounter a problem in my Kicad 5.0.1 installation on Windows 10, when I run your plugins I get an error "IndexError: list index out od range". The problem seems to be in the followings code:

def Run(self):
        _pcbnew_frame = \
            filter(lambda w: w.GetTitle().startswith('Pcbnew'),
                   wx.GetTopLevelWindows()
                   )[0]

I replaced it with:

    def Run(self):
        _pcbnew_frame = wx.GetActiveWindow()

And now it seems to work correctly.

By the way, your plugins are very useful, in particular the replicator. Thank you again for your great work.

MitjaNemec commented 5 years ago

Thanks for the report. I'll look into it

Would you mind copy-pasting KiCad version information

GasDotto commented 5 years ago

Hi, It is the last version:

Application: kicad
Version: (5.0.1)-3, release build
Libraries:
    wxWidgets 3.0.3
    libcurl/7.54.1 OpenSSL/1.0.2l zlib/1.2.11 libssh2/1.8.0 nghttp2/1.23.1 librtmp/2.3
Platform: Windows 8 (build 9200), 64-bit edition, 64 bit, Little endian, wxMSW
Build Info:
    wxWidgets: 3.0.3 (wchar_t,wx containers,compatible with 2.8)
    Boost: 1.60.0
    OpenCASCADE Community Edition: 6.8.0
    Curl: 7.54.1
    Compiler: GCC 7.1.0 with C++ ABI 1011

Build settings:
    USE_WX_GRAPHICS_CONTEXT=OFF
    USE_WX_OVERLAY=OFF
    KICAD_SCRIPTING=ON
    KICAD_SCRIPTING_MODULES=ON
    KICAD_SCRIPTING_WXPYTHON=ON
    KICAD_SCRIPTING_ACTION_MENU=ON
    BUILD_GITHUB_PLUGIN=ON
    KICAD_USE_OCE=ON
    KICAD_USE_OCC=OFF
    KICAD_SPICE=ON
MitjaNemec commented 5 years ago

@GasDotto As I can not reproduce the bug I'd like to ask you if you can enter following code in pcbnew console and send me back the results:

import wx
windows = wx.GetTopLevelWindows()
for win in window:
    print win.GetTitle()
GasDotto commented 5 years ago

Thank you. Did i you mean:

import wx
windows = wx.GetTopLevelWindows()
for win in windows:
    print win.GetTitle()

? The output is:

KiCad (5.0.1)-3 C:\Users\[***path***]\[***Project file***].pro

PcbNew — C:\Users\[***path***]\[***PCBnew file***].kicad_pcb

KiCAD:PCBNEW - Python Shell - PyAlaMode 0.9.8

I have replaced personal information with [...]. The path string have some spaces.

MitjaNemec commented 5 years ago

Found it. I get Pcbnew — D:\Mitja\[***path***]\[***PCBNEW file***].kicad_pcb

Notice the difference of the case of the letter n in Pcbnew

MitjaNemec commented 5 years ago

Fixed, thanks for your support.