How to clear editview with scripting?

Trying to figure out a way to clear whatever is in the editview of the current tab.

Cobbled this together. It works but is much too slow (and most definitely the wrong way to do it):

def clear_edit_view(self, sender):
    location = 0
    length = 0
    myRange = NSMakeRange( location, length )
    Doc = Glyphs.currentDocument
    GraphicView = Doc.windowController().activeEditViewController().graphicView()
    GraphicView.setSelectedRange_( myRange )
    editView = Font.parent.windowController().graphicView()
    tab = font.currentTab
    allLayers = tab.allLayers()
    for layer in allLayers:
        editView.replaceActiveLayersWithGlyphs_([])
Font.currentTab.layers = ()

Should be enought :wink:

2 Likes

FFS!
Thanks, Hugo:-)

1 Like