PreferencesUI.py 285 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005
  1. # ##########################################################
  2. # FlatCAM: 2D Post-processing for Manufacturing #
  3. # File Author: Marius Adrian Stanciu (c) #
  4. # Date: 10/10/2019 #
  5. # MIT Licence #
  6. # ##########################################################
  7. from PyQt5.QtCore import QSettings
  8. from flatcamGUI.GUIElements import *
  9. import platform
  10. import sys
  11. import gettext
  12. import FlatCAMTranslation as fcTranslate
  13. import builtins
  14. fcTranslate.apply_language('strings')
  15. if '_' not in builtins.__dict__:
  16. _ = gettext.gettext
  17. settings = QtCore.QSettings("Open Source", "FlatCAM")
  18. if settings.contains("machinist"):
  19. machinist_setting = settings.value('machinist', type=int)
  20. else:
  21. machinist_setting = 0
  22. class OptionsGroupUI(QtWidgets.QGroupBox):
  23. def __init__(self, title, parent=None):
  24. # QtGui.QGroupBox.__init__(self, title, parent=parent)
  25. super(OptionsGroupUI, self).__init__()
  26. self.setStyleSheet("""
  27. QGroupBox
  28. {
  29. font-size: 16px;
  30. font-weight: bold;
  31. }
  32. """)
  33. self.layout = QtWidgets.QVBoxLayout()
  34. self.setLayout(self.layout)
  35. class GeneralPreferencesUI(QtWidgets.QWidget):
  36. def __init__(self, decimals, parent=None):
  37. QtWidgets.QWidget.__init__(self, parent=parent)
  38. self.layout = QtWidgets.QHBoxLayout()
  39. self.setLayout(self.layout)
  40. self.decimals = decimals
  41. self.general_app_group = GeneralAppPrefGroupUI(decimals=self.decimals)
  42. self.general_app_group.setMinimumWidth(290)
  43. self.general_gui_group = GeneralGUIPrefGroupUI(decimals=self.decimals)
  44. self.general_gui_group.setMinimumWidth(250)
  45. self.general_gui_set_group = GeneralGUISetGroupUI(decimals=self.decimals)
  46. self.general_gui_set_group.setMinimumWidth(250)
  47. self.layout.addWidget(self.general_app_group)
  48. self.layout.addWidget(self.general_gui_group)
  49. self.layout.addWidget(self.general_gui_set_group)
  50. self.layout.addStretch()
  51. class GerberPreferencesUI(QtWidgets.QWidget):
  52. def __init__(self, decimals, parent=None):
  53. QtWidgets.QWidget.__init__(self, parent=parent)
  54. self.layout = QtWidgets.QHBoxLayout()
  55. self.setLayout(self.layout)
  56. self.decimals = decimals
  57. self.gerber_gen_group = GerberGenPrefGroupUI(decimals=self.decimals)
  58. self.gerber_gen_group.setMinimumWidth(250)
  59. self.gerber_opt_group = GerberOptPrefGroupUI(decimals=self.decimals)
  60. self.gerber_opt_group.setMinimumWidth(250)
  61. self.gerber_exp_group = GerberExpPrefGroupUI(decimals=self.decimals)
  62. self.gerber_exp_group.setMinimumWidth(230)
  63. self.gerber_adv_opt_group = GerberAdvOptPrefGroupUI(decimals=self.decimals)
  64. self.gerber_adv_opt_group.setMinimumWidth(200)
  65. self.gerber_editor_group = GerberEditorPrefGroupUI(decimals=self.decimals)
  66. self.gerber_editor_group.setMinimumWidth(200)
  67. self.vlay = QtWidgets.QVBoxLayout()
  68. self.vlay.addWidget(self.gerber_opt_group)
  69. self.vlay.addWidget(self.gerber_exp_group)
  70. self.layout.addWidget(self.gerber_gen_group)
  71. self.layout.addLayout(self.vlay)
  72. self.layout.addWidget(self.gerber_adv_opt_group)
  73. self.layout.addWidget(self.gerber_editor_group)
  74. self.layout.addStretch()
  75. class ExcellonPreferencesUI(QtWidgets.QWidget):
  76. def __init__(self, decimals, parent=None):
  77. QtWidgets.QWidget.__init__(self, parent=parent)
  78. self.layout = QtWidgets.QHBoxLayout()
  79. self.setLayout(self.layout)
  80. self.decimals = decimals
  81. self.excellon_gen_group = ExcellonGenPrefGroupUI(decimals=self.decimals)
  82. self.excellon_gen_group.setMinimumWidth(220)
  83. self.excellon_opt_group = ExcellonOptPrefGroupUI(decimals=self.decimals)
  84. self.excellon_opt_group.setMinimumWidth(290)
  85. self.excellon_exp_group = ExcellonExpPrefGroupUI(decimals=self.decimals)
  86. self.excellon_exp_group.setMinimumWidth(250)
  87. self.excellon_adv_opt_group = ExcellonAdvOptPrefGroupUI(decimals=self.decimals)
  88. self.excellon_adv_opt_group.setMinimumWidth(250)
  89. self.excellon_editor_group = ExcellonEditorPrefGroupUI(decimals=self.decimals)
  90. self.excellon_editor_group.setMinimumWidth(260)
  91. self.vlay = QtWidgets.QVBoxLayout()
  92. self.vlay.addWidget(self.excellon_opt_group)
  93. self.vlay.addWidget(self.excellon_exp_group)
  94. self.layout.addWidget(self.excellon_gen_group)
  95. self.layout.addLayout(self.vlay)
  96. self.layout.addWidget(self.excellon_adv_opt_group)
  97. self.layout.addWidget(self.excellon_editor_group)
  98. self.layout.addStretch()
  99. class GeometryPreferencesUI(QtWidgets.QWidget):
  100. def __init__(self, decimals, parent=None):
  101. QtWidgets.QWidget.__init__(self, parent=parent)
  102. self.layout = QtWidgets.QHBoxLayout()
  103. self.setLayout(self.layout)
  104. self.decimals = decimals
  105. self.geometry_gen_group = GeometryGenPrefGroupUI(decimals=self.decimals)
  106. self.geometry_gen_group.setMinimumWidth(220)
  107. self.geometry_opt_group = GeometryOptPrefGroupUI(decimals=self.decimals)
  108. self.geometry_opt_group.setMinimumWidth(300)
  109. self.geometry_adv_opt_group = GeometryAdvOptPrefGroupUI(decimals=self.decimals)
  110. self.geometry_adv_opt_group.setMinimumWidth(270)
  111. self.geometry_editor_group = GeometryEditorPrefGroupUI(decimals=self.decimals)
  112. self.geometry_editor_group.setMinimumWidth(250)
  113. self.layout.addWidget(self.geometry_gen_group)
  114. self.layout.addWidget(self.geometry_opt_group)
  115. self.layout.addWidget(self.geometry_adv_opt_group)
  116. self.layout.addWidget(self.geometry_editor_group)
  117. self.layout.addStretch()
  118. class ToolsPreferencesUI(QtWidgets.QWidget):
  119. def __init__(self, decimals, parent=None):
  120. QtWidgets.QWidget.__init__(self, parent=parent)
  121. self.layout = QtWidgets.QHBoxLayout()
  122. self.setLayout(self.layout)
  123. self.decimals = decimals
  124. self.tools_ncc_group = ToolsNCCPrefGroupUI(decimals=self.decimals)
  125. self.tools_ncc_group.setMinimumWidth(220)
  126. self.tools_paint_group = ToolsPaintPrefGroupUI(decimals=self.decimals)
  127. self.tools_paint_group.setMinimumWidth(220)
  128. self.tools_cutout_group = ToolsCutoutPrefGroupUI(decimals=self.decimals)
  129. self.tools_cutout_group.setMinimumWidth(220)
  130. self.tools_2sided_group = Tools2sidedPrefGroupUI(decimals=self.decimals)
  131. self.tools_2sided_group.setMinimumWidth(220)
  132. self.tools_film_group = ToolsFilmPrefGroupUI(decimals=self.decimals)
  133. self.tools_film_group.setMinimumWidth(220)
  134. self.tools_panelize_group = ToolsPanelizePrefGroupUI(decimals=self.decimals)
  135. self.tools_panelize_group.setMinimumWidth(220)
  136. self.tools_calculators_group = ToolsCalculatorsPrefGroupUI(decimals=self.decimals)
  137. self.tools_calculators_group.setMinimumWidth(220)
  138. self.tools_transform_group = ToolsTransformPrefGroupUI(decimals=self.decimals)
  139. self.tools_transform_group.setMinimumWidth(200)
  140. self.tools_solderpaste_group = ToolsSolderpastePrefGroupUI(decimals=self.decimals)
  141. self.tools_solderpaste_group.setMinimumWidth(200)
  142. self.tools_sub_group = ToolsSubPrefGroupUI(decimals=self.decimals)
  143. self.tools_sub_group.setMinimumWidth(200)
  144. self.vlay = QtWidgets.QVBoxLayout()
  145. self.vlay.addWidget(self.tools_ncc_group)
  146. self.vlay.addWidget(self.tools_paint_group)
  147. self.vlay1 = QtWidgets.QVBoxLayout()
  148. self.vlay1.addWidget(self.tools_cutout_group)
  149. self.vlay1.addWidget(self.tools_transform_group)
  150. self.vlay1.addWidget(self.tools_2sided_group)
  151. self.vlay2 = QtWidgets.QVBoxLayout()
  152. self.vlay2.addWidget(self.tools_panelize_group)
  153. self.vlay2.addWidget(self.tools_sub_group)
  154. self.vlay2.addWidget(self.tools_film_group)
  155. self.vlay3 = QtWidgets.QVBoxLayout()
  156. self.vlay3.addWidget(self.tools_solderpaste_group)
  157. self.vlay3.addWidget(self.tools_calculators_group)
  158. self.layout.addLayout(self.vlay)
  159. self.layout.addLayout(self.vlay1)
  160. self.layout.addLayout(self.vlay2)
  161. self.layout.addLayout(self.vlay3)
  162. self.layout.addStretch()
  163. class Tools2PreferencesUI(QtWidgets.QWidget):
  164. def __init__(self, decimals, parent=None):
  165. QtWidgets.QWidget.__init__(self, parent=parent)
  166. self.layout = QtWidgets.QHBoxLayout()
  167. self.setLayout(self.layout)
  168. self.decimals = decimals
  169. self.tools2_checkrules_group = Tools2RulesCheckPrefGroupUI(decimals=self.decimals)
  170. self.tools2_checkrules_group.setMinimumWidth(220)
  171. self.tools2_optimal_group = Tools2OptimalPrefGroupUI(decimals=self.decimals)
  172. self.tools2_optimal_group.setMinimumWidth(220)
  173. self.tools2_qrcode_group = Tools2QRCodePrefGroupUI(decimals=self.decimals)
  174. self.tools2_qrcode_group.setMinimumWidth(220)
  175. self.tools2_cfill_group = Tools2CThievingPrefGroupUI(decimals=self.decimals)
  176. self.tools2_cfill_group.setMinimumWidth(220)
  177. self.tools2_fiducials_group = Tools2FiducialsPrefGroupUI(decimals=self.decimals)
  178. self.tools2_fiducials_group.setMinimumWidth(220)
  179. self.tools2_cal_group = Tools2CalPrefGroupUI(decimals=self.decimals)
  180. self.tools2_cal_group.setMinimumWidth(220)
  181. self.vlay = QtWidgets.QVBoxLayout()
  182. self.vlay.addWidget(self.tools2_checkrules_group)
  183. self.vlay.addWidget(self.tools2_optimal_group)
  184. self.vlay1 = QtWidgets.QVBoxLayout()
  185. self.vlay1.addWidget(self.tools2_qrcode_group)
  186. self.vlay2 = QtWidgets.QVBoxLayout()
  187. self.vlay2.addWidget(self.tools2_cfill_group)
  188. self.vlay3 = QtWidgets.QVBoxLayout()
  189. self.vlay3.addWidget(self.tools2_fiducials_group)
  190. self.vlay3.addWidget(self.tools2_cal_group)
  191. self.layout.addLayout(self.vlay)
  192. self.layout.addLayout(self.vlay1)
  193. self.layout.addLayout(self.vlay2)
  194. self.layout.addLayout(self.vlay3)
  195. self.layout.addStretch()
  196. class CNCJobPreferencesUI(QtWidgets.QWidget):
  197. def __init__(self, decimals, parent=None):
  198. QtWidgets.QWidget.__init__(self, parent=parent)
  199. self.layout = QtWidgets.QHBoxLayout()
  200. self.setLayout(self.layout)
  201. self.decimals = decimals
  202. self.cncjob_gen_group = CNCJobGenPrefGroupUI(decimals=self.decimals)
  203. self.cncjob_gen_group.setMinimumWidth(320)
  204. self.cncjob_opt_group = CNCJobOptPrefGroupUI(decimals=self.decimals)
  205. self.cncjob_opt_group.setMinimumWidth(260)
  206. self.cncjob_adv_opt_group = CNCJobAdvOptPrefGroupUI(decimals=self.decimals)
  207. self.cncjob_adv_opt_group.setMinimumWidth(260)
  208. self.layout.addWidget(self.cncjob_gen_group)
  209. self.layout.addWidget(self.cncjob_opt_group)
  210. self.layout.addWidget(self.cncjob_adv_opt_group)
  211. self.layout.addStretch()
  212. class UtilPreferencesUI(QtWidgets.QWidget):
  213. def __init__(self, decimals, parent=None):
  214. QtWidgets.QWidget.__init__(self, parent=parent)
  215. self.layout = QtWidgets.QHBoxLayout()
  216. self.setLayout(self.layout)
  217. self.decimals = decimals
  218. self.vlay = QtWidgets.QVBoxLayout()
  219. self.fa_excellon_group = FAExcPrefGroupUI(decimals=self.decimals)
  220. self.fa_excellon_group.setMinimumWidth(260)
  221. self.fa_gcode_group = FAGcoPrefGroupUI(decimals=self.decimals)
  222. self.fa_gcode_group.setMinimumWidth(260)
  223. self.vlay.addWidget(self.fa_excellon_group)
  224. self.vlay.addWidget(self.fa_gcode_group)
  225. self.fa_gerber_group = FAGrbPrefGroupUI(decimals=self.decimals)
  226. self.fa_gerber_group.setMinimumWidth(260)
  227. self.kw_group = AutoCompletePrefGroupUI(decimals=self.decimals)
  228. self.kw_group.setMinimumWidth(260)
  229. self.layout.addLayout(self.vlay)
  230. self.layout.addWidget(self.fa_gerber_group)
  231. self.layout.addWidget(self.kw_group)
  232. self.layout.addStretch()
  233. class GeneralGUIPrefGroupUI(OptionsGroupUI):
  234. def __init__(self, decimals=4, parent=None):
  235. super(GeneralGUIPrefGroupUI, self).__init__(self)
  236. self.setTitle(str(_("GUI Preferences")))
  237. self.decimals = decimals
  238. # Create a form layout for the Application general settings
  239. self.form_box = QtWidgets.QFormLayout()
  240. # Grid X Entry
  241. self.gridx_label = QtWidgets.QLabel('%s:' % _('Grid X value'))
  242. self.gridx_label.setToolTip(
  243. _("This is the Grid snap value on X axis.")
  244. )
  245. self.gridx_entry = FCDoubleSpinner()
  246. self.gridx_entry.set_precision(self.decimals)
  247. self.gridx_entry.setSingleStep(0.1)
  248. # Grid Y Entry
  249. self.gridy_label = QtWidgets.QLabel('%s:' % _('Grid Y value'))
  250. self.gridy_label.setToolTip(
  251. _("This is the Grid snap value on Y axis.")
  252. )
  253. self.gridy_entry = FCDoubleSpinner()
  254. self.gridy_entry.set_precision(self.decimals)
  255. self.gridy_entry.setSingleStep(0.1)
  256. # Snap Max Entry
  257. self.snap_max_label = QtWidgets.QLabel('%s:' % _('Snap Max'))
  258. self.snap_max_label.setToolTip(_("Max. magnet distance"))
  259. self.snap_max_dist_entry = FCDoubleSpinner()
  260. self.snap_max_dist_entry.set_precision(self.decimals)
  261. self.snap_max_dist_entry.setSingleStep(0.1)
  262. # Workspace
  263. self.workspace_lbl = QtWidgets.QLabel('%s:' % _('Workspace'))
  264. self.workspace_lbl.setToolTip(
  265. _("Draw a delimiting rectangle on canvas.\n"
  266. "The purpose is to illustrate the limits for our work.")
  267. )
  268. self.workspace_type_lbl = QtWidgets.QLabel('%s:' % _('Wk. size'))
  269. self.workspace_type_lbl.setToolTip(
  270. _("Select the type of rectangle to be used on canvas,\n"
  271. "as valid workspace.")
  272. )
  273. self.workspace_cb = FCCheckBox()
  274. self.wk_cb = FCComboBox()
  275. self.pagesize = dict()
  276. self.pagesize.update(
  277. {
  278. 'A0': (841, 1189),
  279. 'A1': (594, 841),
  280. 'A2': (420, 594),
  281. 'A3': (297, 420),
  282. 'A4': (210, 297),
  283. 'A5': (148, 210),
  284. 'A6': (105, 148),
  285. 'A7': (74, 105),
  286. 'A8': (52, 74),
  287. 'A9': (37, 52),
  288. 'A10': (26, 37),
  289. 'B0': (1000, 1414),
  290. 'B1': (707, 1000),
  291. 'B2': (500, 707),
  292. 'B3': (353, 500),
  293. 'B4': (250, 353),
  294. 'B5': (176, 250),
  295. 'B6': (125, 176),
  296. 'B7': (88, 125),
  297. 'B8': (62, 88),
  298. 'B9': (44, 62),
  299. 'B10': (31, 44),
  300. 'C0': (917, 1297),
  301. 'C1': (648, 917),
  302. 'C2': (458, 648),
  303. 'C3': (324, 458),
  304. 'C4': (229, 324),
  305. 'C5': (162, 229),
  306. 'C6': (114, 162),
  307. 'C7': (81, 114),
  308. 'C8': (57, 81),
  309. 'C9': (40, 57),
  310. 'C10': (28, 40),
  311. # American paper sizes
  312. 'LETTER': (8.5, 11),
  313. 'LEGAL': (8.5, 14),
  314. 'ELEVENSEVENTEEN': (11, 17),
  315. # From https://en.wikipedia.org/wiki/Paper_size
  316. 'JUNIOR_LEGAL': (5, 8),
  317. 'HALF_LETTER': (5.5, 8),
  318. 'GOV_LETTER': (8, 10.5),
  319. 'GOV_LEGAL': (8.5, 13),
  320. 'LEDGER': (17, 11),
  321. }
  322. )
  323. page_size_list = list(self.pagesize.keys())
  324. self.wk_cb.addItems(page_size_list)
  325. # self.wk_cb.addItem('A4P')
  326. # self.wk_cb.addItem('A4L')
  327. # self.wk_cb.addItem('A3P')
  328. # self.wk_cb.addItem('A3L')
  329. # Page orientation
  330. self.wk_orientation_label = QtWidgets.QLabel('%s:' % _("Wk. Orientation"))
  331. self.wk_orientation_label.setToolTip(_("Can be:\n"
  332. "- Portrait\n"
  333. "- Landscape"))
  334. self.wk_orientation_radio = RadioSet([{'label': _('Portrait'), 'value': 'p'},
  335. {'label': _('Landscape'), 'value': 'l'},
  336. ], stretch=False)
  337. self.wks = OptionalInputSection(self.workspace_cb,
  338. [
  339. self.workspace_type_lbl,
  340. self.wk_cb,
  341. self.wk_orientation_label,
  342. self.wk_orientation_radio
  343. ])
  344. # Plot Fill Color
  345. self.pf_color_label = QtWidgets.QLabel('%s:' % _('Plot Fill'))
  346. self.pf_color_label.setToolTip(
  347. _("Set the fill color for plotted objects.\n"
  348. "First 6 digits are the color and the last 2\n"
  349. "digits are for alpha (transparency) level.")
  350. )
  351. self.pf_color_entry = FCEntry()
  352. self.pf_color_button = QtWidgets.QPushButton()
  353. self.pf_color_button.setFixedSize(15, 15)
  354. self.form_box_child_1 = QtWidgets.QHBoxLayout()
  355. self.form_box_child_1.addWidget(self.pf_color_entry)
  356. self.form_box_child_1.addWidget(self.pf_color_button)
  357. self.form_box_child_1.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  358. # Plot Fill Transparency Level
  359. self.pf_alpha_label = QtWidgets.QLabel('%s:' % _('Alpha Level'))
  360. self.pf_alpha_label.setToolTip(
  361. _("Set the fill transparency for plotted objects.")
  362. )
  363. self.pf_color_alpha_slider = QtWidgets.QSlider(QtCore.Qt.Horizontal)
  364. self.pf_color_alpha_slider.setMinimum(0)
  365. self.pf_color_alpha_slider.setMaximum(255)
  366. self.pf_color_alpha_slider.setSingleStep(1)
  367. self.pf_color_alpha_spinner = FCSpinner()
  368. self.pf_color_alpha_spinner.setMinimumWidth(70)
  369. self.pf_color_alpha_spinner.set_range(0, 255)
  370. self.form_box_child_2 = QtWidgets.QHBoxLayout()
  371. self.form_box_child_2.addWidget(self.pf_color_alpha_slider)
  372. self.form_box_child_2.addWidget(self.pf_color_alpha_spinner)
  373. # Plot Line Color
  374. self.pl_color_label = QtWidgets.QLabel('%s:' % _('Plot Line'))
  375. self.pl_color_label.setToolTip(
  376. _("Set the line color for plotted objects.")
  377. )
  378. self.pl_color_entry = FCEntry()
  379. self.pl_color_button = QtWidgets.QPushButton()
  380. self.pl_color_button.setFixedSize(15, 15)
  381. self.form_box_child_3 = QtWidgets.QHBoxLayout()
  382. self.form_box_child_3.addWidget(self.pl_color_entry)
  383. self.form_box_child_3.addWidget(self.pl_color_button)
  384. self.form_box_child_3.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  385. # Plot Selection (left - right) Fill Color
  386. self.sf_color_label = QtWidgets.QLabel('%s:' % _('Sel. Fill'))
  387. self.sf_color_label.setToolTip(
  388. _("Set the fill color for the selection box\n"
  389. "in case that the selection is done from left to right.\n"
  390. "First 6 digits are the color and the last 2\n"
  391. "digits are for alpha (transparency) level.")
  392. )
  393. self.sf_color_entry = FCEntry()
  394. self.sf_color_button = QtWidgets.QPushButton()
  395. self.sf_color_button.setFixedSize(15, 15)
  396. self.form_box_child_4 = QtWidgets.QHBoxLayout()
  397. self.form_box_child_4.addWidget(self.sf_color_entry)
  398. self.form_box_child_4.addWidget(self.sf_color_button)
  399. self.form_box_child_4.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  400. # Plot Selection (left - right) Fill Transparency Level
  401. self.sf_alpha_label = QtWidgets.QLabel('%s:' % _('Alpha Level'))
  402. self.sf_alpha_label.setToolTip(
  403. _("Set the fill transparency for the 'left to right' selection box.")
  404. )
  405. self.sf_color_alpha_slider = QtWidgets.QSlider(QtCore.Qt.Horizontal)
  406. self.sf_color_alpha_slider.setMinimum(0)
  407. self.sf_color_alpha_slider.setMaximum(255)
  408. self.sf_color_alpha_slider.setSingleStep(1)
  409. self.sf_color_alpha_spinner = FCSpinner()
  410. self.sf_color_alpha_spinner.setMinimumWidth(70)
  411. self.sf_color_alpha_spinner.set_range(0, 255)
  412. self.form_box_child_5 = QtWidgets.QHBoxLayout()
  413. self.form_box_child_5.addWidget(self.sf_color_alpha_slider)
  414. self.form_box_child_5.addWidget(self.sf_color_alpha_spinner)
  415. # Plot Selection (left - right) Line Color
  416. self.sl_color_label = QtWidgets.QLabel('%s:' % _('Sel. Line'))
  417. self.sl_color_label.setToolTip(
  418. _("Set the line color for the 'left to right' selection box.")
  419. )
  420. self.sl_color_entry = FCEntry()
  421. self.sl_color_button = QtWidgets.QPushButton()
  422. self.sl_color_button.setFixedSize(15, 15)
  423. self.form_box_child_6 = QtWidgets.QHBoxLayout()
  424. self.form_box_child_6.addWidget(self.sl_color_entry)
  425. self.form_box_child_6.addWidget(self.sl_color_button)
  426. self.form_box_child_6.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  427. # Plot Selection (right - left) Fill Color
  428. self.alt_sf_color_label = QtWidgets.QLabel('%s:' % _('Sel2. Fill'))
  429. self.alt_sf_color_label.setToolTip(
  430. _("Set the fill color for the selection box\n"
  431. "in case that the selection is done from right to left.\n"
  432. "First 6 digits are the color and the last 2\n"
  433. "digits are for alpha (transparency) level.")
  434. )
  435. self.alt_sf_color_entry = FCEntry()
  436. self.alt_sf_color_button = QtWidgets.QPushButton()
  437. self.alt_sf_color_button.setFixedSize(15, 15)
  438. self.form_box_child_7 = QtWidgets.QHBoxLayout()
  439. self.form_box_child_7.addWidget(self.alt_sf_color_entry)
  440. self.form_box_child_7.addWidget(self.alt_sf_color_button)
  441. self.form_box_child_7.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  442. # Plot Selection (right - left) Fill Transparency Level
  443. self.alt_sf_alpha_label = QtWidgets.QLabel('%s:' % _('Alpha Level'))
  444. self.alt_sf_alpha_label.setToolTip(
  445. _("Set the fill transparency for selection 'right to left' box.")
  446. )
  447. self.alt_sf_color_alpha_slider = QtWidgets.QSlider(QtCore.Qt.Horizontal)
  448. self.alt_sf_color_alpha_slider.setMinimum(0)
  449. self.alt_sf_color_alpha_slider.setMaximum(255)
  450. self.alt_sf_color_alpha_slider.setSingleStep(1)
  451. self.alt_sf_color_alpha_spinner = FCSpinner()
  452. self.alt_sf_color_alpha_spinner.setMinimumWidth(70)
  453. self.alt_sf_color_alpha_spinner.set_range(0, 255)
  454. self.form_box_child_8 = QtWidgets.QHBoxLayout()
  455. self.form_box_child_8.addWidget(self.alt_sf_color_alpha_slider)
  456. self.form_box_child_8.addWidget(self.alt_sf_color_alpha_spinner)
  457. # Plot Selection (right - left) Line Color
  458. self.alt_sl_color_label = QtWidgets.QLabel('%s:' % _('Sel2. Line'))
  459. self.alt_sl_color_label.setToolTip(
  460. _("Set the line color for the 'right to left' selection box.")
  461. )
  462. self.alt_sl_color_entry = FCEntry()
  463. self.alt_sl_color_button = QtWidgets.QPushButton()
  464. self.alt_sl_color_button.setFixedSize(15, 15)
  465. self.form_box_child_9 = QtWidgets.QHBoxLayout()
  466. self.form_box_child_9.addWidget(self.alt_sl_color_entry)
  467. self.form_box_child_9.addWidget(self.alt_sl_color_button)
  468. self.form_box_child_9.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  469. # Editor Draw Color
  470. self.draw_color_label = QtWidgets.QLabel('%s:' % _('Editor Draw'))
  471. self.alt_sf_color_label.setToolTip(
  472. _("Set the color for the shape.")
  473. )
  474. self.draw_color_entry = FCEntry()
  475. self.draw_color_button = QtWidgets.QPushButton()
  476. self.draw_color_button.setFixedSize(15, 15)
  477. self.form_box_child_10 = QtWidgets.QHBoxLayout()
  478. self.form_box_child_10.addWidget(self.draw_color_entry)
  479. self.form_box_child_10.addWidget(self.draw_color_button)
  480. self.form_box_child_10.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  481. # Editor Draw Selection Color
  482. self.sel_draw_color_label = QtWidgets.QLabel('%s:' % _('Editor Draw Sel.'))
  483. self.sel_draw_color_label.setToolTip(
  484. _("Set the color of the shape when selected.")
  485. )
  486. self.sel_draw_color_entry = FCEntry()
  487. self.sel_draw_color_button = QtWidgets.QPushButton()
  488. self.sel_draw_color_button.setFixedSize(15, 15)
  489. self.form_box_child_11 = QtWidgets.QHBoxLayout()
  490. self.form_box_child_11.addWidget(self.sel_draw_color_entry)
  491. self.form_box_child_11.addWidget(self.sel_draw_color_button)
  492. self.form_box_child_11.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  493. # Project Tab items color
  494. self.proj_color_label = QtWidgets.QLabel('%s:' % _('Project Items'))
  495. self.proj_color_label.setToolTip(
  496. _("Set the color of the items in Project Tab Tree.")
  497. )
  498. self.proj_color_entry = FCEntry()
  499. self.proj_color_button = QtWidgets.QPushButton()
  500. self.proj_color_button.setFixedSize(15, 15)
  501. self.form_box_child_12 = QtWidgets.QHBoxLayout()
  502. self.form_box_child_12.addWidget(self.proj_color_entry)
  503. self.form_box_child_12.addWidget(self.proj_color_button)
  504. self.form_box_child_12.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  505. self.proj_color_dis_label = QtWidgets.QLabel('%s:' % _('Proj. Dis. Items'))
  506. self.proj_color_dis_label.setToolTip(
  507. _("Set the color of the items in Project Tab Tree,\n"
  508. "for the case when the items are disabled.")
  509. )
  510. self.proj_color_dis_entry = FCEntry()
  511. self.proj_color_dis_button = QtWidgets.QPushButton()
  512. self.proj_color_dis_button.setFixedSize(15, 15)
  513. self.form_box_child_13 = QtWidgets.QHBoxLayout()
  514. self.form_box_child_13.addWidget(self.proj_color_dis_entry)
  515. self.form_box_child_13.addWidget(self.proj_color_dis_button)
  516. self.form_box_child_13.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  517. # Activity monitor icon
  518. self.activity_label = QtWidgets.QLabel('%s:' % _("Activity Icon"))
  519. self.activity_label.setToolTip(
  520. _("Select the GIF that show activity when FlatCAM is active.")
  521. )
  522. self.activity_combo = FCComboBox()
  523. self.activity_combo.addItems(['Ball black', 'Ball green', 'Arrow green', 'Eclipse green'])
  524. # Just to add empty rows
  525. self.spacelabel = QtWidgets.QLabel('')
  526. # Add (label - input field) pair to the QFormLayout
  527. self.form_box.addRow(self.spacelabel, self.spacelabel)
  528. self.form_box.addRow(self.gridx_label, self.gridx_entry)
  529. self.form_box.addRow(self.gridy_label, self.gridy_entry)
  530. self.form_box.addRow(self.snap_max_label, self.snap_max_dist_entry)
  531. self.form_box.addRow(self.workspace_lbl, self.workspace_cb)
  532. self.form_box.addRow(self.workspace_type_lbl, self.wk_cb)
  533. self.form_box.addRow(self.wk_orientation_label, self.wk_orientation_radio)
  534. self.form_box.addRow(self.spacelabel, self.spacelabel)
  535. self.form_box.addRow(self.pf_color_label, self.form_box_child_1)
  536. self.form_box.addRow(self.pf_alpha_label, self.form_box_child_2)
  537. self.form_box.addRow(self.pl_color_label, self.form_box_child_3)
  538. self.form_box.addRow(self.sf_color_label, self.form_box_child_4)
  539. self.form_box.addRow(self.sf_alpha_label, self.form_box_child_5)
  540. self.form_box.addRow(self.sl_color_label, self.form_box_child_6)
  541. self.form_box.addRow(self.alt_sf_color_label, self.form_box_child_7)
  542. self.form_box.addRow(self.alt_sf_alpha_label, self.form_box_child_8)
  543. self.form_box.addRow(self.alt_sl_color_label, self.form_box_child_9)
  544. self.form_box.addRow(self.draw_color_label, self.form_box_child_10)
  545. self.form_box.addRow(self.sel_draw_color_label, self.form_box_child_11)
  546. self.form_box.addRow(QtWidgets.QLabel(""))
  547. self.form_box.addRow(self.proj_color_label, self.form_box_child_12)
  548. self.form_box.addRow(self.proj_color_dis_label, self.form_box_child_13)
  549. self.form_box.addRow(self.activity_label, self.activity_combo)
  550. self.form_box.addRow(self.spacelabel, self.spacelabel)
  551. # Add the QFormLayout that holds the Application general defaults
  552. # to the main layout of this TAB
  553. self.layout.addLayout(self.form_box)
  554. class GeneralGUISetGroupUI(OptionsGroupUI):
  555. def __init__(self, decimals=4, parent=None):
  556. super(GeneralGUISetGroupUI, self).__init__(self)
  557. self.setTitle(str(_("GUI Settings")))
  558. self.decimals = decimals
  559. theme_settings = QtCore.QSettings("Open Source", "FlatCAM")
  560. if theme_settings.contains("theme"):
  561. theme = theme_settings.value('theme', type=str)
  562. else:
  563. theme = 'white'
  564. if theme == 'white':
  565. self.resource_loc = 'share'
  566. else:
  567. self.resource_loc = 'share'
  568. # Create a form layout for the Application general settings
  569. self.form_box = QtWidgets.QFormLayout()
  570. grid0 = QtWidgets.QGridLayout()
  571. self.layout.addLayout(grid0)
  572. grid0.setColumnStretch(0, 0)
  573. grid0.setColumnStretch(1, 1)
  574. grid0.addWidget(QtWidgets.QLabel(''), 0, 0)
  575. # Theme selection
  576. self.theme_label = QtWidgets.QLabel('%s:' % _('Theme'))
  577. self.theme_label.setToolTip(
  578. _("Select a theme for FlatCAM.\n"
  579. "The application will restart after change.")
  580. )
  581. self.theme_radio = RadioSet([
  582. {"label": _("Light"), "value": "white"},
  583. {"label": _("Dark"), "value": "black"}
  584. ], orientation='horizontal', stretch=False)
  585. grid0.addWidget(self.theme_label, 1, 0)
  586. grid0.addWidget(self.theme_radio, 1, 1)
  587. # Layout selection
  588. self.layout_label = QtWidgets.QLabel('%s:' % _('Layout'))
  589. self.layout_label.setToolTip(
  590. _("Select an layout for FlatCAM.\n"
  591. "It is applied immediately.")
  592. )
  593. self.layout_combo = FCComboBox()
  594. # don't translate the QCombo items as they are used in QSettings and identified by name
  595. self.layout_combo.addItem("standard")
  596. self.layout_combo.addItem("compact")
  597. grid0.addWidget(self.layout_label, 2, 0)
  598. grid0.addWidget(self.layout_combo, 2, 1)
  599. # Set the current index for layout_combo
  600. settings = QSettings("Open Source", "FlatCAM")
  601. if settings.contains("layout"):
  602. layout = settings.value('layout', type=str)
  603. idx = self.layout_combo.findText(layout.capitalize())
  604. self.layout_combo.setCurrentIndex(idx)
  605. # Style selection
  606. self.style_label = QtWidgets.QLabel('%s:' % _('Style'))
  607. self.style_label.setToolTip(
  608. _("Select an style for FlatCAM.\n"
  609. "It will be applied at the next app start.")
  610. )
  611. self.style_combo = FCComboBox()
  612. self.style_combo.addItems(QtWidgets.QStyleFactory.keys())
  613. # find current style
  614. index = self.style_combo.findText(QtWidgets.qApp.style().objectName(), QtCore.Qt.MatchFixedString)
  615. self.style_combo.setCurrentIndex(index)
  616. self.style_combo.activated[str].connect(self.handle_style)
  617. grid0.addWidget(self.style_label, 3, 0)
  618. grid0.addWidget(self.style_combo, 3, 1)
  619. # Enable High DPI Support
  620. self.hdpi_label = QtWidgets.QLabel('%s:' % _('HDPI Support'))
  621. self.hdpi_label.setToolTip(
  622. _("Enable High DPI support for FlatCAM.\n"
  623. "It will be applied at the next app start.")
  624. )
  625. self.hdpi_cb = FCCheckBox()
  626. settings = QSettings("Open Source", "FlatCAM")
  627. if settings.contains("hdpi"):
  628. self.hdpi_cb.set_value(settings.value('hdpi', type=int))
  629. else:
  630. self.hdpi_cb.set_value(False)
  631. self.hdpi_cb.stateChanged.connect(self.handle_hdpi)
  632. grid0.addWidget(self.hdpi_label, 4, 0)
  633. grid0.addWidget(self.hdpi_cb, 4, 1)
  634. # Clear Settings
  635. self.clear_label = QtWidgets.QLabel('%s:' % _('Clear GUI Settings'))
  636. self.clear_label.setToolTip(
  637. _("Clear the GUI settings for FlatCAM,\n"
  638. "such as: layout, gui state, style, hdpi support etc.")
  639. )
  640. self.clear_btn = FCButton(_("Clear"))
  641. self.clear_btn.clicked.connect(self.handle_clear)
  642. grid0.addWidget(self.clear_label, 5, 0)
  643. grid0.addWidget(self.clear_btn, 5, 1)
  644. # Enable Hover box
  645. self.hover_label = QtWidgets.QLabel('%s:' % _('Hover Shape'))
  646. self.hover_label.setToolTip(
  647. _("Enable display of a hover shape for FlatCAM objects.\n"
  648. "It is displayed whenever the mouse cursor is hovering\n"
  649. "over any kind of not-selected object.")
  650. )
  651. self.hover_cb = FCCheckBox()
  652. grid0.addWidget(self.hover_label, 6, 0)
  653. grid0.addWidget(self.hover_cb, 6, 1)
  654. # Enable Selection box
  655. self.selection_label = QtWidgets.QLabel('%s:' % _('Sel. Shape'))
  656. self.selection_label.setToolTip(
  657. _("Enable the display of a selection shape for FlatCAM objects.\n"
  658. "It is displayed whenever the mouse selects an object\n"
  659. "either by clicking or dragging mouse from left to right or\n"
  660. "right to left.")
  661. )
  662. self.selection_cb = FCCheckBox()
  663. grid0.addWidget(self.selection_label, 7, 0)
  664. grid0.addWidget(self.selection_cb, 7, 1)
  665. grid0.addWidget(QtWidgets.QLabel(''), 8, 0)
  666. # Notebook Font Size
  667. self.notebook_font_size_label = QtWidgets.QLabel('%s:' % _('NB Font Size'))
  668. self.notebook_font_size_label.setToolTip(
  669. _("This sets the font size for the elements found in the Notebook.\n"
  670. "The notebook is the collapsible area in the left side of the GUI,\n"
  671. "and include the Project, Selected and Tool tabs.")
  672. )
  673. self.notebook_font_size_spinner = FCSpinner()
  674. self.notebook_font_size_spinner.setRange(8, 40)
  675. self.notebook_font_size_spinner.setWrapping(True)
  676. settings = QSettings("Open Source", "FlatCAM")
  677. if settings.contains("notebook_font_size"):
  678. self.notebook_font_size_spinner.set_value(settings.value('notebook_font_size', type=int))
  679. else:
  680. self.notebook_font_size_spinner.set_value(12)
  681. grid0.addWidget(self.notebook_font_size_label, 9, 0)
  682. grid0.addWidget(self.notebook_font_size_spinner, 9, 1)
  683. # Axis Font Size
  684. self.axis_font_size_label = QtWidgets.QLabel('%s:' % _('Axis Font Size'))
  685. self.axis_font_size_label.setToolTip(
  686. _("This sets the font size for canvas axis.")
  687. )
  688. self.axis_font_size_spinner = FCSpinner()
  689. self.axis_font_size_spinner.setRange(0, 40)
  690. self.axis_font_size_spinner.setWrapping(True)
  691. settings = QSettings("Open Source", "FlatCAM")
  692. if settings.contains("axis_font_size"):
  693. self.axis_font_size_spinner.set_value(settings.value('axis_font_size', type=int))
  694. else:
  695. self.axis_font_size_spinner.set_value(8)
  696. grid0.addWidget(self.axis_font_size_label, 10, 0)
  697. grid0.addWidget(self.axis_font_size_spinner, 10, 1)
  698. # TextBox Font Size
  699. self.textbox_font_size_label = QtWidgets.QLabel('%s:' % _('Textbox Font Size'))
  700. self.textbox_font_size_label.setToolTip(
  701. _("This sets the font size for the Textbox GUI\n"
  702. "elements that are used in FlatCAM.")
  703. )
  704. self.textbox_font_size_spinner = FCSpinner()
  705. self.textbox_font_size_spinner.setRange(8, 40)
  706. self.textbox_font_size_spinner.setWrapping(True)
  707. settings = QSettings("Open Source", "FlatCAM")
  708. if settings.contains("textbox_font_size"):
  709. self.textbox_font_size_spinner.set_value(settings.value('textbox_font_size', type=int))
  710. else:
  711. self.textbox_font_size_spinner.set_value(10)
  712. grid0.addWidget(self.textbox_font_size_label, 11, 0)
  713. grid0.addWidget(self.textbox_font_size_spinner, 11, 1)
  714. # Just to add empty rows
  715. grid0.addWidget(QtWidgets.QLabel(''), 12, 0)
  716. # Splash Screen
  717. self.splash_label = QtWidgets.QLabel('%s:' % _('Splash Screen'))
  718. self.splash_label.setToolTip(
  719. _("Enable display of the splash screen at application startup.")
  720. )
  721. self.splash_cb = FCCheckBox()
  722. settings = QSettings("Open Source", "FlatCAM")
  723. if settings.value("splash_screen"):
  724. self.splash_cb.set_value(True)
  725. else:
  726. self.splash_cb.set_value(False)
  727. grid0.addWidget(self.splash_label, 13, 0)
  728. grid0.addWidget(self.splash_cb, 13, 1)
  729. # Sys Tray Icon
  730. self.systray_label = QtWidgets.QLabel('%s:' % _('Sys Tray Icon'))
  731. self.systray_label.setToolTip(
  732. _("Enable display of FlatCAM icon in Sys Tray.")
  733. )
  734. self.systray_cb = FCCheckBox()
  735. grid0.addWidget(self.systray_label, 14, 0)
  736. grid0.addWidget(self.systray_cb, 14, 1)
  737. # Shell StartUp CB
  738. self.shell_startup_label = QtWidgets.QLabel('%s:' % _('Shell at StartUp'))
  739. self.shell_startup_label.setToolTip(
  740. _("Check this box if you want the shell to\n"
  741. "start automatically at startup.")
  742. )
  743. self.shell_startup_cb = FCCheckBox(label='')
  744. self.shell_startup_cb.setToolTip(
  745. _("Check this box if you want the shell to\n"
  746. "start automatically at startup.")
  747. )
  748. grid0.addWidget(self.shell_startup_label, 15, 0)
  749. grid0.addWidget(self.shell_startup_cb, 15, 1)
  750. # Project at StartUp CB
  751. self.project_startup_label = QtWidgets.QLabel('%s:' % _('Project at StartUp'))
  752. self.project_startup_label.setToolTip(
  753. _("Check this box if you want the project/selected/tool tab area to\n"
  754. "to be shown automatically at startup.")
  755. )
  756. self.project_startup_cb = FCCheckBox(label='')
  757. self.project_startup_cb.setToolTip(
  758. _("Check this box if you want the project/selected/tool tab area to\n"
  759. "to be shown automatically at startup.")
  760. )
  761. grid0.addWidget(self.project_startup_label, 16, 0)
  762. grid0.addWidget(self.project_startup_cb, 16, 1)
  763. # Project autohide CB
  764. self.project_autohide_label = QtWidgets.QLabel('%s:' % _('Project AutoHide'))
  765. self.project_autohide_label.setToolTip(
  766. _("Check this box if you want the project/selected/tool tab area to\n"
  767. "hide automatically when there are no objects loaded and\n"
  768. "to show whenever a new object is created.")
  769. )
  770. self.project_autohide_cb = FCCheckBox(label='')
  771. self.project_autohide_cb.setToolTip(
  772. _("Check this box if you want the project/selected/tool tab area to\n"
  773. "hide automatically when there are no objects loaded and\n"
  774. "to show whenever a new object is created.")
  775. )
  776. grid0.addWidget(self.project_autohide_label, 17, 0)
  777. grid0.addWidget(self.project_autohide_cb, 17, 1)
  778. grid0.addWidget(QtWidgets.QLabel(''), 18, 0)
  779. # Enable/Disable ToolTips globally
  780. self.toggle_tooltips_label = QtWidgets.QLabel('<b>%s:</b>' % _('Enable ToolTips'))
  781. self.toggle_tooltips_label.setToolTip(
  782. _("Check this box if you want to have toolTips displayed\n"
  783. "when hovering with mouse over items throughout the App.")
  784. )
  785. self.toggle_tooltips_cb = FCCheckBox(label='')
  786. self.toggle_tooltips_cb.setToolTip(
  787. _("Check this box if you want to have toolTips displayed\n"
  788. "when hovering with mouse over items throughout the App.")
  789. )
  790. grid0.addWidget(self.toggle_tooltips_label, 19, 0)
  791. grid0.addWidget(self.toggle_tooltips_cb, 19, 1)
  792. # Mouse Cursor Shape
  793. self.cursor_lbl = QtWidgets.QLabel('%s:' % _('Mouse Cursor'))
  794. self.cursor_lbl.setToolTip(
  795. _("Choose a mouse cursor shape.\n"
  796. "- Small -> with a customizable size.\n"
  797. "- Big -> Infinite lines")
  798. )
  799. self.cursor_radio = RadioSet([
  800. {"label": _("Small"), "value": "small"},
  801. {"label": _("Big"), "value": "big"}
  802. ], orientation='horizontal', stretch=False)
  803. grid0.addWidget(self.cursor_lbl, 20, 0)
  804. grid0.addWidget(self.cursor_radio, 20, 1)
  805. self.cursor_size_lbl = QtWidgets.QLabel('%s:' % _('Mouse Cursor Size'))
  806. self.cursor_size_lbl.setToolTip(
  807. _("Set the size of the mouse cursor, in pixels.")
  808. )
  809. self.cursor_size_entry = FCSpinner()
  810. self.cursor_size_entry.set_range(10, 70)
  811. self.cursor_size_entry.setWrapping(True)
  812. grid0.addWidget(self.cursor_size_lbl, 21, 0)
  813. grid0.addWidget(self.cursor_size_entry, 21, 1)
  814. self.cursor_width_lbl = QtWidgets.QLabel('%s:' % _('Mouse Cursor Width'))
  815. self.cursor_width_lbl.setToolTip(
  816. _("Set the line width of the mouse cursor, in pixels.")
  817. )
  818. self.cursor_width_entry = FCSpinner()
  819. self.cursor_width_entry.set_range(1, 10)
  820. self.cursor_width_entry.setWrapping(True)
  821. grid0.addWidget(self.cursor_width_lbl, 22, 0)
  822. grid0.addWidget(self.cursor_width_entry, 22, 1)
  823. # Delete confirmation
  824. self.delete_conf_cb = FCCheckBox(_('Delete object confirmation'))
  825. self.delete_conf_cb.setToolTip(
  826. _("When checked the application will ask for user confirmation\n"
  827. "whenever the Delete object(s) event is triggered, either by\n"
  828. "menu shortcut or key shortcut.")
  829. )
  830. grid0.addWidget(self.delete_conf_cb, 23, 0, 1, 2)
  831. self.layout.addStretch()
  832. def handle_style(self, style):
  833. # set current style
  834. settings = QSettings("Open Source", "FlatCAM")
  835. settings.setValue('style', style)
  836. # This will write the setting to the platform specific storage.
  837. del settings
  838. def handle_hdpi(self, state):
  839. # set current HDPI
  840. settings = QSettings("Open Source", "FlatCAM")
  841. settings.setValue('hdpi', state)
  842. # This will write the setting to the platform specific storage.
  843. del settings
  844. def handle_clear(self):
  845. msgbox = QtWidgets.QMessageBox()
  846. msgbox.setText(_("Are you sure you want to delete the GUI Settings? "
  847. "\n")
  848. )
  849. msgbox.setWindowTitle(_("Clear GUI Settings"))
  850. msgbox.setWindowIcon(QtGui.QIcon(self.resource_loc + '/trash32.png'))
  851. bt_yes = msgbox.addButton(_('Yes'), QtWidgets.QMessageBox.YesRole)
  852. bt_no = msgbox.addButton(_('No'), QtWidgets.QMessageBox.NoRole)
  853. msgbox.setDefaultButton(bt_no)
  854. msgbox.exec_()
  855. response = msgbox.clickedButton()
  856. if response == bt_yes:
  857. settings = QSettings("Open Source", "FlatCAM")
  858. for key in settings.allKeys():
  859. settings.remove(key)
  860. # This will write the setting to the platform specific storage.
  861. del settings
  862. class GeneralAppPrefGroupUI(OptionsGroupUI):
  863. def __init__(self, decimals=4, parent=None):
  864. super(GeneralAppPrefGroupUI, self).__init__(self)
  865. self.setTitle(str(_("App Preferences")))
  866. self.decimals = decimals
  867. # Create a form layout for the Application general settings
  868. grid0 = QtWidgets.QGridLayout()
  869. self.layout.addLayout(grid0)
  870. grid0.setColumnStretch(0, 0)
  871. grid0.setColumnStretch(1, 1)
  872. # Units for FlatCAM
  873. self.unitslabel = QtWidgets.QLabel('<span style="color:red;"><b>%s:</b></span>' % _('Units'))
  874. self.unitslabel.setToolTip(_("The default value for FlatCAM units.\n"
  875. "Whatever is selected here is set every time\n"
  876. "FLatCAM is started."))
  877. self.units_radio = RadioSet([{'label': _('MM'), 'value': 'MM'},
  878. {'label': _('IN'), 'value': 'IN'}])
  879. grid0.addWidget(self.unitslabel, 0, 0)
  880. grid0.addWidget(self.units_radio, 0, 1)
  881. # Precision Metric
  882. self.precision_metric_label = QtWidgets.QLabel('%s:' % _('Precision MM'))
  883. self.precision_metric_label.setToolTip(
  884. _("The number of decimals used throughout the application\n"
  885. "when the set units are in METRIC system.\n"
  886. "Any change here require an application restart.")
  887. )
  888. self.precision_metric_entry = FCSpinner()
  889. self.precision_metric_entry.set_range(2, 16)
  890. self.precision_metric_entry.setWrapping(True)
  891. grid0.addWidget(self.precision_metric_label, 1, 0)
  892. grid0.addWidget(self.precision_metric_entry, 1, 1)
  893. # Precision Inch
  894. self.precision_inch_label = QtWidgets.QLabel('%s:' % _('Precision INCH'))
  895. self.precision_inch_label.setToolTip(
  896. _("The number of decimals used throughout the application\n"
  897. "when the set units are in INCH system.\n"
  898. "Any change here require an application restart.")
  899. )
  900. self.precision_inch_entry = FCSpinner()
  901. self.precision_inch_entry.set_range(2, 16)
  902. self.precision_inch_entry.setWrapping(True)
  903. grid0.addWidget(self.precision_inch_label, 2, 0)
  904. grid0.addWidget(self.precision_inch_entry, 2, 1)
  905. # Graphic Engine for FlatCAM
  906. self.ge_label = QtWidgets.QLabel('<b>%s:</b>' % _('Graphic Engine'))
  907. self.ge_label.setToolTip(_("Choose what graphic engine to use in FlatCAM.\n"
  908. "Legacy(2D) -> reduced functionality, slow performance but enhanced compatibility.\n"
  909. "OpenGL(3D) -> full functionality, high performance\n"
  910. "Some graphic cards are too old and do not work in OpenGL(3D) mode, like:\n"
  911. "Intel HD3000 or older. In this case the plot area will be black therefore\n"
  912. "use the Legacy(2D) mode."))
  913. self.ge_radio = RadioSet([{'label': _('Legacy(2D)'), 'value': '2D'},
  914. {'label': _('OpenGL(3D)'), 'value': '3D'}])
  915. grid0.addWidget(self.ge_label, 3, 0)
  916. grid0.addWidget(self.ge_radio, 3, 1)
  917. grid0.addWidget(QtWidgets.QLabel(''), 4, 0)
  918. # Application Level for FlatCAM
  919. self.app_level_label = QtWidgets.QLabel('<span style="color:red;"><b>%s:</b></span>' % _('APP. LEVEL'))
  920. self.app_level_label.setToolTip(_("Choose the default level of usage for FlatCAM.\n"
  921. "BASIC level -> reduced functionality, best for beginner's.\n"
  922. "ADVANCED level -> full functionality.\n\n"
  923. "The choice here will influence the parameters in\n"
  924. "the Selected Tab for all kinds of FlatCAM objects."))
  925. self.app_level_radio = RadioSet([{'label': _('Basic'), 'value': 'b'},
  926. {'label': _('Advanced'), 'value': 'a'}])
  927. grid0.addWidget(self.app_level_label, 5, 0)
  928. grid0.addWidget(self.app_level_radio, 5, 1)
  929. # Portability for FlatCAM
  930. self.portability_label = QtWidgets.QLabel('%s:' % _('Portable app'))
  931. self.portability_label.setToolTip(_("Choose if the application should run as portable.\n\n"
  932. "If Checked the application will run portable,\n"
  933. "which means that the preferences files will be saved\n"
  934. "in the application folder, in the lib\\config subfolder."))
  935. self.portability_cb = FCCheckBox()
  936. grid0.addWidget(self.portability_label, 6, 0)
  937. grid0.addWidget(self.portability_cb, 6, 1)
  938. # Languages for FlatCAM
  939. self.languagelabel = QtWidgets.QLabel('<b>%s:</b>' % _('Languages'))
  940. self.languagelabel.setToolTip(_("Set the language used throughout FlatCAM."))
  941. self.language_cb = FCComboBox()
  942. grid0.addWidget(self.languagelabel, 7, 0)
  943. grid0.addWidget(self.language_cb, 7, 1)
  944. self.language_apply_btn = FCButton(_("Apply Language"))
  945. self.language_apply_btn.setToolTip(_("Set the language used throughout FlatCAM.\n"
  946. "The app will restart after click."
  947. "Windows: When FlatCAM is installed in Program Files\n"
  948. "directory, it is possible that the app will not\n"
  949. "restart after the button is clicked due of Windows\n"
  950. "security features. In this case the language will be\n"
  951. "applied at the next app start."))
  952. grid0.addWidget(self.language_apply_btn, 8, 0, 1, 2)
  953. grid0.addWidget(QtWidgets.QLabel(''), 9, 0)
  954. # Version Check CB
  955. self.version_check_label = QtWidgets.QLabel('%s:' % _('Version Check'))
  956. self.version_check_label.setToolTip(
  957. _("Check this box if you want to check\n"
  958. "for a new version automatically at startup.")
  959. )
  960. self.version_check_cb = FCCheckBox(label='')
  961. self.version_check_cb.setToolTip(
  962. _("Check this box if you want to check\n"
  963. "for a new version automatically at startup.")
  964. )
  965. grid0.addWidget(self.version_check_label, 10, 0)
  966. grid0.addWidget(self.version_check_cb, 10, 1)
  967. # Send Stats CB
  968. self.send_stats_label = QtWidgets.QLabel('%s:' % _('Send Stats'))
  969. self.send_stats_label.setToolTip(
  970. _("Check this box if you agree to send anonymous\n"
  971. "stats automatically at startup, to help improve FlatCAM.")
  972. )
  973. self.send_stats_cb = FCCheckBox(label='')
  974. self.send_stats_cb.setToolTip(
  975. _("Check this box if you agree to send anonymous\n"
  976. "stats automatically at startup, to help improve FlatCAM.")
  977. )
  978. grid0.addWidget(self.send_stats_label, 11, 0)
  979. grid0.addWidget(self.send_stats_cb, 11, 1)
  980. self.ois_version_check = OptionalInputSection(self.version_check_cb, [self.send_stats_cb])
  981. # Select mouse pan button
  982. self.panbuttonlabel = QtWidgets.QLabel('<b>%s:</b>' % _('Pan Button'))
  983. self.panbuttonlabel.setToolTip(_("Select the mouse button to use for panning:\n"
  984. "- MMB --> Middle Mouse Button\n"
  985. "- RMB --> Right Mouse Button"))
  986. self.pan_button_radio = RadioSet([{'label': _('MMB'), 'value': '3'},
  987. {'label': _('RMB'), 'value': '2'}])
  988. grid0.addWidget(self.panbuttonlabel, 12, 0)
  989. grid0.addWidget(self.pan_button_radio, 12, 1)
  990. # Multiple Selection Modifier Key
  991. self.mselectlabel = QtWidgets.QLabel('<b>%s:</b>' % _('Multiple Sel'))
  992. self.mselectlabel.setToolTip(_("Select the key used for multiple selection."))
  993. self.mselect_radio = RadioSet([{'label': _('CTRL'), 'value': 'Control'},
  994. {'label': _('SHIFT'), 'value': 'Shift'}])
  995. grid0.addWidget(self.mselectlabel, 13, 0)
  996. grid0.addWidget(self.mselect_radio, 13, 1)
  997. # Worker Numbers
  998. self.worker_number_label = QtWidgets.QLabel('%s:' % _('Workers number'))
  999. self.worker_number_label.setToolTip(
  1000. _("The number of Qthreads made available to the App.\n"
  1001. "A bigger number may finish the jobs more quickly but\n"
  1002. "depending on your computer speed, may make the App\n"
  1003. "unresponsive. Can have a value between 2 and 16.\n"
  1004. "Default value is 2.\n"
  1005. "After change, it will be applied at next App start.")
  1006. )
  1007. self.worker_number_sb = FCSpinner()
  1008. self.worker_number_sb.setToolTip(
  1009. _("The number of Qthreads made available to the App.\n"
  1010. "A bigger number may finish the jobs more quickly but\n"
  1011. "depending on your computer speed, may make the App\n"
  1012. "unresponsive. Can have a value between 2 and 16.\n"
  1013. "Default value is 2.\n"
  1014. "After change, it will be applied at next App start.")
  1015. )
  1016. self.worker_number_sb.set_range(2, 16)
  1017. grid0.addWidget(self.worker_number_label, 14, 0)
  1018. grid0.addWidget(self.worker_number_sb, 14, 1)
  1019. # Geometric tolerance
  1020. tol_label = QtWidgets.QLabel('%s:' % _("Geo Tolerance"))
  1021. tol_label.setToolTip(_(
  1022. "This value can counter the effect of the Circle Steps\n"
  1023. "parameter. Default value is 0.01.\n"
  1024. "A lower value will increase the detail both in image\n"
  1025. "and in Gcode for the circles, with a higher cost in\n"
  1026. "performance. Higher value will provide more\n"
  1027. "performance at the expense of level of detail."
  1028. ))
  1029. self.tol_entry = FCDoubleSpinner()
  1030. self.tol_entry.setToolTip(_(
  1031. "This value can counter the effect of the Circle Steps\n"
  1032. "parameter. Default value is 0.01.\n"
  1033. "A lower value will increase the detail both in image\n"
  1034. "and in Gcode for the circles, with a higher cost in\n"
  1035. "performance. Higher value will provide more\n"
  1036. "performance at the expense of level of detail."
  1037. ))
  1038. self.tol_entry.setSingleStep(0.001)
  1039. self.tol_entry.set_precision(6)
  1040. grid0.addWidget(tol_label, 15, 0)
  1041. grid0.addWidget(self.tol_entry, 15, 1)
  1042. grid0.addWidget(QtWidgets.QLabel(''), 16, 0)
  1043. # Open behavior
  1044. self.open_style_cb = FCCheckBox('%s' % _('"Open" behavior'))
  1045. self.open_style_cb.setToolTip(
  1046. _("When checked the path for the last saved file is used when saving files,\n"
  1047. "and the path for the last opened file is used when opening files.\n\n"
  1048. "When unchecked the path for opening files is the one used last: either the\n"
  1049. "path for saving files or the path for opening files.")
  1050. )
  1051. grid0.addWidget(self.open_style_cb, 17, 0, 1, 2)
  1052. # Save compressed project CB
  1053. self.save_type_cb = FCCheckBox(_('Save Compressed Project'))
  1054. self.save_type_cb.setToolTip(
  1055. _("Whether to save a compressed or uncompressed project.\n"
  1056. "When checked it will save a compressed FlatCAM project.")
  1057. )
  1058. grid0.addWidget(self.save_type_cb, 18, 0, 1, 2)
  1059. # Project LZMA Comppression Level
  1060. self.compress_spinner = FCSpinner()
  1061. self.compress_spinner.set_range(0, 9)
  1062. self.compress_label = QtWidgets.QLabel('%s:' % _('Compression'))
  1063. self.compress_label.setToolTip(
  1064. _("The level of compression used when saving\n"
  1065. "a FlatCAM project. Higher value means better compression\n"
  1066. "but require more RAM usage and more processing time.")
  1067. )
  1068. grid0.addWidget(self.compress_label, 19, 0)
  1069. grid0.addWidget(self.compress_spinner, 19, 1)
  1070. self.proj_ois = OptionalInputSection(self.save_type_cb, [self.compress_label, self.compress_spinner], True)
  1071. # Bookmarks Limit in the Help Menu
  1072. self.bm_limit_spinner = FCSpinner()
  1073. self.bm_limit_label = QtWidgets.QLabel('%s:' % _('Bookmarks limit'))
  1074. self.bm_limit_label.setToolTip(
  1075. _("The maximum number of bookmarks that may be installed in the menu.\n"
  1076. "The number of bookmarks in the bookmark manager may be greater\n"
  1077. "but the menu will hold only so much.")
  1078. )
  1079. grid0.addWidget(self.bm_limit_label, 20, 0)
  1080. grid0.addWidget(self.bm_limit_spinner, 20, 1)
  1081. # Machinist settings that allow unsafe settings
  1082. self.machinist_cb = FCCheckBox(_("Allow Machinist Unsafe Settings"))
  1083. self.machinist_cb.setToolTip(
  1084. _("If checked, some of the application settings will be allowed\n"
  1085. "to have values that are usually unsafe to use.\n"
  1086. "Like Z travel negative values or Z Cut positive values.\n"
  1087. "It will applied at the next application start.\n"
  1088. "<<WARNING>>: Don't change this unless you know what you are doing !!!")
  1089. )
  1090. grid0.addWidget(self.machinist_cb, 21, 0, 1, 2)
  1091. separator_line = QtWidgets.QFrame()
  1092. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  1093. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  1094. self.layout.addWidget(separator_line)
  1095. self.layout.addWidget(QtWidgets.QLabel(''))
  1096. grid1 = QtWidgets.QGridLayout()
  1097. self.layout.addLayout(grid1)
  1098. grid1.setColumnStretch(0, 0)
  1099. grid1.setColumnStretch(1, 1)
  1100. self.pdf_param_label = QtWidgets.QLabel('<B>%s:</b>' % _("Text to PDF parameters"))
  1101. self.pdf_param_label.setToolTip(
  1102. _("Used when saving text in Code Editor or in FlatCAM Document objects.")
  1103. )
  1104. grid1.addWidget(self.pdf_param_label, 0, 0, 1, 2)
  1105. # Top Margin value
  1106. self.tmargin_entry = FCDoubleSpinner()
  1107. self.tmargin_entry.set_precision(self.decimals)
  1108. self.tmargin_entry.set_range(0.0000, 9999.9999)
  1109. self.tmargin_label = QtWidgets.QLabel('%s:' % _("Top Margin"))
  1110. self.tmargin_label.setToolTip(
  1111. _("Distance between text body and the top of the PDF file.")
  1112. )
  1113. grid1.addWidget(self.tmargin_label, 1, 0)
  1114. grid1.addWidget(self.tmargin_entry, 1, 1)
  1115. # Bottom Margin value
  1116. self.bmargin_entry = FCDoubleSpinner()
  1117. self.bmargin_entry.set_precision(self.decimals)
  1118. self.bmargin_entry.set_range(0.0000, 9999.9999)
  1119. self.bmargin_label = QtWidgets.QLabel('%s:' % _("Bottom Margin"))
  1120. self.bmargin_label.setToolTip(
  1121. _("Distance between text body and the bottom of the PDF file.")
  1122. )
  1123. grid1.addWidget(self.bmargin_label, 2, 0)
  1124. grid1.addWidget(self.bmargin_entry, 2, 1)
  1125. # Left Margin value
  1126. self.lmargin_entry = FCDoubleSpinner()
  1127. self.lmargin_entry.set_precision(self.decimals)
  1128. self.lmargin_entry.set_range(0.0000, 9999.9999)
  1129. self.lmargin_label = QtWidgets.QLabel('%s:' % _("Left Margin"))
  1130. self.lmargin_label.setToolTip(
  1131. _("Distance between text body and the left of the PDF file.")
  1132. )
  1133. grid1.addWidget(self.lmargin_label, 3, 0)
  1134. grid1.addWidget(self.lmargin_entry, 3, 1)
  1135. # Right Margin value
  1136. self.rmargin_entry = FCDoubleSpinner()
  1137. self.rmargin_entry.set_precision(self.decimals)
  1138. self.rmargin_entry.set_range(0.0000, 9999.9999)
  1139. self.rmargin_label = QtWidgets.QLabel('%s:' % _("Right Margin"))
  1140. self.rmargin_label.setToolTip(
  1141. _("Distance between text body and the right of the PDF file.")
  1142. )
  1143. grid1.addWidget(self.rmargin_label, 4, 0)
  1144. grid1.addWidget(self.rmargin_entry, 4, 1)
  1145. self.layout.addStretch()
  1146. if sys.platform != 'win32':
  1147. self.portability_label.hide()
  1148. self.portability_cb.hide()
  1149. class GerberGenPrefGroupUI(OptionsGroupUI):
  1150. def __init__(self, decimals=4, parent=None):
  1151. # OptionsGroupUI.__init__(self, "Gerber General Preferences", parent=parent)
  1152. super(GerberGenPrefGroupUI, self).__init__(self)
  1153. self.setTitle(str(_("Gerber General")))
  1154. self.decimals = decimals
  1155. # ## Plot options
  1156. self.plot_options_label = QtWidgets.QLabel("<b>%s:</b>" % _("Plot Options"))
  1157. self.layout.addWidget(self.plot_options_label)
  1158. grid0 = QtWidgets.QGridLayout()
  1159. self.layout.addLayout(grid0)
  1160. # Solid CB
  1161. self.solid_cb = FCCheckBox(label='%s' % _('Solid'))
  1162. self.solid_cb.setToolTip(
  1163. _("Solid color polygons.")
  1164. )
  1165. grid0.addWidget(self.solid_cb, 0, 0)
  1166. # Multicolored CB
  1167. self.multicolored_cb = FCCheckBox(label='%s' % _('M-Color'))
  1168. self.multicolored_cb.setToolTip(
  1169. _("Draw polygons in different colors.")
  1170. )
  1171. grid0.addWidget(self.multicolored_cb, 0, 1)
  1172. # Plot CB
  1173. self.plot_cb = FCCheckBox(label='%s' % _('Plot'))
  1174. self.plot_options_label.setToolTip(
  1175. _("Plot (show) this object.")
  1176. )
  1177. grid0.addWidget(self.plot_cb, 0, 2)
  1178. # Number of circle steps for circular aperture linear approximation
  1179. self.circle_steps_label = QtWidgets.QLabel('%s:' % _("Circle Steps"))
  1180. self.circle_steps_label.setToolTip(
  1181. _("The number of circle steps for Gerber \n"
  1182. "circular aperture linear approximation.")
  1183. )
  1184. self.circle_steps_entry = FCSpinner()
  1185. self.circle_steps_entry.set_range(0, 9999)
  1186. grid0.addWidget(self.circle_steps_label, 1, 0)
  1187. grid0.addWidget(self.circle_steps_entry, 1, 1, 1, 2)
  1188. grid0.addWidget(QtWidgets.QLabel(''), 2, 0, 1, 3)
  1189. # Default format for Gerber
  1190. self.gerber_default_label = QtWidgets.QLabel('<b>%s:</b>' % _('Default Values'))
  1191. self.gerber_default_label.setToolTip(
  1192. _("Those values will be used as fallback values\n"
  1193. "in case that they are not found in the Gerber file.")
  1194. )
  1195. grid0.addWidget(self.gerber_default_label, 3, 0, 1, 3)
  1196. # Gerber Units
  1197. self.gerber_units_label = QtWidgets.QLabel('%s:' % _('Units'))
  1198. self.gerber_units_label.setToolTip(
  1199. _("The units used in the Gerber file.")
  1200. )
  1201. self.gerber_units_radio = RadioSet([{'label': _('INCH'), 'value': 'IN'},
  1202. {'label': _('MM'), 'value': 'MM'}])
  1203. self.gerber_units_radio.setToolTip(
  1204. _("The units used in the Gerber file.")
  1205. )
  1206. grid0.addWidget(self.gerber_units_label, 4, 0)
  1207. grid0.addWidget(self.gerber_units_radio, 4, 1, 1, 2)
  1208. # Gerber Zeros
  1209. self.gerber_zeros_label = QtWidgets.QLabel('%s:' % _('Zeros'))
  1210. self.gerber_zeros_label.setAlignment(QtCore.Qt.AlignLeft)
  1211. self.gerber_zeros_label.setToolTip(
  1212. _("This sets the type of Gerber zeros.\n"
  1213. "If LZ then Leading Zeros are removed and\n"
  1214. "Trailing Zeros are kept.\n"
  1215. "If TZ is checked then Trailing Zeros are removed\n"
  1216. "and Leading Zeros are kept.")
  1217. )
  1218. self.gerber_zeros_radio = RadioSet([{'label': _('LZ'), 'value': 'L'},
  1219. {'label': _('TZ'), 'value': 'T'}])
  1220. self.gerber_zeros_radio.setToolTip(
  1221. _("This sets the type of Gerber zeros.\n"
  1222. "If LZ then Leading Zeros are removed and\n"
  1223. "Trailing Zeros are kept.\n"
  1224. "If TZ is checked then Trailing Zeros are removed\n"
  1225. "and Leading Zeros are kept.")
  1226. )
  1227. grid0.addWidget(self.gerber_zeros_label, 5, 0)
  1228. grid0.addWidget(self.gerber_zeros_radio, 5, 1, 1, 2)
  1229. separator_line = QtWidgets.QFrame()
  1230. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  1231. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  1232. grid0.addWidget(separator_line, 6, 0, 1, 3)
  1233. # Apertures Cleaning
  1234. self.gerber_clean_cb = FCCheckBox(label='%s' % _('Clean Apertures'))
  1235. self.gerber_clean_cb.setToolTip(
  1236. _("Will remove apertures that do not have geometry\n"
  1237. "thus lowering the number of apertures in the Gerber object.")
  1238. )
  1239. grid0.addWidget(self.gerber_clean_cb, 7, 0, 1, 3)
  1240. # Apply Extra Buffering
  1241. self.gerber_extra_buffering = FCCheckBox(label='%s' % _('Polarity change buffer'))
  1242. self.gerber_extra_buffering.setToolTip(
  1243. _("Will apply extra buffering for the\n"
  1244. "solid geometry when we have polarity changes.\n"
  1245. "May help loading Gerber files that otherwise\n"
  1246. "do not load correctly.")
  1247. )
  1248. grid0.addWidget(self.gerber_extra_buffering, 8, 0, 1, 3)
  1249. self.layout.addStretch()
  1250. class GerberOptPrefGroupUI(OptionsGroupUI):
  1251. def __init__(self, decimals=4, parent=None):
  1252. # OptionsGroupUI.__init__(self, "Gerber Options Preferences", parent=parent)
  1253. super(GerberOptPrefGroupUI, self).__init__(self)
  1254. self.decimals = decimals
  1255. self.setTitle(str(_("Gerber Options")))
  1256. # ## Isolation Routing
  1257. self.isolation_routing_label = QtWidgets.QLabel("<b>%s:</b>" % _("Isolation Routing"))
  1258. self.isolation_routing_label.setToolTip(
  1259. _("Create a Geometry object with\n"
  1260. "toolpaths to cut outside polygons.")
  1261. )
  1262. self.layout.addWidget(self.isolation_routing_label)
  1263. # Cutting Tool Diameter
  1264. grid0 = QtWidgets.QGridLayout()
  1265. self.layout.addLayout(grid0)
  1266. tdlabel = QtWidgets.QLabel('%s:' % _('Tool dia'))
  1267. tdlabel.setToolTip(
  1268. _("Diameter of the cutting tool.")
  1269. )
  1270. grid0.addWidget(tdlabel, 0, 0)
  1271. self.iso_tool_dia_entry = FCDoubleSpinner()
  1272. self.iso_tool_dia_entry.set_precision(self.decimals)
  1273. self.iso_tool_dia_entry.setSingleStep(0.1)
  1274. self.iso_tool_dia_entry.set_range(-9999, 9999)
  1275. grid0.addWidget(self.iso_tool_dia_entry, 0, 1)
  1276. # Nr of passes
  1277. passlabel = QtWidgets.QLabel('%s:' % _('# Passes'))
  1278. passlabel.setToolTip(
  1279. _("Width of the isolation gap in\n"
  1280. "number (integer) of tool widths.")
  1281. )
  1282. self.iso_width_entry = FCSpinner()
  1283. self.iso_width_entry.setRange(1, 999)
  1284. grid0.addWidget(passlabel, 1, 0)
  1285. grid0.addWidget(self.iso_width_entry, 1, 1)
  1286. # Pass overlap
  1287. overlabel = QtWidgets.QLabel('%s:' % _('Pass overlap'))
  1288. overlabel.setToolTip(
  1289. _("How much (fraction) of the tool width to overlap each tool pass.")
  1290. )
  1291. self.iso_overlap_entry = FCDoubleSpinner(suffix='%')
  1292. self.iso_overlap_entry.set_precision(self.decimals)
  1293. self.iso_overlap_entry.setWrapping(True)
  1294. self.iso_overlap_entry.setRange(0.0000, 99.9999)
  1295. self.iso_overlap_entry.setSingleStep(0.1)
  1296. grid0.addWidget(overlabel, 2, 0)
  1297. grid0.addWidget(self.iso_overlap_entry, 2, 1)
  1298. # Isolation Scope
  1299. self.iso_scope_label = QtWidgets.QLabel('%s:' % _('Scope'))
  1300. self.iso_scope_label.setToolTip(
  1301. _("Isolation scope. Choose what to isolate:\n"
  1302. "- 'All' -> Isolate all the polygons in the object\n"
  1303. "- 'Selection' -> Isolate a selection of polygons.")
  1304. )
  1305. self.iso_scope_radio = RadioSet([{'label': _('All'), 'value': 'all'},
  1306. {'label': _('Selection'), 'value': 'single'}])
  1307. grid0.addWidget(self.iso_scope_label, 3, 0)
  1308. grid0.addWidget(self.iso_scope_radio, 3, 1, 1, 2)
  1309. # Milling Type
  1310. milling_type_label = QtWidgets.QLabel('%s:' % _('Milling Type'))
  1311. milling_type_label.setToolTip(
  1312. _("Milling type:\n"
  1313. "- climb / best for precision milling and to reduce tool usage\n"
  1314. "- conventional / useful when there is no backlash compensation")
  1315. )
  1316. grid0.addWidget(milling_type_label, 4, 0)
  1317. self.milling_type_radio = RadioSet([{'label': _('Climb'), 'value': 'cl'},
  1318. {'label': _('Conv.'), 'value': 'cv'}])
  1319. grid0.addWidget(self.milling_type_radio, 4, 1)
  1320. # Combine passes
  1321. self.combine_passes_cb = FCCheckBox(label=_('Combine Passes'))
  1322. self.combine_passes_cb.setToolTip(
  1323. _("Combine all passes into one object")
  1324. )
  1325. grid0.addWidget(self.combine_passes_cb, 5, 0, 1, 2)
  1326. separator_line = QtWidgets.QFrame()
  1327. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  1328. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  1329. grid0.addWidget(separator_line, 6, 0, 1, 2)
  1330. # ## Clear non-copper regions
  1331. self.clearcopper_label = QtWidgets.QLabel("<b>%s:</b>" % _("Non-copper regions"))
  1332. self.clearcopper_label.setToolTip(
  1333. _("Create polygons covering the\n"
  1334. "areas without copper on the PCB.\n"
  1335. "Equivalent to the inverse of this\n"
  1336. "object. Can be used to remove all\n"
  1337. "copper from a specified region.")
  1338. )
  1339. self.layout.addWidget(self.clearcopper_label)
  1340. grid1 = QtWidgets.QGridLayout()
  1341. self.layout.addLayout(grid1)
  1342. # Margin
  1343. bmlabel = QtWidgets.QLabel('%s:' % _('Boundary Margin'))
  1344. bmlabel.setToolTip(
  1345. _("Specify the edge of the PCB\n"
  1346. "by drawing a box around all\n"
  1347. "objects with this minimum\n"
  1348. "distance.")
  1349. )
  1350. grid1.addWidget(bmlabel, 0, 0)
  1351. self.noncopper_margin_entry = FCDoubleSpinner()
  1352. self.noncopper_margin_entry.set_precision(self.decimals)
  1353. self.noncopper_margin_entry.setSingleStep(0.1)
  1354. self.noncopper_margin_entry.set_range(-9999, 9999)
  1355. grid1.addWidget(self.noncopper_margin_entry, 0, 1)
  1356. # Rounded corners
  1357. self.noncopper_rounded_cb = FCCheckBox(label=_("Rounded Geo"))
  1358. self.noncopper_rounded_cb.setToolTip(
  1359. _("Resulting geometry will have rounded corners.")
  1360. )
  1361. grid1.addWidget(self.noncopper_rounded_cb, 1, 0, 1, 2)
  1362. separator_line = QtWidgets.QFrame()
  1363. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  1364. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  1365. grid1.addWidget(separator_line, 2, 0, 1, 2)
  1366. # ## Bounding box
  1367. self.boundingbox_label = QtWidgets.QLabel('<b>%s:</b>' % _('Bounding Box'))
  1368. self.layout.addWidget(self.boundingbox_label)
  1369. grid2 = QtWidgets.QGridLayout()
  1370. self.layout.addLayout(grid2)
  1371. bbmargin = QtWidgets.QLabel('%s:' % _('Boundary Margin'))
  1372. bbmargin.setToolTip(
  1373. _("Distance of the edges of the box\n"
  1374. "to the nearest polygon.")
  1375. )
  1376. self.bbmargin_entry = FCDoubleSpinner()
  1377. self.bbmargin_entry.set_precision(self.decimals)
  1378. self.bbmargin_entry.setSingleStep(0.1)
  1379. self.bbmargin_entry.set_range(-9999, 9999)
  1380. grid2.addWidget(bbmargin, 0, 0)
  1381. grid2.addWidget(self.bbmargin_entry, 0, 1)
  1382. self.bbrounded_cb = FCCheckBox(label='%s' % _("Rounded Geo"))
  1383. self.bbrounded_cb.setToolTip(
  1384. _("If the bounding box is \n"
  1385. "to have rounded corners\n"
  1386. "their radius is equal to\n"
  1387. "the margin.")
  1388. )
  1389. grid2.addWidget(self.bbrounded_cb, 1, 0, 1, 2)
  1390. self.layout.addStretch()
  1391. class GerberAdvOptPrefGroupUI(OptionsGroupUI):
  1392. def __init__(self, decimals=4, parent=None):
  1393. # OptionsGroupUI.__init__(self, "Gerber Adv. Options Preferences", parent=parent)
  1394. super(GerberAdvOptPrefGroupUI, self).__init__(self)
  1395. self.setTitle(str(_("Gerber Adv. Options")))
  1396. self.decimals = decimals
  1397. # ## Advanced Gerber Parameters
  1398. self.adv_param_label = QtWidgets.QLabel('<b>%s:</b>' % _('Advanced Options'))
  1399. self.adv_param_label.setToolTip(
  1400. _("A list of Gerber advanced parameters.\n"
  1401. "Those parameters are available only for\n"
  1402. "Advanced App. Level.")
  1403. )
  1404. self.layout.addWidget(self.adv_param_label)
  1405. grid0 = QtWidgets.QGridLayout()
  1406. self.layout.addLayout(grid0)
  1407. # Follow Attribute
  1408. self.follow_cb = FCCheckBox(label=_('"Follow"'))
  1409. self.follow_cb.setToolTip(
  1410. _("Generate a 'Follow' geometry.\n"
  1411. "This means that it will cut through\n"
  1412. "the middle of the trace.")
  1413. )
  1414. grid0.addWidget(self.follow_cb, 0, 0, 1, 2)
  1415. # Aperture Table Visibility CB
  1416. self.aperture_table_visibility_cb = FCCheckBox(label=_('Table Show/Hide'))
  1417. self.aperture_table_visibility_cb.setToolTip(
  1418. _("Toggle the display of the Gerber Apertures Table.\n"
  1419. "Also, on hide, it will delete all mark shapes\n"
  1420. "that are drawn on canvas.")
  1421. )
  1422. grid0.addWidget(self.aperture_table_visibility_cb, 1, 0, 1, 2)
  1423. separator_line = QtWidgets.QFrame()
  1424. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  1425. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  1426. grid0.addWidget(separator_line, 2, 0, 1, 2)
  1427. # Tool Type
  1428. self.tool_type_label = QtWidgets.QLabel('<b>%s</b>' % _('Tool Type'))
  1429. self.tool_type_label.setToolTip(
  1430. _("Choose what tool to use for Gerber isolation:\n"
  1431. "'Circular' or 'V-shape'.\n"
  1432. "When the 'V-shape' is selected then the tool\n"
  1433. "diameter will depend on the chosen cut depth.")
  1434. )
  1435. self.tool_type_radio = RadioSet([{'label': 'Circular', 'value': 'circular'},
  1436. {'label': 'V-Shape', 'value': 'v'}])
  1437. grid0.addWidget(self.tool_type_label, 3, 0)
  1438. grid0.addWidget(self.tool_type_radio, 3, 1, 1, 2)
  1439. # Tip Dia
  1440. self.tipdialabel = QtWidgets.QLabel('%s:' % _('V-Tip Dia'))
  1441. self.tipdialabel.setToolTip(
  1442. _("The tip diameter for V-Shape Tool")
  1443. )
  1444. self.tipdia_spinner = FCDoubleSpinner()
  1445. self.tipdia_spinner.set_precision(self.decimals)
  1446. self.tipdia_spinner.set_range(-99.9999, 99.9999)
  1447. self.tipdia_spinner.setSingleStep(0.1)
  1448. self.tipdia_spinner.setWrapping(True)
  1449. grid0.addWidget(self.tipdialabel, 4, 0)
  1450. grid0.addWidget(self.tipdia_spinner, 4, 1, 1, 2)
  1451. # Tip Angle
  1452. self.tipanglelabel = QtWidgets.QLabel('%s:' % _('V-Tip Angle'))
  1453. self.tipanglelabel.setToolTip(
  1454. _("The tip angle for V-Shape Tool.\n"
  1455. "In degree.")
  1456. )
  1457. self.tipangle_spinner = FCSpinner()
  1458. self.tipangle_spinner.set_range(0, 180)
  1459. self.tipangle_spinner.setSingleStep(5)
  1460. self.tipangle_spinner.setWrapping(True)
  1461. grid0.addWidget(self.tipanglelabel, 5, 0)
  1462. grid0.addWidget(self.tipangle_spinner, 5, 1, 1, 2)
  1463. # Cut Z
  1464. self.cutzlabel = QtWidgets.QLabel('%s:' % _('Cut Z'))
  1465. self.cutzlabel.setToolTip(
  1466. _("Cutting depth (negative)\n"
  1467. "below the copper surface.")
  1468. )
  1469. self.cutz_spinner = FCDoubleSpinner()
  1470. self.cutz_spinner.set_precision(self.decimals)
  1471. self.cutz_spinner.set_range(-99.9999, 0.0000)
  1472. self.cutz_spinner.setSingleStep(0.1)
  1473. self.cutz_spinner.setWrapping(True)
  1474. grid0.addWidget(self.cutzlabel, 6, 0)
  1475. grid0.addWidget(self.cutz_spinner, 6, 1, 1, 2)
  1476. # Isolation Type
  1477. self.iso_type_label = QtWidgets.QLabel('%s:' % _('Isolation Type'))
  1478. self.iso_type_label.setToolTip(
  1479. _("Choose how the isolation will be executed:\n"
  1480. "- 'Full' -> complete isolation of polygons\n"
  1481. "- 'Ext' -> will isolate only on the outside\n"
  1482. "- 'Int' -> will isolate only on the inside\n"
  1483. "'Exterior' isolation is almost always possible\n"
  1484. "(with the right tool) but 'Interior'\n"
  1485. "isolation can be done only when there is an opening\n"
  1486. "inside of the polygon (e.g polygon is a 'doughnut' shape).")
  1487. )
  1488. self.iso_type_radio = RadioSet([{'label': _('Full'), 'value': 'full'},
  1489. {'label': _('Exterior'), 'value': 'ext'},
  1490. {'label': _('Interior'), 'value': 'int'}])
  1491. grid0.addWidget(self.iso_type_label, 7, 0,)
  1492. grid0.addWidget(self.iso_type_radio, 7, 1, 1, 2)
  1493. separator_line = QtWidgets.QFrame()
  1494. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  1495. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  1496. grid0.addWidget(separator_line, 8, 0, 1, 2)
  1497. # Buffering Type
  1498. buffering_label = QtWidgets.QLabel('%s:' % _('Buffering'))
  1499. buffering_label.setToolTip(
  1500. _("Buffering type:\n"
  1501. "- None --> best performance, fast file loading but no so good display\n"
  1502. "- Full --> slow file loading but good visuals. This is the default.\n"
  1503. "<<WARNING>>: Don't change this unless you know what you are doing !!!")
  1504. )
  1505. self.buffering_radio = RadioSet([{'label': _('None'), 'value': 'no'},
  1506. {'label': _('Full'), 'value': 'full'}])
  1507. grid0.addWidget(buffering_label, 9, 0)
  1508. grid0.addWidget(self.buffering_radio, 9, 1)
  1509. # Simplification
  1510. self.simplify_cb = FCCheckBox(label=_('Simplify'))
  1511. self.simplify_cb.setToolTip(
  1512. _("When checked all the Gerber polygons will be\n"
  1513. "loaded with simplification having a set tolerance.\n"
  1514. "<<WARNING>>: Don't change this unless you know what you are doing !!!")
  1515. )
  1516. grid0.addWidget(self.simplify_cb, 10, 0, 1, 2)
  1517. # Simplification tolerance
  1518. self.simplification_tol_label = QtWidgets.QLabel(_('Tolerance'))
  1519. self.simplification_tol_label.setToolTip(_("Tolerance for polygon simplification."))
  1520. self.simplification_tol_spinner = FCDoubleSpinner()
  1521. self.simplification_tol_spinner.set_precision(self.decimals + 1)
  1522. self.simplification_tol_spinner.setWrapping(True)
  1523. self.simplification_tol_spinner.setRange(0.00000, 0.01000)
  1524. self.simplification_tol_spinner.setSingleStep(0.0001)
  1525. grid0.addWidget(self.simplification_tol_label, 11, 0)
  1526. grid0.addWidget(self.simplification_tol_spinner, 11, 1)
  1527. self.ois_simplif = OptionalInputSection(
  1528. self.simplify_cb,
  1529. [
  1530. self.simplification_tol_label, self.simplification_tol_spinner
  1531. ],
  1532. logic=True)
  1533. self.layout.addStretch()
  1534. class GerberExpPrefGroupUI(OptionsGroupUI):
  1535. def __init__(self, decimals=4, parent=None):
  1536. super(GerberExpPrefGroupUI, self).__init__(self)
  1537. self.setTitle(str(_("Gerber Export")))
  1538. self.decimals = decimals
  1539. # Plot options
  1540. self.export_options_label = QtWidgets.QLabel("<b>%s:</b>" % _("Export Options"))
  1541. self.export_options_label.setToolTip(
  1542. _("The parameters set here are used in the file exported\n"
  1543. "when using the File -> Export -> Export Gerber menu entry.")
  1544. )
  1545. self.layout.addWidget(self.export_options_label)
  1546. form = QtWidgets.QFormLayout()
  1547. self.layout.addLayout(form)
  1548. # Gerber Units
  1549. self.gerber_units_label = QtWidgets.QLabel('<b>%s:</b>' % _('Units'))
  1550. self.gerber_units_label.setToolTip(
  1551. _("The units used in the Gerber file.")
  1552. )
  1553. self.gerber_units_radio = RadioSet([{'label': _('INCH'), 'value': 'IN'},
  1554. {'label': _('MM'), 'value': 'MM'}])
  1555. self.gerber_units_radio.setToolTip(
  1556. _("The units used in the Gerber file.")
  1557. )
  1558. form.addRow(self.gerber_units_label, self.gerber_units_radio)
  1559. # Gerber format
  1560. self.digits_label = QtWidgets.QLabel("<b>%s:</b>" % _("Int/Decimals"))
  1561. self.digits_label.setToolTip(
  1562. _("The number of digits in the whole part of the number\n"
  1563. "and in the fractional part of the number.")
  1564. )
  1565. hlay1 = QtWidgets.QHBoxLayout()
  1566. self.format_whole_entry = FCSpinner()
  1567. self.format_whole_entry.set_range(0, 9)
  1568. self.format_whole_entry.setSingleStep(1)
  1569. self.format_whole_entry.setWrapping(True)
  1570. self.format_whole_entry.setMinimumWidth(30)
  1571. self.format_whole_entry.setToolTip(
  1572. _("This numbers signify the number of digits in\n"
  1573. "the whole part of Gerber coordinates.")
  1574. )
  1575. hlay1.addWidget(self.format_whole_entry, QtCore.Qt.AlignLeft)
  1576. gerber_separator_label = QtWidgets.QLabel(':')
  1577. gerber_separator_label.setFixedWidth(5)
  1578. hlay1.addWidget(gerber_separator_label, QtCore.Qt.AlignLeft)
  1579. self.format_dec_entry = FCSpinner()
  1580. self.format_dec_entry.set_range(0, 9)
  1581. self.format_dec_entry.setSingleStep(1)
  1582. self.format_dec_entry.setWrapping(True)
  1583. self.format_dec_entry.setMinimumWidth(30)
  1584. self.format_dec_entry.setToolTip(
  1585. _("This numbers signify the number of digits in\n"
  1586. "the decimal part of Gerber coordinates.")
  1587. )
  1588. hlay1.addWidget(self.format_dec_entry, QtCore.Qt.AlignLeft)
  1589. hlay1.addStretch()
  1590. form.addRow(self.digits_label, hlay1)
  1591. # Gerber Zeros
  1592. self.zeros_label = QtWidgets.QLabel('<b>%s:</b>' % _('Zeros'))
  1593. self.zeros_label.setAlignment(QtCore.Qt.AlignLeft)
  1594. self.zeros_label.setToolTip(
  1595. _("This sets the type of Gerber zeros.\n"
  1596. "If LZ then Leading Zeros are removed and\n"
  1597. "Trailing Zeros are kept.\n"
  1598. "If TZ is checked then Trailing Zeros are removed\n"
  1599. "and Leading Zeros are kept.")
  1600. )
  1601. self.zeros_radio = RadioSet([{'label': _('LZ'), 'value': 'L'},
  1602. {'label': _('TZ'), 'value': 'T'}])
  1603. self.zeros_radio.setToolTip(
  1604. _("This sets the type of Gerber zeros.\n"
  1605. "If LZ then Leading Zeros are removed and\n"
  1606. "Trailing Zeros are kept.\n"
  1607. "If TZ is checked then Trailing Zeros are removed\n"
  1608. "and Leading Zeros are kept.")
  1609. )
  1610. form.addRow(self.zeros_label, self.zeros_radio)
  1611. self.layout.addStretch()
  1612. class GerberEditorPrefGroupUI(OptionsGroupUI):
  1613. def __init__(self, decimals=4, parent=None):
  1614. # OptionsGroupUI.__init__(self, "Gerber Adv. Options Preferences", parent=parent)
  1615. super(GerberEditorPrefGroupUI, self).__init__(self)
  1616. self.setTitle(str(_("Gerber Editor")))
  1617. self.decimals = decimals
  1618. # Advanced Gerber Parameters
  1619. self.param_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  1620. self.param_label.setToolTip(
  1621. _("A list of Gerber Editor parameters.")
  1622. )
  1623. self.layout.addWidget(self.param_label)
  1624. grid0 = QtWidgets.QGridLayout()
  1625. self.layout.addLayout(grid0)
  1626. # Selection Limit
  1627. self.sel_limit_label = QtWidgets.QLabel('%s:' % _("Selection limit"))
  1628. self.sel_limit_label.setToolTip(
  1629. _("Set the number of selected Gerber geometry\n"
  1630. "items above which the utility geometry\n"
  1631. "becomes just a selection rectangle.\n"
  1632. "Increases the performance when moving a\n"
  1633. "large number of geometric elements.")
  1634. )
  1635. self.sel_limit_entry = FCSpinner()
  1636. self.sel_limit_entry.set_range(0, 9999)
  1637. grid0.addWidget(self.sel_limit_label, 0, 0)
  1638. grid0.addWidget(self.sel_limit_entry, 0, 1)
  1639. # New aperture code
  1640. self.addcode_entry_lbl = QtWidgets.QLabel('%s:' % _('New Aperture code'))
  1641. self.addcode_entry_lbl.setToolTip(
  1642. _("Code for the new aperture")
  1643. )
  1644. self.addcode_entry = FCSpinner()
  1645. self.addcode_entry.set_range(10, 99)
  1646. self.addcode_entry.setWrapping(True)
  1647. grid0.addWidget(self.addcode_entry_lbl, 1, 0)
  1648. grid0.addWidget(self.addcode_entry, 1, 1)
  1649. # New aperture size
  1650. self.addsize_entry_lbl = QtWidgets.QLabel('%s:' % _('New Aperture size'))
  1651. self.addsize_entry_lbl.setToolTip(
  1652. _("Size for the new aperture")
  1653. )
  1654. self.addsize_entry = FCDoubleSpinner()
  1655. self.addsize_entry.set_range(0, 100)
  1656. self.addsize_entry.set_precision(self.decimals)
  1657. grid0.addWidget(self.addsize_entry_lbl, 2, 0)
  1658. grid0.addWidget(self.addsize_entry, 2, 1)
  1659. # New aperture type
  1660. self.addtype_combo_lbl = QtWidgets.QLabel('%s:' % _('New Aperture type'))
  1661. self.addtype_combo_lbl.setToolTip(
  1662. _("Type for the new aperture.\n"
  1663. "Can be 'C', 'R' or 'O'.")
  1664. )
  1665. self.addtype_combo = FCComboBox()
  1666. self.addtype_combo.addItems(['C', 'R', 'O'])
  1667. grid0.addWidget(self.addtype_combo_lbl, 3, 0)
  1668. grid0.addWidget(self.addtype_combo, 3, 1)
  1669. # Number of pads in a pad array
  1670. self.grb_array_size_label = QtWidgets.QLabel('%s:' % _('Nr of pads'))
  1671. self.grb_array_size_label.setToolTip(
  1672. _("Specify how many pads to be in the array.")
  1673. )
  1674. self.grb_array_size_entry = FCSpinner()
  1675. self.grb_array_size_entry.set_range(0, 9999)
  1676. grid0.addWidget(self.grb_array_size_label, 4, 0)
  1677. grid0.addWidget(self.grb_array_size_entry, 4, 1)
  1678. self.adddim_label = QtWidgets.QLabel('%s:' % _('Aperture Dimensions'))
  1679. self.adddim_label.setToolTip(
  1680. _("Diameters of the cutting tools, separated by ','")
  1681. )
  1682. grid0.addWidget(self.adddim_label, 5, 0)
  1683. self.adddim_entry = FCEntry()
  1684. grid0.addWidget(self.adddim_entry, 5, 1)
  1685. self.grb_array_linear_label = QtWidgets.QLabel('<b>%s:</b>' % _('Linear Pad Array'))
  1686. grid0.addWidget(self.grb_array_linear_label, 6, 0, 1, 2)
  1687. # Linear Pad Array direction
  1688. self.grb_axis_label = QtWidgets.QLabel('%s:' % _('Linear Direction'))
  1689. self.grb_axis_label.setToolTip(
  1690. _("Direction on which the linear array is oriented:\n"
  1691. "- 'X' - horizontal axis \n"
  1692. "- 'Y' - vertical axis or \n"
  1693. "- 'Angle' - a custom angle for the array inclination")
  1694. )
  1695. self.grb_axis_radio = RadioSet([{'label': _('X'), 'value': 'X'},
  1696. {'label': _('Y'), 'value': 'Y'},
  1697. {'label': _('Angle'), 'value': 'A'}])
  1698. grid0.addWidget(self.grb_axis_label, 7, 0)
  1699. grid0.addWidget(self.grb_axis_radio, 7, 1)
  1700. # Linear Pad Array pitch distance
  1701. self.grb_pitch_label = QtWidgets.QLabel('%s:' % _('Pitch'))
  1702. self.grb_pitch_label.setToolTip(
  1703. _("Pitch = Distance between elements of the array.")
  1704. )
  1705. # self.drill_pitch_label.setMinimumWidth(100)
  1706. self.grb_pitch_entry = FCDoubleSpinner()
  1707. self.grb_pitch_entry.set_precision(self.decimals)
  1708. grid0.addWidget(self.grb_pitch_label, 8, 0)
  1709. grid0.addWidget(self.grb_pitch_entry, 8, 1)
  1710. # Linear Pad Array custom angle
  1711. self.grb_angle_label = QtWidgets.QLabel('%s:' % _('Angle'))
  1712. self.grb_angle_label.setToolTip(
  1713. _("Angle at which each element in circular array is placed.")
  1714. )
  1715. self.grb_angle_entry = FCDoubleSpinner()
  1716. self.grb_angle_entry.set_precision(self.decimals)
  1717. self.grb_angle_entry.set_range(-360, 360)
  1718. self.grb_angle_entry.setSingleStep(5)
  1719. grid0.addWidget(self.grb_angle_label, 9, 0)
  1720. grid0.addWidget(self.grb_angle_entry, 9, 1)
  1721. self.grb_array_circ_label = QtWidgets.QLabel('<b>%s:</b>' % _('Circular Pad Array'))
  1722. grid0.addWidget(self.grb_array_circ_label, 10, 0, 1, 2)
  1723. # Circular Pad Array direction
  1724. self.grb_circular_direction_label = QtWidgets.QLabel('%s:' % _('Circular Direction'))
  1725. self.grb_circular_direction_label.setToolTip(
  1726. _("Direction for circular array.\n"
  1727. "Can be CW = clockwise or CCW = counter clockwise.")
  1728. )
  1729. self.grb_circular_dir_radio = RadioSet([{'label': _('CW'), 'value': 'CW'},
  1730. {'label': _('CCW'), 'value': 'CCW'}])
  1731. grid0.addWidget(self.grb_circular_direction_label, 11, 0)
  1732. grid0.addWidget(self.grb_circular_dir_radio, 11, 1)
  1733. # Circular Pad Array Angle
  1734. self.grb_circular_angle_label = QtWidgets.QLabel('%s:' % _('Circular Angle'))
  1735. self.grb_circular_angle_label.setToolTip(
  1736. _("Angle at which each element in circular array is placed.")
  1737. )
  1738. self.grb_circular_angle_entry = FCDoubleSpinner()
  1739. self.grb_circular_angle_entry.set_precision(self.decimals)
  1740. self.grb_circular_angle_entry.set_range(-360, 360)
  1741. self.grb_circular_angle_entry.setSingleStep(5)
  1742. grid0.addWidget(self.grb_circular_angle_label, 12, 0)
  1743. grid0.addWidget(self.grb_circular_angle_entry, 12, 1)
  1744. self.grb_array_tools_b_label = QtWidgets.QLabel('<b>%s:</b>' % _('Buffer Tool'))
  1745. grid0.addWidget(self.grb_array_tools_b_label, 13, 0, 1, 2)
  1746. # Buffer Distance
  1747. self.grb_buff_label = QtWidgets.QLabel('%s:' % _('Buffer distance'))
  1748. self.grb_buff_label.setToolTip(
  1749. _("Distance at which to buffer the Gerber element.")
  1750. )
  1751. self.grb_buff_entry = FCDoubleSpinner()
  1752. self.grb_buff_entry.set_precision(self.decimals)
  1753. self.grb_buff_entry.set_range(-9999, 9999)
  1754. grid0.addWidget(self.grb_buff_label, 14, 0)
  1755. grid0.addWidget(self.grb_buff_entry, 14, 1)
  1756. self.grb_array_tools_s_label = QtWidgets.QLabel('<b>%s:</b>' % _('Scale Tool'))
  1757. grid0.addWidget(self.grb_array_tools_s_label, 15, 0, 1, 2)
  1758. # Scale Factor
  1759. self.grb_scale_label = QtWidgets.QLabel('%s:' % _('Scale factor'))
  1760. self.grb_scale_label.setToolTip(
  1761. _("Factor to scale the Gerber element.")
  1762. )
  1763. self.grb_scale_entry = FCDoubleSpinner()
  1764. self.grb_scale_entry.set_precision(self.decimals)
  1765. self.grb_scale_entry.set_range(0, 9999)
  1766. grid0.addWidget(self.grb_scale_label, 16, 0)
  1767. grid0.addWidget(self.grb_scale_entry, 16, 1)
  1768. self.grb_array_tools_ma_label = QtWidgets.QLabel('<b>%s:</b>' % _('Mark Area Tool'))
  1769. grid0.addWidget(self.grb_array_tools_ma_label, 17, 0, 1, 2)
  1770. # Mark area Tool low threshold
  1771. self.grb_ma_low_label = QtWidgets.QLabel('%s:' % _('Threshold low'))
  1772. self.grb_ma_low_label.setToolTip(
  1773. _("Threshold value under which the apertures are not marked.")
  1774. )
  1775. self.grb_ma_low_entry = FCDoubleSpinner()
  1776. self.grb_ma_low_entry.set_precision(self.decimals)
  1777. self.grb_ma_low_entry.set_range(0, 9999)
  1778. grid0.addWidget(self.grb_ma_low_label, 18, 0)
  1779. grid0.addWidget(self.grb_ma_low_entry, 18, 1)
  1780. # Mark area Tool high threshold
  1781. self.grb_ma_high_label = QtWidgets.QLabel('%s:' % _('Threshold high'))
  1782. self.grb_ma_high_label.setToolTip(
  1783. _("Threshold value over which the apertures are not marked.")
  1784. )
  1785. self.grb_ma_high_entry = FCDoubleSpinner()
  1786. self.grb_ma_high_entry.set_precision(self.decimals)
  1787. self.grb_ma_high_entry.set_range(0, 9999)
  1788. grid0.addWidget(self.grb_ma_high_label, 19, 0)
  1789. grid0.addWidget(self.grb_ma_high_entry, 19, 1)
  1790. self.layout.addStretch()
  1791. class ExcellonGenPrefGroupUI(OptionsGroupUI):
  1792. def __init__(self, decimals=4, parent=None):
  1793. # OptionsGroupUI.__init__(self, "Excellon Options", parent=parent)
  1794. super(ExcellonGenPrefGroupUI, self).__init__(self)
  1795. self.setTitle(str(_("Excellon General")))
  1796. self.decimals = decimals
  1797. # Plot options
  1798. self.plot_options_label = QtWidgets.QLabel("<b>%s:</b>" % _("Plot Options"))
  1799. self.layout.addWidget(self.plot_options_label)
  1800. grid1 = QtWidgets.QGridLayout()
  1801. self.layout.addLayout(grid1)
  1802. self.plot_cb = FCCheckBox(label=_('Plot'))
  1803. self.plot_cb.setToolTip(
  1804. "Plot (show) this object."
  1805. )
  1806. grid1.addWidget(self.plot_cb, 0, 0)
  1807. self.solid_cb = FCCheckBox(label=_('Solid'))
  1808. self.solid_cb.setToolTip(
  1809. "Plot as solid circles."
  1810. )
  1811. grid1.addWidget(self.solid_cb, 0, 1)
  1812. # Excellon format
  1813. self.excellon_format_label = QtWidgets.QLabel("<b>%s:</b>" % _("Excellon Format"))
  1814. self.excellon_format_label.setToolTip(
  1815. _("The NC drill files, usually named Excellon files\n"
  1816. "are files that can be found in different formats.\n"
  1817. "Here we set the format used when the provided\n"
  1818. "coordinates are not using period.\n"
  1819. "\n"
  1820. "Possible presets:\n"
  1821. "\n"
  1822. "PROTEUS 3:3 MM LZ\n"
  1823. "DipTrace 5:2 MM TZ\n"
  1824. "DipTrace 4:3 MM LZ\n"
  1825. "\n"
  1826. "EAGLE 3:3 MM TZ\n"
  1827. "EAGLE 4:3 MM TZ\n"
  1828. "EAGLE 2:5 INCH TZ\n"
  1829. "EAGLE 3:5 INCH TZ\n"
  1830. "\n"
  1831. "ALTIUM 2:4 INCH LZ\n"
  1832. "Sprint Layout 2:4 INCH LZ"
  1833. "\n"
  1834. "KiCAD 3:5 INCH TZ")
  1835. )
  1836. self.layout.addWidget(self.excellon_format_label)
  1837. hlay1 = QtWidgets.QHBoxLayout()
  1838. self.layout.addLayout(hlay1)
  1839. self.excellon_format_in_label = QtWidgets.QLabel('%s:' % _("INCH"))
  1840. self.excellon_format_in_label.setAlignment(QtCore.Qt.AlignLeft)
  1841. self.excellon_format_in_label.setToolTip(
  1842. _("Default values for INCH are 2:4"))
  1843. hlay1.addWidget(self.excellon_format_in_label, QtCore.Qt.AlignLeft)
  1844. self.excellon_format_upper_in_entry = FCSpinner()
  1845. self.excellon_format_upper_in_entry.set_range(0, 9)
  1846. self.excellon_format_upper_in_entry.setMinimumWidth(30)
  1847. self.excellon_format_upper_in_entry.setToolTip(
  1848. _("This numbers signify the number of digits in\n"
  1849. "the whole part of Excellon coordinates.")
  1850. )
  1851. hlay1.addWidget(self.excellon_format_upper_in_entry, QtCore.Qt.AlignLeft)
  1852. excellon_separator_in_label = QtWidgets.QLabel(':')
  1853. excellon_separator_in_label.setFixedWidth(5)
  1854. hlay1.addWidget(excellon_separator_in_label, QtCore.Qt.AlignLeft)
  1855. self.excellon_format_lower_in_entry = FCSpinner()
  1856. self.excellon_format_lower_in_entry.set_range(0, 9)
  1857. self.excellon_format_lower_in_entry.setMinimumWidth(30)
  1858. self.excellon_format_lower_in_entry.setToolTip(
  1859. _("This numbers signify the number of digits in\n"
  1860. "the decimal part of Excellon coordinates.")
  1861. )
  1862. hlay1.addWidget(self.excellon_format_lower_in_entry, QtCore.Qt.AlignLeft)
  1863. hlay1.addStretch()
  1864. hlay2 = QtWidgets.QHBoxLayout()
  1865. self.layout.addLayout(hlay2)
  1866. self.excellon_format_mm_label = QtWidgets.QLabel('%s:' % _("METRIC"))
  1867. self.excellon_format_mm_label.setAlignment(QtCore.Qt.AlignLeft)
  1868. self.excellon_format_mm_label.setToolTip(
  1869. _("Default values for METRIC are 3:3"))
  1870. hlay2.addWidget(self.excellon_format_mm_label, QtCore.Qt.AlignLeft)
  1871. self.excellon_format_upper_mm_entry = FCSpinner()
  1872. self.excellon_format_upper_mm_entry.set_range(0, 9)
  1873. self.excellon_format_upper_mm_entry.setMinimumWidth(30)
  1874. self.excellon_format_upper_mm_entry.setToolTip(
  1875. _("This numbers signify the number of digits in\n"
  1876. "the whole part of Excellon coordinates.")
  1877. )
  1878. hlay2.addWidget(self.excellon_format_upper_mm_entry, QtCore.Qt.AlignLeft)
  1879. excellon_separator_mm_label = QtWidgets.QLabel(':')
  1880. excellon_separator_mm_label.setFixedWidth(5)
  1881. hlay2.addWidget(excellon_separator_mm_label, QtCore.Qt.AlignLeft)
  1882. self.excellon_format_lower_mm_entry = FCSpinner()
  1883. self.excellon_format_lower_mm_entry.set_range(0, 9)
  1884. self.excellon_format_lower_mm_entry.setMinimumWidth(30)
  1885. self.excellon_format_lower_mm_entry.setToolTip(
  1886. _("This numbers signify the number of digits in\n"
  1887. "the decimal part of Excellon coordinates.")
  1888. )
  1889. hlay2.addWidget(self.excellon_format_lower_mm_entry, QtCore.Qt.AlignLeft)
  1890. hlay2.addStretch()
  1891. grid2 = QtWidgets.QGridLayout()
  1892. self.layout.addLayout(grid2)
  1893. self.excellon_zeros_label = QtWidgets.QLabel('%s:' % _('Default <b>Zeros</b>'))
  1894. self.excellon_zeros_label.setAlignment(QtCore.Qt.AlignLeft)
  1895. self.excellon_zeros_label.setToolTip(
  1896. _("This sets the type of Excellon zeros.\n"
  1897. "If LZ then Leading Zeros are kept and\n"
  1898. "Trailing Zeros are removed.\n"
  1899. "If TZ is checked then Trailing Zeros are kept\n"
  1900. "and Leading Zeros are removed.")
  1901. )
  1902. grid2.addWidget(self.excellon_zeros_label, 0, 0)
  1903. self.excellon_zeros_radio = RadioSet([{'label': _('LZ'), 'value': 'L'},
  1904. {'label': _('TZ'), 'value': 'T'}])
  1905. self.excellon_zeros_radio.setToolTip(
  1906. _("This sets the default type of Excellon zeros.\n"
  1907. "If it is not detected in the parsed file the value here\n"
  1908. "will be used."
  1909. "If LZ then Leading Zeros are kept and\n"
  1910. "Trailing Zeros are removed.\n"
  1911. "If TZ is checked then Trailing Zeros are kept\n"
  1912. "and Leading Zeros are removed.")
  1913. )
  1914. grid2.addWidget(self.excellon_zeros_radio, 0, 1)
  1915. self.excellon_units_label = QtWidgets.QLabel('%s:' % _('Default <b>Units</b>'))
  1916. self.excellon_units_label.setAlignment(QtCore.Qt.AlignLeft)
  1917. self.excellon_units_label.setToolTip(
  1918. _("This sets the default units of Excellon files.\n"
  1919. "If it is not detected in the parsed file the value here\n"
  1920. "will be used."
  1921. "Some Excellon files don't have an header\n"
  1922. "therefore this parameter will be used.")
  1923. )
  1924. grid2.addWidget(self.excellon_units_label, 1, 0)
  1925. self.excellon_units_radio = RadioSet([{'label': _('INCH'), 'value': 'INCH'},
  1926. {'label': _('MM'), 'value': 'METRIC'}])
  1927. self.excellon_units_radio.setToolTip(
  1928. _("This sets the units of Excellon files.\n"
  1929. "Some Excellon files don't have an header\n"
  1930. "therefore this parameter will be used.")
  1931. )
  1932. grid2.addWidget(self.excellon_units_radio, 1, 1)
  1933. self.update_excellon_cb = FCCheckBox(label=_('Update Export settings'))
  1934. self.update_excellon_cb.setToolTip(
  1935. "If checked, the Excellon Export settings will be updated with the ones above."
  1936. )
  1937. grid2.addWidget(self.update_excellon_cb, 2, 0, 1, 2)
  1938. grid2.addWidget(QtWidgets.QLabel(""), 3, 0)
  1939. self.excellon_general_label = QtWidgets.QLabel("<b>%s:</b>" % _("Excellon Optimization"))
  1940. grid2.addWidget(self.excellon_general_label, 4, 0, 1, 2)
  1941. self.excellon_optimization_label = QtWidgets.QLabel(_('Algorithm:'))
  1942. self.excellon_optimization_label.setToolTip(
  1943. _("This sets the optimization type for the Excellon drill path.\n"
  1944. "If <<MetaHeuristic>> is checked then Google OR-Tools algorithm with\n"
  1945. "MetaHeuristic Guided Local Path is used. Default search time is 3sec.\n"
  1946. "If <<Basic>> is checked then Google OR-Tools Basic algorithm is used.\n"
  1947. "If <<TSA>> is checked then Travelling Salesman algorithm is used for\n"
  1948. "drill path optimization.\n"
  1949. "\n"
  1950. "If this control is disabled, then FlatCAM works in 32bit mode and it uses\n"
  1951. "Travelling Salesman algorithm for path optimization.")
  1952. )
  1953. grid2.addWidget(self.excellon_optimization_label, 5, 0)
  1954. self.excellon_optimization_radio = RadioSet([{'label': _('MetaHeuristic'), 'value': 'M'},
  1955. {'label': _('Basic'), 'value': 'B'},
  1956. {'label': _('TSA'), 'value': 'T'}],
  1957. orientation='vertical', stretch=False)
  1958. self.excellon_optimization_radio.setToolTip(
  1959. _("This sets the optimization type for the Excellon drill path.\n"
  1960. "If <<MetaHeuristic>> is checked then Google OR-Tools algorithm with\n"
  1961. "MetaHeuristic Guided Local Path is used. Default search time is 3sec.\n"
  1962. "If <<Basic>> is checked then Google OR-Tools Basic algorithm is used.\n"
  1963. "If <<TSA>> is checked then Travelling Salesman algorithm is used for\n"
  1964. "drill path optimization.\n"
  1965. "\n"
  1966. "If this control is disabled, then FlatCAM works in 32bit mode and it uses\n"
  1967. "Travelling Salesman algorithm for path optimization.")
  1968. )
  1969. grid2.addWidget(self.excellon_optimization_radio, 5, 1)
  1970. self.optimization_time_label = QtWidgets.QLabel('%s:' % _('Optimization Time'))
  1971. self.optimization_time_label.setAlignment(QtCore.Qt.AlignLeft)
  1972. self.optimization_time_label.setToolTip(
  1973. _("When OR-Tools Metaheuristic (MH) is enabled there is a\n"
  1974. "maximum threshold for how much time is spent doing the\n"
  1975. "path optimization. This max duration is set here.\n"
  1976. "In seconds.")
  1977. )
  1978. grid2.addWidget(self.optimization_time_label, 6, 0)
  1979. self.optimization_time_entry = FCSpinner()
  1980. self.optimization_time_entry.set_range(0, 999)
  1981. grid2.addWidget(self.optimization_time_entry, 6, 1)
  1982. current_platform = platform.architecture()[0]
  1983. if current_platform == '64bit':
  1984. self.excellon_optimization_label.setDisabled(False)
  1985. self.excellon_optimization_radio.setDisabled(False)
  1986. self.optimization_time_label.setDisabled(False)
  1987. self.optimization_time_entry.setDisabled(False)
  1988. self.excellon_optimization_radio.activated_custom.connect(self.optimization_selection)
  1989. else:
  1990. self.excellon_optimization_label.setDisabled(True)
  1991. self.excellon_optimization_radio.setDisabled(True)
  1992. self.optimization_time_label.setDisabled(True)
  1993. self.optimization_time_entry.setDisabled(True)
  1994. self.layout.addStretch()
  1995. def optimization_selection(self):
  1996. if self.excellon_optimization_radio.get_value() == 'M':
  1997. self.optimization_time_label.setDisabled(False)
  1998. self.optimization_time_entry.setDisabled(False)
  1999. else:
  2000. self.optimization_time_label.setDisabled(True)
  2001. self.optimization_time_entry.setDisabled(True)
  2002. class ExcellonOptPrefGroupUI(OptionsGroupUI):
  2003. def __init__(self, decimals=4, parent=None):
  2004. # OptionsGroupUI.__init__(self, "Excellon Options", parent=parent)
  2005. super(ExcellonOptPrefGroupUI, self).__init__(self)
  2006. self.setTitle(str(_("Excellon Options")))
  2007. self.decimals = decimals
  2008. # ## Create CNC Job
  2009. self.cncjob_label = QtWidgets.QLabel('<b>%s</b>' % _('Create CNC Job'))
  2010. self.cncjob_label.setToolTip(
  2011. _("Parameters used to create a CNC Job object\n"
  2012. "for this drill object.")
  2013. )
  2014. self.layout.addWidget(self.cncjob_label)
  2015. grid2 = QtWidgets.QGridLayout()
  2016. self.layout.addLayout(grid2)
  2017. # Cut Z
  2018. cutzlabel = QtWidgets.QLabel('%s:' % _('Cut Z'))
  2019. cutzlabel.setToolTip(
  2020. _("Drill depth (negative)\n"
  2021. "below the copper surface.")
  2022. )
  2023. grid2.addWidget(cutzlabel, 0, 0)
  2024. self.cutz_entry = FCDoubleSpinner()
  2025. if machinist_setting == 0:
  2026. self.cutz_entry.set_range(-9999.9999, 0.0000)
  2027. else:
  2028. self.cutz_entry.set_range(-9999.9999, 9999.9999)
  2029. self.cutz_entry.setSingleStep(0.1)
  2030. self.cutz_entry.set_precision(self.decimals)
  2031. grid2.addWidget(self.cutz_entry, 0, 1)
  2032. # Travel Z
  2033. travelzlabel = QtWidgets.QLabel('%s:' % _('Travel Z'))
  2034. travelzlabel.setToolTip(
  2035. _("Tool height when travelling\n"
  2036. "across the XY plane.")
  2037. )
  2038. grid2.addWidget(travelzlabel, 1, 0)
  2039. self.travelz_entry = FCDoubleSpinner()
  2040. self.travelz_entry.set_precision(self.decimals)
  2041. if machinist_setting == 0:
  2042. self.travelz_entry.set_range(0.0001, 9999.9999)
  2043. else:
  2044. self.travelz_entry.set_range(-9999.9999, 9999.9999)
  2045. grid2.addWidget(self.travelz_entry, 1, 1)
  2046. # Tool change:
  2047. toolchlabel = QtWidgets.QLabel('%s:' % _("Tool change"))
  2048. toolchlabel.setToolTip(
  2049. _("Include tool-change sequence\n"
  2050. "in G-Code (Pause for tool change).")
  2051. )
  2052. self.toolchange_cb = FCCheckBox()
  2053. grid2.addWidget(toolchlabel, 2, 0)
  2054. grid2.addWidget(self.toolchange_cb, 2, 1)
  2055. toolchangezlabel = QtWidgets.QLabel('%s:' % _('Toolchange Z'))
  2056. toolchangezlabel.setToolTip(
  2057. _("Z-axis position (height) for\n"
  2058. "tool change.")
  2059. )
  2060. grid2.addWidget(toolchangezlabel, 3, 0)
  2061. self.toolchangez_entry = FCDoubleSpinner()
  2062. self.toolchangez_entry.set_precision(self.decimals)
  2063. if machinist_setting == 0:
  2064. self.toolchangez_entry.set_range(0.0001, 9999.9999)
  2065. else:
  2066. self.toolchangez_entry.set_range(-9999.9999, 9999.9999)
  2067. grid2.addWidget(self.toolchangez_entry, 3, 1)
  2068. # End Move Z
  2069. endzlabel = QtWidgets.QLabel('%s:' % _('End move Z'))
  2070. endzlabel.setToolTip(
  2071. _("Height of the tool after\n"
  2072. "the last move at the end of the job.")
  2073. )
  2074. self.eendz_entry = FCDoubleSpinner()
  2075. self.eendz_entry.set_precision(self.decimals)
  2076. if machinist_setting == 0:
  2077. self.eendz_entry.set_range(0.0000, 9999.9999)
  2078. else:
  2079. self.eendz_entry.set_range(-9999.9999, 9999.9999)
  2080. grid2.addWidget(endzlabel, 4, 0)
  2081. grid2.addWidget(self.eendz_entry, 4, 1)
  2082. # Feedrate Z
  2083. frlabel = QtWidgets.QLabel('%s:' % _('Feedrate Z'))
  2084. frlabel.setToolTip(
  2085. _("Tool speed while drilling\n"
  2086. "(in units per minute).\n"
  2087. "So called 'Plunge' feedrate.\n"
  2088. "This is for linear move G01.")
  2089. )
  2090. self.feedrate_entry = FCDoubleSpinner()
  2091. self.feedrate_entry.set_precision(self.decimals)
  2092. self.feedrate_entry.set_range(0, 999)
  2093. grid2.addWidget(frlabel, 5, 0)
  2094. grid2.addWidget(self.feedrate_entry, 5, 1)
  2095. # Spindle speed
  2096. spdlabel = QtWidgets.QLabel('%s:' % _('Spindle Speed'))
  2097. spdlabel.setToolTip(
  2098. _("Speed of the spindle\n"
  2099. "in RPM (optional)")
  2100. )
  2101. grid2.addWidget(spdlabel, 6, 0)
  2102. self.spindlespeed_entry = FCSpinner()
  2103. self.spindlespeed_entry.set_range(0, 1000000)
  2104. self.spindlespeed_entry.setSingleStep(100)
  2105. grid2.addWidget(self.spindlespeed_entry, 6, 1)
  2106. # Dwell
  2107. dwelllabel = QtWidgets.QLabel('%s:' % _('Dwell'))
  2108. dwelllabel.setToolTip(
  2109. _("Pause to allow the spindle to reach its\n"
  2110. "speed before cutting.")
  2111. )
  2112. dwelltime = QtWidgets.QLabel('%s:' % _('Duration'))
  2113. dwelltime.setToolTip(
  2114. _("Number of time units for spindle to dwell.")
  2115. )
  2116. self.dwell_cb = FCCheckBox()
  2117. self.dwelltime_entry = FCDoubleSpinner()
  2118. self.dwelltime_entry.set_precision(self.decimals)
  2119. self.dwelltime_entry.set_range(0, 99999.9999)
  2120. grid2.addWidget(dwelllabel, 7, 0)
  2121. grid2.addWidget(self.dwell_cb, 7, 1)
  2122. grid2.addWidget(dwelltime, 8, 0)
  2123. grid2.addWidget(self.dwelltime_entry, 8, 1)
  2124. self.ois_dwell_exc = OptionalInputSection(self.dwell_cb, [self.dwelltime_entry])
  2125. # preprocessor selection
  2126. pp_excellon_label = QtWidgets.QLabel('%s:' % _("Preprocessor"))
  2127. pp_excellon_label.setToolTip(
  2128. _("The preprocessor JSON file that dictates\n"
  2129. "Gcode output.")
  2130. )
  2131. grid2.addWidget(pp_excellon_label, 9, 0)
  2132. self.pp_excellon_name_cb = FCComboBox()
  2133. self.pp_excellon_name_cb.setFocusPolicy(Qt.StrongFocus)
  2134. grid2.addWidget(self.pp_excellon_name_cb, 9, 1)
  2135. # ### Choose what to use for Gcode creation: Drills, Slots or Both
  2136. excellon_gcode_type_label = QtWidgets.QLabel('<b>%s</b>' % _('Gcode'))
  2137. excellon_gcode_type_label.setToolTip(
  2138. _("Choose what to use for GCode generation:\n"
  2139. "'Drills', 'Slots' or 'Both'.\n"
  2140. "When choosing 'Slots' or 'Both', slots will be\n"
  2141. "converted to drills.")
  2142. )
  2143. self.excellon_gcode_type_radio = RadioSet([{'label': 'Drills', 'value': 'drills'},
  2144. {'label': 'Slots', 'value': 'slots'},
  2145. {'label': 'Both', 'value': 'both'}])
  2146. grid2.addWidget(excellon_gcode_type_label, 10, 0)
  2147. grid2.addWidget(self.excellon_gcode_type_radio, 10, 1)
  2148. # until I decide to implement this feature those remain disabled
  2149. excellon_gcode_type_label.hide()
  2150. self.excellon_gcode_type_radio.setVisible(False)
  2151. # ### Milling Holes ## ##
  2152. self.mill_hole_label = QtWidgets.QLabel('<b>%s</b>' % _('Mill Holes'))
  2153. self.mill_hole_label.setToolTip(
  2154. _("Create Geometry for milling holes.")
  2155. )
  2156. grid2.addWidget(self.mill_hole_label, 11, 0, 1, 2)
  2157. tdlabel = QtWidgets.QLabel('%s:' % _('Drill Tool dia'))
  2158. tdlabel.setToolTip(
  2159. _("Diameter of the cutting tool.")
  2160. )
  2161. self.tooldia_entry = FCDoubleSpinner()
  2162. self.tooldia_entry.set_precision(self.decimals)
  2163. self.tooldia_entry.set_range(0, 999.9999)
  2164. grid2.addWidget(tdlabel, 12, 0)
  2165. grid2.addWidget(self.tooldia_entry, 12, 1)
  2166. stdlabel = QtWidgets.QLabel('%s:' % _('Slot Tool dia'))
  2167. stdlabel.setToolTip(
  2168. _("Diameter of the cutting tool\n"
  2169. "when milling slots.")
  2170. )
  2171. self.slot_tooldia_entry = FCDoubleSpinner()
  2172. self.slot_tooldia_entry.set_precision(self.decimals)
  2173. self.slot_tooldia_entry.set_range(0, 999.9999)
  2174. grid2.addWidget(stdlabel, 13, 0)
  2175. grid2.addWidget(self.slot_tooldia_entry, 13, 1)
  2176. grid4 = QtWidgets.QGridLayout()
  2177. self.layout.addLayout(grid4)
  2178. # Adding the Excellon Format Defaults Button
  2179. self.excellon_defaults_button = QtWidgets.QPushButton()
  2180. self.excellon_defaults_button.setText(str(_("Defaults")))
  2181. self.excellon_defaults_button.setMinimumWidth(80)
  2182. grid4.addWidget(self.excellon_defaults_button, 0, 0, QtCore.Qt.AlignRight)
  2183. self.layout.addStretch()
  2184. class ExcellonAdvOptPrefGroupUI(OptionsGroupUI):
  2185. def __init__(self, decimals=4, parent=None):
  2186. # OptionsGroupUI.__init__(self, "Excellon Advanced Options", parent=parent)
  2187. super(ExcellonAdvOptPrefGroupUI, self).__init__(self)
  2188. self.setTitle(str(_("Excellon Adv. Options")))
  2189. self.decimals = decimals
  2190. # #######################
  2191. # ## ADVANCED OPTIONS ###
  2192. # #######################
  2193. self.exc_label = QtWidgets.QLabel('<b>%s:</b>' % _('Advanced Options'))
  2194. self.exc_label.setToolTip(
  2195. _("A list of Excellon advanced parameters.\n"
  2196. "Those parameters are available only for\n"
  2197. "Advanced App. Level.")
  2198. )
  2199. self.layout.addWidget(self.exc_label)
  2200. grid1 = QtWidgets.QGridLayout()
  2201. self.layout.addLayout(grid1)
  2202. offsetlabel = QtWidgets.QLabel('%s:' % _('Offset Z'))
  2203. offsetlabel.setToolTip(
  2204. _("Some drill bits (the larger ones) need to drill deeper\n"
  2205. "to create the desired exit hole diameter due of the tip shape.\n"
  2206. "The value here can compensate the Cut Z parameter."))
  2207. self.offset_entry = FCDoubleSpinner()
  2208. self.offset_entry.set_precision(self.decimals)
  2209. self.offset_entry.set_range(-999.9999, 999.9999)
  2210. grid1.addWidget(offsetlabel, 0, 0)
  2211. grid1.addWidget(self.offset_entry, 0, 1)
  2212. toolchange_xy_label = QtWidgets.QLabel('%s:' % _('Toolchange X,Y'))
  2213. toolchange_xy_label.setToolTip(
  2214. _("Toolchange X,Y position.")
  2215. )
  2216. grid1.addWidget(toolchange_xy_label, 1, 0)
  2217. self.toolchangexy_entry = FCEntry()
  2218. grid1.addWidget(self.toolchangexy_entry, 1, 1)
  2219. startzlabel = QtWidgets.QLabel('%s:' % _('Start Z'))
  2220. startzlabel.setToolTip(
  2221. _("Height of the tool just after start.\n"
  2222. "Delete the value if you don't need this feature.")
  2223. )
  2224. grid1.addWidget(startzlabel, 2, 0)
  2225. self.estartz_entry = FloatEntry()
  2226. grid1.addWidget(self.estartz_entry, 2, 1)
  2227. # Feedrate Rapids
  2228. fr_rapid_label = QtWidgets.QLabel('%s:' % _('Feedrate Rapids'))
  2229. fr_rapid_label.setToolTip(
  2230. _("Tool speed while drilling\n"
  2231. "(in units per minute).\n"
  2232. "This is for the rapid move G00.\n"
  2233. "It is useful only for Marlin,\n"
  2234. "ignore for any other cases.")
  2235. )
  2236. self.feedrate_rapid_entry = FCDoubleSpinner()
  2237. self.feedrate_rapid_entry.set_precision(self.decimals)
  2238. self.feedrate_rapid_entry.set_range(0, 9999999.9999)
  2239. grid1.addWidget(fr_rapid_label, 3, 0)
  2240. grid1.addWidget(self.feedrate_rapid_entry, 3, 1)
  2241. # Probe depth
  2242. self.pdepth_label = QtWidgets.QLabel('%s:' % _("Probe Z depth"))
  2243. self.pdepth_label.setToolTip(
  2244. _("The maximum depth that the probe is allowed\n"
  2245. "to probe. Negative value, in current units.")
  2246. )
  2247. self.pdepth_entry = FCDoubleSpinner()
  2248. self.pdepth_entry.set_precision(self.decimals)
  2249. self.pdepth_entry.set_range(-99999.9999, 0.0000)
  2250. grid1.addWidget(self.pdepth_label, 4, 0)
  2251. grid1.addWidget(self.pdepth_entry, 4, 1)
  2252. # Probe feedrate
  2253. self.feedrate_probe_label = QtWidgets.QLabel('%s:' % _("Feedrate Probe"))
  2254. self.feedrate_probe_label.setToolTip(
  2255. _("The feedrate used while the probe is probing.")
  2256. )
  2257. self.feedrate_probe_entry = FCDoubleSpinner()
  2258. self.feedrate_probe_entry.set_precision(self.decimals)
  2259. self.feedrate_probe_entry.set_range(0, 9999999.9999)
  2260. grid1.addWidget(self.feedrate_probe_label, 5, 0)
  2261. grid1.addWidget(self.feedrate_probe_entry, 5, 1)
  2262. # Spindle direction
  2263. spindle_dir_label = QtWidgets.QLabel('%s:' % _('Spindle direction'))
  2264. spindle_dir_label.setToolTip(
  2265. _("This sets the direction that the spindle is rotating.\n"
  2266. "It can be either:\n"
  2267. "- CW = clockwise or\n"
  2268. "- CCW = counter clockwise")
  2269. )
  2270. self.spindledir_radio = RadioSet([{'label': _('CW'), 'value': 'CW'},
  2271. {'label': _('CCW'), 'value': 'CCW'}])
  2272. grid1.addWidget(spindle_dir_label, 6, 0)
  2273. grid1.addWidget(self.spindledir_radio, 6, 1)
  2274. fplungelabel = QtWidgets.QLabel('%s:' % _('Fast Plunge'))
  2275. fplungelabel.setToolTip(
  2276. _("By checking this, the vertical move from\n"
  2277. "Z_Toolchange to Z_move is done with G0,\n"
  2278. "meaning the fastest speed available.\n"
  2279. "WARNING: the move is done at Toolchange X,Y coords.")
  2280. )
  2281. self.fplunge_cb = FCCheckBox()
  2282. grid1.addWidget(fplungelabel, 7, 0)
  2283. grid1.addWidget(self.fplunge_cb, 7, 1)
  2284. fretractlabel = QtWidgets.QLabel('%s:' % _('Fast Retract'))
  2285. fretractlabel.setToolTip(
  2286. _("Exit hole strategy.\n"
  2287. " - When uncheked, while exiting the drilled hole the drill bit\n"
  2288. "will travel slow, with set feedrate (G1), up to zero depth and then\n"
  2289. "travel as fast as possible (G0) to the Z Move (travel height).\n"
  2290. " - When checked the travel from Z cut (cut depth) to Z_move\n"
  2291. "(travel height) is done as fast as possible (G0) in one move.")
  2292. )
  2293. self.fretract_cb = FCCheckBox()
  2294. grid1.addWidget(fretractlabel, 8, 0)
  2295. grid1.addWidget(self.fretract_cb, 8, 1)
  2296. self.layout.addStretch()
  2297. class ExcellonExpPrefGroupUI(OptionsGroupUI):
  2298. def __init__(self, decimals=4, parent=None):
  2299. super(ExcellonExpPrefGroupUI, self).__init__(self)
  2300. self.setTitle(str(_("Excellon Export")))
  2301. self.decimals = decimals
  2302. # Plot options
  2303. self.export_options_label = QtWidgets.QLabel("<b>%s:</b>" % _("Export Options"))
  2304. self.export_options_label.setToolTip(
  2305. _("The parameters set here are used in the file exported\n"
  2306. "when using the File -> Export -> Export Excellon menu entry.")
  2307. )
  2308. self.layout.addWidget(self.export_options_label)
  2309. form = QtWidgets.QFormLayout()
  2310. self.layout.addLayout(form)
  2311. # Excellon Units
  2312. self.excellon_units_label = QtWidgets.QLabel('<b>%s:</b>' % _('Units'))
  2313. self.excellon_units_label.setToolTip(
  2314. _("The units used in the Excellon file.")
  2315. )
  2316. self.excellon_units_radio = RadioSet([{'label': _('INCH'), 'value': 'INCH'},
  2317. {'label': _('MM'), 'value': 'METRIC'}])
  2318. self.excellon_units_radio.setToolTip(
  2319. _("The units used in the Excellon file.")
  2320. )
  2321. form.addRow(self.excellon_units_label, self.excellon_units_radio)
  2322. # Excellon non-decimal format
  2323. self.digits_label = QtWidgets.QLabel("<b>%s:</b>" % _("Int/Decimals"))
  2324. self.digits_label.setToolTip(
  2325. _("The NC drill files, usually named Excellon files\n"
  2326. "are files that can be found in different formats.\n"
  2327. "Here we set the format used when the provided\n"
  2328. "coordinates are not using period.")
  2329. )
  2330. hlay1 = QtWidgets.QHBoxLayout()
  2331. self.format_whole_entry = FCSpinner()
  2332. self.format_whole_entry.set_range(0, 9)
  2333. self.format_whole_entry.setMinimumWidth(30)
  2334. self.format_whole_entry.setToolTip(
  2335. _("This numbers signify the number of digits in\n"
  2336. "the whole part of Excellon coordinates.")
  2337. )
  2338. hlay1.addWidget(self.format_whole_entry, QtCore.Qt.AlignLeft)
  2339. excellon_separator_label = QtWidgets.QLabel(':')
  2340. excellon_separator_label.setFixedWidth(5)
  2341. hlay1.addWidget(excellon_separator_label, QtCore.Qt.AlignLeft)
  2342. self.format_dec_entry = FCSpinner()
  2343. self.format_dec_entry.set_range(0, 9)
  2344. self.format_dec_entry.setMinimumWidth(30)
  2345. self.format_dec_entry.setToolTip(
  2346. _("This numbers signify the number of digits in\n"
  2347. "the decimal part of Excellon coordinates.")
  2348. )
  2349. hlay1.addWidget(self.format_dec_entry, QtCore.Qt.AlignLeft)
  2350. hlay1.addStretch()
  2351. form.addRow(self.digits_label, hlay1)
  2352. # Select the Excellon Format
  2353. self.format_label = QtWidgets.QLabel("<b>%s:</b>" % _("Format"))
  2354. self.format_label.setToolTip(
  2355. _("Select the kind of coordinates format used.\n"
  2356. "Coordinates can be saved with decimal point or without.\n"
  2357. "When there is no decimal point, it is required to specify\n"
  2358. "the number of digits for integer part and the number of decimals.\n"
  2359. "Also it will have to be specified if LZ = leading zeros are kept\n"
  2360. "or TZ = trailing zeros are kept.")
  2361. )
  2362. self.format_radio = RadioSet([{'label': _('Decimal'), 'value': 'dec'},
  2363. {'label': _('No-Decimal'), 'value': 'ndec'}])
  2364. self.format_radio.setToolTip(
  2365. _("Select the kind of coordinates format used.\n"
  2366. "Coordinates can be saved with decimal point or without.\n"
  2367. "When there is no decimal point, it is required to specify\n"
  2368. "the number of digits for integer part and the number of decimals.\n"
  2369. "Also it will have to be specified if LZ = leading zeros are kept\n"
  2370. "or TZ = trailing zeros are kept.")
  2371. )
  2372. form.addRow(self.format_label, self.format_radio)
  2373. # Excellon Zeros
  2374. self.zeros_label = QtWidgets.QLabel('<b>%s:</b>' % _('Zeros'))
  2375. self.zeros_label.setAlignment(QtCore.Qt.AlignLeft)
  2376. self.zeros_label.setToolTip(
  2377. _("This sets the type of Excellon zeros.\n"
  2378. "If LZ then Leading Zeros are kept and\n"
  2379. "Trailing Zeros are removed.\n"
  2380. "If TZ is checked then Trailing Zeros are kept\n"
  2381. "and Leading Zeros are removed.")
  2382. )
  2383. self.zeros_radio = RadioSet([{'label': _('LZ'), 'value': 'LZ'},
  2384. {'label': _('TZ'), 'value': 'TZ'}])
  2385. self.zeros_radio.setToolTip(
  2386. _("This sets the default type of Excellon zeros.\n"
  2387. "If LZ then Leading Zeros are kept and\n"
  2388. "Trailing Zeros are removed.\n"
  2389. "If TZ is checked then Trailing Zeros are kept\n"
  2390. "and Leading Zeros are removed.")
  2391. )
  2392. form.addRow(self.zeros_label, self.zeros_radio)
  2393. # Slot type
  2394. self.slot_type_label = QtWidgets.QLabel('<b>%s:</b>' % _('Slot type'))
  2395. self.slot_type_label.setAlignment(QtCore.Qt.AlignLeft)
  2396. self.slot_type_label.setToolTip(
  2397. _("This sets how the slots will be exported.\n"
  2398. "If ROUTED then the slots will be routed\n"
  2399. "using M15/M16 commands.\n"
  2400. "If DRILLED(G85) the slots will be exported\n"
  2401. "using the Drilled slot command (G85).")
  2402. )
  2403. self.slot_type_radio = RadioSet([{'label': _('Routed'), 'value': 'routing'},
  2404. {'label': _('Drilled(G85)'), 'value': 'drilling'}])
  2405. self.slot_type_radio.setToolTip(
  2406. _("This sets how the slots will be exported.\n"
  2407. "If ROUTED then the slots will be routed\n"
  2408. "using M15/M16 commands.\n"
  2409. "If DRILLED(G85) the slots will be exported\n"
  2410. "using the Drilled slot command (G85).")
  2411. )
  2412. form.addRow(self.slot_type_label, self.slot_type_radio)
  2413. self.layout.addStretch()
  2414. self.format_radio.activated_custom.connect(self.optimization_selection)
  2415. def optimization_selection(self):
  2416. if self.format_radio.get_value() == 'dec':
  2417. self.zeros_label.setDisabled(True)
  2418. self.zeros_radio.setDisabled(True)
  2419. else:
  2420. self.zeros_label.setDisabled(False)
  2421. self.zeros_radio.setDisabled(False)
  2422. class ExcellonEditorPrefGroupUI(OptionsGroupUI):
  2423. def __init__(self, decimals=4, parent=None):
  2424. super(ExcellonEditorPrefGroupUI, self).__init__(self)
  2425. self.setTitle(str(_("Excellon Editor")))
  2426. self.decimals = decimals
  2427. # Excellon Editor Parameters
  2428. self.param_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  2429. self.param_label.setToolTip(
  2430. _("A list of Excellon Editor parameters.")
  2431. )
  2432. self.layout.addWidget(self.param_label)
  2433. grid0 = QtWidgets.QGridLayout()
  2434. self.layout.addLayout(grid0)
  2435. # Selection Limit
  2436. self.sel_limit_label = QtWidgets.QLabel('%s:' % _("Selection limit"))
  2437. self.sel_limit_label.setToolTip(
  2438. _("Set the number of selected Excellon geometry\n"
  2439. "items above which the utility geometry\n"
  2440. "becomes just a selection rectangle.\n"
  2441. "Increases the performance when moving a\n"
  2442. "large number of geometric elements.")
  2443. )
  2444. self.sel_limit_entry = FCSpinner()
  2445. self.sel_limit_entry.set_range(0, 99999)
  2446. grid0.addWidget(self.sel_limit_label, 0, 0)
  2447. grid0.addWidget(self.sel_limit_entry, 0, 1)
  2448. # New tool diameter
  2449. self.addtool_entry_lbl = QtWidgets.QLabel('%s:' % _('New Tool Dia'))
  2450. self.addtool_entry_lbl.setToolTip(
  2451. _("Diameter for the new tool")
  2452. )
  2453. self.addtool_entry = FCDoubleSpinner()
  2454. self.addtool_entry.set_range(0.000001, 99.9999)
  2455. self.addtool_entry.set_precision(self.decimals)
  2456. grid0.addWidget(self.addtool_entry_lbl, 1, 0)
  2457. grid0.addWidget(self.addtool_entry, 1, 1)
  2458. # Number of drill holes in a drill array
  2459. self.drill_array_size_label = QtWidgets.QLabel('%s:' % _('Nr of drills'))
  2460. self.drill_array_size_label.setToolTip(
  2461. _("Specify how many drills to be in the array.")
  2462. )
  2463. # self.drill_array_size_label.setMinimumWidth(100)
  2464. self.drill_array_size_entry = FCSpinner()
  2465. self.drill_array_size_entry.set_range(0, 9999)
  2466. grid0.addWidget(self.drill_array_size_label, 2, 0)
  2467. grid0.addWidget(self.drill_array_size_entry, 2, 1)
  2468. self.drill_array_linear_label = QtWidgets.QLabel('<b>%s:</b>' % _('Linear Drill Array'))
  2469. grid0.addWidget(self.drill_array_linear_label, 3, 0, 1, 2)
  2470. # Linear Drill Array direction
  2471. self.drill_axis_label = QtWidgets.QLabel('%s:' % _('Linear Direction'))
  2472. self.drill_axis_label.setToolTip(
  2473. _("Direction on which the linear array is oriented:\n"
  2474. "- 'X' - horizontal axis \n"
  2475. "- 'Y' - vertical axis or \n"
  2476. "- 'Angle' - a custom angle for the array inclination")
  2477. )
  2478. # self.drill_axis_label.setMinimumWidth(100)
  2479. self.drill_axis_radio = RadioSet([{'label': _('X'), 'value': 'X'},
  2480. {'label': _('Y'), 'value': 'Y'},
  2481. {'label': _('Angle'), 'value': 'A'}])
  2482. grid0.addWidget(self.drill_axis_label, 4, 0)
  2483. grid0.addWidget(self.drill_axis_radio, 4, 1)
  2484. # Linear Drill Array pitch distance
  2485. self.drill_pitch_label = QtWidgets.QLabel('%s:' % _('Pitch'))
  2486. self.drill_pitch_label.setToolTip(
  2487. _("Pitch = Distance between elements of the array.")
  2488. )
  2489. # self.drill_pitch_label.setMinimumWidth(100)
  2490. self.drill_pitch_entry = FCDoubleSpinner()
  2491. self.drill_pitch_entry.set_range(0, 99999.9999)
  2492. self.drill_pitch_entry.set_precision(self.decimals)
  2493. grid0.addWidget(self.drill_pitch_label, 5, 0)
  2494. grid0.addWidget(self.drill_pitch_entry, 5, 1)
  2495. # Linear Drill Array custom angle
  2496. self.drill_angle_label = QtWidgets.QLabel('%s:' % _('Angle'))
  2497. self.drill_angle_label.setToolTip(
  2498. _("Angle at which each element in circular array is placed.")
  2499. )
  2500. self.drill_angle_entry = FCDoubleSpinner()
  2501. self.drill_pitch_entry.set_range(-360, 360)
  2502. self.drill_pitch_entry.set_precision(self.decimals)
  2503. self.drill_angle_entry.setWrapping(True)
  2504. self.drill_angle_entry.setSingleStep(5)
  2505. grid0.addWidget(self.drill_angle_label, 6, 0)
  2506. grid0.addWidget(self.drill_angle_entry, 6, 1)
  2507. self.drill_array_circ_label = QtWidgets.QLabel('<b>%s:</b>' % _('Circular Drill Array'))
  2508. grid0.addWidget(self.drill_array_circ_label, 7, 0, 1, 2)
  2509. # Circular Drill Array direction
  2510. self.drill_circular_direction_label = QtWidgets.QLabel('%s:' % _('Circular Direction'))
  2511. self.drill_circular_direction_label.setToolTip(
  2512. _("Direction for circular array.\n"
  2513. "Can be CW = clockwise or CCW = counter clockwise.")
  2514. )
  2515. self.drill_circular_dir_radio = RadioSet([{'label': _('CW'), 'value': 'CW'},
  2516. {'label': _('CCW'), 'value': 'CCW'}])
  2517. grid0.addWidget(self.drill_circular_direction_label, 8, 0)
  2518. grid0.addWidget(self.drill_circular_dir_radio, 8, 1)
  2519. # Circular Drill Array Angle
  2520. self.drill_circular_angle_label = QtWidgets.QLabel('%s:' % _('Circular Angle'))
  2521. self.drill_circular_angle_label.setToolTip(
  2522. _("Angle at which each element in circular array is placed.")
  2523. )
  2524. self.drill_circular_angle_entry = FCDoubleSpinner()
  2525. self.drill_circular_angle_entry.set_range(-360, 360)
  2526. self.drill_circular_angle_entry.set_precision(self.decimals)
  2527. self.drill_circular_angle_entry.setWrapping(True)
  2528. self.drill_circular_angle_entry.setSingleStep(5)
  2529. grid0.addWidget(self.drill_circular_angle_label, 9, 0)
  2530. grid0.addWidget(self.drill_circular_angle_entry, 9, 1)
  2531. # ##### SLOTS #####
  2532. # #################
  2533. self.drill_array_circ_label = QtWidgets.QLabel('<b>%s:</b>' % _('Slots'))
  2534. grid0.addWidget(self.drill_array_circ_label, 10, 0, 1, 2)
  2535. # Slot length
  2536. self.slot_length_label = QtWidgets.QLabel('%s:' % _('Length'))
  2537. self.slot_length_label.setToolTip(
  2538. _("Length = The length of the slot.")
  2539. )
  2540. self.slot_length_label.setMinimumWidth(100)
  2541. self.slot_length_entry = FCDoubleSpinner()
  2542. self.slot_length_entry.set_range(0, 99999)
  2543. self.slot_length_entry.set_precision(self.decimals)
  2544. self.slot_length_entry.setWrapping(True)
  2545. self.slot_length_entry.setSingleStep(1)
  2546. grid0.addWidget(self.slot_length_label, 11, 0)
  2547. grid0.addWidget(self.slot_length_entry, 11, 1)
  2548. # Slot direction
  2549. self.slot_axis_label = QtWidgets.QLabel('%s:' % _('Direction'))
  2550. self.slot_axis_label.setToolTip(
  2551. _("Direction on which the slot is oriented:\n"
  2552. "- 'X' - horizontal axis \n"
  2553. "- 'Y' - vertical axis or \n"
  2554. "- 'Angle' - a custom angle for the slot inclination")
  2555. )
  2556. self.slot_axis_label.setMinimumWidth(100)
  2557. self.slot_axis_radio = RadioSet([{'label': _('X'), 'value': 'X'},
  2558. {'label': _('Y'), 'value': 'Y'},
  2559. {'label': _('Angle'), 'value': 'A'}])
  2560. grid0.addWidget(self.slot_axis_label, 12, 0)
  2561. grid0.addWidget(self.slot_axis_radio, 12, 1)
  2562. # Slot custom angle
  2563. self.slot_angle_label = QtWidgets.QLabel('%s:' % _('Angle'))
  2564. self.slot_angle_label.setToolTip(
  2565. _("Angle at which the slot is placed.\n"
  2566. "The precision is of max 2 decimals.\n"
  2567. "Min value is: -359.99 degrees.\n"
  2568. "Max value is: 360.00 degrees.")
  2569. )
  2570. self.slot_angle_label.setMinimumWidth(100)
  2571. self.slot_angle_spinner = FCDoubleSpinner()
  2572. self.slot_angle_spinner.set_precision(self.decimals)
  2573. self.slot_angle_spinner.setWrapping(True)
  2574. self.slot_angle_spinner.setRange(-359.99, 360.00)
  2575. self.slot_angle_spinner.setSingleStep(5)
  2576. grid0.addWidget(self.slot_angle_label, 13, 0)
  2577. grid0.addWidget(self.slot_angle_spinner, 13, 1)
  2578. # #### SLOTS ARRAY #######
  2579. # ########################
  2580. self.slot_array_linear_label = QtWidgets.QLabel('<b>%s:</b>' % _('Linear Slot Array'))
  2581. grid0.addWidget(self.slot_array_linear_label, 14, 0, 1, 2)
  2582. # Number of slot holes in a drill array
  2583. self.slot_array_size_label = QtWidgets.QLabel('%s:' % _('Nr of slots'))
  2584. self.drill_array_size_label.setToolTip(
  2585. _("Specify how many slots to be in the array.")
  2586. )
  2587. # self.slot_array_size_label.setMinimumWidth(100)
  2588. self.slot_array_size_entry = FCSpinner()
  2589. self.slot_array_size_entry.set_range(0, 999999)
  2590. grid0.addWidget(self.slot_array_size_label, 15, 0)
  2591. grid0.addWidget(self.slot_array_size_entry, 15, 1)
  2592. # Linear Slot Array direction
  2593. self.slot_array_axis_label = QtWidgets.QLabel('%s:' % _('Linear Direction'))
  2594. self.slot_array_axis_label.setToolTip(
  2595. _("Direction on which the linear array is oriented:\n"
  2596. "- 'X' - horizontal axis \n"
  2597. "- 'Y' - vertical axis or \n"
  2598. "- 'Angle' - a custom angle for the array inclination")
  2599. )
  2600. # self.slot_axis_label.setMinimumWidth(100)
  2601. self.slot_array_axis_radio = RadioSet([{'label': _('X'), 'value': 'X'},
  2602. {'label': _('Y'), 'value': 'Y'},
  2603. {'label': _('Angle'), 'value': 'A'}])
  2604. grid0.addWidget(self.slot_array_axis_label, 16, 0)
  2605. grid0.addWidget(self.slot_array_axis_radio, 16, 1)
  2606. # Linear Slot Array pitch distance
  2607. self.slot_array_pitch_label = QtWidgets.QLabel('%s:' % _('Pitch'))
  2608. self.slot_array_pitch_label.setToolTip(
  2609. _("Pitch = Distance between elements of the array.")
  2610. )
  2611. # self.drill_pitch_label.setMinimumWidth(100)
  2612. self.slot_array_pitch_entry = FCDoubleSpinner()
  2613. self.slot_array_pitch_entry.set_precision(self.decimals)
  2614. self.slot_array_pitch_entry.setWrapping(True)
  2615. self.slot_array_pitch_entry.setRange(0, 999999)
  2616. self.slot_array_pitch_entry.setSingleStep(1)
  2617. grid0.addWidget(self.slot_array_pitch_label, 17, 0)
  2618. grid0.addWidget(self.slot_array_pitch_entry, 17, 1)
  2619. # Linear Slot Array custom angle
  2620. self.slot_array_angle_label = QtWidgets.QLabel('%s:' % _('Angle'))
  2621. self.slot_array_angle_label.setToolTip(
  2622. _("Angle at which each element in circular array is placed.")
  2623. )
  2624. self.slot_array_angle_entry = FCDoubleSpinner()
  2625. self.slot_array_angle_entry.set_precision(self.decimals)
  2626. self.slot_array_angle_entry.setWrapping(True)
  2627. self.slot_array_angle_entry.setRange(-360, 360)
  2628. self.slot_array_angle_entry.setSingleStep(5)
  2629. grid0.addWidget(self.slot_array_angle_label, 18, 0)
  2630. grid0.addWidget(self.slot_array_angle_entry, 18, 1)
  2631. self.slot_array_circ_label = QtWidgets.QLabel('<b>%s:</b>' % _('Circular Slot Array'))
  2632. grid0.addWidget(self.slot_array_circ_label, 19, 0, 1, 2)
  2633. # Circular Slot Array direction
  2634. self.slot_array_circular_direction_label = QtWidgets.QLabel('%s:' % _('Circular Direction'))
  2635. self.slot_array_circular_direction_label.setToolTip(
  2636. _("Direction for circular array.\n"
  2637. "Can be CW = clockwise or CCW = counter clockwise.")
  2638. )
  2639. self.slot_array_circular_dir_radio = RadioSet([{'label': _('CW'), 'value': 'CW'},
  2640. {'label': _('CCW'), 'value': 'CCW'}])
  2641. grid0.addWidget(self.slot_array_circular_direction_label, 20, 0)
  2642. grid0.addWidget(self.slot_array_circular_dir_radio, 20, 1)
  2643. # Circular Slot Array Angle
  2644. self.slot_array_circular_angle_label = QtWidgets.QLabel('%s:' % _('Circular Angle'))
  2645. self.slot_array_circular_angle_label.setToolTip(
  2646. _("Angle at which each element in circular array is placed.")
  2647. )
  2648. self.slot_array_circular_angle_entry = FCDoubleSpinner()
  2649. self.slot_array_circular_angle_entry.set_precision(self.decimals)
  2650. self.slot_array_circular_angle_entry.setWrapping(True)
  2651. self.slot_array_circular_angle_entry.setRange(-360, 360)
  2652. self.slot_array_circular_angle_entry.setSingleStep(5)
  2653. grid0.addWidget(self.slot_array_circular_angle_label, 21, 0)
  2654. grid0.addWidget(self.slot_array_circular_angle_entry, 21, 1)
  2655. self.layout.addStretch()
  2656. class GeometryGenPrefGroupUI(OptionsGroupUI):
  2657. def __init__(self, decimals=4, parent=None):
  2658. # OptionsGroupUI.__init__(self, "Geometry General Preferences", parent=parent)
  2659. super(GeometryGenPrefGroupUI, self).__init__(self)
  2660. self.setTitle(str(_("Geometry General")))
  2661. self.decimals = decimals
  2662. # ## Plot options
  2663. self.plot_options_label = QtWidgets.QLabel("<b>%s:</b>" % _("Plot Options"))
  2664. self.layout.addWidget(self.plot_options_label)
  2665. # Plot CB
  2666. self.plot_cb = FCCheckBox(label=_('Plot'))
  2667. self.plot_cb.setToolTip(
  2668. _("Plot (show) this object.")
  2669. )
  2670. self.layout.addWidget(self.plot_cb)
  2671. grid0 = QtWidgets.QGridLayout()
  2672. self.layout.addLayout(grid0)
  2673. grid0.setColumnStretch(0, 0)
  2674. grid0.setColumnStretch(1, 1)
  2675. # Number of circle steps for circular aperture linear approximation
  2676. self.circle_steps_label = QtWidgets.QLabel('%s:' % _("Circle Steps"))
  2677. self.circle_steps_label.setToolTip(
  2678. _("The number of circle steps for <b>Geometry</b> \n"
  2679. "circle and arc shapes linear approximation.")
  2680. )
  2681. self.circle_steps_entry = FCSpinner()
  2682. self.circle_steps_entry.set_range(0, 999)
  2683. grid0.addWidget(self.circle_steps_label, 1, 0)
  2684. grid0.addWidget(self.circle_steps_entry, 1, 1)
  2685. # Tools
  2686. self.tools_label = QtWidgets.QLabel("<b>%s:</b>" % _("Tools"))
  2687. grid0.addWidget(self.tools_label, 2, 0, 1, 2)
  2688. # Tooldia
  2689. tdlabel = QtWidgets.QLabel('%s:' % _('Tool dia'))
  2690. tdlabel.setToolTip(
  2691. _("Diameters of the cutting tools, separated by ','")
  2692. )
  2693. self.cnctooldia_entry = FCEntry()
  2694. grid0.addWidget(tdlabel, 3, 0)
  2695. grid0.addWidget(self.cnctooldia_entry, 3, 1)
  2696. self.layout.addStretch()
  2697. class GeometryOptPrefGroupUI(OptionsGroupUI):
  2698. def __init__(self, decimals=4, parent=None):
  2699. # OptionsGroupUI.__init__(self, "Geometry Options Preferences", parent=parent)
  2700. super(GeometryOptPrefGroupUI, self).__init__(self)
  2701. self.setTitle(str(_("Geometry Options")))
  2702. self.decimals = decimals
  2703. # ------------------------------
  2704. # ## Create CNC Job
  2705. # ------------------------------
  2706. self.cncjob_label = QtWidgets.QLabel('<b>%s:</b>' % _('Create CNC Job'))
  2707. self.cncjob_label.setToolTip(
  2708. _("Create a CNC Job object\n"
  2709. "tracing the contours of this\n"
  2710. "Geometry object.")
  2711. )
  2712. self.layout.addWidget(self.cncjob_label)
  2713. grid1 = QtWidgets.QGridLayout()
  2714. self.layout.addLayout(grid1)
  2715. # Cut Z
  2716. cutzlabel = QtWidgets.QLabel('%s:' % _('Cut Z'))
  2717. cutzlabel.setToolTip(
  2718. _("Cutting depth (negative)\n"
  2719. "below the copper surface.")
  2720. )
  2721. self.cutz_entry = FCDoubleSpinner()
  2722. if machinist_setting == 0:
  2723. self.cutz_entry.set_range(-9999.9999, 0.0000)
  2724. else:
  2725. self.cutz_entry.set_range(-9999.9999, 9999.9999)
  2726. self.cutz_entry.set_precision(self.decimals)
  2727. self.cutz_entry.setSingleStep(0.1)
  2728. self.cutz_entry.setWrapping(True)
  2729. grid1.addWidget(cutzlabel, 0, 0)
  2730. grid1.addWidget(self.cutz_entry, 0, 1)
  2731. # Multidepth CheckBox
  2732. self.multidepth_cb = FCCheckBox(label=_('Multi-Depth'))
  2733. self.multidepth_cb.setToolTip(
  2734. _(
  2735. "Use multiple passes to limit\n"
  2736. "the cut depth in each pass. Will\n"
  2737. "cut multiple times until Cut Z is\n"
  2738. "reached."
  2739. )
  2740. )
  2741. grid1.addWidget(self.multidepth_cb, 1, 0)
  2742. # Depth/pass
  2743. dplabel = QtWidgets.QLabel('%s:' % _('Depth/Pass'))
  2744. dplabel.setToolTip(
  2745. _("The depth to cut on each pass,\n"
  2746. "when multidepth is enabled.\n"
  2747. "It has positive value although\n"
  2748. "it is a fraction from the depth\n"
  2749. "which has negative value.")
  2750. )
  2751. self.depthperpass_entry = FCDoubleSpinner()
  2752. self.depthperpass_entry.set_range(0, 99999)
  2753. self.depthperpass_entry.set_precision(self.decimals)
  2754. self.depthperpass_entry.setSingleStep(0.1)
  2755. self.depthperpass_entry.setWrapping(True)
  2756. grid1.addWidget(dplabel, 2, 0)
  2757. grid1.addWidget(self.depthperpass_entry, 2, 1)
  2758. self.ois_multidepth = OptionalInputSection(self.multidepth_cb, [self.depthperpass_entry])
  2759. # Travel Z
  2760. travelzlabel = QtWidgets.QLabel('%s:' % _('Travel Z'))
  2761. travelzlabel.setToolTip(
  2762. _("Height of the tool when\n"
  2763. "moving without cutting.")
  2764. )
  2765. self.travelz_entry = FCDoubleSpinner()
  2766. if machinist_setting == 0:
  2767. self.travelz_entry.set_range(0.0001, 9999.9999)
  2768. else:
  2769. self.travelz_entry.set_range(-9999.9999, 9999.9999)
  2770. self.travelz_entry.set_precision(self.decimals)
  2771. self.travelz_entry.setSingleStep(0.1)
  2772. self.travelz_entry.setWrapping(True)
  2773. grid1.addWidget(travelzlabel, 3, 0)
  2774. grid1.addWidget(self.travelz_entry, 3, 1)
  2775. # Tool change:
  2776. toolchlabel = QtWidgets.QLabel('%s:' % _("Tool change"))
  2777. toolchlabel.setToolTip(
  2778. _(
  2779. "Include tool-change sequence\n"
  2780. "in the Machine Code (Pause for tool change)."
  2781. )
  2782. )
  2783. self.toolchange_cb = FCCheckBox()
  2784. grid1.addWidget(toolchlabel, 4, 0)
  2785. grid1.addWidget(self.toolchange_cb, 4, 1)
  2786. # Toolchange Z
  2787. toolchangezlabel = QtWidgets.QLabel('%s:' % _('Toolchange Z'))
  2788. toolchangezlabel.setToolTip(
  2789. _(
  2790. "Z-axis position (height) for\n"
  2791. "tool change."
  2792. )
  2793. )
  2794. self.toolchangez_entry = FCDoubleSpinner()
  2795. if machinist_setting == 0:
  2796. self.toolchangez_entry.set_range(0.000, 9999.9999)
  2797. else:
  2798. self.toolchangez_entry.set_range(-9999.9999, 9999.9999)
  2799. self.toolchangez_entry.set_precision(self.decimals)
  2800. self.toolchangez_entry.setSingleStep(0.1)
  2801. self.toolchangez_entry.setWrapping(True)
  2802. grid1.addWidget(toolchangezlabel, 5, 0)
  2803. grid1.addWidget(self.toolchangez_entry, 5, 1)
  2804. # End move Z
  2805. endzlabel = QtWidgets.QLabel('%s:' % _('End move Z'))
  2806. endzlabel.setToolTip(
  2807. _("Height of the tool after\n"
  2808. "the last move at the end of the job.")
  2809. )
  2810. self.gendz_entry = FCDoubleSpinner()
  2811. if machinist_setting == 0:
  2812. self.gendz_entry.set_range(0.000, 9999.9999)
  2813. else:
  2814. self.gendz_entry.set_range(-9999.9999, 9999.9999)
  2815. self.gendz_entry.set_precision(self.decimals)
  2816. self.gendz_entry.setSingleStep(0.1)
  2817. self.gendz_entry.setWrapping(True)
  2818. grid1.addWidget(endzlabel, 6, 0)
  2819. grid1.addWidget(self.gendz_entry, 6, 1)
  2820. # Feedrate X-Y
  2821. frlabel = QtWidgets.QLabel('%s:' % _('Feedrate X-Y'))
  2822. frlabel.setToolTip(
  2823. _("Cutting speed in the XY\n"
  2824. "plane in units per minute")
  2825. )
  2826. self.cncfeedrate_entry = FCDoubleSpinner()
  2827. self.cncfeedrate_entry.set_range(0, 99999)
  2828. self.cncfeedrate_entry.set_precision(self.decimals)
  2829. self.cncfeedrate_entry.setSingleStep(0.1)
  2830. self.cncfeedrate_entry.setWrapping(True)
  2831. grid1.addWidget(frlabel, 7, 0)
  2832. grid1.addWidget(self.cncfeedrate_entry, 7, 1)
  2833. # Feedrate Z (Plunge)
  2834. frz_label = QtWidgets.QLabel('%s:' % _('Feedrate Z'))
  2835. frz_label.setToolTip(
  2836. _("Cutting speed in the XY\n"
  2837. "plane in units per minute.\n"
  2838. "It is called also Plunge.")
  2839. )
  2840. self.cncplunge_entry = FCDoubleSpinner()
  2841. self.cncplunge_entry.set_range(0, 99999)
  2842. self.cncplunge_entry.set_precision(self.decimals)
  2843. self.cncplunge_entry.setSingleStep(0.1)
  2844. self.cncplunge_entry.setWrapping(True)
  2845. grid1.addWidget(frz_label, 8, 0)
  2846. grid1.addWidget(self.cncplunge_entry, 8, 1)
  2847. # Spindle Speed
  2848. spdlabel = QtWidgets.QLabel('%s:' % _('Spindle speed'))
  2849. spdlabel.setToolTip(
  2850. _(
  2851. "Speed of the spindle in RPM (optional).\n"
  2852. "If LASER preprocessor is used,\n"
  2853. "this value is the power of laser."
  2854. )
  2855. )
  2856. grid1.addWidget(spdlabel, 9, 0)
  2857. self.cncspindlespeed_entry = FCSpinner()
  2858. self.cncspindlespeed_entry.set_range(0, 1000000)
  2859. self.cncspindlespeed_entry.setSingleStep(100)
  2860. grid1.addWidget(self.cncspindlespeed_entry, 9, 1)
  2861. # Dwell
  2862. self.dwell_cb = FCCheckBox(label='%s:' % _('Dwell'))
  2863. self.dwell_cb.setToolTip(
  2864. _("Pause to allow the spindle to reach its\n"
  2865. "speed before cutting.")
  2866. )
  2867. dwelltime = QtWidgets.QLabel('%s:' % _('Duration'))
  2868. dwelltime.setToolTip(
  2869. _("Number of time units for spindle to dwell.")
  2870. )
  2871. self.dwelltime_entry = FCDoubleSpinner()
  2872. self.dwelltime_entry.set_range(0, 99999)
  2873. self.dwelltime_entry.set_precision(self.decimals)
  2874. self.dwelltime_entry.setSingleStep(0.1)
  2875. self.dwelltime_entry.setWrapping(True)
  2876. grid1.addWidget(self.dwell_cb, 10, 0)
  2877. grid1.addWidget(dwelltime, 11, 0)
  2878. grid1.addWidget(self.dwelltime_entry, 11, 1)
  2879. self.ois_dwell = OptionalInputSection(self.dwell_cb, [self.dwelltime_entry])
  2880. # preprocessor selection
  2881. pp_label = QtWidgets.QLabel('%s:' % _("Preprocessor"))
  2882. pp_label.setToolTip(
  2883. _("The Preprocessor file that dictates\n"
  2884. "the Machine Code (like GCode, RML, HPGL) output.")
  2885. )
  2886. grid1.addWidget(pp_label, 12, 0)
  2887. self.pp_geometry_name_cb = FCComboBox()
  2888. self.pp_geometry_name_cb.setFocusPolicy(Qt.StrongFocus)
  2889. grid1.addWidget(self.pp_geometry_name_cb, 12, 1)
  2890. self.layout.addStretch()
  2891. class GeometryAdvOptPrefGroupUI(OptionsGroupUI):
  2892. def __init__(self, decimals=4, parent=None):
  2893. # OptionsGroupUI.__init__(self, "Geometry Advanced Options Preferences", parent=parent)
  2894. super(GeometryAdvOptPrefGroupUI, self).__init__(self)
  2895. self.setTitle(str(_("Geometry Adv. Options")))
  2896. self.decimals = decimals
  2897. # ------------------------------
  2898. # ## Advanced Options
  2899. # ------------------------------
  2900. self.geo_label = QtWidgets.QLabel('<b>%s:</b>' % _('Advanced Options'))
  2901. self.geo_label.setToolTip(
  2902. _("A list of Geometry advanced parameters.\n"
  2903. "Those parameters are available only for\n"
  2904. "Advanced App. Level.")
  2905. )
  2906. self.layout.addWidget(self.geo_label)
  2907. grid1 = QtWidgets.QGridLayout()
  2908. self.layout.addLayout(grid1)
  2909. # Toolchange X,Y
  2910. toolchange_xy_label = QtWidgets.QLabel('%s:' % _('Toolchange X-Y'))
  2911. toolchange_xy_label.setToolTip(
  2912. _("Toolchange X,Y position.")
  2913. )
  2914. grid1.addWidget(toolchange_xy_label, 1, 0)
  2915. self.toolchangexy_entry = FCEntry()
  2916. grid1.addWidget(self.toolchangexy_entry, 1, 1)
  2917. # Start move Z
  2918. startzlabel = QtWidgets.QLabel('%s:' % _('Start Z'))
  2919. startzlabel.setToolTip(
  2920. _("Height of the tool just after starting the work.\n"
  2921. "Delete the value if you don't need this feature.")
  2922. )
  2923. grid1.addWidget(startzlabel, 2, 0)
  2924. self.gstartz_entry = FloatEntry()
  2925. grid1.addWidget(self.gstartz_entry, 2, 1)
  2926. # Feedrate rapids
  2927. fr_rapid_label = QtWidgets.QLabel('%s:' % _('Feedrate Rapids'))
  2928. fr_rapid_label.setToolTip(
  2929. _("Cutting speed in the XY plane\n"
  2930. "(in units per minute).\n"
  2931. "This is for the rapid move G00.\n"
  2932. "It is useful only for Marlin,\n"
  2933. "ignore for any other cases.")
  2934. )
  2935. self.cncfeedrate_rapid_entry = FCDoubleSpinner()
  2936. self.cncfeedrate_rapid_entry.set_range(0, 99999)
  2937. self.cncfeedrate_rapid_entry.set_precision(self.decimals)
  2938. self.cncfeedrate_rapid_entry.setSingleStep(0.1)
  2939. self.cncfeedrate_rapid_entry.setWrapping(True)
  2940. grid1.addWidget(fr_rapid_label, 4, 0)
  2941. grid1.addWidget(self.cncfeedrate_rapid_entry, 4, 1)
  2942. # End move extra cut
  2943. self.extracut_cb = FCCheckBox('%s' % _('Re-cut'))
  2944. self.extracut_cb.setToolTip(
  2945. _("In order to remove possible\n"
  2946. "copper leftovers where first cut\n"
  2947. "meet with last cut, we generate an\n"
  2948. "extended cut over the first cut section.")
  2949. )
  2950. self.e_cut_entry = FCDoubleSpinner()
  2951. self.e_cut_entry.set_range(0, 99999)
  2952. self.e_cut_entry.set_precision(self.decimals)
  2953. self.e_cut_entry.setSingleStep(0.1)
  2954. self.e_cut_entry.setWrapping(True)
  2955. self.e_cut_entry.setToolTip(
  2956. _("In order to remove possible\n"
  2957. "copper leftovers where first cut\n"
  2958. "meet with last cut, we generate an\n"
  2959. "extended cut over the first cut section.")
  2960. )
  2961. grid1.addWidget(self.extracut_cb, 5, 0)
  2962. grid1.addWidget(self.e_cut_entry, 5, 1)
  2963. # Probe depth
  2964. self.pdepth_label = QtWidgets.QLabel('%s:' % _("Probe Z depth"))
  2965. self.pdepth_label.setToolTip(
  2966. _("The maximum depth that the probe is allowed\n"
  2967. "to probe. Negative value, in current units.")
  2968. )
  2969. self.pdepth_entry = FCDoubleSpinner()
  2970. self.pdepth_entry.set_range(-99999, 0.0000)
  2971. self.pdepth_entry.set_precision(self.decimals)
  2972. self.pdepth_entry.setSingleStep(0.1)
  2973. self.pdepth_entry.setWrapping(True)
  2974. grid1.addWidget(self.pdepth_label, 6, 0)
  2975. grid1.addWidget(self.pdepth_entry, 6, 1)
  2976. # Probe feedrate
  2977. self.feedrate_probe_label = QtWidgets.QLabel('%s:' % _("Feedrate Probe"))
  2978. self.feedrate_probe_label.setToolTip(
  2979. _("The feedrate used while the probe is probing.")
  2980. )
  2981. self.feedrate_probe_entry = FCDoubleSpinner()
  2982. self.feedrate_probe_entry.set_range(0, 99999)
  2983. self.feedrate_probe_entry.set_precision(self.decimals)
  2984. self.feedrate_probe_entry.setSingleStep(0.1)
  2985. self.feedrate_probe_entry.setWrapping(True)
  2986. grid1.addWidget(self.feedrate_probe_label, 7, 0)
  2987. grid1.addWidget(self.feedrate_probe_entry, 7, 1)
  2988. # Spindle direction
  2989. spindle_dir_label = QtWidgets.QLabel('%s:' % _('Spindle direction'))
  2990. spindle_dir_label.setToolTip(
  2991. _("This sets the direction that the spindle is rotating.\n"
  2992. "It can be either:\n"
  2993. "- CW = clockwise or\n"
  2994. "- CCW = counter clockwise")
  2995. )
  2996. self.spindledir_radio = RadioSet([{'label': _('CW'), 'value': 'CW'},
  2997. {'label': _('CCW'), 'value': 'CCW'}])
  2998. grid1.addWidget(spindle_dir_label, 8, 0)
  2999. grid1.addWidget(self.spindledir_radio, 8, 1)
  3000. # Fast Move from Z Toolchange
  3001. fplungelabel = QtWidgets.QLabel('%s:' % _('Fast Plunge'))
  3002. fplungelabel.setToolTip(
  3003. _("By checking this, the vertical move from\n"
  3004. "Z_Toolchange to Z_move is done with G0,\n"
  3005. "meaning the fastest speed available.\n"
  3006. "WARNING: the move is done at Toolchange X,Y coords.")
  3007. )
  3008. self.fplunge_cb = FCCheckBox()
  3009. grid1.addWidget(fplungelabel, 9, 0)
  3010. grid1.addWidget(self.fplunge_cb, 9, 1)
  3011. # Size of trace segment on X axis
  3012. segx_label = QtWidgets.QLabel('%s:' % _("Segment X size"))
  3013. segx_label.setToolTip(
  3014. _("The size of the trace segment on the X axis.\n"
  3015. "Useful for auto-leveling.\n"
  3016. "A value of 0 means no segmentation on the X axis.")
  3017. )
  3018. self.segx_entry = FCDoubleSpinner()
  3019. self.segx_entry.set_range(0, 99999)
  3020. self.segx_entry.set_precision(self.decimals)
  3021. self.segx_entry.setSingleStep(0.1)
  3022. self.segx_entry.setWrapping(True)
  3023. grid1.addWidget(segx_label, 10, 0)
  3024. grid1.addWidget(self.segx_entry, 10, 1)
  3025. # Size of trace segment on Y axis
  3026. segy_label = QtWidgets.QLabel('%s:' % _("Segment Y size"))
  3027. segy_label.setToolTip(
  3028. _("The size of the trace segment on the Y axis.\n"
  3029. "Useful for auto-leveling.\n"
  3030. "A value of 0 means no segmentation on the Y axis.")
  3031. )
  3032. self.segy_entry = FCDoubleSpinner()
  3033. self.segy_entry.set_range(0, 99999)
  3034. self.segy_entry.set_precision(self.decimals)
  3035. self.segy_entry.setSingleStep(0.1)
  3036. self.segy_entry.setWrapping(True)
  3037. grid1.addWidget(segy_label, 11, 0)
  3038. grid1.addWidget(self.segy_entry, 11, 1)
  3039. self.layout.addStretch()
  3040. class GeometryEditorPrefGroupUI(OptionsGroupUI):
  3041. def __init__(self, decimals=4, parent=None):
  3042. # OptionsGroupUI.__init__(self, "Gerber Adv. Options Preferences", parent=parent)
  3043. super(GeometryEditorPrefGroupUI, self).__init__(self)
  3044. self.setTitle(str(_("Geometry Editor")))
  3045. self.decimals = decimals
  3046. # Advanced Geometry Parameters
  3047. self.param_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  3048. self.param_label.setToolTip(
  3049. _("A list of Geometry Editor parameters.")
  3050. )
  3051. self.layout.addWidget(self.param_label)
  3052. grid0 = QtWidgets.QGridLayout()
  3053. self.layout.addLayout(grid0)
  3054. # Selection Limit
  3055. self.sel_limit_label = QtWidgets.QLabel('%s:' % _("Selection limit"))
  3056. self.sel_limit_label.setToolTip(
  3057. _("Set the number of selected geometry\n"
  3058. "items above which the utility geometry\n"
  3059. "becomes just a selection rectangle.\n"
  3060. "Increases the performance when moving a\n"
  3061. "large number of geometric elements.")
  3062. )
  3063. self.sel_limit_entry = FCSpinner()
  3064. self.sel_limit_entry.set_range(0, 9999)
  3065. grid0.addWidget(self.sel_limit_label, 0, 0)
  3066. grid0.addWidget(self.sel_limit_entry, 0, 1)
  3067. # Milling Type
  3068. milling_type_label = QtWidgets.QLabel('%s:' % _('Milling Type'))
  3069. milling_type_label.setToolTip(
  3070. _("Milling type:\n"
  3071. "- climb / best for precision milling and to reduce tool usage\n"
  3072. "- conventional / useful when there is no backlash compensation")
  3073. )
  3074. self.milling_type_radio = RadioSet([{'label': _('Climb'), 'value': 'cl'},
  3075. {'label': _('Conv.'), 'value': 'cv'}])
  3076. grid0.addWidget(milling_type_label, 1, 0)
  3077. grid0.addWidget(self.milling_type_radio, 1, 1)
  3078. self.layout.addStretch()
  3079. class CNCJobGenPrefGroupUI(OptionsGroupUI):
  3080. def __init__(self, decimals=4, parent=None):
  3081. # OptionsGroupUI.__init__(self, "CNC Job General Preferences", parent=None)
  3082. super(CNCJobGenPrefGroupUI, self).__init__(self)
  3083. self.setTitle(str(_("CNC Job General")))
  3084. self.decimals = decimals
  3085. # ## Plot options
  3086. self.plot_options_label = QtWidgets.QLabel("<b>%s:</b>" % _("Plot Options"))
  3087. self.layout.addWidget(self.plot_options_label)
  3088. grid0 = QtWidgets.QGridLayout()
  3089. self.layout.addLayout(grid0)
  3090. grid0.setColumnStretch(0, 0)
  3091. grid0.setColumnStretch(1, 1)
  3092. # Plot CB
  3093. # self.plot_cb = QtWidgets.QCheckBox('Plot')
  3094. self.plot_cb = FCCheckBox(_('Plot Object'))
  3095. self.plot_cb.setToolTip(_("Plot (show) this object."))
  3096. grid0.addWidget(self.plot_cb, 0, 0)
  3097. # Plot Kind
  3098. self.cncplot_method_label = QtWidgets.QLabel('%s:' % _("Plot kind"))
  3099. self.cncplot_method_label.setToolTip(
  3100. _("This selects the kind of geometries on the canvas to plot.\n"
  3101. "Those can be either of type 'Travel' which means the moves\n"
  3102. "above the work piece or it can be of type 'Cut',\n"
  3103. "which means the moves that cut into the material.")
  3104. )
  3105. self.cncplot_method_radio = RadioSet([
  3106. {"label": _("All"), "value": "all"},
  3107. {"label": _("Travel"), "value": "travel"},
  3108. {"label": _("Cut"), "value": "cut"}
  3109. ], stretch=False)
  3110. grid0.addWidget(self.cncplot_method_label, 1, 0)
  3111. grid0.addWidget(self.cncplot_method_radio, 1, 1)
  3112. grid0.addWidget(QtWidgets.QLabel(''), 1, 2)
  3113. # Display Annotation
  3114. self.annotation_cb = FCCheckBox(_("Display Annotation"))
  3115. self.annotation_cb.setToolTip(
  3116. _("This selects if to display text annotation on the plot.\n"
  3117. "When checked it will display numbers in order for each end\n"
  3118. "of a travel line."
  3119. )
  3120. )
  3121. grid0.addWidget(self.annotation_cb, 2, 0, 1, 3)
  3122. # ###################################################################
  3123. # Number of circle steps for circular aperture linear approximation #
  3124. # ###################################################################
  3125. self.steps_per_circle_label = QtWidgets.QLabel('%s:' % _("Circle Steps"))
  3126. self.steps_per_circle_label.setToolTip(
  3127. _("The number of circle steps for <b>GCode</b> \n"
  3128. "circle and arc shapes linear approximation.")
  3129. )
  3130. grid0.addWidget(self.steps_per_circle_label, 3, 0)
  3131. self.steps_per_circle_entry = FCSpinner()
  3132. self.steps_per_circle_entry.set_range(0, 99999)
  3133. grid0.addWidget(self.steps_per_circle_entry, 3, 1)
  3134. # Tool dia for plot
  3135. tdlabel = QtWidgets.QLabel('%s:' % _('Travel dia'))
  3136. tdlabel.setToolTip(
  3137. _("The width of the travel lines to be\n"
  3138. "rendered in the plot.")
  3139. )
  3140. self.tooldia_entry = FCDoubleSpinner()
  3141. self.tooldia_entry.set_range(0, 99999)
  3142. self.tooldia_entry.set_precision(self.decimals)
  3143. self.tooldia_entry.setSingleStep(0.1)
  3144. self.tooldia_entry.setWrapping(True)
  3145. grid0.addWidget(tdlabel, 4, 0)
  3146. grid0.addWidget(self.tooldia_entry, 4, 1)
  3147. # add a space
  3148. grid0.addWidget(QtWidgets.QLabel(''), 5, 0)
  3149. # Number of decimals to use in GCODE coordinates
  3150. cdeclabel = QtWidgets.QLabel('%s:' % _('Coordinates decimals'))
  3151. cdeclabel.setToolTip(
  3152. _("The number of decimals to be used for \n"
  3153. "the X, Y, Z coordinates in CNC code (GCODE, etc.)")
  3154. )
  3155. self.coords_dec_entry = FCSpinner()
  3156. self.coords_dec_entry.set_range(0, 9)
  3157. self.coords_dec_entry.setWrapping(True)
  3158. grid0.addWidget(cdeclabel, 6, 0)
  3159. grid0.addWidget(self.coords_dec_entry, 6, 1)
  3160. # Number of decimals to use in GCODE feedrate
  3161. frdeclabel = QtWidgets.QLabel('%s:' % _('Feedrate decimals'))
  3162. frdeclabel.setToolTip(
  3163. _("The number of decimals to be used for \n"
  3164. "the Feedrate parameter in CNC code (GCODE, etc.)")
  3165. )
  3166. self.fr_dec_entry = FCSpinner()
  3167. self.fr_dec_entry.set_range(0, 9)
  3168. self.fr_dec_entry.setWrapping(True)
  3169. grid0.addWidget(frdeclabel, 7, 0)
  3170. grid0.addWidget(self.fr_dec_entry, 7, 1)
  3171. # The type of coordinates used in the Gcode: Absolute or Incremental
  3172. coords_type_label = QtWidgets.QLabel('%s:' % _('Coordinates type'))
  3173. coords_type_label.setToolTip(
  3174. _("The type of coordinates to be used in Gcode.\n"
  3175. "Can be:\n"
  3176. "- Absolute G90 -> the reference is the origin x=0, y=0\n"
  3177. "- Incremental G91 -> the reference is the previous position")
  3178. )
  3179. self.coords_type_radio = RadioSet([
  3180. {"label": _("Absolute G90"), "value": "G90"},
  3181. {"label": _("Incremental G91"), "value": "G91"}
  3182. ], orientation='vertical', stretch=False)
  3183. grid0.addWidget(coords_type_label, 8, 0)
  3184. grid0.addWidget(self.coords_type_radio, 8, 1)
  3185. # hidden for the time being, until implemented
  3186. coords_type_label.hide()
  3187. self.coords_type_radio.hide()
  3188. # Line Endings
  3189. self.line_ending_cb = FCCheckBox(_("Force Windows style line-ending"))
  3190. self.line_ending_cb.setToolTip(
  3191. _("When checked will force a Windows style line-ending\n"
  3192. "(\\r\\n) on non-Windows OS's.")
  3193. )
  3194. grid0.addWidget(self.line_ending_cb, 9, 0, 1, 3)
  3195. self.layout.addStretch()
  3196. class CNCJobOptPrefGroupUI(OptionsGroupUI):
  3197. def __init__(self, decimals=4, parent=None):
  3198. # OptionsGroupUI.__init__(self, "CNC Job Options Preferences", parent=None)
  3199. super(CNCJobOptPrefGroupUI, self).__init__(self)
  3200. self.setTitle(str(_("CNC Job Options")))
  3201. self.decimals = decimals
  3202. # ## Export G-Code
  3203. self.export_gcode_label = QtWidgets.QLabel("<b>%s:</b>" % _("Export G-Code"))
  3204. self.export_gcode_label.setToolTip(
  3205. _("Export and save G-Code to\n"
  3206. "make this object to a file.")
  3207. )
  3208. self.layout.addWidget(self.export_gcode_label)
  3209. settings = QSettings("Open Source", "FlatCAM")
  3210. if settings.contains("textbox_font_size"):
  3211. tb_fsize = settings.value('textbox_font_size', type=int)
  3212. else:
  3213. tb_fsize = 10
  3214. font = QtGui.QFont()
  3215. font.setPointSize(tb_fsize)
  3216. # Prepend to G-Code
  3217. prependlabel = QtWidgets.QLabel('%s:' % _('Prepend to G-Code'))
  3218. prependlabel.setToolTip(
  3219. _("Type here any G-Code commands you would\n"
  3220. "like to add at the beginning of the G-Code file.")
  3221. )
  3222. self.layout.addWidget(prependlabel)
  3223. self.prepend_text = FCTextArea()
  3224. self.prepend_text.setPlaceholderText(
  3225. _("Type here any G-Code commands you would\n"
  3226. "like to add at the beginning of the G-Code file.")
  3227. )
  3228. self.layout.addWidget(self.prepend_text)
  3229. self.prepend_text.setFont(font)
  3230. # Append text to G-Code
  3231. appendlabel = QtWidgets.QLabel('%s:' % _('Append to G-Code'))
  3232. appendlabel.setToolTip(
  3233. _("Type here any G-Code commands you would\n"
  3234. "like to append to the generated file.\n"
  3235. "I.e.: M2 (End of program)")
  3236. )
  3237. self.layout.addWidget(appendlabel)
  3238. self.append_text = FCTextArea()
  3239. self.append_text.setPlaceholderText(
  3240. _("Type here any G-Code commands you would\n"
  3241. "like to append to the generated file.\n"
  3242. "I.e.: M2 (End of program)")
  3243. )
  3244. self.layout.addWidget(self.append_text)
  3245. self.append_text.setFont(font)
  3246. self.layout.addStretch()
  3247. class CNCJobAdvOptPrefGroupUI(OptionsGroupUI):
  3248. def __init__(self, decimals=4, parent=None):
  3249. # OptionsGroupUI.__init__(self, "CNC Job Advanced Options Preferences", parent=None)
  3250. super(CNCJobAdvOptPrefGroupUI, self).__init__(self)
  3251. self.decimals = decimals
  3252. self.setTitle(str(_("CNC Job Adv. Options")))
  3253. # ## Export G-Code
  3254. self.export_gcode_label = QtWidgets.QLabel("<b>%s:</b>" % _("Export CNC Code"))
  3255. self.export_gcode_label.setToolTip(
  3256. _("Export and save G-Code to\n"
  3257. "make this object to a file.")
  3258. )
  3259. self.layout.addWidget(self.export_gcode_label)
  3260. # Prepend to G-Code
  3261. toolchangelabel = QtWidgets.QLabel('%s:' % _('Toolchange G-Code'))
  3262. toolchangelabel.setToolTip(
  3263. _(
  3264. "Type here any G-Code commands you would\n"
  3265. "like to be executed when Toolchange event is encountered.\n"
  3266. "This will constitute a Custom Toolchange GCode,\n"
  3267. "or a Toolchange Macro.\n"
  3268. "The FlatCAM variables are surrounded by '%' symbol.\n\n"
  3269. "WARNING: it can be used only with a preprocessor file\n"
  3270. "that has 'toolchange_custom' in it's name and this is built\n"
  3271. "having as template the 'Toolchange Custom' posprocessor file."
  3272. )
  3273. )
  3274. self.layout.addWidget(toolchangelabel)
  3275. settings = QSettings("Open Source", "FlatCAM")
  3276. if settings.contains("textbox_font_size"):
  3277. tb_fsize = settings.value('textbox_font_size', type=int)
  3278. else:
  3279. tb_fsize = 10
  3280. font = QtGui.QFont()
  3281. font.setPointSize(tb_fsize)
  3282. self.toolchange_text = FCTextArea()
  3283. self.toolchange_text.setPlaceholderText(
  3284. _(
  3285. "Type here any G-Code commands you would\n"
  3286. "like to be executed when Toolchange event is encountered.\n"
  3287. "This will constitute a Custom Toolchange GCode,\n"
  3288. "or a Toolchange Macro.\n"
  3289. "The FlatCAM variables are surrounded by '%' symbol.\n"
  3290. "WARNING: it can be used only with a preprocessor file\n"
  3291. "that has 'toolchange_custom' in it's name."
  3292. )
  3293. )
  3294. self.layout.addWidget(self.toolchange_text)
  3295. self.toolchange_text.setFont(font)
  3296. hlay = QtWidgets.QHBoxLayout()
  3297. self.layout.addLayout(hlay)
  3298. # Toolchange Replacement GCode
  3299. self.toolchange_cb = FCCheckBox(label='%s' % _('Use Toolchange Macro'))
  3300. self.toolchange_cb.setToolTip(
  3301. _("Check this box if you want to use\n"
  3302. "a Custom Toolchange GCode (macro).")
  3303. )
  3304. hlay.addWidget(self.toolchange_cb)
  3305. hlay.addStretch()
  3306. hlay1 = QtWidgets.QHBoxLayout()
  3307. self.layout.addLayout(hlay1)
  3308. # Variable list
  3309. self.tc_variable_combo = FCComboBox()
  3310. self.tc_variable_combo.setToolTip(
  3311. _("A list of the FlatCAM variables that can be used\n"
  3312. "in the Toolchange event.\n"
  3313. "They have to be surrounded by the '%' symbol")
  3314. )
  3315. hlay1.addWidget(self.tc_variable_combo)
  3316. # Populate the Combo Box
  3317. variables = [_('Parameters'), 'tool', 'tooldia', 't_drills', 'x_toolchange', 'y_toolchange', 'z_toolchange',
  3318. 'z_cut', 'z_move', 'z_depthpercut', 'spindlespeed', 'dwelltime']
  3319. self.tc_variable_combo.addItems(variables)
  3320. self.tc_variable_combo.setItemData(0, _("FlatCAM CNC parameters"), Qt.ToolTipRole)
  3321. self.tc_variable_combo.setItemData(1, 'tool = %s' % _("tool number"), Qt.ToolTipRole)
  3322. self.tc_variable_combo.setItemData(2, 'tooldia = %s' % _("tool diameter"), Qt.ToolTipRole)
  3323. self.tc_variable_combo.setItemData(3, 't_drills = %s' % _("for Excellon, total number of drills"),
  3324. Qt.ToolTipRole)
  3325. self.tc_variable_combo.setItemData(4, 'x_toolchange = %s' % _("X coord for Toolchange"), Qt.ToolTipRole)
  3326. self.tc_variable_combo.setItemData(5, 'y_toolchange = %s' % _("Y coord for Toolchange"),
  3327. Qt.ToolTipRole)
  3328. self.tc_variable_combo.setItemData(6, 'z_toolchange = %s' % _("Z coord for Toolchange"), Qt.ToolTipRole)
  3329. self.tc_variable_combo.setItemData(7, 'z_cut = %s' % _("Z depth for the cut"), Qt.ToolTipRole)
  3330. self.tc_variable_combo.setItemData(8, 'z_move = %s' % _("Z height for travel"), Qt.ToolTipRole)
  3331. self.tc_variable_combo.setItemData(9, 'z_depthpercut = %s' % _("the step value for multidepth cut"),
  3332. Qt.ToolTipRole)
  3333. self.tc_variable_combo.setItemData(10, 'spindlesspeed = %s' % _("the value for the spindle speed"),
  3334. Qt.ToolTipRole)
  3335. self.tc_variable_combo.setItemData(11,
  3336. _("dwelltime = time to dwell to allow the spindle to reach it's set RPM"),
  3337. Qt.ToolTipRole)
  3338. hlay1.addStretch()
  3339. # Insert Variable into the Toolchange G-Code Text Box
  3340. # self.tc_insert_buton = FCButton("Insert")
  3341. # self.tc_insert_buton.setToolTip(
  3342. # "Insert the variable in the GCode Box\n"
  3343. # "surrounded by the '%' symbol."
  3344. # )
  3345. # hlay1.addWidget(self.tc_insert_buton)
  3346. grid0 = QtWidgets.QGridLayout()
  3347. self.layout.addLayout(grid0)
  3348. grid0.addWidget(QtWidgets.QLabel(''), 1, 0, 1, 2)
  3349. # Annotation Font Size
  3350. self.annotation_fontsize_label = QtWidgets.QLabel('%s:' % _("Annotation Size"))
  3351. self.annotation_fontsize_label.setToolTip(
  3352. _("The font size of the annotation text. In pixels.")
  3353. )
  3354. grid0.addWidget(self.annotation_fontsize_label, 2, 0)
  3355. self.annotation_fontsize_sp = FCSpinner()
  3356. self.annotation_fontsize_sp.set_range(0, 9999)
  3357. grid0.addWidget(self.annotation_fontsize_sp, 2, 1)
  3358. grid0.addWidget(QtWidgets.QLabel(''), 2, 2)
  3359. # Annotation Font Color
  3360. self.annotation_color_label = QtWidgets.QLabel('%s:' % _('Annotation Color'))
  3361. self.annotation_color_label.setToolTip(
  3362. _("Set the font color for the annotation texts.")
  3363. )
  3364. self.annotation_fontcolor_entry = FCEntry()
  3365. self.annotation_fontcolor_button = QtWidgets.QPushButton()
  3366. self.annotation_fontcolor_button.setFixedSize(15, 15)
  3367. self.form_box_child = QtWidgets.QHBoxLayout()
  3368. self.form_box_child.setContentsMargins(0, 0, 0, 0)
  3369. self.form_box_child.addWidget(self.annotation_fontcolor_entry)
  3370. self.form_box_child.addWidget(self.annotation_fontcolor_button, alignment=Qt.AlignRight)
  3371. self.form_box_child.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  3372. color_widget = QtWidgets.QWidget()
  3373. color_widget.setLayout(self.form_box_child)
  3374. grid0.addWidget(self.annotation_color_label, 3, 0)
  3375. grid0.addWidget(color_widget, 3, 1)
  3376. grid0.addWidget(QtWidgets.QLabel(''), 3, 2)
  3377. self.layout.addStretch()
  3378. class ToolsNCCPrefGroupUI(OptionsGroupUI):
  3379. def __init__(self, decimals=4, parent=None):
  3380. # OptionsGroupUI.__init__(self, "NCC Tool Options", parent=parent)
  3381. super(ToolsNCCPrefGroupUI, self).__init__(self)
  3382. self.setTitle(str(_("NCC Tool Options")))
  3383. self.decimals = decimals
  3384. # ## Clear non-copper regions
  3385. self.clearcopper_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  3386. self.clearcopper_label.setToolTip(
  3387. _("Create a Geometry object with\n"
  3388. "toolpaths to cut all non-copper regions.")
  3389. )
  3390. self.layout.addWidget(self.clearcopper_label)
  3391. grid0 = QtWidgets.QGridLayout()
  3392. self.layout.addLayout(grid0)
  3393. ncctdlabel = QtWidgets.QLabel('%s:' % _('Tools dia'))
  3394. ncctdlabel.setToolTip(
  3395. _("Diameters of the cutting tools, separated by ','")
  3396. )
  3397. grid0.addWidget(ncctdlabel, 0, 0)
  3398. self.ncc_tool_dia_entry = FCEntry()
  3399. grid0.addWidget(self.ncc_tool_dia_entry, 0, 1)
  3400. # Tool Type Radio Button
  3401. self.tool_type_label = QtWidgets.QLabel('%s:' % _('Tool Type'))
  3402. self.tool_type_label.setToolTip(
  3403. _("Default tool type:\n"
  3404. "- 'V-shape'\n"
  3405. "- Circular")
  3406. )
  3407. self.tool_type_radio = RadioSet([{'label': _('V-shape'), 'value': 'V'},
  3408. {'label': _('Circular'), 'value': 'C1'}])
  3409. self.tool_type_radio.setToolTip(
  3410. _("Default tool type:\n"
  3411. "- 'V-shape'\n"
  3412. "- Circular")
  3413. )
  3414. grid0.addWidget(self.tool_type_label, 1, 0)
  3415. grid0.addWidget(self.tool_type_radio, 1, 1)
  3416. # Tip Dia
  3417. self.tipdialabel = QtWidgets.QLabel('%s:' % _('V-Tip Dia'))
  3418. self.tipdialabel.setToolTip(
  3419. _("The tip diameter for V-Shape Tool"))
  3420. self.tipdia_entry = FCDoubleSpinner()
  3421. self.tipdia_entry.set_precision(self.decimals)
  3422. self.tipdia_entry.set_range(0, 1000)
  3423. self.tipdia_entry.setSingleStep(0.1)
  3424. grid0.addWidget(self.tipdialabel, 2, 0)
  3425. grid0.addWidget(self.tipdia_entry, 2, 1)
  3426. # Tip Angle
  3427. self.tipanglelabel = QtWidgets.QLabel('%s:' % _('V-Tip Angle'))
  3428. self.tipanglelabel.setToolTip(
  3429. _("The tip angle for V-Shape Tool.\n"
  3430. "In degree."))
  3431. self.tipangle_entry = FCDoubleSpinner()
  3432. self.tipangle_entry.set_precision(self.decimals)
  3433. self.tipangle_entry.set_range(-360, 360)
  3434. self.tipangle_entry.setSingleStep(5)
  3435. self.tipangle_entry.setWrapping(True)
  3436. grid0.addWidget(self.tipanglelabel, 3, 0)
  3437. grid0.addWidget(self.tipangle_entry, 3, 1)
  3438. # Cut Z entry
  3439. cutzlabel = QtWidgets.QLabel('%s:' % _('Cut Z'))
  3440. cutzlabel.setToolTip(
  3441. _("Depth of cut into material. Negative value.\n"
  3442. "In FlatCAM units.")
  3443. )
  3444. self.cutz_entry = FCDoubleSpinner()
  3445. self.cutz_entry.set_precision(self.decimals)
  3446. self.cutz_entry.set_range(-9999.9999, 0.0000)
  3447. self.cutz_entry.setSingleStep(0.1)
  3448. self.cutz_entry.setToolTip(
  3449. _("Depth of cut into material. Negative value.\n"
  3450. "In FlatCAM units.")
  3451. )
  3452. grid0.addWidget(cutzlabel, 4, 0)
  3453. grid0.addWidget(self.cutz_entry, 4, 1)
  3454. # New Diameter
  3455. self.newdialabel = QtWidgets.QLabel('%s:' % _('New Tool Dia'))
  3456. self.newdialabel.setToolTip(
  3457. _("The new tool diameter (cut width) to add in the tool table."))
  3458. self.newdia_entry = FCDoubleSpinner()
  3459. self.newdia_entry.set_precision(self.decimals)
  3460. self.newdia_entry.set_range(0.0001, 9999.9999)
  3461. self.newdia_entry.setSingleStep(0.1)
  3462. grid0.addWidget(self.newdialabel, 5, 0)
  3463. grid0.addWidget(self.newdia_entry, 5, 1)
  3464. # Milling Type Radio Button
  3465. self.milling_type_label = QtWidgets.QLabel('%s:' % _('Milling Type'))
  3466. self.milling_type_label.setToolTip(
  3467. _("Milling type when the selected tool is of type: 'iso_op':\n"
  3468. "- climb / best for precision milling and to reduce tool usage\n"
  3469. "- conventional / useful when there is no backlash compensation")
  3470. )
  3471. self.milling_type_radio = RadioSet([{'label': _('Climb'), 'value': 'cl'},
  3472. {'label': _('Conv.'), 'value': 'cv'}])
  3473. self.milling_type_radio.setToolTip(
  3474. _("Milling type when the selected tool is of type: 'iso_op':\n"
  3475. "- climb / best for precision milling and to reduce tool usage\n"
  3476. "- conventional / useful when there is no backlash compensation")
  3477. )
  3478. grid0.addWidget(self.milling_type_label, 6, 0)
  3479. grid0.addWidget(self.milling_type_radio, 6, 1)
  3480. # Tool order Radio Button
  3481. self.ncc_order_label = QtWidgets.QLabel('%s:' % _('Tool order'))
  3482. self.ncc_order_label.setToolTip(_("This set the way that the tools in the tools table are used.\n"
  3483. "'No' --> means that the used order is the one in the tool table\n"
  3484. "'Forward' --> means that the tools will be ordered from small to big\n"
  3485. "'Reverse' --> menas that the tools will ordered from big to small\n\n"
  3486. "WARNING: using rest machining will automatically set the order\n"
  3487. "in reverse and disable this control."))
  3488. self.ncc_order_radio = RadioSet([{'label': _('No'), 'value': 'no'},
  3489. {'label': _('Forward'), 'value': 'fwd'},
  3490. {'label': _('Reverse'), 'value': 'rev'}])
  3491. self.ncc_order_radio.setToolTip(_("This set the way that the tools in the tools table are used.\n"
  3492. "'No' --> means that the used order is the one in the tool table\n"
  3493. "'Forward' --> means that the tools will be ordered from small to big\n"
  3494. "'Reverse' --> menas that the tools will ordered from big to small\n\n"
  3495. "WARNING: using rest machining will automatically set the order\n"
  3496. "in reverse and disable this control."))
  3497. grid0.addWidget(self.ncc_order_label, 7, 0)
  3498. grid0.addWidget(self.ncc_order_radio, 7, 1)
  3499. # Overlap Entry
  3500. nccoverlabel = QtWidgets.QLabel('%s:' % _('Overlap Rate'))
  3501. nccoverlabel.setToolTip(
  3502. _("How much (fraction) of the tool width to overlap each tool pass.\n"
  3503. "Adjust the value starting with lower values\n"
  3504. "and increasing it if areas that should be cleared are still \n"
  3505. "not cleared.\n"
  3506. "Lower values = faster processing, faster execution on CNC.\n"
  3507. "Higher values = slow processing and slow execution on CNC\n"
  3508. "due of too many paths.")
  3509. )
  3510. self.ncc_overlap_entry = FCDoubleSpinner(suffix='%')
  3511. self.ncc_overlap_entry.set_precision(self.decimals)
  3512. self.ncc_overlap_entry.setWrapping(True)
  3513. self.ncc_overlap_entry.setRange(0.0000, 99.9999)
  3514. self.ncc_overlap_entry.setSingleStep(0.1)
  3515. grid0.addWidget(nccoverlabel, 8, 0)
  3516. grid0.addWidget(self.ncc_overlap_entry, 8, 1)
  3517. # Margin entry
  3518. nccmarginlabel = QtWidgets.QLabel('%s:' % _('Margin'))
  3519. nccmarginlabel.setToolTip(
  3520. _("Bounding box margin.")
  3521. )
  3522. self.ncc_margin_entry = FCDoubleSpinner()
  3523. self.ncc_margin_entry.set_precision(self.decimals)
  3524. self.ncc_margin_entry.set_range(-10000, 10000)
  3525. self.ncc_margin_entry.setSingleStep(0.1)
  3526. grid0.addWidget(nccmarginlabel, 9, 0)
  3527. grid0.addWidget(self.ncc_margin_entry, 9, 1)
  3528. # Method
  3529. methodlabel = QtWidgets.QLabel('%s:' % _('Method'))
  3530. methodlabel.setToolTip(
  3531. _("Algorithm for non-copper clearing:<BR>"
  3532. "<B>Standard</B>: Fixed step inwards.<BR>"
  3533. "<B>Seed-based</B>: Outwards from seed.<BR>"
  3534. "<B>Line-based</B>: Parallel lines.")
  3535. )
  3536. self.ncc_method_radio = RadioSet([
  3537. {"label": _("Standard"), "value": "standard"},
  3538. {"label": _("Seed-based"), "value": "seed"},
  3539. {"label": _("Straight lines"), "value": "lines"}
  3540. ], orientation='vertical', stretch=False)
  3541. grid0.addWidget(methodlabel, 10, 0)
  3542. grid0.addWidget(self.ncc_method_radio, 10, 1)
  3543. # Connect lines
  3544. pathconnectlabel = QtWidgets.QLabel('%s:' % _("Connect"))
  3545. pathconnectlabel.setToolTip(
  3546. _("Draw lines between resulting\n"
  3547. "segments to minimize tool lifts.")
  3548. )
  3549. self.ncc_connect_cb = FCCheckBox()
  3550. grid0.addWidget(pathconnectlabel, 11, 0)
  3551. grid0.addWidget(self.ncc_connect_cb, 11, 1)
  3552. # Contour Checkbox
  3553. contourlabel = QtWidgets.QLabel('%s:' % _("Contour"))
  3554. contourlabel.setToolTip(
  3555. _("Cut around the perimeter of the polygon\n"
  3556. "to trim rough edges.")
  3557. )
  3558. self.ncc_contour_cb = FCCheckBox()
  3559. grid0.addWidget(contourlabel, 12, 0)
  3560. grid0.addWidget(self.ncc_contour_cb, 12, 1)
  3561. # Rest machining CheckBox
  3562. restlabel = QtWidgets.QLabel('%s:' % _("Rest M."))
  3563. restlabel.setToolTip(
  3564. _("If checked, use 'rest machining'.\n"
  3565. "Basically it will clear copper outside PCB features,\n"
  3566. "using the biggest tool and continue with the next tools,\n"
  3567. "from bigger to smaller, to clear areas of copper that\n"
  3568. "could not be cleared by previous tool, until there is\n"
  3569. "no more copper to clear or there are no more tools.\n"
  3570. "If not checked, use the standard algorithm.")
  3571. )
  3572. self.ncc_rest_cb = FCCheckBox()
  3573. grid0.addWidget(restlabel, 13, 0)
  3574. grid0.addWidget(self.ncc_rest_cb, 13, 1)
  3575. # ## NCC Offset choice
  3576. self.ncc_offset_choice_label = QtWidgets.QLabel('%s:' % _("Offset"))
  3577. self.ncc_offset_choice_label.setToolTip(
  3578. _("If used, it will add an offset to the copper features.\n"
  3579. "The copper clearing will finish to a distance\n"
  3580. "from the copper features.\n"
  3581. "The value can be between 0 and 10 FlatCAM units.")
  3582. )
  3583. self.ncc_choice_offset_cb = FCCheckBox()
  3584. grid0.addWidget(self.ncc_offset_choice_label, 14, 0)
  3585. grid0.addWidget(self.ncc_choice_offset_cb, 14, 1)
  3586. # ## NCC Offset value
  3587. self.ncc_offset_label = QtWidgets.QLabel('%s:' % _("Offset value"))
  3588. self.ncc_offset_label.setToolTip(
  3589. _("If used, it will add an offset to the copper features.\n"
  3590. "The copper clearing will finish to a distance\n"
  3591. "from the copper features.\n"
  3592. "The value can be between 0.0 and 9999.9 FlatCAM units.")
  3593. )
  3594. self.ncc_offset_spinner = FCDoubleSpinner()
  3595. self.ncc_offset_spinner.set_range(0.00, 9999.9999)
  3596. self.ncc_offset_spinner.set_precision(self.decimals)
  3597. self.ncc_offset_spinner.setWrapping(True)
  3598. self.ncc_offset_spinner.setSingleStep(0.1)
  3599. grid0.addWidget(self.ncc_offset_label, 15, 0)
  3600. grid0.addWidget(self.ncc_offset_spinner, 15, 1)
  3601. # ## Reference
  3602. self.reference_radio = RadioSet([{'label': _('Itself'), 'value': 'itself'},
  3603. {"label": _("Area"), "value": "area"},
  3604. {'label': _('Ref'), 'value': 'box'}])
  3605. reference_label = QtWidgets.QLabel('%s:' % _("Reference"))
  3606. reference_label.setToolTip(
  3607. _("- 'Itself' - the non copper clearing extent\n"
  3608. "is based on the object that is copper cleared.\n "
  3609. "- 'Area Selection' - left mouse click to start selection of the area to be painted.\n"
  3610. "Keeping a modifier key pressed (CTRL or SHIFT) will allow to add multiple areas.\n"
  3611. "- 'Reference Object' - will do non copper clearing within the area\n"
  3612. "specified by another object.")
  3613. )
  3614. grid0.addWidget(reference_label, 16, 0)
  3615. grid0.addWidget(self.reference_radio, 16, 1)
  3616. # ## Plotting type
  3617. self.ncc_plotting_radio = RadioSet([{'label': _('Normal'), 'value': 'normal'},
  3618. {"label": _("Progressive"), "value": "progressive"}])
  3619. plotting_label = QtWidgets.QLabel('%s:' % _("NCC Plotting"))
  3620. plotting_label.setToolTip(
  3621. _("- 'Normal' - normal plotting, done at the end of the NCC job\n"
  3622. "- 'Progressive' - after each shape is generated it will be plotted.")
  3623. )
  3624. grid0.addWidget(plotting_label, 17, 0)
  3625. grid0.addWidget(self.ncc_plotting_radio, 17, 1)
  3626. self.layout.addStretch()
  3627. class ToolsCutoutPrefGroupUI(OptionsGroupUI):
  3628. def __init__(self, decimals=4, parent=None):
  3629. # OptionsGroupUI.__init__(self, "Cutout Tool Options", parent=parent)
  3630. super(ToolsCutoutPrefGroupUI, self).__init__(self)
  3631. self.setTitle(str(_("Cutout Tool Options")))
  3632. self.decimals = decimals
  3633. # ## Board cutout
  3634. self.board_cutout_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  3635. self.board_cutout_label.setToolTip(
  3636. _("Create toolpaths to cut around\n"
  3637. "the PCB and separate it from\n"
  3638. "the original board.")
  3639. )
  3640. self.layout.addWidget(self.board_cutout_label)
  3641. grid0 = QtWidgets.QGridLayout()
  3642. self.layout.addLayout(grid0)
  3643. tdclabel = QtWidgets.QLabel('%s:' % _('Tool Diameter'))
  3644. tdclabel.setToolTip(
  3645. _("Diameter of the tool used to cutout\n"
  3646. "the PCB shape out of the surrounding material.")
  3647. )
  3648. self.cutout_tooldia_entry = FCDoubleSpinner()
  3649. self.cutout_tooldia_entry.set_range(0.000001, 9999.9999)
  3650. self.cutout_tooldia_entry.set_precision(self.decimals)
  3651. self.cutout_tooldia_entry.setSingleStep(0.1)
  3652. grid0.addWidget(tdclabel, 0, 0)
  3653. grid0.addWidget(self.cutout_tooldia_entry, 0, 1)
  3654. # Cut Z
  3655. cutzlabel = QtWidgets.QLabel('%s:' % _('Cut Z'))
  3656. cutzlabel.setToolTip(
  3657. _(
  3658. "Cutting depth (negative)\n"
  3659. "below the copper surface."
  3660. )
  3661. )
  3662. self.cutz_entry = FCDoubleSpinner()
  3663. self.cutz_entry.set_precision(self.decimals)
  3664. if machinist_setting == 0:
  3665. self.cutz_entry.setRange(-9999.9999, 0.0000)
  3666. else:
  3667. self.cutz_entry.setRange(-9999.9999, 9999.9999)
  3668. self.cutz_entry.setSingleStep(0.1)
  3669. grid0.addWidget(cutzlabel, 1, 0)
  3670. grid0.addWidget(self.cutz_entry, 1, 1)
  3671. # Multi-pass
  3672. self.mpass_cb = FCCheckBox('%s:' % _("Multi-Depth"))
  3673. self.mpass_cb.setToolTip(
  3674. _(
  3675. "Use multiple passes to limit\n"
  3676. "the cut depth in each pass. Will\n"
  3677. "cut multiple times until Cut Z is\n"
  3678. "reached."
  3679. )
  3680. )
  3681. self.maxdepth_entry = FCDoubleSpinner()
  3682. self.maxdepth_entry.set_precision(self.decimals)
  3683. self.maxdepth_entry.setRange(0, 9999.9999)
  3684. self.maxdepth_entry.setSingleStep(0.1)
  3685. self.maxdepth_entry.setToolTip(_("Depth of each pass (positive)."))
  3686. grid0.addWidget(self.mpass_cb, 2, 0)
  3687. grid0.addWidget(self.maxdepth_entry, 2, 1)
  3688. # Object kind
  3689. kindlabel = QtWidgets.QLabel('%s:' % _('Object kind'))
  3690. kindlabel.setToolTip(
  3691. _("Choice of what kind the object we want to cutout is.<BR>"
  3692. "- <B>Single</B>: contain a single PCB Gerber outline object.<BR>"
  3693. "- <B>Panel</B>: a panel PCB Gerber object, which is made\n"
  3694. "out of many individual PCB outlines.")
  3695. )
  3696. self.obj_kind_combo = RadioSet([
  3697. {"label": _("Single"), "value": "single"},
  3698. {"label": _("Panel"), "value": "panel"},
  3699. ])
  3700. grid0.addWidget(kindlabel, 3, 0)
  3701. grid0.addWidget(self.obj_kind_combo, 3, 1)
  3702. marginlabel = QtWidgets.QLabel('%s:' % _('Margin'))
  3703. marginlabel.setToolTip(
  3704. _("Margin over bounds. A positive value here\n"
  3705. "will make the cutout of the PCB further from\n"
  3706. "the actual PCB border")
  3707. )
  3708. self.cutout_margin_entry = FCDoubleSpinner()
  3709. self.cutout_margin_entry.set_range(-9999.9999, 9999.9999)
  3710. self.cutout_margin_entry.set_precision(self.decimals)
  3711. self.cutout_margin_entry.setSingleStep(0.1)
  3712. grid0.addWidget(marginlabel, 4, 0)
  3713. grid0.addWidget(self.cutout_margin_entry, 4, 1)
  3714. gaplabel = QtWidgets.QLabel('%s:' % _('Gap size'))
  3715. gaplabel.setToolTip(
  3716. _("The size of the bridge gaps in the cutout\n"
  3717. "used to keep the board connected to\n"
  3718. "the surrounding material (the one \n"
  3719. "from which the PCB is cutout).")
  3720. )
  3721. self.cutout_gap_entry = FCDoubleSpinner()
  3722. self.cutout_gap_entry.set_range(0.000001, 9999.9999)
  3723. self.cutout_gap_entry.set_precision(self.decimals)
  3724. self.cutout_gap_entry.setSingleStep(0.1)
  3725. grid0.addWidget(gaplabel, 5, 0)
  3726. grid0.addWidget(self.cutout_gap_entry, 5, 1)
  3727. gaps_label = QtWidgets.QLabel('%s:' % _('Gaps'))
  3728. gaps_label.setToolTip(
  3729. _("Number of gaps used for the cutout.\n"
  3730. "There can be maximum 8 bridges/gaps.\n"
  3731. "The choices are:\n"
  3732. "- None - no gaps\n"
  3733. "- lr - left + right\n"
  3734. "- tb - top + bottom\n"
  3735. "- 4 - left + right +top + bottom\n"
  3736. "- 2lr - 2*left + 2*right\n"
  3737. "- 2tb - 2*top + 2*bottom\n"
  3738. "- 8 - 2*left + 2*right +2*top + 2*bottom")
  3739. )
  3740. self.gaps_combo = FCComboBox()
  3741. grid0.addWidget(gaps_label, 6, 0)
  3742. grid0.addWidget(self.gaps_combo, 6, 1)
  3743. gaps_items = ['None', 'LR', 'TB', '4', '2LR', '2TB', '8']
  3744. for it in gaps_items:
  3745. self.gaps_combo.addItem(it)
  3746. self.gaps_combo.setStyleSheet('background-color: rgb(255,255,255)')
  3747. # Surrounding convex box shape
  3748. self.convex_box = FCCheckBox()
  3749. self.convex_box_label = QtWidgets.QLabel('%s:' % _("Convex Sh."))
  3750. self.convex_box_label.setToolTip(
  3751. _("Create a convex shape surrounding the entire PCB.\n"
  3752. "Used only if the source object type is Gerber.")
  3753. )
  3754. grid0.addWidget(self.convex_box_label, 7, 0)
  3755. grid0.addWidget(self.convex_box, 7, 1)
  3756. self.layout.addStretch()
  3757. class Tools2sidedPrefGroupUI(OptionsGroupUI):
  3758. def __init__(self, decimals=4, parent=None):
  3759. # OptionsGroupUI.__init__(self, "2sided Tool Options", parent=parent)
  3760. super(Tools2sidedPrefGroupUI, self).__init__(self)
  3761. self.setTitle(str(_("2Sided Tool Options")))
  3762. self.decimals = decimals
  3763. # ## Board cuttout
  3764. self.dblsided_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  3765. self.dblsided_label.setToolTip(
  3766. _("A tool to help in creating a double sided\n"
  3767. "PCB using alignment holes.")
  3768. )
  3769. self.layout.addWidget(self.dblsided_label)
  3770. grid0 = QtWidgets.QGridLayout()
  3771. self.layout.addLayout(grid0)
  3772. # ## Drill diameter for alignment holes
  3773. self.drill_dia_entry = FCDoubleSpinner()
  3774. self.drill_dia_entry.set_range(0.000001, 9999.9999)
  3775. self.drill_dia_entry.set_precision(self.decimals)
  3776. self.drill_dia_entry.setSingleStep(0.1)
  3777. self.dd_label = QtWidgets.QLabel('%s:' % _("Drill dia"))
  3778. self.dd_label.setToolTip(
  3779. _("Diameter of the drill for the "
  3780. "alignment holes.")
  3781. )
  3782. grid0.addWidget(self.dd_label, 0, 0)
  3783. grid0.addWidget(self.drill_dia_entry, 0, 1)
  3784. # ## Axis
  3785. self.mirror_axis_radio = RadioSet([{'label': 'X', 'value': 'X'},
  3786. {'label': 'Y', 'value': 'Y'}])
  3787. self.mirax_label = QtWidgets.QLabel(_("Mirror Axis:"))
  3788. self.mirax_label.setToolTip(
  3789. _("Mirror vertically (X) or horizontally (Y).")
  3790. )
  3791. # grid_lay.addRow("Mirror Axis:", self.mirror_axis)
  3792. self.empty_lb1 = QtWidgets.QLabel("")
  3793. grid0.addWidget(self.empty_lb1, 1, 0)
  3794. grid0.addWidget(self.mirax_label, 2, 0)
  3795. grid0.addWidget(self.mirror_axis_radio, 2, 1)
  3796. # ## Axis Location
  3797. self.axis_location_radio = RadioSet([{'label': _('Point'), 'value': 'point'},
  3798. {'label': _('Box'), 'value': 'box'}])
  3799. self.axloc_label = QtWidgets.QLabel('%s:' % _("Axis Ref"))
  3800. self.axloc_label.setToolTip(
  3801. _("The axis should pass through a <b>point</b> or cut\n "
  3802. "a specified <b>box</b> (in a FlatCAM object) through \n"
  3803. "the center.")
  3804. )
  3805. # grid_lay.addRow("Axis Location:", self.axis_location)
  3806. grid0.addWidget(self.axloc_label, 3, 0)
  3807. grid0.addWidget(self.axis_location_radio, 3, 1)
  3808. self.layout.addStretch()
  3809. class ToolsPaintPrefGroupUI(OptionsGroupUI):
  3810. def __init__(self, decimals=4, parent=None):
  3811. # OptionsGroupUI.__init__(self, "Paint Area Tool Options", parent=parent)
  3812. super(ToolsPaintPrefGroupUI, self).__init__(self)
  3813. self.setTitle(str(_("Paint Tool Options")))
  3814. self.decimals = decimals
  3815. # ------------------------------
  3816. # ## Paint area
  3817. # ------------------------------
  3818. self.paint_label = QtWidgets.QLabel(_('<b>Parameters:</b>'))
  3819. self.paint_label.setToolTip(
  3820. _("Creates tool paths to cover the\n"
  3821. "whole area of a polygon (remove\n"
  3822. "all copper). You will be asked\n"
  3823. "to click on the desired polygon.")
  3824. )
  3825. self.layout.addWidget(self.paint_label)
  3826. grid0 = QtWidgets.QGridLayout()
  3827. self.layout.addLayout(grid0)
  3828. # Tool dia
  3829. ptdlabel = QtWidgets.QLabel('%s:' % _('Tool dia'))
  3830. ptdlabel.setToolTip(
  3831. _("Diameter of the tool to\n"
  3832. "be used in the operation.")
  3833. )
  3834. grid0.addWidget(ptdlabel, 0, 0)
  3835. self.painttooldia_entry = FCEntry()
  3836. grid0.addWidget(self.painttooldia_entry, 0, 1)
  3837. self.paint_order_label = QtWidgets.QLabel('<b>%s:</b>' % _('Tool order'))
  3838. self.paint_order_label.setToolTip(_("This set the way that the tools in the tools table are used.\n"
  3839. "'No' --> means that the used order is the one in the tool table\n"
  3840. "'Forward' --> means that the tools will be ordered from small to big\n"
  3841. "'Reverse' --> menas that the tools will ordered from big to small\n\n"
  3842. "WARNING: using rest machining will automatically set the order\n"
  3843. "in reverse and disable this control."))
  3844. self.paint_order_radio = RadioSet([{'label': _('No'), 'value': 'no'},
  3845. {'label': _('Forward'), 'value': 'fwd'},
  3846. {'label': _('Reverse'), 'value': 'rev'}])
  3847. self.paint_order_radio.setToolTip(_("This set the way that the tools in the tools table are used.\n"
  3848. "'No' --> means that the used order is the one in the tool table\n"
  3849. "'Forward' --> means that the tools will be ordered from small to big\n"
  3850. "'Reverse' --> menas that the tools will ordered from big to small\n\n"
  3851. "WARNING: using rest machining will automatically set the order\n"
  3852. "in reverse and disable this control."))
  3853. grid0.addWidget(self.paint_order_label, 1, 0)
  3854. grid0.addWidget(self.paint_order_radio, 1, 1)
  3855. # Overlap
  3856. ovlabel = QtWidgets.QLabel('%s:' % _('Overlap Rate'))
  3857. ovlabel.setToolTip(
  3858. _("How much (fraction) of the tool width to overlap each tool pass.\n"
  3859. "Adjust the value starting with lower values\n"
  3860. "and increasing it if areas that should be painted are still \n"
  3861. "not painted.\n"
  3862. "Lower values = faster processing, faster execution on CNC.\n"
  3863. "Higher values = slow processing and slow execution on CNC\n"
  3864. "due of too many paths.")
  3865. )
  3866. self.paintoverlap_entry = FCDoubleSpinner(suffix='%')
  3867. self.paintoverlap_entry.set_precision(self.decimals)
  3868. self.paintoverlap_entry.setWrapping(True)
  3869. self.paintoverlap_entry.setRange(0.0000, 99.9999)
  3870. self.paintoverlap_entry.setSingleStep(0.1)
  3871. grid0.addWidget(ovlabel, 2, 0)
  3872. grid0.addWidget(self.paintoverlap_entry, 2, 1)
  3873. # Margin
  3874. marginlabel = QtWidgets.QLabel('%s:' % _('Margin'))
  3875. marginlabel.setToolTip(
  3876. _("Distance by which to avoid\n"
  3877. "the edges of the polygon to\n"
  3878. "be painted.")
  3879. )
  3880. grid0.addWidget(marginlabel, 3, 0)
  3881. self.paintmargin_entry = FCDoubleSpinner()
  3882. self.paintmargin_entry.set_range(-9999.9999, 9999.9999)
  3883. self.paintmargin_entry.set_precision(self.decimals)
  3884. self.paintmargin_entry.setSingleStep(0.1)
  3885. grid0.addWidget(self.paintmargin_entry, 3, 1)
  3886. # Method
  3887. methodlabel = QtWidgets.QLabel('%s:' % _('Method'))
  3888. methodlabel.setToolTip(
  3889. _("Algorithm for non-copper clearing:<BR>"
  3890. "<B>Standard</B>: Fixed step inwards.<BR>"
  3891. "<B>Seed-based</B>: Outwards from seed.<BR>"
  3892. "<B>Line-based</B>: Parallel lines.")
  3893. )
  3894. grid0.addWidget(methodlabel, 4, 0)
  3895. self.paintmethod_combo = RadioSet([
  3896. {"label": _("Standard"), "value": "standard"},
  3897. {"label": _("Seed-based"), "value": "seed"},
  3898. {"label": _("Straight lines"), "value": "lines"}
  3899. ], orientation='vertical', stretch=False)
  3900. grid0.addWidget(self.paintmethod_combo, 4, 1)
  3901. # Connect lines
  3902. pathconnectlabel = QtWidgets.QLabel('%s:' % _("Connect"))
  3903. pathconnectlabel.setToolTip(
  3904. _("Draw lines between resulting\n"
  3905. "segments to minimize tool lifts.")
  3906. )
  3907. grid0.addWidget(pathconnectlabel, 5, 0)
  3908. self.pathconnect_cb = FCCheckBox()
  3909. grid0.addWidget(self.pathconnect_cb, 5, 1)
  3910. # Paint contour
  3911. contourlabel = QtWidgets.QLabel('%s:' % _("Contour"))
  3912. contourlabel.setToolTip(
  3913. _("Cut around the perimeter of the polygon\n"
  3914. "to trim rough edges.")
  3915. )
  3916. grid0.addWidget(contourlabel, 6, 0)
  3917. self.contour_cb = FCCheckBox()
  3918. grid0.addWidget(self.contour_cb, 6, 1)
  3919. # Polygon selection
  3920. selectlabel = QtWidgets.QLabel('%s:' % _('Selection'))
  3921. selectlabel.setToolTip(
  3922. _("How to select Polygons to be painted.\n"
  3923. "- 'Polygon Selection' - left mouse click to add/remove polygons to be painted.\n"
  3924. "- 'Area Selection' - left mouse click to start selection of the area to be painted.\n"
  3925. "Keeping a modifier key pressed (CTRL or SHIFT) will allow to add multiple areas.\n"
  3926. "- 'All Polygons' - the Paint will start after click.\n"
  3927. "- 'Reference Object' - will do non copper clearing within the area\n"
  3928. "specified by another object.")
  3929. )
  3930. self.selectmethod_combo = RadioSet([
  3931. {"label": _("Sel"), "value": "single"},
  3932. {"label": _("Area"), "value": "area"},
  3933. {"label": _("All"), "value": "all"},
  3934. {"label": _("Ref"), "value": "ref"}
  3935. ])
  3936. grid0.addWidget(selectlabel, 7, 0)
  3937. grid0.addWidget(self.selectmethod_combo, 7, 1)
  3938. # ## Plotting type
  3939. self.paint_plotting_radio = RadioSet([{'label': _('Normal'), 'value': 'normal'},
  3940. {"label": _("Progressive"), "value": "progressive"}])
  3941. plotting_label = QtWidgets.QLabel('%s:' % _("Paint Plotting"))
  3942. plotting_label.setToolTip(
  3943. _("- 'Normal' - normal plotting, done at the end of the Paint job\n"
  3944. "- 'Progressive' - after each shape is generated it will be plotted.")
  3945. )
  3946. grid0.addWidget(plotting_label, 8, 0)
  3947. grid0.addWidget(self.paint_plotting_radio, 8, 1)
  3948. self.layout.addStretch()
  3949. class ToolsFilmPrefGroupUI(OptionsGroupUI):
  3950. def __init__(self, decimals=4, parent=None):
  3951. # OptionsGroupUI.__init__(self, "Cutout Tool Options", parent=parent)
  3952. super(ToolsFilmPrefGroupUI, self).__init__(self)
  3953. self.setTitle(str(_("Film Tool Options")))
  3954. self.decimals = decimals
  3955. # ## Parameters
  3956. self.film_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  3957. self.film_label.setToolTip(
  3958. _("Create a PCB film from a Gerber or Geometry\n"
  3959. "FlatCAM object.\n"
  3960. "The file is saved in SVG format.")
  3961. )
  3962. self.layout.addWidget(self.film_label)
  3963. grid0 = QtWidgets.QGridLayout()
  3964. self.layout.addLayout(grid0)
  3965. self.film_type_radio = RadioSet([{'label': 'Pos', 'value': 'pos'},
  3966. {'label': 'Neg', 'value': 'neg'}])
  3967. ftypelbl = QtWidgets.QLabel('%s:' % _('Film Type'))
  3968. ftypelbl.setToolTip(
  3969. _("Generate a Positive black film or a Negative film.\n"
  3970. "Positive means that it will print the features\n"
  3971. "with black on a white canvas.\n"
  3972. "Negative means that it will print the features\n"
  3973. "with white on a black canvas.\n"
  3974. "The Film format is SVG.")
  3975. )
  3976. grid0.addWidget(ftypelbl, 0, 0)
  3977. grid0.addWidget(self.film_type_radio, 0, 1)
  3978. # Film Color
  3979. self.film_color_label = QtWidgets.QLabel('%s:' % _('Film Color'))
  3980. self.film_color_label.setToolTip(
  3981. _("Set the film color when positive film is selected.")
  3982. )
  3983. self.film_color_entry = FCEntry()
  3984. self.film_color_button = QtWidgets.QPushButton()
  3985. self.film_color_button.setFixedSize(15, 15)
  3986. self.form_box_child = QtWidgets.QHBoxLayout()
  3987. self.form_box_child.setContentsMargins(0, 0, 0, 0)
  3988. self.form_box_child.addWidget(self.film_color_entry)
  3989. self.form_box_child.addWidget(self.film_color_button, alignment=Qt.AlignRight)
  3990. self.form_box_child.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  3991. film_color_widget = QtWidgets.QWidget()
  3992. film_color_widget.setLayout(self.form_box_child)
  3993. grid0.addWidget(self.film_color_label, 1, 0)
  3994. grid0.addWidget(film_color_widget, 1, 1)
  3995. # Film Border
  3996. self.film_boundary_entry = FCDoubleSpinner()
  3997. self.film_boundary_entry.set_precision(self.decimals)
  3998. self.film_boundary_entry.set_range(0, 9999.9999)
  3999. self.film_boundary_entry.setSingleStep(0.1)
  4000. self.film_boundary_label = QtWidgets.QLabel('%s:' % _("Border"))
  4001. self.film_boundary_label.setToolTip(
  4002. _("Specify a border around the object.\n"
  4003. "Only for negative film.\n"
  4004. "It helps if we use as a Box Object the same \n"
  4005. "object as in Film Object. It will create a thick\n"
  4006. "black bar around the actual print allowing for a\n"
  4007. "better delimitation of the outline features which are of\n"
  4008. "white color like the rest and which may confound with the\n"
  4009. "surroundings if not for this border.")
  4010. )
  4011. grid0.addWidget(self.film_boundary_label, 2, 0)
  4012. grid0.addWidget(self.film_boundary_entry, 2, 1)
  4013. self.film_scale_stroke_entry = FCDoubleSpinner()
  4014. self.film_scale_stroke_entry.set_precision(self.decimals)
  4015. self.film_scale_stroke_entry.set_range(0, 9999.9999)
  4016. self.film_scale_stroke_entry.setSingleStep(0.1)
  4017. self.film_scale_stroke_label = QtWidgets.QLabel('%s:' % _("Scale Stroke"))
  4018. self.film_scale_stroke_label.setToolTip(
  4019. _("Scale the line stroke thickness of each feature in the SVG file.\n"
  4020. "It means that the line that envelope each SVG feature will be thicker or thinner,\n"
  4021. "therefore the fine features may be more affected by this parameter.")
  4022. )
  4023. grid0.addWidget(self.film_scale_stroke_label, 3, 0)
  4024. grid0.addWidget(self.film_scale_stroke_entry, 3, 1)
  4025. self.film_adj_label = QtWidgets.QLabel('<b>%s</b>' % _("Film Adjustments"))
  4026. self.film_adj_label.setToolTip(
  4027. _("Sometime the printers will distort the print shape, especially the Laser types.\n"
  4028. "This section provide the tools to compensate for the print distortions.")
  4029. )
  4030. grid0.addWidget(self.film_adj_label, 4, 0, 1, 2)
  4031. # Scale Geometry
  4032. self.film_scale_cb = FCCheckBox('%s' % _("Scale Film geometry"))
  4033. self.film_scale_cb.setToolTip(
  4034. _("A value greater than 1 will stretch the film\n"
  4035. "while a value less than 1 will jolt it.")
  4036. )
  4037. self.film_scale_cb.setStyleSheet(
  4038. """
  4039. QCheckBox {font-weight: bold; color: black}
  4040. """
  4041. )
  4042. grid0.addWidget(self.film_scale_cb, 5, 0, 1, 2)
  4043. self.film_scalex_label = QtWidgets.QLabel('%s:' % _("X factor"))
  4044. self.film_scalex_entry = FCDoubleSpinner()
  4045. self.film_scalex_entry.set_range(-999.9999, 999.9999)
  4046. self.film_scalex_entry.set_precision(self.decimals)
  4047. self.film_scalex_entry.setSingleStep(0.01)
  4048. grid0.addWidget(self.film_scalex_label, 6, 0)
  4049. grid0.addWidget(self.film_scalex_entry, 6, 1)
  4050. self.film_scaley_label = QtWidgets.QLabel('%s:' % _("Y factor"))
  4051. self.film_scaley_entry = FCDoubleSpinner()
  4052. self.film_scaley_entry.set_range(-999.9999, 999.9999)
  4053. self.film_scaley_entry.set_precision(self.decimals)
  4054. self.film_scaley_entry.setSingleStep(0.01)
  4055. grid0.addWidget(self.film_scaley_label, 7, 0)
  4056. grid0.addWidget(self.film_scaley_entry, 7, 1)
  4057. # Skew Geometry
  4058. self.film_skew_cb = FCCheckBox('%s' % _("Skew Film geometry"))
  4059. self.film_skew_cb.setToolTip(
  4060. _("Positive values will skew to the right\n"
  4061. "while negative values will skew to the left.")
  4062. )
  4063. self.film_skew_cb.setStyleSheet(
  4064. """
  4065. QCheckBox {font-weight: bold; color: black}
  4066. """
  4067. )
  4068. grid0.addWidget(self.film_skew_cb, 8, 0, 1, 2)
  4069. self.film_skewx_label = QtWidgets.QLabel('%s:' % _("X angle"))
  4070. self.film_skewx_entry = FCDoubleSpinner()
  4071. self.film_skewx_entry.set_range(-999.9999, 999.9999)
  4072. self.film_skewx_entry.set_precision(self.decimals)
  4073. self.film_skewx_entry.setSingleStep(0.01)
  4074. grid0.addWidget(self.film_skewx_label, 9, 0)
  4075. grid0.addWidget(self.film_skewx_entry, 9, 1)
  4076. self.film_skewy_label = QtWidgets.QLabel('%s:' % _("Y angle"))
  4077. self.film_skewy_entry = FCDoubleSpinner()
  4078. self.film_skewy_entry.set_range(-999.9999, 999.9999)
  4079. self.film_skewy_entry.set_precision(self.decimals)
  4080. self.film_skewy_entry.setSingleStep(0.01)
  4081. grid0.addWidget(self.film_skewy_label, 10, 0)
  4082. grid0.addWidget(self.film_skewy_entry, 10, 1)
  4083. self.film_skew_ref_label = QtWidgets.QLabel('%s:' % _("Reference"))
  4084. self.film_skew_ref_label.setToolTip(
  4085. _("The reference point to be used as origin for the skew.\n"
  4086. "It can be one of the four points of the geometry bounding box.")
  4087. )
  4088. self.film_skew_reference = RadioSet([{'label': _('Bottom Left'), 'value': 'bottomleft'},
  4089. {'label': _('Top Left'), 'value': 'topleft'},
  4090. {'label': _('Bottom Right'), 'value': 'bottomright'},
  4091. {'label': _('Top right'), 'value': 'topright'}],
  4092. orientation='vertical',
  4093. stretch=False)
  4094. grid0.addWidget(self.film_skew_ref_label, 11, 0)
  4095. grid0.addWidget(self.film_skew_reference, 11, 1)
  4096. # Mirror Geometry
  4097. self.film_mirror_cb = FCCheckBox('%s' % _("Mirror Film geometry"))
  4098. self.film_mirror_cb.setToolTip(
  4099. _("Mirror the film geometry on the selected axis or on both.")
  4100. )
  4101. self.film_mirror_cb.setStyleSheet(
  4102. """
  4103. QCheckBox {font-weight: bold; color: black}
  4104. """
  4105. )
  4106. grid0.addWidget(self.film_mirror_cb, 12, 0, 1, 2)
  4107. self.film_mirror_axis = RadioSet([{'label': _('None'), 'value': 'none'},
  4108. {'label': _('X'), 'value': 'x'},
  4109. {'label': _('Y'), 'value': 'y'},
  4110. {'label': _('Both'), 'value': 'both'}],
  4111. stretch=False)
  4112. self.film_mirror_axis_label = QtWidgets.QLabel('%s:' % _("Mirror axis"))
  4113. grid0.addWidget(self.film_mirror_axis_label, 13, 0)
  4114. grid0.addWidget(self.film_mirror_axis, 13, 1)
  4115. separator_line3 = QtWidgets.QFrame()
  4116. separator_line3.setFrameShape(QtWidgets.QFrame.HLine)
  4117. separator_line3.setFrameShadow(QtWidgets.QFrame.Sunken)
  4118. grid0.addWidget(separator_line3, 14, 0, 1, 2)
  4119. self.file_type_radio = RadioSet([{'label': _('SVG'), 'value': 'svg'},
  4120. {'label': _('PNG'), 'value': 'png'},
  4121. {'label': _('PDF'), 'value': 'pdf'}
  4122. ], stretch=False)
  4123. self.file_type_label = QtWidgets.QLabel(_("Film Type:"))
  4124. self.file_type_label.setToolTip(
  4125. _("The file type of the saved film. Can be:\n"
  4126. "- 'SVG' -> open-source vectorial format\n"
  4127. "- 'PNG' -> raster image\n"
  4128. "- 'PDF' -> portable document format")
  4129. )
  4130. grid0.addWidget(self.file_type_label, 15, 0)
  4131. grid0.addWidget(self.file_type_radio, 15, 1)
  4132. # Page orientation
  4133. self.orientation_label = QtWidgets.QLabel('%s:' % _("Page Orientation"))
  4134. self.orientation_label.setToolTip(_("Can be:\n"
  4135. "- Portrait\n"
  4136. "- Landscape"))
  4137. self.orientation_radio = RadioSet([{'label': _('Portrait'), 'value': 'p'},
  4138. {'label': _('Landscape'), 'value': 'l'},
  4139. ], stretch=False)
  4140. grid0.addWidget(self.orientation_label, 16, 0)
  4141. grid0.addWidget(self.orientation_radio, 16, 1)
  4142. # Page Size
  4143. self.pagesize_label = QtWidgets.QLabel('%s:' % _("Page Size"))
  4144. self.pagesize_label.setToolTip(_("A selection of standard ISO 216 page sizes."))
  4145. self.pagesize_combo = FCComboBox()
  4146. self.pagesize = dict()
  4147. self.pagesize.update(
  4148. {
  4149. 'Bounds': None,
  4150. 'A0': (841, 1189),
  4151. 'A1': (594, 841),
  4152. 'A2': (420, 594),
  4153. 'A3': (297, 420),
  4154. 'A4': (210, 297),
  4155. 'A5': (148, 210),
  4156. 'A6': (105, 148),
  4157. 'A7': (74, 105),
  4158. 'A8': (52, 74),
  4159. 'A9': (37, 52),
  4160. 'A10': (26, 37),
  4161. 'B0': (1000, 1414),
  4162. 'B1': (707, 1000),
  4163. 'B2': (500, 707),
  4164. 'B3': (353, 500),
  4165. 'B4': (250, 353),
  4166. 'B5': (176, 250),
  4167. 'B6': (125, 176),
  4168. 'B7': (88, 125),
  4169. 'B8': (62, 88),
  4170. 'B9': (44, 62),
  4171. 'B10': (31, 44),
  4172. 'C0': (917, 1297),
  4173. 'C1': (648, 917),
  4174. 'C2': (458, 648),
  4175. 'C3': (324, 458),
  4176. 'C4': (229, 324),
  4177. 'C5': (162, 229),
  4178. 'C6': (114, 162),
  4179. 'C7': (81, 114),
  4180. 'C8': (57, 81),
  4181. 'C9': (40, 57),
  4182. 'C10': (28, 40),
  4183. # American paper sizes
  4184. 'LETTER': (8.5, 11),
  4185. 'LEGAL': (8.5, 14),
  4186. 'ELEVENSEVENTEEN': (11, 17),
  4187. # From https://en.wikipedia.org/wiki/Paper_size
  4188. 'JUNIOR_LEGAL': (5, 8),
  4189. 'HALF_LETTER': (5.5, 8),
  4190. 'GOV_LETTER': (8, 10.5),
  4191. 'GOV_LEGAL': (8.5, 13),
  4192. 'LEDGER': (17, 11),
  4193. }
  4194. )
  4195. page_size_list = list(self.pagesize.keys())
  4196. self.pagesize_combo.addItems(page_size_list)
  4197. grid0.addWidget(self.pagesize_label, 17, 0)
  4198. grid0.addWidget(self.pagesize_combo, 17, 1)
  4199. self.layout.addStretch()
  4200. class ToolsPanelizePrefGroupUI(OptionsGroupUI):
  4201. def __init__(self, decimals=4, parent=None):
  4202. # OptionsGroupUI.__init__(self, "Cutout Tool Options", parent=parent)
  4203. super(ToolsPanelizePrefGroupUI, self).__init__(self)
  4204. self.setTitle(str(_("Panelize Tool Options")))
  4205. self.decimals = decimals
  4206. # ## Board cuttout
  4207. self.panelize_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  4208. self.panelize_label.setToolTip(
  4209. _("Create an object that contains an array of (x, y) elements,\n"
  4210. "each element is a copy of the source object spaced\n"
  4211. "at a X distance, Y distance of each other.")
  4212. )
  4213. self.layout.addWidget(self.panelize_label)
  4214. grid0 = QtWidgets.QGridLayout()
  4215. self.layout.addLayout(grid0)
  4216. grid0.setColumnStretch(0, 0)
  4217. grid0.setColumnStretch(1, 1)
  4218. # ## Spacing Columns
  4219. self.pspacing_columns = FCDoubleSpinner()
  4220. self.pspacing_columns.set_range(0.000001, 9999.9999)
  4221. self.pspacing_columns.set_precision(self.decimals)
  4222. self.pspacing_columns.setSingleStep(0.1)
  4223. self.spacing_columns_label = QtWidgets.QLabel('%s:' % _("Spacing cols"))
  4224. self.spacing_columns_label.setToolTip(
  4225. _("Spacing between columns of the desired panel.\n"
  4226. "In current units.")
  4227. )
  4228. grid0.addWidget(self.spacing_columns_label, 0, 0)
  4229. grid0.addWidget(self.pspacing_columns, 0, 1)
  4230. # ## Spacing Rows
  4231. self.pspacing_rows = FCDoubleSpinner()
  4232. self.pspacing_rows.set_range(0.000001, 9999.9999)
  4233. self.pspacing_rows.set_precision(self.decimals)
  4234. self.pspacing_rows.setSingleStep(0.1)
  4235. self.spacing_rows_label = QtWidgets.QLabel('%s:' % _("Spacing rows"))
  4236. self.spacing_rows_label.setToolTip(
  4237. _("Spacing between rows of the desired panel.\n"
  4238. "In current units.")
  4239. )
  4240. grid0.addWidget(self.spacing_rows_label, 1, 0)
  4241. grid0.addWidget(self.pspacing_rows, 1, 1)
  4242. # ## Columns
  4243. self.pcolumns = FCSpinner()
  4244. self.pcolumns.set_range(1, 1000)
  4245. self.pcolumns.setSingleStep(1)
  4246. self.columns_label = QtWidgets.QLabel('%s:' % _("Columns"))
  4247. self.columns_label.setToolTip(
  4248. _("Number of columns of the desired panel")
  4249. )
  4250. grid0.addWidget(self.columns_label, 2, 0)
  4251. grid0.addWidget(self.pcolumns, 2, 1)
  4252. # ## Rows
  4253. self.prows = FCSpinner()
  4254. self.prows.set_range(1, 1000)
  4255. self.prows.setSingleStep(1)
  4256. self.rows_label = QtWidgets.QLabel('%s:' % _("Rows"))
  4257. self.rows_label.setToolTip(
  4258. _("Number of rows of the desired panel")
  4259. )
  4260. grid0.addWidget(self.rows_label, 3, 0)
  4261. grid0.addWidget(self.prows, 3, 1)
  4262. # ## Type of resulting Panel object
  4263. self.panel_type_radio = RadioSet([{'label': _('Gerber'), 'value': 'gerber'},
  4264. {'label': _('Geo'), 'value': 'geometry'}])
  4265. self.panel_type_label = QtWidgets.QLabel('%s:' % _("Panel Type"))
  4266. self.panel_type_label.setToolTip(
  4267. _("Choose the type of object for the panel object:\n"
  4268. "- Gerber\n"
  4269. "- Geometry")
  4270. )
  4271. grid0.addWidget(self.panel_type_label, 4, 0)
  4272. grid0.addWidget(self.panel_type_radio, 4, 1)
  4273. # ## Constrains
  4274. self.pconstrain_cb = FCCheckBox('%s:' % _("Constrain within"))
  4275. self.pconstrain_cb.setToolTip(
  4276. _("Area define by DX and DY within to constrain the panel.\n"
  4277. "DX and DY values are in current units.\n"
  4278. "Regardless of how many columns and rows are desired,\n"
  4279. "the final panel will have as many columns and rows as\n"
  4280. "they fit completely within selected area.")
  4281. )
  4282. grid0.addWidget(self.pconstrain_cb, 5, 0)
  4283. self.px_width_entry = FCDoubleSpinner()
  4284. self.px_width_entry.set_range(0.000001, 9999.9999)
  4285. self.px_width_entry.set_precision(self.decimals)
  4286. self.px_width_entry.setSingleStep(0.1)
  4287. self.x_width_lbl = QtWidgets.QLabel('%s:' % _("Width (DX)"))
  4288. self.x_width_lbl.setToolTip(
  4289. _("The width (DX) within which the panel must fit.\n"
  4290. "In current units.")
  4291. )
  4292. grid0.addWidget(self.x_width_lbl, 6, 0)
  4293. grid0.addWidget(self.px_width_entry, 6, 1)
  4294. self.py_height_entry = FCDoubleSpinner()
  4295. self.py_height_entry.set_range(0.000001, 9999.9999)
  4296. self.py_height_entry.set_precision(self.decimals)
  4297. self.py_height_entry.setSingleStep(0.1)
  4298. self.y_height_lbl = QtWidgets.QLabel('%s:' % _("Height (DY)"))
  4299. self.y_height_lbl.setToolTip(
  4300. _("The height (DY)within which the panel must fit.\n"
  4301. "In current units.")
  4302. )
  4303. grid0.addWidget(self.y_height_lbl, 7, 0)
  4304. grid0.addWidget(self.py_height_entry, 7, 1)
  4305. self.layout.addStretch()
  4306. class ToolsCalculatorsPrefGroupUI(OptionsGroupUI):
  4307. def __init__(self, decimals=4, parent=None):
  4308. # OptionsGroupUI.__init__(self, "Calculators Tool Options", parent=parent)
  4309. super(ToolsCalculatorsPrefGroupUI, self).__init__(self)
  4310. self.setTitle(str(_("Calculators Tool Options")))
  4311. self.decimals = decimals
  4312. # ## V-shape Calculator Tool
  4313. self.vshape_tool_label = QtWidgets.QLabel("<b>%s:</b>" % _("V-Shape Tool Calculator"))
  4314. self.vshape_tool_label.setToolTip(
  4315. _("Calculate the tool diameter for a given V-shape tool,\n"
  4316. "having the tip diameter, tip angle and\n"
  4317. "depth-of-cut as parameters.")
  4318. )
  4319. self.layout.addWidget(self.vshape_tool_label)
  4320. grid0 = QtWidgets.QGridLayout()
  4321. self.layout.addLayout(grid0)
  4322. # ## Tip Diameter
  4323. self.tip_dia_entry = FCDoubleSpinner()
  4324. self.tip_dia_entry.set_range(0.000001, 9999.9999)
  4325. self.tip_dia_entry.set_precision(self.decimals)
  4326. self.tip_dia_entry.setSingleStep(0.1)
  4327. self.tip_dia_label = QtWidgets.QLabel('%s:' % _("Tip Diameter"))
  4328. self.tip_dia_label.setToolTip(
  4329. _("This is the tool tip diameter.\n"
  4330. "It is specified by manufacturer.")
  4331. )
  4332. grid0.addWidget(self.tip_dia_label, 0, 0)
  4333. grid0.addWidget(self.tip_dia_entry, 0, 1)
  4334. # ## Tip angle
  4335. self.tip_angle_entry = FCDoubleSpinner()
  4336. self.tip_angle_entry.set_range(0.0, 180.0)
  4337. self.tip_angle_entry.set_precision(self.decimals)
  4338. self.tip_angle_entry.setSingleStep(5)
  4339. self.tip_angle_label = QtWidgets.QLabel('%s:' % _("Tip Angle"))
  4340. self.tip_angle_label.setToolTip(
  4341. _("This is the angle on the tip of the tool.\n"
  4342. "It is specified by manufacturer.")
  4343. )
  4344. grid0.addWidget(self.tip_angle_label, 1, 0)
  4345. grid0.addWidget(self.tip_angle_entry, 1, 1)
  4346. # ## Depth-of-cut Cut Z
  4347. self.cut_z_entry = FCDoubleSpinner()
  4348. self.cut_z_entry.set_range(-9999.9999, 0.0000)
  4349. self.cut_z_entry.set_precision(self.decimals)
  4350. self.cut_z_entry.setSingleStep(0.01)
  4351. self.cut_z_label = QtWidgets.QLabel('%s:' % _("Cut Z"))
  4352. self.cut_z_label.setToolTip(
  4353. _("This is depth to cut into material.\n"
  4354. "In the CNCJob object it is the CutZ parameter.")
  4355. )
  4356. grid0.addWidget(self.cut_z_label, 2, 0)
  4357. grid0.addWidget(self.cut_z_entry, 2, 1)
  4358. # ## Electroplating Calculator Tool
  4359. self.plate_title_label = QtWidgets.QLabel("<b>%s:</b>" % _("ElectroPlating Calculator"))
  4360. self.plate_title_label.setToolTip(
  4361. _("This calculator is useful for those who plate the via/pad/drill holes,\n"
  4362. "using a method like grahite ink or calcium hypophosphite ink or palladium chloride.")
  4363. )
  4364. self.layout.addWidget(self.plate_title_label)
  4365. grid1 = QtWidgets.QGridLayout()
  4366. self.layout.addLayout(grid1)
  4367. # ## PCB Length
  4368. self.pcblength_entry = FCDoubleSpinner()
  4369. self.pcblength_entry.set_range(0.000001, 9999.9999)
  4370. self.pcblength_entry.set_precision(self.decimals)
  4371. self.pcblength_entry.setSingleStep(0.1)
  4372. self.pcblengthlabel = QtWidgets.QLabel('%s:' % _("Board Length"))
  4373. self.pcblengthlabel.setToolTip(_('This is the board length. In centimeters.'))
  4374. grid1.addWidget(self.pcblengthlabel, 0, 0)
  4375. grid1.addWidget(self.pcblength_entry, 0, 1)
  4376. # ## PCB Width
  4377. self.pcbwidth_entry = FCDoubleSpinner()
  4378. self.pcbwidth_entry.set_range(0.000001, 9999.9999)
  4379. self.pcbwidth_entry.set_precision(self.decimals)
  4380. self.pcbwidth_entry.setSingleStep(0.1)
  4381. self.pcbwidthlabel = QtWidgets.QLabel('%s:' % _("Board Width"))
  4382. self.pcbwidthlabel.setToolTip(_('This is the board width.In centimeters.'))
  4383. grid1.addWidget(self.pcbwidthlabel, 1, 0)
  4384. grid1.addWidget(self.pcbwidth_entry, 1, 1)
  4385. # ## Current Density
  4386. self.cdensity_label = QtWidgets.QLabel('%s:' % _("Current Density"))
  4387. self.cdensity_entry = FCDoubleSpinner()
  4388. self.cdensity_entry.set_range(0.000001, 9999.9999)
  4389. self.cdensity_entry.set_precision(self.decimals)
  4390. self.cdensity_entry.setSingleStep(0.1)
  4391. self.cdensity_label.setToolTip(_("Current density to pass through the board. \n"
  4392. "In Amps per Square Feet ASF."))
  4393. grid1.addWidget(self.cdensity_label, 2, 0)
  4394. grid1.addWidget(self.cdensity_entry, 2, 1)
  4395. # ## PCB Copper Growth
  4396. self.growth_label = QtWidgets.QLabel('%s:' % _("Copper Growth"))
  4397. self.growth_entry = FCDoubleSpinner()
  4398. self.growth_entry.set_range(0.000001, 9999.9999)
  4399. self.growth_entry.set_precision(self.decimals)
  4400. self.growth_entry.setSingleStep(0.01)
  4401. self.growth_label.setToolTip(_("How thick the copper growth is intended to be.\n"
  4402. "In microns."))
  4403. grid1.addWidget(self.growth_label, 3, 0)
  4404. grid1.addWidget(self.growth_entry, 3, 1)
  4405. self.layout.addStretch()
  4406. class ToolsTransformPrefGroupUI(OptionsGroupUI):
  4407. def __init__(self, decimals=4, parent=None):
  4408. super(ToolsTransformPrefGroupUI, self).__init__(self)
  4409. self.setTitle(str(_("Transform Tool Options")))
  4410. self.decimals = decimals
  4411. # ## Transformations
  4412. self.transform_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  4413. self.transform_label.setToolTip(
  4414. _("Various transformations that can be applied\n"
  4415. "on a FlatCAM object.")
  4416. )
  4417. self.layout.addWidget(self.transform_label)
  4418. grid0 = QtWidgets.QGridLayout()
  4419. self.layout.addLayout(grid0)
  4420. grid0.setColumnStretch(0, 0)
  4421. grid0.setColumnStretch(1, 1)
  4422. # ## Rotate Angle
  4423. rotate_title_lbl = QtWidgets.QLabel('<b>%s</b>' % _("Rotate"))
  4424. grid0.addWidget(rotate_title_lbl, 0, 0, 1, 2)
  4425. self.rotate_entry = FCDoubleSpinner()
  4426. self.rotate_entry.set_range(-360.0, 360.0)
  4427. self.rotate_entry.set_precision(self.decimals)
  4428. self.rotate_entry.setSingleStep(15)
  4429. self.rotate_label = QtWidgets.QLabel('%s:' % _("Angle"))
  4430. self.rotate_label.setToolTip(
  4431. _("Angle for Rotation action, in degrees.\n"
  4432. "Float number between -360 and 359.\n"
  4433. "Positive numbers for CW motion.\n"
  4434. "Negative numbers for CCW motion.")
  4435. )
  4436. grid0.addWidget(self.rotate_label, 1, 0)
  4437. grid0.addWidget(self.rotate_entry, 1, 1)
  4438. # ## Skew/Shear Angle on X axis
  4439. skew_title_lbl = QtWidgets.QLabel('<b>%s</b>' % _("Skew"))
  4440. grid0.addWidget(skew_title_lbl, 2, 0, 1, 2)
  4441. self.skewx_entry = FCDoubleSpinner()
  4442. self.skewx_entry.set_range(-360.0, 360.0)
  4443. self.skewx_entry.set_precision(self.decimals)
  4444. self.skewx_entry.setSingleStep(0.1)
  4445. self.skewx_label = QtWidgets.QLabel('%s:' % _("X angle"))
  4446. self.skewx_label.setToolTip(
  4447. _("Angle for Skew action, in degrees.\n"
  4448. "Float number between -360 and 359.")
  4449. )
  4450. grid0.addWidget(self.skewx_label, 3, 0)
  4451. grid0.addWidget(self.skewx_entry, 3, 1)
  4452. # ## Skew/Shear Angle on Y axis
  4453. self.skewy_entry = FCDoubleSpinner()
  4454. self.skewy_entry.set_range(-360.0, 360.0)
  4455. self.skewy_entry.set_precision(self.decimals)
  4456. self.skewy_entry.setSingleStep(0.1)
  4457. self.skewy_label = QtWidgets.QLabel('%s:' % _("Y angle"))
  4458. self.skewy_label.setToolTip(
  4459. _("Angle for Skew action, in degrees.\n"
  4460. "Float number between -360 and 359.")
  4461. )
  4462. grid0.addWidget(self.skewy_label, 4, 0)
  4463. grid0.addWidget(self.skewy_entry, 4, 1)
  4464. # ## Scale
  4465. scale_title_lbl = QtWidgets.QLabel('<b>%s</b>' % _("Scale"))
  4466. grid0.addWidget(scale_title_lbl, 5, 0, 1, 2)
  4467. self.scalex_entry = FCDoubleSpinner()
  4468. self.scalex_entry.set_range(0, 9999.9999)
  4469. self.scalex_entry.set_precision(self.decimals)
  4470. self.scalex_entry.setSingleStep(0.1)
  4471. self.scalex_label = QtWidgets.QLabel('%s:' % _("X factor"))
  4472. self.scalex_label.setToolTip(
  4473. _("Factor for scaling on X axis.")
  4474. )
  4475. grid0.addWidget(self.scalex_label, 6, 0)
  4476. grid0.addWidget(self.scalex_entry, 6, 1)
  4477. # ## Scale factor on X axis
  4478. self.scaley_entry = FCDoubleSpinner()
  4479. self.scaley_entry.set_range(0, 9999.9999)
  4480. self.scaley_entry.set_precision(self.decimals)
  4481. self.scaley_entry.setSingleStep(0.1)
  4482. self.scaley_label = QtWidgets.QLabel('%s:' % _("Y factor"))
  4483. self.scaley_label.setToolTip(
  4484. _("Factor for scaling on Y axis.")
  4485. )
  4486. grid0.addWidget(self.scaley_label, 7, 0)
  4487. grid0.addWidget(self.scaley_entry, 7, 1)
  4488. # ## Link Scale factors
  4489. self.link_cb = FCCheckBox(_("Link"))
  4490. self.link_cb.setToolTip(
  4491. _("Scale the selected object(s)\n"
  4492. "using the Scale_X factor for both axis.")
  4493. )
  4494. grid0.addWidget(self.link_cb, 8, 0)
  4495. # ## Scale Reference
  4496. self.reference_cb = FCCheckBox('%s' % _("Scale Reference"))
  4497. self.reference_cb.setToolTip(
  4498. _("Scale the selected object(s)\n"
  4499. "using the origin reference when checked,\n"
  4500. "and the center of the biggest bounding box\n"
  4501. "of the selected objects when unchecked.")
  4502. )
  4503. grid0.addWidget(self.reference_cb, 8, 1)
  4504. # ## Offset
  4505. offset_title_lbl = QtWidgets.QLabel('<b>%s</b>' % _("Offset"))
  4506. grid0.addWidget(offset_title_lbl, 9, 0, 1, 2)
  4507. self.offx_entry = FCDoubleSpinner()
  4508. self.offx_entry.set_range(-9999.9999, 9999.9999)
  4509. self.offx_entry.set_precision(self.decimals)
  4510. self.offx_entry.setSingleStep(0.1)
  4511. self.offx_label = QtWidgets.QLabel('%s:' % _("X val"))
  4512. self.offx_label.setToolTip(
  4513. _("Distance to offset on X axis. In current units.")
  4514. )
  4515. grid0.addWidget(self.offx_label, 10, 0)
  4516. grid0.addWidget(self.offx_entry, 10, 1)
  4517. # ## Offset distance on Y axis
  4518. self.offy_entry = FCDoubleSpinner()
  4519. self.offy_entry.set_range(-9999.9999, 9999.9999)
  4520. self.offy_entry.set_precision(self.decimals)
  4521. self.offy_entry.setSingleStep(0.1)
  4522. self.offy_label = QtWidgets.QLabel('%s:' % _("Y val"))
  4523. self.offy_label.setToolTip(
  4524. _("Distance to offset on Y axis. In current units.")
  4525. )
  4526. grid0.addWidget(self.offy_label, 11, 0)
  4527. grid0.addWidget(self.offy_entry, 11, 1)
  4528. # ## Mirror
  4529. mirror_title_lbl = QtWidgets.QLabel('<b>%s</b>' % _("Mirror"))
  4530. grid0.addWidget(mirror_title_lbl, 12, 0, 1, 2)
  4531. # ## Mirror (Flip) Reference Point
  4532. self.mirror_reference_cb = FCCheckBox('%s' % _("Mirror Reference"))
  4533. self.mirror_reference_cb.setToolTip(
  4534. _("Flip the selected object(s)\n"
  4535. "around the point in Point Entry Field.\n"
  4536. "\n"
  4537. "The point coordinates can be captured by\n"
  4538. "left click on canvas together with pressing\n"
  4539. "SHIFT key. \n"
  4540. "Then click Add button to insert coordinates.\n"
  4541. "Or enter the coords in format (x, y) in the\n"
  4542. "Point Entry field and click Flip on X(Y)"))
  4543. grid0.addWidget(self.mirror_reference_cb, 13, 0, 1, 2)
  4544. self.flip_ref_label = QtWidgets.QLabel('%s' % _("Mirror Reference point"))
  4545. self.flip_ref_label.setToolTip(
  4546. _("Coordinates in format (x, y) used as reference for mirroring.\n"
  4547. "The 'x' in (x, y) will be used when using Flip on X and\n"
  4548. "the 'y' in (x, y) will be used when using Flip on Y and")
  4549. )
  4550. self.flip_ref_entry = EvalEntry2("(0, 0)")
  4551. grid0.addWidget(self.flip_ref_label, 14, 0, 1, 2)
  4552. grid0.addWidget(self.flip_ref_entry, 15, 0, 1, 2)
  4553. # ## Buffer
  4554. buffer_title_lbl = QtWidgets.QLabel('<b>%s</b>' % _("Buffer"))
  4555. grid0.addWidget(buffer_title_lbl, 16, 0, 1, 2)
  4556. self.buffer_label = QtWidgets.QLabel('%s:' % _("Distance"))
  4557. self.buffer_label.setToolTip(
  4558. _("A positive value will create the effect of dilation,\n"
  4559. "while a negative value will create the effect of erosion.\n"
  4560. "Each geometry element of the object will be increased\n"
  4561. "or decreased with the 'distance'.")
  4562. )
  4563. self.buffer_entry = FCDoubleSpinner()
  4564. self.buffer_entry.set_precision(self.decimals)
  4565. self.buffer_entry.setSingleStep(0.1)
  4566. self.buffer_entry.setWrapping(True)
  4567. self.buffer_entry.set_range(-9999.9999, 9999.9999)
  4568. grid0.addWidget(self.buffer_label, 17, 0)
  4569. grid0.addWidget(self.buffer_entry, 17, 1)
  4570. self.buffer_rounded_cb = FCCheckBox()
  4571. self.buffer_rounded_cb.setText('%s' % _("Rounded"))
  4572. self.buffer_rounded_cb.setToolTip(
  4573. _("If checked then the buffer will surround the buffered shape,\n"
  4574. "every corner will be rounded.\n"
  4575. "If not checked then the buffer will follow the exact geometry\n"
  4576. "of the buffered shape.")
  4577. )
  4578. grid0.addWidget(self.buffer_rounded_cb, 18, 0, 1, 2)
  4579. grid0.addWidget(QtWidgets.QLabel(''), 19, 0, 1, 2)
  4580. self.layout.addStretch()
  4581. class ToolsSolderpastePrefGroupUI(OptionsGroupUI):
  4582. def __init__(self, decimals=4, parent=None):
  4583. super(ToolsSolderpastePrefGroupUI, self).__init__(self)
  4584. self.setTitle(str(_("SolderPaste Tool Options")))
  4585. self.decimals = decimals
  4586. # ## Solder Paste Dispensing
  4587. self.solderpastelabel = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  4588. self.solderpastelabel.setToolTip(
  4589. _("A tool to create GCode for dispensing\n"
  4590. "solder paste onto a PCB.")
  4591. )
  4592. self.layout.addWidget(self.solderpastelabel)
  4593. grid0 = QtWidgets.QGridLayout()
  4594. self.layout.addLayout(grid0)
  4595. # Nozzle Tool Diameters
  4596. nozzletdlabel = QtWidgets.QLabel('%s:' % _('Tools dia'))
  4597. nozzletdlabel.setToolTip(
  4598. _("Diameters of nozzle tools, separated by ','")
  4599. )
  4600. self.nozzle_tool_dia_entry = FCEntry()
  4601. grid0.addWidget(nozzletdlabel, 0, 0)
  4602. grid0.addWidget(self.nozzle_tool_dia_entry, 0, 1)
  4603. # New Nozzle Tool Dia
  4604. self.addtool_entry_lbl = QtWidgets.QLabel('<b>%s:</b>' % _('New Nozzle Dia'))
  4605. self.addtool_entry_lbl.setToolTip(
  4606. _("Diameter for the new Nozzle tool to add in the Tool Table")
  4607. )
  4608. self.addtool_entry = FCDoubleSpinner()
  4609. self.addtool_entry.set_precision(self.decimals)
  4610. self.addtool_entry.set_range(0.0000001, 9999.9999)
  4611. self.addtool_entry.setSingleStep(0.1)
  4612. grid0.addWidget(self.addtool_entry_lbl, 1, 0)
  4613. grid0.addWidget(self.addtool_entry, 1, 1)
  4614. # Z dispense start
  4615. self.z_start_entry = FCDoubleSpinner()
  4616. self.z_start_entry.set_precision(self.decimals)
  4617. self.z_start_entry.set_range(0.0000001, 9999.9999)
  4618. self.z_start_entry.setSingleStep(0.1)
  4619. self.z_start_label = QtWidgets.QLabel('%s:' % _("Z Dispense Start"))
  4620. self.z_start_label.setToolTip(
  4621. _("The height (Z) when solder paste dispensing starts.")
  4622. )
  4623. grid0.addWidget(self.z_start_label, 2, 0)
  4624. grid0.addWidget(self.z_start_entry, 2, 1)
  4625. # Z dispense
  4626. self.z_dispense_entry = FCDoubleSpinner()
  4627. self.z_dispense_entry.set_precision(self.decimals)
  4628. self.z_dispense_entry.set_range(0.0000001, 9999.9999)
  4629. self.z_dispense_entry.setSingleStep(0.1)
  4630. self.z_dispense_label = QtWidgets.QLabel('%s:' % _("Z Dispense"))
  4631. self.z_dispense_label.setToolTip(
  4632. _("The height (Z) when doing solder paste dispensing.")
  4633. )
  4634. grid0.addWidget(self.z_dispense_label, 3, 0)
  4635. grid0.addWidget(self.z_dispense_entry, 3, 1)
  4636. # Z dispense stop
  4637. self.z_stop_entry = FCDoubleSpinner()
  4638. self.z_stop_entry.set_precision(self.decimals)
  4639. self.z_stop_entry.set_range(0.0000001, 9999.9999)
  4640. self.z_stop_entry.setSingleStep(0.1)
  4641. self.z_stop_label = QtWidgets.QLabel('%s:' % _("Z Dispense Stop"))
  4642. self.z_stop_label.setToolTip(
  4643. _("The height (Z) when solder paste dispensing stops.")
  4644. )
  4645. grid0.addWidget(self.z_stop_label, 4, 0)
  4646. grid0.addWidget(self.z_stop_entry, 4, 1)
  4647. # Z travel
  4648. self.z_travel_entry = FCDoubleSpinner()
  4649. self.z_travel_entry.set_precision(self.decimals)
  4650. self.z_travel_entry.set_range(0.0000001, 9999.9999)
  4651. self.z_travel_entry.setSingleStep(0.1)
  4652. self.z_travel_label = QtWidgets.QLabel('%s:' % _("Z Travel"))
  4653. self.z_travel_label.setToolTip(
  4654. _("The height (Z) for travel between pads\n"
  4655. "(without dispensing solder paste).")
  4656. )
  4657. grid0.addWidget(self.z_travel_label, 5, 0)
  4658. grid0.addWidget(self.z_travel_entry, 5, 1)
  4659. # Z toolchange location
  4660. self.z_toolchange_entry = FCDoubleSpinner()
  4661. self.z_toolchange_entry.set_precision(self.decimals)
  4662. self.z_toolchange_entry.set_range(0.0000001, 9999.9999)
  4663. self.z_toolchange_entry.setSingleStep(0.1)
  4664. self.z_toolchange_label = QtWidgets.QLabel('%s:' % _("Z Toolchange"))
  4665. self.z_toolchange_label.setToolTip(
  4666. _("The height (Z) for tool (nozzle) change.")
  4667. )
  4668. grid0.addWidget(self.z_toolchange_label, 6, 0)
  4669. grid0.addWidget(self.z_toolchange_entry, 6, 1)
  4670. # X,Y Toolchange location
  4671. self.xy_toolchange_entry = FCEntry()
  4672. self.xy_toolchange_label = QtWidgets.QLabel('%s:' % _("Toolchange X-Y"))
  4673. self.xy_toolchange_label.setToolTip(
  4674. _("The X,Y location for tool (nozzle) change.\n"
  4675. "The format is (x, y) where x and y are real numbers.")
  4676. )
  4677. grid0.addWidget(self.xy_toolchange_label, 7, 0)
  4678. grid0.addWidget(self.xy_toolchange_entry, 7, 1)
  4679. # Feedrate X-Y
  4680. self.frxy_entry = FCDoubleSpinner()
  4681. self.frxy_entry.set_precision(self.decimals)
  4682. self.frxy_entry.set_range(0.0000001, 9999.9999)
  4683. self.frxy_entry.setSingleStep(0.1)
  4684. self.frxy_label = QtWidgets.QLabel('%s:' % _("Feedrate X-Y"))
  4685. self.frxy_label.setToolTip(
  4686. _("Feedrate (speed) while moving on the X-Y plane.")
  4687. )
  4688. grid0.addWidget(self.frxy_label, 8, 0)
  4689. grid0.addWidget(self.frxy_entry, 8, 1)
  4690. # Feedrate Z
  4691. self.frz_entry = FCDoubleSpinner()
  4692. self.frz_entry.set_precision(self.decimals)
  4693. self.frz_entry.set_range(0.0000001, 9999.9999)
  4694. self.frz_entry.setSingleStep(0.1)
  4695. self.frz_label = QtWidgets.QLabel('%s:' % _("Feedrate Z"))
  4696. self.frz_label.setToolTip(
  4697. _("Feedrate (speed) while moving vertically\n"
  4698. "(on Z plane).")
  4699. )
  4700. grid0.addWidget(self.frz_label, 9, 0)
  4701. grid0.addWidget(self.frz_entry, 9, 1)
  4702. # Feedrate Z Dispense
  4703. self.frz_dispense_entry = FCDoubleSpinner()
  4704. self.frz_dispense_entry.set_precision(self.decimals)
  4705. self.frz_dispense_entry.set_range(0.0000001, 9999.9999)
  4706. self.frz_dispense_entry.setSingleStep(0.1)
  4707. self.frz_dispense_label = QtWidgets.QLabel('%s:' % _("Feedrate Z Dispense"))
  4708. self.frz_dispense_label.setToolTip(
  4709. _("Feedrate (speed) while moving up vertically\n"
  4710. "to Dispense position (on Z plane).")
  4711. )
  4712. grid0.addWidget(self.frz_dispense_label, 10, 0)
  4713. grid0.addWidget(self.frz_dispense_entry, 10, 1)
  4714. # Spindle Speed Forward
  4715. self.speedfwd_entry = FCSpinner()
  4716. self.speedfwd_entry.set_range(0, 999999)
  4717. self.speedfwd_entry.setSingleStep(1000)
  4718. self.speedfwd_label = QtWidgets.QLabel('%s:' % _("Spindle Speed FWD"))
  4719. self.speedfwd_label.setToolTip(
  4720. _("The dispenser speed while pushing solder paste\n"
  4721. "through the dispenser nozzle.")
  4722. )
  4723. grid0.addWidget(self.speedfwd_label, 11, 0)
  4724. grid0.addWidget(self.speedfwd_entry, 11, 1)
  4725. # Dwell Forward
  4726. self.dwellfwd_entry = FCDoubleSpinner()
  4727. self.dwellfwd_entry.set_precision(self.decimals)
  4728. self.dwellfwd_entry.set_range(0.0000001, 9999.9999)
  4729. self.dwellfwd_entry.setSingleStep(0.1)
  4730. self.dwellfwd_label = QtWidgets.QLabel('%s:' % _("Dwell FWD"))
  4731. self.dwellfwd_label.setToolTip(
  4732. _("Pause after solder dispensing.")
  4733. )
  4734. grid0.addWidget(self.dwellfwd_label, 12, 0)
  4735. grid0.addWidget(self.dwellfwd_entry, 12, 1)
  4736. # Spindle Speed Reverse
  4737. self.speedrev_entry = FCSpinner()
  4738. self.speedrev_entry.set_range(0, 999999)
  4739. self.speedrev_entry.setSingleStep(1000)
  4740. self.speedrev_label = QtWidgets.QLabel('%s:' % _("Spindle Speed REV"))
  4741. self.speedrev_label.setToolTip(
  4742. _("The dispenser speed while retracting solder paste\n"
  4743. "through the dispenser nozzle.")
  4744. )
  4745. grid0.addWidget(self.speedrev_label, 13, 0)
  4746. grid0.addWidget(self.speedrev_entry, 13, 1)
  4747. # Dwell Reverse
  4748. self.dwellrev_entry = FCDoubleSpinner()
  4749. self.dwellrev_entry.set_precision(self.decimals)
  4750. self.dwellrev_entry.set_range(0.0000001, 9999.9999)
  4751. self.dwellrev_entry.setSingleStep(0.1)
  4752. self.dwellrev_label = QtWidgets.QLabel('%s:' % _("Dwell REV"))
  4753. self.dwellrev_label.setToolTip(
  4754. _("Pause after solder paste dispenser retracted,\n"
  4755. "to allow pressure equilibrium.")
  4756. )
  4757. grid0.addWidget(self.dwellrev_label, 14, 0)
  4758. grid0.addWidget(self.dwellrev_entry, 14, 1)
  4759. # Preprocessors
  4760. pp_label = QtWidgets.QLabel('%s:' % _('PostProcessor'))
  4761. pp_label.setToolTip(
  4762. _("Files that control the GCode generation.")
  4763. )
  4764. self.pp_combo = FCComboBox()
  4765. grid0.addWidget(pp_label, 15, 0)
  4766. grid0.addWidget(self.pp_combo, 15, 1)
  4767. self.layout.addStretch()
  4768. class ToolsSubPrefGroupUI(OptionsGroupUI):
  4769. def __init__(self, decimals=4, parent=None):
  4770. super(ToolsSubPrefGroupUI, self).__init__(self)
  4771. self.setTitle(str(_("Substractor Tool Options")))
  4772. self.decimals = decimals
  4773. # ## Subtractor Tool Parameters
  4774. self.sublabel = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  4775. self.sublabel.setToolTip(
  4776. _("A tool to substract one Gerber or Geometry object\n"
  4777. "from another of the same type.")
  4778. )
  4779. self.layout.addWidget(self.sublabel)
  4780. self.close_paths_cb = FCCheckBox(_("Close paths"))
  4781. self.close_paths_cb.setToolTip(_("Checking this will close the paths cut by the Geometry substractor object."))
  4782. self.layout.addWidget(self.close_paths_cb)
  4783. self.layout.addStretch()
  4784. class Tools2RulesCheckPrefGroupUI(OptionsGroupUI):
  4785. def __init__(self, decimals=4, parent=None):
  4786. super(Tools2RulesCheckPrefGroupUI, self).__init__(self)
  4787. self.setTitle(str(_("Check Rules Tool Options")))
  4788. self.decimals = decimals
  4789. self.crlabel = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  4790. self.crlabel.setToolTip(
  4791. _("A tool to check if Gerber files are within a set\n"
  4792. "of Manufacturing Rules.")
  4793. )
  4794. self.layout.addWidget(self.crlabel)
  4795. # Form Layout
  4796. self.form_layout_1 = QtWidgets.QFormLayout()
  4797. self.layout.addLayout(self.form_layout_1)
  4798. # Trace size
  4799. self.trace_size_cb = FCCheckBox('%s:' % _("Trace Size"))
  4800. self.trace_size_cb.setToolTip(
  4801. _("This checks if the minimum size for traces is met.")
  4802. )
  4803. self.form_layout_1.addRow(self.trace_size_cb)
  4804. # Trace size value
  4805. self.trace_size_entry = FCDoubleSpinner()
  4806. self.trace_size_entry.set_range(0.00001, 999.99999)
  4807. self.trace_size_entry.set_precision(self.decimals)
  4808. self.trace_size_entry.setSingleStep(0.1)
  4809. self.trace_size_lbl = QtWidgets.QLabel('%s:' % _("Min value"))
  4810. self.trace_size_lbl.setToolTip(
  4811. _("Minimum acceptable trace size.")
  4812. )
  4813. self.form_layout_1.addRow(self.trace_size_lbl, self.trace_size_entry)
  4814. # Copper2copper clearance
  4815. self.clearance_copper2copper_cb = FCCheckBox('%s:' % _("Copper to Copper clearance"))
  4816. self.clearance_copper2copper_cb.setToolTip(
  4817. _("This checks if the minimum clearance between copper\n"
  4818. "features is met.")
  4819. )
  4820. self.form_layout_1.addRow(self.clearance_copper2copper_cb)
  4821. # Copper2copper clearance value
  4822. self.clearance_copper2copper_entry = FCDoubleSpinner()
  4823. self.clearance_copper2copper_entry.set_range(0.00001, 999.99999)
  4824. self.clearance_copper2copper_entry.set_precision(self.decimals)
  4825. self.clearance_copper2copper_entry.setSingleStep(0.1)
  4826. self.clearance_copper2copper_lbl = QtWidgets.QLabel('%s:' % _("Min value"))
  4827. self.clearance_copper2copper_lbl.setToolTip(
  4828. _("Minimum acceptable clearance value.")
  4829. )
  4830. self.form_layout_1.addRow(self.clearance_copper2copper_lbl, self.clearance_copper2copper_entry)
  4831. # Copper2outline clearance
  4832. self.clearance_copper2ol_cb = FCCheckBox('%s:' % _("Copper to Outline clearance"))
  4833. self.clearance_copper2ol_cb.setToolTip(
  4834. _("This checks if the minimum clearance between copper\n"
  4835. "features and the outline is met.")
  4836. )
  4837. self.form_layout_1.addRow(self.clearance_copper2ol_cb)
  4838. # Copper2outline clearance value
  4839. self.clearance_copper2ol_entry = FCDoubleSpinner()
  4840. self.clearance_copper2ol_entry.set_range(0.00001, 999.99999)
  4841. self.clearance_copper2ol_entry.set_precision(self.decimals)
  4842. self.clearance_copper2ol_entry.setSingleStep(0.1)
  4843. self.clearance_copper2ol_lbl = QtWidgets.QLabel('%s:' % _("Min value"))
  4844. self.clearance_copper2ol_lbl.setToolTip(
  4845. _("Minimum acceptable clearance value.")
  4846. )
  4847. self.form_layout_1.addRow(self.clearance_copper2ol_lbl, self.clearance_copper2ol_entry)
  4848. # Silkscreen2silkscreen clearance
  4849. self.clearance_silk2silk_cb = FCCheckBox('%s:' % _("Silk to Silk Clearance"))
  4850. self.clearance_silk2silk_cb.setToolTip(
  4851. _("This checks if the minimum clearance between silkscreen\n"
  4852. "features and silkscreen features is met.")
  4853. )
  4854. self.form_layout_1.addRow(self.clearance_silk2silk_cb)
  4855. # Copper2silkscreen clearance value
  4856. self.clearance_silk2silk_entry = FCDoubleSpinner()
  4857. self.clearance_silk2silk_entry.set_range(0.00001, 999.99999)
  4858. self.clearance_silk2silk_entry.set_precision(self.decimals)
  4859. self.clearance_silk2silk_entry.setSingleStep(0.1)
  4860. self.clearance_silk2silk_lbl = QtWidgets.QLabel('%s:' % _("Min value"))
  4861. self.clearance_silk2silk_lbl.setToolTip(
  4862. _("Minimum acceptable clearance value.")
  4863. )
  4864. self.form_layout_1.addRow(self.clearance_silk2silk_lbl, self.clearance_silk2silk_entry)
  4865. # Silkscreen2soldermask clearance
  4866. self.clearance_silk2sm_cb = FCCheckBox('%s:' % _("Silk to Solder Mask Clearance"))
  4867. self.clearance_silk2sm_cb.setToolTip(
  4868. _("This checks if the minimum clearance between silkscreen\n"
  4869. "features and soldermask features is met.")
  4870. )
  4871. self.form_layout_1.addRow(self.clearance_silk2sm_cb)
  4872. # Silkscreen2soldermask clearance value
  4873. self.clearance_silk2sm_entry = FCDoubleSpinner()
  4874. self.clearance_silk2sm_entry.set_range(0.00001, 999.99999)
  4875. self.clearance_silk2sm_entry.set_precision(self.decimals)
  4876. self.clearance_silk2sm_entry.setSingleStep(0.1)
  4877. self.clearance_silk2sm_lbl = QtWidgets.QLabel('%s:' % _("Min value"))
  4878. self.clearance_silk2sm_lbl.setToolTip(
  4879. _("Minimum acceptable clearance value.")
  4880. )
  4881. self.form_layout_1.addRow(self.clearance_silk2sm_lbl, self.clearance_silk2sm_entry)
  4882. # Silk2outline clearance
  4883. self.clearance_silk2ol_cb = FCCheckBox('%s:' % _("Silk to Outline Clearance"))
  4884. self.clearance_silk2ol_cb.setToolTip(
  4885. _("This checks if the minimum clearance between silk\n"
  4886. "features and the outline is met.")
  4887. )
  4888. self.form_layout_1.addRow(self.clearance_silk2ol_cb)
  4889. # Silk2outline clearance value
  4890. self.clearance_silk2ol_entry = FCDoubleSpinner()
  4891. self.clearance_silk2ol_entry.set_range(0.00001, 999.99999)
  4892. self.clearance_silk2ol_entry.set_precision(self.decimals)
  4893. self.clearance_silk2ol_entry.setSingleStep(0.1)
  4894. self.clearance_silk2ol_lbl = QtWidgets.QLabel('%s:' % _("Min value"))
  4895. self.clearance_silk2ol_lbl.setToolTip(
  4896. _("Minimum acceptable clearance value.")
  4897. )
  4898. self.form_layout_1.addRow(self.clearance_silk2ol_lbl, self.clearance_silk2ol_entry)
  4899. # Soldermask2soldermask clearance
  4900. self.clearance_sm2sm_cb = FCCheckBox('%s:' % _("Minimum Solder Mask Sliver"))
  4901. self.clearance_sm2sm_cb.setToolTip(
  4902. _("This checks if the minimum clearance between soldermask\n"
  4903. "features and soldermask features is met.")
  4904. )
  4905. self.form_layout_1.addRow(self.clearance_sm2sm_cb)
  4906. # Soldermask2soldermask clearance value
  4907. self.clearance_sm2sm_entry = FCDoubleSpinner()
  4908. self.clearance_sm2sm_entry.set_range(0.00001, 999.99999)
  4909. self.clearance_sm2sm_entry.set_precision(self.decimals)
  4910. self.clearance_sm2sm_entry.setSingleStep(0.1)
  4911. self.clearance_sm2sm_lbl = QtWidgets.QLabel('%s:' % _("Min value"))
  4912. self.clearance_sm2sm_lbl.setToolTip(
  4913. _("Minimum acceptable clearance value.")
  4914. )
  4915. self.form_layout_1.addRow(self.clearance_sm2sm_lbl, self.clearance_sm2sm_entry)
  4916. # Ring integrity check
  4917. self.ring_integrity_cb = FCCheckBox('%s:' % _("Minimum Annular Ring"))
  4918. self.ring_integrity_cb.setToolTip(
  4919. _("This checks if the minimum copper ring left by drilling\n"
  4920. "a hole into a pad is met.")
  4921. )
  4922. self.form_layout_1.addRow(self.ring_integrity_cb)
  4923. # Ring integrity value
  4924. self.ring_integrity_entry = FCDoubleSpinner()
  4925. self.ring_integrity_entry.set_range(0.00001, 999.99999)
  4926. self.ring_integrity_entry.set_precision(self.decimals)
  4927. self.ring_integrity_entry.setSingleStep(0.1)
  4928. self.ring_integrity_lbl = QtWidgets.QLabel('%s:' % _("Min value"))
  4929. self.ring_integrity_lbl.setToolTip(
  4930. _("Minimum acceptable ring value.")
  4931. )
  4932. self.form_layout_1.addRow(self.ring_integrity_lbl, self.ring_integrity_entry)
  4933. self.form_layout_1.addRow(QtWidgets.QLabel(""))
  4934. # Hole2Hole clearance
  4935. self.clearance_d2d_cb = FCCheckBox('%s:' % _("Hole to Hole Clearance"))
  4936. self.clearance_d2d_cb.setToolTip(
  4937. _("This checks if the minimum clearance between a drill hole\n"
  4938. "and another drill hole is met.")
  4939. )
  4940. self.form_layout_1.addRow(self.clearance_d2d_cb)
  4941. # Hole2Hole clearance value
  4942. self.clearance_d2d_entry = FCDoubleSpinner()
  4943. self.clearance_d2d_entry.set_range(0.00001, 999.99999)
  4944. self.clearance_d2d_entry.set_precision(self.decimals)
  4945. self.clearance_d2d_entry.setSingleStep(0.1)
  4946. self.clearance_d2d_lbl = QtWidgets.QLabel('%s:' % _("Min value"))
  4947. self.clearance_d2d_lbl.setToolTip(
  4948. _("Minimum acceptable drill size.")
  4949. )
  4950. self.form_layout_1.addRow(self.clearance_d2d_lbl, self.clearance_d2d_entry)
  4951. # Drill holes size check
  4952. self.drill_size_cb = FCCheckBox('%s:' % _("Hole Size"))
  4953. self.drill_size_cb.setToolTip(
  4954. _("This checks if the drill holes\n"
  4955. "sizes are above the threshold.")
  4956. )
  4957. self.form_layout_1.addRow(self.drill_size_cb)
  4958. # Drile holes value
  4959. self.drill_size_entry = FCDoubleSpinner()
  4960. self.drill_size_entry.set_range(0.00001, 999.99999)
  4961. self.drill_size_entry.set_precision(self.decimals)
  4962. self.drill_size_entry.setSingleStep(0.1)
  4963. self.drill_size_lbl = QtWidgets.QLabel('%s:' % _("Min value"))
  4964. self.drill_size_lbl.setToolTip(
  4965. _("Minimum acceptable clearance value.")
  4966. )
  4967. self.form_layout_1.addRow(self.drill_size_lbl, self.drill_size_entry)
  4968. self.layout.addStretch()
  4969. class Tools2OptimalPrefGroupUI(OptionsGroupUI):
  4970. def __init__(self, decimals=4, parent=None):
  4971. super(Tools2OptimalPrefGroupUI, self).__init__(self)
  4972. self.setTitle(str(_("Optimal Tool Options")))
  4973. self.decimals = decimals
  4974. # ## Parameters
  4975. self.optlabel = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  4976. self.optlabel.setToolTip(
  4977. _("A tool to find the minimum distance between\n"
  4978. "every two Gerber geometric elements")
  4979. )
  4980. self.layout.addWidget(self.optlabel)
  4981. grid0 = QtWidgets.QGridLayout()
  4982. self.layout.addLayout(grid0)
  4983. grid0.setColumnStretch(0, 0)
  4984. grid0.setColumnStretch(1, 1)
  4985. self.precision_sp = FCSpinner()
  4986. self.precision_sp.set_range(2, 10)
  4987. self.precision_sp.setSingleStep(1)
  4988. self.precision_sp.setWrapping(True)
  4989. self.precision_lbl = QtWidgets.QLabel('%s:' % _("Precision"))
  4990. self.precision_lbl.setToolTip(
  4991. _("Number of decimals for the distances and coordinates in this tool.")
  4992. )
  4993. grid0.addWidget(self.precision_lbl, 0, 0)
  4994. grid0.addWidget(self.precision_sp, 0, 1)
  4995. self.layout.addStretch()
  4996. class Tools2QRCodePrefGroupUI(OptionsGroupUI):
  4997. def __init__(self, decimals=4, parent=None):
  4998. super(Tools2QRCodePrefGroupUI, self).__init__(self)
  4999. self.setTitle(str(_("QRCode Tool Options")))
  5000. self.decimals = decimals
  5001. # ## Parameters
  5002. self.qrlabel = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  5003. self.qrlabel.setToolTip(
  5004. _("A tool to create a QRCode that can be inserted\n"
  5005. "into a selected Gerber file, or it can be exported as a file.")
  5006. )
  5007. self.layout.addWidget(self.qrlabel)
  5008. # ## Grid Layout
  5009. grid_lay = QtWidgets.QGridLayout()
  5010. self.layout.addLayout(grid_lay)
  5011. grid_lay.setColumnStretch(0, 0)
  5012. grid_lay.setColumnStretch(1, 1)
  5013. # VERSION #
  5014. self.version_label = QtWidgets.QLabel('%s:' % _("Version"))
  5015. self.version_label.setToolTip(
  5016. _("QRCode version can have values from 1 (21x21 boxes)\n"
  5017. "to 40 (177x177 boxes).")
  5018. )
  5019. self.version_entry = FCSpinner()
  5020. self.version_entry.set_range(1, 40)
  5021. self.version_entry.setWrapping(True)
  5022. grid_lay.addWidget(self.version_label, 1, 0)
  5023. grid_lay.addWidget(self.version_entry, 1, 1)
  5024. # ERROR CORRECTION #
  5025. self.error_label = QtWidgets.QLabel('%s:' % _("Error correction"))
  5026. self.error_label.setToolTip(
  5027. _("Parameter that controls the error correction used for the QR Code.\n"
  5028. "L = maximum 7%% errors can be corrected\n"
  5029. "M = maximum 15%% errors can be corrected\n"
  5030. "Q = maximum 25%% errors can be corrected\n"
  5031. "H = maximum 30%% errors can be corrected.")
  5032. )
  5033. self.error_radio = RadioSet([{'label': 'L', 'value': 'L'},
  5034. {'label': 'M', 'value': 'M'},
  5035. {'label': 'Q', 'value': 'Q'},
  5036. {'label': 'H', 'value': 'H'}])
  5037. self.error_radio.setToolTip(
  5038. _("Parameter that controls the error correction used for the QR Code.\n"
  5039. "L = maximum 7%% errors can be corrected\n"
  5040. "M = maximum 15%% errors can be corrected\n"
  5041. "Q = maximum 25%% errors can be corrected\n"
  5042. "H = maximum 30%% errors can be corrected.")
  5043. )
  5044. grid_lay.addWidget(self.error_label, 2, 0)
  5045. grid_lay.addWidget(self.error_radio, 2, 1)
  5046. # BOX SIZE #
  5047. self.bsize_label = QtWidgets.QLabel('%s:' % _("Box Size"))
  5048. self.bsize_label.setToolTip(
  5049. _("Box size control the overall size of the QRcode\n"
  5050. "by adjusting the size of each box in the code.")
  5051. )
  5052. self.bsize_entry = FCSpinner()
  5053. self.bsize_entry.set_range(1, 9999)
  5054. self.bsize_entry.setWrapping(True)
  5055. grid_lay.addWidget(self.bsize_label, 3, 0)
  5056. grid_lay.addWidget(self.bsize_entry, 3, 1)
  5057. # BORDER SIZE #
  5058. self.border_size_label = QtWidgets.QLabel('%s:' % _("Border Size"))
  5059. self.border_size_label.setToolTip(
  5060. _("Size of the QRCode border. How many boxes thick is the border.\n"
  5061. "Default value is 4. The width of the clearance around the QRCode.")
  5062. )
  5063. self.border_size_entry = FCSpinner()
  5064. self.border_size_entry.set_range(1, 9999)
  5065. self.border_size_entry.setWrapping(True)
  5066. grid_lay.addWidget(self.border_size_label, 4, 0)
  5067. grid_lay.addWidget(self.border_size_entry, 4, 1)
  5068. # Text box
  5069. self.text_label = QtWidgets.QLabel('%s:' % _("QRCode Data"))
  5070. self.text_label.setToolTip(
  5071. _("QRCode Data. Alphanumeric text to be encoded in the QRCode.")
  5072. )
  5073. self.text_data = FCTextArea()
  5074. self.text_data.setPlaceholderText(
  5075. _("Add here the text to be included in the QRCode...")
  5076. )
  5077. grid_lay.addWidget(self.text_label, 5, 0)
  5078. grid_lay.addWidget(self.text_data, 6, 0, 1, 2)
  5079. # POLARITY CHOICE #
  5080. self.pol_label = QtWidgets.QLabel('%s:' % _("Polarity"))
  5081. self.pol_label.setToolTip(
  5082. _("Choose the polarity of the QRCode.\n"
  5083. "It can be drawn in a negative way (squares are clear)\n"
  5084. "or in a positive way (squares are opaque).")
  5085. )
  5086. self.pol_radio = RadioSet([{'label': _('Negative'), 'value': 'neg'},
  5087. {'label': _('Positive'), 'value': 'pos'}])
  5088. self.pol_radio.setToolTip(
  5089. _("Choose the type of QRCode to be created.\n"
  5090. "If added on a Silkscreen Gerber file the QRCode may\n"
  5091. "be added as positive. If it is added to a Copper Gerber\n"
  5092. "file then perhaps the QRCode can be added as negative.")
  5093. )
  5094. grid_lay.addWidget(self.pol_label, 7, 0)
  5095. grid_lay.addWidget(self.pol_radio, 7, 1)
  5096. # BOUNDING BOX TYPE #
  5097. self.bb_label = QtWidgets.QLabel('%s:' % _("Bounding Box"))
  5098. self.bb_label.setToolTip(
  5099. _("The bounding box, meaning the empty space that surrounds\n"
  5100. "the QRCode geometry, can have a rounded or a square shape.")
  5101. )
  5102. self.bb_radio = RadioSet([{'label': _('Rounded'), 'value': 'r'},
  5103. {'label': _('Square'), 'value': 's'}])
  5104. self.bb_radio.setToolTip(
  5105. _("The bounding box, meaning the empty space that surrounds\n"
  5106. "the QRCode geometry, can have a rounded or a square shape.")
  5107. )
  5108. grid_lay.addWidget(self.bb_label, 8, 0)
  5109. grid_lay.addWidget(self.bb_radio, 8, 1)
  5110. # FILL COLOR #
  5111. self.fill_color_label = QtWidgets.QLabel('%s:' % _('Fill Color'))
  5112. self.fill_color_label.setToolTip(
  5113. _("Set the QRCode fill color (squares color).")
  5114. )
  5115. self.fill_color_entry = FCEntry()
  5116. self.fill_color_button = QtWidgets.QPushButton()
  5117. self.fill_color_button.setFixedSize(15, 15)
  5118. fill_lay_child = QtWidgets.QHBoxLayout()
  5119. fill_lay_child.setContentsMargins(0, 0, 0, 0)
  5120. fill_lay_child.addWidget(self.fill_color_entry)
  5121. fill_lay_child.addWidget(self.fill_color_button, alignment=Qt.AlignRight)
  5122. fill_lay_child.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  5123. fill_color_widget = QtWidgets.QWidget()
  5124. fill_color_widget.setLayout(fill_lay_child)
  5125. grid_lay.addWidget(self.fill_color_label, 9, 0)
  5126. grid_lay.addWidget(fill_color_widget, 9, 1)
  5127. # BACK COLOR #
  5128. self.back_color_label = QtWidgets.QLabel('%s:' % _('Back Color'))
  5129. self.back_color_label.setToolTip(
  5130. _("Set the QRCode background color.")
  5131. )
  5132. self.back_color_entry = FCEntry()
  5133. self.back_color_button = QtWidgets.QPushButton()
  5134. self.back_color_button.setFixedSize(15, 15)
  5135. back_lay_child = QtWidgets.QHBoxLayout()
  5136. back_lay_child.setContentsMargins(0, 0, 0, 0)
  5137. back_lay_child.addWidget(self.back_color_entry)
  5138. back_lay_child.addWidget(self.back_color_button, alignment=Qt.AlignRight)
  5139. back_lay_child.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  5140. back_color_widget = QtWidgets.QWidget()
  5141. back_color_widget.setLayout(back_lay_child)
  5142. grid_lay.addWidget(self.back_color_label, 10, 0)
  5143. grid_lay.addWidget(back_color_widget, 10, 1)
  5144. # Selection Limit
  5145. self.sel_limit_label = QtWidgets.QLabel('%s:' % _("Selection limit"))
  5146. self.sel_limit_label.setToolTip(
  5147. _("Set the number of selected geometry\n"
  5148. "items above which the utility geometry\n"
  5149. "becomes just a selection rectangle.\n"
  5150. "Increases the performance when moving a\n"
  5151. "large number of geometric elements.")
  5152. )
  5153. self.sel_limit_entry = FCSpinner()
  5154. self.sel_limit_entry.set_range(0, 9999)
  5155. grid_lay.addWidget(self.sel_limit_label, 11, 0)
  5156. grid_lay.addWidget(self.sel_limit_entry, 11, 1)
  5157. # self.layout.addStretch()
  5158. class Tools2CThievingPrefGroupUI(OptionsGroupUI):
  5159. def __init__(self, decimals=4, parent=None):
  5160. super(Tools2CThievingPrefGroupUI, self).__init__(self)
  5161. self.setTitle(str(_("Copper Thieving Tool Options")))
  5162. self.decimals = decimals
  5163. # ## Grid Layout
  5164. grid_lay = QtWidgets.QGridLayout()
  5165. self.layout.addLayout(grid_lay)
  5166. grid_lay.setColumnStretch(0, 0)
  5167. grid_lay.setColumnStretch(1, 1)
  5168. # ## Parameters
  5169. self.cflabel = QtWidgets.QLabel('<b>%s</b>' % _('Parameters'))
  5170. self.cflabel.setToolTip(
  5171. _("A tool to generate a Copper Thieving that can be added\n"
  5172. "to a selected Gerber file.")
  5173. )
  5174. grid_lay.addWidget(self.cflabel, 0, 0, 1, 2)
  5175. # CIRCLE STEPS - to be used when buffering
  5176. self.circle_steps_lbl = QtWidgets.QLabel('%s:' % _("Circle Steps"))
  5177. self.circle_steps_lbl.setToolTip(
  5178. _("Number of steps (lines) used to interpolate circles.")
  5179. )
  5180. self.circlesteps_entry = FCSpinner()
  5181. self.circlesteps_entry.set_range(1, 9999)
  5182. grid_lay.addWidget(self.circle_steps_lbl, 1, 0)
  5183. grid_lay.addWidget(self.circlesteps_entry, 1, 1)
  5184. # CLEARANCE #
  5185. self.clearance_label = QtWidgets.QLabel('%s:' % _("Clearance"))
  5186. self.clearance_label.setToolTip(
  5187. _("This set the distance between the copper Thieving components\n"
  5188. "(the polygon fill may be split in multiple polygons)\n"
  5189. "and the copper traces in the Gerber file.")
  5190. )
  5191. self.clearance_entry = FCDoubleSpinner()
  5192. self.clearance_entry.setMinimum(0.00001)
  5193. self.clearance_entry.set_precision(self.decimals)
  5194. self.clearance_entry.setSingleStep(0.1)
  5195. grid_lay.addWidget(self.clearance_label, 2, 0)
  5196. grid_lay.addWidget(self.clearance_entry, 2, 1)
  5197. # MARGIN #
  5198. self.margin_label = QtWidgets.QLabel('%s:' % _("Margin"))
  5199. self.margin_label.setToolTip(
  5200. _("Bounding box margin.")
  5201. )
  5202. self.margin_entry = FCDoubleSpinner()
  5203. self.margin_entry.setMinimum(0.0)
  5204. self.margin_entry.set_precision(self.decimals)
  5205. self.margin_entry.setSingleStep(0.1)
  5206. grid_lay.addWidget(self.margin_label, 3, 0)
  5207. grid_lay.addWidget(self.margin_entry, 3, 1)
  5208. # Reference #
  5209. self.reference_radio = RadioSet([
  5210. {'label': _('Itself'), 'value': 'itself'},
  5211. {"label": _("Area Selection"), "value": "area"},
  5212. {'label': _("Reference Object"), 'value': 'box'}
  5213. ], orientation='vertical', stretch=False)
  5214. self.reference_label = QtWidgets.QLabel(_("Reference:"))
  5215. self.reference_label.setToolTip(
  5216. _("- 'Itself' - the copper Thieving extent is based on the object extent.\n"
  5217. "- 'Area Selection' - left mouse click to start selection of the area to be filled.\n"
  5218. "- 'Reference Object' - will do copper thieving within the area specified by another object.")
  5219. )
  5220. grid_lay.addWidget(self.reference_label, 4, 0)
  5221. grid_lay.addWidget(self.reference_radio, 4, 1)
  5222. # Bounding Box Type #
  5223. self.bbox_type_radio = RadioSet([
  5224. {'label': _('Rectangular'), 'value': 'rect'},
  5225. {"label": _("Minimal"), "value": "min"}
  5226. ], stretch=False)
  5227. self.bbox_type_label = QtWidgets.QLabel(_("Box Type:"))
  5228. self.bbox_type_label.setToolTip(
  5229. _("- 'Rectangular' - the bounding box will be of rectangular shape.\n"
  5230. "- 'Minimal' - the bounding box will be the convex hull shape.")
  5231. )
  5232. grid_lay.addWidget(self.bbox_type_label, 5, 0)
  5233. grid_lay.addWidget(self.bbox_type_radio, 5, 1)
  5234. separator_line = QtWidgets.QFrame()
  5235. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  5236. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  5237. grid_lay.addWidget(separator_line, 6, 0, 1, 2)
  5238. # Fill Type
  5239. self.fill_type_radio = RadioSet([
  5240. {'label': _('Solid'), 'value': 'solid'},
  5241. {"label": _("Dots Grid"), "value": "dot"},
  5242. {"label": _("Squares Grid"), "value": "square"},
  5243. {"label": _("Lines Grid"), "value": "line"}
  5244. ], orientation='vertical', stretch=False)
  5245. self.fill_type_label = QtWidgets.QLabel(_("Fill Type:"))
  5246. self.fill_type_label.setToolTip(
  5247. _("- 'Solid' - copper thieving will be a solid polygon.\n"
  5248. "- 'Dots Grid' - the empty area will be filled with a pattern of dots.\n"
  5249. "- 'Squares Grid' - the empty area will be filled with a pattern of squares.\n"
  5250. "- 'Lines Grid' - the empty area will be filled with a pattern of lines.")
  5251. )
  5252. grid_lay.addWidget(self.fill_type_label, 7, 0)
  5253. grid_lay.addWidget(self.fill_type_radio, 7, 1)
  5254. self.dots_label = QtWidgets.QLabel('<b>%s</b>:' % _("Dots Grid Parameters"))
  5255. grid_lay.addWidget(self.dots_label, 8, 0, 1, 2)
  5256. # Dot diameter #
  5257. self.dotdia_label = QtWidgets.QLabel('%s:' % _("Dia"))
  5258. self.dotdia_label.setToolTip(
  5259. _("Dot diameter in Dots Grid.")
  5260. )
  5261. self.dot_dia_entry = FCDoubleSpinner()
  5262. self.dot_dia_entry.set_range(0.0, 9999.9999)
  5263. self.dot_dia_entry.set_precision(self.decimals)
  5264. self.dot_dia_entry.setSingleStep(0.1)
  5265. grid_lay.addWidget(self.dotdia_label, 9, 0)
  5266. grid_lay.addWidget(self.dot_dia_entry, 9, 1)
  5267. # Dot spacing #
  5268. self.dotspacing_label = QtWidgets.QLabel('%s:' % _("Spacing"))
  5269. self.dotspacing_label.setToolTip(
  5270. _("Distance between each two dots in Dots Grid.")
  5271. )
  5272. self.dot_spacing_entry = FCDoubleSpinner()
  5273. self.dot_spacing_entry.set_range(0.0, 9999.9999)
  5274. self.dot_spacing_entry.set_precision(self.decimals)
  5275. self.dot_spacing_entry.setSingleStep(0.1)
  5276. grid_lay.addWidget(self.dotspacing_label, 10, 0)
  5277. grid_lay.addWidget(self.dot_spacing_entry, 10, 1)
  5278. self.squares_label = QtWidgets.QLabel('<b>%s</b>:' % _("Squares Grid Parameters"))
  5279. grid_lay.addWidget(self.squares_label, 11, 0, 1, 2)
  5280. # Square Size #
  5281. self.square_size_label = QtWidgets.QLabel('%s:' % _("Size"))
  5282. self.square_size_label.setToolTip(
  5283. _("Square side size in Squares Grid.")
  5284. )
  5285. self.square_size_entry = FCDoubleSpinner()
  5286. self.square_size_entry.set_range(0.0, 9999.9999)
  5287. self.square_size_entry.set_precision(self.decimals)
  5288. self.square_size_entry.setSingleStep(0.1)
  5289. grid_lay.addWidget(self.square_size_label, 12, 0)
  5290. grid_lay.addWidget(self.square_size_entry, 12, 1)
  5291. # Squares spacing #
  5292. self.squares_spacing_label = QtWidgets.QLabel('%s:' % _("Spacing"))
  5293. self.squares_spacing_label.setToolTip(
  5294. _("Distance between each two squares in Squares Grid.")
  5295. )
  5296. self.squares_spacing_entry = FCDoubleSpinner()
  5297. self.squares_spacing_entry.set_range(0.0, 9999.9999)
  5298. self.squares_spacing_entry.set_precision(self.decimals)
  5299. self.squares_spacing_entry.setSingleStep(0.1)
  5300. grid_lay.addWidget(self.squares_spacing_label, 13, 0)
  5301. grid_lay.addWidget(self.squares_spacing_entry, 13, 1)
  5302. self.lines_label = QtWidgets.QLabel('<b>%s</b>:' % _("Lines Grid Parameters"))
  5303. grid_lay.addWidget(self.lines_label, 14, 0, 1, 2)
  5304. # Square Size #
  5305. self.line_size_label = QtWidgets.QLabel('%s:' % _("Size"))
  5306. self.line_size_label.setToolTip(
  5307. _("Line thickness size in Lines Grid.")
  5308. )
  5309. self.line_size_entry = FCDoubleSpinner()
  5310. self.line_size_entry.set_range(0.0, 9999.9999)
  5311. self.line_size_entry.set_precision(self.decimals)
  5312. self.line_size_entry.setSingleStep(0.1)
  5313. grid_lay.addWidget(self.line_size_label, 15, 0)
  5314. grid_lay.addWidget(self.line_size_entry, 15, 1)
  5315. # Lines spacing #
  5316. self.lines_spacing_label = QtWidgets.QLabel('%s:' % _("Spacing"))
  5317. self.lines_spacing_label.setToolTip(
  5318. _("Distance between each two lines in Lines Grid.")
  5319. )
  5320. self.lines_spacing_entry = FCDoubleSpinner()
  5321. self.lines_spacing_entry.set_range(0.0, 9999.9999)
  5322. self.lines_spacing_entry.set_precision(self.decimals)
  5323. self.lines_spacing_entry.setSingleStep(0.1)
  5324. grid_lay.addWidget(self.lines_spacing_label, 16, 0)
  5325. grid_lay.addWidget(self.lines_spacing_entry, 16, 1)
  5326. self.robber_bar_label = QtWidgets.QLabel('<b>%s</b>' % _('Robber Bar Parameters'))
  5327. self.robber_bar_label.setToolTip(
  5328. _("Parameters used for the robber bar.\n"
  5329. "Robber bar = copper border to help in pattern hole plating.")
  5330. )
  5331. grid_lay.addWidget(self.robber_bar_label, 17, 0, 1, 2)
  5332. # ROBBER BAR MARGIN #
  5333. self.rb_margin_label = QtWidgets.QLabel('%s:' % _("Margin"))
  5334. self.rb_margin_label.setToolTip(
  5335. _("Bounding box margin for robber bar.")
  5336. )
  5337. self.rb_margin_entry = FCDoubleSpinner()
  5338. self.rb_margin_entry.set_range(-9999.9999, 9999.9999)
  5339. self.rb_margin_entry.set_precision(self.decimals)
  5340. self.rb_margin_entry.setSingleStep(0.1)
  5341. grid_lay.addWidget(self.rb_margin_label, 18, 0)
  5342. grid_lay.addWidget(self.rb_margin_entry, 18, 1)
  5343. # THICKNESS #
  5344. self.rb_thickness_label = QtWidgets.QLabel('%s:' % _("Thickness"))
  5345. self.rb_thickness_label.setToolTip(
  5346. _("The robber bar thickness.")
  5347. )
  5348. self.rb_thickness_entry = FCDoubleSpinner()
  5349. self.rb_thickness_entry.set_range(0.0000, 9999.9999)
  5350. self.rb_thickness_entry.set_precision(self.decimals)
  5351. self.rb_thickness_entry.setSingleStep(0.1)
  5352. grid_lay.addWidget(self.rb_thickness_label, 19, 0)
  5353. grid_lay.addWidget(self.rb_thickness_entry, 19, 1)
  5354. self.patern_mask_label = QtWidgets.QLabel('<b>%s</b>' % _('Pattern Plating Mask'))
  5355. self.patern_mask_label.setToolTip(
  5356. _("Generate a mask for pattern plating.")
  5357. )
  5358. grid_lay.addWidget(self.patern_mask_label, 20, 0, 1, 2)
  5359. # Openings CLEARANCE #
  5360. self.clearance_ppm_label = QtWidgets.QLabel('%s:' % _("Clearance"))
  5361. self.clearance_ppm_label.setToolTip(
  5362. _("The distance between the possible copper thieving elements\n"
  5363. "and/or robber bar and the actual openings in the mask.")
  5364. )
  5365. self.clearance_ppm_entry = FCDoubleSpinner()
  5366. self.clearance_ppm_entry.set_range(-9999.9999, 9999.9999)
  5367. self.clearance_ppm_entry.set_precision(self.decimals)
  5368. self.clearance_ppm_entry.setSingleStep(0.1)
  5369. grid_lay.addWidget(self.clearance_ppm_label, 21, 0)
  5370. grid_lay.addWidget(self.clearance_ppm_entry, 21, 1)
  5371. self.layout.addStretch()
  5372. class Tools2FiducialsPrefGroupUI(OptionsGroupUI):
  5373. def __init__(self, decimals=4, parent=None):
  5374. super(Tools2FiducialsPrefGroupUI, self).__init__(self)
  5375. self.setTitle(str(_("Fiducials Tool Options")))
  5376. self.decimals = decimals
  5377. # ## Grid Layout
  5378. grid_lay = QtWidgets.QGridLayout()
  5379. self.layout.addLayout(grid_lay)
  5380. grid_lay.setColumnStretch(0, 0)
  5381. grid_lay.setColumnStretch(1, 1)
  5382. self.param_label = QtWidgets.QLabel('<b>%s:</b>' % _('Parameters'))
  5383. self.param_label.setToolTip(
  5384. _("Parameters used for this tool.")
  5385. )
  5386. grid_lay.addWidget(self.param_label, 0, 0, 1, 2)
  5387. # DIAMETER #
  5388. self.dia_label = QtWidgets.QLabel('%s:' % _("Size"))
  5389. self.dia_label.setToolTip(
  5390. _("This set the fiducial diameter if fiducial type is circular,\n"
  5391. "otherwise is the size of the fiducial.\n"
  5392. "The soldermask opening is double than that.")
  5393. )
  5394. self.dia_entry = FCDoubleSpinner()
  5395. self.dia_entry.set_range(1.0000, 3.0000)
  5396. self.dia_entry.set_precision(self.decimals)
  5397. self.dia_entry.setWrapping(True)
  5398. self.dia_entry.setSingleStep(0.1)
  5399. grid_lay.addWidget(self.dia_label, 1, 0)
  5400. grid_lay.addWidget(self.dia_entry, 1, 1)
  5401. # MARGIN #
  5402. self.margin_label = QtWidgets.QLabel('%s:' % _("Margin"))
  5403. self.margin_label.setToolTip(
  5404. _("Bounding box margin.")
  5405. )
  5406. self.margin_entry = FCDoubleSpinner()
  5407. self.margin_entry.set_range(-9999.9999, 9999.9999)
  5408. self.margin_entry.set_precision(self.decimals)
  5409. self.margin_entry.setSingleStep(0.1)
  5410. grid_lay.addWidget(self.margin_label, 2, 0)
  5411. grid_lay.addWidget(self.margin_entry, 2, 1)
  5412. # Mode #
  5413. self.mode_radio = RadioSet([
  5414. {'label': _('Auto'), 'value': 'auto'},
  5415. {"label": _("Manual"), "value": "manual"}
  5416. ], stretch=False)
  5417. self.mode_label = QtWidgets.QLabel(_("Mode:"))
  5418. self.mode_label.setToolTip(
  5419. _("- 'Auto' - automatic placement of fiducials in the corners of the bounding box.\n"
  5420. "- 'Manual' - manual placement of fiducials.")
  5421. )
  5422. grid_lay.addWidget(self.mode_label, 3, 0)
  5423. grid_lay.addWidget(self.mode_radio, 3, 1)
  5424. # Position for second fiducial #
  5425. self.pos_radio = RadioSet([
  5426. {'label': _('Up'), 'value': 'up'},
  5427. {"label": _("Down"), "value": "down"},
  5428. {"label": _("None"), "value": "no"}
  5429. ], stretch=False)
  5430. self.pos_label = QtWidgets.QLabel('%s:' % _("Second fiducial"))
  5431. self.pos_label.setToolTip(
  5432. _("The position for the second fiducial.\n"
  5433. "- 'Up' - the order is: bottom-left, top-left, top-right.\n"
  5434. "- 'Down' - the order is: bottom-left, bottom-right, top-right.\n"
  5435. "- 'None' - there is no second fiducial. The order is: bottom-left, top-right.")
  5436. )
  5437. grid_lay.addWidget(self.pos_label, 4, 0)
  5438. grid_lay.addWidget(self.pos_radio, 4, 1)
  5439. separator_line = QtWidgets.QFrame()
  5440. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  5441. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  5442. grid_lay.addWidget(separator_line, 5, 0, 1, 2)
  5443. # Fiducial type #
  5444. self.fid_type_radio = RadioSet([
  5445. {'label': _('Circular'), 'value': 'circular'},
  5446. {"label": _("Cross"), "value": "cross"},
  5447. {"label": _("Chess"), "value": "chess"}
  5448. ], stretch=False)
  5449. self.fid_type_label = QtWidgets.QLabel('%s:' % _("Fiducial Type"))
  5450. self.fid_type_label.setToolTip(
  5451. _("The type of fiducial.\n"
  5452. "- 'Circular' - this is the regular fiducial.\n"
  5453. "- 'Cross' - cross lines fiducial.\n"
  5454. "- 'Chess' - chess pattern fiducial.")
  5455. )
  5456. grid_lay.addWidget(self.fid_type_label, 6, 0)
  5457. grid_lay.addWidget(self.fid_type_radio, 6, 1)
  5458. # Line Thickness #
  5459. self.line_thickness_label = QtWidgets.QLabel('%s:' % _("Line thickness"))
  5460. self.line_thickness_label.setToolTip(
  5461. _("Bounding box margin.")
  5462. )
  5463. self.line_thickness_entry = FCDoubleSpinner()
  5464. self.line_thickness_entry.set_range(0.00001, 9999.9999)
  5465. self.line_thickness_entry.set_precision(self.decimals)
  5466. self.line_thickness_entry.setSingleStep(0.1)
  5467. grid_lay.addWidget(self.line_thickness_label, 7, 0)
  5468. grid_lay.addWidget(self.line_thickness_entry, 7, 1)
  5469. self.layout.addStretch()
  5470. class Tools2CalPrefGroupUI(OptionsGroupUI):
  5471. def __init__(self, decimals=4, parent=None):
  5472. super(Tools2CalPrefGroupUI, self).__init__(self)
  5473. self.setTitle(str(_("Calibration Tool Options")))
  5474. self.decimals = decimals
  5475. # ## Grid Layout
  5476. grid_lay = QtWidgets.QGridLayout()
  5477. self.layout.addLayout(grid_lay)
  5478. grid_lay.setColumnStretch(0, 0)
  5479. grid_lay.setColumnStretch(1, 1)
  5480. self.param_label = QtWidgets.QLabel('<b>%s:</b>' % _('Parameters'))
  5481. self.param_label.setToolTip(
  5482. _("Parameters used for this tool.")
  5483. )
  5484. grid_lay.addWidget(self.param_label, 0, 0, 1, 2)
  5485. # Calibration source
  5486. self.cal_source_lbl = QtWidgets.QLabel("<b>%s:</b>" % _("Source Type"))
  5487. self.cal_source_lbl.setToolTip(_("The source of calibration points.\n"
  5488. "It can be:\n"
  5489. "- Object -> click a hole geo for Excellon or a pad for Gerber\n"
  5490. "- Free -> click freely on canvas to acquire the calibration points"))
  5491. self.cal_source_radio = RadioSet([{'label': _('Object'), 'value': 'object'},
  5492. {'label': _('Free'), 'value': 'free'}],
  5493. stretch=False)
  5494. grid_lay.addWidget(self.cal_source_lbl, 1, 0)
  5495. grid_lay.addWidget(self.cal_source_radio, 1, 1, 1, 2)
  5496. separator_line = QtWidgets.QFrame()
  5497. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  5498. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  5499. grid_lay.addWidget(separator_line, 2, 0, 1, 2)
  5500. # Travel Z entry
  5501. travelz_lbl = QtWidgets.QLabel('%s:' % _("Travel Z"))
  5502. travelz_lbl.setToolTip(
  5503. _("Height (Z) for travelling between the points.")
  5504. )
  5505. self.travelz_entry = FCDoubleSpinner()
  5506. self.travelz_entry.set_range(-9999.9999, 9999.9999)
  5507. self.travelz_entry.set_precision(self.decimals)
  5508. self.travelz_entry.setSingleStep(0.1)
  5509. grid_lay.addWidget(travelz_lbl, 3, 0)
  5510. grid_lay.addWidget(self.travelz_entry, 3, 1, 1, 2)
  5511. # Verification Z entry
  5512. verz_lbl = QtWidgets.QLabel('%s:' % _("Verification Z"))
  5513. verz_lbl.setToolTip(
  5514. _("Height (Z) for checking the point.")
  5515. )
  5516. self.verz_entry = FCDoubleSpinner()
  5517. self.verz_entry.set_range(-9999.9999, 9999.9999)
  5518. self.verz_entry.set_precision(self.decimals)
  5519. self.verz_entry.setSingleStep(0.1)
  5520. grid_lay.addWidget(verz_lbl, 4, 0)
  5521. grid_lay.addWidget(self.verz_entry, 4, 1, 1, 2)
  5522. # Zero the Z of the verification tool
  5523. self.zeroz_cb = FCCheckBox('%s' % _("Zero Z tool"))
  5524. self.zeroz_cb.setToolTip(
  5525. _("Include a sequence to zero the height (Z)\n"
  5526. "of the verification tool.")
  5527. )
  5528. grid_lay.addWidget(self.zeroz_cb, 5, 0, 1, 3)
  5529. # Toochange Z entry
  5530. toolchangez_lbl = QtWidgets.QLabel('%s:' % _("Toolchange Z"))
  5531. toolchangez_lbl.setToolTip(
  5532. _("Height (Z) for mounting the verification probe.")
  5533. )
  5534. self.toolchangez_entry = FCDoubleSpinner()
  5535. self.toolchangez_entry.set_range(0.0000, 9999.9999)
  5536. self.toolchangez_entry.set_precision(self.decimals)
  5537. self.toolchangez_entry.setSingleStep(0.1)
  5538. grid_lay.addWidget(toolchangez_lbl, 6, 0)
  5539. grid_lay.addWidget(self.toolchangez_entry, 6, 1, 1, 2)
  5540. # Toolchange X-Y entry
  5541. toolchangexy_lbl = QtWidgets.QLabel('%s:' % _('Toolchange X-Y'))
  5542. toolchangexy_lbl.setToolTip(
  5543. _("Toolchange X,Y position.\n"
  5544. "If no value is entered then the current\n"
  5545. "(x, y) point will be used,")
  5546. )
  5547. self.toolchange_xy_entry = FCEntry()
  5548. grid_lay.addWidget(toolchangexy_lbl, 7, 0)
  5549. grid_lay.addWidget(self.toolchange_xy_entry, 7, 1, 1, 2)
  5550. # Second point choice
  5551. second_point_lbl = QtWidgets.QLabel('%s:' % _("Second point"))
  5552. second_point_lbl.setToolTip(
  5553. _("Second point in the Gcode verification can be:\n"
  5554. "- top-left -> the user will align the PCB vertically\n"
  5555. "- bottom-right -> the user will align the PCB horizontally")
  5556. )
  5557. self.second_point_radio = RadioSet([{'label': _('Top-Left'), 'value': 'tl'},
  5558. {'label': _('Bottom-Right'), 'value': 'br'}],
  5559. orientation='vertical')
  5560. grid_lay.addWidget(second_point_lbl, 8, 0)
  5561. grid_lay.addWidget(self.second_point_radio, 8, 1, 1, 2)
  5562. self.layout.addStretch()
  5563. class FAExcPrefGroupUI(OptionsGroupUI):
  5564. def __init__(self, decimals=4, parent=None):
  5565. # OptionsGroupUI.__init__(self, "Excellon File associations Preferences", parent=None)
  5566. super().__init__(self)
  5567. self.setTitle(str(_("Excellon File associations")))
  5568. self.decimals = decimals
  5569. self.layout.setContentsMargins(2, 2, 2, 2)
  5570. self.vertical_lay = QtWidgets.QVBoxLayout()
  5571. scroll_widget = QtWidgets.QWidget()
  5572. scroll = VerticalScrollArea()
  5573. scroll.setWidget(scroll_widget)
  5574. scroll.setWidgetResizable(True)
  5575. scroll.setFrameShape(QtWidgets.QFrame.NoFrame)
  5576. self.restore_btn = FCButton(_("Restore"))
  5577. self.restore_btn.setToolTip(_("Restore the extension list to the default state."))
  5578. self.del_all_btn = FCButton(_("Delete All"))
  5579. self.del_all_btn.setToolTip(_("Delete all extensions from the list."))
  5580. hlay0 = QtWidgets.QHBoxLayout()
  5581. hlay0.addWidget(self.restore_btn)
  5582. hlay0.addWidget(self.del_all_btn)
  5583. self.vertical_lay.addLayout(hlay0)
  5584. # # ## Excellon associations
  5585. list_label = QtWidgets.QLabel("<b>%s:</b>" % _("Extensions list"))
  5586. list_label.setToolTip(
  5587. _("List of file extensions to be\n"
  5588. "associated with FlatCAM.")
  5589. )
  5590. self.vertical_lay.addWidget(list_label)
  5591. settings = QSettings("Open Source", "FlatCAM")
  5592. if settings.contains("textbox_font_size"):
  5593. tb_fsize = settings.value('textbox_font_size', type=int)
  5594. else:
  5595. tb_fsize = 10
  5596. self.exc_list_text = FCTextArea()
  5597. self.exc_list_text.setReadOnly(True)
  5598. # self.exc_list_text.sizeHint(custom_sizehint=150)
  5599. font = QtGui.QFont()
  5600. font.setPointSize(tb_fsize)
  5601. self.exc_list_text.setFont(font)
  5602. self.vertical_lay.addWidget(self.exc_list_text)
  5603. self.ext_label = QtWidgets.QLabel('%s:' % _("Extension"))
  5604. self.ext_label.setToolTip(_("A file extension to be added or deleted to the list."))
  5605. self.ext_entry = FCEntry()
  5606. hlay1 = QtWidgets.QHBoxLayout()
  5607. self.vertical_lay.addLayout(hlay1)
  5608. hlay1.addWidget(self.ext_label)
  5609. hlay1.addWidget(self.ext_entry)
  5610. self.add_btn = FCButton(_("Add Extension"))
  5611. self.add_btn.setToolTip(_("Add a file extension to the list"))
  5612. self.del_btn = FCButton(_("Delete Extension"))
  5613. self.del_btn.setToolTip(_("Delete a file extension from the list"))
  5614. hlay2 = QtWidgets.QHBoxLayout()
  5615. self.vertical_lay.addLayout(hlay2)
  5616. hlay2.addWidget(self.add_btn)
  5617. hlay2.addWidget(self.del_btn)
  5618. self.exc_list_btn = FCButton(_("Apply Association"))
  5619. self.exc_list_btn.setToolTip(_("Apply the file associations between\n"
  5620. "FlatCAM and the files with above extensions.\n"
  5621. "They will be active after next logon.\n"
  5622. "This work only in Windows."))
  5623. self.vertical_lay.addWidget(self.exc_list_btn)
  5624. scroll_widget.setLayout(self.vertical_lay)
  5625. self.layout.addWidget(scroll)
  5626. # self.vertical_lay.addStretch()
  5627. class FAGcoPrefGroupUI(OptionsGroupUI):
  5628. def __init__(self, decimals=4, parent=None):
  5629. # OptionsGroupUI.__init__(self, "Gcode File associations Preferences", parent=None)
  5630. super(FAGcoPrefGroupUI, self).__init__(self)
  5631. self.setTitle(str(_("GCode File associations")))
  5632. self.decimals = decimals
  5633. self.restore_btn = FCButton(_("Restore"))
  5634. self.restore_btn.setToolTip(_("Restore the extension list to the default state."))
  5635. self.del_all_btn = FCButton(_("Delete All"))
  5636. self.del_all_btn.setToolTip(_("Delete all extensions from the list."))
  5637. hlay0 = QtWidgets.QHBoxLayout()
  5638. self.layout.addLayout(hlay0)
  5639. hlay0.addWidget(self.restore_btn)
  5640. hlay0.addWidget(self.del_all_btn)
  5641. # ## G-Code associations
  5642. self.gco_list_label = QtWidgets.QLabel("<b>%s:</b>" % _("Extensions list"))
  5643. self.gco_list_label.setToolTip(
  5644. _("List of file extensions to be\n"
  5645. "associated with FlatCAM.")
  5646. )
  5647. self.layout.addWidget(self.gco_list_label)
  5648. settings = QSettings("Open Source", "FlatCAM")
  5649. if settings.contains("textbox_font_size"):
  5650. tb_fsize = settings.value('textbox_font_size', type=int)
  5651. else:
  5652. tb_fsize = 10
  5653. self.gco_list_text = FCTextArea()
  5654. self.gco_list_text.setReadOnly(True)
  5655. # self.gco_list_text.sizeHint(custom_sizehint=150)
  5656. font = QtGui.QFont()
  5657. font.setPointSize(tb_fsize)
  5658. self.gco_list_text.setFont(font)
  5659. self.layout.addWidget(self.gco_list_text)
  5660. self.ext_label = QtWidgets.QLabel('%s:' % _("Extension"))
  5661. self.ext_label.setToolTip(_("A file extension to be added or deleted to the list."))
  5662. self.ext_entry = FCEntry()
  5663. hlay1 = QtWidgets.QHBoxLayout()
  5664. self.layout.addLayout(hlay1)
  5665. hlay1.addWidget(self.ext_label)
  5666. hlay1.addWidget(self.ext_entry)
  5667. self.add_btn = FCButton(_("Add Extension"))
  5668. self.add_btn.setToolTip(_("Add a file extension to the list"))
  5669. self.del_btn = FCButton(_("Delete Extension"))
  5670. self.del_btn.setToolTip(_("Delete a file extension from the list"))
  5671. hlay2 = QtWidgets.QHBoxLayout()
  5672. self.layout.addLayout(hlay2)
  5673. hlay2.addWidget(self.add_btn)
  5674. hlay2.addWidget(self.del_btn)
  5675. self.gco_list_btn = FCButton(_("Apply Association"))
  5676. self.gco_list_btn.setToolTip(_("Apply the file associations between\n"
  5677. "FlatCAM and the files with above extensions.\n"
  5678. "They will be active after next logon.\n"
  5679. "This work only in Windows."))
  5680. self.layout.addWidget(self.gco_list_btn)
  5681. # self.layout.addStretch()
  5682. class FAGrbPrefGroupUI(OptionsGroupUI):
  5683. def __init__(self, decimals=4, parent=None):
  5684. # OptionsGroupUI.__init__(self, "Gerber File associations Preferences", parent=None)
  5685. super(FAGrbPrefGroupUI, self).__init__(self)
  5686. self.setTitle(str(_("Gerber File associations")))
  5687. self.decimals = decimals
  5688. self.restore_btn = FCButton(_("Restore"))
  5689. self.restore_btn.setToolTip(_("Restore the extension list to the default state."))
  5690. self.del_all_btn = FCButton(_("Delete All"))
  5691. self.del_all_btn.setToolTip(_("Delete all extensions from the list."))
  5692. hlay0 = QtWidgets.QHBoxLayout()
  5693. self.layout.addLayout(hlay0)
  5694. hlay0.addWidget(self.restore_btn)
  5695. hlay0.addWidget(self.del_all_btn)
  5696. # ## Gerber associations
  5697. self.grb_list_label = QtWidgets.QLabel("<b>%s:</b>" % _("Extensions list"))
  5698. self.grb_list_label.setToolTip(
  5699. _("List of file extensions to be\n"
  5700. "associated with FlatCAM.")
  5701. )
  5702. self.layout.addWidget(self.grb_list_label)
  5703. settings = QSettings("Open Source", "FlatCAM")
  5704. if settings.contains("textbox_font_size"):
  5705. tb_fsize = settings.value('textbox_font_size', type=int)
  5706. else:
  5707. tb_fsize = 10
  5708. self.grb_list_text = FCTextArea()
  5709. self.grb_list_text.setReadOnly(True)
  5710. # self.grb_list_text.sizeHint(custom_sizehint=150)
  5711. self.layout.addWidget(self.grb_list_text)
  5712. font = QtGui.QFont()
  5713. font.setPointSize(tb_fsize)
  5714. self.grb_list_text.setFont(font)
  5715. self.ext_label = QtWidgets.QLabel('%s:' % _("Extension"))
  5716. self.ext_label.setToolTip(_("A file extension to be added or deleted to the list."))
  5717. self.ext_entry = FCEntry()
  5718. hlay1 = QtWidgets.QHBoxLayout()
  5719. self.layout.addLayout(hlay1)
  5720. hlay1.addWidget(self.ext_label)
  5721. hlay1.addWidget(self.ext_entry)
  5722. self.add_btn = FCButton(_("Add Extension"))
  5723. self.add_btn.setToolTip(_("Add a file extension to the list"))
  5724. self.del_btn = FCButton(_("Delete Extension"))
  5725. self.del_btn.setToolTip(_("Delete a file extension from the list"))
  5726. hlay2 = QtWidgets.QHBoxLayout()
  5727. self.layout.addLayout(hlay2)
  5728. hlay2.addWidget(self.add_btn)
  5729. hlay2.addWidget(self.del_btn)
  5730. self.grb_list_btn = FCButton(_("Apply Association"))
  5731. self.grb_list_btn.setToolTip(_("Apply the file associations between\n"
  5732. "FlatCAM and the files with above extensions.\n"
  5733. "They will be active after next logon.\n"
  5734. "This work only in Windows."))
  5735. self.layout.addWidget(self.grb_list_btn)
  5736. # self.layout.addStretch()
  5737. class AutoCompletePrefGroupUI(OptionsGroupUI):
  5738. def __init__(self, decimals=4, parent=None):
  5739. # OptionsGroupUI.__init__(self, "Gerber File associations Preferences", parent=None)
  5740. super().__init__(self, parent=parent)
  5741. self.setTitle(str(_("Autocompleter Keywords")))
  5742. self.decimals = decimals
  5743. self.restore_btn = FCButton(_("Restore"))
  5744. self.restore_btn.setToolTip(_("Restore the autocompleter keywords list to the default state."))
  5745. self.del_all_btn = FCButton(_("Delete All"))
  5746. self.del_all_btn.setToolTip(_("Delete all autocompleter keywords from the list."))
  5747. hlay0 = QtWidgets.QHBoxLayout()
  5748. self.layout.addLayout(hlay0)
  5749. hlay0.addWidget(self.restore_btn)
  5750. hlay0.addWidget(self.del_all_btn)
  5751. # ## Gerber associations
  5752. self.grb_list_label = QtWidgets.QLabel("<b>%s:</b>" % _("Keywords list"))
  5753. self.grb_list_label.setToolTip(
  5754. _("List of keywords used by\n"
  5755. "the autocompleter in FlatCAM.\n"
  5756. "The autocompleter is installed\n"
  5757. "in the Code Editor and for the Tcl Shell.")
  5758. )
  5759. self.layout.addWidget(self.grb_list_label)
  5760. settings = QSettings("Open Source", "FlatCAM")
  5761. if settings.contains("textbox_font_size"):
  5762. tb_fsize = settings.value('textbox_font_size', type=int)
  5763. else:
  5764. tb_fsize = 10
  5765. self.kw_list_text = FCTextArea()
  5766. self.kw_list_text.setReadOnly(True)
  5767. # self.grb_list_text.sizeHint(custom_sizehint=150)
  5768. self.layout.addWidget(self.kw_list_text)
  5769. font = QtGui.QFont()
  5770. font.setPointSize(tb_fsize)
  5771. self.kw_list_text.setFont(font)
  5772. self.kw_label = QtWidgets.QLabel('%s:' % _("Extension"))
  5773. self.kw_label.setToolTip(_("A keyword to be added or deleted to the list."))
  5774. self.kw_entry = FCEntry()
  5775. hlay1 = QtWidgets.QHBoxLayout()
  5776. self.layout.addLayout(hlay1)
  5777. hlay1.addWidget(self.kw_label)
  5778. hlay1.addWidget(self.kw_entry)
  5779. self.add_btn = FCButton(_("Add keyword"))
  5780. self.add_btn.setToolTip(_("Add a keyword to the list"))
  5781. self.del_btn = FCButton(_("Delete keyword"))
  5782. self.del_btn.setToolTip(_("Delete a keyword from the list"))
  5783. hlay2 = QtWidgets.QHBoxLayout()
  5784. self.layout.addLayout(hlay2)
  5785. hlay2.addWidget(self.add_btn)
  5786. hlay2.addWidget(self.del_btn)
  5787. # self.layout.addStretch()