PreferencesUI.py 281 KB

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