From f7a1ac44f83e520fafb2c37122912cc436111a15 Mon Sep 17 00:00:00 2001 From: easyw Date: Sun, 3 Nov 2019 23:27:45 +0100 Subject: [PATCH] move2layer ... initial dialog --- MoveToLayer/Move2LayerDlg.py | 6 +- .../__pycache__/Move2LayerDlg.cpython-36.pyc | Bin 1928 -> 0 bytes .../__pycache__/__init__.cpython-36.pyc | Bin 228 -> 0 bytes .../__pycache__/move_to_layer.cpython-36.pyc | Bin 3209 -> 0 bytes MoveToLayer/move_to_layer (copy).py | 248 --- MoveToLayer/move_to_layer.py | 20 +- MoveToLayer/move_to_layer_dlg-t.fbp | 1623 ----------------- MoveToLayer/move_to_layer_dlg.fbp | 10 +- __init__.py | 11 + 9 files changed, 38 insertions(+), 1880 deletions(-) delete mode 100644 MoveToLayer/__pycache__/Move2LayerDlg.cpython-36.pyc delete mode 100644 MoveToLayer/__pycache__/__init__.cpython-36.pyc delete mode 100644 MoveToLayer/__pycache__/move_to_layer.cpython-36.pyc delete mode 100644 MoveToLayer/move_to_layer (copy).py delete mode 100644 MoveToLayer/move_to_layer_dlg-t.fbp create mode 100644 __init__.py diff --git a/MoveToLayer/Move2LayerDlg.py b/MoveToLayer/Move2LayerDlg.py index 08838fe..c380ba4 100644 --- a/MoveToLayer/Move2LayerDlg.py +++ b/MoveToLayer/Move2LayerDlg.py @@ -17,7 +17,7 @@ import wx.xrc class Move2LayerDlg ( wx.Dialog ): def __init__( self, parent ): - wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = u"Move to Layer", pos = wx.DefaultPosition, size = wx.Size( 390,180 ), style = wx.CAPTION|wx.CLOSE_BOX|wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER ) + wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = u"Move to Layer", pos = wx.DefaultPosition, size = wx.Size( 325,180 ), style = wx.CAPTION|wx.CLOSE_BOX|wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER ) self.SetSizeHints( wx.DefaultSize, wx.DefaultSize ) @@ -36,8 +36,8 @@ class Move2LayerDlg ( wx.Dialog ): bSizer31.Add( self.m_staticTextLayer, 1, wx.ALL|wx.EXPAND, 5 ) m_comboBoxLayerChoices = [] - self.m_comboBoxLayer = wx.ComboBox( self, wx.ID_ANY, u"Combo!", wx.DefaultPosition, wx.DefaultSize, m_comboBoxLayerChoices, 0 ) - bSizer31.Add( self.m_comboBoxLayer, 0, wx.ALL, 5 ) + self.m_comboBoxLayer = wx.ComboBox( self, wx.ID_ANY, u"Combo!", wx.DefaultPosition, wx.Size( 250,-1 ), m_comboBoxLayerChoices, 0 ) + bSizer31.Add( self.m_comboBoxLayer, 0, wx.ALL|wx.EXPAND, 5 ) bSizer3.Add( bSizer31, 0, 0, 5 ) diff --git a/MoveToLayer/__pycache__/Move2LayerDlg.cpython-36.pyc b/MoveToLayer/__pycache__/Move2LayerDlg.cpython-36.pyc deleted file mode 100644 index 34b0d7f221135865dda61ece8f49e1770fa6a8f0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1928 zcmZuyOK;mo5MDk-$(CiuuhdmtrAgBYMeI639|(#fl*CvAmOvh#vRalm9|5?d(!g6sIf9?Ck8!H;>(=9u$j(-M{|)@v{O#f1{-# zgZv06xeJUSA_U0JX2C|sh=@dbjfmu-zBrX^i3nX(m9M}SSuW%AA%gG-C@BN;kS!2o zi$oyeYXn{rkztmJ0^TYuei!}X-8Y>}FKz^9E^}o=1FU#R-}SAVFy0 zGLXWOnu;K)K)D*T(>Tx95Rre&321`)1<-FsPLQTbTdPk`@{U+R003JStWbie-rdK z{-+Ywi&-Tgy$`fpOBre@LoFp;#r^Du7ez-@hTOrzXM*2(}IW}Peh(K>fhy&QU4RL_>}1gf-AXhjrpCd zq)~-mOaE5^p{qaOB32bD`h+T}p9UV4hEYQ0#2JY zFOUi`AfYSH6p*OG1B}&r6rM)6Y(*aqgG;K`oq_8GSO3C@i(toDwMxa87gTNdP7s|@ z4P$@crx;VU)xf&-oR%8i3uhFhCsE?3el(zRm*tkL>nFWd+oJip+3p&+)_z8}8pdP& zsoBGgmTtC>akux}G-$D7bXzvF=roKDUF~`)LumSgG@&aqbdIUjq6;R(RQulO^jdY@ zq=jzkq`uqpE>b%mVmAsyZ;(>?hu9fXNhbuDX;RgAcA{GiT4=UAExT>?bkp7lak6mc zEuk83352mr9P2a!Iop~AGW~%^i)IVI0iwk@Pym}pbj1jV>18*K{lOUpoHs#^K0l({ zy4gCmaNV$aMh7qIP-~+!h3+ZP*7g&-5aLs=Xg`4xy>!+FnuqPWZq*IbUYna_=SEjD z;7;qf*`wO5i!oIp{b-cJ@j_o>kIJ=nuL)m3Iq`xQR2@1o>sRiSH}-+8&4eR+=UNBq z=aKJv$=vklcNBjKx8$GZ;dvB#hoLh%Jow3X9fF6!=*%A^hkSLh<*jKQmIgE)HVBCa7!v8LW z@%HsN+`@wQ3eRNVgdRMT0>)uPMgfyoG5&ev1lbO+HvanUP^_Ubix;yH8$b!mPZPB- nxTY${Yp|y3%Zr1H*o{lD;2TTnE-mUadS9#`0|UcjAcg}bAj<)Wi=}`>3PTEG4nrxyr<<5ul9`{UTaurjQ>^a` pv@9gw2V{$We0*kJW=VX!UP0w84x8Nkl+v73JCLi2LALQQ0s!F1KFt6C diff --git a/MoveToLayer/__pycache__/move_to_layer.cpython-36.pyc b/MoveToLayer/__pycache__/move_to_layer.cpython-36.pyc deleted file mode 100644 index 4c18bdda4eabdcc3b87b79fe8a70d4491472e995..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3209 zcmai0OOG4J5$>KBhePhlSlfEoKrk?3OQS?w?b=9SLlGqHdL_f!jSwmbLcnMYr+dkv zhBNE#rl=*jCkpU6_xyqUiTsHmm%irYe-P-DsveU2h=L4J#p*|OS66>kU0-f&MDPCj z_a8pIPsqQ>h0g=|5s)f?al&aqdi6i;QD{2_eOb4io&#;SaK~QHqjjI(^SRdxxX**4 zF%EknB~J-&@bE3+p$JFe!tFJor^zGei3A-*(9`0yOOn>lup>E2sG)a(U3+o*?YJ*E z7yP?%IuJ8|r?cDH`I*8b7~VLnUW?u5>8X(W#UMk~)#ok+^-B;0L9=_#Pvn?#%AL1i z&*d)n-jbg86Y)sThpm0HdA=OO^;T=(|B6%x8k&q?omWKOoRg6=r*miFP*QGbS9^1^ za7O;Bj}utgIhwg&b?zsDai(ufi?P>2s=O*0Gn-wZyZKB!%S)}gGvlktiI6gYO-%dZ zSmGK_iQ>5Ds@V>*T{wS}v8+gyV(f3^-LvgsH5S|Bbh6!fm1ikuC&grtmulO#?xmTA zJ@4tND%3Wf^kro|w><`#>53KT$Ii*AY{Bkd04X$s(1>n2vrjMkrgPD@%)xo^t(>$6 zvbqBdoJ|UH=4d*i;3zVu=qPZS3*;@xf+A+Di=@3%Up7EZ`oK)cSYGBDycEH1hk1#P zGL5IT#}ZezaaM4WN>S=sZxfX*yN1#Sz;=O_2MO^YH?ACHwF%q~Y*?mafg3V5uK1)t zxy{&*leDNutZ(ePW@G96OcVuU^{%*eLgfZ-ZY@9$eufrcNQGXzZLcMTByX`|uCp1deK$t<`;TnNI6VOCj_~6vOv8R+-FCbgZiw4;ptxAu=s^ zybrVUa&Si_IF=17CCa!I)7XL_zLUOA^CImRBCg8fG|tQT>Eq`~Y*&3&O;Ks0#5cBm zFGd@%3+60)0GzNCS{7IR5p<~KaF!NDtcN15L3vpT`_UAOz)M45_{GKIX%5Tu zh25W{0hiS>1QCAdR79gi;v*0+>;Z|CyPDnr1Tu$1s4|!Pz`Z#g`J=${h7K2$2Ma(e zYw`y0h&$l;aQ1I&8G89p=wStxiQ{xqXcdnqN~2X$Kv!N0zMhF8+d=5WYFJGQjJ;DtUTEYu$aPtaN-TG+qf$F6(kpLjZ#Pf_fTf)%Zk;p(s@j zcXwgdT0M@dK04RkASi;FdDOzT?corR2JU>2-U+g`ZeSH~? z|4SLb7pG+`-sDQd;#T#8j!jX!%luRhUM4N$R0<>TJe4xzp`T5-a*}CXIHU1SQav=@ zsLD&z;JK{lGIpHXAm7Y0$j7!}M?Qq>nnF^nihe3tf1-6&CXUTG@)p49Jlt)Zn{b7N z?_p43Vj^J(nKOXjO*;GZzhkzu(pY0Q0;M%(XVBmj@M@C)WKei=7UT@jyMQMLq-9#r zF6PmF$fP{DMb3Qf&;12G3+BNnSP;my!KeYV8}kOt3|~32ubVp3E&E`>t9%yn@T@s+ z@}_RzAipJNO`DISql2|w7*m+hxiL4K)LVgbBOMKhpZDjaH$pqP5WWPf8Yh?G3;ZrZS zkwJlk^#*-&_1*(D&2=_pFs?oUMjVg6?-$b97w^HqA0}nzK~X_+R1Z7#Qfs$k3d2{! zy8SZ{29UOX_~eX2nj!!K3j_`qFCl&X#re^LBt_*8OoUn?gje!qt_xxOqMCwtBc)TR zaf@N%7^ibz;=_35IPand1q2>uiiiJzVTCpXWOn!enSQQjbA=(Zk8h(6<^~(KAXLTe zXtquczl)O%YpgZ(NtH@&T43}6#N!dfv3<|Y79OKIc`jay;!khfb`*U``hW4y|s;=syQK0|h1_MF!~H(}rrkga{f zrsss$B=#lkx>Q1-n4q63@td#AN7FZ*BJX#^ve?eC*p`@#>THL`%de4PWwtC&AKQZR jg)K7e((kjwgb(UU>LD7hwt&?q4`~}b;5lt?>lgn4-p)m^ diff --git a/MoveToLayer/move_to_layer (copy).py b/MoveToLayer/move_to_layer (copy).py deleted file mode 100644 index dc31ad2..0000000 --- a/MoveToLayer/move_to_layer (copy).py +++ /dev/null @@ -1,248 +0,0 @@ -# move_to_edge_cuts.py -# -# Copyright (C) 2017 KiCad Developers, see CHANGELOG.TXT for contributors. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, -# MA 02110-1301, USA. -# -# - -import wx -import pcbnew -from pcbnew import * -import base64 -from wx.lib.embeddedimage import PyEmbeddedImage -import os -___version___="1.2.0" - - -class move_to_draw_layer( pcbnew.ActionPlugin ): - """ - A script to Move Selected Drawing(s) to chosen new Layer (available only in GAL) - How to use: - - move to GAL - - select some draw objects - - call the plugin - - select the new layer - - selected draw objects will be moved to new layer - """ - - def defaults( self ): - """ - Method defaults must be redefined - self.name should be the menu label to use - self.category should be the category (not yet used) - self.description should be a comprehensive description - of the plugin - """ - import os - self.name = "Move Selected drawings to chosen Layer\nversion "+___version___ - self.category = "Modify PCB" - self.description = "Move Selected drawings to chosen Layer on an existing PCB" - self.icon_file_name = os.path.join(os.path.dirname(__file__), "./move2layer.png") - self.show_toolbar_button = True - - def Run( self ): - found_selected=False - #wx.MessageDialog(self.frame,"ciao") - #subprocess.check_call(["C:\pathToYourProgram\yourProgram.exe", "your", "arguments", "comma", "separated"]) - #http://stackoverflow.com/questions/1811691/running-an-outside-program-executable-in-python - def switch(x): - return { - 'Edge_Cuts': pcbnew.Edge_Cuts, - 'Eco1_User': pcbnew.Eco1_User, - 'Eco2_User': pcbnew.Eco2_User, - 'Dwgs_User': pcbnew.Dwgs_User, - 'Cmts_User': pcbnew.Cmts_User, - 'Margin' : pcbnew.Margin, - 'F_CrtYd' : pcbnew.F_CrtYd, - 'B_CrtYd' : pcbnew.B_CrtYd, - 'F_Fab' : pcbnew.F_Fab, - 'B_Fab' : pcbnew.B_Fab, - 'F_SilkS' : pcbnew.F_SilkS, - 'B_SilkS' : pcbnew.B_SilkS, - }[x] - - class displayDialog(wx.Dialog): - """ - The default frame - http://stackoverflow.com/questions/3566603/how-do-i-make-wx-textctrl-multi-line-text-update-smoothly - """ - - #---------------------------------------------------------------------- - #def __init__(self): - # """Constructor""" - # wx.Frame.__init__(self, None, title="Display Frame", style=wx.DEFAULT_FRAME_STYLE, wx.ICON_INFORMATION) - # panel = wx.Panel(self) - def __init__(self, parent): - wx.Dialog.__init__(self, parent, id=-1, title="Move to Layer")# - #, style=wx.DEFAULT_DIALOG_STYLE, wx.ICON_INFORMATION) - #, style=wx.DEFAULT_DIALOG_STYLE, wx.ICON_INFORMATION) - #, pos=DefaultPosition, size=DefaultSize, style = wx.DEFAULT_FRAME_STYLE & (~wx.MAXIMIZE_BOX), name="fname") - #, wx.ICON_INFORMATION) #, title="Annular Check", style=wx.DEFAULT_FRAME_STYLE, wx.ICON_INFORMATION) - # - - self.SetIcon(PyEmbeddedImage(move_to_layer_ico_b64_data).GetIcon()) - #wx.IconFromBitmap(wx.Bitmap("icon.ico", wx.BITMAP_TYPE_ANY))) - self.panel = wx.Panel(self) - - self.ct = 0 - self.layerSelection = "Edge_Cuts" - layerList = ["Edge_Cuts", "Eco1_User", "Eco2_User", "Dwgs_User", "Cmts_User", "Margin", "F_CrtYd", "B_CrtYd", "F_Fab", "B_Fab", "F_SilkS", "B_SilkS"] - self.combo = wx.ComboBox(self.panel, choices=layerList) - self.combo.SetSelection(0) - - self.combo.Bind(wx.EVT_COMBOBOX, self.onCombo) - - self.title = wx.StaticText(self.panel, label="Move to Layer:") - #self.result = wx.StaticText(self.panel, label="") - #self.result.SetForegroundColour('#FF0000') - #self.button = wx.Button(self.panel, label="Save") - #self.lblname = wx.StaticText(self.panel, label="Your name:") - #self.editname = wx.TextCtrl(self.panel, size=(140, -1)) - ##self.editname = wx.TextCtrl(self.panel, size = (300, 400), style = wx.TE_MULTILINE|wx.TE_READONLY) - - - # Set sizer for the frame, so we can change frame size to match widgets - self.windowSizer = wx.BoxSizer() - self.windowSizer.Add(self.panel, 1, wx.ALL | wx.EXPAND) - - # Set sizer for the panel content - self.sizer = wx.GridBagSizer(5, 0) - self.sizer.Add(self.title, (0, 0)) - self.button = wx.Button(self.panel, label="OK") - self.sizer.Add(self.button, (2, 0), (1, 2), flag=wx.EXPAND) - #self.sizer.Add(self.result, (1, 0)) - #self.sizer.Add(self.lblname, (1, 0)) - ##self.sizer.Add(self.editname, (1, 0)) - self.sizer.Add(self.combo, (1, 0)) - #self.sizer.Add(self.button, (2, 0), (1, 2), flag=wx.EXPAND) - - # Set simple sizer for a nice border - self.border = wx.BoxSizer() - self.border.Add(self.sizer, 1, wx.ALL | wx.EXPAND, 5) - - # Use the sizers - self.panel.SetSizerAndFit(self.border) - self.SetSizerAndFit(self.windowSizer) - - #self.button = wx.Button(self.panel, label="Close") - self.button.Bind(wx.EVT_BUTTON, self.OnClose) - self.Bind(wx.EVT_CLOSE,self.OnClose) - - #---------------------------------------------------------------------- - def OnClose(self,e): - #wx.LogMessage("c") - e.Skip() - self.Close() - #self.result.SetLabel(msg) - # Set event handlers - #self.button.Bind(wx.EVT_BUTTON, self.OnButton) - #self.Show() - #self.Bind(wx.EVT_CLOSE,self.OnClose) - def onCombo(self, event): - """ - """ - self.layerSelection = self.combo.GetValue() - - #def OnClose(self,e): - # #wx.LogMessage("c") - # e.Skip() - #self.Close() - - #def OnButton(self, e): - # self.result.SetLabel(self.editname.GetValue()) - #def setMsg(self, t_msg): - # self.editname.SetValue(t_msg) - - board = pcbnew.GetBoard() - #wx.MessageDialog(None, 'This is a message box.', 'Test', wx.OK | wx.ICON_INFORMATION).ShowModal() - fileName = GetBoard().GetFileName() - if len(fileName)==0: - wx.LogMessage("a board needs to be saved/loaded!") - else: - LogMsg='' - msg="'move to layer tool'\n" - msg+="version = "+___version___ - frame = displayDialog(None) - #frame = wx.Frame(None) - frame.Center() - #frame.setMsg(LogMsg) - frame.ShowModal() - #dlg.Destroy() - frame.Destroy() - - #dlg=wx.MessageBox( 'Changing Layer for Selected?', 'Confirm', wx.YES_NO | wx.NO_DEFAULT | wx.ICON_QUESTION ) - dlg=wx.MessageBox( 'Changing Layer for Selected '+frame.layerSelection+ '?', 'Confirm', wx.YES_NO | wx.NO_DEFAULT | wx.ICON_WARNING ) - if dlg == wx.YES: - #wx.LogMessage("YES") - #wx.LogMessage(str(board.IsModified())) - #board.SetModified() - #wx.LogMessage(str(board.IsModified())) - #try: - # board_drawings=board.GetDrawings() - #except: - # board_drawings=board.DrawingsList() - # - #for drw in board_drawings: - for drw in board.GetDrawings(): - if drw.IsSelected(): - drw.SetLayer(switch(frame.layerSelection)) - found_selected=True - - if found_selected!=True: - LogMsg="select lines to be moved to new layer\n" - LogMsg+="use GAL for selecting lines" - wx.LogMessage(LogMsg) - else: - pcbnew.Refresh() - LogMsg="selected drawings moved to "+frame.layerSelection+" layer" - wx.LogMessage(LogMsg) - - - - -#move_to_draw_layer().register() - - -# "b64_data" is a variable containing your base64 encoded jpeg -move_to_layer_ico_b64_data =\ -""" -iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAKYQAACmEB/MxKJQAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAJrSURBVDiNnZRRSFNxFMa/s3vlLje3y0bpdKkwrcTCxbChQUIPUWBJ0IvQy3STCIkgoehFJIKCHkSCkLRBVNJT0EPQQ4W9bFmJDS0TSmwbc65ku7ZrY96dHsQ1yQfnB+flcPj9/985h0O+iz5nVtJGwGwjprEHg6N92IHErKSNTB9fcKmmDPa9qb3gdt9dmJg48hIQIswudaOwt7fXmhZXbzOhTdDgr7ZW3+rv78/lQWC2qaYMQIBSnjasrBqGAAawBqJ3ywDCACInzlod2dOT+xO1CtUFbVeFcHQawPM8iJjGGt7aPakK1Vg1Y02FYnu8AMkA7IVRJqfqv9YqlBNzWHIkTXLc0F4IImZGT09Pa06CU/udfeL3+5Nb9aD7Uvf1ZVv62pIjWbY3aP9jTgtHh4eHJzeBtqOBgQFdNB5t/x6xD4aCLksiUbGb2ZXNFzBzUQEEO4AgA8GOwrxuW9/ZJPEFgGUA5wuzRYPW7dBTAO1EH807Bq1LewRAD2jnCl4orkcbIUnj887me3M+n6+Vmbc/tUJ5PB45q9eHY01xo5zYlTT/0o8WZY1oSiYKnJybP/Q45lw0LDYmMNv2Q2biThHAlgtJBB3wvgHQWgBqAdAC4ACgo2+zdVl3JKSh4adYqkgAUUzsutx9R6lWPakK1Vg5VX7DaHx1P502HgbgBmAGCACiAAIAjwC6QDxeMmldEW5antV3gihWkhG8IhN3fjkWsYCA3JpgqXEsXPkcavwAwA9wABACzM3h/42e6gOQPzkiiGKlilSpmjIwL5UqVU1TZ2Y+dY0XOwCxJCN4D76u+XfYHg4VDQGAvyJXT3w3dEsJAAAAAElFTkSuQmCC""" - -# pcbnew.F_Cu -# pcbnew.In1_Cu -# pcbnew.In2_Cu -#.. -# pcbnew.In30_Cu -# pcbnew.B_Cu -# pcbnew.B_Adhes -# pcbnew.F_Adhes -# pcbnew.B_Paste -# pcbnew.F_Paste -# pcbnew.B_SilkS -# pcbnew.F_SilkS -# pcbnew.B_Mask -# pcbnew.F_Mask -# pcbnew.Dwgs_User -# pcbnew.Cmts_User -# pcbnew.Eco1_User -# pcbnew.Eco2_User -# pcbnew.Edge_Cuts -# pcbnew.Margin -# pcbnew.B_CrtYd -# pcbnew.F_CrtYd -# pcbnew.B_Fab -# pcbnew.F_Fab diff --git a/MoveToLayer/move_to_layer.py b/MoveToLayer/move_to_layer.py index f36106f..50ecd01 100644 --- a/MoveToLayer/move_to_layer.py +++ b/MoveToLayer/move_to_layer.py @@ -203,6 +203,17 @@ class move_to_draw_layer( pcbnew.ActionPlugin ): board = pcbnew.GetBoard() #wx.MessageDialog(None, 'This is a message box.', 'Test', wx.OK | wx.ICON_INFORMATION).ShowModal() fileName = GetBoard().GetFileName() + # # dicts for converting layer name to id, used by _get_layer + # _std_layer_dict = {pcbnew.BOARD_GetStandardLayerName(n): n + # for n in range(pcbnew.PCB_LAYER_ID_COUNT)} + # #_std_layer_names = {s: n for n, s in _std_layer_dict.iteritems()} + # _std_layer_names = {s: n for n, s in _std_layer_dict.items()} + # _brd_layer_dict = {pcbnew.GetBoard().GetLayerName(n): n + # for n in range(pcbnew.PCB_LAYER_ID_COUNT)} + # #_std_layer_names = {s: n for n, s in _std_layer_dict.iteritems()} + # _brd_layer_names = {s: n for n, s in _brd_layer_dict.items()} + + if 0: #len(fileName) == 0: wx.LogMessage("A board needs to be saved/loaded\nto run the plugin!") else: @@ -211,9 +222,16 @@ class move_to_draw_layer( pcbnew.ActionPlugin ): _pcbnew_frame = [x for x in wx.GetTopLevelWindows() if x.GetTitle().lower().startswith('pcbnew')][0] aParameters = Move2Layer_Dlg(_pcbnew_frame) aParameters.Show() + for l in range(pcbnew.PCB_LAYER_ID_COUNT): + aParameters.m_comboBoxLayer.Append(pcbnew.GetBoard().GetLayerName(l)) + aParameters.m_comboBoxLayer.Select(44) modal_result = aParameters.ShowModal() if modal_result == wx.ID_OK: - MoveToLayer(pcb, Layer) + LayerName = aParameters.m_comboBoxLayer.GetStringSelection() + idx = aParameters.m_comboBoxLayer.FindString(LayerName) + LayerStdName = pcbnew.BOARD_GetStandardLayerName(idx) + wx.LogMessage(LayerName+';'+str(idx)+';'+LayerStdName) + #MoveToLayer(pcb, Layer) else: None # Cancel diff --git a/MoveToLayer/move_to_layer_dlg-t.fbp b/MoveToLayer/move_to_layer_dlg-t.fbp deleted file mode 100644 index 824981f..0000000 --- a/MoveToLayer/move_to_layer_dlg-t.fbp +++ /dev/null @@ -1,1623 +0,0 @@ - - - - - - Python - 1 - source_name - 0 - 0 - res - UTF-8 - connect - viafence_basedialogs - 1000 - none - - 0 - viafence_basedialogs - - .. - - 1 - 1 - 1 - 1 - UI - 0 - 0 - - 0 - wxAUI_MGR_DEFAULT - - wxBOTH - - 1 - 1 - impl_virtual - - - - 0 - wxID_ANY - -1,-1 - -1,-1 - MainDialogBase - - 503,567 - wxCAPTION|wxCLOSE_BOX|wxRESIZE_BORDER - - Via Fence Generator - - - - - OnInitDialog - - - mainSizer - wxVERTICAL - none - - 5 - wxEXPAND - 1 - - - wxBOTH - 0 - - 0 - - gbSizer4 - wxFLEX_GROWMODE_SPECIFIED - none - 0 - - 5 - 1 - 0 - wxEXPAND - 0 - 1 - - - bSizer23 - wxVERTICAL - none - - 5 - wxALL|wxEXPAND - 1 - - wxID_ANY - Via Settings - - sbSizer2 - wxVERTICAL - 1 - none - - 5 - wxEXPAND - 1 - - 2 - wxBOTH - 1 - - 0 - - fgSizer4 - wxFLEX_GROWMODE_SPECIFIED - none - 8 - 0 - - 5 - wxALL|wxALIGN_CENTER_VERTICAL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Offset (mm): - 0 - - 0 - - - 0 - - 1 - m_staticText11 - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - 5 - wxALL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - - 0 - -1,-1 - 1 - txtViaOffset - 1 - - - protected - 1 - - Resizable - 1 - - wxTE_PROCESS_ENTER|wxTE_RIGHT - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - 5 - wxALL|wxALIGN_CENTER_VERTICAL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Pitch (mm): - 0 - - 0 - - - 0 - - 1 - m_staticText21 - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - 5 - wxALL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - - 0 - - 1 - txtViaPitch - 1 - - - protected - 1 - - Resizable - 1 - - wxTE_PROCESS_ENTER|wxTE_RIGHT - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - 5 - wxALL|wxALIGN_CENTER_VERTICAL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Via Drill (mm): - 0 - - 0 - - - 0 - - 1 - m_staticText13 - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - 5 - wxALL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - - 0 - - 1 - txtViaDrill - 1 - - - protected - 1 - - Resizable - 1 - - wxTE_PROCESS_ENTER|wxTE_RIGHT - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - 5 - wxALL|wxALIGN_CENTER_VERTICAL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Via Size (mm): - 0 - - 0 - - - 0 - - 1 - m_staticText14 - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - 5 - wxEXPAND|wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - - 0 - - 1 - txtViaSize - 1 - - - protected - 1 - - Resizable - 1 - - wxTE_PROCESS_ENTER|wxTE_RIGHT - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - 5 - wxALL|wxALIGN_CENTER_VERTICAL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Via Net: - 0 - - 0 - - - 0 - - 1 - m_staticText23 - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - 5 - wxEXPAND|wxALL - 1 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - lstViaNet - 1 - - - protected - 1 - - Resizable - 0 - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - 5 - 1 - 1 - wxEXPAND|wxALL - 0 - 1 - - - bSizer21 - wxVERTICAL - none - - 5 - - 0 - - 9 - protected - 0 - - - - 5 - wxEXPAND - 1 - - 1 - 1 - 1 - 1 - - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - bmpViafence - 1 - - - protected - 1 - - Resizable - 1 - - - 0 - - - - - - - - - - 5 - 1 - 0 - wxALL|wxEXPAND - 1 - 1 - - wxID_ANY - Input Tracks - - sbSizer411 - wxVERTICAL - 1 - none - - 5 - wxEXPAND - 0 - - 1 - 0 - - gSizer4 - none - 3 - 0 - - 5 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Include Selected - - 0 - - - 0 - - 1 - chkIncludeSelection - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - 5 - wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Include Drawing Lines - - 0 - - - 0 - - 1 - chkIncludeDrawing - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - 5 - wxEXPAND|wxALIGN_CENTER_VERTICAL - 1 - - 2 - wxHORIZONTAL - 1 - - 10 - - fgSizer311 - wxFLEX_GROWMODE_SPECIFIED - none - 1 - 0 - - 5 - wxALL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Net(s): - - 0 - - - 0 - - 1 - chkNetFilter - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnNetFilterCheckBox - - - - 5 - wxALL|wxEXPAND - 1 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - - 1 - - 1 - 0 - Dock - 0 - Left - 0 - - 1 - - 0 - 0 - wxID_ANY - - 0 - -1,-1 - - 0 - - 1 - txtNetFilter - 1 - - - protected - 1 - - Resizable - -1 - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - Combo! - - - - - - - - - 5 - wxEXPAND|wxALIGN_CENTER_VERTICAL - 1 - - 2 - wxHORIZONTAL - 1 - - 10 - - fgSizer31 - wxFLEX_GROWMODE_SPECIFIED - none - 1 - 0 - - 5 - wxALL|wxEXPAND - 1 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Layer: - - 0 - - - 0 - - 1 - chkLayer - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnLayerCheckBox - - - - 5 - wxALL|wxEXPAND - 1 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - - 1 - - 1 - 0 - Dock - 0 - Left - 0 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - lstLayer - 1 - - - protected - 1 - - Resizable - 0 - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - 5 - 1 - 1 - wxEXPAND|wxALL - 1 - 1 - - wxID_ANY - Output VIAs - - sbSizer4 - wxVERTICAL - 1 - none - - 5 - wxEXPAND - 1 - - 1 - 0 - - gSizer2 - none - 3 - 0 - - 5 - wxEXPAND|wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT - 1 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Keep VIAs in Via Net zones only - - 0 - - - 0 - - 1 - chkSameNetZoneViasOnly - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - 5 - wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT|wxLEFT - 1 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Remove VIAs violating clearance rules - - 0 - - - 0 - - 1 - chkRemoveViasWithClearanceViolation - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - 5 - wxALIGN_CENTER|wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - - 1 - 0 - 1 - - 1 - - 0 - 0 - - Dock - 0 - Left - 1 - - 1 - - - 0 - 0 - wxID_ANY - Delete Vias - - 0 - - 0 - - - 0 - - 1 - m_buttonDelete - 1 - - - protected - 1 - - - - Resizable - 1 - - - ; ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - 5 - wxEXPAND - 0 - - - bSizer5 - wxHORIZONTAL - none - - 5 - wxALL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Debug Dump - - 0 - - - 0 - - 1 - chkDebugDump - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - 5 - wxEXPAND - 1 - - 0 - protected - 0 - - - - 5 - wxEXPAND|wxALL - 0 - - 0 - 1 - 0 - 0 - 0 - 1 - 0 - 0 - - m_sdbSizer1 - protected - - - - - - - - diff --git a/MoveToLayer/move_to_layer_dlg.fbp b/MoveToLayer/move_to_layer_dlg.fbp index cd5db6e..5735e63 100644 --- a/MoveToLayer/move_to_layer_dlg.fbp +++ b/MoveToLayer/move_to_layer_dlg.fbp @@ -45,7 +45,7 @@ Move2LayerDlg - 390,180 + 325,180 wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER Move to Layer @@ -191,7 +191,7 @@ 5 - wxALL + wxALL|wxEXPAND 0 1 @@ -225,9 +225,9 @@ 0 - + -1,-1 0 - + -1,-1 1 m_comboBoxLayer 1 @@ -239,7 +239,7 @@ Resizable -1 1 - + 250,-1 ; ; forward_declare 0 diff --git a/__init__.py b/__init__.py new file mode 100644 index 0000000..001b420 --- /dev/null +++ b/__init__.py @@ -0,0 +1,11 @@ +# pcbnew loads this folder as a package using import +# thus __init__.py (this file) is executed +# We import the plugin class here and register it to pcbnew + +from . import AnnularChecker + +from . import FabricationPositions + +from . import MoveToLayer + +from . import PcbToDxf