Init isPcbframe in the correct order

Fix #9205
This commit is contained in:
Marek Roszko 2021-09-22 20:59:05 -04:00
parent a2ad204f4b
commit 1463c9ab01
1 changed files with 5 additions and 7 deletions

View File

@ -27,18 +27,16 @@ from .kicad_pyeditor import KiCadEditorNotebookFrame
from .kicad_pyeditor import KiCadEditorNotebook
class KiCadPyShell(KiCadEditorNotebookFrame):
isPcbframe = False # is True only if the board editor is open,
# i.e. if Pcbnew application exists
def __init__(self, parent):
KiCadEditorNotebookFrame.__init__(self, parent)
# Search if a pcbnew frame is open, because import pcbnew can be made only if it exists.
# frame names are "SchematicFrame" and "PcbFrame"
#
# Note we must do this before the KiCadEditorNotebookFrame __init__ call because it ends up calling _setup back on us
frame = wx.FindWindowByName( "PcbFrame" )
if frame is not None:
isPcbframe = True
self.isPcbframe = frame is not None
KiCadEditorNotebookFrame.__init__(self, parent)
def _setup_startup(self):
"""Initialise the startup script."""