PreferencesUI.py 279 KB

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