Macro editor window bug on Windows

Matthias,

A short time ago I posted about how on Win 7 with KL 0.23.3 I am observing problems - when the Macro Editor is open and you do some KLayout function that opens another dialog window (such as "Move By"), the second dialog window (eg "Move By" dialog) and the Macro Editor both flicker and become unresponsive, and eventually the program crashes. You mentioned you were not aware of that bug because you use KL on Linux, so it must be a Windows thing.

Anyway in an effort to help you track down that bug I have tried a few things.

The crash does happen if you have Macro Editor open and do any of the following functions: (this is not a complete list)

  • File > Save as
  • File > Layout properties
  • File > Layout statistics

The crash does not happen if you have Macro Editor open and do any of the following functions that open a dialog box: (this is not a complete list)

  • File > Setup
  • File > Import > Other file into current
  • File > Log viewer
  • File > Layout statistics, if you don't have a current layout open (because in that case it says "No current view to show layout statistics for" and you click OK, and it doesn't have any issues.
  • Edit > Cell > New cell
  • Edit > Layer > New layer
  • Any Qt dialog that you've coded in a Ruby script

Anyway, that's just a sampling. It is clear it has issue on some functions but not on others. Perhaps by glancing at this list you can tell what is the common factor that defines one list or the other.

If you need more examples I'd be happy to try the other functions and report which ones exhibit the bug

This prompts a suggestion: Perhaps in a future release, the Macro Editor would have a toggle button that enables/disables debugging mode. When enabled it is as it is now. When disabled however, the running script doesn't stop for any breakpoints, doesn't return focus to the Macro Editor after a script is run, doesn't output to the console, etc. Basically in the latter case the Macro Editor is simply a notepad with "Save" and "Run" features. (Currently I actually use an actual notepad app for this, because of this issue.) Disabling this toggle button would allow much faster running of intensive scripts at the cost of debugging mode.

Just an idea!

Thanks,
David

Comments

  • edited November -1

    Hi David,

    thanks for your efforts to trace down the issue. I'll try my best to reproduce it.

    Regarding the non-debugger run mode: I was not aware of this. My reasoning was that people would close the macro editor if they don't want to run the macro in the debugger. I'll note that for the next major release.

    Best regards,

    Matthias

  • edited November -1

    Hi David,

    I tried my best, but I still cannot reproduce it. I'm using Windows 7, 64bit SP1. But I'm using KLayout 0.23.4 - I'm not aware of anything that I changed related to the macro IDE, so it should behave the same way than 0.23.3.

    Here's how I cannot reproduce the issue:

    • I open KLayout in editor mode
    • I load some file
    • I open the macro IDE, but I don't open some macro
    • I choose "File/Save As"

    As expected, the file dialog pops up and I select a name, then the save options come up and I hit Ok. The file is saved as expected.

    The behavior does not change if I open a macro in the macro IDE or if I use "Layout properties".

    Next thing I'll try is to use 0.23.3 ...

    Matthias

  • edited November -1

    Well ... 0.23.3 32bit and 64bit ... all working as expected.

    Your list of observations indicate it's related to the window management and window activation/deactivation. Do you use some special settings on the desktop or some special configuration (i.e. remote desktop, multiple screens etc.)?

    Matthias

  • edited November -1

    !! You are quite right, I just tried it on another computer with Win 8 and a fresh KL install and it works fine!

    My apologies for assuming this was a Qt/KL issue, or at least a Win issue. It's perhaps just me that has the problem!

    Still not sure what special configuration I might be using that is causing this. No remote desktop or multiple screens. I tried a few simple things but will try further things (like reinstalling KL, trying 0.23.4 instead, etc) and let you know what I find.

    David

  • edited June 2014

    Well I am flummoxed. I have tried everything I can think of except a complete reinstall, which I am putting off until after an upcoming tapeout deadline in case one of my needed scripts breaks.. But I'll try that in a week or two and let you know if I find anything.

    In the meantime, if it helps anyone else: I usually don't run scripts from the macro editor. Instead I have attached the following code to a toolbar button. Not only does it get around the issue described here (which it seems only I have!) but scripts can run much faster.

    # This code asks for an .rb file and then runs it. Doesn't work on .lym files
    RBA::FileDialog::ask_open_file_name("Choose file", File.expand_path("C:\your_preferred_filepath"), "All files (*)")
    if !file.nil?
      if file[-2..-1] != "rb"
        raise "Error - this is not an .rb file"
      else
        load File.expand_path(file)
      end
    end
    

    It is true that instead of this you can just have a macro show up in any of the dropdown menus, and I do this for some of the main scripts. This is just an alternative that doesn't clog up the menus with every little script you may use.

    David

  • edited November -1

    Hi David,

    thanks for the note and keep trying ... I just can't debug the problem without begin able to reproduce it :-(

    Matthias

  • edited November -1
    Hi-

    Just saw this thread.
    I have the same problem as David reported - if macro editor window is open and I try File->Open in main window the app will usually crash.

    I have a win07 64bit
    using Klayout 0.23.2

    Itamar
  • edited November -1

    Hi Itamar,

    Could you try 0.23.7? There have been a couple of bug fixes since 0.23.2 and maybe the problem is a side effect of another bug.

    I am using W7 on 64bit myself on a daily basis, with and without macros and so far I have no observed a crash. It might be related to the macros you are using. If the problem still exists on 0.23.7, could you narrow it down

    Matthias

  • edited November -1
    Now that you ask to repeat it does not fail (of course).
    I will let you know if I see it or 0.23.7
  • edited November -1
    Matthias-

    I did not yet see this issue happening on 0.23.7
    However since the issue always happened to me when trying to load new gds file, maybe it is related to the line of code below which I think is depreciated

    @file_esda = RBA::FileDialog::get_open_file_name("Open ESDA file for matching", @PATH, "CSV (*.CSV)")


    Itamar
Sign In or Register to comment.