PreferencesUI.py 208 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081
  1. from PyQt5.QtCore import QSettings
  2. from flatcamGUI.GUIElements import *
  3. import platform
  4. import webbrowser
  5. import sys
  6. from flatcamEditors.FlatCAMGeoEditor import FCShapeTool
  7. import gettext
  8. import FlatCAMTranslation as fcTranslate
  9. import builtins
  10. fcTranslate.apply_language('strings')
  11. if '_' not in builtins.__dict__:
  12. _ = gettext.gettext
  13. class OptionsGroupUI(QtWidgets.QGroupBox):
  14. def __init__(self, title, parent=None):
  15. # QtGui.QGroupBox.__init__(self, title, parent=parent)
  16. super(OptionsGroupUI, self).__init__()
  17. self.setStyleSheet("""
  18. QGroupBox
  19. {
  20. font-size: 16px;
  21. font-weight: bold;
  22. }
  23. """)
  24. self.layout = QtWidgets.QVBoxLayout()
  25. self.setLayout(self.layout)
  26. class GeneralPreferencesUI(QtWidgets.QWidget):
  27. def __init__(self, parent=None):
  28. QtWidgets.QWidget.__init__(self, parent=parent)
  29. self.layout = QtWidgets.QHBoxLayout()
  30. self.setLayout(self.layout)
  31. self.general_app_group = GeneralAppPrefGroupUI()
  32. self.general_app_group.setMinimumWidth(290)
  33. self.general_gui_group = GeneralGUIPrefGroupUI()
  34. self.general_gui_group.setMinimumWidth(250)
  35. self.general_gui_set_group = GeneralGUISetGroupUI()
  36. self.general_gui_set_group.setMinimumWidth(250)
  37. self.layout.addWidget(self.general_app_group)
  38. self.layout.addWidget(self.general_gui_group)
  39. self.layout.addWidget(self.general_gui_set_group)
  40. self.layout.addStretch()
  41. class GerberPreferencesUI(QtWidgets.QWidget):
  42. def __init__(self, parent=None):
  43. QtWidgets.QWidget.__init__(self, parent=parent)
  44. self.layout = QtWidgets.QHBoxLayout()
  45. self.setLayout(self.layout)
  46. self.gerber_gen_group = GerberGenPrefGroupUI()
  47. self.gerber_gen_group.setMinimumWidth(250)
  48. self.gerber_opt_group = GerberOptPrefGroupUI()
  49. self.gerber_opt_group.setMinimumWidth(250)
  50. self.gerber_exp_group = GerberExpPrefGroupUI()
  51. self.gerber_exp_group.setMinimumWidth(230)
  52. self.gerber_adv_opt_group = GerberAdvOptPrefGroupUI()
  53. self.gerber_adv_opt_group.setMinimumWidth(200)
  54. self.gerber_editor_group = GerberEditorPrefGroupUI()
  55. self.gerber_editor_group.setMinimumWidth(200)
  56. self.vlay = QtWidgets.QVBoxLayout()
  57. self.vlay.addWidget(self.gerber_opt_group)
  58. self.vlay.addWidget(self.gerber_exp_group)
  59. self.layout.addWidget(self.gerber_gen_group)
  60. self.layout.addLayout(self.vlay)
  61. self.layout.addWidget(self.gerber_adv_opt_group)
  62. self.layout.addWidget(self.gerber_editor_group)
  63. self.layout.addStretch()
  64. class ExcellonPreferencesUI(QtWidgets.QWidget):
  65. def __init__(self, parent=None):
  66. QtWidgets.QWidget.__init__(self, parent=parent)
  67. self.layout = QtWidgets.QHBoxLayout()
  68. self.setLayout(self.layout)
  69. self.excellon_gen_group = ExcellonGenPrefGroupUI()
  70. self.excellon_gen_group.setMinimumWidth(220)
  71. self.excellon_opt_group = ExcellonOptPrefGroupUI()
  72. self.excellon_opt_group.setMinimumWidth(290)
  73. self.excellon_exp_group = ExcellonExpPrefGroupUI()
  74. self.excellon_exp_group.setMinimumWidth(250)
  75. self.excellon_adv_opt_group = ExcellonAdvOptPrefGroupUI()
  76. self.excellon_adv_opt_group.setMinimumWidth(250)
  77. self.excellon_editor_group = ExcellonEditorPrefGroupUI()
  78. self.excellon_editor_group.setMinimumWidth(260)
  79. self.vlay = QtWidgets.QVBoxLayout()
  80. self.vlay.addWidget(self.excellon_opt_group)
  81. self.vlay.addWidget(self.excellon_exp_group)
  82. self.layout.addWidget(self.excellon_gen_group)
  83. self.layout.addLayout(self.vlay)
  84. self.layout.addWidget(self.excellon_adv_opt_group)
  85. self.layout.addWidget(self.excellon_editor_group)
  86. self.layout.addStretch()
  87. class GeometryPreferencesUI(QtWidgets.QWidget):
  88. def __init__(self, parent=None):
  89. QtWidgets.QWidget.__init__(self, parent=parent)
  90. self.layout = QtWidgets.QHBoxLayout()
  91. self.setLayout(self.layout)
  92. self.geometry_gen_group = GeometryGenPrefGroupUI()
  93. self.geometry_gen_group.setMinimumWidth(220)
  94. self.geometry_opt_group = GeometryOptPrefGroupUI()
  95. self.geometry_opt_group.setMinimumWidth(300)
  96. self.geometry_adv_opt_group = GeometryAdvOptPrefGroupUI()
  97. self.geometry_adv_opt_group.setMinimumWidth(270)
  98. self.geometry_editor_group = GeometryEditorPrefGroupUI()
  99. self.geometry_editor_group.setMinimumWidth(250)
  100. self.layout.addWidget(self.geometry_gen_group)
  101. self.layout.addWidget(self.geometry_opt_group)
  102. self.layout.addWidget(self.geometry_adv_opt_group)
  103. self.layout.addWidget(self.geometry_editor_group)
  104. self.layout.addStretch()
  105. class ToolsPreferencesUI(QtWidgets.QWidget):
  106. def __init__(self, parent=None):
  107. QtWidgets.QWidget.__init__(self, parent=parent)
  108. self.layout = QtWidgets.QHBoxLayout()
  109. self.setLayout(self.layout)
  110. self.tools_ncc_group = ToolsNCCPrefGroupUI()
  111. self.tools_ncc_group.setMinimumWidth(220)
  112. self.tools_paint_group = ToolsPaintPrefGroupUI()
  113. self.tools_paint_group.setMinimumWidth(220)
  114. self.tools_cutout_group = ToolsCutoutPrefGroupUI()
  115. self.tools_cutout_group.setMinimumWidth(220)
  116. self.tools_2sided_group = Tools2sidedPrefGroupUI()
  117. self.tools_2sided_group.setMinimumWidth(220)
  118. self.tools_film_group = ToolsFilmPrefGroupUI()
  119. self.tools_film_group.setMinimumWidth(220)
  120. self.tools_panelize_group = ToolsPanelizePrefGroupUI()
  121. self.tools_panelize_group.setMinimumWidth(220)
  122. self.tools_calculators_group = ToolsCalculatorsPrefGroupUI()
  123. self.tools_calculators_group.setMinimumWidth(220)
  124. self.tools_transform_group = ToolsTransformPrefGroupUI()
  125. self.tools_transform_group.setMinimumWidth(200)
  126. self.tools_solderpaste_group = ToolsSolderpastePrefGroupUI()
  127. self.tools_solderpaste_group.setMinimumWidth(200)
  128. self.tools_sub_group = ToolsSubPrefGroupUI()
  129. self.tools_sub_group.setMinimumWidth(200)
  130. self.vlay = QtWidgets.QVBoxLayout()
  131. self.vlay.addWidget(self.tools_ncc_group)
  132. self.vlay.addWidget(self.tools_paint_group)
  133. self.vlay1 = QtWidgets.QVBoxLayout()
  134. self.vlay1.addWidget(self.tools_cutout_group)
  135. self.vlay1.addWidget(self.tools_transform_group)
  136. self.vlay1.addWidget(self.tools_2sided_group)
  137. self.vlay2 = QtWidgets.QVBoxLayout()
  138. self.vlay2.addWidget(self.tools_panelize_group)
  139. self.vlay2.addWidget(self.tools_calculators_group)
  140. self.vlay3 = QtWidgets.QVBoxLayout()
  141. self.vlay3.addWidget(self.tools_solderpaste_group)
  142. self.vlay3.addWidget(self.tools_sub_group)
  143. self.vlay3.addWidget(self.tools_film_group)
  144. self.layout.addLayout(self.vlay)
  145. self.layout.addLayout(self.vlay1)
  146. self.layout.addLayout(self.vlay2)
  147. self.layout.addLayout(self.vlay3)
  148. self.layout.addStretch()
  149. class CNCJobPreferencesUI(QtWidgets.QWidget):
  150. def __init__(self, parent=None):
  151. QtWidgets.QWidget.__init__(self, parent=parent)
  152. self.layout = QtWidgets.QHBoxLayout()
  153. self.setLayout(self.layout)
  154. self.cncjob_gen_group = CNCJobGenPrefGroupUI()
  155. self.cncjob_gen_group.setMinimumWidth(320)
  156. self.cncjob_opt_group = CNCJobOptPrefGroupUI()
  157. self.cncjob_opt_group.setMinimumWidth(260)
  158. self.cncjob_adv_opt_group = CNCJobAdvOptPrefGroupUI()
  159. self.cncjob_adv_opt_group.setMinimumWidth(260)
  160. self.layout.addWidget(self.cncjob_gen_group)
  161. self.layout.addWidget(self.cncjob_opt_group)
  162. self.layout.addWidget(self.cncjob_adv_opt_group)
  163. self.layout.addStretch()
  164. class UtilPreferencesUI(QtWidgets.QWidget):
  165. def __init__(self, parent=None):
  166. QtWidgets.QWidget.__init__(self, parent=parent)
  167. self.layout = QtWidgets.QHBoxLayout()
  168. self.setLayout(self.layout)
  169. self.vlay = QtWidgets.QVBoxLayout()
  170. self.fa_excellon_group = FAExcPrefGroupUI()
  171. self.fa_excellon_group.setMinimumWidth(260)
  172. self.fa_gcode_group = FAGcoPrefGroupUI()
  173. self.fa_gcode_group.setMinimumWidth(260)
  174. self.vlay.addWidget(self.fa_excellon_group)
  175. self.vlay.addWidget(self.fa_gcode_group)
  176. self.fa_gerber_group = FAGrbPrefGroupUI()
  177. self.fa_gerber_group.setMinimumWidth(260)
  178. self.kw_group = AutoCompletePrefGroupUI()
  179. self.kw_group.setMinimumWidth(260)
  180. self.layout.addLayout(self.vlay)
  181. self.layout.addWidget(self.fa_gerber_group)
  182. self.layout.addWidget(self.kw_group)
  183. self.layout.addStretch()
  184. class GeneralGUIPrefGroupUI(OptionsGroupUI):
  185. def __init__(self, parent=None):
  186. super(GeneralGUIPrefGroupUI, self).__init__(self)
  187. self.setTitle(str(_("GUI Preferences")))
  188. # Create a form layout for the Application general settings
  189. self.form_box = QtWidgets.QFormLayout()
  190. # Grid X Entry
  191. self.gridx_label = QtWidgets.QLabel('%s:' % _('Grid X value'))
  192. self.gridx_label.setToolTip(
  193. _("This is the Grid snap value on X axis.")
  194. )
  195. self.gridx_entry = FCDoubleSpinner()
  196. self.gridx_entry.set_precision(4)
  197. self.gridx_entry.setSingleStep(0.1)
  198. # Grid Y Entry
  199. self.gridy_label = QtWidgets.QLabel('%s:' % _('Grid Y value'))
  200. self.gridy_label.setToolTip(
  201. _("This is the Grid snap value on Y axis.")
  202. )
  203. self.gridy_entry = FCDoubleSpinner()
  204. self.gridy_entry.set_precision(4)
  205. self.gridy_entry.setSingleStep(0.1)
  206. # Snap Max Entry
  207. self.snap_max_label = QtWidgets.QLabel('%s:' % _('Snap Max'))
  208. self.snap_max_label.setToolTip(_("Max. magnet distance"))
  209. self.snap_max_dist_entry = FCDoubleSpinner()
  210. self.snap_max_dist_entry.set_precision(4)
  211. self.snap_max_dist_entry.setSingleStep(0.1)
  212. # Workspace
  213. self.workspace_lbl = QtWidgets.QLabel('%s:' % _('Workspace'))
  214. self.workspace_lbl.setToolTip(
  215. _("Draw a delimiting rectangle on canvas.\n"
  216. "The purpose is to illustrate the limits for our work.")
  217. )
  218. self.workspace_type_lbl = QtWidgets.QLabel('%s:' % _('Wk. format'))
  219. self.workspace_type_lbl.setToolTip(
  220. _("Select the type of rectangle to be used on canvas,\n"
  221. "as valid workspace.")
  222. )
  223. self.workspace_cb = FCCheckBox()
  224. self.wk_cb = FCComboBox()
  225. self.wk_cb.addItem('A4P')
  226. self.wk_cb.addItem('A4L')
  227. self.wk_cb.addItem('A3P')
  228. self.wk_cb.addItem('A3L')
  229. self.wks = OptionalInputSection(self.workspace_cb, [self.workspace_type_lbl, self.wk_cb])
  230. # Plot Fill Color
  231. self.pf_color_label = QtWidgets.QLabel('%s:' % _('Plot Fill'))
  232. self.pf_color_label.setToolTip(
  233. _("Set the fill color for plotted objects.\n"
  234. "First 6 digits are the color and the last 2\n"
  235. "digits are for alpha (transparency) level.")
  236. )
  237. self.pf_color_entry = FCEntry()
  238. self.pf_color_button = QtWidgets.QPushButton()
  239. self.pf_color_button.setFixedSize(15, 15)
  240. self.form_box_child_1 = QtWidgets.QHBoxLayout()
  241. self.form_box_child_1.addWidget(self.pf_color_entry)
  242. self.form_box_child_1.addWidget(self.pf_color_button)
  243. self.form_box_child_1.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  244. # Plot Fill Transparency Level
  245. self.pf_alpha_label = QtWidgets.QLabel('%s:' % _('Alpha Level'))
  246. self.pf_alpha_label.setToolTip(
  247. _("Set the fill transparency for plotted objects.")
  248. )
  249. self.pf_color_alpha_slider = QtWidgets.QSlider(QtCore.Qt.Horizontal)
  250. self.pf_color_alpha_slider.setMinimum(0)
  251. self.pf_color_alpha_slider.setMaximum(255)
  252. self.pf_color_alpha_slider.setSingleStep(1)
  253. self.pf_color_alpha_spinner = FCSpinner()
  254. self.pf_color_alpha_spinner.setMinimumWidth(70)
  255. self.pf_color_alpha_spinner.set_range(0, 255)
  256. self.form_box_child_2 = QtWidgets.QHBoxLayout()
  257. self.form_box_child_2.addWidget(self.pf_color_alpha_slider)
  258. self.form_box_child_2.addWidget(self.pf_color_alpha_spinner)
  259. # Plot Line Color
  260. self.pl_color_label = QtWidgets.QLabel('%s:' % _('Plot Line'))
  261. self.pl_color_label.setToolTip(
  262. _("Set the line color for plotted objects.")
  263. )
  264. self.pl_color_entry = FCEntry()
  265. self.pl_color_button = QtWidgets.QPushButton()
  266. self.pl_color_button.setFixedSize(15, 15)
  267. self.form_box_child_3 = QtWidgets.QHBoxLayout()
  268. self.form_box_child_3.addWidget(self.pl_color_entry)
  269. self.form_box_child_3.addWidget(self.pl_color_button)
  270. self.form_box_child_3.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  271. # Plot Selection (left - right) Fill Color
  272. self.sf_color_label = QtWidgets.QLabel('%s:' % _('Sel. Fill'))
  273. self.sf_color_label.setToolTip(
  274. _("Set the fill color for the selection box\n"
  275. "in case that the selection is done from left to right.\n"
  276. "First 6 digits are the color and the last 2\n"
  277. "digits are for alpha (transparency) level.")
  278. )
  279. self.sf_color_entry = FCEntry()
  280. self.sf_color_button = QtWidgets.QPushButton()
  281. self.sf_color_button.setFixedSize(15, 15)
  282. self.form_box_child_4 = QtWidgets.QHBoxLayout()
  283. self.form_box_child_4.addWidget(self.sf_color_entry)
  284. self.form_box_child_4.addWidget(self.sf_color_button)
  285. self.form_box_child_4.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  286. # Plot Selection (left - right) Fill Transparency Level
  287. self.sf_alpha_label = QtWidgets.QLabel('%s:' % _('Alpha Level'))
  288. self.sf_alpha_label.setToolTip(
  289. _("Set the fill transparency for the 'left to right' selection box.")
  290. )
  291. self.sf_color_alpha_slider = QtWidgets.QSlider(QtCore.Qt.Horizontal)
  292. self.sf_color_alpha_slider.setMinimum(0)
  293. self.sf_color_alpha_slider.setMaximum(255)
  294. self.sf_color_alpha_slider.setSingleStep(1)
  295. self.sf_color_alpha_spinner = FCSpinner()
  296. self.sf_color_alpha_spinner.setMinimumWidth(70)
  297. self.sf_color_alpha_spinner.set_range(0, 255)
  298. self.form_box_child_5 = QtWidgets.QHBoxLayout()
  299. self.form_box_child_5.addWidget(self.sf_color_alpha_slider)
  300. self.form_box_child_5.addWidget(self.sf_color_alpha_spinner)
  301. # Plot Selection (left - right) Line Color
  302. self.sl_color_label = QtWidgets.QLabel('%s:' % _('Sel. Line'))
  303. self.sl_color_label.setToolTip(
  304. _("Set the line color for the 'left to right' selection box.")
  305. )
  306. self.sl_color_entry = FCEntry()
  307. self.sl_color_button = QtWidgets.QPushButton()
  308. self.sl_color_button.setFixedSize(15, 15)
  309. self.form_box_child_6 = QtWidgets.QHBoxLayout()
  310. self.form_box_child_6.addWidget(self.sl_color_entry)
  311. self.form_box_child_6.addWidget(self.sl_color_button)
  312. self.form_box_child_6.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  313. # Plot Selection (right - left) Fill Color
  314. self.alt_sf_color_label = QtWidgets.QLabel('%s:' % _('Sel2. Fill'))
  315. self.alt_sf_color_label.setToolTip(
  316. _("Set the fill color for the selection box\n"
  317. "in case that the selection is done from right to left.\n"
  318. "First 6 digits are the color and the last 2\n"
  319. "digits are for alpha (transparency) level.")
  320. )
  321. self.alt_sf_color_entry = FCEntry()
  322. self.alt_sf_color_button = QtWidgets.QPushButton()
  323. self.alt_sf_color_button.setFixedSize(15, 15)
  324. self.form_box_child_7 = QtWidgets.QHBoxLayout()
  325. self.form_box_child_7.addWidget(self.alt_sf_color_entry)
  326. self.form_box_child_7.addWidget(self.alt_sf_color_button)
  327. self.form_box_child_7.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  328. # Plot Selection (right - left) Fill Transparency Level
  329. self.alt_sf_alpha_label = QtWidgets.QLabel('%s:' % _('Alpha Level'))
  330. self.alt_sf_alpha_label.setToolTip(
  331. _("Set the fill transparency for selection 'right to left' box.")
  332. )
  333. self.alt_sf_color_alpha_slider = QtWidgets.QSlider(QtCore.Qt.Horizontal)
  334. self.alt_sf_color_alpha_slider.setMinimum(0)
  335. self.alt_sf_color_alpha_slider.setMaximum(255)
  336. self.alt_sf_color_alpha_slider.setSingleStep(1)
  337. self.alt_sf_color_alpha_spinner = FCSpinner()
  338. self.alt_sf_color_alpha_spinner.setMinimumWidth(70)
  339. self.alt_sf_color_alpha_spinner.set_range(0, 255)
  340. self.form_box_child_8 = QtWidgets.QHBoxLayout()
  341. self.form_box_child_8.addWidget(self.alt_sf_color_alpha_slider)
  342. self.form_box_child_8.addWidget(self.alt_sf_color_alpha_spinner)
  343. # Plot Selection (right - left) Line Color
  344. self.alt_sl_color_label = QtWidgets.QLabel('%s:' % _('Sel2. Line'))
  345. self.alt_sl_color_label.setToolTip(
  346. _("Set the line color for the 'right to left' selection box.")
  347. )
  348. self.alt_sl_color_entry = FCEntry()
  349. self.alt_sl_color_button = QtWidgets.QPushButton()
  350. self.alt_sl_color_button.setFixedSize(15, 15)
  351. self.form_box_child_9 = QtWidgets.QHBoxLayout()
  352. self.form_box_child_9.addWidget(self.alt_sl_color_entry)
  353. self.form_box_child_9.addWidget(self.alt_sl_color_button)
  354. self.form_box_child_9.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  355. # Editor Draw Color
  356. self.draw_color_label = QtWidgets.QLabel('%s:' % _('Editor Draw'))
  357. self.alt_sf_color_label.setToolTip(
  358. _("Set the color for the shape.")
  359. )
  360. self.draw_color_entry = FCEntry()
  361. self.draw_color_button = QtWidgets.QPushButton()
  362. self.draw_color_button.setFixedSize(15, 15)
  363. self.form_box_child_10 = QtWidgets.QHBoxLayout()
  364. self.form_box_child_10.addWidget(self.draw_color_entry)
  365. self.form_box_child_10.addWidget(self.draw_color_button)
  366. self.form_box_child_10.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  367. # Editor Draw Selection Color
  368. self.sel_draw_color_label = QtWidgets.QLabel('%s:' % _('Editor Draw Sel.'))
  369. self.sel_draw_color_label.setToolTip(
  370. _("Set the color of the shape when selected.")
  371. )
  372. self.sel_draw_color_entry = FCEntry()
  373. self.sel_draw_color_button = QtWidgets.QPushButton()
  374. self.sel_draw_color_button.setFixedSize(15, 15)
  375. self.form_box_child_11 = QtWidgets.QHBoxLayout()
  376. self.form_box_child_11.addWidget(self.sel_draw_color_entry)
  377. self.form_box_child_11.addWidget(self.sel_draw_color_button)
  378. self.form_box_child_11.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  379. # Project Tab items color
  380. self.proj_color_label = QtWidgets.QLabel('%s:' % _('Project Items'))
  381. self.proj_color_label.setToolTip(
  382. _("Set the color of the items in Project Tab Tree.")
  383. )
  384. self.proj_color_entry = FCEntry()
  385. self.proj_color_button = QtWidgets.QPushButton()
  386. self.proj_color_button.setFixedSize(15, 15)
  387. self.form_box_child_12 = QtWidgets.QHBoxLayout()
  388. self.form_box_child_12.addWidget(self.proj_color_entry)
  389. self.form_box_child_12.addWidget(self.proj_color_button)
  390. self.form_box_child_12.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  391. self.proj_color_dis_label = QtWidgets.QLabel('%s:' % _('Proj. Dis. Items'))
  392. self.proj_color_dis_label.setToolTip(
  393. _("Set the color of the items in Project Tab Tree,\n"
  394. "for the case when the items are disabled.")
  395. )
  396. self.proj_color_dis_entry = FCEntry()
  397. self.proj_color_dis_button = QtWidgets.QPushButton()
  398. self.proj_color_dis_button.setFixedSize(15, 15)
  399. self.form_box_child_13 = QtWidgets.QHBoxLayout()
  400. self.form_box_child_13.addWidget(self.proj_color_dis_entry)
  401. self.form_box_child_13.addWidget(self.proj_color_dis_button)
  402. self.form_box_child_13.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  403. # Activity monitor icon
  404. self.activity_label = QtWidgets.QLabel('%s:' % _("Activity Icon"))
  405. self.activity_label.setToolTip(
  406. _("Select the GIF that show activity when FlatCAM is active.")
  407. )
  408. self.activity_combo = FCComboBox()
  409. self.activity_combo.addItems(['Ball black', 'Ball green', 'Arrow green', 'Eclipse green'])
  410. # Just to add empty rows
  411. self.spacelabel = QtWidgets.QLabel('')
  412. # Add (label - input field) pair to the QFormLayout
  413. self.form_box.addRow(self.spacelabel, self.spacelabel)
  414. self.form_box.addRow(self.gridx_label, self.gridx_entry)
  415. self.form_box.addRow(self.gridy_label, self.gridy_entry)
  416. self.form_box.addRow(self.snap_max_label, self.snap_max_dist_entry)
  417. self.form_box.addRow(self.workspace_lbl, self.workspace_cb)
  418. self.form_box.addRow(self.workspace_type_lbl, self.wk_cb)
  419. self.form_box.addRow(self.spacelabel, self.spacelabel)
  420. self.form_box.addRow(self.pf_color_label, self.form_box_child_1)
  421. self.form_box.addRow(self.pf_alpha_label, self.form_box_child_2)
  422. self.form_box.addRow(self.pl_color_label, self.form_box_child_3)
  423. self.form_box.addRow(self.sf_color_label, self.form_box_child_4)
  424. self.form_box.addRow(self.sf_alpha_label, self.form_box_child_5)
  425. self.form_box.addRow(self.sl_color_label, self.form_box_child_6)
  426. self.form_box.addRow(self.alt_sf_color_label, self.form_box_child_7)
  427. self.form_box.addRow(self.alt_sf_alpha_label, self.form_box_child_8)
  428. self.form_box.addRow(self.alt_sl_color_label, self.form_box_child_9)
  429. self.form_box.addRow(self.draw_color_label, self.form_box_child_10)
  430. self.form_box.addRow(self.sel_draw_color_label, self.form_box_child_11)
  431. self.form_box.addRow(QtWidgets.QLabel(""))
  432. self.form_box.addRow(self.proj_color_label, self.form_box_child_12)
  433. self.form_box.addRow(self.proj_color_dis_label, self.form_box_child_13)
  434. self.form_box.addRow(self.activity_label, self.activity_combo)
  435. self.form_box.addRow(self.spacelabel, self.spacelabel)
  436. # Add the QFormLayout that holds the Application general defaults
  437. # to the main layout of this TAB
  438. self.layout.addLayout(self.form_box)
  439. class GeneralGUISetGroupUI(OptionsGroupUI):
  440. def __init__(self, parent=None):
  441. super(GeneralGUISetGroupUI, self).__init__(self)
  442. self.setTitle(str(_("GUI Settings")))
  443. # Create a form layout for the Application general settings
  444. self.form_box = QtWidgets.QFormLayout()
  445. grid0 = QtWidgets.QGridLayout()
  446. self.layout.addLayout(grid0)
  447. grid0.setColumnStretch(0, 0)
  448. grid0.setColumnStretch(1, 1)
  449. grid0.addWidget(QtWidgets.QLabel(''), 0, 0)
  450. # Theme selection
  451. self.theme_label = QtWidgets.QLabel('%s:' % _('Theme'))
  452. self.theme_label.setToolTip(
  453. _("Select a theme for FlatCAM.\n"
  454. "The application will restart after change.")
  455. )
  456. self.theme_radio = RadioSet([
  457. {"label": _("Light"), "value": "white"},
  458. {"label": _("Dark"), "value": "black"}
  459. ], orientation='horizontal', stretch=False)
  460. grid0.addWidget(self.theme_label, 1, 0)
  461. grid0.addWidget(self.theme_radio, 1, 1)
  462. # Layout selection
  463. self.layout_label = QtWidgets.QLabel('%s:' % _('Layout'))
  464. self.layout_label.setToolTip(
  465. _("Select an layout for FlatCAM.\n"
  466. "It is applied immediately.")
  467. )
  468. self.layout_combo = FCComboBox()
  469. # don't translate the QCombo items as they are used in QSettings and identified by name
  470. self.layout_combo.addItem("standard")
  471. self.layout_combo.addItem("compact")
  472. grid0.addWidget(self.layout_label, 2, 0)
  473. grid0.addWidget(self.layout_combo, 2, 1)
  474. # Set the current index for layout_combo
  475. settings = QSettings("Open Source", "FlatCAM")
  476. if settings.contains("layout"):
  477. layout = settings.value('layout', type=str)
  478. idx = self.layout_combo.findText(layout.capitalize())
  479. self.layout_combo.setCurrentIndex(idx)
  480. # Style selection
  481. self.style_label = QtWidgets.QLabel('%s:' % _('Style'))
  482. self.style_label.setToolTip(
  483. _("Select an style for FlatCAM.\n"
  484. "It will be applied at the next app start.")
  485. )
  486. self.style_combo = FCComboBox()
  487. self.style_combo.addItems(QtWidgets.QStyleFactory.keys())
  488. # find current style
  489. index = self.style_combo.findText(QtWidgets.qApp.style().objectName(), QtCore.Qt.MatchFixedString)
  490. self.style_combo.setCurrentIndex(index)
  491. self.style_combo.activated[str].connect(self.handle_style)
  492. grid0.addWidget(self.style_label, 3, 0)
  493. grid0.addWidget(self.style_combo, 3, 1)
  494. # Enable High DPI Support
  495. self.hdpi_label = QtWidgets.QLabel('%s:' % _('HDPI Support'))
  496. self.hdpi_label.setToolTip(
  497. _("Enable High DPI support for FlatCAM.\n"
  498. "It will be applied at the next app start.")
  499. )
  500. self.hdpi_cb = FCCheckBox()
  501. settings = QSettings("Open Source", "FlatCAM")
  502. if settings.contains("hdpi"):
  503. self.hdpi_cb.set_value(settings.value('hdpi', type=int))
  504. else:
  505. self.hdpi_cb.set_value(False)
  506. self.hdpi_cb.stateChanged.connect(self.handle_hdpi)
  507. grid0.addWidget(self.hdpi_label, 4, 0)
  508. grid0.addWidget(self.hdpi_cb, 4, 1)
  509. # Clear Settings
  510. self.clear_label = QtWidgets.QLabel('%s:' % _('Clear GUI Settings'))
  511. self.clear_label.setToolTip(
  512. _("Clear the GUI settings for FlatCAM,\n"
  513. "such as: layout, gui state, style, hdpi support etc.")
  514. )
  515. self.clear_btn = FCButton(_("Clear"))
  516. self.clear_btn.clicked.connect(self.handle_clear)
  517. grid0.addWidget(self.clear_label, 5, 0)
  518. grid0.addWidget(self.clear_btn, 5, 1)
  519. # Enable Hover box
  520. self.hover_label = QtWidgets.QLabel('%s:' % _('Hover Shape'))
  521. self.hover_label.setToolTip(
  522. _("Enable display of a hover shape for FlatCAM objects.\n"
  523. "It is displayed whenever the mouse cursor is hovering\n"
  524. "over any kind of not-selected object.")
  525. )
  526. self.hover_cb = FCCheckBox()
  527. grid0.addWidget(self.hover_label, 6, 0)
  528. grid0.addWidget(self.hover_cb, 6, 1)
  529. # Enable Selection box
  530. self.selection_label = QtWidgets.QLabel('%s:' % _('Sel. Shape'))
  531. self.selection_label.setToolTip(
  532. _("Enable the display of a selection shape for FlatCAM objects.\n"
  533. "It is displayed whenever the mouse selects an object\n"
  534. "either by clicking or dragging mouse from left to right or\n"
  535. "right to left.")
  536. )
  537. self.selection_cb = FCCheckBox()
  538. grid0.addWidget(self.selection_label, 7, 0)
  539. grid0.addWidget(self.selection_cb, 7, 1)
  540. grid0.addWidget(QtWidgets.QLabel(''), 8, 0)
  541. # Notebook Font Size
  542. self.notebook_font_size_label = QtWidgets.QLabel('%s:' % _('NB Font Size'))
  543. self.notebook_font_size_label.setToolTip(
  544. _("This sets the font size for the elements found in the Notebook.\n"
  545. "The notebook is the collapsible area in the left side of the GUI,\n"
  546. "and include the Project, Selected and Tool tabs.")
  547. )
  548. self.notebook_font_size_spinner = FCSpinner()
  549. self.notebook_font_size_spinner.setRange(8, 40)
  550. self.notebook_font_size_spinner.setWrapping(True)
  551. settings = QSettings("Open Source", "FlatCAM")
  552. if settings.contains("notebook_font_size"):
  553. self.notebook_font_size_spinner.set_value(settings.value('notebook_font_size', type=int))
  554. else:
  555. self.notebook_font_size_spinner.set_value(12)
  556. grid0.addWidget(self.notebook_font_size_label, 9, 0)
  557. grid0.addWidget(self.notebook_font_size_spinner, 9, 1)
  558. # Axis Font Size
  559. self.axis_font_size_label = QtWidgets.QLabel('%s:' % _('Axis Font Size'))
  560. self.axis_font_size_label.setToolTip(
  561. _("This sets the font size for canvas axis.")
  562. )
  563. self.axis_font_size_spinner = FCSpinner()
  564. self.axis_font_size_spinner.setRange(8, 40)
  565. self.axis_font_size_spinner.setWrapping(True)
  566. settings = QSettings("Open Source", "FlatCAM")
  567. if settings.contains("axis_font_size"):
  568. self.axis_font_size_spinner.set_value(settings.value('axis_font_size', type=int))
  569. else:
  570. self.axis_font_size_spinner.set_value(8)
  571. grid0.addWidget(self.axis_font_size_label, 10, 0)
  572. grid0.addWidget(self.axis_font_size_spinner, 10, 1)
  573. # TextBox Font Size
  574. self.textbox_font_size_label = QtWidgets.QLabel('%s:' % _('Textbox Font Size'))
  575. self.textbox_font_size_label.setToolTip(
  576. _("This sets the font size for the Textbox GUI\n"
  577. "elements that are used in FlatCAM.")
  578. )
  579. self.textbox_font_size_spinner = FCSpinner()
  580. self.textbox_font_size_spinner.setRange(8, 40)
  581. self.textbox_font_size_spinner.setWrapping(True)
  582. settings = QSettings("Open Source", "FlatCAM")
  583. if settings.contains("textbox_font_size"):
  584. self.textbox_font_size_spinner.set_value(settings.value('textbox_font_size', type=int))
  585. else:
  586. self.textbox_font_size_spinner.set_value(10)
  587. grid0.addWidget(self.textbox_font_size_label, 11, 0)
  588. grid0.addWidget(self.textbox_font_size_spinner, 11, 1)
  589. # Just to add empty rows
  590. grid0.addWidget(QtWidgets.QLabel(''), 12, 0)
  591. # Splash Screen
  592. self.splash_label = QtWidgets.QLabel('%s:' % _('Splash Screen'))
  593. self.splash_label.setToolTip(
  594. _("Enable display of the splash screen at application startup.")
  595. )
  596. self.splash_cb = FCCheckBox()
  597. settings = QSettings("Open Source", "FlatCAM")
  598. if settings.value("splash_screen"):
  599. self.splash_cb.set_value(True)
  600. else:
  601. self.splash_cb.set_value(False)
  602. grid0.addWidget(self.splash_label, 13, 0)
  603. grid0.addWidget(self.splash_cb, 13, 1)
  604. # Sys Tray Icon
  605. self.systray_label = QtWidgets.QLabel('%s:' % _('Sys Tray Icon'))
  606. self.systray_label.setToolTip(
  607. _("Enable display of FlatCAM icon in Sys Tray.")
  608. )
  609. self.systray_cb = FCCheckBox()
  610. grid0.addWidget(self.systray_label, 14, 0)
  611. grid0.addWidget(self.systray_cb, 14, 1)
  612. # Shell StartUp CB
  613. self.shell_startup_label = QtWidgets.QLabel('%s:' % _('Shell at StartUp'))
  614. self.shell_startup_label.setToolTip(
  615. _("Check this box if you want the shell to\n"
  616. "start automatically at startup.")
  617. )
  618. self.shell_startup_cb = FCCheckBox(label='')
  619. self.shell_startup_cb.setToolTip(
  620. _("Check this box if you want the shell to\n"
  621. "start automatically at startup.")
  622. )
  623. grid0.addWidget(self.shell_startup_label, 15, 0)
  624. grid0.addWidget(self.shell_startup_cb, 15, 1)
  625. # Project at StartUp CB
  626. self.project_startup_label = QtWidgets.QLabel('%s:' % _('Project at StartUp'))
  627. self.project_startup_label.setToolTip(
  628. _("Check this box if you want the project/selected/tool tab area to\n"
  629. "to be shown automatically at startup.")
  630. )
  631. self.project_startup_cb = FCCheckBox(label='')
  632. self.project_startup_cb.setToolTip(
  633. _("Check this box if you want the project/selected/tool tab area to\n"
  634. "to be shown automatically at startup.")
  635. )
  636. grid0.addWidget(self.project_startup_label, 16, 0)
  637. grid0.addWidget(self.project_startup_cb, 16, 1)
  638. # Project autohide CB
  639. self.project_autohide_label = QtWidgets.QLabel('%s:' % _('Project AutoHide'))
  640. self.project_autohide_label.setToolTip(
  641. _("Check this box if you want the project/selected/tool tab area to\n"
  642. "hide automatically when there are no objects loaded and\n"
  643. "to show whenever a new object is created.")
  644. )
  645. self.project_autohide_cb = FCCheckBox(label='')
  646. self.project_autohide_cb.setToolTip(
  647. _("Check this box if you want the project/selected/tool tab area to\n"
  648. "hide automatically when there are no objects loaded and\n"
  649. "to show whenever a new object is created.")
  650. )
  651. grid0.addWidget(self.project_autohide_label, 17, 0)
  652. grid0.addWidget(self.project_autohide_cb, 17, 1)
  653. grid0.addWidget(QtWidgets.QLabel(''), 18, 0)
  654. # Enable/Disable ToolTips globally
  655. self.toggle_tooltips_label = QtWidgets.QLabel('<b>%s:</b>' % _('Enable ToolTips'))
  656. self.toggle_tooltips_label.setToolTip(
  657. _("Check this box if you want to have toolTips displayed\n"
  658. "when hovering with mouse over items throughout the App.")
  659. )
  660. self.toggle_tooltips_cb = FCCheckBox(label='')
  661. self.toggle_tooltips_cb.setToolTip(
  662. _("Check this box if you want to have toolTips displayed\n"
  663. "when hovering with mouse over items throughout the App.")
  664. )
  665. grid0.addWidget(self.toggle_tooltips_label, 19, 0)
  666. grid0.addWidget(self.toggle_tooltips_cb, 19, 1)
  667. # Mouse Cursor Shape
  668. self.cursor_lbl = QtWidgets.QLabel('%s:' % _('Mouse Cursor'))
  669. self.cursor_lbl.setToolTip(
  670. _("Choose a mouse cursor shape.\n"
  671. "- Small -> with a customizable size.\n"
  672. "- Big -> Infinite lines")
  673. )
  674. self.cursor_radio = RadioSet([
  675. {"label": _("Small"), "value": "small"},
  676. {"label": _("Big"), "value": "big"}
  677. ], orientation='horizontal', stretch=False)
  678. grid0.addWidget(self.cursor_lbl, 20, 0)
  679. grid0.addWidget(self.cursor_radio, 20, 1)
  680. self.cursor_size_lbl = QtWidgets.QLabel('%s:' % _('Mouse Cursor Size'))
  681. self.cursor_size_lbl.setToolTip(
  682. _("Set the size of the mouse cursor, in pixels.")
  683. )
  684. self.cursor_size_entry = FCSpinner()
  685. self.cursor_size_entry.set_range(10, 70)
  686. self.cursor_size_entry.setWrapping(True)
  687. grid0.addWidget(self.cursor_size_lbl, 21, 0)
  688. grid0.addWidget(self.cursor_size_entry, 21, 1)
  689. # Delete confirmation
  690. self.delete_conf_cb = FCCheckBox(_('Delete object confirmation'))
  691. self.delete_conf_cb.setToolTip(
  692. _("When checked the application will ask for user confirmation\n"
  693. "whenever the Delete object(s) event is triggered, either by\n"
  694. "menu shortcut or key shortcut.")
  695. )
  696. grid0.addWidget(self.delete_conf_cb, 22, 0, 1, 2)
  697. self.layout.addStretch()
  698. def handle_style(self, style):
  699. # set current style
  700. settings = QSettings("Open Source", "FlatCAM")
  701. settings.setValue('style', style)
  702. # This will write the setting to the platform specific storage.
  703. del settings
  704. def handle_hdpi(self, state):
  705. # set current HDPI
  706. settings = QSettings("Open Source", "FlatCAM")
  707. settings.setValue('hdpi', state)
  708. # This will write the setting to the platform specific storage.
  709. del settings
  710. def handle_clear(self):
  711. msgbox = QtWidgets.QMessageBox()
  712. msgbox.setText(_("Are you sure you want to delete the GUI Settings? "
  713. "\n")
  714. )
  715. msgbox.setWindowTitle(_("Clear GUI Settings"))
  716. msgbox.setWindowIcon(QtGui.QIcon('share/trash32.png'))
  717. bt_yes = msgbox.addButton(_('Yes'), QtWidgets.QMessageBox.YesRole)
  718. bt_no = msgbox.addButton(_('No'), QtWidgets.QMessageBox.NoRole)
  719. msgbox.setDefaultButton(bt_no)
  720. msgbox.exec_()
  721. response = msgbox.clickedButton()
  722. if response == bt_yes:
  723. settings = QSettings("Open Source", "FlatCAM")
  724. for key in settings.allKeys():
  725. settings.remove(key)
  726. # This will write the setting to the platform specific storage.
  727. del settings
  728. class GeneralAppPrefGroupUI(OptionsGroupUI):
  729. def __init__(self, parent=None):
  730. super(GeneralAppPrefGroupUI, self).__init__(self)
  731. self.setTitle(str(_("App Preferences")))
  732. # Create a form layout for the Application general settings
  733. self.form_box = QtWidgets.QFormLayout()
  734. # Units for FlatCAM
  735. self.unitslabel = QtWidgets.QLabel('<span style="color:red;"><b>%s:</b></span>' % _('Units'))
  736. self.unitslabel.setToolTip(_("The default value for FlatCAM units.\n"
  737. "Whatever is selected here is set every time\n"
  738. "FLatCAM is started."))
  739. self.units_radio = RadioSet([{'label': _('IN'), 'value': 'IN'},
  740. {'label': _('MM'), 'value': 'MM'}])
  741. # Graphic Engine for FlatCAM
  742. self.ge_label = QtWidgets.QLabel('<b>%s:</b>' % _('Graphic Engine'))
  743. self.ge_label.setToolTip(_("Choose what graphic engine to use in FlatCAM.\n"
  744. "Legacy(2D) -> reduced functionality, slow performance but enhanced compatibility.\n"
  745. "OpenGL(3D) -> full functionality, high performance\n"
  746. "Some graphic cards are too old and do not work in OpenGL(3D) mode, like:\n"
  747. "Intel HD3000 or older. In this case the plot area will be black therefore\n"
  748. "use the Legacy(2D) mode."))
  749. self.ge_radio = RadioSet([{'label': _('Legacy(2D)'), 'value': '2D'},
  750. {'label': _('OpenGL(3D)'), 'value': '3D'}])
  751. # Application Level for FlatCAM
  752. self.app_level_label = QtWidgets.QLabel('<span style="color:red;"><b>%s:</b></span>' % _('APP. LEVEL'))
  753. self.app_level_label.setToolTip(_("Choose the default level of usage for FlatCAM.\n"
  754. "BASIC level -> reduced functionality, best for beginner's.\n"
  755. "ADVANCED level -> full functionality.\n\n"
  756. "The choice here will influence the parameters in\n"
  757. "the Selected Tab for all kinds of FlatCAM objects."))
  758. self.app_level_radio = RadioSet([{'label': _('Basic'), 'value': 'b'},
  759. {'label': _('Advanced'), 'value': 'a'}])
  760. # Application Level for FlatCAM
  761. self.portability_label = QtWidgets.QLabel('%s:' % _('Portable app'))
  762. self.portability_label.setToolTip(_("Choose if the application should run as portable.\n\n"
  763. "If Checked the application will run portable,\n"
  764. "which means that the preferences files will be saved\n"
  765. "in the application folder, in the lib\\config subfolder."))
  766. self.portability_cb = FCCheckBox()
  767. # Languages for FlatCAM
  768. self.languagelabel = QtWidgets.QLabel('<b>%s:</b>' % _('Languages'))
  769. self.languagelabel.setToolTip(_("Set the language used throughout FlatCAM."))
  770. self.language_cb = FCComboBox()
  771. self.languagespace = QtWidgets.QLabel('')
  772. self.language_apply_btn = FCButton(_("Apply Language"))
  773. self.language_apply_btn.setToolTip(_("Set the language used throughout FlatCAM.\n"
  774. "The app will restart after click."
  775. "Windows: When FlatCAM is installed in Program Files\n"
  776. "directory, it is possible that the app will not\n"
  777. "restart after the button is clicked due of Windows\n"
  778. "security features. In this case the language will be\n"
  779. "applied at the next app start."))
  780. # Version Check CB
  781. self.version_check_label = QtWidgets.QLabel('%s:' % _('Version Check'))
  782. self.version_check_label.setToolTip(
  783. _("Check this box if you want to check\n"
  784. "for a new version automatically at startup.")
  785. )
  786. self.version_check_cb = FCCheckBox(label='')
  787. self.version_check_cb.setToolTip(
  788. _("Check this box if you want to check\n"
  789. "for a new version automatically at startup.")
  790. )
  791. # Send Stats CB
  792. self.send_stats_label = QtWidgets.QLabel('%s:' % _('Send Stats'))
  793. self.send_stats_label.setToolTip(
  794. _("Check this box if you agree to send anonymous\n"
  795. "stats automatically at startup, to help improve FlatCAM.")
  796. )
  797. self.send_stats_cb = FCCheckBox(label='')
  798. self.send_stats_cb.setToolTip(
  799. _("Check this box if you agree to send anonymous\n"
  800. "stats automatically at startup, to help improve FlatCAM.")
  801. )
  802. self.ois_version_check = OptionalInputSection(self.version_check_cb, [self.send_stats_cb])
  803. # Select mouse pan button
  804. self.panbuttonlabel = QtWidgets.QLabel('<b>%s:</b>' % _('Pan Button'))
  805. self.panbuttonlabel.setToolTip(_("Select the mouse button to use for panning:\n"
  806. "- MMB --> Middle Mouse Button\n"
  807. "- RMB --> Right Mouse Button"))
  808. self.pan_button_radio = RadioSet([{'label': _('MMB'), 'value': '3'},
  809. {'label': _('RMB'), 'value': '2'}])
  810. # Multiple Selection Modifier Key
  811. self.mselectlabel = QtWidgets.QLabel('<b>%s:</b>' % _('Multiple Sel'))
  812. self.mselectlabel.setToolTip(_("Select the key used for multiple selection."))
  813. self.mselect_radio = RadioSet([{'label': _('CTRL'), 'value': 'Control'},
  814. {'label': _('SHIFT'), 'value': 'Shift'}])
  815. # Worker Numbers
  816. self.worker_number_label = QtWidgets.QLabel('%s:' % _('Workers number'))
  817. self.worker_number_label.setToolTip(
  818. _("The number of Qthreads made available to the App.\n"
  819. "A bigger number may finish the jobs more quickly but\n"
  820. "depending on your computer speed, may make the App\n"
  821. "unresponsive. Can have a value between 2 and 16.\n"
  822. "Default value is 2.\n"
  823. "After change, it will be applied at next App start.")
  824. )
  825. self.worker_number_sb = FCSpinner()
  826. self.worker_number_sb.setToolTip(
  827. _("The number of Qthreads made available to the App.\n"
  828. "A bigger number may finish the jobs more quickly but\n"
  829. "depending on your computer speed, may make the App\n"
  830. "unresponsive. Can have a value between 2 and 16.\n"
  831. "Default value is 2.\n"
  832. "After change, it will be applied at next App start.")
  833. )
  834. self.worker_number_sb.set_range(2, 16)
  835. # Geometric tolerance
  836. tol_label = QtWidgets.QLabel('%s:' % _("Geo Tolerance"))
  837. tol_label.setToolTip(_(
  838. "This value can counter the effect of the Circle Steps\n"
  839. "parameter. Default value is 0.01.\n"
  840. "A lower value will increase the detail both in image\n"
  841. "and in Gcode for the circles, with a higher cost in\n"
  842. "performance. Higher value will provide more\n"
  843. "performance at the expense of level of detail."
  844. ))
  845. self.tol_entry = FCDoubleSpinner()
  846. self.tol_entry.setToolTip(_(
  847. "This value can counter the effect of the Circle Steps\n"
  848. "parameter. Default value is 0.01.\n"
  849. "A lower value will increase the detail both in image\n"
  850. "and in Gcode for the circles, with a higher cost in\n"
  851. "performance. Higher value will provide more\n"
  852. "performance at the expense of level of detail."
  853. ))
  854. self.tol_entry.setSingleStep(0.001)
  855. self.tol_entry.set_precision(6)
  856. # Just to add empty rows
  857. self.spacelabel = QtWidgets.QLabel('')
  858. # Add (label - input field) pair to the QFormLayout
  859. self.form_box.addRow(self.unitslabel, self.units_radio)
  860. self.form_box.addRow(self.ge_label, self.ge_radio)
  861. self.form_box.addRow(QtWidgets.QLabel(''))
  862. self.form_box.addRow(self.app_level_label, self.app_level_radio)
  863. self.form_box.addRow(self.portability_label, self.portability_cb)
  864. self.form_box.addRow(QtWidgets.QLabel(''))
  865. self.form_box.addRow(self.languagelabel, self.language_cb)
  866. self.form_box.addRow(self.languagespace, self.language_apply_btn)
  867. self.form_box.addRow(self.spacelabel, self.spacelabel)
  868. self.form_box.addRow(self.version_check_label, self.version_check_cb)
  869. self.form_box.addRow(self.send_stats_label, self.send_stats_cb)
  870. self.form_box.addRow(self.panbuttonlabel, self.pan_button_radio)
  871. self.form_box.addRow(self.mselectlabel, self.mselect_radio)
  872. self.form_box.addRow(self.worker_number_label, self.worker_number_sb)
  873. self.form_box.addRow(tol_label, self.tol_entry)
  874. self.form_box.addRow(self.spacelabel, self.spacelabel)
  875. # Add the QFormLayout that holds the Application general defaults
  876. # to the main layout of this TAB
  877. self.layout.addLayout(self.form_box)
  878. # Open behavior
  879. self.open_style_cb = FCCheckBox('%s' % _('"Open" behavior'))
  880. self.open_style_cb.setToolTip(
  881. _("When checked the path for the last saved file is used when saving files,\n"
  882. "and the path for the last opened file is used when opening files.\n\n"
  883. "When unchecked the path for opening files is the one used last: either the\n"
  884. "path for saving files or the path for opening files.")
  885. )
  886. # self.advanced_cb.setLayoutDirection(QtCore.Qt.RightToLeft)
  887. self.layout.addWidget(self.open_style_cb)
  888. # Save compressed project CB
  889. self.save_type_cb = FCCheckBox(_('Save Compressed Project'))
  890. self.save_type_cb.setToolTip(
  891. _("Whether to save a compressed or uncompressed project.\n"
  892. "When checked it will save a compressed FlatCAM project.")
  893. )
  894. # self.advanced_cb.setLayoutDirection(QtCore.Qt.RightToLeft)
  895. self.layout.addWidget(self.save_type_cb)
  896. hlay1 = QtWidgets.QHBoxLayout()
  897. self.layout.addLayout(hlay1)
  898. # Project LZMA Comppression Level
  899. self.compress_combo = FCComboBox()
  900. self.compress_label = QtWidgets.QLabel('%s:' % _('Compression Level'))
  901. self.compress_label.setToolTip(
  902. _("The level of compression used when saving\n"
  903. "a FlatCAM project. Higher value means better compression\n"
  904. "but require more RAM usage and more processing time.")
  905. )
  906. # self.advanced_cb.setLayoutDirection(QtCore.Qt.RightToLeft)
  907. self.compress_combo.addItems([str(i) for i in range(10)])
  908. hlay1.addWidget(self.compress_label)
  909. hlay1.addWidget(self.compress_combo)
  910. self.proj_ois = OptionalInputSection(self.save_type_cb, [self.compress_label, self.compress_combo], True)
  911. self.form_box_2 = QtWidgets.QFormLayout()
  912. self.layout.addLayout(self.form_box_2)
  913. self.layout.addStretch()
  914. if sys.platform != 'win32':
  915. self.portability_label.hide()
  916. self.portability_cb.hide()
  917. class GerberGenPrefGroupUI(OptionsGroupUI):
  918. def __init__(self, parent=None):
  919. # OptionsGroupUI.__init__(self, "Gerber General Preferences", parent=parent)
  920. super(GerberGenPrefGroupUI, self).__init__(self)
  921. self.setTitle(str(_("Gerber General")))
  922. # ## Plot options
  923. self.plot_options_label = QtWidgets.QLabel("<b>%s:</b>" % _("Plot Options"))
  924. self.layout.addWidget(self.plot_options_label)
  925. grid0 = QtWidgets.QGridLayout()
  926. self.layout.addLayout(grid0)
  927. # Solid CB
  928. self.solid_cb = FCCheckBox(label='%s' % _('Solid'))
  929. self.solid_cb.setToolTip(
  930. _("Solid color polygons.")
  931. )
  932. grid0.addWidget(self.solid_cb, 0, 0)
  933. # Multicolored CB
  934. self.multicolored_cb = FCCheckBox(label='%s' % _('M-Color'))
  935. self.multicolored_cb.setToolTip(
  936. _("Draw polygons in different colors.")
  937. )
  938. grid0.addWidget(self.multicolored_cb, 0, 1)
  939. # Plot CB
  940. self.plot_cb = FCCheckBox(label='%s' % _('Plot'))
  941. self.plot_options_label.setToolTip(
  942. _("Plot (show) this object.")
  943. )
  944. grid0.addWidget(self.plot_cb, 0, 2)
  945. # Number of circle steps for circular aperture linear approximation
  946. self.circle_steps_label = QtWidgets.QLabel('%s:' % _("Circle Steps"))
  947. self.circle_steps_label.setToolTip(
  948. _("The number of circle steps for Gerber \n"
  949. "circular aperture linear approximation.")
  950. )
  951. self.circle_steps_entry = FCSpinner()
  952. self.circle_steps_entry.set_range(0, 9999)
  953. grid0.addWidget(self.circle_steps_label, 1, 0)
  954. grid0.addWidget(self.circle_steps_entry, 1, 1, 1, 2)
  955. grid0.addWidget(QtWidgets.QLabel(''), 2, 0, 1, 3)
  956. # Default format for Gerber
  957. self.gerber_default_label = QtWidgets.QLabel('<b>%s:</b>' % _('Default Values'))
  958. self.gerber_default_label.setToolTip(
  959. _("Those values will be used as fallback values\n"
  960. "in case that they are not found in the Gerber file.")
  961. )
  962. grid0.addWidget(self.gerber_default_label, 3, 0, 1, 3)
  963. # Gerber Units
  964. self.gerber_units_label = QtWidgets.QLabel('%s:' % _('Units'))
  965. self.gerber_units_label.setToolTip(
  966. _("The units used in the Gerber file.")
  967. )
  968. self.gerber_units_radio = RadioSet([{'label': _('INCH'), 'value': 'IN'},
  969. {'label': _('MM'), 'value': 'MM'}])
  970. self.gerber_units_radio.setToolTip(
  971. _("The units used in the Gerber file.")
  972. )
  973. grid0.addWidget(self.gerber_units_label, 4, 0)
  974. grid0.addWidget(self.gerber_units_radio, 4, 1, 1, 2)
  975. # Gerber Zeros
  976. self.gerber_zeros_label = QtWidgets.QLabel('%s:' % _('Zeros'))
  977. self.gerber_zeros_label.setAlignment(QtCore.Qt.AlignLeft)
  978. self.gerber_zeros_label.setToolTip(
  979. _("This sets the type of Gerber zeros.\n"
  980. "If LZ then Leading Zeros are removed and\n"
  981. "Trailing Zeros are kept.\n"
  982. "If TZ is checked then Trailing Zeros are removed\n"
  983. "and Leading Zeros are kept.")
  984. )
  985. self.gerber_zeros_radio = RadioSet([{'label': _('LZ'), 'value': 'L'},
  986. {'label': _('TZ'), 'value': 'T'}])
  987. self.gerber_zeros_radio.setToolTip(
  988. _("This sets the type of Gerber zeros.\n"
  989. "If LZ then Leading Zeros are removed and\n"
  990. "Trailing Zeros are kept.\n"
  991. "If TZ is checked then Trailing Zeros are removed\n"
  992. "and Leading Zeros are kept.")
  993. )
  994. grid0.addWidget(self.gerber_zeros_label, 5, 0)
  995. grid0.addWidget(self.gerber_zeros_radio, 5, 1, 1, 2)
  996. self.layout.addStretch()
  997. class GerberOptPrefGroupUI(OptionsGroupUI):
  998. def __init__(self, parent=None):
  999. # OptionsGroupUI.__init__(self, "Gerber Options Preferences", parent=parent)
  1000. super(GerberOptPrefGroupUI, self).__init__(self)
  1001. self.setTitle(str(_("Gerber Options")))
  1002. # ## Isolation Routing
  1003. self.isolation_routing_label = QtWidgets.QLabel("<b>%s:</b>" % _("Isolation Routing"))
  1004. self.isolation_routing_label.setToolTip(
  1005. _("Create a Geometry object with\n"
  1006. "toolpaths to cut outside polygons.")
  1007. )
  1008. self.layout.addWidget(self.isolation_routing_label)
  1009. # Cutting Tool Diameter
  1010. grid0 = QtWidgets.QGridLayout()
  1011. self.layout.addLayout(grid0)
  1012. tdlabel = QtWidgets.QLabel('%s:' % _('Tool dia'))
  1013. tdlabel.setToolTip(
  1014. _("Diameter of the cutting tool.")
  1015. )
  1016. grid0.addWidget(tdlabel, 0, 0)
  1017. self.iso_tool_dia_entry = FCDoubleSpinner()
  1018. self.iso_tool_dia_entry.set_precision(4)
  1019. self.iso_tool_dia_entry.setSingleStep(0.1)
  1020. self.iso_tool_dia_entry.set_range(-9999, 9999)
  1021. grid0.addWidget(self.iso_tool_dia_entry, 0, 1)
  1022. # Nr of passes
  1023. passlabel = QtWidgets.QLabel('%s:' % _('# Passes'))
  1024. passlabel.setToolTip(
  1025. _("Width of the isolation gap in\n"
  1026. "number (integer) of tool widths.")
  1027. )
  1028. grid0.addWidget(passlabel, 1, 0)
  1029. self.iso_width_entry = FCSpinner()
  1030. self.iso_width_entry.setRange(1, 999)
  1031. grid0.addWidget(self.iso_width_entry, 1, 1)
  1032. # Pass overlap
  1033. overlabel = QtWidgets.QLabel('%s:' % _('Pass overlap'))
  1034. overlabel.setToolTip(
  1035. _("How much (fraction) of the tool width to overlap each tool pass.\n"
  1036. "Example:\n"
  1037. "A value here of 0.25 means an overlap of 25%% from the tool diameter found above.")
  1038. )
  1039. grid0.addWidget(overlabel, 2, 0)
  1040. self.iso_overlap_entry = FCDoubleSpinner()
  1041. self.iso_overlap_entry.set_precision(3)
  1042. self.iso_overlap_entry.setWrapping(True)
  1043. self.iso_overlap_entry.setRange(0.000, 0.999)
  1044. self.iso_overlap_entry.setSingleStep(0.1)
  1045. grid0.addWidget(self.iso_overlap_entry, 2, 1)
  1046. # Milling Type
  1047. milling_type_label = QtWidgets.QLabel('%s:' % _('Milling Type'))
  1048. milling_type_label.setToolTip(
  1049. _("Milling type:\n"
  1050. "- climb / best for precision milling and to reduce tool usage\n"
  1051. "- conventional / useful when there is no backlash compensation")
  1052. )
  1053. grid0.addWidget(milling_type_label, 3, 0)
  1054. self.milling_type_radio = RadioSet([{'label': _('Climb'), 'value': 'cl'},
  1055. {'label': _('Conv.'), 'value': 'cv'}])
  1056. grid0.addWidget(self.milling_type_radio, 3, 1)
  1057. # Combine passes
  1058. self.combine_passes_cb = FCCheckBox(label=_('Combine Passes'))
  1059. self.combine_passes_cb.setToolTip(
  1060. _("Combine all passes into one object")
  1061. )
  1062. grid0.addWidget(self.combine_passes_cb, 4, 0, 1, 2)
  1063. # ## Clear non-copper regions
  1064. self.clearcopper_label = QtWidgets.QLabel("<b>%s:</b>" % _("Non-copper regions"))
  1065. self.clearcopper_label.setToolTip(
  1066. _("Create polygons covering the\n"
  1067. "areas without copper on the PCB.\n"
  1068. "Equivalent to the inverse of this\n"
  1069. "object. Can be used to remove all\n"
  1070. "copper from a specified region.")
  1071. )
  1072. self.layout.addWidget(self.clearcopper_label)
  1073. grid1 = QtWidgets.QGridLayout()
  1074. self.layout.addLayout(grid1)
  1075. # Margin
  1076. bmlabel = QtWidgets.QLabel('%s:' % _('Boundary Margin'))
  1077. bmlabel.setToolTip(
  1078. _("Specify the edge of the PCB\n"
  1079. "by drawing a box around all\n"
  1080. "objects with this minimum\n"
  1081. "distance.")
  1082. )
  1083. grid1.addWidget(bmlabel, 0, 0)
  1084. self.noncopper_margin_entry = FCDoubleSpinner()
  1085. self.noncopper_margin_entry.set_precision(4)
  1086. self.noncopper_margin_entry.setSingleStep(0.1)
  1087. self.noncopper_margin_entry.set_range(-9999, 9999)
  1088. grid1.addWidget(self.noncopper_margin_entry, 0, 1)
  1089. # Rounded corners
  1090. self.noncopper_rounded_cb = FCCheckBox(label=_("Rounded Geo"))
  1091. self.noncopper_rounded_cb.setToolTip(
  1092. _("Resulting geometry will have rounded corners.")
  1093. )
  1094. grid1.addWidget(self.noncopper_rounded_cb, 1, 0, 1, 2)
  1095. # ## Bounding box
  1096. self.boundingbox_label = QtWidgets.QLabel('<b>%s:</b>' % _('Bounding Box'))
  1097. self.layout.addWidget(self.boundingbox_label)
  1098. grid2 = QtWidgets.QGridLayout()
  1099. self.layout.addLayout(grid2)
  1100. bbmargin = QtWidgets.QLabel('%s:' % _('Boundary Margin'))
  1101. bbmargin.setToolTip(
  1102. _("Distance of the edges of the box\n"
  1103. "to the nearest polygon.")
  1104. )
  1105. self.bbmargin_entry = FCDoubleSpinner()
  1106. self.bbmargin_entry.set_precision(4)
  1107. self.bbmargin_entry.setSingleStep(0.1)
  1108. self.bbmargin_entry.set_range(-9999, 9999)
  1109. grid2.addWidget(bbmargin, 0, 0)
  1110. grid2.addWidget(self.bbmargin_entry, 0, 1)
  1111. self.bbrounded_cb = FCCheckBox(label='%s' % _("Rounded Geo"))
  1112. self.bbrounded_cb.setToolTip(
  1113. _("If the bounding box is \n"
  1114. "to have rounded corners\n"
  1115. "their radius is equal to\n"
  1116. "the margin.")
  1117. )
  1118. grid2.addWidget(self.bbrounded_cb, 1, 0, 1, 2)
  1119. self.layout.addStretch()
  1120. class GerberAdvOptPrefGroupUI(OptionsGroupUI):
  1121. def __init__(self, parent=None):
  1122. # OptionsGroupUI.__init__(self, "Gerber Adv. Options Preferences", parent=parent)
  1123. super(GerberAdvOptPrefGroupUI, self).__init__(self)
  1124. self.setTitle(str(_("Gerber Adv. Options")))
  1125. # ## Advanced Gerber Parameters
  1126. self.adv_param_label = QtWidgets.QLabel('<b>%s:</b>' % _('Advanced Options'))
  1127. self.adv_param_label.setToolTip(
  1128. _("A list of Gerber advanced parameters.\n"
  1129. "Those parameters are available only for\n"
  1130. "Advanced App. Level.")
  1131. )
  1132. self.layout.addWidget(self.adv_param_label)
  1133. grid0 = QtWidgets.QGridLayout()
  1134. self.layout.addLayout(grid0)
  1135. # Follow Attribute
  1136. self.follow_cb = FCCheckBox(label=_('"Follow"'))
  1137. self.follow_cb.setToolTip(
  1138. _("Generate a 'Follow' geometry.\n"
  1139. "This means that it will cut through\n"
  1140. "the middle of the trace.")
  1141. )
  1142. grid0.addWidget(self.follow_cb, 0, 0, 1, 2)
  1143. # Aperture Table Visibility CB
  1144. self.aperture_table_visibility_cb = FCCheckBox(label=_('Table Show/Hide'))
  1145. self.aperture_table_visibility_cb.setToolTip(
  1146. _("Toggle the display of the Gerber Apertures Table.\n"
  1147. "Also, on hide, it will delete all mark shapes\n"
  1148. "that are drawn on canvas.")
  1149. )
  1150. grid0.addWidget(self.aperture_table_visibility_cb, 1, 0, 1, 2)
  1151. # Tool Type
  1152. self.tool_type_label = QtWidgets.QLabel('<b>%s</b>' % _('Tool Type'))
  1153. self.tool_type_label.setToolTip(
  1154. _("Choose what tool to use for Gerber isolation:\n"
  1155. "'Circular' or 'V-shape'.\n"
  1156. "When the 'V-shape' is selected then the tool\n"
  1157. "diameter will depend on the chosen cut depth.")
  1158. )
  1159. self.tool_type_radio = RadioSet([{'label': 'Circular', 'value': 'circular'},
  1160. {'label': 'V-Shape', 'value': 'v'}])
  1161. grid0.addWidget(self.tool_type_label, 2, 0)
  1162. grid0.addWidget(self.tool_type_radio, 2, 1, 1, 2)
  1163. # Tip Dia
  1164. self.tipdialabel = QtWidgets.QLabel('%s:' % _('V-Tip Dia'))
  1165. self.tipdialabel.setToolTip(
  1166. _("The tip diameter for V-Shape Tool")
  1167. )
  1168. self.tipdia_spinner = FCDoubleSpinner()
  1169. self.tipdia_spinner.set_range(-99.9999, 99.9999)
  1170. self.tipdia_spinner.setSingleStep(0.1)
  1171. self.tipdia_spinner.setWrapping(True)
  1172. grid0.addWidget(self.tipdialabel, 3, 0)
  1173. grid0.addWidget(self.tipdia_spinner, 3, 1, 1, 2)
  1174. # Tip Angle
  1175. self.tipanglelabel = QtWidgets.QLabel('%s:' % _('V-Tip Angle'))
  1176. self.tipanglelabel.setToolTip(
  1177. _("The tip angle for V-Shape Tool.\n"
  1178. "In degree.")
  1179. )
  1180. self.tipangle_spinner = FCSpinner()
  1181. self.tipangle_spinner.set_range(0, 180)
  1182. self.tipangle_spinner.setSingleStep(5)
  1183. self.tipangle_spinner.setWrapping(True)
  1184. grid0.addWidget(self.tipanglelabel, 4, 0)
  1185. grid0.addWidget(self.tipangle_spinner, 4, 1, 1, 2)
  1186. # Cut Z
  1187. self.cutzlabel = QtWidgets.QLabel('%s:' % _('Cut Z'))
  1188. self.cutzlabel.setToolTip(
  1189. _("Cutting depth (negative)\n"
  1190. "below the copper surface.")
  1191. )
  1192. self.cutz_spinner = FCDoubleSpinner()
  1193. self.cutz_spinner.set_range(-99.9999, -0.0001)
  1194. self.cutz_spinner.setSingleStep(0.1)
  1195. self.cutz_spinner.setWrapping(True)
  1196. grid0.addWidget(self.cutzlabel, 5, 0)
  1197. grid0.addWidget(self.cutz_spinner, 5, 1, 1, 2)
  1198. # Buffering Type
  1199. buffering_label = QtWidgets.QLabel('%s:' % _('Buffering'))
  1200. buffering_label.setToolTip(
  1201. _("Buffering type:\n"
  1202. "- None --> best performance, fast file loading but no so good display\n"
  1203. "- Full --> slow file loading but good visuals. This is the default.\n"
  1204. "<<WARNING>>: Don't change this unless you know what you are doing !!!")
  1205. )
  1206. self.buffering_radio = RadioSet([{'label': _('None'), 'value': 'no'},
  1207. {'label': _('Full'), 'value': 'full'}])
  1208. grid0.addWidget(buffering_label, 6, 0)
  1209. grid0.addWidget(self.buffering_radio, 6, 1)
  1210. # Simplification
  1211. self.simplify_cb = FCCheckBox(label=_('Simplify'))
  1212. self.simplify_cb.setToolTip(
  1213. _("When checked all the Gerber polygons will be\n"
  1214. "loaded with simplification having a set tolerance.\n"
  1215. "<<WARNING>>: Don't change this unless you know what you are doing !!!")
  1216. )
  1217. grid0.addWidget(self.simplify_cb, 7, 0, 1, 2)
  1218. # Simplification tolerance
  1219. self.simplification_tol_label = QtWidgets.QLabel(_('Tolerance'))
  1220. self.simplification_tol_label.setToolTip(_("Tolerance for polygon simplification."))
  1221. self.simplification_tol_spinner = FCDoubleSpinner()
  1222. self.simplification_tol_spinner.set_precision(5)
  1223. self.simplification_tol_spinner.setWrapping(True)
  1224. self.simplification_tol_spinner.setRange(0.00000, 0.01000)
  1225. self.simplification_tol_spinner.setSingleStep(0.0001)
  1226. grid0.addWidget(self.simplification_tol_label, 8, 0)
  1227. grid0.addWidget(self.simplification_tol_spinner, 8, 1)
  1228. self.ois_simplif = OptionalInputSection(self.simplify_cb,
  1229. [self.simplification_tol_label, self.simplification_tol_spinner],
  1230. logic=True)
  1231. self.layout.addStretch()
  1232. class GerberExpPrefGroupUI(OptionsGroupUI):
  1233. def __init__(self, parent=None):
  1234. super(GerberExpPrefGroupUI, self).__init__(self)
  1235. self.setTitle(str(_("Gerber Export")))
  1236. # Plot options
  1237. self.export_options_label = QtWidgets.QLabel("<b>%s:</b>" % _("Export Options"))
  1238. self.export_options_label.setToolTip(
  1239. _("The parameters set here are used in the file exported\n"
  1240. "when using the File -> Export -> Export Gerber menu entry.")
  1241. )
  1242. self.layout.addWidget(self.export_options_label)
  1243. form = QtWidgets.QFormLayout()
  1244. self.layout.addLayout(form)
  1245. # Gerber Units
  1246. self.gerber_units_label = QtWidgets.QLabel('<b>%s:</b>' % _('Units'))
  1247. self.gerber_units_label.setToolTip(
  1248. _("The units used in the Gerber file.")
  1249. )
  1250. self.gerber_units_radio = RadioSet([{'label': _('INCH'), 'value': 'IN'},
  1251. {'label': _('MM'), 'value': 'MM'}])
  1252. self.gerber_units_radio.setToolTip(
  1253. _("The units used in the Gerber file.")
  1254. )
  1255. form.addRow(self.gerber_units_label, self.gerber_units_radio)
  1256. # Gerber format
  1257. self.digits_label = QtWidgets.QLabel("<b>%s:</b>" % _("Int/Decimals"))
  1258. self.digits_label.setToolTip(
  1259. _("The number of digits in the whole part of the number\n"
  1260. "and in the fractional part of the number.")
  1261. )
  1262. hlay1 = QtWidgets.QHBoxLayout()
  1263. self.format_whole_entry = FCSpinner()
  1264. self.format_whole_entry.set_range(0, 9)
  1265. self.format_whole_entry.setSingleStep(1)
  1266. self.format_whole_entry.setWrapping(True)
  1267. self.format_whole_entry.setMinimumWidth(30)
  1268. self.format_whole_entry.setToolTip(
  1269. _("This numbers signify the number of digits in\n"
  1270. "the whole part of Gerber coordinates.")
  1271. )
  1272. hlay1.addWidget(self.format_whole_entry, QtCore.Qt.AlignLeft)
  1273. gerber_separator_label = QtWidgets.QLabel(':')
  1274. gerber_separator_label.setFixedWidth(5)
  1275. hlay1.addWidget(gerber_separator_label, QtCore.Qt.AlignLeft)
  1276. self.format_dec_entry = FCSpinner()
  1277. self.format_dec_entry.set_range(0, 9)
  1278. self.format_dec_entry.setSingleStep(1)
  1279. self.format_dec_entry.setWrapping(True)
  1280. self.format_dec_entry.setMinimumWidth(30)
  1281. self.format_dec_entry.setToolTip(
  1282. _("This numbers signify the number of digits in\n"
  1283. "the decimal part of Gerber coordinates.")
  1284. )
  1285. hlay1.addWidget(self.format_dec_entry, QtCore.Qt.AlignLeft)
  1286. hlay1.addStretch()
  1287. form.addRow(self.digits_label, hlay1)
  1288. # Gerber Zeros
  1289. self.zeros_label = QtWidgets.QLabel('<b>%s:</b>' % _('Zeros'))
  1290. self.zeros_label.setAlignment(QtCore.Qt.AlignLeft)
  1291. self.zeros_label.setToolTip(
  1292. _("This sets the type of Gerber zeros.\n"
  1293. "If LZ then Leading Zeros are removed and\n"
  1294. "Trailing Zeros are kept.\n"
  1295. "If TZ is checked then Trailing Zeros are removed\n"
  1296. "and Leading Zeros are kept.")
  1297. )
  1298. self.zeros_radio = RadioSet([{'label': _('LZ'), 'value': 'L'},
  1299. {'label': _('TZ'), 'value': 'T'}])
  1300. self.zeros_radio.setToolTip(
  1301. _("This sets the type of Gerber zeros.\n"
  1302. "If LZ then Leading Zeros are removed and\n"
  1303. "Trailing Zeros are kept.\n"
  1304. "If TZ is checked then Trailing Zeros are removed\n"
  1305. "and Leading Zeros are kept.")
  1306. )
  1307. form.addRow(self.zeros_label, self.zeros_radio)
  1308. self.layout.addStretch()
  1309. class GerberEditorPrefGroupUI(OptionsGroupUI):
  1310. def __init__(self, parent=None):
  1311. # OptionsGroupUI.__init__(self, "Gerber Adv. Options Preferences", parent=parent)
  1312. super(GerberEditorPrefGroupUI, self).__init__(self)
  1313. self.setTitle(str(_("Gerber Editor")))
  1314. # Advanced Gerber Parameters
  1315. self.param_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  1316. self.param_label.setToolTip(
  1317. _("A list of Gerber Editor parameters.")
  1318. )
  1319. self.layout.addWidget(self.param_label)
  1320. grid0 = QtWidgets.QGridLayout()
  1321. self.layout.addLayout(grid0)
  1322. # Selection Limit
  1323. self.sel_limit_label = QtWidgets.QLabel('%s:' % _("Selection limit"))
  1324. self.sel_limit_label.setToolTip(
  1325. _("Set the number of selected Gerber geometry\n"
  1326. "items above which the utility geometry\n"
  1327. "becomes just a selection rectangle.\n"
  1328. "Increases the performance when moving a\n"
  1329. "large number of geometric elements.")
  1330. )
  1331. self.sel_limit_entry = FCSpinner()
  1332. self.sel_limit_entry.set_range(0, 9999)
  1333. grid0.addWidget(self.sel_limit_label, 0, 0)
  1334. grid0.addWidget(self.sel_limit_entry, 0, 1)
  1335. # New aperture code
  1336. self.addcode_entry_lbl = QtWidgets.QLabel('%s:' % _('New Aperture code'))
  1337. self.addcode_entry_lbl.setToolTip(
  1338. _("Code for the new aperture")
  1339. )
  1340. self.addcode_entry = FCSpinner()
  1341. self.addcode_entry.set_range(10, 99)
  1342. self.addcode_entry.setWrapping(True)
  1343. grid0.addWidget(self.addcode_entry_lbl, 1, 0)
  1344. grid0.addWidget(self.addcode_entry, 1, 1)
  1345. # New aperture size
  1346. self.addsize_entry_lbl = QtWidgets.QLabel('%s:' % _('New Aperture size'))
  1347. self.addsize_entry_lbl.setToolTip(
  1348. _("Size for the new aperture")
  1349. )
  1350. self.addsize_entry = FCDoubleSpinner()
  1351. self.addsize_entry.set_range(0, 100)
  1352. self.addsize_entry.set_precision(4)
  1353. grid0.addWidget(self.addsize_entry_lbl, 2, 0)
  1354. grid0.addWidget(self.addsize_entry, 2, 1)
  1355. # New aperture type
  1356. self.addtype_combo_lbl = QtWidgets.QLabel('%s:' % _('New Aperture type'))
  1357. self.addtype_combo_lbl.setToolTip(
  1358. _("Type for the new aperture.\n"
  1359. "Can be 'C', 'R' or 'O'.")
  1360. )
  1361. self.addtype_combo = FCComboBox()
  1362. self.addtype_combo.addItems(['C', 'R', 'O'])
  1363. grid0.addWidget(self.addtype_combo_lbl, 3, 0)
  1364. grid0.addWidget(self.addtype_combo, 3, 1)
  1365. # Number of pads in a pad array
  1366. self.grb_array_size_label = QtWidgets.QLabel('%s:' % _('Nr of pads'))
  1367. self.grb_array_size_label.setToolTip(
  1368. _("Specify how many pads to be in the array.")
  1369. )
  1370. self.grb_array_size_entry = FCSpinner()
  1371. self.grb_array_size_entry.set_range(0, 9999)
  1372. grid0.addWidget(self.grb_array_size_label, 4, 0)
  1373. grid0.addWidget(self.grb_array_size_entry, 4, 1)
  1374. self.adddim_label = QtWidgets.QLabel('%s:' % _('Aperture Dimensions'))
  1375. self.adddim_label.setToolTip(
  1376. _("Diameters of the cutting tools, separated by ','")
  1377. )
  1378. grid0.addWidget(self.adddim_label, 5, 0)
  1379. self.adddim_entry = FCEntry()
  1380. grid0.addWidget(self.adddim_entry, 5, 1)
  1381. self.grb_array_linear_label = QtWidgets.QLabel('<b>%s:</b>' % _('Linear Pad Array'))
  1382. grid0.addWidget(self.grb_array_linear_label, 6, 0, 1, 2)
  1383. # Linear Pad Array direction
  1384. self.grb_axis_label = QtWidgets.QLabel('%s:' % _('Linear Dir.'))
  1385. self.grb_axis_label.setToolTip(
  1386. _("Direction on which the linear array is oriented:\n"
  1387. "- 'X' - horizontal axis \n"
  1388. "- 'Y' - vertical axis or \n"
  1389. "- 'Angle' - a custom angle for the array inclination")
  1390. )
  1391. self.grb_axis_radio = RadioSet([{'label': _('X'), 'value': 'X'},
  1392. {'label': _('Y'), 'value': 'Y'},
  1393. {'label': _('Angle'), 'value': 'A'}])
  1394. grid0.addWidget(self.grb_axis_label, 7, 0)
  1395. grid0.addWidget(self.grb_axis_radio, 7, 1)
  1396. # Linear Pad Array pitch distance
  1397. self.grb_pitch_label = QtWidgets.QLabel('%s:' % _('Pitch'))
  1398. self.grb_pitch_label.setToolTip(
  1399. _("Pitch = Distance between elements of the array.")
  1400. )
  1401. # self.drill_pitch_label.setMinimumWidth(100)
  1402. self.grb_pitch_entry = FCDoubleSpinner()
  1403. self.grb_pitch_entry.set_precision(4)
  1404. grid0.addWidget(self.grb_pitch_label, 8, 0)
  1405. grid0.addWidget(self.grb_pitch_entry, 8, 1)
  1406. # Linear Pad Array custom angle
  1407. self.grb_angle_label = QtWidgets.QLabel('%s:' % _('Angle'))
  1408. self.grb_angle_label.setToolTip(
  1409. _("Angle at which each element in circular array is placed.")
  1410. )
  1411. self.grb_angle_entry = FCDoubleSpinner()
  1412. self.grb_angle_entry.set_precision(4)
  1413. self.grb_angle_entry.setSingleStep(5)
  1414. grid0.addWidget(self.grb_angle_label, 9, 0)
  1415. grid0.addWidget(self.grb_angle_entry, 9, 1)
  1416. self.grb_array_circ_label = QtWidgets.QLabel('<b>%s:</b>' % _('Circular Pad Array'))
  1417. grid0.addWidget(self.grb_array_circ_label, 10, 0, 1, 2)
  1418. # Circular Pad Array direction
  1419. self.grb_circular_direction_label = QtWidgets.QLabel('%s:' % _('Circular Dir.'))
  1420. self.grb_circular_direction_label.setToolTip(
  1421. _("Direction for circular array.\n"
  1422. "Can be CW = clockwise or CCW = counter clockwise.")
  1423. )
  1424. self.grb_circular_dir_radio = RadioSet([{'label': _('CW'), 'value': 'CW'},
  1425. {'label': _('CCW'), 'value': 'CCW'}])
  1426. grid0.addWidget(self.grb_circular_direction_label, 11, 0)
  1427. grid0.addWidget(self.grb_circular_dir_radio, 11, 1)
  1428. # Circular Pad Array Angle
  1429. self.grb_circular_angle_label = QtWidgets.QLabel('%s:' % _('Circ. Angle'))
  1430. self.grb_circular_angle_label.setToolTip(
  1431. _("Angle at which each element in circular array is placed.")
  1432. )
  1433. self.grb_circular_angle_entry = FCDoubleSpinner()
  1434. self.grb_circular_angle_entry.set_precision(4)
  1435. self.grb_circular_angle_entry.setSingleStep(5)
  1436. grid0.addWidget(self.grb_circular_angle_label, 12, 0)
  1437. grid0.addWidget(self.grb_circular_angle_entry, 12, 1)
  1438. self.grb_array_tools_b_label = QtWidgets.QLabel('<b>%s:</b>' % _('Buffer Tool'))
  1439. grid0.addWidget(self.grb_array_tools_b_label, 13, 0, 1, 2)
  1440. # Buffer Distance
  1441. self.grb_buff_label = QtWidgets.QLabel('%s:' % _('Buffer distance'))
  1442. self.grb_buff_label.setToolTip(
  1443. _("Distance at which to buffer the Gerber element.")
  1444. )
  1445. self.grb_buff_entry = FCDoubleSpinner()
  1446. self.grb_buff_entry.set_precision(4)
  1447. grid0.addWidget(self.grb_buff_label, 14, 0)
  1448. grid0.addWidget(self.grb_buff_entry, 14, 1)
  1449. self.grb_array_tools_s_label = QtWidgets.QLabel('<b>%s:</b>' % _('Scale Tool'))
  1450. grid0.addWidget(self.grb_array_tools_s_label, 15, 0, 1, 2)
  1451. # Scale Factor
  1452. self.grb_scale_label = QtWidgets.QLabel('%s:' % _('Scale factor'))
  1453. self.grb_scale_label.setToolTip(
  1454. _("Factor to scale the Gerber element.")
  1455. )
  1456. self.grb_scale_entry = FCDoubleSpinner()
  1457. self.grb_scale_entry.set_precision(4)
  1458. grid0.addWidget(self.grb_scale_label, 16, 0)
  1459. grid0.addWidget(self.grb_scale_entry, 16, 1)
  1460. self.grb_array_tools_ma_label = QtWidgets.QLabel('<b>%s:</b>' % _('Mark Area Tool'))
  1461. grid0.addWidget(self.grb_array_tools_ma_label, 17, 0, 1, 2)
  1462. # Mark area Tool low threshold
  1463. self.grb_ma_low_label = QtWidgets.QLabel('%s:' % _('Threshold low'))
  1464. self.grb_ma_low_label.setToolTip(
  1465. _("Threshold value under which the apertures are not marked.")
  1466. )
  1467. self.grb_ma_low_entry = FCDoubleSpinner()
  1468. self.grb_ma_low_entry.set_precision(4)
  1469. grid0.addWidget(self.grb_ma_low_label, 18, 0)
  1470. grid0.addWidget(self.grb_ma_low_entry, 18, 1)
  1471. # Mark area Tool high threshold
  1472. self.grb_ma_high_label = QtWidgets.QLabel('%s:' % _('Threshold high'))
  1473. self.grb_ma_high_label.setToolTip(
  1474. _("Threshold value over which the apertures are not marked.")
  1475. )
  1476. self.grb_ma_high_entry = FCDoubleSpinner()
  1477. self.grb_ma_high_entry.set_precision(4)
  1478. grid0.addWidget(self.grb_ma_high_label, 19, 0)
  1479. grid0.addWidget(self.grb_ma_high_entry, 19, 1)
  1480. self.layout.addStretch()
  1481. class ExcellonGenPrefGroupUI(OptionsGroupUI):
  1482. def __init__(self, parent=None):
  1483. # OptionsGroupUI.__init__(self, "Excellon Options", parent=parent)
  1484. super(ExcellonGenPrefGroupUI, self).__init__(self)
  1485. self.setTitle(str(_("Excellon General")))
  1486. # Plot options
  1487. self.plot_options_label = QtWidgets.QLabel("<b>%s:</b>" % _("Plot Options"))
  1488. self.layout.addWidget(self.plot_options_label)
  1489. grid1 = QtWidgets.QGridLayout()
  1490. self.layout.addLayout(grid1)
  1491. self.plot_cb = FCCheckBox(label=_('Plot'))
  1492. self.plot_cb.setToolTip(
  1493. "Plot (show) this object."
  1494. )
  1495. grid1.addWidget(self.plot_cb, 0, 0)
  1496. self.solid_cb = FCCheckBox(label=_('Solid'))
  1497. self.solid_cb.setToolTip(
  1498. "Plot as solid circles."
  1499. )
  1500. grid1.addWidget(self.solid_cb, 0, 1)
  1501. # Excellon format
  1502. self.excellon_format_label = QtWidgets.QLabel("<b>%s:</b>" % _("Excellon Format"))
  1503. self.excellon_format_label.setToolTip(
  1504. _("The NC drill files, usually named Excellon files\n"
  1505. "are files that can be found in different formats.\n"
  1506. "Here we set the format used when the provided\n"
  1507. "coordinates are not using period.\n"
  1508. "\n"
  1509. "Possible presets:\n"
  1510. "\n"
  1511. "PROTEUS 3:3 MM LZ\n"
  1512. "DipTrace 5:2 MM TZ\n"
  1513. "DipTrace 4:3 MM LZ\n"
  1514. "\n"
  1515. "EAGLE 3:3 MM TZ\n"
  1516. "EAGLE 4:3 MM TZ\n"
  1517. "EAGLE 2:5 INCH TZ\n"
  1518. "EAGLE 3:5 INCH TZ\n"
  1519. "\n"
  1520. "ALTIUM 2:4 INCH LZ\n"
  1521. "Sprint Layout 2:4 INCH LZ"
  1522. "\n"
  1523. "KiCAD 3:5 INCH TZ")
  1524. )
  1525. self.layout.addWidget(self.excellon_format_label)
  1526. hlay1 = QtWidgets.QHBoxLayout()
  1527. self.layout.addLayout(hlay1)
  1528. self.excellon_format_in_label = QtWidgets.QLabel('%s:' % _("INCH"))
  1529. self.excellon_format_in_label.setAlignment(QtCore.Qt.AlignLeft)
  1530. self.excellon_format_in_label.setToolTip(
  1531. _("Default values for INCH are 2:4"))
  1532. hlay1.addWidget(self.excellon_format_in_label, QtCore.Qt.AlignLeft)
  1533. self.excellon_format_upper_in_entry = FCSpinner()
  1534. self.excellon_format_upper_in_entry.set_range(0, 9)
  1535. self.excellon_format_upper_in_entry.setMinimumWidth(30)
  1536. self.excellon_format_upper_in_entry.setToolTip(
  1537. _("This numbers signify the number of digits in\n"
  1538. "the whole part of Excellon coordinates.")
  1539. )
  1540. hlay1.addWidget(self.excellon_format_upper_in_entry, QtCore.Qt.AlignLeft)
  1541. excellon_separator_in_label = QtWidgets.QLabel(':')
  1542. excellon_separator_in_label.setFixedWidth(5)
  1543. hlay1.addWidget(excellon_separator_in_label, QtCore.Qt.AlignLeft)
  1544. self.excellon_format_lower_in_entry = FCSpinner()
  1545. self.excellon_format_lower_in_entry.set_range(0, 9)
  1546. self.excellon_format_lower_in_entry.setMinimumWidth(30)
  1547. self.excellon_format_lower_in_entry.setToolTip(
  1548. _("This numbers signify the number of digits in\n"
  1549. "the decimal part of Excellon coordinates.")
  1550. )
  1551. hlay1.addWidget(self.excellon_format_lower_in_entry, QtCore.Qt.AlignLeft)
  1552. hlay1.addStretch()
  1553. hlay2 = QtWidgets.QHBoxLayout()
  1554. self.layout.addLayout(hlay2)
  1555. self.excellon_format_mm_label = QtWidgets.QLabel('%s:' % _("METRIC"))
  1556. self.excellon_format_mm_label.setAlignment(QtCore.Qt.AlignLeft)
  1557. self.excellon_format_mm_label.setToolTip(
  1558. _("Default values for METRIC are 3:3"))
  1559. hlay2.addWidget(self.excellon_format_mm_label, QtCore.Qt.AlignLeft)
  1560. self.excellon_format_upper_mm_entry = FCSpinner()
  1561. self.excellon_format_upper_mm_entry.set_range(0, 9)
  1562. self.excellon_format_upper_mm_entry.setMinimumWidth(30)
  1563. self.excellon_format_upper_mm_entry.setToolTip(
  1564. _("This numbers signify the number of digits in\n"
  1565. "the whole part of Excellon coordinates.")
  1566. )
  1567. hlay2.addWidget(self.excellon_format_upper_mm_entry, QtCore.Qt.AlignLeft)
  1568. excellon_separator_mm_label = QtWidgets.QLabel(':')
  1569. excellon_separator_mm_label.setFixedWidth(5)
  1570. hlay2.addWidget(excellon_separator_mm_label, QtCore.Qt.AlignLeft)
  1571. self.excellon_format_lower_mm_entry = FCSpinner()
  1572. self.excellon_format_lower_mm_entry.set_range(0, 9)
  1573. self.excellon_format_lower_mm_entry.setMinimumWidth(30)
  1574. self.excellon_format_lower_mm_entry.setToolTip(
  1575. _("This numbers signify the number of digits in\n"
  1576. "the decimal part of Excellon coordinates.")
  1577. )
  1578. hlay2.addWidget(self.excellon_format_lower_mm_entry, QtCore.Qt.AlignLeft)
  1579. hlay2.addStretch()
  1580. grid2 = QtWidgets.QGridLayout()
  1581. self.layout.addLayout(grid2)
  1582. self.excellon_zeros_label = QtWidgets.QLabel('%s:' % _('Default <b>Zeros</b>'))
  1583. self.excellon_zeros_label.setAlignment(QtCore.Qt.AlignLeft)
  1584. self.excellon_zeros_label.setToolTip(
  1585. _("This sets the type of Excellon zeros.\n"
  1586. "If LZ then Leading Zeros are kept and\n"
  1587. "Trailing Zeros are removed.\n"
  1588. "If TZ is checked then Trailing Zeros are kept\n"
  1589. "and Leading Zeros are removed.")
  1590. )
  1591. grid2.addWidget(self.excellon_zeros_label, 0, 0)
  1592. self.excellon_zeros_radio = RadioSet([{'label': _('LZ'), 'value': 'L'},
  1593. {'label': _('TZ'), 'value': 'T'}])
  1594. self.excellon_zeros_radio.setToolTip(
  1595. _("This sets the default type of Excellon zeros.\n"
  1596. "If it is not detected in the parsed file the value here\n"
  1597. "will be used."
  1598. "If LZ then Leading Zeros are kept and\n"
  1599. "Trailing Zeros are removed.\n"
  1600. "If TZ is checked then Trailing Zeros are kept\n"
  1601. "and Leading Zeros are removed.")
  1602. )
  1603. grid2.addWidget(self.excellon_zeros_radio, 0, 1)
  1604. self.excellon_units_label = QtWidgets.QLabel('%s:' % _('Default <b>Units</b>'))
  1605. self.excellon_units_label.setAlignment(QtCore.Qt.AlignLeft)
  1606. self.excellon_units_label.setToolTip(
  1607. _("This sets the default units of Excellon files.\n"
  1608. "If it is not detected in the parsed file the value here\n"
  1609. "will be used."
  1610. "Some Excellon files don't have an header\n"
  1611. "therefore this parameter will be used.")
  1612. )
  1613. grid2.addWidget(self.excellon_units_label, 1, 0)
  1614. self.excellon_units_radio = RadioSet([{'label': _('INCH'), 'value': 'INCH'},
  1615. {'label': _('MM'), 'value': 'METRIC'}])
  1616. self.excellon_units_radio.setToolTip(
  1617. _("This sets the units of Excellon files.\n"
  1618. "Some Excellon files don't have an header\n"
  1619. "therefore this parameter will be used.")
  1620. )
  1621. grid2.addWidget(self.excellon_units_radio, 1, 1)
  1622. self.update_excellon_cb = FCCheckBox(label=_('Update Export settings'))
  1623. self.update_excellon_cb.setToolTip(
  1624. "If checked, the Excellon Export settings will be updated with the ones above."
  1625. )
  1626. grid2.addWidget(self.update_excellon_cb, 2, 0, 1, 2)
  1627. grid2.addWidget(QtWidgets.QLabel(""), 3, 0)
  1628. self.excellon_general_label = QtWidgets.QLabel("<b>%s:</b>" % _("Excellon Optimization"))
  1629. grid2.addWidget(self.excellon_general_label, 4, 0, 1, 2)
  1630. self.excellon_optimization_label = QtWidgets.QLabel(_('Algorithm:'))
  1631. self.excellon_optimization_label.setToolTip(
  1632. _("This sets the optimization type for the Excellon drill path.\n"
  1633. "If <<MetaHeuristic>> is checked then Google OR-Tools algorithm with\n"
  1634. "MetaHeuristic Guided Local Path is used. Default search time is 3sec.\n"
  1635. "If <<Basic>> is checked then Google OR-Tools Basic algorithm is used.\n"
  1636. "If <<TSA>> is checked then Travelling Salesman algorithm is used for\n"
  1637. "drill path optimization.\n"
  1638. "\n"
  1639. "If this control is disabled, then FlatCAM works in 32bit mode and it uses\n"
  1640. "Travelling Salesman algorithm for path optimization.")
  1641. )
  1642. grid2.addWidget(self.excellon_optimization_label, 5, 0)
  1643. self.excellon_optimization_radio = RadioSet([{'label': _('MetaHeuristic'), 'value': 'M'},
  1644. {'label': _('Basic'), 'value': 'B'},
  1645. {'label': _('TSA'), 'value': 'T'}],
  1646. orientation='vertical', stretch=False)
  1647. self.excellon_optimization_radio.setToolTip(
  1648. _("This sets the optimization type for the Excellon drill path.\n"
  1649. "If <<MetaHeuristic>> is checked then Google OR-Tools algorithm with\n"
  1650. "MetaHeuristic Guided Local Path is used. Default search time is 3sec.\n"
  1651. "If <<Basic>> is checked then Google OR-Tools Basic algorithm is used.\n"
  1652. "If <<TSA>> is checked then Travelling Salesman algorithm is used for\n"
  1653. "drill path optimization.\n"
  1654. "\n"
  1655. "If this control is disabled, then FlatCAM works in 32bit mode and it uses\n"
  1656. "Travelling Salesman algorithm for path optimization.")
  1657. )
  1658. grid2.addWidget(self.excellon_optimization_radio, 5, 1)
  1659. self.optimization_time_label = QtWidgets.QLabel('%s:' % _('Optimization Time'))
  1660. self.optimization_time_label.setAlignment(QtCore.Qt.AlignLeft)
  1661. self.optimization_time_label.setToolTip(
  1662. _("When OR-Tools Metaheuristic (MH) is enabled there is a\n"
  1663. "maximum threshold for how much time is spent doing the\n"
  1664. "path optimization. This max duration is set here.\n"
  1665. "In seconds.")
  1666. )
  1667. grid2.addWidget(self.optimization_time_label, 6, 0)
  1668. self.optimization_time_entry = FCSpinner()
  1669. self.optimization_time_entry.set_range(0, 999)
  1670. grid2.addWidget(self.optimization_time_entry, 6, 1)
  1671. current_platform = platform.architecture()[0]
  1672. if current_platform == '64bit':
  1673. self.excellon_optimization_label.setDisabled(False)
  1674. self.excellon_optimization_radio.setDisabled(False)
  1675. self.optimization_time_label.setDisabled(False)
  1676. self.optimization_time_entry.setDisabled(False)
  1677. self.excellon_optimization_radio.activated_custom.connect(self.optimization_selection)
  1678. else:
  1679. self.excellon_optimization_label.setDisabled(True)
  1680. self.excellon_optimization_radio.setDisabled(True)
  1681. self.optimization_time_label.setDisabled(True)
  1682. self.optimization_time_entry.setDisabled(True)
  1683. self.layout.addStretch()
  1684. def optimization_selection(self):
  1685. if self.excellon_optimization_radio.get_value() == 'M':
  1686. self.optimization_time_label.setDisabled(False)
  1687. self.optimization_time_entry.setDisabled(False)
  1688. else:
  1689. self.optimization_time_label.setDisabled(True)
  1690. self.optimization_time_entry.setDisabled(True)
  1691. class ExcellonOptPrefGroupUI(OptionsGroupUI):
  1692. def __init__(self, parent=None):
  1693. # OptionsGroupUI.__init__(self, "Excellon Options", parent=parent)
  1694. super(ExcellonOptPrefGroupUI, self).__init__(self)
  1695. self.setTitle(str(_("Excellon Options")))
  1696. # ## Create CNC Job
  1697. self.cncjob_label = QtWidgets.QLabel('<b>%s</b>' % _('Create CNC Job'))
  1698. self.cncjob_label.setToolTip(
  1699. _("Parameters used to create a CNC Job object\n"
  1700. "for this drill object.")
  1701. )
  1702. self.layout.addWidget(self.cncjob_label)
  1703. grid2 = QtWidgets.QGridLayout()
  1704. self.layout.addLayout(grid2)
  1705. # Cut Z
  1706. cutzlabel = QtWidgets.QLabel('%s:' % _('Cut Z'))
  1707. cutzlabel.setToolTip(
  1708. _("Drill depth (negative)\n"
  1709. "below the copper surface.")
  1710. )
  1711. grid2.addWidget(cutzlabel, 0, 0)
  1712. self.cutz_entry = FCDoubleSpinner()
  1713. self.cutz_entry.set_range(-9999, -0.000001)
  1714. self.cutz_entry.set_precision(4)
  1715. grid2.addWidget(self.cutz_entry, 0, 1)
  1716. # Travel Z
  1717. travelzlabel = QtWidgets.QLabel('%s:' % _('Travel Z'))
  1718. travelzlabel.setToolTip(
  1719. _("Tool height when travelling\n"
  1720. "across the XY plane.")
  1721. )
  1722. grid2.addWidget(travelzlabel, 1, 0)
  1723. self.travelz_entry = FCDoubleSpinner()
  1724. self.travelz_entry.set_precision(4)
  1725. self.travelz_entry.set_range(0, 999)
  1726. grid2.addWidget(self.travelz_entry, 1, 1)
  1727. # Tool change:
  1728. toolchlabel = QtWidgets.QLabel('%s:' % _("Tool change"))
  1729. toolchlabel.setToolTip(
  1730. _("Include tool-change sequence\n"
  1731. "in G-Code (Pause for tool change).")
  1732. )
  1733. self.toolchange_cb = FCCheckBox()
  1734. grid2.addWidget(toolchlabel, 2, 0)
  1735. grid2.addWidget(self.toolchange_cb, 2, 1)
  1736. toolchangezlabel = QtWidgets.QLabel('%s:' % _('Toolchange Z'))
  1737. toolchangezlabel.setToolTip(
  1738. _("Z-axis position (height) for\n"
  1739. "tool change.")
  1740. )
  1741. grid2.addWidget(toolchangezlabel, 3, 0)
  1742. self.toolchangez_entry = FCDoubleSpinner()
  1743. self.toolchangez_entry.set_precision(4)
  1744. self.toolchangez_entry.set_range(0, 999)
  1745. grid2.addWidget(self.toolchangez_entry, 3, 1)
  1746. # End Move Z
  1747. endzlabel = QtWidgets.QLabel('%s:' % _('End move Z'))
  1748. endzlabel.setToolTip(
  1749. _("Height of the tool after\n"
  1750. "the last move at the end of the job.")
  1751. )
  1752. self.eendz_entry = FCDoubleSpinner()
  1753. self.eendz_entry.set_precision(4)
  1754. self.eendz_entry.set_range(0, 999)
  1755. grid2.addWidget(endzlabel, 4, 0)
  1756. grid2.addWidget(self.eendz_entry, 4, 1)
  1757. # Feedrate Z
  1758. frlabel = QtWidgets.QLabel('%s:' % _('Feedrate Z'))
  1759. frlabel.setToolTip(
  1760. _("Tool speed while drilling\n"
  1761. "(in units per minute).\n"
  1762. "So called 'Plunge' feedrate.\n"
  1763. "This is for linear move G01.")
  1764. )
  1765. self.feedrate_entry = FCDoubleSpinner()
  1766. self.feedrate_entry.set_precision(4)
  1767. self.feedrate_entry.set_range(0, 999)
  1768. grid2.addWidget(frlabel, 5, 0)
  1769. grid2.addWidget(self.feedrate_entry, 5, 1)
  1770. # Spindle speed
  1771. spdlabel = QtWidgets.QLabel('%s:' % _('Spindle Speed'))
  1772. spdlabel.setToolTip(
  1773. _("Speed of the spindle\n"
  1774. "in RPM (optional)")
  1775. )
  1776. grid2.addWidget(spdlabel, 6, 0)
  1777. self.spindlespeed_entry = IntEntry(allow_empty=True)
  1778. grid2.addWidget(self.spindlespeed_entry, 6, 1)
  1779. # Dwell
  1780. dwelllabel = QtWidgets.QLabel('%s:' % _('Dwell'))
  1781. dwelllabel.setToolTip(
  1782. _("Pause to allow the spindle to reach its\n"
  1783. "speed before cutting.")
  1784. )
  1785. dwelltime = QtWidgets.QLabel('%s:' % _('Duration'))
  1786. dwelltime.setToolTip(
  1787. _("Number of time units for spindle to dwell.")
  1788. )
  1789. self.dwell_cb = FCCheckBox()
  1790. self.dwelltime_entry = FCDoubleSpinner()
  1791. self.dwelltime_entry.set_precision(4)
  1792. self.dwelltime_entry.set_range(0, 99999.9999)
  1793. grid2.addWidget(dwelllabel, 7, 0)
  1794. grid2.addWidget(self.dwell_cb, 7, 1)
  1795. grid2.addWidget(dwelltime, 8, 0)
  1796. grid2.addWidget(self.dwelltime_entry, 8, 1)
  1797. self.ois_dwell_exc = OptionalInputSection(self.dwell_cb, [self.dwelltime_entry])
  1798. # postprocessor selection
  1799. pp_excellon_label = QtWidgets.QLabel('%s:' % _("Postprocessor"))
  1800. pp_excellon_label.setToolTip(
  1801. _("The postprocessor JSON file that dictates\n"
  1802. "Gcode output.")
  1803. )
  1804. grid2.addWidget(pp_excellon_label, 9, 0)
  1805. self.pp_excellon_name_cb = FCComboBox()
  1806. self.pp_excellon_name_cb.setFocusPolicy(Qt.StrongFocus)
  1807. grid2.addWidget(self.pp_excellon_name_cb, 9, 1)
  1808. # ### Choose what to use for Gcode creation: Drills, Slots or Both
  1809. excellon_gcode_type_label = QtWidgets.QLabel('<b>%s</b>' % _('Gcode'))
  1810. excellon_gcode_type_label.setToolTip(
  1811. _("Choose what to use for GCode generation:\n"
  1812. "'Drills', 'Slots' or 'Both'.\n"
  1813. "When choosing 'Slots' or 'Both', slots will be\n"
  1814. "converted to drills.")
  1815. )
  1816. self.excellon_gcode_type_radio = RadioSet([{'label': 'Drills', 'value': 'drills'},
  1817. {'label': 'Slots', 'value': 'slots'},
  1818. {'label': 'Both', 'value': 'both'}])
  1819. grid2.addWidget(excellon_gcode_type_label, 10, 0)
  1820. grid2.addWidget(self.excellon_gcode_type_radio, 10, 1)
  1821. # until I decide to implement this feature those remain disabled
  1822. excellon_gcode_type_label.hide()
  1823. self.excellon_gcode_type_radio.setVisible(False)
  1824. # ### Milling Holes ## ##
  1825. self.mill_hole_label = QtWidgets.QLabel('<b>%s</b>' % _('Mill Holes'))
  1826. self.mill_hole_label.setToolTip(
  1827. _("Create Geometry for milling holes.")
  1828. )
  1829. grid2.addWidget(self.mill_hole_label, 11, 0, 1, 2)
  1830. tdlabel = QtWidgets.QLabel('%s:' % _('Drill Tool dia'))
  1831. tdlabel.setToolTip(
  1832. _("Diameter of the cutting tool.")
  1833. )
  1834. self.tooldia_entry = FCDoubleSpinner()
  1835. self.tooldia_entry.set_precision(4)
  1836. self.tooldia_entry.set_range(0, 999.9999)
  1837. grid2.addWidget(tdlabel, 12, 0)
  1838. grid2.addWidget(self.tooldia_entry, 12, 1)
  1839. stdlabel = QtWidgets.QLabel('%s:' % _('Slot Tool dia'))
  1840. stdlabel.setToolTip(
  1841. _("Diameter of the cutting tool\n"
  1842. "when milling slots.")
  1843. )
  1844. self.slot_tooldia_entry = FCDoubleSpinner()
  1845. self.slot_tooldia_entry.set_precision(4)
  1846. self.slot_tooldia_entry.set_range(0, 999.9999)
  1847. grid2.addWidget(stdlabel, 13, 0)
  1848. grid2.addWidget(self.slot_tooldia_entry, 13, 1)
  1849. grid4 = QtWidgets.QGridLayout()
  1850. self.layout.addLayout(grid4)
  1851. # Adding the Excellon Format Defaults Button
  1852. self.excellon_defaults_button = QtWidgets.QPushButton()
  1853. self.excellon_defaults_button.setText(str(_("Defaults")))
  1854. self.excellon_defaults_button.setMinimumWidth(80)
  1855. grid4.addWidget(self.excellon_defaults_button, 0, 0, QtCore.Qt.AlignRight)
  1856. self.layout.addStretch()
  1857. class ExcellonAdvOptPrefGroupUI(OptionsGroupUI):
  1858. def __init__(self, parent=None):
  1859. # OptionsGroupUI.__init__(self, "Excellon Advanced Options", parent=parent)
  1860. super(ExcellonAdvOptPrefGroupUI, self).__init__(self)
  1861. self.setTitle(str(_("Excellon Adv. Options")))
  1862. # #######################
  1863. # ## ADVANCED OPTIONS ###
  1864. # #######################
  1865. self.exc_label = QtWidgets.QLabel('<b>%s:</b>' % _('Advanced Options'))
  1866. self.exc_label.setToolTip(
  1867. _("A list of Excellon advanced parameters.\n"
  1868. "Those parameters are available only for\n"
  1869. "Advanced App. Level.")
  1870. )
  1871. self.layout.addWidget(self.exc_label)
  1872. grid1 = QtWidgets.QGridLayout()
  1873. self.layout.addLayout(grid1)
  1874. offsetlabel = QtWidgets.QLabel('%s:' % _('Offset Z'))
  1875. offsetlabel.setToolTip(
  1876. _("Some drill bits (the larger ones) need to drill deeper\n"
  1877. "to create the desired exit hole diameter due of the tip shape.\n"
  1878. "The value here can compensate the Cut Z parameter."))
  1879. self.offset_entry = FCDoubleSpinner()
  1880. self.offset_entry.set_precision(4)
  1881. self.offset_entry.set_range(-999.9999, 999.9999)
  1882. grid1.addWidget(offsetlabel, 0, 0)
  1883. grid1.addWidget(self.offset_entry, 0, 1)
  1884. toolchange_xy_label = QtWidgets.QLabel('%s:' % _('Toolchange X,Y'))
  1885. toolchange_xy_label.setToolTip(
  1886. _("Toolchange X,Y position.")
  1887. )
  1888. grid1.addWidget(toolchange_xy_label, 1, 0)
  1889. self.toolchangexy_entry = FCEntry()
  1890. grid1.addWidget(self.toolchangexy_entry, 1, 1)
  1891. startzlabel = QtWidgets.QLabel('%s:' % _('Start move Z'))
  1892. startzlabel.setToolTip(
  1893. _("Height of the tool just after start.\n"
  1894. "Delete the value if you don't need this feature.")
  1895. )
  1896. grid1.addWidget(startzlabel, 2, 0)
  1897. self.estartz_entry = FloatEntry()
  1898. grid1.addWidget(self.estartz_entry, 2, 1)
  1899. # Feedrate Rapids
  1900. fr_rapid_label = QtWidgets.QLabel('%s:' % _('Feedrate Rapids'))
  1901. fr_rapid_label.setToolTip(
  1902. _("Tool speed while drilling\n"
  1903. "(in units per minute).\n"
  1904. "This is for the rapid move G00.\n"
  1905. "It is useful only for Marlin,\n"
  1906. "ignore for any other cases.")
  1907. )
  1908. self.feedrate_rapid_entry = FCDoubleSpinner()
  1909. self.feedrate_rapid_entry.set_precision(4)
  1910. self.feedrate_rapid_entry.set_range(0, 9999999.9999)
  1911. grid1.addWidget(fr_rapid_label, 3, 0)
  1912. grid1.addWidget(self.feedrate_rapid_entry, 3, 1)
  1913. # Probe depth
  1914. self.pdepth_label = QtWidgets.QLabel('%s:' % _("Probe Z depth"))
  1915. self.pdepth_label.setToolTip(
  1916. _("The maximum depth that the probe is allowed\n"
  1917. "to probe. Negative value, in current units.")
  1918. )
  1919. self.pdepth_entry = FCDoubleSpinner()
  1920. self.pdepth_entry.set_precision(4)
  1921. self.pdepth_entry.set_range(-99999, -0.000001)
  1922. grid1.addWidget(self.pdepth_label, 4, 0)
  1923. grid1.addWidget(self.pdepth_entry, 4, 1)
  1924. # Probe feedrate
  1925. self.feedrate_probe_label = QtWidgets.QLabel('%s:' % _("Feedrate Probe"))
  1926. self.feedrate_probe_label.setToolTip(
  1927. _("The feedrate used while the probe is probing.")
  1928. )
  1929. self.feedrate_probe_entry = FCDoubleSpinner()
  1930. self.feedrate_probe_entry.set_precision(4)
  1931. self.feedrate_probe_entry.set_range(0, 9999999.9999)
  1932. grid1.addWidget(self.feedrate_probe_label, 5, 0)
  1933. grid1.addWidget(self.feedrate_probe_entry, 5, 1)
  1934. # Spindle direction
  1935. spindle_dir_label = QtWidgets.QLabel('%s:' % _('Spindle dir.'))
  1936. spindle_dir_label.setToolTip(
  1937. _("This sets the direction that the spindle is rotating.\n"
  1938. "It can be either:\n"
  1939. "- CW = clockwise or\n"
  1940. "- CCW = counter clockwise")
  1941. )
  1942. self.spindledir_radio = RadioSet([{'label': _('CW'), 'value': 'CW'},
  1943. {'label': _('CCW'), 'value': 'CCW'}])
  1944. grid1.addWidget(spindle_dir_label, 6, 0)
  1945. grid1.addWidget(self.spindledir_radio, 6, 1)
  1946. fplungelabel = QtWidgets.QLabel('%s:' % _('Fast Plunge'))
  1947. fplungelabel.setToolTip(
  1948. _("By checking this, the vertical move from\n"
  1949. "Z_Toolchange to Z_move is done with G0,\n"
  1950. "meaning the fastest speed available.\n"
  1951. "WARNING: the move is done at Toolchange X,Y coords.")
  1952. )
  1953. self.fplunge_cb = FCCheckBox()
  1954. grid1.addWidget(fplungelabel, 7, 0)
  1955. grid1.addWidget(self.fplunge_cb, 7, 1)
  1956. fretractlabel = QtWidgets.QLabel('%s:' % _('Fast Retract'))
  1957. fretractlabel.setToolTip(
  1958. _("Exit hole strategy.\n"
  1959. " - When uncheked, while exiting the drilled hole the drill bit\n"
  1960. "will travel slow, with set feedrate (G1), up to zero depth and then\n"
  1961. "travel as fast as possible (G0) to the Z Move (travel height).\n"
  1962. " - When checked the travel from Z cut (cut depth) to Z_move\n"
  1963. "(travel height) is done as fast as possible (G0) in one move.")
  1964. )
  1965. self.fretract_cb = FCCheckBox()
  1966. grid1.addWidget(fretractlabel, 8, 0)
  1967. grid1.addWidget(self.fretract_cb, 8, 1)
  1968. self.layout.addStretch()
  1969. class ExcellonExpPrefGroupUI(OptionsGroupUI):
  1970. def __init__(self, parent=None):
  1971. super(ExcellonExpPrefGroupUI, self).__init__(self)
  1972. self.setTitle(str(_("Excellon Export")))
  1973. # Plot options
  1974. self.export_options_label = QtWidgets.QLabel("<b>%s:</b>" % _("Export Options"))
  1975. self.export_options_label.setToolTip(
  1976. _("The parameters set here are used in the file exported\n"
  1977. "when using the File -> Export -> Export Excellon menu entry.")
  1978. )
  1979. self.layout.addWidget(self.export_options_label)
  1980. form = QtWidgets.QFormLayout()
  1981. self.layout.addLayout(form)
  1982. # Excellon Units
  1983. self.excellon_units_label = QtWidgets.QLabel('<b>%s:</b>' % _('Units'))
  1984. self.excellon_units_label.setToolTip(
  1985. _("The units used in the Excellon file.")
  1986. )
  1987. self.excellon_units_radio = RadioSet([{'label': _('INCH'), 'value': 'INCH'},
  1988. {'label': _('MM'), 'value': 'METRIC'}])
  1989. self.excellon_units_radio.setToolTip(
  1990. _("The units used in the Excellon file.")
  1991. )
  1992. form.addRow(self.excellon_units_label, self.excellon_units_radio)
  1993. # Excellon non-decimal format
  1994. self.digits_label = QtWidgets.QLabel("<b>%s:</b>" % _("Int/Decimals"))
  1995. self.digits_label.setToolTip(
  1996. _("The NC drill files, usually named Excellon files\n"
  1997. "are files that can be found in different formats.\n"
  1998. "Here we set the format used when the provided\n"
  1999. "coordinates are not using period.")
  2000. )
  2001. hlay1 = QtWidgets.QHBoxLayout()
  2002. self.format_whole_entry = FCSpinner()
  2003. self.format_whole_entry.set_range(0, 9)
  2004. self.format_whole_entry.setMinimumWidth(30)
  2005. self.format_whole_entry.setToolTip(
  2006. _("This numbers signify the number of digits in\n"
  2007. "the whole part of Excellon coordinates.")
  2008. )
  2009. hlay1.addWidget(self.format_whole_entry, QtCore.Qt.AlignLeft)
  2010. excellon_separator_label = QtWidgets.QLabel(':')
  2011. excellon_separator_label.setFixedWidth(5)
  2012. hlay1.addWidget(excellon_separator_label, QtCore.Qt.AlignLeft)
  2013. self.format_dec_entry = FCSpinner()
  2014. self.format_dec_entry.set_range(0, 9)
  2015. self.format_dec_entry.setMinimumWidth(30)
  2016. self.format_dec_entry.setToolTip(
  2017. _("This numbers signify the number of digits in\n"
  2018. "the decimal part of Excellon coordinates.")
  2019. )
  2020. hlay1.addWidget(self.format_dec_entry, QtCore.Qt.AlignLeft)
  2021. hlay1.addStretch()
  2022. form.addRow(self.digits_label, hlay1)
  2023. # Select the Excellon Format
  2024. self.format_label = QtWidgets.QLabel("<b>%s:</b>" % _("Format"))
  2025. self.format_label.setToolTip(
  2026. _("Select the kind of coordinates format used.\n"
  2027. "Coordinates can be saved with decimal point or without.\n"
  2028. "When there is no decimal point, it is required to specify\n"
  2029. "the number of digits for integer part and the number of decimals.\n"
  2030. "Also it will have to be specified if LZ = leading zeros are kept\n"
  2031. "or TZ = trailing zeros are kept.")
  2032. )
  2033. self.format_radio = RadioSet([{'label': _('Decimal'), 'value': 'dec'},
  2034. {'label': _('No-Decimal'), 'value': 'ndec'}])
  2035. self.format_radio.setToolTip(
  2036. _("Select the kind of coordinates format used.\n"
  2037. "Coordinates can be saved with decimal point or without.\n"
  2038. "When there is no decimal point, it is required to specify\n"
  2039. "the number of digits for integer part and the number of decimals.\n"
  2040. "Also it will have to be specified if LZ = leading zeros are kept\n"
  2041. "or TZ = trailing zeros are kept.")
  2042. )
  2043. form.addRow(self.format_label, self.format_radio)
  2044. # Excellon Zeros
  2045. self.zeros_label = QtWidgets.QLabel('<b>%s:</b>' % _('Zeros'))
  2046. self.zeros_label.setAlignment(QtCore.Qt.AlignLeft)
  2047. self.zeros_label.setToolTip(
  2048. _("This sets the type of Excellon zeros.\n"
  2049. "If LZ then Leading Zeros are kept and\n"
  2050. "Trailing Zeros are removed.\n"
  2051. "If TZ is checked then Trailing Zeros are kept\n"
  2052. "and Leading Zeros are removed.")
  2053. )
  2054. self.zeros_radio = RadioSet([{'label': _('LZ'), 'value': 'LZ'},
  2055. {'label': _('TZ'), 'value': 'TZ'}])
  2056. self.zeros_radio.setToolTip(
  2057. _("This sets the default type of Excellon zeros.\n"
  2058. "If LZ then Leading Zeros are kept and\n"
  2059. "Trailing Zeros are removed.\n"
  2060. "If TZ is checked then Trailing Zeros are kept\n"
  2061. "and Leading Zeros are removed.")
  2062. )
  2063. form.addRow(self.zeros_label, self.zeros_radio)
  2064. # Slot type
  2065. self.slot_type_label = QtWidgets.QLabel('<b>%s:</b>' % _('Slot type'))
  2066. self.slot_type_label.setAlignment(QtCore.Qt.AlignLeft)
  2067. self.slot_type_label.setToolTip(
  2068. _("This sets how the slots will be exported.\n"
  2069. "If ROUTED then the slots will be routed\n"
  2070. "using M15/M16 commands.\n"
  2071. "If DRILLED(G85) the slots will be exported\n"
  2072. "using the Drilled slot command (G85).")
  2073. )
  2074. self.slot_type_radio = RadioSet([{'label': _('Routed'), 'value': 'routing'},
  2075. {'label': _('Drilled(G85)'), 'value': 'drilling'}])
  2076. self.slot_type_radio.setToolTip(
  2077. _("This sets how the slots will be exported.\n"
  2078. "If ROUTED then the slots will be routed\n"
  2079. "using M15/M16 commands.\n"
  2080. "If DRILLED(G85) the slots will be exported\n"
  2081. "using the Drilled slot command (G85).")
  2082. )
  2083. form.addRow(self.slot_type_label, self.slot_type_radio)
  2084. self.layout.addStretch()
  2085. self.format_radio.activated_custom.connect(self.optimization_selection)
  2086. def optimization_selection(self):
  2087. if self.format_radio.get_value() == 'dec':
  2088. self.zeros_label.setDisabled(True)
  2089. self.zeros_radio.setDisabled(True)
  2090. else:
  2091. self.zeros_label.setDisabled(False)
  2092. self.zeros_radio.setDisabled(False)
  2093. class ExcellonEditorPrefGroupUI(OptionsGroupUI):
  2094. def __init__(self, parent=None):
  2095. super(ExcellonEditorPrefGroupUI, self).__init__(self)
  2096. self.setTitle(str(_("Excellon Editor")))
  2097. # Excellon Editor Parameters
  2098. self.param_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  2099. self.param_label.setToolTip(
  2100. _("A list of Excellon Editor parameters.")
  2101. )
  2102. self.layout.addWidget(self.param_label)
  2103. grid0 = QtWidgets.QGridLayout()
  2104. self.layout.addLayout(grid0)
  2105. # Selection Limit
  2106. self.sel_limit_label = QtWidgets.QLabel('%s:' % _("Selection limit"))
  2107. self.sel_limit_label.setToolTip(
  2108. _("Set the number of selected Excellon geometry\n"
  2109. "items above which the utility geometry\n"
  2110. "becomes just a selection rectangle.\n"
  2111. "Increases the performance when moving a\n"
  2112. "large number of geometric elements.")
  2113. )
  2114. self.sel_limit_entry = FCSpinner()
  2115. self.sel_limit_entry.set_range(0, 99999)
  2116. grid0.addWidget(self.sel_limit_label, 0, 0)
  2117. grid0.addWidget(self.sel_limit_entry, 0, 1)
  2118. # New tool diameter
  2119. self.addtool_entry_lbl = QtWidgets.QLabel('%s:' % _('New Tool Dia'))
  2120. self.addtool_entry_lbl.setToolTip(
  2121. _("Diameter for the new tool")
  2122. )
  2123. self.addtool_entry = FCDoubleSpinner()
  2124. self.addtool_entry.set_range(0.000001, 99.9999)
  2125. self.addtool_entry.set_precision(4)
  2126. grid0.addWidget(self.addtool_entry_lbl, 1, 0)
  2127. grid0.addWidget(self.addtool_entry, 1, 1)
  2128. # Number of drill holes in a drill array
  2129. self.drill_array_size_label = QtWidgets.QLabel('%s:' % _('Nr of drills'))
  2130. self.drill_array_size_label.setToolTip(
  2131. _("Specify how many drills to be in the array.")
  2132. )
  2133. # self.drill_array_size_label.setMinimumWidth(100)
  2134. self.drill_array_size_entry = FCSpinner()
  2135. self.drill_array_size_entry.set_range(0, 9999)
  2136. grid0.addWidget(self.drill_array_size_label, 2, 0)
  2137. grid0.addWidget(self.drill_array_size_entry, 2, 1)
  2138. self.drill_array_linear_label = QtWidgets.QLabel('<b>%s:</b>' % _('Linear Drill Array'))
  2139. grid0.addWidget(self.drill_array_linear_label, 3, 0, 1, 2)
  2140. # Linear Drill Array direction
  2141. self.drill_axis_label = QtWidgets.QLabel('%s:' % _('Linear Dir.'))
  2142. self.drill_axis_label.setToolTip(
  2143. _("Direction on which the linear array is oriented:\n"
  2144. "- 'X' - horizontal axis \n"
  2145. "- 'Y' - vertical axis or \n"
  2146. "- 'Angle' - a custom angle for the array inclination")
  2147. )
  2148. # self.drill_axis_label.setMinimumWidth(100)
  2149. self.drill_axis_radio = RadioSet([{'label': _('X'), 'value': 'X'},
  2150. {'label': _('Y'), 'value': 'Y'},
  2151. {'label': _('Angle'), 'value': 'A'}])
  2152. grid0.addWidget(self.drill_axis_label, 4, 0)
  2153. grid0.addWidget(self.drill_axis_radio, 4, 1)
  2154. # Linear Drill Array pitch distance
  2155. self.drill_pitch_label = QtWidgets.QLabel('%s:' % _('Pitch'))
  2156. self.drill_pitch_label.setToolTip(
  2157. _("Pitch = Distance between elements of the array.")
  2158. )
  2159. # self.drill_pitch_label.setMinimumWidth(100)
  2160. self.drill_pitch_entry = FCDoubleSpinner()
  2161. self.drill_pitch_entry.set_range(0, 99999.9999)
  2162. self.drill_pitch_entry.set_precision(4)
  2163. grid0.addWidget(self.drill_pitch_label, 5, 0)
  2164. grid0.addWidget(self.drill_pitch_entry, 5, 1)
  2165. # Linear Drill Array custom angle
  2166. self.drill_angle_label = QtWidgets.QLabel('%s:' % _('Angle'))
  2167. self.drill_angle_label.setToolTip(
  2168. _("Angle at which each element in circular array is placed.")
  2169. )
  2170. self.drill_angle_entry = FCDoubleSpinner()
  2171. self.drill_pitch_entry.set_range(-360, 360)
  2172. self.drill_pitch_entry.set_precision(4)
  2173. self.drill_angle_entry.setWrapping(True)
  2174. self.drill_angle_entry.setSingleStep(5)
  2175. grid0.addWidget(self.drill_angle_label, 6, 0)
  2176. grid0.addWidget(self.drill_angle_entry, 6, 1)
  2177. self.drill_array_circ_label = QtWidgets.QLabel('<b>%s:</b>' % _('Circular Drill Array'))
  2178. grid0.addWidget(self.drill_array_circ_label, 7, 0, 1, 2)
  2179. # Circular Drill Array direction
  2180. self.drill_circular_direction_label = QtWidgets.QLabel('%s:' % _('Circular Dir.'))
  2181. self.drill_circular_direction_label.setToolTip(
  2182. _("Direction for circular array.\n"
  2183. "Can be CW = clockwise or CCW = counter clockwise.")
  2184. )
  2185. self.drill_circular_dir_radio = RadioSet([{'label': _('CW'), 'value': 'CW'},
  2186. {'label': _('CCW'), 'value': 'CCW'}])
  2187. grid0.addWidget(self.drill_circular_direction_label, 8, 0)
  2188. grid0.addWidget(self.drill_circular_dir_radio, 8, 1)
  2189. # Circular Drill Array Angle
  2190. self.drill_circular_angle_label = QtWidgets.QLabel('%s:' % _('Circ. Angle'))
  2191. self.drill_circular_angle_label.setToolTip(
  2192. _("Angle at which each element in circular array is placed.")
  2193. )
  2194. self.drill_circular_angle_entry = FCDoubleSpinner()
  2195. self.drill_circular_angle_entry.set_range(-360, 360)
  2196. self.drill_circular_angle_entry.set_precision(4)
  2197. self.drill_circular_angle_entry.setWrapping(True)
  2198. self.drill_circular_angle_entry.setSingleStep(5)
  2199. grid0.addWidget(self.drill_circular_angle_label, 9, 0)
  2200. grid0.addWidget(self.drill_circular_angle_entry, 9, 1)
  2201. # ##### SLOTS #####
  2202. # #################
  2203. self.drill_array_circ_label = QtWidgets.QLabel('<b>%s:</b>' % _('Slots'))
  2204. grid0.addWidget(self.drill_array_circ_label, 10, 0, 1, 2)
  2205. # Slot length
  2206. self.slot_length_label = QtWidgets.QLabel('%s:' % _('Length'))
  2207. self.slot_length_label.setToolTip(
  2208. _("Length = The length of the slot.")
  2209. )
  2210. self.slot_length_label.setMinimumWidth(100)
  2211. self.slot_length_entry = FCDoubleSpinner()
  2212. self.slot_length_entry.set_range(0, 99999)
  2213. self.slot_length_entry.set_precision(4)
  2214. self.slot_length_entry.setWrapping(True)
  2215. self.slot_length_entry.setSingleStep(1)
  2216. grid0.addWidget(self.slot_length_label, 11, 0)
  2217. grid0.addWidget(self.slot_length_entry, 11, 1)
  2218. # Slot direction
  2219. self.slot_axis_label = QtWidgets.QLabel('%s:' % _('Direction'))
  2220. self.slot_axis_label.setToolTip(
  2221. _("Direction on which the slot is oriented:\n"
  2222. "- 'X' - horizontal axis \n"
  2223. "- 'Y' - vertical axis or \n"
  2224. "- 'Angle' - a custom angle for the slot inclination")
  2225. )
  2226. self.slot_axis_label.setMinimumWidth(100)
  2227. self.slot_axis_radio = RadioSet([{'label': _('X'), 'value': 'X'},
  2228. {'label': _('Y'), 'value': 'Y'},
  2229. {'label': _('Angle'), 'value': 'A'}])
  2230. grid0.addWidget(self.slot_axis_label, 12, 0)
  2231. grid0.addWidget(self.slot_axis_radio, 12, 1)
  2232. # Slot custom angle
  2233. self.slot_angle_label = QtWidgets.QLabel('%s:' % _('Angle'))
  2234. self.slot_angle_label.setToolTip(
  2235. _("Angle at which the slot is placed.\n"
  2236. "The precision is of max 2 decimals.\n"
  2237. "Min value is: -359.99 degrees.\n"
  2238. "Max value is: 360.00 degrees.")
  2239. )
  2240. self.slot_angle_label.setMinimumWidth(100)
  2241. self.slot_angle_spinner = FCDoubleSpinner()
  2242. self.slot_angle_spinner.set_precision(4)
  2243. self.slot_angle_spinner.setWrapping(True)
  2244. self.slot_angle_spinner.setRange(-359.99, 360.00)
  2245. self.slot_angle_spinner.setSingleStep(5)
  2246. grid0.addWidget(self.slot_angle_label, 13, 0)
  2247. grid0.addWidget(self.slot_angle_spinner, 13, 1)
  2248. # #### SLOTS ARRAY #######
  2249. # ########################
  2250. self.slot_array_linear_label = QtWidgets.QLabel('<b>%s:</b>' % _('Linear Slot Array'))
  2251. grid0.addWidget(self.slot_array_linear_label, 14, 0, 1, 2)
  2252. # Number of slot holes in a drill array
  2253. self.slot_array_size_label = QtWidgets.QLabel('%s:' % _('Nr of slots'))
  2254. self.drill_array_size_label.setToolTip(
  2255. _("Specify how many slots to be in the array.")
  2256. )
  2257. # self.slot_array_size_label.setMinimumWidth(100)
  2258. self.slot_array_size_entry = FCSpinner()
  2259. self.slot_array_size_entry.set_range(0, 999999)
  2260. grid0.addWidget(self.slot_array_size_label, 15, 0)
  2261. grid0.addWidget(self.slot_array_size_entry, 15, 1)
  2262. # Linear Slot Array direction
  2263. self.slot_array_axis_label = QtWidgets.QLabel('%s:' % _('Linear Dir.'))
  2264. self.slot_array_axis_label.setToolTip(
  2265. _("Direction on which the linear array is oriented:\n"
  2266. "- 'X' - horizontal axis \n"
  2267. "- 'Y' - vertical axis or \n"
  2268. "- 'Angle' - a custom angle for the array inclination")
  2269. )
  2270. # self.slot_axis_label.setMinimumWidth(100)
  2271. self.slot_array_axis_radio = RadioSet([{'label': _('X'), 'value': 'X'},
  2272. {'label': _('Y'), 'value': 'Y'},
  2273. {'label': _('Angle'), 'value': 'A'}])
  2274. grid0.addWidget(self.slot_array_axis_label, 16, 0)
  2275. grid0.addWidget(self.slot_array_axis_radio, 16, 1)
  2276. # Linear Slot Array pitch distance
  2277. self.slot_array_pitch_label = QtWidgets.QLabel('%s:' % _('Pitch'))
  2278. self.slot_array_pitch_label.setToolTip(
  2279. _("Pitch = Distance between elements of the array.")
  2280. )
  2281. # self.drill_pitch_label.setMinimumWidth(100)
  2282. self.slot_array_pitch_entry = FCDoubleSpinner()
  2283. self.slot_array_pitch_entry.set_precision(4)
  2284. self.slot_array_pitch_entry.setWrapping(True)
  2285. self.slot_array_pitch_entry.setRange(0, 999999)
  2286. self.slot_array_pitch_entry.setSingleStep(1)
  2287. grid0.addWidget(self.slot_array_pitch_label, 17, 0)
  2288. grid0.addWidget(self.slot_array_pitch_entry, 17, 1)
  2289. # Linear Slot Array custom angle
  2290. self.slot_array_angle_label = QtWidgets.QLabel('%s:' % _('Angle'))
  2291. self.slot_array_angle_label.setToolTip(
  2292. _("Angle at which each element in circular array is placed.")
  2293. )
  2294. self.slot_array_angle_entry = FCDoubleSpinner()
  2295. self.slot_array_angle_entry.set_precision(4)
  2296. self.slot_array_angle_entry.setWrapping(True)
  2297. self.slot_array_angle_entry.setRange(-360, 360)
  2298. self.slot_array_angle_entry.setSingleStep(5)
  2299. grid0.addWidget(self.slot_array_angle_label, 18, 0)
  2300. grid0.addWidget(self.slot_array_angle_entry, 18, 1)
  2301. self.slot_array_circ_label = QtWidgets.QLabel('<b>%s:</b>' % _('Circular Slot Array'))
  2302. grid0.addWidget(self.slot_array_circ_label, 19, 0, 1, 2)
  2303. # Circular Slot Array direction
  2304. self.slot_array_circular_direction_label = QtWidgets.QLabel('%s:' % _('Circular Dir.'))
  2305. self.slot_array_circular_direction_label.setToolTip(
  2306. _("Direction for circular array.\n"
  2307. "Can be CW = clockwise or CCW = counter clockwise.")
  2308. )
  2309. self.slot_array_circular_dir_radio = RadioSet([{'label': _('CW'), 'value': 'CW'},
  2310. {'label': _('CCW'), 'value': 'CCW'}])
  2311. grid0.addWidget(self.slot_array_circular_direction_label, 20, 0)
  2312. grid0.addWidget(self.slot_array_circular_dir_radio, 20, 1)
  2313. # Circular Slot Array Angle
  2314. self.slot_array_circular_angle_label = QtWidgets.QLabel('%s:' % _('Circ. Angle'))
  2315. self.slot_array_circular_angle_label.setToolTip(
  2316. _("Angle at which each element in circular array is placed.")
  2317. )
  2318. self.slot_array_circular_angle_entry = FCDoubleSpinner()
  2319. self.slot_array_circular_angle_entry.set_precision(4)
  2320. self.slot_array_circular_angle_entry.setWrapping(True)
  2321. self.slot_array_circular_angle_entry.setRange(-360, 360)
  2322. self.slot_array_circular_angle_entry.setSingleStep(5)
  2323. grid0.addWidget(self.slot_array_circular_angle_label, 21, 0)
  2324. grid0.addWidget(self.slot_array_circular_angle_entry, 21, 1)
  2325. self.layout.addStretch()
  2326. class GeometryGenPrefGroupUI(OptionsGroupUI):
  2327. def __init__(self, parent=None):
  2328. # OptionsGroupUI.__init__(self, "Geometry General Preferences", parent=parent)
  2329. super(GeometryGenPrefGroupUI, self).__init__(self)
  2330. self.setTitle(str(_("Geometry General")))
  2331. # ## Plot options
  2332. self.plot_options_label = QtWidgets.QLabel("<b>%s:</b>" % _("Plot Options"))
  2333. self.layout.addWidget(self.plot_options_label)
  2334. # Plot CB
  2335. self.plot_cb = FCCheckBox(label=_('Plot'))
  2336. self.plot_cb.setToolTip(
  2337. _("Plot (show) this object.")
  2338. )
  2339. self.layout.addWidget(self.plot_cb)
  2340. grid0 = QtWidgets.QGridLayout()
  2341. self.layout.addLayout(grid0)
  2342. grid0.setColumnStretch(0, 0)
  2343. grid0.setColumnStretch(1, 1)
  2344. # Number of circle steps for circular aperture linear approximation
  2345. self.circle_steps_label = QtWidgets.QLabel('%s:' % _("Circle Steps"))
  2346. self.circle_steps_label.setToolTip(
  2347. _("The number of circle steps for <b>Geometry</b> \n"
  2348. "circle and arc shapes linear approximation.")
  2349. )
  2350. self.circle_steps_entry = FCSpinner()
  2351. self.circle_steps_entry.set_range(0, 999)
  2352. grid0.addWidget(self.circle_steps_label, 1, 0)
  2353. grid0.addWidget(self.circle_steps_entry, 1, 1)
  2354. # Tools
  2355. self.tools_label = QtWidgets.QLabel("<b>%s:</b>" % _("Tools"))
  2356. grid0.addWidget(self.tools_label, 2, 0, 1, 2)
  2357. # Tooldia
  2358. tdlabel = QtWidgets.QLabel('%s:' % _('Tool dia'))
  2359. tdlabel.setToolTip(
  2360. _("Diameters of the cutting tools, separated by ','")
  2361. )
  2362. self.cnctooldia_entry = FCDoubleSpinner()
  2363. self.cnctooldia_entry.set_range(0.000001, 999.9999)
  2364. self.cnctooldia_entry.set_precision(4)
  2365. self.cnctooldia_entry.setSingleStep(0.1)
  2366. self.cnctooldia_entry.setWrapping(True)
  2367. grid0.addWidget(tdlabel, 3, 0)
  2368. grid0.addWidget(self.cnctooldia_entry, 3, 1)
  2369. self.layout.addStretch()
  2370. class GeometryOptPrefGroupUI(OptionsGroupUI):
  2371. def __init__(self, parent=None):
  2372. # OptionsGroupUI.__init__(self, "Geometry Options Preferences", parent=parent)
  2373. super(GeometryOptPrefGroupUI, self).__init__(self)
  2374. self.setTitle(str(_("Geometry Options")))
  2375. # ------------------------------
  2376. # ## Create CNC Job
  2377. # ------------------------------
  2378. self.cncjob_label = QtWidgets.QLabel('<b>%s:</b>' % _('Create CNC Job'))
  2379. self.cncjob_label.setToolTip(
  2380. _("Create a CNC Job object\n"
  2381. "tracing the contours of this\n"
  2382. "Geometry object.")
  2383. )
  2384. self.layout.addWidget(self.cncjob_label)
  2385. grid1 = QtWidgets.QGridLayout()
  2386. self.layout.addLayout(grid1)
  2387. # Cut Z
  2388. cutzlabel = QtWidgets.QLabel('%s:' % _('Cut Z'))
  2389. cutzlabel.setToolTip(
  2390. _("Cutting depth (negative)\n"
  2391. "below the copper surface.")
  2392. )
  2393. self.cutz_entry = FCDoubleSpinner()
  2394. self.cutz_entry.set_range(-999.999, -0.000001)
  2395. self.cutz_entry.set_precision(4)
  2396. self.cutz_entry.setSingleStep(0.1)
  2397. self.cutz_entry.setWrapping(True)
  2398. grid1.addWidget(cutzlabel, 0, 0)
  2399. grid1.addWidget(self.cutz_entry, 0, 1)
  2400. # Multidepth CheckBox
  2401. self.multidepth_cb = FCCheckBox(label=_('Multi-Depth'))
  2402. self.multidepth_cb.setToolTip(
  2403. _(
  2404. "Use multiple passes to limit\n"
  2405. "the cut depth in each pass. Will\n"
  2406. "cut multiple times until Cut Z is\n"
  2407. "reached."
  2408. )
  2409. )
  2410. grid1.addWidget(self.multidepth_cb, 1, 0)
  2411. # Depth/pass
  2412. dplabel = QtWidgets.QLabel('%s:' % _('Depth/Pass'))
  2413. dplabel.setToolTip(
  2414. _("The depth to cut on each pass,\n"
  2415. "when multidepth is enabled.\n"
  2416. "It has positive value although\n"
  2417. "it is a fraction from the depth\n"
  2418. "which has negative value.")
  2419. )
  2420. self.depthperpass_entry = FCDoubleSpinner()
  2421. self.depthperpass_entry.set_range(0, 99999)
  2422. self.depthperpass_entry.set_precision(4)
  2423. self.depthperpass_entry.setSingleStep(0.1)
  2424. self.depthperpass_entry.setWrapping(True)
  2425. grid1.addWidget(dplabel, 2, 0)
  2426. grid1.addWidget(self.depthperpass_entry, 2, 1)
  2427. self.ois_multidepth = OptionalInputSection(self.multidepth_cb, [self.depthperpass_entry])
  2428. # Travel Z
  2429. travelzlabel = QtWidgets.QLabel('%s:' % _('Travel Z'))
  2430. travelzlabel.setToolTip(
  2431. _("Height of the tool when\n"
  2432. "moving without cutting.")
  2433. )
  2434. self.travelz_entry = FCDoubleSpinner()
  2435. self.travelz_entry.set_range(0, 99999)
  2436. self.travelz_entry.set_precision(4)
  2437. self.travelz_entry.setSingleStep(0.1)
  2438. self.travelz_entry.setWrapping(True)
  2439. grid1.addWidget(travelzlabel, 3, 0)
  2440. grid1.addWidget(self.travelz_entry, 3, 1)
  2441. # Tool change:
  2442. toolchlabel = QtWidgets.QLabel('%s:' % _("Tool change"))
  2443. toolchlabel.setToolTip(
  2444. _(
  2445. "Include tool-change sequence\n"
  2446. "in the Machine Code (Pause for tool change)."
  2447. )
  2448. )
  2449. self.toolchange_cb = FCCheckBox()
  2450. grid1.addWidget(toolchlabel, 4, 0)
  2451. grid1.addWidget(self.toolchange_cb, 4, 1)
  2452. # Toolchange Z
  2453. toolchangezlabel = QtWidgets.QLabel('%s:' % _('Toolchange Z'))
  2454. toolchangezlabel.setToolTip(
  2455. _(
  2456. "Z-axis position (height) for\n"
  2457. "tool change."
  2458. )
  2459. )
  2460. self.toolchangez_entry = FCDoubleSpinner()
  2461. self.toolchangez_entry.set_range(0, 99999)
  2462. self.toolchangez_entry.set_precision(4)
  2463. self.toolchangez_entry.setSingleStep(0.1)
  2464. self.toolchangez_entry.setWrapping(True)
  2465. grid1.addWidget(toolchangezlabel, 5, 0)
  2466. grid1.addWidget(self.toolchangez_entry, 5, 1)
  2467. # End move Z
  2468. endzlabel = QtWidgets.QLabel('%s:' % _('End move Z'))
  2469. endzlabel.setToolTip(
  2470. _("Height of the tool after\n"
  2471. "the last move at the end of the job.")
  2472. )
  2473. self.gendz_entry = FCDoubleSpinner()
  2474. self.gendz_entry.set_range(0, 99999)
  2475. self.gendz_entry.set_precision(4)
  2476. self.gendz_entry.setSingleStep(0.1)
  2477. self.gendz_entry.setWrapping(True)
  2478. grid1.addWidget(endzlabel, 6, 0)
  2479. grid1.addWidget(self.gendz_entry, 6, 1)
  2480. # Feedrate X-Y
  2481. frlabel = QtWidgets.QLabel('%s:' % _('Feed Rate X-Y'))
  2482. frlabel.setToolTip(
  2483. _("Cutting speed in the XY\n"
  2484. "plane in units per minute")
  2485. )
  2486. self.cncfeedrate_entry = FCDoubleSpinner()
  2487. self.cncfeedrate_entry.set_range(0, 99999)
  2488. self.cncfeedrate_entry.set_precision(4)
  2489. self.cncfeedrate_entry.setSingleStep(0.1)
  2490. self.cncfeedrate_entry.setWrapping(True)
  2491. grid1.addWidget(frlabel, 7, 0)
  2492. grid1.addWidget(self.cncfeedrate_entry, 7, 1)
  2493. # Feedrate Z (Plunge)
  2494. frz_label = QtWidgets.QLabel('%s:' % _('Feed Rate Z'))
  2495. frz_label.setToolTip(
  2496. _("Cutting speed in the XY\n"
  2497. "plane in units per minute.\n"
  2498. "It is called also Plunge.")
  2499. )
  2500. self.cncplunge_entry = FCDoubleSpinner()
  2501. self.cncplunge_entry.set_range(0, 99999)
  2502. self.cncplunge_entry.set_precision(4)
  2503. self.cncplunge_entry.setSingleStep(0.1)
  2504. self.cncplunge_entry.setWrapping(True)
  2505. grid1.addWidget(frz_label, 8, 0)
  2506. grid1.addWidget(self.cncplunge_entry, 8, 1)
  2507. # Spindle Speed
  2508. spdlabel = QtWidgets.QLabel('%s:' % _('Spindle speed'))
  2509. spdlabel.setToolTip(
  2510. _(
  2511. "Speed of the spindle in RPM (optional).\n"
  2512. "If LASER postprocessor is used,\n"
  2513. "this value is the power of laser."
  2514. )
  2515. )
  2516. grid1.addWidget(spdlabel, 9, 0)
  2517. self.cncspindlespeed_entry = IntEntry(allow_empty=True)
  2518. grid1.addWidget(self.cncspindlespeed_entry, 9, 1)
  2519. # Dwell
  2520. self.dwell_cb = FCCheckBox(label='%s:' % _('Dwell'))
  2521. self.dwell_cb.setToolTip(
  2522. _("Pause to allow the spindle to reach its\n"
  2523. "speed before cutting.")
  2524. )
  2525. dwelltime = QtWidgets.QLabel('%s:' % _('Duration'))
  2526. dwelltime.setToolTip(
  2527. _("Number of time units for spindle to dwell.")
  2528. )
  2529. self.dwelltime_entry = FCDoubleSpinner()
  2530. self.dwelltime_entry.set_range(0, 99999)
  2531. self.dwelltime_entry.set_precision(4)
  2532. self.dwelltime_entry.setSingleStep(0.1)
  2533. self.dwelltime_entry.setWrapping(True)
  2534. grid1.addWidget(self.dwell_cb, 10, 0)
  2535. grid1.addWidget(dwelltime, 11, 0)
  2536. grid1.addWidget(self.dwelltime_entry, 11, 1)
  2537. self.ois_dwell = OptionalInputSection(self.dwell_cb, [self.dwelltime_entry])
  2538. # postprocessor selection
  2539. pp_label = QtWidgets.QLabel('%s:' % _("Postprocessor"))
  2540. pp_label.setToolTip(
  2541. _("The Postprocessor file that dictates\n"
  2542. "the Machine Code (like GCode, RML, HPGL) output.")
  2543. )
  2544. grid1.addWidget(pp_label, 12, 0)
  2545. self.pp_geometry_name_cb = FCComboBox()
  2546. self.pp_geometry_name_cb.setFocusPolicy(Qt.StrongFocus)
  2547. grid1.addWidget(self.pp_geometry_name_cb, 12, 1)
  2548. self.layout.addStretch()
  2549. class GeometryAdvOptPrefGroupUI(OptionsGroupUI):
  2550. def __init__(self, parent=None):
  2551. # OptionsGroupUI.__init__(self, "Geometry Advanced Options Preferences", parent=parent)
  2552. super(GeometryAdvOptPrefGroupUI, self).__init__(self)
  2553. self.setTitle(str(_("Geometry Adv. Options")))
  2554. # ------------------------------
  2555. # ## Advanced Options
  2556. # ------------------------------
  2557. self.geo_label = QtWidgets.QLabel('<b>%s:</b>' % _('Advanced Options'))
  2558. self.geo_label.setToolTip(
  2559. _("A list of Geometry advanced parameters.\n"
  2560. "Those parameters are available only for\n"
  2561. "Advanced App. Level.")
  2562. )
  2563. self.layout.addWidget(self.geo_label)
  2564. grid1 = QtWidgets.QGridLayout()
  2565. self.layout.addLayout(grid1)
  2566. # Toolchange X,Y
  2567. toolchange_xy_label = QtWidgets.QLabel('%s:' % _('Toolchange X-Y'))
  2568. toolchange_xy_label.setToolTip(
  2569. _("Toolchange X,Y position.")
  2570. )
  2571. grid1.addWidget(toolchange_xy_label, 1, 0)
  2572. self.toolchangexy_entry = FCEntry()
  2573. grid1.addWidget(self.toolchangexy_entry, 1, 1)
  2574. # Start move Z
  2575. startzlabel = QtWidgets.QLabel('%s:' % _('Start move Z'))
  2576. startzlabel.setToolTip(
  2577. _("Height of the tool just after starting the work.\n"
  2578. "Delete the value if you don't need this feature.")
  2579. )
  2580. grid1.addWidget(startzlabel, 2, 0)
  2581. self.gstartz_entry = FloatEntry()
  2582. grid1.addWidget(self.gstartz_entry, 2, 1)
  2583. # Feedrate rapids
  2584. fr_rapid_label = QtWidgets.QLabel('%s:' % _('Feed Rate Rapids'))
  2585. fr_rapid_label.setToolTip(
  2586. _("Cutting speed in the XY plane\n"
  2587. "(in units per minute).\n"
  2588. "This is for the rapid move G00.\n"
  2589. "It is useful only for Marlin,\n"
  2590. "ignore for any other cases.")
  2591. )
  2592. self.cncfeedrate_rapid_entry = FCDoubleSpinner()
  2593. self.cncfeedrate_rapid_entry.set_range(0, 99999)
  2594. self.cncfeedrate_rapid_entry.set_precision(4)
  2595. self.cncfeedrate_rapid_entry.setSingleStep(0.1)
  2596. self.cncfeedrate_rapid_entry.setWrapping(True)
  2597. grid1.addWidget(fr_rapid_label, 4, 0)
  2598. grid1.addWidget(self.cncfeedrate_rapid_entry, 4, 1)
  2599. # End move extra cut
  2600. self.extracut_cb = FCCheckBox(label='%s' % _('Re-cut 1st pt.'))
  2601. self.extracut_cb.setToolTip(
  2602. _("In order to remove possible\n"
  2603. "copper leftovers where first cut\n"
  2604. "meet with last cut, we generate an\n"
  2605. "extended cut over the first cut section.")
  2606. )
  2607. grid1.addWidget(self.extracut_cb, 5, 0)
  2608. # Probe depth
  2609. self.pdepth_label = QtWidgets.QLabel('%s:' % _("Probe Z depth"))
  2610. self.pdepth_label.setToolTip(
  2611. _("The maximum depth that the probe is allowed\n"
  2612. "to probe. Negative value, in current units.")
  2613. )
  2614. self.pdepth_entry = FCDoubleSpinner()
  2615. self.pdepth_entry.set_range(-99999, -0.000001)
  2616. self.pdepth_entry.set_precision(4)
  2617. self.pdepth_entry.setSingleStep(0.1)
  2618. self.pdepth_entry.setWrapping(True)
  2619. grid1.addWidget(self.pdepth_label, 6, 0)
  2620. grid1.addWidget(self.pdepth_entry, 6, 1)
  2621. # Probe feedrate
  2622. self.feedrate_probe_label = QtWidgets.QLabel('%s:' % _("Feedrate Probe"))
  2623. self.feedrate_probe_label.setToolTip(
  2624. _("The feedrate used while the probe is probing.")
  2625. )
  2626. self.feedrate_probe_entry = FCDoubleSpinner()
  2627. self.feedrate_probe_entry.set_range(0, 99999)
  2628. self.feedrate_probe_entry.set_precision(4)
  2629. self.feedrate_probe_entry.setSingleStep(0.1)
  2630. self.feedrate_probe_entry.setWrapping(True)
  2631. grid1.addWidget(self.feedrate_probe_label, 7, 0)
  2632. grid1.addWidget(self.feedrate_probe_entry, 7, 1)
  2633. # Spindle direction
  2634. spindle_dir_label = QtWidgets.QLabel('%s:' % _('Spindle dir.'))
  2635. spindle_dir_label.setToolTip(
  2636. _("This sets the direction that the spindle is rotating.\n"
  2637. "It can be either:\n"
  2638. "- CW = clockwise or\n"
  2639. "- CCW = counter clockwise")
  2640. )
  2641. self.spindledir_radio = RadioSet([{'label': _('CW'), 'value': 'CW'},
  2642. {'label': _('CCW'), 'value': 'CCW'}])
  2643. grid1.addWidget(spindle_dir_label, 8, 0)
  2644. grid1.addWidget(self.spindledir_radio, 8, 1)
  2645. # Fast Move from Z Toolchange
  2646. fplungelabel = QtWidgets.QLabel('%s:' % _('Fast Plunge'))
  2647. fplungelabel.setToolTip(
  2648. _("By checking this, the vertical move from\n"
  2649. "Z_Toolchange to Z_move is done with G0,\n"
  2650. "meaning the fastest speed available.\n"
  2651. "WARNING: the move is done at Toolchange X,Y coords.")
  2652. )
  2653. self.fplunge_cb = FCCheckBox()
  2654. grid1.addWidget(fplungelabel, 9, 0)
  2655. grid1.addWidget(self.fplunge_cb, 9, 1)
  2656. # Size of trace segment on X axis
  2657. segx_label = QtWidgets.QLabel('%s:' % _("Seg. X size"))
  2658. segx_label.setToolTip(
  2659. _("The size of the trace segment on the X axis.\n"
  2660. "Useful for auto-leveling.\n"
  2661. "A value of 0 means no segmentation on the X axis.")
  2662. )
  2663. self.segx_entry = FCDoubleSpinner()
  2664. self.segx_entry.set_range(0, 99999)
  2665. self.segx_entry.set_precision(4)
  2666. self.segx_entry.setSingleStep(0.1)
  2667. self.segx_entry.setWrapping(True)
  2668. grid1.addWidget(segx_label, 10, 0)
  2669. grid1.addWidget(self.segx_entry, 10, 1)
  2670. # Size of trace segment on Y axis
  2671. segy_label = QtWidgets.QLabel('%s:' % _("Seg. Y size"))
  2672. segy_label.setToolTip(
  2673. _("The size of the trace segment on the Y axis.\n"
  2674. "Useful for auto-leveling.\n"
  2675. "A value of 0 means no segmentation on the Y axis.")
  2676. )
  2677. self.segy_entry = FCDoubleSpinner()
  2678. self.segy_entry.set_range(0, 99999)
  2679. self.segy_entry.set_precision(4)
  2680. self.segy_entry.setSingleStep(0.1)
  2681. self.segy_entry.setWrapping(True)
  2682. grid1.addWidget(segy_label, 11, 0)
  2683. grid1.addWidget(self.segy_entry, 11, 1)
  2684. self.layout.addStretch()
  2685. class GeometryEditorPrefGroupUI(OptionsGroupUI):
  2686. def __init__(self, parent=None):
  2687. # OptionsGroupUI.__init__(self, "Gerber Adv. Options Preferences", parent=parent)
  2688. super(GeometryEditorPrefGroupUI, self).__init__(self)
  2689. self.setTitle(str(_("Geometry Editor")))
  2690. # Advanced Geometry Parameters
  2691. self.param_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  2692. self.param_label.setToolTip(
  2693. _("A list of Geometry Editor parameters.")
  2694. )
  2695. self.layout.addWidget(self.param_label)
  2696. grid0 = QtWidgets.QGridLayout()
  2697. self.layout.addLayout(grid0)
  2698. # Selection Limit
  2699. self.sel_limit_label = QtWidgets.QLabel('%s:' % _("Selection limit"))
  2700. self.sel_limit_label.setToolTip(
  2701. _("Set the number of selected geometry\n"
  2702. "items above which the utility geometry\n"
  2703. "becomes just a selection rectangle.\n"
  2704. "Increases the performance when moving a\n"
  2705. "large number of geometric elements.")
  2706. )
  2707. self.sel_limit_entry = FCSpinner()
  2708. self.sel_limit_entry.set_range(0, 9999)
  2709. grid0.addWidget(self.sel_limit_label, 0, 0)
  2710. grid0.addWidget(self.sel_limit_entry, 0, 1)
  2711. # Milling Type
  2712. milling_type_label = QtWidgets.QLabel('%s:' % _('Milling Type'))
  2713. milling_type_label.setToolTip(
  2714. _("Milling type:\n"
  2715. "- climb / best for precision milling and to reduce tool usage\n"
  2716. "- conventional / useful when there is no backlash compensation")
  2717. )
  2718. self.milling_type_radio = RadioSet([{'label': _('Climb'), 'value': 'cl'},
  2719. {'label': _('Conv.'), 'value': 'cv'}])
  2720. grid0.addWidget(milling_type_label, 1, 0)
  2721. grid0.addWidget(self.milling_type_radio, 1, 1)
  2722. self.layout.addStretch()
  2723. class CNCJobGenPrefGroupUI(OptionsGroupUI):
  2724. def __init__(self, parent=None):
  2725. # OptionsGroupUI.__init__(self, "CNC Job General Preferences", parent=None)
  2726. super(CNCJobGenPrefGroupUI, self).__init__(self)
  2727. self.setTitle(str(_("CNC Job General")))
  2728. # ## Plot options
  2729. self.plot_options_label = QtWidgets.QLabel("<b>%s:</b>" % _("Plot Options"))
  2730. self.layout.addWidget(self.plot_options_label)
  2731. grid0 = QtWidgets.QGridLayout()
  2732. self.layout.addLayout(grid0)
  2733. # grid0.setColumnStretch(1, 1)
  2734. # grid0.setColumnStretch(2, 1)
  2735. # Plot CB
  2736. # self.plot_cb = QtWidgets.QCheckBox('Plot')
  2737. self.plot_cb = FCCheckBox(_('Plot Object'))
  2738. self.plot_cb.setToolTip(_("Plot (show) this object."))
  2739. grid0.addWidget(self.plot_cb, 0, 0)
  2740. # Plot Kind
  2741. self.cncplot_method_label = QtWidgets.QLabel('%s:' % _("Plot kind"))
  2742. self.cncplot_method_label.setToolTip(
  2743. _("This selects the kind of geometries on the canvas to plot.\n"
  2744. "Those can be either of type 'Travel' which means the moves\n"
  2745. "above the work piece or it can be of type 'Cut',\n"
  2746. "which means the moves that cut into the material.")
  2747. )
  2748. self.cncplot_method_radio = RadioSet([
  2749. {"label": _("All"), "value": "all"},
  2750. {"label": _("Travel"), "value": "travel"},
  2751. {"label": _("Cut"), "value": "cut"}
  2752. ], stretch=False)
  2753. grid0.addWidget(self.cncplot_method_label, 1, 0)
  2754. grid0.addWidget(self.cncplot_method_radio, 1, 1)
  2755. grid0.addWidget(QtWidgets.QLabel(''), 1, 2)
  2756. # Display Annotation
  2757. self.annotation_label = QtWidgets.QLabel('%s:' % _("Display Annotation"))
  2758. self.annotation_label.setToolTip(
  2759. _("This selects if to display text annotation on the plot.\n"
  2760. "When checked it will display numbers in order for each end\n"
  2761. "of a travel line."
  2762. )
  2763. )
  2764. self.annotation_cb = FCCheckBox()
  2765. grid0.addWidget(self.annotation_label, 2, 0)
  2766. grid0.addWidget(self.annotation_cb, 2, 1)
  2767. grid0.addWidget(QtWidgets.QLabel(''), 2, 2)
  2768. # ###################################################################
  2769. # Number of circle steps for circular aperture linear approximation #
  2770. # ###################################################################
  2771. self.steps_per_circle_label = QtWidgets.QLabel('%s:' % _("Circle Steps"))
  2772. self.steps_per_circle_label.setToolTip(
  2773. _("The number of circle steps for <b>GCode</b> \n"
  2774. "circle and arc shapes linear approximation.")
  2775. )
  2776. grid0.addWidget(self.steps_per_circle_label, 3, 0)
  2777. self.steps_per_circle_entry = FCSpinner()
  2778. self.steps_per_circle_entry.set_range(0, 99999)
  2779. grid0.addWidget(self.steps_per_circle_entry, 3, 1)
  2780. # Tool dia for plot
  2781. tdlabel = QtWidgets.QLabel('%s:' % _('Travel dia'))
  2782. tdlabel.setToolTip(
  2783. _("The width of the travel lines to be\n"
  2784. "rendered in the plot.")
  2785. )
  2786. self.tooldia_entry = FCDoubleSpinner()
  2787. self.tooldia_entry.set_range(0, 99999)
  2788. self.tooldia_entry.set_precision(4)
  2789. self.tooldia_entry.setSingleStep(0.1)
  2790. self.tooldia_entry.setWrapping(True)
  2791. grid0.addWidget(tdlabel, 4, 0)
  2792. grid0.addWidget(self.tooldia_entry, 4, 1)
  2793. # add a space
  2794. grid0.addWidget(QtWidgets.QLabel(''), 5, 0)
  2795. # Number of decimals to use in GCODE coordinates
  2796. cdeclabel = QtWidgets.QLabel('%s:' % _('Coordinates decimals'))
  2797. cdeclabel.setToolTip(
  2798. _("The number of decimals to be used for \n"
  2799. "the X, Y, Z coordinates in CNC code (GCODE, etc.)")
  2800. )
  2801. self.coords_dec_entry = FCSpinner()
  2802. self.coords_dec_entry.set_range(0, 9)
  2803. self.coords_dec_entry.setWrapping(True)
  2804. grid0.addWidget(cdeclabel, 6, 0)
  2805. grid0.addWidget(self.coords_dec_entry, 6, 1)
  2806. # Number of decimals to use in GCODE feedrate
  2807. frdeclabel = QtWidgets.QLabel('%s:' % _('Feedrate decimals'))
  2808. frdeclabel.setToolTip(
  2809. _("The number of decimals to be used for \n"
  2810. "the Feedrate parameter in CNC code (GCODE, etc.)")
  2811. )
  2812. self.fr_dec_entry = FCSpinner()
  2813. self.fr_dec_entry.set_range(0, 9)
  2814. self.fr_dec_entry.setWrapping(True)
  2815. grid0.addWidget(frdeclabel, 7, 0)
  2816. grid0.addWidget(self.fr_dec_entry, 7, 1)
  2817. # The type of coordinates used in the Gcode: Absolute or Incremental
  2818. coords_type_label = QtWidgets.QLabel('%s:' % _('Coordinates type'))
  2819. coords_type_label.setToolTip(
  2820. _("The type of coordinates to be used in Gcode.\n"
  2821. "Can be:\n"
  2822. "- Absolute G90 -> the reference is the origin x=0, y=0\n"
  2823. "- Incremental G91 -> the reference is the previous position")
  2824. )
  2825. self.coords_type_radio = RadioSet([
  2826. {"label": _("Absolute G90"), "value": "G90"},
  2827. {"label": _("Incremental G91"), "value": "G91"}
  2828. ], orientation='vertical', stretch=False)
  2829. grid0.addWidget(coords_type_label, 8, 0)
  2830. grid0.addWidget(self.coords_type_radio, 8, 1)
  2831. # hidden for the time being, until implemented
  2832. coords_type_label.hide()
  2833. self.coords_type_radio.hide()
  2834. self.layout.addStretch()
  2835. class CNCJobOptPrefGroupUI(OptionsGroupUI):
  2836. def __init__(self, parent=None):
  2837. # OptionsGroupUI.__init__(self, "CNC Job Options Preferences", parent=None)
  2838. super(CNCJobOptPrefGroupUI, self).__init__(self)
  2839. self.setTitle(str(_("CNC Job Options")))
  2840. # ## Export G-Code
  2841. self.export_gcode_label = QtWidgets.QLabel("<b>%s:</b>" % _("Export G-Code"))
  2842. self.export_gcode_label.setToolTip(
  2843. _("Export and save G-Code to\n"
  2844. "make this object to a file.")
  2845. )
  2846. self.layout.addWidget(self.export_gcode_label)
  2847. settings = QSettings("Open Source", "FlatCAM")
  2848. if settings.contains("textbox_font_size"):
  2849. tb_fsize = settings.value('textbox_font_size', type=int)
  2850. else:
  2851. tb_fsize = 10
  2852. font = QtGui.QFont()
  2853. font.setPointSize(tb_fsize)
  2854. # Prepend to G-Code
  2855. prependlabel = QtWidgets.QLabel('%s:' % _('Prepend to G-Code'))
  2856. prependlabel.setToolTip(
  2857. _("Type here any G-Code commands you would\n"
  2858. "like to add at the beginning of the G-Code file.")
  2859. )
  2860. self.layout.addWidget(prependlabel)
  2861. self.prepend_text = FCTextArea()
  2862. self.layout.addWidget(self.prepend_text)
  2863. self.prepend_text.setFont(font)
  2864. # Append text to G-Code
  2865. appendlabel = QtWidgets.QLabel('%s:' % _('Append to G-Code'))
  2866. appendlabel.setToolTip(
  2867. _("Type here any G-Code commands you would\n"
  2868. "like to append to the generated file.\n"
  2869. "I.e.: M2 (End of program)")
  2870. )
  2871. self.layout.addWidget(appendlabel)
  2872. self.append_text = FCTextArea()
  2873. self.layout.addWidget(self.append_text)
  2874. self.append_text.setFont(font)
  2875. self.layout.addStretch()
  2876. class CNCJobAdvOptPrefGroupUI(OptionsGroupUI):
  2877. def __init__(self, parent=None):
  2878. # OptionsGroupUI.__init__(self, "CNC Job Advanced Options Preferences", parent=None)
  2879. super(CNCJobAdvOptPrefGroupUI, self).__init__(self)
  2880. self.setTitle(str(_("CNC Job Adv. Options")))
  2881. # ## Export G-Code
  2882. self.export_gcode_label = QtWidgets.QLabel("<b>%s:</b>" % _("Export CNC Code"))
  2883. self.export_gcode_label.setToolTip(
  2884. _("Export and save G-Code to\n"
  2885. "make this object to a file.")
  2886. )
  2887. self.layout.addWidget(self.export_gcode_label)
  2888. # Prepend to G-Code
  2889. toolchangelabel = QtWidgets.QLabel('%s:' % _('Toolchange G-Code'))
  2890. toolchangelabel.setToolTip(
  2891. _(
  2892. "Type here any G-Code commands you would\n"
  2893. "like to be executed when Toolchange event is encountered.\n"
  2894. "This will constitute a Custom Toolchange GCode,\n"
  2895. "or a Toolchange Macro.\n"
  2896. "The FlatCAM variables are surrounded by '%' symbol.\n\n"
  2897. "WARNING: it can be used only with a postprocessor file\n"
  2898. "that has 'toolchange_custom' in it's name and this is built\n"
  2899. "having as template the 'Toolchange Custom' posprocessor file."
  2900. )
  2901. )
  2902. self.layout.addWidget(toolchangelabel)
  2903. settings = QSettings("Open Source", "FlatCAM")
  2904. if settings.contains("textbox_font_size"):
  2905. tb_fsize = settings.value('textbox_font_size', type=int)
  2906. else:
  2907. tb_fsize = 10
  2908. font = QtGui.QFont()
  2909. font.setPointSize(tb_fsize)
  2910. self.toolchange_text = FCTextArea()
  2911. self.layout.addWidget(self.toolchange_text)
  2912. self.toolchange_text.setFont(font)
  2913. hlay = QtWidgets.QHBoxLayout()
  2914. self.layout.addLayout(hlay)
  2915. # Toolchange Replacement GCode
  2916. self.toolchange_cb = FCCheckBox(label='%s' % _('Use Toolchange Macro'))
  2917. self.toolchange_cb.setToolTip(
  2918. _("Check this box if you want to use\n"
  2919. "a Custom Toolchange GCode (macro).")
  2920. )
  2921. hlay.addWidget(self.toolchange_cb)
  2922. hlay.addStretch()
  2923. hlay1 = QtWidgets.QHBoxLayout()
  2924. self.layout.addLayout(hlay1)
  2925. # Variable list
  2926. self.tc_variable_combo = FCComboBox()
  2927. self.tc_variable_combo.setToolTip(
  2928. _("A list of the FlatCAM variables that can be used\n"
  2929. "in the Toolchange event.\n"
  2930. "They have to be surrounded by the '%' symbol")
  2931. )
  2932. hlay1.addWidget(self.tc_variable_combo)
  2933. # Populate the Combo Box
  2934. variables = [_('Parameters'), 'tool', 'tooldia', 't_drills', 'x_toolchange', 'y_toolchange', 'z_toolchange',
  2935. 'z_cut', 'z_move', 'z_depthpercut', 'spindlespeed', 'dwelltime']
  2936. self.tc_variable_combo.addItems(variables)
  2937. self.tc_variable_combo.setItemData(0, _("FlatCAM CNC parameters"), Qt.ToolTipRole)
  2938. self.tc_variable_combo.setItemData(1, 'tool = %s' % _("tool number"), Qt.ToolTipRole)
  2939. self.tc_variable_combo.setItemData(2, 'tooldia = %s' % _("tool diameter"), Qt.ToolTipRole)
  2940. self.tc_variable_combo.setItemData(3, 't_drills = %s' % _("for Excellon, total number of drills"),
  2941. Qt.ToolTipRole)
  2942. self.tc_variable_combo.setItemData(4, 'x_toolchange = %s' % _("X coord for Toolchange"), Qt.ToolTipRole)
  2943. self.tc_variable_combo.setItemData(5, 'y_toolchange = %s' % _("y_toolchange = Y coord for Toolchange"),
  2944. Qt.ToolTipRole)
  2945. self.tc_variable_combo.setItemData(6, 'z_toolchange = %s' % _("Z coord for Toolchange"), Qt.ToolTipRole)
  2946. self.tc_variable_combo.setItemData(7, 'z_cut = %s' % _("Z depth for the cut"), Qt.ToolTipRole)
  2947. self.tc_variable_combo.setItemData(8, 'z_move = %s' % _("Z height for travel"), Qt.ToolTipRole)
  2948. self.tc_variable_combo.setItemData(9, 'z_depthpercut = %s' % _("the step value for multidepth cut"),
  2949. Qt.ToolTipRole)
  2950. self.tc_variable_combo.setItemData(10, 'spindlesspeed = %s' % _("the value for the spindle speed"),
  2951. Qt.ToolTipRole)
  2952. self.tc_variable_combo.setItemData(11,
  2953. _("dwelltime = time to dwell to allow the spindle to reach it's set RPM"),
  2954. Qt.ToolTipRole)
  2955. hlay1.addStretch()
  2956. # Insert Variable into the Toolchange G-Code Text Box
  2957. # self.tc_insert_buton = FCButton("Insert")
  2958. # self.tc_insert_buton.setToolTip(
  2959. # "Insert the variable in the GCode Box\n"
  2960. # "surrounded by the '%' symbol."
  2961. # )
  2962. # hlay1.addWidget(self.tc_insert_buton)
  2963. grid0 = QtWidgets.QGridLayout()
  2964. self.layout.addLayout(grid0)
  2965. grid0.addWidget(QtWidgets.QLabel(''), 1, 0, 1, 2)
  2966. # Annotation Font Size
  2967. self.annotation_fontsize_label = QtWidgets.QLabel('%s:' % _("Annotation Size"))
  2968. self.annotation_fontsize_label.setToolTip(
  2969. _("The font size of the annotation text. In pixels.")
  2970. )
  2971. grid0.addWidget(self.annotation_fontsize_label, 2, 0)
  2972. self.annotation_fontsize_sp = FCSpinner()
  2973. self.annotation_fontsize_sp.set_range(0, 9999)
  2974. grid0.addWidget(self.annotation_fontsize_sp, 2, 1)
  2975. grid0.addWidget(QtWidgets.QLabel(''), 2, 2)
  2976. # Annotation Font Color
  2977. self.annotation_color_label = QtWidgets.QLabel('%s:' % _('Annotation Color'))
  2978. self.annotation_color_label.setToolTip(
  2979. _("Set the font color for the annotation texts.")
  2980. )
  2981. self.annotation_fontcolor_entry = FCEntry()
  2982. self.annotation_fontcolor_button = QtWidgets.QPushButton()
  2983. self.annotation_fontcolor_button.setFixedSize(15, 15)
  2984. self.form_box_child = QtWidgets.QHBoxLayout()
  2985. self.form_box_child.setContentsMargins(0, 0, 0, 0)
  2986. self.form_box_child.addWidget(self.annotation_fontcolor_entry)
  2987. self.form_box_child.addWidget(self.annotation_fontcolor_button, alignment=Qt.AlignRight)
  2988. self.form_box_child.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  2989. color_widget = QtWidgets.QWidget()
  2990. color_widget.setLayout(self.form_box_child)
  2991. grid0.addWidget(self.annotation_color_label, 3, 0)
  2992. grid0.addWidget(color_widget, 3, 1)
  2993. grid0.addWidget(QtWidgets.QLabel(''), 3, 2)
  2994. self.layout.addStretch()
  2995. class ToolsNCCPrefGroupUI(OptionsGroupUI):
  2996. def __init__(self, parent=None):
  2997. # OptionsGroupUI.__init__(self, "NCC Tool Options", parent=parent)
  2998. super(ToolsNCCPrefGroupUI, self).__init__(self)
  2999. self.setTitle(str(_("NCC Tool Options")))
  3000. # ## Clear non-copper regions
  3001. self.clearcopper_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  3002. self.clearcopper_label.setToolTip(
  3003. _("Create a Geometry object with\n"
  3004. "toolpaths to cut all non-copper regions.")
  3005. )
  3006. self.layout.addWidget(self.clearcopper_label)
  3007. grid0 = QtWidgets.QGridLayout()
  3008. self.layout.addLayout(grid0)
  3009. ncctdlabel = QtWidgets.QLabel('%s:' % _('Tools dia'))
  3010. ncctdlabel.setToolTip(
  3011. _("Diameters of the cutting tools, separated by ','")
  3012. )
  3013. grid0.addWidget(ncctdlabel, 0, 0)
  3014. self.ncc_tool_dia_entry = FCEntry()
  3015. grid0.addWidget(self.ncc_tool_dia_entry, 0, 1)
  3016. # Tool Type Radio Button
  3017. self.tool_type_label = QtWidgets.QLabel('%s:' % _('Tool Type'))
  3018. self.tool_type_label.setToolTip(
  3019. _("Default tool type:\n"
  3020. "- 'V-shape'\n"
  3021. "- Circular")
  3022. )
  3023. self.tool_type_radio = RadioSet([{'label': _('V-shape'), 'value': 'V'},
  3024. {'label': _('Circular'), 'value': 'C1'}])
  3025. self.tool_type_radio.setToolTip(
  3026. _("Default tool type:\n"
  3027. "- 'V-shape'\n"
  3028. "- Circular")
  3029. )
  3030. grid0.addWidget(self.tool_type_label, 1, 0)
  3031. grid0.addWidget(self.tool_type_radio, 1, 1)
  3032. # Tip Dia
  3033. self.tipdialabel = QtWidgets.QLabel('%s:' % _('V-Tip Dia'))
  3034. self.tipdialabel.setToolTip(
  3035. _("The tip diameter for V-Shape Tool"))
  3036. self.tipdia_entry = LengthEntry()
  3037. grid0.addWidget(self.tipdialabel, 2, 0)
  3038. grid0.addWidget(self.tipdia_entry, 2, 1)
  3039. # Tip Angle
  3040. self.tipanglelabel = QtWidgets.QLabel('%s:' % _('V-Tip Angle'))
  3041. self.tipanglelabel.setToolTip(
  3042. _("The tip angle for V-Shape Tool.\n"
  3043. "In degree."))
  3044. self.tipangle_entry = LengthEntry()
  3045. grid0.addWidget(self.tipanglelabel, 3, 0)
  3046. grid0.addWidget(self.tipangle_entry, 3, 1)
  3047. # Milling Type Radio Button
  3048. self.milling_type_label = QtWidgets.QLabel('%s:' % _('Milling Type'))
  3049. self.milling_type_label.setToolTip(
  3050. _("Milling type when the selected tool is of type: 'iso_op':\n"
  3051. "- climb / best for precision milling and to reduce tool usage\n"
  3052. "- conventional / useful when there is no backlash compensation")
  3053. )
  3054. self.milling_type_radio = RadioSet([{'label': _('Climb'), 'value': 'cl'},
  3055. {'label': _('Conv.'), 'value': 'cv'}])
  3056. self.milling_type_radio.setToolTip(
  3057. _("Milling type when the selected tool is of type: 'iso_op':\n"
  3058. "- climb / best for precision milling and to reduce tool usage\n"
  3059. "- conventional / useful when there is no backlash compensation")
  3060. )
  3061. grid0.addWidget(self.milling_type_label, 4, 0)
  3062. grid0.addWidget(self.milling_type_radio, 4, 1)
  3063. # Tool order Radio Button
  3064. self.ncc_order_label = QtWidgets.QLabel('%s:' % _('Tool order'))
  3065. self.ncc_order_label.setToolTip(_("This set the way that the tools in the tools table are used.\n"
  3066. "'No' --> means that the used order is the one in the tool table\n"
  3067. "'Forward' --> means that the tools will be ordered from small to big\n"
  3068. "'Reverse' --> menas that the tools will ordered from big to small\n\n"
  3069. "WARNING: using rest machining will automatically set the order\n"
  3070. "in reverse and disable this control."))
  3071. self.ncc_order_radio = RadioSet([{'label': _('No'), 'value': 'no'},
  3072. {'label': _('Forward'), 'value': 'fwd'},
  3073. {'label': _('Reverse'), 'value': 'rev'}])
  3074. self.ncc_order_radio.setToolTip(_("This set the way that the tools in the tools table are used.\n"
  3075. "'No' --> means that the used order is the one in the tool table\n"
  3076. "'Forward' --> means that the tools will be ordered from small to big\n"
  3077. "'Reverse' --> menas that the tools will ordered from big to small\n\n"
  3078. "WARNING: using rest machining will automatically set the order\n"
  3079. "in reverse and disable this control."))
  3080. grid0.addWidget(self.ncc_order_label, 5, 0)
  3081. grid0.addWidget(self.ncc_order_radio, 5, 1)
  3082. # Cut Z entry
  3083. cutzlabel = QtWidgets.QLabel('%s:' % _('Cut Z'))
  3084. cutzlabel.setToolTip(
  3085. _("Depth of cut into material. Negative value.\n"
  3086. "In FlatCAM units.")
  3087. )
  3088. self.cutz_entry = FloatEntry()
  3089. self.cutz_entry.setToolTip(
  3090. _("Depth of cut into material. Negative value.\n"
  3091. "In FlatCAM units.")
  3092. )
  3093. grid0.addWidget(cutzlabel, 6, 0)
  3094. grid0.addWidget(self.cutz_entry, 6, 1)
  3095. # Overlap Entry
  3096. nccoverlabel = QtWidgets.QLabel('%s:' % _('Overlap Rate'))
  3097. nccoverlabel.setToolTip(
  3098. _("How much (fraction) of the tool width to overlap each tool pass.\n"
  3099. "Example:\n"
  3100. "A value here of 0.25 means 25%% from the tool diameter found above.\n\n"
  3101. "Adjust the value starting with lower values\n"
  3102. "and increasing it if areas that should be cleared are still \n"
  3103. "not cleared.\n"
  3104. "Lower values = faster processing, faster execution on PCB.\n"
  3105. "Higher values = slow processing and slow execution on CNC\n"
  3106. "due of too many paths.")
  3107. )
  3108. self.ncc_overlap_entry = FCDoubleSpinner()
  3109. self.ncc_overlap_entry.set_precision(3)
  3110. self.ncc_overlap_entry.setWrapping(True)
  3111. self.ncc_overlap_entry.setRange(0.000, 0.999)
  3112. self.ncc_overlap_entry.setSingleStep(0.1)
  3113. grid0.addWidget(nccoverlabel, 7, 0)
  3114. grid0.addWidget(self.ncc_overlap_entry, 7, 1)
  3115. # Margin entry
  3116. nccmarginlabel = QtWidgets.QLabel('%s:' % _('Margin'))
  3117. nccmarginlabel.setToolTip(
  3118. _("Bounding box margin.")
  3119. )
  3120. grid0.addWidget(nccmarginlabel, 8, 0)
  3121. self.ncc_margin_entry = FloatEntry()
  3122. grid0.addWidget(self.ncc_margin_entry, 8, 1)
  3123. # Method
  3124. methodlabel = QtWidgets.QLabel('%s:' % _('Method'))
  3125. methodlabel.setToolTip(
  3126. _("Algorithm for non-copper clearing:<BR>"
  3127. "<B>Standard</B>: Fixed step inwards.<BR>"
  3128. "<B>Seed-based</B>: Outwards from seed.<BR>"
  3129. "<B>Line-based</B>: Parallel lines.")
  3130. )
  3131. grid0.addWidget(methodlabel, 9, 0)
  3132. self.ncc_method_radio = RadioSet([
  3133. {"label": _("Standard"), "value": "standard"},
  3134. {"label": _("Seed-based"), "value": "seed"},
  3135. {"label": _("Straight lines"), "value": "lines"}
  3136. ], orientation='vertical', stretch=False)
  3137. grid0.addWidget(self.ncc_method_radio, 9, 1)
  3138. # Connect lines
  3139. pathconnectlabel = QtWidgets.QLabel('%s:' % _("Connect"))
  3140. pathconnectlabel.setToolTip(
  3141. _("Draw lines between resulting\n"
  3142. "segments to minimize tool lifts.")
  3143. )
  3144. grid0.addWidget(pathconnectlabel, 10, 0)
  3145. self.ncc_connect_cb = FCCheckBox()
  3146. grid0.addWidget(self.ncc_connect_cb, 10, 1)
  3147. # Contour Checkbox
  3148. contourlabel = QtWidgets.QLabel('%s:' % _("Contour"))
  3149. contourlabel.setToolTip(
  3150. _("Cut around the perimeter of the polygon\n"
  3151. "to trim rough edges.")
  3152. )
  3153. grid0.addWidget(contourlabel, 11, 0)
  3154. self.ncc_contour_cb = FCCheckBox()
  3155. grid0.addWidget(self.ncc_contour_cb, 11, 1)
  3156. # Rest machining CheckBox
  3157. restlabel = QtWidgets.QLabel('%s:' % _("Rest M."))
  3158. restlabel.setToolTip(
  3159. _("If checked, use 'rest machining'.\n"
  3160. "Basically it will clear copper outside PCB features,\n"
  3161. "using the biggest tool and continue with the next tools,\n"
  3162. "from bigger to smaller, to clear areas of copper that\n"
  3163. "could not be cleared by previous tool, until there is\n"
  3164. "no more copper to clear or there are no more tools.\n"
  3165. "If not checked, use the standard algorithm.")
  3166. )
  3167. grid0.addWidget(restlabel, 12, 0)
  3168. self.ncc_rest_cb = FCCheckBox()
  3169. grid0.addWidget(self.ncc_rest_cb, 12, 1)
  3170. # ## NCC Offset choice
  3171. self.ncc_offset_choice_label = QtWidgets.QLabel('%s:' % _("Offset"))
  3172. self.ncc_offset_choice_label.setToolTip(
  3173. _("If used, it will add an offset to the copper features.\n"
  3174. "The copper clearing will finish to a distance\n"
  3175. "from the copper features.\n"
  3176. "The value can be between 0 and 10 FlatCAM units.")
  3177. )
  3178. grid0.addWidget(self.ncc_offset_choice_label, 13, 0)
  3179. self.ncc_choice_offset_cb = FCCheckBox()
  3180. grid0.addWidget(self.ncc_choice_offset_cb, 13, 1)
  3181. # ## NCC Offset value
  3182. self.ncc_offset_label = QtWidgets.QLabel('%s:' % _("Offset value"))
  3183. self.ncc_offset_label.setToolTip(
  3184. _("If used, it will add an offset to the copper features.\n"
  3185. "The copper clearing will finish to a distance\n"
  3186. "from the copper features.\n"
  3187. "The value can be between 0 and 10 FlatCAM units.")
  3188. )
  3189. grid0.addWidget(self.ncc_offset_label, 14, 0)
  3190. self.ncc_offset_spinner = FCDoubleSpinner()
  3191. self.ncc_offset_spinner.set_range(0.00, 10.00)
  3192. self.ncc_offset_spinner.set_precision(4)
  3193. self.ncc_offset_spinner.setWrapping(True)
  3194. self.ncc_offset_spinner.setSingleStep(0.1)
  3195. grid0.addWidget(self.ncc_offset_spinner, 14, 1)
  3196. # ## Reference
  3197. self.reference_radio = RadioSet([{'label': _('Itself'), 'value': 'itself'},
  3198. {"label": _("Area"), "value": "area"},
  3199. {'label': _('Ref'), 'value': 'box'}])
  3200. reference_label = QtWidgets.QLabel('%s:' % _("Reference"))
  3201. reference_label.setToolTip(
  3202. _("- 'Itself' - the non copper clearing extent\n"
  3203. "is based on the object that is copper cleared.\n "
  3204. "- 'Area Selection' - left mouse click to start selection of the area to be painted.\n"
  3205. "Keeping a modifier key pressed (CTRL or SHIFT) will allow to add multiple areas.\n"
  3206. "- 'Reference Object' - will do non copper clearing within the area\n"
  3207. "specified by another object.")
  3208. )
  3209. grid0.addWidget(reference_label, 15, 0)
  3210. grid0.addWidget(self.reference_radio, 15, 1)
  3211. # ## Plotting type
  3212. self.ncc_plotting_radio = RadioSet([{'label': _('Normal'), 'value': 'normal'},
  3213. {"label": _("Progressive"), "value": "progressive"}])
  3214. plotting_label = QtWidgets.QLabel('%s:' % _("NCC Plotting"))
  3215. plotting_label.setToolTip(
  3216. _("- 'Normal' - normal plotting, done at the end of the NCC job\n"
  3217. "- 'Progressive' - after each shape is generated it will be plotted.")
  3218. )
  3219. grid0.addWidget(plotting_label, 16, 0)
  3220. grid0.addWidget(self.ncc_plotting_radio, 16, 1)
  3221. self.layout.addStretch()
  3222. class ToolsCutoutPrefGroupUI(OptionsGroupUI):
  3223. def __init__(self, parent=None):
  3224. # OptionsGroupUI.__init__(self, "Cutout Tool Options", parent=parent)
  3225. super(ToolsCutoutPrefGroupUI, self).__init__(self)
  3226. self.setTitle(str(_("Cutout Tool Options")))
  3227. # ## Board cuttout
  3228. self.board_cutout_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  3229. self.board_cutout_label.setToolTip(
  3230. _("Create toolpaths to cut around\n"
  3231. "the PCB and separate it from\n"
  3232. "the original board.")
  3233. )
  3234. self.layout.addWidget(self.board_cutout_label)
  3235. grid0 = QtWidgets.QGridLayout()
  3236. self.layout.addLayout(grid0)
  3237. tdclabel = QtWidgets.QLabel('%s:' % _('Tool dia'))
  3238. tdclabel.setToolTip(
  3239. _("Diameter of the tool used to cutout\n"
  3240. "the PCB shape out of the surrounding material.")
  3241. )
  3242. grid0.addWidget(tdclabel, 0, 0)
  3243. self.cutout_tooldia_entry = LengthEntry()
  3244. grid0.addWidget(self.cutout_tooldia_entry, 0, 1)
  3245. # Object kind
  3246. kindlabel = QtWidgets.QLabel('%s:' % _('Obj kind'))
  3247. kindlabel.setToolTip(
  3248. _("Choice of what kind the object we want to cutout is.<BR>"
  3249. "- <B>Single</B>: contain a single PCB Gerber outline object.<BR>"
  3250. "- <B>Panel</B>: a panel PCB Gerber object, which is made\n"
  3251. "out of many individual PCB outlines.")
  3252. )
  3253. grid0.addWidget(kindlabel, 1, 0)
  3254. self.obj_kind_combo = RadioSet([
  3255. {"label": _("Single"), "value": "single"},
  3256. {"label": _("Panel"), "value": "panel"},
  3257. ])
  3258. grid0.addWidget(self.obj_kind_combo, 1, 1)
  3259. marginlabel = QtWidgets.QLabel('%s:' % _('Margin'))
  3260. marginlabel.setToolTip(
  3261. _("Margin over bounds. A positive value here\n"
  3262. "will make the cutout of the PCB further from\n"
  3263. "the actual PCB border")
  3264. )
  3265. grid0.addWidget(marginlabel, 2, 0)
  3266. self.cutout_margin_entry = LengthEntry()
  3267. grid0.addWidget(self.cutout_margin_entry, 2, 1)
  3268. gaplabel = QtWidgets.QLabel('%s:' % _('Gap size'))
  3269. gaplabel.setToolTip(
  3270. _("The size of the bridge gaps in the cutout\n"
  3271. "used to keep the board connected to\n"
  3272. "the surrounding material (the one \n"
  3273. "from which the PCB is cutout).")
  3274. )
  3275. grid0.addWidget(gaplabel, 3, 0)
  3276. self.cutout_gap_entry = LengthEntry()
  3277. grid0.addWidget(self.cutout_gap_entry, 3, 1)
  3278. gaps_label = QtWidgets.QLabel('%s:' % _('Gaps'))
  3279. gaps_label.setToolTip(
  3280. _("Number of gaps used for the cutout.\n"
  3281. "There can be maximum 8 bridges/gaps.\n"
  3282. "The choices are:\n"
  3283. "- None - no gaps\n"
  3284. "- lr - left + right\n"
  3285. "- tb - top + bottom\n"
  3286. "- 4 - left + right +top + bottom\n"
  3287. "- 2lr - 2*left + 2*right\n"
  3288. "- 2tb - 2*top + 2*bottom\n"
  3289. "- 8 - 2*left + 2*right +2*top + 2*bottom")
  3290. )
  3291. grid0.addWidget(gaps_label, 4, 0)
  3292. self.gaps_combo = FCComboBox()
  3293. grid0.addWidget(self.gaps_combo, 4, 1)
  3294. gaps_items = ['None', 'LR', 'TB', '4', '2LR', '2TB', '8']
  3295. for it in gaps_items:
  3296. self.gaps_combo.addItem(it)
  3297. self.gaps_combo.setStyleSheet('background-color: rgb(255,255,255)')
  3298. # Surrounding convex box shape
  3299. self.convex_box = FCCheckBox()
  3300. self.convex_box_label = QtWidgets.QLabel('%s:' % _("Convex Sh."))
  3301. self.convex_box_label.setToolTip(
  3302. _("Create a convex shape surrounding the entire PCB.\n"
  3303. "Used only if the source object type is Gerber.")
  3304. )
  3305. grid0.addWidget(self.convex_box_label, 5, 0)
  3306. grid0.addWidget(self.convex_box, 5, 1)
  3307. self.layout.addStretch()
  3308. class Tools2sidedPrefGroupUI(OptionsGroupUI):
  3309. def __init__(self, parent=None):
  3310. # OptionsGroupUI.__init__(self, "2sided Tool Options", parent=parent)
  3311. super(Tools2sidedPrefGroupUI, self).__init__(self)
  3312. self.setTitle(str(_("2Sided Tool Options")))
  3313. # ## Board cuttout
  3314. self.dblsided_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  3315. self.dblsided_label.setToolTip(
  3316. _("A tool to help in creating a double sided\n"
  3317. "PCB using alignment holes.")
  3318. )
  3319. self.layout.addWidget(self.dblsided_label)
  3320. grid0 = QtWidgets.QGridLayout()
  3321. self.layout.addLayout(grid0)
  3322. # ## Drill diameter for alignment holes
  3323. self.drill_dia_entry = LengthEntry()
  3324. self.dd_label = QtWidgets.QLabel('%s:' % _("Drill dia"))
  3325. self.dd_label.setToolTip(
  3326. _("Diameter of the drill for the "
  3327. "alignment holes.")
  3328. )
  3329. grid0.addWidget(self.dd_label, 0, 0)
  3330. grid0.addWidget(self.drill_dia_entry, 0, 1)
  3331. # ## Axis
  3332. self.mirror_axis_radio = RadioSet([{'label': 'X', 'value': 'X'},
  3333. {'label': 'Y', 'value': 'Y'}])
  3334. self.mirax_label = QtWidgets.QLabel(_("Mirror Axis:"))
  3335. self.mirax_label.setToolTip(
  3336. _("Mirror vertically (X) or horizontally (Y).")
  3337. )
  3338. # grid_lay.addRow("Mirror Axis:", self.mirror_axis)
  3339. self.empty_lb1 = QtWidgets.QLabel("")
  3340. grid0.addWidget(self.empty_lb1, 1, 0)
  3341. grid0.addWidget(self.mirax_label, 2, 0)
  3342. grid0.addWidget(self.mirror_axis_radio, 2, 1)
  3343. # ## Axis Location
  3344. self.axis_location_radio = RadioSet([{'label': _('Point'), 'value': 'point'},
  3345. {'label': _('Box'), 'value': 'box'}])
  3346. self.axloc_label = QtWidgets.QLabel('%s:' % _("Axis Ref"))
  3347. self.axloc_label.setToolTip(
  3348. _("The axis should pass through a <b>point</b> or cut\n "
  3349. "a specified <b>box</b> (in a FlatCAM object) through \n"
  3350. "the center.")
  3351. )
  3352. # grid_lay.addRow("Axis Location:", self.axis_location)
  3353. grid0.addWidget(self.axloc_label, 3, 0)
  3354. grid0.addWidget(self.axis_location_radio, 3, 1)
  3355. self.layout.addStretch()
  3356. class ToolsPaintPrefGroupUI(OptionsGroupUI):
  3357. def __init__(self, parent=None):
  3358. # OptionsGroupUI.__init__(self, "Paint Area Tool Options", parent=parent)
  3359. super(ToolsPaintPrefGroupUI, self).__init__(self)
  3360. self.setTitle(str(_("Paint Tool Options")))
  3361. # ------------------------------
  3362. # ## Paint area
  3363. # ------------------------------
  3364. self.paint_label = QtWidgets.QLabel(_('<b>Parameters:</b>'))
  3365. self.paint_label.setToolTip(
  3366. _("Creates tool paths to cover the\n"
  3367. "whole area of a polygon (remove\n"
  3368. "all copper). You will be asked\n"
  3369. "to click on the desired polygon.")
  3370. )
  3371. self.layout.addWidget(self.paint_label)
  3372. grid0 = QtWidgets.QGridLayout()
  3373. self.layout.addLayout(grid0)
  3374. # Tool dia
  3375. ptdlabel = QtWidgets.QLabel('%s:' % _('Tool dia'))
  3376. ptdlabel.setToolTip(
  3377. _("Diameter of the tool to\n"
  3378. "be used in the operation.")
  3379. )
  3380. grid0.addWidget(ptdlabel, 0, 0)
  3381. self.painttooldia_entry = LengthEntry()
  3382. grid0.addWidget(self.painttooldia_entry, 0, 1)
  3383. self.paint_order_label = QtWidgets.QLabel('<b>%s:</b>' % _('Tool order'))
  3384. self.paint_order_label.setToolTip(_("This set the way that the tools in the tools table are used.\n"
  3385. "'No' --> means that the used order is the one in the tool table\n"
  3386. "'Forward' --> means that the tools will be ordered from small to big\n"
  3387. "'Reverse' --> menas that the tools will ordered from big to small\n\n"
  3388. "WARNING: using rest machining will automatically set the order\n"
  3389. "in reverse and disable this control."))
  3390. self.paint_order_radio = RadioSet([{'label': _('No'), 'value': 'no'},
  3391. {'label': _('Forward'), 'value': 'fwd'},
  3392. {'label': _('Reverse'), 'value': 'rev'}])
  3393. self.paint_order_radio.setToolTip(_("This set the way that the tools in the tools table are used.\n"
  3394. "'No' --> means that the used order is the one in the tool table\n"
  3395. "'Forward' --> means that the tools will be ordered from small to big\n"
  3396. "'Reverse' --> menas that the tools will ordered from big to small\n\n"
  3397. "WARNING: using rest machining will automatically set the order\n"
  3398. "in reverse and disable this control."))
  3399. grid0.addWidget(self.paint_order_label, 1, 0)
  3400. grid0.addWidget(self.paint_order_radio, 1, 1)
  3401. # Overlap
  3402. ovlabel = QtWidgets.QLabel('%s:' % _('Overlap Rate'))
  3403. ovlabel.setToolTip(
  3404. _("How much (fraction) of the tool width to overlap each tool pass.\n"
  3405. "Example:\n"
  3406. "A value here of 0.25 means 25%% from the tool diameter found above.\n\n"
  3407. "Adjust the value starting with lower values\n"
  3408. "and increasing it if areas that should be painted are still \n"
  3409. "not painted.\n"
  3410. "Lower values = faster processing, faster execution on PCB.\n"
  3411. "Higher values = slow processing and slow execution on CNC\n"
  3412. "due of too many paths.")
  3413. )
  3414. self.paintoverlap_entry = FCDoubleSpinner()
  3415. self.paintoverlap_entry.set_precision(3)
  3416. self.paintoverlap_entry.setWrapping(True)
  3417. self.paintoverlap_entry.setRange(0.000, 0.999)
  3418. self.paintoverlap_entry.setSingleStep(0.1)
  3419. grid0.addWidget(ovlabel, 2, 0)
  3420. grid0.addWidget(self.paintoverlap_entry, 2, 1)
  3421. # Margin
  3422. marginlabel = QtWidgets.QLabel('%s:' % _('Margin'))
  3423. marginlabel.setToolTip(
  3424. _("Distance by which to avoid\n"
  3425. "the edges of the polygon to\n"
  3426. "be painted.")
  3427. )
  3428. grid0.addWidget(marginlabel, 3, 0)
  3429. self.paintmargin_entry = LengthEntry()
  3430. grid0.addWidget(self.paintmargin_entry, 3, 1)
  3431. # Method
  3432. methodlabel = QtWidgets.QLabel('%s:' % _('Method'))
  3433. methodlabel.setToolTip(
  3434. _("Algorithm for non-copper clearing:<BR>"
  3435. "<B>Standard</B>: Fixed step inwards.<BR>"
  3436. "<B>Seed-based</B>: Outwards from seed.<BR>"
  3437. "<B>Line-based</B>: Parallel lines.")
  3438. )
  3439. grid0.addWidget(methodlabel, 4, 0)
  3440. self.paintmethod_combo = RadioSet([
  3441. {"label": _("Standard"), "value": "standard"},
  3442. {"label": _("Seed-based"), "value": "seed"},
  3443. {"label": _("Straight lines"), "value": "lines"}
  3444. ], orientation='vertical', stretch=False)
  3445. grid0.addWidget(self.paintmethod_combo, 4, 1)
  3446. # Connect lines
  3447. pathconnectlabel = QtWidgets.QLabel('%s:' % _("Connect"))
  3448. pathconnectlabel.setToolTip(
  3449. _("Draw lines between resulting\n"
  3450. "segments to minimize tool lifts.")
  3451. )
  3452. grid0.addWidget(pathconnectlabel, 5, 0)
  3453. self.pathconnect_cb = FCCheckBox()
  3454. grid0.addWidget(self.pathconnect_cb, 5, 1)
  3455. # Paint contour
  3456. contourlabel = QtWidgets.QLabel('%s:' % _("Contour"))
  3457. contourlabel.setToolTip(
  3458. _("Cut around the perimeter of the polygon\n"
  3459. "to trim rough edges.")
  3460. )
  3461. grid0.addWidget(contourlabel, 6, 0)
  3462. self.contour_cb = FCCheckBox()
  3463. grid0.addWidget(self.contour_cb, 6, 1)
  3464. # Polygon selection
  3465. selectlabel = QtWidgets.QLabel('%s:' % _('Selection'))
  3466. selectlabel.setToolTip(
  3467. _("How to select Polygons to be painted.\n\n"
  3468. "- 'Area Selection' - left mouse click to start selection of the area to be painted.\n"
  3469. "Keeping a modifier key pressed (CTRL or SHIFT) will allow to add multiple areas.\n"
  3470. "- 'All Polygons' - the Paint will start after click.\n"
  3471. "- 'Reference Object' - will do non copper clearing within the area\n"
  3472. "specified by another object.")
  3473. )
  3474. self.selectmethod_combo = RadioSet([
  3475. {"label": _("Single"), "value": "single"},
  3476. {"label": _("Area"), "value": "area"},
  3477. {"label": _("All"), "value": "all"},
  3478. {"label": _("Ref."), "value": "ref"}
  3479. ])
  3480. grid0.addWidget(selectlabel, 7, 0)
  3481. grid0.addWidget(self.selectmethod_combo, 7, 1)
  3482. # ## Plotting type
  3483. self.paint_plotting_radio = RadioSet([{'label': _('Normal'), 'value': 'normal'},
  3484. {"label": _("Progressive"), "value": "progressive"}])
  3485. plotting_label = QtWidgets.QLabel('%s:' % _("Paint Plotting"))
  3486. plotting_label.setToolTip(
  3487. _("- 'Normal' - normal plotting, done at the end of the Paint job\n"
  3488. "- 'Progressive' - after each shape is generated it will be plotted.")
  3489. )
  3490. grid0.addWidget(plotting_label, 8, 0)
  3491. grid0.addWidget(self.paint_plotting_radio, 8, 1)
  3492. self.layout.addStretch()
  3493. class ToolsFilmPrefGroupUI(OptionsGroupUI):
  3494. def __init__(self, parent=None):
  3495. # OptionsGroupUI.__init__(self, "Cutout Tool Options", parent=parent)
  3496. super(ToolsFilmPrefGroupUI, self).__init__(self)
  3497. self.setTitle(str(_("Film Tool Options")))
  3498. # ## Board cuttout
  3499. self.film_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  3500. self.film_label.setToolTip(
  3501. _("Create a PCB film from a Gerber or Geometry\n"
  3502. "FlatCAM object.\n"
  3503. "The file is saved in SVG format.")
  3504. )
  3505. self.layout.addWidget(self.film_label)
  3506. grid0 = QtWidgets.QGridLayout()
  3507. self.layout.addLayout(grid0)
  3508. self.film_type_radio = RadioSet([{'label': 'Pos', 'value': 'pos'},
  3509. {'label': 'Neg', 'value': 'neg'}])
  3510. ftypelbl = QtWidgets.QLabel('%s:' % _('Film Type'))
  3511. ftypelbl.setToolTip(
  3512. _("Generate a Positive black film or a Negative film.\n"
  3513. "Positive means that it will print the features\n"
  3514. "with black on a white canvas.\n"
  3515. "Negative means that it will print the features\n"
  3516. "with white on a black canvas.\n"
  3517. "The Film format is SVG.")
  3518. )
  3519. grid0.addWidget(ftypelbl, 0, 0)
  3520. grid0.addWidget(self.film_type_radio, 0, 1)
  3521. # Film Color
  3522. self.film_color_label = QtWidgets.QLabel('%s:' % _('Film Color'))
  3523. self.film_color_label.setToolTip(
  3524. _("Set the film color when positive film is selected.")
  3525. )
  3526. self.film_color_entry = FCEntry()
  3527. self.film_color_button = QtWidgets.QPushButton()
  3528. self.film_color_button.setFixedSize(15, 15)
  3529. self.form_box_child = QtWidgets.QHBoxLayout()
  3530. self.form_box_child.setContentsMargins(0, 0, 0, 0)
  3531. self.form_box_child.addWidget(self.film_color_entry)
  3532. self.form_box_child.addWidget(self.film_color_button, alignment=Qt.AlignRight)
  3533. self.form_box_child.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  3534. film_color_widget = QtWidgets.QWidget()
  3535. film_color_widget.setLayout(self.form_box_child)
  3536. grid0.addWidget(self.film_color_label, 1, 0)
  3537. grid0.addWidget(film_color_widget, 1, 1)
  3538. self.film_boundary_entry = FCEntry()
  3539. self.film_boundary_label = QtWidgets.QLabel('%s:' % _("Border"))
  3540. self.film_boundary_label.setToolTip(
  3541. _("Specify a border around the object.\n"
  3542. "Only for negative film.\n"
  3543. "It helps if we use as a Box Object the same \n"
  3544. "object as in Film Object. It will create a thick\n"
  3545. "black bar around the actual print allowing for a\n"
  3546. "better delimitation of the outline features which are of\n"
  3547. "white color like the rest and which may confound with the\n"
  3548. "surroundings if not for this border.")
  3549. )
  3550. grid0.addWidget(self.film_boundary_label, 2, 0)
  3551. grid0.addWidget(self.film_boundary_entry, 2, 1)
  3552. self.film_scale_entry = FCEntry()
  3553. self.film_scale_label = QtWidgets.QLabel('%s:' % _("Scale Stroke"))
  3554. self.film_scale_label.setToolTip(
  3555. _("Scale the line stroke thickness of each feature in the SVG file.\n"
  3556. "It means that the line that envelope each SVG feature will be thicker or thinner,\n"
  3557. "therefore the fine features may be more affected by this parameter.")
  3558. )
  3559. grid0.addWidget(self.film_scale_label, 3, 0)
  3560. grid0.addWidget(self.film_scale_entry, 3, 1)
  3561. self.layout.addStretch()
  3562. class ToolsPanelizePrefGroupUI(OptionsGroupUI):
  3563. def __init__(self, parent=None):
  3564. # OptionsGroupUI.__init__(self, "Cutout Tool Options", parent=parent)
  3565. super(ToolsPanelizePrefGroupUI, self).__init__(self)
  3566. self.setTitle(str(_("Panelize Tool Options")))
  3567. # ## Board cuttout
  3568. self.panelize_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  3569. self.panelize_label.setToolTip(
  3570. _("Create an object that contains an array of (x, y) elements,\n"
  3571. "each element is a copy of the source object spaced\n"
  3572. "at a X distance, Y distance of each other.")
  3573. )
  3574. self.layout.addWidget(self.panelize_label)
  3575. grid0 = QtWidgets.QGridLayout()
  3576. self.layout.addLayout(grid0)
  3577. # ## Spacing Columns
  3578. self.pspacing_columns = FCEntry()
  3579. self.spacing_columns_label = QtWidgets.QLabel('%s:' % _("Spacing cols"))
  3580. self.spacing_columns_label.setToolTip(
  3581. _("Spacing between columns of the desired panel.\n"
  3582. "In current units.")
  3583. )
  3584. grid0.addWidget(self.spacing_columns_label, 0, 0)
  3585. grid0.addWidget(self.pspacing_columns, 0, 1)
  3586. # ## Spacing Rows
  3587. self.pspacing_rows = FCEntry()
  3588. self.spacing_rows_label = QtWidgets.QLabel('%s:' % _("Spacing rows"))
  3589. self.spacing_rows_label.setToolTip(
  3590. _("Spacing between rows of the desired panel.\n"
  3591. "In current units.")
  3592. )
  3593. grid0.addWidget(self.spacing_rows_label, 1, 0)
  3594. grid0.addWidget(self.pspacing_rows, 1, 1)
  3595. # ## Columns
  3596. self.pcolumns = FCEntry()
  3597. self.columns_label = QtWidgets.QLabel('%s:' % _("Columns"))
  3598. self.columns_label.setToolTip(
  3599. _("Number of columns of the desired panel")
  3600. )
  3601. grid0.addWidget(self.columns_label, 2, 0)
  3602. grid0.addWidget(self.pcolumns, 2, 1)
  3603. # ## Rows
  3604. self.prows = FCEntry()
  3605. self.rows_label = QtWidgets.QLabel('%s:' % _("Rows"))
  3606. self.rows_label.setToolTip(
  3607. _("Number of rows of the desired panel")
  3608. )
  3609. grid0.addWidget(self.rows_label, 3, 0)
  3610. grid0.addWidget(self.prows, 3, 1)
  3611. # ## Type of resulting Panel object
  3612. self.panel_type_radio = RadioSet([{'label': _('Gerber'), 'value': 'gerber'},
  3613. {'label': _('Geo'), 'value': 'geometry'}])
  3614. self.panel_type_label = QtWidgets.QLabel('%s:' % _("Panel Type"))
  3615. self.panel_type_label.setToolTip(
  3616. _("Choose the type of object for the panel object:\n"
  3617. "- Gerber\n"
  3618. "- Geometry")
  3619. )
  3620. grid0.addWidget(self.panel_type_label, 4, 0)
  3621. grid0.addWidget(self.panel_type_radio, 4, 1)
  3622. # ## Constrains
  3623. self.pconstrain_cb = FCCheckBox('%s:' % _("Constrain within"))
  3624. self.pconstrain_cb.setToolTip(
  3625. _("Area define by DX and DY within to constrain the panel.\n"
  3626. "DX and DY values are in current units.\n"
  3627. "Regardless of how many columns and rows are desired,\n"
  3628. "the final panel will have as many columns and rows as\n"
  3629. "they fit completely within selected area.")
  3630. )
  3631. grid0.addWidget(self.pconstrain_cb, 5, 0)
  3632. self.px_width_entry = FCEntry()
  3633. self.x_width_lbl = QtWidgets.QLabel('%s:' % _("Width (DX)"))
  3634. self.x_width_lbl.setToolTip(
  3635. _("The width (DX) within which the panel must fit.\n"
  3636. "In current units.")
  3637. )
  3638. grid0.addWidget(self.x_width_lbl, 6, 0)
  3639. grid0.addWidget(self.px_width_entry, 6, 1)
  3640. self.py_height_entry = FCEntry()
  3641. self.y_height_lbl = QtWidgets.QLabel('%s:' % _("Height (DY)"))
  3642. self.y_height_lbl.setToolTip(
  3643. _("The height (DY)within which the panel must fit.\n"
  3644. "In current units.")
  3645. )
  3646. grid0.addWidget(self.y_height_lbl, 7, 0)
  3647. grid0.addWidget(self.py_height_entry, 7, 1)
  3648. self.layout.addStretch()
  3649. class ToolsCalculatorsPrefGroupUI(OptionsGroupUI):
  3650. def __init__(self, parent=None):
  3651. # OptionsGroupUI.__init__(self, "Calculators Tool Options", parent=parent)
  3652. super(ToolsCalculatorsPrefGroupUI, self).__init__(self)
  3653. self.setTitle(str(_("Calculators Tool Options")))
  3654. # ## V-shape Calculator Tool
  3655. self.vshape_tool_label = QtWidgets.QLabel("<b>%s:</b>" % _("V-Shape Tool Calculator"))
  3656. self.vshape_tool_label.setToolTip(
  3657. _("Calculate the tool diameter for a given V-shape tool,\n"
  3658. "having the tip diameter, tip angle and\n"
  3659. "depth-of-cut as parameters.")
  3660. )
  3661. self.layout.addWidget(self.vshape_tool_label)
  3662. grid0 = QtWidgets.QGridLayout()
  3663. self.layout.addLayout(grid0)
  3664. # ## Tip Diameter
  3665. self.tip_dia_entry = FCEntry()
  3666. self.tip_dia_label = QtWidgets.QLabel('%s:' % _("Tip Diameter"))
  3667. self.tip_dia_label.setToolTip(
  3668. _("This is the tool tip diameter.\n"
  3669. "It is specified by manufacturer.")
  3670. )
  3671. grid0.addWidget(self.tip_dia_label, 0, 0)
  3672. grid0.addWidget(self.tip_dia_entry, 0, 1)
  3673. # ## Tip angle
  3674. self.tip_angle_entry = FCEntry()
  3675. self.tip_angle_label = QtWidgets.QLabel('%s:' % _("Tip Angle"))
  3676. self.tip_angle_label.setToolTip(
  3677. _("This is the angle on the tip of the tool.\n"
  3678. "It is specified by manufacturer.")
  3679. )
  3680. grid0.addWidget(self.tip_angle_label, 1, 0)
  3681. grid0.addWidget(self.tip_angle_entry, 1, 1)
  3682. # ## Depth-of-cut Cut Z
  3683. self.cut_z_entry = FCEntry()
  3684. self.cut_z_label = QtWidgets.QLabel('%s:' % _("Cut Z"))
  3685. self.cut_z_label.setToolTip(
  3686. _("This is depth to cut into material.\n"
  3687. "In the CNCJob object it is the CutZ parameter.")
  3688. )
  3689. grid0.addWidget(self.cut_z_label, 2, 0)
  3690. grid0.addWidget(self.cut_z_entry, 2, 1)
  3691. # ## Electroplating Calculator Tool
  3692. self.plate_title_label = QtWidgets.QLabel("<b>%s:</b>" % _("ElectroPlating Calculator"))
  3693. self.plate_title_label.setToolTip(
  3694. _("This calculator is useful for those who plate the via/pad/drill holes,\n"
  3695. "using a method like grahite ink or calcium hypophosphite ink or palladium chloride.")
  3696. )
  3697. self.layout.addWidget(self.plate_title_label)
  3698. grid1 = QtWidgets.QGridLayout()
  3699. self.layout.addLayout(grid1)
  3700. # ## PCB Length
  3701. self.pcblength_entry = FCEntry()
  3702. self.pcblengthlabel = QtWidgets.QLabel('%s:' % _("Board Length"))
  3703. self.pcblengthlabel.setToolTip(_('This is the board length. In centimeters.'))
  3704. grid1.addWidget(self.pcblengthlabel, 0, 0)
  3705. grid1.addWidget(self.pcblength_entry, 0, 1)
  3706. # ## PCB Width
  3707. self.pcbwidth_entry = FCEntry()
  3708. self.pcbwidthlabel = QtWidgets.QLabel('%s:' % _("Board Width"))
  3709. self.pcbwidthlabel.setToolTip(_('This is the board width.In centimeters.'))
  3710. grid1.addWidget(self.pcbwidthlabel, 1, 0)
  3711. grid1.addWidget(self.pcbwidth_entry, 1, 1)
  3712. # ## Current Density
  3713. self.cdensity_label = QtWidgets.QLabel('%s:' % _("Current Density"))
  3714. self.cdensity_entry = FCEntry()
  3715. self.cdensity_label.setToolTip(_("Current density to pass through the board. \n"
  3716. "In Amps per Square Feet ASF."))
  3717. grid1.addWidget(self.cdensity_label, 2, 0)
  3718. grid1.addWidget(self.cdensity_entry, 2, 1)
  3719. # ## PCB Copper Growth
  3720. self.growth_label = QtWidgets.QLabel('%s:' % _("Copper Growth"))
  3721. self.growth_entry = FCEntry()
  3722. self.growth_label.setToolTip(_("How thick the copper growth is intended to be.\n"
  3723. "In microns."))
  3724. grid1.addWidget(self.growth_label, 3, 0)
  3725. grid1.addWidget(self.growth_entry, 3, 1)
  3726. self.layout.addStretch()
  3727. class ToolsTransformPrefGroupUI(OptionsGroupUI):
  3728. def __init__(self, parent=None):
  3729. super(ToolsTransformPrefGroupUI, self).__init__(self)
  3730. self.setTitle(str(_("Transform Tool Options")))
  3731. # ## Transformations
  3732. self.transform_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  3733. self.transform_label.setToolTip(
  3734. _("Various transformations that can be applied\n"
  3735. "on a FlatCAM object.")
  3736. )
  3737. self.layout.addWidget(self.transform_label)
  3738. grid0 = QtWidgets.QGridLayout()
  3739. self.layout.addLayout(grid0)
  3740. # ## Rotate Angle
  3741. self.rotate_entry = FCEntry()
  3742. self.rotate_label = QtWidgets.QLabel('%s:' % _("Rotate Angle"))
  3743. self.rotate_label.setToolTip(
  3744. _("Angle for Rotation action, in degrees.\n"
  3745. "Float number between -360 and 359.\n"
  3746. "Positive numbers for CW motion.\n"
  3747. "Negative numbers for CCW motion.")
  3748. )
  3749. grid0.addWidget(self.rotate_label, 0, 0)
  3750. grid0.addWidget(self.rotate_entry, 0, 1)
  3751. # ## Skew/Shear Angle on X axis
  3752. self.skewx_entry = FCEntry()
  3753. self.skewx_label = QtWidgets.QLabel('%s:' % _("Skew_X angle"))
  3754. self.skewx_label.setToolTip(
  3755. _("Angle for Skew action, in degrees.\n"
  3756. "Float number between -360 and 359.")
  3757. )
  3758. grid0.addWidget(self.skewx_label, 1, 0)
  3759. grid0.addWidget(self.skewx_entry, 1, 1)
  3760. # ## Skew/Shear Angle on Y axis
  3761. self.skewy_entry = FCEntry()
  3762. self.skewy_label = QtWidgets.QLabel('%s:' % _("Skew_Y angle"))
  3763. self.skewy_label.setToolTip(
  3764. _("Angle for Skew action, in degrees.\n"
  3765. "Float number between -360 and 359.")
  3766. )
  3767. grid0.addWidget(self.skewy_label, 2, 0)
  3768. grid0.addWidget(self.skewy_entry, 2, 1)
  3769. # ## Scale factor on X axis
  3770. self.scalex_entry = FCEntry()
  3771. self.scalex_label = QtWidgets.QLabel('%s:' % _("Scale_X factor"))
  3772. self.scalex_label.setToolTip(
  3773. _("Factor for scaling on X axis.")
  3774. )
  3775. grid0.addWidget(self.scalex_label, 3, 0)
  3776. grid0.addWidget(self.scalex_entry, 3, 1)
  3777. # ## Scale factor on X axis
  3778. self.scaley_entry = FCEntry()
  3779. self.scaley_label = QtWidgets.QLabel('%s:' % _("Scale_Y factor"))
  3780. self.scaley_label.setToolTip(
  3781. _("Factor for scaling on Y axis.")
  3782. )
  3783. grid0.addWidget(self.scaley_label, 4, 0)
  3784. grid0.addWidget(self.scaley_entry, 4, 1)
  3785. # ## Link Scale factors
  3786. self.link_cb = FCCheckBox(_("Link"))
  3787. self.link_cb.setToolTip(
  3788. _("Scale the selected object(s)\n"
  3789. "using the Scale_X factor for both axis.")
  3790. )
  3791. grid0.addWidget(self.link_cb, 5, 0)
  3792. # ## Scale Reference
  3793. self.reference_cb = FCCheckBox('%s' % _("Scale Reference"))
  3794. self.reference_cb.setToolTip(
  3795. _("Scale the selected object(s)\n"
  3796. "using the origin reference when checked,\n"
  3797. "and the center of the biggest bounding box\n"
  3798. "of the selected objects when unchecked.")
  3799. )
  3800. grid0.addWidget(self.reference_cb, 5, 1)
  3801. # ## Offset distance on X axis
  3802. self.offx_entry = FCEntry()
  3803. self.offx_label = QtWidgets.QLabel('%s:' % _("Offset_X val"))
  3804. self.offx_label.setToolTip(
  3805. _("Distance to offset on X axis. In current units.")
  3806. )
  3807. grid0.addWidget(self.offx_label, 6, 0)
  3808. grid0.addWidget(self.offx_entry, 6, 1)
  3809. # ## Offset distance on Y axis
  3810. self.offy_entry = FCEntry()
  3811. self.offy_label = QtWidgets.QLabel('%s:' % _("Offset_Y val"))
  3812. self.offy_label.setToolTip(
  3813. _("Distance to offset on Y axis. In current units.")
  3814. )
  3815. grid0.addWidget(self.offy_label, 7, 0)
  3816. grid0.addWidget(self.offy_entry, 7, 1)
  3817. # ## Mirror (Flip) Reference Point
  3818. self.mirror_reference_cb = FCCheckBox('%s' % _("Mirror Reference"))
  3819. self.mirror_reference_cb.setToolTip(
  3820. _("Flip the selected object(s)\n"
  3821. "around the point in Point Entry Field.\n"
  3822. "\n"
  3823. "The point coordinates can be captured by\n"
  3824. "left click on canvas together with pressing\n"
  3825. "SHIFT key. \n"
  3826. "Then click Add button to insert coordinates.\n"
  3827. "Or enter the coords in format (x, y) in the\n"
  3828. "Point Entry field and click Flip on X(Y)"))
  3829. grid0.addWidget(self.mirror_reference_cb, 8, 1)
  3830. self.flip_ref_label = QtWidgets.QLabel('%s:' % _(" Mirror Ref. Point"))
  3831. self.flip_ref_label.setToolTip(
  3832. _("Coordinates in format (x, y) used as reference for mirroring.\n"
  3833. "The 'x' in (x, y) will be used when using Flip on X and\n"
  3834. "the 'y' in (x, y) will be used when using Flip on Y and")
  3835. )
  3836. self.flip_ref_entry = EvalEntry2("(0, 0)")
  3837. grid0.addWidget(self.flip_ref_label, 9, 0)
  3838. grid0.addWidget(self.flip_ref_entry, 9, 1)
  3839. self.layout.addStretch()
  3840. class ToolsSolderpastePrefGroupUI(OptionsGroupUI):
  3841. def __init__(self, parent=None):
  3842. super(ToolsSolderpastePrefGroupUI, self).__init__(self)
  3843. self.setTitle(str(_("SolderPaste Tool Options")))
  3844. # ## Solder Paste Dispensing
  3845. self.solderpastelabel = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  3846. self.solderpastelabel.setToolTip(
  3847. _("A tool to create GCode for dispensing\n"
  3848. "solder paste onto a PCB.")
  3849. )
  3850. self.layout.addWidget(self.solderpastelabel)
  3851. grid0 = QtWidgets.QGridLayout()
  3852. self.layout.addLayout(grid0)
  3853. # Nozzle Tool Diameters
  3854. nozzletdlabel = QtWidgets.QLabel('%s:' % _('Tools dia'))
  3855. nozzletdlabel.setToolTip(
  3856. _("Diameters of nozzle tools, separated by ','")
  3857. )
  3858. self.nozzle_tool_dia_entry = FCEntry()
  3859. grid0.addWidget(nozzletdlabel, 0, 0)
  3860. grid0.addWidget(self.nozzle_tool_dia_entry, 0, 1)
  3861. # New Nozzle Tool Dia
  3862. self.addtool_entry_lbl = QtWidgets.QLabel('<b>%s:</b>' % _('New Nozzle Dia'))
  3863. self.addtool_entry_lbl.setToolTip(
  3864. _("Diameter for the new Nozzle tool to add in the Tool Table")
  3865. )
  3866. self.addtool_entry = FCEntry()
  3867. grid0.addWidget(self.addtool_entry_lbl, 1, 0)
  3868. grid0.addWidget(self.addtool_entry, 1, 1)
  3869. # Z dispense start
  3870. self.z_start_entry = FCEntry()
  3871. self.z_start_label = QtWidgets.QLabel('%s:' % _("Z Dispense Start"))
  3872. self.z_start_label.setToolTip(
  3873. _("The height (Z) when solder paste dispensing starts.")
  3874. )
  3875. grid0.addWidget(self.z_start_label, 2, 0)
  3876. grid0.addWidget(self.z_start_entry, 2, 1)
  3877. # Z dispense
  3878. self.z_dispense_entry = FCEntry()
  3879. self.z_dispense_label = QtWidgets.QLabel('%s:' % _("Z Dispense"))
  3880. self.z_dispense_label.setToolTip(
  3881. _("The height (Z) when doing solder paste dispensing.")
  3882. )
  3883. grid0.addWidget(self.z_dispense_label, 3, 0)
  3884. grid0.addWidget(self.z_dispense_entry, 3, 1)
  3885. # Z dispense stop
  3886. self.z_stop_entry = FCEntry()
  3887. self.z_stop_label = QtWidgets.QLabel('%s:' % _("Z Dispense Stop"))
  3888. self.z_stop_label.setToolTip(
  3889. _("The height (Z) when solder paste dispensing stops.")
  3890. )
  3891. grid0.addWidget(self.z_stop_label, 4, 0)
  3892. grid0.addWidget(self.z_stop_entry, 4, 1)
  3893. # Z travel
  3894. self.z_travel_entry = FCEntry()
  3895. self.z_travel_label = QtWidgets.QLabel('%s:' % _("Z Travel"))
  3896. self.z_travel_label.setToolTip(
  3897. _("The height (Z) for travel between pads\n"
  3898. "(without dispensing solder paste).")
  3899. )
  3900. grid0.addWidget(self.z_travel_label, 5, 0)
  3901. grid0.addWidget(self.z_travel_entry, 5, 1)
  3902. # Z toolchange location
  3903. self.z_toolchange_entry = FCEntry()
  3904. self.z_toolchange_label = QtWidgets.QLabel('%s:' % _("Z Toolchange"))
  3905. self.z_toolchange_label.setToolTip(
  3906. _("The height (Z) for tool (nozzle) change.")
  3907. )
  3908. grid0.addWidget(self.z_toolchange_label, 6, 0)
  3909. grid0.addWidget(self.z_toolchange_entry, 6, 1)
  3910. # X,Y Toolchange location
  3911. self.xy_toolchange_entry = FCEntry()
  3912. self.xy_toolchange_label = QtWidgets.QLabel('%s:' % _("Toolchange X-Y"))
  3913. self.xy_toolchange_label.setToolTip(
  3914. _("The X,Y location for tool (nozzle) change.\n"
  3915. "The format is (x, y) where x and y are real numbers.")
  3916. )
  3917. grid0.addWidget(self.xy_toolchange_label, 7, 0)
  3918. grid0.addWidget(self.xy_toolchange_entry, 7, 1)
  3919. # Feedrate X-Y
  3920. self.frxy_entry = FCEntry()
  3921. self.frxy_label = QtWidgets.QLabel('%s:' % _("Feedrate X-Y"))
  3922. self.frxy_label.setToolTip(
  3923. _("Feedrate (speed) while moving on the X-Y plane.")
  3924. )
  3925. grid0.addWidget(self.frxy_label, 8, 0)
  3926. grid0.addWidget(self.frxy_entry, 8, 1)
  3927. # Feedrate Z
  3928. self.frz_entry = FCEntry()
  3929. self.frz_label = QtWidgets.QLabel('%s:' % _("Feedrate Z"))
  3930. self.frz_label.setToolTip(
  3931. _("Feedrate (speed) while moving vertically\n"
  3932. "(on Z plane).")
  3933. )
  3934. grid0.addWidget(self.frz_label, 9, 0)
  3935. grid0.addWidget(self.frz_entry, 9, 1)
  3936. # Feedrate Z Dispense
  3937. self.frz_dispense_entry = FCEntry()
  3938. self.frz_dispense_label = QtWidgets.QLabel('%s:' % _("Feedrate Z Dispense"))
  3939. self.frz_dispense_label.setToolTip(
  3940. _("Feedrate (speed) while moving up vertically\n"
  3941. "to Dispense position (on Z plane).")
  3942. )
  3943. grid0.addWidget(self.frz_dispense_label, 10, 0)
  3944. grid0.addWidget(self.frz_dispense_entry, 10, 1)
  3945. # Spindle Speed Forward
  3946. self.speedfwd_entry = FCEntry()
  3947. self.speedfwd_label = QtWidgets.QLabel('%s:' % _("Spindle Speed FWD"))
  3948. self.speedfwd_label.setToolTip(
  3949. _("The dispenser speed while pushing solder paste\n"
  3950. "through the dispenser nozzle.")
  3951. )
  3952. grid0.addWidget(self.speedfwd_label, 11, 0)
  3953. grid0.addWidget(self.speedfwd_entry, 11, 1)
  3954. # Dwell Forward
  3955. self.dwellfwd_entry = FCEntry()
  3956. self.dwellfwd_label = QtWidgets.QLabel('%s:' % _("Dwell FWD"))
  3957. self.dwellfwd_label.setToolTip(
  3958. _("Pause after solder dispensing.")
  3959. )
  3960. grid0.addWidget(self.dwellfwd_label, 12, 0)
  3961. grid0.addWidget(self.dwellfwd_entry, 12, 1)
  3962. # Spindle Speed Reverse
  3963. self.speedrev_entry = FCEntry()
  3964. self.speedrev_label = QtWidgets.QLabel('%s:' % _("Spindle Speed REV"))
  3965. self.speedrev_label.setToolTip(
  3966. _("The dispenser speed while retracting solder paste\n"
  3967. "through the dispenser nozzle.")
  3968. )
  3969. grid0.addWidget(self.speedrev_label, 13, 0)
  3970. grid0.addWidget(self.speedrev_entry, 13, 1)
  3971. # Dwell Reverse
  3972. self.dwellrev_entry = FCEntry()
  3973. self.dwellrev_label = QtWidgets.QLabel('%s:' % _("Dwell REV"))
  3974. self.dwellrev_label.setToolTip(
  3975. _("Pause after solder paste dispenser retracted,\n"
  3976. "to allow pressure equilibrium.")
  3977. )
  3978. grid0.addWidget(self.dwellrev_label, 14, 0)
  3979. grid0.addWidget(self.dwellrev_entry, 14, 1)
  3980. # Postprocessors
  3981. pp_label = QtWidgets.QLabel('%s:' % _('PostProcessor'))
  3982. pp_label.setToolTip(
  3983. _("Files that control the GCode generation.")
  3984. )
  3985. self.pp_combo = FCComboBox()
  3986. grid0.addWidget(pp_label, 15, 0)
  3987. grid0.addWidget(self.pp_combo, 15, 1)
  3988. self.layout.addStretch()
  3989. class ToolsSubPrefGroupUI(OptionsGroupUI):
  3990. def __init__(self, parent=None):
  3991. super(ToolsSubPrefGroupUI, self).__init__(self)
  3992. self.setTitle(str(_("Substractor Tool Options")))
  3993. # ## Solder Paste Dispensing
  3994. self.sublabel = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  3995. self.sublabel.setToolTip(
  3996. _("A tool to substract one Gerber or Geometry object\n"
  3997. "from another of the same type.")
  3998. )
  3999. self.layout.addWidget(self.sublabel)
  4000. self.close_paths_cb = FCCheckBox(_("Close paths"))
  4001. self.close_paths_cb.setToolTip(_("Checking this will close the paths cut by the Geometry substractor object."))
  4002. self.layout.addWidget(self.close_paths_cb)
  4003. self.layout.addStretch()
  4004. class FAExcPrefGroupUI(OptionsGroupUI):
  4005. def __init__(self, parent=None):
  4006. # OptionsGroupUI.__init__(self, "Excellon File associations Preferences", parent=None)
  4007. super().__init__(self)
  4008. self.setTitle(str(_("Excellon File associations")))
  4009. self.layout.setContentsMargins(2, 2, 2, 2)
  4010. self.vertical_lay = QtWidgets.QVBoxLayout()
  4011. scroll_widget = QtWidgets.QWidget()
  4012. scroll = VerticalScrollArea()
  4013. scroll.setWidget(scroll_widget)
  4014. scroll.setWidgetResizable(True)
  4015. scroll.setFrameShape(QtWidgets.QFrame.NoFrame)
  4016. self.restore_btn = FCButton(_("Restore"))
  4017. self.restore_btn.setToolTip(_("Restore the extension list to the default state."))
  4018. self.del_all_btn = FCButton(_("Delete All"))
  4019. self.del_all_btn.setToolTip(_("Delete all extensions from the list."))
  4020. hlay0 = QtWidgets.QHBoxLayout()
  4021. hlay0.addWidget(self.restore_btn)
  4022. hlay0.addWidget(self.del_all_btn)
  4023. self.vertical_lay.addLayout(hlay0)
  4024. # # ## Excellon associations
  4025. list_label = QtWidgets.QLabel("<b>%s:</b>" % _("Extensions list"))
  4026. list_label.setToolTip(
  4027. _("List of file extensions to be\n"
  4028. "associated with FlatCAM.")
  4029. )
  4030. self.vertical_lay.addWidget(list_label)
  4031. settings = QSettings("Open Source", "FlatCAM")
  4032. if settings.contains("textbox_font_size"):
  4033. tb_fsize = settings.value('textbox_font_size', type=int)
  4034. else:
  4035. tb_fsize = 10
  4036. self.exc_list_text = FCTextArea()
  4037. self.exc_list_text.setReadOnly(True)
  4038. # self.exc_list_text.sizeHint(custom_sizehint=150)
  4039. font = QtGui.QFont()
  4040. font.setPointSize(tb_fsize)
  4041. self.exc_list_text.setFont(font)
  4042. self.vertical_lay.addWidget(self.exc_list_text)
  4043. self.ext_label = QtWidgets.QLabel('%s:' % _("Extension"))
  4044. self.ext_label.setToolTip(_("A file extension to be added or deleted to the list."))
  4045. self.ext_entry = FCEntry()
  4046. hlay1 = QtWidgets.QHBoxLayout()
  4047. self.vertical_lay.addLayout(hlay1)
  4048. hlay1.addWidget(self.ext_label)
  4049. hlay1.addWidget(self.ext_entry)
  4050. self.add_btn = FCButton(_("Add Extension"))
  4051. self.add_btn.setToolTip(_("Add a file extension to the list"))
  4052. self.del_btn = FCButton(_("Delete Extension"))
  4053. self.del_btn.setToolTip(_("Delete a file extension from the list"))
  4054. hlay2 = QtWidgets.QHBoxLayout()
  4055. self.vertical_lay.addLayout(hlay2)
  4056. hlay2.addWidget(self.add_btn)
  4057. hlay2.addWidget(self.del_btn)
  4058. self.exc_list_btn = FCButton(_("Apply Association"))
  4059. self.exc_list_btn.setToolTip(_("Apply the file associations between\n"
  4060. "FlatCAM and the files with above extensions.\n"
  4061. "They will be active after next logon.\n"
  4062. "This work only in Windows."))
  4063. self.vertical_lay.addWidget(self.exc_list_btn)
  4064. scroll_widget.setLayout(self.vertical_lay)
  4065. self.layout.addWidget(scroll)
  4066. # self.vertical_lay.addStretch()
  4067. class FAGcoPrefGroupUI(OptionsGroupUI):
  4068. def __init__(self, parent=None):
  4069. # OptionsGroupUI.__init__(self, "Gcode File associations Preferences", parent=None)
  4070. super(FAGcoPrefGroupUI, self).__init__(self)
  4071. self.setTitle(str(_("GCode File associations")))
  4072. self.restore_btn = FCButton(_("Restore"))
  4073. self.restore_btn.setToolTip(_("Restore the extension list to the default state."))
  4074. self.del_all_btn = FCButton(_("Delete All"))
  4075. self.del_all_btn.setToolTip(_("Delete all extensions from the list."))
  4076. hlay0 = QtWidgets.QHBoxLayout()
  4077. self.layout.addLayout(hlay0)
  4078. hlay0.addWidget(self.restore_btn)
  4079. hlay0.addWidget(self.del_all_btn)
  4080. # ## G-Code associations
  4081. self.gco_list_label = QtWidgets.QLabel("<b>%s:</b>" % _("Extensions list"))
  4082. self.gco_list_label.setToolTip(
  4083. _("List of file extensions to be\n"
  4084. "associated with FlatCAM.")
  4085. )
  4086. self.layout.addWidget(self.gco_list_label)
  4087. settings = QSettings("Open Source", "FlatCAM")
  4088. if settings.contains("textbox_font_size"):
  4089. tb_fsize = settings.value('textbox_font_size', type=int)
  4090. else:
  4091. tb_fsize = 10
  4092. self.gco_list_text = FCTextArea()
  4093. self.gco_list_text.setReadOnly(True)
  4094. # self.gco_list_text.sizeHint(custom_sizehint=150)
  4095. font = QtGui.QFont()
  4096. font.setPointSize(tb_fsize)
  4097. self.gco_list_text.setFont(font)
  4098. self.layout.addWidget(self.gco_list_text)
  4099. self.ext_label = QtWidgets.QLabel('%s:' % _("Extension"))
  4100. self.ext_label.setToolTip(_("A file extension to be added or deleted to the list."))
  4101. self.ext_entry = FCEntry()
  4102. hlay1 = QtWidgets.QHBoxLayout()
  4103. self.layout.addLayout(hlay1)
  4104. hlay1.addWidget(self.ext_label)
  4105. hlay1.addWidget(self.ext_entry)
  4106. self.add_btn = FCButton(_("Add Extension"))
  4107. self.add_btn.setToolTip(_("Add a file extension to the list"))
  4108. self.del_btn = FCButton(_("Delete Extension"))
  4109. self.del_btn.setToolTip(_("Delete a file extension from the list"))
  4110. hlay2 = QtWidgets.QHBoxLayout()
  4111. self.layout.addLayout(hlay2)
  4112. hlay2.addWidget(self.add_btn)
  4113. hlay2.addWidget(self.del_btn)
  4114. self.gco_list_btn = FCButton(_("Apply Association"))
  4115. self.gco_list_btn.setToolTip(_("Apply the file associations between\n"
  4116. "FlatCAM and the files with above extensions.\n"
  4117. "They will be active after next logon.\n"
  4118. "This work only in Windows."))
  4119. self.layout.addWidget(self.gco_list_btn)
  4120. # self.layout.addStretch()
  4121. class FAGrbPrefGroupUI(OptionsGroupUI):
  4122. def __init__(self, parent=None):
  4123. # OptionsGroupUI.__init__(self, "Gerber File associations Preferences", parent=None)
  4124. super(FAGrbPrefGroupUI, self).__init__(self)
  4125. self.setTitle(str(_("Gerber File associations")))
  4126. self.restore_btn = FCButton(_("Restore"))
  4127. self.restore_btn.setToolTip(_("Restore the extension list to the default state."))
  4128. self.del_all_btn = FCButton(_("Delete All"))
  4129. self.del_all_btn.setToolTip(_("Delete all extensions from the list."))
  4130. hlay0 = QtWidgets.QHBoxLayout()
  4131. self.layout.addLayout(hlay0)
  4132. hlay0.addWidget(self.restore_btn)
  4133. hlay0.addWidget(self.del_all_btn)
  4134. # ## Gerber associations
  4135. self.grb_list_label = QtWidgets.QLabel("<b>%s:</b>" % _("Extensions list"))
  4136. self.grb_list_label.setToolTip(
  4137. _("List of file extensions to be\n"
  4138. "associated with FlatCAM.")
  4139. )
  4140. self.layout.addWidget(self.grb_list_label)
  4141. settings = QSettings("Open Source", "FlatCAM")
  4142. if settings.contains("textbox_font_size"):
  4143. tb_fsize = settings.value('textbox_font_size', type=int)
  4144. else:
  4145. tb_fsize = 10
  4146. self.grb_list_text = FCTextArea()
  4147. self.grb_list_text.setReadOnly(True)
  4148. # self.grb_list_text.sizeHint(custom_sizehint=150)
  4149. self.layout.addWidget(self.grb_list_text)
  4150. font = QtGui.QFont()
  4151. font.setPointSize(tb_fsize)
  4152. self.grb_list_text.setFont(font)
  4153. self.ext_label = QtWidgets.QLabel('%s:' % _("Extension"))
  4154. self.ext_label.setToolTip(_("A file extension to be added or deleted to the list."))
  4155. self.ext_entry = FCEntry()
  4156. hlay1 = QtWidgets.QHBoxLayout()
  4157. self.layout.addLayout(hlay1)
  4158. hlay1.addWidget(self.ext_label)
  4159. hlay1.addWidget(self.ext_entry)
  4160. self.add_btn = FCButton(_("Add Extension"))
  4161. self.add_btn.setToolTip(_("Add a file extension to the list"))
  4162. self.del_btn = FCButton(_("Delete Extension"))
  4163. self.del_btn.setToolTip(_("Delete a file extension from the list"))
  4164. hlay2 = QtWidgets.QHBoxLayout()
  4165. self.layout.addLayout(hlay2)
  4166. hlay2.addWidget(self.add_btn)
  4167. hlay2.addWidget(self.del_btn)
  4168. self.grb_list_btn = FCButton(_("Apply Association"))
  4169. self.grb_list_btn.setToolTip(_("Apply the file associations between\n"
  4170. "FlatCAM and the files with above extensions.\n"
  4171. "They will be active after next logon.\n"
  4172. "This work only in Windows."))
  4173. self.layout.addWidget(self.grb_list_btn)
  4174. # self.layout.addStretch()
  4175. class AutoCompletePrefGroupUI(OptionsGroupUI):
  4176. def __init__(self, parent=None):
  4177. # OptionsGroupUI.__init__(self, "Gerber File associations Preferences", parent=None)
  4178. super().__init__(self, parent=parent)
  4179. self.setTitle(str(_("Autocompleter Keywords")))
  4180. self.restore_btn = FCButton(_("Restore"))
  4181. self.restore_btn.setToolTip(_("Restore the autocompleter keywords list to the default state."))
  4182. self.del_all_btn = FCButton(_("Delete All"))
  4183. self.del_all_btn.setToolTip(_("Delete all autocompleter keywords from the list."))
  4184. hlay0 = QtWidgets.QHBoxLayout()
  4185. self.layout.addLayout(hlay0)
  4186. hlay0.addWidget(self.restore_btn)
  4187. hlay0.addWidget(self.del_all_btn)
  4188. # ## Gerber associations
  4189. self.grb_list_label = QtWidgets.QLabel("<b>%s:</b>" % _("Keywords list"))
  4190. self.grb_list_label.setToolTip(
  4191. _("List of keywords used by\n"
  4192. "the autocompleter in FlatCAM.\n"
  4193. "The autocompleter is installed\n"
  4194. "in the Code Editor and for the Tcl Shell.")
  4195. )
  4196. self.layout.addWidget(self.grb_list_label)
  4197. settings = QSettings("Open Source", "FlatCAM")
  4198. if settings.contains("textbox_font_size"):
  4199. tb_fsize = settings.value('textbox_font_size', type=int)
  4200. else:
  4201. tb_fsize = 10
  4202. self.kw_list_text = FCTextArea()
  4203. self.kw_list_text.setReadOnly(True)
  4204. # self.grb_list_text.sizeHint(custom_sizehint=150)
  4205. self.layout.addWidget(self.kw_list_text)
  4206. font = QtGui.QFont()
  4207. font.setPointSize(tb_fsize)
  4208. self.kw_list_text.setFont(font)
  4209. self.kw_label = QtWidgets.QLabel('%s:' % _("Extension"))
  4210. self.kw_label.setToolTip(_("A keyword to be added or deleted to the list."))
  4211. self.kw_entry = FCEntry()
  4212. hlay1 = QtWidgets.QHBoxLayout()
  4213. self.layout.addLayout(hlay1)
  4214. hlay1.addWidget(self.kw_label)
  4215. hlay1.addWidget(self.kw_entry)
  4216. self.add_btn = FCButton(_("Add keyword"))
  4217. self.add_btn.setToolTip(_("Add a keyword to the list"))
  4218. self.del_btn = FCButton(_("Delete keyword"))
  4219. self.del_btn.setToolTip(_("Delete a keyword from the list"))
  4220. hlay2 = QtWidgets.QHBoxLayout()
  4221. self.layout.addLayout(hlay2)
  4222. hlay2.addWidget(self.add_btn)
  4223. hlay2.addWidget(self.del_btn)
  4224. # self.layout.addStretch()