move to layer kv6 compatibility
This commit is contained in:
@ -30,7 +30,7 @@ from pcbnew import *
|
|||||||
import base64
|
import base64
|
||||||
from wx.lib.embeddedimage import PyEmbeddedImage
|
from wx.lib.embeddedimage import PyEmbeddedImage
|
||||||
import os
|
import os
|
||||||
___version___="1.2.3"
|
___version___="1.2.4"
|
||||||
|
|
||||||
from . import Move2LayerDlg
|
from . import Move2LayerDlg
|
||||||
|
|
||||||
@ -52,7 +52,13 @@ def MoveToLayer(pcb,layerId):
|
|||||||
LogMsg="selected drawings moved to "+layerName+" layer"
|
LogMsg="selected drawings moved to "+layerName+" layer"
|
||||||
wx.LogMessage(LogMsg)
|
wx.LogMessage(LogMsg)
|
||||||
#
|
#
|
||||||
|
def find_pcbnew_w():
|
||||||
|
windows = wx.GetTopLevelWindows()
|
||||||
|
pcbneww = [w for w in windows if "pcbnew" in w.GetTitle().lower()]
|
||||||
|
if len(pcbneww) != 1:
|
||||||
|
return None
|
||||||
|
return pcbneww[0]
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
# Python plugin stuff
|
# Python plugin stuff
|
||||||
@ -137,8 +143,9 @@ class move_to_draw_layer( pcbnew.ActionPlugin ):
|
|||||||
else:
|
else:
|
||||||
#from https://github.com/MitjaNemec/Kicad_action_plugins
|
#from https://github.com/MitjaNemec/Kicad_action_plugins
|
||||||
#hack wxFormBuilder py2/py3
|
#hack wxFormBuilder py2/py3
|
||||||
_pcbnew_frame = [x for x in wx.GetTopLevelWindows() if x.GetTitle().lower().startswith('pcbnew')][0]
|
#_pcbnew_frame = [x for x in wx.GetTopLevelWindows() if x.GetTitle().lower().startswith('pcbnew')][0]
|
||||||
aParameters = Move2Layer_Dlg(_pcbnew_frame)
|
pcbnew_window = find_pcbnew_w()
|
||||||
|
aParameters = Move2Layer_Dlg(pcbnew_window)
|
||||||
aParameters.Show()
|
aParameters.Show()
|
||||||
for l in range(pcbnew.PCB_LAYER_ID_COUNT):
|
for l in range(pcbnew.PCB_LAYER_ID_COUNT):
|
||||||
aParameters.m_comboBoxLayer.Append(pcbnew.GetBoard().GetLayerName(l))
|
aParameters.m_comboBoxLayer.Append(pcbnew.GetBoard().GetLayerName(l))
|
||||||
|
Reference in New Issue
Block a user