PreferencesUI.py 428 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882
  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. import os
  8. from defaults import FlatCAMDefaults
  9. from flatcamGUI.GUIElements import *
  10. import platform
  11. import sys
  12. import logging
  13. import gettext
  14. import FlatCAMTranslation as fcTranslate
  15. import builtins
  16. log = logging.getLogger('PreferencesUI')
  17. fcTranslate.apply_language('strings')
  18. if '_' not in builtins.__dict__:
  19. _ = gettext.gettext
  20. settings = QSettings("Open Source", "FlatCAM")
  21. if settings.contains("machinist"):
  22. machinist_setting = settings.value('machinist', type=int)
  23. else:
  24. machinist_setting = 0
  25. class PreferencesUIManager():
  26. def __init__(self, defaults: FlatCAMDefaults, data_path: str, ui, inform):
  27. self.defaults = defaults
  28. self.data_path = data_path
  29. self.ui = ui
  30. self.inform = inform
  31. # if Preferences are changed in the Edit -> Preferences tab the value will be set to True
  32. self.preferences_changed_flag = False
  33. # when adding entries here read the comments in the method found bellow named:
  34. # def new_object(self, kind, name, initialize, active=True, fit=True, plot=True)
  35. self.defaults_form_fields = {
  36. # General App
  37. "decimals_inch": self.ui.general_defaults_form.general_app_group.precision_inch_entry,
  38. "decimals_metric": self.ui.general_defaults_form.general_app_group.precision_metric_entry,
  39. "units": self.ui.general_defaults_form.general_app_group.units_radio,
  40. "global_graphic_engine": self.ui.general_defaults_form.general_app_group.ge_radio,
  41. "global_app_level": self.ui.general_defaults_form.general_app_group.app_level_radio,
  42. "global_portable": self.ui.general_defaults_form.general_app_group.portability_cb,
  43. "global_language": self.ui.general_defaults_form.general_app_group.language_cb,
  44. "global_systray_icon": self.ui.general_defaults_form.general_app_group.systray_cb,
  45. "global_shell_at_startup": self.ui.general_defaults_form.general_app_group.shell_startup_cb,
  46. "global_project_at_startup": self.ui.general_defaults_form.general_app_group.project_startup_cb,
  47. "global_version_check": self.ui.general_defaults_form.general_app_group.version_check_cb,
  48. "global_send_stats": self.ui.general_defaults_form.general_app_group.send_stats_cb,
  49. "global_worker_number": self.ui.general_defaults_form.general_app_group.worker_number_sb,
  50. "global_tolerance": self.ui.general_defaults_form.general_app_group.tol_entry,
  51. "global_compression_level": self.ui.general_defaults_form.general_app_group.compress_spinner,
  52. "global_save_compressed": self.ui.general_defaults_form.general_app_group.save_type_cb,
  53. "global_autosave": self.ui.general_defaults_form.general_app_group.autosave_cb,
  54. "global_autosave_timeout": self.ui.general_defaults_form.general_app_group.autosave_entry,
  55. "global_tpdf_tmargin": self.ui.general_defaults_form.general_app_group.tmargin_entry,
  56. "global_tpdf_bmargin": self.ui.general_defaults_form.general_app_group.bmargin_entry,
  57. "global_tpdf_lmargin": self.ui.general_defaults_form.general_app_group.lmargin_entry,
  58. "global_tpdf_rmargin": self.ui.general_defaults_form.general_app_group.rmargin_entry,
  59. # General GUI Preferences
  60. "global_theme": self.ui.general_defaults_form.general_gui_group.theme_radio,
  61. "global_gray_icons": self.ui.general_defaults_form.general_gui_group.gray_icons_cb,
  62. "global_layout": self.ui.general_defaults_form.general_gui_group.layout_combo,
  63. "global_hover": self.ui.general_defaults_form.general_gui_group.hover_cb,
  64. "global_selection_shape": self.ui.general_defaults_form.general_gui_group.selection_cb,
  65. "global_sel_fill": self.ui.general_defaults_form.general_gui_group.sf_color_entry,
  66. "global_sel_line": self.ui.general_defaults_form.general_gui_group.sl_color_entry,
  67. "global_alt_sel_fill": self.ui.general_defaults_form.general_gui_group.alt_sf_color_entry,
  68. "global_alt_sel_line": self.ui.general_defaults_form.general_gui_group.alt_sl_color_entry,
  69. "global_draw_color": self.ui.general_defaults_form.general_gui_group.draw_color_entry,
  70. "global_sel_draw_color": self.ui.general_defaults_form.general_gui_group.sel_draw_color_entry,
  71. "global_proj_item_color": self.ui.general_defaults_form.general_gui_group.proj_color_entry,
  72. "global_proj_item_dis_color": self.ui.general_defaults_form.general_gui_group.proj_color_dis_entry,
  73. "global_project_autohide": self.ui.general_defaults_form.general_gui_group.project_autohide_cb,
  74. # General GUI Settings
  75. "global_gridx": self.ui.general_defaults_form.general_app_set_group.gridx_entry,
  76. "global_gridy": self.ui.general_defaults_form.general_app_set_group.gridy_entry,
  77. "global_snap_max": self.ui.general_defaults_form.general_app_set_group.snap_max_dist_entry,
  78. "global_workspace": self.ui.general_defaults_form.general_app_set_group.workspace_cb,
  79. "global_workspaceT": self.ui.general_defaults_form.general_app_set_group.wk_cb,
  80. "global_workspace_orientation": self.ui.general_defaults_form.general_app_set_group.wk_orientation_radio,
  81. "global_cursor_type": self.ui.general_defaults_form.general_app_set_group.cursor_radio,
  82. "global_cursor_size": self.ui.general_defaults_form.general_app_set_group.cursor_size_entry,
  83. "global_cursor_width": self.ui.general_defaults_form.general_app_set_group.cursor_width_entry,
  84. "global_cursor_color_enabled": self.ui.general_defaults_form.general_app_set_group.mouse_cursor_color_cb,
  85. "global_cursor_color": self.ui.general_defaults_form.general_app_set_group.mouse_cursor_entry,
  86. "global_pan_button": self.ui.general_defaults_form.general_app_set_group.pan_button_radio,
  87. "global_mselect_key": self.ui.general_defaults_form.general_app_set_group.mselect_radio,
  88. "global_delete_confirmation": self.ui.general_defaults_form.general_app_set_group.delete_conf_cb,
  89. "global_open_style": self.ui.general_defaults_form.general_app_set_group.open_style_cb,
  90. "global_toggle_tooltips": self.ui.general_defaults_form.general_app_set_group.toggle_tooltips_cb,
  91. "global_machinist_setting": self.ui.general_defaults_form.general_app_set_group.machinist_cb,
  92. "global_bookmarks_limit": self.ui.general_defaults_form.general_app_set_group.bm_limit_spinner,
  93. "global_activity_icon": self.ui.general_defaults_form.general_app_set_group.activity_combo,
  94. # Gerber General
  95. "gerber_plot": self.ui.gerber_defaults_form.gerber_gen_group.plot_cb,
  96. "gerber_solid": self.ui.gerber_defaults_form.gerber_gen_group.solid_cb,
  97. "gerber_multicolored": self.ui.gerber_defaults_form.gerber_gen_group.multicolored_cb,
  98. "gerber_circle_steps": self.ui.gerber_defaults_form.gerber_gen_group.circle_steps_entry,
  99. "gerber_def_units": self.ui.gerber_defaults_form.gerber_gen_group.gerber_units_radio,
  100. "gerber_def_zeros": self.ui.gerber_defaults_form.gerber_gen_group.gerber_zeros_radio,
  101. "gerber_clean_apertures": self.ui.gerber_defaults_form.gerber_gen_group.gerber_clean_cb,
  102. "gerber_extra_buffering": self.ui.gerber_defaults_form.gerber_gen_group.gerber_extra_buffering,
  103. "gerber_plot_fill": self.ui.gerber_defaults_form.gerber_gen_group.pf_color_entry,
  104. "gerber_plot_line": self.ui.gerber_defaults_form.gerber_gen_group.pl_color_entry,
  105. # Gerber Options
  106. "gerber_isotooldia": self.ui.gerber_defaults_form.gerber_opt_group.iso_tool_dia_entry,
  107. "gerber_isopasses": self.ui.gerber_defaults_form.gerber_opt_group.iso_width_entry,
  108. "gerber_isooverlap": self.ui.gerber_defaults_form.gerber_opt_group.iso_overlap_entry,
  109. "gerber_combine_passes": self.ui.gerber_defaults_form.gerber_opt_group.combine_passes_cb,
  110. "gerber_iso_scope": self.ui.gerber_defaults_form.gerber_opt_group.iso_scope_radio,
  111. "gerber_milling_type": self.ui.gerber_defaults_form.gerber_opt_group.milling_type_radio,
  112. "gerber_noncoppermargin": self.ui.gerber_defaults_form.gerber_opt_group.noncopper_margin_entry,
  113. "gerber_noncopperrounded": self.ui.gerber_defaults_form.gerber_opt_group.noncopper_rounded_cb,
  114. "gerber_bboxmargin": self.ui.gerber_defaults_form.gerber_opt_group.bbmargin_entry,
  115. "gerber_bboxrounded": self.ui.gerber_defaults_form.gerber_opt_group.bbrounded_cb,
  116. # Gerber Advanced Options
  117. "gerber_aperture_display": self.ui.gerber_defaults_form.gerber_adv_opt_group.aperture_table_visibility_cb,
  118. # "gerber_aperture_scale_factor": self.ui.gerber_defaults_form.gerber_adv_opt_group.scale_aperture_entry,
  119. # "gerber_aperture_buffer_factor": self.ui.gerber_defaults_form.gerber_adv_opt_group.buffer_aperture_entry,
  120. "gerber_follow": self.ui.gerber_defaults_form.gerber_adv_opt_group.follow_cb,
  121. "gerber_tool_type": self.ui.gerber_defaults_form.gerber_adv_opt_group.tool_type_radio,
  122. "gerber_vtipdia": self.ui.gerber_defaults_form.gerber_adv_opt_group.tipdia_spinner,
  123. "gerber_vtipangle": self.ui.gerber_defaults_form.gerber_adv_opt_group.tipangle_spinner,
  124. "gerber_vcutz": self.ui.gerber_defaults_form.gerber_adv_opt_group.cutz_spinner,
  125. "gerber_iso_type": self.ui.gerber_defaults_form.gerber_adv_opt_group.iso_type_radio,
  126. "gerber_buffering": self.ui.gerber_defaults_form.gerber_adv_opt_group.buffering_radio,
  127. "gerber_simplification": self.ui.gerber_defaults_form.gerber_adv_opt_group.simplify_cb,
  128. "gerber_simp_tolerance": self.ui.gerber_defaults_form.gerber_adv_opt_group.simplification_tol_spinner,
  129. # Gerber Export
  130. "gerber_exp_units": self.ui.gerber_defaults_form.gerber_exp_group.gerber_units_radio,
  131. "gerber_exp_integer": self.ui.gerber_defaults_form.gerber_exp_group.format_whole_entry,
  132. "gerber_exp_decimals": self.ui.gerber_defaults_form.gerber_exp_group.format_dec_entry,
  133. "gerber_exp_zeros": self.ui.gerber_defaults_form.gerber_exp_group.zeros_radio,
  134. # Gerber Editor
  135. "gerber_editor_sel_limit": self.ui.gerber_defaults_form.gerber_editor_group.sel_limit_entry,
  136. "gerber_editor_newcode": self.ui.gerber_defaults_form.gerber_editor_group.addcode_entry,
  137. "gerber_editor_newsize": self.ui.gerber_defaults_form.gerber_editor_group.addsize_entry,
  138. "gerber_editor_newtype": self.ui.gerber_defaults_form.gerber_editor_group.addtype_combo,
  139. "gerber_editor_newdim": self.ui.gerber_defaults_form.gerber_editor_group.adddim_entry,
  140. "gerber_editor_array_size": self.ui.gerber_defaults_form.gerber_editor_group.grb_array_size_entry,
  141. "gerber_editor_lin_axis": self.ui.gerber_defaults_form.gerber_editor_group.grb_axis_radio,
  142. "gerber_editor_lin_pitch": self.ui.gerber_defaults_form.gerber_editor_group.grb_pitch_entry,
  143. "gerber_editor_lin_angle": self.ui.gerber_defaults_form.gerber_editor_group.grb_angle_entry,
  144. "gerber_editor_circ_dir": self.ui.gerber_defaults_form.gerber_editor_group.grb_circular_dir_radio,
  145. "gerber_editor_circ_angle":
  146. self.ui.gerber_defaults_form.gerber_editor_group.grb_circular_angle_entry,
  147. "gerber_editor_scale_f": self.ui.gerber_defaults_form.gerber_editor_group.grb_scale_entry,
  148. "gerber_editor_buff_f": self.ui.gerber_defaults_form.gerber_editor_group.grb_buff_entry,
  149. "gerber_editor_ma_low": self.ui.gerber_defaults_form.gerber_editor_group.grb_ma_low_entry,
  150. "gerber_editor_ma_high": self.ui.gerber_defaults_form.gerber_editor_group.grb_ma_high_entry,
  151. # Excellon General
  152. "excellon_plot": self.ui.excellon_defaults_form.excellon_gen_group.plot_cb,
  153. "excellon_solid": self.ui.excellon_defaults_form.excellon_gen_group.solid_cb,
  154. "excellon_format_upper_in":
  155. self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_upper_in_entry,
  156. "excellon_format_lower_in":
  157. self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_lower_in_entry,
  158. "excellon_format_upper_mm":
  159. self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_upper_mm_entry,
  160. "excellon_format_lower_mm":
  161. self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_lower_mm_entry,
  162. "excellon_zeros": self.ui.excellon_defaults_form.excellon_gen_group.excellon_zeros_radio,
  163. "excellon_units": self.ui.excellon_defaults_form.excellon_gen_group.excellon_units_radio,
  164. "excellon_update": self.ui.excellon_defaults_form.excellon_gen_group.update_excellon_cb,
  165. "excellon_optimization_type": self.ui.excellon_defaults_form.excellon_gen_group.excellon_optimization_radio,
  166. "excellon_search_time": self.ui.excellon_defaults_form.excellon_gen_group.optimization_time_entry,
  167. "excellon_plot_fill": self.ui.excellon_defaults_form.excellon_gen_group.fill_color_entry,
  168. "excellon_plot_line": self.ui.excellon_defaults_form.excellon_gen_group.line_color_entry,
  169. # Excellon Options
  170. "excellon_operation": self.ui.excellon_defaults_form.excellon_opt_group.operation_radio,
  171. "excellon_milling_type": self.ui.excellon_defaults_form.excellon_opt_group.milling_type_radio,
  172. "excellon_milling_dia": self.ui.excellon_defaults_form.excellon_opt_group.mill_dia_entry,
  173. "excellon_cutz": self.ui.excellon_defaults_form.excellon_opt_group.cutz_entry,
  174. "excellon_multidepth": self.ui.excellon_defaults_form.excellon_opt_group.mpass_cb,
  175. "excellon_depthperpass": self.ui.excellon_defaults_form.excellon_opt_group.maxdepth_entry,
  176. "excellon_travelz": self.ui.excellon_defaults_form.excellon_opt_group.travelz_entry,
  177. "excellon_endz": self.ui.excellon_defaults_form.excellon_opt_group.endz_entry,
  178. "excellon_endxy": self.ui.excellon_defaults_form.excellon_opt_group.endxy_entry,
  179. "excellon_feedrate_z": self.ui.excellon_defaults_form.excellon_opt_group.feedrate_z_entry,
  180. "excellon_spindlespeed": self.ui.excellon_defaults_form.excellon_opt_group.spindlespeed_entry,
  181. "excellon_dwell": self.ui.excellon_defaults_form.excellon_opt_group.dwell_cb,
  182. "excellon_dwelltime": self.ui.excellon_defaults_form.excellon_opt_group.dwelltime_entry,
  183. "excellon_toolchange": self.ui.excellon_defaults_form.excellon_opt_group.toolchange_cb,
  184. "excellon_toolchangez": self.ui.excellon_defaults_form.excellon_opt_group.toolchangez_entry,
  185. "excellon_ppname_e": self.ui.excellon_defaults_form.excellon_opt_group.pp_excellon_name_cb,
  186. "excellon_tooldia": self.ui.excellon_defaults_form.excellon_opt_group.tooldia_entry,
  187. "excellon_slot_tooldia": self.ui.excellon_defaults_form.excellon_opt_group.slot_tooldia_entry,
  188. "excellon_gcode_type": self.ui.excellon_defaults_form.excellon_opt_group.excellon_gcode_type_radio,
  189. # Excellon Advanced Options
  190. "excellon_offset": self.ui.excellon_defaults_form.excellon_adv_opt_group.offset_entry,
  191. "excellon_toolchangexy": self.ui.excellon_defaults_form.excellon_adv_opt_group.toolchangexy_entry,
  192. "excellon_startz": self.ui.excellon_defaults_form.excellon_adv_opt_group.estartz_entry,
  193. "excellon_feedrate_rapid": self.ui.excellon_defaults_form.excellon_adv_opt_group.feedrate_rapid_entry,
  194. "excellon_z_pdepth": self.ui.excellon_defaults_form.excellon_adv_opt_group.pdepth_entry,
  195. "excellon_feedrate_probe": self.ui.excellon_defaults_form.excellon_adv_opt_group.feedrate_probe_entry,
  196. "excellon_spindledir": self.ui.excellon_defaults_form.excellon_adv_opt_group.spindledir_radio,
  197. "excellon_f_plunge": self.ui.excellon_defaults_form.excellon_adv_opt_group.fplunge_cb,
  198. "excellon_f_retract": self.ui.excellon_defaults_form.excellon_adv_opt_group.fretract_cb,
  199. # Excellon Export
  200. "excellon_exp_units": self.ui.excellon_defaults_form.excellon_exp_group.excellon_units_radio,
  201. "excellon_exp_format": self.ui.excellon_defaults_form.excellon_exp_group.format_radio,
  202. "excellon_exp_integer": self.ui.excellon_defaults_form.excellon_exp_group.format_whole_entry,
  203. "excellon_exp_decimals": self.ui.excellon_defaults_form.excellon_exp_group.format_dec_entry,
  204. "excellon_exp_zeros": self.ui.excellon_defaults_form.excellon_exp_group.zeros_radio,
  205. "excellon_exp_slot_type": self.ui.excellon_defaults_form.excellon_exp_group.slot_type_radio,
  206. # Excellon Editor
  207. "excellon_editor_sel_limit": self.ui.excellon_defaults_form.excellon_editor_group.sel_limit_entry,
  208. "excellon_editor_newdia": self.ui.excellon_defaults_form.excellon_editor_group.addtool_entry,
  209. "excellon_editor_array_size": self.ui.excellon_defaults_form.excellon_editor_group.drill_array_size_entry,
  210. "excellon_editor_lin_dir": self.ui.excellon_defaults_form.excellon_editor_group.drill_axis_radio,
  211. "excellon_editor_lin_pitch": self.ui.excellon_defaults_form.excellon_editor_group.drill_pitch_entry,
  212. "excellon_editor_lin_angle": self.ui.excellon_defaults_form.excellon_editor_group.drill_angle_entry,
  213. "excellon_editor_circ_dir": self.ui.excellon_defaults_form.excellon_editor_group.drill_circular_dir_radio,
  214. "excellon_editor_circ_angle":
  215. self.ui.excellon_defaults_form.excellon_editor_group.drill_circular_angle_entry,
  216. # Excellon Slots
  217. "excellon_editor_slot_direction":
  218. self.ui.excellon_defaults_form.excellon_editor_group.slot_axis_radio,
  219. "excellon_editor_slot_angle":
  220. self.ui.excellon_defaults_form.excellon_editor_group.slot_angle_spinner,
  221. "excellon_editor_slot_length":
  222. self.ui.excellon_defaults_form.excellon_editor_group.slot_length_entry,
  223. # Excellon Slots
  224. "excellon_editor_slot_array_size":
  225. self.ui.excellon_defaults_form.excellon_editor_group.slot_array_size_entry,
  226. "excellon_editor_slot_lin_dir": self.ui.excellon_defaults_form.excellon_editor_group.slot_array_axis_radio,
  227. "excellon_editor_slot_lin_pitch":
  228. self.ui.excellon_defaults_form.excellon_editor_group.slot_array_pitch_entry,
  229. "excellon_editor_slot_lin_angle":
  230. self.ui.excellon_defaults_form.excellon_editor_group.slot_array_angle_entry,
  231. "excellon_editor_slot_circ_dir":
  232. self.ui.excellon_defaults_form.excellon_editor_group.slot_array_circular_dir_radio,
  233. "excellon_editor_slot_circ_angle":
  234. self.ui.excellon_defaults_form.excellon_editor_group.slot_array_circular_angle_entry,
  235. # Geometry General
  236. "geometry_plot": self.ui.geometry_defaults_form.geometry_gen_group.plot_cb,
  237. "geometry_circle_steps": self.ui.geometry_defaults_form.geometry_gen_group.circle_steps_entry,
  238. "geometry_cnctooldia": self.ui.geometry_defaults_form.geometry_gen_group.cnctooldia_entry,
  239. "geometry_plot_line": self.ui.geometry_defaults_form.geometry_gen_group.line_color_entry,
  240. # Geometry Options
  241. "geometry_cutz": self.ui.geometry_defaults_form.geometry_opt_group.cutz_entry,
  242. "geometry_travelz": self.ui.geometry_defaults_form.geometry_opt_group.travelz_entry,
  243. "geometry_feedrate": self.ui.geometry_defaults_form.geometry_opt_group.cncfeedrate_entry,
  244. "geometry_feedrate_z": self.ui.geometry_defaults_form.geometry_opt_group.feedrate_z_entry,
  245. "geometry_spindlespeed": self.ui.geometry_defaults_form.geometry_opt_group.cncspindlespeed_entry,
  246. "geometry_dwell": self.ui.geometry_defaults_form.geometry_opt_group.dwell_cb,
  247. "geometry_dwelltime": self.ui.geometry_defaults_form.geometry_opt_group.dwelltime_entry,
  248. "geometry_ppname_g": self.ui.geometry_defaults_form.geometry_opt_group.pp_geometry_name_cb,
  249. "geometry_toolchange": self.ui.geometry_defaults_form.geometry_opt_group.toolchange_cb,
  250. "geometry_toolchangez": self.ui.geometry_defaults_form.geometry_opt_group.toolchangez_entry,
  251. "geometry_endz": self.ui.geometry_defaults_form.geometry_opt_group.endz_entry,
  252. "geometry_endxy": self.ui.geometry_defaults_form.geometry_opt_group.endxy_entry,
  253. "geometry_depthperpass": self.ui.geometry_defaults_form.geometry_opt_group.depthperpass_entry,
  254. "geometry_multidepth": self.ui.geometry_defaults_form.geometry_opt_group.multidepth_cb,
  255. # Geometry Advanced Options
  256. "geometry_toolchangexy": self.ui.geometry_defaults_form.geometry_adv_opt_group.toolchangexy_entry,
  257. "geometry_startz": self.ui.geometry_defaults_form.geometry_adv_opt_group.gstartz_entry,
  258. "geometry_feedrate_rapid": self.ui.geometry_defaults_form.geometry_adv_opt_group.feedrate_rapid_entry,
  259. "geometry_extracut": self.ui.geometry_defaults_form.geometry_adv_opt_group.extracut_cb,
  260. "geometry_extracut_length": self.ui.geometry_defaults_form.geometry_adv_opt_group.e_cut_entry,
  261. "geometry_z_pdepth": self.ui.geometry_defaults_form.geometry_adv_opt_group.pdepth_entry,
  262. "geometry_feedrate_probe": self.ui.geometry_defaults_form.geometry_adv_opt_group.feedrate_probe_entry,
  263. "geometry_spindledir": self.ui.geometry_defaults_form.geometry_adv_opt_group.spindledir_radio,
  264. "geometry_f_plunge": self.ui.geometry_defaults_form.geometry_adv_opt_group.fplunge_cb,
  265. "geometry_segx": self.ui.geometry_defaults_form.geometry_adv_opt_group.segx_entry,
  266. "geometry_segy": self.ui.geometry_defaults_form.geometry_adv_opt_group.segy_entry,
  267. # Geometry Editor
  268. "geometry_editor_sel_limit": self.ui.geometry_defaults_form.geometry_editor_group.sel_limit_entry,
  269. "geometry_editor_milling_type": self.ui.geometry_defaults_form.geometry_editor_group.milling_type_radio,
  270. # CNCJob General
  271. "cncjob_plot": self.ui.cncjob_defaults_form.cncjob_gen_group.plot_cb,
  272. "cncjob_plot_kind": self.ui.cncjob_defaults_form.cncjob_gen_group.cncplot_method_radio,
  273. "cncjob_annotation": self.ui.cncjob_defaults_form.cncjob_gen_group.annotation_cb,
  274. "cncjob_tooldia": self.ui.cncjob_defaults_form.cncjob_gen_group.tooldia_entry,
  275. "cncjob_coords_type": self.ui.cncjob_defaults_form.cncjob_gen_group.coords_type_radio,
  276. "cncjob_coords_decimals": self.ui.cncjob_defaults_form.cncjob_gen_group.coords_dec_entry,
  277. "cncjob_fr_decimals": self.ui.cncjob_defaults_form.cncjob_gen_group.fr_dec_entry,
  278. "cncjob_steps_per_circle": self.ui.cncjob_defaults_form.cncjob_gen_group.steps_per_circle_entry,
  279. "cncjob_line_ending": self.ui.cncjob_defaults_form.cncjob_gen_group.line_ending_cb,
  280. "cncjob_plot_line": self.ui.cncjob_defaults_form.cncjob_gen_group.line_color_entry,
  281. "cncjob_plot_fill": self.ui.cncjob_defaults_form.cncjob_gen_group.fill_color_entry,
  282. "cncjob_travel_line": self.ui.cncjob_defaults_form.cncjob_gen_group.tline_color_entry,
  283. "cncjob_travel_fill": self.ui.cncjob_defaults_form.cncjob_gen_group.tfill_color_entry,
  284. # CNC Job Options
  285. "cncjob_prepend": self.ui.cncjob_defaults_form.cncjob_opt_group.prepend_text,
  286. "cncjob_append": self.ui.cncjob_defaults_form.cncjob_opt_group.append_text,
  287. # CNC Job Advanced Options
  288. "cncjob_toolchange_macro": self.ui.cncjob_defaults_form.cncjob_adv_opt_group.toolchange_text,
  289. "cncjob_toolchange_macro_enable": self.ui.cncjob_defaults_form.cncjob_adv_opt_group.toolchange_cb,
  290. "cncjob_annotation_fontsize": self.ui.cncjob_defaults_form.cncjob_adv_opt_group.annotation_fontsize_sp,
  291. "cncjob_annotation_fontcolor": self.ui.cncjob_defaults_form.cncjob_adv_opt_group.annotation_fontcolor_entry,
  292. # NCC Tool
  293. "tools_ncctools": self.ui.tools_defaults_form.tools_ncc_group.ncc_tool_dia_entry,
  294. "tools_nccorder": self.ui.tools_defaults_form.tools_ncc_group.ncc_order_radio,
  295. "tools_nccoverlap": self.ui.tools_defaults_form.tools_ncc_group.ncc_overlap_entry,
  296. "tools_nccmargin": self.ui.tools_defaults_form.tools_ncc_group.ncc_margin_entry,
  297. "tools_nccmethod": self.ui.tools_defaults_form.tools_ncc_group.ncc_method_combo,
  298. "tools_nccconnect": self.ui.tools_defaults_form.tools_ncc_group.ncc_connect_cb,
  299. "tools_ncccontour": self.ui.tools_defaults_form.tools_ncc_group.ncc_contour_cb,
  300. "tools_nccrest": self.ui.tools_defaults_form.tools_ncc_group.ncc_rest_cb,
  301. "tools_ncc_offset_choice": self.ui.tools_defaults_form.tools_ncc_group.ncc_choice_offset_cb,
  302. "tools_ncc_offset_value": self.ui.tools_defaults_form.tools_ncc_group.ncc_offset_spinner,
  303. "tools_nccref": self.ui.tools_defaults_form.tools_ncc_group.select_combo,
  304. "tools_ncc_area_shape": self.ui.tools_defaults_form.tools_ncc_group.area_shape_radio,
  305. "tools_ncc_plotting": self.ui.tools_defaults_form.tools_ncc_group.ncc_plotting_radio,
  306. "tools_nccmilling_type": self.ui.tools_defaults_form.tools_ncc_group.milling_type_radio,
  307. "tools_ncctool_type": self.ui.tools_defaults_form.tools_ncc_group.tool_type_radio,
  308. "tools_ncccutz": self.ui.tools_defaults_form.tools_ncc_group.cutz_entry,
  309. "tools_ncctipdia": self.ui.tools_defaults_form.tools_ncc_group.tipdia_entry,
  310. "tools_ncctipangle": self.ui.tools_defaults_form.tools_ncc_group.tipangle_entry,
  311. "tools_nccnewdia": self.ui.tools_defaults_form.tools_ncc_group.newdia_entry,
  312. # CutOut Tool
  313. "tools_cutouttooldia": self.ui.tools_defaults_form.tools_cutout_group.cutout_tooldia_entry,
  314. "tools_cutoutkind": self.ui.tools_defaults_form.tools_cutout_group.obj_kind_combo,
  315. "tools_cutoutmargin": self.ui.tools_defaults_form.tools_cutout_group.cutout_margin_entry,
  316. "tools_cutout_z": self.ui.tools_defaults_form.tools_cutout_group.cutz_entry,
  317. "tools_cutout_depthperpass": self.ui.tools_defaults_form.tools_cutout_group.maxdepth_entry,
  318. "tools_cutout_mdepth": self.ui.tools_defaults_form.tools_cutout_group.mpass_cb,
  319. "tools_cutoutgapsize": self.ui.tools_defaults_form.tools_cutout_group.cutout_gap_entry,
  320. "tools_gaps_ff": self.ui.tools_defaults_form.tools_cutout_group.gaps_combo,
  321. "tools_cutout_convexshape": self.ui.tools_defaults_form.tools_cutout_group.convex_box,
  322. # Paint Area Tool
  323. "tools_painttooldia": self.ui.tools_defaults_form.tools_paint_group.painttooldia_entry,
  324. "tools_paintorder": self.ui.tools_defaults_form.tools_paint_group.paint_order_radio,
  325. "tools_paintoverlap": self.ui.tools_defaults_form.tools_paint_group.paintoverlap_entry,
  326. "tools_paintmargin": self.ui.tools_defaults_form.tools_paint_group.paintmargin_entry,
  327. "tools_paintmethod": self.ui.tools_defaults_form.tools_paint_group.paintmethod_combo,
  328. "tools_selectmethod": self.ui.tools_defaults_form.tools_paint_group.selectmethod_combo,
  329. "tools_paint_area_shape": self.ui.tools_defaults_form.tools_paint_group.area_shape_radio,
  330. "tools_pathconnect": self.ui.tools_defaults_form.tools_paint_group.pathconnect_cb,
  331. "tools_paintcontour": self.ui.tools_defaults_form.tools_paint_group.contour_cb,
  332. "tools_paint_plotting": self.ui.tools_defaults_form.tools_paint_group.paint_plotting_radio,
  333. "tools_paintrest": self.ui.tools_defaults_form.tools_paint_group.rest_cb,
  334. "tools_painttool_type": self.ui.tools_defaults_form.tools_paint_group.tool_type_radio,
  335. "tools_paintcutz": self.ui.tools_defaults_form.tools_paint_group.cutz_entry,
  336. "tools_painttipdia": self.ui.tools_defaults_form.tools_paint_group.tipdia_entry,
  337. "tools_painttipangle": self.ui.tools_defaults_form.tools_paint_group.tipangle_entry,
  338. "tools_paintnewdia": self.ui.tools_defaults_form.tools_paint_group.newdia_entry,
  339. # 2-sided Tool
  340. "tools_2sided_mirror_axis": self.ui.tools_defaults_form.tools_2sided_group.mirror_axis_radio,
  341. "tools_2sided_axis_loc": self.ui.tools_defaults_form.tools_2sided_group.axis_location_radio,
  342. "tools_2sided_drilldia": self.ui.tools_defaults_form.tools_2sided_group.drill_dia_entry,
  343. "tools_2sided_allign_axis": self.ui.tools_defaults_form.tools_2sided_group.align_axis_radio,
  344. # Film Tool
  345. "tools_film_type": self.ui.tools_defaults_form.tools_film_group.film_type_radio,
  346. "tools_film_boundary": self.ui.tools_defaults_form.tools_film_group.film_boundary_entry,
  347. "tools_film_scale_stroke": self.ui.tools_defaults_form.tools_film_group.film_scale_stroke_entry,
  348. "tools_film_color": self.ui.tools_defaults_form.tools_film_group.film_color_entry,
  349. "tools_film_scale_cb": self.ui.tools_defaults_form.tools_film_group.film_scale_cb,
  350. "tools_film_scale_x_entry": self.ui.tools_defaults_form.tools_film_group.film_scalex_entry,
  351. "tools_film_scale_y_entry": self.ui.tools_defaults_form.tools_film_group.film_scaley_entry,
  352. "tools_film_skew_cb": self.ui.tools_defaults_form.tools_film_group.film_skew_cb,
  353. "tools_film_skew_x_entry": self.ui.tools_defaults_form.tools_film_group.film_skewx_entry,
  354. "tools_film_skew_y_entry": self.ui.tools_defaults_form.tools_film_group.film_skewy_entry,
  355. "tools_film_skew_ref_radio": self.ui.tools_defaults_form.tools_film_group.film_skew_reference,
  356. "tools_film_mirror_cb": self.ui.tools_defaults_form.tools_film_group.film_mirror_cb,
  357. "tools_film_mirror_axis_radio": self.ui.tools_defaults_form.tools_film_group.film_mirror_axis,
  358. "tools_film_file_type_radio": self.ui.tools_defaults_form.tools_film_group.file_type_radio,
  359. "tools_film_orientation": self.ui.tools_defaults_form.tools_film_group.orientation_radio,
  360. "tools_film_pagesize": self.ui.tools_defaults_form.tools_film_group.pagesize_combo,
  361. # Panelize Tool
  362. "tools_panelize_spacing_columns": self.ui.tools_defaults_form.tools_panelize_group.pspacing_columns,
  363. "tools_panelize_spacing_rows": self.ui.tools_defaults_form.tools_panelize_group.pspacing_rows,
  364. "tools_panelize_columns": self.ui.tools_defaults_form.tools_panelize_group.pcolumns,
  365. "tools_panelize_rows": self.ui.tools_defaults_form.tools_panelize_group.prows,
  366. "tools_panelize_constrain": self.ui.tools_defaults_form.tools_panelize_group.pconstrain_cb,
  367. "tools_panelize_constrainx": self.ui.tools_defaults_form.tools_panelize_group.px_width_entry,
  368. "tools_panelize_constrainy": self.ui.tools_defaults_form.tools_panelize_group.py_height_entry,
  369. "tools_panelize_panel_type": self.ui.tools_defaults_form.tools_panelize_group.panel_type_radio,
  370. # Calculators Tool
  371. "tools_calc_vshape_tip_dia": self.ui.tools_defaults_form.tools_calculators_group.tip_dia_entry,
  372. "tools_calc_vshape_tip_angle": self.ui.tools_defaults_form.tools_calculators_group.tip_angle_entry,
  373. "tools_calc_vshape_cut_z": self.ui.tools_defaults_form.tools_calculators_group.cut_z_entry,
  374. "tools_calc_electro_length": self.ui.tools_defaults_form.tools_calculators_group.pcblength_entry,
  375. "tools_calc_electro_width": self.ui.tools_defaults_form.tools_calculators_group.pcbwidth_entry,
  376. "tools_calc_electro_cdensity": self.ui.tools_defaults_form.tools_calculators_group.cdensity_entry,
  377. "tools_calc_electro_growth": self.ui.tools_defaults_form.tools_calculators_group.growth_entry,
  378. # Transformations Tool
  379. "tools_transform_rotate": self.ui.tools_defaults_form.tools_transform_group.rotate_entry,
  380. "tools_transform_skew_x": self.ui.tools_defaults_form.tools_transform_group.skewx_entry,
  381. "tools_transform_skew_y": self.ui.tools_defaults_form.tools_transform_group.skewy_entry,
  382. "tools_transform_scale_x": self.ui.tools_defaults_form.tools_transform_group.scalex_entry,
  383. "tools_transform_scale_y": self.ui.tools_defaults_form.tools_transform_group.scaley_entry,
  384. "tools_transform_scale_link": self.ui.tools_defaults_form.tools_transform_group.link_cb,
  385. "tools_transform_scale_reference": self.ui.tools_defaults_form.tools_transform_group.reference_cb,
  386. "tools_transform_offset_x": self.ui.tools_defaults_form.tools_transform_group.offx_entry,
  387. "tools_transform_offset_y": self.ui.tools_defaults_form.tools_transform_group.offy_entry,
  388. "tools_transform_mirror_reference": self.ui.tools_defaults_form.tools_transform_group.mirror_reference_cb,
  389. "tools_transform_mirror_point": self.ui.tools_defaults_form.tools_transform_group.flip_ref_entry,
  390. "tools_transform_buffer_dis": self.ui.tools_defaults_form.tools_transform_group.buffer_entry,
  391. "tools_transform_buffer_factor": self.ui.tools_defaults_form.tools_transform_group.buffer_factor_entry,
  392. "tools_transform_buffer_corner": self.ui.tools_defaults_form.tools_transform_group.buffer_rounded_cb,
  393. # SolderPaste Dispensing Tool
  394. "tools_solderpaste_tools": self.ui.tools_defaults_form.tools_solderpaste_group.nozzle_tool_dia_entry,
  395. "tools_solderpaste_new": self.ui.tools_defaults_form.tools_solderpaste_group.addtool_entry,
  396. "tools_solderpaste_z_start": self.ui.tools_defaults_form.tools_solderpaste_group.z_start_entry,
  397. "tools_solderpaste_z_dispense": self.ui.tools_defaults_form.tools_solderpaste_group.z_dispense_entry,
  398. "tools_solderpaste_z_stop": self.ui.tools_defaults_form.tools_solderpaste_group.z_stop_entry,
  399. "tools_solderpaste_z_travel": self.ui.tools_defaults_form.tools_solderpaste_group.z_travel_entry,
  400. "tools_solderpaste_z_toolchange": self.ui.tools_defaults_form.tools_solderpaste_group.z_toolchange_entry,
  401. "tools_solderpaste_xy_toolchange": self.ui.tools_defaults_form.tools_solderpaste_group.xy_toolchange_entry,
  402. "tools_solderpaste_frxy": self.ui.tools_defaults_form.tools_solderpaste_group.frxy_entry,
  403. "tools_solderpaste_frz": self.ui.tools_defaults_form.tools_solderpaste_group.frz_entry,
  404. "tools_solderpaste_frz_dispense": self.ui.tools_defaults_form.tools_solderpaste_group.frz_dispense_entry,
  405. "tools_solderpaste_speedfwd": self.ui.tools_defaults_form.tools_solderpaste_group.speedfwd_entry,
  406. "tools_solderpaste_dwellfwd": self.ui.tools_defaults_form.tools_solderpaste_group.dwellfwd_entry,
  407. "tools_solderpaste_speedrev": self.ui.tools_defaults_form.tools_solderpaste_group.speedrev_entry,
  408. "tools_solderpaste_dwellrev": self.ui.tools_defaults_form.tools_solderpaste_group.dwellrev_entry,
  409. "tools_solderpaste_pp": self.ui.tools_defaults_form.tools_solderpaste_group.pp_combo,
  410. "tools_sub_close_paths": self.ui.tools_defaults_form.tools_sub_group.close_paths_cb,
  411. # #######################################################################################################
  412. # ########################################## TOOLS 2 ####################################################
  413. # #######################################################################################################
  414. # Optimal Tool
  415. "tools_opt_precision": self.ui.tools2_defaults_form.tools2_optimal_group.precision_sp,
  416. # Check Rules Tool
  417. "tools_cr_trace_size": self.ui.tools2_defaults_form.tools2_checkrules_group.trace_size_cb,
  418. "tools_cr_trace_size_val": self.ui.tools2_defaults_form.tools2_checkrules_group.trace_size_entry,
  419. "tools_cr_c2c": self.ui.tools2_defaults_form.tools2_checkrules_group.clearance_copper2copper_cb,
  420. "tools_cr_c2c_val": self.ui.tools2_defaults_form.tools2_checkrules_group.clearance_copper2copper_entry,
  421. "tools_cr_c2o": self.ui.tools2_defaults_form.tools2_checkrules_group.clearance_copper2ol_cb,
  422. "tools_cr_c2o_val": self.ui.tools2_defaults_form.tools2_checkrules_group.clearance_copper2ol_entry,
  423. "tools_cr_s2s": self.ui.tools2_defaults_form.tools2_checkrules_group.clearance_silk2silk_cb,
  424. "tools_cr_s2s_val": self.ui.tools2_defaults_form.tools2_checkrules_group.clearance_silk2silk_entry,
  425. "tools_cr_s2sm": self.ui.tools2_defaults_form.tools2_checkrules_group.clearance_silk2sm_cb,
  426. "tools_cr_s2sm_val": self.ui.tools2_defaults_form.tools2_checkrules_group.clearance_silk2sm_entry,
  427. "tools_cr_s2o": self.ui.tools2_defaults_form.tools2_checkrules_group.clearance_silk2ol_cb,
  428. "tools_cr_s2o_val": self.ui.tools2_defaults_form.tools2_checkrules_group.clearance_silk2ol_entry,
  429. "tools_cr_sm2sm": self.ui.tools2_defaults_form.tools2_checkrules_group.clearance_sm2sm_cb,
  430. "tools_cr_sm2sm_val": self.ui.tools2_defaults_form.tools2_checkrules_group.clearance_sm2sm_entry,
  431. "tools_cr_ri": self.ui.tools2_defaults_form.tools2_checkrules_group.ring_integrity_cb,
  432. "tools_cr_ri_val": self.ui.tools2_defaults_form.tools2_checkrules_group.ring_integrity_entry,
  433. "tools_cr_h2h": self.ui.tools2_defaults_form.tools2_checkrules_group.clearance_d2d_cb,
  434. "tools_cr_h2h_val": self.ui.tools2_defaults_form.tools2_checkrules_group.clearance_d2d_entry,
  435. "tools_cr_dh": self.ui.tools2_defaults_form.tools2_checkrules_group.drill_size_cb,
  436. "tools_cr_dh_val": self.ui.tools2_defaults_form.tools2_checkrules_group.drill_size_entry,
  437. # QRCode Tool
  438. "tools_qrcode_version": self.ui.tools2_defaults_form.tools2_qrcode_group.version_entry,
  439. "tools_qrcode_error": self.ui.tools2_defaults_form.tools2_qrcode_group.error_radio,
  440. "tools_qrcode_box_size": self.ui.tools2_defaults_form.tools2_qrcode_group.bsize_entry,
  441. "tools_qrcode_border_size": self.ui.tools2_defaults_form.tools2_qrcode_group.border_size_entry,
  442. "tools_qrcode_qrdata": self.ui.tools2_defaults_form.tools2_qrcode_group.text_data,
  443. "tools_qrcode_polarity": self.ui.tools2_defaults_form.tools2_qrcode_group.pol_radio,
  444. "tools_qrcode_rounded": self.ui.tools2_defaults_form.tools2_qrcode_group.bb_radio,
  445. "tools_qrcode_fill_color": self.ui.tools2_defaults_form.tools2_qrcode_group.fill_color_entry,
  446. "tools_qrcode_back_color": self.ui.tools2_defaults_form.tools2_qrcode_group.back_color_entry,
  447. "tools_qrcode_sel_limit": self.ui.tools2_defaults_form.tools2_qrcode_group.sel_limit_entry,
  448. # Copper Thieving Tool
  449. "tools_copper_thieving_clearance": self.ui.tools2_defaults_form.tools2_cfill_group.clearance_entry,
  450. "tools_copper_thieving_margin": self.ui.tools2_defaults_form.tools2_cfill_group.margin_entry,
  451. "tools_copper_thieving_reference": self.ui.tools2_defaults_form.tools2_cfill_group.reference_radio,
  452. "tools_copper_thieving_box_type": self.ui.tools2_defaults_form.tools2_cfill_group.bbox_type_radio,
  453. "tools_copper_thieving_circle_steps": self.ui.tools2_defaults_form.tools2_cfill_group.circlesteps_entry,
  454. "tools_copper_thieving_fill_type": self.ui.tools2_defaults_form.tools2_cfill_group.fill_type_radio,
  455. "tools_copper_thieving_dots_dia": self.ui.tools2_defaults_form.tools2_cfill_group.dot_dia_entry,
  456. "tools_copper_thieving_dots_spacing": self.ui.tools2_defaults_form.tools2_cfill_group.dot_spacing_entry,
  457. "tools_copper_thieving_squares_size": self.ui.tools2_defaults_form.tools2_cfill_group.square_size_entry,
  458. "tools_copper_thieving_squares_spacing":
  459. self.ui.tools2_defaults_form.tools2_cfill_group.squares_spacing_entry,
  460. "tools_copper_thieving_lines_size": self.ui.tools2_defaults_form.tools2_cfill_group.line_size_entry,
  461. "tools_copper_thieving_lines_spacing": self.ui.tools2_defaults_form.tools2_cfill_group.lines_spacing_entry,
  462. "tools_copper_thieving_rb_margin": self.ui.tools2_defaults_form.tools2_cfill_group.rb_margin_entry,
  463. "tools_copper_thieving_rb_thickness": self.ui.tools2_defaults_form.tools2_cfill_group.rb_thickness_entry,
  464. "tools_copper_thieving_mask_clearance": self.ui.tools2_defaults_form.tools2_cfill_group.clearance_ppm_entry,
  465. # Fiducials Tool
  466. "tools_fiducials_dia": self.ui.tools2_defaults_form.tools2_fiducials_group.dia_entry,
  467. "tools_fiducials_margin": self.ui.tools2_defaults_form.tools2_fiducials_group.margin_entry,
  468. "tools_fiducials_mode": self.ui.tools2_defaults_form.tools2_fiducials_group.mode_radio,
  469. "tools_fiducials_second_pos": self.ui.tools2_defaults_form.tools2_fiducials_group.pos_radio,
  470. "tools_fiducials_type": self.ui.tools2_defaults_form.tools2_fiducials_group.fid_type_radio,
  471. "tools_fiducials_line_thickness": self.ui.tools2_defaults_form.tools2_fiducials_group.line_thickness_entry,
  472. # Calibration Tool
  473. "tools_cal_calsource": self.ui.tools2_defaults_form.tools2_cal_group.cal_source_radio,
  474. "tools_cal_travelz": self.ui.tools2_defaults_form.tools2_cal_group.travelz_entry,
  475. "tools_cal_verz": self.ui.tools2_defaults_form.tools2_cal_group.verz_entry,
  476. "tools_cal_zeroz": self.ui.tools2_defaults_form.tools2_cal_group.zeroz_cb,
  477. "tools_cal_toolchangez": self.ui.tools2_defaults_form.tools2_cal_group.toolchangez_entry,
  478. "tools_cal_toolchange_xy": self.ui.tools2_defaults_form.tools2_cal_group.toolchange_xy_entry,
  479. "tools_cal_sec_point": self.ui.tools2_defaults_form.tools2_cal_group.second_point_radio,
  480. # Extract Drills Tool
  481. "tools_edrills_hole_type": self.ui.tools2_defaults_form.tools2_edrills_group.hole_size_radio,
  482. "tools_edrills_hole_fixed_dia": self.ui.tools2_defaults_form.tools2_edrills_group.dia_entry,
  483. "tools_edrills_hole_prop_factor": self.ui.tools2_defaults_form.tools2_edrills_group.factor_entry,
  484. "tools_edrills_circular_ring": self.ui.tools2_defaults_form.tools2_edrills_group.circular_ring_entry,
  485. "tools_edrills_oblong_ring": self.ui.tools2_defaults_form.tools2_edrills_group.oblong_ring_entry,
  486. "tools_edrills_square_ring": self.ui.tools2_defaults_form.tools2_edrills_group.square_ring_entry,
  487. "tools_edrills_rectangular_ring": self.ui.tools2_defaults_form.tools2_edrills_group.rectangular_ring_entry,
  488. "tools_edrills_others_ring": self.ui.tools2_defaults_form.tools2_edrills_group.other_ring_entry,
  489. "tools_edrills_circular": self.ui.tools2_defaults_form.tools2_edrills_group.circular_cb,
  490. "tools_edrills_oblong": self.ui.tools2_defaults_form.tools2_edrills_group.oblong_cb,
  491. "tools_edrills_square": self.ui.tools2_defaults_form.tools2_edrills_group.square_cb,
  492. "tools_edrills_rectangular": self.ui.tools2_defaults_form.tools2_edrills_group.rectangular_cb,
  493. "tools_edrills_others": self.ui.tools2_defaults_form.tools2_edrills_group.other_cb,
  494. # Punch Gerber Tool
  495. "tools_punch_hole_type": self.ui.tools2_defaults_form.tools2_punch_group.hole_size_radio,
  496. "tools_punch_hole_fixed_dia": self.ui.tools2_defaults_form.tools2_punch_group.dia_entry,
  497. "tools_punch_hole_prop_factor": self.ui.tools2_defaults_form.tools2_punch_group.factor_entry,
  498. "tools_punch_circular_ring": self.ui.tools2_defaults_form.tools2_punch_group.circular_ring_entry,
  499. "tools_punch_oblong_ring": self.ui.tools2_defaults_form.tools2_punch_group.oblong_ring_entry,
  500. "tools_punch_square_ring": self.ui.tools2_defaults_form.tools2_punch_group.square_ring_entry,
  501. "tools_punch_rectangular_ring": self.ui.tools2_defaults_form.tools2_punch_group.rectangular_ring_entry,
  502. "tools_punch_others_ring": self.ui.tools2_defaults_form.tools2_punch_group.other_ring_entry,
  503. "tools_punch_circular": self.ui.tools2_defaults_form.tools2_punch_group.circular_cb,
  504. "tools_punch_oblong": self.ui.tools2_defaults_form.tools2_punch_group.oblong_cb,
  505. "tools_punch_square": self.ui.tools2_defaults_form.tools2_punch_group.square_cb,
  506. "tools_punch_rectangular": self.ui.tools2_defaults_form.tools2_punch_group.rectangular_cb,
  507. "tools_punch_others": self.ui.tools2_defaults_form.tools2_punch_group.other_cb,
  508. # Invert Gerber Tool
  509. "tools_invert_margin": self.ui.tools2_defaults_form.tools2_invert_group.margin_entry,
  510. "tools_invert_join_style": self.ui.tools2_defaults_form.tools2_invert_group.join_radio,
  511. # Utilities
  512. # File associations
  513. "fa_excellon": self.ui.util_defaults_form.fa_excellon_group.exc_list_text,
  514. "fa_gcode": self.ui.util_defaults_form.fa_gcode_group.gco_list_text,
  515. # "fa_geometry": self.ui.util_defaults_form.fa_geometry_group.close_paths_cb,
  516. "fa_gerber": self.ui.util_defaults_form.fa_gerber_group.grb_list_text,
  517. "util_autocomplete_keywords": self.ui.util_defaults_form.kw_group.kw_list_text,
  518. }
  519. def defaults_read_form(self):
  520. """
  521. Will read all the values in the Preferences GUI and update the defaults dictionary.
  522. :return: None
  523. """
  524. for option in self.defaults_form_fields:
  525. try:
  526. self.defaults[option] = self.defaults_form_fields[option].get_value()
  527. except Exception as e:
  528. log.debug("App.defaults_read_form() --> %s" % str(e))
  529. def defaults_write_form(self, factor=None, fl_units=None, source_dict=None):
  530. """
  531. Will set the values for all the GUI elements in Preferences GUI based on the values found in the
  532. self.defaults dictionary.
  533. :param factor: will apply a factor to the values that written in the GUI elements
  534. :param fl_units: current measuring units in FlatCAM: Metric or Inch
  535. :param source_dict: the repository of options, usually is the self.defaults
  536. :return: None
  537. """
  538. options_storage = self.defaults if source_dict is None else source_dict
  539. for option in options_storage:
  540. if source_dict:
  541. self.defaults_write_form_field(option, factor=factor, units=fl_units, defaults_dict=source_dict)
  542. else:
  543. self.defaults_write_form_field(option, factor=factor, units=fl_units)
  544. def defaults_write_form_field(self, field, factor=None, units=None, defaults_dict=None):
  545. """
  546. Basically it is the worker in the self.defaults_write_form()
  547. :param field: the GUI element in Preferences GUI to be updated
  548. :param factor: factor to be applied to the field parameter
  549. :param units: current FLatCAM measuring units
  550. :param defaults_dict: the defaults storage
  551. :return: None, it updates GUI elements
  552. """
  553. def_dict = self.defaults if defaults_dict is None else defaults_dict
  554. try:
  555. if factor is None:
  556. if units is None:
  557. self.defaults_form_fields[field].set_value(def_dict[field])
  558. elif units == 'IN' and (field == 'global_gridx' or field == 'global_gridy'):
  559. self.defaults_form_fields[field].set_value(def_dict[field])
  560. elif units == 'MM' and (field == 'global_gridx' or field == 'global_gridy'):
  561. self.defaults_form_fields[field].set_value(def_dict[field])
  562. else:
  563. if units is None:
  564. self.defaults_form_fields[field].set_value(def_dict[field] * factor)
  565. elif units == 'IN' and (field == 'global_gridx' or field == 'global_gridy'):
  566. self.defaults_form_fields[field].set_value((def_dict[field] * factor))
  567. elif units == 'MM' and (field == 'global_gridx' or field == 'global_gridy'):
  568. self.defaults_form_fields[field].set_value((def_dict[field] * factor))
  569. except KeyError:
  570. pass
  571. except AttributeError:
  572. log.debug(field)
  573. def show_preferences_gui(self):
  574. """
  575. Called to initialize and show the Preferences GUI
  576. :return: None
  577. """
  578. gen_form = self.ui.general_defaults_form
  579. try:
  580. self.ui.general_scroll_area.takeWidget()
  581. except Exception:
  582. log.debug("Nothing to remove")
  583. self.ui.general_scroll_area.setWidget(gen_form)
  584. gen_form.show()
  585. ger_form = self.ui.gerber_defaults_form
  586. try:
  587. self.ui.gerber_scroll_area.takeWidget()
  588. except Exception:
  589. log.debug("Nothing to remove")
  590. self.ui.gerber_scroll_area.setWidget(ger_form)
  591. ger_form.show()
  592. exc_form = self.ui.excellon_defaults_form
  593. try:
  594. self.ui.excellon_scroll_area.takeWidget()
  595. except Exception:
  596. log.debug("Nothing to remove")
  597. self.ui.excellon_scroll_area.setWidget(exc_form)
  598. exc_form.show()
  599. geo_form = self.ui.geometry_defaults_form
  600. try:
  601. self.ui.geometry_scroll_area.takeWidget()
  602. except Exception:
  603. log.debug("Nothing to remove")
  604. self.ui.geometry_scroll_area.setWidget(geo_form)
  605. geo_form.show()
  606. cnc_form = self.ui.cncjob_defaults_form
  607. try:
  608. self.ui.cncjob_scroll_area.takeWidget()
  609. except Exception:
  610. log.debug("Nothing to remove")
  611. self.ui.cncjob_scroll_area.setWidget(cnc_form)
  612. cnc_form.show()
  613. tools_form = self.ui.tools_defaults_form
  614. try:
  615. self.ui.tools_scroll_area.takeWidget()
  616. except Exception:
  617. log.debug("Nothing to remove")
  618. self.ui.tools_scroll_area.setWidget(tools_form)
  619. tools_form.show()
  620. tools2_form = self.ui.tools2_defaults_form
  621. try:
  622. self.ui.tools2_scroll_area.takeWidget()
  623. except Exception:
  624. log.debug("Nothing to remove")
  625. self.ui.tools2_scroll_area.setWidget(tools2_form)
  626. tools2_form.show()
  627. fa_form = self.ui.util_defaults_form
  628. try:
  629. self.ui.fa_scroll_area.takeWidget()
  630. except Exception:
  631. log.debug("Nothing to remove")
  632. self.ui.fa_scroll_area.setWidget(fa_form)
  633. fa_form.show()
  634. # Initialize the color box's color in Preferences -> Global -> Colo
  635. self.__init_color_pickers()
  636. # Button handlers
  637. self.ui.pref_save_button.clicked.connect(lambda: self.on_save_button(save_to_file=True))
  638. self.ui.pref_apply_button.clicked.connect(lambda: self.on_save_button(save_to_file=False))
  639. self.ui.pref_close_button.clicked.connect(self.on_pref_close_button)
  640. self.ui.pref_defaults_button.clicked.connect(self.on_restore_defaults_preferences)
  641. log.debug("Finished Preferences GUI form initialization.")
  642. def __init_color_pickers(self):
  643. # Init Gerber Plot Colors
  644. self.ui.gerber_defaults_form.gerber_gen_group.pf_color_entry.set_value(self.defaults['gerber_plot_fill'])
  645. self.ui.gerber_defaults_form.gerber_gen_group.pf_color_button.setStyleSheet(
  646. "background-color:%s;"
  647. "border-color: dimgray" % str(self.defaults['gerber_plot_fill'])[:7])
  648. self.ui.gerber_defaults_form.gerber_gen_group.pf_color_alpha_spinner.set_value(
  649. int(self.defaults['gerber_plot_fill'][7:9], 16))
  650. self.ui.gerber_defaults_form.gerber_gen_group.pf_color_alpha_slider.setValue(
  651. int(self.defaults['gerber_plot_fill'][7:9], 16))
  652. self.ui.gerber_defaults_form.gerber_gen_group.pl_color_entry.set_value(self.defaults['gerber_plot_line'])
  653. self.ui.gerber_defaults_form.gerber_gen_group.pl_color_button.setStyleSheet(
  654. "background-color:%s;"
  655. "border-color: dimgray" % str(self.defaults['gerber_plot_line'])[:7])
  656. # Init Excellon Plot Colors
  657. self.ui.excellon_defaults_form.excellon_gen_group.fill_color_entry.set_value(
  658. self.defaults['excellon_plot_fill'])
  659. self.ui.excellon_defaults_form.excellon_gen_group.fill_color_button.setStyleSheet(
  660. "background-color:%s;"
  661. "border-color: dimgray" % str(self.defaults['excellon_plot_fill'])[:7])
  662. self.ui.excellon_defaults_form.excellon_gen_group.color_alpha_spinner.set_value(
  663. int(self.defaults['excellon_plot_fill'][7:9], 16))
  664. self.ui.excellon_defaults_form.excellon_gen_group.color_alpha_slider.setValue(
  665. int(self.defaults['excellon_plot_fill'][7:9], 16))
  666. self.ui.excellon_defaults_form.excellon_gen_group.line_color_entry.set_value(
  667. self.defaults['excellon_plot_line'])
  668. self.ui.excellon_defaults_form.excellon_gen_group.line_color_button.setStyleSheet(
  669. "background-color:%s;"
  670. "border-color: dimgray" % str(self.defaults['excellon_plot_line'])[:7])
  671. # Init Geometry Plot Colors
  672. self.ui.geometry_defaults_form.geometry_gen_group.line_color_entry.set_value(
  673. self.defaults['geometry_plot_line'])
  674. self.ui.geometry_defaults_form.geometry_gen_group.line_color_button.setStyleSheet(
  675. "background-color:%s;"
  676. "border-color: dimgray" % str(self.defaults['geometry_plot_line'])[:7])
  677. # Init CNCJob Travel Line Colors
  678. self.ui.cncjob_defaults_form.cncjob_gen_group.tfill_color_entry.set_value(
  679. self.defaults['cncjob_travel_fill'])
  680. self.ui.cncjob_defaults_form.cncjob_gen_group.tfill_color_button.setStyleSheet(
  681. "background-color:%s;"
  682. "border-color: dimgray" % str(self.defaults['cncjob_travel_fill'])[:7])
  683. self.ui.cncjob_defaults_form.cncjob_gen_group.tcolor_alpha_spinner.set_value(
  684. int(self.defaults['cncjob_travel_fill'][7:9], 16))
  685. self.ui.cncjob_defaults_form.cncjob_gen_group.tcolor_alpha_slider.setValue(
  686. int(self.defaults['cncjob_travel_fill'][7:9], 16))
  687. self.ui.cncjob_defaults_form.cncjob_gen_group.tline_color_entry.set_value(
  688. self.defaults['cncjob_travel_line'])
  689. self.ui.cncjob_defaults_form.cncjob_gen_group.tline_color_button.setStyleSheet(
  690. "background-color:%s;"
  691. "border-color: dimgray" % str(self.defaults['cncjob_travel_line'])[:7])
  692. # Init CNCJob Plot Colors
  693. self.ui.cncjob_defaults_form.cncjob_gen_group.fill_color_entry.set_value(
  694. self.defaults['cncjob_plot_fill'])
  695. self.ui.cncjob_defaults_form.cncjob_gen_group.fill_color_button.setStyleSheet(
  696. "background-color:%s;"
  697. "border-color: dimgray" % str(self.defaults['cncjob_plot_fill'])[:7])
  698. self.ui.cncjob_defaults_form.cncjob_gen_group.line_color_entry.set_value(
  699. self.defaults['cncjob_plot_line'])
  700. self.ui.cncjob_defaults_form.cncjob_gen_group.line_color_button.setStyleSheet(
  701. "background-color:%s;"
  702. "border-color: dimgray" % str(self.defaults['cncjob_plot_line'])[:7])
  703. # Init Left-Right Selection colors
  704. self.ui.general_defaults_form.general_gui_group.sf_color_entry.set_value(self.defaults['global_sel_fill'])
  705. self.ui.general_defaults_form.general_gui_group.sf_color_button.setStyleSheet(
  706. "background-color:%s;"
  707. "border-color: dimgray" % str(self.defaults['global_sel_fill'])[:7])
  708. self.ui.general_defaults_form.general_gui_group.sf_color_alpha_spinner.set_value(
  709. int(self.defaults['global_sel_fill'][7:9], 16))
  710. self.ui.general_defaults_form.general_gui_group.sf_color_alpha_slider.setValue(
  711. int(self.defaults['global_sel_fill'][7:9], 16))
  712. self.ui.general_defaults_form.general_gui_group.sl_color_entry.set_value(self.defaults['global_sel_line'])
  713. self.ui.general_defaults_form.general_gui_group.sl_color_button.setStyleSheet(
  714. "background-color:%s;"
  715. "border-color: dimgray" % str(self.defaults['global_sel_line'])[:7])
  716. # Init Right-Left Selection colors
  717. self.ui.general_defaults_form.general_gui_group.alt_sf_color_entry.set_value(
  718. self.defaults['global_alt_sel_fill'])
  719. self.ui.general_defaults_form.general_gui_group.alt_sf_color_button.setStyleSheet(
  720. "background-color:%s;"
  721. "border-color: dimgray" % str(self.defaults['global_alt_sel_fill'])[:7])
  722. self.ui.general_defaults_form.general_gui_group.alt_sf_color_alpha_spinner.set_value(
  723. int(self.defaults['global_sel_fill'][7:9], 16))
  724. self.ui.general_defaults_form.general_gui_group.alt_sf_color_alpha_slider.setValue(
  725. int(self.defaults['global_sel_fill'][7:9], 16))
  726. self.ui.general_defaults_form.general_gui_group.alt_sl_color_entry.set_value(
  727. self.defaults['global_alt_sel_line'])
  728. self.ui.general_defaults_form.general_gui_group.alt_sl_color_button.setStyleSheet(
  729. "background-color:%s;"
  730. "border-color: dimgray" % str(self.defaults['global_alt_sel_line'])[:7])
  731. # Init Draw color and Selection Draw Color
  732. self.ui.general_defaults_form.general_gui_group.draw_color_entry.set_value(
  733. self.defaults['global_draw_color'])
  734. self.ui.general_defaults_form.general_gui_group.draw_color_button.setStyleSheet(
  735. "background-color:%s;"
  736. "border-color: dimgray" % str(self.defaults['global_draw_color'])[:7])
  737. self.ui.general_defaults_form.general_gui_group.sel_draw_color_entry.set_value(
  738. self.defaults['global_sel_draw_color'])
  739. self.ui.general_defaults_form.general_gui_group.sel_draw_color_button.setStyleSheet(
  740. "background-color:%s;"
  741. "border-color: dimgray" % str(self.defaults['global_sel_draw_color'])[:7])
  742. # Init Project Items color
  743. self.ui.general_defaults_form.general_gui_group.proj_color_entry.set_value(
  744. self.defaults['global_proj_item_color'])
  745. self.ui.general_defaults_form.general_gui_group.proj_color_button.setStyleSheet(
  746. "background-color:%s;"
  747. "border-color: dimgray" % str(self.defaults['global_proj_item_color'])[:7])
  748. # Init Project Disabled Items color
  749. self.ui.general_defaults_form.general_gui_group.proj_color_dis_entry.set_value(
  750. self.defaults['global_proj_item_dis_color'])
  751. self.ui.general_defaults_form.general_gui_group.proj_color_dis_button.setStyleSheet(
  752. "background-color:%s;"
  753. "border-color: dimgray" % str(self.defaults['global_proj_item_dis_color'])[:7])
  754. # Init Project Disabled Items color
  755. self.ui.general_defaults_form.general_app_set_group.mouse_cursor_entry.set_value(
  756. self.defaults['global_cursor_color'])
  757. self.ui.general_defaults_form.general_app_set_group.mouse_cursor_button.setStyleSheet(
  758. "background-color:%s;"
  759. "border-color: dimgray" % str(self.defaults['global_cursor_color'])[:7])
  760. # Init the Annotation CNC Job color
  761. self.ui.cncjob_defaults_form.cncjob_adv_opt_group.annotation_fontcolor_entry.set_value(
  762. self.defaults['cncjob_annotation_fontcolor'])
  763. self.ui.cncjob_defaults_form.cncjob_adv_opt_group.annotation_fontcolor_button.setStyleSheet(
  764. "background-color:%s;"
  765. "border-color: dimgray" % str(self.defaults['cncjob_annotation_fontcolor'])[:7])
  766. # Init the Tool Film color
  767. self.ui.tools_defaults_form.tools_film_group.film_color_entry.set_value(
  768. self.defaults['tools_film_color'])
  769. self.ui.tools_defaults_form.tools_film_group.film_color_button.setStyleSheet(
  770. "background-color:%s;"
  771. "border-color: dimgray" % str(self.defaults['tools_film_color'])[:7]
  772. )
  773. # Init the Tool QRCode colors
  774. self.ui.tools2_defaults_form.tools2_qrcode_group.fill_color_entry.set_value(
  775. self.defaults['tools_qrcode_fill_color'])
  776. self.ui.tools2_defaults_form.tools2_qrcode_group.fill_color_button.setStyleSheet(
  777. "background-color:%s;"
  778. "border-color: dimgray" % str(self.defaults['tools_qrcode_fill_color'])[:7])
  779. self.ui.tools2_defaults_form.tools2_qrcode_group.back_color_entry.set_value(
  780. self.defaults['tools_qrcode_back_color'])
  781. self.ui.tools2_defaults_form.tools2_qrcode_group.back_color_button.setStyleSheet(
  782. "background-color:%s;"
  783. "border-color: dimgray" % str(self.defaults['tools_qrcode_back_color'])[:7])
  784. def on_save_button(self, save_to_file=True):
  785. log.debug("on_save_button() --> Applying preferences to file.")
  786. # Preferences saved, update flag
  787. self.preferences_changed_flag = False
  788. # Preferences save, update the color of the Preferences Tab text
  789. for idx in range(self.ui.plot_tab_area.count()):
  790. if self.ui.plot_tab_area.tabText(idx) == _("Preferences"):
  791. self.ui.plot_tab_area.tabBar.setTabTextColor(idx, QtGui.QColor('black'))
  792. # restore the default stylesheet by setting a blank one
  793. self.ui.pref_apply_button.setStyleSheet("")
  794. self.inform.emit('%s' % _("Preferences applied."))
  795. # make sure we update the self.current_defaults dict used to undo changes to self.defaults
  796. self.defaults.current_defaults.update(self.defaults)
  797. if save_to_file:
  798. self.save_defaults(silent=False)
  799. # load the defaults so they are updated into the app
  800. self.load_defaults(filename='current_defaults')
  801. # Re-fresh project options
  802. self.on_options_app2project()
  803. settgs = QSettings("Open Source", "FlatCAM")
  804. # save the notebook font size
  805. fsize = self.ui.general_defaults_form.general_app_set_group.notebook_font_size_spinner.get_value()
  806. settgs.setValue('notebook_font_size', fsize)
  807. # save the axis font size
  808. g_fsize = self.ui.general_defaults_form.general_app_set_group.axis_font_size_spinner.get_value()
  809. settgs.setValue('axis_font_size', g_fsize)
  810. # save the textbox font size
  811. tb_fsize = self.ui.general_defaults_form.general_app_set_group.textbox_font_size_spinner.get_value()
  812. settgs.setValue('textbox_font_size', tb_fsize)
  813. settgs.setValue(
  814. 'machinist',
  815. 1 if self.ui.general_defaults_form.general_app_set_group.machinist_cb.get_value() else 0
  816. )
  817. # This will write the setting to the platform specific storage.
  818. del settgs
  819. if save_to_file:
  820. # close the tab and delete it
  821. for idx in range(self.ui.plot_tab_area.count()):
  822. if self.ui.plot_tab_area.tabText(idx) == _("Preferences"):
  823. self.ui.plot_tab_area.tabBar.setTabTextColor(idx, QtGui.QColor('black'))
  824. self.ui.plot_tab_area.closeTab(idx)
  825. break
  826. def on_pref_close_button(self):
  827. # Preferences saved, update flag
  828. self.preferences_changed_flag = False
  829. try:
  830. self.ui.plot_tab_area.tab_closed_signal.disconnect(self.on_plot_area_tab_closed)
  831. except TypeError:
  832. pass
  833. try:
  834. self.ui.general_defaults_form.general_app_group.units_radio.activated_custom.disconnect()
  835. except (TypeError, AttributeError):
  836. pass
  837. self.defaults_write_form(source_dict=self.defaults.current_defaults)
  838. self.ui.general_defaults_form.general_app_group.units_radio.activated_custom.connect(
  839. lambda: self.on_toggle_units(no_pref=False))
  840. self.defaults.update(self.defaults.current_defaults)
  841. # Preferences save, update the color of the Preferences Tab text
  842. for idx in range(self.ui.plot_tab_area.count()):
  843. if self.ui.plot_tab_area.tabText(idx) == _("Preferences"):
  844. self.ui.plot_tab_area.tabBar.setTabTextColor(idx, QtGui.QColor('black'))
  845. self.ui.plot_tab_area.closeTab(idx)
  846. break
  847. self.inform.emit('%s' % _("Preferences closed without saving."))
  848. self.ui.plot_tab_area.tab_closed_signal.connect(self.on_plot_area_tab_closed)
  849. def on_restore_defaults_preferences(self):
  850. """
  851. Loads the application's factory default settings into ``self.defaults``.
  852. :return: None
  853. """
  854. log.debug("on_restore_defaults_preferences()")
  855. self.defaults.reset_to_factory_defaults()
  856. self.on_preferences_edited()
  857. self.inform.emit('[success] %s' % _("Preferences default values are restored."))
  858. def save_defaults(self, silent=False, data_path=None, first_time=False):
  859. """
  860. Saves application default options
  861. ``self.defaults`` to current_defaults.FlatConfig file.
  862. Save the toolbars visibility status to the preferences file (current_defaults.FlatConfig) to be
  863. used at the next launch of the application.
  864. :param silent: Whether to display a message in status bar or not; boolean
  865. :param data_path: The path where to save the preferences file (current_defaults.FlatConfig)
  866. When the application is portable it should be a mobile location.
  867. :param first_time: Boolean. If True will execute some code when the app is run first time
  868. :return: None
  869. """
  870. self.report_usage("save_defaults")
  871. if data_path is None:
  872. data_path = self.data_path
  873. self.propagate_defaults()
  874. if first_time is False:
  875. self.save_toolbar_view()
  876. # Save the options to disk
  877. filename = os.path.join(data_path, "current_defaults.FlatConfig")
  878. try:
  879. self.defaults.write(filename=filename)
  880. except Exception as e:
  881. log.error("save_defaults() --> Failed to write defaults to file %s" % str(e))
  882. self.inform.emit('[ERROR_NOTCL] %s %s' % (_("Failed to write defaults to file."), str(filename)))
  883. return
  884. if not silent:
  885. self.inform.emit('[success] %s' % _("Preferences saved."))
  886. # update the autosave timer
  887. self.save_project_auto_update()
  888. class OptionsGroupUI(QtWidgets.QGroupBox):
  889. app = None
  890. def __init__(self, title, parent=None):
  891. # QtGui.QGroupBox.__init__(self, title, parent=parent)
  892. super(OptionsGroupUI, self).__init__()
  893. self.setStyleSheet("""
  894. QGroupBox
  895. {
  896. font-size: 16px;
  897. font-weight: bold;
  898. }
  899. """)
  900. self.layout = QtWidgets.QVBoxLayout()
  901. self.setLayout(self.layout)
  902. class GeneralPreferencesUI(QtWidgets.QWidget):
  903. def __init__(self, decimals, parent=None):
  904. QtWidgets.QWidget.__init__(self, parent=parent)
  905. self.layout = QtWidgets.QHBoxLayout()
  906. self.setLayout(self.layout)
  907. self.decimals = decimals
  908. self.general_app_group = GeneralAppPrefGroupUI(decimals=self.decimals)
  909. self.general_app_group.setMinimumWidth(250)
  910. self.general_gui_group = GeneralGUIPrefGroupUI(decimals=self.decimals)
  911. self.general_gui_group.setMinimumWidth(250)
  912. self.general_app_set_group = GeneralAPPSetGroupUI(decimals=self.decimals)
  913. self.general_app_set_group.setMinimumWidth(250)
  914. self.layout.addWidget(self.general_app_group)
  915. self.layout.addWidget(self.general_gui_group)
  916. self.layout.addWidget(self.general_app_set_group)
  917. self.layout.addStretch()
  918. class GerberPreferencesUI(QtWidgets.QWidget):
  919. def __init__(self, decimals, parent=None):
  920. QtWidgets.QWidget.__init__(self, parent=parent)
  921. self.layout = QtWidgets.QHBoxLayout()
  922. self.setLayout(self.layout)
  923. self.decimals = decimals
  924. self.gerber_gen_group = GerberGenPrefGroupUI(decimals=self.decimals)
  925. self.gerber_gen_group.setMinimumWidth(250)
  926. self.gerber_opt_group = GerberOptPrefGroupUI(decimals=self.decimals)
  927. self.gerber_opt_group.setMinimumWidth(250)
  928. self.gerber_exp_group = GerberExpPrefGroupUI(decimals=self.decimals)
  929. self.gerber_exp_group.setMinimumWidth(230)
  930. self.gerber_adv_opt_group = GerberAdvOptPrefGroupUI(decimals=self.decimals)
  931. self.gerber_adv_opt_group.setMinimumWidth(200)
  932. self.gerber_editor_group = GerberEditorPrefGroupUI(decimals=self.decimals)
  933. self.gerber_editor_group.setMinimumWidth(200)
  934. self.vlay = QtWidgets.QVBoxLayout()
  935. self.vlay.addWidget(self.gerber_opt_group)
  936. self.vlay.addWidget(self.gerber_exp_group)
  937. self.layout.addWidget(self.gerber_gen_group)
  938. self.layout.addLayout(self.vlay)
  939. self.layout.addWidget(self.gerber_adv_opt_group)
  940. self.layout.addWidget(self.gerber_editor_group)
  941. self.layout.addStretch()
  942. class ExcellonPreferencesUI(QtWidgets.QWidget):
  943. def __init__(self, decimals, parent=None):
  944. QtWidgets.QWidget.__init__(self, parent=parent)
  945. self.layout = QtWidgets.QHBoxLayout()
  946. self.setLayout(self.layout)
  947. self.decimals = decimals
  948. self.excellon_gen_group = ExcellonGenPrefGroupUI(decimals=self.decimals)
  949. self.excellon_gen_group.setMinimumWidth(220)
  950. self.excellon_opt_group = ExcellonOptPrefGroupUI(decimals=self.decimals)
  951. self.excellon_opt_group.setMinimumWidth(290)
  952. self.excellon_exp_group = ExcellonExpPrefGroupUI(decimals=self.decimals)
  953. self.excellon_exp_group.setMinimumWidth(250)
  954. self.excellon_adv_opt_group = ExcellonAdvOptPrefGroupUI(decimals=self.decimals)
  955. self.excellon_adv_opt_group.setMinimumWidth(250)
  956. self.excellon_editor_group = ExcellonEditorPrefGroupUI(decimals=self.decimals)
  957. self.excellon_editor_group.setMinimumWidth(260)
  958. self.vlay = QtWidgets.QVBoxLayout()
  959. self.vlay.addWidget(self.excellon_opt_group)
  960. self.vlay.addWidget(self.excellon_exp_group)
  961. self.layout.addWidget(self.excellon_gen_group)
  962. self.layout.addLayout(self.vlay)
  963. self.layout.addWidget(self.excellon_adv_opt_group)
  964. self.layout.addWidget(self.excellon_editor_group)
  965. self.layout.addStretch()
  966. class GeometryPreferencesUI(QtWidgets.QWidget):
  967. def __init__(self, decimals, parent=None):
  968. QtWidgets.QWidget.__init__(self, parent=parent)
  969. self.layout = QtWidgets.QHBoxLayout()
  970. self.setLayout(self.layout)
  971. self.decimals = decimals
  972. self.geometry_gen_group = GeometryGenPrefGroupUI(decimals=self.decimals)
  973. self.geometry_gen_group.setMinimumWidth(220)
  974. self.geometry_opt_group = GeometryOptPrefGroupUI(decimals=self.decimals)
  975. self.geometry_opt_group.setMinimumWidth(300)
  976. self.geometry_adv_opt_group = GeometryAdvOptPrefGroupUI(decimals=self.decimals)
  977. self.geometry_adv_opt_group.setMinimumWidth(270)
  978. self.geometry_editor_group = GeometryEditorPrefGroupUI(decimals=self.decimals)
  979. self.geometry_editor_group.setMinimumWidth(250)
  980. self.layout.addWidget(self.geometry_gen_group)
  981. self.layout.addWidget(self.geometry_opt_group)
  982. self.layout.addWidget(self.geometry_adv_opt_group)
  983. self.layout.addWidget(self.geometry_editor_group)
  984. self.layout.addStretch()
  985. class ToolsPreferencesUI(QtWidgets.QWidget):
  986. def __init__(self, decimals, parent=None):
  987. QtWidgets.QWidget.__init__(self, parent=parent)
  988. self.layout = QtWidgets.QHBoxLayout()
  989. self.setLayout(self.layout)
  990. self.decimals = decimals
  991. self.tools_ncc_group = ToolsNCCPrefGroupUI(decimals=self.decimals)
  992. self.tools_ncc_group.setMinimumWidth(220)
  993. self.tools_paint_group = ToolsPaintPrefGroupUI(decimals=self.decimals)
  994. self.tools_paint_group.setMinimumWidth(220)
  995. self.tools_cutout_group = ToolsCutoutPrefGroupUI(decimals=self.decimals)
  996. self.tools_cutout_group.setMinimumWidth(220)
  997. self.tools_2sided_group = Tools2sidedPrefGroupUI(decimals=self.decimals)
  998. self.tools_2sided_group.setMinimumWidth(220)
  999. self.tools_film_group = ToolsFilmPrefGroupUI(decimals=self.decimals)
  1000. self.tools_film_group.setMinimumWidth(220)
  1001. self.tools_panelize_group = ToolsPanelizePrefGroupUI(decimals=self.decimals)
  1002. self.tools_panelize_group.setMinimumWidth(220)
  1003. self.tools_calculators_group = ToolsCalculatorsPrefGroupUI(decimals=self.decimals)
  1004. self.tools_calculators_group.setMinimumWidth(220)
  1005. self.tools_transform_group = ToolsTransformPrefGroupUI(decimals=self.decimals)
  1006. self.tools_transform_group.setMinimumWidth(200)
  1007. self.tools_solderpaste_group = ToolsSolderpastePrefGroupUI(decimals=self.decimals)
  1008. self.tools_solderpaste_group.setMinimumWidth(200)
  1009. self.tools_sub_group = ToolsSubPrefGroupUI(decimals=self.decimals)
  1010. self.tools_sub_group.setMinimumWidth(200)
  1011. self.vlay = QtWidgets.QVBoxLayout()
  1012. self.vlay.addWidget(self.tools_ncc_group)
  1013. self.vlay.addWidget(self.tools_cutout_group)
  1014. self.vlay1 = QtWidgets.QVBoxLayout()
  1015. self.vlay1.addWidget(self.tools_paint_group)
  1016. self.vlay1.addWidget(self.tools_panelize_group)
  1017. self.vlay2 = QtWidgets.QVBoxLayout()
  1018. self.vlay2.addWidget(self.tools_transform_group)
  1019. self.vlay2.addWidget(self.tools_2sided_group)
  1020. self.vlay2.addWidget(self.tools_sub_group)
  1021. self.vlay3 = QtWidgets.QVBoxLayout()
  1022. self.vlay3.addWidget(self.tools_film_group)
  1023. self.vlay3.addWidget(self.tools_calculators_group)
  1024. self.vlay4 = QtWidgets.QVBoxLayout()
  1025. self.vlay4.addWidget(self.tools_solderpaste_group)
  1026. self.layout.addLayout(self.vlay)
  1027. self.layout.addLayout(self.vlay1)
  1028. self.layout.addLayout(self.vlay2)
  1029. self.layout.addLayout(self.vlay3)
  1030. self.layout.addLayout(self.vlay4)
  1031. self.layout.addStretch()
  1032. class Tools2PreferencesUI(QtWidgets.QWidget):
  1033. def __init__(self, decimals, parent=None):
  1034. QtWidgets.QWidget.__init__(self, parent=parent)
  1035. self.layout = QtWidgets.QHBoxLayout()
  1036. self.setLayout(self.layout)
  1037. self.decimals = decimals
  1038. self.tools2_checkrules_group = Tools2RulesCheckPrefGroupUI(decimals=self.decimals)
  1039. self.tools2_checkrules_group.setMinimumWidth(220)
  1040. self.tools2_optimal_group = Tools2OptimalPrefGroupUI(decimals=self.decimals)
  1041. self.tools2_optimal_group.setMinimumWidth(220)
  1042. self.tools2_qrcode_group = Tools2QRCodePrefGroupUI(decimals=self.decimals)
  1043. self.tools2_qrcode_group.setMinimumWidth(220)
  1044. self.tools2_cfill_group = Tools2CThievingPrefGroupUI(decimals=self.decimals)
  1045. self.tools2_cfill_group.setMinimumWidth(220)
  1046. self.tools2_fiducials_group = Tools2FiducialsPrefGroupUI(decimals=self.decimals)
  1047. self.tools2_fiducials_group.setMinimumWidth(220)
  1048. self.tools2_cal_group = Tools2CalPrefGroupUI(decimals=self.decimals)
  1049. self.tools2_cal_group.setMinimumWidth(220)
  1050. self.tools2_edrills_group = Tools2EDrillsPrefGroupUI(decimals=self.decimals)
  1051. self.tools2_edrills_group.setMinimumWidth(220)
  1052. self.tools2_punch_group = Tools2PunchGerberPrefGroupUI(decimals=self.decimals)
  1053. self.tools2_punch_group.setMinimumWidth(220)
  1054. self.tools2_invert_group = Tools2InvertPrefGroupUI(decimals=self.decimals)
  1055. self.tools2_invert_group.setMinimumWidth(220)
  1056. self.vlay = QtWidgets.QVBoxLayout()
  1057. self.vlay.addWidget(self.tools2_checkrules_group)
  1058. self.vlay.addWidget(self.tools2_optimal_group)
  1059. self.vlay1 = QtWidgets.QVBoxLayout()
  1060. self.vlay1.addWidget(self.tools2_qrcode_group)
  1061. self.vlay1.addWidget(self.tools2_fiducials_group)
  1062. self.vlay2 = QtWidgets.QVBoxLayout()
  1063. self.vlay2.addWidget(self.tools2_cfill_group)
  1064. self.vlay3 = QtWidgets.QVBoxLayout()
  1065. self.vlay3.addWidget(self.tools2_cal_group)
  1066. self.vlay3.addWidget(self.tools2_edrills_group)
  1067. self.vlay4 = QtWidgets.QVBoxLayout()
  1068. self.vlay4.addWidget(self.tools2_punch_group)
  1069. self.vlay4.addWidget(self.tools2_invert_group)
  1070. self.layout.addLayout(self.vlay)
  1071. self.layout.addLayout(self.vlay1)
  1072. self.layout.addLayout(self.vlay2)
  1073. self.layout.addLayout(self.vlay3)
  1074. self.layout.addLayout(self.vlay4)
  1075. self.layout.addStretch()
  1076. class CNCJobPreferencesUI(QtWidgets.QWidget):
  1077. def __init__(self, decimals, parent=None):
  1078. QtWidgets.QWidget.__init__(self, parent=parent)
  1079. self.layout = QtWidgets.QHBoxLayout()
  1080. self.setLayout(self.layout)
  1081. self.decimals = decimals
  1082. self.cncjob_gen_group = CNCJobGenPrefGroupUI(decimals=self.decimals)
  1083. self.cncjob_gen_group.setMinimumWidth(260)
  1084. self.cncjob_opt_group = CNCJobOptPrefGroupUI(decimals=self.decimals)
  1085. self.cncjob_opt_group.setMinimumWidth(260)
  1086. self.cncjob_adv_opt_group = CNCJobAdvOptPrefGroupUI(decimals=self.decimals)
  1087. self.cncjob_adv_opt_group.setMinimumWidth(260)
  1088. self.layout.addWidget(self.cncjob_gen_group)
  1089. self.layout.addWidget(self.cncjob_opt_group)
  1090. self.layout.addWidget(self.cncjob_adv_opt_group)
  1091. self.layout.addStretch()
  1092. class UtilPreferencesUI(QtWidgets.QWidget):
  1093. def __init__(self, decimals, parent=None):
  1094. QtWidgets.QWidget.__init__(self, parent=parent)
  1095. self.layout = QtWidgets.QHBoxLayout()
  1096. self.setLayout(self.layout)
  1097. self.decimals = decimals
  1098. self.vlay = QtWidgets.QVBoxLayout()
  1099. self.fa_excellon_group = FAExcPrefGroupUI(decimals=self.decimals)
  1100. self.fa_excellon_group.setMinimumWidth(260)
  1101. self.fa_gcode_group = FAGcoPrefGroupUI(decimals=self.decimals)
  1102. self.fa_gcode_group.setMinimumWidth(260)
  1103. self.vlay.addWidget(self.fa_excellon_group)
  1104. self.vlay.addWidget(self.fa_gcode_group)
  1105. self.fa_gerber_group = FAGrbPrefGroupUI(decimals=self.decimals)
  1106. self.fa_gerber_group.setMinimumWidth(260)
  1107. self.kw_group = AutoCompletePrefGroupUI(decimals=self.decimals)
  1108. self.kw_group.setMinimumWidth(260)
  1109. self.layout.addLayout(self.vlay)
  1110. self.layout.addWidget(self.fa_gerber_group)
  1111. self.layout.addWidget(self.kw_group)
  1112. self.layout.addStretch()
  1113. class GeneralGUIPrefGroupUI(OptionsGroupUI):
  1114. def __init__(self, decimals=4, parent=None):
  1115. super(GeneralGUIPrefGroupUI, self).__init__(self)
  1116. self.setTitle(str(_("GUI Preferences")))
  1117. self.decimals = decimals
  1118. # Create a grid layout for the Application general settings
  1119. grid0 = QtWidgets.QGridLayout()
  1120. self.layout.addLayout(grid0)
  1121. grid0.setColumnStretch(0, 0)
  1122. grid0.setColumnStretch(1, 1)
  1123. # Theme selection
  1124. self.theme_label = QtWidgets.QLabel('%s:' % _('Theme'))
  1125. self.theme_label.setToolTip(
  1126. _("Select a theme for FlatCAM.\n"
  1127. "It will theme the plot area.")
  1128. )
  1129. self.theme_radio = RadioSet([
  1130. {"label": _("Light"), "value": "white"},
  1131. {"label": _("Dark"), "value": "black"}
  1132. ], orientation='vertical')
  1133. grid0.addWidget(self.theme_label, 0, 0)
  1134. grid0.addWidget(self.theme_radio, 0, 1)
  1135. # Enable Gray Icons
  1136. self.gray_icons_cb = FCCheckBox('%s' % _('Use Gray Icons'))
  1137. self.gray_icons_cb.setToolTip(
  1138. _("Check this box to use a set of icons with\n"
  1139. "a lighter (gray) color. To be used when a\n"
  1140. "full dark theme is applied.")
  1141. )
  1142. grid0.addWidget(self.gray_icons_cb, 1, 0, 1, 3)
  1143. self.theme_button = FCButton(_("Apply Theme"))
  1144. self.theme_button.setToolTip(
  1145. _("Select a theme for FlatCAM.\n"
  1146. "It will theme the plot area.\n"
  1147. "The application will restart after change.")
  1148. )
  1149. grid0.addWidget(self.theme_button, 2, 0, 1, 3)
  1150. separator_line = QtWidgets.QFrame()
  1151. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  1152. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  1153. grid0.addWidget(separator_line, 3, 0, 1, 2)
  1154. # Layout selection
  1155. self.layout_label = QtWidgets.QLabel('%s:' % _('Layout'))
  1156. self.layout_label.setToolTip(
  1157. _("Select an layout for FlatCAM.\n"
  1158. "It is applied immediately.")
  1159. )
  1160. self.layout_combo = FCComboBox()
  1161. # don't translate the QCombo items as they are used in QSettings and identified by name
  1162. self.layout_combo.addItem("standard")
  1163. self.layout_combo.addItem("compact")
  1164. self.layout_combo.addItem("minimal")
  1165. grid0.addWidget(self.layout_label, 4, 0)
  1166. grid0.addWidget(self.layout_combo, 4, 1)
  1167. # Set the current index for layout_combo
  1168. settings = QSettings("Open Source", "FlatCAM")
  1169. if settings.contains("layout"):
  1170. layout = settings.value('layout', type=str)
  1171. idx = self.layout_combo.findText(layout.capitalize())
  1172. self.layout_combo.setCurrentIndex(idx)
  1173. # Style selection
  1174. self.style_label = QtWidgets.QLabel('%s:' % _('Style'))
  1175. self.style_label.setToolTip(
  1176. _("Select an style for FlatCAM.\n"
  1177. "It will be applied at the next app start.")
  1178. )
  1179. self.style_combo = FCComboBox()
  1180. self.style_combo.addItems(QtWidgets.QStyleFactory.keys())
  1181. # find current style
  1182. index = self.style_combo.findText(QtWidgets.qApp.style().objectName(), QtCore.Qt.MatchFixedString)
  1183. self.style_combo.setCurrentIndex(index)
  1184. self.style_combo.activated[str].connect(self.handle_style)
  1185. grid0.addWidget(self.style_label, 5, 0)
  1186. grid0.addWidget(self.style_combo, 5, 1)
  1187. # Enable High DPI Support
  1188. self.hdpi_cb = FCCheckBox('%s' % _('Activate HDPI Support'))
  1189. self.hdpi_cb.setToolTip(
  1190. _("Enable High DPI support for FlatCAM.\n"
  1191. "It will be applied at the next app start.")
  1192. )
  1193. settings = QSettings("Open Source", "FlatCAM")
  1194. if settings.contains("hdpi"):
  1195. self.hdpi_cb.set_value(settings.value('hdpi', type=int))
  1196. else:
  1197. self.hdpi_cb.set_value(False)
  1198. self.hdpi_cb.stateChanged.connect(self.handle_hdpi)
  1199. grid0.addWidget(self.hdpi_cb, 6, 0, 1, 3)
  1200. # Enable Hover box
  1201. self.hover_cb = FCCheckBox('%s' % _('Display Hover Shape'))
  1202. self.hover_cb.setToolTip(
  1203. _("Enable display of a hover shape for FlatCAM objects.\n"
  1204. "It is displayed whenever the mouse cursor is hovering\n"
  1205. "over any kind of not-selected object.")
  1206. )
  1207. grid0.addWidget(self.hover_cb, 8, 0, 1, 3)
  1208. # Enable Selection box
  1209. self.selection_cb = FCCheckBox('%s' % _('Display Selection Shape'))
  1210. self.selection_cb.setToolTip(
  1211. _("Enable the display of a selection shape for FlatCAM objects.\n"
  1212. "It is displayed whenever the mouse selects an object\n"
  1213. "either by clicking or dragging mouse from left to right or\n"
  1214. "right to left.")
  1215. )
  1216. grid0.addWidget(self.selection_cb, 9, 0, 1, 3)
  1217. separator_line = QtWidgets.QFrame()
  1218. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  1219. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  1220. grid0.addWidget(separator_line, 14, 0, 1, 2)
  1221. # Plot Selection (left - right) Color
  1222. self.sel_lr_label = QtWidgets.QLabel('<b>%s</b>' % _('Left-Right Selection Color'))
  1223. grid0.addWidget(self.sel_lr_label, 15, 0, 1, 2)
  1224. self.sl_color_label = QtWidgets.QLabel('%s:' % _('Outline'))
  1225. self.sl_color_label.setToolTip(
  1226. _("Set the line color for the 'left to right' selection box.")
  1227. )
  1228. self.sl_color_entry = FCEntry()
  1229. self.sl_color_button = QtWidgets.QPushButton()
  1230. self.sl_color_button.setFixedSize(15, 15)
  1231. self.form_box_child_4 = QtWidgets.QHBoxLayout()
  1232. self.form_box_child_4.addWidget(self.sl_color_entry)
  1233. self.form_box_child_4.addWidget(self.sl_color_button)
  1234. self.form_box_child_4.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  1235. grid0.addWidget(self.sl_color_label, 16, 0)
  1236. grid0.addLayout(self.form_box_child_4, 16, 1)
  1237. self.sf_color_label = QtWidgets.QLabel('%s:' % _('Fill'))
  1238. self.sf_color_label.setToolTip(
  1239. _("Set the fill color for the selection box\n"
  1240. "in case that the selection is done from left to right.\n"
  1241. "First 6 digits are the color and the last 2\n"
  1242. "digits are for alpha (transparency) level.")
  1243. )
  1244. self.sf_color_entry = FCEntry()
  1245. self.sf_color_button = QtWidgets.QPushButton()
  1246. self.sf_color_button.setFixedSize(15, 15)
  1247. self.form_box_child_5 = QtWidgets.QHBoxLayout()
  1248. self.form_box_child_5.addWidget(self.sf_color_entry)
  1249. self.form_box_child_5.addWidget(self.sf_color_button)
  1250. self.form_box_child_5.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  1251. grid0.addWidget(self.sf_color_label, 17, 0)
  1252. grid0.addLayout(self.form_box_child_5, 17, 1)
  1253. # Plot Selection (left - right) Fill Transparency Level
  1254. self.sf_alpha_label = QtWidgets.QLabel('%s:' % _('Alpha'))
  1255. self.sf_alpha_label.setToolTip(
  1256. _("Set the fill transparency for the 'left to right' selection box.")
  1257. )
  1258. self.sf_color_alpha_slider = QtWidgets.QSlider(QtCore.Qt.Horizontal)
  1259. self.sf_color_alpha_slider.setMinimum(0)
  1260. self.sf_color_alpha_slider.setMaximum(255)
  1261. self.sf_color_alpha_slider.setSingleStep(1)
  1262. self.sf_color_alpha_spinner = FCSpinner()
  1263. self.sf_color_alpha_spinner.setMinimumWidth(70)
  1264. self.sf_color_alpha_spinner.set_range(0, 255)
  1265. self.form_box_child_6 = QtWidgets.QHBoxLayout()
  1266. self.form_box_child_6.addWidget(self.sf_color_alpha_slider)
  1267. self.form_box_child_6.addWidget(self.sf_color_alpha_spinner)
  1268. grid0.addWidget(self.sf_alpha_label, 18, 0)
  1269. grid0.addLayout(self.form_box_child_6, 18, 1)
  1270. separator_line = QtWidgets.QFrame()
  1271. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  1272. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  1273. grid0.addWidget(separator_line, 19, 0, 1, 2)
  1274. # Plot Selection (left - right) Color
  1275. self.sel_rl_label = QtWidgets.QLabel('<b>%s</b>' % _('Right-Left Selection Color'))
  1276. grid0.addWidget(self.sel_rl_label, 20, 0, 1, 2)
  1277. # Plot Selection (right - left) Line Color
  1278. self.alt_sl_color_label = QtWidgets.QLabel('%s:' % _('Outline'))
  1279. self.alt_sl_color_label.setToolTip(
  1280. _("Set the line color for the 'right to left' selection box.")
  1281. )
  1282. self.alt_sl_color_entry = FCEntry()
  1283. self.alt_sl_color_button = QtWidgets.QPushButton()
  1284. self.alt_sl_color_button.setFixedSize(15, 15)
  1285. self.form_box_child_7 = QtWidgets.QHBoxLayout()
  1286. self.form_box_child_7.addWidget(self.alt_sl_color_entry)
  1287. self.form_box_child_7.addWidget(self.alt_sl_color_button)
  1288. self.form_box_child_7.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  1289. grid0.addWidget(self.alt_sl_color_label, 21, 0)
  1290. grid0.addLayout(self.form_box_child_7, 21, 1)
  1291. # Plot Selection (right - left) Fill Color
  1292. self.alt_sf_color_label = QtWidgets.QLabel('%s:' % _('Fill'))
  1293. self.alt_sf_color_label.setToolTip(
  1294. _("Set the fill color for the selection box\n"
  1295. "in case that the selection is done from right to left.\n"
  1296. "First 6 digits are the color and the last 2\n"
  1297. "digits are for alpha (transparency) level.")
  1298. )
  1299. self.alt_sf_color_entry = FCEntry()
  1300. self.alt_sf_color_button = QtWidgets.QPushButton()
  1301. self.alt_sf_color_button.setFixedSize(15, 15)
  1302. self.form_box_child_8 = QtWidgets.QHBoxLayout()
  1303. self.form_box_child_8.addWidget(self.alt_sf_color_entry)
  1304. self.form_box_child_8.addWidget(self.alt_sf_color_button)
  1305. self.form_box_child_8.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  1306. grid0.addWidget(self.alt_sf_color_label, 22, 0)
  1307. grid0.addLayout(self.form_box_child_8, 22, 1)
  1308. # Plot Selection (right - left) Fill Transparency Level
  1309. self.alt_sf_alpha_label = QtWidgets.QLabel('%s:' % _('Alpha'))
  1310. self.alt_sf_alpha_label.setToolTip(
  1311. _("Set the fill transparency for selection 'right to left' box.")
  1312. )
  1313. self.alt_sf_color_alpha_slider = QtWidgets.QSlider(QtCore.Qt.Horizontal)
  1314. self.alt_sf_color_alpha_slider.setMinimum(0)
  1315. self.alt_sf_color_alpha_slider.setMaximum(255)
  1316. self.alt_sf_color_alpha_slider.setSingleStep(1)
  1317. self.alt_sf_color_alpha_spinner = FCSpinner()
  1318. self.alt_sf_color_alpha_spinner.setMinimumWidth(70)
  1319. self.alt_sf_color_alpha_spinner.set_range(0, 255)
  1320. self.form_box_child_9 = QtWidgets.QHBoxLayout()
  1321. self.form_box_child_9.addWidget(self.alt_sf_color_alpha_slider)
  1322. self.form_box_child_9.addWidget(self.alt_sf_color_alpha_spinner)
  1323. grid0.addWidget(self.alt_sf_alpha_label, 23, 0)
  1324. grid0.addLayout(self.form_box_child_9, 23, 1)
  1325. separator_line = QtWidgets.QFrame()
  1326. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  1327. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  1328. grid0.addWidget(separator_line, 24, 0, 1, 2)
  1329. # ------------------------------------------------------------------
  1330. # ----------------------- Editor Color -----------------------------
  1331. # ------------------------------------------------------------------
  1332. self.editor_color_label = QtWidgets.QLabel('<b>%s</b>' % _('Editor Color'))
  1333. grid0.addWidget(self.editor_color_label, 25, 0, 1, 2)
  1334. # Editor Draw Color
  1335. self.draw_color_label = QtWidgets.QLabel('%s:' % _('Drawing'))
  1336. self.alt_sf_color_label.setToolTip(
  1337. _("Set the color for the shape.")
  1338. )
  1339. self.draw_color_entry = FCEntry()
  1340. self.draw_color_button = QtWidgets.QPushButton()
  1341. self.draw_color_button.setFixedSize(15, 15)
  1342. self.form_box_child_10 = QtWidgets.QHBoxLayout()
  1343. self.form_box_child_10.addWidget(self.draw_color_entry)
  1344. self.form_box_child_10.addWidget(self.draw_color_button)
  1345. self.form_box_child_10.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  1346. grid0.addWidget(self.draw_color_label, 26, 0)
  1347. grid0.addLayout(self.form_box_child_10, 26, 1)
  1348. # Editor Draw Selection Color
  1349. self.sel_draw_color_label = QtWidgets.QLabel('%s:' % _('Selection'))
  1350. self.sel_draw_color_label.setToolTip(
  1351. _("Set the color of the shape when selected.")
  1352. )
  1353. self.sel_draw_color_entry = FCEntry()
  1354. self.sel_draw_color_button = QtWidgets.QPushButton()
  1355. self.sel_draw_color_button.setFixedSize(15, 15)
  1356. self.form_box_child_11 = QtWidgets.QHBoxLayout()
  1357. self.form_box_child_11.addWidget(self.sel_draw_color_entry)
  1358. self.form_box_child_11.addWidget(self.sel_draw_color_button)
  1359. self.form_box_child_11.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  1360. grid0.addWidget(self.sel_draw_color_label, 27, 0)
  1361. grid0.addLayout(self.form_box_child_11, 27, 1)
  1362. separator_line = QtWidgets.QFrame()
  1363. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  1364. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  1365. grid0.addWidget(separator_line, 28, 0, 1, 2)
  1366. # ------------------------------------------------------------------
  1367. # ----------------------- Project Settings -----------------------------
  1368. # ------------------------------------------------------------------
  1369. self.proj_settings_label = QtWidgets.QLabel('<b>%s</b>' % _('Project Items Color'))
  1370. grid0.addWidget(self.proj_settings_label, 29, 0, 1, 2)
  1371. # Project Tab items color
  1372. self.proj_color_label = QtWidgets.QLabel('%s:' % _('Enabled'))
  1373. self.proj_color_label.setToolTip(
  1374. _("Set the color of the items in Project Tab Tree.")
  1375. )
  1376. self.proj_color_entry = FCEntry()
  1377. self.proj_color_button = QtWidgets.QPushButton()
  1378. self.proj_color_button.setFixedSize(15, 15)
  1379. self.form_box_child_12 = QtWidgets.QHBoxLayout()
  1380. self.form_box_child_12.addWidget(self.proj_color_entry)
  1381. self.form_box_child_12.addWidget(self.proj_color_button)
  1382. self.form_box_child_12.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  1383. grid0.addWidget(self.proj_color_label, 30, 0)
  1384. grid0.addLayout(self.form_box_child_12, 30, 1)
  1385. self.proj_color_dis_label = QtWidgets.QLabel('%s:' % _('Disabled'))
  1386. self.proj_color_dis_label.setToolTip(
  1387. _("Set the color of the items in Project Tab Tree,\n"
  1388. "for the case when the items are disabled.")
  1389. )
  1390. self.proj_color_dis_entry = FCEntry()
  1391. self.proj_color_dis_button = QtWidgets.QPushButton()
  1392. self.proj_color_dis_button.setFixedSize(15, 15)
  1393. self.form_box_child_13 = QtWidgets.QHBoxLayout()
  1394. self.form_box_child_13.addWidget(self.proj_color_dis_entry)
  1395. self.form_box_child_13.addWidget(self.proj_color_dis_button)
  1396. self.form_box_child_13.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  1397. grid0.addWidget(self.proj_color_dis_label, 31, 0)
  1398. grid0.addLayout(self.form_box_child_13, 31, 1)
  1399. # Project autohide CB
  1400. self.project_autohide_cb = FCCheckBox(label=_('Project AutoHide'))
  1401. self.project_autohide_cb.setToolTip(
  1402. _("Check this box if you want the project/selected/tool tab area to\n"
  1403. "hide automatically when there are no objects loaded and\n"
  1404. "to show whenever a new object is created.")
  1405. )
  1406. grid0.addWidget(self.project_autohide_cb, 32, 0, 1, 2)
  1407. # Just to add empty rows
  1408. grid0.addWidget(QtWidgets.QLabel(''), 33, 0, 1, 2)
  1409. self.layout.addStretch()
  1410. self.theme_button.clicked.connect(self.on_theme_change)
  1411. # #############################################################################
  1412. # ############################# GUI COLORS SIGNALS ############################
  1413. # #############################################################################
  1414. # Setting selection (left - right) colors signals
  1415. self.sf_color_entry.editingFinished.connect(self.on_sf_color_entry)
  1416. self.sf_color_button.clicked.connect(self.on_sf_color_button)
  1417. self.sf_color_alpha_spinner.valueChanged.connect(self.on_sf_color_spinner)
  1418. self.sf_color_alpha_slider.valueChanged.connect(self.on_sf_color_slider)
  1419. self.sl_color_entry.editingFinished.connect(self.on_sl_color_entry)
  1420. self.sl_color_button.clicked.connect(self.on_sl_color_button)
  1421. # Setting selection (right - left) colors signals
  1422. self.alt_sf_color_entry.editingFinished.connect(self.on_alt_sf_color_entry)
  1423. self.alt_sf_color_button.clicked.connect(self.on_alt_sf_color_button)
  1424. self.alt_sf_color_alpha_spinner.valueChanged.connect(self.on_alt_sf_color_spinner)
  1425. self.alt_sf_color_alpha_slider.valueChanged.connect(self.on_alt_sf_color_slider)
  1426. self.alt_sl_color_entry.editingFinished.connect(self.on_alt_sl_color_entry)
  1427. self.alt_sl_color_button.clicked.connect(self.on_alt_sl_color_button)
  1428. # Setting Editor Draw colors signals
  1429. self.draw_color_entry.editingFinished.connect(self.on_draw_color_entry)
  1430. self.draw_color_button.clicked.connect( self.on_draw_color_button)
  1431. self.sel_draw_color_entry.editingFinished.connect(self.on_sel_draw_color_entry)
  1432. self.sel_draw_color_button.clicked.connect(self.on_sel_draw_color_button)
  1433. self.proj_color_entry.editingFinished.connect(self.on_proj_color_entry)
  1434. self.proj_color_button.clicked.connect(self.on_proj_color_button)
  1435. self.proj_color_dis_entry.editingFinished.connect(self.on_proj_color_dis_entry)
  1436. self.proj_color_dis_button.clicked.connect(self.on_proj_color_dis_button)
  1437. self.layout_combo.activated.connect(self.on_layout)
  1438. def on_theme_change(self):
  1439. val = self.theme_radio.get_value()
  1440. t_settings = QSettings("Open Source", "FlatCAM")
  1441. t_settings.setValue('theme', val)
  1442. # This will write the setting to the platform specific storage.
  1443. del t_settings
  1444. self.app.on_app_restart()
  1445. def handle_style(self, style):
  1446. # set current style
  1447. settings = QSettings("Open Source", "FlatCAM")
  1448. settings.setValue('style', style)
  1449. # This will write the setting to the platform specific storage.
  1450. del settings
  1451. def handle_hdpi(self, state):
  1452. # set current HDPI
  1453. settings = QSettings("Open Source", "FlatCAM")
  1454. settings.setValue('hdpi', state)
  1455. # This will write the setting to the platform specific storage.
  1456. del settings
  1457. # Setting selection colors (left - right) handlers
  1458. def on_sf_color_entry(self):
  1459. self.app.defaults['global_sel_fill'] = self.app.defaults['global_sel_fill'][7:9]
  1460. self.sf_color_button.setStyleSheet("background-color:%s" % str(self.app.defaults['global_sel_fill'])[:7])
  1461. def on_sf_color_button(self):
  1462. current_color = QtGui.QColor(self.app.defaults['global_sel_fill'][:7])
  1463. c_dialog = QtWidgets.QColorDialog()
  1464. plot_fill_color = c_dialog.getColor(initial=current_color)
  1465. if plot_fill_color.isValid() is False:
  1466. return
  1467. self.sf_color_button.setStyleSheet("background-color:%s" % str(plot_fill_color.name()))
  1468. new_val = str(plot_fill_color.name()) + str(self.app.defaults['global_sel_fill'][7:9])
  1469. self.sf_color_entry.set_value(new_val)
  1470. self.app.defaults['global_sel_fill'] = new_val
  1471. def on_sf_color_spinner(self):
  1472. spinner_value = self.sf_color_alpha_spinner.value()
  1473. self.sf_color_alpha_slider.setValue(spinner_value)
  1474. self.app.defaults['global_sel_fill'] = self.app.defaults['global_sel_fill'][:7] + \
  1475. (hex(spinner_value)[2:] if int(hex(spinner_value)[2:], 16) > 0 else '00')
  1476. self.app.defaults['global_sel_line'] = self.app.defaults['global_sel_line'][:7] + \
  1477. (hex(spinner_value)[2:] if int(hex(spinner_value)[2:], 16) > 0 else '00')
  1478. def on_sf_color_slider(self):
  1479. slider_value = self.sf_color_alpha_slider.value()
  1480. self.sf_color_alpha_spinner.setValue(slider_value)
  1481. def on_sl_color_entry(self):
  1482. self.app.defaults['global_sel_line'] = self.sl_color_entry.get_value()[:7] + \
  1483. self.app.defaults['global_sel_line'][7:9]
  1484. self.sl_color_button.setStyleSheet("background-color:%s" % str(self.app.defaults['global_sel_line'])[:7])
  1485. def on_sl_color_button(self):
  1486. current_color = QtGui.QColor(self.app.defaults['global_sel_line'][:7])
  1487. c_dialog = QtWidgets.QColorDialog()
  1488. plot_line_color = c_dialog.getColor(initial=current_color)
  1489. if plot_line_color.isValid() is False:
  1490. return
  1491. self.sl_color_button.setStyleSheet("background-color:%s" % str(plot_line_color.name()))
  1492. new_val_line = str(plot_line_color.name()) + str(self.app.defaults['global_sel_line'][7:9])
  1493. self.sl_color_entry.set_value(new_val_line)
  1494. self.app.defaults['global_sel_line'] = new_val_line
  1495. # Setting selection colors (right - left) handlers
  1496. def on_alt_sf_color_entry(self):
  1497. self.app.defaults['global_alt_sel_fill'] = self.alt_sf_color_entry.get_value()[:7] + \
  1498. self.app.defaults['global_alt_sel_fill'][7:9]
  1499. self.alt_sf_color_button.setStyleSheet(
  1500. "background-color:%s" % str(self.app.defaults['global_alt_sel_fill'])[:7]
  1501. )
  1502. def on_alt_sf_color_button(self):
  1503. current_color = QtGui.QColor(self.app.defaults['global_alt_sel_fill'][:7])
  1504. c_dialog = QtWidgets.QColorDialog()
  1505. plot_fill_color = c_dialog.getColor(initial=current_color)
  1506. if plot_fill_color.isValid() is False:
  1507. return
  1508. self.alt_sf_color_button.setStyleSheet("background-color:%s" % str(plot_fill_color.name()))
  1509. new_val = str(plot_fill_color.name()) + str(self.app.defaults['global_alt_sel_fill'][7:9])
  1510. self.alt_sf_color_entry.set_value(new_val)
  1511. self.app.defaults['global_alt_sel_fill'] = new_val
  1512. def on_alt_sf_color_spinner(self):
  1513. spinner_value = self.alt_sf_color_alpha_spinner.value()
  1514. self.alt_sf_color_alpha_slider.setValue(spinner_value)
  1515. self.app.defaults['global_alt_sel_fill'] = self.app.defaults['global_alt_sel_fill'][:7] + \
  1516. (hex(spinner_value)[2:] if int(hex(spinner_value)[2:], 16) > 0 else '00')
  1517. self.app.defaults['global_alt_sel_line'] = self.app.defaults['global_alt_sel_line'][:7] + \
  1518. (hex(spinner_value)[2:] if int(hex(spinner_value)[2:], 16) > 0 else '00')
  1519. def on_alt_sf_color_slider(self):
  1520. slider_value = self.alt_sf_color_alpha_slider.value()
  1521. self.alt_sf_color_alpha_spinner.setValue(slider_value)
  1522. def on_alt_sl_color_entry(self):
  1523. self.app.defaults['global_alt_sel_line'] = self.alt_sl_color_entry.get_value()[:7] + \
  1524. self.app.defaults['global_alt_sel_line'][7:9]
  1525. self.alt_sl_color_button.setStyleSheet(
  1526. "background-color:%s" % str(self.app.defaults['global_alt_sel_line'])[:7]
  1527. )
  1528. def on_alt_sl_color_button(self):
  1529. current_color = QtGui.QColor(self.app.defaults['global_alt_sel_line'][:7])
  1530. c_dialog = QtWidgets.QColorDialog()
  1531. plot_line_color = c_dialog.getColor(initial=current_color)
  1532. if plot_line_color.isValid() is False:
  1533. return
  1534. self.alt_sl_color_button.setStyleSheet("background-color:%s" % str(plot_line_color.name()))
  1535. new_val_line = str(plot_line_color.name()) + str(self.app.defaults['global_alt_sel_line'][7:9])
  1536. self.alt_sl_color_entry.set_value(new_val_line)
  1537. self.app.defaults['global_alt_sel_line'] = new_val_line
  1538. # Setting Editor colors
  1539. def on_draw_color_entry(self):
  1540. self.app.defaults['global_draw_color'] = self.draw_color_entry.get_value()
  1541. self.draw_color_button.setStyleSheet("background-color:%s" % str(self.app.defaults['global_draw_color']))
  1542. def on_draw_color_button(self):
  1543. current_color = QtGui.QColor(self.app.defaults['global_draw_color'])
  1544. c_dialog = QtWidgets.QColorDialog()
  1545. draw_color = c_dialog.getColor(initial=current_color)
  1546. if draw_color.isValid() is False:
  1547. return
  1548. self.draw_color_button.setStyleSheet("background-color:%s" % str(draw_color.name()))
  1549. new_val = str(draw_color.name())
  1550. self.draw_color_entry.set_value(new_val)
  1551. self.app.defaults['global_draw_color'] = new_val
  1552. def on_sel_draw_color_entry(self):
  1553. self.app.defaults['global_sel_draw_color'] = self.sel_draw_color_entry.get_value()
  1554. self.sel_draw_color_button.setStyleSheet(
  1555. "background-color:%s" % str(self.app.defaults['global_sel_draw_color']))
  1556. def on_sel_draw_color_button(self):
  1557. current_color = QtGui.QColor(self.app.defaults['global_sel_draw_color'])
  1558. c_dialog = QtWidgets.QColorDialog()
  1559. sel_draw_color = c_dialog.getColor(initial=current_color)
  1560. if sel_draw_color.isValid() is False:
  1561. return
  1562. self.sel_draw_color_button.setStyleSheet("background-color:%s" % str(sel_draw_color.name()))
  1563. new_val_sel = str(sel_draw_color.name())
  1564. self.sel_draw_color_entry.set_value(new_val_sel)
  1565. self.app.defaults['global_sel_draw_color'] = new_val_sel
  1566. def on_proj_color_entry(self):
  1567. self.app.defaults['global_proj_item_color'] = self.proj_color_entry.get_value()
  1568. self.proj_color_button.setStyleSheet(
  1569. "background-color:%s" % str(self.app.defaults['global_proj_item_color']))
  1570. def on_proj_color_button(self):
  1571. current_color = QtGui.QColor(self.app.defaults['global_proj_item_color'])
  1572. c_dialog = QtWidgets.QColorDialog()
  1573. proj_color = c_dialog.getColor(initial=current_color)
  1574. if proj_color.isValid() is False:
  1575. return
  1576. self.proj_color_button.setStyleSheet("background-color:%s" % str(proj_color.name()))
  1577. new_val_sel = str(proj_color.name())
  1578. self.proj_color_entry.set_value(new_val_sel)
  1579. self.app.defaults['global_proj_item_color'] = new_val_sel
  1580. def on_proj_color_dis_entry(self):
  1581. self.app.defaults['global_proj_item_dis_color'] = self.proj_color_dis_entry.get_value()
  1582. self.proj_color_dis_button.setStyleSheet(
  1583. "background-color:%s" % str(self.app.defaults['global_proj_item_dis_color']))
  1584. def on_proj_color_dis_button(self):
  1585. current_color = QtGui.QColor(self.app.defaults['global_proj_item_dis_color'])
  1586. c_dialog = QtWidgets.QColorDialog()
  1587. proj_color = c_dialog.getColor(initial=current_color)
  1588. if proj_color.isValid() is False:
  1589. return
  1590. self.proj_color_dis_button.setStyleSheet("background-color:%s" % str(proj_color.name()))
  1591. new_val_sel = str(proj_color.name())
  1592. self.proj_color_dis_entry.set_value(new_val_sel)
  1593. self.app.defaults['global_proj_item_dis_color'] = new_val_sel
  1594. def on_layout(self, index=None, lay=None):
  1595. """
  1596. Set the toolbars layout (location)
  1597. :param index:
  1598. :param lay: Type of layout to be set on the toolbard
  1599. :return: None
  1600. """
  1601. self.app.report_usage("on_layout()")
  1602. if lay:
  1603. current_layout = lay
  1604. else:
  1605. current_layout = self.layout_combo.get_value()
  1606. lay_settings = QSettings("Open Source", "FlatCAM")
  1607. lay_settings.setValue('layout', current_layout)
  1608. # This will write the setting to the platform specific storage.
  1609. del lay_settings
  1610. # first remove the toolbars:
  1611. try:
  1612. self.app.ui.removeToolBar(self.app.ui.toolbarfile)
  1613. self.app.ui.removeToolBar(self.app.ui.toolbargeo)
  1614. self.app.ui.removeToolBar(self.app.ui.toolbarview)
  1615. self.app.ui.removeToolBar(self.app.ui.toolbarshell)
  1616. self.app.ui.removeToolBar(self.app.ui.toolbartools)
  1617. self.app.ui.removeToolBar(self.app.ui.exc_edit_toolbar)
  1618. self.app.ui.removeToolBar(self.app.ui.geo_edit_toolbar)
  1619. self.app.ui.removeToolBar(self.app.ui.grb_edit_toolbar)
  1620. self.app.ui.removeToolBar(self.app.ui.snap_toolbar)
  1621. self.app.ui.removeToolBar(self.app.ui.toolbarshell)
  1622. except Exception:
  1623. pass
  1624. if current_layout == 'compact':
  1625. # ## TOOLBAR INSTALLATION # ##
  1626. self.app.ui.toolbarfile = QtWidgets.QToolBar('File Toolbar')
  1627. self.app.ui.toolbarfile.setObjectName('File_TB')
  1628. self.app.ui.addToolBar(Qt.LeftToolBarArea, self.app.ui.toolbarfile)
  1629. self.app.ui.toolbargeo = QtWidgets.QToolBar('Edit Toolbar')
  1630. self.app.ui.toolbargeo.setObjectName('Edit_TB')
  1631. self.app.ui.addToolBar(Qt.LeftToolBarArea, self.app.ui.toolbargeo)
  1632. self.app.ui.toolbarshell = QtWidgets.QToolBar('Shell Toolbar')
  1633. self.app.ui.toolbarshell.setObjectName('Shell_TB')
  1634. self.app.ui.addToolBar(Qt.LeftToolBarArea, self.app.ui.toolbarshell)
  1635. self.app.ui.toolbartools = QtWidgets.QToolBar('Tools Toolbar')
  1636. self.app.ui.toolbartools.setObjectName('Tools_TB')
  1637. self.app.ui.addToolBar(Qt.LeftToolBarArea, self.app.ui.toolbartools)
  1638. self.app.ui.geo_edit_toolbar = QtWidgets.QToolBar('Geometry Editor Toolbar')
  1639. # self.app.ui.geo_edit_toolbar.setVisible(False)
  1640. self.app.ui.geo_edit_toolbar.setObjectName('GeoEditor_TB')
  1641. self.app.ui.addToolBar(Qt.RightToolBarArea, self.app.ui.geo_edit_toolbar)
  1642. self.app.ui.toolbarview = QtWidgets.QToolBar('View Toolbar')
  1643. self.app.ui.toolbarview.setObjectName('View_TB')
  1644. self.app.ui.addToolBar(Qt.RightToolBarArea, self.app.ui.toolbarview)
  1645. self.app.ui.addToolBarBreak(area=Qt.RightToolBarArea)
  1646. self.app.ui.grb_edit_toolbar = QtWidgets.QToolBar('Gerber Editor Toolbar')
  1647. # self.app.ui.grb_edit_toolbar.setVisible(False)
  1648. self.app.ui.grb_edit_toolbar.setObjectName('GrbEditor_TB')
  1649. self.app.ui.addToolBar(Qt.RightToolBarArea, self.app.ui.grb_edit_toolbar)
  1650. self.app.ui.exc_edit_toolbar = QtWidgets.QToolBar('Excellon Editor Toolbar')
  1651. self.app.ui.exc_edit_toolbar.setObjectName('ExcEditor_TB')
  1652. self.app.ui.addToolBar(Qt.RightToolBarArea, self.app.ui.exc_edit_toolbar)
  1653. self.app.ui.snap_toolbar = QtWidgets.QToolBar('Grid Toolbar')
  1654. self.app.ui.snap_toolbar.setObjectName('Snap_TB')
  1655. self.app.ui.snap_toolbar.setMaximumHeight(30)
  1656. self.app.ui.splitter_left.addWidget(self.app.ui.snap_toolbar)
  1657. self.app.ui.corner_snap_btn.setVisible(True)
  1658. self.app.ui.snap_magnet.setVisible(True)
  1659. else:
  1660. # ## TOOLBAR INSTALLATION # ##
  1661. self.app.ui.toolbarfile = QtWidgets.QToolBar('File Toolbar')
  1662. self.app.ui.toolbarfile.setObjectName('File_TB')
  1663. self.app.ui.addToolBar(self.app.ui.toolbarfile)
  1664. self.app.ui.toolbargeo = QtWidgets.QToolBar('Edit Toolbar')
  1665. self.app.ui.toolbargeo.setObjectName('Edit_TB')
  1666. self.app.ui.addToolBar(self.app.ui.toolbargeo)
  1667. self.app.ui.toolbarview = QtWidgets.QToolBar('View Toolbar')
  1668. self.app.ui.toolbarview.setObjectName('View_TB')
  1669. self.app.ui.addToolBar(self.app.ui.toolbarview)
  1670. self.app.ui.toolbarshell = QtWidgets.QToolBar('Shell Toolbar')
  1671. self.app.ui.toolbarshell.setObjectName('Shell_TB')
  1672. self.app.ui.addToolBar(self.app.ui.toolbarshell)
  1673. self.app.ui.toolbartools = QtWidgets.QToolBar('Tools Toolbar')
  1674. self.app.ui.toolbartools.setObjectName('Tools_TB')
  1675. self.app.ui.addToolBar(self.app.ui.toolbartools)
  1676. self.app.ui.exc_edit_toolbar = QtWidgets.QToolBar('Excellon Editor Toolbar')
  1677. # self.app.ui.exc_edit_toolbar.setVisible(False)
  1678. self.app.ui.exc_edit_toolbar.setObjectName('ExcEditor_TB')
  1679. self.app.ui.addToolBar(self.app.ui.exc_edit_toolbar)
  1680. self.app.ui.addToolBarBreak()
  1681. self.app.ui.geo_edit_toolbar = QtWidgets.QToolBar('Geometry Editor Toolbar')
  1682. # self.app.ui.geo_edit_toolbar.setVisible(False)
  1683. self.app.ui.geo_edit_toolbar.setObjectName('GeoEditor_TB')
  1684. self.app.ui.addToolBar(self.app.ui.geo_edit_toolbar)
  1685. self.app.ui.grb_edit_toolbar = QtWidgets.QToolBar('Gerber Editor Toolbar')
  1686. # self.app.ui.grb_edit_toolbar.setVisible(False)
  1687. self.app.ui.grb_edit_toolbar.setObjectName('GrbEditor_TB')
  1688. self.app.ui.addToolBar(self.app.ui.grb_edit_toolbar)
  1689. self.app.ui.snap_toolbar = QtWidgets.QToolBar('Grid Toolbar')
  1690. self.app.ui.snap_toolbar.setObjectName('Snap_TB')
  1691. # self.app.ui.snap_toolbar.setMaximumHeight(30)
  1692. self.app.ui.addToolBar(self.app.ui.snap_toolbar)
  1693. self.app.ui.corner_snap_btn.setVisible(False)
  1694. self.app.ui.snap_magnet.setVisible(False)
  1695. if current_layout == 'minimal':
  1696. self.app.ui.toolbarview.setVisible(False)
  1697. self.app.ui.toolbarshell.setVisible(False)
  1698. self.app.ui.snap_toolbar.setVisible(False)
  1699. self.app.ui.geo_edit_toolbar.setVisible(False)
  1700. self.app.ui.grb_edit_toolbar.setVisible(False)
  1701. self.app.ui.exc_edit_toolbar.setVisible(False)
  1702. self.app.ui.lock_toolbar(lock=True)
  1703. # add all the actions to the toolbars
  1704. self.app.ui.populate_toolbars()
  1705. # reconnect all the signals to the toolbar actions
  1706. self.app.connect_toolbar_signals()
  1707. self.app.ui.grid_snap_btn.setChecked(True)
  1708. self.app.on_grid_snap_triggered(state=True)
  1709. self.app.ui.grid_gap_x_entry.setText(str(self.app.defaults["global_gridx"]))
  1710. self.app.ui.grid_gap_y_entry.setText(str(self.app.defaults["global_gridy"]))
  1711. self.app.ui.snap_max_dist_entry.setText(str(self.app.defaults["global_snap_max"]))
  1712. self.app.ui.grid_gap_link_cb.setChecked(True)
  1713. class GeneralAPPSetGroupUI(OptionsGroupUI):
  1714. def __init__(self, decimals=4, parent=None):
  1715. super(GeneralAPPSetGroupUI, self).__init__(self)
  1716. self.setTitle(str(_("App Settings")))
  1717. self.decimals = decimals
  1718. theme_settings = QtCore.QSettings("Open Source", "FlatCAM")
  1719. if theme_settings.contains("theme"):
  1720. theme = theme_settings.value('theme', type=str)
  1721. else:
  1722. theme = 'white'
  1723. if theme == 'white':
  1724. self.resource_loc = 'share'
  1725. else:
  1726. self.resource_loc = 'share'
  1727. # Create a grid layout for the Application general settings
  1728. grid0 = QtWidgets.QGridLayout()
  1729. self.layout.addLayout(grid0)
  1730. grid0.setColumnStretch(0, 0)
  1731. grid0.setColumnStretch(1, 1)
  1732. # GRID Settings
  1733. self.grid_label = QtWidgets.QLabel('<b>%s</b>' % _('Grid Settings'))
  1734. grid0.addWidget(self.grid_label, 0, 0, 1, 2)
  1735. # Grid X Entry
  1736. self.gridx_label = QtWidgets.QLabel('%s:' % _('X value'))
  1737. self.gridx_label.setToolTip(
  1738. _("This is the Grid snap value on X axis.")
  1739. )
  1740. self.gridx_entry = FCDoubleSpinner()
  1741. self.gridx_entry.set_precision(self.decimals)
  1742. self.gridx_entry.setSingleStep(0.1)
  1743. grid0.addWidget(self.gridx_label, 1, 0)
  1744. grid0.addWidget(self.gridx_entry, 1, 1)
  1745. # Grid Y Entry
  1746. self.gridy_label = QtWidgets.QLabel('%s:' % _('Y value'))
  1747. self.gridy_label.setToolTip(
  1748. _("This is the Grid snap value on Y axis.")
  1749. )
  1750. self.gridy_entry = FCDoubleSpinner()
  1751. self.gridy_entry.set_precision(self.decimals)
  1752. self.gridy_entry.setSingleStep(0.1)
  1753. grid0.addWidget(self.gridy_label, 2, 0)
  1754. grid0.addWidget(self.gridy_entry, 2, 1)
  1755. # Snap Max Entry
  1756. self.snap_max_label = QtWidgets.QLabel('%s:' % _('Snap Max'))
  1757. self.snap_max_label.setToolTip(_("Max. magnet distance"))
  1758. self.snap_max_dist_entry = FCDoubleSpinner()
  1759. self.snap_max_dist_entry.set_precision(self.decimals)
  1760. self.snap_max_dist_entry.setSingleStep(0.1)
  1761. grid0.addWidget(self.snap_max_label, 3, 0)
  1762. grid0.addWidget(self.snap_max_dist_entry, 3, 1)
  1763. separator_line = QtWidgets.QFrame()
  1764. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  1765. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  1766. grid0.addWidget(separator_line, 4, 0, 1, 2)
  1767. # Workspace
  1768. self.workspace_label = QtWidgets.QLabel('<b>%s</b>' % _('Workspace Settings'))
  1769. grid0.addWidget(self.workspace_label, 5, 0, 1, 2)
  1770. self.workspace_cb = FCCheckBox('%s' % _('Active'))
  1771. self.workspace_cb.setToolTip(
  1772. _("Draw a delimiting rectangle on canvas.\n"
  1773. "The purpose is to illustrate the limits for our work.")
  1774. )
  1775. grid0.addWidget(self.workspace_cb, 6, 0, 1, 2)
  1776. self.workspace_type_lbl = QtWidgets.QLabel('%s:' % _('Size'))
  1777. self.workspace_type_lbl.setToolTip(
  1778. _("Select the type of rectangle to be used on canvas,\n"
  1779. "as valid workspace.")
  1780. )
  1781. self.wk_cb = FCComboBox()
  1782. grid0.addWidget(self.workspace_type_lbl, 7, 0)
  1783. grid0.addWidget(self.wk_cb, 7, 1)
  1784. self.pagesize = {}
  1785. self.pagesize.update(
  1786. {
  1787. 'A0': (841, 1189),
  1788. 'A1': (594, 841),
  1789. 'A2': (420, 594),
  1790. 'A3': (297, 420),
  1791. 'A4': (210, 297),
  1792. 'A5': (148, 210),
  1793. 'A6': (105, 148),
  1794. 'A7': (74, 105),
  1795. 'A8': (52, 74),
  1796. 'A9': (37, 52),
  1797. 'A10': (26, 37),
  1798. 'B0': (1000, 1414),
  1799. 'B1': (707, 1000),
  1800. 'B2': (500, 707),
  1801. 'B3': (353, 500),
  1802. 'B4': (250, 353),
  1803. 'B5': (176, 250),
  1804. 'B6': (125, 176),
  1805. 'B7': (88, 125),
  1806. 'B8': (62, 88),
  1807. 'B9': (44, 62),
  1808. 'B10': (31, 44),
  1809. 'C0': (917, 1297),
  1810. 'C1': (648, 917),
  1811. 'C2': (458, 648),
  1812. 'C3': (324, 458),
  1813. 'C4': (229, 324),
  1814. 'C5': (162, 229),
  1815. 'C6': (114, 162),
  1816. 'C7': (81, 114),
  1817. 'C8': (57, 81),
  1818. 'C9': (40, 57),
  1819. 'C10': (28, 40),
  1820. # American paper sizes
  1821. 'LETTER': (8.5, 11),
  1822. 'LEGAL': (8.5, 14),
  1823. 'ELEVENSEVENTEEN': (11, 17),
  1824. # From https://en.wikipedia.org/wiki/Paper_size
  1825. 'JUNIOR_LEGAL': (5, 8),
  1826. 'HALF_LETTER': (5.5, 8),
  1827. 'GOV_LETTER': (8, 10.5),
  1828. 'GOV_LEGAL': (8.5, 13),
  1829. 'LEDGER': (17, 11),
  1830. }
  1831. )
  1832. page_size_list = list(self.pagesize.keys())
  1833. self.wk_cb.addItems(page_size_list)
  1834. # Page orientation
  1835. self.wk_orientation_label = QtWidgets.QLabel('%s:' % _("Orientation"))
  1836. self.wk_orientation_label.setToolTip(_("Can be:\n"
  1837. "- Portrait\n"
  1838. "- Landscape"))
  1839. self.wk_orientation_radio = RadioSet([{'label': _('Portrait'), 'value': 'p'},
  1840. {'label': _('Landscape'), 'value': 'l'},
  1841. ], stretch=False)
  1842. self.wks = OptionalInputSection(self.workspace_cb,
  1843. [
  1844. self.workspace_type_lbl,
  1845. self.wk_cb,
  1846. self.wk_orientation_label,
  1847. self.wk_orientation_radio
  1848. ])
  1849. grid0.addWidget(self.wk_orientation_label, 8, 0)
  1850. grid0.addWidget(self.wk_orientation_radio, 8, 1)
  1851. separator_line = QtWidgets.QFrame()
  1852. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  1853. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  1854. grid0.addWidget(separator_line, 9, 0, 1, 2)
  1855. # Font Size
  1856. self.font_size_label = QtWidgets.QLabel('<b>%s</b>' % _('Font Size'))
  1857. grid0.addWidget(self.font_size_label, 10, 0, 1, 2)
  1858. # Notebook Font Size
  1859. self.notebook_font_size_label = QtWidgets.QLabel('%s:' % _('Notebook'))
  1860. self.notebook_font_size_label.setToolTip(
  1861. _("This sets the font size for the elements found in the Notebook.\n"
  1862. "The notebook is the collapsible area in the left side of the GUI,\n"
  1863. "and include the Project, Selected and Tool tabs.")
  1864. )
  1865. self.notebook_font_size_spinner = FCSpinner()
  1866. self.notebook_font_size_spinner.set_range(8, 40)
  1867. self.notebook_font_size_spinner.setWrapping(True)
  1868. settings = QSettings("Open Source", "FlatCAM")
  1869. if settings.contains("notebook_font_size"):
  1870. self.notebook_font_size_spinner.set_value(settings.value('notebook_font_size', type=int))
  1871. else:
  1872. self.notebook_font_size_spinner.set_value(12)
  1873. grid0.addWidget(self.notebook_font_size_label, 11, 0)
  1874. grid0.addWidget(self.notebook_font_size_spinner, 11, 1)
  1875. # Axis Font Size
  1876. self.axis_font_size_label = QtWidgets.QLabel('%s:' % _('Axis'))
  1877. self.axis_font_size_label.setToolTip(
  1878. _("This sets the font size for canvas axis.")
  1879. )
  1880. self.axis_font_size_spinner = FCSpinner()
  1881. self.axis_font_size_spinner.set_range(0, 40)
  1882. self.axis_font_size_spinner.setWrapping(True)
  1883. settings = QSettings("Open Source", "FlatCAM")
  1884. if settings.contains("axis_font_size"):
  1885. self.axis_font_size_spinner.set_value(settings.value('axis_font_size', type=int))
  1886. else:
  1887. self.axis_font_size_spinner.set_value(8)
  1888. grid0.addWidget(self.axis_font_size_label, 12, 0)
  1889. grid0.addWidget(self.axis_font_size_spinner, 12, 1)
  1890. # TextBox Font Size
  1891. self.textbox_font_size_label = QtWidgets.QLabel('%s:' % _('Textbox'))
  1892. self.textbox_font_size_label.setToolTip(
  1893. _("This sets the font size for the Textbox GUI\n"
  1894. "elements that are used in FlatCAM.")
  1895. )
  1896. self.textbox_font_size_spinner = FCSpinner()
  1897. self.textbox_font_size_spinner.set_range(8, 40)
  1898. self.textbox_font_size_spinner.setWrapping(True)
  1899. settings = QSettings("Open Source", "FlatCAM")
  1900. if settings.contains("textbox_font_size"):
  1901. self.textbox_font_size_spinner.set_value(settings.value('textbox_font_size', type=int))
  1902. else:
  1903. self.textbox_font_size_spinner.set_value(10)
  1904. grid0.addWidget(self.textbox_font_size_label, 13, 0)
  1905. grid0.addWidget(self.textbox_font_size_spinner, 13, 1)
  1906. separator_line = QtWidgets.QFrame()
  1907. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  1908. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  1909. grid0.addWidget(separator_line, 14, 0, 1, 2)
  1910. # -----------------------------------------------------------
  1911. # -------------- MOUSE SETTINGS -----------------------------
  1912. # -----------------------------------------------------------
  1913. self.mouse_lbl = QtWidgets.QLabel('<b>%s</b>' % _('Mouse Settings'))
  1914. grid0.addWidget(self.mouse_lbl, 21, 0, 1, 2)
  1915. # Mouse Cursor Shape
  1916. self.cursor_lbl = QtWidgets.QLabel('%s:' % _('Cursor Shape'))
  1917. self.cursor_lbl.setToolTip(
  1918. _("Choose a mouse cursor shape.\n"
  1919. "- Small -> with a customizable size.\n"
  1920. "- Big -> Infinite lines")
  1921. )
  1922. self.cursor_radio = RadioSet([
  1923. {"label": _("Small"), "value": "small"},
  1924. {"label": _("Big"), "value": "big"}
  1925. ], orientation='horizontal', stretch=False)
  1926. grid0.addWidget(self.cursor_lbl, 22, 0)
  1927. grid0.addWidget(self.cursor_radio, 22, 1)
  1928. # Mouse Cursor Size
  1929. self.cursor_size_lbl = QtWidgets.QLabel('%s:' % _('Cursor Size'))
  1930. self.cursor_size_lbl.setToolTip(
  1931. _("Set the size of the mouse cursor, in pixels.")
  1932. )
  1933. self.cursor_size_entry = FCSpinner()
  1934. self.cursor_size_entry.set_range(10, 70)
  1935. self.cursor_size_entry.setWrapping(True)
  1936. grid0.addWidget(self.cursor_size_lbl, 23, 0)
  1937. grid0.addWidget(self.cursor_size_entry, 23, 1)
  1938. # Cursor Width
  1939. self.cursor_width_lbl = QtWidgets.QLabel('%s:' % _('Cursor Width'))
  1940. self.cursor_width_lbl.setToolTip(
  1941. _("Set the line width of the mouse cursor, in pixels.")
  1942. )
  1943. self.cursor_width_entry = FCSpinner()
  1944. self.cursor_width_entry.set_range(1, 10)
  1945. self.cursor_width_entry.setWrapping(True)
  1946. grid0.addWidget(self.cursor_width_lbl, 24, 0)
  1947. grid0.addWidget(self.cursor_width_entry, 24, 1)
  1948. # Cursor Color Enable
  1949. self.mouse_cursor_color_cb = FCCheckBox(label='%s' % _('Cursor Color'))
  1950. self.mouse_cursor_color_cb.setToolTip(
  1951. _("Check this box to color mouse cursor.")
  1952. )
  1953. grid0.addWidget(self.mouse_cursor_color_cb, 25, 0, 1, 2)
  1954. # Cursor Color
  1955. self.mouse_color_label = QtWidgets.QLabel('%s:' % _('Cursor Color'))
  1956. self.mouse_color_label.setToolTip(
  1957. _("Set the color of the mouse cursor.")
  1958. )
  1959. self.mouse_cursor_entry = FCEntry()
  1960. self.mouse_cursor_button = QtWidgets.QPushButton()
  1961. self.mouse_cursor_button.setFixedSize(15, 15)
  1962. self.form_box_child_1 = QtWidgets.QHBoxLayout()
  1963. self.form_box_child_1.addWidget(self.mouse_cursor_entry)
  1964. self.form_box_child_1.addWidget(self.mouse_cursor_button)
  1965. self.form_box_child_1.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  1966. grid0.addWidget(self.mouse_color_label, 26, 0)
  1967. grid0.addLayout(self.form_box_child_1, 26, 1)
  1968. self.mois = OptionalInputSection(
  1969. self.mouse_cursor_color_cb,
  1970. [
  1971. self.mouse_color_label,
  1972. self.mouse_cursor_entry,
  1973. self.mouse_cursor_button
  1974. ]
  1975. )
  1976. # Select mouse pan button
  1977. self.panbuttonlabel = QtWidgets.QLabel('%s:' % _('Pan Button'))
  1978. self.panbuttonlabel.setToolTip(
  1979. _("Select the mouse button to use for panning:\n"
  1980. "- MMB --> Middle Mouse Button\n"
  1981. "- RMB --> Right Mouse Button")
  1982. )
  1983. self.pan_button_radio = RadioSet([{'label': _('MMB'), 'value': '3'},
  1984. {'label': _('RMB'), 'value': '2'}])
  1985. grid0.addWidget(self.panbuttonlabel, 27, 0)
  1986. grid0.addWidget(self.pan_button_radio, 27, 1)
  1987. # Multiple Selection Modifier Key
  1988. self.mselectlabel = QtWidgets.QLabel('%s:' % _('Multiple Selection'))
  1989. self.mselectlabel.setToolTip(
  1990. _("Select the key used for multiple selection.")
  1991. )
  1992. self.mselect_radio = RadioSet([{'label': _('CTRL'), 'value': 'Control'},
  1993. {'label': _('SHIFT'), 'value': 'Shift'}])
  1994. grid0.addWidget(self.mselectlabel, 28, 0)
  1995. grid0.addWidget(self.mselect_radio, 28, 1)
  1996. separator_line = QtWidgets.QFrame()
  1997. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  1998. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  1999. grid0.addWidget(separator_line, 29, 0, 1, 2)
  2000. # Delete confirmation
  2001. self.delete_conf_cb = FCCheckBox(_('Delete object confirmation'))
  2002. self.delete_conf_cb.setToolTip(
  2003. _("When checked the application will ask for user confirmation\n"
  2004. "whenever the Delete object(s) event is triggered, either by\n"
  2005. "menu shortcut or key shortcut.")
  2006. )
  2007. grid0.addWidget(self.delete_conf_cb, 30, 0, 1, 2)
  2008. # Open behavior
  2009. self.open_style_cb = FCCheckBox('%s' % _('"Open" behavior'))
  2010. self.open_style_cb.setToolTip(
  2011. _("When checked the path for the last saved file is used when saving files,\n"
  2012. "and the path for the last opened file is used when opening files.\n\n"
  2013. "When unchecked the path for opening files is the one used last: either the\n"
  2014. "path for saving files or the path for opening files.")
  2015. )
  2016. grid0.addWidget(self.open_style_cb, 31, 0, 1, 2)
  2017. # Enable/Disable ToolTips globally
  2018. self.toggle_tooltips_cb = FCCheckBox(label=_('Enable ToolTips'))
  2019. self.toggle_tooltips_cb.setToolTip(
  2020. _("Check this box if you want to have toolTips displayed\n"
  2021. "when hovering with mouse over items throughout the App.")
  2022. )
  2023. grid0.addWidget(self.toggle_tooltips_cb, 32, 0, 1, 2)
  2024. # Machinist settings that allow unsafe settings
  2025. self.machinist_cb = FCCheckBox(_("Allow Machinist Unsafe Settings"))
  2026. self.machinist_cb.setToolTip(
  2027. _("If checked, some of the application settings will be allowed\n"
  2028. "to have values that are usually unsafe to use.\n"
  2029. "Like Z travel negative values or Z Cut positive values.\n"
  2030. "It will applied at the next application start.\n"
  2031. "<<WARNING>>: Don't change this unless you know what you are doing !!!")
  2032. )
  2033. grid0.addWidget(self.machinist_cb, 33, 0, 1, 2)
  2034. # Bookmarks Limit in the Help Menu
  2035. self.bm_limit_spinner = FCSpinner()
  2036. self.bm_limit_spinner.set_range(0, 9999)
  2037. self.bm_limit_label = QtWidgets.QLabel('%s:' % _('Bookmarks limit'))
  2038. self.bm_limit_label.setToolTip(
  2039. _("The maximum number of bookmarks that may be installed in the menu.\n"
  2040. "The number of bookmarks in the bookmark manager may be greater\n"
  2041. "but the menu will hold only so much.")
  2042. )
  2043. grid0.addWidget(self.bm_limit_label, 34, 0)
  2044. grid0.addWidget(self.bm_limit_spinner, 34, 1)
  2045. # Activity monitor icon
  2046. self.activity_label = QtWidgets.QLabel('%s:' % _("Activity Icon"))
  2047. self.activity_label.setToolTip(
  2048. _("Select the GIF that show activity when FlatCAM is active.")
  2049. )
  2050. self.activity_combo = FCComboBox()
  2051. self.activity_combo.addItems(['Ball black', 'Ball green', 'Arrow green', 'Eclipse green'])
  2052. grid0.addWidget(self.activity_label, 35, 0)
  2053. grid0.addWidget(self.activity_combo, 35, 1)
  2054. self.layout.addStretch()
  2055. self.mouse_cursor_color_cb.stateChanged.connect(self.on_mouse_cursor_color_enable)
  2056. self.mouse_cursor_entry.editingFinished.connect(self.on_mouse_cursor_entry)
  2057. self.mouse_cursor_button.clicked.connect(self.on_mouse_cursor_button)
  2058. def on_mouse_cursor_color_enable(self, val):
  2059. if val:
  2060. self.app.cursor_color_3D = self.app.defaults["global_cursor_color"]
  2061. else:
  2062. theme_settings = QtCore.QSettings("Open Source", "FlatCAM")
  2063. if theme_settings.contains("theme"):
  2064. theme = theme_settings.value('theme', type=str)
  2065. else:
  2066. theme = 'white'
  2067. if theme == 'white':
  2068. self.app.cursor_color_3D = 'black'
  2069. else:
  2070. self.app.cursor_color_3D = 'gray'
  2071. def on_mouse_cursor_entry(self):
  2072. self.app.defaults['global_cursor_color'] = self.mouse_cursor_entry.get_value()
  2073. self.mouse_cursor_button.setStyleSheet("background-color:%s" % str(self.app.defaults['global_cursor_color']))
  2074. self.app.cursor_color_3D = self.app.defaults["global_cursor_color"]
  2075. def on_mouse_cursor_button(self):
  2076. current_color = QtGui.QColor(self.app.defaults['global_cursor_color'])
  2077. c_dialog = QtWidgets.QColorDialog()
  2078. proj_color = c_dialog.getColor(initial=current_color)
  2079. if proj_color.isValid() is False:
  2080. return
  2081. self.mouse_cursor_button.setStyleSheet("background-color:%s" % str(proj_color.name()))
  2082. new_val_sel = str(proj_color.name())
  2083. self.mouse_cursor_entry.set_value(new_val_sel)
  2084. self.app.defaults['global_cursor_color'] = new_val_sel
  2085. self.app.cursor_color_3D = self.app.defaults["global_cursor_color"]
  2086. class GeneralAppPrefGroupUI(OptionsGroupUI):
  2087. def __init__(self, decimals=4, parent=None):
  2088. super(GeneralAppPrefGroupUI, self).__init__(self)
  2089. self.setTitle(_("App Preferences"))
  2090. self.decimals = decimals
  2091. # Create a form layout for the Application general settings
  2092. grid0 = QtWidgets.QGridLayout()
  2093. self.layout.addLayout(grid0)
  2094. grid0.setColumnStretch(0, 0)
  2095. grid0.setColumnStretch(1, 1)
  2096. # Units for FlatCAM
  2097. self.unitslabel = QtWidgets.QLabel('<span style="color:red;"><b>%s:</b></span>' % _('Units'))
  2098. self.unitslabel.setToolTip(_("The default value for FlatCAM units.\n"
  2099. "Whatever is selected here is set every time\n"
  2100. "FLatCAM is started."))
  2101. self.units_radio = RadioSet([{'label': _('MM'), 'value': 'MM'},
  2102. {'label': _('IN'), 'value': 'IN'}])
  2103. grid0.addWidget(self.unitslabel, 0, 0)
  2104. grid0.addWidget(self.units_radio, 0, 1)
  2105. # Precision Metric
  2106. self.precision_metric_label = QtWidgets.QLabel('%s:' % _('Precision MM'))
  2107. self.precision_metric_label.setToolTip(
  2108. _("The number of decimals used throughout the application\n"
  2109. "when the set units are in METRIC system.\n"
  2110. "Any change here require an application restart.")
  2111. )
  2112. self.precision_metric_entry = FCSpinner()
  2113. self.precision_metric_entry.set_range(2, 16)
  2114. self.precision_metric_entry.setWrapping(True)
  2115. grid0.addWidget(self.precision_metric_label, 1, 0)
  2116. grid0.addWidget(self.precision_metric_entry, 1, 1)
  2117. # Precision Inch
  2118. self.precision_inch_label = QtWidgets.QLabel('%s:' % _('Precision INCH'))
  2119. self.precision_inch_label.setToolTip(
  2120. _("The number of decimals used throughout the application\n"
  2121. "when the set units are in INCH system.\n"
  2122. "Any change here require an application restart.")
  2123. )
  2124. self.precision_inch_entry = FCSpinner()
  2125. self.precision_inch_entry.set_range(2, 16)
  2126. self.precision_inch_entry.setWrapping(True)
  2127. grid0.addWidget(self.precision_inch_label, 2, 0)
  2128. grid0.addWidget(self.precision_inch_entry, 2, 1)
  2129. # Graphic Engine for FlatCAM
  2130. self.ge_label = QtWidgets.QLabel('<b>%s:</b>' % _('Graphic Engine'))
  2131. self.ge_label.setToolTip(_("Choose what graphic engine to use in FlatCAM.\n"
  2132. "Legacy(2D) -> reduced functionality, slow performance but enhanced compatibility.\n"
  2133. "OpenGL(3D) -> full functionality, high performance\n"
  2134. "Some graphic cards are too old and do not work in OpenGL(3D) mode, like:\n"
  2135. "Intel HD3000 or older. In this case the plot area will be black therefore\n"
  2136. "use the Legacy(2D) mode."))
  2137. self.ge_radio = RadioSet([{'label': _('Legacy(2D)'), 'value': '2D'},
  2138. {'label': _('OpenGL(3D)'), 'value': '3D'}],
  2139. orientation='vertical')
  2140. grid0.addWidget(self.ge_label, 3, 0)
  2141. grid0.addWidget(self.ge_radio, 3, 1)
  2142. separator_line = QtWidgets.QFrame()
  2143. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  2144. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  2145. grid0.addWidget(separator_line, 4, 0, 1, 2)
  2146. # Application Level for FlatCAM
  2147. self.app_level_label = QtWidgets.QLabel('<span style="color:red;"><b>%s:</b></span>' % _('APP. LEVEL'))
  2148. self.app_level_label.setToolTip(_("Choose the default level of usage for FlatCAM.\n"
  2149. "BASIC level -> reduced functionality, best for beginner's.\n"
  2150. "ADVANCED level -> full functionality.\n\n"
  2151. "The choice here will influence the parameters in\n"
  2152. "the Selected Tab for all kinds of FlatCAM objects."))
  2153. self.app_level_radio = RadioSet([{'label': _('Basic'), 'value': 'b'},
  2154. {'label': _('Advanced'), 'value': 'a'}])
  2155. grid0.addWidget(self.app_level_label, 5, 0)
  2156. grid0.addWidget(self.app_level_radio, 5, 1)
  2157. # Portability for FlatCAM
  2158. self.portability_cb = FCCheckBox('%s' % _('Portable app'))
  2159. self.portability_cb.setToolTip(_("Choose if the application should run as portable.\n\n"
  2160. "If Checked the application will run portable,\n"
  2161. "which means that the preferences files will be saved\n"
  2162. "in the application folder, in the lib\\config subfolder."))
  2163. grid0.addWidget(self.portability_cb, 6, 0, 1, 2)
  2164. separator_line = QtWidgets.QFrame()
  2165. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  2166. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  2167. grid0.addWidget(separator_line, 7, 0, 1, 2)
  2168. # Languages for FlatCAM
  2169. self.languagelabel = QtWidgets.QLabel('<b>%s</b>' % _('Languages'))
  2170. self.languagelabel.setToolTip(_("Set the language used throughout FlatCAM."))
  2171. self.language_cb = FCComboBox()
  2172. grid0.addWidget(self.languagelabel, 8, 0, 1, 2)
  2173. grid0.addWidget(self.language_cb, 9, 0, 1, 2)
  2174. self.language_apply_btn = FCButton(_("Apply Language"))
  2175. self.language_apply_btn.setToolTip(_("Set the language used throughout FlatCAM.\n"
  2176. "The app will restart after click."))
  2177. grid0.addWidget(self.language_apply_btn, 15, 0, 1, 2)
  2178. separator_line = QtWidgets.QFrame()
  2179. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  2180. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  2181. grid0.addWidget(separator_line, 16, 0, 1, 2)
  2182. # -----------------------------------------------------------
  2183. # ----------- APPLICATION STARTUP SETTINGS ------------------
  2184. # -----------------------------------------------------------
  2185. self.startup_label = QtWidgets.QLabel('<b>%s</b>' % _('Startup Settings'))
  2186. grid0.addWidget(self.startup_label, 17, 0, 1, 2)
  2187. # Splash Screen
  2188. self.splash_cb = FCCheckBox('%s' % _('Splash Screen'))
  2189. self.splash_cb.setToolTip(
  2190. _("Enable display of the splash screen at application startup.")
  2191. )
  2192. settings = QSettings("Open Source", "FlatCAM")
  2193. if settings.value("splash_screen"):
  2194. self.splash_cb.set_value(True)
  2195. else:
  2196. self.splash_cb.set_value(False)
  2197. grid0.addWidget(self.splash_cb, 18, 0, 1, 2)
  2198. # Sys Tray Icon
  2199. self.systray_cb = FCCheckBox('%s' % _('Sys Tray Icon'))
  2200. self.systray_cb.setToolTip(
  2201. _("Enable display of FlatCAM icon in Sys Tray.")
  2202. )
  2203. grid0.addWidget(self.systray_cb, 19, 0, 1, 2)
  2204. # Shell StartUp CB
  2205. self.shell_startup_cb = FCCheckBox(label='%s' % _('Show Shell'))
  2206. self.shell_startup_cb.setToolTip(
  2207. _("Check this box if you want the shell to\n"
  2208. "start automatically at startup.")
  2209. )
  2210. grid0.addWidget(self.shell_startup_cb, 20, 0, 1, 2)
  2211. # Project at StartUp CB
  2212. self.project_startup_cb = FCCheckBox(label='%s' % _('Show Project'))
  2213. self.project_startup_cb.setToolTip(
  2214. _("Check this box if you want the project/selected/tool tab area to\n"
  2215. "to be shown automatically at startup.")
  2216. )
  2217. grid0.addWidget(self.project_startup_cb, 21, 0, 1, 2)
  2218. # Version Check CB
  2219. self.version_check_cb = FCCheckBox(label='%s' % _('Version Check'))
  2220. self.version_check_cb.setToolTip(
  2221. _("Check this box if you want to check\n"
  2222. "for a new version automatically at startup.")
  2223. )
  2224. grid0.addWidget(self.version_check_cb, 22, 0, 1, 2)
  2225. # Send Stats CB
  2226. self.send_stats_cb = FCCheckBox(label='%s' % _('Send Statistics'))
  2227. self.send_stats_cb.setToolTip(
  2228. _("Check this box if you agree to send anonymous\n"
  2229. "stats automatically at startup, to help improve FlatCAM.")
  2230. )
  2231. grid0.addWidget(self.send_stats_cb, 23, 0, 1, 2)
  2232. self.ois_version_check = OptionalInputSection(self.version_check_cb, [self.send_stats_cb])
  2233. separator_line = QtWidgets.QFrame()
  2234. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  2235. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  2236. grid0.addWidget(separator_line, 24, 0, 1, 2)
  2237. # Worker Numbers
  2238. self.worker_number_label = QtWidgets.QLabel('%s:' % _('Workers number'))
  2239. self.worker_number_label.setToolTip(
  2240. _("The number of Qthreads made available to the App.\n"
  2241. "A bigger number may finish the jobs more quickly but\n"
  2242. "depending on your computer speed, may make the App\n"
  2243. "unresponsive. Can have a value between 2 and 16.\n"
  2244. "Default value is 2.\n"
  2245. "After change, it will be applied at next App start.")
  2246. )
  2247. self.worker_number_sb = FCSpinner()
  2248. self.worker_number_sb.set_range(2, 16)
  2249. grid0.addWidget(self.worker_number_label, 25, 0)
  2250. grid0.addWidget(self.worker_number_sb, 25, 1)
  2251. # Geometric tolerance
  2252. tol_label = QtWidgets.QLabel('%s:' % _("Geo Tolerance"))
  2253. tol_label.setToolTip(_(
  2254. "This value can counter the effect of the Circle Steps\n"
  2255. "parameter. Default value is 0.005.\n"
  2256. "A lower value will increase the detail both in image\n"
  2257. "and in Gcode for the circles, with a higher cost in\n"
  2258. "performance. Higher value will provide more\n"
  2259. "performance at the expense of level of detail."
  2260. ))
  2261. self.tol_entry = FCDoubleSpinner()
  2262. self.tol_entry.setSingleStep(0.001)
  2263. self.tol_entry.set_precision(6)
  2264. grid0.addWidget(tol_label, 26, 0)
  2265. grid0.addWidget(self.tol_entry, 26, 1)
  2266. separator_line = QtWidgets.QFrame()
  2267. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  2268. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  2269. grid0.addWidget(separator_line, 27, 0, 1, 2)
  2270. # Save Settings
  2271. self.save_label = QtWidgets.QLabel('<b>%s</b>' % _("Save Settings"))
  2272. grid0.addWidget(self.save_label, 28, 0, 1, 2)
  2273. # Save compressed project CB
  2274. self.save_type_cb = FCCheckBox(_('Save Compressed Project'))
  2275. self.save_type_cb.setToolTip(
  2276. _("Whether to save a compressed or uncompressed project.\n"
  2277. "When checked it will save a compressed FlatCAM project.")
  2278. )
  2279. grid0.addWidget(self.save_type_cb, 29, 0, 1, 2)
  2280. # Project LZMA Comppression Level
  2281. self.compress_spinner = FCSpinner()
  2282. self.compress_spinner.set_range(0, 9)
  2283. self.compress_label = QtWidgets.QLabel('%s:' % _('Compression'))
  2284. self.compress_label.setToolTip(
  2285. _("The level of compression used when saving\n"
  2286. "a FlatCAM project. Higher value means better compression\n"
  2287. "but require more RAM usage and more processing time.")
  2288. )
  2289. grid0.addWidget(self.compress_label, 30, 0)
  2290. grid0.addWidget(self.compress_spinner, 30, 1)
  2291. self.proj_ois = OptionalInputSection(self.save_type_cb, [self.compress_label, self.compress_spinner], True)
  2292. # Auto save CB
  2293. self.autosave_cb = FCCheckBox(_('Enable Auto Save'))
  2294. self.autosave_cb.setToolTip(
  2295. _("Check to enable the autosave feature.\n"
  2296. "When enabled, the application will try to save a project\n"
  2297. "at the set interval.")
  2298. )
  2299. grid0.addWidget(self.autosave_cb, 31, 0, 1, 2)
  2300. # Auto Save Timeout Interval
  2301. self.autosave_entry = FCSpinner()
  2302. self.autosave_entry.set_range(0, 9999999)
  2303. self.autosave_label = QtWidgets.QLabel('%s:' % _('Interval'))
  2304. self.autosave_label.setToolTip(
  2305. _("Time interval for autosaving. In milliseconds.\n"
  2306. "The application will try to save periodically but only\n"
  2307. "if the project was saved manually at least once.\n"
  2308. "While active, some operations may block this feature.")
  2309. )
  2310. grid0.addWidget(self.autosave_label, 32, 0)
  2311. grid0.addWidget(self.autosave_entry, 32, 1)
  2312. # self.as_ois = OptionalInputSection(self.autosave_cb, [self.autosave_label, self.autosave_entry], True)
  2313. separator_line = QtWidgets.QFrame()
  2314. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  2315. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  2316. grid0.addWidget(separator_line, 33, 0, 1, 2)
  2317. self.pdf_param_label = QtWidgets.QLabel('<B>%s:</b>' % _("Text to PDF parameters"))
  2318. self.pdf_param_label.setToolTip(
  2319. _("Used when saving text in Code Editor or in FlatCAM Document objects.")
  2320. )
  2321. grid0.addWidget(self.pdf_param_label, 34, 0, 1, 2)
  2322. # Top Margin value
  2323. self.tmargin_entry = FCDoubleSpinner()
  2324. self.tmargin_entry.set_precision(self.decimals)
  2325. self.tmargin_entry.set_range(0.0000, 9999.9999)
  2326. self.tmargin_label = QtWidgets.QLabel('%s:' % _("Top Margin"))
  2327. self.tmargin_label.setToolTip(
  2328. _("Distance between text body and the top of the PDF file.")
  2329. )
  2330. grid0.addWidget(self.tmargin_label, 35, 0)
  2331. grid0.addWidget(self.tmargin_entry, 35, 1)
  2332. # Bottom Margin value
  2333. self.bmargin_entry = FCDoubleSpinner()
  2334. self.bmargin_entry.set_precision(self.decimals)
  2335. self.bmargin_entry.set_range(0.0000, 9999.9999)
  2336. self.bmargin_label = QtWidgets.QLabel('%s:' % _("Bottom Margin"))
  2337. self.bmargin_label.setToolTip(
  2338. _("Distance between text body and the bottom of the PDF file.")
  2339. )
  2340. grid0.addWidget(self.bmargin_label, 36, 0)
  2341. grid0.addWidget(self.bmargin_entry, 36, 1)
  2342. # Left Margin value
  2343. self.lmargin_entry = FCDoubleSpinner()
  2344. self.lmargin_entry.set_precision(self.decimals)
  2345. self.lmargin_entry.set_range(0.0000, 9999.9999)
  2346. self.lmargin_label = QtWidgets.QLabel('%s:' % _("Left Margin"))
  2347. self.lmargin_label.setToolTip(
  2348. _("Distance between text body and the left of the PDF file.")
  2349. )
  2350. grid0.addWidget(self.lmargin_label, 37, 0)
  2351. grid0.addWidget(self.lmargin_entry, 37, 1)
  2352. # Right Margin value
  2353. self.rmargin_entry = FCDoubleSpinner()
  2354. self.rmargin_entry.set_precision(self.decimals)
  2355. self.rmargin_entry.set_range(0.0000, 9999.9999)
  2356. self.rmargin_label = QtWidgets.QLabel('%s:' % _("Right Margin"))
  2357. self.rmargin_label.setToolTip(
  2358. _("Distance between text body and the right of the PDF file.")
  2359. )
  2360. grid0.addWidget(self.rmargin_label, 38, 0)
  2361. grid0.addWidget(self.rmargin_entry, 38, 1)
  2362. self.layout.addStretch()
  2363. if sys.platform != 'win32':
  2364. self.portability_cb.hide()
  2365. # splash screen button signal
  2366. self.splash_cb.stateChanged.connect(self.on_splash_changed)
  2367. # Monitor the checkbox from the Application Defaults Tab and show the TCL shell or not depending on it's value
  2368. self.shell_startup_cb.clicked.connect(self.app.on_toggle_shell_from_settings)
  2369. self.language_apply_btn.clicked.connect(lambda: fcTranslate.on_language_apply_click(app=self.app, restart=True))
  2370. def on_splash_changed(self, state):
  2371. settings = QSettings("Open Source", "FlatCAM")
  2372. settings.setValue('splash_screen', 1) if state else settings.setValue('splash_screen', 0)
  2373. # This will write the setting to the platform specific storage.
  2374. del settings
  2375. class GerberGenPrefGroupUI(OptionsGroupUI):
  2376. def __init__(self, decimals=4, parent=None):
  2377. # OptionsGroupUI.__init__(self, "Gerber General Preferences", parent=parent)
  2378. super(GerberGenPrefGroupUI, self).__init__(self)
  2379. self.setTitle(str(_("Gerber General")))
  2380. self.decimals = decimals
  2381. # ## Plot options
  2382. self.plot_options_label = QtWidgets.QLabel("<b>%s:</b>" % _("Plot Options"))
  2383. self.layout.addWidget(self.plot_options_label)
  2384. grid0 = QtWidgets.QGridLayout()
  2385. self.layout.addLayout(grid0)
  2386. # Solid CB
  2387. self.solid_cb = FCCheckBox(label='%s' % _('Solid'))
  2388. self.solid_cb.setToolTip(
  2389. _("Solid color polygons.")
  2390. )
  2391. grid0.addWidget(self.solid_cb, 0, 0)
  2392. # Multicolored CB
  2393. self.multicolored_cb = FCCheckBox(label='%s' % _('M-Color'))
  2394. self.multicolored_cb.setToolTip(
  2395. _("Draw polygons in different colors.")
  2396. )
  2397. grid0.addWidget(self.multicolored_cb, 0, 1)
  2398. # Plot CB
  2399. self.plot_cb = FCCheckBox(label='%s' % _('Plot'))
  2400. self.plot_options_label.setToolTip(
  2401. _("Plot (show) this object.")
  2402. )
  2403. grid0.addWidget(self.plot_cb, 0, 2)
  2404. # Number of circle steps for circular aperture linear approximation
  2405. self.circle_steps_label = QtWidgets.QLabel('%s:' % _("Circle Steps"))
  2406. self.circle_steps_label.setToolTip(
  2407. _("The number of circle steps for Gerber \n"
  2408. "circular aperture linear approximation.")
  2409. )
  2410. self.circle_steps_entry = FCSpinner()
  2411. self.circle_steps_entry.set_range(0, 9999)
  2412. grid0.addWidget(self.circle_steps_label, 1, 0)
  2413. grid0.addWidget(self.circle_steps_entry, 1, 1, 1, 2)
  2414. grid0.addWidget(QtWidgets.QLabel(''), 2, 0, 1, 3)
  2415. # Default format for Gerber
  2416. self.gerber_default_label = QtWidgets.QLabel('<b>%s:</b>' % _('Default Values'))
  2417. self.gerber_default_label.setToolTip(
  2418. _("Those values will be used as fallback values\n"
  2419. "in case that they are not found in the Gerber file.")
  2420. )
  2421. grid0.addWidget(self.gerber_default_label, 3, 0, 1, 3)
  2422. # Gerber Units
  2423. self.gerber_units_label = QtWidgets.QLabel('%s:' % _('Units'))
  2424. self.gerber_units_label.setToolTip(
  2425. _("The units used in the Gerber file.")
  2426. )
  2427. self.gerber_units_radio = RadioSet([{'label': _('INCH'), 'value': 'IN'},
  2428. {'label': _('MM'), 'value': 'MM'}])
  2429. self.gerber_units_radio.setToolTip(
  2430. _("The units used in the Gerber file.")
  2431. )
  2432. grid0.addWidget(self.gerber_units_label, 4, 0)
  2433. grid0.addWidget(self.gerber_units_radio, 4, 1, 1, 2)
  2434. # Gerber Zeros
  2435. self.gerber_zeros_label = QtWidgets.QLabel('%s:' % _('Zeros'))
  2436. self.gerber_zeros_label.setAlignment(QtCore.Qt.AlignLeft)
  2437. self.gerber_zeros_label.setToolTip(
  2438. _("This sets the type of Gerber zeros.\n"
  2439. "If LZ then Leading Zeros are removed and\n"
  2440. "Trailing Zeros are kept.\n"
  2441. "If TZ is checked then Trailing Zeros are removed\n"
  2442. "and Leading Zeros are kept.")
  2443. )
  2444. self.gerber_zeros_radio = RadioSet([{'label': _('LZ'), 'value': 'L'},
  2445. {'label': _('TZ'), 'value': 'T'}])
  2446. self.gerber_zeros_radio.setToolTip(
  2447. _("This sets the type of Gerber zeros.\n"
  2448. "If LZ then Leading Zeros are removed and\n"
  2449. "Trailing Zeros are kept.\n"
  2450. "If TZ is checked then Trailing Zeros are removed\n"
  2451. "and Leading Zeros are kept.")
  2452. )
  2453. grid0.addWidget(self.gerber_zeros_label, 5, 0)
  2454. grid0.addWidget(self.gerber_zeros_radio, 5, 1, 1, 2)
  2455. separator_line = QtWidgets.QFrame()
  2456. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  2457. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  2458. grid0.addWidget(separator_line, 6, 0, 1, 3)
  2459. # Apertures Cleaning
  2460. self.gerber_clean_cb = FCCheckBox(label='%s' % _('Clean Apertures'))
  2461. self.gerber_clean_cb.setToolTip(
  2462. _("Will remove apertures that do not have geometry\n"
  2463. "thus lowering the number of apertures in the Gerber object.")
  2464. )
  2465. grid0.addWidget(self.gerber_clean_cb, 7, 0, 1, 3)
  2466. # Apply Extra Buffering
  2467. self.gerber_extra_buffering = FCCheckBox(label='%s' % _('Polarity change buffer'))
  2468. self.gerber_extra_buffering.setToolTip(
  2469. _("Will apply extra buffering for the\n"
  2470. "solid geometry when we have polarity changes.\n"
  2471. "May help loading Gerber files that otherwise\n"
  2472. "do not load correctly.")
  2473. )
  2474. grid0.addWidget(self.gerber_extra_buffering, 8, 0, 1, 3)
  2475. separator_line = QtWidgets.QFrame()
  2476. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  2477. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  2478. grid0.addWidget(separator_line, 9, 0, 1, 3)
  2479. # Gerber Object Color
  2480. self.gerber_color_label = QtWidgets.QLabel('<b>%s</b>' % _('Gerber Object Color'))
  2481. grid0.addWidget(self.gerber_color_label, 10, 0, 1, 3)
  2482. # Plot Line Color
  2483. self.pl_color_label = QtWidgets.QLabel('%s:' % _('Outline'))
  2484. self.pl_color_label.setToolTip(
  2485. _("Set the line color for plotted objects.")
  2486. )
  2487. self.pl_color_entry = FCEntry()
  2488. self.pl_color_button = QtWidgets.QPushButton()
  2489. self.pl_color_button.setFixedSize(15, 15)
  2490. self.form_box_child_2 = QtWidgets.QHBoxLayout()
  2491. self.form_box_child_2.addWidget(self.pl_color_entry)
  2492. self.form_box_child_2.addWidget(self.pl_color_button)
  2493. self.form_box_child_2.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  2494. grid0.addWidget(self.pl_color_label, 11, 0)
  2495. grid0.addLayout(self.form_box_child_2, 11, 1, 1, 2)
  2496. # Plot Fill Color
  2497. self.pf_color_label = QtWidgets.QLabel('%s:' % _('Fill'))
  2498. self.pf_color_label.setToolTip(
  2499. _("Set the fill color for plotted objects.\n"
  2500. "First 6 digits are the color and the last 2\n"
  2501. "digits are for alpha (transparency) level.")
  2502. )
  2503. self.pf_color_entry = FCEntry()
  2504. self.pf_color_button = QtWidgets.QPushButton()
  2505. self.pf_color_button.setFixedSize(15, 15)
  2506. self.form_box_child_1 = QtWidgets.QHBoxLayout()
  2507. self.form_box_child_1.addWidget(self.pf_color_entry)
  2508. self.form_box_child_1.addWidget(self.pf_color_button)
  2509. self.form_box_child_1.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  2510. grid0.addWidget(self.pf_color_label, 12, 0)
  2511. grid0.addLayout(self.form_box_child_1, 12, 1, 1, 2)
  2512. # Plot Fill Transparency Level
  2513. self.pf_alpha_label = QtWidgets.QLabel('%s:' % _('Alpha'))
  2514. self.pf_alpha_label.setToolTip(
  2515. _("Set the fill transparency for plotted objects.")
  2516. )
  2517. self.pf_color_alpha_slider = QtWidgets.QSlider(QtCore.Qt.Horizontal)
  2518. self.pf_color_alpha_slider.setMinimum(0)
  2519. self.pf_color_alpha_slider.setMaximum(255)
  2520. self.pf_color_alpha_slider.setSingleStep(1)
  2521. self.pf_color_alpha_spinner = FCSpinner()
  2522. self.pf_color_alpha_spinner.setMinimumWidth(70)
  2523. self.pf_color_alpha_spinner.set_range(0, 255)
  2524. self.form_box_child_3 = QtWidgets.QHBoxLayout()
  2525. self.form_box_child_3.addWidget(self.pf_color_alpha_slider)
  2526. self.form_box_child_3.addWidget(self.pf_color_alpha_spinner)
  2527. grid0.addWidget(self.pf_alpha_label, 13, 0)
  2528. grid0.addLayout(self.form_box_child_3, 13, 1, 1, 2)
  2529. self.layout.addStretch()
  2530. # Setting plot colors signals
  2531. self.pl_color_entry.editingFinished.connect(self.on_pl_color_entry)
  2532. self.pl_color_button.clicked.connect(self.on_pl_color_button)
  2533. self.pf_color_entry.editingFinished.connect(self.on_pf_color_entry)
  2534. self.pf_color_button.clicked.connect(self.on_pf_color_button)
  2535. self.pf_color_alpha_spinner.valueChanged.connect(self.on_pf_color_spinner)
  2536. self.pf_color_alpha_slider.valueChanged.connect(self.on_pf_color_slider)
  2537. # Setting plot colors handlers
  2538. def on_pf_color_entry(self):
  2539. self.app.defaults['gerber_plot_fill'] = self.pf_color_entry.get_value()[:7] + \
  2540. self.app.defaults['gerber_plot_fill'][7:9]
  2541. self.pf_color_button.setStyleSheet("background-color:%s" % str(self.defaults['gerber_plot_fill'])[:7])
  2542. def on_pf_color_button(self):
  2543. current_color = QtGui.QColor(self.app.defaults['gerber_plot_fill'][:7])
  2544. c_dialog = QtWidgets.QColorDialog()
  2545. plot_fill_color = c_dialog.getColor(initial=current_color)
  2546. if plot_fill_color.isValid() is False:
  2547. return
  2548. self.pf_color_button.setStyleSheet("background-color:%s" % str(plot_fill_color.name()))
  2549. new_val = str(plot_fill_color.name()) + str(self.app.defaults['gerber_plot_fill'][7:9])
  2550. self.pf_color_entry.set_value(new_val)
  2551. self.app.defaults['gerber_plot_fill'] = new_val
  2552. def on_pf_color_spinner(self):
  2553. spinner_value = self.pf_color_alpha_spinner.value()
  2554. self.pf_color_alpha_slider.setValue(spinner_value)
  2555. self.app.defaults['gerber_plot_fill'] = \
  2556. self.app.defaults['gerber_plot_fill'][:7] + \
  2557. (hex(spinner_value)[2:] if int(hex(spinner_value)[2:], 16) > 0 else '00')
  2558. self.app.defaults['gerber_plot_line'] = \
  2559. self.app.defaults['gerber_plot_line'][:7] + \
  2560. (hex(spinner_value)[2:] if int(hex(spinner_value)[2:], 16) > 0 else '00')
  2561. def on_pf_color_slider(self):
  2562. slider_value = self.pf_color_alpha_slider.value()
  2563. self.pf_color_alpha_spinner.setValue(slider_value)
  2564. def on_pl_color_entry(self):
  2565. self.app.defaults['gerber_plot_line'] = self.pl_color_entry.get_value()[:7] + \
  2566. self.app.defaults['gerber_plot_line'][7:9]
  2567. self.pl_color_button.setStyleSheet("background-color:%s" % str(self.defaults['gerber_plot_line'])[:7])
  2568. def on_pl_color_button(self):
  2569. current_color = QtGui.QColor(self.app.defaults['gerber_plot_line'][:7])
  2570. # print(current_color)
  2571. c_dialog = QtWidgets.QColorDialog()
  2572. plot_line_color = c_dialog.getColor(initial=current_color)
  2573. if plot_line_color.isValid() is False:
  2574. return
  2575. self.pl_color_button.setStyleSheet("background-color:%s" % str(plot_line_color.name()))
  2576. new_val_line = str(plot_line_color.name()) + str(self.app.defaults['gerber_plot_line'][7:9])
  2577. self.pl_color_entry.set_value(new_val_line)
  2578. self.app.defaults['gerber_plot_line'] = new_val_line
  2579. class GerberOptPrefGroupUI(OptionsGroupUI):
  2580. def __init__(self, decimals=4, parent=None):
  2581. # OptionsGroupUI.__init__(self, "Gerber Options Preferences", parent=parent)
  2582. super(GerberOptPrefGroupUI, self).__init__(self)
  2583. self.decimals = decimals
  2584. self.setTitle(str(_("Gerber Options")))
  2585. # ## Isolation Routing
  2586. self.isolation_routing_label = QtWidgets.QLabel("<b>%s:</b>" % _("Isolation Routing"))
  2587. self.isolation_routing_label.setToolTip(
  2588. _("Create a Geometry object with\n"
  2589. "toolpaths to cut outside polygons.")
  2590. )
  2591. self.layout.addWidget(self.isolation_routing_label)
  2592. # Cutting Tool Diameter
  2593. grid0 = QtWidgets.QGridLayout()
  2594. self.layout.addLayout(grid0)
  2595. tdlabel = QtWidgets.QLabel('%s:' % _('Tool dia'))
  2596. tdlabel.setToolTip(
  2597. _("Diameter of the cutting tool.")
  2598. )
  2599. grid0.addWidget(tdlabel, 0, 0)
  2600. self.iso_tool_dia_entry = FCDoubleSpinner()
  2601. self.iso_tool_dia_entry.set_precision(self.decimals)
  2602. self.iso_tool_dia_entry.setSingleStep(0.1)
  2603. self.iso_tool_dia_entry.set_range(-9999, 9999)
  2604. grid0.addWidget(self.iso_tool_dia_entry, 0, 1)
  2605. # Nr of passes
  2606. passlabel = QtWidgets.QLabel('%s:' % _('# Passes'))
  2607. passlabel.setToolTip(
  2608. _("Width of the isolation gap in\n"
  2609. "number (integer) of tool widths.")
  2610. )
  2611. self.iso_width_entry = FCSpinner()
  2612. self.iso_width_entry.set_range(1, 999)
  2613. grid0.addWidget(passlabel, 1, 0)
  2614. grid0.addWidget(self.iso_width_entry, 1, 1)
  2615. # Pass overlap
  2616. overlabel = QtWidgets.QLabel('%s:' % _('Pass overlap'))
  2617. overlabel.setToolTip(
  2618. _("How much (percentage) of the tool width to overlap each tool pass.")
  2619. )
  2620. self.iso_overlap_entry = FCDoubleSpinner(suffix='%')
  2621. self.iso_overlap_entry.set_precision(self.decimals)
  2622. self.iso_overlap_entry.setWrapping(True)
  2623. self.iso_overlap_entry.setRange(0.0000, 99.9999)
  2624. self.iso_overlap_entry.setSingleStep(0.1)
  2625. grid0.addWidget(overlabel, 2, 0)
  2626. grid0.addWidget(self.iso_overlap_entry, 2, 1)
  2627. # Isolation Scope
  2628. self.iso_scope_label = QtWidgets.QLabel('%s:' % _('Scope'))
  2629. self.iso_scope_label.setToolTip(
  2630. _("Isolation scope. Choose what to isolate:\n"
  2631. "- 'All' -> Isolate all the polygons in the object\n"
  2632. "- 'Selection' -> Isolate a selection of polygons.")
  2633. )
  2634. self.iso_scope_radio = RadioSet([{'label': _('All'), 'value': 'all'},
  2635. {'label': _('Selection'), 'value': 'single'}])
  2636. grid0.addWidget(self.iso_scope_label, 3, 0)
  2637. grid0.addWidget(self.iso_scope_radio, 3, 1, 1, 2)
  2638. # Milling Type
  2639. milling_type_label = QtWidgets.QLabel('%s:' % _('Milling Type'))
  2640. milling_type_label.setToolTip(
  2641. _("Milling type:\n"
  2642. "- climb / best for precision milling and to reduce tool usage\n"
  2643. "- conventional / useful when there is no backlash compensation")
  2644. )
  2645. grid0.addWidget(milling_type_label, 4, 0)
  2646. self.milling_type_radio = RadioSet([{'label': _('Climb'), 'value': 'cl'},
  2647. {'label': _('Conventional'), 'value': 'cv'}])
  2648. grid0.addWidget(self.milling_type_radio, 4, 1)
  2649. # Combine passes
  2650. self.combine_passes_cb = FCCheckBox(label=_('Combine Passes'))
  2651. self.combine_passes_cb.setToolTip(
  2652. _("Combine all passes into one object")
  2653. )
  2654. grid0.addWidget(self.combine_passes_cb, 5, 0, 1, 2)
  2655. separator_line = QtWidgets.QFrame()
  2656. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  2657. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  2658. grid0.addWidget(separator_line, 6, 0, 1, 2)
  2659. # ## Clear non-copper regions
  2660. self.clearcopper_label = QtWidgets.QLabel("<b>%s:</b>" % _("Non-copper regions"))
  2661. self.clearcopper_label.setToolTip(
  2662. _("Create polygons covering the\n"
  2663. "areas without copper on the PCB.\n"
  2664. "Equivalent to the inverse of this\n"
  2665. "object. Can be used to remove all\n"
  2666. "copper from a specified region.")
  2667. )
  2668. self.layout.addWidget(self.clearcopper_label)
  2669. grid1 = QtWidgets.QGridLayout()
  2670. self.layout.addLayout(grid1)
  2671. # Margin
  2672. bmlabel = QtWidgets.QLabel('%s:' % _('Boundary Margin'))
  2673. bmlabel.setToolTip(
  2674. _("Specify the edge of the PCB\n"
  2675. "by drawing a box around all\n"
  2676. "objects with this minimum\n"
  2677. "distance.")
  2678. )
  2679. grid1.addWidget(bmlabel, 0, 0)
  2680. self.noncopper_margin_entry = FCDoubleSpinner()
  2681. self.noncopper_margin_entry.set_precision(self.decimals)
  2682. self.noncopper_margin_entry.setSingleStep(0.1)
  2683. self.noncopper_margin_entry.set_range(-9999, 9999)
  2684. grid1.addWidget(self.noncopper_margin_entry, 0, 1)
  2685. # Rounded corners
  2686. self.noncopper_rounded_cb = FCCheckBox(label=_("Rounded Geo"))
  2687. self.noncopper_rounded_cb.setToolTip(
  2688. _("Resulting geometry will have rounded corners.")
  2689. )
  2690. grid1.addWidget(self.noncopper_rounded_cb, 1, 0, 1, 2)
  2691. separator_line = QtWidgets.QFrame()
  2692. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  2693. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  2694. grid1.addWidget(separator_line, 2, 0, 1, 2)
  2695. # ## Bounding box
  2696. self.boundingbox_label = QtWidgets.QLabel('<b>%s:</b>' % _('Bounding Box'))
  2697. self.layout.addWidget(self.boundingbox_label)
  2698. grid2 = QtWidgets.QGridLayout()
  2699. self.layout.addLayout(grid2)
  2700. bbmargin = QtWidgets.QLabel('%s:' % _('Boundary Margin'))
  2701. bbmargin.setToolTip(
  2702. _("Distance of the edges of the box\n"
  2703. "to the nearest polygon.")
  2704. )
  2705. self.bbmargin_entry = FCDoubleSpinner()
  2706. self.bbmargin_entry.set_precision(self.decimals)
  2707. self.bbmargin_entry.setSingleStep(0.1)
  2708. self.bbmargin_entry.set_range(-9999, 9999)
  2709. grid2.addWidget(bbmargin, 0, 0)
  2710. grid2.addWidget(self.bbmargin_entry, 0, 1)
  2711. self.bbrounded_cb = FCCheckBox(label='%s' % _("Rounded Geo"))
  2712. self.bbrounded_cb.setToolTip(
  2713. _("If the bounding box is \n"
  2714. "to have rounded corners\n"
  2715. "their radius is equal to\n"
  2716. "the margin.")
  2717. )
  2718. grid2.addWidget(self.bbrounded_cb, 1, 0, 1, 2)
  2719. self.layout.addStretch()
  2720. class GerberAdvOptPrefGroupUI(OptionsGroupUI):
  2721. def __init__(self, decimals=4, parent=None):
  2722. # OptionsGroupUI.__init__(self, "Gerber Adv. Options Preferences", parent=parent)
  2723. super(GerberAdvOptPrefGroupUI, self).__init__(self)
  2724. self.setTitle(str(_("Gerber Adv. Options")))
  2725. self.decimals = decimals
  2726. # ## Advanced Gerber Parameters
  2727. self.adv_param_label = QtWidgets.QLabel('<b>%s:</b>' % _('Advanced Options'))
  2728. self.adv_param_label.setToolTip(
  2729. _("A list of Gerber advanced parameters.\n"
  2730. "Those parameters are available only for\n"
  2731. "Advanced App. Level.")
  2732. )
  2733. self.layout.addWidget(self.adv_param_label)
  2734. grid0 = QtWidgets.QGridLayout()
  2735. self.layout.addLayout(grid0)
  2736. # Follow Attribute
  2737. self.follow_cb = FCCheckBox(label=_('"Follow"'))
  2738. self.follow_cb.setToolTip(
  2739. _("Generate a 'Follow' geometry.\n"
  2740. "This means that it will cut through\n"
  2741. "the middle of the trace.")
  2742. )
  2743. grid0.addWidget(self.follow_cb, 0, 0, 1, 2)
  2744. # Aperture Table Visibility CB
  2745. self.aperture_table_visibility_cb = FCCheckBox(label=_('Table Show/Hide'))
  2746. self.aperture_table_visibility_cb.setToolTip(
  2747. _("Toggle the display of the Gerber Apertures Table.\n"
  2748. "Also, on hide, it will delete all mark shapes\n"
  2749. "that are drawn on canvas.")
  2750. )
  2751. grid0.addWidget(self.aperture_table_visibility_cb, 1, 0, 1, 2)
  2752. separator_line = QtWidgets.QFrame()
  2753. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  2754. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  2755. grid0.addWidget(separator_line, 2, 0, 1, 2)
  2756. # Tool Type
  2757. self.tool_type_label = QtWidgets.QLabel('<b>%s</b>' % _('Tool Type'))
  2758. self.tool_type_label.setToolTip(
  2759. _("Choose what tool to use for Gerber isolation:\n"
  2760. "'Circular' or 'V-shape'.\n"
  2761. "When the 'V-shape' is selected then the tool\n"
  2762. "diameter will depend on the chosen cut depth.")
  2763. )
  2764. self.tool_type_radio = RadioSet([{'label': 'Circular', 'value': 'circular'},
  2765. {'label': 'V-Shape', 'value': 'v'}])
  2766. grid0.addWidget(self.tool_type_label, 3, 0)
  2767. grid0.addWidget(self.tool_type_radio, 3, 1, 1, 2)
  2768. # Tip Dia
  2769. self.tipdialabel = QtWidgets.QLabel('%s:' % _('V-Tip Dia'))
  2770. self.tipdialabel.setToolTip(
  2771. _("The tip diameter for V-Shape Tool")
  2772. )
  2773. self.tipdia_spinner = FCDoubleSpinner()
  2774. self.tipdia_spinner.set_precision(self.decimals)
  2775. self.tipdia_spinner.set_range(-99.9999, 99.9999)
  2776. self.tipdia_spinner.setSingleStep(0.1)
  2777. self.tipdia_spinner.setWrapping(True)
  2778. grid0.addWidget(self.tipdialabel, 4, 0)
  2779. grid0.addWidget(self.tipdia_spinner, 4, 1, 1, 2)
  2780. # Tip Angle
  2781. self.tipanglelabel = QtWidgets.QLabel('%s:' % _('V-Tip Angle'))
  2782. self.tipanglelabel.setToolTip(
  2783. _("The tip angle for V-Shape Tool.\n"
  2784. "In degree.")
  2785. )
  2786. self.tipangle_spinner = FCSpinner()
  2787. self.tipangle_spinner.set_range(1, 180)
  2788. self.tipangle_spinner.set_step(5)
  2789. self.tipangle_spinner.setWrapping(True)
  2790. grid0.addWidget(self.tipanglelabel, 5, 0)
  2791. grid0.addWidget(self.tipangle_spinner, 5, 1, 1, 2)
  2792. # Cut Z
  2793. self.cutzlabel = QtWidgets.QLabel('%s:' % _('Cut Z'))
  2794. self.cutzlabel.setToolTip(
  2795. _("Cutting depth (negative)\n"
  2796. "below the copper surface.")
  2797. )
  2798. self.cutz_spinner = FCDoubleSpinner()
  2799. self.cutz_spinner.set_precision(self.decimals)
  2800. self.cutz_spinner.set_range(-99.9999, 0.0000)
  2801. self.cutz_spinner.setSingleStep(0.1)
  2802. self.cutz_spinner.setWrapping(True)
  2803. grid0.addWidget(self.cutzlabel, 6, 0)
  2804. grid0.addWidget(self.cutz_spinner, 6, 1, 1, 2)
  2805. # Isolation Type
  2806. self.iso_type_label = QtWidgets.QLabel('%s:' % _('Isolation Type'))
  2807. self.iso_type_label.setToolTip(
  2808. _("Choose how the isolation will be executed:\n"
  2809. "- 'Full' -> complete isolation of polygons\n"
  2810. "- 'Ext' -> will isolate only on the outside\n"
  2811. "- 'Int' -> will isolate only on the inside\n"
  2812. "'Exterior' isolation is almost always possible\n"
  2813. "(with the right tool) but 'Interior'\n"
  2814. "isolation can be done only when there is an opening\n"
  2815. "inside of the polygon (e.g polygon is a 'doughnut' shape).")
  2816. )
  2817. self.iso_type_radio = RadioSet([{'label': _('Full'), 'value': 'full'},
  2818. {'label': _('Exterior'), 'value': 'ext'},
  2819. {'label': _('Interior'), 'value': 'int'}])
  2820. grid0.addWidget(self.iso_type_label, 7, 0,)
  2821. grid0.addWidget(self.iso_type_radio, 7, 1, 1, 2)
  2822. separator_line = QtWidgets.QFrame()
  2823. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  2824. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  2825. grid0.addWidget(separator_line, 8, 0, 1, 2)
  2826. # Buffering Type
  2827. buffering_label = QtWidgets.QLabel('%s:' % _('Buffering'))
  2828. buffering_label.setToolTip(
  2829. _("Buffering type:\n"
  2830. "- None --> best performance, fast file loading but no so good display\n"
  2831. "- Full --> slow file loading but good visuals. This is the default.\n"
  2832. "<<WARNING>>: Don't change this unless you know what you are doing !!!")
  2833. )
  2834. self.buffering_radio = RadioSet([{'label': _('None'), 'value': 'no'},
  2835. {'label': _('Full'), 'value': 'full'}])
  2836. grid0.addWidget(buffering_label, 9, 0)
  2837. grid0.addWidget(self.buffering_radio, 9, 1)
  2838. # Simplification
  2839. self.simplify_cb = FCCheckBox(label=_('Simplify'))
  2840. self.simplify_cb.setToolTip(
  2841. _("When checked all the Gerber polygons will be\n"
  2842. "loaded with simplification having a set tolerance.\n"
  2843. "<<WARNING>>: Don't change this unless you know what you are doing !!!")
  2844. )
  2845. grid0.addWidget(self.simplify_cb, 10, 0, 1, 2)
  2846. # Simplification tolerance
  2847. self.simplification_tol_label = QtWidgets.QLabel(_('Tolerance'))
  2848. self.simplification_tol_label.setToolTip(_("Tolerance for polygon simplification."))
  2849. self.simplification_tol_spinner = FCDoubleSpinner()
  2850. self.simplification_tol_spinner.set_precision(self.decimals + 1)
  2851. self.simplification_tol_spinner.setWrapping(True)
  2852. self.simplification_tol_spinner.setRange(0.00000, 0.01000)
  2853. self.simplification_tol_spinner.setSingleStep(0.0001)
  2854. grid0.addWidget(self.simplification_tol_label, 11, 0)
  2855. grid0.addWidget(self.simplification_tol_spinner, 11, 1)
  2856. self.ois_simplif = OptionalInputSection(
  2857. self.simplify_cb,
  2858. [
  2859. self.simplification_tol_label, self.simplification_tol_spinner
  2860. ],
  2861. logic=True)
  2862. self.layout.addStretch()
  2863. class GerberExpPrefGroupUI(OptionsGroupUI):
  2864. def __init__(self, decimals=4, parent=None):
  2865. super(GerberExpPrefGroupUI, self).__init__(self)
  2866. self.setTitle(str(_("Gerber Export")))
  2867. self.decimals = decimals
  2868. # Plot options
  2869. self.export_options_label = QtWidgets.QLabel("<b>%s:</b>" % _("Export Options"))
  2870. self.export_options_label.setToolTip(
  2871. _("The parameters set here are used in the file exported\n"
  2872. "when using the File -> Export -> Export Gerber menu entry.")
  2873. )
  2874. self.layout.addWidget(self.export_options_label)
  2875. form = QtWidgets.QFormLayout()
  2876. self.layout.addLayout(form)
  2877. # Gerber Units
  2878. self.gerber_units_label = QtWidgets.QLabel('%s:' % _('Units'))
  2879. self.gerber_units_label.setToolTip(
  2880. _("The units used in the Gerber file.")
  2881. )
  2882. self.gerber_units_radio = RadioSet([{'label': _('INCH'), 'value': 'IN'},
  2883. {'label': _('MM'), 'value': 'MM'}])
  2884. self.gerber_units_radio.setToolTip(
  2885. _("The units used in the Gerber file.")
  2886. )
  2887. form.addRow(self.gerber_units_label, self.gerber_units_radio)
  2888. # Gerber format
  2889. self.digits_label = QtWidgets.QLabel("%s:" % _("Int/Decimals"))
  2890. self.digits_label.setToolTip(
  2891. _("The number of digits in the whole part of the number\n"
  2892. "and in the fractional part of the number.")
  2893. )
  2894. hlay1 = QtWidgets.QHBoxLayout()
  2895. self.format_whole_entry = FCSpinner()
  2896. self.format_whole_entry.set_range(0, 9)
  2897. self.format_whole_entry.set_step(1)
  2898. self.format_whole_entry.setWrapping(True)
  2899. self.format_whole_entry.setMinimumWidth(30)
  2900. self.format_whole_entry.setToolTip(
  2901. _("This numbers signify the number of digits in\n"
  2902. "the whole part of Gerber coordinates.")
  2903. )
  2904. hlay1.addWidget(self.format_whole_entry, QtCore.Qt.AlignLeft)
  2905. gerber_separator_label = QtWidgets.QLabel(':')
  2906. gerber_separator_label.setFixedWidth(5)
  2907. hlay1.addWidget(gerber_separator_label, QtCore.Qt.AlignLeft)
  2908. self.format_dec_entry = FCSpinner()
  2909. self.format_dec_entry.set_range(0, 9)
  2910. self.format_dec_entry.set_step(1)
  2911. self.format_dec_entry.setWrapping(True)
  2912. self.format_dec_entry.setMinimumWidth(30)
  2913. self.format_dec_entry.setToolTip(
  2914. _("This numbers signify the number of digits in\n"
  2915. "the decimal part of Gerber coordinates.")
  2916. )
  2917. hlay1.addWidget(self.format_dec_entry, QtCore.Qt.AlignLeft)
  2918. hlay1.addStretch()
  2919. form.addRow(self.digits_label, hlay1)
  2920. # Gerber Zeros
  2921. self.zeros_label = QtWidgets.QLabel('%s:' % _('Zeros'))
  2922. self.zeros_label.setAlignment(QtCore.Qt.AlignLeft)
  2923. self.zeros_label.setToolTip(
  2924. _("This sets the type of Gerber zeros.\n"
  2925. "If LZ then Leading Zeros are removed and\n"
  2926. "Trailing Zeros are kept.\n"
  2927. "If TZ is checked then Trailing Zeros are removed\n"
  2928. "and Leading Zeros are kept.")
  2929. )
  2930. self.zeros_radio = RadioSet([{'label': _('LZ'), 'value': 'L'},
  2931. {'label': _('TZ'), 'value': 'T'}])
  2932. self.zeros_radio.setToolTip(
  2933. _("This sets the type of Gerber zeros.\n"
  2934. "If LZ then Leading Zeros are removed and\n"
  2935. "Trailing Zeros are kept.\n"
  2936. "If TZ is checked then Trailing Zeros are removed\n"
  2937. "and Leading Zeros are kept.")
  2938. )
  2939. form.addRow(self.zeros_label, self.zeros_radio)
  2940. self.layout.addStretch()
  2941. class GerberEditorPrefGroupUI(OptionsGroupUI):
  2942. def __init__(self, decimals=4, parent=None):
  2943. # OptionsGroupUI.__init__(self, "Gerber Adv. Options Preferences", parent=parent)
  2944. super(GerberEditorPrefGroupUI, self).__init__(self)
  2945. self.setTitle(str(_("Gerber Editor")))
  2946. self.decimals = decimals
  2947. # Advanced Gerber Parameters
  2948. self.param_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  2949. self.param_label.setToolTip(
  2950. _("A list of Gerber Editor parameters.")
  2951. )
  2952. self.layout.addWidget(self.param_label)
  2953. grid0 = QtWidgets.QGridLayout()
  2954. self.layout.addLayout(grid0)
  2955. # Selection Limit
  2956. self.sel_limit_label = QtWidgets.QLabel('%s:' % _("Selection limit"))
  2957. self.sel_limit_label.setToolTip(
  2958. _("Set the number of selected Gerber geometry\n"
  2959. "items above which the utility geometry\n"
  2960. "becomes just a selection rectangle.\n"
  2961. "Increases the performance when moving a\n"
  2962. "large number of geometric elements.")
  2963. )
  2964. self.sel_limit_entry = FCSpinner()
  2965. self.sel_limit_entry.set_range(0, 9999)
  2966. grid0.addWidget(self.sel_limit_label, 0, 0)
  2967. grid0.addWidget(self.sel_limit_entry, 0, 1)
  2968. # New aperture code
  2969. self.addcode_entry_lbl = QtWidgets.QLabel('%s:' % _('New Aperture code'))
  2970. self.addcode_entry_lbl.setToolTip(
  2971. _("Code for the new aperture")
  2972. )
  2973. self.addcode_entry = FCSpinner()
  2974. self.addcode_entry.set_range(10, 99)
  2975. self.addcode_entry.setWrapping(True)
  2976. grid0.addWidget(self.addcode_entry_lbl, 1, 0)
  2977. grid0.addWidget(self.addcode_entry, 1, 1)
  2978. # New aperture size
  2979. self.addsize_entry_lbl = QtWidgets.QLabel('%s:' % _('New Aperture size'))
  2980. self.addsize_entry_lbl.setToolTip(
  2981. _("Size for the new aperture")
  2982. )
  2983. self.addsize_entry = FCDoubleSpinner()
  2984. self.addsize_entry.set_range(0, 100)
  2985. self.addsize_entry.set_precision(self.decimals)
  2986. grid0.addWidget(self.addsize_entry_lbl, 2, 0)
  2987. grid0.addWidget(self.addsize_entry, 2, 1)
  2988. # New aperture type
  2989. self.addtype_combo_lbl = QtWidgets.QLabel('%s:' % _('New Aperture type'))
  2990. self.addtype_combo_lbl.setToolTip(
  2991. _("Type for the new aperture.\n"
  2992. "Can be 'C', 'R' or 'O'.")
  2993. )
  2994. self.addtype_combo = FCComboBox()
  2995. self.addtype_combo.addItems(['C', 'R', 'O'])
  2996. grid0.addWidget(self.addtype_combo_lbl, 3, 0)
  2997. grid0.addWidget(self.addtype_combo, 3, 1)
  2998. # Number of pads in a pad array
  2999. self.grb_array_size_label = QtWidgets.QLabel('%s:' % _('Nr of pads'))
  3000. self.grb_array_size_label.setToolTip(
  3001. _("Specify how many pads to be in the array.")
  3002. )
  3003. self.grb_array_size_entry = FCSpinner()
  3004. self.grb_array_size_entry.set_range(0, 9999)
  3005. grid0.addWidget(self.grb_array_size_label, 4, 0)
  3006. grid0.addWidget(self.grb_array_size_entry, 4, 1)
  3007. self.adddim_label = QtWidgets.QLabel('%s:' % _('Aperture Dimensions'))
  3008. self.adddim_label.setToolTip(
  3009. _("Diameters of the tools, separated by comma.\n"
  3010. "The value of the diameter has to use the dot decimals separator.\n"
  3011. "Valid values: 0.3, 1.0")
  3012. )
  3013. grid0.addWidget(self.adddim_label, 5, 0)
  3014. self.adddim_entry = FCEntry()
  3015. grid0.addWidget(self.adddim_entry, 5, 1)
  3016. self.grb_array_linear_label = QtWidgets.QLabel('<b>%s:</b>' % _('Linear Pad Array'))
  3017. grid0.addWidget(self.grb_array_linear_label, 6, 0, 1, 2)
  3018. # Linear Pad Array direction
  3019. self.grb_axis_label = QtWidgets.QLabel('%s:' % _('Linear Direction'))
  3020. self.grb_axis_label.setToolTip(
  3021. _("Direction on which the linear array is oriented:\n"
  3022. "- 'X' - horizontal axis \n"
  3023. "- 'Y' - vertical axis or \n"
  3024. "- 'Angle' - a custom angle for the array inclination")
  3025. )
  3026. self.grb_axis_radio = RadioSet([{'label': _('X'), 'value': 'X'},
  3027. {'label': _('Y'), 'value': 'Y'},
  3028. {'label': _('Angle'), 'value': 'A'}])
  3029. grid0.addWidget(self.grb_axis_label, 7, 0)
  3030. grid0.addWidget(self.grb_axis_radio, 7, 1)
  3031. # Linear Pad Array pitch distance
  3032. self.grb_pitch_label = QtWidgets.QLabel('%s:' % _('Pitch'))
  3033. self.grb_pitch_label.setToolTip(
  3034. _("Pitch = Distance between elements of the array.")
  3035. )
  3036. # self.drill_pitch_label.setMinimumWidth(100)
  3037. self.grb_pitch_entry = FCDoubleSpinner()
  3038. self.grb_pitch_entry.set_precision(self.decimals)
  3039. grid0.addWidget(self.grb_pitch_label, 8, 0)
  3040. grid0.addWidget(self.grb_pitch_entry, 8, 1)
  3041. # Linear Pad Array custom angle
  3042. self.grb_angle_label = QtWidgets.QLabel('%s:' % _('Angle'))
  3043. self.grb_angle_label.setToolTip(
  3044. _("Angle at which each element in circular array is placed.")
  3045. )
  3046. self.grb_angle_entry = FCDoubleSpinner()
  3047. self.grb_angle_entry.set_precision(self.decimals)
  3048. self.grb_angle_entry.set_range(-360, 360)
  3049. self.grb_angle_entry.setSingleStep(5)
  3050. grid0.addWidget(self.grb_angle_label, 9, 0)
  3051. grid0.addWidget(self.grb_angle_entry, 9, 1)
  3052. self.grb_array_circ_label = QtWidgets.QLabel('<b>%s:</b>' % _('Circular Pad Array'))
  3053. grid0.addWidget(self.grb_array_circ_label, 10, 0, 1, 2)
  3054. # Circular Pad Array direction
  3055. self.grb_circular_direction_label = QtWidgets.QLabel('%s:' % _('Circular Direction'))
  3056. self.grb_circular_direction_label.setToolTip(
  3057. _("Direction for circular array.\n"
  3058. "Can be CW = clockwise or CCW = counter clockwise.")
  3059. )
  3060. self.grb_circular_dir_radio = RadioSet([{'label': _('CW'), 'value': 'CW'},
  3061. {'label': _('CCW'), 'value': 'CCW'}])
  3062. grid0.addWidget(self.grb_circular_direction_label, 11, 0)
  3063. grid0.addWidget(self.grb_circular_dir_radio, 11, 1)
  3064. # Circular Pad Array Angle
  3065. self.grb_circular_angle_label = QtWidgets.QLabel('%s:' % _('Circular Angle'))
  3066. self.grb_circular_angle_label.setToolTip(
  3067. _("Angle at which each element in circular array is placed.")
  3068. )
  3069. self.grb_circular_angle_entry = FCDoubleSpinner()
  3070. self.grb_circular_angle_entry.set_precision(self.decimals)
  3071. self.grb_circular_angle_entry.set_range(-360, 360)
  3072. self.grb_circular_angle_entry.setSingleStep(5)
  3073. grid0.addWidget(self.grb_circular_angle_label, 12, 0)
  3074. grid0.addWidget(self.grb_circular_angle_entry, 12, 1)
  3075. self.grb_array_tools_b_label = QtWidgets.QLabel('<b>%s:</b>' % _('Buffer Tool'))
  3076. grid0.addWidget(self.grb_array_tools_b_label, 13, 0, 1, 2)
  3077. # Buffer Distance
  3078. self.grb_buff_label = QtWidgets.QLabel('%s:' % _('Buffer distance'))
  3079. self.grb_buff_label.setToolTip(
  3080. _("Distance at which to buffer the Gerber element.")
  3081. )
  3082. self.grb_buff_entry = FCDoubleSpinner()
  3083. self.grb_buff_entry.set_precision(self.decimals)
  3084. self.grb_buff_entry.set_range(-9999, 9999)
  3085. grid0.addWidget(self.grb_buff_label, 14, 0)
  3086. grid0.addWidget(self.grb_buff_entry, 14, 1)
  3087. self.grb_array_tools_s_label = QtWidgets.QLabel('<b>%s:</b>' % _('Scale Tool'))
  3088. grid0.addWidget(self.grb_array_tools_s_label, 15, 0, 1, 2)
  3089. # Scale Factor
  3090. self.grb_scale_label = QtWidgets.QLabel('%s:' % _('Scale factor'))
  3091. self.grb_scale_label.setToolTip(
  3092. _("Factor to scale the Gerber element.")
  3093. )
  3094. self.grb_scale_entry = FCDoubleSpinner()
  3095. self.grb_scale_entry.set_precision(self.decimals)
  3096. self.grb_scale_entry.set_range(0, 9999)
  3097. grid0.addWidget(self.grb_scale_label, 16, 0)
  3098. grid0.addWidget(self.grb_scale_entry, 16, 1)
  3099. self.grb_array_tools_ma_label = QtWidgets.QLabel('<b>%s:</b>' % _('Mark Area Tool'))
  3100. grid0.addWidget(self.grb_array_tools_ma_label, 17, 0, 1, 2)
  3101. # Mark area Tool low threshold
  3102. self.grb_ma_low_label = QtWidgets.QLabel('%s:' % _('Threshold low'))
  3103. self.grb_ma_low_label.setToolTip(
  3104. _("Threshold value under which the apertures are not marked.")
  3105. )
  3106. self.grb_ma_low_entry = FCDoubleSpinner()
  3107. self.grb_ma_low_entry.set_precision(self.decimals)
  3108. self.grb_ma_low_entry.set_range(0, 9999)
  3109. grid0.addWidget(self.grb_ma_low_label, 18, 0)
  3110. grid0.addWidget(self.grb_ma_low_entry, 18, 1)
  3111. # Mark area Tool high threshold
  3112. self.grb_ma_high_label = QtWidgets.QLabel('%s:' % _('Threshold high'))
  3113. self.grb_ma_high_label.setToolTip(
  3114. _("Threshold value over which the apertures are not marked.")
  3115. )
  3116. self.grb_ma_high_entry = FCDoubleSpinner()
  3117. self.grb_ma_high_entry.set_precision(self.decimals)
  3118. self.grb_ma_high_entry.set_range(0, 9999)
  3119. grid0.addWidget(self.grb_ma_high_label, 19, 0)
  3120. grid0.addWidget(self.grb_ma_high_entry, 19, 1)
  3121. self.layout.addStretch()
  3122. class ExcellonGenPrefGroupUI(OptionsGroupUI):
  3123. def __init__(self, decimals=4, parent=None):
  3124. # OptionsGroupUI.__init__(self, "Excellon Options", parent=parent)
  3125. super(ExcellonGenPrefGroupUI, self).__init__(self)
  3126. self.setTitle(str(_("Excellon General")))
  3127. self.decimals = decimals
  3128. # Plot options
  3129. self.plot_options_label = QtWidgets.QLabel("<b>%s:</b>" % _("Plot Options"))
  3130. self.layout.addWidget(self.plot_options_label)
  3131. grid1 = QtWidgets.QGridLayout()
  3132. self.layout.addLayout(grid1)
  3133. self.plot_cb = FCCheckBox(label=_('Plot'))
  3134. self.plot_cb.setToolTip(
  3135. "Plot (show) this object."
  3136. )
  3137. grid1.addWidget(self.plot_cb, 0, 0)
  3138. self.solid_cb = FCCheckBox(label=_('Solid'))
  3139. self.solid_cb.setToolTip(
  3140. "Plot as solid circles."
  3141. )
  3142. grid1.addWidget(self.solid_cb, 0, 1)
  3143. separator_line = QtWidgets.QFrame()
  3144. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  3145. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  3146. grid1.addWidget(separator_line, 1, 0, 1, 2)
  3147. grid2 = QtWidgets.QGridLayout()
  3148. self.layout.addLayout(grid2)
  3149. grid2.setColumnStretch(0, 0)
  3150. grid2.setColumnStretch(1, 1)
  3151. # Excellon format
  3152. self.excellon_format_label = QtWidgets.QLabel("<b>%s:</b>" % _("Excellon Format"))
  3153. self.excellon_format_label.setToolTip(
  3154. _("The NC drill files, usually named Excellon files\n"
  3155. "are files that can be found in different formats.\n"
  3156. "Here we set the format used when the provided\n"
  3157. "coordinates are not using period.\n"
  3158. "\n"
  3159. "Possible presets:\n"
  3160. "\n"
  3161. "PROTEUS 3:3 MM LZ\n"
  3162. "DipTrace 5:2 MM TZ\n"
  3163. "DipTrace 4:3 MM LZ\n"
  3164. "\n"
  3165. "EAGLE 3:3 MM TZ\n"
  3166. "EAGLE 4:3 MM TZ\n"
  3167. "EAGLE 2:5 INCH TZ\n"
  3168. "EAGLE 3:5 INCH TZ\n"
  3169. "\n"
  3170. "ALTIUM 2:4 INCH LZ\n"
  3171. "Sprint Layout 2:4 INCH LZ"
  3172. "\n"
  3173. "KiCAD 3:5 INCH TZ")
  3174. )
  3175. grid2.addWidget(self.excellon_format_label, 0, 0, 1, 2)
  3176. self.excellon_format_in_label = QtWidgets.QLabel('%s:' % _("INCH"))
  3177. self.excellon_format_in_label.setToolTip(_("Default values for INCH are 2:4"))
  3178. hlay1 = QtWidgets.QHBoxLayout()
  3179. self.excellon_format_upper_in_entry = FCSpinner()
  3180. self.excellon_format_upper_in_entry.set_range(0, 9)
  3181. self.excellon_format_upper_in_entry.setMinimumWidth(30)
  3182. self.excellon_format_upper_in_entry.setToolTip(
  3183. _("This numbers signify the number of digits in\n"
  3184. "the whole part of Excellon coordinates.")
  3185. )
  3186. hlay1.addWidget(self.excellon_format_upper_in_entry)
  3187. excellon_separator_in_label = QtWidgets.QLabel(':')
  3188. excellon_separator_in_label.setFixedWidth(5)
  3189. hlay1.addWidget(excellon_separator_in_label)
  3190. self.excellon_format_lower_in_entry = FCSpinner()
  3191. self.excellon_format_lower_in_entry.set_range(0, 9)
  3192. self.excellon_format_lower_in_entry.setMinimumWidth(30)
  3193. self.excellon_format_lower_in_entry.setToolTip(
  3194. _("This numbers signify the number of digits in\n"
  3195. "the decimal part of Excellon coordinates.")
  3196. )
  3197. hlay1.addWidget(self.excellon_format_lower_in_entry)
  3198. grid2.addWidget(self.excellon_format_in_label, 1, 0)
  3199. grid2.addLayout(hlay1, 1, 1)
  3200. self.excellon_format_mm_label = QtWidgets.QLabel('%s:' % _("METRIC"))
  3201. self.excellon_format_mm_label.setToolTip(_("Default values for METRIC are 3:3"))
  3202. hlay2 = QtWidgets.QHBoxLayout()
  3203. self.excellon_format_upper_mm_entry = FCSpinner()
  3204. self.excellon_format_upper_mm_entry.set_range(0, 9)
  3205. self.excellon_format_upper_mm_entry.setMinimumWidth(30)
  3206. self.excellon_format_upper_mm_entry.setToolTip(
  3207. _("This numbers signify the number of digits in\n"
  3208. "the whole part of Excellon coordinates.")
  3209. )
  3210. hlay2.addWidget(self.excellon_format_upper_mm_entry)
  3211. excellon_separator_mm_label = QtWidgets.QLabel(':')
  3212. excellon_separator_mm_label.setFixedWidth(5)
  3213. hlay2.addWidget(excellon_separator_mm_label, QtCore.Qt.AlignLeft)
  3214. self.excellon_format_lower_mm_entry = FCSpinner()
  3215. self.excellon_format_lower_mm_entry.set_range(0, 9)
  3216. self.excellon_format_lower_mm_entry.setMinimumWidth(30)
  3217. self.excellon_format_lower_mm_entry.setToolTip(
  3218. _("This numbers signify the number of digits in\n"
  3219. "the decimal part of Excellon coordinates.")
  3220. )
  3221. hlay2.addWidget(self.excellon_format_lower_mm_entry)
  3222. grid2.addWidget(self.excellon_format_mm_label, 2, 0)
  3223. grid2.addLayout(hlay2, 2, 1)
  3224. self.excellon_zeros_label = QtWidgets.QLabel('%s:' % _('Zeros'))
  3225. self.excellon_zeros_label.setAlignment(QtCore.Qt.AlignLeft)
  3226. self.excellon_zeros_label.setToolTip(
  3227. _("This sets the type of Excellon zeros.\n"
  3228. "If LZ then Leading Zeros are kept and\n"
  3229. "Trailing Zeros are removed.\n"
  3230. "If TZ is checked then Trailing Zeros are kept\n"
  3231. "and Leading Zeros are removed.\n\n"
  3232. "This is used when there is no information\n"
  3233. "stored in the Excellon file.")
  3234. )
  3235. grid2.addWidget(self.excellon_zeros_label, 3, 0)
  3236. self.excellon_zeros_radio = RadioSet([{'label': _('LZ'), 'value': 'L'},
  3237. {'label': _('TZ'), 'value': 'T'}])
  3238. grid2.addWidget(self.excellon_zeros_radio, 3, 1)
  3239. self.excellon_units_label = QtWidgets.QLabel('%s:' % _('Units'))
  3240. self.excellon_units_label.setAlignment(QtCore.Qt.AlignLeft)
  3241. self.excellon_units_label.setToolTip(
  3242. _("This sets the default units of Excellon files.\n"
  3243. "If it is not detected in the parsed file the value here\n"
  3244. "will be used."
  3245. "Some Excellon files don't have an header\n"
  3246. "therefore this parameter will be used.")
  3247. )
  3248. self.excellon_units_radio = RadioSet([{'label': _('INCH'), 'value': 'INCH'},
  3249. {'label': _('MM'), 'value': 'METRIC'}])
  3250. self.excellon_units_radio.setToolTip(
  3251. _("This sets the units of Excellon files.\n"
  3252. "Some Excellon files don't have an header\n"
  3253. "therefore this parameter will be used.")
  3254. )
  3255. grid2.addWidget(self.excellon_units_label, 4, 0)
  3256. grid2.addWidget(self.excellon_units_radio, 4, 1)
  3257. self.update_excellon_cb = FCCheckBox(label=_('Update Export settings'))
  3258. self.update_excellon_cb.setToolTip(
  3259. "If checked, the Excellon Export settings will be updated with the ones above."
  3260. )
  3261. grid2.addWidget(self.update_excellon_cb, 5, 0, 1, 2)
  3262. # Adding the Excellon Format Defaults Button
  3263. self.excellon_defaults_button = QtWidgets.QPushButton()
  3264. self.excellon_defaults_button.setText(str(_("Restore Defaults")))
  3265. self.excellon_defaults_button.setMinimumWidth(80)
  3266. grid2.addWidget(self.excellon_defaults_button, 6, 0, 1, 2)
  3267. separator_line = QtWidgets.QFrame()
  3268. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  3269. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  3270. grid2.addWidget(separator_line, 7, 0, 1, 2)
  3271. self.excellon_general_label = QtWidgets.QLabel("<b>%s:</b>" % _("Excellon Optimization"))
  3272. grid2.addWidget(self.excellon_general_label, 8, 0, 1, 2)
  3273. self.excellon_optimization_label = QtWidgets.QLabel(_('Algorithm:'))
  3274. self.excellon_optimization_label.setToolTip(
  3275. _("This sets the optimization type for the Excellon drill path.\n"
  3276. "If <<MetaHeuristic>> is checked then Google OR-Tools algorithm with\n"
  3277. "MetaHeuristic Guided Local Path is used. Default search time is 3sec.\n"
  3278. "If <<Basic>> is checked then Google OR-Tools Basic algorithm is used.\n"
  3279. "If <<TSA>> is checked then Travelling Salesman algorithm is used for\n"
  3280. "drill path optimization.\n"
  3281. "\n"
  3282. "If this control is disabled, then FlatCAM works in 32bit mode and it uses\n"
  3283. "Travelling Salesman algorithm for path optimization.")
  3284. )
  3285. self.excellon_optimization_radio = RadioSet([{'label': _('MetaHeuristic'), 'value': 'M'},
  3286. {'label': _('Basic'), 'value': 'B'},
  3287. {'label': _('TSA'), 'value': 'T'}],
  3288. orientation='vertical', stretch=False)
  3289. self.excellon_optimization_radio.setToolTip(
  3290. _("This sets the optimization type for the Excellon drill path.\n"
  3291. "If <<MetaHeuristic>> is checked then Google OR-Tools algorithm with\n"
  3292. "MetaHeuristic Guided Local Path is used. Default search time is 3sec.\n"
  3293. "If <<Basic>> is checked then Google OR-Tools Basic algorithm is used.\n"
  3294. "If <<TSA>> is checked then Travelling Salesman algorithm is used for\n"
  3295. "drill path optimization.\n"
  3296. "\n"
  3297. "If this control is disabled, then FlatCAM works in 32bit mode and it uses\n"
  3298. "Travelling Salesman algorithm for path optimization.")
  3299. )
  3300. grid2.addWidget(self.excellon_optimization_label, 9, 0)
  3301. grid2.addWidget(self.excellon_optimization_radio, 9, 1)
  3302. self.optimization_time_label = QtWidgets.QLabel('%s:' % _('Duration'))
  3303. self.optimization_time_label.setAlignment(QtCore.Qt.AlignLeft)
  3304. self.optimization_time_label.setToolTip(
  3305. _("When OR-Tools Metaheuristic (MH) is enabled there is a\n"
  3306. "maximum threshold for how much time is spent doing the\n"
  3307. "path optimization. This max duration is set here.\n"
  3308. "In seconds.")
  3309. )
  3310. self.optimization_time_entry = FCSpinner()
  3311. self.optimization_time_entry.set_range(0, 999)
  3312. grid2.addWidget(self.optimization_time_label, 10, 0)
  3313. grid2.addWidget(self.optimization_time_entry, 10, 1)
  3314. separator_line = QtWidgets.QFrame()
  3315. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  3316. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  3317. grid2.addWidget(separator_line, 11, 0, 1, 2)
  3318. # Excellon Object Color
  3319. self.gerber_color_label = QtWidgets.QLabel('<b>%s</b>' % _('Excellon Object Color'))
  3320. grid2.addWidget(self.gerber_color_label, 12, 0, 1, 2)
  3321. # Plot Line Color
  3322. self.line_color_label = QtWidgets.QLabel('%s:' % _('Outline'))
  3323. self.line_color_label.setToolTip(
  3324. _("Set the line color for plotted objects.")
  3325. )
  3326. self.line_color_entry = FCEntry()
  3327. self.line_color_button = QtWidgets.QPushButton()
  3328. self.line_color_button.setFixedSize(15, 15)
  3329. self.form_box_child_2 = QtWidgets.QHBoxLayout()
  3330. self.form_box_child_2.addWidget(self.line_color_entry)
  3331. self.form_box_child_2.addWidget(self.line_color_button)
  3332. self.form_box_child_2.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  3333. grid2.addWidget(self.line_color_label, 13, 0)
  3334. grid2.addLayout(self.form_box_child_2, 13, 1)
  3335. # Plot Fill Color
  3336. self.fill_color_label = QtWidgets.QLabel('%s:' % _('Fill'))
  3337. self.fill_color_label.setToolTip(
  3338. _("Set the fill color for plotted objects.\n"
  3339. "First 6 digits are the color and the last 2\n"
  3340. "digits are for alpha (transparency) level.")
  3341. )
  3342. self.fill_color_entry = FCEntry()
  3343. self.fill_color_button = QtWidgets.QPushButton()
  3344. self.fill_color_button.setFixedSize(15, 15)
  3345. self.form_box_child_1 = QtWidgets.QHBoxLayout()
  3346. self.form_box_child_1.addWidget(self.fill_color_entry)
  3347. self.form_box_child_1.addWidget(self.fill_color_button)
  3348. self.form_box_child_1.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  3349. grid2.addWidget(self.fill_color_label, 14, 0)
  3350. grid2.addLayout(self.form_box_child_1, 14, 1)
  3351. # Plot Fill Transparency Level
  3352. self.alpha_label = QtWidgets.QLabel('%s:' % _('Alpha'))
  3353. self.alpha_label.setToolTip(
  3354. _("Set the fill transparency for plotted objects.")
  3355. )
  3356. self.color_alpha_slider = QtWidgets.QSlider(QtCore.Qt.Horizontal)
  3357. self.color_alpha_slider.setMinimum(0)
  3358. self.color_alpha_slider.setMaximum(255)
  3359. self.color_alpha_slider.setSingleStep(1)
  3360. self.color_alpha_spinner = FCSpinner()
  3361. self.color_alpha_spinner.setMinimumWidth(70)
  3362. self.color_alpha_spinner.set_range(0, 255)
  3363. self.form_box_child_3 = QtWidgets.QHBoxLayout()
  3364. self.form_box_child_3.addWidget(self.color_alpha_slider)
  3365. self.form_box_child_3.addWidget(self.color_alpha_spinner)
  3366. grid2.addWidget(self.alpha_label, 15, 0)
  3367. grid2.addLayout(self.form_box_child_3, 15, 1)
  3368. self.layout.addStretch()
  3369. current_platform = platform.architecture()[0]
  3370. if current_platform == '64bit':
  3371. self.excellon_optimization_label.setDisabled(False)
  3372. self.excellon_optimization_radio.setDisabled(False)
  3373. self.optimization_time_label.setDisabled(False)
  3374. self.optimization_time_entry.setDisabled(False)
  3375. self.excellon_optimization_radio.activated_custom.connect(self.optimization_selection)
  3376. else:
  3377. self.excellon_optimization_label.setDisabled(True)
  3378. self.excellon_optimization_radio.setDisabled(True)
  3379. self.optimization_time_label.setDisabled(True)
  3380. self.optimization_time_entry.setDisabled(True)
  3381. # Setting plot colors signals
  3382. self.line_color_entry.editingFinished.connect(self.on_line_color_entry)
  3383. self.line_color_button.clicked.connect(self.on_line_color_button)
  3384. self.fill_color_entry.editingFinished.connect(self.on_fill_color_entry)
  3385. self.fill_color_button.clicked.connect(self.on_fill_color_button)
  3386. self.color_alpha_spinner.valueChanged.connect(self.on_color_spinner)
  3387. self.color_alpha_slider.valueChanged.connect(self.on_color_slider)
  3388. # Load the defaults values into the Excellon Format and Excellon Zeros fields
  3389. self.excellon_defaults_button.clicked.connect(self.on_excellon_defaults_button)
  3390. def optimization_selection(self):
  3391. if self.excellon_optimization_radio.get_value() == 'M':
  3392. self.optimization_time_label.setDisabled(False)
  3393. self.optimization_time_entry.setDisabled(False)
  3394. else:
  3395. self.optimization_time_label.setDisabled(True)
  3396. self.optimization_time_entry.setDisabled(True)
  3397. # Setting plot colors handlers
  3398. def on_fill_color_entry(self):
  3399. self.app.defaults['excellon_plot_fill'] = self.fill_color_entry.get_value()[:7] + \
  3400. self.app.defaults['excellon_plot_fill'][7:9]
  3401. self.fill_color_button.setStyleSheet("background-color:%s" % str(self.app.defaults['excellon_plot_fill'])[:7])
  3402. def on_fill_color_button(self):
  3403. current_color = QtGui.QColor(self.app.defaults['excellon_plot_fill'][:7])
  3404. c_dialog = QtWidgets.QColorDialog()
  3405. plot_fill_color = c_dialog.getColor(initial=current_color)
  3406. if plot_fill_color.isValid() is False:
  3407. return
  3408. self.fill_color_button.setStyleSheet("background-color:%s" % str(plot_fill_color.name()))
  3409. new_val = str(plot_fill_color.name()) + str(self.app.defaults['excellon_plot_fill'][7:9])
  3410. self.fill_color_entry.set_value(new_val)
  3411. self.app.defaults['excellon_plot_fill'] = new_val
  3412. def on_color_spinner(self):
  3413. spinner_value = self.color_alpha_spinner.value()
  3414. self.color_alpha_slider.setValue(spinner_value)
  3415. self.app.defaults['excellon_plot_fill'] = \
  3416. self.app.defaults['excellon_plot_fill'][:7] + \
  3417. (hex(spinner_value)[2:] if int(hex(spinner_value)[2:], 16) > 0 else '00')
  3418. self.app.defaults['excellon_plot_line'] = \
  3419. self.app.defaults['excellon_plot_line'][:7] + \
  3420. (hex(spinner_value)[2:] if int(hex(spinner_value)[2:], 16) > 0 else '00')
  3421. def on_color_slider(self):
  3422. slider_value = self.color_alpha_slider.value()
  3423. self.color_alpha_spinner.setValue(slider_value)
  3424. def on_line_color_entry(self):
  3425. self.app.defaults['excellon_plot_line'] = self.line_color_entry.get_value()[:7] + \
  3426. self.app.defaults['excellon_plot_line'][7:9]
  3427. self.line_color_button.setStyleSheet("background-color:%s" % str(self.app.defaults['excellon_plot_line'])[:7])
  3428. def on_line_color_button(self):
  3429. current_color = QtGui.QColor(self.app.defaults['excellon_plot_line'][:7])
  3430. # print(current_color)
  3431. c_dialog = QtWidgets.QColorDialog()
  3432. plot_line_color = c_dialog.getColor(initial=current_color)
  3433. if plot_line_color.isValid() is False:
  3434. return
  3435. self.line_color_button.setStyleSheet("background-color:%s" % str(plot_line_color.name()))
  3436. new_val_line = str(plot_line_color.name()) + str(self.app.defaults['excellon_plot_line'][7:9])
  3437. self.line_color_entry.set_value(new_val_line)
  3438. self.app.defaults['excellon_plot_line'] = new_val_line
  3439. def on_excellon_defaults_button(self):
  3440. self.app.preferencesUiManager.defaults_form_fields["excellon_format_lower_in"].set_value('4')
  3441. self.app.preferencesUiManager.defaults_form_fields["excellon_format_upper_in"].set_value('2')
  3442. self.app.preferencesUiManager.defaults_form_fields["excellon_format_lower_mm"].set_value('3')
  3443. self.app.preferencesUiManager.defaults_form_fields["excellon_format_upper_mm"].set_value('3')
  3444. self.app.preferencesUiManager.defaults_form_fields["excellon_zeros"].set_value('L')
  3445. self.app.preferencesUiManager.defaults_form_fields["excellon_units"].set_value('INCH')
  3446. class ExcellonOptPrefGroupUI(OptionsGroupUI):
  3447. def __init__(self, decimals=4, parent=None):
  3448. # OptionsGroupUI.__init__(self, "Excellon Options", parent=parent)
  3449. super(ExcellonOptPrefGroupUI, self).__init__(self)
  3450. self.setTitle(str(_("Excellon Options")))
  3451. self.decimals = decimals
  3452. # ## Create CNC Job
  3453. self.cncjob_label = QtWidgets.QLabel('<b>%s</b>' % _('Create CNC Job'))
  3454. self.cncjob_label.setToolTip(
  3455. _("Parameters used to create a CNC Job object\n"
  3456. "for this drill object.")
  3457. )
  3458. self.layout.addWidget(self.cncjob_label)
  3459. grid2 = QtWidgets.QGridLayout()
  3460. self.layout.addLayout(grid2)
  3461. grid2.setColumnStretch(0, 0)
  3462. grid2.setColumnStretch(1, 1)
  3463. # Operation Type
  3464. self.operation_label = QtWidgets.QLabel('<b>%s:</b>' % _('Operation'))
  3465. self.operation_label.setToolTip(
  3466. _("Operation type:\n"
  3467. "- Drilling -> will drill the drills/slots associated with this tool\n"
  3468. "- Milling -> will mill the drills/slots")
  3469. )
  3470. self.operation_radio = RadioSet(
  3471. [
  3472. {'label': _('Drilling'), 'value': 'drill'},
  3473. {'label': _("Milling"), 'value': 'mill'}
  3474. ]
  3475. )
  3476. grid2.addWidget(self.operation_label, 0, 0)
  3477. grid2.addWidget(self.operation_radio, 0, 1)
  3478. self.mill_type_label = QtWidgets.QLabel('%s:' % _('Milling Type'))
  3479. self.mill_type_label.setToolTip(
  3480. _("Milling type:\n"
  3481. "- Drills -> will mill the drills associated with this tool\n"
  3482. "- Slots -> will mill the slots associated with this tool\n"
  3483. "- Both -> will mill both drills and mills or whatever is available")
  3484. )
  3485. self.milling_type_radio = RadioSet(
  3486. [
  3487. {'label': _('Drills'), 'value': 'drills'},
  3488. {'label': _("Slots"), 'value': 'slots'},
  3489. {'label': _("Both"), 'value': 'both'},
  3490. ]
  3491. )
  3492. grid2.addWidget(self.mill_type_label, 1, 0)
  3493. grid2.addWidget(self.milling_type_radio, 1, 1)
  3494. self.mill_dia_label = QtWidgets.QLabel('%s:' % _('Milling Diameter'))
  3495. self.mill_dia_label.setToolTip(
  3496. _("The diameter of the tool who will do the milling")
  3497. )
  3498. self.mill_dia_entry = FCDoubleSpinner()
  3499. self.mill_dia_entry.set_precision(self.decimals)
  3500. self.mill_dia_entry.set_range(0.0000, 9999.9999)
  3501. grid2.addWidget(self.mill_dia_label, 2, 0)
  3502. grid2.addWidget(self.mill_dia_entry, 2, 1)
  3503. # Cut Z
  3504. cutzlabel = QtWidgets.QLabel('%s:' % _('Cut Z'))
  3505. cutzlabel.setToolTip(
  3506. _("Drill depth (negative)\n"
  3507. "below the copper surface.")
  3508. )
  3509. self.cutz_entry = FCDoubleSpinner()
  3510. if machinist_setting == 0:
  3511. self.cutz_entry.set_range(-9999.9999, 0.0000)
  3512. else:
  3513. self.cutz_entry.set_range(-9999.9999, 9999.9999)
  3514. self.cutz_entry.setSingleStep(0.1)
  3515. self.cutz_entry.set_precision(self.decimals)
  3516. grid2.addWidget(cutzlabel, 3, 0)
  3517. grid2.addWidget(self.cutz_entry, 3, 1)
  3518. # Multi-Depth
  3519. self.mpass_cb = FCCheckBox('%s:' % _("Multi-Depth"))
  3520. self.mpass_cb.setToolTip(
  3521. _(
  3522. "Use multiple passes to limit\n"
  3523. "the cut depth in each pass. Will\n"
  3524. "cut multiple times until Cut Z is\n"
  3525. "reached."
  3526. )
  3527. )
  3528. self.maxdepth_entry = FCDoubleSpinner()
  3529. self.maxdepth_entry.set_precision(self.decimals)
  3530. self.maxdepth_entry.set_range(0, 9999.9999)
  3531. self.maxdepth_entry.setSingleStep(0.1)
  3532. self.maxdepth_entry.setToolTip(_("Depth of each pass (positive)."))
  3533. grid2.addWidget(self.mpass_cb, 4, 0)
  3534. grid2.addWidget(self.maxdepth_entry, 4, 1)
  3535. # Travel Z
  3536. travelzlabel = QtWidgets.QLabel('%s:' % _('Travel Z'))
  3537. travelzlabel.setToolTip(
  3538. _("Tool height when travelling\n"
  3539. "across the XY plane.")
  3540. )
  3541. self.travelz_entry = FCDoubleSpinner()
  3542. self.travelz_entry.set_precision(self.decimals)
  3543. if machinist_setting == 0:
  3544. self.travelz_entry.set_range(0.0001, 9999.9999)
  3545. else:
  3546. self.travelz_entry.set_range(-9999.9999, 9999.9999)
  3547. grid2.addWidget(travelzlabel, 5, 0)
  3548. grid2.addWidget(self.travelz_entry, 5, 1)
  3549. # Tool change:
  3550. self.toolchange_cb = FCCheckBox('%s' % _("Tool change"))
  3551. self.toolchange_cb.setToolTip(
  3552. _("Include tool-change sequence\n"
  3553. "in G-Code (Pause for tool change).")
  3554. )
  3555. grid2.addWidget(self.toolchange_cb, 6, 0, 1, 2)
  3556. # Tool Change Z
  3557. toolchangezlabel = QtWidgets.QLabel('%s:' % _('Toolchange Z'))
  3558. toolchangezlabel.setToolTip(
  3559. _("Z-axis position (height) for\n"
  3560. "tool change.")
  3561. )
  3562. self.toolchangez_entry = FCDoubleSpinner()
  3563. self.toolchangez_entry.set_precision(self.decimals)
  3564. if machinist_setting == 0:
  3565. self.toolchangez_entry.set_range(0.0001, 9999.9999)
  3566. else:
  3567. self.toolchangez_entry.set_range(-9999.9999, 9999.9999)
  3568. grid2.addWidget(toolchangezlabel, 7, 0)
  3569. grid2.addWidget(self.toolchangez_entry, 7, 1)
  3570. # End Move Z
  3571. endz_label = QtWidgets.QLabel('%s:' % _('End move Z'))
  3572. endz_label.setToolTip(
  3573. _("Height of the tool after\n"
  3574. "the last move at the end of the job.")
  3575. )
  3576. self.endz_entry = FCDoubleSpinner()
  3577. self.endz_entry.set_precision(self.decimals)
  3578. if machinist_setting == 0:
  3579. self.endz_entry.set_range(0.0000, 9999.9999)
  3580. else:
  3581. self.endz_entry.set_range(-9999.9999, 9999.9999)
  3582. grid2.addWidget(endz_label, 8, 0)
  3583. grid2.addWidget(self.endz_entry, 8, 1)
  3584. # End Move X,Y
  3585. endmove_xy_label = QtWidgets.QLabel('%s:' % _('End move X,Y'))
  3586. endmove_xy_label.setToolTip(
  3587. _("End move X,Y position. In format (x,y).\n"
  3588. "If no value is entered then there is no move\n"
  3589. "on X,Y plane at the end of the job.")
  3590. )
  3591. self.endxy_entry = FCEntry()
  3592. grid2.addWidget(endmove_xy_label, 9, 0)
  3593. grid2.addWidget(self.endxy_entry, 9, 1)
  3594. # Feedrate Z
  3595. frlabel = QtWidgets.QLabel('%s:' % _('Feedrate Z'))
  3596. frlabel.setToolTip(
  3597. _("Tool speed while drilling\n"
  3598. "(in units per minute).\n"
  3599. "So called 'Plunge' feedrate.\n"
  3600. "This is for linear move G01.")
  3601. )
  3602. self.feedrate_z_entry = FCDoubleSpinner()
  3603. self.feedrate_z_entry.set_precision(self.decimals)
  3604. self.feedrate_z_entry.set_range(0, 99999.9999)
  3605. grid2.addWidget(frlabel, 10, 0)
  3606. grid2.addWidget(self.feedrate_z_entry, 10, 1)
  3607. # Spindle speed
  3608. spdlabel = QtWidgets.QLabel('%s:' % _('Spindle Speed'))
  3609. spdlabel.setToolTip(
  3610. _("Speed of the spindle\n"
  3611. "in RPM (optional)")
  3612. )
  3613. self.spindlespeed_entry = FCSpinner()
  3614. self.spindlespeed_entry.set_range(0, 1000000)
  3615. self.spindlespeed_entry.set_step(100)
  3616. grid2.addWidget(spdlabel, 11, 0)
  3617. grid2.addWidget(self.spindlespeed_entry, 11, 1)
  3618. # Dwell
  3619. self.dwell_cb = FCCheckBox('%s' % _('Enable Dwell'))
  3620. self.dwell_cb .setToolTip(
  3621. _("Pause to allow the spindle to reach its\n"
  3622. "speed before cutting.")
  3623. )
  3624. grid2.addWidget(self.dwell_cb, 12, 0, 1, 2)
  3625. # Dwell Time
  3626. dwelltime = QtWidgets.QLabel('%s:' % _('Duration'))
  3627. dwelltime.setToolTip(_("Number of time units for spindle to dwell."))
  3628. self.dwelltime_entry = FCDoubleSpinner()
  3629. self.dwelltime_entry.set_precision(self.decimals)
  3630. self.dwelltime_entry.set_range(0, 99999.9999)
  3631. grid2.addWidget(dwelltime, 13, 0)
  3632. grid2.addWidget(self.dwelltime_entry, 13, 1)
  3633. self.ois_dwell_exc = OptionalInputSection(self.dwell_cb, [self.dwelltime_entry])
  3634. # preprocessor selection
  3635. pp_excellon_label = QtWidgets.QLabel('%s:' % _("Preprocessor"))
  3636. pp_excellon_label.setToolTip(
  3637. _("The preprocessor JSON file that dictates\n"
  3638. "Gcode output.")
  3639. )
  3640. self.pp_excellon_name_cb = FCComboBox()
  3641. self.pp_excellon_name_cb.setFocusPolicy(Qt.StrongFocus)
  3642. grid2.addWidget(pp_excellon_label, 14, 0)
  3643. grid2.addWidget(self.pp_excellon_name_cb, 14, 1)
  3644. # ### Choose what to use for Gcode creation: Drills, Slots or Both
  3645. excellon_gcode_type_label = QtWidgets.QLabel('<b>%s</b>' % _('Gcode'))
  3646. excellon_gcode_type_label.setToolTip(
  3647. _("Choose what to use for GCode generation:\n"
  3648. "'Drills', 'Slots' or 'Both'.\n"
  3649. "When choosing 'Slots' or 'Both', slots will be\n"
  3650. "converted to drills.")
  3651. )
  3652. self.excellon_gcode_type_radio = RadioSet([{'label': 'Drills', 'value': 'drills'},
  3653. {'label': 'Slots', 'value': 'slots'},
  3654. {'label': 'Both', 'value': 'both'}])
  3655. grid2.addWidget(excellon_gcode_type_label, 15, 0)
  3656. grid2.addWidget(self.excellon_gcode_type_radio, 15, 1)
  3657. # until I decide to implement this feature those remain disabled
  3658. excellon_gcode_type_label.hide()
  3659. self.excellon_gcode_type_radio.setVisible(False)
  3660. # ### Milling Holes ## ##
  3661. self.mill_hole_label = QtWidgets.QLabel('<b>%s</b>' % _('Mill Holes'))
  3662. self.mill_hole_label.setToolTip(
  3663. _("Create Geometry for milling holes.")
  3664. )
  3665. grid2.addWidget(self.mill_hole_label, 16, 0, 1, 2)
  3666. tdlabel = QtWidgets.QLabel('%s:' % _('Drill Tool dia'))
  3667. tdlabel.setToolTip(
  3668. _("Diameter of the cutting tool.")
  3669. )
  3670. self.tooldia_entry = FCDoubleSpinner()
  3671. self.tooldia_entry.set_precision(self.decimals)
  3672. self.tooldia_entry.set_range(0, 999.9999)
  3673. grid2.addWidget(tdlabel, 18, 0)
  3674. grid2.addWidget(self.tooldia_entry, 18, 1)
  3675. stdlabel = QtWidgets.QLabel('%s:' % _('Slot Tool dia'))
  3676. stdlabel.setToolTip(
  3677. _("Diameter of the cutting tool\n"
  3678. "when milling slots.")
  3679. )
  3680. self.slot_tooldia_entry = FCDoubleSpinner()
  3681. self.slot_tooldia_entry.set_precision(self.decimals)
  3682. self.slot_tooldia_entry.set_range(0, 999.9999)
  3683. grid2.addWidget(stdlabel, 21, 0)
  3684. grid2.addWidget(self.slot_tooldia_entry, 21, 1)
  3685. self.layout.addStretch()
  3686. class ExcellonAdvOptPrefGroupUI(OptionsGroupUI):
  3687. def __init__(self, decimals=4, parent=None):
  3688. # OptionsGroupUI.__init__(self, "Excellon Advanced Options", parent=parent)
  3689. super(ExcellonAdvOptPrefGroupUI, self).__init__(self)
  3690. self.setTitle(str(_("Excellon Adv. Options")))
  3691. self.decimals = decimals
  3692. # #######################
  3693. # ## ADVANCED OPTIONS ###
  3694. # #######################
  3695. self.exc_label = QtWidgets.QLabel('<b>%s:</b>' % _('Advanced Options'))
  3696. self.exc_label.setToolTip(
  3697. _("A list of Excellon advanced parameters.\n"
  3698. "Those parameters are available only for\n"
  3699. "Advanced App. Level.")
  3700. )
  3701. self.layout.addWidget(self.exc_label)
  3702. grid1 = QtWidgets.QGridLayout()
  3703. self.layout.addLayout(grid1)
  3704. # Offset Z
  3705. offsetlabel = QtWidgets.QLabel('%s:' % _('Offset Z'))
  3706. offsetlabel.setToolTip(
  3707. _("Some drill bits (the larger ones) need to drill deeper\n"
  3708. "to create the desired exit hole diameter due of the tip shape.\n"
  3709. "The value here can compensate the Cut Z parameter."))
  3710. self.offset_entry = FCDoubleSpinner()
  3711. self.offset_entry.set_precision(self.decimals)
  3712. self.offset_entry.set_range(-999.9999, 999.9999)
  3713. grid1.addWidget(offsetlabel, 0, 0)
  3714. grid1.addWidget(self.offset_entry, 0, 1)
  3715. # ToolChange X,Y
  3716. toolchange_xy_label = QtWidgets.QLabel('%s:' % _('Toolchange X,Y'))
  3717. toolchange_xy_label.setToolTip(
  3718. _("Toolchange X,Y position.")
  3719. )
  3720. self.toolchangexy_entry = FCEntry()
  3721. grid1.addWidget(toolchange_xy_label, 1, 0)
  3722. grid1.addWidget(self.toolchangexy_entry, 1, 1)
  3723. # Start Z
  3724. startzlabel = QtWidgets.QLabel('%s:' % _('Start Z'))
  3725. startzlabel.setToolTip(
  3726. _("Height of the tool just after start.\n"
  3727. "Delete the value if you don't need this feature.")
  3728. )
  3729. self.estartz_entry = FloatEntry()
  3730. grid1.addWidget(startzlabel, 2, 0)
  3731. grid1.addWidget(self.estartz_entry, 2, 1)
  3732. # Feedrate Rapids
  3733. fr_rapid_label = QtWidgets.QLabel('%s:' % _('Feedrate Rapids'))
  3734. fr_rapid_label.setToolTip(
  3735. _("Tool speed while drilling\n"
  3736. "(in units per minute).\n"
  3737. "This is for the rapid move G00.\n"
  3738. "It is useful only for Marlin,\n"
  3739. "ignore for any other cases.")
  3740. )
  3741. self.feedrate_rapid_entry = FCDoubleSpinner()
  3742. self.feedrate_rapid_entry.set_precision(self.decimals)
  3743. self.feedrate_rapid_entry.set_range(0, 99999.9999)
  3744. grid1.addWidget(fr_rapid_label, 3, 0)
  3745. grid1.addWidget(self.feedrate_rapid_entry, 3, 1)
  3746. # Probe depth
  3747. self.pdepth_label = QtWidgets.QLabel('%s:' % _("Probe Z depth"))
  3748. self.pdepth_label.setToolTip(
  3749. _("The maximum depth that the probe is allowed\n"
  3750. "to probe. Negative value, in current units.")
  3751. )
  3752. self.pdepth_entry = FCDoubleSpinner()
  3753. self.pdepth_entry.set_precision(self.decimals)
  3754. self.pdepth_entry.set_range(-99999.9999, 0.0000)
  3755. grid1.addWidget(self.pdepth_label, 4, 0)
  3756. grid1.addWidget(self.pdepth_entry, 4, 1)
  3757. # Probe feedrate
  3758. self.feedrate_probe_label = QtWidgets.QLabel('%s:' % _("Feedrate Probe"))
  3759. self.feedrate_probe_label.setToolTip(
  3760. _("The feedrate used while the probe is probing.")
  3761. )
  3762. self.feedrate_probe_entry = FCDoubleSpinner()
  3763. self.feedrate_probe_entry.set_precision(self.decimals)
  3764. self.feedrate_probe_entry.set_range(0, 99999.9999)
  3765. grid1.addWidget(self.feedrate_probe_label, 5, 0)
  3766. grid1.addWidget(self.feedrate_probe_entry, 5, 1)
  3767. # Spindle direction
  3768. spindle_dir_label = QtWidgets.QLabel('%s:' % _('Spindle direction'))
  3769. spindle_dir_label.setToolTip(
  3770. _("This sets the direction that the spindle is rotating.\n"
  3771. "It can be either:\n"
  3772. "- CW = clockwise or\n"
  3773. "- CCW = counter clockwise")
  3774. )
  3775. self.spindledir_radio = RadioSet([{'label': _('CW'), 'value': 'CW'},
  3776. {'label': _('CCW'), 'value': 'CCW'}])
  3777. grid1.addWidget(spindle_dir_label, 6, 0)
  3778. grid1.addWidget(self.spindledir_radio, 6, 1)
  3779. self.fplunge_cb = FCCheckBox('%s' % _('Fast Plunge'))
  3780. self.fplunge_cb.setToolTip(
  3781. _("By checking this, the vertical move from\n"
  3782. "Z_Toolchange to Z_move is done with G0,\n"
  3783. "meaning the fastest speed available.\n"
  3784. "WARNING: the move is done at Toolchange X,Y coords.")
  3785. )
  3786. grid1.addWidget(self.fplunge_cb, 7, 0, 1, 2)
  3787. self.fretract_cb = FCCheckBox('%s' % _('Fast Retract'))
  3788. self.fretract_cb.setToolTip(
  3789. _("Exit hole strategy.\n"
  3790. " - When uncheked, while exiting the drilled hole the drill bit\n"
  3791. "will travel slow, with set feedrate (G1), up to zero depth and then\n"
  3792. "travel as fast as possible (G0) to the Z Move (travel height).\n"
  3793. " - When checked the travel from Z cut (cut depth) to Z_move\n"
  3794. "(travel height) is done as fast as possible (G0) in one move.")
  3795. )
  3796. grid1.addWidget(self.fretract_cb, 8, 0, 1, 2)
  3797. self.layout.addStretch()
  3798. class ExcellonExpPrefGroupUI(OptionsGroupUI):
  3799. def __init__(self, decimals=4, parent=None):
  3800. super(ExcellonExpPrefGroupUI, self).__init__(self)
  3801. self.setTitle(str(_("Excellon Export")))
  3802. self.decimals = decimals
  3803. # Plot options
  3804. self.export_options_label = QtWidgets.QLabel("<b>%s:</b>" % _("Export Options"))
  3805. self.export_options_label.setToolTip(
  3806. _("The parameters set here are used in the file exported\n"
  3807. "when using the File -> Export -> Export Excellon menu entry.")
  3808. )
  3809. self.layout.addWidget(self.export_options_label)
  3810. form = QtWidgets.QFormLayout()
  3811. self.layout.addLayout(form)
  3812. # Excellon Units
  3813. self.excellon_units_label = QtWidgets.QLabel('%s:' % _('Units'))
  3814. self.excellon_units_label.setToolTip(
  3815. _("The units used in the Excellon file.")
  3816. )
  3817. self.excellon_units_radio = RadioSet([{'label': _('INCH'), 'value': 'INCH'},
  3818. {'label': _('MM'), 'value': 'METRIC'}])
  3819. self.excellon_units_radio.setToolTip(
  3820. _("The units used in the Excellon file.")
  3821. )
  3822. form.addRow(self.excellon_units_label, self.excellon_units_radio)
  3823. # Excellon non-decimal format
  3824. self.digits_label = QtWidgets.QLabel("%s:" % _("Int/Decimals"))
  3825. self.digits_label.setToolTip(
  3826. _("The NC drill files, usually named Excellon files\n"
  3827. "are files that can be found in different formats.\n"
  3828. "Here we set the format used when the provided\n"
  3829. "coordinates are not using period.")
  3830. )
  3831. hlay1 = QtWidgets.QHBoxLayout()
  3832. self.format_whole_entry = FCSpinner()
  3833. self.format_whole_entry.set_range(0, 9)
  3834. self.format_whole_entry.setMinimumWidth(30)
  3835. self.format_whole_entry.setToolTip(
  3836. _("This numbers signify the number of digits in\n"
  3837. "the whole part of Excellon coordinates.")
  3838. )
  3839. hlay1.addWidget(self.format_whole_entry, QtCore.Qt.AlignLeft)
  3840. excellon_separator_label = QtWidgets.QLabel(':')
  3841. excellon_separator_label.setFixedWidth(5)
  3842. hlay1.addWidget(excellon_separator_label, QtCore.Qt.AlignLeft)
  3843. self.format_dec_entry = FCSpinner()
  3844. self.format_dec_entry.set_range(0, 9)
  3845. self.format_dec_entry.setMinimumWidth(30)
  3846. self.format_dec_entry.setToolTip(
  3847. _("This numbers signify the number of digits in\n"
  3848. "the decimal part of Excellon coordinates.")
  3849. )
  3850. hlay1.addWidget(self.format_dec_entry, QtCore.Qt.AlignLeft)
  3851. hlay1.addStretch()
  3852. form.addRow(self.digits_label, hlay1)
  3853. # Select the Excellon Format
  3854. self.format_label = QtWidgets.QLabel("%s:" % _("Format"))
  3855. self.format_label.setToolTip(
  3856. _("Select the kind of coordinates format used.\n"
  3857. "Coordinates can be saved with decimal point or without.\n"
  3858. "When there is no decimal point, it is required to specify\n"
  3859. "the number of digits for integer part and the number of decimals.\n"
  3860. "Also it will have to be specified if LZ = leading zeros are kept\n"
  3861. "or TZ = trailing zeros are kept.")
  3862. )
  3863. self.format_radio = RadioSet([{'label': _('Decimal'), 'value': 'dec'},
  3864. {'label': _('No-Decimal'), 'value': 'ndec'}])
  3865. self.format_radio.setToolTip(
  3866. _("Select the kind of coordinates format used.\n"
  3867. "Coordinates can be saved with decimal point or without.\n"
  3868. "When there is no decimal point, it is required to specify\n"
  3869. "the number of digits for integer part and the number of decimals.\n"
  3870. "Also it will have to be specified if LZ = leading zeros are kept\n"
  3871. "or TZ = trailing zeros are kept.")
  3872. )
  3873. form.addRow(self.format_label, self.format_radio)
  3874. # Excellon Zeros
  3875. self.zeros_label = QtWidgets.QLabel('%s:' % _('Zeros'))
  3876. self.zeros_label.setAlignment(QtCore.Qt.AlignLeft)
  3877. self.zeros_label.setToolTip(
  3878. _("This sets the type of Excellon zeros.\n"
  3879. "If LZ then Leading Zeros are kept and\n"
  3880. "Trailing Zeros are removed.\n"
  3881. "If TZ is checked then Trailing Zeros are kept\n"
  3882. "and Leading Zeros are removed.")
  3883. )
  3884. self.zeros_radio = RadioSet([{'label': _('LZ'), 'value': 'LZ'},
  3885. {'label': _('TZ'), 'value': 'TZ'}])
  3886. self.zeros_radio.setToolTip(
  3887. _("This sets the default type of Excellon zeros.\n"
  3888. "If LZ then Leading Zeros are kept and\n"
  3889. "Trailing Zeros are removed.\n"
  3890. "If TZ is checked then Trailing Zeros are kept\n"
  3891. "and Leading Zeros are removed.")
  3892. )
  3893. form.addRow(self.zeros_label, self.zeros_radio)
  3894. # Slot type
  3895. self.slot_type_label = QtWidgets.QLabel('%s:' % _('Slot type'))
  3896. self.slot_type_label.setAlignment(QtCore.Qt.AlignLeft)
  3897. self.slot_type_label.setToolTip(
  3898. _("This sets how the slots will be exported.\n"
  3899. "If ROUTED then the slots will be routed\n"
  3900. "using M15/M16 commands.\n"
  3901. "If DRILLED(G85) the slots will be exported\n"
  3902. "using the Drilled slot command (G85).")
  3903. )
  3904. self.slot_type_radio = RadioSet([{'label': _('Routed'), 'value': 'routing'},
  3905. {'label': _('Drilled(G85)'), 'value': 'drilling'}])
  3906. self.slot_type_radio.setToolTip(
  3907. _("This sets how the slots will be exported.\n"
  3908. "If ROUTED then the slots will be routed\n"
  3909. "using M15/M16 commands.\n"
  3910. "If DRILLED(G85) the slots will be exported\n"
  3911. "using the Drilled slot command (G85).")
  3912. )
  3913. form.addRow(self.slot_type_label, self.slot_type_radio)
  3914. self.layout.addStretch()
  3915. self.format_radio.activated_custom.connect(self.optimization_selection)
  3916. def optimization_selection(self):
  3917. if self.format_radio.get_value() == 'dec':
  3918. self.zeros_label.setDisabled(True)
  3919. self.zeros_radio.setDisabled(True)
  3920. else:
  3921. self.zeros_label.setDisabled(False)
  3922. self.zeros_radio.setDisabled(False)
  3923. class ExcellonEditorPrefGroupUI(OptionsGroupUI):
  3924. def __init__(self, decimals=4, parent=None):
  3925. super(ExcellonEditorPrefGroupUI, self).__init__(self)
  3926. self.setTitle(str(_("Excellon Editor")))
  3927. self.decimals = decimals
  3928. # Excellon Editor Parameters
  3929. self.param_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  3930. self.param_label.setToolTip(
  3931. _("A list of Excellon Editor parameters.")
  3932. )
  3933. self.layout.addWidget(self.param_label)
  3934. grid0 = QtWidgets.QGridLayout()
  3935. self.layout.addLayout(grid0)
  3936. # Selection Limit
  3937. self.sel_limit_label = QtWidgets.QLabel('%s:' % _("Selection limit"))
  3938. self.sel_limit_label.setToolTip(
  3939. _("Set the number of selected Excellon geometry\n"
  3940. "items above which the utility geometry\n"
  3941. "becomes just a selection rectangle.\n"
  3942. "Increases the performance when moving a\n"
  3943. "large number of geometric elements.")
  3944. )
  3945. self.sel_limit_entry = FCSpinner()
  3946. self.sel_limit_entry.set_range(0, 99999)
  3947. grid0.addWidget(self.sel_limit_label, 0, 0)
  3948. grid0.addWidget(self.sel_limit_entry, 0, 1)
  3949. # New Diameter
  3950. self.addtool_entry_lbl = QtWidgets.QLabel('%s:' % _('New Dia'))
  3951. self.addtool_entry_lbl.setToolTip(
  3952. _("Diameter for the new tool")
  3953. )
  3954. self.addtool_entry = FCDoubleSpinner()
  3955. self.addtool_entry.set_range(0.000001, 99.9999)
  3956. self.addtool_entry.set_precision(self.decimals)
  3957. grid0.addWidget(self.addtool_entry_lbl, 1, 0)
  3958. grid0.addWidget(self.addtool_entry, 1, 1)
  3959. # Number of drill holes in a drill array
  3960. self.drill_array_size_label = QtWidgets.QLabel('%s:' % _('Nr of drills'))
  3961. self.drill_array_size_label.setToolTip(
  3962. _("Specify how many drills to be in the array.")
  3963. )
  3964. # self.drill_array_size_label.setMinimumWidth(100)
  3965. self.drill_array_size_entry = FCSpinner()
  3966. self.drill_array_size_entry.set_range(0, 9999)
  3967. grid0.addWidget(self.drill_array_size_label, 2, 0)
  3968. grid0.addWidget(self.drill_array_size_entry, 2, 1)
  3969. self.drill_array_linear_label = QtWidgets.QLabel('<b>%s:</b>' % _('Linear Drill Array'))
  3970. grid0.addWidget(self.drill_array_linear_label, 3, 0, 1, 2)
  3971. # Linear Drill Array direction
  3972. self.drill_axis_label = QtWidgets.QLabel('%s:' % _('Linear Direction'))
  3973. self.drill_axis_label.setToolTip(
  3974. _("Direction on which the linear array is oriented:\n"
  3975. "- 'X' - horizontal axis \n"
  3976. "- 'Y' - vertical axis or \n"
  3977. "- 'Angle' - a custom angle for the array inclination")
  3978. )
  3979. # self.drill_axis_label.setMinimumWidth(100)
  3980. self.drill_axis_radio = RadioSet([{'label': _('X'), 'value': 'X'},
  3981. {'label': _('Y'), 'value': 'Y'},
  3982. {'label': _('Angle'), 'value': 'A'}])
  3983. grid0.addWidget(self.drill_axis_label, 4, 0)
  3984. grid0.addWidget(self.drill_axis_radio, 4, 1)
  3985. # Linear Drill Array pitch distance
  3986. self.drill_pitch_label = QtWidgets.QLabel('%s:' % _('Pitch'))
  3987. self.drill_pitch_label.setToolTip(
  3988. _("Pitch = Distance between elements of the array.")
  3989. )
  3990. # self.drill_pitch_label.setMinimumWidth(100)
  3991. self.drill_pitch_entry = FCDoubleSpinner()
  3992. self.drill_pitch_entry.set_range(0, 99999.9999)
  3993. self.drill_pitch_entry.set_precision(self.decimals)
  3994. grid0.addWidget(self.drill_pitch_label, 5, 0)
  3995. grid0.addWidget(self.drill_pitch_entry, 5, 1)
  3996. # Linear Drill Array custom angle
  3997. self.drill_angle_label = QtWidgets.QLabel('%s:' % _('Angle'))
  3998. self.drill_angle_label.setToolTip(
  3999. _("Angle at which each element in circular array is placed.")
  4000. )
  4001. self.drill_angle_entry = FCDoubleSpinner()
  4002. self.drill_pitch_entry.set_range(-360, 360)
  4003. self.drill_pitch_entry.set_precision(self.decimals)
  4004. self.drill_angle_entry.setWrapping(True)
  4005. self.drill_angle_entry.setSingleStep(5)
  4006. grid0.addWidget(self.drill_angle_label, 6, 0)
  4007. grid0.addWidget(self.drill_angle_entry, 6, 1)
  4008. self.drill_array_circ_label = QtWidgets.QLabel('<b>%s:</b>' % _('Circular Drill Array'))
  4009. grid0.addWidget(self.drill_array_circ_label, 7, 0, 1, 2)
  4010. # Circular Drill Array direction
  4011. self.drill_circular_direction_label = QtWidgets.QLabel('%s:' % _('Circular Direction'))
  4012. self.drill_circular_direction_label.setToolTip(
  4013. _("Direction for circular array.\n"
  4014. "Can be CW = clockwise or CCW = counter clockwise.")
  4015. )
  4016. self.drill_circular_dir_radio = RadioSet([{'label': _('CW'), 'value': 'CW'},
  4017. {'label': _('CCW'), 'value': 'CCW'}])
  4018. grid0.addWidget(self.drill_circular_direction_label, 8, 0)
  4019. grid0.addWidget(self.drill_circular_dir_radio, 8, 1)
  4020. # Circular Drill Array Angle
  4021. self.drill_circular_angle_label = QtWidgets.QLabel('%s:' % _('Circular Angle'))
  4022. self.drill_circular_angle_label.setToolTip(
  4023. _("Angle at which each element in circular array is placed.")
  4024. )
  4025. self.drill_circular_angle_entry = FCDoubleSpinner()
  4026. self.drill_circular_angle_entry.set_range(-360, 360)
  4027. self.drill_circular_angle_entry.set_precision(self.decimals)
  4028. self.drill_circular_angle_entry.setWrapping(True)
  4029. self.drill_circular_angle_entry.setSingleStep(5)
  4030. grid0.addWidget(self.drill_circular_angle_label, 9, 0)
  4031. grid0.addWidget(self.drill_circular_angle_entry, 9, 1)
  4032. # ##### SLOTS #####
  4033. # #################
  4034. self.drill_array_circ_label = QtWidgets.QLabel('<b>%s:</b>' % _('Slots'))
  4035. grid0.addWidget(self.drill_array_circ_label, 10, 0, 1, 2)
  4036. # Slot length
  4037. self.slot_length_label = QtWidgets.QLabel('%s:' % _('Length'))
  4038. self.slot_length_label.setToolTip(
  4039. _("Length = The length of the slot.")
  4040. )
  4041. self.slot_length_label.setMinimumWidth(100)
  4042. self.slot_length_entry = FCDoubleSpinner()
  4043. self.slot_length_entry.set_range(0, 99999)
  4044. self.slot_length_entry.set_precision(self.decimals)
  4045. self.slot_length_entry.setWrapping(True)
  4046. self.slot_length_entry.setSingleStep(1)
  4047. grid0.addWidget(self.slot_length_label, 11, 0)
  4048. grid0.addWidget(self.slot_length_entry, 11, 1)
  4049. # Slot direction
  4050. self.slot_axis_label = QtWidgets.QLabel('%s:' % _('Direction'))
  4051. self.slot_axis_label.setToolTip(
  4052. _("Direction on which the slot is oriented:\n"
  4053. "- 'X' - horizontal axis \n"
  4054. "- 'Y' - vertical axis or \n"
  4055. "- 'Angle' - a custom angle for the slot inclination")
  4056. )
  4057. self.slot_axis_label.setMinimumWidth(100)
  4058. self.slot_axis_radio = RadioSet([{'label': _('X'), 'value': 'X'},
  4059. {'label': _('Y'), 'value': 'Y'},
  4060. {'label': _('Angle'), 'value': 'A'}])
  4061. grid0.addWidget(self.slot_axis_label, 12, 0)
  4062. grid0.addWidget(self.slot_axis_radio, 12, 1)
  4063. # Slot custom angle
  4064. self.slot_angle_label = QtWidgets.QLabel('%s:' % _('Angle'))
  4065. self.slot_angle_label.setToolTip(
  4066. _("Angle at which the slot is placed.\n"
  4067. "The precision is of max 2 decimals.\n"
  4068. "Min value is: -359.99 degrees.\n"
  4069. "Max value is: 360.00 degrees.")
  4070. )
  4071. self.slot_angle_label.setMinimumWidth(100)
  4072. self.slot_angle_spinner = FCDoubleSpinner()
  4073. self.slot_angle_spinner.set_precision(self.decimals)
  4074. self.slot_angle_spinner.setWrapping(True)
  4075. self.slot_angle_spinner.setRange(-359.99, 360.00)
  4076. self.slot_angle_spinner.setSingleStep(5)
  4077. grid0.addWidget(self.slot_angle_label, 13, 0)
  4078. grid0.addWidget(self.slot_angle_spinner, 13, 1)
  4079. # #### SLOTS ARRAY #######
  4080. # ########################
  4081. self.slot_array_linear_label = QtWidgets.QLabel('<b>%s:</b>' % _('Linear Slot Array'))
  4082. grid0.addWidget(self.slot_array_linear_label, 14, 0, 1, 2)
  4083. # Number of slot holes in a drill array
  4084. self.slot_array_size_label = QtWidgets.QLabel('%s:' % _('Nr of slots'))
  4085. self.drill_array_size_label.setToolTip(
  4086. _("Specify how many slots to be in the array.")
  4087. )
  4088. # self.slot_array_size_label.setMinimumWidth(100)
  4089. self.slot_array_size_entry = FCSpinner()
  4090. self.slot_array_size_entry.set_range(0, 999999)
  4091. grid0.addWidget(self.slot_array_size_label, 15, 0)
  4092. grid0.addWidget(self.slot_array_size_entry, 15, 1)
  4093. # Linear Slot Array direction
  4094. self.slot_array_axis_label = QtWidgets.QLabel('%s:' % _('Linear Direction'))
  4095. self.slot_array_axis_label.setToolTip(
  4096. _("Direction on which the linear array is oriented:\n"
  4097. "- 'X' - horizontal axis \n"
  4098. "- 'Y' - vertical axis or \n"
  4099. "- 'Angle' - a custom angle for the array inclination")
  4100. )
  4101. # self.slot_axis_label.setMinimumWidth(100)
  4102. self.slot_array_axis_radio = RadioSet([{'label': _('X'), 'value': 'X'},
  4103. {'label': _('Y'), 'value': 'Y'},
  4104. {'label': _('Angle'), 'value': 'A'}])
  4105. grid0.addWidget(self.slot_array_axis_label, 16, 0)
  4106. grid0.addWidget(self.slot_array_axis_radio, 16, 1)
  4107. # Linear Slot Array pitch distance
  4108. self.slot_array_pitch_label = QtWidgets.QLabel('%s:' % _('Pitch'))
  4109. self.slot_array_pitch_label.setToolTip(
  4110. _("Pitch = Distance between elements of the array.")
  4111. )
  4112. # self.drill_pitch_label.setMinimumWidth(100)
  4113. self.slot_array_pitch_entry = FCDoubleSpinner()
  4114. self.slot_array_pitch_entry.set_precision(self.decimals)
  4115. self.slot_array_pitch_entry.setWrapping(True)
  4116. self.slot_array_pitch_entry.setRange(0, 999999)
  4117. self.slot_array_pitch_entry.setSingleStep(1)
  4118. grid0.addWidget(self.slot_array_pitch_label, 17, 0)
  4119. grid0.addWidget(self.slot_array_pitch_entry, 17, 1)
  4120. # Linear Slot Array custom angle
  4121. self.slot_array_angle_label = QtWidgets.QLabel('%s:' % _('Angle'))
  4122. self.slot_array_angle_label.setToolTip(
  4123. _("Angle at which each element in circular array is placed.")
  4124. )
  4125. self.slot_array_angle_entry = FCDoubleSpinner()
  4126. self.slot_array_angle_entry.set_precision(self.decimals)
  4127. self.slot_array_angle_entry.setWrapping(True)
  4128. self.slot_array_angle_entry.setRange(-360, 360)
  4129. self.slot_array_angle_entry.setSingleStep(5)
  4130. grid0.addWidget(self.slot_array_angle_label, 18, 0)
  4131. grid0.addWidget(self.slot_array_angle_entry, 18, 1)
  4132. self.slot_array_circ_label = QtWidgets.QLabel('<b>%s:</b>' % _('Circular Slot Array'))
  4133. grid0.addWidget(self.slot_array_circ_label, 19, 0, 1, 2)
  4134. # Circular Slot Array direction
  4135. self.slot_array_circular_direction_label = QtWidgets.QLabel('%s:' % _('Circular Direction'))
  4136. self.slot_array_circular_direction_label.setToolTip(
  4137. _("Direction for circular array.\n"
  4138. "Can be CW = clockwise or CCW = counter clockwise.")
  4139. )
  4140. self.slot_array_circular_dir_radio = RadioSet([{'label': _('CW'), 'value': 'CW'},
  4141. {'label': _('CCW'), 'value': 'CCW'}])
  4142. grid0.addWidget(self.slot_array_circular_direction_label, 20, 0)
  4143. grid0.addWidget(self.slot_array_circular_dir_radio, 20, 1)
  4144. # Circular Slot Array Angle
  4145. self.slot_array_circular_angle_label = QtWidgets.QLabel('%s:' % _('Circular Angle'))
  4146. self.slot_array_circular_angle_label.setToolTip(
  4147. _("Angle at which each element in circular array is placed.")
  4148. )
  4149. self.slot_array_circular_angle_entry = FCDoubleSpinner()
  4150. self.slot_array_circular_angle_entry.set_precision(self.decimals)
  4151. self.slot_array_circular_angle_entry.setWrapping(True)
  4152. self.slot_array_circular_angle_entry.setRange(-360, 360)
  4153. self.slot_array_circular_angle_entry.setSingleStep(5)
  4154. grid0.addWidget(self.slot_array_circular_angle_label, 21, 0)
  4155. grid0.addWidget(self.slot_array_circular_angle_entry, 21, 1)
  4156. self.layout.addStretch()
  4157. class GeometryGenPrefGroupUI(OptionsGroupUI):
  4158. def __init__(self, decimals=4, parent=None):
  4159. # OptionsGroupUI.__init__(self, "Geometry General Preferences", parent=parent)
  4160. super(GeometryGenPrefGroupUI, self).__init__(self)
  4161. self.setTitle(str(_("Geometry General")))
  4162. self.decimals = decimals
  4163. # ## Plot options
  4164. self.plot_options_label = QtWidgets.QLabel("<b>%s:</b>" % _("Plot Options"))
  4165. self.layout.addWidget(self.plot_options_label)
  4166. # Plot CB
  4167. self.plot_cb = FCCheckBox(label=_('Plot'))
  4168. self.plot_cb.setToolTip(
  4169. _("Plot (show) this object.")
  4170. )
  4171. self.layout.addWidget(self.plot_cb)
  4172. grid0 = QtWidgets.QGridLayout()
  4173. self.layout.addLayout(grid0)
  4174. grid0.setColumnStretch(0, 0)
  4175. grid0.setColumnStretch(1, 1)
  4176. # Number of circle steps for circular aperture linear approximation
  4177. self.circle_steps_label = QtWidgets.QLabel('%s:' % _("Circle Steps"))
  4178. self.circle_steps_label.setToolTip(
  4179. _("The number of circle steps for <b>Geometry</b> \n"
  4180. "circle and arc shapes linear approximation.")
  4181. )
  4182. self.circle_steps_entry = FCSpinner()
  4183. self.circle_steps_entry.set_range(0, 999)
  4184. grid0.addWidget(self.circle_steps_label, 1, 0)
  4185. grid0.addWidget(self.circle_steps_entry, 1, 1)
  4186. # Tools
  4187. self.tools_label = QtWidgets.QLabel("<b>%s:</b>" % _("Tools"))
  4188. grid0.addWidget(self.tools_label, 2, 0, 1, 2)
  4189. # Tooldia
  4190. tdlabel = QtWidgets.QLabel('<b><font color="green">%s:</font></b>' % _('Tools Dia'))
  4191. tdlabel.setToolTip(
  4192. _("Diameters of the tools, separated by comma.\n"
  4193. "The value of the diameter has to use the dot decimals separator.\n"
  4194. "Valid values: 0.3, 1.0")
  4195. )
  4196. self.cnctooldia_entry = FCEntry()
  4197. grid0.addWidget(tdlabel, 3, 0)
  4198. grid0.addWidget(self.cnctooldia_entry, 3, 1)
  4199. separator_line = QtWidgets.QFrame()
  4200. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  4201. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  4202. grid0.addWidget(separator_line, 9, 0, 1, 2)
  4203. # Geometry Object Color
  4204. self.gerber_color_label = QtWidgets.QLabel('<b>%s</b>' % _('Geometry Object Color'))
  4205. grid0.addWidget(self.gerber_color_label, 10, 0, 1, 2)
  4206. # Plot Line Color
  4207. self.line_color_label = QtWidgets.QLabel('%s:' % _('Outline'))
  4208. self.line_color_label.setToolTip(
  4209. _("Set the line color for plotted objects.")
  4210. )
  4211. self.line_color_entry = FCEntry()
  4212. self.line_color_button = QtWidgets.QPushButton()
  4213. self.line_color_button.setFixedSize(15, 15)
  4214. self.form_box_child_2 = QtWidgets.QHBoxLayout()
  4215. self.form_box_child_2.addWidget(self.line_color_entry)
  4216. self.form_box_child_2.addWidget(self.line_color_button)
  4217. self.form_box_child_2.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  4218. grid0.addWidget(self.line_color_label, 11, 0)
  4219. grid0.addLayout(self.form_box_child_2, 11, 1)
  4220. self.layout.addStretch()
  4221. # Setting plot colors signals
  4222. self.line_color_entry.editingFinished.connect(self.on_line_color_entry)
  4223. self.line_color_button.clicked.connect(self.on_line_color_button)
  4224. def on_line_color_entry(self):
  4225. self.app.defaults['geometry_plot_line'] = self.line_color_entry.get_value()[:7] + 'FF'
  4226. self.line_color_button.setStyleSheet("background-color:%s" % str(self.app.defaults['geometry_plot_line'])[:7])
  4227. def on_line_color_button(self):
  4228. current_color = QtGui.QColor(self.app.defaults['geometry_plot_line'][:7])
  4229. # print(current_color)
  4230. c_dialog = QtWidgets.QColorDialog()
  4231. plot_line_color = c_dialog.getColor(initial=current_color)
  4232. if plot_line_color.isValid() is False:
  4233. return
  4234. self.line_color_button.setStyleSheet("background-color:%s" % str(plot_line_color.name()))
  4235. new_val_line = str(plot_line_color.name()) + str(self.app.defaults['geometry_plot_line'][7:9])
  4236. self.line_color_entry.set_value(new_val_line)
  4237. class GeometryOptPrefGroupUI(OptionsGroupUI):
  4238. def __init__(self, decimals=4, parent=None):
  4239. # OptionsGroupUI.__init__(self, "Geometry Options Preferences", parent=parent)
  4240. super(GeometryOptPrefGroupUI, self).__init__(self)
  4241. self.setTitle(str(_("Geometry Options")))
  4242. self.decimals = decimals
  4243. # ------------------------------
  4244. # ## Create CNC Job
  4245. # ------------------------------
  4246. self.cncjob_label = QtWidgets.QLabel('<b>%s:</b>' % _('Create CNC Job'))
  4247. self.cncjob_label.setToolTip(
  4248. _("Create a CNC Job object\n"
  4249. "tracing the contours of this\n"
  4250. "Geometry object.")
  4251. )
  4252. self.layout.addWidget(self.cncjob_label)
  4253. grid1 = QtWidgets.QGridLayout()
  4254. self.layout.addLayout(grid1)
  4255. grid1.setColumnStretch(0, 0)
  4256. grid1.setColumnStretch(1, 1)
  4257. # Cut Z
  4258. cutzlabel = QtWidgets.QLabel('%s:' % _('Cut Z'))
  4259. cutzlabel.setToolTip(
  4260. _("Cutting depth (negative)\n"
  4261. "below the copper surface.")
  4262. )
  4263. self.cutz_entry = FCDoubleSpinner()
  4264. if machinist_setting == 0:
  4265. self.cutz_entry.set_range(-9999.9999, 0.0000)
  4266. else:
  4267. self.cutz_entry.set_range(-9999.9999, 9999.9999)
  4268. self.cutz_entry.set_precision(self.decimals)
  4269. self.cutz_entry.setSingleStep(0.1)
  4270. self.cutz_entry.setWrapping(True)
  4271. grid1.addWidget(cutzlabel, 0, 0)
  4272. grid1.addWidget(self.cutz_entry, 0, 1)
  4273. # Multidepth CheckBox
  4274. self.multidepth_cb = FCCheckBox(label=_('Multi-Depth'))
  4275. self.multidepth_cb.setToolTip(
  4276. _(
  4277. "Use multiple passes to limit\n"
  4278. "the cut depth in each pass. Will\n"
  4279. "cut multiple times until Cut Z is\n"
  4280. "reached."
  4281. )
  4282. )
  4283. grid1.addWidget(self.multidepth_cb, 1, 0)
  4284. # Depth/pass
  4285. dplabel = QtWidgets.QLabel('%s:' % _('Depth/Pass'))
  4286. dplabel.setToolTip(
  4287. _("The depth to cut on each pass,\n"
  4288. "when multidepth is enabled.\n"
  4289. "It has positive value although\n"
  4290. "it is a fraction from the depth\n"
  4291. "which has negative value.")
  4292. )
  4293. self.depthperpass_entry = FCDoubleSpinner()
  4294. self.depthperpass_entry.set_range(0, 99999)
  4295. self.depthperpass_entry.set_precision(self.decimals)
  4296. self.depthperpass_entry.setSingleStep(0.1)
  4297. self.depthperpass_entry.setWrapping(True)
  4298. grid1.addWidget(dplabel, 2, 0)
  4299. grid1.addWidget(self.depthperpass_entry, 2, 1)
  4300. self.ois_multidepth = OptionalInputSection(self.multidepth_cb, [self.depthperpass_entry])
  4301. # Travel Z
  4302. travelzlabel = QtWidgets.QLabel('%s:' % _('Travel Z'))
  4303. travelzlabel.setToolTip(
  4304. _("Height of the tool when\n"
  4305. "moving without cutting.")
  4306. )
  4307. self.travelz_entry = FCDoubleSpinner()
  4308. if machinist_setting == 0:
  4309. self.travelz_entry.set_range(0.0001, 9999.9999)
  4310. else:
  4311. self.travelz_entry.set_range(-9999.9999, 9999.9999)
  4312. self.travelz_entry.set_precision(self.decimals)
  4313. self.travelz_entry.setSingleStep(0.1)
  4314. self.travelz_entry.setWrapping(True)
  4315. grid1.addWidget(travelzlabel, 3, 0)
  4316. grid1.addWidget(self.travelz_entry, 3, 1)
  4317. # Tool change:
  4318. self.toolchange_cb = FCCheckBox('%s' % _("Tool change"))
  4319. self.toolchange_cb.setToolTip(
  4320. _(
  4321. "Include tool-change sequence\n"
  4322. "in the Machine Code (Pause for tool change)."
  4323. )
  4324. )
  4325. grid1.addWidget(self.toolchange_cb, 4, 0, 1, 2)
  4326. # Toolchange Z
  4327. toolchangezlabel = QtWidgets.QLabel('%s:' % _('Toolchange Z'))
  4328. toolchangezlabel.setToolTip(
  4329. _(
  4330. "Z-axis position (height) for\n"
  4331. "tool change."
  4332. )
  4333. )
  4334. self.toolchangez_entry = FCDoubleSpinner()
  4335. if machinist_setting == 0:
  4336. self.toolchangez_entry.set_range(0.000, 9999.9999)
  4337. else:
  4338. self.toolchangez_entry.set_range(-9999.9999, 9999.9999)
  4339. self.toolchangez_entry.set_precision(self.decimals)
  4340. self.toolchangez_entry.setSingleStep(0.1)
  4341. self.toolchangez_entry.setWrapping(True)
  4342. grid1.addWidget(toolchangezlabel, 5, 0)
  4343. grid1.addWidget(self.toolchangez_entry, 5, 1)
  4344. # End move Z
  4345. endz_label = QtWidgets.QLabel('%s:' % _('End move Z'))
  4346. endz_label.setToolTip(
  4347. _("Height of the tool after\n"
  4348. "the last move at the end of the job.")
  4349. )
  4350. self.endz_entry = FCDoubleSpinner()
  4351. if machinist_setting == 0:
  4352. self.endz_entry.set_range(0.000, 9999.9999)
  4353. else:
  4354. self.endz_entry.set_range(-9999.9999, 9999.9999)
  4355. self.endz_entry.set_precision(self.decimals)
  4356. self.endz_entry.setSingleStep(0.1)
  4357. self.endz_entry.setWrapping(True)
  4358. grid1.addWidget(endz_label, 6, 0)
  4359. grid1.addWidget(self.endz_entry, 6, 1)
  4360. # End Move X,Y
  4361. endmove_xy_label = QtWidgets.QLabel('%s:' % _('End move X,Y'))
  4362. endmove_xy_label.setToolTip(
  4363. _("End move X,Y position. In format (x,y).\n"
  4364. "If no value is entered then there is no move\n"
  4365. "on X,Y plane at the end of the job.")
  4366. )
  4367. self.endxy_entry = FCEntry()
  4368. grid1.addWidget(endmove_xy_label, 7, 0)
  4369. grid1.addWidget(self.endxy_entry, 7, 1)
  4370. # Feedrate X-Y
  4371. frlabel = QtWidgets.QLabel('%s:' % _('Feedrate X-Y'))
  4372. frlabel.setToolTip(
  4373. _("Cutting speed in the XY\n"
  4374. "plane in units per minute")
  4375. )
  4376. self.cncfeedrate_entry = FCDoubleSpinner()
  4377. self.cncfeedrate_entry.set_range(0, 99999.9999)
  4378. self.cncfeedrate_entry.set_precision(self.decimals)
  4379. self.cncfeedrate_entry.setSingleStep(0.1)
  4380. self.cncfeedrate_entry.setWrapping(True)
  4381. grid1.addWidget(frlabel, 8, 0)
  4382. grid1.addWidget(self.cncfeedrate_entry, 8, 1)
  4383. # Feedrate Z (Plunge)
  4384. frz_label = QtWidgets.QLabel('%s:' % _('Feedrate Z'))
  4385. frz_label.setToolTip(
  4386. _("Cutting speed in the XY\n"
  4387. "plane in units per minute.\n"
  4388. "It is called also Plunge.")
  4389. )
  4390. self.feedrate_z_entry = FCDoubleSpinner()
  4391. self.feedrate_z_entry.set_range(0, 99999.9999)
  4392. self.feedrate_z_entry.set_precision(self.decimals)
  4393. self.feedrate_z_entry.setSingleStep(0.1)
  4394. self.feedrate_z_entry.setWrapping(True)
  4395. grid1.addWidget(frz_label, 9, 0)
  4396. grid1.addWidget(self.feedrate_z_entry, 9, 1)
  4397. # Spindle Speed
  4398. spdlabel = QtWidgets.QLabel('%s:' % _('Spindle speed'))
  4399. spdlabel.setToolTip(
  4400. _(
  4401. "Speed of the spindle in RPM (optional).\n"
  4402. "If LASER preprocessor is used,\n"
  4403. "this value is the power of laser."
  4404. )
  4405. )
  4406. self.cncspindlespeed_entry = FCSpinner()
  4407. self.cncspindlespeed_entry.set_range(0, 1000000)
  4408. self.cncspindlespeed_entry.set_step(100)
  4409. grid1.addWidget(spdlabel, 10, 0)
  4410. grid1.addWidget(self.cncspindlespeed_entry, 10, 1)
  4411. # Dwell
  4412. self.dwell_cb = FCCheckBox(label='%s' % _('Enable Dwell'))
  4413. self.dwell_cb.setToolTip(
  4414. _("Pause to allow the spindle to reach its\n"
  4415. "speed before cutting.")
  4416. )
  4417. dwelltime = QtWidgets.QLabel('%s:' % _('Duration'))
  4418. dwelltime.setToolTip(
  4419. _("Number of time units for spindle to dwell.")
  4420. )
  4421. self.dwelltime_entry = FCDoubleSpinner()
  4422. self.dwelltime_entry.set_range(0, 99999)
  4423. self.dwelltime_entry.set_precision(self.decimals)
  4424. self.dwelltime_entry.setSingleStep(0.1)
  4425. self.dwelltime_entry.setWrapping(True)
  4426. grid1.addWidget(self.dwell_cb, 11, 0)
  4427. grid1.addWidget(dwelltime, 12, 0)
  4428. grid1.addWidget(self.dwelltime_entry, 12, 1)
  4429. self.ois_dwell = OptionalInputSection(self.dwell_cb, [self.dwelltime_entry])
  4430. # preprocessor selection
  4431. pp_label = QtWidgets.QLabel('%s:' % _("Preprocessor"))
  4432. pp_label.setToolTip(
  4433. _("The Preprocessor file that dictates\n"
  4434. "the Machine Code (like GCode, RML, HPGL) output.")
  4435. )
  4436. self.pp_geometry_name_cb = FCComboBox()
  4437. self.pp_geometry_name_cb.setFocusPolicy(Qt.StrongFocus)
  4438. grid1.addWidget(pp_label, 13, 0)
  4439. grid1.addWidget(self.pp_geometry_name_cb, 13, 1)
  4440. self.layout.addStretch()
  4441. class GeometryAdvOptPrefGroupUI(OptionsGroupUI):
  4442. def __init__(self, decimals=4, parent=None):
  4443. # OptionsGroupUI.__init__(self, "Geometry Advanced Options Preferences", parent=parent)
  4444. super(GeometryAdvOptPrefGroupUI, self).__init__(self)
  4445. self.setTitle(str(_("Geometry Adv. Options")))
  4446. self.decimals = decimals
  4447. # ------------------------------
  4448. # ## Advanced Options
  4449. # ------------------------------
  4450. self.geo_label = QtWidgets.QLabel('<b>%s:</b>' % _('Advanced Options'))
  4451. self.geo_label.setToolTip(
  4452. _("A list of Geometry advanced parameters.\n"
  4453. "Those parameters are available only for\n"
  4454. "Advanced App. Level.")
  4455. )
  4456. self.layout.addWidget(self.geo_label)
  4457. grid1 = QtWidgets.QGridLayout()
  4458. self.layout.addLayout(grid1)
  4459. # Toolchange X,Y
  4460. toolchange_xy_label = QtWidgets.QLabel('%s:' % _('Toolchange X-Y'))
  4461. toolchange_xy_label.setToolTip(
  4462. _("Toolchange X,Y position.")
  4463. )
  4464. grid1.addWidget(toolchange_xy_label, 1, 0)
  4465. self.toolchangexy_entry = FCEntry()
  4466. grid1.addWidget(self.toolchangexy_entry, 1, 1)
  4467. # Start move Z
  4468. startzlabel = QtWidgets.QLabel('%s:' % _('Start Z'))
  4469. startzlabel.setToolTip(
  4470. _("Height of the tool just after starting the work.\n"
  4471. "Delete the value if you don't need this feature.")
  4472. )
  4473. grid1.addWidget(startzlabel, 2, 0)
  4474. self.gstartz_entry = FloatEntry()
  4475. grid1.addWidget(self.gstartz_entry, 2, 1)
  4476. # Feedrate rapids
  4477. fr_rapid_label = QtWidgets.QLabel('%s:' % _('Feedrate Rapids'))
  4478. fr_rapid_label.setToolTip(
  4479. _("Cutting speed in the XY plane\n"
  4480. "(in units per minute).\n"
  4481. "This is for the rapid move G00.\n"
  4482. "It is useful only for Marlin,\n"
  4483. "ignore for any other cases.")
  4484. )
  4485. self.feedrate_rapid_entry = FCDoubleSpinner()
  4486. self.feedrate_rapid_entry.set_range(0, 99999.9999)
  4487. self.feedrate_rapid_entry.set_precision(self.decimals)
  4488. self.feedrate_rapid_entry.setSingleStep(0.1)
  4489. self.feedrate_rapid_entry.setWrapping(True)
  4490. grid1.addWidget(fr_rapid_label, 4, 0)
  4491. grid1.addWidget(self.feedrate_rapid_entry, 4, 1)
  4492. # End move extra cut
  4493. self.extracut_cb = FCCheckBox('%s' % _('Re-cut'))
  4494. self.extracut_cb.setToolTip(
  4495. _("In order to remove possible\n"
  4496. "copper leftovers where first cut\n"
  4497. "meet with last cut, we generate an\n"
  4498. "extended cut over the first cut section.")
  4499. )
  4500. self.e_cut_entry = FCDoubleSpinner()
  4501. self.e_cut_entry.set_range(0, 99999)
  4502. self.e_cut_entry.set_precision(self.decimals)
  4503. self.e_cut_entry.setSingleStep(0.1)
  4504. self.e_cut_entry.setWrapping(True)
  4505. self.e_cut_entry.setToolTip(
  4506. _("In order to remove possible\n"
  4507. "copper leftovers where first cut\n"
  4508. "meet with last cut, we generate an\n"
  4509. "extended cut over the first cut section.")
  4510. )
  4511. grid1.addWidget(self.extracut_cb, 5, 0)
  4512. grid1.addWidget(self.e_cut_entry, 5, 1)
  4513. # Probe depth
  4514. self.pdepth_label = QtWidgets.QLabel('%s:' % _("Probe Z depth"))
  4515. self.pdepth_label.setToolTip(
  4516. _("The maximum depth that the probe is allowed\n"
  4517. "to probe. Negative value, in current units.")
  4518. )
  4519. self.pdepth_entry = FCDoubleSpinner()
  4520. self.pdepth_entry.set_range(-99999, 0.0000)
  4521. self.pdepth_entry.set_precision(self.decimals)
  4522. self.pdepth_entry.setSingleStep(0.1)
  4523. self.pdepth_entry.setWrapping(True)
  4524. grid1.addWidget(self.pdepth_label, 6, 0)
  4525. grid1.addWidget(self.pdepth_entry, 6, 1)
  4526. # Probe feedrate
  4527. self.feedrate_probe_label = QtWidgets.QLabel('%s:' % _("Feedrate Probe"))
  4528. self.feedrate_probe_label.setToolTip(
  4529. _("The feedrate used while the probe is probing.")
  4530. )
  4531. self.feedrate_probe_entry = FCDoubleSpinner()
  4532. self.feedrate_probe_entry.set_range(0, 99999.9999)
  4533. self.feedrate_probe_entry.set_precision(self.decimals)
  4534. self.feedrate_probe_entry.setSingleStep(0.1)
  4535. self.feedrate_probe_entry.setWrapping(True)
  4536. grid1.addWidget(self.feedrate_probe_label, 7, 0)
  4537. grid1.addWidget(self.feedrate_probe_entry, 7, 1)
  4538. # Spindle direction
  4539. spindle_dir_label = QtWidgets.QLabel('%s:' % _('Spindle direction'))
  4540. spindle_dir_label.setToolTip(
  4541. _("This sets the direction that the spindle is rotating.\n"
  4542. "It can be either:\n"
  4543. "- CW = clockwise or\n"
  4544. "- CCW = counter clockwise")
  4545. )
  4546. self.spindledir_radio = RadioSet([{'label': _('CW'), 'value': 'CW'},
  4547. {'label': _('CCW'), 'value': 'CCW'}])
  4548. grid1.addWidget(spindle_dir_label, 8, 0)
  4549. grid1.addWidget(self.spindledir_radio, 8, 1)
  4550. # Fast Move from Z Toolchange
  4551. self.fplunge_cb = FCCheckBox('%s' % _('Fast Plunge'))
  4552. self.fplunge_cb.setToolTip(
  4553. _("By checking this, the vertical move from\n"
  4554. "Z_Toolchange to Z_move is done with G0,\n"
  4555. "meaning the fastest speed available.\n"
  4556. "WARNING: the move is done at Toolchange X,Y coords.")
  4557. )
  4558. grid1.addWidget(self.fplunge_cb, 9, 0, 1, 2)
  4559. # Size of trace segment on X axis
  4560. segx_label = QtWidgets.QLabel('%s:' % _("Segment X size"))
  4561. segx_label.setToolTip(
  4562. _("The size of the trace segment on the X axis.\n"
  4563. "Useful for auto-leveling.\n"
  4564. "A value of 0 means no segmentation on the X axis.")
  4565. )
  4566. self.segx_entry = FCDoubleSpinner()
  4567. self.segx_entry.set_range(0, 99999)
  4568. self.segx_entry.set_precision(self.decimals)
  4569. self.segx_entry.setSingleStep(0.1)
  4570. self.segx_entry.setWrapping(True)
  4571. grid1.addWidget(segx_label, 10, 0)
  4572. grid1.addWidget(self.segx_entry, 10, 1)
  4573. # Size of trace segment on Y axis
  4574. segy_label = QtWidgets.QLabel('%s:' % _("Segment Y size"))
  4575. segy_label.setToolTip(
  4576. _("The size of the trace segment on the Y axis.\n"
  4577. "Useful for auto-leveling.\n"
  4578. "A value of 0 means no segmentation on the Y axis.")
  4579. )
  4580. self.segy_entry = FCDoubleSpinner()
  4581. self.segy_entry.set_range(0, 99999)
  4582. self.segy_entry.set_precision(self.decimals)
  4583. self.segy_entry.setSingleStep(0.1)
  4584. self.segy_entry.setWrapping(True)
  4585. grid1.addWidget(segy_label, 11, 0)
  4586. grid1.addWidget(self.segy_entry, 11, 1)
  4587. self.layout.addStretch()
  4588. class GeometryEditorPrefGroupUI(OptionsGroupUI):
  4589. def __init__(self, decimals=4, parent=None):
  4590. # OptionsGroupUI.__init__(self, "Gerber Adv. Options Preferences", parent=parent)
  4591. super(GeometryEditorPrefGroupUI, self).__init__(self)
  4592. self.setTitle(str(_("Geometry Editor")))
  4593. self.decimals = decimals
  4594. # Advanced Geometry Parameters
  4595. self.param_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  4596. self.param_label.setToolTip(
  4597. _("A list of Geometry Editor parameters.")
  4598. )
  4599. self.layout.addWidget(self.param_label)
  4600. grid0 = QtWidgets.QGridLayout()
  4601. self.layout.addLayout(grid0)
  4602. # Selection Limit
  4603. self.sel_limit_label = QtWidgets.QLabel('%s:' % _("Selection limit"))
  4604. self.sel_limit_label.setToolTip(
  4605. _("Set the number of selected geometry\n"
  4606. "items above which the utility geometry\n"
  4607. "becomes just a selection rectangle.\n"
  4608. "Increases the performance when moving a\n"
  4609. "large number of geometric elements.")
  4610. )
  4611. self.sel_limit_entry = FCSpinner()
  4612. self.sel_limit_entry.set_range(0, 9999)
  4613. grid0.addWidget(self.sel_limit_label, 0, 0)
  4614. grid0.addWidget(self.sel_limit_entry, 0, 1)
  4615. # Milling Type
  4616. milling_type_label = QtWidgets.QLabel('%s:' % _('Milling Type'))
  4617. milling_type_label.setToolTip(
  4618. _("Milling type:\n"
  4619. "- climb / best for precision milling and to reduce tool usage\n"
  4620. "- conventional / useful when there is no backlash compensation")
  4621. )
  4622. self.milling_type_radio = RadioSet([{'label': _('Climb'), 'value': 'cl'},
  4623. {'label': _('Conventional'), 'value': 'cv'}])
  4624. grid0.addWidget(milling_type_label, 1, 0)
  4625. grid0.addWidget(self.milling_type_radio, 1, 1)
  4626. self.layout.addStretch()
  4627. class CNCJobGenPrefGroupUI(OptionsGroupUI):
  4628. def __init__(self, decimals=4, parent=None):
  4629. # OptionsGroupUI.__init__(self, "CNC Job General Preferences", parent=None)
  4630. super(CNCJobGenPrefGroupUI, self).__init__(self)
  4631. self.setTitle(str(_("CNC Job General")))
  4632. self.decimals = decimals
  4633. # ## Plot options
  4634. self.plot_options_label = QtWidgets.QLabel("<b>%s:</b>" % _("Plot Options"))
  4635. self.layout.addWidget(self.plot_options_label)
  4636. grid0 = QtWidgets.QGridLayout()
  4637. self.layout.addLayout(grid0)
  4638. grid0.setColumnStretch(0, 0)
  4639. grid0.setColumnStretch(1, 1)
  4640. # Plot CB
  4641. # self.plot_cb = QtWidgets.QCheckBox('Plot')
  4642. self.plot_cb = FCCheckBox(_('Plot Object'))
  4643. self.plot_cb.setToolTip(_("Plot (show) this object."))
  4644. grid0.addWidget(self.plot_cb, 0, 0, 1, 2)
  4645. # Plot Kind
  4646. self.cncplot_method_label = QtWidgets.QLabel('%s:' % _("Plot kind"))
  4647. self.cncplot_method_label.setToolTip(
  4648. _("This selects the kind of geometries on the canvas to plot.\n"
  4649. "Those can be either of type 'Travel' which means the moves\n"
  4650. "above the work piece or it can be of type 'Cut',\n"
  4651. "which means the moves that cut into the material.")
  4652. )
  4653. self.cncplot_method_radio = RadioSet([
  4654. {"label": _("All"), "value": "all"},
  4655. {"label": _("Travel"), "value": "travel"},
  4656. {"label": _("Cut"), "value": "cut"}
  4657. ], orientation='vertical')
  4658. grid0.addWidget(self.cncplot_method_label, 1, 0)
  4659. grid0.addWidget(self.cncplot_method_radio, 1, 1)
  4660. grid0.addWidget(QtWidgets.QLabel(''), 1, 2)
  4661. # Display Annotation
  4662. self.annotation_cb = FCCheckBox(_("Display Annotation"))
  4663. self.annotation_cb.setToolTip(
  4664. _("This selects if to display text annotation on the plot.\n"
  4665. "When checked it will display numbers in order for each end\n"
  4666. "of a travel line."
  4667. )
  4668. )
  4669. grid0.addWidget(self.annotation_cb, 2, 0, 1, 3)
  4670. # ###################################################################
  4671. # Number of circle steps for circular aperture linear approximation #
  4672. # ###################################################################
  4673. self.steps_per_circle_label = QtWidgets.QLabel('%s:' % _("Circle Steps"))
  4674. self.steps_per_circle_label.setToolTip(
  4675. _("The number of circle steps for <b>GCode</b> \n"
  4676. "circle and arc shapes linear approximation.")
  4677. )
  4678. grid0.addWidget(self.steps_per_circle_label, 3, 0)
  4679. self.steps_per_circle_entry = FCSpinner()
  4680. self.steps_per_circle_entry.set_range(0, 99999)
  4681. grid0.addWidget(self.steps_per_circle_entry, 3, 1)
  4682. # Tool dia for plot
  4683. tdlabel = QtWidgets.QLabel('%s:' % _('Travel dia'))
  4684. tdlabel.setToolTip(
  4685. _("The width of the travel lines to be\n"
  4686. "rendered in the plot.")
  4687. )
  4688. self.tooldia_entry = FCDoubleSpinner()
  4689. self.tooldia_entry.set_range(0, 99999)
  4690. self.tooldia_entry.set_precision(self.decimals)
  4691. self.tooldia_entry.setSingleStep(0.1)
  4692. self.tooldia_entry.setWrapping(True)
  4693. grid0.addWidget(tdlabel, 4, 0)
  4694. grid0.addWidget(self.tooldia_entry, 4, 1)
  4695. # add a space
  4696. grid0.addWidget(QtWidgets.QLabel('<b>%s:</b>' % _("G-code Decimals")), 5, 0, 1, 2)
  4697. # Number of decimals to use in GCODE coordinates
  4698. cdeclabel = QtWidgets.QLabel('%s:' % _('Coordinates'))
  4699. cdeclabel.setToolTip(
  4700. _("The number of decimals to be used for \n"
  4701. "the X, Y, Z coordinates in CNC code (GCODE, etc.)")
  4702. )
  4703. self.coords_dec_entry = FCSpinner()
  4704. self.coords_dec_entry.set_range(0, 9)
  4705. self.coords_dec_entry.setWrapping(True)
  4706. grid0.addWidget(cdeclabel, 6, 0)
  4707. grid0.addWidget(self.coords_dec_entry, 6, 1)
  4708. # Number of decimals to use in GCODE feedrate
  4709. frdeclabel = QtWidgets.QLabel('%s:' % _('Feedrate'))
  4710. frdeclabel.setToolTip(
  4711. _("The number of decimals to be used for \n"
  4712. "the Feedrate parameter in CNC code (GCODE, etc.)")
  4713. )
  4714. self.fr_dec_entry = FCSpinner()
  4715. self.fr_dec_entry.set_range(0, 9)
  4716. self.fr_dec_entry.setWrapping(True)
  4717. grid0.addWidget(frdeclabel, 7, 0)
  4718. grid0.addWidget(self.fr_dec_entry, 7, 1)
  4719. # The type of coordinates used in the Gcode: Absolute or Incremental
  4720. coords_type_label = QtWidgets.QLabel('%s:' % _('Coordinates type'))
  4721. coords_type_label.setToolTip(
  4722. _("The type of coordinates to be used in Gcode.\n"
  4723. "Can be:\n"
  4724. "- Absolute G90 -> the reference is the origin x=0, y=0\n"
  4725. "- Incremental G91 -> the reference is the previous position")
  4726. )
  4727. self.coords_type_radio = RadioSet([
  4728. {"label": _("Absolute G90"), "value": "G90"},
  4729. {"label": _("Incremental G91"), "value": "G91"}
  4730. ], orientation='vertical', stretch=False)
  4731. grid0.addWidget(coords_type_label, 8, 0)
  4732. grid0.addWidget(self.coords_type_radio, 8, 1)
  4733. # hidden for the time being, until implemented
  4734. coords_type_label.hide()
  4735. self.coords_type_radio.hide()
  4736. # Line Endings
  4737. self.line_ending_cb = FCCheckBox(_("Force Windows style line-ending"))
  4738. self.line_ending_cb.setToolTip(
  4739. _("When checked will force a Windows style line-ending\n"
  4740. "(\\r\\n) on non-Windows OS's.")
  4741. )
  4742. grid0.addWidget(self.line_ending_cb, 9, 0, 1, 3)
  4743. separator_line = QtWidgets.QFrame()
  4744. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  4745. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  4746. grid0.addWidget(separator_line, 12, 0, 1, 2)
  4747. # Travel Line Color
  4748. self.travel_color_label = QtWidgets.QLabel('<b>%s</b>' % _('Travel Line Color'))
  4749. grid0.addWidget(self.travel_color_label, 13, 0, 1, 2)
  4750. # Plot Line Color
  4751. self.tline_color_label = QtWidgets.QLabel('%s:' % _('Outline'))
  4752. self.tline_color_label.setToolTip(
  4753. _("Set the travel line color for plotted objects.")
  4754. )
  4755. self.tline_color_entry = FCEntry()
  4756. self.tline_color_button = QtWidgets.QPushButton()
  4757. self.tline_color_button.setFixedSize(15, 15)
  4758. self.form_box_child_2 = QtWidgets.QHBoxLayout()
  4759. self.form_box_child_2.addWidget(self.tline_color_entry)
  4760. self.form_box_child_2.addWidget(self.tline_color_button)
  4761. self.form_box_child_2.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  4762. grid0.addWidget(self.tline_color_label, 14, 0)
  4763. grid0.addLayout(self.form_box_child_2, 14, 1)
  4764. # Plot Fill Color
  4765. self.tfill_color_label = QtWidgets.QLabel('%s:' % _('Fill'))
  4766. self.tfill_color_label.setToolTip(
  4767. _("Set the fill color for plotted objects.\n"
  4768. "First 6 digits are the color and the last 2\n"
  4769. "digits are for alpha (transparency) level.")
  4770. )
  4771. self.tfill_color_entry = FCEntry()
  4772. self.tfill_color_button = QtWidgets.QPushButton()
  4773. self.tfill_color_button.setFixedSize(15, 15)
  4774. self.form_box_child_1 = QtWidgets.QHBoxLayout()
  4775. self.form_box_child_1.addWidget(self.tfill_color_entry)
  4776. self.form_box_child_1.addWidget(self.tfill_color_button)
  4777. self.form_box_child_1.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  4778. grid0.addWidget(self.tfill_color_label, 15, 0)
  4779. grid0.addLayout(self.form_box_child_1, 15, 1)
  4780. # Plot Fill Transparency Level
  4781. self.alpha_label = QtWidgets.QLabel('%s:' % _('Alpha'))
  4782. self.alpha_label.setToolTip(
  4783. _("Set the fill transparency for plotted objects.")
  4784. )
  4785. self.tcolor_alpha_slider = QtWidgets.QSlider(QtCore.Qt.Horizontal)
  4786. self.tcolor_alpha_slider.setMinimum(0)
  4787. self.tcolor_alpha_slider.setMaximum(255)
  4788. self.tcolor_alpha_slider.setSingleStep(1)
  4789. self.tcolor_alpha_spinner = FCSpinner()
  4790. self.tcolor_alpha_spinner.setMinimumWidth(70)
  4791. self.tcolor_alpha_spinner.set_range(0, 255)
  4792. self.form_box_child_3 = QtWidgets.QHBoxLayout()
  4793. self.form_box_child_3.addWidget(self.tcolor_alpha_slider)
  4794. self.form_box_child_3.addWidget(self.tcolor_alpha_spinner)
  4795. grid0.addWidget(self.alpha_label, 16, 0)
  4796. grid0.addLayout(self.form_box_child_3, 16, 1)
  4797. separator_line = QtWidgets.QFrame()
  4798. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  4799. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  4800. grid0.addWidget(separator_line, 17, 0, 1, 2)
  4801. # CNCJob Object Color
  4802. self.cnc_color_label = QtWidgets.QLabel('<b>%s</b>' % _('CNCJob Object Color'))
  4803. grid0.addWidget(self.cnc_color_label, 18, 0, 1, 2)
  4804. # Plot Line Color
  4805. self.line_color_label = QtWidgets.QLabel('%s:' % _('Outline'))
  4806. self.line_color_label.setToolTip(
  4807. _("Set the color for plotted objects.")
  4808. )
  4809. self.line_color_entry = FCEntry()
  4810. self.line_color_button = QtWidgets.QPushButton()
  4811. self.line_color_button.setFixedSize(15, 15)
  4812. self.form_box_child_2 = QtWidgets.QHBoxLayout()
  4813. self.form_box_child_2.addWidget(self.line_color_entry)
  4814. self.form_box_child_2.addWidget(self.line_color_button)
  4815. self.form_box_child_2.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  4816. grid0.addWidget(self.line_color_label, 19, 0)
  4817. grid0.addLayout(self.form_box_child_2, 19, 1)
  4818. # Plot Fill Color
  4819. self.fill_color_label = QtWidgets.QLabel('%s:' % _('Fill'))
  4820. self.fill_color_label.setToolTip(
  4821. _("Set the fill color for plotted objects.\n"
  4822. "First 6 digits are the color and the last 2\n"
  4823. "digits are for alpha (transparency) level.")
  4824. )
  4825. self.fill_color_entry = FCEntry()
  4826. self.fill_color_button = QtWidgets.QPushButton()
  4827. self.fill_color_button.setFixedSize(15, 15)
  4828. self.form_box_child_1 = QtWidgets.QHBoxLayout()
  4829. self.form_box_child_1.addWidget(self.fill_color_entry)
  4830. self.form_box_child_1.addWidget(self.fill_color_button)
  4831. self.form_box_child_1.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  4832. grid0.addWidget(self.fill_color_label, 20, 0)
  4833. grid0.addLayout(self.form_box_child_1, 20, 1)
  4834. self.layout.addStretch()
  4835. # Setting plot colors signals
  4836. self.tline_color_entry.editingFinished.connect(self.on_tline_color_entry)
  4837. self.tline_color_button.clicked.connect(self.on_tline_color_button)
  4838. self.tfill_color_entry.editingFinished.connect(self.on_tfill_color_entry)
  4839. self.tfill_color_button.clicked.connect(self.on_tfill_color_button)
  4840. self.tcolor_alpha_spinner.valueChanged.connect(self.on_tcolor_spinner)
  4841. self.tcolor_alpha_slider.valueChanged.connect(self.on_tcolor_slider)
  4842. self.line_color_entry.editingFinished.connect(self.on_line_color_entry)
  4843. self.line_color_button.clicked.connect(self.on_line_color_button)
  4844. self.fill_color_entry.editingFinished.connect(self.on_fill_color_entry)
  4845. self.fill_color_button.clicked.connect(self.on_fill_color_button)
  4846. # ------------------------------------------------------
  4847. # Setting travel colors handlers
  4848. # ------------------------------------------------------
  4849. def on_tfill_color_entry(self):
  4850. self.app.defaults['cncjob_travel_fill'] = self.tfill_color_entry.get_value()[:7] + \
  4851. self.app.defaults['cncjob_travel_fill'][7:9]
  4852. self.tfill_color_button.setStyleSheet(
  4853. "background-color:%s" % str(self.app.defaults['cncjob_travel_fill'])[:7])
  4854. def on_tfill_color_button(self):
  4855. current_color = QtGui.QColor(self.app.defaults['cncjob_travel_fill'][:7])
  4856. c_dialog = QtWidgets.QColorDialog()
  4857. plot_fill_color = c_dialog.getColor(initial=current_color)
  4858. if plot_fill_color.isValid() is False:
  4859. return
  4860. self.tfill_color_button.setStyleSheet("background-color:%s" % str(plot_fill_color.name()))
  4861. new_val = str(plot_fill_color.name()) + str(self.app.defaults['cncjob_travel_fill'][7:9])
  4862. self.tfill_color_entry.set_value(new_val)
  4863. self.app.defaults['cncjob_travel_fill'] = new_val
  4864. def on_tcolor_spinner(self):
  4865. spinner_value = self.tcolor_alpha_spinner.value()
  4866. self.tcolor_alpha_slider.setValue(spinner_value)
  4867. self.app.defaults['cncjob_travel_fill'] = \
  4868. self.app.defaults['cncjob_travel_fill'][:7] + \
  4869. (hex(spinner_value)[2:] if int(hex(spinner_value)[2:], 16) > 0 else '00')
  4870. self.app.defaults['cncjob_travel_line'] = \
  4871. self.app.defaults['cncjob_travel_line'][:7] + \
  4872. (hex(spinner_value)[2:] if int(hex(spinner_value)[2:], 16) > 0 else '00')
  4873. def on_tcolor_slider(self):
  4874. slider_value = self.tcolor_alpha_slider.value()
  4875. self.tcolor_alpha_spinner.setValue(slider_value)
  4876. def on_tline_color_entry(self):
  4877. self.app.defaults['cncjob_travel_line'] = self.tline_color_entry.get_value()[:7] + \
  4878. self.app.defaults['cncjob_travel_line'][7:9]
  4879. self.tline_color_button.setStyleSheet(
  4880. "background-color:%s" % str(self.app.defaults['cncjob_travel_line'])[:7])
  4881. def on_tline_color_button(self):
  4882. current_color = QtGui.QColor(self.app.defaults['cncjob_travel_line'][:7])
  4883. # print(current_color)
  4884. c_dialog = QtWidgets.QColorDialog()
  4885. plot_line_color = c_dialog.getColor(initial=current_color)
  4886. if plot_line_color.isValid() is False:
  4887. return
  4888. self.tline_color_button.setStyleSheet("background-color:%s" % str(plot_line_color.name()))
  4889. new_val_line = str(plot_line_color.name()) + str(self.app.defaults['cncjob_travel_line'][7:9])
  4890. self.tline_color_entry.set_value(new_val_line)
  4891. self.app.defaults['cncjob_travel_line'] = new_val_line
  4892. # ------------------------------------------------------
  4893. # Setting plot colors handlers
  4894. # ------------------------------------------------------
  4895. def on_fill_color_entry(self):
  4896. self.app.defaults['cncjob_plot_fill'] = self.fill_color_entry.get_value()[:7] + \
  4897. self.app.defaults['cncjob_plot_fill'][7:9]
  4898. self.fill_color_button.setStyleSheet(
  4899. "background-color:%s" % str(self.app.defaults['cncjob_plot_fill'])[:7])
  4900. def on_fill_color_button(self):
  4901. current_color = QtGui.QColor(self.app.defaults['cncjob_plot_fill'][:7])
  4902. c_dialog = QtWidgets.QColorDialog()
  4903. plot_fill_color = c_dialog.getColor(initial=current_color)
  4904. if plot_fill_color.isValid() is False:
  4905. return
  4906. self.fill_color_button.setStyleSheet("background-color:%s" % str(plot_fill_color.name()))
  4907. new_val = str(plot_fill_color.name()) + str(self.app.defaults['cncjob_plot_fill'][7:9])
  4908. self.fill_color_entry.set_value(new_val)
  4909. self.app.defaults['cncjob_plot_fill'] = new_val
  4910. def on_line_color_entry(self):
  4911. self.app.defaults['cncjob_plot_line'] = self.line_color_entry.get_value()[:7] + \
  4912. self.app.defaults['cncjob_plot_line'][7:9]
  4913. self.line_color_button.setStyleSheet(
  4914. "background-color:%s" % str(self.app.defaults['cncjob_plot_line'])[:7])
  4915. def on_line_color_button(self):
  4916. current_color = QtGui.QColor(self.app.defaults['cncjob_plot_line'][:7])
  4917. # print(current_color)
  4918. c_dialog = QtWidgets.QColorDialog()
  4919. plot_line_color = c_dialog.getColor(initial=current_color)
  4920. if plot_line_color.isValid() is False:
  4921. return
  4922. self.line_color_button.setStyleSheet("background-color:%s" % str(plot_line_color.name()))
  4923. new_val_line = str(plot_line_color.name()) + str(self.app.defaults['cncjob_plot_line'][7:9])
  4924. self.line_color_entry.set_value(new_val_line)
  4925. self.app.defaults['cncjob_plot_line'] = new_val_line
  4926. class CNCJobOptPrefGroupUI(OptionsGroupUI):
  4927. def __init__(self, decimals=4, parent=None):
  4928. # OptionsGroupUI.__init__(self, "CNC Job Options Preferences", parent=None)
  4929. super(CNCJobOptPrefGroupUI, self).__init__(self)
  4930. self.setTitle(str(_("CNC Job Options")))
  4931. self.decimals = decimals
  4932. # ## Export G-Code
  4933. self.export_gcode_label = QtWidgets.QLabel("<b>%s:</b>" % _("Export G-Code"))
  4934. self.export_gcode_label.setToolTip(
  4935. _("Export and save G-Code to\n"
  4936. "make this object to a file.")
  4937. )
  4938. self.layout.addWidget(self.export_gcode_label)
  4939. settings = QSettings("Open Source", "FlatCAM")
  4940. if settings.contains("textbox_font_size"):
  4941. tb_fsize = settings.value('textbox_font_size', type=int)
  4942. else:
  4943. tb_fsize = 10
  4944. font = QtGui.QFont()
  4945. font.setPointSize(tb_fsize)
  4946. # Prepend to G-Code
  4947. prependlabel = QtWidgets.QLabel('%s:' % _('Prepend to G-Code'))
  4948. prependlabel.setToolTip(
  4949. _("Type here any G-Code commands you would\n"
  4950. "like to add at the beginning of the G-Code file.")
  4951. )
  4952. self.layout.addWidget(prependlabel)
  4953. self.prepend_text = FCTextArea()
  4954. self.prepend_text.setPlaceholderText(
  4955. _("Type here any G-Code commands you would "
  4956. "like to add at the beginning of the G-Code file.")
  4957. )
  4958. self.layout.addWidget(self.prepend_text)
  4959. self.prepend_text.setFont(font)
  4960. # Append text to G-Code
  4961. appendlabel = QtWidgets.QLabel('%s:' % _('Append to G-Code'))
  4962. appendlabel.setToolTip(
  4963. _("Type here any G-Code commands you would\n"
  4964. "like to append to the generated file.\n"
  4965. "I.e.: M2 (End of program)")
  4966. )
  4967. self.layout.addWidget(appendlabel)
  4968. self.append_text = FCTextArea()
  4969. self.append_text.setPlaceholderText(
  4970. _("Type here any G-Code commands you would "
  4971. "like to append to the generated file.\n"
  4972. "I.e.: M2 (End of program)")
  4973. )
  4974. self.layout.addWidget(self.append_text)
  4975. self.append_text.setFont(font)
  4976. self.layout.addStretch()
  4977. class CNCJobAdvOptPrefGroupUI(OptionsGroupUI):
  4978. def __init__(self, decimals=4, parent=None):
  4979. # OptionsGroupUI.__init__(self, "CNC Job Advanced Options Preferences", parent=None)
  4980. super(CNCJobAdvOptPrefGroupUI, self).__init__(self)
  4981. self.decimals = decimals
  4982. self.setTitle(str(_("CNC Job Adv. Options")))
  4983. # ## Export G-Code
  4984. self.export_gcode_label = QtWidgets.QLabel("<b>%s:</b>" % _("Export CNC Code"))
  4985. self.export_gcode_label.setToolTip(
  4986. _("Export and save G-Code to\n"
  4987. "make this object to a file.")
  4988. )
  4989. self.layout.addWidget(self.export_gcode_label)
  4990. # Prepend to G-Code
  4991. toolchangelabel = QtWidgets.QLabel('%s' % _('Toolchange G-Code'))
  4992. toolchangelabel.setToolTip(
  4993. _(
  4994. "Type here any G-Code commands you would\n"
  4995. "like to be executed when Toolchange event is encountered.\n"
  4996. "This will constitute a Custom Toolchange GCode,\n"
  4997. "or a Toolchange Macro.\n"
  4998. "The FlatCAM variables are surrounded by '%' symbol.\n\n"
  4999. "WARNING: it can be used only with a preprocessor file\n"
  5000. "that has 'toolchange_custom' in it's name and this is built\n"
  5001. "having as template the 'Toolchange Custom' posprocessor file."
  5002. )
  5003. )
  5004. self.layout.addWidget(toolchangelabel)
  5005. settings = QSettings("Open Source", "FlatCAM")
  5006. if settings.contains("textbox_font_size"):
  5007. tb_fsize = settings.value('textbox_font_size', type=int)
  5008. else:
  5009. tb_fsize = 10
  5010. font = QtGui.QFont()
  5011. font.setPointSize(tb_fsize)
  5012. self.toolchange_text = FCTextArea()
  5013. self.toolchange_text.setPlaceholderText(
  5014. _(
  5015. "Type here any G-Code commands you would "
  5016. "like to be executed when Toolchange event is encountered.\n"
  5017. "This will constitute a Custom Toolchange GCode, "
  5018. "or a Toolchange Macro.\n"
  5019. "The FlatCAM variables are surrounded by '%' symbol.\n"
  5020. "WARNING: it can be used only with a preprocessor file "
  5021. "that has 'toolchange_custom' in it's name."
  5022. )
  5023. )
  5024. self.layout.addWidget(self.toolchange_text)
  5025. self.toolchange_text.setFont(font)
  5026. hlay = QtWidgets.QHBoxLayout()
  5027. self.layout.addLayout(hlay)
  5028. # Toolchange Replacement GCode
  5029. self.toolchange_cb = FCCheckBox(label='%s' % _('Use Toolchange Macro'))
  5030. self.toolchange_cb.setToolTip(
  5031. _("Check this box if you want to use\n"
  5032. "a Custom Toolchange GCode (macro).")
  5033. )
  5034. hlay.addWidget(self.toolchange_cb)
  5035. hlay.addStretch()
  5036. hlay1 = QtWidgets.QHBoxLayout()
  5037. self.layout.addLayout(hlay1)
  5038. # Variable list
  5039. self.tc_variable_combo = FCComboBox()
  5040. self.tc_variable_combo.setToolTip(
  5041. _("A list of the FlatCAM variables that can be used\n"
  5042. "in the Toolchange event.\n"
  5043. "They have to be surrounded by the '%' symbol")
  5044. )
  5045. hlay1.addWidget(self.tc_variable_combo)
  5046. # Populate the Combo Box
  5047. variables = [_('Parameters'), 'tool', 'tooldia', 't_drills', 'x_toolchange', 'y_toolchange', 'z_toolchange',
  5048. 'z_cut', 'z_move', 'z_depthpercut', 'spindlespeed', 'dwelltime']
  5049. self.tc_variable_combo.addItems(variables)
  5050. self.tc_variable_combo.insertSeparator(1)
  5051. self.tc_variable_combo.setItemData(0, _("FlatCAM CNC parameters"), Qt.ToolTipRole)
  5052. fnt = QtGui.QFont()
  5053. fnt.setBold(True)
  5054. self.tc_variable_combo.setItemData(0, fnt, Qt.FontRole)
  5055. self.tc_variable_combo.setItemData(2, 'tool = %s' % _("tool number"), Qt.ToolTipRole)
  5056. self.tc_variable_combo.setItemData(3, 'tooldia = %s' % _("tool diameter"), Qt.ToolTipRole)
  5057. self.tc_variable_combo.setItemData(4, 't_drills = %s' % _("for Excellon, total number of drills"),
  5058. Qt.ToolTipRole)
  5059. self.tc_variable_combo.setItemData(5, 'x_toolchange = %s' % _("X coord for Toolchange"), Qt.ToolTipRole)
  5060. self.tc_variable_combo.setItemData(6, 'y_toolchange = %s' % _("Y coord for Toolchange"),
  5061. Qt.ToolTipRole)
  5062. self.tc_variable_combo.setItemData(7, 'z_toolchange = %s' % _("Z coord for Toolchange"), Qt.ToolTipRole)
  5063. self.tc_variable_combo.setItemData(8, 'z_cut = %s' % _("Z depth for the cut"), Qt.ToolTipRole)
  5064. self.tc_variable_combo.setItemData(9, 'z_move = %s' % _("Z height for travel"), Qt.ToolTipRole)
  5065. self.tc_variable_combo.setItemData(10, 'z_depthpercut = %s' % _("the step value for multidepth cut"),
  5066. Qt.ToolTipRole)
  5067. self.tc_variable_combo.setItemData(11, 'spindlesspeed = %s' % _("the value for the spindle speed"),
  5068. Qt.ToolTipRole)
  5069. self.tc_variable_combo.setItemData(12,
  5070. _("dwelltime = time to dwell to allow the spindle to reach it's set RPM"),
  5071. Qt.ToolTipRole)
  5072. # hlay1.addStretch()
  5073. # Insert Variable into the Toolchange G-Code Text Box
  5074. # self.tc_insert_buton = FCButton("Insert")
  5075. # self.tc_insert_buton.setToolTip(
  5076. # "Insert the variable in the GCode Box\n"
  5077. # "surrounded by the '%' symbol."
  5078. # )
  5079. # hlay1.addWidget(self.tc_insert_buton)
  5080. grid0 = QtWidgets.QGridLayout()
  5081. self.layout.addLayout(grid0)
  5082. grid0.addWidget(QtWidgets.QLabel(''), 1, 0, 1, 2)
  5083. # Annotation Font Size
  5084. self.annotation_fontsize_label = QtWidgets.QLabel('%s:' % _("Annotation Size"))
  5085. self.annotation_fontsize_label.setToolTip(
  5086. _("The font size of the annotation text. In pixels.")
  5087. )
  5088. grid0.addWidget(self.annotation_fontsize_label, 2, 0)
  5089. self.annotation_fontsize_sp = FCSpinner()
  5090. self.annotation_fontsize_sp.set_range(0, 9999)
  5091. grid0.addWidget(self.annotation_fontsize_sp, 2, 1)
  5092. grid0.addWidget(QtWidgets.QLabel(''), 2, 2)
  5093. # Annotation Font Color
  5094. self.annotation_color_label = QtWidgets.QLabel('%s:' % _('Annotation Color'))
  5095. self.annotation_color_label.setToolTip(
  5096. _("Set the font color for the annotation texts.")
  5097. )
  5098. self.annotation_fontcolor_entry = FCEntry()
  5099. self.annotation_fontcolor_button = QtWidgets.QPushButton()
  5100. self.annotation_fontcolor_button.setFixedSize(15, 15)
  5101. self.form_box_child = QtWidgets.QHBoxLayout()
  5102. self.form_box_child.setContentsMargins(0, 0, 0, 0)
  5103. self.form_box_child.addWidget(self.annotation_fontcolor_entry)
  5104. self.form_box_child.addWidget(self.annotation_fontcolor_button, alignment=Qt.AlignRight)
  5105. self.form_box_child.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  5106. color_widget = QtWidgets.QWidget()
  5107. color_widget.setLayout(self.form_box_child)
  5108. grid0.addWidget(self.annotation_color_label, 3, 0)
  5109. grid0.addWidget(color_widget, 3, 1)
  5110. grid0.addWidget(QtWidgets.QLabel(''), 3, 2)
  5111. self.layout.addStretch()
  5112. self.tc_variable_combo.currentIndexChanged[str].connect(self.on_cnc_custom_parameters)
  5113. self.annotation_fontcolor_entry.editingFinished.connect(self.on_annotation_fontcolor_entry)
  5114. self.annotation_fontcolor_button.clicked.connect(self.on_annotation_fontcolor_button)
  5115. def on_cnc_custom_parameters(self, signal_text):
  5116. if signal_text == 'Parameters':
  5117. return
  5118. else:
  5119. self.toolchange_text.insertPlainText('%%%s%%' % signal_text)
  5120. def on_annotation_fontcolor_entry(self):
  5121. self.app.defaults['cncjob_annotation_fontcolor'] = self.annotation_fontcolor_entry.get_value()
  5122. self.annotation_fontcolor_button.setStyleSheet(
  5123. "background-color:%s" % str(self.app.defaults['cncjob_annotation_fontcolor']))
  5124. def on_annotation_fontcolor_button(self):
  5125. current_color = QtGui.QColor(self.app.defaults['cncjob_annotation_fontcolor'])
  5126. c_dialog = QtWidgets.QColorDialog()
  5127. annotation_color = c_dialog.getColor(initial=current_color)
  5128. if annotation_color.isValid() is False:
  5129. return
  5130. self.annotation_fontcolor_button.setStyleSheet("background-color:%s" % str(annotation_color.name()))
  5131. new_val_sel = str(annotation_color.name())
  5132. self.annotation_fontcolor_entry.set_value(new_val_sel)
  5133. self.app.defaults['cncjob_annotation_fontcolor'] = new_val_sel
  5134. class ToolsNCCPrefGroupUI(OptionsGroupUI):
  5135. def __init__(self, decimals=4, parent=None):
  5136. # OptionsGroupUI.__init__(self, "NCC Tool Options", parent=parent)
  5137. super(ToolsNCCPrefGroupUI, self).__init__(self)
  5138. self.setTitle(str(_("NCC Tool Options")))
  5139. self.decimals = decimals
  5140. # ## Clear non-copper regions
  5141. self.clearcopper_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  5142. self.clearcopper_label.setToolTip(
  5143. _("Create a Geometry object with\n"
  5144. "toolpaths to cut all non-copper regions.")
  5145. )
  5146. self.layout.addWidget(self.clearcopper_label)
  5147. grid0 = QtWidgets.QGridLayout()
  5148. self.layout.addLayout(grid0)
  5149. ncctdlabel = QtWidgets.QLabel('<b><font color="green">%s:</font></b>' % _('Tools Dia'))
  5150. ncctdlabel.setToolTip(
  5151. _("Diameters of the tools, separated by comma.\n"
  5152. "The value of the diameter has to use the dot decimals separator.\n"
  5153. "Valid values: 0.3, 1.0")
  5154. )
  5155. grid0.addWidget(ncctdlabel, 0, 0)
  5156. self.ncc_tool_dia_entry = FCEntry(border_color='#0069A9')
  5157. self.ncc_tool_dia_entry.setPlaceholderText(_("Comma separated values"))
  5158. grid0.addWidget(self.ncc_tool_dia_entry, 0, 1)
  5159. # Tool Type Radio Button
  5160. self.tool_type_label = QtWidgets.QLabel('%s:' % _('Tool Type'))
  5161. self.tool_type_label.setToolTip(
  5162. _("Default tool type:\n"
  5163. "- 'V-shape'\n"
  5164. "- Circular")
  5165. )
  5166. self.tool_type_radio = RadioSet([{'label': _('V-shape'), 'value': 'V'},
  5167. {'label': _('Circular'), 'value': 'C1'}])
  5168. self.tool_type_radio.setToolTip(
  5169. _("Default tool type:\n"
  5170. "- 'V-shape'\n"
  5171. "- Circular")
  5172. )
  5173. grid0.addWidget(self.tool_type_label, 1, 0)
  5174. grid0.addWidget(self.tool_type_radio, 1, 1)
  5175. # Tip Dia
  5176. self.tipdialabel = QtWidgets.QLabel('%s:' % _('V-Tip Dia'))
  5177. self.tipdialabel.setToolTip(
  5178. _("The tip diameter for V-Shape Tool"))
  5179. self.tipdia_entry = FCDoubleSpinner()
  5180. self.tipdia_entry.set_precision(self.decimals)
  5181. self.tipdia_entry.set_range(0, 1000)
  5182. self.tipdia_entry.setSingleStep(0.1)
  5183. grid0.addWidget(self.tipdialabel, 2, 0)
  5184. grid0.addWidget(self.tipdia_entry, 2, 1)
  5185. # Tip Angle
  5186. self.tipanglelabel = QtWidgets.QLabel('%s:' % _('V-Tip Angle'))
  5187. self.tipanglelabel.setToolTip(
  5188. _("The tip angle for V-Shape Tool.\n"
  5189. "In degree."))
  5190. self.tipangle_entry = FCDoubleSpinner()
  5191. self.tipangle_entry.set_precision(self.decimals)
  5192. self.tipangle_entry.set_range(1, 180)
  5193. self.tipangle_entry.setSingleStep(5)
  5194. self.tipangle_entry.setWrapping(True)
  5195. grid0.addWidget(self.tipanglelabel, 3, 0)
  5196. grid0.addWidget(self.tipangle_entry, 3, 1)
  5197. # Cut Z entry
  5198. cutzlabel = QtWidgets.QLabel('%s:' % _('Cut Z'))
  5199. cutzlabel.setToolTip(
  5200. _("Depth of cut into material. Negative value.\n"
  5201. "In FlatCAM units.")
  5202. )
  5203. self.cutz_entry = FCDoubleSpinner()
  5204. self.cutz_entry.set_precision(self.decimals)
  5205. self.cutz_entry.set_range(-9999.9999, 0.0000)
  5206. self.cutz_entry.setSingleStep(0.1)
  5207. self.cutz_entry.setToolTip(
  5208. _("Depth of cut into material. Negative value.\n"
  5209. "In FlatCAM units.")
  5210. )
  5211. grid0.addWidget(cutzlabel, 4, 0)
  5212. grid0.addWidget(self.cutz_entry, 4, 1)
  5213. # New Diameter
  5214. self.newdialabel = QtWidgets.QLabel('%s:' % _('New Dia'))
  5215. self.newdialabel.setToolTip(
  5216. _("Diameter for the new tool to add in the Tool Table.\n"
  5217. "If the tool is V-shape type then this value is automatically\n"
  5218. "calculated from the other parameters.")
  5219. )
  5220. self.newdia_entry = FCDoubleSpinner()
  5221. self.newdia_entry.set_precision(self.decimals)
  5222. self.newdia_entry.set_range(0.0001, 9999.9999)
  5223. self.newdia_entry.setSingleStep(0.1)
  5224. grid0.addWidget(self.newdialabel, 5, 0)
  5225. grid0.addWidget(self.newdia_entry, 5, 1)
  5226. separator_line = QtWidgets.QFrame()
  5227. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  5228. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  5229. grid0.addWidget(separator_line, 6, 0, 1, 2)
  5230. # Milling Type Radio Button
  5231. self.milling_type_label = QtWidgets.QLabel('%s:' % _('Milling Type'))
  5232. self.milling_type_label.setToolTip(
  5233. _("Milling type when the selected tool is of type: 'iso_op':\n"
  5234. "- climb / best for precision milling and to reduce tool usage\n"
  5235. "- conventional / useful when there is no backlash compensation")
  5236. )
  5237. self.milling_type_radio = RadioSet([{'label': _('Climb'), 'value': 'cl'},
  5238. {'label': _('Conventional'), 'value': 'cv'}])
  5239. self.milling_type_radio.setToolTip(
  5240. _("Milling type when the selected tool is of type: 'iso_op':\n"
  5241. "- climb / best for precision milling and to reduce tool usage\n"
  5242. "- conventional / useful when there is no backlash compensation")
  5243. )
  5244. grid0.addWidget(self.milling_type_label, 7, 0)
  5245. grid0.addWidget(self.milling_type_radio, 7, 1)
  5246. # Tool order Radio Button
  5247. self.ncc_order_label = QtWidgets.QLabel('%s:' % _('Tool order'))
  5248. self.ncc_order_label.setToolTip(_("This set the way that the tools in the tools table are used.\n"
  5249. "'No' --> means that the used order is the one in the tool table\n"
  5250. "'Forward' --> means that the tools will be ordered from small to big\n"
  5251. "'Reverse' --> menas that the tools will ordered from big to small\n\n"
  5252. "WARNING: using rest machining will automatically set the order\n"
  5253. "in reverse and disable this control."))
  5254. self.ncc_order_radio = RadioSet([{'label': _('No'), 'value': 'no'},
  5255. {'label': _('Forward'), 'value': 'fwd'},
  5256. {'label': _('Reverse'), 'value': 'rev'}])
  5257. self.ncc_order_radio.setToolTip(_("This set the way that the tools in the tools table are used.\n"
  5258. "'No' --> means that the used order is the one in the tool table\n"
  5259. "'Forward' --> means that the tools will be ordered from small to big\n"
  5260. "'Reverse' --> menas that the tools will ordered from big to small\n\n"
  5261. "WARNING: using rest machining will automatically set the order\n"
  5262. "in reverse and disable this control."))
  5263. grid0.addWidget(self.ncc_order_label, 8, 0)
  5264. grid0.addWidget(self.ncc_order_radio, 8, 1)
  5265. separator_line = QtWidgets.QFrame()
  5266. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  5267. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  5268. grid0.addWidget(separator_line, 9, 0, 1, 2)
  5269. # Overlap Entry
  5270. nccoverlabel = QtWidgets.QLabel('%s:' % _('Overlap'))
  5271. nccoverlabel.setToolTip(
  5272. _("How much (percentage) of the tool width to overlap each tool pass.\n"
  5273. "Adjust the value starting with lower values\n"
  5274. "and increasing it if areas that should be cleared are still \n"
  5275. "not cleared.\n"
  5276. "Lower values = faster processing, faster execution on CNC.\n"
  5277. "Higher values = slow processing and slow execution on CNC\n"
  5278. "due of too many paths.")
  5279. )
  5280. self.ncc_overlap_entry = FCDoubleSpinner(suffix='%')
  5281. self.ncc_overlap_entry.set_precision(self.decimals)
  5282. self.ncc_overlap_entry.setWrapping(True)
  5283. self.ncc_overlap_entry.setRange(0.0000, 99.9999)
  5284. self.ncc_overlap_entry.setSingleStep(0.1)
  5285. grid0.addWidget(nccoverlabel, 10, 0)
  5286. grid0.addWidget(self.ncc_overlap_entry, 10, 1)
  5287. # Margin entry
  5288. nccmarginlabel = QtWidgets.QLabel('%s:' % _('Margin'))
  5289. nccmarginlabel.setToolTip(
  5290. _("Bounding box margin.")
  5291. )
  5292. self.ncc_margin_entry = FCDoubleSpinner()
  5293. self.ncc_margin_entry.set_precision(self.decimals)
  5294. self.ncc_margin_entry.set_range(-10000, 10000)
  5295. self.ncc_margin_entry.setSingleStep(0.1)
  5296. grid0.addWidget(nccmarginlabel, 11, 0)
  5297. grid0.addWidget(self.ncc_margin_entry, 11, 1)
  5298. # Method
  5299. methodlabel = QtWidgets.QLabel('%s:' % _('Method'))
  5300. methodlabel.setToolTip(
  5301. _("Algorithm for copper clearing:\n"
  5302. "- Standard: Fixed step inwards.\n"
  5303. "- Seed-based: Outwards from seed.\n"
  5304. "- Line-based: Parallel lines.")
  5305. )
  5306. # self.ncc_method_radio = RadioSet([
  5307. # {"label": _("Standard"), "value": "standard"},
  5308. # {"label": _("Seed-based"), "value": "seed"},
  5309. # {"label": _("Straight lines"), "value": "lines"}
  5310. # ], orientation='vertical', stretch=False)
  5311. self.ncc_method_combo = FCComboBox()
  5312. self.ncc_method_combo.addItems(
  5313. [_("Standard"), _("Seed"), _("Lines")]
  5314. )
  5315. grid0.addWidget(methodlabel, 12, 0)
  5316. grid0.addWidget(self.ncc_method_combo, 12, 1)
  5317. # Connect lines
  5318. self.ncc_connect_cb = FCCheckBox('%s' % _("Connect"))
  5319. self.ncc_connect_cb.setToolTip(
  5320. _("Draw lines between resulting\n"
  5321. "segments to minimize tool lifts.")
  5322. )
  5323. grid0.addWidget(self.ncc_connect_cb, 13, 0)
  5324. # Contour Checkbox
  5325. self.ncc_contour_cb = FCCheckBox('%s' % _("Contour"))
  5326. self.ncc_contour_cb.setToolTip(
  5327. _("Cut around the perimeter of the polygon\n"
  5328. "to trim rough edges.")
  5329. )
  5330. grid0.addWidget(self.ncc_contour_cb, 13, 1)
  5331. # ## NCC Offset choice
  5332. self.ncc_choice_offset_cb = FCCheckBox('%s' % _("Offset"))
  5333. self.ncc_choice_offset_cb.setToolTip(
  5334. _("If used, it will add an offset to the copper features.\n"
  5335. "The copper clearing will finish to a distance\n"
  5336. "from the copper features.\n"
  5337. "The value can be between 0 and 10 FlatCAM units.")
  5338. )
  5339. grid0.addWidget(self.ncc_choice_offset_cb, 14, 0, 1, 2)
  5340. # ## NCC Offset value
  5341. self.ncc_offset_label = QtWidgets.QLabel('%s:' % _("Offset value"))
  5342. self.ncc_offset_label.setToolTip(
  5343. _("If used, it will add an offset to the copper features.\n"
  5344. "The copper clearing will finish to a distance\n"
  5345. "from the copper features.\n"
  5346. "The value can be between 0.0 and 9999.9 FlatCAM units.")
  5347. )
  5348. self.ncc_offset_spinner = FCDoubleSpinner()
  5349. self.ncc_offset_spinner.set_range(0.00, 9999.9999)
  5350. self.ncc_offset_spinner.set_precision(self.decimals)
  5351. self.ncc_offset_spinner.setWrapping(True)
  5352. self.ncc_offset_spinner.setSingleStep(0.1)
  5353. grid0.addWidget(self.ncc_offset_label, 15, 0)
  5354. grid0.addWidget(self.ncc_offset_spinner, 15, 1)
  5355. separator_line = QtWidgets.QFrame()
  5356. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  5357. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  5358. grid0.addWidget(separator_line, 16, 0, 1, 2)
  5359. # Rest machining CheckBox
  5360. self.ncc_rest_cb = FCCheckBox('%s' % _("Rest Machining"))
  5361. self.ncc_rest_cb.setToolTip(
  5362. _("If checked, use 'rest machining'.\n"
  5363. "Basically it will clear copper outside PCB features,\n"
  5364. "using the biggest tool and continue with the next tools,\n"
  5365. "from bigger to smaller, to clear areas of copper that\n"
  5366. "could not be cleared by previous tool, until there is\n"
  5367. "no more copper to clear or there are no more tools.\n"
  5368. "If not checked, use the standard algorithm.")
  5369. )
  5370. grid0.addWidget(self.ncc_rest_cb, 17, 0, 1, 2)
  5371. # ## Reference
  5372. # self.reference_radio = RadioSet([{'label': _('Itself'), 'value': 'itself'},
  5373. # {"label": _("Area Selection"), "value": "area"},
  5374. # {'label': _('Reference Object'), 'value': 'box'}],
  5375. # orientation='vertical',
  5376. # stretch=None)
  5377. self.select_combo = FCComboBox()
  5378. self.select_combo.addItems(
  5379. [_("Itself"), _("Area Selection"), _("Reference Object")]
  5380. )
  5381. select_label = QtWidgets.QLabel('%s:' % _("Selection"))
  5382. select_label.setToolTip(
  5383. _("Selection of area to be processed.\n"
  5384. "- 'Itself' - the processing extent is based on the object that is processed.\n "
  5385. "- 'Area Selection' - left mouse click to start selection of the area to be processed.\n"
  5386. "- 'Reference Object' - will process the area specified by another object.")
  5387. )
  5388. grid0.addWidget(select_label, 18, 0)
  5389. grid0.addWidget(self.select_combo, 18, 1)
  5390. self.area_shape_label = QtWidgets.QLabel('%s:' % _("Shape"))
  5391. self.area_shape_label.setToolTip(
  5392. _("The kind of selection shape used for area selection.")
  5393. )
  5394. self.area_shape_radio = RadioSet([{'label': _("Square"), 'value': 'square'},
  5395. {'label': _("Polygon"), 'value': 'polygon'}])
  5396. grid0.addWidget(self.area_shape_label, 19, 0)
  5397. grid0.addWidget(self.area_shape_radio, 19, 1)
  5398. separator_line = QtWidgets.QFrame()
  5399. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  5400. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  5401. grid0.addWidget(separator_line, 20, 0, 1, 2)
  5402. # ## Plotting type
  5403. self.ncc_plotting_radio = RadioSet([{'label': _('Normal'), 'value': 'normal'},
  5404. {"label": _("Progressive"), "value": "progressive"}])
  5405. plotting_label = QtWidgets.QLabel('%s:' % _("NCC Plotting"))
  5406. plotting_label.setToolTip(
  5407. _("- 'Normal' - normal plotting, done at the end of the NCC job\n"
  5408. "- 'Progressive' - after each shape is generated it will be plotted.")
  5409. )
  5410. grid0.addWidget(plotting_label, 21, 0)
  5411. grid0.addWidget(self.ncc_plotting_radio, 21, 1)
  5412. self.layout.addStretch()
  5413. class ToolsCutoutPrefGroupUI(OptionsGroupUI):
  5414. def __init__(self, decimals=4, parent=None):
  5415. # OptionsGroupUI.__init__(self, "Cutout Tool Options", parent=parent)
  5416. super(ToolsCutoutPrefGroupUI, self).__init__(self)
  5417. self.setTitle(str(_("Cutout Tool Options")))
  5418. self.decimals = decimals
  5419. # ## Board cutout
  5420. self.board_cutout_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  5421. self.board_cutout_label.setToolTip(
  5422. _("Create toolpaths to cut around\n"
  5423. "the PCB and separate it from\n"
  5424. "the original board.")
  5425. )
  5426. self.layout.addWidget(self.board_cutout_label)
  5427. grid0 = QtWidgets.QGridLayout()
  5428. self.layout.addLayout(grid0)
  5429. tdclabel = QtWidgets.QLabel('%s:' % _('Tool Diameter'))
  5430. tdclabel.setToolTip(
  5431. _("Diameter of the tool used to cutout\n"
  5432. "the PCB shape out of the surrounding material.")
  5433. )
  5434. self.cutout_tooldia_entry = FCDoubleSpinner()
  5435. self.cutout_tooldia_entry.set_range(0.000001, 9999.9999)
  5436. self.cutout_tooldia_entry.set_precision(self.decimals)
  5437. self.cutout_tooldia_entry.setSingleStep(0.1)
  5438. grid0.addWidget(tdclabel, 0, 0)
  5439. grid0.addWidget(self.cutout_tooldia_entry, 0, 1)
  5440. # Cut Z
  5441. cutzlabel = QtWidgets.QLabel('%s:' % _('Cut Z'))
  5442. cutzlabel.setToolTip(
  5443. _(
  5444. "Cutting depth (negative)\n"
  5445. "below the copper surface."
  5446. )
  5447. )
  5448. self.cutz_entry = FCDoubleSpinner()
  5449. self.cutz_entry.set_precision(self.decimals)
  5450. if machinist_setting == 0:
  5451. self.cutz_entry.setRange(-9999.9999, 0.0000)
  5452. else:
  5453. self.cutz_entry.setRange(-9999.9999, 9999.9999)
  5454. self.cutz_entry.setSingleStep(0.1)
  5455. grid0.addWidget(cutzlabel, 1, 0)
  5456. grid0.addWidget(self.cutz_entry, 1, 1)
  5457. # Multi-pass
  5458. self.mpass_cb = FCCheckBox('%s:' % _("Multi-Depth"))
  5459. self.mpass_cb.setToolTip(
  5460. _(
  5461. "Use multiple passes to limit\n"
  5462. "the cut depth in each pass. Will\n"
  5463. "cut multiple times until Cut Z is\n"
  5464. "reached."
  5465. )
  5466. )
  5467. self.maxdepth_entry = FCDoubleSpinner()
  5468. self.maxdepth_entry.set_precision(self.decimals)
  5469. self.maxdepth_entry.setRange(0, 9999.9999)
  5470. self.maxdepth_entry.setSingleStep(0.1)
  5471. self.maxdepth_entry.setToolTip(_("Depth of each pass (positive)."))
  5472. grid0.addWidget(self.mpass_cb, 2, 0)
  5473. grid0.addWidget(self.maxdepth_entry, 2, 1)
  5474. # Object kind
  5475. kindlabel = QtWidgets.QLabel('%s:' % _('Object kind'))
  5476. kindlabel.setToolTip(
  5477. _("Choice of what kind the object we want to cutout is.<BR>"
  5478. "- <B>Single</B>: contain a single PCB Gerber outline object.<BR>"
  5479. "- <B>Panel</B>: a panel PCB Gerber object, which is made\n"
  5480. "out of many individual PCB outlines.")
  5481. )
  5482. self.obj_kind_combo = RadioSet([
  5483. {"label": _("Single"), "value": "single"},
  5484. {"label": _("Panel"), "value": "panel"},
  5485. ])
  5486. grid0.addWidget(kindlabel, 3, 0)
  5487. grid0.addWidget(self.obj_kind_combo, 3, 1)
  5488. marginlabel = QtWidgets.QLabel('%s:' % _('Margin'))
  5489. marginlabel.setToolTip(
  5490. _("Margin over bounds. A positive value here\n"
  5491. "will make the cutout of the PCB further from\n"
  5492. "the actual PCB border")
  5493. )
  5494. self.cutout_margin_entry = FCDoubleSpinner()
  5495. self.cutout_margin_entry.set_range(-9999.9999, 9999.9999)
  5496. self.cutout_margin_entry.set_precision(self.decimals)
  5497. self.cutout_margin_entry.setSingleStep(0.1)
  5498. grid0.addWidget(marginlabel, 4, 0)
  5499. grid0.addWidget(self.cutout_margin_entry, 4, 1)
  5500. gaplabel = QtWidgets.QLabel('%s:' % _('Gap size'))
  5501. gaplabel.setToolTip(
  5502. _("The size of the bridge gaps in the cutout\n"
  5503. "used to keep the board connected to\n"
  5504. "the surrounding material (the one \n"
  5505. "from which the PCB is cutout).")
  5506. )
  5507. self.cutout_gap_entry = FCDoubleSpinner()
  5508. self.cutout_gap_entry.set_range(0.000001, 9999.9999)
  5509. self.cutout_gap_entry.set_precision(self.decimals)
  5510. self.cutout_gap_entry.setSingleStep(0.1)
  5511. grid0.addWidget(gaplabel, 5, 0)
  5512. grid0.addWidget(self.cutout_gap_entry, 5, 1)
  5513. gaps_label = QtWidgets.QLabel('%s:' % _('Gaps'))
  5514. gaps_label.setToolTip(
  5515. _("Number of gaps used for the cutout.\n"
  5516. "There can be maximum 8 bridges/gaps.\n"
  5517. "The choices are:\n"
  5518. "- None - no gaps\n"
  5519. "- lr - left + right\n"
  5520. "- tb - top + bottom\n"
  5521. "- 4 - left + right +top + bottom\n"
  5522. "- 2lr - 2*left + 2*right\n"
  5523. "- 2tb - 2*top + 2*bottom\n"
  5524. "- 8 - 2*left + 2*right +2*top + 2*bottom")
  5525. )
  5526. self.gaps_combo = FCComboBox()
  5527. grid0.addWidget(gaps_label, 6, 0)
  5528. grid0.addWidget(self.gaps_combo, 6, 1)
  5529. gaps_items = ['None', 'LR', 'TB', '4', '2LR', '2TB', '8']
  5530. for it in gaps_items:
  5531. self.gaps_combo.addItem(it)
  5532. self.gaps_combo.setStyleSheet('background-color: rgb(255,255,255)')
  5533. # Surrounding convex box shape
  5534. self.convex_box = FCCheckBox('%s' % _("Convex Shape"))
  5535. self.convex_box.setToolTip(
  5536. _("Create a convex shape surrounding the entire PCB.\n"
  5537. "Used only if the source object type is Gerber.")
  5538. )
  5539. grid0.addWidget(self.convex_box, 7, 0, 1, 2)
  5540. self.layout.addStretch()
  5541. class Tools2sidedPrefGroupUI(OptionsGroupUI):
  5542. def __init__(self, decimals=4, parent=None):
  5543. # OptionsGroupUI.__init__(self, "2sided Tool Options", parent=parent)
  5544. super(Tools2sidedPrefGroupUI, self).__init__(self)
  5545. self.setTitle(str(_("2Sided Tool Options")))
  5546. self.decimals = decimals
  5547. # ## Board cuttout
  5548. self.dblsided_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  5549. self.dblsided_label.setToolTip(
  5550. _("A tool to help in creating a double sided\n"
  5551. "PCB using alignment holes.")
  5552. )
  5553. self.layout.addWidget(self.dblsided_label)
  5554. grid0 = QtWidgets.QGridLayout()
  5555. self.layout.addLayout(grid0)
  5556. # ## Drill diameter for alignment holes
  5557. self.drill_dia_entry = FCDoubleSpinner()
  5558. self.drill_dia_entry.set_range(0.000001, 9999.9999)
  5559. self.drill_dia_entry.set_precision(self.decimals)
  5560. self.drill_dia_entry.setSingleStep(0.1)
  5561. self.dd_label = QtWidgets.QLabel('%s:' % _("Drill dia"))
  5562. self.dd_label.setToolTip(
  5563. _("Diameter of the drill for the "
  5564. "alignment holes.")
  5565. )
  5566. grid0.addWidget(self.dd_label, 0, 0)
  5567. grid0.addWidget(self.drill_dia_entry, 0, 1)
  5568. # ## Alignment Axis
  5569. self.align_ax_label = QtWidgets.QLabel('%s:' % _("Align Axis"))
  5570. self.align_ax_label.setToolTip(
  5571. _("Mirror vertically (X) or horizontally (Y).")
  5572. )
  5573. self.align_axis_radio = RadioSet([{'label': 'X', 'value': 'X'},
  5574. {'label': 'Y', 'value': 'Y'}])
  5575. grid0.addWidget(self.align_ax_label, 1, 0)
  5576. grid0.addWidget(self.align_axis_radio, 1, 1)
  5577. # ## Axis
  5578. self.mirror_axis_radio = RadioSet([{'label': 'X', 'value': 'X'},
  5579. {'label': 'Y', 'value': 'Y'}])
  5580. self.mirax_label = QtWidgets.QLabel(_("Mirror Axis:"))
  5581. self.mirax_label.setToolTip(
  5582. _("Mirror vertically (X) or horizontally (Y).")
  5583. )
  5584. self.empty_lb1 = QtWidgets.QLabel("")
  5585. grid0.addWidget(self.empty_lb1, 2, 0)
  5586. grid0.addWidget(self.mirax_label, 3, 0)
  5587. grid0.addWidget(self.mirror_axis_radio, 3, 1)
  5588. # ## Axis Location
  5589. self.axis_location_radio = RadioSet([{'label': _('Point'), 'value': 'point'},
  5590. {'label': _('Box'), 'value': 'box'}])
  5591. self.axloc_label = QtWidgets.QLabel('%s:' % _("Axis Ref"))
  5592. self.axloc_label.setToolTip(
  5593. _("The axis should pass through a <b>point</b> or cut\n "
  5594. "a specified <b>box</b> (in a FlatCAM object) through \n"
  5595. "the center.")
  5596. )
  5597. grid0.addWidget(self.axloc_label, 4, 0)
  5598. grid0.addWidget(self.axis_location_radio, 4, 1)
  5599. self.layout.addStretch()
  5600. class ToolsPaintPrefGroupUI(OptionsGroupUI):
  5601. def __init__(self, decimals=4, parent=None):
  5602. # OptionsGroupUI.__init__(self, "Paint Area Tool Options", parent=parent)
  5603. super(ToolsPaintPrefGroupUI, self).__init__(self)
  5604. self.setTitle(str(_("Paint Tool Options")))
  5605. self.decimals = decimals
  5606. # ------------------------------
  5607. # ## Paint area
  5608. # ------------------------------
  5609. self.paint_label = QtWidgets.QLabel(_('<b>Parameters:</b>'))
  5610. self.paint_label.setToolTip(
  5611. _("Creates tool paths to cover the\n"
  5612. "whole area of a polygon (remove\n"
  5613. "all copper). You will be asked\n"
  5614. "to click on the desired polygon.")
  5615. )
  5616. self.layout.addWidget(self.paint_label)
  5617. grid0 = QtWidgets.QGridLayout()
  5618. grid0.setColumnStretch(0, 0)
  5619. grid0.setColumnStretch(1, 1)
  5620. self.layout.addLayout(grid0)
  5621. # Tool dia
  5622. ptdlabel = QtWidgets.QLabel('<b><font color="green">%s:</font></b>' % _('Tools Dia'))
  5623. ptdlabel.setToolTip(
  5624. _("Diameters of the tools, separated by comma.\n"
  5625. "The value of the diameter has to use the dot decimals separator.\n"
  5626. "Valid values: 0.3, 1.0")
  5627. )
  5628. grid0.addWidget(ptdlabel, 0, 0)
  5629. self.painttooldia_entry = FCEntry(border_color='#0069A9')
  5630. self.painttooldia_entry.setPlaceholderText(_("Comma separated values"))
  5631. grid0.addWidget(self.painttooldia_entry, 0, 1)
  5632. # Tool Type Radio Button
  5633. self.tool_type_label = QtWidgets.QLabel('%s:' % _('Tool Type'))
  5634. self.tool_type_label.setToolTip(
  5635. _("Default tool type:\n"
  5636. "- 'V-shape'\n"
  5637. "- Circular")
  5638. )
  5639. self.tool_type_radio = RadioSet([{'label': _('V-shape'), 'value': 'V'},
  5640. {'label': _('Circular'), 'value': 'C1'}])
  5641. self.tool_type_radio.setObjectName(_("Tool Type"))
  5642. grid0.addWidget(self.tool_type_label, 1, 0)
  5643. grid0.addWidget(self.tool_type_radio, 1, 1)
  5644. # Tip Dia
  5645. self.tipdialabel = QtWidgets.QLabel('%s:' % _('V-Tip Dia'))
  5646. self.tipdialabel.setToolTip(
  5647. _("The tip diameter for V-Shape Tool"))
  5648. self.tipdia_entry = FCDoubleSpinner()
  5649. self.tipdia_entry.set_precision(self.decimals)
  5650. self.tipdia_entry.set_range(0.0000, 9999.9999)
  5651. self.tipdia_entry.setSingleStep(0.1)
  5652. self.tipdia_entry.setObjectName(_("V-Tip Dia"))
  5653. grid0.addWidget(self.tipdialabel, 2, 0)
  5654. grid0.addWidget(self.tipdia_entry, 2, 1)
  5655. # Tip Angle
  5656. self.tipanglelabel = QtWidgets.QLabel('%s:' % _('V-Tip Angle'))
  5657. self.tipanglelabel.setToolTip(
  5658. _("The tip angle for V-Shape Tool.\n"
  5659. "In degree."))
  5660. self.tipangle_entry = FCDoubleSpinner()
  5661. self.tipangle_entry.set_precision(self.decimals)
  5662. self.tipangle_entry.set_range(1.0000, 180.0000)
  5663. self.tipangle_entry.setSingleStep(5)
  5664. self.tipangle_entry.setObjectName(_("V-Tip Angle"))
  5665. grid0.addWidget(self.tipanglelabel, 3, 0)
  5666. grid0.addWidget(self.tipangle_entry, 3, 1)
  5667. # Cut Z entry
  5668. cutzlabel = QtWidgets.QLabel('%s:' % _('Cut Z'))
  5669. cutzlabel.setToolTip(
  5670. _("Depth of cut into material. Negative value.\n"
  5671. "In FlatCAM units.")
  5672. )
  5673. self.cutz_entry = FCDoubleSpinner()
  5674. self.cutz_entry.set_precision(self.decimals)
  5675. self.cutz_entry.set_range(-99999.9999, 0.0000)
  5676. self.cutz_entry.setObjectName(_("Cut Z"))
  5677. self.cutz_entry.setToolTip(
  5678. _("Depth of cut into material. Negative value.\n"
  5679. "In FlatCAM units.")
  5680. )
  5681. grid0.addWidget(cutzlabel, 4, 0)
  5682. grid0.addWidget(self.cutz_entry, 4, 1)
  5683. # ### Tool Diameter ####
  5684. self.newdialabel = QtWidgets.QLabel('%s:' % _('New Dia'))
  5685. self.newdialabel.setToolTip(
  5686. _("Diameter for the new tool to add in the Tool Table.\n"
  5687. "If the tool is V-shape type then this value is automatically\n"
  5688. "calculated from the other parameters.")
  5689. )
  5690. self.newdia_entry = FCDoubleSpinner()
  5691. self.newdia_entry.set_precision(self.decimals)
  5692. self.newdia_entry.set_range(0.000, 9999.9999)
  5693. self.newdia_entry.setObjectName(_("Tool Dia"))
  5694. grid0.addWidget(self.newdialabel, 5, 0)
  5695. grid0.addWidget(self.newdia_entry, 5, 1)
  5696. separator_line = QtWidgets.QFrame()
  5697. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  5698. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  5699. grid0.addWidget(separator_line, 6, 0, 1, 2)
  5700. self.paint_order_label = QtWidgets.QLabel('%s:' % _('Tool order'))
  5701. self.paint_order_label.setToolTip(_("This set the way that the tools in the tools table are used.\n"
  5702. "'No' --> means that the used order is the one in the tool table\n"
  5703. "'Forward' --> means that the tools will be ordered from small to big\n"
  5704. "'Reverse' --> menas that the tools will ordered from big to small\n\n"
  5705. "WARNING: using rest machining will automatically set the order\n"
  5706. "in reverse and disable this control."))
  5707. self.paint_order_radio = RadioSet([{'label': _('No'), 'value': 'no'},
  5708. {'label': _('Forward'), 'value': 'fwd'},
  5709. {'label': _('Reverse'), 'value': 'rev'}])
  5710. grid0.addWidget(self.paint_order_label, 7, 0)
  5711. grid0.addWidget(self.paint_order_radio, 7, 1)
  5712. separator_line = QtWidgets.QFrame()
  5713. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  5714. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  5715. grid0.addWidget(separator_line, 8, 0, 1, 2)
  5716. # Overlap
  5717. ovlabel = QtWidgets.QLabel('%s:' % _('Overlap'))
  5718. ovlabel.setToolTip(
  5719. _("How much (percentage) of the tool width to overlap each tool pass.\n"
  5720. "Adjust the value starting with lower values\n"
  5721. "and increasing it if areas that should be painted are still \n"
  5722. "not painted.\n"
  5723. "Lower values = faster processing, faster execution on CNC.\n"
  5724. "Higher values = slow processing and slow execution on CNC\n"
  5725. "due of too many paths.")
  5726. )
  5727. self.paintoverlap_entry = FCDoubleSpinner(suffix='%')
  5728. self.paintoverlap_entry.set_precision(self.decimals)
  5729. self.paintoverlap_entry.setWrapping(True)
  5730. self.paintoverlap_entry.setRange(0.0000, 99.9999)
  5731. self.paintoverlap_entry.setSingleStep(0.1)
  5732. grid0.addWidget(ovlabel, 9, 0)
  5733. grid0.addWidget(self.paintoverlap_entry, 9, 1)
  5734. # Margin
  5735. marginlabel = QtWidgets.QLabel('%s:' % _('Margin'))
  5736. marginlabel.setToolTip(
  5737. _("Distance by which to avoid\n"
  5738. "the edges of the polygon to\n"
  5739. "be painted.")
  5740. )
  5741. self.paintmargin_entry = FCDoubleSpinner()
  5742. self.paintmargin_entry.set_range(-9999.9999, 9999.9999)
  5743. self.paintmargin_entry.set_precision(self.decimals)
  5744. self.paintmargin_entry.setSingleStep(0.1)
  5745. grid0.addWidget(marginlabel, 10, 0)
  5746. grid0.addWidget(self.paintmargin_entry, 10, 1)
  5747. # Method
  5748. methodlabel = QtWidgets.QLabel('%s:' % _('Method'))
  5749. methodlabel.setToolTip(
  5750. _("Algorithm for painting:\n"
  5751. "- Standard: Fixed step inwards.\n"
  5752. "- Seed-based: Outwards from seed.\n"
  5753. "- Line-based: Parallel lines.\n"
  5754. "- Laser-lines: Active only for Gerber objects.\n"
  5755. "Will create lines that follow the traces.\n"
  5756. "- Combo: In case of failure a new method will be picked from the above\n"
  5757. "in the order specified.")
  5758. )
  5759. # self.paintmethod_combo = RadioSet([
  5760. # {"label": _("Standard"), "value": "standard"},
  5761. # {"label": _("Seed-based"), "value": "seed"},
  5762. # {"label": _("Straight lines"), "value": "lines"}
  5763. # ], orientation='vertical', stretch=False)
  5764. self.paintmethod_combo = FCComboBox()
  5765. self.paintmethod_combo.addItems(
  5766. [_("Standard"), _("Seed"), _("Lines"), _("Laser_lines"), _("Combo")]
  5767. )
  5768. grid0.addWidget(methodlabel, 11, 0)
  5769. grid0.addWidget(self.paintmethod_combo, 11, 1)
  5770. # Connect lines
  5771. self.pathconnect_cb = FCCheckBox('%s' % _("Connect"))
  5772. self.pathconnect_cb.setToolTip(
  5773. _("Draw lines between resulting\n"
  5774. "segments to minimize tool lifts.")
  5775. )
  5776. grid0.addWidget(self.pathconnect_cb, 12, 0)
  5777. # Paint contour
  5778. self.contour_cb = FCCheckBox('%s' % _("Contour"))
  5779. self.contour_cb.setToolTip(
  5780. _("Cut around the perimeter of the polygon\n"
  5781. "to trim rough edges.")
  5782. )
  5783. grid0.addWidget(self.contour_cb, 12, 1)
  5784. separator_line = QtWidgets.QFrame()
  5785. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  5786. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  5787. grid0.addWidget(separator_line, 13, 0, 1, 2)
  5788. self.rest_cb = FCCheckBox('%s' % _("Rest Machining"))
  5789. self.rest_cb.setObjectName(_("Rest Machining"))
  5790. self.rest_cb.setToolTip(
  5791. _("If checked, use 'rest machining'.\n"
  5792. "Basically it will clear copper outside PCB features,\n"
  5793. "using the biggest tool and continue with the next tools,\n"
  5794. "from bigger to smaller, to clear areas of copper that\n"
  5795. "could not be cleared by previous tool, until there is\n"
  5796. "no more copper to clear or there are no more tools.\n\n"
  5797. "If not checked, use the standard algorithm.")
  5798. )
  5799. grid0.addWidget(self.rest_cb, 14, 0, 1, 2)
  5800. # Polygon selection
  5801. selectlabel = QtWidgets.QLabel('%s:' % _('Selection'))
  5802. selectlabel.setToolTip(
  5803. _("Selection of area to be processed.\n"
  5804. "- 'Polygon Selection' - left mouse click to add/remove polygons to be processed.\n"
  5805. "- 'Area Selection' - left mouse click to start selection of the area to be processed.\n"
  5806. "Keeping a modifier key pressed (CTRL or SHIFT) will allow to add multiple areas.\n"
  5807. "- 'All Polygons' - the process will start after click.\n"
  5808. "- 'Reference Object' - will process the area specified by another object.")
  5809. )
  5810. # self.selectmethod_combo = RadioSet(
  5811. # [
  5812. # {"label": _("Polygon Selection"), "value": "single"},
  5813. # {"label": _("Area Selection"), "value": "area"},
  5814. # {"label": _("All Polygons"), "value": "all"},
  5815. # {"label": _("Reference Object"), "value": "ref"}
  5816. # ],
  5817. # orientation='vertical',
  5818. # stretch=None
  5819. # )
  5820. self.selectmethod_combo = FCComboBox()
  5821. self.selectmethod_combo.addItems(
  5822. [_("Polygon Selection"), _("Area Selection"), _("All Polygons"), _("Reference Object")]
  5823. )
  5824. grid0.addWidget(selectlabel, 15, 0)
  5825. grid0.addWidget(self.selectmethod_combo, 15, 1)
  5826. self.area_shape_label = QtWidgets.QLabel('%s:' % _("Shape"))
  5827. self.area_shape_label.setToolTip(
  5828. _("The kind of selection shape used for area selection.")
  5829. )
  5830. self.area_shape_radio = RadioSet([{'label': _("Square"), 'value': 'square'},
  5831. {'label': _("Polygon"), 'value': 'polygon'}])
  5832. grid0.addWidget(self.area_shape_label, 18, 0)
  5833. grid0.addWidget(self.area_shape_radio, 18, 1)
  5834. separator_line = QtWidgets.QFrame()
  5835. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  5836. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  5837. grid0.addWidget(separator_line, 19, 0, 1, 2)
  5838. # ## Plotting type
  5839. self.paint_plotting_radio = RadioSet([{'label': _('Normal'), 'value': 'normal'},
  5840. {"label": _("Progressive"), "value": "progressive"}])
  5841. plotting_label = QtWidgets.QLabel('%s:' % _("Paint Plotting"))
  5842. plotting_label.setToolTip(
  5843. _("- 'Normal' - normal plotting, done at the end of the Paint job\n"
  5844. "- 'Progressive' - after each shape is generated it will be plotted.")
  5845. )
  5846. grid0.addWidget(plotting_label, 20, 0)
  5847. grid0.addWidget(self.paint_plotting_radio, 20, 1)
  5848. self.layout.addStretch()
  5849. class ToolsFilmPrefGroupUI(OptionsGroupUI):
  5850. def __init__(self, decimals=4, parent=None):
  5851. # OptionsGroupUI.__init__(self, "Cutout Tool Options", parent=parent)
  5852. super(ToolsFilmPrefGroupUI, self).__init__(self)
  5853. self.setTitle(str(_("Film Tool Options")))
  5854. self.decimals = decimals
  5855. # ## Parameters
  5856. self.film_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  5857. self.film_label.setToolTip(
  5858. _("Create a PCB film from a Gerber or Geometry\n"
  5859. "FlatCAM object.\n"
  5860. "The file is saved in SVG format.")
  5861. )
  5862. self.layout.addWidget(self.film_label)
  5863. grid0 = QtWidgets.QGridLayout()
  5864. self.layout.addLayout(grid0)
  5865. self.film_type_radio = RadioSet([{'label': 'Pos', 'value': 'pos'},
  5866. {'label': 'Neg', 'value': 'neg'}])
  5867. ftypelbl = QtWidgets.QLabel('%s:' % _('Film Type'))
  5868. ftypelbl.setToolTip(
  5869. _("Generate a Positive black film or a Negative film.\n"
  5870. "Positive means that it will print the features\n"
  5871. "with black on a white canvas.\n"
  5872. "Negative means that it will print the features\n"
  5873. "with white on a black canvas.\n"
  5874. "The Film format is SVG.")
  5875. )
  5876. grid0.addWidget(ftypelbl, 0, 0)
  5877. grid0.addWidget(self.film_type_radio, 0, 1)
  5878. # Film Color
  5879. self.film_color_label = QtWidgets.QLabel('%s:' % _('Film Color'))
  5880. self.film_color_label.setToolTip(
  5881. _("Set the film color when positive film is selected.")
  5882. )
  5883. self.film_color_entry = FCEntry()
  5884. self.film_color_button = QtWidgets.QPushButton()
  5885. self.film_color_button.setFixedSize(15, 15)
  5886. self.form_box_child = QtWidgets.QHBoxLayout()
  5887. self.form_box_child.setContentsMargins(0, 0, 0, 0)
  5888. self.form_box_child.addWidget(self.film_color_entry)
  5889. self.form_box_child.addWidget(self.film_color_button, alignment=Qt.AlignRight)
  5890. self.form_box_child.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  5891. film_color_widget = QtWidgets.QWidget()
  5892. film_color_widget.setLayout(self.form_box_child)
  5893. grid0.addWidget(self.film_color_label, 1, 0)
  5894. grid0.addWidget(film_color_widget, 1, 1)
  5895. # Film Border
  5896. self.film_boundary_entry = FCDoubleSpinner()
  5897. self.film_boundary_entry.set_precision(self.decimals)
  5898. self.film_boundary_entry.set_range(0, 9999.9999)
  5899. self.film_boundary_entry.setSingleStep(0.1)
  5900. self.film_boundary_label = QtWidgets.QLabel('%s:' % _("Border"))
  5901. self.film_boundary_label.setToolTip(
  5902. _("Specify a border around the object.\n"
  5903. "Only for negative film.\n"
  5904. "It helps if we use as a Box Object the same \n"
  5905. "object as in Film Object. It will create a thick\n"
  5906. "black bar around the actual print allowing for a\n"
  5907. "better delimitation of the outline features which are of\n"
  5908. "white color like the rest and which may confound with the\n"
  5909. "surroundings if not for this border.")
  5910. )
  5911. grid0.addWidget(self.film_boundary_label, 2, 0)
  5912. grid0.addWidget(self.film_boundary_entry, 2, 1)
  5913. self.film_scale_stroke_entry = FCDoubleSpinner()
  5914. self.film_scale_stroke_entry.set_precision(self.decimals)
  5915. self.film_scale_stroke_entry.set_range(0, 9999.9999)
  5916. self.film_scale_stroke_entry.setSingleStep(0.1)
  5917. self.film_scale_stroke_label = QtWidgets.QLabel('%s:' % _("Scale Stroke"))
  5918. self.film_scale_stroke_label.setToolTip(
  5919. _("Scale the line stroke thickness of each feature in the SVG file.\n"
  5920. "It means that the line that envelope each SVG feature will be thicker or thinner,\n"
  5921. "therefore the fine features may be more affected by this parameter.")
  5922. )
  5923. grid0.addWidget(self.film_scale_stroke_label, 3, 0)
  5924. grid0.addWidget(self.film_scale_stroke_entry, 3, 1)
  5925. self.film_adj_label = QtWidgets.QLabel('<b>%s</b>' % _("Film Adjustments"))
  5926. self.film_adj_label.setToolTip(
  5927. _("Sometime the printers will distort the print shape, especially the Laser types.\n"
  5928. "This section provide the tools to compensate for the print distortions.")
  5929. )
  5930. grid0.addWidget(self.film_adj_label, 4, 0, 1, 2)
  5931. # Scale Geometry
  5932. self.film_scale_cb = FCCheckBox('%s' % _("Scale Film geometry"))
  5933. self.film_scale_cb.setToolTip(
  5934. _("A value greater than 1 will stretch the film\n"
  5935. "while a value less than 1 will jolt it.")
  5936. )
  5937. self.film_scale_cb.setStyleSheet(
  5938. """
  5939. QCheckBox {font-weight: bold; color: black}
  5940. """
  5941. )
  5942. grid0.addWidget(self.film_scale_cb, 5, 0, 1, 2)
  5943. self.film_scalex_label = QtWidgets.QLabel('%s:' % _("X factor"))
  5944. self.film_scalex_entry = FCDoubleSpinner()
  5945. self.film_scalex_entry.set_range(-999.9999, 999.9999)
  5946. self.film_scalex_entry.set_precision(self.decimals)
  5947. self.film_scalex_entry.setSingleStep(0.01)
  5948. grid0.addWidget(self.film_scalex_label, 6, 0)
  5949. grid0.addWidget(self.film_scalex_entry, 6, 1)
  5950. self.film_scaley_label = QtWidgets.QLabel('%s:' % _("Y factor"))
  5951. self.film_scaley_entry = FCDoubleSpinner()
  5952. self.film_scaley_entry.set_range(-999.9999, 999.9999)
  5953. self.film_scaley_entry.set_precision(self.decimals)
  5954. self.film_scaley_entry.setSingleStep(0.01)
  5955. grid0.addWidget(self.film_scaley_label, 7, 0)
  5956. grid0.addWidget(self.film_scaley_entry, 7, 1)
  5957. # Skew Geometry
  5958. self.film_skew_cb = FCCheckBox('%s' % _("Skew Film geometry"))
  5959. self.film_skew_cb.setToolTip(
  5960. _("Positive values will skew to the right\n"
  5961. "while negative values will skew to the left.")
  5962. )
  5963. self.film_skew_cb.setStyleSheet(
  5964. """
  5965. QCheckBox {font-weight: bold; color: black}
  5966. """
  5967. )
  5968. grid0.addWidget(self.film_skew_cb, 8, 0, 1, 2)
  5969. self.film_skewx_label = QtWidgets.QLabel('%s:' % _("X angle"))
  5970. self.film_skewx_entry = FCDoubleSpinner()
  5971. self.film_skewx_entry.set_range(-999.9999, 999.9999)
  5972. self.film_skewx_entry.set_precision(self.decimals)
  5973. self.film_skewx_entry.setSingleStep(0.01)
  5974. grid0.addWidget(self.film_skewx_label, 9, 0)
  5975. grid0.addWidget(self.film_skewx_entry, 9, 1)
  5976. self.film_skewy_label = QtWidgets.QLabel('%s:' % _("Y angle"))
  5977. self.film_skewy_entry = FCDoubleSpinner()
  5978. self.film_skewy_entry.set_range(-999.9999, 999.9999)
  5979. self.film_skewy_entry.set_precision(self.decimals)
  5980. self.film_skewy_entry.setSingleStep(0.01)
  5981. grid0.addWidget(self.film_skewy_label, 10, 0)
  5982. grid0.addWidget(self.film_skewy_entry, 10, 1)
  5983. self.film_skew_ref_label = QtWidgets.QLabel('%s:' % _("Reference"))
  5984. self.film_skew_ref_label.setToolTip(
  5985. _("The reference point to be used as origin for the skew.\n"
  5986. "It can be one of the four points of the geometry bounding box.")
  5987. )
  5988. self.film_skew_reference = RadioSet([{'label': _('Bottom Left'), 'value': 'bottomleft'},
  5989. {'label': _('Top Left'), 'value': 'topleft'},
  5990. {'label': _('Bottom Right'), 'value': 'bottomright'},
  5991. {'label': _('Top right'), 'value': 'topright'}],
  5992. orientation='vertical',
  5993. stretch=False)
  5994. grid0.addWidget(self.film_skew_ref_label, 11, 0)
  5995. grid0.addWidget(self.film_skew_reference, 11, 1)
  5996. # Mirror Geometry
  5997. self.film_mirror_cb = FCCheckBox('%s' % _("Mirror Film geometry"))
  5998. self.film_mirror_cb.setToolTip(
  5999. _("Mirror the film geometry on the selected axis or on both.")
  6000. )
  6001. self.film_mirror_cb.setStyleSheet(
  6002. """
  6003. QCheckBox {font-weight: bold; color: black}
  6004. """
  6005. )
  6006. grid0.addWidget(self.film_mirror_cb, 12, 0, 1, 2)
  6007. self.film_mirror_axis = RadioSet([{'label': _('None'), 'value': 'none'},
  6008. {'label': _('X'), 'value': 'x'},
  6009. {'label': _('Y'), 'value': 'y'},
  6010. {'label': _('Both'), 'value': 'both'}],
  6011. stretch=False)
  6012. self.film_mirror_axis_label = QtWidgets.QLabel('%s:' % _("Mirror axis"))
  6013. grid0.addWidget(self.film_mirror_axis_label, 13, 0)
  6014. grid0.addWidget(self.film_mirror_axis, 13, 1)
  6015. separator_line3 = QtWidgets.QFrame()
  6016. separator_line3.setFrameShape(QtWidgets.QFrame.HLine)
  6017. separator_line3.setFrameShadow(QtWidgets.QFrame.Sunken)
  6018. grid0.addWidget(separator_line3, 14, 0, 1, 2)
  6019. self.file_type_radio = RadioSet([{'label': _('SVG'), 'value': 'svg'},
  6020. {'label': _('PNG'), 'value': 'png'},
  6021. {'label': _('PDF'), 'value': 'pdf'}
  6022. ], stretch=False)
  6023. self.file_type_label = QtWidgets.QLabel(_("Film Type:"))
  6024. self.file_type_label.setToolTip(
  6025. _("The file type of the saved film. Can be:\n"
  6026. "- 'SVG' -> open-source vectorial format\n"
  6027. "- 'PNG' -> raster image\n"
  6028. "- 'PDF' -> portable document format")
  6029. )
  6030. grid0.addWidget(self.file_type_label, 15, 0)
  6031. grid0.addWidget(self.file_type_radio, 15, 1)
  6032. # Page orientation
  6033. self.orientation_label = QtWidgets.QLabel('%s:' % _("Page Orientation"))
  6034. self.orientation_label.setToolTip(_("Can be:\n"
  6035. "- Portrait\n"
  6036. "- Landscape"))
  6037. self.orientation_radio = RadioSet([{'label': _('Portrait'), 'value': 'p'},
  6038. {'label': _('Landscape'), 'value': 'l'},
  6039. ], stretch=False)
  6040. grid0.addWidget(self.orientation_label, 16, 0)
  6041. grid0.addWidget(self.orientation_radio, 16, 1)
  6042. # Page Size
  6043. self.pagesize_label = QtWidgets.QLabel('%s:' % _("Page Size"))
  6044. self.pagesize_label.setToolTip(_("A selection of standard ISO 216 page sizes."))
  6045. self.pagesize_combo = FCComboBox()
  6046. self.pagesize = {}
  6047. self.pagesize.update(
  6048. {
  6049. 'Bounds': None,
  6050. 'A0': (841, 1189),
  6051. 'A1': (594, 841),
  6052. 'A2': (420, 594),
  6053. 'A3': (297, 420),
  6054. 'A4': (210, 297),
  6055. 'A5': (148, 210),
  6056. 'A6': (105, 148),
  6057. 'A7': (74, 105),
  6058. 'A8': (52, 74),
  6059. 'A9': (37, 52),
  6060. 'A10': (26, 37),
  6061. 'B0': (1000, 1414),
  6062. 'B1': (707, 1000),
  6063. 'B2': (500, 707),
  6064. 'B3': (353, 500),
  6065. 'B4': (250, 353),
  6066. 'B5': (176, 250),
  6067. 'B6': (125, 176),
  6068. 'B7': (88, 125),
  6069. 'B8': (62, 88),
  6070. 'B9': (44, 62),
  6071. 'B10': (31, 44),
  6072. 'C0': (917, 1297),
  6073. 'C1': (648, 917),
  6074. 'C2': (458, 648),
  6075. 'C3': (324, 458),
  6076. 'C4': (229, 324),
  6077. 'C5': (162, 229),
  6078. 'C6': (114, 162),
  6079. 'C7': (81, 114),
  6080. 'C8': (57, 81),
  6081. 'C9': (40, 57),
  6082. 'C10': (28, 40),
  6083. # American paper sizes
  6084. 'LETTER': (8.5, 11),
  6085. 'LEGAL': (8.5, 14),
  6086. 'ELEVENSEVENTEEN': (11, 17),
  6087. # From https://en.wikipedia.org/wiki/Paper_size
  6088. 'JUNIOR_LEGAL': (5, 8),
  6089. 'HALF_LETTER': (5.5, 8),
  6090. 'GOV_LETTER': (8, 10.5),
  6091. 'GOV_LEGAL': (8.5, 13),
  6092. 'LEDGER': (17, 11),
  6093. }
  6094. )
  6095. page_size_list = list(self.pagesize.keys())
  6096. self.pagesize_combo.addItems(page_size_list)
  6097. grid0.addWidget(self.pagesize_label, 17, 0)
  6098. grid0.addWidget(self.pagesize_combo, 17, 1)
  6099. self.layout.addStretch()
  6100. class ToolsPanelizePrefGroupUI(OptionsGroupUI):
  6101. def __init__(self, decimals=4, parent=None):
  6102. # OptionsGroupUI.__init__(self, "Cutout Tool Options", parent=parent)
  6103. super(ToolsPanelizePrefGroupUI, self).__init__(self)
  6104. self.setTitle(str(_("Panelize Tool Options")))
  6105. self.decimals = decimals
  6106. # ## Board cuttout
  6107. self.panelize_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  6108. self.panelize_label.setToolTip(
  6109. _("Create an object that contains an array of (x, y) elements,\n"
  6110. "each element is a copy of the source object spaced\n"
  6111. "at a X distance, Y distance of each other.")
  6112. )
  6113. self.layout.addWidget(self.panelize_label)
  6114. grid0 = QtWidgets.QGridLayout()
  6115. self.layout.addLayout(grid0)
  6116. grid0.setColumnStretch(0, 0)
  6117. grid0.setColumnStretch(1, 1)
  6118. # ## Spacing Columns
  6119. self.pspacing_columns = FCDoubleSpinner()
  6120. self.pspacing_columns.set_range(0.000001, 9999.9999)
  6121. self.pspacing_columns.set_precision(self.decimals)
  6122. self.pspacing_columns.setSingleStep(0.1)
  6123. self.spacing_columns_label = QtWidgets.QLabel('%s:' % _("Spacing cols"))
  6124. self.spacing_columns_label.setToolTip(
  6125. _("Spacing between columns of the desired panel.\n"
  6126. "In current units.")
  6127. )
  6128. grid0.addWidget(self.spacing_columns_label, 0, 0)
  6129. grid0.addWidget(self.pspacing_columns, 0, 1)
  6130. # ## Spacing Rows
  6131. self.pspacing_rows = FCDoubleSpinner()
  6132. self.pspacing_rows.set_range(0.000001, 9999.9999)
  6133. self.pspacing_rows.set_precision(self.decimals)
  6134. self.pspacing_rows.setSingleStep(0.1)
  6135. self.spacing_rows_label = QtWidgets.QLabel('%s:' % _("Spacing rows"))
  6136. self.spacing_rows_label.setToolTip(
  6137. _("Spacing between rows of the desired panel.\n"
  6138. "In current units.")
  6139. )
  6140. grid0.addWidget(self.spacing_rows_label, 1, 0)
  6141. grid0.addWidget(self.pspacing_rows, 1, 1)
  6142. # ## Columns
  6143. self.pcolumns = FCSpinner()
  6144. self.pcolumns.set_range(1, 1000)
  6145. self.pcolumns.set_step(1)
  6146. self.columns_label = QtWidgets.QLabel('%s:' % _("Columns"))
  6147. self.columns_label.setToolTip(
  6148. _("Number of columns of the desired panel")
  6149. )
  6150. grid0.addWidget(self.columns_label, 2, 0)
  6151. grid0.addWidget(self.pcolumns, 2, 1)
  6152. # ## Rows
  6153. self.prows = FCSpinner()
  6154. self.prows.set_range(1, 1000)
  6155. self.prows.set_step(1)
  6156. self.rows_label = QtWidgets.QLabel('%s:' % _("Rows"))
  6157. self.rows_label.setToolTip(
  6158. _("Number of rows of the desired panel")
  6159. )
  6160. grid0.addWidget(self.rows_label, 3, 0)
  6161. grid0.addWidget(self.prows, 3, 1)
  6162. # ## Type of resulting Panel object
  6163. self.panel_type_radio = RadioSet([{'label': _('Gerber'), 'value': 'gerber'},
  6164. {'label': _('Geo'), 'value': 'geometry'}])
  6165. self.panel_type_label = QtWidgets.QLabel('%s:' % _("Panel Type"))
  6166. self.panel_type_label.setToolTip(
  6167. _("Choose the type of object for the panel object:\n"
  6168. "- Gerber\n"
  6169. "- Geometry")
  6170. )
  6171. grid0.addWidget(self.panel_type_label, 4, 0)
  6172. grid0.addWidget(self.panel_type_radio, 4, 1)
  6173. # ## Constrains
  6174. self.pconstrain_cb = FCCheckBox('%s:' % _("Constrain within"))
  6175. self.pconstrain_cb.setToolTip(
  6176. _("Area define by DX and DY within to constrain the panel.\n"
  6177. "DX and DY values are in current units.\n"
  6178. "Regardless of how many columns and rows are desired,\n"
  6179. "the final panel will have as many columns and rows as\n"
  6180. "they fit completely within selected area.")
  6181. )
  6182. grid0.addWidget(self.pconstrain_cb, 5, 0, 1, 2)
  6183. self.px_width_entry = FCDoubleSpinner()
  6184. self.px_width_entry.set_range(0.000001, 9999.9999)
  6185. self.px_width_entry.set_precision(self.decimals)
  6186. self.px_width_entry.setSingleStep(0.1)
  6187. self.x_width_lbl = QtWidgets.QLabel('%s:' % _("Width (DX)"))
  6188. self.x_width_lbl.setToolTip(
  6189. _("The width (DX) within which the panel must fit.\n"
  6190. "In current units.")
  6191. )
  6192. grid0.addWidget(self.x_width_lbl, 6, 0)
  6193. grid0.addWidget(self.px_width_entry, 6, 1)
  6194. self.py_height_entry = FCDoubleSpinner()
  6195. self.py_height_entry.set_range(0.000001, 9999.9999)
  6196. self.py_height_entry.set_precision(self.decimals)
  6197. self.py_height_entry.setSingleStep(0.1)
  6198. self.y_height_lbl = QtWidgets.QLabel('%s:' % _("Height (DY)"))
  6199. self.y_height_lbl.setToolTip(
  6200. _("The height (DY)within which the panel must fit.\n"
  6201. "In current units.")
  6202. )
  6203. grid0.addWidget(self.y_height_lbl, 7, 0)
  6204. grid0.addWidget(self.py_height_entry, 7, 1)
  6205. self.layout.addStretch()
  6206. class ToolsCalculatorsPrefGroupUI(OptionsGroupUI):
  6207. def __init__(self, decimals=4, parent=None):
  6208. # OptionsGroupUI.__init__(self, "Calculators Tool Options", parent=parent)
  6209. super(ToolsCalculatorsPrefGroupUI, self).__init__(self)
  6210. self.setTitle(str(_("Calculators Tool Options")))
  6211. self.decimals = decimals
  6212. # ## V-shape Calculator Tool
  6213. self.vshape_tool_label = QtWidgets.QLabel("<b>%s:</b>" % _("V-Shape Tool Calculator"))
  6214. self.vshape_tool_label.setToolTip(
  6215. _("Calculate the tool diameter for a given V-shape tool,\n"
  6216. "having the tip diameter, tip angle and\n"
  6217. "depth-of-cut as parameters.")
  6218. )
  6219. self.layout.addWidget(self.vshape_tool_label)
  6220. grid0 = QtWidgets.QGridLayout()
  6221. grid0.setColumnStretch(0, 0)
  6222. grid0.setColumnStretch(1, 1)
  6223. self.layout.addLayout(grid0)
  6224. # ## Tip Diameter
  6225. self.tip_dia_entry = FCDoubleSpinner()
  6226. self.tip_dia_entry.set_range(0.000001, 9999.9999)
  6227. self.tip_dia_entry.set_precision(self.decimals)
  6228. self.tip_dia_entry.setSingleStep(0.1)
  6229. self.tip_dia_label = QtWidgets.QLabel('%s:' % _("Tip Diameter"))
  6230. self.tip_dia_label.setToolTip(
  6231. _("This is the tool tip diameter.\n"
  6232. "It is specified by manufacturer.")
  6233. )
  6234. grid0.addWidget(self.tip_dia_label, 0, 0)
  6235. grid0.addWidget(self.tip_dia_entry, 0, 1)
  6236. # ## Tip angle
  6237. self.tip_angle_entry = FCDoubleSpinner()
  6238. self.tip_angle_entry.set_range(0.0, 180.0)
  6239. self.tip_angle_entry.set_precision(self.decimals)
  6240. self.tip_angle_entry.setSingleStep(5)
  6241. self.tip_angle_label = QtWidgets.QLabel('%s:' % _("Tip Angle"))
  6242. self.tip_angle_label.setToolTip(
  6243. _("This is the angle on the tip of the tool.\n"
  6244. "It is specified by manufacturer.")
  6245. )
  6246. grid0.addWidget(self.tip_angle_label, 1, 0)
  6247. grid0.addWidget(self.tip_angle_entry, 1, 1)
  6248. # ## Depth-of-cut Cut Z
  6249. self.cut_z_entry = FCDoubleSpinner()
  6250. self.cut_z_entry.set_range(-9999.9999, 0.0000)
  6251. self.cut_z_entry.set_precision(self.decimals)
  6252. self.cut_z_entry.setSingleStep(0.01)
  6253. self.cut_z_label = QtWidgets.QLabel('%s:' % _("Cut Z"))
  6254. self.cut_z_label.setToolTip(
  6255. _("This is depth to cut into material.\n"
  6256. "In the CNCJob object it is the CutZ parameter.")
  6257. )
  6258. grid0.addWidget(self.cut_z_label, 2, 0)
  6259. grid0.addWidget(self.cut_z_entry, 2, 1)
  6260. # ## Electroplating Calculator Tool
  6261. self.plate_title_label = QtWidgets.QLabel("<b>%s:</b>" % _("ElectroPlating Calculator"))
  6262. self.plate_title_label.setToolTip(
  6263. _("This calculator is useful for those who plate the via/pad/drill holes,\n"
  6264. "using a method like grahite ink or calcium hypophosphite ink or palladium chloride.")
  6265. )
  6266. grid0.addWidget(self.plate_title_label, 3, 0, 1, 2)
  6267. # ## PCB Length
  6268. self.pcblength_entry = FCDoubleSpinner()
  6269. self.pcblength_entry.set_range(0.000001, 9999.9999)
  6270. self.pcblength_entry.set_precision(self.decimals)
  6271. self.pcblength_entry.setSingleStep(0.1)
  6272. self.pcblengthlabel = QtWidgets.QLabel('%s:' % _("Board Length"))
  6273. self.pcblengthlabel.setToolTip(_('This is the board length. In centimeters.'))
  6274. grid0.addWidget(self.pcblengthlabel, 4, 0)
  6275. grid0.addWidget(self.pcblength_entry, 4, 1)
  6276. # ## PCB Width
  6277. self.pcbwidth_entry = FCDoubleSpinner()
  6278. self.pcbwidth_entry.set_range(0.000001, 9999.9999)
  6279. self.pcbwidth_entry.set_precision(self.decimals)
  6280. self.pcbwidth_entry.setSingleStep(0.1)
  6281. self.pcbwidthlabel = QtWidgets.QLabel('%s:' % _("Board Width"))
  6282. self.pcbwidthlabel.setToolTip(_('This is the board width.In centimeters.'))
  6283. grid0.addWidget(self.pcbwidthlabel, 5, 0)
  6284. grid0.addWidget(self.pcbwidth_entry, 5, 1)
  6285. # ## Current Density
  6286. self.cdensity_label = QtWidgets.QLabel('%s:' % _("Current Density"))
  6287. self.cdensity_entry = FCDoubleSpinner()
  6288. self.cdensity_entry.set_range(0.000001, 9999.9999)
  6289. self.cdensity_entry.set_precision(self.decimals)
  6290. self.cdensity_entry.setSingleStep(0.1)
  6291. self.cdensity_label.setToolTip(_("Current density to pass through the board. \n"
  6292. "In Amps per Square Feet ASF."))
  6293. grid0.addWidget(self.cdensity_label, 6, 0)
  6294. grid0.addWidget(self.cdensity_entry, 6, 1)
  6295. # ## PCB Copper Growth
  6296. self.growth_label = QtWidgets.QLabel('%s:' % _("Copper Growth"))
  6297. self.growth_entry = FCDoubleSpinner()
  6298. self.growth_entry.set_range(0.000001, 9999.9999)
  6299. self.growth_entry.set_precision(self.decimals)
  6300. self.growth_entry.setSingleStep(0.01)
  6301. self.growth_label.setToolTip(_("How thick the copper growth is intended to be.\n"
  6302. "In microns."))
  6303. grid0.addWidget(self.growth_label, 7, 0)
  6304. grid0.addWidget(self.growth_entry, 7, 1)
  6305. self.layout.addStretch()
  6306. class ToolsTransformPrefGroupUI(OptionsGroupUI):
  6307. def __init__(self, decimals=4, parent=None):
  6308. super(ToolsTransformPrefGroupUI, self).__init__(self)
  6309. self.setTitle(str(_("Transform Tool Options")))
  6310. self.decimals = decimals
  6311. # ## Transformations
  6312. self.transform_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  6313. self.transform_label.setToolTip(
  6314. _("Various transformations that can be applied\n"
  6315. "on a FlatCAM object.")
  6316. )
  6317. self.layout.addWidget(self.transform_label)
  6318. grid0 = QtWidgets.QGridLayout()
  6319. self.layout.addLayout(grid0)
  6320. grid0.setColumnStretch(0, 0)
  6321. grid0.setColumnStretch(1, 1)
  6322. # ## Rotate Angle
  6323. rotate_title_lbl = QtWidgets.QLabel('<b>%s</b>' % _("Rotate"))
  6324. grid0.addWidget(rotate_title_lbl, 0, 0, 1, 2)
  6325. self.rotate_entry = FCDoubleSpinner()
  6326. self.rotate_entry.set_range(-360.0, 360.0)
  6327. self.rotate_entry.set_precision(self.decimals)
  6328. self.rotate_entry.setSingleStep(15)
  6329. self.rotate_label = QtWidgets.QLabel('%s:' % _("Angle"))
  6330. self.rotate_label.setToolTip(
  6331. _("Angle for Rotation action, in degrees.\n"
  6332. "Float number between -360 and 359.\n"
  6333. "Positive numbers for CW motion.\n"
  6334. "Negative numbers for CCW motion.")
  6335. )
  6336. grid0.addWidget(self.rotate_label, 1, 0)
  6337. grid0.addWidget(self.rotate_entry, 1, 1)
  6338. # ## Skew/Shear Angle on X axis
  6339. skew_title_lbl = QtWidgets.QLabel('<b>%s</b>' % _("Skew"))
  6340. grid0.addWidget(skew_title_lbl, 2, 0, 1, 2)
  6341. self.skewx_entry = FCDoubleSpinner()
  6342. self.skewx_entry.set_range(-360.0, 360.0)
  6343. self.skewx_entry.set_precision(self.decimals)
  6344. self.skewx_entry.setSingleStep(0.1)
  6345. self.skewx_label = QtWidgets.QLabel('%s:' % _("X angle"))
  6346. self.skewx_label.setToolTip(
  6347. _("Angle for Skew action, in degrees.\n"
  6348. "Float number between -360 and 359.")
  6349. )
  6350. grid0.addWidget(self.skewx_label, 3, 0)
  6351. grid0.addWidget(self.skewx_entry, 3, 1)
  6352. # ## Skew/Shear Angle on Y axis
  6353. self.skewy_entry = FCDoubleSpinner()
  6354. self.skewy_entry.set_range(-360.0, 360.0)
  6355. self.skewy_entry.set_precision(self.decimals)
  6356. self.skewy_entry.setSingleStep(0.1)
  6357. self.skewy_label = QtWidgets.QLabel('%s:' % _("Y angle"))
  6358. self.skewy_label.setToolTip(
  6359. _("Angle for Skew action, in degrees.\n"
  6360. "Float number between -360 and 359.")
  6361. )
  6362. grid0.addWidget(self.skewy_label, 4, 0)
  6363. grid0.addWidget(self.skewy_entry, 4, 1)
  6364. # ## Scale
  6365. scale_title_lbl = QtWidgets.QLabel('<b>%s</b>' % _("Scale"))
  6366. grid0.addWidget(scale_title_lbl, 5, 0, 1, 2)
  6367. self.scalex_entry = FCDoubleSpinner()
  6368. self.scalex_entry.set_range(0, 9999.9999)
  6369. self.scalex_entry.set_precision(self.decimals)
  6370. self.scalex_entry.setSingleStep(0.1)
  6371. self.scalex_label = QtWidgets.QLabel('%s:' % _("X factor"))
  6372. self.scalex_label.setToolTip(
  6373. _("Factor for scaling on X axis.")
  6374. )
  6375. grid0.addWidget(self.scalex_label, 6, 0)
  6376. grid0.addWidget(self.scalex_entry, 6, 1)
  6377. # ## Scale factor on X axis
  6378. self.scaley_entry = FCDoubleSpinner()
  6379. self.scaley_entry.set_range(0, 9999.9999)
  6380. self.scaley_entry.set_precision(self.decimals)
  6381. self.scaley_entry.setSingleStep(0.1)
  6382. self.scaley_label = QtWidgets.QLabel('%s:' % _("Y factor"))
  6383. self.scaley_label.setToolTip(
  6384. _("Factor for scaling on Y axis.")
  6385. )
  6386. grid0.addWidget(self.scaley_label, 7, 0)
  6387. grid0.addWidget(self.scaley_entry, 7, 1)
  6388. # ## Link Scale factors
  6389. self.link_cb = FCCheckBox(_("Link"))
  6390. self.link_cb.setToolTip(
  6391. _("Scale the selected object(s)\n"
  6392. "using the Scale_X factor for both axis.")
  6393. )
  6394. grid0.addWidget(self.link_cb, 8, 0)
  6395. # ## Scale Reference
  6396. self.reference_cb = FCCheckBox('%s' % _("Scale Reference"))
  6397. self.reference_cb.setToolTip(
  6398. _("Scale the selected object(s)\n"
  6399. "using the origin reference when checked,\n"
  6400. "and the center of the biggest bounding box\n"
  6401. "of the selected objects when unchecked.")
  6402. )
  6403. grid0.addWidget(self.reference_cb, 8, 1)
  6404. # ## Offset
  6405. offset_title_lbl = QtWidgets.QLabel('<b>%s</b>' % _("Offset"))
  6406. grid0.addWidget(offset_title_lbl, 9, 0, 1, 2)
  6407. self.offx_entry = FCDoubleSpinner()
  6408. self.offx_entry.set_range(-9999.9999, 9999.9999)
  6409. self.offx_entry.set_precision(self.decimals)
  6410. self.offx_entry.setSingleStep(0.1)
  6411. self.offx_label = QtWidgets.QLabel('%s:' % _("X val"))
  6412. self.offx_label.setToolTip(
  6413. _("Distance to offset on X axis. In current units.")
  6414. )
  6415. grid0.addWidget(self.offx_label, 10, 0)
  6416. grid0.addWidget(self.offx_entry, 10, 1)
  6417. # ## Offset distance on Y axis
  6418. self.offy_entry = FCDoubleSpinner()
  6419. self.offy_entry.set_range(-9999.9999, 9999.9999)
  6420. self.offy_entry.set_precision(self.decimals)
  6421. self.offy_entry.setSingleStep(0.1)
  6422. self.offy_label = QtWidgets.QLabel('%s:' % _("Y val"))
  6423. self.offy_label.setToolTip(
  6424. _("Distance to offset on Y axis. In current units.")
  6425. )
  6426. grid0.addWidget(self.offy_label, 11, 0)
  6427. grid0.addWidget(self.offy_entry, 11, 1)
  6428. # ## Mirror
  6429. mirror_title_lbl = QtWidgets.QLabel('<b>%s</b>' % _("Mirror"))
  6430. grid0.addWidget(mirror_title_lbl, 12, 0, 1, 2)
  6431. # ## Mirror (Flip) Reference Point
  6432. self.mirror_reference_cb = FCCheckBox('%s' % _("Mirror Reference"))
  6433. self.mirror_reference_cb.setToolTip(
  6434. _("Flip the selected object(s)\n"
  6435. "around the point in Point Entry Field.\n"
  6436. "\n"
  6437. "The point coordinates can be captured by\n"
  6438. "left click on canvas together with pressing\n"
  6439. "SHIFT key. \n"
  6440. "Then click Add button to insert coordinates.\n"
  6441. "Or enter the coords in format (x, y) in the\n"
  6442. "Point Entry field and click Flip on X(Y)"))
  6443. grid0.addWidget(self.mirror_reference_cb, 13, 0, 1, 2)
  6444. self.flip_ref_label = QtWidgets.QLabel('%s' % _("Mirror Reference point"))
  6445. self.flip_ref_label.setToolTip(
  6446. _("Coordinates in format (x, y) used as reference for mirroring.\n"
  6447. "The 'x' in (x, y) will be used when using Flip on X and\n"
  6448. "the 'y' in (x, y) will be used when using Flip on Y and")
  6449. )
  6450. self.flip_ref_entry = EvalEntry2("(0, 0)")
  6451. grid0.addWidget(self.flip_ref_label, 14, 0, 1, 2)
  6452. grid0.addWidget(self.flip_ref_entry, 15, 0, 1, 2)
  6453. # ## Buffer
  6454. buffer_title_lbl = QtWidgets.QLabel('<b>%s</b>' % _("Buffer"))
  6455. grid0.addWidget(buffer_title_lbl, 16, 0, 1, 2)
  6456. self.buffer_label = QtWidgets.QLabel('%s:' % _("Distance"))
  6457. self.buffer_label.setToolTip(
  6458. _("A positive value will create the effect of dilation,\n"
  6459. "while a negative value will create the effect of erosion.\n"
  6460. "Each geometry element of the object will be increased\n"
  6461. "or decreased with the 'distance'.")
  6462. )
  6463. self.buffer_entry = FCDoubleSpinner()
  6464. self.buffer_entry.set_precision(self.decimals)
  6465. self.buffer_entry.setSingleStep(0.1)
  6466. self.buffer_entry.setWrapping(True)
  6467. self.buffer_entry.set_range(-9999.9999, 9999.9999)
  6468. grid0.addWidget(self.buffer_label, 17, 0)
  6469. grid0.addWidget(self.buffer_entry, 17, 1)
  6470. self.buffer_factor_label = QtWidgets.QLabel('%s:' % _("Value"))
  6471. self.buffer_factor_label.setToolTip(
  6472. _("A positive value will create the effect of dilation,\n"
  6473. "while a negative value will create the effect of erosion.\n"
  6474. "Each geometry element of the object will be increased\n"
  6475. "or decreased to fit the 'Value'. Value is a percentage\n"
  6476. "of the initial dimension.")
  6477. )
  6478. self.buffer_factor_entry = FCDoubleSpinner(suffix='%')
  6479. self.buffer_factor_entry.set_range(-100.0000, 1000.0000)
  6480. self.buffer_factor_entry.set_precision(self.decimals)
  6481. self.buffer_factor_entry.setWrapping(True)
  6482. self.buffer_factor_entry.setSingleStep(1)
  6483. grid0.addWidget(self.buffer_factor_label, 18, 0)
  6484. grid0.addWidget(self.buffer_factor_entry, 18, 1)
  6485. self.buffer_rounded_cb = FCCheckBox()
  6486. self.buffer_rounded_cb.setText('%s' % _("Rounded"))
  6487. self.buffer_rounded_cb.setToolTip(
  6488. _("If checked then the buffer will surround the buffered shape,\n"
  6489. "every corner will be rounded.\n"
  6490. "If not checked then the buffer will follow the exact geometry\n"
  6491. "of the buffered shape.")
  6492. )
  6493. grid0.addWidget(self.buffer_rounded_cb, 19, 0, 1, 2)
  6494. self.layout.addStretch()
  6495. class ToolsSolderpastePrefGroupUI(OptionsGroupUI):
  6496. def __init__(self, decimals=4, parent=None):
  6497. super(ToolsSolderpastePrefGroupUI, self).__init__(self)
  6498. self.setTitle(str(_("SolderPaste Tool Options")))
  6499. self.decimals = decimals
  6500. # ## Solder Paste Dispensing
  6501. self.solderpastelabel = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  6502. self.solderpastelabel.setToolTip(
  6503. _("A tool to create GCode for dispensing\n"
  6504. "solder paste onto a PCB.")
  6505. )
  6506. self.layout.addWidget(self.solderpastelabel)
  6507. grid0 = QtWidgets.QGridLayout()
  6508. self.layout.addLayout(grid0)
  6509. # Nozzle Tool Diameters
  6510. nozzletdlabel = QtWidgets.QLabel('<b><font color="green">%s:</font></b>' % _('Tools Dia'))
  6511. nozzletdlabel.setToolTip(
  6512. _("Diameters of the tools, separated by comma.\n"
  6513. "The value of the diameter has to use the dot decimals separator.\n"
  6514. "Valid values: 0.3, 1.0")
  6515. )
  6516. self.nozzle_tool_dia_entry = FCEntry()
  6517. grid0.addWidget(nozzletdlabel, 0, 0)
  6518. grid0.addWidget(self.nozzle_tool_dia_entry, 0, 1)
  6519. # New Nozzle Tool Dia
  6520. self.addtool_entry_lbl = QtWidgets.QLabel('<b>%s:</b>' % _('New Nozzle Dia'))
  6521. self.addtool_entry_lbl.setToolTip(
  6522. _("Diameter for the new Nozzle tool to add in the Tool Table")
  6523. )
  6524. self.addtool_entry = FCDoubleSpinner()
  6525. self.addtool_entry.set_precision(self.decimals)
  6526. self.addtool_entry.set_range(0.0000001, 9999.9999)
  6527. self.addtool_entry.setSingleStep(0.1)
  6528. grid0.addWidget(self.addtool_entry_lbl, 1, 0)
  6529. grid0.addWidget(self.addtool_entry, 1, 1)
  6530. # Z dispense start
  6531. self.z_start_entry = FCDoubleSpinner()
  6532. self.z_start_entry.set_precision(self.decimals)
  6533. self.z_start_entry.set_range(0.0000001, 9999.9999)
  6534. self.z_start_entry.setSingleStep(0.1)
  6535. self.z_start_label = QtWidgets.QLabel('%s:' % _("Z Dispense Start"))
  6536. self.z_start_label.setToolTip(
  6537. _("The height (Z) when solder paste dispensing starts.")
  6538. )
  6539. grid0.addWidget(self.z_start_label, 2, 0)
  6540. grid0.addWidget(self.z_start_entry, 2, 1)
  6541. # Z dispense
  6542. self.z_dispense_entry = FCDoubleSpinner()
  6543. self.z_dispense_entry.set_precision(self.decimals)
  6544. self.z_dispense_entry.set_range(0.0000001, 9999.9999)
  6545. self.z_dispense_entry.setSingleStep(0.1)
  6546. self.z_dispense_label = QtWidgets.QLabel('%s:' % _("Z Dispense"))
  6547. self.z_dispense_label.setToolTip(
  6548. _("The height (Z) when doing solder paste dispensing.")
  6549. )
  6550. grid0.addWidget(self.z_dispense_label, 3, 0)
  6551. grid0.addWidget(self.z_dispense_entry, 3, 1)
  6552. # Z dispense stop
  6553. self.z_stop_entry = FCDoubleSpinner()
  6554. self.z_stop_entry.set_precision(self.decimals)
  6555. self.z_stop_entry.set_range(0.0000001, 9999.9999)
  6556. self.z_stop_entry.setSingleStep(0.1)
  6557. self.z_stop_label = QtWidgets.QLabel('%s:' % _("Z Dispense Stop"))
  6558. self.z_stop_label.setToolTip(
  6559. _("The height (Z) when solder paste dispensing stops.")
  6560. )
  6561. grid0.addWidget(self.z_stop_label, 4, 0)
  6562. grid0.addWidget(self.z_stop_entry, 4, 1)
  6563. # Z travel
  6564. self.z_travel_entry = FCDoubleSpinner()
  6565. self.z_travel_entry.set_precision(self.decimals)
  6566. self.z_travel_entry.set_range(0.0000001, 9999.9999)
  6567. self.z_travel_entry.setSingleStep(0.1)
  6568. self.z_travel_label = QtWidgets.QLabel('%s:' % _("Z Travel"))
  6569. self.z_travel_label.setToolTip(
  6570. _("The height (Z) for travel between pads\n"
  6571. "(without dispensing solder paste).")
  6572. )
  6573. grid0.addWidget(self.z_travel_label, 5, 0)
  6574. grid0.addWidget(self.z_travel_entry, 5, 1)
  6575. # Z toolchange location
  6576. self.z_toolchange_entry = FCDoubleSpinner()
  6577. self.z_toolchange_entry.set_precision(self.decimals)
  6578. self.z_toolchange_entry.set_range(0.0000001, 9999.9999)
  6579. self.z_toolchange_entry.setSingleStep(0.1)
  6580. self.z_toolchange_label = QtWidgets.QLabel('%s:' % _("Z Toolchange"))
  6581. self.z_toolchange_label.setToolTip(
  6582. _("The height (Z) for tool (nozzle) change.")
  6583. )
  6584. grid0.addWidget(self.z_toolchange_label, 6, 0)
  6585. grid0.addWidget(self.z_toolchange_entry, 6, 1)
  6586. # X,Y Toolchange location
  6587. self.xy_toolchange_entry = FCEntry()
  6588. self.xy_toolchange_label = QtWidgets.QLabel('%s:' % _("Toolchange X-Y"))
  6589. self.xy_toolchange_label.setToolTip(
  6590. _("The X,Y location for tool (nozzle) change.\n"
  6591. "The format is (x, y) where x and y are real numbers.")
  6592. )
  6593. grid0.addWidget(self.xy_toolchange_label, 7, 0)
  6594. grid0.addWidget(self.xy_toolchange_entry, 7, 1)
  6595. # Feedrate X-Y
  6596. self.frxy_entry = FCDoubleSpinner()
  6597. self.frxy_entry.set_precision(self.decimals)
  6598. self.frxy_entry.set_range(0.0000001, 99999.9999)
  6599. self.frxy_entry.setSingleStep(0.1)
  6600. self.frxy_label = QtWidgets.QLabel('%s:' % _("Feedrate X-Y"))
  6601. self.frxy_label.setToolTip(
  6602. _("Feedrate (speed) while moving on the X-Y plane.")
  6603. )
  6604. grid0.addWidget(self.frxy_label, 8, 0)
  6605. grid0.addWidget(self.frxy_entry, 8, 1)
  6606. # Feedrate Z
  6607. self.frz_entry = FCDoubleSpinner()
  6608. self.frz_entry.set_precision(self.decimals)
  6609. self.frz_entry.set_range(0.0000001, 99999.9999)
  6610. self.frz_entry.setSingleStep(0.1)
  6611. self.frz_label = QtWidgets.QLabel('%s:' % _("Feedrate Z"))
  6612. self.frz_label.setToolTip(
  6613. _("Feedrate (speed) while moving vertically\n"
  6614. "(on Z plane).")
  6615. )
  6616. grid0.addWidget(self.frz_label, 9, 0)
  6617. grid0.addWidget(self.frz_entry, 9, 1)
  6618. # Feedrate Z Dispense
  6619. self.frz_dispense_entry = FCDoubleSpinner()
  6620. self.frz_dispense_entry.set_precision(self.decimals)
  6621. self.frz_dispense_entry.set_range(0.0000001, 99999.9999)
  6622. self.frz_dispense_entry.setSingleStep(0.1)
  6623. self.frz_dispense_label = QtWidgets.QLabel('%s:' % _("Feedrate Z Dispense"))
  6624. self.frz_dispense_label.setToolTip(
  6625. _("Feedrate (speed) while moving up vertically\n"
  6626. "to Dispense position (on Z plane).")
  6627. )
  6628. grid0.addWidget(self.frz_dispense_label, 10, 0)
  6629. grid0.addWidget(self.frz_dispense_entry, 10, 1)
  6630. # Spindle Speed Forward
  6631. self.speedfwd_entry = FCSpinner()
  6632. self.speedfwd_entry.set_range(0, 99999)
  6633. self.speedfwd_entry.set_step(1000)
  6634. self.speedfwd_label = QtWidgets.QLabel('%s:' % _("Spindle Speed FWD"))
  6635. self.speedfwd_label.setToolTip(
  6636. _("The dispenser speed while pushing solder paste\n"
  6637. "through the dispenser nozzle.")
  6638. )
  6639. grid0.addWidget(self.speedfwd_label, 11, 0)
  6640. grid0.addWidget(self.speedfwd_entry, 11, 1)
  6641. # Dwell Forward
  6642. self.dwellfwd_entry = FCDoubleSpinner()
  6643. self.dwellfwd_entry.set_precision(self.decimals)
  6644. self.dwellfwd_entry.set_range(0.0000001, 9999.9999)
  6645. self.dwellfwd_entry.setSingleStep(0.1)
  6646. self.dwellfwd_label = QtWidgets.QLabel('%s:' % _("Dwell FWD"))
  6647. self.dwellfwd_label.setToolTip(
  6648. _("Pause after solder dispensing.")
  6649. )
  6650. grid0.addWidget(self.dwellfwd_label, 12, 0)
  6651. grid0.addWidget(self.dwellfwd_entry, 12, 1)
  6652. # Spindle Speed Reverse
  6653. self.speedrev_entry = FCSpinner()
  6654. self.speedrev_entry.set_range(0, 999999)
  6655. self.speedrev_entry.set_step(1000)
  6656. self.speedrev_label = QtWidgets.QLabel('%s:' % _("Spindle Speed REV"))
  6657. self.speedrev_label.setToolTip(
  6658. _("The dispenser speed while retracting solder paste\n"
  6659. "through the dispenser nozzle.")
  6660. )
  6661. grid0.addWidget(self.speedrev_label, 13, 0)
  6662. grid0.addWidget(self.speedrev_entry, 13, 1)
  6663. # Dwell Reverse
  6664. self.dwellrev_entry = FCDoubleSpinner()
  6665. self.dwellrev_entry.set_precision(self.decimals)
  6666. self.dwellrev_entry.set_range(0.0000001, 9999.9999)
  6667. self.dwellrev_entry.setSingleStep(0.1)
  6668. self.dwellrev_label = QtWidgets.QLabel('%s:' % _("Dwell REV"))
  6669. self.dwellrev_label.setToolTip(
  6670. _("Pause after solder paste dispenser retracted,\n"
  6671. "to allow pressure equilibrium.")
  6672. )
  6673. grid0.addWidget(self.dwellrev_label, 14, 0)
  6674. grid0.addWidget(self.dwellrev_entry, 14, 1)
  6675. # Preprocessors
  6676. pp_label = QtWidgets.QLabel('%s:' % _('Preprocessor'))
  6677. pp_label.setToolTip(
  6678. _("Files that control the GCode generation.")
  6679. )
  6680. self.pp_combo = FCComboBox()
  6681. grid0.addWidget(pp_label, 15, 0)
  6682. grid0.addWidget(self.pp_combo, 15, 1)
  6683. self.layout.addStretch()
  6684. class ToolsSubPrefGroupUI(OptionsGroupUI):
  6685. def __init__(self, decimals=4, parent=None):
  6686. super(ToolsSubPrefGroupUI, self).__init__(self)
  6687. self.setTitle(str(_("Substractor Tool Options")))
  6688. self.decimals = decimals
  6689. # ## Subtractor Tool Parameters
  6690. self.sublabel = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  6691. self.sublabel.setToolTip(
  6692. _("A tool to substract one Gerber or Geometry object\n"
  6693. "from another of the same type.")
  6694. )
  6695. self.layout.addWidget(self.sublabel)
  6696. self.close_paths_cb = FCCheckBox(_("Close paths"))
  6697. self.close_paths_cb.setToolTip(_("Checking this will close the paths cut by the Geometry substractor object."))
  6698. self.layout.addWidget(self.close_paths_cb)
  6699. self.layout.addStretch()
  6700. class Tools2RulesCheckPrefGroupUI(OptionsGroupUI):
  6701. def __init__(self, decimals=4, parent=None):
  6702. super(Tools2RulesCheckPrefGroupUI, self).__init__(self)
  6703. self.setTitle(str(_("Check Rules Tool Options")))
  6704. self.decimals = decimals
  6705. self.crlabel = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  6706. self.crlabel.setToolTip(
  6707. _("A tool to check if Gerber files are within a set\n"
  6708. "of Manufacturing Rules.")
  6709. )
  6710. self.layout.addWidget(self.crlabel)
  6711. # Form Layout
  6712. self.form_layout_1 = QtWidgets.QFormLayout()
  6713. self.layout.addLayout(self.form_layout_1)
  6714. # Trace size
  6715. self.trace_size_cb = FCCheckBox('%s:' % _("Trace Size"))
  6716. self.trace_size_cb.setToolTip(
  6717. _("This checks if the minimum size for traces is met.")
  6718. )
  6719. self.form_layout_1.addRow(self.trace_size_cb)
  6720. # Trace size value
  6721. self.trace_size_entry = FCDoubleSpinner()
  6722. self.trace_size_entry.set_range(0.00001, 999.99999)
  6723. self.trace_size_entry.set_precision(self.decimals)
  6724. self.trace_size_entry.setSingleStep(0.1)
  6725. self.trace_size_lbl = QtWidgets.QLabel('%s:' % _("Min value"))
  6726. self.trace_size_lbl.setToolTip(
  6727. _("Minimum acceptable trace size.")
  6728. )
  6729. self.form_layout_1.addRow(self.trace_size_lbl, self.trace_size_entry)
  6730. # Copper2copper clearance
  6731. self.clearance_copper2copper_cb = FCCheckBox('%s:' % _("Copper to Copper clearance"))
  6732. self.clearance_copper2copper_cb.setToolTip(
  6733. _("This checks if the minimum clearance between copper\n"
  6734. "features is met.")
  6735. )
  6736. self.form_layout_1.addRow(self.clearance_copper2copper_cb)
  6737. # Copper2copper clearance value
  6738. self.clearance_copper2copper_entry = FCDoubleSpinner()
  6739. self.clearance_copper2copper_entry.set_range(0.00001, 999.99999)
  6740. self.clearance_copper2copper_entry.set_precision(self.decimals)
  6741. self.clearance_copper2copper_entry.setSingleStep(0.1)
  6742. self.clearance_copper2copper_lbl = QtWidgets.QLabel('%s:' % _("Min value"))
  6743. self.clearance_copper2copper_lbl.setToolTip(
  6744. _("Minimum acceptable clearance value.")
  6745. )
  6746. self.form_layout_1.addRow(self.clearance_copper2copper_lbl, self.clearance_copper2copper_entry)
  6747. # Copper2outline clearance
  6748. self.clearance_copper2ol_cb = FCCheckBox('%s:' % _("Copper to Outline clearance"))
  6749. self.clearance_copper2ol_cb.setToolTip(
  6750. _("This checks if the minimum clearance between copper\n"
  6751. "features and the outline is met.")
  6752. )
  6753. self.form_layout_1.addRow(self.clearance_copper2ol_cb)
  6754. # Copper2outline clearance value
  6755. self.clearance_copper2ol_entry = FCDoubleSpinner()
  6756. self.clearance_copper2ol_entry.set_range(0.00001, 999.99999)
  6757. self.clearance_copper2ol_entry.set_precision(self.decimals)
  6758. self.clearance_copper2ol_entry.setSingleStep(0.1)
  6759. self.clearance_copper2ol_lbl = QtWidgets.QLabel('%s:' % _("Min value"))
  6760. self.clearance_copper2ol_lbl.setToolTip(
  6761. _("Minimum acceptable clearance value.")
  6762. )
  6763. self.form_layout_1.addRow(self.clearance_copper2ol_lbl, self.clearance_copper2ol_entry)
  6764. # Silkscreen2silkscreen clearance
  6765. self.clearance_silk2silk_cb = FCCheckBox('%s:' % _("Silk to Silk Clearance"))
  6766. self.clearance_silk2silk_cb.setToolTip(
  6767. _("This checks if the minimum clearance between silkscreen\n"
  6768. "features and silkscreen features is met.")
  6769. )
  6770. self.form_layout_1.addRow(self.clearance_silk2silk_cb)
  6771. # Copper2silkscreen clearance value
  6772. self.clearance_silk2silk_entry = FCDoubleSpinner()
  6773. self.clearance_silk2silk_entry.set_range(0.00001, 999.99999)
  6774. self.clearance_silk2silk_entry.set_precision(self.decimals)
  6775. self.clearance_silk2silk_entry.setSingleStep(0.1)
  6776. self.clearance_silk2silk_lbl = QtWidgets.QLabel('%s:' % _("Min value"))
  6777. self.clearance_silk2silk_lbl.setToolTip(
  6778. _("Minimum acceptable clearance value.")
  6779. )
  6780. self.form_layout_1.addRow(self.clearance_silk2silk_lbl, self.clearance_silk2silk_entry)
  6781. # Silkscreen2soldermask clearance
  6782. self.clearance_silk2sm_cb = FCCheckBox('%s:' % _("Silk to Solder Mask Clearance"))
  6783. self.clearance_silk2sm_cb.setToolTip(
  6784. _("This checks if the minimum clearance between silkscreen\n"
  6785. "features and soldermask features is met.")
  6786. )
  6787. self.form_layout_1.addRow(self.clearance_silk2sm_cb)
  6788. # Silkscreen2soldermask clearance value
  6789. self.clearance_silk2sm_entry = FCDoubleSpinner()
  6790. self.clearance_silk2sm_entry.set_range(0.00001, 999.99999)
  6791. self.clearance_silk2sm_entry.set_precision(self.decimals)
  6792. self.clearance_silk2sm_entry.setSingleStep(0.1)
  6793. self.clearance_silk2sm_lbl = QtWidgets.QLabel('%s:' % _("Min value"))
  6794. self.clearance_silk2sm_lbl.setToolTip(
  6795. _("Minimum acceptable clearance value.")
  6796. )
  6797. self.form_layout_1.addRow(self.clearance_silk2sm_lbl, self.clearance_silk2sm_entry)
  6798. # Silk2outline clearance
  6799. self.clearance_silk2ol_cb = FCCheckBox('%s:' % _("Silk to Outline Clearance"))
  6800. self.clearance_silk2ol_cb.setToolTip(
  6801. _("This checks if the minimum clearance between silk\n"
  6802. "features and the outline is met.")
  6803. )
  6804. self.form_layout_1.addRow(self.clearance_silk2ol_cb)
  6805. # Silk2outline clearance value
  6806. self.clearance_silk2ol_entry = FCDoubleSpinner()
  6807. self.clearance_silk2ol_entry.set_range(0.00001, 999.99999)
  6808. self.clearance_silk2ol_entry.set_precision(self.decimals)
  6809. self.clearance_silk2ol_entry.setSingleStep(0.1)
  6810. self.clearance_silk2ol_lbl = QtWidgets.QLabel('%s:' % _("Min value"))
  6811. self.clearance_silk2ol_lbl.setToolTip(
  6812. _("Minimum acceptable clearance value.")
  6813. )
  6814. self.form_layout_1.addRow(self.clearance_silk2ol_lbl, self.clearance_silk2ol_entry)
  6815. # Soldermask2soldermask clearance
  6816. self.clearance_sm2sm_cb = FCCheckBox('%s:' % _("Minimum Solder Mask Sliver"))
  6817. self.clearance_sm2sm_cb.setToolTip(
  6818. _("This checks if the minimum clearance between soldermask\n"
  6819. "features and soldermask features is met.")
  6820. )
  6821. self.form_layout_1.addRow(self.clearance_sm2sm_cb)
  6822. # Soldermask2soldermask clearance value
  6823. self.clearance_sm2sm_entry = FCDoubleSpinner()
  6824. self.clearance_sm2sm_entry.set_range(0.00001, 999.99999)
  6825. self.clearance_sm2sm_entry.set_precision(self.decimals)
  6826. self.clearance_sm2sm_entry.setSingleStep(0.1)
  6827. self.clearance_sm2sm_lbl = QtWidgets.QLabel('%s:' % _("Min value"))
  6828. self.clearance_sm2sm_lbl.setToolTip(
  6829. _("Minimum acceptable clearance value.")
  6830. )
  6831. self.form_layout_1.addRow(self.clearance_sm2sm_lbl, self.clearance_sm2sm_entry)
  6832. # Ring integrity check
  6833. self.ring_integrity_cb = FCCheckBox('%s:' % _("Minimum Annular Ring"))
  6834. self.ring_integrity_cb.setToolTip(
  6835. _("This checks if the minimum copper ring left by drilling\n"
  6836. "a hole into a pad is met.")
  6837. )
  6838. self.form_layout_1.addRow(self.ring_integrity_cb)
  6839. # Ring integrity value
  6840. self.ring_integrity_entry = FCDoubleSpinner()
  6841. self.ring_integrity_entry.set_range(0.00001, 999.99999)
  6842. self.ring_integrity_entry.set_precision(self.decimals)
  6843. self.ring_integrity_entry.setSingleStep(0.1)
  6844. self.ring_integrity_lbl = QtWidgets.QLabel('%s:' % _("Min value"))
  6845. self.ring_integrity_lbl.setToolTip(
  6846. _("Minimum acceptable ring value.")
  6847. )
  6848. self.form_layout_1.addRow(self.ring_integrity_lbl, self.ring_integrity_entry)
  6849. self.form_layout_1.addRow(QtWidgets.QLabel(""))
  6850. # Hole2Hole clearance
  6851. self.clearance_d2d_cb = FCCheckBox('%s:' % _("Hole to Hole Clearance"))
  6852. self.clearance_d2d_cb.setToolTip(
  6853. _("This checks if the minimum clearance between a drill hole\n"
  6854. "and another drill hole is met.")
  6855. )
  6856. self.form_layout_1.addRow(self.clearance_d2d_cb)
  6857. # Hole2Hole clearance value
  6858. self.clearance_d2d_entry = FCDoubleSpinner()
  6859. self.clearance_d2d_entry.set_range(0.00001, 999.99999)
  6860. self.clearance_d2d_entry.set_precision(self.decimals)
  6861. self.clearance_d2d_entry.setSingleStep(0.1)
  6862. self.clearance_d2d_lbl = QtWidgets.QLabel('%s:' % _("Min value"))
  6863. self.clearance_d2d_lbl.setToolTip(
  6864. _("Minimum acceptable drill size.")
  6865. )
  6866. self.form_layout_1.addRow(self.clearance_d2d_lbl, self.clearance_d2d_entry)
  6867. # Drill holes size check
  6868. self.drill_size_cb = FCCheckBox('%s:' % _("Hole Size"))
  6869. self.drill_size_cb.setToolTip(
  6870. _("This checks if the drill holes\n"
  6871. "sizes are above the threshold.")
  6872. )
  6873. self.form_layout_1.addRow(self.drill_size_cb)
  6874. # Drile holes value
  6875. self.drill_size_entry = FCDoubleSpinner()
  6876. self.drill_size_entry.set_range(0.00001, 999.99999)
  6877. self.drill_size_entry.set_precision(self.decimals)
  6878. self.drill_size_entry.setSingleStep(0.1)
  6879. self.drill_size_lbl = QtWidgets.QLabel('%s:' % _("Min value"))
  6880. self.drill_size_lbl.setToolTip(
  6881. _("Minimum acceptable clearance value.")
  6882. )
  6883. self.form_layout_1.addRow(self.drill_size_lbl, self.drill_size_entry)
  6884. self.layout.addStretch()
  6885. class Tools2OptimalPrefGroupUI(OptionsGroupUI):
  6886. def __init__(self, decimals=4, parent=None):
  6887. super(Tools2OptimalPrefGroupUI, self).__init__(self)
  6888. self.setTitle(str(_("Optimal Tool Options")))
  6889. self.decimals = decimals
  6890. # ## Parameters
  6891. self.optlabel = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  6892. self.optlabel.setToolTip(
  6893. _("A tool to find the minimum distance between\n"
  6894. "every two Gerber geometric elements")
  6895. )
  6896. self.layout.addWidget(self.optlabel)
  6897. grid0 = QtWidgets.QGridLayout()
  6898. self.layout.addLayout(grid0)
  6899. grid0.setColumnStretch(0, 0)
  6900. grid0.setColumnStretch(1, 1)
  6901. self.precision_sp = FCSpinner()
  6902. self.precision_sp.set_range(2, 10)
  6903. self.precision_sp.set_step(1)
  6904. self.precision_sp.setWrapping(True)
  6905. self.precision_lbl = QtWidgets.QLabel('%s:' % _("Precision"))
  6906. self.precision_lbl.setToolTip(
  6907. _("Number of decimals for the distances and coordinates in this tool.")
  6908. )
  6909. grid0.addWidget(self.precision_lbl, 0, 0)
  6910. grid0.addWidget(self.precision_sp, 0, 1)
  6911. self.layout.addStretch()
  6912. class Tools2QRCodePrefGroupUI(OptionsGroupUI):
  6913. def __init__(self, decimals=4, parent=None):
  6914. super(Tools2QRCodePrefGroupUI, self).__init__(self)
  6915. self.setTitle(str(_("QRCode Tool Options")))
  6916. self.decimals = decimals
  6917. # ## Parameters
  6918. self.qrlabel = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  6919. self.qrlabel.setToolTip(
  6920. _("A tool to create a QRCode that can be inserted\n"
  6921. "into a selected Gerber file, or it can be exported as a file.")
  6922. )
  6923. self.layout.addWidget(self.qrlabel)
  6924. # ## Grid Layout
  6925. grid_lay = QtWidgets.QGridLayout()
  6926. self.layout.addLayout(grid_lay)
  6927. grid_lay.setColumnStretch(0, 0)
  6928. grid_lay.setColumnStretch(1, 1)
  6929. # VERSION #
  6930. self.version_label = QtWidgets.QLabel('%s:' % _("Version"))
  6931. self.version_label.setToolTip(
  6932. _("QRCode version can have values from 1 (21x21 boxes)\n"
  6933. "to 40 (177x177 boxes).")
  6934. )
  6935. self.version_entry = FCSpinner()
  6936. self.version_entry.set_range(1, 40)
  6937. self.version_entry.setWrapping(True)
  6938. grid_lay.addWidget(self.version_label, 1, 0)
  6939. grid_lay.addWidget(self.version_entry, 1, 1)
  6940. # ERROR CORRECTION #
  6941. self.error_label = QtWidgets.QLabel('%s:' % _("Error correction"))
  6942. self.error_label.setToolTip(
  6943. _("Parameter that controls the error correction used for the QR Code.\n"
  6944. "L = maximum 7%% errors can be corrected\n"
  6945. "M = maximum 15%% errors can be corrected\n"
  6946. "Q = maximum 25%% errors can be corrected\n"
  6947. "H = maximum 30%% errors can be corrected.")
  6948. )
  6949. self.error_radio = RadioSet([{'label': 'L', 'value': 'L'},
  6950. {'label': 'M', 'value': 'M'},
  6951. {'label': 'Q', 'value': 'Q'},
  6952. {'label': 'H', 'value': 'H'}])
  6953. self.error_radio.setToolTip(
  6954. _("Parameter that controls the error correction used for the QR Code.\n"
  6955. "L = maximum 7%% errors can be corrected\n"
  6956. "M = maximum 15%% errors can be corrected\n"
  6957. "Q = maximum 25%% errors can be corrected\n"
  6958. "H = maximum 30%% errors can be corrected.")
  6959. )
  6960. grid_lay.addWidget(self.error_label, 2, 0)
  6961. grid_lay.addWidget(self.error_radio, 2, 1)
  6962. # BOX SIZE #
  6963. self.bsize_label = QtWidgets.QLabel('%s:' % _("Box Size"))
  6964. self.bsize_label.setToolTip(
  6965. _("Box size control the overall size of the QRcode\n"
  6966. "by adjusting the size of each box in the code.")
  6967. )
  6968. self.bsize_entry = FCSpinner()
  6969. self.bsize_entry.set_range(1, 9999)
  6970. self.bsize_entry.setWrapping(True)
  6971. grid_lay.addWidget(self.bsize_label, 3, 0)
  6972. grid_lay.addWidget(self.bsize_entry, 3, 1)
  6973. # BORDER SIZE #
  6974. self.border_size_label = QtWidgets.QLabel('%s:' % _("Border Size"))
  6975. self.border_size_label.setToolTip(
  6976. _("Size of the QRCode border. How many boxes thick is the border.\n"
  6977. "Default value is 4. The width of the clearance around the QRCode.")
  6978. )
  6979. self.border_size_entry = FCSpinner()
  6980. self.border_size_entry.set_range(1, 9999)
  6981. self.border_size_entry.setWrapping(True)
  6982. grid_lay.addWidget(self.border_size_label, 4, 0)
  6983. grid_lay.addWidget(self.border_size_entry, 4, 1)
  6984. # Text box
  6985. self.text_label = QtWidgets.QLabel('%s:' % _("QRCode Data"))
  6986. self.text_label.setToolTip(
  6987. _("QRCode Data. Alphanumeric text to be encoded in the QRCode.")
  6988. )
  6989. self.text_data = FCTextArea()
  6990. self.text_data.setPlaceholderText(
  6991. _("Add here the text to be included in the QRCode...")
  6992. )
  6993. grid_lay.addWidget(self.text_label, 5, 0)
  6994. grid_lay.addWidget(self.text_data, 6, 0, 1, 2)
  6995. # POLARITY CHOICE #
  6996. self.pol_label = QtWidgets.QLabel('%s:' % _("Polarity"))
  6997. self.pol_label.setToolTip(
  6998. _("Choose the polarity of the QRCode.\n"
  6999. "It can be drawn in a negative way (squares are clear)\n"
  7000. "or in a positive way (squares are opaque).")
  7001. )
  7002. self.pol_radio = RadioSet([{'label': _('Negative'), 'value': 'neg'},
  7003. {'label': _('Positive'), 'value': 'pos'}])
  7004. self.pol_radio.setToolTip(
  7005. _("Choose the type of QRCode to be created.\n"
  7006. "If added on a Silkscreen Gerber file the QRCode may\n"
  7007. "be added as positive. If it is added to a Copper Gerber\n"
  7008. "file then perhaps the QRCode can be added as negative.")
  7009. )
  7010. grid_lay.addWidget(self.pol_label, 7, 0)
  7011. grid_lay.addWidget(self.pol_radio, 7, 1)
  7012. # BOUNDING BOX TYPE #
  7013. self.bb_label = QtWidgets.QLabel('%s:' % _("Bounding Box"))
  7014. self.bb_label.setToolTip(
  7015. _("The bounding box, meaning the empty space that surrounds\n"
  7016. "the QRCode geometry, can have a rounded or a square shape.")
  7017. )
  7018. self.bb_radio = RadioSet([{'label': _('Rounded'), 'value': 'r'},
  7019. {'label': _('Square'), 'value': 's'}])
  7020. self.bb_radio.setToolTip(
  7021. _("The bounding box, meaning the empty space that surrounds\n"
  7022. "the QRCode geometry, can have a rounded or a square shape.")
  7023. )
  7024. grid_lay.addWidget(self.bb_label, 8, 0)
  7025. grid_lay.addWidget(self.bb_radio, 8, 1)
  7026. # FILL COLOR #
  7027. self.fill_color_label = QtWidgets.QLabel('%s:' % _('Fill Color'))
  7028. self.fill_color_label.setToolTip(
  7029. _("Set the QRCode fill color (squares color).")
  7030. )
  7031. self.fill_color_entry = FCEntry()
  7032. self.fill_color_button = QtWidgets.QPushButton()
  7033. self.fill_color_button.setFixedSize(15, 15)
  7034. fill_lay_child = QtWidgets.QHBoxLayout()
  7035. fill_lay_child.setContentsMargins(0, 0, 0, 0)
  7036. fill_lay_child.addWidget(self.fill_color_entry)
  7037. fill_lay_child.addWidget(self.fill_color_button, alignment=Qt.AlignRight)
  7038. fill_lay_child.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  7039. fill_color_widget = QtWidgets.QWidget()
  7040. fill_color_widget.setLayout(fill_lay_child)
  7041. grid_lay.addWidget(self.fill_color_label, 9, 0)
  7042. grid_lay.addWidget(fill_color_widget, 9, 1)
  7043. # BACK COLOR #
  7044. self.back_color_label = QtWidgets.QLabel('%s:' % _('Back Color'))
  7045. self.back_color_label.setToolTip(
  7046. _("Set the QRCode background color.")
  7047. )
  7048. self.back_color_entry = FCEntry()
  7049. self.back_color_button = QtWidgets.QPushButton()
  7050. self.back_color_button.setFixedSize(15, 15)
  7051. back_lay_child = QtWidgets.QHBoxLayout()
  7052. back_lay_child.setContentsMargins(0, 0, 0, 0)
  7053. back_lay_child.addWidget(self.back_color_entry)
  7054. back_lay_child.addWidget(self.back_color_button, alignment=Qt.AlignRight)
  7055. back_lay_child.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  7056. back_color_widget = QtWidgets.QWidget()
  7057. back_color_widget.setLayout(back_lay_child)
  7058. grid_lay.addWidget(self.back_color_label, 10, 0)
  7059. grid_lay.addWidget(back_color_widget, 10, 1)
  7060. # Selection Limit
  7061. self.sel_limit_label = QtWidgets.QLabel('%s:' % _("Selection limit"))
  7062. self.sel_limit_label.setToolTip(
  7063. _("Set the number of selected geometry\n"
  7064. "items above which the utility geometry\n"
  7065. "becomes just a selection rectangle.\n"
  7066. "Increases the performance when moving a\n"
  7067. "large number of geometric elements.")
  7068. )
  7069. self.sel_limit_entry = FCSpinner()
  7070. self.sel_limit_entry.set_range(0, 9999)
  7071. grid_lay.addWidget(self.sel_limit_label, 11, 0)
  7072. grid_lay.addWidget(self.sel_limit_entry, 11, 1)
  7073. # self.layout.addStretch()
  7074. class Tools2CThievingPrefGroupUI(OptionsGroupUI):
  7075. def __init__(self, decimals=4, parent=None):
  7076. super(Tools2CThievingPrefGroupUI, self).__init__(self)
  7077. self.setTitle(str(_("Copper Thieving Tool Options")))
  7078. self.decimals = decimals
  7079. # ## Grid Layout
  7080. grid_lay = QtWidgets.QGridLayout()
  7081. self.layout.addLayout(grid_lay)
  7082. grid_lay.setColumnStretch(0, 0)
  7083. grid_lay.setColumnStretch(1, 1)
  7084. # ## Parameters
  7085. self.cflabel = QtWidgets.QLabel('<b>%s</b>' % _('Parameters'))
  7086. self.cflabel.setToolTip(
  7087. _("A tool to generate a Copper Thieving that can be added\n"
  7088. "to a selected Gerber file.")
  7089. )
  7090. grid_lay.addWidget(self.cflabel, 0, 0, 1, 2)
  7091. # CIRCLE STEPS - to be used when buffering
  7092. self.circle_steps_lbl = QtWidgets.QLabel('%s:' % _("Circle Steps"))
  7093. self.circle_steps_lbl.setToolTip(
  7094. _("Number of steps (lines) used to interpolate circles.")
  7095. )
  7096. self.circlesteps_entry = FCSpinner()
  7097. self.circlesteps_entry.set_range(1, 9999)
  7098. grid_lay.addWidget(self.circle_steps_lbl, 1, 0)
  7099. grid_lay.addWidget(self.circlesteps_entry, 1, 1)
  7100. # CLEARANCE #
  7101. self.clearance_label = QtWidgets.QLabel('%s:' % _("Clearance"))
  7102. self.clearance_label.setToolTip(
  7103. _("This set the distance between the copper Thieving components\n"
  7104. "(the polygon fill may be split in multiple polygons)\n"
  7105. "and the copper traces in the Gerber file.")
  7106. )
  7107. self.clearance_entry = FCDoubleSpinner()
  7108. self.clearance_entry.setMinimum(0.00001)
  7109. self.clearance_entry.set_precision(self.decimals)
  7110. self.clearance_entry.setSingleStep(0.1)
  7111. grid_lay.addWidget(self.clearance_label, 2, 0)
  7112. grid_lay.addWidget(self.clearance_entry, 2, 1)
  7113. # MARGIN #
  7114. self.margin_label = QtWidgets.QLabel('%s:' % _("Margin"))
  7115. self.margin_label.setToolTip(
  7116. _("Bounding box margin.")
  7117. )
  7118. self.margin_entry = FCDoubleSpinner()
  7119. self.margin_entry.setMinimum(0.0)
  7120. self.margin_entry.set_precision(self.decimals)
  7121. self.margin_entry.setSingleStep(0.1)
  7122. grid_lay.addWidget(self.margin_label, 3, 0)
  7123. grid_lay.addWidget(self.margin_entry, 3, 1)
  7124. # Reference #
  7125. self.reference_radio = RadioSet([
  7126. {'label': _('Itself'), 'value': 'itself'},
  7127. {"label": _("Area Selection"), "value": "area"},
  7128. {'label': _("Reference Object"), 'value': 'box'}
  7129. ], orientation='vertical', stretch=False)
  7130. self.reference_label = QtWidgets.QLabel(_("Reference:"))
  7131. self.reference_label.setToolTip(
  7132. _("- 'Itself' - the copper Thieving extent is based on the object extent.\n"
  7133. "- 'Area Selection' - left mouse click to start selection of the area to be filled.\n"
  7134. "- 'Reference Object' - will do copper thieving within the area specified by another object.")
  7135. )
  7136. grid_lay.addWidget(self.reference_label, 4, 0)
  7137. grid_lay.addWidget(self.reference_radio, 4, 1)
  7138. # Bounding Box Type #
  7139. self.bbox_type_radio = RadioSet([
  7140. {'label': _('Rectangular'), 'value': 'rect'},
  7141. {"label": _("Minimal"), "value": "min"}
  7142. ], stretch=False)
  7143. self.bbox_type_label = QtWidgets.QLabel(_("Box Type:"))
  7144. self.bbox_type_label.setToolTip(
  7145. _("- 'Rectangular' - the bounding box will be of rectangular shape.\n"
  7146. "- 'Minimal' - the bounding box will be the convex hull shape.")
  7147. )
  7148. grid_lay.addWidget(self.bbox_type_label, 5, 0)
  7149. grid_lay.addWidget(self.bbox_type_radio, 5, 1)
  7150. separator_line = QtWidgets.QFrame()
  7151. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  7152. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  7153. grid_lay.addWidget(separator_line, 6, 0, 1, 2)
  7154. # Fill Type
  7155. self.fill_type_radio = RadioSet([
  7156. {'label': _('Solid'), 'value': 'solid'},
  7157. {"label": _("Dots Grid"), "value": "dot"},
  7158. {"label": _("Squares Grid"), "value": "square"},
  7159. {"label": _("Lines Grid"), "value": "line"}
  7160. ], orientation='vertical', stretch=False)
  7161. self.fill_type_label = QtWidgets.QLabel(_("Fill Type:"))
  7162. self.fill_type_label.setToolTip(
  7163. _("- 'Solid' - copper thieving will be a solid polygon.\n"
  7164. "- 'Dots Grid' - the empty area will be filled with a pattern of dots.\n"
  7165. "- 'Squares Grid' - the empty area will be filled with a pattern of squares.\n"
  7166. "- 'Lines Grid' - the empty area will be filled with a pattern of lines.")
  7167. )
  7168. grid_lay.addWidget(self.fill_type_label, 7, 0)
  7169. grid_lay.addWidget(self.fill_type_radio, 7, 1)
  7170. self.dots_label = QtWidgets.QLabel('<b>%s</b>:' % _("Dots Grid Parameters"))
  7171. grid_lay.addWidget(self.dots_label, 8, 0, 1, 2)
  7172. # Dot diameter #
  7173. self.dotdia_label = QtWidgets.QLabel('%s:' % _("Dia"))
  7174. self.dotdia_label.setToolTip(
  7175. _("Dot diameter in Dots Grid.")
  7176. )
  7177. self.dot_dia_entry = FCDoubleSpinner()
  7178. self.dot_dia_entry.set_range(0.0, 9999.9999)
  7179. self.dot_dia_entry.set_precision(self.decimals)
  7180. self.dot_dia_entry.setSingleStep(0.1)
  7181. grid_lay.addWidget(self.dotdia_label, 9, 0)
  7182. grid_lay.addWidget(self.dot_dia_entry, 9, 1)
  7183. # Dot spacing #
  7184. self.dotspacing_label = QtWidgets.QLabel('%s:' % _("Spacing"))
  7185. self.dotspacing_label.setToolTip(
  7186. _("Distance between each two dots in Dots Grid.")
  7187. )
  7188. self.dot_spacing_entry = FCDoubleSpinner()
  7189. self.dot_spacing_entry.set_range(0.0, 9999.9999)
  7190. self.dot_spacing_entry.set_precision(self.decimals)
  7191. self.dot_spacing_entry.setSingleStep(0.1)
  7192. grid_lay.addWidget(self.dotspacing_label, 10, 0)
  7193. grid_lay.addWidget(self.dot_spacing_entry, 10, 1)
  7194. self.squares_label = QtWidgets.QLabel('<b>%s</b>:' % _("Squares Grid Parameters"))
  7195. grid_lay.addWidget(self.squares_label, 11, 0, 1, 2)
  7196. # Square Size #
  7197. self.square_size_label = QtWidgets.QLabel('%s:' % _("Size"))
  7198. self.square_size_label.setToolTip(
  7199. _("Square side size in Squares Grid.")
  7200. )
  7201. self.square_size_entry = FCDoubleSpinner()
  7202. self.square_size_entry.set_range(0.0, 9999.9999)
  7203. self.square_size_entry.set_precision(self.decimals)
  7204. self.square_size_entry.setSingleStep(0.1)
  7205. grid_lay.addWidget(self.square_size_label, 12, 0)
  7206. grid_lay.addWidget(self.square_size_entry, 12, 1)
  7207. # Squares spacing #
  7208. self.squares_spacing_label = QtWidgets.QLabel('%s:' % _("Spacing"))
  7209. self.squares_spacing_label.setToolTip(
  7210. _("Distance between each two squares in Squares Grid.")
  7211. )
  7212. self.squares_spacing_entry = FCDoubleSpinner()
  7213. self.squares_spacing_entry.set_range(0.0, 9999.9999)
  7214. self.squares_spacing_entry.set_precision(self.decimals)
  7215. self.squares_spacing_entry.setSingleStep(0.1)
  7216. grid_lay.addWidget(self.squares_spacing_label, 13, 0)
  7217. grid_lay.addWidget(self.squares_spacing_entry, 13, 1)
  7218. self.lines_label = QtWidgets.QLabel('<b>%s</b>:' % _("Lines Grid Parameters"))
  7219. grid_lay.addWidget(self.lines_label, 14, 0, 1, 2)
  7220. # Square Size #
  7221. self.line_size_label = QtWidgets.QLabel('%s:' % _("Size"))
  7222. self.line_size_label.setToolTip(
  7223. _("Line thickness size in Lines Grid.")
  7224. )
  7225. self.line_size_entry = FCDoubleSpinner()
  7226. self.line_size_entry.set_range(0.0, 9999.9999)
  7227. self.line_size_entry.set_precision(self.decimals)
  7228. self.line_size_entry.setSingleStep(0.1)
  7229. grid_lay.addWidget(self.line_size_label, 15, 0)
  7230. grid_lay.addWidget(self.line_size_entry, 15, 1)
  7231. # Lines spacing #
  7232. self.lines_spacing_label = QtWidgets.QLabel('%s:' % _("Spacing"))
  7233. self.lines_spacing_label.setToolTip(
  7234. _("Distance between each two lines in Lines Grid.")
  7235. )
  7236. self.lines_spacing_entry = FCDoubleSpinner()
  7237. self.lines_spacing_entry.set_range(0.0, 9999.9999)
  7238. self.lines_spacing_entry.set_precision(self.decimals)
  7239. self.lines_spacing_entry.setSingleStep(0.1)
  7240. grid_lay.addWidget(self.lines_spacing_label, 16, 0)
  7241. grid_lay.addWidget(self.lines_spacing_entry, 16, 1)
  7242. self.robber_bar_label = QtWidgets.QLabel('<b>%s</b>' % _('Robber Bar Parameters'))
  7243. self.robber_bar_label.setToolTip(
  7244. _("Parameters used for the robber bar.\n"
  7245. "Robber bar = copper border to help in pattern hole plating.")
  7246. )
  7247. grid_lay.addWidget(self.robber_bar_label, 17, 0, 1, 2)
  7248. # ROBBER BAR MARGIN #
  7249. self.rb_margin_label = QtWidgets.QLabel('%s:' % _("Margin"))
  7250. self.rb_margin_label.setToolTip(
  7251. _("Bounding box margin for robber bar.")
  7252. )
  7253. self.rb_margin_entry = FCDoubleSpinner()
  7254. self.rb_margin_entry.set_range(-9999.9999, 9999.9999)
  7255. self.rb_margin_entry.set_precision(self.decimals)
  7256. self.rb_margin_entry.setSingleStep(0.1)
  7257. grid_lay.addWidget(self.rb_margin_label, 18, 0)
  7258. grid_lay.addWidget(self.rb_margin_entry, 18, 1)
  7259. # THICKNESS #
  7260. self.rb_thickness_label = QtWidgets.QLabel('%s:' % _("Thickness"))
  7261. self.rb_thickness_label.setToolTip(
  7262. _("The robber bar thickness.")
  7263. )
  7264. self.rb_thickness_entry = FCDoubleSpinner()
  7265. self.rb_thickness_entry.set_range(0.0000, 9999.9999)
  7266. self.rb_thickness_entry.set_precision(self.decimals)
  7267. self.rb_thickness_entry.setSingleStep(0.1)
  7268. grid_lay.addWidget(self.rb_thickness_label, 19, 0)
  7269. grid_lay.addWidget(self.rb_thickness_entry, 19, 1)
  7270. self.patern_mask_label = QtWidgets.QLabel('<b>%s</b>' % _('Pattern Plating Mask'))
  7271. self.patern_mask_label.setToolTip(
  7272. _("Generate a mask for pattern plating.")
  7273. )
  7274. grid_lay.addWidget(self.patern_mask_label, 20, 0, 1, 2)
  7275. # Openings CLEARANCE #
  7276. self.clearance_ppm_label = QtWidgets.QLabel('%s:' % _("Clearance"))
  7277. self.clearance_ppm_label.setToolTip(
  7278. _("The distance between the possible copper thieving elements\n"
  7279. "and/or robber bar and the actual openings in the mask.")
  7280. )
  7281. self.clearance_ppm_entry = FCDoubleSpinner()
  7282. self.clearance_ppm_entry.set_range(-9999.9999, 9999.9999)
  7283. self.clearance_ppm_entry.set_precision(self.decimals)
  7284. self.clearance_ppm_entry.setSingleStep(0.1)
  7285. grid_lay.addWidget(self.clearance_ppm_label, 21, 0)
  7286. grid_lay.addWidget(self.clearance_ppm_entry, 21, 1)
  7287. self.layout.addStretch()
  7288. class Tools2FiducialsPrefGroupUI(OptionsGroupUI):
  7289. def __init__(self, decimals=4, parent=None):
  7290. super(Tools2FiducialsPrefGroupUI, self).__init__(self)
  7291. self.setTitle(str(_("Fiducials Tool Options")))
  7292. self.decimals = decimals
  7293. # ## Grid Layout
  7294. grid_lay = QtWidgets.QGridLayout()
  7295. self.layout.addLayout(grid_lay)
  7296. grid_lay.setColumnStretch(0, 0)
  7297. grid_lay.setColumnStretch(1, 1)
  7298. self.param_label = QtWidgets.QLabel('<b>%s:</b>' % _('Parameters'))
  7299. self.param_label.setToolTip(
  7300. _("Parameters used for this tool.")
  7301. )
  7302. grid_lay.addWidget(self.param_label, 0, 0, 1, 2)
  7303. # DIAMETER #
  7304. self.dia_label = QtWidgets.QLabel('%s:' % _("Size"))
  7305. self.dia_label.setToolTip(
  7306. _("This set the fiducial diameter if fiducial type is circular,\n"
  7307. "otherwise is the size of the fiducial.\n"
  7308. "The soldermask opening is double than that.")
  7309. )
  7310. self.dia_entry = FCDoubleSpinner()
  7311. self.dia_entry.set_range(1.0000, 3.0000)
  7312. self.dia_entry.set_precision(self.decimals)
  7313. self.dia_entry.setWrapping(True)
  7314. self.dia_entry.setSingleStep(0.1)
  7315. grid_lay.addWidget(self.dia_label, 1, 0)
  7316. grid_lay.addWidget(self.dia_entry, 1, 1)
  7317. # MARGIN #
  7318. self.margin_label = QtWidgets.QLabel('%s:' % _("Margin"))
  7319. self.margin_label.setToolTip(
  7320. _("Bounding box margin.")
  7321. )
  7322. self.margin_entry = FCDoubleSpinner()
  7323. self.margin_entry.set_range(-9999.9999, 9999.9999)
  7324. self.margin_entry.set_precision(self.decimals)
  7325. self.margin_entry.setSingleStep(0.1)
  7326. grid_lay.addWidget(self.margin_label, 2, 0)
  7327. grid_lay.addWidget(self.margin_entry, 2, 1)
  7328. # Mode #
  7329. self.mode_radio = RadioSet([
  7330. {'label': _('Auto'), 'value': 'auto'},
  7331. {"label": _("Manual"), "value": "manual"}
  7332. ], stretch=False)
  7333. self.mode_label = QtWidgets.QLabel(_("Mode:"))
  7334. self.mode_label.setToolTip(
  7335. _("- 'Auto' - automatic placement of fiducials in the corners of the bounding box.\n"
  7336. "- 'Manual' - manual placement of fiducials.")
  7337. )
  7338. grid_lay.addWidget(self.mode_label, 3, 0)
  7339. grid_lay.addWidget(self.mode_radio, 3, 1)
  7340. # Position for second fiducial #
  7341. self.pos_radio = RadioSet([
  7342. {'label': _('Up'), 'value': 'up'},
  7343. {"label": _("Down"), "value": "down"},
  7344. {"label": _("None"), "value": "no"}
  7345. ], stretch=False)
  7346. self.pos_label = QtWidgets.QLabel('%s:' % _("Second fiducial"))
  7347. self.pos_label.setToolTip(
  7348. _("The position for the second fiducial.\n"
  7349. "- 'Up' - the order is: bottom-left, top-left, top-right.\n"
  7350. "- 'Down' - the order is: bottom-left, bottom-right, top-right.\n"
  7351. "- 'None' - there is no second fiducial. The order is: bottom-left, top-right.")
  7352. )
  7353. grid_lay.addWidget(self.pos_label, 4, 0)
  7354. grid_lay.addWidget(self.pos_radio, 4, 1)
  7355. separator_line = QtWidgets.QFrame()
  7356. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  7357. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  7358. grid_lay.addWidget(separator_line, 5, 0, 1, 2)
  7359. # Fiducial type #
  7360. self.fid_type_radio = RadioSet([
  7361. {'label': _('Circular'), 'value': 'circular'},
  7362. {"label": _("Cross"), "value": "cross"},
  7363. {"label": _("Chess"), "value": "chess"}
  7364. ], stretch=False)
  7365. self.fid_type_label = QtWidgets.QLabel('%s:' % _("Fiducial Type"))
  7366. self.fid_type_label.setToolTip(
  7367. _("The type of fiducial.\n"
  7368. "- 'Circular' - this is the regular fiducial.\n"
  7369. "- 'Cross' - cross lines fiducial.\n"
  7370. "- 'Chess' - chess pattern fiducial.")
  7371. )
  7372. grid_lay.addWidget(self.fid_type_label, 6, 0)
  7373. grid_lay.addWidget(self.fid_type_radio, 6, 1)
  7374. # Line Thickness #
  7375. self.line_thickness_label = QtWidgets.QLabel('%s:' % _("Line thickness"))
  7376. self.line_thickness_label.setToolTip(
  7377. _("Bounding box margin.")
  7378. )
  7379. self.line_thickness_entry = FCDoubleSpinner()
  7380. self.line_thickness_entry.set_range(0.00001, 9999.9999)
  7381. self.line_thickness_entry.set_precision(self.decimals)
  7382. self.line_thickness_entry.setSingleStep(0.1)
  7383. grid_lay.addWidget(self.line_thickness_label, 7, 0)
  7384. grid_lay.addWidget(self.line_thickness_entry, 7, 1)
  7385. self.layout.addStretch()
  7386. class Tools2CalPrefGroupUI(OptionsGroupUI):
  7387. def __init__(self, decimals=4, parent=None):
  7388. super(Tools2CalPrefGroupUI, self).__init__(self)
  7389. self.setTitle(str(_("Calibration Tool Options")))
  7390. self.decimals = decimals
  7391. # ## Grid Layout
  7392. grid_lay = QtWidgets.QGridLayout()
  7393. self.layout.addLayout(grid_lay)
  7394. grid_lay.setColumnStretch(0, 0)
  7395. grid_lay.setColumnStretch(1, 1)
  7396. self.param_label = QtWidgets.QLabel('<b>%s:</b>' % _('Parameters'))
  7397. self.param_label.setToolTip(
  7398. _("Parameters used for this tool.")
  7399. )
  7400. grid_lay.addWidget(self.param_label, 0, 0, 1, 2)
  7401. # Calibration source
  7402. self.cal_source_lbl = QtWidgets.QLabel("<b>%s:</b>" % _("Source Type"))
  7403. self.cal_source_lbl.setToolTip(_("The source of calibration points.\n"
  7404. "It can be:\n"
  7405. "- Object -> click a hole geo for Excellon or a pad for Gerber\n"
  7406. "- Free -> click freely on canvas to acquire the calibration points"))
  7407. self.cal_source_radio = RadioSet([{'label': _('Object'), 'value': 'object'},
  7408. {'label': _('Free'), 'value': 'free'}],
  7409. stretch=False)
  7410. grid_lay.addWidget(self.cal_source_lbl, 1, 0)
  7411. grid_lay.addWidget(self.cal_source_radio, 1, 1, 1, 2)
  7412. separator_line = QtWidgets.QFrame()
  7413. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  7414. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  7415. grid_lay.addWidget(separator_line, 2, 0, 1, 2)
  7416. # Travel Z entry
  7417. travelz_lbl = QtWidgets.QLabel('%s:' % _("Travel Z"))
  7418. travelz_lbl.setToolTip(
  7419. _("Height (Z) for travelling between the points.")
  7420. )
  7421. self.travelz_entry = FCDoubleSpinner()
  7422. self.travelz_entry.set_range(-9999.9999, 9999.9999)
  7423. self.travelz_entry.set_precision(self.decimals)
  7424. self.travelz_entry.setSingleStep(0.1)
  7425. grid_lay.addWidget(travelz_lbl, 3, 0)
  7426. grid_lay.addWidget(self.travelz_entry, 3, 1, 1, 2)
  7427. # Verification Z entry
  7428. verz_lbl = QtWidgets.QLabel('%s:' % _("Verification Z"))
  7429. verz_lbl.setToolTip(
  7430. _("Height (Z) for checking the point.")
  7431. )
  7432. self.verz_entry = FCDoubleSpinner()
  7433. self.verz_entry.set_range(-9999.9999, 9999.9999)
  7434. self.verz_entry.set_precision(self.decimals)
  7435. self.verz_entry.setSingleStep(0.1)
  7436. grid_lay.addWidget(verz_lbl, 4, 0)
  7437. grid_lay.addWidget(self.verz_entry, 4, 1, 1, 2)
  7438. # Zero the Z of the verification tool
  7439. self.zeroz_cb = FCCheckBox('%s' % _("Zero Z tool"))
  7440. self.zeroz_cb.setToolTip(
  7441. _("Include a sequence to zero the height (Z)\n"
  7442. "of the verification tool.")
  7443. )
  7444. grid_lay.addWidget(self.zeroz_cb, 5, 0, 1, 3)
  7445. # Toochange Z entry
  7446. toolchangez_lbl = QtWidgets.QLabel('%s:' % _("Toolchange Z"))
  7447. toolchangez_lbl.setToolTip(
  7448. _("Height (Z) for mounting the verification probe.")
  7449. )
  7450. self.toolchangez_entry = FCDoubleSpinner()
  7451. self.toolchangez_entry.set_range(0.0000, 9999.9999)
  7452. self.toolchangez_entry.set_precision(self.decimals)
  7453. self.toolchangez_entry.setSingleStep(0.1)
  7454. grid_lay.addWidget(toolchangez_lbl, 6, 0)
  7455. grid_lay.addWidget(self.toolchangez_entry, 6, 1, 1, 2)
  7456. # Toolchange X-Y entry
  7457. toolchangexy_lbl = QtWidgets.QLabel('%s:' % _('Toolchange X-Y'))
  7458. toolchangexy_lbl.setToolTip(
  7459. _("Toolchange X,Y position.\n"
  7460. "If no value is entered then the current\n"
  7461. "(x, y) point will be used,")
  7462. )
  7463. self.toolchange_xy_entry = FCEntry()
  7464. grid_lay.addWidget(toolchangexy_lbl, 7, 0)
  7465. grid_lay.addWidget(self.toolchange_xy_entry, 7, 1, 1, 2)
  7466. # Second point choice
  7467. second_point_lbl = QtWidgets.QLabel('%s:' % _("Second point"))
  7468. second_point_lbl.setToolTip(
  7469. _("Second point in the Gcode verification can be:\n"
  7470. "- top-left -> the user will align the PCB vertically\n"
  7471. "- bottom-right -> the user will align the PCB horizontally")
  7472. )
  7473. self.second_point_radio = RadioSet([{'label': _('Top-Left'), 'value': 'tl'},
  7474. {'label': _('Bottom-Right'), 'value': 'br'}],
  7475. orientation='vertical')
  7476. grid_lay.addWidget(second_point_lbl, 8, 0)
  7477. grid_lay.addWidget(self.second_point_radio, 8, 1, 1, 2)
  7478. self.layout.addStretch()
  7479. class Tools2EDrillsPrefGroupUI(OptionsGroupUI):
  7480. def __init__(self, decimals=4, parent=None):
  7481. super(Tools2EDrillsPrefGroupUI, self).__init__(self)
  7482. self.setTitle(str(_("Extract Drills Options")))
  7483. self.decimals = decimals
  7484. # ## Grid Layout
  7485. grid_lay = QtWidgets.QGridLayout()
  7486. self.layout.addLayout(grid_lay)
  7487. grid_lay.setColumnStretch(0, 0)
  7488. grid_lay.setColumnStretch(1, 1)
  7489. self.param_label = QtWidgets.QLabel('<b>%s:</b>' % _('Parameters'))
  7490. self.param_label.setToolTip(
  7491. _("Parameters used for this tool.")
  7492. )
  7493. grid_lay.addWidget(self.param_label, 0, 0, 1, 2)
  7494. self.padt_label = QtWidgets.QLabel("<b>%s:</b>" % _("Processed Pads Type"))
  7495. self.padt_label.setToolTip(
  7496. _("The type of pads shape to be processed.\n"
  7497. "If the PCB has many SMD pads with rectangular pads,\n"
  7498. "disable the Rectangular aperture.")
  7499. )
  7500. grid_lay.addWidget(self.padt_label, 2, 0, 1, 2)
  7501. # Circular Aperture Selection
  7502. self.circular_cb = FCCheckBox('%s' % _("Circular"))
  7503. self.circular_cb.setToolTip(
  7504. _("Process Circular Pads.")
  7505. )
  7506. grid_lay.addWidget(self.circular_cb, 3, 0, 1, 2)
  7507. # Oblong Aperture Selection
  7508. self.oblong_cb = FCCheckBox('%s' % _("Oblong"))
  7509. self.oblong_cb.setToolTip(
  7510. _("Process Oblong Pads.")
  7511. )
  7512. grid_lay.addWidget(self.oblong_cb, 4, 0, 1, 2)
  7513. # Square Aperture Selection
  7514. self.square_cb = FCCheckBox('%s' % _("Square"))
  7515. self.square_cb.setToolTip(
  7516. _("Process Square Pads.")
  7517. )
  7518. grid_lay.addWidget(self.square_cb, 5, 0, 1, 2)
  7519. # Rectangular Aperture Selection
  7520. self.rectangular_cb = FCCheckBox('%s' % _("Rectangular"))
  7521. self.rectangular_cb.setToolTip(
  7522. _("Process Rectangular Pads.")
  7523. )
  7524. grid_lay.addWidget(self.rectangular_cb, 6, 0, 1, 2)
  7525. # Others type of Apertures Selection
  7526. self.other_cb = FCCheckBox('%s' % _("Others"))
  7527. self.other_cb.setToolTip(
  7528. _("Process pads not in the categories above.")
  7529. )
  7530. grid_lay.addWidget(self.other_cb, 7, 0, 1, 2)
  7531. separator_line = QtWidgets.QFrame()
  7532. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  7533. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  7534. grid_lay.addWidget(separator_line, 8, 0, 1, 2)
  7535. # ## Axis
  7536. self.hole_size_radio = RadioSet(
  7537. [
  7538. {'label': _("Fixed Diameter"), 'value': 'fixed'},
  7539. {'label': _("Fixed Annular Ring"), 'value': 'ring'},
  7540. {'label': _("Proportional"), 'value': 'prop'}
  7541. ],
  7542. orientation='vertical',
  7543. stretch=False)
  7544. self.hole_size_label = QtWidgets.QLabel('<b>%s:</b>' % _("Method"))
  7545. self.hole_size_label.setToolTip(
  7546. _("The method for processing pads. Can be:\n"
  7547. "- Fixed Diameter -> all holes will have a set size\n"
  7548. "- Fixed Annular Ring -> all holes will have a set annular ring\n"
  7549. "- Proportional -> each hole size will be a fraction of the pad size"))
  7550. grid_lay.addWidget(self.hole_size_label, 9, 0)
  7551. grid_lay.addWidget(self.hole_size_radio, 9, 1)
  7552. # grid_lay1.addWidget(QtWidgets.QLabel(''))
  7553. separator_line = QtWidgets.QFrame()
  7554. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  7555. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  7556. grid_lay.addWidget(separator_line, 10, 0, 1, 2)
  7557. # Annular Ring
  7558. self.fixed_label = QtWidgets.QLabel('<b>%s</b>' % _("Fixed Diameter"))
  7559. grid_lay.addWidget(self.fixed_label, 11, 0, 1, 2)
  7560. # Diameter value
  7561. self.dia_entry = FCDoubleSpinner()
  7562. self.dia_entry.set_precision(self.decimals)
  7563. self.dia_entry.set_range(0.0000, 9999.9999)
  7564. self.dia_label = QtWidgets.QLabel('%s:' % _("Value"))
  7565. self.dia_label.setToolTip(
  7566. _("Fixed hole diameter.")
  7567. )
  7568. grid_lay.addWidget(self.dia_label, 12, 0)
  7569. grid_lay.addWidget(self.dia_entry, 12, 1)
  7570. # Annular Ring value
  7571. self.ring_label = QtWidgets.QLabel('<b>%s</b>' % _("Fixed Annular Ring"))
  7572. self.ring_label.setToolTip(
  7573. _("The size of annular ring.\n"
  7574. "The copper sliver between the hole exterior\n"
  7575. "and the margin of the copper pad.")
  7576. )
  7577. grid_lay.addWidget(self.ring_label, 13, 0, 1, 2)
  7578. # Circular Annular Ring Value
  7579. self.circular_ring_label = QtWidgets.QLabel('%s:' % _("Circular"))
  7580. self.circular_ring_label.setToolTip(
  7581. _("The size of annular ring for circular pads.")
  7582. )
  7583. self.circular_ring_entry = FCDoubleSpinner()
  7584. self.circular_ring_entry.set_precision(self.decimals)
  7585. self.circular_ring_entry.set_range(0.0000, 9999.9999)
  7586. grid_lay.addWidget(self.circular_ring_label, 14, 0)
  7587. grid_lay.addWidget(self.circular_ring_entry, 14, 1)
  7588. # Oblong Annular Ring Value
  7589. self.oblong_ring_label = QtWidgets.QLabel('%s:' % _("Oblong"))
  7590. self.oblong_ring_label.setToolTip(
  7591. _("The size of annular ring for oblong pads.")
  7592. )
  7593. self.oblong_ring_entry = FCDoubleSpinner()
  7594. self.oblong_ring_entry.set_precision(self.decimals)
  7595. self.oblong_ring_entry.set_range(0.0000, 9999.9999)
  7596. grid_lay.addWidget(self.oblong_ring_label, 15, 0)
  7597. grid_lay.addWidget(self.oblong_ring_entry, 15, 1)
  7598. # Square Annular Ring Value
  7599. self.square_ring_label = QtWidgets.QLabel('%s:' % _("Square"))
  7600. self.square_ring_label.setToolTip(
  7601. _("The size of annular ring for square pads.")
  7602. )
  7603. self.square_ring_entry = FCDoubleSpinner()
  7604. self.square_ring_entry.set_precision(self.decimals)
  7605. self.square_ring_entry.set_range(0.0000, 9999.9999)
  7606. grid_lay.addWidget(self.square_ring_label, 16, 0)
  7607. grid_lay.addWidget(self.square_ring_entry, 16, 1)
  7608. # Rectangular Annular Ring Value
  7609. self.rectangular_ring_label = QtWidgets.QLabel('%s:' % _("Rectangular"))
  7610. self.rectangular_ring_label.setToolTip(
  7611. _("The size of annular ring for rectangular pads.")
  7612. )
  7613. self.rectangular_ring_entry = FCDoubleSpinner()
  7614. self.rectangular_ring_entry.set_precision(self.decimals)
  7615. self.rectangular_ring_entry.set_range(0.0000, 9999.9999)
  7616. grid_lay.addWidget(self.rectangular_ring_label, 17, 0)
  7617. grid_lay.addWidget(self.rectangular_ring_entry, 17, 1)
  7618. # Others Annular Ring Value
  7619. self.other_ring_label = QtWidgets.QLabel('%s:' % _("Others"))
  7620. self.other_ring_label.setToolTip(
  7621. _("The size of annular ring for other pads.")
  7622. )
  7623. self.other_ring_entry = FCDoubleSpinner()
  7624. self.other_ring_entry.set_precision(self.decimals)
  7625. self.other_ring_entry.set_range(0.0000, 9999.9999)
  7626. grid_lay.addWidget(self.other_ring_label, 18, 0)
  7627. grid_lay.addWidget(self.other_ring_entry, 18, 1)
  7628. self.prop_label = QtWidgets.QLabel('<b>%s</b>' % _("Proportional Diameter"))
  7629. grid_lay.addWidget(self.prop_label, 19, 0, 1, 2)
  7630. # Factor value
  7631. self.factor_entry = FCDoubleSpinner(suffix='%')
  7632. self.factor_entry.set_precision(self.decimals)
  7633. self.factor_entry.set_range(0.0000, 100.0000)
  7634. self.factor_entry.setSingleStep(0.1)
  7635. self.factor_label = QtWidgets.QLabel('%s:' % _("Factor"))
  7636. self.factor_label.setToolTip(
  7637. _("Proportional Diameter.\n"
  7638. "The hole diameter will be a fraction of the pad size.")
  7639. )
  7640. grid_lay.addWidget(self.factor_label, 20, 0)
  7641. grid_lay.addWidget(self.factor_entry, 20, 1)
  7642. self.layout.addStretch()
  7643. class Tools2PunchGerberPrefGroupUI(OptionsGroupUI):
  7644. def __init__(self, decimals=4, parent=None):
  7645. super(Tools2PunchGerberPrefGroupUI, self).__init__(self)
  7646. self.setTitle(str(_("Punch Gerber Options")))
  7647. self.decimals = decimals
  7648. # ## Grid Layout
  7649. grid_lay = QtWidgets.QGridLayout()
  7650. self.layout.addLayout(grid_lay)
  7651. grid_lay.setColumnStretch(0, 0)
  7652. grid_lay.setColumnStretch(1, 1)
  7653. self.param_label = QtWidgets.QLabel('<b>%s:</b>' % _('Parameters'))
  7654. self.param_label.setToolTip(
  7655. _("Parameters used for this tool.")
  7656. )
  7657. grid_lay.addWidget(self.param_label, 0, 0, 1, 2)
  7658. self.padt_label = QtWidgets.QLabel("<b>%s:</b>" % _("Processed Pads Type"))
  7659. self.padt_label.setToolTip(
  7660. _("The type of pads shape to be processed.\n"
  7661. "If the PCB has many SMD pads with rectangular pads,\n"
  7662. "disable the Rectangular aperture.")
  7663. )
  7664. grid_lay.addWidget(self.padt_label, 2, 0, 1, 2)
  7665. # Circular Aperture Selection
  7666. self.circular_cb = FCCheckBox('%s' % _("Circular"))
  7667. self.circular_cb.setToolTip(
  7668. _("Process Circular Pads.")
  7669. )
  7670. grid_lay.addWidget(self.circular_cb, 3, 0, 1, 2)
  7671. # Oblong Aperture Selection
  7672. self.oblong_cb = FCCheckBox('%s' % _("Oblong"))
  7673. self.oblong_cb.setToolTip(
  7674. _("Process Oblong Pads.")
  7675. )
  7676. grid_lay.addWidget(self.oblong_cb, 4, 0, 1, 2)
  7677. # Square Aperture Selection
  7678. self.square_cb = FCCheckBox('%s' % _("Square"))
  7679. self.square_cb.setToolTip(
  7680. _("Process Square Pads.")
  7681. )
  7682. grid_lay.addWidget(self.square_cb, 5, 0, 1, 2)
  7683. # Rectangular Aperture Selection
  7684. self.rectangular_cb = FCCheckBox('%s' % _("Rectangular"))
  7685. self.rectangular_cb.setToolTip(
  7686. _("Process Rectangular Pads.")
  7687. )
  7688. grid_lay.addWidget(self.rectangular_cb, 6, 0, 1, 2)
  7689. # Others type of Apertures Selection
  7690. self.other_cb = FCCheckBox('%s' % _("Others"))
  7691. self.other_cb.setToolTip(
  7692. _("Process pads not in the categories above.")
  7693. )
  7694. grid_lay.addWidget(self.other_cb, 7, 0, 1, 2)
  7695. separator_line = QtWidgets.QFrame()
  7696. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  7697. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  7698. grid_lay.addWidget(separator_line, 8, 0, 1, 2)
  7699. # ## Axis
  7700. self.hole_size_radio = RadioSet(
  7701. [
  7702. {'label': _("Excellon"), 'value': 'exc'},
  7703. {'label': _("Fixed Diameter"), 'value': 'fixed'},
  7704. {'label': _("Fixed Annular Ring"), 'value': 'ring'},
  7705. {'label': _("Proportional"), 'value': 'prop'}
  7706. ],
  7707. orientation='vertical',
  7708. stretch=False)
  7709. self.hole_size_label = QtWidgets.QLabel('<b>%s:</b>' % _("Method"))
  7710. self.hole_size_label.setToolTip(
  7711. _("The punch hole source can be:\n"
  7712. "- Excellon Object-> the Excellon object drills center will serve as reference.\n"
  7713. "- Fixed Diameter -> will try to use the pads center as reference adding fixed diameter holes.\n"
  7714. "- Fixed Annular Ring -> will try to keep a set annular ring.\n"
  7715. "- Proportional -> will make a Gerber punch hole having the diameter a percentage of the pad diameter.")
  7716. )
  7717. grid_lay.addWidget(self.hole_size_label, 9, 0)
  7718. grid_lay.addWidget(self.hole_size_radio, 9, 1)
  7719. # grid_lay1.addWidget(QtWidgets.QLabel(''))
  7720. separator_line = QtWidgets.QFrame()
  7721. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  7722. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  7723. grid_lay.addWidget(separator_line, 10, 0, 1, 2)
  7724. # Annular Ring
  7725. self.fixed_label = QtWidgets.QLabel('<b>%s</b>' % _("Fixed Diameter"))
  7726. grid_lay.addWidget(self.fixed_label, 11, 0, 1, 2)
  7727. # Diameter value
  7728. self.dia_entry = FCDoubleSpinner()
  7729. self.dia_entry.set_precision(self.decimals)
  7730. self.dia_entry.set_range(0.0000, 9999.9999)
  7731. self.dia_label = QtWidgets.QLabel('%s:' % _("Value"))
  7732. self.dia_label.setToolTip(
  7733. _("Fixed hole diameter.")
  7734. )
  7735. grid_lay.addWidget(self.dia_label, 12, 0)
  7736. grid_lay.addWidget(self.dia_entry, 12, 1)
  7737. # Annular Ring value
  7738. self.ring_label = QtWidgets.QLabel('<b>%s</b>' % _("Fixed Annular Ring"))
  7739. self.ring_label.setToolTip(
  7740. _("The size of annular ring.\n"
  7741. "The copper sliver between the hole exterior\n"
  7742. "and the margin of the copper pad.")
  7743. )
  7744. grid_lay.addWidget(self.ring_label, 13, 0, 1, 2)
  7745. # Circular Annular Ring Value
  7746. self.circular_ring_label = QtWidgets.QLabel('%s:' % _("Circular"))
  7747. self.circular_ring_label.setToolTip(
  7748. _("The size of annular ring for circular pads.")
  7749. )
  7750. self.circular_ring_entry = FCDoubleSpinner()
  7751. self.circular_ring_entry.set_precision(self.decimals)
  7752. self.circular_ring_entry.set_range(0.0000, 9999.9999)
  7753. grid_lay.addWidget(self.circular_ring_label, 14, 0)
  7754. grid_lay.addWidget(self.circular_ring_entry, 14, 1)
  7755. # Oblong Annular Ring Value
  7756. self.oblong_ring_label = QtWidgets.QLabel('%s:' % _("Oblong"))
  7757. self.oblong_ring_label.setToolTip(
  7758. _("The size of annular ring for oblong pads.")
  7759. )
  7760. self.oblong_ring_entry = FCDoubleSpinner()
  7761. self.oblong_ring_entry.set_precision(self.decimals)
  7762. self.oblong_ring_entry.set_range(0.0000, 9999.9999)
  7763. grid_lay.addWidget(self.oblong_ring_label, 15, 0)
  7764. grid_lay.addWidget(self.oblong_ring_entry, 15, 1)
  7765. # Square Annular Ring Value
  7766. self.square_ring_label = QtWidgets.QLabel('%s:' % _("Square"))
  7767. self.square_ring_label.setToolTip(
  7768. _("The size of annular ring for square pads.")
  7769. )
  7770. self.square_ring_entry = FCDoubleSpinner()
  7771. self.square_ring_entry.set_precision(self.decimals)
  7772. self.square_ring_entry.set_range(0.0000, 9999.9999)
  7773. grid_lay.addWidget(self.square_ring_label, 16, 0)
  7774. grid_lay.addWidget(self.square_ring_entry, 16, 1)
  7775. # Rectangular Annular Ring Value
  7776. self.rectangular_ring_label = QtWidgets.QLabel('%s:' % _("Rectangular"))
  7777. self.rectangular_ring_label.setToolTip(
  7778. _("The size of annular ring for rectangular pads.")
  7779. )
  7780. self.rectangular_ring_entry = FCDoubleSpinner()
  7781. self.rectangular_ring_entry.set_precision(self.decimals)
  7782. self.rectangular_ring_entry.set_range(0.0000, 9999.9999)
  7783. grid_lay.addWidget(self.rectangular_ring_label, 17, 0)
  7784. grid_lay.addWidget(self.rectangular_ring_entry, 17, 1)
  7785. # Others Annular Ring Value
  7786. self.other_ring_label = QtWidgets.QLabel('%s:' % _("Others"))
  7787. self.other_ring_label.setToolTip(
  7788. _("The size of annular ring for other pads.")
  7789. )
  7790. self.other_ring_entry = FCDoubleSpinner()
  7791. self.other_ring_entry.set_precision(self.decimals)
  7792. self.other_ring_entry.set_range(0.0000, 9999.9999)
  7793. grid_lay.addWidget(self.other_ring_label, 18, 0)
  7794. grid_lay.addWidget(self.other_ring_entry, 18, 1)
  7795. self.prop_label = QtWidgets.QLabel('<b>%s</b>' % _("Proportional Diameter"))
  7796. grid_lay.addWidget(self.prop_label, 19, 0, 1, 2)
  7797. # Factor value
  7798. self.factor_entry = FCDoubleSpinner(suffix='%')
  7799. self.factor_entry.set_precision(self.decimals)
  7800. self.factor_entry.set_range(0.0000, 100.0000)
  7801. self.factor_entry.setSingleStep(0.1)
  7802. self.factor_label = QtWidgets.QLabel('%s:' % _("Factor"))
  7803. self.factor_label.setToolTip(
  7804. _("Proportional Diameter.\n"
  7805. "The hole diameter will be a fraction of the pad size.")
  7806. )
  7807. grid_lay.addWidget(self.factor_label, 20, 0)
  7808. grid_lay.addWidget(self.factor_entry, 20, 1)
  7809. self.layout.addStretch()
  7810. class Tools2InvertPrefGroupUI(OptionsGroupUI):
  7811. def __init__(self, decimals=4, parent=None):
  7812. super(Tools2InvertPrefGroupUI, self).__init__(self)
  7813. self.setTitle(str(_("Invert Gerber Tool Options")))
  7814. self.decimals = decimals
  7815. # ## Subtractor Tool Parameters
  7816. self.sublabel = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  7817. self.sublabel.setToolTip(
  7818. _("A tool to invert Gerber geometry from positive to negative\n"
  7819. "and in revers.")
  7820. )
  7821. self.layout.addWidget(self.sublabel)
  7822. # Grid Layout
  7823. grid0 = QtWidgets.QGridLayout()
  7824. grid0.setColumnStretch(0, 0)
  7825. grid0.setColumnStretch(1, 1)
  7826. self.layout.addLayout(grid0)
  7827. # Margin
  7828. self.margin_label = QtWidgets.QLabel('%s:' % _('Margin'))
  7829. self.margin_label.setToolTip(
  7830. _("Distance by which to avoid\n"
  7831. "the edges of the Gerber object.")
  7832. )
  7833. self.margin_entry = FCDoubleSpinner()
  7834. self.margin_entry.set_precision(self.decimals)
  7835. self.margin_entry.set_range(0.0000, 9999.9999)
  7836. self.margin_entry.setObjectName(_("Margin"))
  7837. grid0.addWidget(self.margin_label, 2, 0, 1, 2)
  7838. grid0.addWidget(self.margin_entry, 3, 0, 1, 2)
  7839. self.join_label = QtWidgets.QLabel('%s:' % _("Lines Join Style"))
  7840. self.join_label.setToolTip(
  7841. _("The way that the lines in the object outline will be joined.\n"
  7842. "Can be:\n"
  7843. "- rounded -> an arc is added between two joining lines\n"
  7844. "- square -> the lines meet in 90 degrees angle\n"
  7845. "- bevel -> the lines are joined by a third line")
  7846. )
  7847. self.join_radio = RadioSet([
  7848. {'label': 'Rounded', 'value': 'r'},
  7849. {'label': 'Square', 'value': 's'},
  7850. {'label': 'Bevel', 'value': 'b'}
  7851. ], orientation='vertical', stretch=False)
  7852. grid0.addWidget(self.join_label, 5, 0, 1, 2)
  7853. grid0.addWidget(self.join_radio, 7, 0, 1, 2)
  7854. self.layout.addStretch()
  7855. class FAExcPrefGroupUI(OptionsGroupUI):
  7856. def __init__(self, decimals=4, parent=None):
  7857. # OptionsGroupUI.__init__(self, "Excellon File associations Preferences", parent=None)
  7858. super().__init__(self)
  7859. self.setTitle(str(_("Excellon File associations")))
  7860. self.decimals = decimals
  7861. self.layout.setContentsMargins(2, 2, 2, 2)
  7862. self.vertical_lay = QtWidgets.QVBoxLayout()
  7863. scroll_widget = QtWidgets.QWidget()
  7864. scroll = VerticalScrollArea()
  7865. scroll.setWidget(scroll_widget)
  7866. scroll.setWidgetResizable(True)
  7867. scroll.setFrameShape(QtWidgets.QFrame.NoFrame)
  7868. self.restore_btn = FCButton(_("Restore"))
  7869. self.restore_btn.setToolTip(_("Restore the extension list to the default state."))
  7870. self.del_all_btn = FCButton(_("Delete All"))
  7871. self.del_all_btn.setToolTip(_("Delete all extensions from the list."))
  7872. hlay0 = QtWidgets.QHBoxLayout()
  7873. hlay0.addWidget(self.restore_btn)
  7874. hlay0.addWidget(self.del_all_btn)
  7875. self.vertical_lay.addLayout(hlay0)
  7876. # # ## Excellon associations
  7877. list_label = QtWidgets.QLabel("<b>%s:</b>" % _("Extensions list"))
  7878. list_label.setToolTip(
  7879. _("List of file extensions to be\n"
  7880. "associated with FlatCAM.")
  7881. )
  7882. self.vertical_lay.addWidget(list_label)
  7883. settings = QSettings("Open Source", "FlatCAM")
  7884. if settings.contains("textbox_font_size"):
  7885. tb_fsize = settings.value('textbox_font_size', type=int)
  7886. else:
  7887. tb_fsize = 10
  7888. self.exc_list_text = FCTextArea()
  7889. self.exc_list_text.setReadOnly(True)
  7890. # self.exc_list_text.sizeHint(custom_sizehint=150)
  7891. font = QtGui.QFont()
  7892. font.setPointSize(tb_fsize)
  7893. self.exc_list_text.setFont(font)
  7894. self.vertical_lay.addWidget(self.exc_list_text)
  7895. self.ext_label = QtWidgets.QLabel('%s:' % _("Extension"))
  7896. self.ext_label.setToolTip(_("A file extension to be added or deleted to the list."))
  7897. self.ext_entry = FCEntry()
  7898. hlay1 = QtWidgets.QHBoxLayout()
  7899. self.vertical_lay.addLayout(hlay1)
  7900. hlay1.addWidget(self.ext_label)
  7901. hlay1.addWidget(self.ext_entry)
  7902. self.add_btn = FCButton(_("Add Extension"))
  7903. self.add_btn.setToolTip(_("Add a file extension to the list"))
  7904. self.del_btn = FCButton(_("Delete Extension"))
  7905. self.del_btn.setToolTip(_("Delete a file extension from the list"))
  7906. hlay2 = QtWidgets.QHBoxLayout()
  7907. self.vertical_lay.addLayout(hlay2)
  7908. hlay2.addWidget(self.add_btn)
  7909. hlay2.addWidget(self.del_btn)
  7910. self.exc_list_btn = FCButton(_("Apply Association"))
  7911. self.exc_list_btn.setToolTip(_("Apply the file associations between\n"
  7912. "FlatCAM and the files with above extensions.\n"
  7913. "They will be active after next logon.\n"
  7914. "This work only in Windows."))
  7915. self.vertical_lay.addWidget(self.exc_list_btn)
  7916. scroll_widget.setLayout(self.vertical_lay)
  7917. self.layout.addWidget(scroll)
  7918. # self.vertical_lay.addStretch()
  7919. class FAGcoPrefGroupUI(OptionsGroupUI):
  7920. def __init__(self, decimals=4, parent=None):
  7921. # OptionsGroupUI.__init__(self, "Gcode File associations Preferences", parent=None)
  7922. super(FAGcoPrefGroupUI, self).__init__(self)
  7923. self.setTitle(str(_("GCode File associations")))
  7924. self.decimals = decimals
  7925. self.restore_btn = FCButton(_("Restore"))
  7926. self.restore_btn.setToolTip(_("Restore the extension list to the default state."))
  7927. self.del_all_btn = FCButton(_("Delete All"))
  7928. self.del_all_btn.setToolTip(_("Delete all extensions from the list."))
  7929. hlay0 = QtWidgets.QHBoxLayout()
  7930. self.layout.addLayout(hlay0)
  7931. hlay0.addWidget(self.restore_btn)
  7932. hlay0.addWidget(self.del_all_btn)
  7933. # ## G-Code associations
  7934. self.gco_list_label = QtWidgets.QLabel("<b>%s:</b>" % _("Extensions list"))
  7935. self.gco_list_label.setToolTip(
  7936. _("List of file extensions to be\n"
  7937. "associated with FlatCAM.")
  7938. )
  7939. self.layout.addWidget(self.gco_list_label)
  7940. settings = QSettings("Open Source", "FlatCAM")
  7941. if settings.contains("textbox_font_size"):
  7942. tb_fsize = settings.value('textbox_font_size', type=int)
  7943. else:
  7944. tb_fsize = 10
  7945. self.gco_list_text = FCTextArea()
  7946. self.gco_list_text.setReadOnly(True)
  7947. # self.gco_list_text.sizeHint(custom_sizehint=150)
  7948. font = QtGui.QFont()
  7949. font.setPointSize(tb_fsize)
  7950. self.gco_list_text.setFont(font)
  7951. self.layout.addWidget(self.gco_list_text)
  7952. self.ext_label = QtWidgets.QLabel('%s:' % _("Extension"))
  7953. self.ext_label.setToolTip(_("A file extension to be added or deleted to the list."))
  7954. self.ext_entry = FCEntry()
  7955. hlay1 = QtWidgets.QHBoxLayout()
  7956. self.layout.addLayout(hlay1)
  7957. hlay1.addWidget(self.ext_label)
  7958. hlay1.addWidget(self.ext_entry)
  7959. self.add_btn = FCButton(_("Add Extension"))
  7960. self.add_btn.setToolTip(_("Add a file extension to the list"))
  7961. self.del_btn = FCButton(_("Delete Extension"))
  7962. self.del_btn.setToolTip(_("Delete a file extension from the list"))
  7963. hlay2 = QtWidgets.QHBoxLayout()
  7964. self.layout.addLayout(hlay2)
  7965. hlay2.addWidget(self.add_btn)
  7966. hlay2.addWidget(self.del_btn)
  7967. self.gco_list_btn = FCButton(_("Apply Association"))
  7968. self.gco_list_btn.setToolTip(_("Apply the file associations between\n"
  7969. "FlatCAM and the files with above extensions.\n"
  7970. "They will be active after next logon.\n"
  7971. "This work only in Windows."))
  7972. self.layout.addWidget(self.gco_list_btn)
  7973. # self.layout.addStretch()
  7974. class FAGrbPrefGroupUI(OptionsGroupUI):
  7975. def __init__(self, decimals=4, parent=None):
  7976. # OptionsGroupUI.__init__(self, "Gerber File associations Preferences", parent=None)
  7977. super(FAGrbPrefGroupUI, self).__init__(self)
  7978. self.setTitle(str(_("Gerber File associations")))
  7979. self.decimals = decimals
  7980. self.restore_btn = FCButton(_("Restore"))
  7981. self.restore_btn.setToolTip(_("Restore the extension list to the default state."))
  7982. self.del_all_btn = FCButton(_("Delete All"))
  7983. self.del_all_btn.setToolTip(_("Delete all extensions from the list."))
  7984. hlay0 = QtWidgets.QHBoxLayout()
  7985. self.layout.addLayout(hlay0)
  7986. hlay0.addWidget(self.restore_btn)
  7987. hlay0.addWidget(self.del_all_btn)
  7988. # ## Gerber associations
  7989. self.grb_list_label = QtWidgets.QLabel("<b>%s:</b>" % _("Extensions list"))
  7990. self.grb_list_label.setToolTip(
  7991. _("List of file extensions to be\n"
  7992. "associated with FlatCAM.")
  7993. )
  7994. self.layout.addWidget(self.grb_list_label)
  7995. settings = QSettings("Open Source", "FlatCAM")
  7996. if settings.contains("textbox_font_size"):
  7997. tb_fsize = settings.value('textbox_font_size', type=int)
  7998. else:
  7999. tb_fsize = 10
  8000. self.grb_list_text = FCTextArea()
  8001. self.grb_list_text.setReadOnly(True)
  8002. # self.grb_list_text.sizeHint(custom_sizehint=150)
  8003. self.layout.addWidget(self.grb_list_text)
  8004. font = QtGui.QFont()
  8005. font.setPointSize(tb_fsize)
  8006. self.grb_list_text.setFont(font)
  8007. self.ext_label = QtWidgets.QLabel('%s:' % _("Extension"))
  8008. self.ext_label.setToolTip(_("A file extension to be added or deleted to the list."))
  8009. self.ext_entry = FCEntry()
  8010. hlay1 = QtWidgets.QHBoxLayout()
  8011. self.layout.addLayout(hlay1)
  8012. hlay1.addWidget(self.ext_label)
  8013. hlay1.addWidget(self.ext_entry)
  8014. self.add_btn = FCButton(_("Add Extension"))
  8015. self.add_btn.setToolTip(_("Add a file extension to the list"))
  8016. self.del_btn = FCButton(_("Delete Extension"))
  8017. self.del_btn.setToolTip(_("Delete a file extension from the list"))
  8018. hlay2 = QtWidgets.QHBoxLayout()
  8019. self.layout.addLayout(hlay2)
  8020. hlay2.addWidget(self.add_btn)
  8021. hlay2.addWidget(self.del_btn)
  8022. self.grb_list_btn = FCButton(_("Apply Association"))
  8023. self.grb_list_btn.setToolTip(_("Apply the file associations between\n"
  8024. "FlatCAM and the files with above extensions.\n"
  8025. "They will be active after next logon.\n"
  8026. "This work only in Windows."))
  8027. self.layout.addWidget(self.grb_list_btn)
  8028. # self.layout.addStretch()
  8029. class AutoCompletePrefGroupUI(OptionsGroupUI):
  8030. def __init__(self, decimals=4, parent=None):
  8031. # OptionsGroupUI.__init__(self, "Gerber File associations Preferences", parent=None)
  8032. super().__init__(self, parent=parent)
  8033. self.setTitle(str(_("Autocompleter Keywords")))
  8034. self.decimals = decimals
  8035. self.restore_btn = FCButton(_("Restore"))
  8036. self.restore_btn.setToolTip(_("Restore the autocompleter keywords list to the default state."))
  8037. self.del_all_btn = FCButton(_("Delete All"))
  8038. self.del_all_btn.setToolTip(_("Delete all autocompleter keywords from the list."))
  8039. hlay0 = QtWidgets.QHBoxLayout()
  8040. self.layout.addLayout(hlay0)
  8041. hlay0.addWidget(self.restore_btn)
  8042. hlay0.addWidget(self.del_all_btn)
  8043. # ## Gerber associations
  8044. self.grb_list_label = QtWidgets.QLabel("<b>%s:</b>" % _("Keywords list"))
  8045. self.grb_list_label.setToolTip(
  8046. _("List of keywords used by\n"
  8047. "the autocompleter in FlatCAM.\n"
  8048. "The autocompleter is installed\n"
  8049. "in the Code Editor and for the Tcl Shell.")
  8050. )
  8051. self.layout.addWidget(self.grb_list_label)
  8052. settings = QSettings("Open Source", "FlatCAM")
  8053. if settings.contains("textbox_font_size"):
  8054. tb_fsize = settings.value('textbox_font_size', type=int)
  8055. else:
  8056. tb_fsize = 10
  8057. self.kw_list_text = FCTextArea()
  8058. self.kw_list_text.setReadOnly(True)
  8059. # self.grb_list_text.sizeHint(custom_sizehint=150)
  8060. self.layout.addWidget(self.kw_list_text)
  8061. font = QtGui.QFont()
  8062. font.setPointSize(tb_fsize)
  8063. self.kw_list_text.setFont(font)
  8064. self.kw_label = QtWidgets.QLabel('%s:' % _("Extension"))
  8065. self.kw_label.setToolTip(_("A keyword to be added or deleted to the list."))
  8066. self.kw_entry = FCEntry()
  8067. hlay1 = QtWidgets.QHBoxLayout()
  8068. self.layout.addLayout(hlay1)
  8069. hlay1.addWidget(self.kw_label)
  8070. hlay1.addWidget(self.kw_entry)
  8071. self.add_btn = FCButton(_("Add keyword"))
  8072. self.add_btn.setToolTip(_("Add a keyword to the list"))
  8073. self.del_btn = FCButton(_("Delete keyword"))
  8074. self.del_btn.setToolTip(_("Delete a keyword from the list"))
  8075. hlay2 = QtWidgets.QHBoxLayout()
  8076. self.layout.addLayout(hlay2)
  8077. hlay2.addWidget(self.add_btn)
  8078. hlay2.addWidget(self.del_btn)
  8079. # self.layout.addStretch()