PreferencesUI.py 431 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003
  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. # Modified by David Robertson 29.04.2020 #
  8. # ##########################################################
  9. import os
  10. from defaults import FlatCAMDefaults
  11. from flatcamGUI.GUIElements import *
  12. import platform
  13. import sys
  14. import logging
  15. import gettext
  16. import FlatCAMTranslation as fcTranslate
  17. import builtins
  18. log = logging.getLogger('PreferencesUI')
  19. fcTranslate.apply_language('strings')
  20. if '_' not in builtins.__dict__:
  21. _ = gettext.gettext
  22. settings = QSettings("Open Source", "FlatCAM")
  23. if settings.contains("machinist"):
  24. machinist_setting = settings.value('machinist', type=int)
  25. else:
  26. machinist_setting = 0
  27. class PreferencesUIManager:
  28. def __init__(self, defaults: FlatCAMDefaults, data_path: str, ui, inform):
  29. """
  30. Class that control the Preferences Tab
  31. :param defaults: a dictionary storage where all the application settings are stored
  32. :param data_path: a path to the file where all the preferences are stored for persistence
  33. :param ui: reference to the FlatCAMGUI class which constructs the UI
  34. :param inform: a pyqtSignal used to display information's in the StatusBar of the GUI
  35. """
  36. self.defaults = defaults
  37. self.data_path = data_path
  38. self.ui = ui
  39. self.inform = inform
  40. self.ignore_tab_close_event = False
  41. # if Preferences are changed in the Edit -> Preferences tab the value will be set to True
  42. self.preferences_changed_flag = False
  43. # when adding entries here read the comments in the method found bellow named:
  44. # def new_object(self, kind, name, initialize, active=True, fit=True, plot=True)
  45. self.defaults_form_fields = {
  46. # General App
  47. "decimals_inch": self.ui.general_defaults_form.general_app_group.precision_inch_entry,
  48. "decimals_metric": self.ui.general_defaults_form.general_app_group.precision_metric_entry,
  49. "units": self.ui.general_defaults_form.general_app_group.units_radio,
  50. "global_graphic_engine": self.ui.general_defaults_form.general_app_group.ge_radio,
  51. "global_app_level": self.ui.general_defaults_form.general_app_group.app_level_radio,
  52. "global_portable": self.ui.general_defaults_form.general_app_group.portability_cb,
  53. "global_language": self.ui.general_defaults_form.general_app_group.language_cb,
  54. "global_systray_icon": self.ui.general_defaults_form.general_app_group.systray_cb,
  55. "global_shell_at_startup": self.ui.general_defaults_form.general_app_group.shell_startup_cb,
  56. "global_project_at_startup": self.ui.general_defaults_form.general_app_group.project_startup_cb,
  57. "global_version_check": self.ui.general_defaults_form.general_app_group.version_check_cb,
  58. "global_send_stats": self.ui.general_defaults_form.general_app_group.send_stats_cb,
  59. "global_worker_number": self.ui.general_defaults_form.general_app_group.worker_number_sb,
  60. "global_tolerance": self.ui.general_defaults_form.general_app_group.tol_entry,
  61. "global_compression_level": self.ui.general_defaults_form.general_app_group.compress_spinner,
  62. "global_save_compressed": self.ui.general_defaults_form.general_app_group.save_type_cb,
  63. "global_autosave": self.ui.general_defaults_form.general_app_group.autosave_cb,
  64. "global_autosave_timeout": self.ui.general_defaults_form.general_app_group.autosave_entry,
  65. "global_tpdf_tmargin": self.ui.general_defaults_form.general_app_group.tmargin_entry,
  66. "global_tpdf_bmargin": self.ui.general_defaults_form.general_app_group.bmargin_entry,
  67. "global_tpdf_lmargin": self.ui.general_defaults_form.general_app_group.lmargin_entry,
  68. "global_tpdf_rmargin": self.ui.general_defaults_form.general_app_group.rmargin_entry,
  69. # General GUI Preferences
  70. "global_theme": self.ui.general_defaults_form.general_gui_group.theme_radio,
  71. "global_gray_icons": self.ui.general_defaults_form.general_gui_group.gray_icons_cb,
  72. "global_layout": self.ui.general_defaults_form.general_gui_group.layout_combo,
  73. "global_hover": self.ui.general_defaults_form.general_gui_group.hover_cb,
  74. "global_selection_shape": self.ui.general_defaults_form.general_gui_group.selection_cb,
  75. "global_sel_fill": self.ui.general_defaults_form.general_gui_group.sf_color_entry,
  76. "global_sel_line": self.ui.general_defaults_form.general_gui_group.sl_color_entry,
  77. "global_alt_sel_fill": self.ui.general_defaults_form.general_gui_group.alt_sf_color_entry,
  78. "global_alt_sel_line": self.ui.general_defaults_form.general_gui_group.alt_sl_color_entry,
  79. "global_draw_color": self.ui.general_defaults_form.general_gui_group.draw_color_entry,
  80. "global_sel_draw_color": self.ui.general_defaults_form.general_gui_group.sel_draw_color_entry,
  81. "global_proj_item_color": self.ui.general_defaults_form.general_gui_group.proj_color_entry,
  82. "global_proj_item_dis_color": self.ui.general_defaults_form.general_gui_group.proj_color_dis_entry,
  83. "global_project_autohide": self.ui.general_defaults_form.general_gui_group.project_autohide_cb,
  84. # General GUI Settings
  85. "global_gridx": self.ui.general_defaults_form.general_app_set_group.gridx_entry,
  86. "global_gridy": self.ui.general_defaults_form.general_app_set_group.gridy_entry,
  87. "global_snap_max": self.ui.general_defaults_form.general_app_set_group.snap_max_dist_entry,
  88. "global_workspace": self.ui.general_defaults_form.general_app_set_group.workspace_cb,
  89. "global_workspaceT": self.ui.general_defaults_form.general_app_set_group.wk_cb,
  90. "global_workspace_orientation": self.ui.general_defaults_form.general_app_set_group.wk_orientation_radio,
  91. "global_cursor_type": self.ui.general_defaults_form.general_app_set_group.cursor_radio,
  92. "global_cursor_size": self.ui.general_defaults_form.general_app_set_group.cursor_size_entry,
  93. "global_cursor_width": self.ui.general_defaults_form.general_app_set_group.cursor_width_entry,
  94. "global_cursor_color_enabled": self.ui.general_defaults_form.general_app_set_group.mouse_cursor_color_cb,
  95. "global_cursor_color": self.ui.general_defaults_form.general_app_set_group.mouse_cursor_entry,
  96. "global_pan_button": self.ui.general_defaults_form.general_app_set_group.pan_button_radio,
  97. "global_mselect_key": self.ui.general_defaults_form.general_app_set_group.mselect_radio,
  98. "global_delete_confirmation": self.ui.general_defaults_form.general_app_set_group.delete_conf_cb,
  99. "global_open_style": self.ui.general_defaults_form.general_app_set_group.open_style_cb,
  100. "global_toggle_tooltips": self.ui.general_defaults_form.general_app_set_group.toggle_tooltips_cb,
  101. "global_machinist_setting": self.ui.general_defaults_form.general_app_set_group.machinist_cb,
  102. "global_bookmarks_limit": self.ui.general_defaults_form.general_app_set_group.bm_limit_spinner,
  103. "global_activity_icon": self.ui.general_defaults_form.general_app_set_group.activity_combo,
  104. # Gerber General
  105. "gerber_plot": self.ui.gerber_defaults_form.gerber_gen_group.plot_cb,
  106. "gerber_solid": self.ui.gerber_defaults_form.gerber_gen_group.solid_cb,
  107. "gerber_multicolored": self.ui.gerber_defaults_form.gerber_gen_group.multicolored_cb,
  108. "gerber_circle_steps": self.ui.gerber_defaults_form.gerber_gen_group.circle_steps_entry,
  109. "gerber_def_units": self.ui.gerber_defaults_form.gerber_gen_group.gerber_units_radio,
  110. "gerber_def_zeros": self.ui.gerber_defaults_form.gerber_gen_group.gerber_zeros_radio,
  111. "gerber_clean_apertures": self.ui.gerber_defaults_form.gerber_gen_group.gerber_clean_cb,
  112. "gerber_extra_buffering": self.ui.gerber_defaults_form.gerber_gen_group.gerber_extra_buffering,
  113. "gerber_plot_fill": self.ui.gerber_defaults_form.gerber_gen_group.pf_color_entry,
  114. "gerber_plot_line": self.ui.gerber_defaults_form.gerber_gen_group.pl_color_entry,
  115. # Gerber Options
  116. "gerber_isotooldia": self.ui.gerber_defaults_form.gerber_opt_group.iso_tool_dia_entry,
  117. "gerber_isopasses": self.ui.gerber_defaults_form.gerber_opt_group.iso_width_entry,
  118. "gerber_isooverlap": self.ui.gerber_defaults_form.gerber_opt_group.iso_overlap_entry,
  119. "gerber_combine_passes": self.ui.gerber_defaults_form.gerber_opt_group.combine_passes_cb,
  120. "gerber_iso_scope": self.ui.gerber_defaults_form.gerber_opt_group.iso_scope_radio,
  121. "gerber_milling_type": self.ui.gerber_defaults_form.gerber_opt_group.milling_type_radio,
  122. "gerber_noncoppermargin": self.ui.gerber_defaults_form.gerber_opt_group.noncopper_margin_entry,
  123. "gerber_noncopperrounded": self.ui.gerber_defaults_form.gerber_opt_group.noncopper_rounded_cb,
  124. "gerber_bboxmargin": self.ui.gerber_defaults_form.gerber_opt_group.bbmargin_entry,
  125. "gerber_bboxrounded": self.ui.gerber_defaults_form.gerber_opt_group.bbrounded_cb,
  126. # Gerber Advanced Options
  127. "gerber_aperture_display": self.ui.gerber_defaults_form.gerber_adv_opt_group.aperture_table_visibility_cb,
  128. # "gerber_aperture_scale_factor": self.ui.gerber_defaults_form.gerber_adv_opt_group.scale_aperture_entry,
  129. # "gerber_aperture_buffer_factor": self.ui.gerber_defaults_form.gerber_adv_opt_group.buffer_aperture_entry,
  130. "gerber_follow": self.ui.gerber_defaults_form.gerber_adv_opt_group.follow_cb,
  131. "gerber_tool_type": self.ui.gerber_defaults_form.gerber_adv_opt_group.tool_type_radio,
  132. "gerber_vtipdia": self.ui.gerber_defaults_form.gerber_adv_opt_group.tipdia_spinner,
  133. "gerber_vtipangle": self.ui.gerber_defaults_form.gerber_adv_opt_group.tipangle_spinner,
  134. "gerber_vcutz": self.ui.gerber_defaults_form.gerber_adv_opt_group.cutz_spinner,
  135. "gerber_iso_type": self.ui.gerber_defaults_form.gerber_adv_opt_group.iso_type_radio,
  136. "gerber_buffering": self.ui.gerber_defaults_form.gerber_adv_opt_group.buffering_radio,
  137. "gerber_simplification": self.ui.gerber_defaults_form.gerber_adv_opt_group.simplify_cb,
  138. "gerber_simp_tolerance": self.ui.gerber_defaults_form.gerber_adv_opt_group.simplification_tol_spinner,
  139. # Gerber Export
  140. "gerber_exp_units": self.ui.gerber_defaults_form.gerber_exp_group.gerber_units_radio,
  141. "gerber_exp_integer": self.ui.gerber_defaults_form.gerber_exp_group.format_whole_entry,
  142. "gerber_exp_decimals": self.ui.gerber_defaults_form.gerber_exp_group.format_dec_entry,
  143. "gerber_exp_zeros": self.ui.gerber_defaults_form.gerber_exp_group.zeros_radio,
  144. # Gerber Editor
  145. "gerber_editor_sel_limit": self.ui.gerber_defaults_form.gerber_editor_group.sel_limit_entry,
  146. "gerber_editor_newcode": self.ui.gerber_defaults_form.gerber_editor_group.addcode_entry,
  147. "gerber_editor_newsize": self.ui.gerber_defaults_form.gerber_editor_group.addsize_entry,
  148. "gerber_editor_newtype": self.ui.gerber_defaults_form.gerber_editor_group.addtype_combo,
  149. "gerber_editor_newdim": self.ui.gerber_defaults_form.gerber_editor_group.adddim_entry,
  150. "gerber_editor_array_size": self.ui.gerber_defaults_form.gerber_editor_group.grb_array_size_entry,
  151. "gerber_editor_lin_axis": self.ui.gerber_defaults_form.gerber_editor_group.grb_axis_radio,
  152. "gerber_editor_lin_pitch": self.ui.gerber_defaults_form.gerber_editor_group.grb_pitch_entry,
  153. "gerber_editor_lin_angle": self.ui.gerber_defaults_form.gerber_editor_group.grb_angle_entry,
  154. "gerber_editor_circ_dir": self.ui.gerber_defaults_form.gerber_editor_group.grb_circular_dir_radio,
  155. "gerber_editor_circ_angle":
  156. self.ui.gerber_defaults_form.gerber_editor_group.grb_circular_angle_entry,
  157. "gerber_editor_scale_f": self.ui.gerber_defaults_form.gerber_editor_group.grb_scale_entry,
  158. "gerber_editor_buff_f": self.ui.gerber_defaults_form.gerber_editor_group.grb_buff_entry,
  159. "gerber_editor_ma_low": self.ui.gerber_defaults_form.gerber_editor_group.grb_ma_low_entry,
  160. "gerber_editor_ma_high": self.ui.gerber_defaults_form.gerber_editor_group.grb_ma_high_entry,
  161. # Excellon General
  162. "excellon_plot": self.ui.excellon_defaults_form.excellon_gen_group.plot_cb,
  163. "excellon_solid": self.ui.excellon_defaults_form.excellon_gen_group.solid_cb,
  164. "excellon_format_upper_in":
  165. self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_upper_in_entry,
  166. "excellon_format_lower_in":
  167. self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_lower_in_entry,
  168. "excellon_format_upper_mm":
  169. self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_upper_mm_entry,
  170. "excellon_format_lower_mm":
  171. self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_lower_mm_entry,
  172. "excellon_zeros": self.ui.excellon_defaults_form.excellon_gen_group.excellon_zeros_radio,
  173. "excellon_units": self.ui.excellon_defaults_form.excellon_gen_group.excellon_units_radio,
  174. "excellon_update": self.ui.excellon_defaults_form.excellon_gen_group.update_excellon_cb,
  175. "excellon_optimization_type": self.ui.excellon_defaults_form.excellon_gen_group.excellon_optimization_radio,
  176. "excellon_search_time": self.ui.excellon_defaults_form.excellon_gen_group.optimization_time_entry,
  177. "excellon_plot_fill": self.ui.excellon_defaults_form.excellon_gen_group.fill_color_entry,
  178. "excellon_plot_line": self.ui.excellon_defaults_form.excellon_gen_group.line_color_entry,
  179. # Excellon Options
  180. "excellon_operation": self.ui.excellon_defaults_form.excellon_opt_group.operation_radio,
  181. "excellon_milling_type": self.ui.excellon_defaults_form.excellon_opt_group.milling_type_radio,
  182. "excellon_milling_dia": self.ui.excellon_defaults_form.excellon_opt_group.mill_dia_entry,
  183. "excellon_cutz": self.ui.excellon_defaults_form.excellon_opt_group.cutz_entry,
  184. "excellon_multidepth": self.ui.excellon_defaults_form.excellon_opt_group.mpass_cb,
  185. "excellon_depthperpass": self.ui.excellon_defaults_form.excellon_opt_group.maxdepth_entry,
  186. "excellon_travelz": self.ui.excellon_defaults_form.excellon_opt_group.travelz_entry,
  187. "excellon_endz": self.ui.excellon_defaults_form.excellon_opt_group.endz_entry,
  188. "excellon_endxy": self.ui.excellon_defaults_form.excellon_opt_group.endxy_entry,
  189. "excellon_feedrate_z": self.ui.excellon_defaults_form.excellon_opt_group.feedrate_z_entry,
  190. "excellon_spindlespeed": self.ui.excellon_defaults_form.excellon_opt_group.spindlespeed_entry,
  191. "excellon_dwell": self.ui.excellon_defaults_form.excellon_opt_group.dwell_cb,
  192. "excellon_dwelltime": self.ui.excellon_defaults_form.excellon_opt_group.dwelltime_entry,
  193. "excellon_toolchange": self.ui.excellon_defaults_form.excellon_opt_group.toolchange_cb,
  194. "excellon_toolchangez": self.ui.excellon_defaults_form.excellon_opt_group.toolchangez_entry,
  195. "excellon_ppname_e": self.ui.excellon_defaults_form.excellon_opt_group.pp_excellon_name_cb,
  196. "excellon_tooldia": self.ui.excellon_defaults_form.excellon_opt_group.tooldia_entry,
  197. "excellon_slot_tooldia": self.ui.excellon_defaults_form.excellon_opt_group.slot_tooldia_entry,
  198. "excellon_gcode_type": self.ui.excellon_defaults_form.excellon_opt_group.excellon_gcode_type_radio,
  199. # Excellon Advanced Options
  200. "excellon_offset": self.ui.excellon_defaults_form.excellon_adv_opt_group.offset_entry,
  201. "excellon_toolchangexy": self.ui.excellon_defaults_form.excellon_adv_opt_group.toolchangexy_entry,
  202. "excellon_startz": self.ui.excellon_defaults_form.excellon_adv_opt_group.estartz_entry,
  203. "excellon_feedrate_rapid": self.ui.excellon_defaults_form.excellon_adv_opt_group.feedrate_rapid_entry,
  204. "excellon_z_pdepth": self.ui.excellon_defaults_form.excellon_adv_opt_group.pdepth_entry,
  205. "excellon_feedrate_probe": self.ui.excellon_defaults_form.excellon_adv_opt_group.feedrate_probe_entry,
  206. "excellon_spindledir": self.ui.excellon_defaults_form.excellon_adv_opt_group.spindledir_radio,
  207. "excellon_f_plunge": self.ui.excellon_defaults_form.excellon_adv_opt_group.fplunge_cb,
  208. "excellon_f_retract": self.ui.excellon_defaults_form.excellon_adv_opt_group.fretract_cb,
  209. # Excellon Export
  210. "excellon_exp_units": self.ui.excellon_defaults_form.excellon_exp_group.excellon_units_radio,
  211. "excellon_exp_format": self.ui.excellon_defaults_form.excellon_exp_group.format_radio,
  212. "excellon_exp_integer": self.ui.excellon_defaults_form.excellon_exp_group.format_whole_entry,
  213. "excellon_exp_decimals": self.ui.excellon_defaults_form.excellon_exp_group.format_dec_entry,
  214. "excellon_exp_zeros": self.ui.excellon_defaults_form.excellon_exp_group.zeros_radio,
  215. "excellon_exp_slot_type": self.ui.excellon_defaults_form.excellon_exp_group.slot_type_radio,
  216. # Excellon Editor
  217. "excellon_editor_sel_limit": self.ui.excellon_defaults_form.excellon_editor_group.sel_limit_entry,
  218. "excellon_editor_newdia": self.ui.excellon_defaults_form.excellon_editor_group.addtool_entry,
  219. "excellon_editor_array_size": self.ui.excellon_defaults_form.excellon_editor_group.drill_array_size_entry,
  220. "excellon_editor_lin_dir": self.ui.excellon_defaults_form.excellon_editor_group.drill_axis_radio,
  221. "excellon_editor_lin_pitch": self.ui.excellon_defaults_form.excellon_editor_group.drill_pitch_entry,
  222. "excellon_editor_lin_angle": self.ui.excellon_defaults_form.excellon_editor_group.drill_angle_entry,
  223. "excellon_editor_circ_dir": self.ui.excellon_defaults_form.excellon_editor_group.drill_circular_dir_radio,
  224. "excellon_editor_circ_angle":
  225. self.ui.excellon_defaults_form.excellon_editor_group.drill_circular_angle_entry,
  226. # Excellon Slots
  227. "excellon_editor_slot_direction":
  228. self.ui.excellon_defaults_form.excellon_editor_group.slot_axis_radio,
  229. "excellon_editor_slot_angle":
  230. self.ui.excellon_defaults_form.excellon_editor_group.slot_angle_spinner,
  231. "excellon_editor_slot_length":
  232. self.ui.excellon_defaults_form.excellon_editor_group.slot_length_entry,
  233. # Excellon Slots
  234. "excellon_editor_slot_array_size":
  235. self.ui.excellon_defaults_form.excellon_editor_group.slot_array_size_entry,
  236. "excellon_editor_slot_lin_dir": self.ui.excellon_defaults_form.excellon_editor_group.slot_array_axis_radio,
  237. "excellon_editor_slot_lin_pitch":
  238. self.ui.excellon_defaults_form.excellon_editor_group.slot_array_pitch_entry,
  239. "excellon_editor_slot_lin_angle":
  240. self.ui.excellon_defaults_form.excellon_editor_group.slot_array_angle_entry,
  241. "excellon_editor_slot_circ_dir":
  242. self.ui.excellon_defaults_form.excellon_editor_group.slot_array_circular_dir_radio,
  243. "excellon_editor_slot_circ_angle":
  244. self.ui.excellon_defaults_form.excellon_editor_group.slot_array_circular_angle_entry,
  245. # Geometry General
  246. "geometry_plot": self.ui.geometry_defaults_form.geometry_gen_group.plot_cb,
  247. "geometry_circle_steps": self.ui.geometry_defaults_form.geometry_gen_group.circle_steps_entry,
  248. "geometry_cnctooldia": self.ui.geometry_defaults_form.geometry_gen_group.cnctooldia_entry,
  249. "geometry_plot_line": self.ui.geometry_defaults_form.geometry_gen_group.line_color_entry,
  250. # Geometry Options
  251. "geometry_cutz": self.ui.geometry_defaults_form.geometry_opt_group.cutz_entry,
  252. "geometry_travelz": self.ui.geometry_defaults_form.geometry_opt_group.travelz_entry,
  253. "geometry_feedrate": self.ui.geometry_defaults_form.geometry_opt_group.cncfeedrate_entry,
  254. "geometry_feedrate_z": self.ui.geometry_defaults_form.geometry_opt_group.feedrate_z_entry,
  255. "geometry_spindlespeed": self.ui.geometry_defaults_form.geometry_opt_group.cncspindlespeed_entry,
  256. "geometry_dwell": self.ui.geometry_defaults_form.geometry_opt_group.dwell_cb,
  257. "geometry_dwelltime": self.ui.geometry_defaults_form.geometry_opt_group.dwelltime_entry,
  258. "geometry_ppname_g": self.ui.geometry_defaults_form.geometry_opt_group.pp_geometry_name_cb,
  259. "geometry_toolchange": self.ui.geometry_defaults_form.geometry_opt_group.toolchange_cb,
  260. "geometry_toolchangez": self.ui.geometry_defaults_form.geometry_opt_group.toolchangez_entry,
  261. "geometry_endz": self.ui.geometry_defaults_form.geometry_opt_group.endz_entry,
  262. "geometry_endxy": self.ui.geometry_defaults_form.geometry_opt_group.endxy_entry,
  263. "geometry_depthperpass": self.ui.geometry_defaults_form.geometry_opt_group.depthperpass_entry,
  264. "geometry_multidepth": self.ui.geometry_defaults_form.geometry_opt_group.multidepth_cb,
  265. # Geometry Advanced Options
  266. "geometry_toolchangexy": self.ui.geometry_defaults_form.geometry_adv_opt_group.toolchangexy_entry,
  267. "geometry_startz": self.ui.geometry_defaults_form.geometry_adv_opt_group.gstartz_entry,
  268. "geometry_feedrate_rapid": self.ui.geometry_defaults_form.geometry_adv_opt_group.feedrate_rapid_entry,
  269. "geometry_extracut": self.ui.geometry_defaults_form.geometry_adv_opt_group.extracut_cb,
  270. "geometry_extracut_length": self.ui.geometry_defaults_form.geometry_adv_opt_group.e_cut_entry,
  271. "geometry_z_pdepth": self.ui.geometry_defaults_form.geometry_adv_opt_group.pdepth_entry,
  272. "geometry_feedrate_probe": self.ui.geometry_defaults_form.geometry_adv_opt_group.feedrate_probe_entry,
  273. "geometry_spindledir": self.ui.geometry_defaults_form.geometry_adv_opt_group.spindledir_radio,
  274. "geometry_f_plunge": self.ui.geometry_defaults_form.geometry_adv_opt_group.fplunge_cb,
  275. "geometry_segx": self.ui.geometry_defaults_form.geometry_adv_opt_group.segx_entry,
  276. "geometry_segy": self.ui.geometry_defaults_form.geometry_adv_opt_group.segy_entry,
  277. # Geometry Editor
  278. "geometry_editor_sel_limit": self.ui.geometry_defaults_form.geometry_editor_group.sel_limit_entry,
  279. "geometry_editor_milling_type": self.ui.geometry_defaults_form.geometry_editor_group.milling_type_radio,
  280. # CNCJob General
  281. "cncjob_plot": self.ui.cncjob_defaults_form.cncjob_gen_group.plot_cb,
  282. "cncjob_plot_kind": self.ui.cncjob_defaults_form.cncjob_gen_group.cncplot_method_radio,
  283. "cncjob_annotation": self.ui.cncjob_defaults_form.cncjob_gen_group.annotation_cb,
  284. "cncjob_tooldia": self.ui.cncjob_defaults_form.cncjob_gen_group.tooldia_entry,
  285. "cncjob_coords_type": self.ui.cncjob_defaults_form.cncjob_gen_group.coords_type_radio,
  286. "cncjob_coords_decimals": self.ui.cncjob_defaults_form.cncjob_gen_group.coords_dec_entry,
  287. "cncjob_fr_decimals": self.ui.cncjob_defaults_form.cncjob_gen_group.fr_dec_entry,
  288. "cncjob_steps_per_circle": self.ui.cncjob_defaults_form.cncjob_gen_group.steps_per_circle_entry,
  289. "cncjob_line_ending": self.ui.cncjob_defaults_form.cncjob_gen_group.line_ending_cb,
  290. "cncjob_plot_line": self.ui.cncjob_defaults_form.cncjob_gen_group.line_color_entry,
  291. "cncjob_plot_fill": self.ui.cncjob_defaults_form.cncjob_gen_group.fill_color_entry,
  292. "cncjob_travel_line": self.ui.cncjob_defaults_form.cncjob_gen_group.tline_color_entry,
  293. "cncjob_travel_fill": self.ui.cncjob_defaults_form.cncjob_gen_group.tfill_color_entry,
  294. # CNC Job Options
  295. "cncjob_prepend": self.ui.cncjob_defaults_form.cncjob_opt_group.prepend_text,
  296. "cncjob_append": self.ui.cncjob_defaults_form.cncjob_opt_group.append_text,
  297. # CNC Job Advanced Options
  298. "cncjob_toolchange_macro": self.ui.cncjob_defaults_form.cncjob_adv_opt_group.toolchange_text,
  299. "cncjob_toolchange_macro_enable": self.ui.cncjob_defaults_form.cncjob_adv_opt_group.toolchange_cb,
  300. "cncjob_annotation_fontsize": self.ui.cncjob_defaults_form.cncjob_adv_opt_group.annotation_fontsize_sp,
  301. "cncjob_annotation_fontcolor": self.ui.cncjob_defaults_form.cncjob_adv_opt_group.annotation_fontcolor_entry,
  302. # NCC Tool
  303. "tools_ncctools": self.ui.tools_defaults_form.tools_ncc_group.ncc_tool_dia_entry,
  304. "tools_nccorder": self.ui.tools_defaults_form.tools_ncc_group.ncc_order_radio,
  305. "tools_nccoverlap": self.ui.tools_defaults_form.tools_ncc_group.ncc_overlap_entry,
  306. "tools_nccmargin": self.ui.tools_defaults_form.tools_ncc_group.ncc_margin_entry,
  307. "tools_nccmethod": self.ui.tools_defaults_form.tools_ncc_group.ncc_method_combo,
  308. "tools_nccconnect": self.ui.tools_defaults_form.tools_ncc_group.ncc_connect_cb,
  309. "tools_ncccontour": self.ui.tools_defaults_form.tools_ncc_group.ncc_contour_cb,
  310. "tools_nccrest": self.ui.tools_defaults_form.tools_ncc_group.ncc_rest_cb,
  311. "tools_ncc_offset_choice": self.ui.tools_defaults_form.tools_ncc_group.ncc_choice_offset_cb,
  312. "tools_ncc_offset_value": self.ui.tools_defaults_form.tools_ncc_group.ncc_offset_spinner,
  313. "tools_nccref": self.ui.tools_defaults_form.tools_ncc_group.select_combo,
  314. "tools_ncc_area_shape": self.ui.tools_defaults_form.tools_ncc_group.area_shape_radio,
  315. "tools_ncc_plotting": self.ui.tools_defaults_form.tools_ncc_group.ncc_plotting_radio,
  316. "tools_nccmilling_type": self.ui.tools_defaults_form.tools_ncc_group.milling_type_radio,
  317. "tools_ncctool_type": self.ui.tools_defaults_form.tools_ncc_group.tool_type_radio,
  318. "tools_ncccutz": self.ui.tools_defaults_form.tools_ncc_group.cutz_entry,
  319. "tools_ncctipdia": self.ui.tools_defaults_form.tools_ncc_group.tipdia_entry,
  320. "tools_ncctipangle": self.ui.tools_defaults_form.tools_ncc_group.tipangle_entry,
  321. "tools_nccnewdia": self.ui.tools_defaults_form.tools_ncc_group.newdia_entry,
  322. # CutOut Tool
  323. "tools_cutouttooldia": self.ui.tools_defaults_form.tools_cutout_group.cutout_tooldia_entry,
  324. "tools_cutoutkind": self.ui.tools_defaults_form.tools_cutout_group.obj_kind_combo,
  325. "tools_cutoutmargin": self.ui.tools_defaults_form.tools_cutout_group.cutout_margin_entry,
  326. "tools_cutout_z": self.ui.tools_defaults_form.tools_cutout_group.cutz_entry,
  327. "tools_cutout_depthperpass": self.ui.tools_defaults_form.tools_cutout_group.maxdepth_entry,
  328. "tools_cutout_mdepth": self.ui.tools_defaults_form.tools_cutout_group.mpass_cb,
  329. "tools_cutoutgapsize": self.ui.tools_defaults_form.tools_cutout_group.cutout_gap_entry,
  330. "tools_gaps_ff": self.ui.tools_defaults_form.tools_cutout_group.gaps_combo,
  331. "tools_cutout_convexshape": self.ui.tools_defaults_form.tools_cutout_group.convex_box,
  332. # Paint Area Tool
  333. "tools_painttooldia": self.ui.tools_defaults_form.tools_paint_group.painttooldia_entry,
  334. "tools_paintorder": self.ui.tools_defaults_form.tools_paint_group.paint_order_radio,
  335. "tools_paintoverlap": self.ui.tools_defaults_form.tools_paint_group.paintoverlap_entry,
  336. "tools_paintmargin": self.ui.tools_defaults_form.tools_paint_group.paintmargin_entry,
  337. "tools_paintmethod": self.ui.tools_defaults_form.tools_paint_group.paintmethod_combo,
  338. "tools_selectmethod": self.ui.tools_defaults_form.tools_paint_group.selectmethod_combo,
  339. "tools_paint_area_shape": self.ui.tools_defaults_form.tools_paint_group.area_shape_radio,
  340. "tools_pathconnect": self.ui.tools_defaults_form.tools_paint_group.pathconnect_cb,
  341. "tools_paintcontour": self.ui.tools_defaults_form.tools_paint_group.contour_cb,
  342. "tools_paint_plotting": self.ui.tools_defaults_form.tools_paint_group.paint_plotting_radio,
  343. "tools_paintrest": self.ui.tools_defaults_form.tools_paint_group.rest_cb,
  344. "tools_painttool_type": self.ui.tools_defaults_form.tools_paint_group.tool_type_radio,
  345. "tools_paintcutz": self.ui.tools_defaults_form.tools_paint_group.cutz_entry,
  346. "tools_painttipdia": self.ui.tools_defaults_form.tools_paint_group.tipdia_entry,
  347. "tools_painttipangle": self.ui.tools_defaults_form.tools_paint_group.tipangle_entry,
  348. "tools_paintnewdia": self.ui.tools_defaults_form.tools_paint_group.newdia_entry,
  349. # 2-sided Tool
  350. "tools_2sided_mirror_axis": self.ui.tools_defaults_form.tools_2sided_group.mirror_axis_radio,
  351. "tools_2sided_axis_loc": self.ui.tools_defaults_form.tools_2sided_group.axis_location_radio,
  352. "tools_2sided_drilldia": self.ui.tools_defaults_form.tools_2sided_group.drill_dia_entry,
  353. "tools_2sided_allign_axis": self.ui.tools_defaults_form.tools_2sided_group.align_axis_radio,
  354. # Film Tool
  355. "tools_film_type": self.ui.tools_defaults_form.tools_film_group.film_type_radio,
  356. "tools_film_boundary": self.ui.tools_defaults_form.tools_film_group.film_boundary_entry,
  357. "tools_film_scale_stroke": self.ui.tools_defaults_form.tools_film_group.film_scale_stroke_entry,
  358. "tools_film_color": self.ui.tools_defaults_form.tools_film_group.film_color_entry,
  359. "tools_film_scale_cb": self.ui.tools_defaults_form.tools_film_group.film_scale_cb,
  360. "tools_film_scale_x_entry": self.ui.tools_defaults_form.tools_film_group.film_scalex_entry,
  361. "tools_film_scale_y_entry": self.ui.tools_defaults_form.tools_film_group.film_scaley_entry,
  362. "tools_film_skew_cb": self.ui.tools_defaults_form.tools_film_group.film_skew_cb,
  363. "tools_film_skew_x_entry": self.ui.tools_defaults_form.tools_film_group.film_skewx_entry,
  364. "tools_film_skew_y_entry": self.ui.tools_defaults_form.tools_film_group.film_skewy_entry,
  365. "tools_film_skew_ref_radio": self.ui.tools_defaults_form.tools_film_group.film_skew_reference,
  366. "tools_film_mirror_cb": self.ui.tools_defaults_form.tools_film_group.film_mirror_cb,
  367. "tools_film_mirror_axis_radio": self.ui.tools_defaults_form.tools_film_group.film_mirror_axis,
  368. "tools_film_file_type_radio": self.ui.tools_defaults_form.tools_film_group.file_type_radio,
  369. "tools_film_orientation": self.ui.tools_defaults_form.tools_film_group.orientation_radio,
  370. "tools_film_pagesize": self.ui.tools_defaults_form.tools_film_group.pagesize_combo,
  371. # Panelize Tool
  372. "tools_panelize_spacing_columns": self.ui.tools_defaults_form.tools_panelize_group.pspacing_columns,
  373. "tools_panelize_spacing_rows": self.ui.tools_defaults_form.tools_panelize_group.pspacing_rows,
  374. "tools_panelize_columns": self.ui.tools_defaults_form.tools_panelize_group.pcolumns,
  375. "tools_panelize_rows": self.ui.tools_defaults_form.tools_panelize_group.prows,
  376. "tools_panelize_constrain": self.ui.tools_defaults_form.tools_panelize_group.pconstrain_cb,
  377. "tools_panelize_constrainx": self.ui.tools_defaults_form.tools_panelize_group.px_width_entry,
  378. "tools_panelize_constrainy": self.ui.tools_defaults_form.tools_panelize_group.py_height_entry,
  379. "tools_panelize_panel_type": self.ui.tools_defaults_form.tools_panelize_group.panel_type_radio,
  380. # Calculators Tool
  381. "tools_calc_vshape_tip_dia": self.ui.tools_defaults_form.tools_calculators_group.tip_dia_entry,
  382. "tools_calc_vshape_tip_angle": self.ui.tools_defaults_form.tools_calculators_group.tip_angle_entry,
  383. "tools_calc_vshape_cut_z": self.ui.tools_defaults_form.tools_calculators_group.cut_z_entry,
  384. "tools_calc_electro_length": self.ui.tools_defaults_form.tools_calculators_group.pcblength_entry,
  385. "tools_calc_electro_width": self.ui.tools_defaults_form.tools_calculators_group.pcbwidth_entry,
  386. "tools_calc_electro_cdensity": self.ui.tools_defaults_form.tools_calculators_group.cdensity_entry,
  387. "tools_calc_electro_growth": self.ui.tools_defaults_form.tools_calculators_group.growth_entry,
  388. # Transformations Tool
  389. "tools_transform_rotate": self.ui.tools_defaults_form.tools_transform_group.rotate_entry,
  390. "tools_transform_skew_x": self.ui.tools_defaults_form.tools_transform_group.skewx_entry,
  391. "tools_transform_skew_y": self.ui.tools_defaults_form.tools_transform_group.skewy_entry,
  392. "tools_transform_scale_x": self.ui.tools_defaults_form.tools_transform_group.scalex_entry,
  393. "tools_transform_scale_y": self.ui.tools_defaults_form.tools_transform_group.scaley_entry,
  394. "tools_transform_scale_link": self.ui.tools_defaults_form.tools_transform_group.link_cb,
  395. "tools_transform_scale_reference": self.ui.tools_defaults_form.tools_transform_group.reference_cb,
  396. "tools_transform_offset_x": self.ui.tools_defaults_form.tools_transform_group.offx_entry,
  397. "tools_transform_offset_y": self.ui.tools_defaults_form.tools_transform_group.offy_entry,
  398. "tools_transform_mirror_reference": self.ui.tools_defaults_form.tools_transform_group.mirror_reference_cb,
  399. "tools_transform_mirror_point": self.ui.tools_defaults_form.tools_transform_group.flip_ref_entry,
  400. "tools_transform_buffer_dis": self.ui.tools_defaults_form.tools_transform_group.buffer_entry,
  401. "tools_transform_buffer_factor": self.ui.tools_defaults_form.tools_transform_group.buffer_factor_entry,
  402. "tools_transform_buffer_corner": self.ui.tools_defaults_form.tools_transform_group.buffer_rounded_cb,
  403. # SolderPaste Dispensing Tool
  404. "tools_solderpaste_tools": self.ui.tools_defaults_form.tools_solderpaste_group.nozzle_tool_dia_entry,
  405. "tools_solderpaste_new": self.ui.tools_defaults_form.tools_solderpaste_group.addtool_entry,
  406. "tools_solderpaste_z_start": self.ui.tools_defaults_form.tools_solderpaste_group.z_start_entry,
  407. "tools_solderpaste_z_dispense": self.ui.tools_defaults_form.tools_solderpaste_group.z_dispense_entry,
  408. "tools_solderpaste_z_stop": self.ui.tools_defaults_form.tools_solderpaste_group.z_stop_entry,
  409. "tools_solderpaste_z_travel": self.ui.tools_defaults_form.tools_solderpaste_group.z_travel_entry,
  410. "tools_solderpaste_z_toolchange": self.ui.tools_defaults_form.tools_solderpaste_group.z_toolchange_entry,
  411. "tools_solderpaste_xy_toolchange": self.ui.tools_defaults_form.tools_solderpaste_group.xy_toolchange_entry,
  412. "tools_solderpaste_frxy": self.ui.tools_defaults_form.tools_solderpaste_group.frxy_entry,
  413. "tools_solderpaste_frz": self.ui.tools_defaults_form.tools_solderpaste_group.frz_entry,
  414. "tools_solderpaste_frz_dispense": self.ui.tools_defaults_form.tools_solderpaste_group.frz_dispense_entry,
  415. "tools_solderpaste_speedfwd": self.ui.tools_defaults_form.tools_solderpaste_group.speedfwd_entry,
  416. "tools_solderpaste_dwellfwd": self.ui.tools_defaults_form.tools_solderpaste_group.dwellfwd_entry,
  417. "tools_solderpaste_speedrev": self.ui.tools_defaults_form.tools_solderpaste_group.speedrev_entry,
  418. "tools_solderpaste_dwellrev": self.ui.tools_defaults_form.tools_solderpaste_group.dwellrev_entry,
  419. "tools_solderpaste_pp": self.ui.tools_defaults_form.tools_solderpaste_group.pp_combo,
  420. "tools_sub_close_paths": self.ui.tools_defaults_form.tools_sub_group.close_paths_cb,
  421. # #######################################################################################################
  422. # ########################################## TOOLS 2 ####################################################
  423. # #######################################################################################################
  424. # Optimal Tool
  425. "tools_opt_precision": self.ui.tools2_defaults_form.tools2_optimal_group.precision_sp,
  426. # Check Rules Tool
  427. "tools_cr_trace_size": self.ui.tools2_defaults_form.tools2_checkrules_group.trace_size_cb,
  428. "tools_cr_trace_size_val": self.ui.tools2_defaults_form.tools2_checkrules_group.trace_size_entry,
  429. "tools_cr_c2c": self.ui.tools2_defaults_form.tools2_checkrules_group.clearance_copper2copper_cb,
  430. "tools_cr_c2c_val": self.ui.tools2_defaults_form.tools2_checkrules_group.clearance_copper2copper_entry,
  431. "tools_cr_c2o": self.ui.tools2_defaults_form.tools2_checkrules_group.clearance_copper2ol_cb,
  432. "tools_cr_c2o_val": self.ui.tools2_defaults_form.tools2_checkrules_group.clearance_copper2ol_entry,
  433. "tools_cr_s2s": self.ui.tools2_defaults_form.tools2_checkrules_group.clearance_silk2silk_cb,
  434. "tools_cr_s2s_val": self.ui.tools2_defaults_form.tools2_checkrules_group.clearance_silk2silk_entry,
  435. "tools_cr_s2sm": self.ui.tools2_defaults_form.tools2_checkrules_group.clearance_silk2sm_cb,
  436. "tools_cr_s2sm_val": self.ui.tools2_defaults_form.tools2_checkrules_group.clearance_silk2sm_entry,
  437. "tools_cr_s2o": self.ui.tools2_defaults_form.tools2_checkrules_group.clearance_silk2ol_cb,
  438. "tools_cr_s2o_val": self.ui.tools2_defaults_form.tools2_checkrules_group.clearance_silk2ol_entry,
  439. "tools_cr_sm2sm": self.ui.tools2_defaults_form.tools2_checkrules_group.clearance_sm2sm_cb,
  440. "tools_cr_sm2sm_val": self.ui.tools2_defaults_form.tools2_checkrules_group.clearance_sm2sm_entry,
  441. "tools_cr_ri": self.ui.tools2_defaults_form.tools2_checkrules_group.ring_integrity_cb,
  442. "tools_cr_ri_val": self.ui.tools2_defaults_form.tools2_checkrules_group.ring_integrity_entry,
  443. "tools_cr_h2h": self.ui.tools2_defaults_form.tools2_checkrules_group.clearance_d2d_cb,
  444. "tools_cr_h2h_val": self.ui.tools2_defaults_form.tools2_checkrules_group.clearance_d2d_entry,
  445. "tools_cr_dh": self.ui.tools2_defaults_form.tools2_checkrules_group.drill_size_cb,
  446. "tools_cr_dh_val": self.ui.tools2_defaults_form.tools2_checkrules_group.drill_size_entry,
  447. # QRCode Tool
  448. "tools_qrcode_version": self.ui.tools2_defaults_form.tools2_qrcode_group.version_entry,
  449. "tools_qrcode_error": self.ui.tools2_defaults_form.tools2_qrcode_group.error_radio,
  450. "tools_qrcode_box_size": self.ui.tools2_defaults_form.tools2_qrcode_group.bsize_entry,
  451. "tools_qrcode_border_size": self.ui.tools2_defaults_form.tools2_qrcode_group.border_size_entry,
  452. "tools_qrcode_qrdata": self.ui.tools2_defaults_form.tools2_qrcode_group.text_data,
  453. "tools_qrcode_polarity": self.ui.tools2_defaults_form.tools2_qrcode_group.pol_radio,
  454. "tools_qrcode_rounded": self.ui.tools2_defaults_form.tools2_qrcode_group.bb_radio,
  455. "tools_qrcode_fill_color": self.ui.tools2_defaults_form.tools2_qrcode_group.fill_color_entry,
  456. "tools_qrcode_back_color": self.ui.tools2_defaults_form.tools2_qrcode_group.back_color_entry,
  457. "tools_qrcode_sel_limit": self.ui.tools2_defaults_form.tools2_qrcode_group.sel_limit_entry,
  458. # Copper Thieving Tool
  459. "tools_copper_thieving_clearance": self.ui.tools2_defaults_form.tools2_cfill_group.clearance_entry,
  460. "tools_copper_thieving_margin": self.ui.tools2_defaults_form.tools2_cfill_group.margin_entry,
  461. "tools_copper_thieving_reference": self.ui.tools2_defaults_form.tools2_cfill_group.reference_radio,
  462. "tools_copper_thieving_box_type": self.ui.tools2_defaults_form.tools2_cfill_group.bbox_type_radio,
  463. "tools_copper_thieving_circle_steps": self.ui.tools2_defaults_form.tools2_cfill_group.circlesteps_entry,
  464. "tools_copper_thieving_fill_type": self.ui.tools2_defaults_form.tools2_cfill_group.fill_type_radio,
  465. "tools_copper_thieving_dots_dia": self.ui.tools2_defaults_form.tools2_cfill_group.dot_dia_entry,
  466. "tools_copper_thieving_dots_spacing": self.ui.tools2_defaults_form.tools2_cfill_group.dot_spacing_entry,
  467. "tools_copper_thieving_squares_size": self.ui.tools2_defaults_form.tools2_cfill_group.square_size_entry,
  468. "tools_copper_thieving_squares_spacing":
  469. self.ui.tools2_defaults_form.tools2_cfill_group.squares_spacing_entry,
  470. "tools_copper_thieving_lines_size": self.ui.tools2_defaults_form.tools2_cfill_group.line_size_entry,
  471. "tools_copper_thieving_lines_spacing": self.ui.tools2_defaults_form.tools2_cfill_group.lines_spacing_entry,
  472. "tools_copper_thieving_rb_margin": self.ui.tools2_defaults_form.tools2_cfill_group.rb_margin_entry,
  473. "tools_copper_thieving_rb_thickness": self.ui.tools2_defaults_form.tools2_cfill_group.rb_thickness_entry,
  474. "tools_copper_thieving_mask_clearance": self.ui.tools2_defaults_form.tools2_cfill_group.clearance_ppm_entry,
  475. # Fiducials Tool
  476. "tools_fiducials_dia": self.ui.tools2_defaults_form.tools2_fiducials_group.dia_entry,
  477. "tools_fiducials_margin": self.ui.tools2_defaults_form.tools2_fiducials_group.margin_entry,
  478. "tools_fiducials_mode": self.ui.tools2_defaults_form.tools2_fiducials_group.mode_radio,
  479. "tools_fiducials_second_pos": self.ui.tools2_defaults_form.tools2_fiducials_group.pos_radio,
  480. "tools_fiducials_type": self.ui.tools2_defaults_form.tools2_fiducials_group.fid_type_radio,
  481. "tools_fiducials_line_thickness": self.ui.tools2_defaults_form.tools2_fiducials_group.line_thickness_entry,
  482. # Calibration Tool
  483. "tools_cal_calsource": self.ui.tools2_defaults_form.tools2_cal_group.cal_source_radio,
  484. "tools_cal_travelz": self.ui.tools2_defaults_form.tools2_cal_group.travelz_entry,
  485. "tools_cal_verz": self.ui.tools2_defaults_form.tools2_cal_group.verz_entry,
  486. "tools_cal_zeroz": self.ui.tools2_defaults_form.tools2_cal_group.zeroz_cb,
  487. "tools_cal_toolchangez": self.ui.tools2_defaults_form.tools2_cal_group.toolchangez_entry,
  488. "tools_cal_toolchange_xy": self.ui.tools2_defaults_form.tools2_cal_group.toolchange_xy_entry,
  489. "tools_cal_sec_point": self.ui.tools2_defaults_form.tools2_cal_group.second_point_radio,
  490. # Extract Drills Tool
  491. "tools_edrills_hole_type": self.ui.tools2_defaults_form.tools2_edrills_group.hole_size_radio,
  492. "tools_edrills_hole_fixed_dia": self.ui.tools2_defaults_form.tools2_edrills_group.dia_entry,
  493. "tools_edrills_hole_prop_factor": self.ui.tools2_defaults_form.tools2_edrills_group.factor_entry,
  494. "tools_edrills_circular_ring": self.ui.tools2_defaults_form.tools2_edrills_group.circular_ring_entry,
  495. "tools_edrills_oblong_ring": self.ui.tools2_defaults_form.tools2_edrills_group.oblong_ring_entry,
  496. "tools_edrills_square_ring": self.ui.tools2_defaults_form.tools2_edrills_group.square_ring_entry,
  497. "tools_edrills_rectangular_ring": self.ui.tools2_defaults_form.tools2_edrills_group.rectangular_ring_entry,
  498. "tools_edrills_others_ring": self.ui.tools2_defaults_form.tools2_edrills_group.other_ring_entry,
  499. "tools_edrills_circular": self.ui.tools2_defaults_form.tools2_edrills_group.circular_cb,
  500. "tools_edrills_oblong": self.ui.tools2_defaults_form.tools2_edrills_group.oblong_cb,
  501. "tools_edrills_square": self.ui.tools2_defaults_form.tools2_edrills_group.square_cb,
  502. "tools_edrills_rectangular": self.ui.tools2_defaults_form.tools2_edrills_group.rectangular_cb,
  503. "tools_edrills_others": self.ui.tools2_defaults_form.tools2_edrills_group.other_cb,
  504. # Punch Gerber Tool
  505. "tools_punch_hole_type": self.ui.tools2_defaults_form.tools2_punch_group.hole_size_radio,
  506. "tools_punch_hole_fixed_dia": self.ui.tools2_defaults_form.tools2_punch_group.dia_entry,
  507. "tools_punch_hole_prop_factor": self.ui.tools2_defaults_form.tools2_punch_group.factor_entry,
  508. "tools_punch_circular_ring": self.ui.tools2_defaults_form.tools2_punch_group.circular_ring_entry,
  509. "tools_punch_oblong_ring": self.ui.tools2_defaults_form.tools2_punch_group.oblong_ring_entry,
  510. "tools_punch_square_ring": self.ui.tools2_defaults_form.tools2_punch_group.square_ring_entry,
  511. "tools_punch_rectangular_ring": self.ui.tools2_defaults_form.tools2_punch_group.rectangular_ring_entry,
  512. "tools_punch_others_ring": self.ui.tools2_defaults_form.tools2_punch_group.other_ring_entry,
  513. "tools_punch_circular": self.ui.tools2_defaults_form.tools2_punch_group.circular_cb,
  514. "tools_punch_oblong": self.ui.tools2_defaults_form.tools2_punch_group.oblong_cb,
  515. "tools_punch_square": self.ui.tools2_defaults_form.tools2_punch_group.square_cb,
  516. "tools_punch_rectangular": self.ui.tools2_defaults_form.tools2_punch_group.rectangular_cb,
  517. "tools_punch_others": self.ui.tools2_defaults_form.tools2_punch_group.other_cb,
  518. # Invert Gerber Tool
  519. "tools_invert_margin": self.ui.tools2_defaults_form.tools2_invert_group.margin_entry,
  520. "tools_invert_join_style": self.ui.tools2_defaults_form.tools2_invert_group.join_radio,
  521. # Utilities
  522. # File associations
  523. "fa_excellon": self.ui.util_defaults_form.fa_excellon_group.exc_list_text,
  524. "fa_gcode": self.ui.util_defaults_form.fa_gcode_group.gco_list_text,
  525. # "fa_geometry": self.ui.util_defaults_form.fa_geometry_group.close_paths_cb,
  526. "fa_gerber": self.ui.util_defaults_form.fa_gerber_group.grb_list_text,
  527. "util_autocomplete_keywords": self.ui.util_defaults_form.kw_group.kw_list_text,
  528. }
  529. def defaults_read_form(self):
  530. """
  531. Will read all the values in the Preferences GUI and update the defaults dictionary.
  532. :return: None
  533. """
  534. for option in self.defaults_form_fields:
  535. try:
  536. self.defaults[option] = self.defaults_form_fields[option].get_value()
  537. except Exception as e:
  538. log.debug("App.defaults_read_form() --> %s" % str(e))
  539. def defaults_write_form(self, factor=None, fl_units=None, source_dict=None):
  540. """
  541. Will set the values for all the GUI elements in Preferences GUI based on the values found in the
  542. self.defaults dictionary.
  543. :param factor: will apply a factor to the values that written in the GUI elements
  544. :param fl_units: current measuring units in FlatCAM: Metric or Inch
  545. :param source_dict: the repository of options, usually is the self.defaults
  546. :return: None
  547. """
  548. options_storage = self.defaults if source_dict is None else source_dict
  549. for option in options_storage:
  550. if source_dict:
  551. self.defaults_write_form_field(option, factor=factor, units=fl_units, defaults_dict=source_dict)
  552. else:
  553. self.defaults_write_form_field(option, factor=factor, units=fl_units)
  554. def defaults_write_form_field(self, field, factor=None, units=None, defaults_dict=None):
  555. """
  556. Basically it is the worker in the self.defaults_write_form()
  557. :param field: the GUI element in Preferences GUI to be updated
  558. :param factor: factor to be applied to the field parameter
  559. :param units: current FLatCAM measuring units
  560. :param defaults_dict: the defaults storage
  561. :return: None, it updates GUI elements
  562. """
  563. def_dict = self.defaults if defaults_dict is None else defaults_dict
  564. try:
  565. value = def_dict[field]
  566. log.debug("value is " + str(value) + " and factor is "+str(factor))
  567. if factor is not None:
  568. value *= factor
  569. form_field = self.defaults_form_fields[field]
  570. if units is None:
  571. form_field.set_value(value)
  572. elif (units == 'IN' or units == 'MM') and (field == 'global_gridx' or field == 'global_gridy'):
  573. form_field.set_value(value)
  574. except KeyError:
  575. pass
  576. except AttributeError:
  577. log.debug(field)
  578. def show_preferences_gui(self):
  579. """
  580. Called to initialize and show the Preferences GUI
  581. :return: None
  582. """
  583. gen_form = self.ui.general_defaults_form
  584. try:
  585. self.ui.general_scroll_area.takeWidget()
  586. except Exception:
  587. log.debug("Nothing to remove")
  588. self.ui.general_scroll_area.setWidget(gen_form)
  589. gen_form.show()
  590. ger_form = self.ui.gerber_defaults_form
  591. try:
  592. self.ui.gerber_scroll_area.takeWidget()
  593. except Exception:
  594. log.debug("Nothing to remove")
  595. self.ui.gerber_scroll_area.setWidget(ger_form)
  596. ger_form.show()
  597. exc_form = self.ui.excellon_defaults_form
  598. try:
  599. self.ui.excellon_scroll_area.takeWidget()
  600. except Exception:
  601. log.debug("Nothing to remove")
  602. self.ui.excellon_scroll_area.setWidget(exc_form)
  603. exc_form.show()
  604. geo_form = self.ui.geometry_defaults_form
  605. try:
  606. self.ui.geometry_scroll_area.takeWidget()
  607. except Exception:
  608. log.debug("Nothing to remove")
  609. self.ui.geometry_scroll_area.setWidget(geo_form)
  610. geo_form.show()
  611. cnc_form = self.ui.cncjob_defaults_form
  612. try:
  613. self.ui.cncjob_scroll_area.takeWidget()
  614. except Exception:
  615. log.debug("Nothing to remove")
  616. self.ui.cncjob_scroll_area.setWidget(cnc_form)
  617. cnc_form.show()
  618. tools_form = self.ui.tools_defaults_form
  619. try:
  620. self.ui.tools_scroll_area.takeWidget()
  621. except Exception:
  622. log.debug("Nothing to remove")
  623. self.ui.tools_scroll_area.setWidget(tools_form)
  624. tools_form.show()
  625. tools2_form = self.ui.tools2_defaults_form
  626. try:
  627. self.ui.tools2_scroll_area.takeWidget()
  628. except Exception:
  629. log.debug("Nothing to remove")
  630. self.ui.tools2_scroll_area.setWidget(tools2_form)
  631. tools2_form.show()
  632. fa_form = self.ui.util_defaults_form
  633. try:
  634. self.ui.fa_scroll_area.takeWidget()
  635. except Exception:
  636. log.debug("Nothing to remove")
  637. self.ui.fa_scroll_area.setWidget(fa_form)
  638. fa_form.show()
  639. # Initialize the color box's color in Preferences -> Global -> Colo
  640. self.__init_color_pickers()
  641. # Button handlers
  642. self.ui.pref_save_button.clicked.connect(lambda: self.on_save_button(save_to_file=True))
  643. self.ui.pref_apply_button.clicked.connect(lambda: self.on_save_button(save_to_file=False))
  644. self.ui.pref_close_button.clicked.connect(self.on_pref_close_button)
  645. self.ui.pref_defaults_button.clicked.connect(self.on_restore_defaults_preferences)
  646. log.debug("Finished Preferences GUI form initialization.")
  647. def __init_color_pickers(self):
  648. # Init Gerber Plot Colors
  649. self.ui.gerber_defaults_form.gerber_gen_group.pf_color_entry.set_value(self.defaults['gerber_plot_fill'])
  650. self.ui.gerber_defaults_form.gerber_gen_group.pf_color_button.setStyleSheet(
  651. "background-color:%s;"
  652. "border-color: dimgray" % str(self.defaults['gerber_plot_fill'])[:7])
  653. self.ui.gerber_defaults_form.gerber_gen_group.pf_color_alpha_spinner.set_value(
  654. int(self.defaults['gerber_plot_fill'][7:9], 16))
  655. self.ui.gerber_defaults_form.gerber_gen_group.pf_color_alpha_slider.setValue(
  656. int(self.defaults['gerber_plot_fill'][7:9], 16))
  657. self.ui.gerber_defaults_form.gerber_gen_group.pl_color_entry.set_value(self.defaults['gerber_plot_line'])
  658. self.ui.gerber_defaults_form.gerber_gen_group.pl_color_button.setStyleSheet(
  659. "background-color:%s;"
  660. "border-color: dimgray" % str(self.defaults['gerber_plot_line'])[:7])
  661. # Init Excellon Plot Colors
  662. self.ui.excellon_defaults_form.excellon_gen_group.fill_color_entry.set_value(
  663. self.defaults['excellon_plot_fill'])
  664. self.ui.excellon_defaults_form.excellon_gen_group.fill_color_button.setStyleSheet(
  665. "background-color:%s;"
  666. "border-color: dimgray" % str(self.defaults['excellon_plot_fill'])[:7])
  667. self.ui.excellon_defaults_form.excellon_gen_group.color_alpha_spinner.set_value(
  668. int(self.defaults['excellon_plot_fill'][7:9], 16))
  669. self.ui.excellon_defaults_form.excellon_gen_group.color_alpha_slider.setValue(
  670. int(self.defaults['excellon_plot_fill'][7:9], 16))
  671. self.ui.excellon_defaults_form.excellon_gen_group.line_color_entry.set_value(
  672. self.defaults['excellon_plot_line'])
  673. self.ui.excellon_defaults_form.excellon_gen_group.line_color_button.setStyleSheet(
  674. "background-color:%s;"
  675. "border-color: dimgray" % str(self.defaults['excellon_plot_line'])[:7])
  676. # Init Geometry Plot Colors
  677. self.ui.geometry_defaults_form.geometry_gen_group.line_color_entry.set_value(
  678. self.defaults['geometry_plot_line'])
  679. self.ui.geometry_defaults_form.geometry_gen_group.line_color_button.setStyleSheet(
  680. "background-color:%s;"
  681. "border-color: dimgray" % str(self.defaults['geometry_plot_line'])[:7])
  682. # Init CNCJob Travel Line Colors
  683. self.ui.cncjob_defaults_form.cncjob_gen_group.tfill_color_entry.set_value(
  684. self.defaults['cncjob_travel_fill'])
  685. self.ui.cncjob_defaults_form.cncjob_gen_group.tfill_color_button.setStyleSheet(
  686. "background-color:%s;"
  687. "border-color: dimgray" % str(self.defaults['cncjob_travel_fill'])[:7])
  688. self.ui.cncjob_defaults_form.cncjob_gen_group.tcolor_alpha_spinner.set_value(
  689. int(self.defaults['cncjob_travel_fill'][7:9], 16))
  690. self.ui.cncjob_defaults_form.cncjob_gen_group.tcolor_alpha_slider.setValue(
  691. int(self.defaults['cncjob_travel_fill'][7:9], 16))
  692. self.ui.cncjob_defaults_form.cncjob_gen_group.tline_color_entry.set_value(
  693. self.defaults['cncjob_travel_line'])
  694. self.ui.cncjob_defaults_form.cncjob_gen_group.tline_color_button.setStyleSheet(
  695. "background-color:%s;"
  696. "border-color: dimgray" % str(self.defaults['cncjob_travel_line'])[:7])
  697. # Init CNCJob Plot Colors
  698. self.ui.cncjob_defaults_form.cncjob_gen_group.fill_color_entry.set_value(
  699. self.defaults['cncjob_plot_fill'])
  700. self.ui.cncjob_defaults_form.cncjob_gen_group.fill_color_button.setStyleSheet(
  701. "background-color:%s;"
  702. "border-color: dimgray" % str(self.defaults['cncjob_plot_fill'])[:7])
  703. self.ui.cncjob_defaults_form.cncjob_gen_group.line_color_entry.set_value(
  704. self.defaults['cncjob_plot_line'])
  705. self.ui.cncjob_defaults_form.cncjob_gen_group.line_color_button.setStyleSheet(
  706. "background-color:%s;"
  707. "border-color: dimgray" % str(self.defaults['cncjob_plot_line'])[:7])
  708. # Init Left-Right Selection colors
  709. self.ui.general_defaults_form.general_gui_group.sf_color_entry.set_value(self.defaults['global_sel_fill'])
  710. self.ui.general_defaults_form.general_gui_group.sf_color_button.setStyleSheet(
  711. "background-color:%s;"
  712. "border-color: dimgray" % str(self.defaults['global_sel_fill'])[:7])
  713. self.ui.general_defaults_form.general_gui_group.sf_color_alpha_spinner.set_value(
  714. int(self.defaults['global_sel_fill'][7:9], 16))
  715. self.ui.general_defaults_form.general_gui_group.sf_color_alpha_slider.setValue(
  716. int(self.defaults['global_sel_fill'][7:9], 16))
  717. self.ui.general_defaults_form.general_gui_group.sl_color_entry.set_value(self.defaults['global_sel_line'])
  718. self.ui.general_defaults_form.general_gui_group.sl_color_button.setStyleSheet(
  719. "background-color:%s;"
  720. "border-color: dimgray" % str(self.defaults['global_sel_line'])[:7])
  721. # Init Right-Left Selection colors
  722. self.ui.general_defaults_form.general_gui_group.alt_sf_color_entry.set_value(
  723. self.defaults['global_alt_sel_fill'])
  724. self.ui.general_defaults_form.general_gui_group.alt_sf_color_button.setStyleSheet(
  725. "background-color:%s;"
  726. "border-color: dimgray" % str(self.defaults['global_alt_sel_fill'])[:7])
  727. self.ui.general_defaults_form.general_gui_group.alt_sf_color_alpha_spinner.set_value(
  728. int(self.defaults['global_sel_fill'][7:9], 16))
  729. self.ui.general_defaults_form.general_gui_group.alt_sf_color_alpha_slider.setValue(
  730. int(self.defaults['global_sel_fill'][7:9], 16))
  731. self.ui.general_defaults_form.general_gui_group.alt_sl_color_entry.set_value(
  732. self.defaults['global_alt_sel_line'])
  733. self.ui.general_defaults_form.general_gui_group.alt_sl_color_button.setStyleSheet(
  734. "background-color:%s;"
  735. "border-color: dimgray" % str(self.defaults['global_alt_sel_line'])[:7])
  736. # Init Draw color and Selection Draw Color
  737. self.ui.general_defaults_form.general_gui_group.draw_color_entry.set_value(
  738. self.defaults['global_draw_color'])
  739. self.ui.general_defaults_form.general_gui_group.draw_color_button.setStyleSheet(
  740. "background-color:%s;"
  741. "border-color: dimgray" % str(self.defaults['global_draw_color'])[:7])
  742. self.ui.general_defaults_form.general_gui_group.sel_draw_color_entry.set_value(
  743. self.defaults['global_sel_draw_color'])
  744. self.ui.general_defaults_form.general_gui_group.sel_draw_color_button.setStyleSheet(
  745. "background-color:%s;"
  746. "border-color: dimgray" % str(self.defaults['global_sel_draw_color'])[:7])
  747. # Init Project Items color
  748. self.ui.general_defaults_form.general_gui_group.proj_color_entry.set_value(
  749. self.defaults['global_proj_item_color'])
  750. self.ui.general_defaults_form.general_gui_group.proj_color_button.setStyleSheet(
  751. "background-color:%s;"
  752. "border-color: dimgray" % str(self.defaults['global_proj_item_color'])[:7])
  753. # Init Project Disabled Items color
  754. self.ui.general_defaults_form.general_gui_group.proj_color_dis_entry.set_value(
  755. self.defaults['global_proj_item_dis_color'])
  756. self.ui.general_defaults_form.general_gui_group.proj_color_dis_button.setStyleSheet(
  757. "background-color:%s;"
  758. "border-color: dimgray" % str(self.defaults['global_proj_item_dis_color'])[:7])
  759. # Init Project Disabled Items color
  760. self.ui.general_defaults_form.general_app_set_group.mouse_cursor_entry.set_value(
  761. self.defaults['global_cursor_color'])
  762. self.ui.general_defaults_form.general_app_set_group.mouse_cursor_button.setStyleSheet(
  763. "background-color:%s;"
  764. "border-color: dimgray" % str(self.defaults['global_cursor_color'])[:7])
  765. # Init the Annotation CNC Job color
  766. self.ui.cncjob_defaults_form.cncjob_adv_opt_group.annotation_fontcolor_entry.set_value(
  767. self.defaults['cncjob_annotation_fontcolor'])
  768. self.ui.cncjob_defaults_form.cncjob_adv_opt_group.annotation_fontcolor_button.setStyleSheet(
  769. "background-color:%s;"
  770. "border-color: dimgray" % str(self.defaults['cncjob_annotation_fontcolor'])[:7])
  771. # Init the Tool Film color
  772. self.ui.tools_defaults_form.tools_film_group.film_color_entry.set_value(
  773. self.defaults['tools_film_color'])
  774. self.ui.tools_defaults_form.tools_film_group.film_color_button.setStyleSheet(
  775. "background-color:%s;"
  776. "border-color: dimgray" % str(self.defaults['tools_film_color'])[:7]
  777. )
  778. # Init the Tool QRCode colors
  779. self.ui.tools2_defaults_form.tools2_qrcode_group.fill_color_entry.set_value(
  780. self.defaults['tools_qrcode_fill_color'])
  781. self.ui.tools2_defaults_form.tools2_qrcode_group.fill_color_button.setStyleSheet(
  782. "background-color:%s;"
  783. "border-color: dimgray" % str(self.defaults['tools_qrcode_fill_color'])[:7])
  784. self.ui.tools2_defaults_form.tools2_qrcode_group.back_color_entry.set_value(
  785. self.defaults['tools_qrcode_back_color'])
  786. self.ui.tools2_defaults_form.tools2_qrcode_group.back_color_button.setStyleSheet(
  787. "background-color:%s;"
  788. "border-color: dimgray" % str(self.defaults['tools_qrcode_back_color'])[:7])
  789. def on_save_button(self, save_to_file=True):
  790. log.debug("on_save_button() --> Applying preferences to file.")
  791. # Preferences saved, update flag
  792. self.preferences_changed_flag = False
  793. # Preferences save, update the color of the Preferences Tab text
  794. for idx in range(self.ui.plot_tab_area.count()):
  795. if self.ui.plot_tab_area.tabText(idx) == _("Preferences"):
  796. self.ui.plot_tab_area.tabBar.setTabTextColor(idx, QtGui.QColor('black'))
  797. # restore the default stylesheet by setting a blank one
  798. self.ui.pref_apply_button.setStyleSheet("")
  799. self.inform.emit('%s' % _("Preferences applied."))
  800. # make sure we update the self.current_defaults dict used to undo changes to self.defaults
  801. self.defaults.current_defaults.update(self.defaults)
  802. if save_to_file:
  803. self.save_defaults(silent=False)
  804. # load the defaults so they are updated into the app
  805. self.defaults.load(filename=os.path.join(self.data_path, 'current_defaults.FlatConfig'))
  806. # Re-fresh project options
  807. self.ui.app.on_options_app2project()
  808. settgs = QSettings("Open Source", "FlatCAM")
  809. # save the notebook font size
  810. fsize = self.ui.general_defaults_form.general_app_set_group.notebook_font_size_spinner.get_value()
  811. settgs.setValue('notebook_font_size', fsize)
  812. # save the axis font size
  813. g_fsize = self.ui.general_defaults_form.general_app_set_group.axis_font_size_spinner.get_value()
  814. settgs.setValue('axis_font_size', g_fsize)
  815. # save the textbox font size
  816. tb_fsize = self.ui.general_defaults_form.general_app_set_group.textbox_font_size_spinner.get_value()
  817. settgs.setValue('textbox_font_size', tb_fsize)
  818. settgs.setValue(
  819. 'machinist',
  820. 1 if self.ui.general_defaults_form.general_app_set_group.machinist_cb.get_value() else 0
  821. )
  822. # This will write the setting to the platform specific storage.
  823. del settgs
  824. if save_to_file:
  825. # close the tab and delete it
  826. for idx in range(self.ui.plot_tab_area.count()):
  827. if self.ui.plot_tab_area.tabText(idx) == _("Preferences"):
  828. self.ui.plot_tab_area.tabBar.setTabTextColor(idx, QtGui.QColor('black'))
  829. self.ui.plot_tab_area.closeTab(idx)
  830. break
  831. def on_pref_close_button(self):
  832. # Preferences saved, update flag
  833. self.preferences_changed_flag = False
  834. self.ignore_tab_close_event = True
  835. try:
  836. self.ui.general_defaults_form.general_app_group.units_radio.activated_custom.disconnect()
  837. except (TypeError, AttributeError):
  838. pass
  839. self.defaults_write_form(source_dict=self.defaults.current_defaults)
  840. self.ui.general_defaults_form.general_app_group.units_radio.activated_custom.connect(
  841. lambda: self.ui.app.on_toggle_units(no_pref=False))
  842. self.defaults.update(self.defaults.current_defaults)
  843. # Preferences save, update the color of the Preferences Tab text
  844. for idx in range(self.ui.plot_tab_area.count()):
  845. if self.ui.plot_tab_area.tabText(idx) == _("Preferences"):
  846. self.ui.plot_tab_area.tabBar.setTabTextColor(idx, QtGui.QColor('black'))
  847. self.ui.plot_tab_area.closeTab(idx)
  848. break
  849. self.inform.emit('%s' % _("Preferences closed without saving."))
  850. self.ignore_tab_close_event = False
  851. def on_restore_defaults_preferences(self):
  852. """
  853. Loads the application's factory default settings into ``self.defaults``.
  854. :return: None
  855. """
  856. log.debug("on_restore_defaults_preferences()")
  857. self.defaults.reset_to_factory_defaults()
  858. self.on_preferences_edited()
  859. self.inform.emit('[success] %s' % _("Preferences default values are restored."))
  860. def save_defaults(self, silent=False, data_path=None, first_time=False):
  861. """
  862. Saves application default options
  863. ``self.defaults`` to current_defaults.FlatConfig file.
  864. Save the toolbars visibility status to the preferences file (current_defaults.FlatConfig) to be
  865. used at the next launch of the application.
  866. :param silent: Whether to display a message in status bar or not; boolean
  867. :param data_path: The path where to save the preferences file (current_defaults.FlatConfig)
  868. When the application is portable it should be a mobile location.
  869. :param first_time: Boolean. If True will execute some code when the app is run first time
  870. :return: None
  871. """
  872. self.defaults.report_usage("save_defaults")
  873. if data_path is None:
  874. data_path = self.data_path
  875. self.defaults.propagate_defaults()
  876. if first_time is False:
  877. self.save_toolbar_view()
  878. # Save the options to disk
  879. filename = os.path.join(data_path, "current_defaults.FlatConfig")
  880. try:
  881. self.defaults.write(filename=filename)
  882. except Exception as e:
  883. log.error("save_defaults() --> Failed to write defaults to file %s" % str(e))
  884. self.inform.emit('[ERROR_NOTCL] %s %s' % (_("Failed to write defaults to file."), str(filename)))
  885. return
  886. if not silent:
  887. self.inform.emit('[success] %s' % _("Preferences saved."))
  888. # update the autosave timer
  889. self.ui.app.save_project_auto_update()
  890. def save_toolbar_view(self):
  891. """
  892. Will save the toolbar view state to the defaults
  893. :return: None
  894. """
  895. # Save the toolbar view
  896. tb_status = 0
  897. if self.ui.toolbarfile.isVisible():
  898. tb_status += 1
  899. if self.ui.toolbargeo.isVisible():
  900. tb_status += 2
  901. if self.ui.toolbarview.isVisible():
  902. tb_status += 4
  903. if self.ui.toolbartools.isVisible():
  904. tb_status += 8
  905. if self.ui.exc_edit_toolbar.isVisible():
  906. tb_status += 16
  907. if self.ui.geo_edit_toolbar.isVisible():
  908. tb_status += 32
  909. if self.ui.grb_edit_toolbar.isVisible():
  910. tb_status += 64
  911. if self.ui.snap_toolbar.isVisible():
  912. tb_status += 128
  913. if self.ui.toolbarshell.isVisible():
  914. tb_status += 256
  915. self.defaults["global_toolbar_view"] = tb_status
  916. def on_preferences_edited(self):
  917. """
  918. Executed when a preference was changed in the Edit -> Preferences tab.
  919. Will color the Preferences tab text to Red color.
  920. :return:
  921. """
  922. if self.preferences_changed_flag is False:
  923. self.inform.emit('[WARNING_NOTCL] %s' % _("Preferences edited but not saved."))
  924. for idx in range(self.ui.plot_tab_area.count()):
  925. if self.ui.plot_tab_area.tabText(idx) == _("Preferences"):
  926. self.ui.plot_tab_area.tabBar.setTabTextColor(idx, QtGui.QColor('red'))
  927. self.ui.pref_apply_button.setStyleSheet("QPushButton {color: red;}")
  928. self.preferences_changed_flag = True
  929. def on_close_preferences_tab(self):
  930. if self.ignore_tab_close_event:
  931. return
  932. # disconnect
  933. for idx in range(self.ui.pref_tab_area.count()):
  934. for tb in self.ui.pref_tab_area.widget(idx).findChildren(QtCore.QObject):
  935. try:
  936. tb.textEdited.disconnect(self.on_preferences_edited)
  937. except (TypeError, AttributeError):
  938. pass
  939. try:
  940. tb.modificationChanged.disconnect(self.on_preferences_edited)
  941. except (TypeError, AttributeError):
  942. pass
  943. try:
  944. tb.toggled.disconnect(self.on_preferences_edited)
  945. except (TypeError, AttributeError):
  946. pass
  947. try:
  948. tb.valueChanged.disconnect(self.on_preferences_edited)
  949. except (TypeError, AttributeError):
  950. pass
  951. try:
  952. tb.currentIndexChanged.disconnect(self.on_preferences_edited)
  953. except (TypeError, AttributeError):
  954. pass
  955. # Prompt user to save
  956. if self.preferences_changed_flag is True:
  957. msgbox = QtWidgets.QMessageBox()
  958. msgbox.setText(_("One or more values are changed.\n"
  959. "Do you want to save the Preferences?"))
  960. msgbox.setWindowTitle(_("Save Preferences"))
  961. msgbox.setWindowIcon(QtGui.QIcon(self.ui.app.resource_location + '/save_as.png'))
  962. bt_yes = msgbox.addButton(_('Yes'), QtWidgets.QMessageBox.YesRole)
  963. msgbox.addButton(_('No'), QtWidgets.QMessageBox.NoRole)
  964. msgbox.setDefaultButton(bt_yes)
  965. msgbox.exec_()
  966. response = msgbox.clickedButton()
  967. if response == bt_yes:
  968. self.on_save_button(save_to_file=True)
  969. self.inform.emit('[success] %s' % _("Preferences saved."))
  970. else:
  971. self.preferences_changed_flag = False
  972. self.inform.emit('')
  973. return
  974. class OptionsGroupUI(QtWidgets.QGroupBox):
  975. app = None
  976. def __init__(self, title, parent=None):
  977. # QtGui.QGroupBox.__init__(self, title, parent=parent)
  978. super(OptionsGroupUI, self).__init__()
  979. self.setStyleSheet("""
  980. QGroupBox
  981. {
  982. font-size: 16px;
  983. font-weight: bold;
  984. }
  985. """)
  986. self.layout = QtWidgets.QVBoxLayout()
  987. self.setLayout(self.layout)
  988. class GeneralPreferencesUI(QtWidgets.QWidget):
  989. def __init__(self, decimals, parent=None):
  990. QtWidgets.QWidget.__init__(self, parent=parent)
  991. self.layout = QtWidgets.QHBoxLayout()
  992. self.setLayout(self.layout)
  993. self.decimals = decimals
  994. self.general_app_group = GeneralAppPrefGroupUI(decimals=self.decimals)
  995. self.general_app_group.setMinimumWidth(250)
  996. self.general_gui_group = GeneralGUIPrefGroupUI(decimals=self.decimals)
  997. self.general_gui_group.setMinimumWidth(250)
  998. self.general_app_set_group = GeneralAPPSetGroupUI(decimals=self.decimals)
  999. self.general_app_set_group.setMinimumWidth(250)
  1000. self.layout.addWidget(self.general_app_group)
  1001. self.layout.addWidget(self.general_gui_group)
  1002. self.layout.addWidget(self.general_app_set_group)
  1003. self.layout.addStretch()
  1004. class GerberPreferencesUI(QtWidgets.QWidget):
  1005. def __init__(self, decimals, parent=None):
  1006. QtWidgets.QWidget.__init__(self, parent=parent)
  1007. self.layout = QtWidgets.QHBoxLayout()
  1008. self.setLayout(self.layout)
  1009. self.decimals = decimals
  1010. self.gerber_gen_group = GerberGenPrefGroupUI(decimals=self.decimals)
  1011. self.gerber_gen_group.setMinimumWidth(250)
  1012. self.gerber_opt_group = GerberOptPrefGroupUI(decimals=self.decimals)
  1013. self.gerber_opt_group.setMinimumWidth(250)
  1014. self.gerber_exp_group = GerberExpPrefGroupUI(decimals=self.decimals)
  1015. self.gerber_exp_group.setMinimumWidth(230)
  1016. self.gerber_adv_opt_group = GerberAdvOptPrefGroupUI(decimals=self.decimals)
  1017. self.gerber_adv_opt_group.setMinimumWidth(200)
  1018. self.gerber_editor_group = GerberEditorPrefGroupUI(decimals=self.decimals)
  1019. self.gerber_editor_group.setMinimumWidth(200)
  1020. self.vlay = QtWidgets.QVBoxLayout()
  1021. self.vlay.addWidget(self.gerber_opt_group)
  1022. self.vlay.addWidget(self.gerber_exp_group)
  1023. self.layout.addWidget(self.gerber_gen_group)
  1024. self.layout.addLayout(self.vlay)
  1025. self.layout.addWidget(self.gerber_adv_opt_group)
  1026. self.layout.addWidget(self.gerber_editor_group)
  1027. self.layout.addStretch()
  1028. class ExcellonPreferencesUI(QtWidgets.QWidget):
  1029. def __init__(self, decimals, parent=None):
  1030. QtWidgets.QWidget.__init__(self, parent=parent)
  1031. self.layout = QtWidgets.QHBoxLayout()
  1032. self.setLayout(self.layout)
  1033. self.decimals = decimals
  1034. self.excellon_gen_group = ExcellonGenPrefGroupUI(decimals=self.decimals)
  1035. self.excellon_gen_group.setMinimumWidth(220)
  1036. self.excellon_opt_group = ExcellonOptPrefGroupUI(decimals=self.decimals)
  1037. self.excellon_opt_group.setMinimumWidth(290)
  1038. self.excellon_exp_group = ExcellonExpPrefGroupUI(decimals=self.decimals)
  1039. self.excellon_exp_group.setMinimumWidth(250)
  1040. self.excellon_adv_opt_group = ExcellonAdvOptPrefGroupUI(decimals=self.decimals)
  1041. self.excellon_adv_opt_group.setMinimumWidth(250)
  1042. self.excellon_editor_group = ExcellonEditorPrefGroupUI(decimals=self.decimals)
  1043. self.excellon_editor_group.setMinimumWidth(260)
  1044. self.vlay = QtWidgets.QVBoxLayout()
  1045. self.vlay.addWidget(self.excellon_opt_group)
  1046. self.vlay.addWidget(self.excellon_exp_group)
  1047. self.layout.addWidget(self.excellon_gen_group)
  1048. self.layout.addLayout(self.vlay)
  1049. self.layout.addWidget(self.excellon_adv_opt_group)
  1050. self.layout.addWidget(self.excellon_editor_group)
  1051. self.layout.addStretch()
  1052. class GeometryPreferencesUI(QtWidgets.QWidget):
  1053. def __init__(self, decimals, parent=None):
  1054. QtWidgets.QWidget.__init__(self, parent=parent)
  1055. self.layout = QtWidgets.QHBoxLayout()
  1056. self.setLayout(self.layout)
  1057. self.decimals = decimals
  1058. self.geometry_gen_group = GeometryGenPrefGroupUI(decimals=self.decimals)
  1059. self.geometry_gen_group.setMinimumWidth(220)
  1060. self.geometry_opt_group = GeometryOptPrefGroupUI(decimals=self.decimals)
  1061. self.geometry_opt_group.setMinimumWidth(300)
  1062. self.geometry_adv_opt_group = GeometryAdvOptPrefGroupUI(decimals=self.decimals)
  1063. self.geometry_adv_opt_group.setMinimumWidth(270)
  1064. self.geometry_editor_group = GeometryEditorPrefGroupUI(decimals=self.decimals)
  1065. self.geometry_editor_group.setMinimumWidth(250)
  1066. self.layout.addWidget(self.geometry_gen_group)
  1067. self.layout.addWidget(self.geometry_opt_group)
  1068. self.layout.addWidget(self.geometry_adv_opt_group)
  1069. self.layout.addWidget(self.geometry_editor_group)
  1070. self.layout.addStretch()
  1071. class ToolsPreferencesUI(QtWidgets.QWidget):
  1072. def __init__(self, decimals, parent=None):
  1073. QtWidgets.QWidget.__init__(self, parent=parent)
  1074. self.layout = QtWidgets.QHBoxLayout()
  1075. self.setLayout(self.layout)
  1076. self.decimals = decimals
  1077. self.tools_ncc_group = ToolsNCCPrefGroupUI(decimals=self.decimals)
  1078. self.tools_ncc_group.setMinimumWidth(220)
  1079. self.tools_paint_group = ToolsPaintPrefGroupUI(decimals=self.decimals)
  1080. self.tools_paint_group.setMinimumWidth(220)
  1081. self.tools_cutout_group = ToolsCutoutPrefGroupUI(decimals=self.decimals)
  1082. self.tools_cutout_group.setMinimumWidth(220)
  1083. self.tools_2sided_group = Tools2sidedPrefGroupUI(decimals=self.decimals)
  1084. self.tools_2sided_group.setMinimumWidth(220)
  1085. self.tools_film_group = ToolsFilmPrefGroupUI(decimals=self.decimals)
  1086. self.tools_film_group.setMinimumWidth(220)
  1087. self.tools_panelize_group = ToolsPanelizePrefGroupUI(decimals=self.decimals)
  1088. self.tools_panelize_group.setMinimumWidth(220)
  1089. self.tools_calculators_group = ToolsCalculatorsPrefGroupUI(decimals=self.decimals)
  1090. self.tools_calculators_group.setMinimumWidth(220)
  1091. self.tools_transform_group = ToolsTransformPrefGroupUI(decimals=self.decimals)
  1092. self.tools_transform_group.setMinimumWidth(200)
  1093. self.tools_solderpaste_group = ToolsSolderpastePrefGroupUI(decimals=self.decimals)
  1094. self.tools_solderpaste_group.setMinimumWidth(200)
  1095. self.tools_sub_group = ToolsSubPrefGroupUI(decimals=self.decimals)
  1096. self.tools_sub_group.setMinimumWidth(200)
  1097. self.vlay = QtWidgets.QVBoxLayout()
  1098. self.vlay.addWidget(self.tools_ncc_group)
  1099. self.vlay.addWidget(self.tools_cutout_group)
  1100. self.vlay1 = QtWidgets.QVBoxLayout()
  1101. self.vlay1.addWidget(self.tools_paint_group)
  1102. self.vlay1.addWidget(self.tools_panelize_group)
  1103. self.vlay2 = QtWidgets.QVBoxLayout()
  1104. self.vlay2.addWidget(self.tools_transform_group)
  1105. self.vlay2.addWidget(self.tools_2sided_group)
  1106. self.vlay2.addWidget(self.tools_sub_group)
  1107. self.vlay3 = QtWidgets.QVBoxLayout()
  1108. self.vlay3.addWidget(self.tools_film_group)
  1109. self.vlay3.addWidget(self.tools_calculators_group)
  1110. self.vlay4 = QtWidgets.QVBoxLayout()
  1111. self.vlay4.addWidget(self.tools_solderpaste_group)
  1112. self.layout.addLayout(self.vlay)
  1113. self.layout.addLayout(self.vlay1)
  1114. self.layout.addLayout(self.vlay2)
  1115. self.layout.addLayout(self.vlay3)
  1116. self.layout.addLayout(self.vlay4)
  1117. self.layout.addStretch()
  1118. class Tools2PreferencesUI(QtWidgets.QWidget):
  1119. def __init__(self, decimals, parent=None):
  1120. QtWidgets.QWidget.__init__(self, parent=parent)
  1121. self.layout = QtWidgets.QHBoxLayout()
  1122. self.setLayout(self.layout)
  1123. self.decimals = decimals
  1124. self.tools2_checkrules_group = Tools2RulesCheckPrefGroupUI(decimals=self.decimals)
  1125. self.tools2_checkrules_group.setMinimumWidth(220)
  1126. self.tools2_optimal_group = Tools2OptimalPrefGroupUI(decimals=self.decimals)
  1127. self.tools2_optimal_group.setMinimumWidth(220)
  1128. self.tools2_qrcode_group = Tools2QRCodePrefGroupUI(decimals=self.decimals)
  1129. self.tools2_qrcode_group.setMinimumWidth(220)
  1130. self.tools2_cfill_group = Tools2CThievingPrefGroupUI(decimals=self.decimals)
  1131. self.tools2_cfill_group.setMinimumWidth(220)
  1132. self.tools2_fiducials_group = Tools2FiducialsPrefGroupUI(decimals=self.decimals)
  1133. self.tools2_fiducials_group.setMinimumWidth(220)
  1134. self.tools2_cal_group = Tools2CalPrefGroupUI(decimals=self.decimals)
  1135. self.tools2_cal_group.setMinimumWidth(220)
  1136. self.tools2_edrills_group = Tools2EDrillsPrefGroupUI(decimals=self.decimals)
  1137. self.tools2_edrills_group.setMinimumWidth(220)
  1138. self.tools2_punch_group = Tools2PunchGerberPrefGroupUI(decimals=self.decimals)
  1139. self.tools2_punch_group.setMinimumWidth(220)
  1140. self.tools2_invert_group = Tools2InvertPrefGroupUI(decimals=self.decimals)
  1141. self.tools2_invert_group.setMinimumWidth(220)
  1142. self.vlay = QtWidgets.QVBoxLayout()
  1143. self.vlay.addWidget(self.tools2_checkrules_group)
  1144. self.vlay.addWidget(self.tools2_optimal_group)
  1145. self.vlay1 = QtWidgets.QVBoxLayout()
  1146. self.vlay1.addWidget(self.tools2_qrcode_group)
  1147. self.vlay1.addWidget(self.tools2_fiducials_group)
  1148. self.vlay2 = QtWidgets.QVBoxLayout()
  1149. self.vlay2.addWidget(self.tools2_cfill_group)
  1150. self.vlay3 = QtWidgets.QVBoxLayout()
  1151. self.vlay3.addWidget(self.tools2_cal_group)
  1152. self.vlay3.addWidget(self.tools2_edrills_group)
  1153. self.vlay4 = QtWidgets.QVBoxLayout()
  1154. self.vlay4.addWidget(self.tools2_punch_group)
  1155. self.vlay4.addWidget(self.tools2_invert_group)
  1156. self.layout.addLayout(self.vlay)
  1157. self.layout.addLayout(self.vlay1)
  1158. self.layout.addLayout(self.vlay2)
  1159. self.layout.addLayout(self.vlay3)
  1160. self.layout.addLayout(self.vlay4)
  1161. self.layout.addStretch()
  1162. class CNCJobPreferencesUI(QtWidgets.QWidget):
  1163. def __init__(self, decimals, parent=None):
  1164. QtWidgets.QWidget.__init__(self, parent=parent)
  1165. self.layout = QtWidgets.QHBoxLayout()
  1166. self.setLayout(self.layout)
  1167. self.decimals = decimals
  1168. self.cncjob_gen_group = CNCJobGenPrefGroupUI(decimals=self.decimals)
  1169. self.cncjob_gen_group.setMinimumWidth(260)
  1170. self.cncjob_opt_group = CNCJobOptPrefGroupUI(decimals=self.decimals)
  1171. self.cncjob_opt_group.setMinimumWidth(260)
  1172. self.cncjob_adv_opt_group = CNCJobAdvOptPrefGroupUI(decimals=self.decimals)
  1173. self.cncjob_adv_opt_group.setMinimumWidth(260)
  1174. self.layout.addWidget(self.cncjob_gen_group)
  1175. self.layout.addWidget(self.cncjob_opt_group)
  1176. self.layout.addWidget(self.cncjob_adv_opt_group)
  1177. self.layout.addStretch()
  1178. class UtilPreferencesUI(QtWidgets.QWidget):
  1179. def __init__(self, decimals, parent=None):
  1180. QtWidgets.QWidget.__init__(self, parent=parent)
  1181. self.layout = QtWidgets.QHBoxLayout()
  1182. self.setLayout(self.layout)
  1183. self.decimals = decimals
  1184. self.vlay = QtWidgets.QVBoxLayout()
  1185. self.fa_excellon_group = FAExcPrefGroupUI(decimals=self.decimals)
  1186. self.fa_excellon_group.setMinimumWidth(260)
  1187. self.fa_gcode_group = FAGcoPrefGroupUI(decimals=self.decimals)
  1188. self.fa_gcode_group.setMinimumWidth(260)
  1189. self.vlay.addWidget(self.fa_excellon_group)
  1190. self.vlay.addWidget(self.fa_gcode_group)
  1191. self.fa_gerber_group = FAGrbPrefGroupUI(decimals=self.decimals)
  1192. self.fa_gerber_group.setMinimumWidth(260)
  1193. self.kw_group = AutoCompletePrefGroupUI(decimals=self.decimals)
  1194. self.kw_group.setMinimumWidth(260)
  1195. self.layout.addLayout(self.vlay)
  1196. self.layout.addWidget(self.fa_gerber_group)
  1197. self.layout.addWidget(self.kw_group)
  1198. self.layout.addStretch()
  1199. class GeneralGUIPrefGroupUI(OptionsGroupUI):
  1200. def __init__(self, decimals=4, parent=None):
  1201. super(GeneralGUIPrefGroupUI, self).__init__(self)
  1202. self.setTitle(str(_("GUI Preferences")))
  1203. self.decimals = decimals
  1204. # Create a grid layout for the Application general settings
  1205. grid0 = QtWidgets.QGridLayout()
  1206. self.layout.addLayout(grid0)
  1207. grid0.setColumnStretch(0, 0)
  1208. grid0.setColumnStretch(1, 1)
  1209. # Theme selection
  1210. self.theme_label = QtWidgets.QLabel('%s:' % _('Theme'))
  1211. self.theme_label.setToolTip(
  1212. _("Select a theme for FlatCAM.\n"
  1213. "It will theme the plot area.")
  1214. )
  1215. self.theme_radio = RadioSet([
  1216. {"label": _("Light"), "value": "white"},
  1217. {"label": _("Dark"), "value": "black"}
  1218. ], orientation='vertical')
  1219. grid0.addWidget(self.theme_label, 0, 0)
  1220. grid0.addWidget(self.theme_radio, 0, 1)
  1221. # Enable Gray Icons
  1222. self.gray_icons_cb = FCCheckBox('%s' % _('Use Gray Icons'))
  1223. self.gray_icons_cb.setToolTip(
  1224. _("Check this box to use a set of icons with\n"
  1225. "a lighter (gray) color. To be used when a\n"
  1226. "full dark theme is applied.")
  1227. )
  1228. grid0.addWidget(self.gray_icons_cb, 1, 0, 1, 3)
  1229. self.theme_button = FCButton(_("Apply Theme"))
  1230. self.theme_button.setToolTip(
  1231. _("Select a theme for FlatCAM.\n"
  1232. "It will theme the plot area.\n"
  1233. "The application will restart after change.")
  1234. )
  1235. grid0.addWidget(self.theme_button, 2, 0, 1, 3)
  1236. separator_line = QtWidgets.QFrame()
  1237. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  1238. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  1239. grid0.addWidget(separator_line, 3, 0, 1, 2)
  1240. # Layout selection
  1241. self.layout_label = QtWidgets.QLabel('%s:' % _('Layout'))
  1242. self.layout_label.setToolTip(
  1243. _("Select an layout for FlatCAM.\n"
  1244. "It is applied immediately.")
  1245. )
  1246. self.layout_combo = FCComboBox()
  1247. # don't translate the QCombo items as they are used in QSettings and identified by name
  1248. self.layout_combo.addItem("standard")
  1249. self.layout_combo.addItem("compact")
  1250. self.layout_combo.addItem("minimal")
  1251. grid0.addWidget(self.layout_label, 4, 0)
  1252. grid0.addWidget(self.layout_combo, 4, 1)
  1253. # Set the current index for layout_combo
  1254. qsettings = QSettings("Open Source", "FlatCAM")
  1255. if qsettings.contains("layout"):
  1256. layout = qsettings.value('layout', type=str)
  1257. idx = self.layout_combo.findText(layout.capitalize())
  1258. self.layout_combo.setCurrentIndex(idx)
  1259. # Style selection
  1260. self.style_label = QtWidgets.QLabel('%s:' % _('Style'))
  1261. self.style_label.setToolTip(
  1262. _("Select an style for FlatCAM.\n"
  1263. "It will be applied at the next app start.")
  1264. )
  1265. self.style_combo = FCComboBox()
  1266. self.style_combo.addItems(QtWidgets.QStyleFactory.keys())
  1267. # find current style
  1268. index = self.style_combo.findText(QtWidgets.qApp.style().objectName(), QtCore.Qt.MatchFixedString)
  1269. self.style_combo.setCurrentIndex(index)
  1270. self.style_combo.activated[str].connect(self.handle_style)
  1271. grid0.addWidget(self.style_label, 5, 0)
  1272. grid0.addWidget(self.style_combo, 5, 1)
  1273. # Enable High DPI Support
  1274. self.hdpi_cb = FCCheckBox('%s' % _('Activate HDPI Support'))
  1275. self.hdpi_cb.setToolTip(
  1276. _("Enable High DPI support for FlatCAM.\n"
  1277. "It will be applied at the next app start.")
  1278. )
  1279. qsettings = QSettings("Open Source", "FlatCAM")
  1280. if qsettings.contains("hdpi"):
  1281. self.hdpi_cb.set_value(qsettings.value('hdpi', type=int))
  1282. else:
  1283. self.hdpi_cb.set_value(False)
  1284. self.hdpi_cb.stateChanged.connect(self.handle_hdpi)
  1285. grid0.addWidget(self.hdpi_cb, 6, 0, 1, 3)
  1286. # Enable Hover box
  1287. self.hover_cb = FCCheckBox('%s' % _('Display Hover Shape'))
  1288. self.hover_cb.setToolTip(
  1289. _("Enable display of a hover shape for FlatCAM objects.\n"
  1290. "It is displayed whenever the mouse cursor is hovering\n"
  1291. "over any kind of not-selected object.")
  1292. )
  1293. grid0.addWidget(self.hover_cb, 8, 0, 1, 3)
  1294. # Enable Selection box
  1295. self.selection_cb = FCCheckBox('%s' % _('Display Selection Shape'))
  1296. self.selection_cb.setToolTip(
  1297. _("Enable the display of a selection shape for FlatCAM objects.\n"
  1298. "It is displayed whenever the mouse selects an object\n"
  1299. "either by clicking or dragging mouse from left to right or\n"
  1300. "right to left.")
  1301. )
  1302. grid0.addWidget(self.selection_cb, 9, 0, 1, 3)
  1303. separator_line = QtWidgets.QFrame()
  1304. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  1305. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  1306. grid0.addWidget(separator_line, 14, 0, 1, 2)
  1307. # Plot Selection (left - right) Color
  1308. self.sel_lr_label = QtWidgets.QLabel('<b>%s</b>' % _('Left-Right Selection Color'))
  1309. grid0.addWidget(self.sel_lr_label, 15, 0, 1, 2)
  1310. self.sl_color_label = QtWidgets.QLabel('%s:' % _('Outline'))
  1311. self.sl_color_label.setToolTip(
  1312. _("Set the line color for the 'left to right' selection box.")
  1313. )
  1314. self.sl_color_entry = FCEntry()
  1315. self.sl_color_button = QtWidgets.QPushButton()
  1316. self.sl_color_button.setFixedSize(15, 15)
  1317. self.form_box_child_4 = QtWidgets.QHBoxLayout()
  1318. self.form_box_child_4.addWidget(self.sl_color_entry)
  1319. self.form_box_child_4.addWidget(self.sl_color_button)
  1320. self.form_box_child_4.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  1321. grid0.addWidget(self.sl_color_label, 16, 0)
  1322. grid0.addLayout(self.form_box_child_4, 16, 1)
  1323. self.sf_color_label = QtWidgets.QLabel('%s:' % _('Fill'))
  1324. self.sf_color_label.setToolTip(
  1325. _("Set the fill color for the selection box\n"
  1326. "in case that the selection is done from left to right.\n"
  1327. "First 6 digits are the color and the last 2\n"
  1328. "digits are for alpha (transparency) level.")
  1329. )
  1330. self.sf_color_entry = FCEntry()
  1331. self.sf_color_button = QtWidgets.QPushButton()
  1332. self.sf_color_button.setFixedSize(15, 15)
  1333. self.form_box_child_5 = QtWidgets.QHBoxLayout()
  1334. self.form_box_child_5.addWidget(self.sf_color_entry)
  1335. self.form_box_child_5.addWidget(self.sf_color_button)
  1336. self.form_box_child_5.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  1337. grid0.addWidget(self.sf_color_label, 17, 0)
  1338. grid0.addLayout(self.form_box_child_5, 17, 1)
  1339. # Plot Selection (left - right) Fill Transparency Level
  1340. self.sf_alpha_label = QtWidgets.QLabel('%s:' % _('Alpha'))
  1341. self.sf_alpha_label.setToolTip(
  1342. _("Set the fill transparency for the 'left to right' selection box.")
  1343. )
  1344. self.sf_color_alpha_slider = QtWidgets.QSlider(QtCore.Qt.Horizontal)
  1345. self.sf_color_alpha_slider.setMinimum(0)
  1346. self.sf_color_alpha_slider.setMaximum(255)
  1347. self.sf_color_alpha_slider.setSingleStep(1)
  1348. self.sf_color_alpha_spinner = FCSpinner()
  1349. self.sf_color_alpha_spinner.setMinimumWidth(70)
  1350. self.sf_color_alpha_spinner.set_range(0, 255)
  1351. self.form_box_child_6 = QtWidgets.QHBoxLayout()
  1352. self.form_box_child_6.addWidget(self.sf_color_alpha_slider)
  1353. self.form_box_child_6.addWidget(self.sf_color_alpha_spinner)
  1354. grid0.addWidget(self.sf_alpha_label, 18, 0)
  1355. grid0.addLayout(self.form_box_child_6, 18, 1)
  1356. separator_line = QtWidgets.QFrame()
  1357. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  1358. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  1359. grid0.addWidget(separator_line, 19, 0, 1, 2)
  1360. # Plot Selection (left - right) Color
  1361. self.sel_rl_label = QtWidgets.QLabel('<b>%s</b>' % _('Right-Left Selection Color'))
  1362. grid0.addWidget(self.sel_rl_label, 20, 0, 1, 2)
  1363. # Plot Selection (right - left) Line Color
  1364. self.alt_sl_color_label = QtWidgets.QLabel('%s:' % _('Outline'))
  1365. self.alt_sl_color_label.setToolTip(
  1366. _("Set the line color for the 'right to left' selection box.")
  1367. )
  1368. self.alt_sl_color_entry = FCEntry()
  1369. self.alt_sl_color_button = QtWidgets.QPushButton()
  1370. self.alt_sl_color_button.setFixedSize(15, 15)
  1371. self.form_box_child_7 = QtWidgets.QHBoxLayout()
  1372. self.form_box_child_7.addWidget(self.alt_sl_color_entry)
  1373. self.form_box_child_7.addWidget(self.alt_sl_color_button)
  1374. self.form_box_child_7.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  1375. grid0.addWidget(self.alt_sl_color_label, 21, 0)
  1376. grid0.addLayout(self.form_box_child_7, 21, 1)
  1377. # Plot Selection (right - left) Fill Color
  1378. self.alt_sf_color_label = QtWidgets.QLabel('%s:' % _('Fill'))
  1379. self.alt_sf_color_label.setToolTip(
  1380. _("Set the fill color for the selection box\n"
  1381. "in case that the selection is done from right to left.\n"
  1382. "First 6 digits are the color and the last 2\n"
  1383. "digits are for alpha (transparency) level.")
  1384. )
  1385. self.alt_sf_color_entry = FCEntry()
  1386. self.alt_sf_color_button = QtWidgets.QPushButton()
  1387. self.alt_sf_color_button.setFixedSize(15, 15)
  1388. self.form_box_child_8 = QtWidgets.QHBoxLayout()
  1389. self.form_box_child_8.addWidget(self.alt_sf_color_entry)
  1390. self.form_box_child_8.addWidget(self.alt_sf_color_button)
  1391. self.form_box_child_8.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  1392. grid0.addWidget(self.alt_sf_color_label, 22, 0)
  1393. grid0.addLayout(self.form_box_child_8, 22, 1)
  1394. # Plot Selection (right - left) Fill Transparency Level
  1395. self.alt_sf_alpha_label = QtWidgets.QLabel('%s:' % _('Alpha'))
  1396. self.alt_sf_alpha_label.setToolTip(
  1397. _("Set the fill transparency for selection 'right to left' box.")
  1398. )
  1399. self.alt_sf_color_alpha_slider = QtWidgets.QSlider(QtCore.Qt.Horizontal)
  1400. self.alt_sf_color_alpha_slider.setMinimum(0)
  1401. self.alt_sf_color_alpha_slider.setMaximum(255)
  1402. self.alt_sf_color_alpha_slider.setSingleStep(1)
  1403. self.alt_sf_color_alpha_spinner = FCSpinner()
  1404. self.alt_sf_color_alpha_spinner.setMinimumWidth(70)
  1405. self.alt_sf_color_alpha_spinner.set_range(0, 255)
  1406. self.form_box_child_9 = QtWidgets.QHBoxLayout()
  1407. self.form_box_child_9.addWidget(self.alt_sf_color_alpha_slider)
  1408. self.form_box_child_9.addWidget(self.alt_sf_color_alpha_spinner)
  1409. grid0.addWidget(self.alt_sf_alpha_label, 23, 0)
  1410. grid0.addLayout(self.form_box_child_9, 23, 1)
  1411. separator_line = QtWidgets.QFrame()
  1412. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  1413. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  1414. grid0.addWidget(separator_line, 24, 0, 1, 2)
  1415. # ------------------------------------------------------------------
  1416. # ----------------------- Editor Color -----------------------------
  1417. # ------------------------------------------------------------------
  1418. self.editor_color_label = QtWidgets.QLabel('<b>%s</b>' % _('Editor Color'))
  1419. grid0.addWidget(self.editor_color_label, 25, 0, 1, 2)
  1420. # Editor Draw Color
  1421. self.draw_color_label = QtWidgets.QLabel('%s:' % _('Drawing'))
  1422. self.alt_sf_color_label.setToolTip(
  1423. _("Set the color for the shape.")
  1424. )
  1425. self.draw_color_entry = FCEntry()
  1426. self.draw_color_button = QtWidgets.QPushButton()
  1427. self.draw_color_button.setFixedSize(15, 15)
  1428. self.form_box_child_10 = QtWidgets.QHBoxLayout()
  1429. self.form_box_child_10.addWidget(self.draw_color_entry)
  1430. self.form_box_child_10.addWidget(self.draw_color_button)
  1431. self.form_box_child_10.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  1432. grid0.addWidget(self.draw_color_label, 26, 0)
  1433. grid0.addLayout(self.form_box_child_10, 26, 1)
  1434. # Editor Draw Selection Color
  1435. self.sel_draw_color_label = QtWidgets.QLabel('%s:' % _('Selection'))
  1436. self.sel_draw_color_label.setToolTip(
  1437. _("Set the color of the shape when selected.")
  1438. )
  1439. self.sel_draw_color_entry = FCEntry()
  1440. self.sel_draw_color_button = QtWidgets.QPushButton()
  1441. self.sel_draw_color_button.setFixedSize(15, 15)
  1442. self.form_box_child_11 = QtWidgets.QHBoxLayout()
  1443. self.form_box_child_11.addWidget(self.sel_draw_color_entry)
  1444. self.form_box_child_11.addWidget(self.sel_draw_color_button)
  1445. self.form_box_child_11.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  1446. grid0.addWidget(self.sel_draw_color_label, 27, 0)
  1447. grid0.addLayout(self.form_box_child_11, 27, 1)
  1448. separator_line = QtWidgets.QFrame()
  1449. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  1450. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  1451. grid0.addWidget(separator_line, 28, 0, 1, 2)
  1452. # ------------------------------------------------------------------
  1453. # ----------------------- Project Settings -----------------------------
  1454. # ------------------------------------------------------------------
  1455. self.proj_settings_label = QtWidgets.QLabel('<b>%s</b>' % _('Project Items Color'))
  1456. grid0.addWidget(self.proj_settings_label, 29, 0, 1, 2)
  1457. # Project Tab items color
  1458. self.proj_color_label = QtWidgets.QLabel('%s:' % _('Enabled'))
  1459. self.proj_color_label.setToolTip(
  1460. _("Set the color of the items in Project Tab Tree.")
  1461. )
  1462. self.proj_color_entry = FCEntry()
  1463. self.proj_color_button = QtWidgets.QPushButton()
  1464. self.proj_color_button.setFixedSize(15, 15)
  1465. self.form_box_child_12 = QtWidgets.QHBoxLayout()
  1466. self.form_box_child_12.addWidget(self.proj_color_entry)
  1467. self.form_box_child_12.addWidget(self.proj_color_button)
  1468. self.form_box_child_12.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  1469. grid0.addWidget(self.proj_color_label, 30, 0)
  1470. grid0.addLayout(self.form_box_child_12, 30, 1)
  1471. self.proj_color_dis_label = QtWidgets.QLabel('%s:' % _('Disabled'))
  1472. self.proj_color_dis_label.setToolTip(
  1473. _("Set the color of the items in Project Tab Tree,\n"
  1474. "for the case when the items are disabled.")
  1475. )
  1476. self.proj_color_dis_entry = FCEntry()
  1477. self.proj_color_dis_button = QtWidgets.QPushButton()
  1478. self.proj_color_dis_button.setFixedSize(15, 15)
  1479. self.form_box_child_13 = QtWidgets.QHBoxLayout()
  1480. self.form_box_child_13.addWidget(self.proj_color_dis_entry)
  1481. self.form_box_child_13.addWidget(self.proj_color_dis_button)
  1482. self.form_box_child_13.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  1483. grid0.addWidget(self.proj_color_dis_label, 31, 0)
  1484. grid0.addLayout(self.form_box_child_13, 31, 1)
  1485. # Project autohide CB
  1486. self.project_autohide_cb = FCCheckBox(label=_('Project AutoHide'))
  1487. self.project_autohide_cb.setToolTip(
  1488. _("Check this box if you want the project/selected/tool tab area to\n"
  1489. "hide automatically when there are no objects loaded and\n"
  1490. "to show whenever a new object is created.")
  1491. )
  1492. grid0.addWidget(self.project_autohide_cb, 32, 0, 1, 2)
  1493. # Just to add empty rows
  1494. grid0.addWidget(QtWidgets.QLabel(''), 33, 0, 1, 2)
  1495. self.layout.addStretch()
  1496. self.theme_button.clicked.connect(self.on_theme_change)
  1497. # #############################################################################
  1498. # ############################# GUI COLORS SIGNALS ############################
  1499. # #############################################################################
  1500. # Setting selection (left - right) colors signals
  1501. self.sf_color_entry.editingFinished.connect(self.on_sf_color_entry)
  1502. self.sf_color_button.clicked.connect(self.on_sf_color_button)
  1503. self.sf_color_alpha_spinner.valueChanged.connect(self.on_sf_color_spinner)
  1504. self.sf_color_alpha_slider.valueChanged.connect(self.on_sf_color_slider)
  1505. self.sl_color_entry.editingFinished.connect(self.on_sl_color_entry)
  1506. self.sl_color_button.clicked.connect(self.on_sl_color_button)
  1507. # Setting selection (right - left) colors signals
  1508. self.alt_sf_color_entry.editingFinished.connect(self.on_alt_sf_color_entry)
  1509. self.alt_sf_color_button.clicked.connect(self.on_alt_sf_color_button)
  1510. self.alt_sf_color_alpha_spinner.valueChanged.connect(self.on_alt_sf_color_spinner)
  1511. self.alt_sf_color_alpha_slider.valueChanged.connect(self.on_alt_sf_color_slider)
  1512. self.alt_sl_color_entry.editingFinished.connect(self.on_alt_sl_color_entry)
  1513. self.alt_sl_color_button.clicked.connect(self.on_alt_sl_color_button)
  1514. # Setting Editor Draw colors signals
  1515. self.draw_color_entry.editingFinished.connect(self.on_draw_color_entry)
  1516. self.draw_color_button.clicked.connect(self.on_draw_color_button)
  1517. self.sel_draw_color_entry.editingFinished.connect(self.on_sel_draw_color_entry)
  1518. self.sel_draw_color_button.clicked.connect(self.on_sel_draw_color_button)
  1519. self.proj_color_entry.editingFinished.connect(self.on_proj_color_entry)
  1520. self.proj_color_button.clicked.connect(self.on_proj_color_button)
  1521. self.proj_color_dis_entry.editingFinished.connect(self.on_proj_color_dis_entry)
  1522. self.proj_color_dis_button.clicked.connect(self.on_proj_color_dis_button)
  1523. self.layout_combo.activated.connect(self.on_layout)
  1524. def on_theme_change(self):
  1525. val = self.theme_radio.get_value()
  1526. qsettings = QSettings("Open Source", "FlatCAM")
  1527. qsettings.setValue('theme', val)
  1528. # This will write the setting to the platform specific storage.
  1529. del qsettings
  1530. self.app.on_app_restart()
  1531. @staticmethod
  1532. def handle_style(style):
  1533. # set current style
  1534. qsettings = QSettings("Open Source", "FlatCAM")
  1535. qsettings.setValue('style', style)
  1536. # This will write the setting to the platform specific storage.
  1537. del qsettings
  1538. @staticmethod
  1539. def handle_hdpi(state):
  1540. # set current HDPI
  1541. qsettings = QSettings("Open Source", "FlatCAM")
  1542. qsettings.setValue('hdpi', state)
  1543. # This will write the setting to the platform specific storage.
  1544. del qsettings
  1545. # Setting selection colors (left - right) handlers
  1546. def on_sf_color_entry(self):
  1547. self.app.defaults['global_sel_fill'] = self.app.defaults['global_sel_fill'][7:9]
  1548. self.sf_color_button.setStyleSheet("background-color:%s" % str(self.app.defaults['global_sel_fill'])[:7])
  1549. def on_sf_color_button(self):
  1550. current_color = QtGui.QColor(self.app.defaults['global_sel_fill'][:7])
  1551. c_dialog = QtWidgets.QColorDialog()
  1552. plot_fill_color = c_dialog.getColor(initial=current_color)
  1553. if plot_fill_color.isValid() is False:
  1554. return
  1555. self.sf_color_button.setStyleSheet("background-color:%s" % str(plot_fill_color.name()))
  1556. new_val = str(plot_fill_color.name()) + str(self.app.defaults['global_sel_fill'][7:9])
  1557. self.sf_color_entry.set_value(new_val)
  1558. self.app.defaults['global_sel_fill'] = new_val
  1559. def on_sf_color_spinner(self):
  1560. spinner_value = self.sf_color_alpha_spinner.value()
  1561. self.sf_color_alpha_slider.setValue(spinner_value)
  1562. self.app.defaults['global_sel_fill'] = self.app.defaults['global_sel_fill'][:7] + \
  1563. (hex(spinner_value)[2:] if int(hex(spinner_value)[2:], 16) > 0 else '00')
  1564. self.app.defaults['global_sel_line'] = self.app.defaults['global_sel_line'][:7] + \
  1565. (hex(spinner_value)[2:] if int(hex(spinner_value)[2:], 16) > 0 else '00')
  1566. def on_sf_color_slider(self):
  1567. slider_value = self.sf_color_alpha_slider.value()
  1568. self.sf_color_alpha_spinner.setValue(slider_value)
  1569. def on_sl_color_entry(self):
  1570. self.app.defaults['global_sel_line'] = self.sl_color_entry.get_value()[:7] + \
  1571. self.app.defaults['global_sel_line'][7:9]
  1572. self.sl_color_button.setStyleSheet("background-color:%s" % str(self.app.defaults['global_sel_line'])[:7])
  1573. def on_sl_color_button(self):
  1574. current_color = QtGui.QColor(self.app.defaults['global_sel_line'][:7])
  1575. c_dialog = QtWidgets.QColorDialog()
  1576. plot_line_color = c_dialog.getColor(initial=current_color)
  1577. if plot_line_color.isValid() is False:
  1578. return
  1579. self.sl_color_button.setStyleSheet("background-color:%s" % str(plot_line_color.name()))
  1580. new_val_line = str(plot_line_color.name()) + str(self.app.defaults['global_sel_line'][7:9])
  1581. self.sl_color_entry.set_value(new_val_line)
  1582. self.app.defaults['global_sel_line'] = new_val_line
  1583. # Setting selection colors (right - left) handlers
  1584. def on_alt_sf_color_entry(self):
  1585. self.app.defaults['global_alt_sel_fill'] = self.alt_sf_color_entry.get_value()[:7] + \
  1586. self.app.defaults['global_alt_sel_fill'][7:9]
  1587. self.alt_sf_color_button.setStyleSheet(
  1588. "background-color:%s" % str(self.app.defaults['global_alt_sel_fill'])[:7]
  1589. )
  1590. def on_alt_sf_color_button(self):
  1591. current_color = QtGui.QColor(self.app.defaults['global_alt_sel_fill'][:7])
  1592. c_dialog = QtWidgets.QColorDialog()
  1593. plot_fill_color = c_dialog.getColor(initial=current_color)
  1594. if plot_fill_color.isValid() is False:
  1595. return
  1596. self.alt_sf_color_button.setStyleSheet("background-color:%s" % str(plot_fill_color.name()))
  1597. new_val = str(plot_fill_color.name()) + str(self.app.defaults['global_alt_sel_fill'][7:9])
  1598. self.alt_sf_color_entry.set_value(new_val)
  1599. self.app.defaults['global_alt_sel_fill'] = new_val
  1600. def on_alt_sf_color_spinner(self):
  1601. spinner_value = self.alt_sf_color_alpha_spinner.value()
  1602. self.alt_sf_color_alpha_slider.setValue(spinner_value)
  1603. self.app.defaults['global_alt_sel_fill'] = self.app.defaults['global_alt_sel_fill'][:7] + \
  1604. (hex(spinner_value)[2:] if int(hex(spinner_value)[2:], 16) > 0 else '00')
  1605. self.app.defaults['global_alt_sel_line'] = self.app.defaults['global_alt_sel_line'][:7] + \
  1606. (hex(spinner_value)[2:] if int(hex(spinner_value)[2:], 16) > 0 else '00')
  1607. def on_alt_sf_color_slider(self):
  1608. slider_value = self.alt_sf_color_alpha_slider.value()
  1609. self.alt_sf_color_alpha_spinner.setValue(slider_value)
  1610. def on_alt_sl_color_entry(self):
  1611. self.app.defaults['global_alt_sel_line'] = self.alt_sl_color_entry.get_value()[:7] + \
  1612. self.app.defaults['global_alt_sel_line'][7:9]
  1613. self.alt_sl_color_button.setStyleSheet(
  1614. "background-color:%s" % str(self.app.defaults['global_alt_sel_line'])[:7]
  1615. )
  1616. def on_alt_sl_color_button(self):
  1617. current_color = QtGui.QColor(self.app.defaults['global_alt_sel_line'][:7])
  1618. c_dialog = QtWidgets.QColorDialog()
  1619. plot_line_color = c_dialog.getColor(initial=current_color)
  1620. if plot_line_color.isValid() is False:
  1621. return
  1622. self.alt_sl_color_button.setStyleSheet("background-color:%s" % str(plot_line_color.name()))
  1623. new_val_line = str(plot_line_color.name()) + str(self.app.defaults['global_alt_sel_line'][7:9])
  1624. self.alt_sl_color_entry.set_value(new_val_line)
  1625. self.app.defaults['global_alt_sel_line'] = new_val_line
  1626. # Setting Editor colors
  1627. def on_draw_color_entry(self):
  1628. self.app.defaults['global_draw_color'] = self.draw_color_entry.get_value()
  1629. self.draw_color_button.setStyleSheet("background-color:%s" % str(self.app.defaults['global_draw_color']))
  1630. def on_draw_color_button(self):
  1631. current_color = QtGui.QColor(self.app.defaults['global_draw_color'])
  1632. c_dialog = QtWidgets.QColorDialog()
  1633. draw_color = c_dialog.getColor(initial=current_color)
  1634. if draw_color.isValid() is False:
  1635. return
  1636. self.draw_color_button.setStyleSheet("background-color:%s" % str(draw_color.name()))
  1637. new_val = str(draw_color.name())
  1638. self.draw_color_entry.set_value(new_val)
  1639. self.app.defaults['global_draw_color'] = new_val
  1640. def on_sel_draw_color_entry(self):
  1641. self.app.defaults['global_sel_draw_color'] = self.sel_draw_color_entry.get_value()
  1642. self.sel_draw_color_button.setStyleSheet(
  1643. "background-color:%s" % str(self.app.defaults['global_sel_draw_color']))
  1644. def on_sel_draw_color_button(self):
  1645. current_color = QtGui.QColor(self.app.defaults['global_sel_draw_color'])
  1646. c_dialog = QtWidgets.QColorDialog()
  1647. sel_draw_color = c_dialog.getColor(initial=current_color)
  1648. if sel_draw_color.isValid() is False:
  1649. return
  1650. self.sel_draw_color_button.setStyleSheet("background-color:%s" % str(sel_draw_color.name()))
  1651. new_val_sel = str(sel_draw_color.name())
  1652. self.sel_draw_color_entry.set_value(new_val_sel)
  1653. self.app.defaults['global_sel_draw_color'] = new_val_sel
  1654. def on_proj_color_entry(self):
  1655. self.app.defaults['global_proj_item_color'] = self.proj_color_entry.get_value()
  1656. self.proj_color_button.setStyleSheet(
  1657. "background-color:%s" % str(self.app.defaults['global_proj_item_color']))
  1658. def on_proj_color_button(self):
  1659. current_color = QtGui.QColor(self.app.defaults['global_proj_item_color'])
  1660. c_dialog = QtWidgets.QColorDialog()
  1661. proj_color = c_dialog.getColor(initial=current_color)
  1662. if proj_color.isValid() is False:
  1663. return
  1664. self.proj_color_button.setStyleSheet("background-color:%s" % str(proj_color.name()))
  1665. new_val_sel = str(proj_color.name())
  1666. self.proj_color_entry.set_value(new_val_sel)
  1667. self.app.defaults['global_proj_item_color'] = new_val_sel
  1668. def on_proj_color_dis_entry(self):
  1669. self.app.defaults['global_proj_item_dis_color'] = self.proj_color_dis_entry.get_value()
  1670. self.proj_color_dis_button.setStyleSheet(
  1671. "background-color:%s" % str(self.app.defaults['global_proj_item_dis_color']))
  1672. def on_proj_color_dis_button(self):
  1673. current_color = QtGui.QColor(self.app.defaults['global_proj_item_dis_color'])
  1674. c_dialog = QtWidgets.QColorDialog()
  1675. proj_color = c_dialog.getColor(initial=current_color)
  1676. if proj_color.isValid() is False:
  1677. return
  1678. self.proj_color_dis_button.setStyleSheet("background-color:%s" % str(proj_color.name()))
  1679. new_val_sel = str(proj_color.name())
  1680. self.proj_color_dis_entry.set_value(new_val_sel)
  1681. self.app.defaults['global_proj_item_dis_color'] = new_val_sel
  1682. def on_layout(self, index=None, lay=None):
  1683. """
  1684. Set the toolbars layout (location)
  1685. :param index:
  1686. :param lay: Type of layout to be set on the toolbard
  1687. :return: None
  1688. """
  1689. self.app.defaults.report_usage("on_layout()")
  1690. if lay:
  1691. current_layout = lay
  1692. else:
  1693. current_layout = self.layout_combo.get_value()
  1694. lay_settings = QSettings("Open Source", "FlatCAM")
  1695. lay_settings.setValue('layout', current_layout)
  1696. # This will write the setting to the platform specific storage.
  1697. del lay_settings
  1698. # first remove the toolbars:
  1699. try:
  1700. self.app.ui.removeToolBar(self.app.ui.toolbarfile)
  1701. self.app.ui.removeToolBar(self.app.ui.toolbargeo)
  1702. self.app.ui.removeToolBar(self.app.ui.toolbarview)
  1703. self.app.ui.removeToolBar(self.app.ui.toolbarshell)
  1704. self.app.ui.removeToolBar(self.app.ui.toolbartools)
  1705. self.app.ui.removeToolBar(self.app.ui.exc_edit_toolbar)
  1706. self.app.ui.removeToolBar(self.app.ui.geo_edit_toolbar)
  1707. self.app.ui.removeToolBar(self.app.ui.grb_edit_toolbar)
  1708. self.app.ui.removeToolBar(self.app.ui.snap_toolbar)
  1709. self.app.ui.removeToolBar(self.app.ui.toolbarshell)
  1710. except Exception:
  1711. pass
  1712. if current_layout == 'compact':
  1713. # ## TOOLBAR INSTALLATION # ##
  1714. self.app.ui.toolbarfile = QtWidgets.QToolBar('File Toolbar')
  1715. self.app.ui.toolbarfile.setObjectName('File_TB')
  1716. self.app.ui.addToolBar(Qt.LeftToolBarArea, self.app.ui.toolbarfile)
  1717. self.app.ui.toolbargeo = QtWidgets.QToolBar('Edit Toolbar')
  1718. self.app.ui.toolbargeo.setObjectName('Edit_TB')
  1719. self.app.ui.addToolBar(Qt.LeftToolBarArea, self.app.ui.toolbargeo)
  1720. self.app.ui.toolbarshell = QtWidgets.QToolBar('Shell Toolbar')
  1721. self.app.ui.toolbarshell.setObjectName('Shell_TB')
  1722. self.app.ui.addToolBar(Qt.LeftToolBarArea, self.app.ui.toolbarshell)
  1723. self.app.ui.toolbartools = QtWidgets.QToolBar('Tools Toolbar')
  1724. self.app.ui.toolbartools.setObjectName('Tools_TB')
  1725. self.app.ui.addToolBar(Qt.LeftToolBarArea, self.app.ui.toolbartools)
  1726. self.app.ui.geo_edit_toolbar = QtWidgets.QToolBar('Geometry Editor Toolbar')
  1727. # self.app.ui.geo_edit_toolbar.setVisible(False)
  1728. self.app.ui.geo_edit_toolbar.setObjectName('GeoEditor_TB')
  1729. self.app.ui.addToolBar(Qt.RightToolBarArea, self.app.ui.geo_edit_toolbar)
  1730. self.app.ui.toolbarview = QtWidgets.QToolBar('View Toolbar')
  1731. self.app.ui.toolbarview.setObjectName('View_TB')
  1732. self.app.ui.addToolBar(Qt.RightToolBarArea, self.app.ui.toolbarview)
  1733. self.app.ui.addToolBarBreak(area=Qt.RightToolBarArea)
  1734. self.app.ui.grb_edit_toolbar = QtWidgets.QToolBar('Gerber Editor Toolbar')
  1735. # self.app.ui.grb_edit_toolbar.setVisible(False)
  1736. self.app.ui.grb_edit_toolbar.setObjectName('GrbEditor_TB')
  1737. self.app.ui.addToolBar(Qt.RightToolBarArea, self.app.ui.grb_edit_toolbar)
  1738. self.app.ui.exc_edit_toolbar = QtWidgets.QToolBar('Excellon Editor Toolbar')
  1739. self.app.ui.exc_edit_toolbar.setObjectName('ExcEditor_TB')
  1740. self.app.ui.addToolBar(Qt.RightToolBarArea, self.app.ui.exc_edit_toolbar)
  1741. self.app.ui.snap_toolbar = QtWidgets.QToolBar('Grid Toolbar')
  1742. self.app.ui.snap_toolbar.setObjectName('Snap_TB')
  1743. self.app.ui.snap_toolbar.setMaximumHeight(30)
  1744. self.app.ui.splitter_left.addWidget(self.app.ui.snap_toolbar)
  1745. self.app.ui.corner_snap_btn.setVisible(True)
  1746. self.app.ui.snap_magnet.setVisible(True)
  1747. else:
  1748. # ## TOOLBAR INSTALLATION # ##
  1749. self.app.ui.toolbarfile = QtWidgets.QToolBar('File Toolbar')
  1750. self.app.ui.toolbarfile.setObjectName('File_TB')
  1751. self.app.ui.addToolBar(self.app.ui.toolbarfile)
  1752. self.app.ui.toolbargeo = QtWidgets.QToolBar('Edit Toolbar')
  1753. self.app.ui.toolbargeo.setObjectName('Edit_TB')
  1754. self.app.ui.addToolBar(self.app.ui.toolbargeo)
  1755. self.app.ui.toolbarview = QtWidgets.QToolBar('View Toolbar')
  1756. self.app.ui.toolbarview.setObjectName('View_TB')
  1757. self.app.ui.addToolBar(self.app.ui.toolbarview)
  1758. self.app.ui.toolbarshell = QtWidgets.QToolBar('Shell Toolbar')
  1759. self.app.ui.toolbarshell.setObjectName('Shell_TB')
  1760. self.app.ui.addToolBar(self.app.ui.toolbarshell)
  1761. self.app.ui.toolbartools = QtWidgets.QToolBar('Tools Toolbar')
  1762. self.app.ui.toolbartools.setObjectName('Tools_TB')
  1763. self.app.ui.addToolBar(self.app.ui.toolbartools)
  1764. self.app.ui.exc_edit_toolbar = QtWidgets.QToolBar('Excellon Editor Toolbar')
  1765. # self.app.ui.exc_edit_toolbar.setVisible(False)
  1766. self.app.ui.exc_edit_toolbar.setObjectName('ExcEditor_TB')
  1767. self.app.ui.addToolBar(self.app.ui.exc_edit_toolbar)
  1768. self.app.ui.addToolBarBreak()
  1769. self.app.ui.geo_edit_toolbar = QtWidgets.QToolBar('Geometry Editor Toolbar')
  1770. # self.app.ui.geo_edit_toolbar.setVisible(False)
  1771. self.app.ui.geo_edit_toolbar.setObjectName('GeoEditor_TB')
  1772. self.app.ui.addToolBar(self.app.ui.geo_edit_toolbar)
  1773. self.app.ui.grb_edit_toolbar = QtWidgets.QToolBar('Gerber Editor Toolbar')
  1774. # self.app.ui.grb_edit_toolbar.setVisible(False)
  1775. self.app.ui.grb_edit_toolbar.setObjectName('GrbEditor_TB')
  1776. self.app.ui.addToolBar(self.app.ui.grb_edit_toolbar)
  1777. self.app.ui.snap_toolbar = QtWidgets.QToolBar('Grid Toolbar')
  1778. self.app.ui.snap_toolbar.setObjectName('Snap_TB')
  1779. # self.app.ui.snap_toolbar.setMaximumHeight(30)
  1780. self.app.ui.addToolBar(self.app.ui.snap_toolbar)
  1781. self.app.ui.corner_snap_btn.setVisible(False)
  1782. self.app.ui.snap_magnet.setVisible(False)
  1783. if current_layout == 'minimal':
  1784. self.app.ui.toolbarview.setVisible(False)
  1785. self.app.ui.toolbarshell.setVisible(False)
  1786. self.app.ui.snap_toolbar.setVisible(False)
  1787. self.app.ui.geo_edit_toolbar.setVisible(False)
  1788. self.app.ui.grb_edit_toolbar.setVisible(False)
  1789. self.app.ui.exc_edit_toolbar.setVisible(False)
  1790. self.app.ui.lock_toolbar(lock=True)
  1791. # add all the actions to the toolbars
  1792. self.app.ui.populate_toolbars()
  1793. # reconnect all the signals to the toolbar actions
  1794. self.app.connect_toolbar_signals()
  1795. self.app.ui.grid_snap_btn.setChecked(True)
  1796. self.app.on_grid_snap_triggered(state=True)
  1797. self.app.ui.grid_gap_x_entry.setText(str(self.app.defaults["global_gridx"]))
  1798. self.app.ui.grid_gap_y_entry.setText(str(self.app.defaults["global_gridy"]))
  1799. self.app.ui.snap_max_dist_entry.setText(str(self.app.defaults["global_snap_max"]))
  1800. self.app.ui.grid_gap_link_cb.setChecked(True)
  1801. class GeneralAPPSetGroupUI(OptionsGroupUI):
  1802. def __init__(self, decimals=4, parent=None):
  1803. super(GeneralAPPSetGroupUI, self).__init__(self)
  1804. self.setTitle(str(_("App Settings")))
  1805. self.decimals = decimals
  1806. theme_settings = QtCore.QSettings("Open Source", "FlatCAM")
  1807. if theme_settings.contains("theme"):
  1808. theme = theme_settings.value('theme', type=str)
  1809. else:
  1810. theme = 'white'
  1811. if theme == 'white':
  1812. self.resource_loc = 'assets/resources'
  1813. else:
  1814. self.resource_loc = 'assets/resources'
  1815. # Create a grid layout for the Application general settings
  1816. grid0 = QtWidgets.QGridLayout()
  1817. self.layout.addLayout(grid0)
  1818. grid0.setColumnStretch(0, 0)
  1819. grid0.setColumnStretch(1, 1)
  1820. # GRID Settings
  1821. self.grid_label = QtWidgets.QLabel('<b>%s</b>' % _('Grid Settings'))
  1822. grid0.addWidget(self.grid_label, 0, 0, 1, 2)
  1823. # Grid X Entry
  1824. self.gridx_label = QtWidgets.QLabel('%s:' % _('X value'))
  1825. self.gridx_label.setToolTip(
  1826. _("This is the Grid snap value on X axis.")
  1827. )
  1828. self.gridx_entry = FCDoubleSpinner()
  1829. self.gridx_entry.set_precision(self.decimals)
  1830. self.gridx_entry.setSingleStep(0.1)
  1831. grid0.addWidget(self.gridx_label, 1, 0)
  1832. grid0.addWidget(self.gridx_entry, 1, 1)
  1833. # Grid Y Entry
  1834. self.gridy_label = QtWidgets.QLabel('%s:' % _('Y value'))
  1835. self.gridy_label.setToolTip(
  1836. _("This is the Grid snap value on Y axis.")
  1837. )
  1838. self.gridy_entry = FCDoubleSpinner()
  1839. self.gridy_entry.set_precision(self.decimals)
  1840. self.gridy_entry.setSingleStep(0.1)
  1841. grid0.addWidget(self.gridy_label, 2, 0)
  1842. grid0.addWidget(self.gridy_entry, 2, 1)
  1843. # Snap Max Entry
  1844. self.snap_max_label = QtWidgets.QLabel('%s:' % _('Snap Max'))
  1845. self.snap_max_label.setToolTip(_("Max. magnet distance"))
  1846. self.snap_max_dist_entry = FCDoubleSpinner()
  1847. self.snap_max_dist_entry.set_precision(self.decimals)
  1848. self.snap_max_dist_entry.setSingleStep(0.1)
  1849. grid0.addWidget(self.snap_max_label, 3, 0)
  1850. grid0.addWidget(self.snap_max_dist_entry, 3, 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, 4, 0, 1, 2)
  1855. # Workspace
  1856. self.workspace_label = QtWidgets.QLabel('<b>%s</b>' % _('Workspace Settings'))
  1857. grid0.addWidget(self.workspace_label, 5, 0, 1, 2)
  1858. self.workspace_cb = FCCheckBox('%s' % _('Active'))
  1859. self.workspace_cb.setToolTip(
  1860. _("Draw a delimiting rectangle on canvas.\n"
  1861. "The purpose is to illustrate the limits for our work.")
  1862. )
  1863. grid0.addWidget(self.workspace_cb, 6, 0, 1, 2)
  1864. self.workspace_type_lbl = QtWidgets.QLabel('%s:' % _('Size'))
  1865. self.workspace_type_lbl.setToolTip(
  1866. _("Select the type of rectangle to be used on canvas,\n"
  1867. "as valid workspace.")
  1868. )
  1869. self.wk_cb = FCComboBox()
  1870. grid0.addWidget(self.workspace_type_lbl, 7, 0)
  1871. grid0.addWidget(self.wk_cb, 7, 1)
  1872. self.pagesize = {}
  1873. self.pagesize.update(
  1874. {
  1875. 'A0': (841, 1189),
  1876. 'A1': (594, 841),
  1877. 'A2': (420, 594),
  1878. 'A3': (297, 420),
  1879. 'A4': (210, 297),
  1880. 'A5': (148, 210),
  1881. 'A6': (105, 148),
  1882. 'A7': (74, 105),
  1883. 'A8': (52, 74),
  1884. 'A9': (37, 52),
  1885. 'A10': (26, 37),
  1886. 'B0': (1000, 1414),
  1887. 'B1': (707, 1000),
  1888. 'B2': (500, 707),
  1889. 'B3': (353, 500),
  1890. 'B4': (250, 353),
  1891. 'B5': (176, 250),
  1892. 'B6': (125, 176),
  1893. 'B7': (88, 125),
  1894. 'B8': (62, 88),
  1895. 'B9': (44, 62),
  1896. 'B10': (31, 44),
  1897. 'C0': (917, 1297),
  1898. 'C1': (648, 917),
  1899. 'C2': (458, 648),
  1900. 'C3': (324, 458),
  1901. 'C4': (229, 324),
  1902. 'C5': (162, 229),
  1903. 'C6': (114, 162),
  1904. 'C7': (81, 114),
  1905. 'C8': (57, 81),
  1906. 'C9': (40, 57),
  1907. 'C10': (28, 40),
  1908. # American paper sizes
  1909. 'LETTER': (8.5, 11),
  1910. 'LEGAL': (8.5, 14),
  1911. 'ELEVENSEVENTEEN': (11, 17),
  1912. # From https://en.wikipedia.org/wiki/Paper_size
  1913. 'JUNIOR_LEGAL': (5, 8),
  1914. 'HALF_LETTER': (5.5, 8),
  1915. 'GOV_LETTER': (8, 10.5),
  1916. 'GOV_LEGAL': (8.5, 13),
  1917. 'LEDGER': (17, 11),
  1918. }
  1919. )
  1920. page_size_list = list(self.pagesize.keys())
  1921. self.wk_cb.addItems(page_size_list)
  1922. # Page orientation
  1923. self.wk_orientation_label = QtWidgets.QLabel('%s:' % _("Orientation"))
  1924. self.wk_orientation_label.setToolTip(_("Can be:\n"
  1925. "- Portrait\n"
  1926. "- Landscape"))
  1927. self.wk_orientation_radio = RadioSet([{'label': _('Portrait'), 'value': 'p'},
  1928. {'label': _('Landscape'), 'value': 'l'},
  1929. ], stretch=False)
  1930. self.wks = OptionalInputSection(self.workspace_cb,
  1931. [
  1932. self.workspace_type_lbl,
  1933. self.wk_cb,
  1934. self.wk_orientation_label,
  1935. self.wk_orientation_radio
  1936. ])
  1937. grid0.addWidget(self.wk_orientation_label, 8, 0)
  1938. grid0.addWidget(self.wk_orientation_radio, 8, 1)
  1939. separator_line = QtWidgets.QFrame()
  1940. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  1941. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  1942. grid0.addWidget(separator_line, 9, 0, 1, 2)
  1943. # Font Size
  1944. self.font_size_label = QtWidgets.QLabel('<b>%s</b>' % _('Font Size'))
  1945. grid0.addWidget(self.font_size_label, 10, 0, 1, 2)
  1946. # Notebook Font Size
  1947. self.notebook_font_size_label = QtWidgets.QLabel('%s:' % _('Notebook'))
  1948. self.notebook_font_size_label.setToolTip(
  1949. _("This sets the font size for the elements found in the Notebook.\n"
  1950. "The notebook is the collapsible area in the left side of the GUI,\n"
  1951. "and include the Project, Selected and Tool tabs.")
  1952. )
  1953. self.notebook_font_size_spinner = FCSpinner()
  1954. self.notebook_font_size_spinner.set_range(8, 40)
  1955. self.notebook_font_size_spinner.setWrapping(True)
  1956. qsettings = QSettings("Open Source", "FlatCAM")
  1957. if qsettings.contains("notebook_font_size"):
  1958. self.notebook_font_size_spinner.set_value(qsettings.value('notebook_font_size', type=int))
  1959. else:
  1960. self.notebook_font_size_spinner.set_value(12)
  1961. grid0.addWidget(self.notebook_font_size_label, 11, 0)
  1962. grid0.addWidget(self.notebook_font_size_spinner, 11, 1)
  1963. # Axis Font Size
  1964. self.axis_font_size_label = QtWidgets.QLabel('%s:' % _('Axis'))
  1965. self.axis_font_size_label.setToolTip(
  1966. _("This sets the font size for canvas axis.")
  1967. )
  1968. self.axis_font_size_spinner = FCSpinner()
  1969. self.axis_font_size_spinner.set_range(0, 40)
  1970. self.axis_font_size_spinner.setWrapping(True)
  1971. qsettings = QSettings("Open Source", "FlatCAM")
  1972. if qsettings.contains("axis_font_size"):
  1973. self.axis_font_size_spinner.set_value(qsettings.value('axis_font_size', type=int))
  1974. else:
  1975. self.axis_font_size_spinner.set_value(8)
  1976. grid0.addWidget(self.axis_font_size_label, 12, 0)
  1977. grid0.addWidget(self.axis_font_size_spinner, 12, 1)
  1978. # TextBox Font Size
  1979. self.textbox_font_size_label = QtWidgets.QLabel('%s:' % _('Textbox'))
  1980. self.textbox_font_size_label.setToolTip(
  1981. _("This sets the font size for the Textbox GUI\n"
  1982. "elements that are used in FlatCAM.")
  1983. )
  1984. self.textbox_font_size_spinner = FCSpinner()
  1985. self.textbox_font_size_spinner.set_range(8, 40)
  1986. self.textbox_font_size_spinner.setWrapping(True)
  1987. qsettings = QSettings("Open Source", "FlatCAM")
  1988. if qsettings.contains("textbox_font_size"):
  1989. self.textbox_font_size_spinner.set_value(settings.value('textbox_font_size', type=int))
  1990. else:
  1991. self.textbox_font_size_spinner.set_value(10)
  1992. grid0.addWidget(self.textbox_font_size_label, 13, 0)
  1993. grid0.addWidget(self.textbox_font_size_spinner, 13, 1)
  1994. separator_line = QtWidgets.QFrame()
  1995. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  1996. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  1997. grid0.addWidget(separator_line, 14, 0, 1, 2)
  1998. # -----------------------------------------------------------
  1999. # -------------- MOUSE SETTINGS -----------------------------
  2000. # -----------------------------------------------------------
  2001. self.mouse_lbl = QtWidgets.QLabel('<b>%s</b>' % _('Mouse Settings'))
  2002. grid0.addWidget(self.mouse_lbl, 21, 0, 1, 2)
  2003. # Mouse Cursor Shape
  2004. self.cursor_lbl = QtWidgets.QLabel('%s:' % _('Cursor Shape'))
  2005. self.cursor_lbl.setToolTip(
  2006. _("Choose a mouse cursor shape.\n"
  2007. "- Small -> with a customizable size.\n"
  2008. "- Big -> Infinite lines")
  2009. )
  2010. self.cursor_radio = RadioSet([
  2011. {"label": _("Small"), "value": "small"},
  2012. {"label": _("Big"), "value": "big"}
  2013. ], orientation='horizontal', stretch=False)
  2014. grid0.addWidget(self.cursor_lbl, 22, 0)
  2015. grid0.addWidget(self.cursor_radio, 22, 1)
  2016. # Mouse Cursor Size
  2017. self.cursor_size_lbl = QtWidgets.QLabel('%s:' % _('Cursor Size'))
  2018. self.cursor_size_lbl.setToolTip(
  2019. _("Set the size of the mouse cursor, in pixels.")
  2020. )
  2021. self.cursor_size_entry = FCSpinner()
  2022. self.cursor_size_entry.set_range(10, 70)
  2023. self.cursor_size_entry.setWrapping(True)
  2024. grid0.addWidget(self.cursor_size_lbl, 23, 0)
  2025. grid0.addWidget(self.cursor_size_entry, 23, 1)
  2026. # Cursor Width
  2027. self.cursor_width_lbl = QtWidgets.QLabel('%s:' % _('Cursor Width'))
  2028. self.cursor_width_lbl.setToolTip(
  2029. _("Set the line width of the mouse cursor, in pixels.")
  2030. )
  2031. self.cursor_width_entry = FCSpinner()
  2032. self.cursor_width_entry.set_range(1, 10)
  2033. self.cursor_width_entry.setWrapping(True)
  2034. grid0.addWidget(self.cursor_width_lbl, 24, 0)
  2035. grid0.addWidget(self.cursor_width_entry, 24, 1)
  2036. # Cursor Color Enable
  2037. self.mouse_cursor_color_cb = FCCheckBox(label='%s' % _('Cursor Color'))
  2038. self.mouse_cursor_color_cb.setToolTip(
  2039. _("Check this box to color mouse cursor.")
  2040. )
  2041. grid0.addWidget(self.mouse_cursor_color_cb, 25, 0, 1, 2)
  2042. # Cursor Color
  2043. self.mouse_color_label = QtWidgets.QLabel('%s:' % _('Cursor Color'))
  2044. self.mouse_color_label.setToolTip(
  2045. _("Set the color of the mouse cursor.")
  2046. )
  2047. self.mouse_cursor_entry = FCEntry()
  2048. self.mouse_cursor_button = QtWidgets.QPushButton()
  2049. self.mouse_cursor_button.setFixedSize(15, 15)
  2050. self.form_box_child_1 = QtWidgets.QHBoxLayout()
  2051. self.form_box_child_1.addWidget(self.mouse_cursor_entry)
  2052. self.form_box_child_1.addWidget(self.mouse_cursor_button)
  2053. self.form_box_child_1.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  2054. grid0.addWidget(self.mouse_color_label, 26, 0)
  2055. grid0.addLayout(self.form_box_child_1, 26, 1)
  2056. self.mois = OptionalInputSection(
  2057. self.mouse_cursor_color_cb,
  2058. [
  2059. self.mouse_color_label,
  2060. self.mouse_cursor_entry,
  2061. self.mouse_cursor_button
  2062. ]
  2063. )
  2064. # Select mouse pan button
  2065. self.panbuttonlabel = QtWidgets.QLabel('%s:' % _('Pan Button'))
  2066. self.panbuttonlabel.setToolTip(
  2067. _("Select the mouse button to use for panning:\n"
  2068. "- MMB --> Middle Mouse Button\n"
  2069. "- RMB --> Right Mouse Button")
  2070. )
  2071. self.pan_button_radio = RadioSet([{'label': _('MMB'), 'value': '3'},
  2072. {'label': _('RMB'), 'value': '2'}])
  2073. grid0.addWidget(self.panbuttonlabel, 27, 0)
  2074. grid0.addWidget(self.pan_button_radio, 27, 1)
  2075. # Multiple Selection Modifier Key
  2076. self.mselectlabel = QtWidgets.QLabel('%s:' % _('Multiple Selection'))
  2077. self.mselectlabel.setToolTip(
  2078. _("Select the key used for multiple selection.")
  2079. )
  2080. self.mselect_radio = RadioSet([{'label': _('CTRL'), 'value': 'Control'},
  2081. {'label': _('SHIFT'), 'value': 'Shift'}])
  2082. grid0.addWidget(self.mselectlabel, 28, 0)
  2083. grid0.addWidget(self.mselect_radio, 28, 1)
  2084. separator_line = QtWidgets.QFrame()
  2085. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  2086. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  2087. grid0.addWidget(separator_line, 29, 0, 1, 2)
  2088. # Delete confirmation
  2089. self.delete_conf_cb = FCCheckBox(_('Delete object confirmation'))
  2090. self.delete_conf_cb.setToolTip(
  2091. _("When checked the application will ask for user confirmation\n"
  2092. "whenever the Delete object(s) event is triggered, either by\n"
  2093. "menu shortcut or key shortcut.")
  2094. )
  2095. grid0.addWidget(self.delete_conf_cb, 30, 0, 1, 2)
  2096. # Open behavior
  2097. self.open_style_cb = FCCheckBox('%s' % _('"Open" behavior'))
  2098. self.open_style_cb.setToolTip(
  2099. _("When checked the path for the last saved file is used when saving files,\n"
  2100. "and the path for the last opened file is used when opening files.\n\n"
  2101. "When unchecked the path for opening files is the one used last: either the\n"
  2102. "path for saving files or the path for opening files.")
  2103. )
  2104. grid0.addWidget(self.open_style_cb, 31, 0, 1, 2)
  2105. # Enable/Disable ToolTips globally
  2106. self.toggle_tooltips_cb = FCCheckBox(label=_('Enable ToolTips'))
  2107. self.toggle_tooltips_cb.setToolTip(
  2108. _("Check this box if you want to have toolTips displayed\n"
  2109. "when hovering with mouse over items throughout the App.")
  2110. )
  2111. grid0.addWidget(self.toggle_tooltips_cb, 32, 0, 1, 2)
  2112. # Machinist settings that allow unsafe settings
  2113. self.machinist_cb = FCCheckBox(_("Allow Machinist Unsafe Settings"))
  2114. self.machinist_cb.setToolTip(
  2115. _("If checked, some of the application settings will be allowed\n"
  2116. "to have values that are usually unsafe to use.\n"
  2117. "Like Z travel negative values or Z Cut positive values.\n"
  2118. "It will applied at the next application start.\n"
  2119. "<<WARNING>>: Don't change this unless you know what you are doing !!!")
  2120. )
  2121. grid0.addWidget(self.machinist_cb, 33, 0, 1, 2)
  2122. # Bookmarks Limit in the Help Menu
  2123. self.bm_limit_spinner = FCSpinner()
  2124. self.bm_limit_spinner.set_range(0, 9999)
  2125. self.bm_limit_label = QtWidgets.QLabel('%s:' % _('Bookmarks limit'))
  2126. self.bm_limit_label.setToolTip(
  2127. _("The maximum number of bookmarks that may be installed in the menu.\n"
  2128. "The number of bookmarks in the bookmark manager may be greater\n"
  2129. "but the menu will hold only so much.")
  2130. )
  2131. grid0.addWidget(self.bm_limit_label, 34, 0)
  2132. grid0.addWidget(self.bm_limit_spinner, 34, 1)
  2133. # Activity monitor icon
  2134. self.activity_label = QtWidgets.QLabel('%s:' % _("Activity Icon"))
  2135. self.activity_label.setToolTip(
  2136. _("Select the GIF that show activity when FlatCAM is active.")
  2137. )
  2138. self.activity_combo = FCComboBox()
  2139. self.activity_combo.addItems(['Ball black', 'Ball green', 'Arrow green', 'Eclipse green'])
  2140. grid0.addWidget(self.activity_label, 35, 0)
  2141. grid0.addWidget(self.activity_combo, 35, 1)
  2142. self.layout.addStretch()
  2143. self.mouse_cursor_color_cb.stateChanged.connect(self.on_mouse_cursor_color_enable)
  2144. self.mouse_cursor_entry.editingFinished.connect(self.on_mouse_cursor_entry)
  2145. self.mouse_cursor_button.clicked.connect(self.on_mouse_cursor_button)
  2146. def on_mouse_cursor_color_enable(self, val):
  2147. if val:
  2148. self.app.cursor_color_3D = self.app.defaults["global_cursor_color"]
  2149. else:
  2150. theme_settings = QtCore.QSettings("Open Source", "FlatCAM")
  2151. if theme_settings.contains("theme"):
  2152. theme = theme_settings.value('theme', type=str)
  2153. else:
  2154. theme = 'white'
  2155. if theme == 'white':
  2156. self.app.cursor_color_3D = 'black'
  2157. else:
  2158. self.app.cursor_color_3D = 'gray'
  2159. def on_mouse_cursor_entry(self):
  2160. self.app.defaults['global_cursor_color'] = self.mouse_cursor_entry.get_value()
  2161. self.mouse_cursor_button.setStyleSheet("background-color:%s" % str(self.app.defaults['global_cursor_color']))
  2162. self.app.cursor_color_3D = self.app.defaults["global_cursor_color"]
  2163. def on_mouse_cursor_button(self):
  2164. current_color = QtGui.QColor(self.app.defaults['global_cursor_color'])
  2165. c_dialog = QtWidgets.QColorDialog()
  2166. proj_color = c_dialog.getColor(initial=current_color)
  2167. if proj_color.isValid() is False:
  2168. return
  2169. self.mouse_cursor_button.setStyleSheet("background-color:%s" % str(proj_color.name()))
  2170. new_val_sel = str(proj_color.name())
  2171. self.mouse_cursor_entry.set_value(new_val_sel)
  2172. self.app.defaults['global_cursor_color'] = new_val_sel
  2173. self.app.cursor_color_3D = self.app.defaults["global_cursor_color"]
  2174. class GeneralAppPrefGroupUI(OptionsGroupUI):
  2175. def __init__(self, decimals=4, parent=None):
  2176. super(GeneralAppPrefGroupUI, self).__init__(self)
  2177. self.setTitle(_("App Preferences"))
  2178. self.decimals = decimals
  2179. # Create a form layout for the Application general settings
  2180. grid0 = QtWidgets.QGridLayout()
  2181. self.layout.addLayout(grid0)
  2182. grid0.setColumnStretch(0, 0)
  2183. grid0.setColumnStretch(1, 1)
  2184. # Units for FlatCAM
  2185. self.unitslabel = QtWidgets.QLabel('<span style="color:red;"><b>%s:</b></span>' % _('Units'))
  2186. self.unitslabel.setToolTip(_("The default value for FlatCAM units.\n"
  2187. "Whatever is selected here is set every time\n"
  2188. "FLatCAM is started."))
  2189. self.units_radio = RadioSet([{'label': _('MM'), 'value': 'MM'},
  2190. {'label': _('IN'), 'value': 'IN'}])
  2191. grid0.addWidget(self.unitslabel, 0, 0)
  2192. grid0.addWidget(self.units_radio, 0, 1)
  2193. # Precision Metric
  2194. self.precision_metric_label = QtWidgets.QLabel('%s:' % _('Precision MM'))
  2195. self.precision_metric_label.setToolTip(
  2196. _("The number of decimals used throughout the application\n"
  2197. "when the set units are in METRIC system.\n"
  2198. "Any change here require an application restart.")
  2199. )
  2200. self.precision_metric_entry = FCSpinner()
  2201. self.precision_metric_entry.set_range(2, 16)
  2202. self.precision_metric_entry.setWrapping(True)
  2203. grid0.addWidget(self.precision_metric_label, 1, 0)
  2204. grid0.addWidget(self.precision_metric_entry, 1, 1)
  2205. # Precision Inch
  2206. self.precision_inch_label = QtWidgets.QLabel('%s:' % _('Precision INCH'))
  2207. self.precision_inch_label.setToolTip(
  2208. _("The number of decimals used throughout the application\n"
  2209. "when the set units are in INCH system.\n"
  2210. "Any change here require an application restart.")
  2211. )
  2212. self.precision_inch_entry = FCSpinner()
  2213. self.precision_inch_entry.set_range(2, 16)
  2214. self.precision_inch_entry.setWrapping(True)
  2215. grid0.addWidget(self.precision_inch_label, 2, 0)
  2216. grid0.addWidget(self.precision_inch_entry, 2, 1)
  2217. # Graphic Engine for FlatCAM
  2218. self.ge_label = QtWidgets.QLabel('<b>%s:</b>' % _('Graphic Engine'))
  2219. self.ge_label.setToolTip(_("Choose what graphic engine to use in FlatCAM.\n"
  2220. "Legacy(2D) -> reduced functionality, slow performance but enhanced compatibility.\n"
  2221. "OpenGL(3D) -> full functionality, high performance\n"
  2222. "Some graphic cards are too old and do not work in OpenGL(3D) mode, like:\n"
  2223. "Intel HD3000 or older. In this case the plot area will be black therefore\n"
  2224. "use the Legacy(2D) mode."))
  2225. self.ge_radio = RadioSet([{'label': _('Legacy(2D)'), 'value': '2D'},
  2226. {'label': _('OpenGL(3D)'), 'value': '3D'}],
  2227. orientation='vertical')
  2228. grid0.addWidget(self.ge_label, 3, 0)
  2229. grid0.addWidget(self.ge_radio, 3, 1)
  2230. separator_line = QtWidgets.QFrame()
  2231. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  2232. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  2233. grid0.addWidget(separator_line, 4, 0, 1, 2)
  2234. # Application Level for FlatCAM
  2235. self.app_level_label = QtWidgets.QLabel('<span style="color:red;"><b>%s:</b></span>' % _('APP. LEVEL'))
  2236. self.app_level_label.setToolTip(_("Choose the default level of usage for FlatCAM.\n"
  2237. "BASIC level -> reduced functionality, best for beginner's.\n"
  2238. "ADVANCED level -> full functionality.\n\n"
  2239. "The choice here will influence the parameters in\n"
  2240. "the Selected Tab for all kinds of FlatCAM objects."))
  2241. self.app_level_radio = RadioSet([{'label': _('Basic'), 'value': 'b'},
  2242. {'label': _('Advanced'), 'value': 'a'}])
  2243. grid0.addWidget(self.app_level_label, 5, 0)
  2244. grid0.addWidget(self.app_level_radio, 5, 1)
  2245. # Portability for FlatCAM
  2246. self.portability_cb = FCCheckBox('%s' % _('Portable app'))
  2247. self.portability_cb.setToolTip(_("Choose if the application should run as portable.\n\n"
  2248. "If Checked the application will run portable,\n"
  2249. "which means that the preferences files will be saved\n"
  2250. "in the application folder, in the lib\\config subfolder."))
  2251. grid0.addWidget(self.portability_cb, 6, 0, 1, 2)
  2252. separator_line = QtWidgets.QFrame()
  2253. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  2254. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  2255. grid0.addWidget(separator_line, 7, 0, 1, 2)
  2256. # Languages for FlatCAM
  2257. self.languagelabel = QtWidgets.QLabel('<b>%s</b>' % _('Languages'))
  2258. self.languagelabel.setToolTip(_("Set the language used throughout FlatCAM."))
  2259. self.language_cb = FCComboBox()
  2260. grid0.addWidget(self.languagelabel, 8, 0, 1, 2)
  2261. grid0.addWidget(self.language_cb, 9, 0, 1, 2)
  2262. self.language_apply_btn = FCButton(_("Apply Language"))
  2263. self.language_apply_btn.setToolTip(_("Set the language used throughout FlatCAM.\n"
  2264. "The app will restart after click."))
  2265. grid0.addWidget(self.language_apply_btn, 15, 0, 1, 2)
  2266. separator_line = QtWidgets.QFrame()
  2267. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  2268. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  2269. grid0.addWidget(separator_line, 16, 0, 1, 2)
  2270. # -----------------------------------------------------------
  2271. # ----------- APPLICATION STARTUP SETTINGS ------------------
  2272. # -----------------------------------------------------------
  2273. self.startup_label = QtWidgets.QLabel('<b>%s</b>' % _('Startup Settings'))
  2274. grid0.addWidget(self.startup_label, 17, 0, 1, 2)
  2275. # Splash Screen
  2276. self.splash_cb = FCCheckBox('%s' % _('Splash Screen'))
  2277. self.splash_cb.setToolTip(
  2278. _("Enable display of the splash screen at application startup.")
  2279. )
  2280. qsettings = QSettings("Open Source", "FlatCAM")
  2281. if qsettings.value("splash_screen"):
  2282. self.splash_cb.set_value(True)
  2283. else:
  2284. self.splash_cb.set_value(False)
  2285. grid0.addWidget(self.splash_cb, 18, 0, 1, 2)
  2286. # Sys Tray Icon
  2287. self.systray_cb = FCCheckBox('%s' % _('Sys Tray Icon'))
  2288. self.systray_cb.setToolTip(
  2289. _("Enable display of FlatCAM icon in Sys Tray.")
  2290. )
  2291. grid0.addWidget(self.systray_cb, 19, 0, 1, 2)
  2292. # Shell StartUp CB
  2293. self.shell_startup_cb = FCCheckBox(label='%s' % _('Show Shell'))
  2294. self.shell_startup_cb.setToolTip(
  2295. _("Check this box if you want the shell to\n"
  2296. "start automatically at startup.")
  2297. )
  2298. grid0.addWidget(self.shell_startup_cb, 20, 0, 1, 2)
  2299. # Project at StartUp CB
  2300. self.project_startup_cb = FCCheckBox(label='%s' % _('Show Project'))
  2301. self.project_startup_cb.setToolTip(
  2302. _("Check this box if you want the project/selected/tool tab area to\n"
  2303. "to be shown automatically at startup.")
  2304. )
  2305. grid0.addWidget(self.project_startup_cb, 21, 0, 1, 2)
  2306. # Version Check CB
  2307. self.version_check_cb = FCCheckBox(label='%s' % _('Version Check'))
  2308. self.version_check_cb.setToolTip(
  2309. _("Check this box if you want to check\n"
  2310. "for a new version automatically at startup.")
  2311. )
  2312. grid0.addWidget(self.version_check_cb, 22, 0, 1, 2)
  2313. # Send Stats CB
  2314. self.send_stats_cb = FCCheckBox(label='%s' % _('Send Statistics'))
  2315. self.send_stats_cb.setToolTip(
  2316. _("Check this box if you agree to send anonymous\n"
  2317. "stats automatically at startup, to help improve FlatCAM.")
  2318. )
  2319. grid0.addWidget(self.send_stats_cb, 23, 0, 1, 2)
  2320. self.ois_version_check = OptionalInputSection(self.version_check_cb, [self.send_stats_cb])
  2321. separator_line = QtWidgets.QFrame()
  2322. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  2323. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  2324. grid0.addWidget(separator_line, 24, 0, 1, 2)
  2325. # Worker Numbers
  2326. self.worker_number_label = QtWidgets.QLabel('%s:' % _('Workers number'))
  2327. self.worker_number_label.setToolTip(
  2328. _("The number of Qthreads made available to the App.\n"
  2329. "A bigger number may finish the jobs more quickly but\n"
  2330. "depending on your computer speed, may make the App\n"
  2331. "unresponsive. Can have a value between 2 and 16.\n"
  2332. "Default value is 2.\n"
  2333. "After change, it will be applied at next App start.")
  2334. )
  2335. self.worker_number_sb = FCSpinner()
  2336. self.worker_number_sb.set_range(2, 16)
  2337. grid0.addWidget(self.worker_number_label, 25, 0)
  2338. grid0.addWidget(self.worker_number_sb, 25, 1)
  2339. # Geometric tolerance
  2340. tol_label = QtWidgets.QLabel('%s:' % _("Geo Tolerance"))
  2341. tol_label.setToolTip(_(
  2342. "This value can counter the effect of the Circle Steps\n"
  2343. "parameter. Default value is 0.005.\n"
  2344. "A lower value will increase the detail both in image\n"
  2345. "and in Gcode for the circles, with a higher cost in\n"
  2346. "performance. Higher value will provide more\n"
  2347. "performance at the expense of level of detail."
  2348. ))
  2349. self.tol_entry = FCDoubleSpinner()
  2350. self.tol_entry.setSingleStep(0.001)
  2351. self.tol_entry.set_precision(6)
  2352. grid0.addWidget(tol_label, 26, 0)
  2353. grid0.addWidget(self.tol_entry, 26, 1)
  2354. separator_line = QtWidgets.QFrame()
  2355. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  2356. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  2357. grid0.addWidget(separator_line, 27, 0, 1, 2)
  2358. # Save Settings
  2359. self.save_label = QtWidgets.QLabel('<b>%s</b>' % _("Save Settings"))
  2360. grid0.addWidget(self.save_label, 28, 0, 1, 2)
  2361. # Save compressed project CB
  2362. self.save_type_cb = FCCheckBox(_('Save Compressed Project'))
  2363. self.save_type_cb.setToolTip(
  2364. _("Whether to save a compressed or uncompressed project.\n"
  2365. "When checked it will save a compressed FlatCAM project.")
  2366. )
  2367. grid0.addWidget(self.save_type_cb, 29, 0, 1, 2)
  2368. # Project LZMA Comppression Level
  2369. self.compress_spinner = FCSpinner()
  2370. self.compress_spinner.set_range(0, 9)
  2371. self.compress_label = QtWidgets.QLabel('%s:' % _('Compression'))
  2372. self.compress_label.setToolTip(
  2373. _("The level of compression used when saving\n"
  2374. "a FlatCAM project. Higher value means better compression\n"
  2375. "but require more RAM usage and more processing time.")
  2376. )
  2377. grid0.addWidget(self.compress_label, 30, 0)
  2378. grid0.addWidget(self.compress_spinner, 30, 1)
  2379. self.proj_ois = OptionalInputSection(self.save_type_cb, [self.compress_label, self.compress_spinner], True)
  2380. # Auto save CB
  2381. self.autosave_cb = FCCheckBox(_('Enable Auto Save'))
  2382. self.autosave_cb.setToolTip(
  2383. _("Check to enable the autosave feature.\n"
  2384. "When enabled, the application will try to save a project\n"
  2385. "at the set interval.")
  2386. )
  2387. grid0.addWidget(self.autosave_cb, 31, 0, 1, 2)
  2388. # Auto Save Timeout Interval
  2389. self.autosave_entry = FCSpinner()
  2390. self.autosave_entry.set_range(0, 9999999)
  2391. self.autosave_label = QtWidgets.QLabel('%s:' % _('Interval'))
  2392. self.autosave_label.setToolTip(
  2393. _("Time interval for autosaving. In milliseconds.\n"
  2394. "The application will try to save periodically but only\n"
  2395. "if the project was saved manually at least once.\n"
  2396. "While active, some operations may block this feature.")
  2397. )
  2398. grid0.addWidget(self.autosave_label, 32, 0)
  2399. grid0.addWidget(self.autosave_entry, 32, 1)
  2400. # self.as_ois = OptionalInputSection(self.autosave_cb, [self.autosave_label, self.autosave_entry], True)
  2401. separator_line = QtWidgets.QFrame()
  2402. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  2403. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  2404. grid0.addWidget(separator_line, 33, 0, 1, 2)
  2405. self.pdf_param_label = QtWidgets.QLabel('<B>%s:</b>' % _("Text to PDF parameters"))
  2406. self.pdf_param_label.setToolTip(
  2407. _("Used when saving text in Code Editor or in FlatCAM Document objects.")
  2408. )
  2409. grid0.addWidget(self.pdf_param_label, 34, 0, 1, 2)
  2410. # Top Margin value
  2411. self.tmargin_entry = FCDoubleSpinner()
  2412. self.tmargin_entry.set_precision(self.decimals)
  2413. self.tmargin_entry.set_range(0.0000, 9999.9999)
  2414. self.tmargin_label = QtWidgets.QLabel('%s:' % _("Top Margin"))
  2415. self.tmargin_label.setToolTip(
  2416. _("Distance between text body and the top of the PDF file.")
  2417. )
  2418. grid0.addWidget(self.tmargin_label, 35, 0)
  2419. grid0.addWidget(self.tmargin_entry, 35, 1)
  2420. # Bottom Margin value
  2421. self.bmargin_entry = FCDoubleSpinner()
  2422. self.bmargin_entry.set_precision(self.decimals)
  2423. self.bmargin_entry.set_range(0.0000, 9999.9999)
  2424. self.bmargin_label = QtWidgets.QLabel('%s:' % _("Bottom Margin"))
  2425. self.bmargin_label.setToolTip(
  2426. _("Distance between text body and the bottom of the PDF file.")
  2427. )
  2428. grid0.addWidget(self.bmargin_label, 36, 0)
  2429. grid0.addWidget(self.bmargin_entry, 36, 1)
  2430. # Left Margin value
  2431. self.lmargin_entry = FCDoubleSpinner()
  2432. self.lmargin_entry.set_precision(self.decimals)
  2433. self.lmargin_entry.set_range(0.0000, 9999.9999)
  2434. self.lmargin_label = QtWidgets.QLabel('%s:' % _("Left Margin"))
  2435. self.lmargin_label.setToolTip(
  2436. _("Distance between text body and the left of the PDF file.")
  2437. )
  2438. grid0.addWidget(self.lmargin_label, 37, 0)
  2439. grid0.addWidget(self.lmargin_entry, 37, 1)
  2440. # Right Margin value
  2441. self.rmargin_entry = FCDoubleSpinner()
  2442. self.rmargin_entry.set_precision(self.decimals)
  2443. self.rmargin_entry.set_range(0.0000, 9999.9999)
  2444. self.rmargin_label = QtWidgets.QLabel('%s:' % _("Right Margin"))
  2445. self.rmargin_label.setToolTip(
  2446. _("Distance between text body and the right of the PDF file.")
  2447. )
  2448. grid0.addWidget(self.rmargin_label, 38, 0)
  2449. grid0.addWidget(self.rmargin_entry, 38, 1)
  2450. self.layout.addStretch()
  2451. if sys.platform != 'win32':
  2452. self.portability_cb.hide()
  2453. # splash screen button signal
  2454. self.splash_cb.stateChanged.connect(self.on_splash_changed)
  2455. # Monitor the checkbox from the Application Defaults Tab and show the TCL shell or not depending on it's value
  2456. self.shell_startup_cb.clicked.connect(self.app.on_toggle_shell_from_settings)
  2457. self.language_apply_btn.clicked.connect(lambda: fcTranslate.on_language_apply_click(app=self.app, restart=True))
  2458. @staticmethod
  2459. def on_splash_changed(state):
  2460. qsettings = QSettings("Open Source", "FlatCAM")
  2461. qsettings.setValue('splash_screen', 1) if state else qsettings.setValue('splash_screen', 0)
  2462. # This will write the setting to the platform specific storage.
  2463. del qsettings
  2464. class GerberGenPrefGroupUI(OptionsGroupUI):
  2465. def __init__(self, decimals=4, parent=None):
  2466. # OptionsGroupUI.__init__(self, "Gerber General Preferences", parent=parent)
  2467. super(GerberGenPrefGroupUI, self).__init__(self)
  2468. self.parent = parent
  2469. self.setTitle(str(_("Gerber General")))
  2470. self.decimals = decimals
  2471. # ## Plot options
  2472. self.plot_options_label = QtWidgets.QLabel("<b>%s:</b>" % _("Plot Options"))
  2473. self.layout.addWidget(self.plot_options_label)
  2474. grid0 = QtWidgets.QGridLayout()
  2475. self.layout.addLayout(grid0)
  2476. # Solid CB
  2477. self.solid_cb = FCCheckBox(label='%s' % _('Solid'))
  2478. self.solid_cb.setToolTip(
  2479. _("Solid color polygons.")
  2480. )
  2481. grid0.addWidget(self.solid_cb, 0, 0)
  2482. # Multicolored CB
  2483. self.multicolored_cb = FCCheckBox(label='%s' % _('M-Color'))
  2484. self.multicolored_cb.setToolTip(
  2485. _("Draw polygons in different colors.")
  2486. )
  2487. grid0.addWidget(self.multicolored_cb, 0, 1)
  2488. # Plot CB
  2489. self.plot_cb = FCCheckBox(label='%s' % _('Plot'))
  2490. self.plot_options_label.setToolTip(
  2491. _("Plot (show) this object.")
  2492. )
  2493. grid0.addWidget(self.plot_cb, 0, 2)
  2494. # Number of circle steps for circular aperture linear approximation
  2495. self.circle_steps_label = QtWidgets.QLabel('%s:' % _("Circle Steps"))
  2496. self.circle_steps_label.setToolTip(
  2497. _("The number of circle steps for Gerber \n"
  2498. "circular aperture linear approximation.")
  2499. )
  2500. self.circle_steps_entry = FCSpinner()
  2501. self.circle_steps_entry.set_range(0, 9999)
  2502. grid0.addWidget(self.circle_steps_label, 1, 0)
  2503. grid0.addWidget(self.circle_steps_entry, 1, 1, 1, 2)
  2504. grid0.addWidget(QtWidgets.QLabel(''), 2, 0, 1, 3)
  2505. # Default format for Gerber
  2506. self.gerber_default_label = QtWidgets.QLabel('<b>%s:</b>' % _('Default Values'))
  2507. self.gerber_default_label.setToolTip(
  2508. _("Those values will be used as fallback values\n"
  2509. "in case that they are not found in the Gerber file.")
  2510. )
  2511. grid0.addWidget(self.gerber_default_label, 3, 0, 1, 3)
  2512. # Gerber Units
  2513. self.gerber_units_label = QtWidgets.QLabel('%s:' % _('Units'))
  2514. self.gerber_units_label.setToolTip(
  2515. _("The units used in the Gerber file.")
  2516. )
  2517. self.gerber_units_radio = RadioSet([{'label': _('INCH'), 'value': 'IN'},
  2518. {'label': _('MM'), 'value': 'MM'}])
  2519. self.gerber_units_radio.setToolTip(
  2520. _("The units used in the Gerber file.")
  2521. )
  2522. grid0.addWidget(self.gerber_units_label, 4, 0)
  2523. grid0.addWidget(self.gerber_units_radio, 4, 1, 1, 2)
  2524. # Gerber Zeros
  2525. self.gerber_zeros_label = QtWidgets.QLabel('%s:' % _('Zeros'))
  2526. self.gerber_zeros_label.setAlignment(QtCore.Qt.AlignLeft)
  2527. self.gerber_zeros_label.setToolTip(
  2528. _("This sets the type of Gerber zeros.\n"
  2529. "If LZ then Leading Zeros are removed and\n"
  2530. "Trailing Zeros are kept.\n"
  2531. "If TZ is checked then Trailing Zeros are removed\n"
  2532. "and Leading Zeros are kept.")
  2533. )
  2534. self.gerber_zeros_radio = RadioSet([{'label': _('LZ'), 'value': 'L'},
  2535. {'label': _('TZ'), 'value': 'T'}])
  2536. self.gerber_zeros_radio.setToolTip(
  2537. _("This sets the type of Gerber zeros.\n"
  2538. "If LZ then Leading Zeros are removed and\n"
  2539. "Trailing Zeros are kept.\n"
  2540. "If TZ is checked then Trailing Zeros are removed\n"
  2541. "and Leading Zeros are kept.")
  2542. )
  2543. grid0.addWidget(self.gerber_zeros_label, 5, 0)
  2544. grid0.addWidget(self.gerber_zeros_radio, 5, 1, 1, 2)
  2545. separator_line = QtWidgets.QFrame()
  2546. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  2547. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  2548. grid0.addWidget(separator_line, 6, 0, 1, 3)
  2549. # Apertures Cleaning
  2550. self.gerber_clean_cb = FCCheckBox(label='%s' % _('Clean Apertures'))
  2551. self.gerber_clean_cb.setToolTip(
  2552. _("Will remove apertures that do not have geometry\n"
  2553. "thus lowering the number of apertures in the Gerber object.")
  2554. )
  2555. grid0.addWidget(self.gerber_clean_cb, 7, 0, 1, 3)
  2556. # Apply Extra Buffering
  2557. self.gerber_extra_buffering = FCCheckBox(label='%s' % _('Polarity change buffer'))
  2558. self.gerber_extra_buffering.setToolTip(
  2559. _("Will apply extra buffering for the\n"
  2560. "solid geometry when we have polarity changes.\n"
  2561. "May help loading Gerber files that otherwise\n"
  2562. "do not load correctly.")
  2563. )
  2564. grid0.addWidget(self.gerber_extra_buffering, 8, 0, 1, 3)
  2565. separator_line = QtWidgets.QFrame()
  2566. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  2567. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  2568. grid0.addWidget(separator_line, 9, 0, 1, 3)
  2569. # Gerber Object Color
  2570. self.gerber_color_label = QtWidgets.QLabel('<b>%s</b>' % _('Gerber Object Color'))
  2571. grid0.addWidget(self.gerber_color_label, 10, 0, 1, 3)
  2572. # Plot Line Color
  2573. self.pl_color_label = QtWidgets.QLabel('%s:' % _('Outline'))
  2574. self.pl_color_label.setToolTip(
  2575. _("Set the line color for plotted objects.")
  2576. )
  2577. self.pl_color_entry = FCEntry()
  2578. self.pl_color_button = QtWidgets.QPushButton()
  2579. self.pl_color_button.setFixedSize(15, 15)
  2580. self.form_box_child_2 = QtWidgets.QHBoxLayout()
  2581. self.form_box_child_2.addWidget(self.pl_color_entry)
  2582. self.form_box_child_2.addWidget(self.pl_color_button)
  2583. self.form_box_child_2.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  2584. grid0.addWidget(self.pl_color_label, 11, 0)
  2585. grid0.addLayout(self.form_box_child_2, 11, 1, 1, 2)
  2586. # Plot Fill Color
  2587. self.pf_color_label = QtWidgets.QLabel('%s:' % _('Fill'))
  2588. self.pf_color_label.setToolTip(
  2589. _("Set the fill color for plotted objects.\n"
  2590. "First 6 digits are the color and the last 2\n"
  2591. "digits are for alpha (transparency) level.")
  2592. )
  2593. self.pf_color_entry = FCEntry()
  2594. self.pf_color_button = QtWidgets.QPushButton()
  2595. self.pf_color_button.setFixedSize(15, 15)
  2596. self.form_box_child_1 = QtWidgets.QHBoxLayout()
  2597. self.form_box_child_1.addWidget(self.pf_color_entry)
  2598. self.form_box_child_1.addWidget(self.pf_color_button)
  2599. self.form_box_child_1.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  2600. grid0.addWidget(self.pf_color_label, 12, 0)
  2601. grid0.addLayout(self.form_box_child_1, 12, 1, 1, 2)
  2602. # Plot Fill Transparency Level
  2603. self.pf_alpha_label = QtWidgets.QLabel('%s:' % _('Alpha'))
  2604. self.pf_alpha_label.setToolTip(
  2605. _("Set the fill transparency for plotted objects.")
  2606. )
  2607. self.pf_color_alpha_slider = QtWidgets.QSlider(QtCore.Qt.Horizontal)
  2608. self.pf_color_alpha_slider.setMinimum(0)
  2609. self.pf_color_alpha_slider.setMaximum(255)
  2610. self.pf_color_alpha_slider.setSingleStep(1)
  2611. self.pf_color_alpha_spinner = FCSpinner()
  2612. self.pf_color_alpha_spinner.setMinimumWidth(70)
  2613. self.pf_color_alpha_spinner.set_range(0, 255)
  2614. self.form_box_child_3 = QtWidgets.QHBoxLayout()
  2615. self.form_box_child_3.addWidget(self.pf_color_alpha_slider)
  2616. self.form_box_child_3.addWidget(self.pf_color_alpha_spinner)
  2617. grid0.addWidget(self.pf_alpha_label, 13, 0)
  2618. grid0.addLayout(self.form_box_child_3, 13, 1, 1, 2)
  2619. self.layout.addStretch()
  2620. # Setting plot colors signals
  2621. self.pl_color_entry.editingFinished.connect(self.on_pl_color_entry)
  2622. self.pl_color_button.clicked.connect(self.on_pl_color_button)
  2623. self.pf_color_entry.editingFinished.connect(self.on_pf_color_entry)
  2624. self.pf_color_button.clicked.connect(self.on_pf_color_button)
  2625. self.pf_color_alpha_spinner.valueChanged.connect(self.on_pf_color_spinner)
  2626. self.pf_color_alpha_slider.valueChanged.connect(self.on_pf_color_slider)
  2627. # Setting plot colors handlers
  2628. def on_pf_color_entry(self):
  2629. self.app.defaults['gerber_plot_fill'] = self.pf_color_entry.get_value()[:7] + \
  2630. self.app.defaults['gerber_plot_fill'][7:9]
  2631. self.pf_color_button.setStyleSheet("background-color:%s" % str(self.app.defaults['gerber_plot_fill'])[:7])
  2632. def on_pf_color_button(self):
  2633. current_color = QtGui.QColor(self.app.defaults['gerber_plot_fill'][:7])
  2634. c_dialog = QtWidgets.QColorDialog()
  2635. plot_fill_color = c_dialog.getColor(initial=current_color)
  2636. if plot_fill_color.isValid() is False:
  2637. return
  2638. self.pf_color_button.setStyleSheet("background-color:%s" % str(plot_fill_color.name()))
  2639. new_val = str(plot_fill_color.name()) + str(self.app.defaults['gerber_plot_fill'][7:9])
  2640. self.pf_color_entry.set_value(new_val)
  2641. self.app.defaults['gerber_plot_fill'] = new_val
  2642. def on_pf_color_spinner(self):
  2643. spinner_value = self.pf_color_alpha_spinner.value()
  2644. self.pf_color_alpha_slider.setValue(spinner_value)
  2645. self.app.defaults['gerber_plot_fill'] = \
  2646. self.app.defaults['gerber_plot_fill'][:7] + \
  2647. (hex(spinner_value)[2:] if int(hex(spinner_value)[2:], 16) > 0 else '00')
  2648. self.app.defaults['gerber_plot_line'] = \
  2649. self.app.defaults['gerber_plot_line'][:7] + \
  2650. (hex(spinner_value)[2:] if int(hex(spinner_value)[2:], 16) > 0 else '00')
  2651. def on_pf_color_slider(self):
  2652. slider_value = self.pf_color_alpha_slider.value()
  2653. self.pf_color_alpha_spinner.setValue(slider_value)
  2654. def on_pl_color_entry(self):
  2655. self.app.defaults['gerber_plot_line'] = self.pl_color_entry.get_value()[:7] + \
  2656. self.app.defaults['gerber_plot_line'][7:9]
  2657. self.pl_color_button.setStyleSheet("background-color:%s" % str(self.app.defaults['gerber_plot_line'])[:7])
  2658. def on_pl_color_button(self):
  2659. current_color = QtGui.QColor(self.app.defaults['gerber_plot_line'][:7])
  2660. # print(current_color)
  2661. c_dialog = QtWidgets.QColorDialog()
  2662. plot_line_color = c_dialog.getColor(initial=current_color)
  2663. if plot_line_color.isValid() is False:
  2664. return
  2665. self.pl_color_button.setStyleSheet("background-color:%s" % str(plot_line_color.name()))
  2666. new_val_line = str(plot_line_color.name()) + str(self.app.defaults['gerber_plot_line'][7:9])
  2667. self.pl_color_entry.set_value(new_val_line)
  2668. self.app.defaults['gerber_plot_line'] = new_val_line
  2669. class GerberOptPrefGroupUI(OptionsGroupUI):
  2670. def __init__(self, decimals=4, parent=None):
  2671. # OptionsGroupUI.__init__(self, "Gerber Options Preferences", parent=parent)
  2672. super(GerberOptPrefGroupUI, self).__init__(self)
  2673. self.decimals = decimals
  2674. self.setTitle(str(_("Gerber Options")))
  2675. # ## Isolation Routing
  2676. self.isolation_routing_label = QtWidgets.QLabel("<b>%s:</b>" % _("Isolation Routing"))
  2677. self.isolation_routing_label.setToolTip(
  2678. _("Create a Geometry object with\n"
  2679. "toolpaths to cut outside polygons.")
  2680. )
  2681. self.layout.addWidget(self.isolation_routing_label)
  2682. # Cutting Tool Diameter
  2683. grid0 = QtWidgets.QGridLayout()
  2684. self.layout.addLayout(grid0)
  2685. tdlabel = QtWidgets.QLabel('%s:' % _('Tool dia'))
  2686. tdlabel.setToolTip(
  2687. _("Diameter of the cutting tool.")
  2688. )
  2689. grid0.addWidget(tdlabel, 0, 0)
  2690. self.iso_tool_dia_entry = FCDoubleSpinner()
  2691. self.iso_tool_dia_entry.set_precision(self.decimals)
  2692. self.iso_tool_dia_entry.setSingleStep(0.1)
  2693. self.iso_tool_dia_entry.set_range(-9999, 9999)
  2694. grid0.addWidget(self.iso_tool_dia_entry, 0, 1)
  2695. # Nr of passes
  2696. passlabel = QtWidgets.QLabel('%s:' % _('# Passes'))
  2697. passlabel.setToolTip(
  2698. _("Width of the isolation gap in\n"
  2699. "number (integer) of tool widths.")
  2700. )
  2701. self.iso_width_entry = FCSpinner()
  2702. self.iso_width_entry.set_range(1, 999)
  2703. grid0.addWidget(passlabel, 1, 0)
  2704. grid0.addWidget(self.iso_width_entry, 1, 1)
  2705. # Pass overlap
  2706. overlabel = QtWidgets.QLabel('%s:' % _('Pass overlap'))
  2707. overlabel.setToolTip(
  2708. _("How much (percentage) of the tool width to overlap each tool pass.")
  2709. )
  2710. self.iso_overlap_entry = FCDoubleSpinner(suffix='%')
  2711. self.iso_overlap_entry.set_precision(self.decimals)
  2712. self.iso_overlap_entry.setWrapping(True)
  2713. self.iso_overlap_entry.setRange(0.0000, 99.9999)
  2714. self.iso_overlap_entry.setSingleStep(0.1)
  2715. grid0.addWidget(overlabel, 2, 0)
  2716. grid0.addWidget(self.iso_overlap_entry, 2, 1)
  2717. # Isolation Scope
  2718. self.iso_scope_label = QtWidgets.QLabel('%s:' % _('Scope'))
  2719. self.iso_scope_label.setToolTip(
  2720. _("Isolation scope. Choose what to isolate:\n"
  2721. "- 'All' -> Isolate all the polygons in the object\n"
  2722. "- 'Selection' -> Isolate a selection of polygons.")
  2723. )
  2724. self.iso_scope_radio = RadioSet([{'label': _('All'), 'value': 'all'},
  2725. {'label': _('Selection'), 'value': 'single'}])
  2726. grid0.addWidget(self.iso_scope_label, 3, 0)
  2727. grid0.addWidget(self.iso_scope_radio, 3, 1, 1, 2)
  2728. # Milling Type
  2729. milling_type_label = QtWidgets.QLabel('%s:' % _('Milling Type'))
  2730. milling_type_label.setToolTip(
  2731. _("Milling type:\n"
  2732. "- climb / best for precision milling and to reduce tool usage\n"
  2733. "- conventional / useful when there is no backlash compensation")
  2734. )
  2735. grid0.addWidget(milling_type_label, 4, 0)
  2736. self.milling_type_radio = RadioSet([{'label': _('Climb'), 'value': 'cl'},
  2737. {'label': _('Conventional'), 'value': 'cv'}])
  2738. grid0.addWidget(self.milling_type_radio, 4, 1)
  2739. # Combine passes
  2740. self.combine_passes_cb = FCCheckBox(label=_('Combine Passes'))
  2741. self.combine_passes_cb.setToolTip(
  2742. _("Combine all passes into one object")
  2743. )
  2744. grid0.addWidget(self.combine_passes_cb, 5, 0, 1, 2)
  2745. separator_line = QtWidgets.QFrame()
  2746. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  2747. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  2748. grid0.addWidget(separator_line, 6, 0, 1, 2)
  2749. # ## Clear non-copper regions
  2750. self.clearcopper_label = QtWidgets.QLabel("<b>%s:</b>" % _("Non-copper regions"))
  2751. self.clearcopper_label.setToolTip(
  2752. _("Create polygons covering the\n"
  2753. "areas without copper on the PCB.\n"
  2754. "Equivalent to the inverse of this\n"
  2755. "object. Can be used to remove all\n"
  2756. "copper from a specified region.")
  2757. )
  2758. self.layout.addWidget(self.clearcopper_label)
  2759. grid1 = QtWidgets.QGridLayout()
  2760. self.layout.addLayout(grid1)
  2761. # Margin
  2762. bmlabel = QtWidgets.QLabel('%s:' % _('Boundary Margin'))
  2763. bmlabel.setToolTip(
  2764. _("Specify the edge of the PCB\n"
  2765. "by drawing a box around all\n"
  2766. "objects with this minimum\n"
  2767. "distance.")
  2768. )
  2769. grid1.addWidget(bmlabel, 0, 0)
  2770. self.noncopper_margin_entry = FCDoubleSpinner()
  2771. self.noncopper_margin_entry.set_precision(self.decimals)
  2772. self.noncopper_margin_entry.setSingleStep(0.1)
  2773. self.noncopper_margin_entry.set_range(-9999, 9999)
  2774. grid1.addWidget(self.noncopper_margin_entry, 0, 1)
  2775. # Rounded corners
  2776. self.noncopper_rounded_cb = FCCheckBox(label=_("Rounded Geo"))
  2777. self.noncopper_rounded_cb.setToolTip(
  2778. _("Resulting geometry will have rounded corners.")
  2779. )
  2780. grid1.addWidget(self.noncopper_rounded_cb, 1, 0, 1, 2)
  2781. separator_line = QtWidgets.QFrame()
  2782. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  2783. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  2784. grid1.addWidget(separator_line, 2, 0, 1, 2)
  2785. # ## Bounding box
  2786. self.boundingbox_label = QtWidgets.QLabel('<b>%s:</b>' % _('Bounding Box'))
  2787. self.layout.addWidget(self.boundingbox_label)
  2788. grid2 = QtWidgets.QGridLayout()
  2789. self.layout.addLayout(grid2)
  2790. bbmargin = QtWidgets.QLabel('%s:' % _('Boundary Margin'))
  2791. bbmargin.setToolTip(
  2792. _("Distance of the edges of the box\n"
  2793. "to the nearest polygon.")
  2794. )
  2795. self.bbmargin_entry = FCDoubleSpinner()
  2796. self.bbmargin_entry.set_precision(self.decimals)
  2797. self.bbmargin_entry.setSingleStep(0.1)
  2798. self.bbmargin_entry.set_range(-9999, 9999)
  2799. grid2.addWidget(bbmargin, 0, 0)
  2800. grid2.addWidget(self.bbmargin_entry, 0, 1)
  2801. self.bbrounded_cb = FCCheckBox(label='%s' % _("Rounded Geo"))
  2802. self.bbrounded_cb.setToolTip(
  2803. _("If the bounding box is \n"
  2804. "to have rounded corners\n"
  2805. "their radius is equal to\n"
  2806. "the margin.")
  2807. )
  2808. grid2.addWidget(self.bbrounded_cb, 1, 0, 1, 2)
  2809. self.layout.addStretch()
  2810. class GerberAdvOptPrefGroupUI(OptionsGroupUI):
  2811. def __init__(self, decimals=4, parent=None):
  2812. # OptionsGroupUI.__init__(self, "Gerber Adv. Options Preferences", parent=parent)
  2813. super(GerberAdvOptPrefGroupUI, self).__init__(self)
  2814. self.setTitle(str(_("Gerber Adv. Options")))
  2815. self.decimals = decimals
  2816. # ## Advanced Gerber Parameters
  2817. self.adv_param_label = QtWidgets.QLabel('<b>%s:</b>' % _('Advanced Options'))
  2818. self.adv_param_label.setToolTip(
  2819. _("A list of Gerber advanced parameters.\n"
  2820. "Those parameters are available only for\n"
  2821. "Advanced App. Level.")
  2822. )
  2823. self.layout.addWidget(self.adv_param_label)
  2824. grid0 = QtWidgets.QGridLayout()
  2825. self.layout.addLayout(grid0)
  2826. # Follow Attribute
  2827. self.follow_cb = FCCheckBox(label=_('"Follow"'))
  2828. self.follow_cb.setToolTip(
  2829. _("Generate a 'Follow' geometry.\n"
  2830. "This means that it will cut through\n"
  2831. "the middle of the trace.")
  2832. )
  2833. grid0.addWidget(self.follow_cb, 0, 0, 1, 2)
  2834. # Aperture Table Visibility CB
  2835. self.aperture_table_visibility_cb = FCCheckBox(label=_('Table Show/Hide'))
  2836. self.aperture_table_visibility_cb.setToolTip(
  2837. _("Toggle the display of the Gerber Apertures Table.\n"
  2838. "Also, on hide, it will delete all mark shapes\n"
  2839. "that are drawn on canvas.")
  2840. )
  2841. grid0.addWidget(self.aperture_table_visibility_cb, 1, 0, 1, 2)
  2842. separator_line = QtWidgets.QFrame()
  2843. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  2844. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  2845. grid0.addWidget(separator_line, 2, 0, 1, 2)
  2846. # Tool Type
  2847. self.tool_type_label = QtWidgets.QLabel('<b>%s</b>' % _('Tool Type'))
  2848. self.tool_type_label.setToolTip(
  2849. _("Choose which tool to use for Gerber isolation:\n"
  2850. "'Circular' or 'V-shape'.\n"
  2851. "When the 'V-shape' is selected then the tool\n"
  2852. "diameter will depend on the chosen cut depth.")
  2853. )
  2854. self.tool_type_radio = RadioSet([{'label': 'Circular', 'value': 'circular'},
  2855. {'label': 'V-Shape', 'value': 'v'}])
  2856. grid0.addWidget(self.tool_type_label, 3, 0)
  2857. grid0.addWidget(self.tool_type_radio, 3, 1, 1, 2)
  2858. # Tip Dia
  2859. self.tipdialabel = QtWidgets.QLabel('%s:' % _('V-Tip Dia'))
  2860. self.tipdialabel.setToolTip(
  2861. _("The tip diameter for V-Shape Tool")
  2862. )
  2863. self.tipdia_spinner = FCDoubleSpinner()
  2864. self.tipdia_spinner.set_precision(self.decimals)
  2865. self.tipdia_spinner.set_range(-99.9999, 99.9999)
  2866. self.tipdia_spinner.setSingleStep(0.1)
  2867. self.tipdia_spinner.setWrapping(True)
  2868. grid0.addWidget(self.tipdialabel, 4, 0)
  2869. grid0.addWidget(self.tipdia_spinner, 4, 1, 1, 2)
  2870. # Tip Angle
  2871. self.tipanglelabel = QtWidgets.QLabel('%s:' % _('V-Tip Angle'))
  2872. self.tipanglelabel.setToolTip(
  2873. _("The tip angle for V-Shape Tool.\n"
  2874. "In degree.")
  2875. )
  2876. self.tipangle_spinner = FCSpinner()
  2877. self.tipangle_spinner.set_range(1, 180)
  2878. self.tipangle_spinner.set_step(5)
  2879. self.tipangle_spinner.setWrapping(True)
  2880. grid0.addWidget(self.tipanglelabel, 5, 0)
  2881. grid0.addWidget(self.tipangle_spinner, 5, 1, 1, 2)
  2882. # Cut Z
  2883. self.cutzlabel = QtWidgets.QLabel('%s:' % _('Cut Z'))
  2884. self.cutzlabel.setToolTip(
  2885. _("Cutting depth (negative)\n"
  2886. "below the copper surface.")
  2887. )
  2888. self.cutz_spinner = FCDoubleSpinner()
  2889. self.cutz_spinner.set_precision(self.decimals)
  2890. self.cutz_spinner.set_range(-99.9999, 0.0000)
  2891. self.cutz_spinner.setSingleStep(0.1)
  2892. self.cutz_spinner.setWrapping(True)
  2893. grid0.addWidget(self.cutzlabel, 6, 0)
  2894. grid0.addWidget(self.cutz_spinner, 6, 1, 1, 2)
  2895. # Isolation Type
  2896. self.iso_type_label = QtWidgets.QLabel('%s:' % _('Isolation Type'))
  2897. self.iso_type_label.setToolTip(
  2898. _("Choose how the isolation will be executed:\n"
  2899. "- 'Full' -> complete isolation of polygons\n"
  2900. "- 'Ext' -> will isolate only on the outside\n"
  2901. "- 'Int' -> will isolate only on the inside\n"
  2902. "'Exterior' isolation is almost always possible\n"
  2903. "(with the right tool) but 'Interior'\n"
  2904. "isolation can be done only when there is an opening\n"
  2905. "inside of the polygon (e.g polygon is a 'doughnut' shape).")
  2906. )
  2907. self.iso_type_radio = RadioSet([{'label': _('Full'), 'value': 'full'},
  2908. {'label': _('Exterior'), 'value': 'ext'},
  2909. {'label': _('Interior'), 'value': 'int'}])
  2910. grid0.addWidget(self.iso_type_label, 7, 0,)
  2911. grid0.addWidget(self.iso_type_radio, 7, 1, 1, 2)
  2912. separator_line = QtWidgets.QFrame()
  2913. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  2914. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  2915. grid0.addWidget(separator_line, 8, 0, 1, 2)
  2916. # Buffering Type
  2917. buffering_label = QtWidgets.QLabel('%s:' % _('Buffering'))
  2918. buffering_label.setToolTip(
  2919. _("Buffering type:\n"
  2920. "- None --> best performance, fast file loading but no so good display\n"
  2921. "- Full --> slow file loading but good visuals. This is the default.\n"
  2922. "<<WARNING>>: Don't change this unless you know what you are doing !!!")
  2923. )
  2924. self.buffering_radio = RadioSet([{'label': _('None'), 'value': 'no'},
  2925. {'label': _('Full'), 'value': 'full'}])
  2926. grid0.addWidget(buffering_label, 9, 0)
  2927. grid0.addWidget(self.buffering_radio, 9, 1)
  2928. # Simplification
  2929. self.simplify_cb = FCCheckBox(label=_('Simplify'))
  2930. self.simplify_cb.setToolTip(
  2931. _("When checked all the Gerber polygons will be\n"
  2932. "loaded with simplification having a set tolerance.\n"
  2933. "<<WARNING>>: Don't change this unless you know what you are doing !!!")
  2934. )
  2935. grid0.addWidget(self.simplify_cb, 10, 0, 1, 2)
  2936. # Simplification tolerance
  2937. self.simplification_tol_label = QtWidgets.QLabel(_('Tolerance'))
  2938. self.simplification_tol_label.setToolTip(_("Tolerance for polygon simplification."))
  2939. self.simplification_tol_spinner = FCDoubleSpinner()
  2940. self.simplification_tol_spinner.set_precision(self.decimals + 1)
  2941. self.simplification_tol_spinner.setWrapping(True)
  2942. self.simplification_tol_spinner.setRange(0.00000, 0.01000)
  2943. self.simplification_tol_spinner.setSingleStep(0.0001)
  2944. grid0.addWidget(self.simplification_tol_label, 11, 0)
  2945. grid0.addWidget(self.simplification_tol_spinner, 11, 1)
  2946. self.ois_simplif = OptionalInputSection(
  2947. self.simplify_cb,
  2948. [
  2949. self.simplification_tol_label, self.simplification_tol_spinner
  2950. ],
  2951. logic=True)
  2952. self.layout.addStretch()
  2953. class GerberExpPrefGroupUI(OptionsGroupUI):
  2954. def __init__(self, decimals=4, parent=None):
  2955. super(GerberExpPrefGroupUI, self).__init__(self)
  2956. self.setTitle(str(_("Gerber Export")))
  2957. self.decimals = decimals
  2958. # Plot options
  2959. self.export_options_label = QtWidgets.QLabel("<b>%s:</b>" % _("Export Options"))
  2960. self.export_options_label.setToolTip(
  2961. _("The parameters set here are used in the file exported\n"
  2962. "when using the File -> Export -> Export Gerber menu entry.")
  2963. )
  2964. self.layout.addWidget(self.export_options_label)
  2965. form = QtWidgets.QFormLayout()
  2966. self.layout.addLayout(form)
  2967. # Gerber Units
  2968. self.gerber_units_label = QtWidgets.QLabel('%s:' % _('Units'))
  2969. self.gerber_units_label.setToolTip(
  2970. _("The units used in the Gerber file.")
  2971. )
  2972. self.gerber_units_radio = RadioSet([{'label': _('INCH'), 'value': 'IN'},
  2973. {'label': _('MM'), 'value': 'MM'}])
  2974. self.gerber_units_radio.setToolTip(
  2975. _("The units used in the Gerber file.")
  2976. )
  2977. form.addRow(self.gerber_units_label, self.gerber_units_radio)
  2978. # Gerber format
  2979. self.digits_label = QtWidgets.QLabel("%s:" % _("Int/Decimals"))
  2980. self.digits_label.setToolTip(
  2981. _("The number of digits in the whole part of the number\n"
  2982. "and in the fractional part of the number.")
  2983. )
  2984. hlay1 = QtWidgets.QHBoxLayout()
  2985. self.format_whole_entry = FCSpinner()
  2986. self.format_whole_entry.set_range(0, 9)
  2987. self.format_whole_entry.set_step(1)
  2988. self.format_whole_entry.setWrapping(True)
  2989. self.format_whole_entry.setMinimumWidth(30)
  2990. self.format_whole_entry.setToolTip(
  2991. _("This numbers signify the number of digits in\n"
  2992. "the whole part of Gerber coordinates.")
  2993. )
  2994. hlay1.addWidget(self.format_whole_entry, QtCore.Qt.AlignLeft)
  2995. gerber_separator_label = QtWidgets.QLabel(':')
  2996. gerber_separator_label.setFixedWidth(5)
  2997. hlay1.addWidget(gerber_separator_label, QtCore.Qt.AlignLeft)
  2998. self.format_dec_entry = FCSpinner()
  2999. self.format_dec_entry.set_range(0, 9)
  3000. self.format_dec_entry.set_step(1)
  3001. self.format_dec_entry.setWrapping(True)
  3002. self.format_dec_entry.setMinimumWidth(30)
  3003. self.format_dec_entry.setToolTip(
  3004. _("This numbers signify the number of digits in\n"
  3005. "the decimal part of Gerber coordinates.")
  3006. )
  3007. hlay1.addWidget(self.format_dec_entry, QtCore.Qt.AlignLeft)
  3008. hlay1.addStretch()
  3009. form.addRow(self.digits_label, hlay1)
  3010. # Gerber Zeros
  3011. self.zeros_label = QtWidgets.QLabel('%s:' % _('Zeros'))
  3012. self.zeros_label.setAlignment(QtCore.Qt.AlignLeft)
  3013. self.zeros_label.setToolTip(
  3014. _("This sets the type of Gerber zeros.\n"
  3015. "If LZ then Leading Zeros are removed and\n"
  3016. "Trailing Zeros are kept.\n"
  3017. "If TZ is checked then Trailing Zeros are removed\n"
  3018. "and Leading Zeros are kept.")
  3019. )
  3020. self.zeros_radio = RadioSet([{'label': _('LZ'), 'value': 'L'},
  3021. {'label': _('TZ'), 'value': 'T'}])
  3022. self.zeros_radio.setToolTip(
  3023. _("This sets the type of Gerber zeros.\n"
  3024. "If LZ then Leading Zeros are removed and\n"
  3025. "Trailing Zeros are kept.\n"
  3026. "If TZ is checked then Trailing Zeros are removed\n"
  3027. "and Leading Zeros are kept.")
  3028. )
  3029. form.addRow(self.zeros_label, self.zeros_radio)
  3030. self.layout.addStretch()
  3031. class GerberEditorPrefGroupUI(OptionsGroupUI):
  3032. def __init__(self, decimals=4, parent=None):
  3033. # OptionsGroupUI.__init__(self, "Gerber Adv. Options Preferences", parent=parent)
  3034. super(GerberEditorPrefGroupUI, self).__init__(self)
  3035. self.setTitle(str(_("Gerber Editor")))
  3036. self.decimals = decimals
  3037. # Advanced Gerber Parameters
  3038. self.param_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  3039. self.param_label.setToolTip(
  3040. _("A list of Gerber Editor parameters.")
  3041. )
  3042. self.layout.addWidget(self.param_label)
  3043. grid0 = QtWidgets.QGridLayout()
  3044. self.layout.addLayout(grid0)
  3045. # Selection Limit
  3046. self.sel_limit_label = QtWidgets.QLabel('%s:' % _("Selection limit"))
  3047. self.sel_limit_label.setToolTip(
  3048. _("Set the number of selected Gerber geometry\n"
  3049. "items above which the utility geometry\n"
  3050. "becomes just a selection rectangle.\n"
  3051. "Increases the performance when moving a\n"
  3052. "large number of geometric elements.")
  3053. )
  3054. self.sel_limit_entry = FCSpinner()
  3055. self.sel_limit_entry.set_range(0, 9999)
  3056. grid0.addWidget(self.sel_limit_label, 0, 0)
  3057. grid0.addWidget(self.sel_limit_entry, 0, 1)
  3058. # New aperture code
  3059. self.addcode_entry_lbl = QtWidgets.QLabel('%s:' % _('New Aperture code'))
  3060. self.addcode_entry_lbl.setToolTip(
  3061. _("Code for the new aperture")
  3062. )
  3063. self.addcode_entry = FCSpinner()
  3064. self.addcode_entry.set_range(10, 99)
  3065. self.addcode_entry.setWrapping(True)
  3066. grid0.addWidget(self.addcode_entry_lbl, 1, 0)
  3067. grid0.addWidget(self.addcode_entry, 1, 1)
  3068. # New aperture size
  3069. self.addsize_entry_lbl = QtWidgets.QLabel('%s:' % _('New Aperture size'))
  3070. self.addsize_entry_lbl.setToolTip(
  3071. _("Size for the new aperture")
  3072. )
  3073. self.addsize_entry = FCDoubleSpinner()
  3074. self.addsize_entry.set_range(0, 100)
  3075. self.addsize_entry.set_precision(self.decimals)
  3076. grid0.addWidget(self.addsize_entry_lbl, 2, 0)
  3077. grid0.addWidget(self.addsize_entry, 2, 1)
  3078. # New aperture type
  3079. self.addtype_combo_lbl = QtWidgets.QLabel('%s:' % _('New Aperture type'))
  3080. self.addtype_combo_lbl.setToolTip(
  3081. _("Type for the new aperture.\n"
  3082. "Can be 'C', 'R' or 'O'.")
  3083. )
  3084. self.addtype_combo = FCComboBox()
  3085. self.addtype_combo.addItems(['C', 'R', 'O'])
  3086. grid0.addWidget(self.addtype_combo_lbl, 3, 0)
  3087. grid0.addWidget(self.addtype_combo, 3, 1)
  3088. # Number of pads in a pad array
  3089. self.grb_array_size_label = QtWidgets.QLabel('%s:' % _('Nr of pads'))
  3090. self.grb_array_size_label.setToolTip(
  3091. _("Specify how many pads to be in the array.")
  3092. )
  3093. self.grb_array_size_entry = FCSpinner()
  3094. self.grb_array_size_entry.set_range(0, 9999)
  3095. grid0.addWidget(self.grb_array_size_label, 4, 0)
  3096. grid0.addWidget(self.grb_array_size_entry, 4, 1)
  3097. self.adddim_label = QtWidgets.QLabel('%s:' % _('Aperture Dimensions'))
  3098. self.adddim_label.setToolTip(
  3099. _("Diameters of the tools, separated by comma.\n"
  3100. "The value of the diameter has to use the dot decimals separator.\n"
  3101. "Valid values: 0.3, 1.0")
  3102. )
  3103. grid0.addWidget(self.adddim_label, 5, 0)
  3104. self.adddim_entry = FCEntry()
  3105. grid0.addWidget(self.adddim_entry, 5, 1)
  3106. self.grb_array_linear_label = QtWidgets.QLabel('<b>%s:</b>' % _('Linear Pad Array'))
  3107. grid0.addWidget(self.grb_array_linear_label, 6, 0, 1, 2)
  3108. # Linear Pad Array direction
  3109. self.grb_axis_label = QtWidgets.QLabel('%s:' % _('Linear Direction'))
  3110. self.grb_axis_label.setToolTip(
  3111. _("Direction on which the linear array is oriented:\n"
  3112. "- 'X' - horizontal axis \n"
  3113. "- 'Y' - vertical axis or \n"
  3114. "- 'Angle' - a custom angle for the array inclination")
  3115. )
  3116. self.grb_axis_radio = RadioSet([{'label': _('X'), 'value': 'X'},
  3117. {'label': _('Y'), 'value': 'Y'},
  3118. {'label': _('Angle'), 'value': 'A'}])
  3119. grid0.addWidget(self.grb_axis_label, 7, 0)
  3120. grid0.addWidget(self.grb_axis_radio, 7, 1)
  3121. # Linear Pad Array pitch distance
  3122. self.grb_pitch_label = QtWidgets.QLabel('%s:' % _('Pitch'))
  3123. self.grb_pitch_label.setToolTip(
  3124. _("Pitch = Distance between elements of the array.")
  3125. )
  3126. # self.drill_pitch_label.setMinimumWidth(100)
  3127. self.grb_pitch_entry = FCDoubleSpinner()
  3128. self.grb_pitch_entry.set_precision(self.decimals)
  3129. grid0.addWidget(self.grb_pitch_label, 8, 0)
  3130. grid0.addWidget(self.grb_pitch_entry, 8, 1)
  3131. # Linear Pad Array custom angle
  3132. self.grb_angle_label = QtWidgets.QLabel('%s:' % _('Angle'))
  3133. self.grb_angle_label.setToolTip(
  3134. _("Angle at which each element in circular array is placed.")
  3135. )
  3136. self.grb_angle_entry = FCDoubleSpinner()
  3137. self.grb_angle_entry.set_precision(self.decimals)
  3138. self.grb_angle_entry.set_range(-360, 360)
  3139. self.grb_angle_entry.setSingleStep(5)
  3140. grid0.addWidget(self.grb_angle_label, 9, 0)
  3141. grid0.addWidget(self.grb_angle_entry, 9, 1)
  3142. self.grb_array_circ_label = QtWidgets.QLabel('<b>%s:</b>' % _('Circular Pad Array'))
  3143. grid0.addWidget(self.grb_array_circ_label, 10, 0, 1, 2)
  3144. # Circular Pad Array direction
  3145. self.grb_circular_direction_label = QtWidgets.QLabel('%s:' % _('Circular Direction'))
  3146. self.grb_circular_direction_label.setToolTip(
  3147. _("Direction for circular array.\n"
  3148. "Can be CW = clockwise or CCW = counter clockwise.")
  3149. )
  3150. self.grb_circular_dir_radio = RadioSet([{'label': _('CW'), 'value': 'CW'},
  3151. {'label': _('CCW'), 'value': 'CCW'}])
  3152. grid0.addWidget(self.grb_circular_direction_label, 11, 0)
  3153. grid0.addWidget(self.grb_circular_dir_radio, 11, 1)
  3154. # Circular Pad Array Angle
  3155. self.grb_circular_angle_label = QtWidgets.QLabel('%s:' % _('Circular Angle'))
  3156. self.grb_circular_angle_label.setToolTip(
  3157. _("Angle at which each element in circular array is placed.")
  3158. )
  3159. self.grb_circular_angle_entry = FCDoubleSpinner()
  3160. self.grb_circular_angle_entry.set_precision(self.decimals)
  3161. self.grb_circular_angle_entry.set_range(-360, 360)
  3162. self.grb_circular_angle_entry.setSingleStep(5)
  3163. grid0.addWidget(self.grb_circular_angle_label, 12, 0)
  3164. grid0.addWidget(self.grb_circular_angle_entry, 12, 1)
  3165. self.grb_array_tools_b_label = QtWidgets.QLabel('<b>%s:</b>' % _('Buffer Tool'))
  3166. grid0.addWidget(self.grb_array_tools_b_label, 13, 0, 1, 2)
  3167. # Buffer Distance
  3168. self.grb_buff_label = QtWidgets.QLabel('%s:' % _('Buffer distance'))
  3169. self.grb_buff_label.setToolTip(
  3170. _("Distance at which to buffer the Gerber element.")
  3171. )
  3172. self.grb_buff_entry = FCDoubleSpinner()
  3173. self.grb_buff_entry.set_precision(self.decimals)
  3174. self.grb_buff_entry.set_range(-9999, 9999)
  3175. grid0.addWidget(self.grb_buff_label, 14, 0)
  3176. grid0.addWidget(self.grb_buff_entry, 14, 1)
  3177. self.grb_array_tools_s_label = QtWidgets.QLabel('<b>%s:</b>' % _('Scale Tool'))
  3178. grid0.addWidget(self.grb_array_tools_s_label, 15, 0, 1, 2)
  3179. # Scale Factor
  3180. self.grb_scale_label = QtWidgets.QLabel('%s:' % _('Scale factor'))
  3181. self.grb_scale_label.setToolTip(
  3182. _("Factor to scale the Gerber element.")
  3183. )
  3184. self.grb_scale_entry = FCDoubleSpinner()
  3185. self.grb_scale_entry.set_precision(self.decimals)
  3186. self.grb_scale_entry.set_range(0, 9999)
  3187. grid0.addWidget(self.grb_scale_label, 16, 0)
  3188. grid0.addWidget(self.grb_scale_entry, 16, 1)
  3189. self.grb_array_tools_ma_label = QtWidgets.QLabel('<b>%s:</b>' % _('Mark Area Tool'))
  3190. grid0.addWidget(self.grb_array_tools_ma_label, 17, 0, 1, 2)
  3191. # Mark area Tool low threshold
  3192. self.grb_ma_low_label = QtWidgets.QLabel('%s:' % _('Threshold low'))
  3193. self.grb_ma_low_label.setToolTip(
  3194. _("Threshold value under which the apertures are not marked.")
  3195. )
  3196. self.grb_ma_low_entry = FCDoubleSpinner()
  3197. self.grb_ma_low_entry.set_precision(self.decimals)
  3198. self.grb_ma_low_entry.set_range(0, 9999)
  3199. grid0.addWidget(self.grb_ma_low_label, 18, 0)
  3200. grid0.addWidget(self.grb_ma_low_entry, 18, 1)
  3201. # Mark area Tool high threshold
  3202. self.grb_ma_high_label = QtWidgets.QLabel('%s:' % _('Threshold high'))
  3203. self.grb_ma_high_label.setToolTip(
  3204. _("Threshold value over which the apertures are not marked.")
  3205. )
  3206. self.grb_ma_high_entry = FCDoubleSpinner()
  3207. self.grb_ma_high_entry.set_precision(self.decimals)
  3208. self.grb_ma_high_entry.set_range(0, 9999)
  3209. grid0.addWidget(self.grb_ma_high_label, 19, 0)
  3210. grid0.addWidget(self.grb_ma_high_entry, 19, 1)
  3211. self.layout.addStretch()
  3212. class ExcellonGenPrefGroupUI(OptionsGroupUI):
  3213. def __init__(self, decimals=4, parent=None):
  3214. # OptionsGroupUI.__init__(self, "Excellon Options", parent=parent)
  3215. super(ExcellonGenPrefGroupUI, self).__init__(self)
  3216. self.setTitle(str(_("Excellon General")))
  3217. self.decimals = decimals
  3218. # Plot options
  3219. self.plot_options_label = QtWidgets.QLabel("<b>%s:</b>" % _("Plot Options"))
  3220. self.layout.addWidget(self.plot_options_label)
  3221. grid1 = QtWidgets.QGridLayout()
  3222. self.layout.addLayout(grid1)
  3223. self.plot_cb = FCCheckBox(label=_('Plot'))
  3224. self.plot_cb.setToolTip(
  3225. "Plot (show) this object."
  3226. )
  3227. grid1.addWidget(self.plot_cb, 0, 0)
  3228. self.solid_cb = FCCheckBox(label=_('Solid'))
  3229. self.solid_cb.setToolTip(
  3230. "Plot as solid circles."
  3231. )
  3232. grid1.addWidget(self.solid_cb, 0, 1)
  3233. separator_line = QtWidgets.QFrame()
  3234. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  3235. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  3236. grid1.addWidget(separator_line, 1, 0, 1, 2)
  3237. grid2 = QtWidgets.QGridLayout()
  3238. self.layout.addLayout(grid2)
  3239. grid2.setColumnStretch(0, 0)
  3240. grid2.setColumnStretch(1, 1)
  3241. # Excellon format
  3242. self.excellon_format_label = QtWidgets.QLabel("<b>%s:</b>" % _("Excellon Format"))
  3243. self.excellon_format_label.setToolTip(
  3244. _("The NC drill files, usually named Excellon files\n"
  3245. "are files that can be found in different formats.\n"
  3246. "Here we set the format used when the provided\n"
  3247. "coordinates are not using period.\n"
  3248. "\n"
  3249. "Possible presets:\n"
  3250. "\n"
  3251. "PROTEUS 3:3 MM LZ\n"
  3252. "DipTrace 5:2 MM TZ\n"
  3253. "DipTrace 4:3 MM LZ\n"
  3254. "\n"
  3255. "EAGLE 3:3 MM TZ\n"
  3256. "EAGLE 4:3 MM TZ\n"
  3257. "EAGLE 2:5 INCH TZ\n"
  3258. "EAGLE 3:5 INCH TZ\n"
  3259. "\n"
  3260. "ALTIUM 2:4 INCH LZ\n"
  3261. "Sprint Layout 2:4 INCH LZ"
  3262. "\n"
  3263. "KiCAD 3:5 INCH TZ")
  3264. )
  3265. grid2.addWidget(self.excellon_format_label, 0, 0, 1, 2)
  3266. self.excellon_format_in_label = QtWidgets.QLabel('%s:' % _("INCH"))
  3267. self.excellon_format_in_label.setToolTip(_("Default values for INCH are 2:4"))
  3268. hlay1 = QtWidgets.QHBoxLayout()
  3269. self.excellon_format_upper_in_entry = FCSpinner()
  3270. self.excellon_format_upper_in_entry.set_range(0, 9)
  3271. self.excellon_format_upper_in_entry.setMinimumWidth(30)
  3272. self.excellon_format_upper_in_entry.setToolTip(
  3273. _("This numbers signify the number of digits in\n"
  3274. "the whole part of Excellon coordinates.")
  3275. )
  3276. hlay1.addWidget(self.excellon_format_upper_in_entry)
  3277. excellon_separator_in_label = QtWidgets.QLabel(':')
  3278. excellon_separator_in_label.setFixedWidth(5)
  3279. hlay1.addWidget(excellon_separator_in_label)
  3280. self.excellon_format_lower_in_entry = FCSpinner()
  3281. self.excellon_format_lower_in_entry.set_range(0, 9)
  3282. self.excellon_format_lower_in_entry.setMinimumWidth(30)
  3283. self.excellon_format_lower_in_entry.setToolTip(
  3284. _("This numbers signify the number of digits in\n"
  3285. "the decimal part of Excellon coordinates.")
  3286. )
  3287. hlay1.addWidget(self.excellon_format_lower_in_entry)
  3288. grid2.addWidget(self.excellon_format_in_label, 1, 0)
  3289. grid2.addLayout(hlay1, 1, 1)
  3290. self.excellon_format_mm_label = QtWidgets.QLabel('%s:' % _("METRIC"))
  3291. self.excellon_format_mm_label.setToolTip(_("Default values for METRIC are 3:3"))
  3292. hlay2 = QtWidgets.QHBoxLayout()
  3293. self.excellon_format_upper_mm_entry = FCSpinner()
  3294. self.excellon_format_upper_mm_entry.set_range(0, 9)
  3295. self.excellon_format_upper_mm_entry.setMinimumWidth(30)
  3296. self.excellon_format_upper_mm_entry.setToolTip(
  3297. _("This numbers signify the number of digits in\n"
  3298. "the whole part of Excellon coordinates.")
  3299. )
  3300. hlay2.addWidget(self.excellon_format_upper_mm_entry)
  3301. excellon_separator_mm_label = QtWidgets.QLabel(':')
  3302. excellon_separator_mm_label.setFixedWidth(5)
  3303. hlay2.addWidget(excellon_separator_mm_label, QtCore.Qt.AlignLeft)
  3304. self.excellon_format_lower_mm_entry = FCSpinner()
  3305. self.excellon_format_lower_mm_entry.set_range(0, 9)
  3306. self.excellon_format_lower_mm_entry.setMinimumWidth(30)
  3307. self.excellon_format_lower_mm_entry.setToolTip(
  3308. _("This numbers signify the number of digits in\n"
  3309. "the decimal part of Excellon coordinates.")
  3310. )
  3311. hlay2.addWidget(self.excellon_format_lower_mm_entry)
  3312. grid2.addWidget(self.excellon_format_mm_label, 2, 0)
  3313. grid2.addLayout(hlay2, 2, 1)
  3314. self.excellon_zeros_label = QtWidgets.QLabel('%s:' % _('Zeros'))
  3315. self.excellon_zeros_label.setAlignment(QtCore.Qt.AlignLeft)
  3316. self.excellon_zeros_label.setToolTip(
  3317. _("This sets the type of Excellon zeros.\n"
  3318. "If LZ then Leading Zeros are kept and\n"
  3319. "Trailing Zeros are removed.\n"
  3320. "If TZ is checked then Trailing Zeros are kept\n"
  3321. "and Leading Zeros are removed.\n\n"
  3322. "This is used when there is no information\n"
  3323. "stored in the Excellon file.")
  3324. )
  3325. grid2.addWidget(self.excellon_zeros_label, 3, 0)
  3326. self.excellon_zeros_radio = RadioSet([{'label': _('LZ'), 'value': 'L'},
  3327. {'label': _('TZ'), 'value': 'T'}])
  3328. grid2.addWidget(self.excellon_zeros_radio, 3, 1)
  3329. self.excellon_units_label = QtWidgets.QLabel('%s:' % _('Units'))
  3330. self.excellon_units_label.setAlignment(QtCore.Qt.AlignLeft)
  3331. self.excellon_units_label.setToolTip(
  3332. _("This sets the default units of Excellon files.\n"
  3333. "If it is not detected in the parsed file the value here\n"
  3334. "will be used."
  3335. "Some Excellon files don't have an header\n"
  3336. "therefore this parameter will be used.")
  3337. )
  3338. self.excellon_units_radio = RadioSet([{'label': _('INCH'), 'value': 'INCH'},
  3339. {'label': _('MM'), 'value': 'METRIC'}])
  3340. self.excellon_units_radio.setToolTip(
  3341. _("This sets the units of Excellon files.\n"
  3342. "Some Excellon files don't have an header\n"
  3343. "therefore this parameter will be used.")
  3344. )
  3345. grid2.addWidget(self.excellon_units_label, 4, 0)
  3346. grid2.addWidget(self.excellon_units_radio, 4, 1)
  3347. self.update_excellon_cb = FCCheckBox(label=_('Update Export settings'))
  3348. self.update_excellon_cb.setToolTip(
  3349. "If checked, the Excellon Export settings will be updated with the ones above."
  3350. )
  3351. grid2.addWidget(self.update_excellon_cb, 5, 0, 1, 2)
  3352. # Adding the Excellon Format Defaults Button
  3353. self.excellon_defaults_button = QtWidgets.QPushButton()
  3354. self.excellon_defaults_button.setText(str(_("Restore Defaults")))
  3355. self.excellon_defaults_button.setMinimumWidth(80)
  3356. grid2.addWidget(self.excellon_defaults_button, 6, 0, 1, 2)
  3357. separator_line = QtWidgets.QFrame()
  3358. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  3359. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  3360. grid2.addWidget(separator_line, 7, 0, 1, 2)
  3361. self.excellon_general_label = QtWidgets.QLabel("<b>%s:</b>" % _("Excellon Optimization"))
  3362. grid2.addWidget(self.excellon_general_label, 8, 0, 1, 2)
  3363. self.excellon_optimization_label = QtWidgets.QLabel(_('Algorithm:'))
  3364. self.excellon_optimization_label.setToolTip(
  3365. _("This sets the optimization type for the Excellon drill path.\n"
  3366. "If <<MetaHeuristic>> is checked then Google OR-Tools algorithm with\n"
  3367. "MetaHeuristic Guided Local Path is used. Default search time is 3sec.\n"
  3368. "If <<Basic>> is checked then Google OR-Tools Basic algorithm is used.\n"
  3369. "If <<TSA>> is checked then Travelling Salesman algorithm is used for\n"
  3370. "drill path optimization.\n"
  3371. "\n"
  3372. "If this control is disabled, then FlatCAM works in 32bit mode and it uses\n"
  3373. "Travelling Salesman algorithm for path optimization.")
  3374. )
  3375. self.excellon_optimization_radio = RadioSet([{'label': _('MetaHeuristic'), 'value': 'M'},
  3376. {'label': _('Basic'), 'value': 'B'},
  3377. {'label': _('TSA'), 'value': 'T'}],
  3378. orientation='vertical', stretch=False)
  3379. self.excellon_optimization_radio.setToolTip(
  3380. _("This sets the optimization type for the Excellon drill path.\n"
  3381. "If <<MetaHeuristic>> is checked then Google OR-Tools algorithm with\n"
  3382. "MetaHeuristic Guided Local Path is used. Default search time is 3sec.\n"
  3383. "If <<Basic>> is checked then Google OR-Tools Basic algorithm is used.\n"
  3384. "If <<TSA>> is checked then Travelling Salesman algorithm is used for\n"
  3385. "drill path optimization.\n"
  3386. "\n"
  3387. "If this control is disabled, then FlatCAM works in 32bit mode and it uses\n"
  3388. "Travelling Salesman algorithm for path optimization.")
  3389. )
  3390. grid2.addWidget(self.excellon_optimization_label, 9, 0)
  3391. grid2.addWidget(self.excellon_optimization_radio, 9, 1)
  3392. self.optimization_time_label = QtWidgets.QLabel('%s:' % _('Duration'))
  3393. self.optimization_time_label.setAlignment(QtCore.Qt.AlignLeft)
  3394. self.optimization_time_label.setToolTip(
  3395. _("When OR-Tools Metaheuristic (MH) is enabled there is a\n"
  3396. "maximum threshold for how much time is spent doing the\n"
  3397. "path optimization. This max duration is set here.\n"
  3398. "In seconds.")
  3399. )
  3400. self.optimization_time_entry = FCSpinner()
  3401. self.optimization_time_entry.set_range(0, 999)
  3402. grid2.addWidget(self.optimization_time_label, 10, 0)
  3403. grid2.addWidget(self.optimization_time_entry, 10, 1)
  3404. separator_line = QtWidgets.QFrame()
  3405. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  3406. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  3407. grid2.addWidget(separator_line, 11, 0, 1, 2)
  3408. # Excellon Object Color
  3409. self.gerber_color_label = QtWidgets.QLabel('<b>%s</b>' % _('Excellon Object Color'))
  3410. grid2.addWidget(self.gerber_color_label, 12, 0, 1, 2)
  3411. # Plot Line Color
  3412. self.line_color_label = QtWidgets.QLabel('%s:' % _('Outline'))
  3413. self.line_color_label.setToolTip(
  3414. _("Set the line color for plotted objects.")
  3415. )
  3416. self.line_color_entry = FCEntry()
  3417. self.line_color_button = QtWidgets.QPushButton()
  3418. self.line_color_button.setFixedSize(15, 15)
  3419. self.form_box_child_2 = QtWidgets.QHBoxLayout()
  3420. self.form_box_child_2.addWidget(self.line_color_entry)
  3421. self.form_box_child_2.addWidget(self.line_color_button)
  3422. self.form_box_child_2.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  3423. grid2.addWidget(self.line_color_label, 13, 0)
  3424. grid2.addLayout(self.form_box_child_2, 13, 1)
  3425. # Plot Fill Color
  3426. self.fill_color_label = QtWidgets.QLabel('%s:' % _('Fill'))
  3427. self.fill_color_label.setToolTip(
  3428. _("Set the fill color for plotted objects.\n"
  3429. "First 6 digits are the color and the last 2\n"
  3430. "digits are for alpha (transparency) level.")
  3431. )
  3432. self.fill_color_entry = FCEntry()
  3433. self.fill_color_button = QtWidgets.QPushButton()
  3434. self.fill_color_button.setFixedSize(15, 15)
  3435. self.form_box_child_1 = QtWidgets.QHBoxLayout()
  3436. self.form_box_child_1.addWidget(self.fill_color_entry)
  3437. self.form_box_child_1.addWidget(self.fill_color_button)
  3438. self.form_box_child_1.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  3439. grid2.addWidget(self.fill_color_label, 14, 0)
  3440. grid2.addLayout(self.form_box_child_1, 14, 1)
  3441. # Plot Fill Transparency Level
  3442. self.alpha_label = QtWidgets.QLabel('%s:' % _('Alpha'))
  3443. self.alpha_label.setToolTip(
  3444. _("Set the fill transparency for plotted objects.")
  3445. )
  3446. self.color_alpha_slider = QtWidgets.QSlider(QtCore.Qt.Horizontal)
  3447. self.color_alpha_slider.setMinimum(0)
  3448. self.color_alpha_slider.setMaximum(255)
  3449. self.color_alpha_slider.setSingleStep(1)
  3450. self.color_alpha_spinner = FCSpinner()
  3451. self.color_alpha_spinner.setMinimumWidth(70)
  3452. self.color_alpha_spinner.set_range(0, 255)
  3453. self.form_box_child_3 = QtWidgets.QHBoxLayout()
  3454. self.form_box_child_3.addWidget(self.color_alpha_slider)
  3455. self.form_box_child_3.addWidget(self.color_alpha_spinner)
  3456. grid2.addWidget(self.alpha_label, 15, 0)
  3457. grid2.addLayout(self.form_box_child_3, 15, 1)
  3458. self.layout.addStretch()
  3459. current_platform = platform.architecture()[0]
  3460. if current_platform == '64bit':
  3461. self.excellon_optimization_label.setDisabled(False)
  3462. self.excellon_optimization_radio.setDisabled(False)
  3463. self.optimization_time_label.setDisabled(False)
  3464. self.optimization_time_entry.setDisabled(False)
  3465. self.excellon_optimization_radio.activated_custom.connect(self.optimization_selection)
  3466. else:
  3467. self.excellon_optimization_label.setDisabled(True)
  3468. self.excellon_optimization_radio.setDisabled(True)
  3469. self.optimization_time_label.setDisabled(True)
  3470. self.optimization_time_entry.setDisabled(True)
  3471. # Setting plot colors signals
  3472. self.line_color_entry.editingFinished.connect(self.on_line_color_entry)
  3473. self.line_color_button.clicked.connect(self.on_line_color_button)
  3474. self.fill_color_entry.editingFinished.connect(self.on_fill_color_entry)
  3475. self.fill_color_button.clicked.connect(self.on_fill_color_button)
  3476. self.color_alpha_spinner.valueChanged.connect(self.on_color_spinner)
  3477. self.color_alpha_slider.valueChanged.connect(self.on_color_slider)
  3478. # Load the defaults values into the Excellon Format and Excellon Zeros fields
  3479. self.excellon_defaults_button.clicked.connect(self.on_excellon_defaults_button)
  3480. def optimization_selection(self):
  3481. if self.excellon_optimization_radio.get_value() == 'M':
  3482. self.optimization_time_label.setDisabled(False)
  3483. self.optimization_time_entry.setDisabled(False)
  3484. else:
  3485. self.optimization_time_label.setDisabled(True)
  3486. self.optimization_time_entry.setDisabled(True)
  3487. # Setting plot colors handlers
  3488. def on_fill_color_entry(self):
  3489. self.app.defaults['excellon_plot_fill'] = self.fill_color_entry.get_value()[:7] + \
  3490. self.app.defaults['excellon_plot_fill'][7:9]
  3491. self.fill_color_button.setStyleSheet("background-color:%s" % str(self.app.defaults['excellon_plot_fill'])[:7])
  3492. def on_fill_color_button(self):
  3493. current_color = QtGui.QColor(self.app.defaults['excellon_plot_fill'][:7])
  3494. c_dialog = QtWidgets.QColorDialog()
  3495. plot_fill_color = c_dialog.getColor(initial=current_color)
  3496. if plot_fill_color.isValid() is False:
  3497. return
  3498. self.fill_color_button.setStyleSheet("background-color:%s" % str(plot_fill_color.name()))
  3499. new_val = str(plot_fill_color.name()) + str(self.app.defaults['excellon_plot_fill'][7:9])
  3500. self.fill_color_entry.set_value(new_val)
  3501. self.app.defaults['excellon_plot_fill'] = new_val
  3502. def on_color_spinner(self):
  3503. spinner_value = self.color_alpha_spinner.value()
  3504. self.color_alpha_slider.setValue(spinner_value)
  3505. self.app.defaults['excellon_plot_fill'] = \
  3506. self.app.defaults['excellon_plot_fill'][:7] + \
  3507. (hex(spinner_value)[2:] if int(hex(spinner_value)[2:], 16) > 0 else '00')
  3508. self.app.defaults['excellon_plot_line'] = \
  3509. self.app.defaults['excellon_plot_line'][:7] + \
  3510. (hex(spinner_value)[2:] if int(hex(spinner_value)[2:], 16) > 0 else '00')
  3511. def on_color_slider(self):
  3512. slider_value = self.color_alpha_slider.value()
  3513. self.color_alpha_spinner.setValue(slider_value)
  3514. def on_line_color_entry(self):
  3515. self.app.defaults['excellon_plot_line'] = self.line_color_entry.get_value()[:7] + \
  3516. self.app.defaults['excellon_plot_line'][7:9]
  3517. self.line_color_button.setStyleSheet("background-color:%s" % str(self.app.defaults['excellon_plot_line'])[:7])
  3518. def on_line_color_button(self):
  3519. current_color = QtGui.QColor(self.app.defaults['excellon_plot_line'][:7])
  3520. # print(current_color)
  3521. c_dialog = QtWidgets.QColorDialog()
  3522. plot_line_color = c_dialog.getColor(initial=current_color)
  3523. if plot_line_color.isValid() is False:
  3524. return
  3525. self.line_color_button.setStyleSheet("background-color:%s" % str(plot_line_color.name()))
  3526. new_val_line = str(plot_line_color.name()) + str(self.app.defaults['excellon_plot_line'][7:9])
  3527. self.line_color_entry.set_value(new_val_line)
  3528. self.app.defaults['excellon_plot_line'] = new_val_line
  3529. def on_excellon_defaults_button(self):
  3530. self.app.preferencesUiManager.defaults_form_fields["excellon_format_lower_in"].set_value('4')
  3531. self.app.preferencesUiManager.defaults_form_fields["excellon_format_upper_in"].set_value('2')
  3532. self.app.preferencesUiManager.defaults_form_fields["excellon_format_lower_mm"].set_value('3')
  3533. self.app.preferencesUiManager.defaults_form_fields["excellon_format_upper_mm"].set_value('3')
  3534. self.app.preferencesUiManager.defaults_form_fields["excellon_zeros"].set_value('L')
  3535. self.app.preferencesUiManager.defaults_form_fields["excellon_units"].set_value('INCH')
  3536. class ExcellonOptPrefGroupUI(OptionsGroupUI):
  3537. def __init__(self, decimals=4, parent=None):
  3538. # OptionsGroupUI.__init__(self, "Excellon Options", parent=parent)
  3539. super(ExcellonOptPrefGroupUI, self).__init__(self)
  3540. self.setTitle(str(_("Excellon Options")))
  3541. self.decimals = decimals
  3542. # ## Create CNC Job
  3543. self.cncjob_label = QtWidgets.QLabel('<b>%s</b>' % _('Create CNC Job'))
  3544. self.cncjob_label.setToolTip(
  3545. _("Parameters used to create a CNC Job object\n"
  3546. "for this drill object.")
  3547. )
  3548. self.layout.addWidget(self.cncjob_label)
  3549. grid2 = QtWidgets.QGridLayout()
  3550. self.layout.addLayout(grid2)
  3551. grid2.setColumnStretch(0, 0)
  3552. grid2.setColumnStretch(1, 1)
  3553. # Operation Type
  3554. self.operation_label = QtWidgets.QLabel('<b>%s:</b>' % _('Operation'))
  3555. self.operation_label.setToolTip(
  3556. _("Operation type:\n"
  3557. "- Drilling -> will drill the drills/slots associated with this tool\n"
  3558. "- Milling -> will mill the drills/slots")
  3559. )
  3560. self.operation_radio = RadioSet(
  3561. [
  3562. {'label': _('Drilling'), 'value': 'drill'},
  3563. {'label': _("Milling"), 'value': 'mill'}
  3564. ]
  3565. )
  3566. grid2.addWidget(self.operation_label, 0, 0)
  3567. grid2.addWidget(self.operation_radio, 0, 1)
  3568. self.mill_type_label = QtWidgets.QLabel('%s:' % _('Milling Type'))
  3569. self.mill_type_label.setToolTip(
  3570. _("Milling type:\n"
  3571. "- Drills -> will mill the drills associated with this tool\n"
  3572. "- Slots -> will mill the slots associated with this tool\n"
  3573. "- Both -> will mill both drills and mills or whatever is available")
  3574. )
  3575. self.milling_type_radio = RadioSet(
  3576. [
  3577. {'label': _('Drills'), 'value': 'drills'},
  3578. {'label': _("Slots"), 'value': 'slots'},
  3579. {'label': _("Both"), 'value': 'both'},
  3580. ]
  3581. )
  3582. grid2.addWidget(self.mill_type_label, 1, 0)
  3583. grid2.addWidget(self.milling_type_radio, 1, 1)
  3584. self.mill_dia_label = QtWidgets.QLabel('%s:' % _('Milling Diameter'))
  3585. self.mill_dia_label.setToolTip(
  3586. _("The diameter of the tool who will do the milling")
  3587. )
  3588. self.mill_dia_entry = FCDoubleSpinner()
  3589. self.mill_dia_entry.set_precision(self.decimals)
  3590. self.mill_dia_entry.set_range(0.0000, 9999.9999)
  3591. grid2.addWidget(self.mill_dia_label, 2, 0)
  3592. grid2.addWidget(self.mill_dia_entry, 2, 1)
  3593. # Cut Z
  3594. cutzlabel = QtWidgets.QLabel('%s:' % _('Cut Z'))
  3595. cutzlabel.setToolTip(
  3596. _("Drill depth (negative)\n"
  3597. "below the copper surface.")
  3598. )
  3599. self.cutz_entry = FCDoubleSpinner()
  3600. if machinist_setting == 0:
  3601. self.cutz_entry.set_range(-9999.9999, 0.0000)
  3602. else:
  3603. self.cutz_entry.set_range(-9999.9999, 9999.9999)
  3604. self.cutz_entry.setSingleStep(0.1)
  3605. self.cutz_entry.set_precision(self.decimals)
  3606. grid2.addWidget(cutzlabel, 3, 0)
  3607. grid2.addWidget(self.cutz_entry, 3, 1)
  3608. # Multi-Depth
  3609. self.mpass_cb = FCCheckBox('%s:' % _("Multi-Depth"))
  3610. self.mpass_cb.setToolTip(
  3611. _(
  3612. "Use multiple passes to limit\n"
  3613. "the cut depth in each pass. Will\n"
  3614. "cut multiple times until Cut Z is\n"
  3615. "reached."
  3616. )
  3617. )
  3618. self.maxdepth_entry = FCDoubleSpinner()
  3619. self.maxdepth_entry.set_precision(self.decimals)
  3620. self.maxdepth_entry.set_range(0, 9999.9999)
  3621. self.maxdepth_entry.setSingleStep(0.1)
  3622. self.maxdepth_entry.setToolTip(_("Depth of each pass (positive)."))
  3623. grid2.addWidget(self.mpass_cb, 4, 0)
  3624. grid2.addWidget(self.maxdepth_entry, 4, 1)
  3625. # Travel Z
  3626. travelzlabel = QtWidgets.QLabel('%s:' % _('Travel Z'))
  3627. travelzlabel.setToolTip(
  3628. _("Tool height when travelling\n"
  3629. "across the XY plane.")
  3630. )
  3631. self.travelz_entry = FCDoubleSpinner()
  3632. self.travelz_entry.set_precision(self.decimals)
  3633. if machinist_setting == 0:
  3634. self.travelz_entry.set_range(0.0001, 9999.9999)
  3635. else:
  3636. self.travelz_entry.set_range(-9999.9999, 9999.9999)
  3637. grid2.addWidget(travelzlabel, 5, 0)
  3638. grid2.addWidget(self.travelz_entry, 5, 1)
  3639. # Tool change:
  3640. self.toolchange_cb = FCCheckBox('%s' % _("Tool change"))
  3641. self.toolchange_cb.setToolTip(
  3642. _("Include tool-change sequence\n"
  3643. "in G-Code (Pause for tool change).")
  3644. )
  3645. grid2.addWidget(self.toolchange_cb, 6, 0, 1, 2)
  3646. # Tool Change Z
  3647. toolchangezlabel = QtWidgets.QLabel('%s:' % _('Toolchange Z'))
  3648. toolchangezlabel.setToolTip(
  3649. _("Z-axis position (height) for\n"
  3650. "tool change.")
  3651. )
  3652. self.toolchangez_entry = FCDoubleSpinner()
  3653. self.toolchangez_entry.set_precision(self.decimals)
  3654. if machinist_setting == 0:
  3655. self.toolchangez_entry.set_range(0.0001, 9999.9999)
  3656. else:
  3657. self.toolchangez_entry.set_range(-9999.9999, 9999.9999)
  3658. grid2.addWidget(toolchangezlabel, 7, 0)
  3659. grid2.addWidget(self.toolchangez_entry, 7, 1)
  3660. # End Move Z
  3661. endz_label = QtWidgets.QLabel('%s:' % _('End move Z'))
  3662. endz_label.setToolTip(
  3663. _("Height of the tool after\n"
  3664. "the last move at the end of the job.")
  3665. )
  3666. self.endz_entry = FCDoubleSpinner()
  3667. self.endz_entry.set_precision(self.decimals)
  3668. if machinist_setting == 0:
  3669. self.endz_entry.set_range(0.0000, 9999.9999)
  3670. else:
  3671. self.endz_entry.set_range(-9999.9999, 9999.9999)
  3672. grid2.addWidget(endz_label, 8, 0)
  3673. grid2.addWidget(self.endz_entry, 8, 1)
  3674. # End Move X,Y
  3675. endmove_xy_label = QtWidgets.QLabel('%s:' % _('End move X,Y'))
  3676. endmove_xy_label.setToolTip(
  3677. _("End move X,Y position. In format (x,y).\n"
  3678. "If no value is entered then there is no move\n"
  3679. "on X,Y plane at the end of the job.")
  3680. )
  3681. self.endxy_entry = FCEntry()
  3682. grid2.addWidget(endmove_xy_label, 9, 0)
  3683. grid2.addWidget(self.endxy_entry, 9, 1)
  3684. # Feedrate Z
  3685. frlabel = QtWidgets.QLabel('%s:' % _('Feedrate Z'))
  3686. frlabel.setToolTip(
  3687. _("Tool speed while drilling\n"
  3688. "(in units per minute).\n"
  3689. "So called 'Plunge' feedrate.\n"
  3690. "This is for linear move G01.")
  3691. )
  3692. self.feedrate_z_entry = FCDoubleSpinner()
  3693. self.feedrate_z_entry.set_precision(self.decimals)
  3694. self.feedrate_z_entry.set_range(0, 99999.9999)
  3695. grid2.addWidget(frlabel, 10, 0)
  3696. grid2.addWidget(self.feedrate_z_entry, 10, 1)
  3697. # Spindle speed
  3698. spdlabel = QtWidgets.QLabel('%s:' % _('Spindle Speed'))
  3699. spdlabel.setToolTip(
  3700. _("Speed of the spindle\n"
  3701. "in RPM (optional)")
  3702. )
  3703. self.spindlespeed_entry = FCSpinner()
  3704. self.spindlespeed_entry.set_range(0, 1000000)
  3705. self.spindlespeed_entry.set_step(100)
  3706. grid2.addWidget(spdlabel, 11, 0)
  3707. grid2.addWidget(self.spindlespeed_entry, 11, 1)
  3708. # Dwell
  3709. self.dwell_cb = FCCheckBox('%s' % _('Enable Dwell'))
  3710. self.dwell_cb .setToolTip(
  3711. _("Pause to allow the spindle to reach its\n"
  3712. "speed before cutting.")
  3713. )
  3714. grid2.addWidget(self.dwell_cb, 12, 0, 1, 2)
  3715. # Dwell Time
  3716. dwelltime = QtWidgets.QLabel('%s:' % _('Duration'))
  3717. dwelltime.setToolTip(_("Number of time units for spindle to dwell."))
  3718. self.dwelltime_entry = FCDoubleSpinner()
  3719. self.dwelltime_entry.set_precision(self.decimals)
  3720. self.dwelltime_entry.set_range(0, 99999.9999)
  3721. grid2.addWidget(dwelltime, 13, 0)
  3722. grid2.addWidget(self.dwelltime_entry, 13, 1)
  3723. self.ois_dwell_exc = OptionalInputSection(self.dwell_cb, [self.dwelltime_entry])
  3724. # preprocessor selection
  3725. pp_excellon_label = QtWidgets.QLabel('%s:' % _("Preprocessor"))
  3726. pp_excellon_label.setToolTip(
  3727. _("The preprocessor JSON file that dictates\n"
  3728. "Gcode output.")
  3729. )
  3730. self.pp_excellon_name_cb = FCComboBox()
  3731. self.pp_excellon_name_cb.setFocusPolicy(Qt.StrongFocus)
  3732. grid2.addWidget(pp_excellon_label, 14, 0)
  3733. grid2.addWidget(self.pp_excellon_name_cb, 14, 1)
  3734. # ### Choose what to use for Gcode creation: Drills, Slots or Both
  3735. excellon_gcode_type_label = QtWidgets.QLabel('<b>%s</b>' % _('Gcode'))
  3736. excellon_gcode_type_label.setToolTip(
  3737. _("Choose what to use for GCode generation:\n"
  3738. "'Drills', 'Slots' or 'Both'.\n"
  3739. "When choosing 'Slots' or 'Both', slots will be\n"
  3740. "converted to drills.")
  3741. )
  3742. self.excellon_gcode_type_radio = RadioSet([{'label': 'Drills', 'value': 'drills'},
  3743. {'label': 'Slots', 'value': 'slots'},
  3744. {'label': 'Both', 'value': 'both'}])
  3745. grid2.addWidget(excellon_gcode_type_label, 15, 0)
  3746. grid2.addWidget(self.excellon_gcode_type_radio, 15, 1)
  3747. # until I decide to implement this feature those remain disabled
  3748. excellon_gcode_type_label.hide()
  3749. self.excellon_gcode_type_radio.setVisible(False)
  3750. # ### Milling Holes ## ##
  3751. self.mill_hole_label = QtWidgets.QLabel('<b>%s</b>' % _('Mill Holes'))
  3752. self.mill_hole_label.setToolTip(
  3753. _("Create Geometry for milling holes.")
  3754. )
  3755. grid2.addWidget(self.mill_hole_label, 16, 0, 1, 2)
  3756. tdlabel = QtWidgets.QLabel('%s:' % _('Drill Tool dia'))
  3757. tdlabel.setToolTip(
  3758. _("Diameter of the cutting tool.")
  3759. )
  3760. self.tooldia_entry = FCDoubleSpinner()
  3761. self.tooldia_entry.set_precision(self.decimals)
  3762. self.tooldia_entry.set_range(0, 999.9999)
  3763. grid2.addWidget(tdlabel, 18, 0)
  3764. grid2.addWidget(self.tooldia_entry, 18, 1)
  3765. stdlabel = QtWidgets.QLabel('%s:' % _('Slot Tool dia'))
  3766. stdlabel.setToolTip(
  3767. _("Diameter of the cutting tool\n"
  3768. "when milling slots.")
  3769. )
  3770. self.slot_tooldia_entry = FCDoubleSpinner()
  3771. self.slot_tooldia_entry.set_precision(self.decimals)
  3772. self.slot_tooldia_entry.set_range(0, 999.9999)
  3773. grid2.addWidget(stdlabel, 21, 0)
  3774. grid2.addWidget(self.slot_tooldia_entry, 21, 1)
  3775. self.layout.addStretch()
  3776. class ExcellonAdvOptPrefGroupUI(OptionsGroupUI):
  3777. def __init__(self, decimals=4, parent=None):
  3778. # OptionsGroupUI.__init__(self, "Excellon Advanced Options", parent=parent)
  3779. super(ExcellonAdvOptPrefGroupUI, self).__init__(self)
  3780. self.setTitle(str(_("Excellon Adv. Options")))
  3781. self.decimals = decimals
  3782. # #######################
  3783. # ## ADVANCED OPTIONS ###
  3784. # #######################
  3785. self.exc_label = QtWidgets.QLabel('<b>%s:</b>' % _('Advanced Options'))
  3786. self.exc_label.setToolTip(
  3787. _("A list of Excellon advanced parameters.\n"
  3788. "Those parameters are available only for\n"
  3789. "Advanced App. Level.")
  3790. )
  3791. self.layout.addWidget(self.exc_label)
  3792. grid1 = QtWidgets.QGridLayout()
  3793. self.layout.addLayout(grid1)
  3794. # Offset Z
  3795. offsetlabel = QtWidgets.QLabel('%s:' % _('Offset Z'))
  3796. offsetlabel.setToolTip(
  3797. _("Some drill bits (the larger ones) need to drill deeper\n"
  3798. "to create the desired exit hole diameter due of the tip shape.\n"
  3799. "The value here can compensate the Cut Z parameter."))
  3800. self.offset_entry = FCDoubleSpinner()
  3801. self.offset_entry.set_precision(self.decimals)
  3802. self.offset_entry.set_range(-999.9999, 999.9999)
  3803. grid1.addWidget(offsetlabel, 0, 0)
  3804. grid1.addWidget(self.offset_entry, 0, 1)
  3805. # ToolChange X,Y
  3806. toolchange_xy_label = QtWidgets.QLabel('%s:' % _('Toolchange X,Y'))
  3807. toolchange_xy_label.setToolTip(
  3808. _("Toolchange X,Y position.")
  3809. )
  3810. self.toolchangexy_entry = FCEntry()
  3811. grid1.addWidget(toolchange_xy_label, 1, 0)
  3812. grid1.addWidget(self.toolchangexy_entry, 1, 1)
  3813. # Start Z
  3814. startzlabel = QtWidgets.QLabel('%s:' % _('Start Z'))
  3815. startzlabel.setToolTip(
  3816. _("Height of the tool just after start.\n"
  3817. "Delete the value if you don't need this feature.")
  3818. )
  3819. self.estartz_entry = FloatEntry()
  3820. grid1.addWidget(startzlabel, 2, 0)
  3821. grid1.addWidget(self.estartz_entry, 2, 1)
  3822. # Feedrate Rapids
  3823. fr_rapid_label = QtWidgets.QLabel('%s:' % _('Feedrate Rapids'))
  3824. fr_rapid_label.setToolTip(
  3825. _("Tool speed while drilling\n"
  3826. "(in units per minute).\n"
  3827. "This is for the rapid move G00.\n"
  3828. "It is useful only for Marlin,\n"
  3829. "ignore for any other cases.")
  3830. )
  3831. self.feedrate_rapid_entry = FCDoubleSpinner()
  3832. self.feedrate_rapid_entry.set_precision(self.decimals)
  3833. self.feedrate_rapid_entry.set_range(0, 99999.9999)
  3834. grid1.addWidget(fr_rapid_label, 3, 0)
  3835. grid1.addWidget(self.feedrate_rapid_entry, 3, 1)
  3836. # Probe depth
  3837. self.pdepth_label = QtWidgets.QLabel('%s:' % _("Probe Z depth"))
  3838. self.pdepth_label.setToolTip(
  3839. _("The maximum depth that the probe is allowed\n"
  3840. "to probe. Negative value, in current units.")
  3841. )
  3842. self.pdepth_entry = FCDoubleSpinner()
  3843. self.pdepth_entry.set_precision(self.decimals)
  3844. self.pdepth_entry.set_range(-99999.9999, 0.0000)
  3845. grid1.addWidget(self.pdepth_label, 4, 0)
  3846. grid1.addWidget(self.pdepth_entry, 4, 1)
  3847. # Probe feedrate
  3848. self.feedrate_probe_label = QtWidgets.QLabel('%s:' % _("Feedrate Probe"))
  3849. self.feedrate_probe_label.setToolTip(
  3850. _("The feedrate used while the probe is probing.")
  3851. )
  3852. self.feedrate_probe_entry = FCDoubleSpinner()
  3853. self.feedrate_probe_entry.set_precision(self.decimals)
  3854. self.feedrate_probe_entry.set_range(0, 99999.9999)
  3855. grid1.addWidget(self.feedrate_probe_label, 5, 0)
  3856. grid1.addWidget(self.feedrate_probe_entry, 5, 1)
  3857. # Spindle direction
  3858. spindle_dir_label = QtWidgets.QLabel('%s:' % _('Spindle direction'))
  3859. spindle_dir_label.setToolTip(
  3860. _("This sets the direction that the spindle is rotating.\n"
  3861. "It can be either:\n"
  3862. "- CW = clockwise or\n"
  3863. "- CCW = counter clockwise")
  3864. )
  3865. self.spindledir_radio = RadioSet([{'label': _('CW'), 'value': 'CW'},
  3866. {'label': _('CCW'), 'value': 'CCW'}])
  3867. grid1.addWidget(spindle_dir_label, 6, 0)
  3868. grid1.addWidget(self.spindledir_radio, 6, 1)
  3869. self.fplunge_cb = FCCheckBox('%s' % _('Fast Plunge'))
  3870. self.fplunge_cb.setToolTip(
  3871. _("By checking this, the vertical move from\n"
  3872. "Z_Toolchange to Z_move is done with G0,\n"
  3873. "meaning the fastest speed available.\n"
  3874. "WARNING: the move is done at Toolchange X,Y coords.")
  3875. )
  3876. grid1.addWidget(self.fplunge_cb, 7, 0, 1, 2)
  3877. self.fretract_cb = FCCheckBox('%s' % _('Fast Retract'))
  3878. self.fretract_cb.setToolTip(
  3879. _("Exit hole strategy.\n"
  3880. " - When uncheked, while exiting the drilled hole the drill bit\n"
  3881. "will travel slow, with set feedrate (G1), up to zero depth and then\n"
  3882. "travel as fast as possible (G0) to the Z Move (travel height).\n"
  3883. " - When checked the travel from Z cut (cut depth) to Z_move\n"
  3884. "(travel height) is done as fast as possible (G0) in one move.")
  3885. )
  3886. grid1.addWidget(self.fretract_cb, 8, 0, 1, 2)
  3887. self.layout.addStretch()
  3888. class ExcellonExpPrefGroupUI(OptionsGroupUI):
  3889. def __init__(self, decimals=4, parent=None):
  3890. super(ExcellonExpPrefGroupUI, self).__init__(self)
  3891. self.setTitle(str(_("Excellon Export")))
  3892. self.decimals = decimals
  3893. # Plot options
  3894. self.export_options_label = QtWidgets.QLabel("<b>%s:</b>" % _("Export Options"))
  3895. self.export_options_label.setToolTip(
  3896. _("The parameters set here are used in the file exported\n"
  3897. "when using the File -> Export -> Export Excellon menu entry.")
  3898. )
  3899. self.layout.addWidget(self.export_options_label)
  3900. form = QtWidgets.QFormLayout()
  3901. self.layout.addLayout(form)
  3902. # Excellon Units
  3903. self.excellon_units_label = QtWidgets.QLabel('%s:' % _('Units'))
  3904. self.excellon_units_label.setToolTip(
  3905. _("The units used in the Excellon file.")
  3906. )
  3907. self.excellon_units_radio = RadioSet([{'label': _('INCH'), 'value': 'INCH'},
  3908. {'label': _('MM'), 'value': 'METRIC'}])
  3909. self.excellon_units_radio.setToolTip(
  3910. _("The units used in the Excellon file.")
  3911. )
  3912. form.addRow(self.excellon_units_label, self.excellon_units_radio)
  3913. # Excellon non-decimal format
  3914. self.digits_label = QtWidgets.QLabel("%s:" % _("Int/Decimals"))
  3915. self.digits_label.setToolTip(
  3916. _("The NC drill files, usually named Excellon files\n"
  3917. "are files that can be found in different formats.\n"
  3918. "Here we set the format used when the provided\n"
  3919. "coordinates are not using period.")
  3920. )
  3921. hlay1 = QtWidgets.QHBoxLayout()
  3922. self.format_whole_entry = FCSpinner()
  3923. self.format_whole_entry.set_range(0, 9)
  3924. self.format_whole_entry.setMinimumWidth(30)
  3925. self.format_whole_entry.setToolTip(
  3926. _("This numbers signify the number of digits in\n"
  3927. "the whole part of Excellon coordinates.")
  3928. )
  3929. hlay1.addWidget(self.format_whole_entry, QtCore.Qt.AlignLeft)
  3930. excellon_separator_label = QtWidgets.QLabel(':')
  3931. excellon_separator_label.setFixedWidth(5)
  3932. hlay1.addWidget(excellon_separator_label, QtCore.Qt.AlignLeft)
  3933. self.format_dec_entry = FCSpinner()
  3934. self.format_dec_entry.set_range(0, 9)
  3935. self.format_dec_entry.setMinimumWidth(30)
  3936. self.format_dec_entry.setToolTip(
  3937. _("This numbers signify the number of digits in\n"
  3938. "the decimal part of Excellon coordinates.")
  3939. )
  3940. hlay1.addWidget(self.format_dec_entry, QtCore.Qt.AlignLeft)
  3941. hlay1.addStretch()
  3942. form.addRow(self.digits_label, hlay1)
  3943. # Select the Excellon Format
  3944. self.format_label = QtWidgets.QLabel("%s:" % _("Format"))
  3945. self.format_label.setToolTip(
  3946. _("Select the kind of coordinates format used.\n"
  3947. "Coordinates can be saved with decimal point or without.\n"
  3948. "When there is no decimal point, it is required to specify\n"
  3949. "the number of digits for integer part and the number of decimals.\n"
  3950. "Also it will have to be specified if LZ = leading zeros are kept\n"
  3951. "or TZ = trailing zeros are kept.")
  3952. )
  3953. self.format_radio = RadioSet([{'label': _('Decimal'), 'value': 'dec'},
  3954. {'label': _('No-Decimal'), 'value': 'ndec'}])
  3955. self.format_radio.setToolTip(
  3956. _("Select the kind of coordinates format used.\n"
  3957. "Coordinates can be saved with decimal point or without.\n"
  3958. "When there is no decimal point, it is required to specify\n"
  3959. "the number of digits for integer part and the number of decimals.\n"
  3960. "Also it will have to be specified if LZ = leading zeros are kept\n"
  3961. "or TZ = trailing zeros are kept.")
  3962. )
  3963. form.addRow(self.format_label, self.format_radio)
  3964. # Excellon Zeros
  3965. self.zeros_label = QtWidgets.QLabel('%s:' % _('Zeros'))
  3966. self.zeros_label.setAlignment(QtCore.Qt.AlignLeft)
  3967. self.zeros_label.setToolTip(
  3968. _("This sets the type of Excellon zeros.\n"
  3969. "If LZ then Leading Zeros are kept and\n"
  3970. "Trailing Zeros are removed.\n"
  3971. "If TZ is checked then Trailing Zeros are kept\n"
  3972. "and Leading Zeros are removed.")
  3973. )
  3974. self.zeros_radio = RadioSet([{'label': _('LZ'), 'value': 'LZ'},
  3975. {'label': _('TZ'), 'value': 'TZ'}])
  3976. self.zeros_radio.setToolTip(
  3977. _("This sets the default type of Excellon zeros.\n"
  3978. "If LZ then Leading Zeros are kept and\n"
  3979. "Trailing Zeros are removed.\n"
  3980. "If TZ is checked then Trailing Zeros are kept\n"
  3981. "and Leading Zeros are removed.")
  3982. )
  3983. form.addRow(self.zeros_label, self.zeros_radio)
  3984. # Slot type
  3985. self.slot_type_label = QtWidgets.QLabel('%s:' % _('Slot type'))
  3986. self.slot_type_label.setAlignment(QtCore.Qt.AlignLeft)
  3987. self.slot_type_label.setToolTip(
  3988. _("This sets how the slots will be exported.\n"
  3989. "If ROUTED then the slots will be routed\n"
  3990. "using M15/M16 commands.\n"
  3991. "If DRILLED(G85) the slots will be exported\n"
  3992. "using the Drilled slot command (G85).")
  3993. )
  3994. self.slot_type_radio = RadioSet([{'label': _('Routed'), 'value': 'routing'},
  3995. {'label': _('Drilled(G85)'), 'value': 'drilling'}])
  3996. self.slot_type_radio.setToolTip(
  3997. _("This sets how the slots will be exported.\n"
  3998. "If ROUTED then the slots will be routed\n"
  3999. "using M15/M16 commands.\n"
  4000. "If DRILLED(G85) the slots will be exported\n"
  4001. "using the Drilled slot command (G85).")
  4002. )
  4003. form.addRow(self.slot_type_label, self.slot_type_radio)
  4004. self.layout.addStretch()
  4005. self.format_radio.activated_custom.connect(self.optimization_selection)
  4006. def optimization_selection(self):
  4007. if self.format_radio.get_value() == 'dec':
  4008. self.zeros_label.setDisabled(True)
  4009. self.zeros_radio.setDisabled(True)
  4010. else:
  4011. self.zeros_label.setDisabled(False)
  4012. self.zeros_radio.setDisabled(False)
  4013. class ExcellonEditorPrefGroupUI(OptionsGroupUI):
  4014. def __init__(self, decimals=4, parent=None):
  4015. super(ExcellonEditorPrefGroupUI, self).__init__(self)
  4016. self.setTitle(str(_("Excellon Editor")))
  4017. self.decimals = decimals
  4018. # Excellon Editor Parameters
  4019. self.param_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  4020. self.param_label.setToolTip(
  4021. _("A list of Excellon Editor parameters.")
  4022. )
  4023. self.layout.addWidget(self.param_label)
  4024. grid0 = QtWidgets.QGridLayout()
  4025. self.layout.addLayout(grid0)
  4026. # Selection Limit
  4027. self.sel_limit_label = QtWidgets.QLabel('%s:' % _("Selection limit"))
  4028. self.sel_limit_label.setToolTip(
  4029. _("Set the number of selected Excellon geometry\n"
  4030. "items above which the utility geometry\n"
  4031. "becomes just a selection rectangle.\n"
  4032. "Increases the performance when moving a\n"
  4033. "large number of geometric elements.")
  4034. )
  4035. self.sel_limit_entry = FCSpinner()
  4036. self.sel_limit_entry.set_range(0, 99999)
  4037. grid0.addWidget(self.sel_limit_label, 0, 0)
  4038. grid0.addWidget(self.sel_limit_entry, 0, 1)
  4039. # New Diameter
  4040. self.addtool_entry_lbl = QtWidgets.QLabel('%s:' % _('New Dia'))
  4041. self.addtool_entry_lbl.setToolTip(
  4042. _("Diameter for the new tool")
  4043. )
  4044. self.addtool_entry = FCDoubleSpinner()
  4045. self.addtool_entry.set_range(0.000001, 99.9999)
  4046. self.addtool_entry.set_precision(self.decimals)
  4047. grid0.addWidget(self.addtool_entry_lbl, 1, 0)
  4048. grid0.addWidget(self.addtool_entry, 1, 1)
  4049. # Number of drill holes in a drill array
  4050. self.drill_array_size_label = QtWidgets.QLabel('%s:' % _('Nr of drills'))
  4051. self.drill_array_size_label.setToolTip(
  4052. _("Specify how many drills to be in the array.")
  4053. )
  4054. # self.drill_array_size_label.setMinimumWidth(100)
  4055. self.drill_array_size_entry = FCSpinner()
  4056. self.drill_array_size_entry.set_range(0, 9999)
  4057. grid0.addWidget(self.drill_array_size_label, 2, 0)
  4058. grid0.addWidget(self.drill_array_size_entry, 2, 1)
  4059. self.drill_array_linear_label = QtWidgets.QLabel('<b>%s:</b>' % _('Linear Drill Array'))
  4060. grid0.addWidget(self.drill_array_linear_label, 3, 0, 1, 2)
  4061. # Linear Drill Array direction
  4062. self.drill_axis_label = QtWidgets.QLabel('%s:' % _('Linear Direction'))
  4063. self.drill_axis_label.setToolTip(
  4064. _("Direction on which the linear array is oriented:\n"
  4065. "- 'X' - horizontal axis \n"
  4066. "- 'Y' - vertical axis or \n"
  4067. "- 'Angle' - a custom angle for the array inclination")
  4068. )
  4069. # self.drill_axis_label.setMinimumWidth(100)
  4070. self.drill_axis_radio = RadioSet([{'label': _('X'), 'value': 'X'},
  4071. {'label': _('Y'), 'value': 'Y'},
  4072. {'label': _('Angle'), 'value': 'A'}])
  4073. grid0.addWidget(self.drill_axis_label, 4, 0)
  4074. grid0.addWidget(self.drill_axis_radio, 4, 1)
  4075. # Linear Drill Array pitch distance
  4076. self.drill_pitch_label = QtWidgets.QLabel('%s:' % _('Pitch'))
  4077. self.drill_pitch_label.setToolTip(
  4078. _("Pitch = Distance between elements of the array.")
  4079. )
  4080. # self.drill_pitch_label.setMinimumWidth(100)
  4081. self.drill_pitch_entry = FCDoubleSpinner()
  4082. self.drill_pitch_entry.set_range(0, 99999.9999)
  4083. self.drill_pitch_entry.set_precision(self.decimals)
  4084. grid0.addWidget(self.drill_pitch_label, 5, 0)
  4085. grid0.addWidget(self.drill_pitch_entry, 5, 1)
  4086. # Linear Drill Array custom angle
  4087. self.drill_angle_label = QtWidgets.QLabel('%s:' % _('Angle'))
  4088. self.drill_angle_label.setToolTip(
  4089. _("Angle at which each element in circular array is placed.")
  4090. )
  4091. self.drill_angle_entry = FCDoubleSpinner()
  4092. self.drill_pitch_entry.set_range(-360, 360)
  4093. self.drill_pitch_entry.set_precision(self.decimals)
  4094. self.drill_angle_entry.setWrapping(True)
  4095. self.drill_angle_entry.setSingleStep(5)
  4096. grid0.addWidget(self.drill_angle_label, 6, 0)
  4097. grid0.addWidget(self.drill_angle_entry, 6, 1)
  4098. self.drill_array_circ_label = QtWidgets.QLabel('<b>%s:</b>' % _('Circular Drill Array'))
  4099. grid0.addWidget(self.drill_array_circ_label, 7, 0, 1, 2)
  4100. # Circular Drill Array direction
  4101. self.drill_circular_direction_label = QtWidgets.QLabel('%s:' % _('Circular Direction'))
  4102. self.drill_circular_direction_label.setToolTip(
  4103. _("Direction for circular array.\n"
  4104. "Can be CW = clockwise or CCW = counter clockwise.")
  4105. )
  4106. self.drill_circular_dir_radio = RadioSet([{'label': _('CW'), 'value': 'CW'},
  4107. {'label': _('CCW'), 'value': 'CCW'}])
  4108. grid0.addWidget(self.drill_circular_direction_label, 8, 0)
  4109. grid0.addWidget(self.drill_circular_dir_radio, 8, 1)
  4110. # Circular Drill Array Angle
  4111. self.drill_circular_angle_label = QtWidgets.QLabel('%s:' % _('Circular Angle'))
  4112. self.drill_circular_angle_label.setToolTip(
  4113. _("Angle at which each element in circular array is placed.")
  4114. )
  4115. self.drill_circular_angle_entry = FCDoubleSpinner()
  4116. self.drill_circular_angle_entry.set_range(-360, 360)
  4117. self.drill_circular_angle_entry.set_precision(self.decimals)
  4118. self.drill_circular_angle_entry.setWrapping(True)
  4119. self.drill_circular_angle_entry.setSingleStep(5)
  4120. grid0.addWidget(self.drill_circular_angle_label, 9, 0)
  4121. grid0.addWidget(self.drill_circular_angle_entry, 9, 1)
  4122. # ##### SLOTS #####
  4123. # #################
  4124. self.drill_array_circ_label = QtWidgets.QLabel('<b>%s:</b>' % _('Slots'))
  4125. grid0.addWidget(self.drill_array_circ_label, 10, 0, 1, 2)
  4126. # Slot length
  4127. self.slot_length_label = QtWidgets.QLabel('%s:' % _('Length'))
  4128. self.slot_length_label.setToolTip(
  4129. _("Length = The length of the slot.")
  4130. )
  4131. self.slot_length_label.setMinimumWidth(100)
  4132. self.slot_length_entry = FCDoubleSpinner()
  4133. self.slot_length_entry.set_range(0, 99999)
  4134. self.slot_length_entry.set_precision(self.decimals)
  4135. self.slot_length_entry.setWrapping(True)
  4136. self.slot_length_entry.setSingleStep(1)
  4137. grid0.addWidget(self.slot_length_label, 11, 0)
  4138. grid0.addWidget(self.slot_length_entry, 11, 1)
  4139. # Slot direction
  4140. self.slot_axis_label = QtWidgets.QLabel('%s:' % _('Direction'))
  4141. self.slot_axis_label.setToolTip(
  4142. _("Direction on which the slot is oriented:\n"
  4143. "- 'X' - horizontal axis \n"
  4144. "- 'Y' - vertical axis or \n"
  4145. "- 'Angle' - a custom angle for the slot inclination")
  4146. )
  4147. self.slot_axis_label.setMinimumWidth(100)
  4148. self.slot_axis_radio = RadioSet([{'label': _('X'), 'value': 'X'},
  4149. {'label': _('Y'), 'value': 'Y'},
  4150. {'label': _('Angle'), 'value': 'A'}])
  4151. grid0.addWidget(self.slot_axis_label, 12, 0)
  4152. grid0.addWidget(self.slot_axis_radio, 12, 1)
  4153. # Slot custom angle
  4154. self.slot_angle_label = QtWidgets.QLabel('%s:' % _('Angle'))
  4155. self.slot_angle_label.setToolTip(
  4156. _("Angle at which the slot is placed.\n"
  4157. "The precision is of max 2 decimals.\n"
  4158. "Min value is: -359.99 degrees.\n"
  4159. "Max value is: 360.00 degrees.")
  4160. )
  4161. self.slot_angle_label.setMinimumWidth(100)
  4162. self.slot_angle_spinner = FCDoubleSpinner()
  4163. self.slot_angle_spinner.set_precision(self.decimals)
  4164. self.slot_angle_spinner.setWrapping(True)
  4165. self.slot_angle_spinner.setRange(-359.99, 360.00)
  4166. self.slot_angle_spinner.setSingleStep(5)
  4167. grid0.addWidget(self.slot_angle_label, 13, 0)
  4168. grid0.addWidget(self.slot_angle_spinner, 13, 1)
  4169. # #### SLOTS ARRAY #######
  4170. # ########################
  4171. self.slot_array_linear_label = QtWidgets.QLabel('<b>%s:</b>' % _('Linear Slot Array'))
  4172. grid0.addWidget(self.slot_array_linear_label, 14, 0, 1, 2)
  4173. # Number of slot holes in a drill array
  4174. self.slot_array_size_label = QtWidgets.QLabel('%s:' % _('Nr of slots'))
  4175. self.drill_array_size_label.setToolTip(
  4176. _("Specify how many slots to be in the array.")
  4177. )
  4178. # self.slot_array_size_label.setMinimumWidth(100)
  4179. self.slot_array_size_entry = FCSpinner()
  4180. self.slot_array_size_entry.set_range(0, 999999)
  4181. grid0.addWidget(self.slot_array_size_label, 15, 0)
  4182. grid0.addWidget(self.slot_array_size_entry, 15, 1)
  4183. # Linear Slot Array direction
  4184. self.slot_array_axis_label = QtWidgets.QLabel('%s:' % _('Linear Direction'))
  4185. self.slot_array_axis_label.setToolTip(
  4186. _("Direction on which the linear array is oriented:\n"
  4187. "- 'X' - horizontal axis \n"
  4188. "- 'Y' - vertical axis or \n"
  4189. "- 'Angle' - a custom angle for the array inclination")
  4190. )
  4191. # self.slot_axis_label.setMinimumWidth(100)
  4192. self.slot_array_axis_radio = RadioSet([{'label': _('X'), 'value': 'X'},
  4193. {'label': _('Y'), 'value': 'Y'},
  4194. {'label': _('Angle'), 'value': 'A'}])
  4195. grid0.addWidget(self.slot_array_axis_label, 16, 0)
  4196. grid0.addWidget(self.slot_array_axis_radio, 16, 1)
  4197. # Linear Slot Array pitch distance
  4198. self.slot_array_pitch_label = QtWidgets.QLabel('%s:' % _('Pitch'))
  4199. self.slot_array_pitch_label.setToolTip(
  4200. _("Pitch = Distance between elements of the array.")
  4201. )
  4202. # self.drill_pitch_label.setMinimumWidth(100)
  4203. self.slot_array_pitch_entry = FCDoubleSpinner()
  4204. self.slot_array_pitch_entry.set_precision(self.decimals)
  4205. self.slot_array_pitch_entry.setWrapping(True)
  4206. self.slot_array_pitch_entry.setRange(0, 999999)
  4207. self.slot_array_pitch_entry.setSingleStep(1)
  4208. grid0.addWidget(self.slot_array_pitch_label, 17, 0)
  4209. grid0.addWidget(self.slot_array_pitch_entry, 17, 1)
  4210. # Linear Slot Array custom angle
  4211. self.slot_array_angle_label = QtWidgets.QLabel('%s:' % _('Angle'))
  4212. self.slot_array_angle_label.setToolTip(
  4213. _("Angle at which each element in circular array is placed.")
  4214. )
  4215. self.slot_array_angle_entry = FCDoubleSpinner()
  4216. self.slot_array_angle_entry.set_precision(self.decimals)
  4217. self.slot_array_angle_entry.setWrapping(True)
  4218. self.slot_array_angle_entry.setRange(-360, 360)
  4219. self.slot_array_angle_entry.setSingleStep(5)
  4220. grid0.addWidget(self.slot_array_angle_label, 18, 0)
  4221. grid0.addWidget(self.slot_array_angle_entry, 18, 1)
  4222. self.slot_array_circ_label = QtWidgets.QLabel('<b>%s:</b>' % _('Circular Slot Array'))
  4223. grid0.addWidget(self.slot_array_circ_label, 19, 0, 1, 2)
  4224. # Circular Slot Array direction
  4225. self.slot_array_circular_direction_label = QtWidgets.QLabel('%s:' % _('Circular Direction'))
  4226. self.slot_array_circular_direction_label.setToolTip(
  4227. _("Direction for circular array.\n"
  4228. "Can be CW = clockwise or CCW = counter clockwise.")
  4229. )
  4230. self.slot_array_circular_dir_radio = RadioSet([{'label': _('CW'), 'value': 'CW'},
  4231. {'label': _('CCW'), 'value': 'CCW'}])
  4232. grid0.addWidget(self.slot_array_circular_direction_label, 20, 0)
  4233. grid0.addWidget(self.slot_array_circular_dir_radio, 20, 1)
  4234. # Circular Slot Array Angle
  4235. self.slot_array_circular_angle_label = QtWidgets.QLabel('%s:' % _('Circular Angle'))
  4236. self.slot_array_circular_angle_label.setToolTip(
  4237. _("Angle at which each element in circular array is placed.")
  4238. )
  4239. self.slot_array_circular_angle_entry = FCDoubleSpinner()
  4240. self.slot_array_circular_angle_entry.set_precision(self.decimals)
  4241. self.slot_array_circular_angle_entry.setWrapping(True)
  4242. self.slot_array_circular_angle_entry.setRange(-360, 360)
  4243. self.slot_array_circular_angle_entry.setSingleStep(5)
  4244. grid0.addWidget(self.slot_array_circular_angle_label, 21, 0)
  4245. grid0.addWidget(self.slot_array_circular_angle_entry, 21, 1)
  4246. self.layout.addStretch()
  4247. class GeometryGenPrefGroupUI(OptionsGroupUI):
  4248. def __init__(self, decimals=4, parent=None):
  4249. # OptionsGroupUI.__init__(self, "Geometry General Preferences", parent=parent)
  4250. super(GeometryGenPrefGroupUI, self).__init__(self)
  4251. self.setTitle(str(_("Geometry General")))
  4252. self.decimals = decimals
  4253. # ## Plot options
  4254. self.plot_options_label = QtWidgets.QLabel("<b>%s:</b>" % _("Plot Options"))
  4255. self.layout.addWidget(self.plot_options_label)
  4256. # Plot CB
  4257. self.plot_cb = FCCheckBox(label=_('Plot'))
  4258. self.plot_cb.setToolTip(
  4259. _("Plot (show) this object.")
  4260. )
  4261. self.layout.addWidget(self.plot_cb)
  4262. grid0 = QtWidgets.QGridLayout()
  4263. self.layout.addLayout(grid0)
  4264. grid0.setColumnStretch(0, 0)
  4265. grid0.setColumnStretch(1, 1)
  4266. # Number of circle steps for circular aperture linear approximation
  4267. self.circle_steps_label = QtWidgets.QLabel('%s:' % _("Circle Steps"))
  4268. self.circle_steps_label.setToolTip(
  4269. _("The number of circle steps for <b>Geometry</b> \n"
  4270. "circle and arc shapes linear approximation.")
  4271. )
  4272. self.circle_steps_entry = FCSpinner()
  4273. self.circle_steps_entry.set_range(0, 999)
  4274. grid0.addWidget(self.circle_steps_label, 1, 0)
  4275. grid0.addWidget(self.circle_steps_entry, 1, 1)
  4276. # Tools
  4277. self.tools_label = QtWidgets.QLabel("<b>%s:</b>" % _("Tools"))
  4278. grid0.addWidget(self.tools_label, 2, 0, 1, 2)
  4279. # Tooldia
  4280. tdlabel = QtWidgets.QLabel('<b><font color="green">%s:</font></b>' % _('Tools Dia'))
  4281. tdlabel.setToolTip(
  4282. _("Diameters of the tools, separated by comma.\n"
  4283. "The value of the diameter has to use the dot decimals separator.\n"
  4284. "Valid values: 0.3, 1.0")
  4285. )
  4286. self.cnctooldia_entry = FCEntry()
  4287. grid0.addWidget(tdlabel, 3, 0)
  4288. grid0.addWidget(self.cnctooldia_entry, 3, 1)
  4289. separator_line = QtWidgets.QFrame()
  4290. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  4291. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  4292. grid0.addWidget(separator_line, 9, 0, 1, 2)
  4293. # Geometry Object Color
  4294. self.gerber_color_label = QtWidgets.QLabel('<b>%s</b>' % _('Geometry Object Color'))
  4295. grid0.addWidget(self.gerber_color_label, 10, 0, 1, 2)
  4296. # Plot Line Color
  4297. self.line_color_label = QtWidgets.QLabel('%s:' % _('Outline'))
  4298. self.line_color_label.setToolTip(
  4299. _("Set the line color for plotted objects.")
  4300. )
  4301. self.line_color_entry = FCEntry()
  4302. self.line_color_button = QtWidgets.QPushButton()
  4303. self.line_color_button.setFixedSize(15, 15)
  4304. self.form_box_child_2 = QtWidgets.QHBoxLayout()
  4305. self.form_box_child_2.addWidget(self.line_color_entry)
  4306. self.form_box_child_2.addWidget(self.line_color_button)
  4307. self.form_box_child_2.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  4308. grid0.addWidget(self.line_color_label, 11, 0)
  4309. grid0.addLayout(self.form_box_child_2, 11, 1)
  4310. self.layout.addStretch()
  4311. # Setting plot colors signals
  4312. self.line_color_entry.editingFinished.connect(self.on_line_color_entry)
  4313. self.line_color_button.clicked.connect(self.on_line_color_button)
  4314. def on_line_color_entry(self):
  4315. self.app.defaults['geometry_plot_line'] = self.line_color_entry.get_value()[:7] + 'FF'
  4316. self.line_color_button.setStyleSheet("background-color:%s" % str(self.app.defaults['geometry_plot_line'])[:7])
  4317. def on_line_color_button(self):
  4318. current_color = QtGui.QColor(self.app.defaults['geometry_plot_line'][:7])
  4319. # print(current_color)
  4320. c_dialog = QtWidgets.QColorDialog()
  4321. plot_line_color = c_dialog.getColor(initial=current_color)
  4322. if plot_line_color.isValid() is False:
  4323. return
  4324. self.line_color_button.setStyleSheet("background-color:%s" % str(plot_line_color.name()))
  4325. new_val_line = str(plot_line_color.name()) + str(self.app.defaults['geometry_plot_line'][7:9])
  4326. self.line_color_entry.set_value(new_val_line)
  4327. class GeometryOptPrefGroupUI(OptionsGroupUI):
  4328. def __init__(self, decimals=4, parent=None):
  4329. # OptionsGroupUI.__init__(self, "Geometry Options Preferences", parent=parent)
  4330. super(GeometryOptPrefGroupUI, self).__init__(self)
  4331. self.setTitle(str(_("Geometry Options")))
  4332. self.decimals = decimals
  4333. # ------------------------------
  4334. # ## Create CNC Job
  4335. # ------------------------------
  4336. self.cncjob_label = QtWidgets.QLabel('<b>%s:</b>' % _('Create CNC Job'))
  4337. self.cncjob_label.setToolTip(
  4338. _("Create a CNC Job object\n"
  4339. "tracing the contours of this\n"
  4340. "Geometry object.")
  4341. )
  4342. self.layout.addWidget(self.cncjob_label)
  4343. grid1 = QtWidgets.QGridLayout()
  4344. self.layout.addLayout(grid1)
  4345. grid1.setColumnStretch(0, 0)
  4346. grid1.setColumnStretch(1, 1)
  4347. # Cut Z
  4348. cutzlabel = QtWidgets.QLabel('%s:' % _('Cut Z'))
  4349. cutzlabel.setToolTip(
  4350. _("Cutting depth (negative)\n"
  4351. "below the copper surface.")
  4352. )
  4353. self.cutz_entry = FCDoubleSpinner()
  4354. if machinist_setting == 0:
  4355. self.cutz_entry.set_range(-9999.9999, 0.0000)
  4356. else:
  4357. self.cutz_entry.set_range(-9999.9999, 9999.9999)
  4358. self.cutz_entry.set_precision(self.decimals)
  4359. self.cutz_entry.setSingleStep(0.1)
  4360. self.cutz_entry.setWrapping(True)
  4361. grid1.addWidget(cutzlabel, 0, 0)
  4362. grid1.addWidget(self.cutz_entry, 0, 1)
  4363. # Multidepth CheckBox
  4364. self.multidepth_cb = FCCheckBox(label=_('Multi-Depth'))
  4365. self.multidepth_cb.setToolTip(
  4366. _(
  4367. "Use multiple passes to limit\n"
  4368. "the cut depth in each pass. Will\n"
  4369. "cut multiple times until Cut Z is\n"
  4370. "reached."
  4371. )
  4372. )
  4373. grid1.addWidget(self.multidepth_cb, 1, 0)
  4374. # Depth/pass
  4375. dplabel = QtWidgets.QLabel('%s:' % _('Depth/Pass'))
  4376. dplabel.setToolTip(
  4377. _("The depth to cut on each pass,\n"
  4378. "when multidepth is enabled.\n"
  4379. "It has positive value although\n"
  4380. "it is a fraction from the depth\n"
  4381. "which has negative value.")
  4382. )
  4383. self.depthperpass_entry = FCDoubleSpinner()
  4384. self.depthperpass_entry.set_range(0, 99999)
  4385. self.depthperpass_entry.set_precision(self.decimals)
  4386. self.depthperpass_entry.setSingleStep(0.1)
  4387. self.depthperpass_entry.setWrapping(True)
  4388. grid1.addWidget(dplabel, 2, 0)
  4389. grid1.addWidget(self.depthperpass_entry, 2, 1)
  4390. self.ois_multidepth = OptionalInputSection(self.multidepth_cb, [self.depthperpass_entry])
  4391. # Travel Z
  4392. travelzlabel = QtWidgets.QLabel('%s:' % _('Travel Z'))
  4393. travelzlabel.setToolTip(
  4394. _("Height of the tool when\n"
  4395. "moving without cutting.")
  4396. )
  4397. self.travelz_entry = FCDoubleSpinner()
  4398. if machinist_setting == 0:
  4399. self.travelz_entry.set_range(0.0001, 9999.9999)
  4400. else:
  4401. self.travelz_entry.set_range(-9999.9999, 9999.9999)
  4402. self.travelz_entry.set_precision(self.decimals)
  4403. self.travelz_entry.setSingleStep(0.1)
  4404. self.travelz_entry.setWrapping(True)
  4405. grid1.addWidget(travelzlabel, 3, 0)
  4406. grid1.addWidget(self.travelz_entry, 3, 1)
  4407. # Tool change:
  4408. self.toolchange_cb = FCCheckBox('%s' % _("Tool change"))
  4409. self.toolchange_cb.setToolTip(
  4410. _(
  4411. "Include tool-change sequence\n"
  4412. "in the Machine Code (Pause for tool change)."
  4413. )
  4414. )
  4415. grid1.addWidget(self.toolchange_cb, 4, 0, 1, 2)
  4416. # Toolchange Z
  4417. toolchangezlabel = QtWidgets.QLabel('%s:' % _('Toolchange Z'))
  4418. toolchangezlabel.setToolTip(
  4419. _(
  4420. "Z-axis position (height) for\n"
  4421. "tool change."
  4422. )
  4423. )
  4424. self.toolchangez_entry = FCDoubleSpinner()
  4425. if machinist_setting == 0:
  4426. self.toolchangez_entry.set_range(0.000, 9999.9999)
  4427. else:
  4428. self.toolchangez_entry.set_range(-9999.9999, 9999.9999)
  4429. self.toolchangez_entry.set_precision(self.decimals)
  4430. self.toolchangez_entry.setSingleStep(0.1)
  4431. self.toolchangez_entry.setWrapping(True)
  4432. grid1.addWidget(toolchangezlabel, 5, 0)
  4433. grid1.addWidget(self.toolchangez_entry, 5, 1)
  4434. # End move Z
  4435. endz_label = QtWidgets.QLabel('%s:' % _('End move Z'))
  4436. endz_label.setToolTip(
  4437. _("Height of the tool after\n"
  4438. "the last move at the end of the job.")
  4439. )
  4440. self.endz_entry = FCDoubleSpinner()
  4441. if machinist_setting == 0:
  4442. self.endz_entry.set_range(0.000, 9999.9999)
  4443. else:
  4444. self.endz_entry.set_range(-9999.9999, 9999.9999)
  4445. self.endz_entry.set_precision(self.decimals)
  4446. self.endz_entry.setSingleStep(0.1)
  4447. self.endz_entry.setWrapping(True)
  4448. grid1.addWidget(endz_label, 6, 0)
  4449. grid1.addWidget(self.endz_entry, 6, 1)
  4450. # End Move X,Y
  4451. endmove_xy_label = QtWidgets.QLabel('%s:' % _('End move X,Y'))
  4452. endmove_xy_label.setToolTip(
  4453. _("End move X,Y position. In format (x,y).\n"
  4454. "If no value is entered then there is no move\n"
  4455. "on X,Y plane at the end of the job.")
  4456. )
  4457. self.endxy_entry = FCEntry()
  4458. grid1.addWidget(endmove_xy_label, 7, 0)
  4459. grid1.addWidget(self.endxy_entry, 7, 1)
  4460. # Feedrate X-Y
  4461. frlabel = QtWidgets.QLabel('%s:' % _('Feedrate X-Y'))
  4462. frlabel.setToolTip(
  4463. _("Cutting speed in the XY\n"
  4464. "plane in units per minute")
  4465. )
  4466. self.cncfeedrate_entry = FCDoubleSpinner()
  4467. self.cncfeedrate_entry.set_range(0, 99999.9999)
  4468. self.cncfeedrate_entry.set_precision(self.decimals)
  4469. self.cncfeedrate_entry.setSingleStep(0.1)
  4470. self.cncfeedrate_entry.setWrapping(True)
  4471. grid1.addWidget(frlabel, 8, 0)
  4472. grid1.addWidget(self.cncfeedrate_entry, 8, 1)
  4473. # Feedrate Z (Plunge)
  4474. frz_label = QtWidgets.QLabel('%s:' % _('Feedrate Z'))
  4475. frz_label.setToolTip(
  4476. _("Cutting speed in the XY\n"
  4477. "plane in units per minute.\n"
  4478. "It is called also Plunge.")
  4479. )
  4480. self.feedrate_z_entry = FCDoubleSpinner()
  4481. self.feedrate_z_entry.set_range(0, 99999.9999)
  4482. self.feedrate_z_entry.set_precision(self.decimals)
  4483. self.feedrate_z_entry.setSingleStep(0.1)
  4484. self.feedrate_z_entry.setWrapping(True)
  4485. grid1.addWidget(frz_label, 9, 0)
  4486. grid1.addWidget(self.feedrate_z_entry, 9, 1)
  4487. # Spindle Speed
  4488. spdlabel = QtWidgets.QLabel('%s:' % _('Spindle speed'))
  4489. spdlabel.setToolTip(
  4490. _(
  4491. "Speed of the spindle in RPM (optional).\n"
  4492. "If LASER preprocessor is used,\n"
  4493. "this value is the power of laser."
  4494. )
  4495. )
  4496. self.cncspindlespeed_entry = FCSpinner()
  4497. self.cncspindlespeed_entry.set_range(0, 1000000)
  4498. self.cncspindlespeed_entry.set_step(100)
  4499. grid1.addWidget(spdlabel, 10, 0)
  4500. grid1.addWidget(self.cncspindlespeed_entry, 10, 1)
  4501. # Dwell
  4502. self.dwell_cb = FCCheckBox(label='%s' % _('Enable Dwell'))
  4503. self.dwell_cb.setToolTip(
  4504. _("Pause to allow the spindle to reach its\n"
  4505. "speed before cutting.")
  4506. )
  4507. dwelltime = QtWidgets.QLabel('%s:' % _('Duration'))
  4508. dwelltime.setToolTip(
  4509. _("Number of time units for spindle to dwell.")
  4510. )
  4511. self.dwelltime_entry = FCDoubleSpinner()
  4512. self.dwelltime_entry.set_range(0, 99999)
  4513. self.dwelltime_entry.set_precision(self.decimals)
  4514. self.dwelltime_entry.setSingleStep(0.1)
  4515. self.dwelltime_entry.setWrapping(True)
  4516. grid1.addWidget(self.dwell_cb, 11, 0)
  4517. grid1.addWidget(dwelltime, 12, 0)
  4518. grid1.addWidget(self.dwelltime_entry, 12, 1)
  4519. self.ois_dwell = OptionalInputSection(self.dwell_cb, [self.dwelltime_entry])
  4520. # preprocessor selection
  4521. pp_label = QtWidgets.QLabel('%s:' % _("Preprocessor"))
  4522. pp_label.setToolTip(
  4523. _("The Preprocessor file that dictates\n"
  4524. "the Machine Code (like GCode, RML, HPGL) output.")
  4525. )
  4526. self.pp_geometry_name_cb = FCComboBox()
  4527. self.pp_geometry_name_cb.setFocusPolicy(Qt.StrongFocus)
  4528. grid1.addWidget(pp_label, 13, 0)
  4529. grid1.addWidget(self.pp_geometry_name_cb, 13, 1)
  4530. self.layout.addStretch()
  4531. class GeometryAdvOptPrefGroupUI(OptionsGroupUI):
  4532. def __init__(self, decimals=4, parent=None):
  4533. # OptionsGroupUI.__init__(self, "Geometry Advanced Options Preferences", parent=parent)
  4534. super(GeometryAdvOptPrefGroupUI, self).__init__(self)
  4535. self.setTitle(str(_("Geometry Adv. Options")))
  4536. self.decimals = decimals
  4537. # ------------------------------
  4538. # ## Advanced Options
  4539. # ------------------------------
  4540. self.geo_label = QtWidgets.QLabel('<b>%s:</b>' % _('Advanced Options'))
  4541. self.geo_label.setToolTip(
  4542. _("A list of Geometry advanced parameters.\n"
  4543. "Those parameters are available only for\n"
  4544. "Advanced App. Level.")
  4545. )
  4546. self.layout.addWidget(self.geo_label)
  4547. grid1 = QtWidgets.QGridLayout()
  4548. self.layout.addLayout(grid1)
  4549. # Toolchange X,Y
  4550. toolchange_xy_label = QtWidgets.QLabel('%s:' % _('Toolchange X-Y'))
  4551. toolchange_xy_label.setToolTip(
  4552. _("Toolchange X,Y position.")
  4553. )
  4554. grid1.addWidget(toolchange_xy_label, 1, 0)
  4555. self.toolchangexy_entry = FCEntry()
  4556. grid1.addWidget(self.toolchangexy_entry, 1, 1)
  4557. # Start move Z
  4558. startzlabel = QtWidgets.QLabel('%s:' % _('Start Z'))
  4559. startzlabel.setToolTip(
  4560. _("Height of the tool just after starting the work.\n"
  4561. "Delete the value if you don't need this feature.")
  4562. )
  4563. grid1.addWidget(startzlabel, 2, 0)
  4564. self.gstartz_entry = FloatEntry()
  4565. grid1.addWidget(self.gstartz_entry, 2, 1)
  4566. # Feedrate rapids
  4567. fr_rapid_label = QtWidgets.QLabel('%s:' % _('Feedrate Rapids'))
  4568. fr_rapid_label.setToolTip(
  4569. _("Cutting speed in the XY plane\n"
  4570. "(in units per minute).\n"
  4571. "This is for the rapid move G00.\n"
  4572. "It is useful only for Marlin,\n"
  4573. "ignore for any other cases.")
  4574. )
  4575. self.feedrate_rapid_entry = FCDoubleSpinner()
  4576. self.feedrate_rapid_entry.set_range(0, 99999.9999)
  4577. self.feedrate_rapid_entry.set_precision(self.decimals)
  4578. self.feedrate_rapid_entry.setSingleStep(0.1)
  4579. self.feedrate_rapid_entry.setWrapping(True)
  4580. grid1.addWidget(fr_rapid_label, 4, 0)
  4581. grid1.addWidget(self.feedrate_rapid_entry, 4, 1)
  4582. # End move extra cut
  4583. self.extracut_cb = FCCheckBox('%s' % _('Re-cut'))
  4584. self.extracut_cb.setToolTip(
  4585. _("In order to remove possible\n"
  4586. "copper leftovers where first cut\n"
  4587. "meet with last cut, we generate an\n"
  4588. "extended cut over the first cut section.")
  4589. )
  4590. self.e_cut_entry = FCDoubleSpinner()
  4591. self.e_cut_entry.set_range(0, 99999)
  4592. self.e_cut_entry.set_precision(self.decimals)
  4593. self.e_cut_entry.setSingleStep(0.1)
  4594. self.e_cut_entry.setWrapping(True)
  4595. self.e_cut_entry.setToolTip(
  4596. _("In order to remove possible\n"
  4597. "copper leftovers where first cut\n"
  4598. "meet with last cut, we generate an\n"
  4599. "extended cut over the first cut section.")
  4600. )
  4601. grid1.addWidget(self.extracut_cb, 5, 0)
  4602. grid1.addWidget(self.e_cut_entry, 5, 1)
  4603. # Probe depth
  4604. self.pdepth_label = QtWidgets.QLabel('%s:' % _("Probe Z depth"))
  4605. self.pdepth_label.setToolTip(
  4606. _("The maximum depth that the probe is allowed\n"
  4607. "to probe. Negative value, in current units.")
  4608. )
  4609. self.pdepth_entry = FCDoubleSpinner()
  4610. self.pdepth_entry.set_range(-99999, 0.0000)
  4611. self.pdepth_entry.set_precision(self.decimals)
  4612. self.pdepth_entry.setSingleStep(0.1)
  4613. self.pdepth_entry.setWrapping(True)
  4614. grid1.addWidget(self.pdepth_label, 6, 0)
  4615. grid1.addWidget(self.pdepth_entry, 6, 1)
  4616. # Probe feedrate
  4617. self.feedrate_probe_label = QtWidgets.QLabel('%s:' % _("Feedrate Probe"))
  4618. self.feedrate_probe_label.setToolTip(
  4619. _("The feedrate used while the probe is probing.")
  4620. )
  4621. self.feedrate_probe_entry = FCDoubleSpinner()
  4622. self.feedrate_probe_entry.set_range(0, 99999.9999)
  4623. self.feedrate_probe_entry.set_precision(self.decimals)
  4624. self.feedrate_probe_entry.setSingleStep(0.1)
  4625. self.feedrate_probe_entry.setWrapping(True)
  4626. grid1.addWidget(self.feedrate_probe_label, 7, 0)
  4627. grid1.addWidget(self.feedrate_probe_entry, 7, 1)
  4628. # Spindle direction
  4629. spindle_dir_label = QtWidgets.QLabel('%s:' % _('Spindle direction'))
  4630. spindle_dir_label.setToolTip(
  4631. _("This sets the direction that the spindle is rotating.\n"
  4632. "It can be either:\n"
  4633. "- CW = clockwise or\n"
  4634. "- CCW = counter clockwise")
  4635. )
  4636. self.spindledir_radio = RadioSet([{'label': _('CW'), 'value': 'CW'},
  4637. {'label': _('CCW'), 'value': 'CCW'}])
  4638. grid1.addWidget(spindle_dir_label, 8, 0)
  4639. grid1.addWidget(self.spindledir_radio, 8, 1)
  4640. # Fast Move from Z Toolchange
  4641. self.fplunge_cb = FCCheckBox('%s' % _('Fast Plunge'))
  4642. self.fplunge_cb.setToolTip(
  4643. _("By checking this, the vertical move from\n"
  4644. "Z_Toolchange to Z_move is done with G0,\n"
  4645. "meaning the fastest speed available.\n"
  4646. "WARNING: the move is done at Toolchange X,Y coords.")
  4647. )
  4648. grid1.addWidget(self.fplunge_cb, 9, 0, 1, 2)
  4649. # Size of trace segment on X axis
  4650. segx_label = QtWidgets.QLabel('%s:' % _("Segment X size"))
  4651. segx_label.setToolTip(
  4652. _("The size of the trace segment on the X axis.\n"
  4653. "Useful for auto-leveling.\n"
  4654. "A value of 0 means no segmentation on the X axis.")
  4655. )
  4656. self.segx_entry = FCDoubleSpinner()
  4657. self.segx_entry.set_range(0, 99999)
  4658. self.segx_entry.set_precision(self.decimals)
  4659. self.segx_entry.setSingleStep(0.1)
  4660. self.segx_entry.setWrapping(True)
  4661. grid1.addWidget(segx_label, 10, 0)
  4662. grid1.addWidget(self.segx_entry, 10, 1)
  4663. # Size of trace segment on Y axis
  4664. segy_label = QtWidgets.QLabel('%s:' % _("Segment Y size"))
  4665. segy_label.setToolTip(
  4666. _("The size of the trace segment on the Y axis.\n"
  4667. "Useful for auto-leveling.\n"
  4668. "A value of 0 means no segmentation on the Y axis.")
  4669. )
  4670. self.segy_entry = FCDoubleSpinner()
  4671. self.segy_entry.set_range(0, 99999)
  4672. self.segy_entry.set_precision(self.decimals)
  4673. self.segy_entry.setSingleStep(0.1)
  4674. self.segy_entry.setWrapping(True)
  4675. grid1.addWidget(segy_label, 11, 0)
  4676. grid1.addWidget(self.segy_entry, 11, 1)
  4677. self.layout.addStretch()
  4678. class GeometryEditorPrefGroupUI(OptionsGroupUI):
  4679. def __init__(self, decimals=4, parent=None):
  4680. # OptionsGroupUI.__init__(self, "Gerber Adv. Options Preferences", parent=parent)
  4681. super(GeometryEditorPrefGroupUI, self).__init__(self)
  4682. self.setTitle(str(_("Geometry Editor")))
  4683. self.decimals = decimals
  4684. # Advanced Geometry Parameters
  4685. self.param_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  4686. self.param_label.setToolTip(
  4687. _("A list of Geometry Editor parameters.")
  4688. )
  4689. self.layout.addWidget(self.param_label)
  4690. grid0 = QtWidgets.QGridLayout()
  4691. self.layout.addLayout(grid0)
  4692. # Selection Limit
  4693. self.sel_limit_label = QtWidgets.QLabel('%s:' % _("Selection limit"))
  4694. self.sel_limit_label.setToolTip(
  4695. _("Set the number of selected geometry\n"
  4696. "items above which the utility geometry\n"
  4697. "becomes just a selection rectangle.\n"
  4698. "Increases the performance when moving a\n"
  4699. "large number of geometric elements.")
  4700. )
  4701. self.sel_limit_entry = FCSpinner()
  4702. self.sel_limit_entry.set_range(0, 9999)
  4703. grid0.addWidget(self.sel_limit_label, 0, 0)
  4704. grid0.addWidget(self.sel_limit_entry, 0, 1)
  4705. # Milling Type
  4706. milling_type_label = QtWidgets.QLabel('%s:' % _('Milling Type'))
  4707. milling_type_label.setToolTip(
  4708. _("Milling type:\n"
  4709. "- climb / best for precision milling and to reduce tool usage\n"
  4710. "- conventional / useful when there is no backlash compensation")
  4711. )
  4712. self.milling_type_radio = RadioSet([{'label': _('Climb'), 'value': 'cl'},
  4713. {'label': _('Conventional'), 'value': 'cv'}])
  4714. grid0.addWidget(milling_type_label, 1, 0)
  4715. grid0.addWidget(self.milling_type_radio, 1, 1)
  4716. self.layout.addStretch()
  4717. class CNCJobGenPrefGroupUI(OptionsGroupUI):
  4718. def __init__(self, decimals=4, parent=None):
  4719. # OptionsGroupUI.__init__(self, "CNC Job General Preferences", parent=None)
  4720. super(CNCJobGenPrefGroupUI, self).__init__(self)
  4721. self.setTitle(str(_("CNC Job General")))
  4722. self.decimals = decimals
  4723. # ## Plot options
  4724. self.plot_options_label = QtWidgets.QLabel("<b>%s:</b>" % _("Plot Options"))
  4725. self.layout.addWidget(self.plot_options_label)
  4726. grid0 = QtWidgets.QGridLayout()
  4727. self.layout.addLayout(grid0)
  4728. grid0.setColumnStretch(0, 0)
  4729. grid0.setColumnStretch(1, 1)
  4730. # Plot CB
  4731. # self.plot_cb = QtWidgets.QCheckBox('Plot')
  4732. self.plot_cb = FCCheckBox(_('Plot Object'))
  4733. self.plot_cb.setToolTip(_("Plot (show) this object."))
  4734. grid0.addWidget(self.plot_cb, 0, 0, 1, 2)
  4735. # Plot Kind
  4736. self.cncplot_method_label = QtWidgets.QLabel('%s:' % _("Plot kind"))
  4737. self.cncplot_method_label.setToolTip(
  4738. _("This selects the kind of geometries on the canvas to plot.\n"
  4739. "Those can be either of type 'Travel' which means the moves\n"
  4740. "above the work piece or it can be of type 'Cut',\n"
  4741. "which means the moves that cut into the material.")
  4742. )
  4743. self.cncplot_method_radio = RadioSet([
  4744. {"label": _("All"), "value": "all"},
  4745. {"label": _("Travel"), "value": "travel"},
  4746. {"label": _("Cut"), "value": "cut"}
  4747. ], orientation='vertical')
  4748. grid0.addWidget(self.cncplot_method_label, 1, 0)
  4749. grid0.addWidget(self.cncplot_method_radio, 1, 1)
  4750. grid0.addWidget(QtWidgets.QLabel(''), 1, 2)
  4751. # Display Annotation
  4752. self.annotation_cb = FCCheckBox(_("Display Annotation"))
  4753. self.annotation_cb.setToolTip(
  4754. _("This selects if to display text annotation on the plot.\n"
  4755. "When checked it will display numbers in order for each end\n"
  4756. "of a travel line."
  4757. )
  4758. )
  4759. grid0.addWidget(self.annotation_cb, 2, 0, 1, 3)
  4760. # ###################################################################
  4761. # Number of circle steps for circular aperture linear approximation #
  4762. # ###################################################################
  4763. self.steps_per_circle_label = QtWidgets.QLabel('%s:' % _("Circle Steps"))
  4764. self.steps_per_circle_label.setToolTip(
  4765. _("The number of circle steps for <b>GCode</b> \n"
  4766. "circle and arc shapes linear approximation.")
  4767. )
  4768. grid0.addWidget(self.steps_per_circle_label, 3, 0)
  4769. self.steps_per_circle_entry = FCSpinner()
  4770. self.steps_per_circle_entry.set_range(0, 99999)
  4771. grid0.addWidget(self.steps_per_circle_entry, 3, 1)
  4772. # Tool dia for plot
  4773. tdlabel = QtWidgets.QLabel('%s:' % _('Travel dia'))
  4774. tdlabel.setToolTip(
  4775. _("The width of the travel lines to be\n"
  4776. "rendered in the plot.")
  4777. )
  4778. self.tooldia_entry = FCDoubleSpinner()
  4779. self.tooldia_entry.set_range(0, 99999)
  4780. self.tooldia_entry.set_precision(self.decimals)
  4781. self.tooldia_entry.setSingleStep(0.1)
  4782. self.tooldia_entry.setWrapping(True)
  4783. grid0.addWidget(tdlabel, 4, 0)
  4784. grid0.addWidget(self.tooldia_entry, 4, 1)
  4785. # add a space
  4786. grid0.addWidget(QtWidgets.QLabel('<b>%s:</b>' % _("G-code Decimals")), 5, 0, 1, 2)
  4787. # Number of decimals to use in GCODE coordinates
  4788. cdeclabel = QtWidgets.QLabel('%s:' % _('Coordinates'))
  4789. cdeclabel.setToolTip(
  4790. _("The number of decimals to be used for \n"
  4791. "the X, Y, Z coordinates in CNC code (GCODE, etc.)")
  4792. )
  4793. self.coords_dec_entry = FCSpinner()
  4794. self.coords_dec_entry.set_range(0, 9)
  4795. self.coords_dec_entry.setWrapping(True)
  4796. grid0.addWidget(cdeclabel, 6, 0)
  4797. grid0.addWidget(self.coords_dec_entry, 6, 1)
  4798. # Number of decimals to use in GCODE feedrate
  4799. frdeclabel = QtWidgets.QLabel('%s:' % _('Feedrate'))
  4800. frdeclabel.setToolTip(
  4801. _("The number of decimals to be used for \n"
  4802. "the Feedrate parameter in CNC code (GCODE, etc.)")
  4803. )
  4804. self.fr_dec_entry = FCSpinner()
  4805. self.fr_dec_entry.set_range(0, 9)
  4806. self.fr_dec_entry.setWrapping(True)
  4807. grid0.addWidget(frdeclabel, 7, 0)
  4808. grid0.addWidget(self.fr_dec_entry, 7, 1)
  4809. # The type of coordinates used in the Gcode: Absolute or Incremental
  4810. coords_type_label = QtWidgets.QLabel('%s:' % _('Coordinates type'))
  4811. coords_type_label.setToolTip(
  4812. _("The type of coordinates to be used in Gcode.\n"
  4813. "Can be:\n"
  4814. "- Absolute G90 -> the reference is the origin x=0, y=0\n"
  4815. "- Incremental G91 -> the reference is the previous position")
  4816. )
  4817. self.coords_type_radio = RadioSet([
  4818. {"label": _("Absolute G90"), "value": "G90"},
  4819. {"label": _("Incremental G91"), "value": "G91"}
  4820. ], orientation='vertical', stretch=False)
  4821. grid0.addWidget(coords_type_label, 8, 0)
  4822. grid0.addWidget(self.coords_type_radio, 8, 1)
  4823. # hidden for the time being, until implemented
  4824. coords_type_label.hide()
  4825. self.coords_type_radio.hide()
  4826. # Line Endings
  4827. self.line_ending_cb = FCCheckBox(_("Force Windows style line-ending"))
  4828. self.line_ending_cb.setToolTip(
  4829. _("When checked will force a Windows style line-ending\n"
  4830. "(\\r\\n) on non-Windows OS's.")
  4831. )
  4832. grid0.addWidget(self.line_ending_cb, 9, 0, 1, 3)
  4833. separator_line = QtWidgets.QFrame()
  4834. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  4835. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  4836. grid0.addWidget(separator_line, 12, 0, 1, 2)
  4837. # Travel Line Color
  4838. self.travel_color_label = QtWidgets.QLabel('<b>%s</b>' % _('Travel Line Color'))
  4839. grid0.addWidget(self.travel_color_label, 13, 0, 1, 2)
  4840. # Plot Line Color
  4841. self.tline_color_label = QtWidgets.QLabel('%s:' % _('Outline'))
  4842. self.tline_color_label.setToolTip(
  4843. _("Set the travel line color for plotted objects.")
  4844. )
  4845. self.tline_color_entry = FCEntry()
  4846. self.tline_color_button = QtWidgets.QPushButton()
  4847. self.tline_color_button.setFixedSize(15, 15)
  4848. self.form_box_child_2 = QtWidgets.QHBoxLayout()
  4849. self.form_box_child_2.addWidget(self.tline_color_entry)
  4850. self.form_box_child_2.addWidget(self.tline_color_button)
  4851. self.form_box_child_2.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  4852. grid0.addWidget(self.tline_color_label, 14, 0)
  4853. grid0.addLayout(self.form_box_child_2, 14, 1)
  4854. # Plot Fill Color
  4855. self.tfill_color_label = QtWidgets.QLabel('%s:' % _('Fill'))
  4856. self.tfill_color_label.setToolTip(
  4857. _("Set the fill color for plotted objects.\n"
  4858. "First 6 digits are the color and the last 2\n"
  4859. "digits are for alpha (transparency) level.")
  4860. )
  4861. self.tfill_color_entry = FCEntry()
  4862. self.tfill_color_button = QtWidgets.QPushButton()
  4863. self.tfill_color_button.setFixedSize(15, 15)
  4864. self.form_box_child_1 = QtWidgets.QHBoxLayout()
  4865. self.form_box_child_1.addWidget(self.tfill_color_entry)
  4866. self.form_box_child_1.addWidget(self.tfill_color_button)
  4867. self.form_box_child_1.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  4868. grid0.addWidget(self.tfill_color_label, 15, 0)
  4869. grid0.addLayout(self.form_box_child_1, 15, 1)
  4870. # Plot Fill Transparency Level
  4871. self.alpha_label = QtWidgets.QLabel('%s:' % _('Alpha'))
  4872. self.alpha_label.setToolTip(
  4873. _("Set the fill transparency for plotted objects.")
  4874. )
  4875. self.tcolor_alpha_slider = QtWidgets.QSlider(QtCore.Qt.Horizontal)
  4876. self.tcolor_alpha_slider.setMinimum(0)
  4877. self.tcolor_alpha_slider.setMaximum(255)
  4878. self.tcolor_alpha_slider.setSingleStep(1)
  4879. self.tcolor_alpha_spinner = FCSpinner()
  4880. self.tcolor_alpha_spinner.setMinimumWidth(70)
  4881. self.tcolor_alpha_spinner.set_range(0, 255)
  4882. self.form_box_child_3 = QtWidgets.QHBoxLayout()
  4883. self.form_box_child_3.addWidget(self.tcolor_alpha_slider)
  4884. self.form_box_child_3.addWidget(self.tcolor_alpha_spinner)
  4885. grid0.addWidget(self.alpha_label, 16, 0)
  4886. grid0.addLayout(self.form_box_child_3, 16, 1)
  4887. separator_line = QtWidgets.QFrame()
  4888. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  4889. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  4890. grid0.addWidget(separator_line, 17, 0, 1, 2)
  4891. # CNCJob Object Color
  4892. self.cnc_color_label = QtWidgets.QLabel('<b>%s</b>' % _('CNCJob Object Color'))
  4893. grid0.addWidget(self.cnc_color_label, 18, 0, 1, 2)
  4894. # Plot Line Color
  4895. self.line_color_label = QtWidgets.QLabel('%s:' % _('Outline'))
  4896. self.line_color_label.setToolTip(
  4897. _("Set the color for plotted objects.")
  4898. )
  4899. self.line_color_entry = FCEntry()
  4900. self.line_color_button = QtWidgets.QPushButton()
  4901. self.line_color_button.setFixedSize(15, 15)
  4902. self.form_box_child_2 = QtWidgets.QHBoxLayout()
  4903. self.form_box_child_2.addWidget(self.line_color_entry)
  4904. self.form_box_child_2.addWidget(self.line_color_button)
  4905. self.form_box_child_2.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  4906. grid0.addWidget(self.line_color_label, 19, 0)
  4907. grid0.addLayout(self.form_box_child_2, 19, 1)
  4908. # Plot Fill Color
  4909. self.fill_color_label = QtWidgets.QLabel('%s:' % _('Fill'))
  4910. self.fill_color_label.setToolTip(
  4911. _("Set the fill color for plotted objects.\n"
  4912. "First 6 digits are the color and the last 2\n"
  4913. "digits are for alpha (transparency) level.")
  4914. )
  4915. self.fill_color_entry = FCEntry()
  4916. self.fill_color_button = QtWidgets.QPushButton()
  4917. self.fill_color_button.setFixedSize(15, 15)
  4918. self.form_box_child_1 = QtWidgets.QHBoxLayout()
  4919. self.form_box_child_1.addWidget(self.fill_color_entry)
  4920. self.form_box_child_1.addWidget(self.fill_color_button)
  4921. self.form_box_child_1.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  4922. grid0.addWidget(self.fill_color_label, 20, 0)
  4923. grid0.addLayout(self.form_box_child_1, 20, 1)
  4924. self.layout.addStretch()
  4925. # Setting plot colors signals
  4926. self.tline_color_entry.editingFinished.connect(self.on_tline_color_entry)
  4927. self.tline_color_button.clicked.connect(self.on_tline_color_button)
  4928. self.tfill_color_entry.editingFinished.connect(self.on_tfill_color_entry)
  4929. self.tfill_color_button.clicked.connect(self.on_tfill_color_button)
  4930. self.tcolor_alpha_spinner.valueChanged.connect(self.on_tcolor_spinner)
  4931. self.tcolor_alpha_slider.valueChanged.connect(self.on_tcolor_slider)
  4932. self.line_color_entry.editingFinished.connect(self.on_line_color_entry)
  4933. self.line_color_button.clicked.connect(self.on_line_color_button)
  4934. self.fill_color_entry.editingFinished.connect(self.on_fill_color_entry)
  4935. self.fill_color_button.clicked.connect(self.on_fill_color_button)
  4936. # ------------------------------------------------------
  4937. # Setting travel colors handlers
  4938. # ------------------------------------------------------
  4939. def on_tfill_color_entry(self):
  4940. self.app.defaults['cncjob_travel_fill'] = self.tfill_color_entry.get_value()[:7] + \
  4941. self.app.defaults['cncjob_travel_fill'][7:9]
  4942. self.tfill_color_button.setStyleSheet(
  4943. "background-color:%s" % str(self.app.defaults['cncjob_travel_fill'])[:7])
  4944. def on_tfill_color_button(self):
  4945. current_color = QtGui.QColor(self.app.defaults['cncjob_travel_fill'][:7])
  4946. c_dialog = QtWidgets.QColorDialog()
  4947. plot_fill_color = c_dialog.getColor(initial=current_color)
  4948. if plot_fill_color.isValid() is False:
  4949. return
  4950. self.tfill_color_button.setStyleSheet("background-color:%s" % str(plot_fill_color.name()))
  4951. new_val = str(plot_fill_color.name()) + str(self.app.defaults['cncjob_travel_fill'][7:9])
  4952. self.tfill_color_entry.set_value(new_val)
  4953. self.app.defaults['cncjob_travel_fill'] = new_val
  4954. def on_tcolor_spinner(self):
  4955. spinner_value = self.tcolor_alpha_spinner.value()
  4956. self.tcolor_alpha_slider.setValue(spinner_value)
  4957. self.app.defaults['cncjob_travel_fill'] = \
  4958. self.app.defaults['cncjob_travel_fill'][:7] + \
  4959. (hex(spinner_value)[2:] if int(hex(spinner_value)[2:], 16) > 0 else '00')
  4960. self.app.defaults['cncjob_travel_line'] = \
  4961. self.app.defaults['cncjob_travel_line'][:7] + \
  4962. (hex(spinner_value)[2:] if int(hex(spinner_value)[2:], 16) > 0 else '00')
  4963. def on_tcolor_slider(self):
  4964. slider_value = self.tcolor_alpha_slider.value()
  4965. self.tcolor_alpha_spinner.setValue(slider_value)
  4966. def on_tline_color_entry(self):
  4967. self.app.defaults['cncjob_travel_line'] = self.tline_color_entry.get_value()[:7] + \
  4968. self.app.defaults['cncjob_travel_line'][7:9]
  4969. self.tline_color_button.setStyleSheet(
  4970. "background-color:%s" % str(self.app.defaults['cncjob_travel_line'])[:7])
  4971. def on_tline_color_button(self):
  4972. current_color = QtGui.QColor(self.app.defaults['cncjob_travel_line'][:7])
  4973. # print(current_color)
  4974. c_dialog = QtWidgets.QColorDialog()
  4975. plot_line_color = c_dialog.getColor(initial=current_color)
  4976. if plot_line_color.isValid() is False:
  4977. return
  4978. self.tline_color_button.setStyleSheet("background-color:%s" % str(plot_line_color.name()))
  4979. new_val_line = str(plot_line_color.name()) + str(self.app.defaults['cncjob_travel_line'][7:9])
  4980. self.tline_color_entry.set_value(new_val_line)
  4981. self.app.defaults['cncjob_travel_line'] = new_val_line
  4982. # ------------------------------------------------------
  4983. # Setting plot colors handlers
  4984. # ------------------------------------------------------
  4985. def on_fill_color_entry(self):
  4986. self.app.defaults['cncjob_plot_fill'] = self.fill_color_entry.get_value()[:7] + \
  4987. self.app.defaults['cncjob_plot_fill'][7:9]
  4988. self.fill_color_button.setStyleSheet(
  4989. "background-color:%s" % str(self.app.defaults['cncjob_plot_fill'])[:7])
  4990. def on_fill_color_button(self):
  4991. current_color = QtGui.QColor(self.app.defaults['cncjob_plot_fill'][:7])
  4992. c_dialog = QtWidgets.QColorDialog()
  4993. plot_fill_color = c_dialog.getColor(initial=current_color)
  4994. if plot_fill_color.isValid() is False:
  4995. return
  4996. self.fill_color_button.setStyleSheet("background-color:%s" % str(plot_fill_color.name()))
  4997. new_val = str(plot_fill_color.name()) + str(self.app.defaults['cncjob_plot_fill'][7:9])
  4998. self.fill_color_entry.set_value(new_val)
  4999. self.app.defaults['cncjob_plot_fill'] = new_val
  5000. def on_line_color_entry(self):
  5001. self.app.defaults['cncjob_plot_line'] = self.line_color_entry.get_value()[:7] + \
  5002. self.app.defaults['cncjob_plot_line'][7:9]
  5003. self.line_color_button.setStyleSheet(
  5004. "background-color:%s" % str(self.app.defaults['cncjob_plot_line'])[:7])
  5005. def on_line_color_button(self):
  5006. current_color = QtGui.QColor(self.app.defaults['cncjob_plot_line'][:7])
  5007. # print(current_color)
  5008. c_dialog = QtWidgets.QColorDialog()
  5009. plot_line_color = c_dialog.getColor(initial=current_color)
  5010. if plot_line_color.isValid() is False:
  5011. return
  5012. self.line_color_button.setStyleSheet("background-color:%s" % str(plot_line_color.name()))
  5013. new_val_line = str(plot_line_color.name()) + str(self.app.defaults['cncjob_plot_line'][7:9])
  5014. self.line_color_entry.set_value(new_val_line)
  5015. self.app.defaults['cncjob_plot_line'] = new_val_line
  5016. class CNCJobOptPrefGroupUI(OptionsGroupUI):
  5017. def __init__(self, decimals=4, parent=None):
  5018. # OptionsGroupUI.__init__(self, "CNC Job Options Preferences", parent=None)
  5019. super(CNCJobOptPrefGroupUI, self).__init__(self)
  5020. self.setTitle(str(_("CNC Job Options")))
  5021. self.decimals = decimals
  5022. # ## Export G-Code
  5023. self.export_gcode_label = QtWidgets.QLabel("<b>%s:</b>" % _("Export G-Code"))
  5024. self.export_gcode_label.setToolTip(
  5025. _("Export and save G-Code to\n"
  5026. "make this object to a file.")
  5027. )
  5028. self.layout.addWidget(self.export_gcode_label)
  5029. qsettings = QSettings("Open Source", "FlatCAM")
  5030. if qsettings.contains("textbox_font_size"):
  5031. tb_fsize = qsettings.value('textbox_font_size', type=int)
  5032. else:
  5033. tb_fsize = 10
  5034. font = QtGui.QFont()
  5035. font.setPointSize(tb_fsize)
  5036. # Prepend to G-Code
  5037. prependlabel = QtWidgets.QLabel('%s:' % _('Prepend to G-Code'))
  5038. prependlabel.setToolTip(
  5039. _("Type here any G-Code commands you would\n"
  5040. "like to add at the beginning of the G-Code file.")
  5041. )
  5042. self.layout.addWidget(prependlabel)
  5043. self.prepend_text = FCTextArea()
  5044. self.prepend_text.setPlaceholderText(
  5045. _("Type here any G-Code commands you would "
  5046. "like to add at the beginning of the G-Code file.")
  5047. )
  5048. self.layout.addWidget(self.prepend_text)
  5049. self.prepend_text.setFont(font)
  5050. # Append text to G-Code
  5051. appendlabel = QtWidgets.QLabel('%s:' % _('Append to G-Code'))
  5052. appendlabel.setToolTip(
  5053. _("Type here any G-Code commands you would\n"
  5054. "like to append to the generated file.\n"
  5055. "I.e.: M2 (End of program)")
  5056. )
  5057. self.layout.addWidget(appendlabel)
  5058. self.append_text = FCTextArea()
  5059. self.append_text.setPlaceholderText(
  5060. _("Type here any G-Code commands you would "
  5061. "like to append to the generated file.\n"
  5062. "I.e.: M2 (End of program)")
  5063. )
  5064. self.layout.addWidget(self.append_text)
  5065. self.append_text.setFont(font)
  5066. self.layout.addStretch()
  5067. class CNCJobAdvOptPrefGroupUI(OptionsGroupUI):
  5068. def __init__(self, decimals=4, parent=None):
  5069. # OptionsGroupUI.__init__(self, "CNC Job Advanced Options Preferences", parent=None)
  5070. super(CNCJobAdvOptPrefGroupUI, self).__init__(self)
  5071. self.decimals = decimals
  5072. self.setTitle(str(_("CNC Job Adv. Options")))
  5073. # ## Export G-Code
  5074. self.export_gcode_label = QtWidgets.QLabel("<b>%s:</b>" % _("Export CNC Code"))
  5075. self.export_gcode_label.setToolTip(
  5076. _("Export and save G-Code to\n"
  5077. "make this object to a file.")
  5078. )
  5079. self.layout.addWidget(self.export_gcode_label)
  5080. # Prepend to G-Code
  5081. toolchangelabel = QtWidgets.QLabel('%s' % _('Toolchange G-Code'))
  5082. toolchangelabel.setToolTip(
  5083. _(
  5084. "Type here any G-Code commands you would\n"
  5085. "like to be executed when Toolchange event is encountered.\n"
  5086. "This will constitute a Custom Toolchange GCode,\n"
  5087. "or a Toolchange Macro.\n"
  5088. "The FlatCAM variables are surrounded by '%' symbol.\n\n"
  5089. "WARNING: it can be used only with a preprocessor file\n"
  5090. "that has 'toolchange_custom' in it's name and this is built\n"
  5091. "having as template the 'Toolchange Custom' posprocessor file."
  5092. )
  5093. )
  5094. self.layout.addWidget(toolchangelabel)
  5095. qsettings = QSettings("Open Source", "FlatCAM")
  5096. if qsettings.contains("textbox_font_size"):
  5097. tb_fsize = qsettings.value('textbox_font_size', type=int)
  5098. else:
  5099. tb_fsize = 10
  5100. font = QtGui.QFont()
  5101. font.setPointSize(tb_fsize)
  5102. self.toolchange_text = FCTextArea()
  5103. self.toolchange_text.setPlaceholderText(
  5104. _(
  5105. "Type here any G-Code commands you would "
  5106. "like to be executed when Toolchange event is encountered.\n"
  5107. "This will constitute a Custom Toolchange GCode, "
  5108. "or a Toolchange Macro.\n"
  5109. "The FlatCAM variables are surrounded by '%' symbol.\n"
  5110. "WARNING: it can be used only with a preprocessor file "
  5111. "that has 'toolchange_custom' in it's name."
  5112. )
  5113. )
  5114. self.layout.addWidget(self.toolchange_text)
  5115. self.toolchange_text.setFont(font)
  5116. hlay = QtWidgets.QHBoxLayout()
  5117. self.layout.addLayout(hlay)
  5118. # Toolchange Replacement GCode
  5119. self.toolchange_cb = FCCheckBox(label='%s' % _('Use Toolchange Macro'))
  5120. self.toolchange_cb.setToolTip(
  5121. _("Check this box if you want to use\n"
  5122. "a Custom Toolchange GCode (macro).")
  5123. )
  5124. hlay.addWidget(self.toolchange_cb)
  5125. hlay.addStretch()
  5126. hlay1 = QtWidgets.QHBoxLayout()
  5127. self.layout.addLayout(hlay1)
  5128. # Variable list
  5129. self.tc_variable_combo = FCComboBox()
  5130. self.tc_variable_combo.setToolTip(
  5131. _("A list of the FlatCAM variables that can be used\n"
  5132. "in the Toolchange event.\n"
  5133. "They have to be surrounded by the '%' symbol")
  5134. )
  5135. hlay1.addWidget(self.tc_variable_combo)
  5136. # Populate the Combo Box
  5137. variables = [_('Parameters'), 'tool', 'tooldia', 't_drills', 'x_toolchange', 'y_toolchange', 'z_toolchange',
  5138. 'z_cut', 'z_move', 'z_depthpercut', 'spindlespeed', 'dwelltime']
  5139. self.tc_variable_combo.addItems(variables)
  5140. self.tc_variable_combo.insertSeparator(1)
  5141. self.tc_variable_combo.setItemData(0, _("FlatCAM CNC parameters"), Qt.ToolTipRole)
  5142. fnt = QtGui.QFont()
  5143. fnt.setBold(True)
  5144. self.tc_variable_combo.setItemData(0, fnt, Qt.FontRole)
  5145. self.tc_variable_combo.setItemData(2, 'tool = %s' % _("tool number"), Qt.ToolTipRole)
  5146. self.tc_variable_combo.setItemData(3, 'tooldia = %s' % _("tool diameter"), Qt.ToolTipRole)
  5147. self.tc_variable_combo.setItemData(4, 't_drills = %s' % _("for Excellon, total number of drills"),
  5148. Qt.ToolTipRole)
  5149. self.tc_variable_combo.setItemData(5, 'x_toolchange = %s' % _("X coord for Toolchange"), Qt.ToolTipRole)
  5150. self.tc_variable_combo.setItemData(6, 'y_toolchange = %s' % _("Y coord for Toolchange"),
  5151. Qt.ToolTipRole)
  5152. self.tc_variable_combo.setItemData(7, 'z_toolchange = %s' % _("Z coord for Toolchange"), Qt.ToolTipRole)
  5153. self.tc_variable_combo.setItemData(8, 'z_cut = %s' % _("Z depth for the cut"), Qt.ToolTipRole)
  5154. self.tc_variable_combo.setItemData(9, 'z_move = %s' % _("Z height for travel"), Qt.ToolTipRole)
  5155. self.tc_variable_combo.setItemData(10, 'z_depthpercut = %s' % _("the step value for multidepth cut"),
  5156. Qt.ToolTipRole)
  5157. self.tc_variable_combo.setItemData(11, 'spindlesspeed = %s' % _("the value for the spindle speed"),
  5158. Qt.ToolTipRole)
  5159. self.tc_variable_combo.setItemData(12,
  5160. _("dwelltime = time to dwell to allow the spindle to reach it's set RPM"),
  5161. Qt.ToolTipRole)
  5162. # hlay1.addStretch()
  5163. # Insert Variable into the Toolchange G-Code Text Box
  5164. # self.tc_insert_buton = FCButton("Insert")
  5165. # self.tc_insert_buton.setToolTip(
  5166. # "Insert the variable in the GCode Box\n"
  5167. # "surrounded by the '%' symbol."
  5168. # )
  5169. # hlay1.addWidget(self.tc_insert_buton)
  5170. grid0 = QtWidgets.QGridLayout()
  5171. self.layout.addLayout(grid0)
  5172. grid0.addWidget(QtWidgets.QLabel(''), 1, 0, 1, 2)
  5173. # Annotation Font Size
  5174. self.annotation_fontsize_label = QtWidgets.QLabel('%s:' % _("Annotation Size"))
  5175. self.annotation_fontsize_label.setToolTip(
  5176. _("The font size of the annotation text. In pixels.")
  5177. )
  5178. grid0.addWidget(self.annotation_fontsize_label, 2, 0)
  5179. self.annotation_fontsize_sp = FCSpinner()
  5180. self.annotation_fontsize_sp.set_range(0, 9999)
  5181. grid0.addWidget(self.annotation_fontsize_sp, 2, 1)
  5182. grid0.addWidget(QtWidgets.QLabel(''), 2, 2)
  5183. # Annotation Font Color
  5184. self.annotation_color_label = QtWidgets.QLabel('%s:' % _('Annotation Color'))
  5185. self.annotation_color_label.setToolTip(
  5186. _("Set the font color for the annotation texts.")
  5187. )
  5188. self.annotation_fontcolor_entry = FCEntry()
  5189. self.annotation_fontcolor_button = QtWidgets.QPushButton()
  5190. self.annotation_fontcolor_button.setFixedSize(15, 15)
  5191. self.form_box_child = QtWidgets.QHBoxLayout()
  5192. self.form_box_child.setContentsMargins(0, 0, 0, 0)
  5193. self.form_box_child.addWidget(self.annotation_fontcolor_entry)
  5194. self.form_box_child.addWidget(self.annotation_fontcolor_button, alignment=Qt.AlignRight)
  5195. self.form_box_child.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  5196. color_widget = QtWidgets.QWidget()
  5197. color_widget.setLayout(self.form_box_child)
  5198. grid0.addWidget(self.annotation_color_label, 3, 0)
  5199. grid0.addWidget(color_widget, 3, 1)
  5200. grid0.addWidget(QtWidgets.QLabel(''), 3, 2)
  5201. self.layout.addStretch()
  5202. self.tc_variable_combo.currentIndexChanged[str].connect(self.on_cnc_custom_parameters)
  5203. self.annotation_fontcolor_entry.editingFinished.connect(self.on_annotation_fontcolor_entry)
  5204. self.annotation_fontcolor_button.clicked.connect(self.on_annotation_fontcolor_button)
  5205. def on_cnc_custom_parameters(self, signal_text):
  5206. if signal_text == 'Parameters':
  5207. return
  5208. else:
  5209. self.toolchange_text.insertPlainText('%%%s%%' % signal_text)
  5210. def on_annotation_fontcolor_entry(self):
  5211. self.app.defaults['cncjob_annotation_fontcolor'] = self.annotation_fontcolor_entry.get_value()
  5212. self.annotation_fontcolor_button.setStyleSheet(
  5213. "background-color:%s" % str(self.app.defaults['cncjob_annotation_fontcolor']))
  5214. def on_annotation_fontcolor_button(self):
  5215. current_color = QtGui.QColor(self.app.defaults['cncjob_annotation_fontcolor'])
  5216. c_dialog = QtWidgets.QColorDialog()
  5217. annotation_color = c_dialog.getColor(initial=current_color)
  5218. if annotation_color.isValid() is False:
  5219. return
  5220. self.annotation_fontcolor_button.setStyleSheet("background-color:%s" % str(annotation_color.name()))
  5221. new_val_sel = str(annotation_color.name())
  5222. self.annotation_fontcolor_entry.set_value(new_val_sel)
  5223. self.app.defaults['cncjob_annotation_fontcolor'] = new_val_sel
  5224. class ToolsNCCPrefGroupUI(OptionsGroupUI):
  5225. def __init__(self, decimals=4, parent=None):
  5226. # OptionsGroupUI.__init__(self, "NCC Tool Options", parent=parent)
  5227. super(ToolsNCCPrefGroupUI, self).__init__(self)
  5228. self.setTitle(str(_("NCC Tool Options")))
  5229. self.decimals = decimals
  5230. # ## Clear non-copper regions
  5231. self.clearcopper_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  5232. self.clearcopper_label.setToolTip(
  5233. _("Create a Geometry object with\n"
  5234. "toolpaths to cut all non-copper regions.")
  5235. )
  5236. self.layout.addWidget(self.clearcopper_label)
  5237. grid0 = QtWidgets.QGridLayout()
  5238. self.layout.addLayout(grid0)
  5239. ncctdlabel = QtWidgets.QLabel('<b><font color="green">%s:</font></b>' % _('Tools Dia'))
  5240. ncctdlabel.setToolTip(
  5241. _("Diameters of the tools, separated by comma.\n"
  5242. "The value of the diameter has to use the dot decimals separator.\n"
  5243. "Valid values: 0.3, 1.0")
  5244. )
  5245. grid0.addWidget(ncctdlabel, 0, 0)
  5246. self.ncc_tool_dia_entry = FCEntry(border_color='#0069A9')
  5247. self.ncc_tool_dia_entry.setPlaceholderText(_("Comma separated values"))
  5248. grid0.addWidget(self.ncc_tool_dia_entry, 0, 1)
  5249. # Tool Type Radio Button
  5250. self.tool_type_label = QtWidgets.QLabel('%s:' % _('Tool Type'))
  5251. self.tool_type_label.setToolTip(
  5252. _("Default tool type:\n"
  5253. "- 'V-shape'\n"
  5254. "- Circular")
  5255. )
  5256. self.tool_type_radio = RadioSet([{'label': _('V-shape'), 'value': 'V'},
  5257. {'label': _('Circular'), 'value': 'C1'}])
  5258. self.tool_type_radio.setToolTip(
  5259. _("Default tool type:\n"
  5260. "- 'V-shape'\n"
  5261. "- Circular")
  5262. )
  5263. grid0.addWidget(self.tool_type_label, 1, 0)
  5264. grid0.addWidget(self.tool_type_radio, 1, 1)
  5265. # Tip Dia
  5266. self.tipdialabel = QtWidgets.QLabel('%s:' % _('V-Tip Dia'))
  5267. self.tipdialabel.setToolTip(
  5268. _("The tip diameter for V-Shape Tool"))
  5269. self.tipdia_entry = FCDoubleSpinner()
  5270. self.tipdia_entry.set_precision(self.decimals)
  5271. self.tipdia_entry.set_range(0, 1000)
  5272. self.tipdia_entry.setSingleStep(0.1)
  5273. grid0.addWidget(self.tipdialabel, 2, 0)
  5274. grid0.addWidget(self.tipdia_entry, 2, 1)
  5275. # Tip Angle
  5276. self.tipanglelabel = QtWidgets.QLabel('%s:' % _('V-Tip Angle'))
  5277. self.tipanglelabel.setToolTip(
  5278. _("The tip angle for V-Shape Tool.\n"
  5279. "In degree."))
  5280. self.tipangle_entry = FCDoubleSpinner()
  5281. self.tipangle_entry.set_precision(self.decimals)
  5282. self.tipangle_entry.set_range(1, 180)
  5283. self.tipangle_entry.setSingleStep(5)
  5284. self.tipangle_entry.setWrapping(True)
  5285. grid0.addWidget(self.tipanglelabel, 3, 0)
  5286. grid0.addWidget(self.tipangle_entry, 3, 1)
  5287. # Cut Z entry
  5288. cutzlabel = QtWidgets.QLabel('%s:' % _('Cut Z'))
  5289. cutzlabel.setToolTip(
  5290. _("Depth of cut into material. Negative value.\n"
  5291. "In FlatCAM units.")
  5292. )
  5293. self.cutz_entry = FCDoubleSpinner()
  5294. self.cutz_entry.set_precision(self.decimals)
  5295. self.cutz_entry.set_range(-9999.9999, 0.0000)
  5296. self.cutz_entry.setSingleStep(0.1)
  5297. self.cutz_entry.setToolTip(
  5298. _("Depth of cut into material. Negative value.\n"
  5299. "In FlatCAM units.")
  5300. )
  5301. grid0.addWidget(cutzlabel, 4, 0)
  5302. grid0.addWidget(self.cutz_entry, 4, 1)
  5303. # New Diameter
  5304. self.newdialabel = QtWidgets.QLabel('%s:' % _('New Dia'))
  5305. self.newdialabel.setToolTip(
  5306. _("Diameter for the new tool to add in the Tool Table.\n"
  5307. "If the tool is V-shape type then this value is automatically\n"
  5308. "calculated from the other parameters.")
  5309. )
  5310. self.newdia_entry = FCDoubleSpinner()
  5311. self.newdia_entry.set_precision(self.decimals)
  5312. self.newdia_entry.set_range(0.0001, 9999.9999)
  5313. self.newdia_entry.setSingleStep(0.1)
  5314. grid0.addWidget(self.newdialabel, 5, 0)
  5315. grid0.addWidget(self.newdia_entry, 5, 1)
  5316. separator_line = QtWidgets.QFrame()
  5317. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  5318. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  5319. grid0.addWidget(separator_line, 6, 0, 1, 2)
  5320. # Milling Type Radio Button
  5321. self.milling_type_label = QtWidgets.QLabel('%s:' % _('Milling Type'))
  5322. self.milling_type_label.setToolTip(
  5323. _("Milling type when the selected tool is of type: 'iso_op':\n"
  5324. "- climb / best for precision milling and to reduce tool usage\n"
  5325. "- conventional / useful when there is no backlash compensation")
  5326. )
  5327. self.milling_type_radio = RadioSet([{'label': _('Climb'), 'value': 'cl'},
  5328. {'label': _('Conventional'), 'value': 'cv'}])
  5329. self.milling_type_radio.setToolTip(
  5330. _("Milling type when the selected tool is of type: 'iso_op':\n"
  5331. "- climb / best for precision milling and to reduce tool usage\n"
  5332. "- conventional / useful when there is no backlash compensation")
  5333. )
  5334. grid0.addWidget(self.milling_type_label, 7, 0)
  5335. grid0.addWidget(self.milling_type_radio, 7, 1)
  5336. # Tool order Radio Button
  5337. self.ncc_order_label = QtWidgets.QLabel('%s:' % _('Tool order'))
  5338. self.ncc_order_label.setToolTip(_("This set the way that the tools in the tools table are used.\n"
  5339. "'No' --> means that the used order is the one in the tool table\n"
  5340. "'Forward' --> means that the tools will be ordered from small to big\n"
  5341. "'Reverse' --> menas that the tools will ordered from big to small\n\n"
  5342. "WARNING: using rest machining will automatically set the order\n"
  5343. "in reverse and disable this control."))
  5344. self.ncc_order_radio = RadioSet([{'label': _('No'), 'value': 'no'},
  5345. {'label': _('Forward'), 'value': 'fwd'},
  5346. {'label': _('Reverse'), 'value': 'rev'}])
  5347. self.ncc_order_radio.setToolTip(_("This set the way that the tools in the tools table are used.\n"
  5348. "'No' --> means that the used order is the one in the tool table\n"
  5349. "'Forward' --> means that the tools will be ordered from small to big\n"
  5350. "'Reverse' --> menas that the tools will ordered from big to small\n\n"
  5351. "WARNING: using rest machining will automatically set the order\n"
  5352. "in reverse and disable this control."))
  5353. grid0.addWidget(self.ncc_order_label, 8, 0)
  5354. grid0.addWidget(self.ncc_order_radio, 8, 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, 9, 0, 1, 2)
  5359. # Overlap Entry
  5360. nccoverlabel = QtWidgets.QLabel('%s:' % _('Overlap'))
  5361. nccoverlabel.setToolTip(
  5362. _("How much (percentage) of the tool width to overlap each tool pass.\n"
  5363. "Adjust the value starting with lower values\n"
  5364. "and increasing it if areas that should be cleared are still \n"
  5365. "not cleared.\n"
  5366. "Lower values = faster processing, faster execution on CNC.\n"
  5367. "Higher values = slow processing and slow execution on CNC\n"
  5368. "due of too many paths.")
  5369. )
  5370. self.ncc_overlap_entry = FCDoubleSpinner(suffix='%')
  5371. self.ncc_overlap_entry.set_precision(self.decimals)
  5372. self.ncc_overlap_entry.setWrapping(True)
  5373. self.ncc_overlap_entry.setRange(0.0000, 99.9999)
  5374. self.ncc_overlap_entry.setSingleStep(0.1)
  5375. grid0.addWidget(nccoverlabel, 10, 0)
  5376. grid0.addWidget(self.ncc_overlap_entry, 10, 1)
  5377. # Margin entry
  5378. nccmarginlabel = QtWidgets.QLabel('%s:' % _('Margin'))
  5379. nccmarginlabel.setToolTip(
  5380. _("Bounding box margin.")
  5381. )
  5382. self.ncc_margin_entry = FCDoubleSpinner()
  5383. self.ncc_margin_entry.set_precision(self.decimals)
  5384. self.ncc_margin_entry.set_range(-10000, 10000)
  5385. self.ncc_margin_entry.setSingleStep(0.1)
  5386. grid0.addWidget(nccmarginlabel, 11, 0)
  5387. grid0.addWidget(self.ncc_margin_entry, 11, 1)
  5388. # Method
  5389. methodlabel = QtWidgets.QLabel('%s:' % _('Method'))
  5390. methodlabel.setToolTip(
  5391. _("Algorithm for copper clearing:\n"
  5392. "- Standard: Fixed step inwards.\n"
  5393. "- Seed-based: Outwards from seed.\n"
  5394. "- Line-based: Parallel lines.")
  5395. )
  5396. # self.ncc_method_radio = RadioSet([
  5397. # {"label": _("Standard"), "value": "standard"},
  5398. # {"label": _("Seed-based"), "value": "seed"},
  5399. # {"label": _("Straight lines"), "value": "lines"}
  5400. # ], orientation='vertical', stretch=False)
  5401. self.ncc_method_combo = FCComboBox()
  5402. self.ncc_method_combo.addItems(
  5403. [_("Standard"), _("Seed"), _("Lines")]
  5404. )
  5405. grid0.addWidget(methodlabel, 12, 0)
  5406. grid0.addWidget(self.ncc_method_combo, 12, 1)
  5407. # Connect lines
  5408. self.ncc_connect_cb = FCCheckBox('%s' % _("Connect"))
  5409. self.ncc_connect_cb.setToolTip(
  5410. _("Draw lines between resulting\n"
  5411. "segments to minimize tool lifts.")
  5412. )
  5413. grid0.addWidget(self.ncc_connect_cb, 13, 0)
  5414. # Contour Checkbox
  5415. self.ncc_contour_cb = FCCheckBox('%s' % _("Contour"))
  5416. self.ncc_contour_cb.setToolTip(
  5417. _("Cut around the perimeter of the polygon\n"
  5418. "to trim rough edges.")
  5419. )
  5420. grid0.addWidget(self.ncc_contour_cb, 13, 1)
  5421. # ## NCC Offset choice
  5422. self.ncc_choice_offset_cb = FCCheckBox('%s' % _("Offset"))
  5423. self.ncc_choice_offset_cb.setToolTip(
  5424. _("If used, it will add an offset to the copper features.\n"
  5425. "The copper clearing will finish to a distance\n"
  5426. "from the copper features.\n"
  5427. "The value can be between 0 and 10 FlatCAM units.")
  5428. )
  5429. grid0.addWidget(self.ncc_choice_offset_cb, 14, 0, 1, 2)
  5430. # ## NCC Offset value
  5431. self.ncc_offset_label = QtWidgets.QLabel('%s:' % _("Offset value"))
  5432. self.ncc_offset_label.setToolTip(
  5433. _("If used, it will add an offset to the copper features.\n"
  5434. "The copper clearing will finish to a distance\n"
  5435. "from the copper features.\n"
  5436. "The value can be between 0.0 and 9999.9 FlatCAM units.")
  5437. )
  5438. self.ncc_offset_spinner = FCDoubleSpinner()
  5439. self.ncc_offset_spinner.set_range(0.00, 9999.9999)
  5440. self.ncc_offset_spinner.set_precision(self.decimals)
  5441. self.ncc_offset_spinner.setWrapping(True)
  5442. self.ncc_offset_spinner.setSingleStep(0.1)
  5443. grid0.addWidget(self.ncc_offset_label, 15, 0)
  5444. grid0.addWidget(self.ncc_offset_spinner, 15, 1)
  5445. separator_line = QtWidgets.QFrame()
  5446. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  5447. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  5448. grid0.addWidget(separator_line, 16, 0, 1, 2)
  5449. # Rest machining CheckBox
  5450. self.ncc_rest_cb = FCCheckBox('%s' % _("Rest Machining"))
  5451. self.ncc_rest_cb.setToolTip(
  5452. _("If checked, use 'rest machining'.\n"
  5453. "Basically it will clear copper outside PCB features,\n"
  5454. "using the biggest tool and continue with the next tools,\n"
  5455. "from bigger to smaller, to clear areas of copper that\n"
  5456. "could not be cleared by previous tool, until there is\n"
  5457. "no more copper to clear or there are no more tools.\n"
  5458. "If not checked, use the standard algorithm.")
  5459. )
  5460. grid0.addWidget(self.ncc_rest_cb, 17, 0, 1, 2)
  5461. # ## Reference
  5462. # self.reference_radio = RadioSet([{'label': _('Itself'), 'value': 'itself'},
  5463. # {"label": _("Area Selection"), "value": "area"},
  5464. # {'label': _('Reference Object'), 'value': 'box'}],
  5465. # orientation='vertical',
  5466. # stretch=None)
  5467. self.select_combo = FCComboBox()
  5468. self.select_combo.addItems(
  5469. [_("Itself"), _("Area Selection"), _("Reference Object")]
  5470. )
  5471. select_label = QtWidgets.QLabel('%s:' % _("Selection"))
  5472. select_label.setToolTip(
  5473. _("Selection of area to be processed.\n"
  5474. "- 'Itself' - the processing extent is based on the object that is processed.\n "
  5475. "- 'Area Selection' - left mouse click to start selection of the area to be processed.\n"
  5476. "- 'Reference Object' - will process the area specified by another object.")
  5477. )
  5478. grid0.addWidget(select_label, 18, 0)
  5479. grid0.addWidget(self.select_combo, 18, 1)
  5480. self.area_shape_label = QtWidgets.QLabel('%s:' % _("Shape"))
  5481. self.area_shape_label.setToolTip(
  5482. _("The kind of selection shape used for area selection.")
  5483. )
  5484. self.area_shape_radio = RadioSet([{'label': _("Square"), 'value': 'square'},
  5485. {'label': _("Polygon"), 'value': 'polygon'}])
  5486. grid0.addWidget(self.area_shape_label, 19, 0)
  5487. grid0.addWidget(self.area_shape_radio, 19, 1)
  5488. separator_line = QtWidgets.QFrame()
  5489. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  5490. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  5491. grid0.addWidget(separator_line, 20, 0, 1, 2)
  5492. # ## Plotting type
  5493. self.ncc_plotting_radio = RadioSet([{'label': _('Normal'), 'value': 'normal'},
  5494. {"label": _("Progressive"), "value": "progressive"}])
  5495. plotting_label = QtWidgets.QLabel('%s:' % _("NCC Plotting"))
  5496. plotting_label.setToolTip(
  5497. _("- 'Normal' - normal plotting, done at the end of the NCC job\n"
  5498. "- 'Progressive' - after each shape is generated it will be plotted.")
  5499. )
  5500. grid0.addWidget(plotting_label, 21, 0)
  5501. grid0.addWidget(self.ncc_plotting_radio, 21, 1)
  5502. self.layout.addStretch()
  5503. class ToolsCutoutPrefGroupUI(OptionsGroupUI):
  5504. def __init__(self, decimals=4, parent=None):
  5505. # OptionsGroupUI.__init__(self, "Cutout Tool Options", parent=parent)
  5506. super(ToolsCutoutPrefGroupUI, self).__init__(self)
  5507. self.setTitle(str(_("Cutout Tool Options")))
  5508. self.decimals = decimals
  5509. # ## Board cutout
  5510. self.board_cutout_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  5511. self.board_cutout_label.setToolTip(
  5512. _("Create toolpaths to cut around\n"
  5513. "the PCB and separate it from\n"
  5514. "the original board.")
  5515. )
  5516. self.layout.addWidget(self.board_cutout_label)
  5517. grid0 = QtWidgets.QGridLayout()
  5518. self.layout.addLayout(grid0)
  5519. tdclabel = QtWidgets.QLabel('%s:' % _('Tool Diameter'))
  5520. tdclabel.setToolTip(
  5521. _("Diameter of the tool used to cutout\n"
  5522. "the PCB shape out of the surrounding material.")
  5523. )
  5524. self.cutout_tooldia_entry = FCDoubleSpinner()
  5525. self.cutout_tooldia_entry.set_range(0.000001, 9999.9999)
  5526. self.cutout_tooldia_entry.set_precision(self.decimals)
  5527. self.cutout_tooldia_entry.setSingleStep(0.1)
  5528. grid0.addWidget(tdclabel, 0, 0)
  5529. grid0.addWidget(self.cutout_tooldia_entry, 0, 1)
  5530. # Cut Z
  5531. cutzlabel = QtWidgets.QLabel('%s:' % _('Cut Z'))
  5532. cutzlabel.setToolTip(
  5533. _(
  5534. "Cutting depth (negative)\n"
  5535. "below the copper surface."
  5536. )
  5537. )
  5538. self.cutz_entry = FCDoubleSpinner()
  5539. self.cutz_entry.set_precision(self.decimals)
  5540. if machinist_setting == 0:
  5541. self.cutz_entry.setRange(-9999.9999, 0.0000)
  5542. else:
  5543. self.cutz_entry.setRange(-9999.9999, 9999.9999)
  5544. self.cutz_entry.setSingleStep(0.1)
  5545. grid0.addWidget(cutzlabel, 1, 0)
  5546. grid0.addWidget(self.cutz_entry, 1, 1)
  5547. # Multi-pass
  5548. self.mpass_cb = FCCheckBox('%s:' % _("Multi-Depth"))
  5549. self.mpass_cb.setToolTip(
  5550. _(
  5551. "Use multiple passes to limit\n"
  5552. "the cut depth in each pass. Will\n"
  5553. "cut multiple times until Cut Z is\n"
  5554. "reached."
  5555. )
  5556. )
  5557. self.maxdepth_entry = FCDoubleSpinner()
  5558. self.maxdepth_entry.set_precision(self.decimals)
  5559. self.maxdepth_entry.setRange(0, 9999.9999)
  5560. self.maxdepth_entry.setSingleStep(0.1)
  5561. self.maxdepth_entry.setToolTip(_("Depth of each pass (positive)."))
  5562. grid0.addWidget(self.mpass_cb, 2, 0)
  5563. grid0.addWidget(self.maxdepth_entry, 2, 1)
  5564. # Object kind
  5565. kindlabel = QtWidgets.QLabel('%s:' % _('Object kind'))
  5566. kindlabel.setToolTip(
  5567. _("Choice of what kind the object we want to cutout is.<BR>"
  5568. "- <B>Single</B>: contain a single PCB Gerber outline object.<BR>"
  5569. "- <B>Panel</B>: a panel PCB Gerber object, which is made\n"
  5570. "out of many individual PCB outlines.")
  5571. )
  5572. self.obj_kind_combo = RadioSet([
  5573. {"label": _("Single"), "value": "single"},
  5574. {"label": _("Panel"), "value": "panel"},
  5575. ])
  5576. grid0.addWidget(kindlabel, 3, 0)
  5577. grid0.addWidget(self.obj_kind_combo, 3, 1)
  5578. marginlabel = QtWidgets.QLabel('%s:' % _('Margin'))
  5579. marginlabel.setToolTip(
  5580. _("Margin over bounds. A positive value here\n"
  5581. "will make the cutout of the PCB further from\n"
  5582. "the actual PCB border")
  5583. )
  5584. self.cutout_margin_entry = FCDoubleSpinner()
  5585. self.cutout_margin_entry.set_range(-9999.9999, 9999.9999)
  5586. self.cutout_margin_entry.set_precision(self.decimals)
  5587. self.cutout_margin_entry.setSingleStep(0.1)
  5588. grid0.addWidget(marginlabel, 4, 0)
  5589. grid0.addWidget(self.cutout_margin_entry, 4, 1)
  5590. gaplabel = QtWidgets.QLabel('%s:' % _('Gap size'))
  5591. gaplabel.setToolTip(
  5592. _("The size of the bridge gaps in the cutout\n"
  5593. "used to keep the board connected to\n"
  5594. "the surrounding material (the one \n"
  5595. "from which the PCB is cutout).")
  5596. )
  5597. self.cutout_gap_entry = FCDoubleSpinner()
  5598. self.cutout_gap_entry.set_range(0.000001, 9999.9999)
  5599. self.cutout_gap_entry.set_precision(self.decimals)
  5600. self.cutout_gap_entry.setSingleStep(0.1)
  5601. grid0.addWidget(gaplabel, 5, 0)
  5602. grid0.addWidget(self.cutout_gap_entry, 5, 1)
  5603. gaps_label = QtWidgets.QLabel('%s:' % _('Gaps'))
  5604. gaps_label.setToolTip(
  5605. _("Number of gaps used for the cutout.\n"
  5606. "There can be maximum 8 bridges/gaps.\n"
  5607. "The choices are:\n"
  5608. "- None - no gaps\n"
  5609. "- lr - left + right\n"
  5610. "- tb - top + bottom\n"
  5611. "- 4 - left + right +top + bottom\n"
  5612. "- 2lr - 2*left + 2*right\n"
  5613. "- 2tb - 2*top + 2*bottom\n"
  5614. "- 8 - 2*left + 2*right +2*top + 2*bottom")
  5615. )
  5616. self.gaps_combo = FCComboBox()
  5617. grid0.addWidget(gaps_label, 6, 0)
  5618. grid0.addWidget(self.gaps_combo, 6, 1)
  5619. gaps_items = ['None', 'LR', 'TB', '4', '2LR', '2TB', '8']
  5620. for it in gaps_items:
  5621. self.gaps_combo.addItem(it)
  5622. self.gaps_combo.setStyleSheet('background-color: rgb(255,255,255)')
  5623. # Surrounding convex box shape
  5624. self.convex_box = FCCheckBox('%s' % _("Convex Shape"))
  5625. self.convex_box.setToolTip(
  5626. _("Create a convex shape surrounding the entire PCB.\n"
  5627. "Used only if the source object type is Gerber.")
  5628. )
  5629. grid0.addWidget(self.convex_box, 7, 0, 1, 2)
  5630. self.layout.addStretch()
  5631. class Tools2sidedPrefGroupUI(OptionsGroupUI):
  5632. def __init__(self, decimals=4, parent=None):
  5633. # OptionsGroupUI.__init__(self, "2sided Tool Options", parent=parent)
  5634. super(Tools2sidedPrefGroupUI, self).__init__(self)
  5635. self.setTitle(str(_("2Sided Tool Options")))
  5636. self.decimals = decimals
  5637. # ## Board cuttout
  5638. self.dblsided_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  5639. self.dblsided_label.setToolTip(
  5640. _("A tool to help in creating a double sided\n"
  5641. "PCB using alignment holes.")
  5642. )
  5643. self.layout.addWidget(self.dblsided_label)
  5644. grid0 = QtWidgets.QGridLayout()
  5645. self.layout.addLayout(grid0)
  5646. # ## Drill diameter for alignment holes
  5647. self.drill_dia_entry = FCDoubleSpinner()
  5648. self.drill_dia_entry.set_range(0.000001, 9999.9999)
  5649. self.drill_dia_entry.set_precision(self.decimals)
  5650. self.drill_dia_entry.setSingleStep(0.1)
  5651. self.dd_label = QtWidgets.QLabel('%s:' % _("Drill dia"))
  5652. self.dd_label.setToolTip(
  5653. _("Diameter of the drill for the "
  5654. "alignment holes.")
  5655. )
  5656. grid0.addWidget(self.dd_label, 0, 0)
  5657. grid0.addWidget(self.drill_dia_entry, 0, 1)
  5658. # ## Alignment Axis
  5659. self.align_ax_label = QtWidgets.QLabel('%s:' % _("Align Axis"))
  5660. self.align_ax_label.setToolTip(
  5661. _("Mirror vertically (X) or horizontally (Y).")
  5662. )
  5663. self.align_axis_radio = RadioSet([{'label': 'X', 'value': 'X'},
  5664. {'label': 'Y', 'value': 'Y'}])
  5665. grid0.addWidget(self.align_ax_label, 1, 0)
  5666. grid0.addWidget(self.align_axis_radio, 1, 1)
  5667. # ## Axis
  5668. self.mirror_axis_radio = RadioSet([{'label': 'X', 'value': 'X'},
  5669. {'label': 'Y', 'value': 'Y'}])
  5670. self.mirax_label = QtWidgets.QLabel(_("Mirror Axis:"))
  5671. self.mirax_label.setToolTip(
  5672. _("Mirror vertically (X) or horizontally (Y).")
  5673. )
  5674. self.empty_lb1 = QtWidgets.QLabel("")
  5675. grid0.addWidget(self.empty_lb1, 2, 0)
  5676. grid0.addWidget(self.mirax_label, 3, 0)
  5677. grid0.addWidget(self.mirror_axis_radio, 3, 1)
  5678. # ## Axis Location
  5679. self.axis_location_radio = RadioSet([{'label': _('Point'), 'value': 'point'},
  5680. {'label': _('Box'), 'value': 'box'}])
  5681. self.axloc_label = QtWidgets.QLabel('%s:' % _("Axis Ref"))
  5682. self.axloc_label.setToolTip(
  5683. _("The axis should pass through a <b>point</b> or cut\n "
  5684. "a specified <b>box</b> (in a FlatCAM object) through \n"
  5685. "the center.")
  5686. )
  5687. grid0.addWidget(self.axloc_label, 4, 0)
  5688. grid0.addWidget(self.axis_location_radio, 4, 1)
  5689. self.layout.addStretch()
  5690. class ToolsPaintPrefGroupUI(OptionsGroupUI):
  5691. def __init__(self, decimals=4, parent=None):
  5692. # OptionsGroupUI.__init__(self, "Paint Area Tool Options", parent=parent)
  5693. super(ToolsPaintPrefGroupUI, self).__init__(self)
  5694. self.setTitle(str(_("Paint Tool Options")))
  5695. self.decimals = decimals
  5696. # ------------------------------
  5697. # ## Paint area
  5698. # ------------------------------
  5699. self.paint_label = QtWidgets.QLabel(_('<b>Parameters:</b>'))
  5700. self.paint_label.setToolTip(
  5701. _("Creates tool paths to cover the\n"
  5702. "whole area of a polygon (remove\n"
  5703. "all copper). You will be asked\n"
  5704. "to click on the desired polygon.")
  5705. )
  5706. self.layout.addWidget(self.paint_label)
  5707. grid0 = QtWidgets.QGridLayout()
  5708. grid0.setColumnStretch(0, 0)
  5709. grid0.setColumnStretch(1, 1)
  5710. self.layout.addLayout(grid0)
  5711. # Tool dia
  5712. ptdlabel = QtWidgets.QLabel('<b><font color="green">%s:</font></b>' % _('Tools Dia'))
  5713. ptdlabel.setToolTip(
  5714. _("Diameters of the tools, separated by comma.\n"
  5715. "The value of the diameter has to use the dot decimals separator.\n"
  5716. "Valid values: 0.3, 1.0")
  5717. )
  5718. grid0.addWidget(ptdlabel, 0, 0)
  5719. self.painttooldia_entry = FCEntry(border_color='#0069A9')
  5720. self.painttooldia_entry.setPlaceholderText(_("Comma separated values"))
  5721. grid0.addWidget(self.painttooldia_entry, 0, 1)
  5722. # Tool Type Radio Button
  5723. self.tool_type_label = QtWidgets.QLabel('%s:' % _('Tool Type'))
  5724. self.tool_type_label.setToolTip(
  5725. _("Default tool type:\n"
  5726. "- 'V-shape'\n"
  5727. "- Circular")
  5728. )
  5729. self.tool_type_radio = RadioSet([{'label': _('V-shape'), 'value': 'V'},
  5730. {'label': _('Circular'), 'value': 'C1'}])
  5731. self.tool_type_radio.setObjectName(_("Tool Type"))
  5732. grid0.addWidget(self.tool_type_label, 1, 0)
  5733. grid0.addWidget(self.tool_type_radio, 1, 1)
  5734. # Tip Dia
  5735. self.tipdialabel = QtWidgets.QLabel('%s:' % _('V-Tip Dia'))
  5736. self.tipdialabel.setToolTip(
  5737. _("The tip diameter for V-Shape Tool"))
  5738. self.tipdia_entry = FCDoubleSpinner()
  5739. self.tipdia_entry.set_precision(self.decimals)
  5740. self.tipdia_entry.set_range(0.0000, 9999.9999)
  5741. self.tipdia_entry.setSingleStep(0.1)
  5742. self.tipdia_entry.setObjectName(_("V-Tip Dia"))
  5743. grid0.addWidget(self.tipdialabel, 2, 0)
  5744. grid0.addWidget(self.tipdia_entry, 2, 1)
  5745. # Tip Angle
  5746. self.tipanglelabel = QtWidgets.QLabel('%s:' % _('V-Tip Angle'))
  5747. self.tipanglelabel.setToolTip(
  5748. _("The tip angle for V-Shape Tool.\n"
  5749. "In degree."))
  5750. self.tipangle_entry = FCDoubleSpinner()
  5751. self.tipangle_entry.set_precision(self.decimals)
  5752. self.tipangle_entry.set_range(1.0000, 180.0000)
  5753. self.tipangle_entry.setSingleStep(5)
  5754. self.tipangle_entry.setObjectName(_("V-Tip Angle"))
  5755. grid0.addWidget(self.tipanglelabel, 3, 0)
  5756. grid0.addWidget(self.tipangle_entry, 3, 1)
  5757. # Cut Z entry
  5758. cutzlabel = QtWidgets.QLabel('%s:' % _('Cut Z'))
  5759. cutzlabel.setToolTip(
  5760. _("Depth of cut into material. Negative value.\n"
  5761. "In FlatCAM units.")
  5762. )
  5763. self.cutz_entry = FCDoubleSpinner()
  5764. self.cutz_entry.set_precision(self.decimals)
  5765. self.cutz_entry.set_range(-99999.9999, 0.0000)
  5766. self.cutz_entry.setObjectName(_("Cut Z"))
  5767. self.cutz_entry.setToolTip(
  5768. _("Depth of cut into material. Negative value.\n"
  5769. "In FlatCAM units.")
  5770. )
  5771. grid0.addWidget(cutzlabel, 4, 0)
  5772. grid0.addWidget(self.cutz_entry, 4, 1)
  5773. # ### Tool Diameter ####
  5774. self.newdialabel = QtWidgets.QLabel('%s:' % _('New Dia'))
  5775. self.newdialabel.setToolTip(
  5776. _("Diameter for the new tool to add in the Tool Table.\n"
  5777. "If the tool is V-shape type then this value is automatically\n"
  5778. "calculated from the other parameters.")
  5779. )
  5780. self.newdia_entry = FCDoubleSpinner()
  5781. self.newdia_entry.set_precision(self.decimals)
  5782. self.newdia_entry.set_range(0.000, 9999.9999)
  5783. self.newdia_entry.setObjectName(_("Tool Dia"))
  5784. grid0.addWidget(self.newdialabel, 5, 0)
  5785. grid0.addWidget(self.newdia_entry, 5, 1)
  5786. separator_line = QtWidgets.QFrame()
  5787. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  5788. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  5789. grid0.addWidget(separator_line, 6, 0, 1, 2)
  5790. self.paint_order_label = QtWidgets.QLabel('%s:' % _('Tool order'))
  5791. self.paint_order_label.setToolTip(_("This set the way that the tools in the tools table are used.\n"
  5792. "'No' --> means that the used order is the one in the tool table\n"
  5793. "'Forward' --> means that the tools will be ordered from small to big\n"
  5794. "'Reverse' --> menas that the tools will ordered from big to small\n\n"
  5795. "WARNING: using rest machining will automatically set the order\n"
  5796. "in reverse and disable this control."))
  5797. self.paint_order_radio = RadioSet([{'label': _('No'), 'value': 'no'},
  5798. {'label': _('Forward'), 'value': 'fwd'},
  5799. {'label': _('Reverse'), 'value': 'rev'}])
  5800. grid0.addWidget(self.paint_order_label, 7, 0)
  5801. grid0.addWidget(self.paint_order_radio, 7, 1)
  5802. separator_line = QtWidgets.QFrame()
  5803. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  5804. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  5805. grid0.addWidget(separator_line, 8, 0, 1, 2)
  5806. # Overlap
  5807. ovlabel = QtWidgets.QLabel('%s:' % _('Overlap'))
  5808. ovlabel.setToolTip(
  5809. _("How much (percentage) of the tool width to overlap each tool pass.\n"
  5810. "Adjust the value starting with lower values\n"
  5811. "and increasing it if areas that should be painted are still \n"
  5812. "not painted.\n"
  5813. "Lower values = faster processing, faster execution on CNC.\n"
  5814. "Higher values = slow processing and slow execution on CNC\n"
  5815. "due of too many paths.")
  5816. )
  5817. self.paintoverlap_entry = FCDoubleSpinner(suffix='%')
  5818. self.paintoverlap_entry.set_precision(self.decimals)
  5819. self.paintoverlap_entry.setWrapping(True)
  5820. self.paintoverlap_entry.setRange(0.0000, 99.9999)
  5821. self.paintoverlap_entry.setSingleStep(0.1)
  5822. grid0.addWidget(ovlabel, 9, 0)
  5823. grid0.addWidget(self.paintoverlap_entry, 9, 1)
  5824. # Margin
  5825. marginlabel = QtWidgets.QLabel('%s:' % _('Margin'))
  5826. marginlabel.setToolTip(
  5827. _("Distance by which to avoid\n"
  5828. "the edges of the polygon to\n"
  5829. "be painted.")
  5830. )
  5831. self.paintmargin_entry = FCDoubleSpinner()
  5832. self.paintmargin_entry.set_range(-9999.9999, 9999.9999)
  5833. self.paintmargin_entry.set_precision(self.decimals)
  5834. self.paintmargin_entry.setSingleStep(0.1)
  5835. grid0.addWidget(marginlabel, 10, 0)
  5836. grid0.addWidget(self.paintmargin_entry, 10, 1)
  5837. # Method
  5838. methodlabel = QtWidgets.QLabel('%s:' % _('Method'))
  5839. methodlabel.setToolTip(
  5840. _("Algorithm for painting:\n"
  5841. "- Standard: Fixed step inwards.\n"
  5842. "- Seed-based: Outwards from seed.\n"
  5843. "- Line-based: Parallel lines.\n"
  5844. "- Laser-lines: Active only for Gerber objects.\n"
  5845. "Will create lines that follow the traces.\n"
  5846. "- Combo: In case of failure a new method will be picked from the above\n"
  5847. "in the order specified.")
  5848. )
  5849. # self.paintmethod_combo = RadioSet([
  5850. # {"label": _("Standard"), "value": "standard"},
  5851. # {"label": _("Seed-based"), "value": "seed"},
  5852. # {"label": _("Straight lines"), "value": "lines"}
  5853. # ], orientation='vertical', stretch=False)
  5854. self.paintmethod_combo = FCComboBox()
  5855. self.paintmethod_combo.addItems(
  5856. [_("Standard"), _("Seed"), _("Lines"), _("Laser_lines"), _("Combo")]
  5857. )
  5858. grid0.addWidget(methodlabel, 11, 0)
  5859. grid0.addWidget(self.paintmethod_combo, 11, 1)
  5860. # Connect lines
  5861. self.pathconnect_cb = FCCheckBox('%s' % _("Connect"))
  5862. self.pathconnect_cb.setToolTip(
  5863. _("Draw lines between resulting\n"
  5864. "segments to minimize tool lifts.")
  5865. )
  5866. grid0.addWidget(self.pathconnect_cb, 12, 0)
  5867. # Paint contour
  5868. self.contour_cb = FCCheckBox('%s' % _("Contour"))
  5869. self.contour_cb.setToolTip(
  5870. _("Cut around the perimeter of the polygon\n"
  5871. "to trim rough edges.")
  5872. )
  5873. grid0.addWidget(self.contour_cb, 12, 1)
  5874. separator_line = QtWidgets.QFrame()
  5875. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  5876. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  5877. grid0.addWidget(separator_line, 13, 0, 1, 2)
  5878. self.rest_cb = FCCheckBox('%s' % _("Rest Machining"))
  5879. self.rest_cb.setObjectName(_("Rest Machining"))
  5880. self.rest_cb.setToolTip(
  5881. _("If checked, use 'rest machining'.\n"
  5882. "Basically it will clear copper outside PCB features,\n"
  5883. "using the biggest tool and continue with the next tools,\n"
  5884. "from bigger to smaller, to clear areas of copper that\n"
  5885. "could not be cleared by previous tool, until there is\n"
  5886. "no more copper to clear or there are no more tools.\n\n"
  5887. "If not checked, use the standard algorithm.")
  5888. )
  5889. grid0.addWidget(self.rest_cb, 14, 0, 1, 2)
  5890. # Polygon selection
  5891. selectlabel = QtWidgets.QLabel('%s:' % _('Selection'))
  5892. selectlabel.setToolTip(
  5893. _("Selection of area to be processed.\n"
  5894. "- 'Polygon Selection' - left mouse click to add/remove polygons to be processed.\n"
  5895. "- 'Area Selection' - left mouse click to start selection of the area to be processed.\n"
  5896. "Keeping a modifier key pressed (CTRL or SHIFT) will allow to add multiple areas.\n"
  5897. "- 'All Polygons' - the process will start after click.\n"
  5898. "- 'Reference Object' - will process the area specified by another object.")
  5899. )
  5900. # self.selectmethod_combo = RadioSet(
  5901. # [
  5902. # {"label": _("Polygon Selection"), "value": "single"},
  5903. # {"label": _("Area Selection"), "value": "area"},
  5904. # {"label": _("All Polygons"), "value": "all"},
  5905. # {"label": _("Reference Object"), "value": "ref"}
  5906. # ],
  5907. # orientation='vertical',
  5908. # stretch=None
  5909. # )
  5910. self.selectmethod_combo = FCComboBox()
  5911. self.selectmethod_combo.addItems(
  5912. [_("Polygon Selection"), _("Area Selection"), _("All Polygons"), _("Reference Object")]
  5913. )
  5914. grid0.addWidget(selectlabel, 15, 0)
  5915. grid0.addWidget(self.selectmethod_combo, 15, 1)
  5916. self.area_shape_label = QtWidgets.QLabel('%s:' % _("Shape"))
  5917. self.area_shape_label.setToolTip(
  5918. _("The kind of selection shape used for area selection.")
  5919. )
  5920. self.area_shape_radio = RadioSet([{'label': _("Square"), 'value': 'square'},
  5921. {'label': _("Polygon"), 'value': 'polygon'}])
  5922. grid0.addWidget(self.area_shape_label, 18, 0)
  5923. grid0.addWidget(self.area_shape_radio, 18, 1)
  5924. separator_line = QtWidgets.QFrame()
  5925. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  5926. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  5927. grid0.addWidget(separator_line, 19, 0, 1, 2)
  5928. # ## Plotting type
  5929. self.paint_plotting_radio = RadioSet([{'label': _('Normal'), 'value': 'normal'},
  5930. {"label": _("Progressive"), "value": "progressive"}])
  5931. plotting_label = QtWidgets.QLabel('%s:' % _("Paint Plotting"))
  5932. plotting_label.setToolTip(
  5933. _("- 'Normal' - normal plotting, done at the end of the Paint job\n"
  5934. "- 'Progressive' - after each shape is generated it will be plotted.")
  5935. )
  5936. grid0.addWidget(plotting_label, 20, 0)
  5937. grid0.addWidget(self.paint_plotting_radio, 20, 1)
  5938. self.layout.addStretch()
  5939. class ToolsFilmPrefGroupUI(OptionsGroupUI):
  5940. def __init__(self, decimals=4, parent=None):
  5941. # OptionsGroupUI.__init__(self, "Cutout Tool Options", parent=parent)
  5942. super(ToolsFilmPrefGroupUI, self).__init__(self)
  5943. self.setTitle(str(_("Film Tool Options")))
  5944. self.decimals = decimals
  5945. # ## Parameters
  5946. self.film_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  5947. self.film_label.setToolTip(
  5948. _("Create a PCB film from a Gerber or Geometry\n"
  5949. "FlatCAM object.\n"
  5950. "The file is saved in SVG format.")
  5951. )
  5952. self.layout.addWidget(self.film_label)
  5953. grid0 = QtWidgets.QGridLayout()
  5954. self.layout.addLayout(grid0)
  5955. self.film_type_radio = RadioSet([{'label': 'Pos', 'value': 'pos'},
  5956. {'label': 'Neg', 'value': 'neg'}])
  5957. ftypelbl = QtWidgets.QLabel('%s:' % _('Film Type'))
  5958. ftypelbl.setToolTip(
  5959. _("Generate a Positive black film or a Negative film.\n"
  5960. "Positive means that it will print the features\n"
  5961. "with black on a white canvas.\n"
  5962. "Negative means that it will print the features\n"
  5963. "with white on a black canvas.\n"
  5964. "The Film format is SVG.")
  5965. )
  5966. grid0.addWidget(ftypelbl, 0, 0)
  5967. grid0.addWidget(self.film_type_radio, 0, 1)
  5968. # Film Color
  5969. self.film_color_label = QtWidgets.QLabel('%s:' % _('Film Color'))
  5970. self.film_color_label.setToolTip(
  5971. _("Set the film color when positive film is selected.")
  5972. )
  5973. self.film_color_entry = FCEntry()
  5974. self.film_color_button = QtWidgets.QPushButton()
  5975. self.film_color_button.setFixedSize(15, 15)
  5976. self.form_box_child = QtWidgets.QHBoxLayout()
  5977. self.form_box_child.setContentsMargins(0, 0, 0, 0)
  5978. self.form_box_child.addWidget(self.film_color_entry)
  5979. self.form_box_child.addWidget(self.film_color_button, alignment=Qt.AlignRight)
  5980. self.form_box_child.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  5981. film_color_widget = QtWidgets.QWidget()
  5982. film_color_widget.setLayout(self.form_box_child)
  5983. grid0.addWidget(self.film_color_label, 1, 0)
  5984. grid0.addWidget(film_color_widget, 1, 1)
  5985. # Film Border
  5986. self.film_boundary_entry = FCDoubleSpinner()
  5987. self.film_boundary_entry.set_precision(self.decimals)
  5988. self.film_boundary_entry.set_range(0, 9999.9999)
  5989. self.film_boundary_entry.setSingleStep(0.1)
  5990. self.film_boundary_label = QtWidgets.QLabel('%s:' % _("Border"))
  5991. self.film_boundary_label.setToolTip(
  5992. _("Specify a border around the object.\n"
  5993. "Only for negative film.\n"
  5994. "It helps if we use as a Box Object the same \n"
  5995. "object as in Film Object. It will create a thick\n"
  5996. "black bar around the actual print allowing for a\n"
  5997. "better delimitation of the outline features which are of\n"
  5998. "white color like the rest and which may confound with the\n"
  5999. "surroundings if not for this border.")
  6000. )
  6001. grid0.addWidget(self.film_boundary_label, 2, 0)
  6002. grid0.addWidget(self.film_boundary_entry, 2, 1)
  6003. self.film_scale_stroke_entry = FCDoubleSpinner()
  6004. self.film_scale_stroke_entry.set_precision(self.decimals)
  6005. self.film_scale_stroke_entry.set_range(0, 9999.9999)
  6006. self.film_scale_stroke_entry.setSingleStep(0.1)
  6007. self.film_scale_stroke_label = QtWidgets.QLabel('%s:' % _("Scale Stroke"))
  6008. self.film_scale_stroke_label.setToolTip(
  6009. _("Scale the line stroke thickness of each feature in the SVG file.\n"
  6010. "It means that the line that envelope each SVG feature will be thicker or thinner,\n"
  6011. "therefore the fine features may be more affected by this parameter.")
  6012. )
  6013. grid0.addWidget(self.film_scale_stroke_label, 3, 0)
  6014. grid0.addWidget(self.film_scale_stroke_entry, 3, 1)
  6015. self.film_adj_label = QtWidgets.QLabel('<b>%s</b>' % _("Film Adjustments"))
  6016. self.film_adj_label.setToolTip(
  6017. _("Sometime the printers will distort the print shape, especially the Laser types.\n"
  6018. "This section provide the tools to compensate for the print distortions.")
  6019. )
  6020. grid0.addWidget(self.film_adj_label, 4, 0, 1, 2)
  6021. # Scale Geometry
  6022. self.film_scale_cb = FCCheckBox('%s' % _("Scale Film geometry"))
  6023. self.film_scale_cb.setToolTip(
  6024. _("A value greater than 1 will stretch the film\n"
  6025. "while a value less than 1 will jolt it.")
  6026. )
  6027. self.film_scale_cb.setStyleSheet(
  6028. """
  6029. QCheckBox {font-weight: bold; color: black}
  6030. """
  6031. )
  6032. grid0.addWidget(self.film_scale_cb, 5, 0, 1, 2)
  6033. self.film_scalex_label = QtWidgets.QLabel('%s:' % _("X factor"))
  6034. self.film_scalex_entry = FCDoubleSpinner()
  6035. self.film_scalex_entry.set_range(-999.9999, 999.9999)
  6036. self.film_scalex_entry.set_precision(self.decimals)
  6037. self.film_scalex_entry.setSingleStep(0.01)
  6038. grid0.addWidget(self.film_scalex_label, 6, 0)
  6039. grid0.addWidget(self.film_scalex_entry, 6, 1)
  6040. self.film_scaley_label = QtWidgets.QLabel('%s:' % _("Y factor"))
  6041. self.film_scaley_entry = FCDoubleSpinner()
  6042. self.film_scaley_entry.set_range(-999.9999, 999.9999)
  6043. self.film_scaley_entry.set_precision(self.decimals)
  6044. self.film_scaley_entry.setSingleStep(0.01)
  6045. grid0.addWidget(self.film_scaley_label, 7, 0)
  6046. grid0.addWidget(self.film_scaley_entry, 7, 1)
  6047. # Skew Geometry
  6048. self.film_skew_cb = FCCheckBox('%s' % _("Skew Film geometry"))
  6049. self.film_skew_cb.setToolTip(
  6050. _("Positive values will skew to the right\n"
  6051. "while negative values will skew to the left.")
  6052. )
  6053. self.film_skew_cb.setStyleSheet(
  6054. """
  6055. QCheckBox {font-weight: bold; color: black}
  6056. """
  6057. )
  6058. grid0.addWidget(self.film_skew_cb, 8, 0, 1, 2)
  6059. self.film_skewx_label = QtWidgets.QLabel('%s:' % _("X angle"))
  6060. self.film_skewx_entry = FCDoubleSpinner()
  6061. self.film_skewx_entry.set_range(-999.9999, 999.9999)
  6062. self.film_skewx_entry.set_precision(self.decimals)
  6063. self.film_skewx_entry.setSingleStep(0.01)
  6064. grid0.addWidget(self.film_skewx_label, 9, 0)
  6065. grid0.addWidget(self.film_skewx_entry, 9, 1)
  6066. self.film_skewy_label = QtWidgets.QLabel('%s:' % _("Y angle"))
  6067. self.film_skewy_entry = FCDoubleSpinner()
  6068. self.film_skewy_entry.set_range(-999.9999, 999.9999)
  6069. self.film_skewy_entry.set_precision(self.decimals)
  6070. self.film_skewy_entry.setSingleStep(0.01)
  6071. grid0.addWidget(self.film_skewy_label, 10, 0)
  6072. grid0.addWidget(self.film_skewy_entry, 10, 1)
  6073. self.film_skew_ref_label = QtWidgets.QLabel('%s:' % _("Reference"))
  6074. self.film_skew_ref_label.setToolTip(
  6075. _("The reference point to be used as origin for the skew.\n"
  6076. "It can be one of the four points of the geometry bounding box.")
  6077. )
  6078. self.film_skew_reference = RadioSet([{'label': _('Bottom Left'), 'value': 'bottomleft'},
  6079. {'label': _('Top Left'), 'value': 'topleft'},
  6080. {'label': _('Bottom Right'), 'value': 'bottomright'},
  6081. {'label': _('Top right'), 'value': 'topright'}],
  6082. orientation='vertical',
  6083. stretch=False)
  6084. grid0.addWidget(self.film_skew_ref_label, 11, 0)
  6085. grid0.addWidget(self.film_skew_reference, 11, 1)
  6086. # Mirror Geometry
  6087. self.film_mirror_cb = FCCheckBox('%s' % _("Mirror Film geometry"))
  6088. self.film_mirror_cb.setToolTip(
  6089. _("Mirror the film geometry on the selected axis or on both.")
  6090. )
  6091. self.film_mirror_cb.setStyleSheet(
  6092. """
  6093. QCheckBox {font-weight: bold; color: black}
  6094. """
  6095. )
  6096. grid0.addWidget(self.film_mirror_cb, 12, 0, 1, 2)
  6097. self.film_mirror_axis = RadioSet([{'label': _('None'), 'value': 'none'},
  6098. {'label': _('X'), 'value': 'x'},
  6099. {'label': _('Y'), 'value': 'y'},
  6100. {'label': _('Both'), 'value': 'both'}],
  6101. stretch=False)
  6102. self.film_mirror_axis_label = QtWidgets.QLabel('%s:' % _("Mirror axis"))
  6103. grid0.addWidget(self.film_mirror_axis_label, 13, 0)
  6104. grid0.addWidget(self.film_mirror_axis, 13, 1)
  6105. separator_line3 = QtWidgets.QFrame()
  6106. separator_line3.setFrameShape(QtWidgets.QFrame.HLine)
  6107. separator_line3.setFrameShadow(QtWidgets.QFrame.Sunken)
  6108. grid0.addWidget(separator_line3, 14, 0, 1, 2)
  6109. self.file_type_radio = RadioSet([{'label': _('SVG'), 'value': 'svg'},
  6110. {'label': _('PNG'), 'value': 'png'},
  6111. {'label': _('PDF'), 'value': 'pdf'}
  6112. ], stretch=False)
  6113. self.file_type_label = QtWidgets.QLabel(_("Film Type:"))
  6114. self.file_type_label.setToolTip(
  6115. _("The file type of the saved film. Can be:\n"
  6116. "- 'SVG' -> open-source vectorial format\n"
  6117. "- 'PNG' -> raster image\n"
  6118. "- 'PDF' -> portable document format")
  6119. )
  6120. grid0.addWidget(self.file_type_label, 15, 0)
  6121. grid0.addWidget(self.file_type_radio, 15, 1)
  6122. # Page orientation
  6123. self.orientation_label = QtWidgets.QLabel('%s:' % _("Page Orientation"))
  6124. self.orientation_label.setToolTip(_("Can be:\n"
  6125. "- Portrait\n"
  6126. "- Landscape"))
  6127. self.orientation_radio = RadioSet([{'label': _('Portrait'), 'value': 'p'},
  6128. {'label': _('Landscape'), 'value': 'l'},
  6129. ], stretch=False)
  6130. grid0.addWidget(self.orientation_label, 16, 0)
  6131. grid0.addWidget(self.orientation_radio, 16, 1)
  6132. # Page Size
  6133. self.pagesize_label = QtWidgets.QLabel('%s:' % _("Page Size"))
  6134. self.pagesize_label.setToolTip(_("A selection of standard ISO 216 page sizes."))
  6135. self.pagesize_combo = FCComboBox()
  6136. self.pagesize = {}
  6137. self.pagesize.update(
  6138. {
  6139. 'Bounds': None,
  6140. 'A0': (841, 1189),
  6141. 'A1': (594, 841),
  6142. 'A2': (420, 594),
  6143. 'A3': (297, 420),
  6144. 'A4': (210, 297),
  6145. 'A5': (148, 210),
  6146. 'A6': (105, 148),
  6147. 'A7': (74, 105),
  6148. 'A8': (52, 74),
  6149. 'A9': (37, 52),
  6150. 'A10': (26, 37),
  6151. 'B0': (1000, 1414),
  6152. 'B1': (707, 1000),
  6153. 'B2': (500, 707),
  6154. 'B3': (353, 500),
  6155. 'B4': (250, 353),
  6156. 'B5': (176, 250),
  6157. 'B6': (125, 176),
  6158. 'B7': (88, 125),
  6159. 'B8': (62, 88),
  6160. 'B9': (44, 62),
  6161. 'B10': (31, 44),
  6162. 'C0': (917, 1297),
  6163. 'C1': (648, 917),
  6164. 'C2': (458, 648),
  6165. 'C3': (324, 458),
  6166. 'C4': (229, 324),
  6167. 'C5': (162, 229),
  6168. 'C6': (114, 162),
  6169. 'C7': (81, 114),
  6170. 'C8': (57, 81),
  6171. 'C9': (40, 57),
  6172. 'C10': (28, 40),
  6173. # American paper sizes
  6174. 'LETTER': (8.5, 11),
  6175. 'LEGAL': (8.5, 14),
  6176. 'ELEVENSEVENTEEN': (11, 17),
  6177. # From https://en.wikipedia.org/wiki/Paper_size
  6178. 'JUNIOR_LEGAL': (5, 8),
  6179. 'HALF_LETTER': (5.5, 8),
  6180. 'GOV_LETTER': (8, 10.5),
  6181. 'GOV_LEGAL': (8.5, 13),
  6182. 'LEDGER': (17, 11),
  6183. }
  6184. )
  6185. page_size_list = list(self.pagesize.keys())
  6186. self.pagesize_combo.addItems(page_size_list)
  6187. grid0.addWidget(self.pagesize_label, 17, 0)
  6188. grid0.addWidget(self.pagesize_combo, 17, 1)
  6189. self.layout.addStretch()
  6190. class ToolsPanelizePrefGroupUI(OptionsGroupUI):
  6191. def __init__(self, decimals=4, parent=None):
  6192. # OptionsGroupUI.__init__(self, "Cutout Tool Options", parent=parent)
  6193. super(ToolsPanelizePrefGroupUI, self).__init__(self)
  6194. self.setTitle(str(_("Panelize Tool Options")))
  6195. self.decimals = decimals
  6196. # ## Board cuttout
  6197. self.panelize_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  6198. self.panelize_label.setToolTip(
  6199. _("Create an object that contains an array of (x, y) elements,\n"
  6200. "each element is a copy of the source object spaced\n"
  6201. "at a X distance, Y distance of each other.")
  6202. )
  6203. self.layout.addWidget(self.panelize_label)
  6204. grid0 = QtWidgets.QGridLayout()
  6205. self.layout.addLayout(grid0)
  6206. grid0.setColumnStretch(0, 0)
  6207. grid0.setColumnStretch(1, 1)
  6208. # ## Spacing Columns
  6209. self.pspacing_columns = FCDoubleSpinner()
  6210. self.pspacing_columns.set_range(0.000001, 9999.9999)
  6211. self.pspacing_columns.set_precision(self.decimals)
  6212. self.pspacing_columns.setSingleStep(0.1)
  6213. self.spacing_columns_label = QtWidgets.QLabel('%s:' % _("Spacing cols"))
  6214. self.spacing_columns_label.setToolTip(
  6215. _("Spacing between columns of the desired panel.\n"
  6216. "In current units.")
  6217. )
  6218. grid0.addWidget(self.spacing_columns_label, 0, 0)
  6219. grid0.addWidget(self.pspacing_columns, 0, 1)
  6220. # ## Spacing Rows
  6221. self.pspacing_rows = FCDoubleSpinner()
  6222. self.pspacing_rows.set_range(0.000001, 9999.9999)
  6223. self.pspacing_rows.set_precision(self.decimals)
  6224. self.pspacing_rows.setSingleStep(0.1)
  6225. self.spacing_rows_label = QtWidgets.QLabel('%s:' % _("Spacing rows"))
  6226. self.spacing_rows_label.setToolTip(
  6227. _("Spacing between rows of the desired panel.\n"
  6228. "In current units.")
  6229. )
  6230. grid0.addWidget(self.spacing_rows_label, 1, 0)
  6231. grid0.addWidget(self.pspacing_rows, 1, 1)
  6232. # ## Columns
  6233. self.pcolumns = FCSpinner()
  6234. self.pcolumns.set_range(1, 1000)
  6235. self.pcolumns.set_step(1)
  6236. self.columns_label = QtWidgets.QLabel('%s:' % _("Columns"))
  6237. self.columns_label.setToolTip(
  6238. _("Number of columns of the desired panel")
  6239. )
  6240. grid0.addWidget(self.columns_label, 2, 0)
  6241. grid0.addWidget(self.pcolumns, 2, 1)
  6242. # ## Rows
  6243. self.prows = FCSpinner()
  6244. self.prows.set_range(1, 1000)
  6245. self.prows.set_step(1)
  6246. self.rows_label = QtWidgets.QLabel('%s:' % _("Rows"))
  6247. self.rows_label.setToolTip(
  6248. _("Number of rows of the desired panel")
  6249. )
  6250. grid0.addWidget(self.rows_label, 3, 0)
  6251. grid0.addWidget(self.prows, 3, 1)
  6252. # ## Type of resulting Panel object
  6253. self.panel_type_radio = RadioSet([{'label': _('Gerber'), 'value': 'gerber'},
  6254. {'label': _('Geo'), 'value': 'geometry'}])
  6255. self.panel_type_label = QtWidgets.QLabel('%s:' % _("Panel Type"))
  6256. self.panel_type_label.setToolTip(
  6257. _("Choose the type of object for the panel object:\n"
  6258. "- Gerber\n"
  6259. "- Geometry")
  6260. )
  6261. grid0.addWidget(self.panel_type_label, 4, 0)
  6262. grid0.addWidget(self.panel_type_radio, 4, 1)
  6263. # ## Constrains
  6264. self.pconstrain_cb = FCCheckBox('%s:' % _("Constrain within"))
  6265. self.pconstrain_cb.setToolTip(
  6266. _("Area define by DX and DY within to constrain the panel.\n"
  6267. "DX and DY values are in current units.\n"
  6268. "Regardless of how many columns and rows are desired,\n"
  6269. "the final panel will have as many columns and rows as\n"
  6270. "they fit completely within selected area.")
  6271. )
  6272. grid0.addWidget(self.pconstrain_cb, 5, 0, 1, 2)
  6273. self.px_width_entry = FCDoubleSpinner()
  6274. self.px_width_entry.set_range(0.000001, 9999.9999)
  6275. self.px_width_entry.set_precision(self.decimals)
  6276. self.px_width_entry.setSingleStep(0.1)
  6277. self.x_width_lbl = QtWidgets.QLabel('%s:' % _("Width (DX)"))
  6278. self.x_width_lbl.setToolTip(
  6279. _("The width (DX) within which the panel must fit.\n"
  6280. "In current units.")
  6281. )
  6282. grid0.addWidget(self.x_width_lbl, 6, 0)
  6283. grid0.addWidget(self.px_width_entry, 6, 1)
  6284. self.py_height_entry = FCDoubleSpinner()
  6285. self.py_height_entry.set_range(0.000001, 9999.9999)
  6286. self.py_height_entry.set_precision(self.decimals)
  6287. self.py_height_entry.setSingleStep(0.1)
  6288. self.y_height_lbl = QtWidgets.QLabel('%s:' % _("Height (DY)"))
  6289. self.y_height_lbl.setToolTip(
  6290. _("The height (DY)within which the panel must fit.\n"
  6291. "In current units.")
  6292. )
  6293. grid0.addWidget(self.y_height_lbl, 7, 0)
  6294. grid0.addWidget(self.py_height_entry, 7, 1)
  6295. self.layout.addStretch()
  6296. class ToolsCalculatorsPrefGroupUI(OptionsGroupUI):
  6297. def __init__(self, decimals=4, parent=None):
  6298. # OptionsGroupUI.__init__(self, "Calculators Tool Options", parent=parent)
  6299. super(ToolsCalculatorsPrefGroupUI, self).__init__(self)
  6300. self.setTitle(str(_("Calculators Tool Options")))
  6301. self.decimals = decimals
  6302. # ## V-shape Calculator Tool
  6303. self.vshape_tool_label = QtWidgets.QLabel("<b>%s:</b>" % _("V-Shape Tool Calculator"))
  6304. self.vshape_tool_label.setToolTip(
  6305. _("Calculate the tool diameter for a given V-shape tool,\n"
  6306. "having the tip diameter, tip angle and\n"
  6307. "depth-of-cut as parameters.")
  6308. )
  6309. self.layout.addWidget(self.vshape_tool_label)
  6310. grid0 = QtWidgets.QGridLayout()
  6311. grid0.setColumnStretch(0, 0)
  6312. grid0.setColumnStretch(1, 1)
  6313. self.layout.addLayout(grid0)
  6314. # ## Tip Diameter
  6315. self.tip_dia_entry = FCDoubleSpinner()
  6316. self.tip_dia_entry.set_range(0.000001, 9999.9999)
  6317. self.tip_dia_entry.set_precision(self.decimals)
  6318. self.tip_dia_entry.setSingleStep(0.1)
  6319. self.tip_dia_label = QtWidgets.QLabel('%s:' % _("Tip Diameter"))
  6320. self.tip_dia_label.setToolTip(
  6321. _("This is the tool tip diameter.\n"
  6322. "It is specified by manufacturer.")
  6323. )
  6324. grid0.addWidget(self.tip_dia_label, 0, 0)
  6325. grid0.addWidget(self.tip_dia_entry, 0, 1)
  6326. # ## Tip angle
  6327. self.tip_angle_entry = FCDoubleSpinner()
  6328. self.tip_angle_entry.set_range(0.0, 180.0)
  6329. self.tip_angle_entry.set_precision(self.decimals)
  6330. self.tip_angle_entry.setSingleStep(5)
  6331. self.tip_angle_label = QtWidgets.QLabel('%s:' % _("Tip Angle"))
  6332. self.tip_angle_label.setToolTip(
  6333. _("This is the angle on the tip of the tool.\n"
  6334. "It is specified by manufacturer.")
  6335. )
  6336. grid0.addWidget(self.tip_angle_label, 1, 0)
  6337. grid0.addWidget(self.tip_angle_entry, 1, 1)
  6338. # ## Depth-of-cut Cut Z
  6339. self.cut_z_entry = FCDoubleSpinner()
  6340. self.cut_z_entry.set_range(-9999.9999, 0.0000)
  6341. self.cut_z_entry.set_precision(self.decimals)
  6342. self.cut_z_entry.setSingleStep(0.01)
  6343. self.cut_z_label = QtWidgets.QLabel('%s:' % _("Cut Z"))
  6344. self.cut_z_label.setToolTip(
  6345. _("This is depth to cut into material.\n"
  6346. "In the CNCJob object it is the CutZ parameter.")
  6347. )
  6348. grid0.addWidget(self.cut_z_label, 2, 0)
  6349. grid0.addWidget(self.cut_z_entry, 2, 1)
  6350. # ## Electroplating Calculator Tool
  6351. self.plate_title_label = QtWidgets.QLabel("<b>%s:</b>" % _("ElectroPlating Calculator"))
  6352. self.plate_title_label.setToolTip(
  6353. _("This calculator is useful for those who plate the via/pad/drill holes,\n"
  6354. "using a method like grahite ink or calcium hypophosphite ink or palladium chloride.")
  6355. )
  6356. grid0.addWidget(self.plate_title_label, 3, 0, 1, 2)
  6357. # ## PCB Length
  6358. self.pcblength_entry = FCDoubleSpinner()
  6359. self.pcblength_entry.set_range(0.000001, 9999.9999)
  6360. self.pcblength_entry.set_precision(self.decimals)
  6361. self.pcblength_entry.setSingleStep(0.1)
  6362. self.pcblengthlabel = QtWidgets.QLabel('%s:' % _("Board Length"))
  6363. self.pcblengthlabel.setToolTip(_('This is the board length. In centimeters.'))
  6364. grid0.addWidget(self.pcblengthlabel, 4, 0)
  6365. grid0.addWidget(self.pcblength_entry, 4, 1)
  6366. # ## PCB Width
  6367. self.pcbwidth_entry = FCDoubleSpinner()
  6368. self.pcbwidth_entry.set_range(0.000001, 9999.9999)
  6369. self.pcbwidth_entry.set_precision(self.decimals)
  6370. self.pcbwidth_entry.setSingleStep(0.1)
  6371. self.pcbwidthlabel = QtWidgets.QLabel('%s:' % _("Board Width"))
  6372. self.pcbwidthlabel.setToolTip(_('This is the board width.In centimeters.'))
  6373. grid0.addWidget(self.pcbwidthlabel, 5, 0)
  6374. grid0.addWidget(self.pcbwidth_entry, 5, 1)
  6375. # ## Current Density
  6376. self.cdensity_label = QtWidgets.QLabel('%s:' % _("Current Density"))
  6377. self.cdensity_entry = FCDoubleSpinner()
  6378. self.cdensity_entry.set_range(0.000001, 9999.9999)
  6379. self.cdensity_entry.set_precision(self.decimals)
  6380. self.cdensity_entry.setSingleStep(0.1)
  6381. self.cdensity_label.setToolTip(_("Current density to pass through the board. \n"
  6382. "In Amps per Square Feet ASF."))
  6383. grid0.addWidget(self.cdensity_label, 6, 0)
  6384. grid0.addWidget(self.cdensity_entry, 6, 1)
  6385. # ## PCB Copper Growth
  6386. self.growth_label = QtWidgets.QLabel('%s:' % _("Copper Growth"))
  6387. self.growth_entry = FCDoubleSpinner()
  6388. self.growth_entry.set_range(0.000001, 9999.9999)
  6389. self.growth_entry.set_precision(self.decimals)
  6390. self.growth_entry.setSingleStep(0.01)
  6391. self.growth_label.setToolTip(_("How thick the copper growth is intended to be.\n"
  6392. "In microns."))
  6393. grid0.addWidget(self.growth_label, 7, 0)
  6394. grid0.addWidget(self.growth_entry, 7, 1)
  6395. self.layout.addStretch()
  6396. class ToolsTransformPrefGroupUI(OptionsGroupUI):
  6397. def __init__(self, decimals=4, parent=None):
  6398. super(ToolsTransformPrefGroupUI, self).__init__(self)
  6399. self.setTitle(str(_("Transform Tool Options")))
  6400. self.decimals = decimals
  6401. # ## Transformations
  6402. self.transform_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  6403. self.transform_label.setToolTip(
  6404. _("Various transformations that can be applied\n"
  6405. "on a FlatCAM object.")
  6406. )
  6407. self.layout.addWidget(self.transform_label)
  6408. grid0 = QtWidgets.QGridLayout()
  6409. self.layout.addLayout(grid0)
  6410. grid0.setColumnStretch(0, 0)
  6411. grid0.setColumnStretch(1, 1)
  6412. # ## Rotate Angle
  6413. rotate_title_lbl = QtWidgets.QLabel('<b>%s</b>' % _("Rotate"))
  6414. grid0.addWidget(rotate_title_lbl, 0, 0, 1, 2)
  6415. self.rotate_entry = FCDoubleSpinner()
  6416. self.rotate_entry.set_range(-360.0, 360.0)
  6417. self.rotate_entry.set_precision(self.decimals)
  6418. self.rotate_entry.setSingleStep(15)
  6419. self.rotate_label = QtWidgets.QLabel('%s:' % _("Angle"))
  6420. self.rotate_label.setToolTip(
  6421. _("Angle for Rotation action, in degrees.\n"
  6422. "Float number between -360 and 359.\n"
  6423. "Positive numbers for CW motion.\n"
  6424. "Negative numbers for CCW motion.")
  6425. )
  6426. grid0.addWidget(self.rotate_label, 1, 0)
  6427. grid0.addWidget(self.rotate_entry, 1, 1)
  6428. # ## Skew/Shear Angle on X axis
  6429. skew_title_lbl = QtWidgets.QLabel('<b>%s</b>' % _("Skew"))
  6430. grid0.addWidget(skew_title_lbl, 2, 0, 1, 2)
  6431. self.skewx_entry = FCDoubleSpinner()
  6432. self.skewx_entry.set_range(-360.0, 360.0)
  6433. self.skewx_entry.set_precision(self.decimals)
  6434. self.skewx_entry.setSingleStep(0.1)
  6435. self.skewx_label = QtWidgets.QLabel('%s:' % _("X angle"))
  6436. self.skewx_label.setToolTip(
  6437. _("Angle for Skew action, in degrees.\n"
  6438. "Float number between -360 and 359.")
  6439. )
  6440. grid0.addWidget(self.skewx_label, 3, 0)
  6441. grid0.addWidget(self.skewx_entry, 3, 1)
  6442. # ## Skew/Shear Angle on Y axis
  6443. self.skewy_entry = FCDoubleSpinner()
  6444. self.skewy_entry.set_range(-360.0, 360.0)
  6445. self.skewy_entry.set_precision(self.decimals)
  6446. self.skewy_entry.setSingleStep(0.1)
  6447. self.skewy_label = QtWidgets.QLabel('%s:' % _("Y angle"))
  6448. self.skewy_label.setToolTip(
  6449. _("Angle for Skew action, in degrees.\n"
  6450. "Float number between -360 and 359.")
  6451. )
  6452. grid0.addWidget(self.skewy_label, 4, 0)
  6453. grid0.addWidget(self.skewy_entry, 4, 1)
  6454. # ## Scale
  6455. scale_title_lbl = QtWidgets.QLabel('<b>%s</b>' % _("Scale"))
  6456. grid0.addWidget(scale_title_lbl, 5, 0, 1, 2)
  6457. self.scalex_entry = FCDoubleSpinner()
  6458. self.scalex_entry.set_range(0, 9999.9999)
  6459. self.scalex_entry.set_precision(self.decimals)
  6460. self.scalex_entry.setSingleStep(0.1)
  6461. self.scalex_label = QtWidgets.QLabel('%s:' % _("X factor"))
  6462. self.scalex_label.setToolTip(
  6463. _("Factor for scaling on X axis.")
  6464. )
  6465. grid0.addWidget(self.scalex_label, 6, 0)
  6466. grid0.addWidget(self.scalex_entry, 6, 1)
  6467. # ## Scale factor on X axis
  6468. self.scaley_entry = FCDoubleSpinner()
  6469. self.scaley_entry.set_range(0, 9999.9999)
  6470. self.scaley_entry.set_precision(self.decimals)
  6471. self.scaley_entry.setSingleStep(0.1)
  6472. self.scaley_label = QtWidgets.QLabel('%s:' % _("Y factor"))
  6473. self.scaley_label.setToolTip(
  6474. _("Factor for scaling on Y axis.")
  6475. )
  6476. grid0.addWidget(self.scaley_label, 7, 0)
  6477. grid0.addWidget(self.scaley_entry, 7, 1)
  6478. # ## Link Scale factors
  6479. self.link_cb = FCCheckBox(_("Link"))
  6480. self.link_cb.setToolTip(
  6481. _("Scale the selected object(s)\n"
  6482. "using the Scale_X factor for both axis.")
  6483. )
  6484. grid0.addWidget(self.link_cb, 8, 0)
  6485. # ## Scale Reference
  6486. self.reference_cb = FCCheckBox('%s' % _("Scale Reference"))
  6487. self.reference_cb.setToolTip(
  6488. _("Scale the selected object(s)\n"
  6489. "using the origin reference when checked,\n"
  6490. "and the center of the biggest bounding box\n"
  6491. "of the selected objects when unchecked.")
  6492. )
  6493. grid0.addWidget(self.reference_cb, 8, 1)
  6494. # ## Offset
  6495. offset_title_lbl = QtWidgets.QLabel('<b>%s</b>' % _("Offset"))
  6496. grid0.addWidget(offset_title_lbl, 9, 0, 1, 2)
  6497. self.offx_entry = FCDoubleSpinner()
  6498. self.offx_entry.set_range(-9999.9999, 9999.9999)
  6499. self.offx_entry.set_precision(self.decimals)
  6500. self.offx_entry.setSingleStep(0.1)
  6501. self.offx_label = QtWidgets.QLabel('%s:' % _("X val"))
  6502. self.offx_label.setToolTip(
  6503. _("Distance to offset on X axis. In current units.")
  6504. )
  6505. grid0.addWidget(self.offx_label, 10, 0)
  6506. grid0.addWidget(self.offx_entry, 10, 1)
  6507. # ## Offset distance on Y axis
  6508. self.offy_entry = FCDoubleSpinner()
  6509. self.offy_entry.set_range(-9999.9999, 9999.9999)
  6510. self.offy_entry.set_precision(self.decimals)
  6511. self.offy_entry.setSingleStep(0.1)
  6512. self.offy_label = QtWidgets.QLabel('%s:' % _("Y val"))
  6513. self.offy_label.setToolTip(
  6514. _("Distance to offset on Y axis. In current units.")
  6515. )
  6516. grid0.addWidget(self.offy_label, 11, 0)
  6517. grid0.addWidget(self.offy_entry, 11, 1)
  6518. # ## Mirror
  6519. mirror_title_lbl = QtWidgets.QLabel('<b>%s</b>' % _("Mirror"))
  6520. grid0.addWidget(mirror_title_lbl, 12, 0, 1, 2)
  6521. # ## Mirror (Flip) Reference Point
  6522. self.mirror_reference_cb = FCCheckBox('%s' % _("Mirror Reference"))
  6523. self.mirror_reference_cb.setToolTip(
  6524. _("Flip the selected object(s)\n"
  6525. "around the point in Point Entry Field.\n"
  6526. "\n"
  6527. "The point coordinates can be captured by\n"
  6528. "left click on canvas together with pressing\n"
  6529. "SHIFT key. \n"
  6530. "Then click Add button to insert coordinates.\n"
  6531. "Or enter the coords in format (x, y) in the\n"
  6532. "Point Entry field and click Flip on X(Y)"))
  6533. grid0.addWidget(self.mirror_reference_cb, 13, 0, 1, 2)
  6534. self.flip_ref_label = QtWidgets.QLabel('%s' % _("Mirror Reference point"))
  6535. self.flip_ref_label.setToolTip(
  6536. _("Coordinates in format (x, y) used as reference for mirroring.\n"
  6537. "The 'x' in (x, y) will be used when using Flip on X and\n"
  6538. "the 'y' in (x, y) will be used when using Flip on Y and")
  6539. )
  6540. self.flip_ref_entry = EvalEntry2("(0, 0)")
  6541. grid0.addWidget(self.flip_ref_label, 14, 0, 1, 2)
  6542. grid0.addWidget(self.flip_ref_entry, 15, 0, 1, 2)
  6543. # ## Buffer
  6544. buffer_title_lbl = QtWidgets.QLabel('<b>%s</b>' % _("Buffer"))
  6545. grid0.addWidget(buffer_title_lbl, 16, 0, 1, 2)
  6546. self.buffer_label = QtWidgets.QLabel('%s:' % _("Distance"))
  6547. self.buffer_label.setToolTip(
  6548. _("A positive value will create the effect of dilation,\n"
  6549. "while a negative value will create the effect of erosion.\n"
  6550. "Each geometry element of the object will be increased\n"
  6551. "or decreased with the 'distance'.")
  6552. )
  6553. self.buffer_entry = FCDoubleSpinner()
  6554. self.buffer_entry.set_precision(self.decimals)
  6555. self.buffer_entry.setSingleStep(0.1)
  6556. self.buffer_entry.setWrapping(True)
  6557. self.buffer_entry.set_range(-9999.9999, 9999.9999)
  6558. grid0.addWidget(self.buffer_label, 17, 0)
  6559. grid0.addWidget(self.buffer_entry, 17, 1)
  6560. self.buffer_factor_label = QtWidgets.QLabel('%s:' % _("Value"))
  6561. self.buffer_factor_label.setToolTip(
  6562. _("A positive value will create the effect of dilation,\n"
  6563. "while a negative value will create the effect of erosion.\n"
  6564. "Each geometry element of the object will be increased\n"
  6565. "or decreased to fit the 'Value'. Value is a percentage\n"
  6566. "of the initial dimension.")
  6567. )
  6568. self.buffer_factor_entry = FCDoubleSpinner(suffix='%')
  6569. self.buffer_factor_entry.set_range(-100.0000, 1000.0000)
  6570. self.buffer_factor_entry.set_precision(self.decimals)
  6571. self.buffer_factor_entry.setWrapping(True)
  6572. self.buffer_factor_entry.setSingleStep(1)
  6573. grid0.addWidget(self.buffer_factor_label, 18, 0)
  6574. grid0.addWidget(self.buffer_factor_entry, 18, 1)
  6575. self.buffer_rounded_cb = FCCheckBox()
  6576. self.buffer_rounded_cb.setText('%s' % _("Rounded"))
  6577. self.buffer_rounded_cb.setToolTip(
  6578. _("If checked then the buffer will surround the buffered shape,\n"
  6579. "every corner will be rounded.\n"
  6580. "If not checked then the buffer will follow the exact geometry\n"
  6581. "of the buffered shape.")
  6582. )
  6583. grid0.addWidget(self.buffer_rounded_cb, 19, 0, 1, 2)
  6584. self.layout.addStretch()
  6585. class ToolsSolderpastePrefGroupUI(OptionsGroupUI):
  6586. def __init__(self, decimals=4, parent=None):
  6587. super(ToolsSolderpastePrefGroupUI, self).__init__(self)
  6588. self.setTitle(str(_("SolderPaste Tool Options")))
  6589. self.decimals = decimals
  6590. # ## Solder Paste Dispensing
  6591. self.solderpastelabel = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  6592. self.solderpastelabel.setToolTip(
  6593. _("A tool to create GCode for dispensing\n"
  6594. "solder paste onto a PCB.")
  6595. )
  6596. self.layout.addWidget(self.solderpastelabel)
  6597. grid0 = QtWidgets.QGridLayout()
  6598. self.layout.addLayout(grid0)
  6599. # Nozzle Tool Diameters
  6600. nozzletdlabel = QtWidgets.QLabel('<b><font color="green">%s:</font></b>' % _('Tools Dia'))
  6601. nozzletdlabel.setToolTip(
  6602. _("Diameters of the tools, separated by comma.\n"
  6603. "The value of the diameter has to use the dot decimals separator.\n"
  6604. "Valid values: 0.3, 1.0")
  6605. )
  6606. self.nozzle_tool_dia_entry = FCEntry()
  6607. grid0.addWidget(nozzletdlabel, 0, 0)
  6608. grid0.addWidget(self.nozzle_tool_dia_entry, 0, 1)
  6609. # New Nozzle Tool Dia
  6610. self.addtool_entry_lbl = QtWidgets.QLabel('<b>%s:</b>' % _('New Nozzle Dia'))
  6611. self.addtool_entry_lbl.setToolTip(
  6612. _("Diameter for the new Nozzle tool to add in the Tool Table")
  6613. )
  6614. self.addtool_entry = FCDoubleSpinner()
  6615. self.addtool_entry.set_precision(self.decimals)
  6616. self.addtool_entry.set_range(0.0000001, 9999.9999)
  6617. self.addtool_entry.setSingleStep(0.1)
  6618. grid0.addWidget(self.addtool_entry_lbl, 1, 0)
  6619. grid0.addWidget(self.addtool_entry, 1, 1)
  6620. # Z dispense start
  6621. self.z_start_entry = FCDoubleSpinner()
  6622. self.z_start_entry.set_precision(self.decimals)
  6623. self.z_start_entry.set_range(0.0000001, 9999.9999)
  6624. self.z_start_entry.setSingleStep(0.1)
  6625. self.z_start_label = QtWidgets.QLabel('%s:' % _("Z Dispense Start"))
  6626. self.z_start_label.setToolTip(
  6627. _("The height (Z) when solder paste dispensing starts.")
  6628. )
  6629. grid0.addWidget(self.z_start_label, 2, 0)
  6630. grid0.addWidget(self.z_start_entry, 2, 1)
  6631. # Z dispense
  6632. self.z_dispense_entry = FCDoubleSpinner()
  6633. self.z_dispense_entry.set_precision(self.decimals)
  6634. self.z_dispense_entry.set_range(0.0000001, 9999.9999)
  6635. self.z_dispense_entry.setSingleStep(0.1)
  6636. self.z_dispense_label = QtWidgets.QLabel('%s:' % _("Z Dispense"))
  6637. self.z_dispense_label.setToolTip(
  6638. _("The height (Z) when doing solder paste dispensing.")
  6639. )
  6640. grid0.addWidget(self.z_dispense_label, 3, 0)
  6641. grid0.addWidget(self.z_dispense_entry, 3, 1)
  6642. # Z dispense stop
  6643. self.z_stop_entry = FCDoubleSpinner()
  6644. self.z_stop_entry.set_precision(self.decimals)
  6645. self.z_stop_entry.set_range(0.0000001, 9999.9999)
  6646. self.z_stop_entry.setSingleStep(0.1)
  6647. self.z_stop_label = QtWidgets.QLabel('%s:' % _("Z Dispense Stop"))
  6648. self.z_stop_label.setToolTip(
  6649. _("The height (Z) when solder paste dispensing stops.")
  6650. )
  6651. grid0.addWidget(self.z_stop_label, 4, 0)
  6652. grid0.addWidget(self.z_stop_entry, 4, 1)
  6653. # Z travel
  6654. self.z_travel_entry = FCDoubleSpinner()
  6655. self.z_travel_entry.set_precision(self.decimals)
  6656. self.z_travel_entry.set_range(0.0000001, 9999.9999)
  6657. self.z_travel_entry.setSingleStep(0.1)
  6658. self.z_travel_label = QtWidgets.QLabel('%s:' % _("Z Travel"))
  6659. self.z_travel_label.setToolTip(
  6660. _("The height (Z) for travel between pads\n"
  6661. "(without dispensing solder paste).")
  6662. )
  6663. grid0.addWidget(self.z_travel_label, 5, 0)
  6664. grid0.addWidget(self.z_travel_entry, 5, 1)
  6665. # Z toolchange location
  6666. self.z_toolchange_entry = FCDoubleSpinner()
  6667. self.z_toolchange_entry.set_precision(self.decimals)
  6668. self.z_toolchange_entry.set_range(0.0000001, 9999.9999)
  6669. self.z_toolchange_entry.setSingleStep(0.1)
  6670. self.z_toolchange_label = QtWidgets.QLabel('%s:' % _("Z Toolchange"))
  6671. self.z_toolchange_label.setToolTip(
  6672. _("The height (Z) for tool (nozzle) change.")
  6673. )
  6674. grid0.addWidget(self.z_toolchange_label, 6, 0)
  6675. grid0.addWidget(self.z_toolchange_entry, 6, 1)
  6676. # X,Y Toolchange location
  6677. self.xy_toolchange_entry = FCEntry()
  6678. self.xy_toolchange_label = QtWidgets.QLabel('%s:' % _("Toolchange X-Y"))
  6679. self.xy_toolchange_label.setToolTip(
  6680. _("The X,Y location for tool (nozzle) change.\n"
  6681. "The format is (x, y) where x and y are real numbers.")
  6682. )
  6683. grid0.addWidget(self.xy_toolchange_label, 7, 0)
  6684. grid0.addWidget(self.xy_toolchange_entry, 7, 1)
  6685. # Feedrate X-Y
  6686. self.frxy_entry = FCDoubleSpinner()
  6687. self.frxy_entry.set_precision(self.decimals)
  6688. self.frxy_entry.set_range(0.0000001, 99999.9999)
  6689. self.frxy_entry.setSingleStep(0.1)
  6690. self.frxy_label = QtWidgets.QLabel('%s:' % _("Feedrate X-Y"))
  6691. self.frxy_label.setToolTip(
  6692. _("Feedrate (speed) while moving on the X-Y plane.")
  6693. )
  6694. grid0.addWidget(self.frxy_label, 8, 0)
  6695. grid0.addWidget(self.frxy_entry, 8, 1)
  6696. # Feedrate Z
  6697. self.frz_entry = FCDoubleSpinner()
  6698. self.frz_entry.set_precision(self.decimals)
  6699. self.frz_entry.set_range(0.0000001, 99999.9999)
  6700. self.frz_entry.setSingleStep(0.1)
  6701. self.frz_label = QtWidgets.QLabel('%s:' % _("Feedrate Z"))
  6702. self.frz_label.setToolTip(
  6703. _("Feedrate (speed) while moving vertically\n"
  6704. "(on Z plane).")
  6705. )
  6706. grid0.addWidget(self.frz_label, 9, 0)
  6707. grid0.addWidget(self.frz_entry, 9, 1)
  6708. # Feedrate Z Dispense
  6709. self.frz_dispense_entry = FCDoubleSpinner()
  6710. self.frz_dispense_entry.set_precision(self.decimals)
  6711. self.frz_dispense_entry.set_range(0.0000001, 99999.9999)
  6712. self.frz_dispense_entry.setSingleStep(0.1)
  6713. self.frz_dispense_label = QtWidgets.QLabel('%s:' % _("Feedrate Z Dispense"))
  6714. self.frz_dispense_label.setToolTip(
  6715. _("Feedrate (speed) while moving up vertically\n"
  6716. "to Dispense position (on Z plane).")
  6717. )
  6718. grid0.addWidget(self.frz_dispense_label, 10, 0)
  6719. grid0.addWidget(self.frz_dispense_entry, 10, 1)
  6720. # Spindle Speed Forward
  6721. self.speedfwd_entry = FCSpinner()
  6722. self.speedfwd_entry.set_range(0, 99999)
  6723. self.speedfwd_entry.set_step(1000)
  6724. self.speedfwd_label = QtWidgets.QLabel('%s:' % _("Spindle Speed FWD"))
  6725. self.speedfwd_label.setToolTip(
  6726. _("The dispenser speed while pushing solder paste\n"
  6727. "through the dispenser nozzle.")
  6728. )
  6729. grid0.addWidget(self.speedfwd_label, 11, 0)
  6730. grid0.addWidget(self.speedfwd_entry, 11, 1)
  6731. # Dwell Forward
  6732. self.dwellfwd_entry = FCDoubleSpinner()
  6733. self.dwellfwd_entry.set_precision(self.decimals)
  6734. self.dwellfwd_entry.set_range(0.0000001, 9999.9999)
  6735. self.dwellfwd_entry.setSingleStep(0.1)
  6736. self.dwellfwd_label = QtWidgets.QLabel('%s:' % _("Dwell FWD"))
  6737. self.dwellfwd_label.setToolTip(
  6738. _("Pause after solder dispensing.")
  6739. )
  6740. grid0.addWidget(self.dwellfwd_label, 12, 0)
  6741. grid0.addWidget(self.dwellfwd_entry, 12, 1)
  6742. # Spindle Speed Reverse
  6743. self.speedrev_entry = FCSpinner()
  6744. self.speedrev_entry.set_range(0, 999999)
  6745. self.speedrev_entry.set_step(1000)
  6746. self.speedrev_label = QtWidgets.QLabel('%s:' % _("Spindle Speed REV"))
  6747. self.speedrev_label.setToolTip(
  6748. _("The dispenser speed while retracting solder paste\n"
  6749. "through the dispenser nozzle.")
  6750. )
  6751. grid0.addWidget(self.speedrev_label, 13, 0)
  6752. grid0.addWidget(self.speedrev_entry, 13, 1)
  6753. # Dwell Reverse
  6754. self.dwellrev_entry = FCDoubleSpinner()
  6755. self.dwellrev_entry.set_precision(self.decimals)
  6756. self.dwellrev_entry.set_range(0.0000001, 9999.9999)
  6757. self.dwellrev_entry.setSingleStep(0.1)
  6758. self.dwellrev_label = QtWidgets.QLabel('%s:' % _("Dwell REV"))
  6759. self.dwellrev_label.setToolTip(
  6760. _("Pause after solder paste dispenser retracted,\n"
  6761. "to allow pressure equilibrium.")
  6762. )
  6763. grid0.addWidget(self.dwellrev_label, 14, 0)
  6764. grid0.addWidget(self.dwellrev_entry, 14, 1)
  6765. # Preprocessors
  6766. pp_label = QtWidgets.QLabel('%s:' % _('Preprocessor'))
  6767. pp_label.setToolTip(
  6768. _("Files that control the GCode generation.")
  6769. )
  6770. self.pp_combo = FCComboBox()
  6771. grid0.addWidget(pp_label, 15, 0)
  6772. grid0.addWidget(self.pp_combo, 15, 1)
  6773. self.layout.addStretch()
  6774. class ToolsSubPrefGroupUI(OptionsGroupUI):
  6775. def __init__(self, decimals=4, parent=None):
  6776. super(ToolsSubPrefGroupUI, self).__init__(self)
  6777. self.setTitle(str(_("Substractor Tool Options")))
  6778. self.decimals = decimals
  6779. # ## Subtractor Tool Parameters
  6780. self.sublabel = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  6781. self.sublabel.setToolTip(
  6782. _("A tool to substract one Gerber or Geometry object\n"
  6783. "from another of the same type.")
  6784. )
  6785. self.layout.addWidget(self.sublabel)
  6786. self.close_paths_cb = FCCheckBox(_("Close paths"))
  6787. self.close_paths_cb.setToolTip(_("Checking this will close the paths cut by the Geometry substractor object."))
  6788. self.layout.addWidget(self.close_paths_cb)
  6789. self.layout.addStretch()
  6790. class Tools2RulesCheckPrefGroupUI(OptionsGroupUI):
  6791. def __init__(self, decimals=4, parent=None):
  6792. super(Tools2RulesCheckPrefGroupUI, self).__init__(self)
  6793. self.setTitle(str(_("Check Rules Tool Options")))
  6794. self.decimals = decimals
  6795. self.crlabel = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  6796. self.crlabel.setToolTip(
  6797. _("A tool to check if Gerber files are within a set\n"
  6798. "of Manufacturing Rules.")
  6799. )
  6800. self.layout.addWidget(self.crlabel)
  6801. # Form Layout
  6802. self.form_layout_1 = QtWidgets.QFormLayout()
  6803. self.layout.addLayout(self.form_layout_1)
  6804. # Trace size
  6805. self.trace_size_cb = FCCheckBox('%s:' % _("Trace Size"))
  6806. self.trace_size_cb.setToolTip(
  6807. _("This checks if the minimum size for traces is met.")
  6808. )
  6809. self.form_layout_1.addRow(self.trace_size_cb)
  6810. # Trace size value
  6811. self.trace_size_entry = FCDoubleSpinner()
  6812. self.trace_size_entry.set_range(0.00001, 999.99999)
  6813. self.trace_size_entry.set_precision(self.decimals)
  6814. self.trace_size_entry.setSingleStep(0.1)
  6815. self.trace_size_lbl = QtWidgets.QLabel('%s:' % _("Min value"))
  6816. self.trace_size_lbl.setToolTip(
  6817. _("Minimum acceptable trace size.")
  6818. )
  6819. self.form_layout_1.addRow(self.trace_size_lbl, self.trace_size_entry)
  6820. # Copper2copper clearance
  6821. self.clearance_copper2copper_cb = FCCheckBox('%s:' % _("Copper to Copper clearance"))
  6822. self.clearance_copper2copper_cb.setToolTip(
  6823. _("This checks if the minimum clearance between copper\n"
  6824. "features is met.")
  6825. )
  6826. self.form_layout_1.addRow(self.clearance_copper2copper_cb)
  6827. # Copper2copper clearance value
  6828. self.clearance_copper2copper_entry = FCDoubleSpinner()
  6829. self.clearance_copper2copper_entry.set_range(0.00001, 999.99999)
  6830. self.clearance_copper2copper_entry.set_precision(self.decimals)
  6831. self.clearance_copper2copper_entry.setSingleStep(0.1)
  6832. self.clearance_copper2copper_lbl = QtWidgets.QLabel('%s:' % _("Min value"))
  6833. self.clearance_copper2copper_lbl.setToolTip(
  6834. _("Minimum acceptable clearance value.")
  6835. )
  6836. self.form_layout_1.addRow(self.clearance_copper2copper_lbl, self.clearance_copper2copper_entry)
  6837. # Copper2outline clearance
  6838. self.clearance_copper2ol_cb = FCCheckBox('%s:' % _("Copper to Outline clearance"))
  6839. self.clearance_copper2ol_cb.setToolTip(
  6840. _("This checks if the minimum clearance between copper\n"
  6841. "features and the outline is met.")
  6842. )
  6843. self.form_layout_1.addRow(self.clearance_copper2ol_cb)
  6844. # Copper2outline clearance value
  6845. self.clearance_copper2ol_entry = FCDoubleSpinner()
  6846. self.clearance_copper2ol_entry.set_range(0.00001, 999.99999)
  6847. self.clearance_copper2ol_entry.set_precision(self.decimals)
  6848. self.clearance_copper2ol_entry.setSingleStep(0.1)
  6849. self.clearance_copper2ol_lbl = QtWidgets.QLabel('%s:' % _("Min value"))
  6850. self.clearance_copper2ol_lbl.setToolTip(
  6851. _("Minimum acceptable clearance value.")
  6852. )
  6853. self.form_layout_1.addRow(self.clearance_copper2ol_lbl, self.clearance_copper2ol_entry)
  6854. # Silkscreen2silkscreen clearance
  6855. self.clearance_silk2silk_cb = FCCheckBox('%s:' % _("Silk to Silk Clearance"))
  6856. self.clearance_silk2silk_cb.setToolTip(
  6857. _("This checks if the minimum clearance between silkscreen\n"
  6858. "features and silkscreen features is met.")
  6859. )
  6860. self.form_layout_1.addRow(self.clearance_silk2silk_cb)
  6861. # Copper2silkscreen clearance value
  6862. self.clearance_silk2silk_entry = FCDoubleSpinner()
  6863. self.clearance_silk2silk_entry.set_range(0.00001, 999.99999)
  6864. self.clearance_silk2silk_entry.set_precision(self.decimals)
  6865. self.clearance_silk2silk_entry.setSingleStep(0.1)
  6866. self.clearance_silk2silk_lbl = QtWidgets.QLabel('%s:' % _("Min value"))
  6867. self.clearance_silk2silk_lbl.setToolTip(
  6868. _("Minimum acceptable clearance value.")
  6869. )
  6870. self.form_layout_1.addRow(self.clearance_silk2silk_lbl, self.clearance_silk2silk_entry)
  6871. # Silkscreen2soldermask clearance
  6872. self.clearance_silk2sm_cb = FCCheckBox('%s:' % _("Silk to Solder Mask Clearance"))
  6873. self.clearance_silk2sm_cb.setToolTip(
  6874. _("This checks if the minimum clearance between silkscreen\n"
  6875. "features and soldermask features is met.")
  6876. )
  6877. self.form_layout_1.addRow(self.clearance_silk2sm_cb)
  6878. # Silkscreen2soldermask clearance value
  6879. self.clearance_silk2sm_entry = FCDoubleSpinner()
  6880. self.clearance_silk2sm_entry.set_range(0.00001, 999.99999)
  6881. self.clearance_silk2sm_entry.set_precision(self.decimals)
  6882. self.clearance_silk2sm_entry.setSingleStep(0.1)
  6883. self.clearance_silk2sm_lbl = QtWidgets.QLabel('%s:' % _("Min value"))
  6884. self.clearance_silk2sm_lbl.setToolTip(
  6885. _("Minimum acceptable clearance value.")
  6886. )
  6887. self.form_layout_1.addRow(self.clearance_silk2sm_lbl, self.clearance_silk2sm_entry)
  6888. # Silk2outline clearance
  6889. self.clearance_silk2ol_cb = FCCheckBox('%s:' % _("Silk to Outline Clearance"))
  6890. self.clearance_silk2ol_cb.setToolTip(
  6891. _("This checks if the minimum clearance between silk\n"
  6892. "features and the outline is met.")
  6893. )
  6894. self.form_layout_1.addRow(self.clearance_silk2ol_cb)
  6895. # Silk2outline clearance value
  6896. self.clearance_silk2ol_entry = FCDoubleSpinner()
  6897. self.clearance_silk2ol_entry.set_range(0.00001, 999.99999)
  6898. self.clearance_silk2ol_entry.set_precision(self.decimals)
  6899. self.clearance_silk2ol_entry.setSingleStep(0.1)
  6900. self.clearance_silk2ol_lbl = QtWidgets.QLabel('%s:' % _("Min value"))
  6901. self.clearance_silk2ol_lbl.setToolTip(
  6902. _("Minimum acceptable clearance value.")
  6903. )
  6904. self.form_layout_1.addRow(self.clearance_silk2ol_lbl, self.clearance_silk2ol_entry)
  6905. # Soldermask2soldermask clearance
  6906. self.clearance_sm2sm_cb = FCCheckBox('%s:' % _("Minimum Solder Mask Sliver"))
  6907. self.clearance_sm2sm_cb.setToolTip(
  6908. _("This checks if the minimum clearance between soldermask\n"
  6909. "features and soldermask features is met.")
  6910. )
  6911. self.form_layout_1.addRow(self.clearance_sm2sm_cb)
  6912. # Soldermask2soldermask clearance value
  6913. self.clearance_sm2sm_entry = FCDoubleSpinner()
  6914. self.clearance_sm2sm_entry.set_range(0.00001, 999.99999)
  6915. self.clearance_sm2sm_entry.set_precision(self.decimals)
  6916. self.clearance_sm2sm_entry.setSingleStep(0.1)
  6917. self.clearance_sm2sm_lbl = QtWidgets.QLabel('%s:' % _("Min value"))
  6918. self.clearance_sm2sm_lbl.setToolTip(
  6919. _("Minimum acceptable clearance value.")
  6920. )
  6921. self.form_layout_1.addRow(self.clearance_sm2sm_lbl, self.clearance_sm2sm_entry)
  6922. # Ring integrity check
  6923. self.ring_integrity_cb = FCCheckBox('%s:' % _("Minimum Annular Ring"))
  6924. self.ring_integrity_cb.setToolTip(
  6925. _("This checks if the minimum copper ring left by drilling\n"
  6926. "a hole into a pad is met.")
  6927. )
  6928. self.form_layout_1.addRow(self.ring_integrity_cb)
  6929. # Ring integrity value
  6930. self.ring_integrity_entry = FCDoubleSpinner()
  6931. self.ring_integrity_entry.set_range(0.00001, 999.99999)
  6932. self.ring_integrity_entry.set_precision(self.decimals)
  6933. self.ring_integrity_entry.setSingleStep(0.1)
  6934. self.ring_integrity_lbl = QtWidgets.QLabel('%s:' % _("Min value"))
  6935. self.ring_integrity_lbl.setToolTip(
  6936. _("Minimum acceptable ring value.")
  6937. )
  6938. self.form_layout_1.addRow(self.ring_integrity_lbl, self.ring_integrity_entry)
  6939. self.form_layout_1.addRow(QtWidgets.QLabel(""))
  6940. # Hole2Hole clearance
  6941. self.clearance_d2d_cb = FCCheckBox('%s:' % _("Hole to Hole Clearance"))
  6942. self.clearance_d2d_cb.setToolTip(
  6943. _("This checks if the minimum clearance between a drill hole\n"
  6944. "and another drill hole is met.")
  6945. )
  6946. self.form_layout_1.addRow(self.clearance_d2d_cb)
  6947. # Hole2Hole clearance value
  6948. self.clearance_d2d_entry = FCDoubleSpinner()
  6949. self.clearance_d2d_entry.set_range(0.00001, 999.99999)
  6950. self.clearance_d2d_entry.set_precision(self.decimals)
  6951. self.clearance_d2d_entry.setSingleStep(0.1)
  6952. self.clearance_d2d_lbl = QtWidgets.QLabel('%s:' % _("Min value"))
  6953. self.clearance_d2d_lbl.setToolTip(
  6954. _("Minimum acceptable drill size.")
  6955. )
  6956. self.form_layout_1.addRow(self.clearance_d2d_lbl, self.clearance_d2d_entry)
  6957. # Drill holes size check
  6958. self.drill_size_cb = FCCheckBox('%s:' % _("Hole Size"))
  6959. self.drill_size_cb.setToolTip(
  6960. _("This checks if the drill holes\n"
  6961. "sizes are above the threshold.")
  6962. )
  6963. self.form_layout_1.addRow(self.drill_size_cb)
  6964. # Drile holes value
  6965. self.drill_size_entry = FCDoubleSpinner()
  6966. self.drill_size_entry.set_range(0.00001, 999.99999)
  6967. self.drill_size_entry.set_precision(self.decimals)
  6968. self.drill_size_entry.setSingleStep(0.1)
  6969. self.drill_size_lbl = QtWidgets.QLabel('%s:' % _("Min value"))
  6970. self.drill_size_lbl.setToolTip(
  6971. _("Minimum acceptable clearance value.")
  6972. )
  6973. self.form_layout_1.addRow(self.drill_size_lbl, self.drill_size_entry)
  6974. self.layout.addStretch()
  6975. class Tools2OptimalPrefGroupUI(OptionsGroupUI):
  6976. def __init__(self, decimals=4, parent=None):
  6977. super(Tools2OptimalPrefGroupUI, self).__init__(self)
  6978. self.setTitle(str(_("Optimal Tool Options")))
  6979. self.decimals = decimals
  6980. # ## Parameters
  6981. self.optlabel = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  6982. self.optlabel.setToolTip(
  6983. _("A tool to find the minimum distance between\n"
  6984. "every two Gerber geometric elements")
  6985. )
  6986. self.layout.addWidget(self.optlabel)
  6987. grid0 = QtWidgets.QGridLayout()
  6988. self.layout.addLayout(grid0)
  6989. grid0.setColumnStretch(0, 0)
  6990. grid0.setColumnStretch(1, 1)
  6991. self.precision_sp = FCSpinner()
  6992. self.precision_sp.set_range(2, 10)
  6993. self.precision_sp.set_step(1)
  6994. self.precision_sp.setWrapping(True)
  6995. self.precision_lbl = QtWidgets.QLabel('%s:' % _("Precision"))
  6996. self.precision_lbl.setToolTip(
  6997. _("Number of decimals for the distances and coordinates in this tool.")
  6998. )
  6999. grid0.addWidget(self.precision_lbl, 0, 0)
  7000. grid0.addWidget(self.precision_sp, 0, 1)
  7001. self.layout.addStretch()
  7002. class Tools2QRCodePrefGroupUI(OptionsGroupUI):
  7003. def __init__(self, decimals=4, parent=None):
  7004. super(Tools2QRCodePrefGroupUI, self).__init__(self)
  7005. self.setTitle(str(_("QRCode Tool Options")))
  7006. self.decimals = decimals
  7007. # ## Parameters
  7008. self.qrlabel = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  7009. self.qrlabel.setToolTip(
  7010. _("A tool to create a QRCode that can be inserted\n"
  7011. "into a selected Gerber file, or it can be exported as a file.")
  7012. )
  7013. self.layout.addWidget(self.qrlabel)
  7014. # ## Grid Layout
  7015. grid_lay = QtWidgets.QGridLayout()
  7016. self.layout.addLayout(grid_lay)
  7017. grid_lay.setColumnStretch(0, 0)
  7018. grid_lay.setColumnStretch(1, 1)
  7019. # VERSION #
  7020. self.version_label = QtWidgets.QLabel('%s:' % _("Version"))
  7021. self.version_label.setToolTip(
  7022. _("QRCode version can have values from 1 (21x21 boxes)\n"
  7023. "to 40 (177x177 boxes).")
  7024. )
  7025. self.version_entry = FCSpinner()
  7026. self.version_entry.set_range(1, 40)
  7027. self.version_entry.setWrapping(True)
  7028. grid_lay.addWidget(self.version_label, 1, 0)
  7029. grid_lay.addWidget(self.version_entry, 1, 1)
  7030. # ERROR CORRECTION #
  7031. self.error_label = QtWidgets.QLabel('%s:' % _("Error correction"))
  7032. self.error_label.setToolTip(
  7033. _("Parameter that controls the error correction used for the QR Code.\n"
  7034. "L = maximum 7%% errors can be corrected\n"
  7035. "M = maximum 15%% errors can be corrected\n"
  7036. "Q = maximum 25%% errors can be corrected\n"
  7037. "H = maximum 30%% errors can be corrected.")
  7038. )
  7039. self.error_radio = RadioSet([{'label': 'L', 'value': 'L'},
  7040. {'label': 'M', 'value': 'M'},
  7041. {'label': 'Q', 'value': 'Q'},
  7042. {'label': 'H', 'value': 'H'}])
  7043. self.error_radio.setToolTip(
  7044. _("Parameter that controls the error correction used for the QR Code.\n"
  7045. "L = maximum 7%% errors can be corrected\n"
  7046. "M = maximum 15%% errors can be corrected\n"
  7047. "Q = maximum 25%% errors can be corrected\n"
  7048. "H = maximum 30%% errors can be corrected.")
  7049. )
  7050. grid_lay.addWidget(self.error_label, 2, 0)
  7051. grid_lay.addWidget(self.error_radio, 2, 1)
  7052. # BOX SIZE #
  7053. self.bsize_label = QtWidgets.QLabel('%s:' % _("Box Size"))
  7054. self.bsize_label.setToolTip(
  7055. _("Box size control the overall size of the QRcode\n"
  7056. "by adjusting the size of each box in the code.")
  7057. )
  7058. self.bsize_entry = FCSpinner()
  7059. self.bsize_entry.set_range(1, 9999)
  7060. self.bsize_entry.setWrapping(True)
  7061. grid_lay.addWidget(self.bsize_label, 3, 0)
  7062. grid_lay.addWidget(self.bsize_entry, 3, 1)
  7063. # BORDER SIZE #
  7064. self.border_size_label = QtWidgets.QLabel('%s:' % _("Border Size"))
  7065. self.border_size_label.setToolTip(
  7066. _("Size of the QRCode border. How many boxes thick is the border.\n"
  7067. "Default value is 4. The width of the clearance around the QRCode.")
  7068. )
  7069. self.border_size_entry = FCSpinner()
  7070. self.border_size_entry.set_range(1, 9999)
  7071. self.border_size_entry.setWrapping(True)
  7072. grid_lay.addWidget(self.border_size_label, 4, 0)
  7073. grid_lay.addWidget(self.border_size_entry, 4, 1)
  7074. # Text box
  7075. self.text_label = QtWidgets.QLabel('%s:' % _("QRCode Data"))
  7076. self.text_label.setToolTip(
  7077. _("QRCode Data. Alphanumeric text to be encoded in the QRCode.")
  7078. )
  7079. self.text_data = FCTextArea()
  7080. self.text_data.setPlaceholderText(
  7081. _("Add here the text to be included in the QRCode...")
  7082. )
  7083. grid_lay.addWidget(self.text_label, 5, 0)
  7084. grid_lay.addWidget(self.text_data, 6, 0, 1, 2)
  7085. # POLARITY CHOICE #
  7086. self.pol_label = QtWidgets.QLabel('%s:' % _("Polarity"))
  7087. self.pol_label.setToolTip(
  7088. _("Choose the polarity of the QRCode.\n"
  7089. "It can be drawn in a negative way (squares are clear)\n"
  7090. "or in a positive way (squares are opaque).")
  7091. )
  7092. self.pol_radio = RadioSet([{'label': _('Negative'), 'value': 'neg'},
  7093. {'label': _('Positive'), 'value': 'pos'}])
  7094. self.pol_radio.setToolTip(
  7095. _("Choose the type of QRCode to be created.\n"
  7096. "If added on a Silkscreen Gerber file the QRCode may\n"
  7097. "be added as positive. If it is added to a Copper Gerber\n"
  7098. "file then perhaps the QRCode can be added as negative.")
  7099. )
  7100. grid_lay.addWidget(self.pol_label, 7, 0)
  7101. grid_lay.addWidget(self.pol_radio, 7, 1)
  7102. # BOUNDING BOX TYPE #
  7103. self.bb_label = QtWidgets.QLabel('%s:' % _("Bounding Box"))
  7104. self.bb_label.setToolTip(
  7105. _("The bounding box, meaning the empty space that surrounds\n"
  7106. "the QRCode geometry, can have a rounded or a square shape.")
  7107. )
  7108. self.bb_radio = RadioSet([{'label': _('Rounded'), 'value': 'r'},
  7109. {'label': _('Square'), 'value': 's'}])
  7110. self.bb_radio.setToolTip(
  7111. _("The bounding box, meaning the empty space that surrounds\n"
  7112. "the QRCode geometry, can have a rounded or a square shape.")
  7113. )
  7114. grid_lay.addWidget(self.bb_label, 8, 0)
  7115. grid_lay.addWidget(self.bb_radio, 8, 1)
  7116. # FILL COLOR #
  7117. self.fill_color_label = QtWidgets.QLabel('%s:' % _('Fill Color'))
  7118. self.fill_color_label.setToolTip(
  7119. _("Set the QRCode fill color (squares color).")
  7120. )
  7121. self.fill_color_entry = FCEntry()
  7122. self.fill_color_button = QtWidgets.QPushButton()
  7123. self.fill_color_button.setFixedSize(15, 15)
  7124. fill_lay_child = QtWidgets.QHBoxLayout()
  7125. fill_lay_child.setContentsMargins(0, 0, 0, 0)
  7126. fill_lay_child.addWidget(self.fill_color_entry)
  7127. fill_lay_child.addWidget(self.fill_color_button, alignment=Qt.AlignRight)
  7128. fill_lay_child.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  7129. fill_color_widget = QtWidgets.QWidget()
  7130. fill_color_widget.setLayout(fill_lay_child)
  7131. grid_lay.addWidget(self.fill_color_label, 9, 0)
  7132. grid_lay.addWidget(fill_color_widget, 9, 1)
  7133. # BACK COLOR #
  7134. self.back_color_label = QtWidgets.QLabel('%s:' % _('Back Color'))
  7135. self.back_color_label.setToolTip(
  7136. _("Set the QRCode background color.")
  7137. )
  7138. self.back_color_entry = FCEntry()
  7139. self.back_color_button = QtWidgets.QPushButton()
  7140. self.back_color_button.setFixedSize(15, 15)
  7141. back_lay_child = QtWidgets.QHBoxLayout()
  7142. back_lay_child.setContentsMargins(0, 0, 0, 0)
  7143. back_lay_child.addWidget(self.back_color_entry)
  7144. back_lay_child.addWidget(self.back_color_button, alignment=Qt.AlignRight)
  7145. back_lay_child.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  7146. back_color_widget = QtWidgets.QWidget()
  7147. back_color_widget.setLayout(back_lay_child)
  7148. grid_lay.addWidget(self.back_color_label, 10, 0)
  7149. grid_lay.addWidget(back_color_widget, 10, 1)
  7150. # Selection Limit
  7151. self.sel_limit_label = QtWidgets.QLabel('%s:' % _("Selection limit"))
  7152. self.sel_limit_label.setToolTip(
  7153. _("Set the number of selected geometry\n"
  7154. "items above which the utility geometry\n"
  7155. "becomes just a selection rectangle.\n"
  7156. "Increases the performance when moving a\n"
  7157. "large number of geometric elements.")
  7158. )
  7159. self.sel_limit_entry = FCSpinner()
  7160. self.sel_limit_entry.set_range(0, 9999)
  7161. grid_lay.addWidget(self.sel_limit_label, 11, 0)
  7162. grid_lay.addWidget(self.sel_limit_entry, 11, 1)
  7163. # self.layout.addStretch()
  7164. class Tools2CThievingPrefGroupUI(OptionsGroupUI):
  7165. def __init__(self, decimals=4, parent=None):
  7166. super(Tools2CThievingPrefGroupUI, self).__init__(self)
  7167. self.setTitle(str(_("Copper Thieving Tool Options")))
  7168. self.decimals = decimals
  7169. # ## Grid Layout
  7170. grid_lay = QtWidgets.QGridLayout()
  7171. self.layout.addLayout(grid_lay)
  7172. grid_lay.setColumnStretch(0, 0)
  7173. grid_lay.setColumnStretch(1, 1)
  7174. # ## Parameters
  7175. self.cflabel = QtWidgets.QLabel('<b>%s</b>' % _('Parameters'))
  7176. self.cflabel.setToolTip(
  7177. _("A tool to generate a Copper Thieving that can be added\n"
  7178. "to a selected Gerber file.")
  7179. )
  7180. grid_lay.addWidget(self.cflabel, 0, 0, 1, 2)
  7181. # CIRCLE STEPS - to be used when buffering
  7182. self.circle_steps_lbl = QtWidgets.QLabel('%s:' % _("Circle Steps"))
  7183. self.circle_steps_lbl.setToolTip(
  7184. _("Number of steps (lines) used to interpolate circles.")
  7185. )
  7186. self.circlesteps_entry = FCSpinner()
  7187. self.circlesteps_entry.set_range(1, 9999)
  7188. grid_lay.addWidget(self.circle_steps_lbl, 1, 0)
  7189. grid_lay.addWidget(self.circlesteps_entry, 1, 1)
  7190. # CLEARANCE #
  7191. self.clearance_label = QtWidgets.QLabel('%s:' % _("Clearance"))
  7192. self.clearance_label.setToolTip(
  7193. _("This set the distance between the copper Thieving components\n"
  7194. "(the polygon fill may be split in multiple polygons)\n"
  7195. "and the copper traces in the Gerber file.")
  7196. )
  7197. self.clearance_entry = FCDoubleSpinner()
  7198. self.clearance_entry.setMinimum(0.00001)
  7199. self.clearance_entry.set_precision(self.decimals)
  7200. self.clearance_entry.setSingleStep(0.1)
  7201. grid_lay.addWidget(self.clearance_label, 2, 0)
  7202. grid_lay.addWidget(self.clearance_entry, 2, 1)
  7203. # MARGIN #
  7204. self.margin_label = QtWidgets.QLabel('%s:' % _("Margin"))
  7205. self.margin_label.setToolTip(
  7206. _("Bounding box margin.")
  7207. )
  7208. self.margin_entry = FCDoubleSpinner()
  7209. self.margin_entry.setMinimum(0.0)
  7210. self.margin_entry.set_precision(self.decimals)
  7211. self.margin_entry.setSingleStep(0.1)
  7212. grid_lay.addWidget(self.margin_label, 3, 0)
  7213. grid_lay.addWidget(self.margin_entry, 3, 1)
  7214. # Reference #
  7215. self.reference_radio = RadioSet([
  7216. {'label': _('Itself'), 'value': 'itself'},
  7217. {"label": _("Area Selection"), "value": "area"},
  7218. {'label': _("Reference Object"), 'value': 'box'}
  7219. ], orientation='vertical', stretch=False)
  7220. self.reference_label = QtWidgets.QLabel(_("Reference:"))
  7221. self.reference_label.setToolTip(
  7222. _("- 'Itself' - the copper Thieving extent is based on the object extent.\n"
  7223. "- 'Area Selection' - left mouse click to start selection of the area to be filled.\n"
  7224. "- 'Reference Object' - will do copper thieving within the area specified by another object.")
  7225. )
  7226. grid_lay.addWidget(self.reference_label, 4, 0)
  7227. grid_lay.addWidget(self.reference_radio, 4, 1)
  7228. # Bounding Box Type #
  7229. self.bbox_type_radio = RadioSet([
  7230. {'label': _('Rectangular'), 'value': 'rect'},
  7231. {"label": _("Minimal"), "value": "min"}
  7232. ], stretch=False)
  7233. self.bbox_type_label = QtWidgets.QLabel(_("Box Type:"))
  7234. self.bbox_type_label.setToolTip(
  7235. _("- 'Rectangular' - the bounding box will be of rectangular shape.\n"
  7236. "- 'Minimal' - the bounding box will be the convex hull shape.")
  7237. )
  7238. grid_lay.addWidget(self.bbox_type_label, 5, 0)
  7239. grid_lay.addWidget(self.bbox_type_radio, 5, 1)
  7240. separator_line = QtWidgets.QFrame()
  7241. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  7242. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  7243. grid_lay.addWidget(separator_line, 6, 0, 1, 2)
  7244. # Fill Type
  7245. self.fill_type_radio = RadioSet([
  7246. {'label': _('Solid'), 'value': 'solid'},
  7247. {"label": _("Dots Grid"), "value": "dot"},
  7248. {"label": _("Squares Grid"), "value": "square"},
  7249. {"label": _("Lines Grid"), "value": "line"}
  7250. ], orientation='vertical', stretch=False)
  7251. self.fill_type_label = QtWidgets.QLabel(_("Fill Type:"))
  7252. self.fill_type_label.setToolTip(
  7253. _("- 'Solid' - copper thieving will be a solid polygon.\n"
  7254. "- 'Dots Grid' - the empty area will be filled with a pattern of dots.\n"
  7255. "- 'Squares Grid' - the empty area will be filled with a pattern of squares.\n"
  7256. "- 'Lines Grid' - the empty area will be filled with a pattern of lines.")
  7257. )
  7258. grid_lay.addWidget(self.fill_type_label, 7, 0)
  7259. grid_lay.addWidget(self.fill_type_radio, 7, 1)
  7260. self.dots_label = QtWidgets.QLabel('<b>%s</b>:' % _("Dots Grid Parameters"))
  7261. grid_lay.addWidget(self.dots_label, 8, 0, 1, 2)
  7262. # Dot diameter #
  7263. self.dotdia_label = QtWidgets.QLabel('%s:' % _("Dia"))
  7264. self.dotdia_label.setToolTip(
  7265. _("Dot diameter in Dots Grid.")
  7266. )
  7267. self.dot_dia_entry = FCDoubleSpinner()
  7268. self.dot_dia_entry.set_range(0.0, 9999.9999)
  7269. self.dot_dia_entry.set_precision(self.decimals)
  7270. self.dot_dia_entry.setSingleStep(0.1)
  7271. grid_lay.addWidget(self.dotdia_label, 9, 0)
  7272. grid_lay.addWidget(self.dot_dia_entry, 9, 1)
  7273. # Dot spacing #
  7274. self.dotspacing_label = QtWidgets.QLabel('%s:' % _("Spacing"))
  7275. self.dotspacing_label.setToolTip(
  7276. _("Distance between each two dots in Dots Grid.")
  7277. )
  7278. self.dot_spacing_entry = FCDoubleSpinner()
  7279. self.dot_spacing_entry.set_range(0.0, 9999.9999)
  7280. self.dot_spacing_entry.set_precision(self.decimals)
  7281. self.dot_spacing_entry.setSingleStep(0.1)
  7282. grid_lay.addWidget(self.dotspacing_label, 10, 0)
  7283. grid_lay.addWidget(self.dot_spacing_entry, 10, 1)
  7284. self.squares_label = QtWidgets.QLabel('<b>%s</b>:' % _("Squares Grid Parameters"))
  7285. grid_lay.addWidget(self.squares_label, 11, 0, 1, 2)
  7286. # Square Size #
  7287. self.square_size_label = QtWidgets.QLabel('%s:' % _("Size"))
  7288. self.square_size_label.setToolTip(
  7289. _("Square side size in Squares Grid.")
  7290. )
  7291. self.square_size_entry = FCDoubleSpinner()
  7292. self.square_size_entry.set_range(0.0, 9999.9999)
  7293. self.square_size_entry.set_precision(self.decimals)
  7294. self.square_size_entry.setSingleStep(0.1)
  7295. grid_lay.addWidget(self.square_size_label, 12, 0)
  7296. grid_lay.addWidget(self.square_size_entry, 12, 1)
  7297. # Squares spacing #
  7298. self.squares_spacing_label = QtWidgets.QLabel('%s:' % _("Spacing"))
  7299. self.squares_spacing_label.setToolTip(
  7300. _("Distance between each two squares in Squares Grid.")
  7301. )
  7302. self.squares_spacing_entry = FCDoubleSpinner()
  7303. self.squares_spacing_entry.set_range(0.0, 9999.9999)
  7304. self.squares_spacing_entry.set_precision(self.decimals)
  7305. self.squares_spacing_entry.setSingleStep(0.1)
  7306. grid_lay.addWidget(self.squares_spacing_label, 13, 0)
  7307. grid_lay.addWidget(self.squares_spacing_entry, 13, 1)
  7308. self.lines_label = QtWidgets.QLabel('<b>%s</b>:' % _("Lines Grid Parameters"))
  7309. grid_lay.addWidget(self.lines_label, 14, 0, 1, 2)
  7310. # Square Size #
  7311. self.line_size_label = QtWidgets.QLabel('%s:' % _("Size"))
  7312. self.line_size_label.setToolTip(
  7313. _("Line thickness size in Lines Grid.")
  7314. )
  7315. self.line_size_entry = FCDoubleSpinner()
  7316. self.line_size_entry.set_range(0.0, 9999.9999)
  7317. self.line_size_entry.set_precision(self.decimals)
  7318. self.line_size_entry.setSingleStep(0.1)
  7319. grid_lay.addWidget(self.line_size_label, 15, 0)
  7320. grid_lay.addWidget(self.line_size_entry, 15, 1)
  7321. # Lines spacing #
  7322. self.lines_spacing_label = QtWidgets.QLabel('%s:' % _("Spacing"))
  7323. self.lines_spacing_label.setToolTip(
  7324. _("Distance between each two lines in Lines Grid.")
  7325. )
  7326. self.lines_spacing_entry = FCDoubleSpinner()
  7327. self.lines_spacing_entry.set_range(0.0, 9999.9999)
  7328. self.lines_spacing_entry.set_precision(self.decimals)
  7329. self.lines_spacing_entry.setSingleStep(0.1)
  7330. grid_lay.addWidget(self.lines_spacing_label, 16, 0)
  7331. grid_lay.addWidget(self.lines_spacing_entry, 16, 1)
  7332. self.robber_bar_label = QtWidgets.QLabel('<b>%s</b>' % _('Robber Bar Parameters'))
  7333. self.robber_bar_label.setToolTip(
  7334. _("Parameters used for the robber bar.\n"
  7335. "Robber bar = copper border to help in pattern hole plating.")
  7336. )
  7337. grid_lay.addWidget(self.robber_bar_label, 17, 0, 1, 2)
  7338. # ROBBER BAR MARGIN #
  7339. self.rb_margin_label = QtWidgets.QLabel('%s:' % _("Margin"))
  7340. self.rb_margin_label.setToolTip(
  7341. _("Bounding box margin for robber bar.")
  7342. )
  7343. self.rb_margin_entry = FCDoubleSpinner()
  7344. self.rb_margin_entry.set_range(-9999.9999, 9999.9999)
  7345. self.rb_margin_entry.set_precision(self.decimals)
  7346. self.rb_margin_entry.setSingleStep(0.1)
  7347. grid_lay.addWidget(self.rb_margin_label, 18, 0)
  7348. grid_lay.addWidget(self.rb_margin_entry, 18, 1)
  7349. # THICKNESS #
  7350. self.rb_thickness_label = QtWidgets.QLabel('%s:' % _("Thickness"))
  7351. self.rb_thickness_label.setToolTip(
  7352. _("The robber bar thickness.")
  7353. )
  7354. self.rb_thickness_entry = FCDoubleSpinner()
  7355. self.rb_thickness_entry.set_range(0.0000, 9999.9999)
  7356. self.rb_thickness_entry.set_precision(self.decimals)
  7357. self.rb_thickness_entry.setSingleStep(0.1)
  7358. grid_lay.addWidget(self.rb_thickness_label, 19, 0)
  7359. grid_lay.addWidget(self.rb_thickness_entry, 19, 1)
  7360. self.patern_mask_label = QtWidgets.QLabel('<b>%s</b>' % _('Pattern Plating Mask'))
  7361. self.patern_mask_label.setToolTip(
  7362. _("Generate a mask for pattern plating.")
  7363. )
  7364. grid_lay.addWidget(self.patern_mask_label, 20, 0, 1, 2)
  7365. # Openings CLEARANCE #
  7366. self.clearance_ppm_label = QtWidgets.QLabel('%s:' % _("Clearance"))
  7367. self.clearance_ppm_label.setToolTip(
  7368. _("The distance between the possible copper thieving elements\n"
  7369. "and/or robber bar and the actual openings in the mask.")
  7370. )
  7371. self.clearance_ppm_entry = FCDoubleSpinner()
  7372. self.clearance_ppm_entry.set_range(-9999.9999, 9999.9999)
  7373. self.clearance_ppm_entry.set_precision(self.decimals)
  7374. self.clearance_ppm_entry.setSingleStep(0.1)
  7375. grid_lay.addWidget(self.clearance_ppm_label, 21, 0)
  7376. grid_lay.addWidget(self.clearance_ppm_entry, 21, 1)
  7377. self.layout.addStretch()
  7378. class Tools2FiducialsPrefGroupUI(OptionsGroupUI):
  7379. def __init__(self, decimals=4, parent=None):
  7380. super(Tools2FiducialsPrefGroupUI, self).__init__(self)
  7381. self.setTitle(str(_("Fiducials Tool Options")))
  7382. self.decimals = decimals
  7383. # ## Grid Layout
  7384. grid_lay = QtWidgets.QGridLayout()
  7385. self.layout.addLayout(grid_lay)
  7386. grid_lay.setColumnStretch(0, 0)
  7387. grid_lay.setColumnStretch(1, 1)
  7388. self.param_label = QtWidgets.QLabel('<b>%s:</b>' % _('Parameters'))
  7389. self.param_label.setToolTip(
  7390. _("Parameters used for this tool.")
  7391. )
  7392. grid_lay.addWidget(self.param_label, 0, 0, 1, 2)
  7393. # DIAMETER #
  7394. self.dia_label = QtWidgets.QLabel('%s:' % _("Size"))
  7395. self.dia_label.setToolTip(
  7396. _("This set the fiducial diameter if fiducial type is circular,\n"
  7397. "otherwise is the size of the fiducial.\n"
  7398. "The soldermask opening is double than that.")
  7399. )
  7400. self.dia_entry = FCDoubleSpinner()
  7401. self.dia_entry.set_range(1.0000, 3.0000)
  7402. self.dia_entry.set_precision(self.decimals)
  7403. self.dia_entry.setWrapping(True)
  7404. self.dia_entry.setSingleStep(0.1)
  7405. grid_lay.addWidget(self.dia_label, 1, 0)
  7406. grid_lay.addWidget(self.dia_entry, 1, 1)
  7407. # MARGIN #
  7408. self.margin_label = QtWidgets.QLabel('%s:' % _("Margin"))
  7409. self.margin_label.setToolTip(
  7410. _("Bounding box margin.")
  7411. )
  7412. self.margin_entry = FCDoubleSpinner()
  7413. self.margin_entry.set_range(-9999.9999, 9999.9999)
  7414. self.margin_entry.set_precision(self.decimals)
  7415. self.margin_entry.setSingleStep(0.1)
  7416. grid_lay.addWidget(self.margin_label, 2, 0)
  7417. grid_lay.addWidget(self.margin_entry, 2, 1)
  7418. # Mode #
  7419. self.mode_radio = RadioSet([
  7420. {'label': _('Auto'), 'value': 'auto'},
  7421. {"label": _("Manual"), "value": "manual"}
  7422. ], stretch=False)
  7423. self.mode_label = QtWidgets.QLabel(_("Mode:"))
  7424. self.mode_label.setToolTip(
  7425. _("- 'Auto' - automatic placement of fiducials in the corners of the bounding box.\n"
  7426. "- 'Manual' - manual placement of fiducials.")
  7427. )
  7428. grid_lay.addWidget(self.mode_label, 3, 0)
  7429. grid_lay.addWidget(self.mode_radio, 3, 1)
  7430. # Position for second fiducial #
  7431. self.pos_radio = RadioSet([
  7432. {'label': _('Up'), 'value': 'up'},
  7433. {"label": _("Down"), "value": "down"},
  7434. {"label": _("None"), "value": "no"}
  7435. ], stretch=False)
  7436. self.pos_label = QtWidgets.QLabel('%s:' % _("Second fiducial"))
  7437. self.pos_label.setToolTip(
  7438. _("The position for the second fiducial.\n"
  7439. "- 'Up' - the order is: bottom-left, top-left, top-right.\n"
  7440. "- 'Down' - the order is: bottom-left, bottom-right, top-right.\n"
  7441. "- 'None' - there is no second fiducial. The order is: bottom-left, top-right.")
  7442. )
  7443. grid_lay.addWidget(self.pos_label, 4, 0)
  7444. grid_lay.addWidget(self.pos_radio, 4, 1)
  7445. separator_line = QtWidgets.QFrame()
  7446. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  7447. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  7448. grid_lay.addWidget(separator_line, 5, 0, 1, 2)
  7449. # Fiducial type #
  7450. self.fid_type_radio = RadioSet([
  7451. {'label': _('Circular'), 'value': 'circular'},
  7452. {"label": _("Cross"), "value": "cross"},
  7453. {"label": _("Chess"), "value": "chess"}
  7454. ], stretch=False)
  7455. self.fid_type_label = QtWidgets.QLabel('%s:' % _("Fiducial Type"))
  7456. self.fid_type_label.setToolTip(
  7457. _("The type of fiducial.\n"
  7458. "- 'Circular' - this is the regular fiducial.\n"
  7459. "- 'Cross' - cross lines fiducial.\n"
  7460. "- 'Chess' - chess pattern fiducial.")
  7461. )
  7462. grid_lay.addWidget(self.fid_type_label, 6, 0)
  7463. grid_lay.addWidget(self.fid_type_radio, 6, 1)
  7464. # Line Thickness #
  7465. self.line_thickness_label = QtWidgets.QLabel('%s:' % _("Line thickness"))
  7466. self.line_thickness_label.setToolTip(
  7467. _("Bounding box margin.")
  7468. )
  7469. self.line_thickness_entry = FCDoubleSpinner()
  7470. self.line_thickness_entry.set_range(0.00001, 9999.9999)
  7471. self.line_thickness_entry.set_precision(self.decimals)
  7472. self.line_thickness_entry.setSingleStep(0.1)
  7473. grid_lay.addWidget(self.line_thickness_label, 7, 0)
  7474. grid_lay.addWidget(self.line_thickness_entry, 7, 1)
  7475. self.layout.addStretch()
  7476. class Tools2CalPrefGroupUI(OptionsGroupUI):
  7477. def __init__(self, decimals=4, parent=None):
  7478. super(Tools2CalPrefGroupUI, self).__init__(self)
  7479. self.setTitle(str(_("Calibration Tool Options")))
  7480. self.decimals = decimals
  7481. # ## Grid Layout
  7482. grid_lay = QtWidgets.QGridLayout()
  7483. self.layout.addLayout(grid_lay)
  7484. grid_lay.setColumnStretch(0, 0)
  7485. grid_lay.setColumnStretch(1, 1)
  7486. self.param_label = QtWidgets.QLabel('<b>%s:</b>' % _('Parameters'))
  7487. self.param_label.setToolTip(
  7488. _("Parameters used for this tool.")
  7489. )
  7490. grid_lay.addWidget(self.param_label, 0, 0, 1, 2)
  7491. # Calibration source
  7492. self.cal_source_lbl = QtWidgets.QLabel("<b>%s:</b>" % _("Source Type"))
  7493. self.cal_source_lbl.setToolTip(_("The source of calibration points.\n"
  7494. "It can be:\n"
  7495. "- Object -> click a hole geo for Excellon or a pad for Gerber\n"
  7496. "- Free -> click freely on canvas to acquire the calibration points"))
  7497. self.cal_source_radio = RadioSet([{'label': _('Object'), 'value': 'object'},
  7498. {'label': _('Free'), 'value': 'free'}],
  7499. stretch=False)
  7500. grid_lay.addWidget(self.cal_source_lbl, 1, 0)
  7501. grid_lay.addWidget(self.cal_source_radio, 1, 1, 1, 2)
  7502. separator_line = QtWidgets.QFrame()
  7503. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  7504. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  7505. grid_lay.addWidget(separator_line, 2, 0, 1, 2)
  7506. # Travel Z entry
  7507. travelz_lbl = QtWidgets.QLabel('%s:' % _("Travel Z"))
  7508. travelz_lbl.setToolTip(
  7509. _("Height (Z) for travelling between the points.")
  7510. )
  7511. self.travelz_entry = FCDoubleSpinner()
  7512. self.travelz_entry.set_range(-9999.9999, 9999.9999)
  7513. self.travelz_entry.set_precision(self.decimals)
  7514. self.travelz_entry.setSingleStep(0.1)
  7515. grid_lay.addWidget(travelz_lbl, 3, 0)
  7516. grid_lay.addWidget(self.travelz_entry, 3, 1, 1, 2)
  7517. # Verification Z entry
  7518. verz_lbl = QtWidgets.QLabel('%s:' % _("Verification Z"))
  7519. verz_lbl.setToolTip(
  7520. _("Height (Z) for checking the point.")
  7521. )
  7522. self.verz_entry = FCDoubleSpinner()
  7523. self.verz_entry.set_range(-9999.9999, 9999.9999)
  7524. self.verz_entry.set_precision(self.decimals)
  7525. self.verz_entry.setSingleStep(0.1)
  7526. grid_lay.addWidget(verz_lbl, 4, 0)
  7527. grid_lay.addWidget(self.verz_entry, 4, 1, 1, 2)
  7528. # Zero the Z of the verification tool
  7529. self.zeroz_cb = FCCheckBox('%s' % _("Zero Z tool"))
  7530. self.zeroz_cb.setToolTip(
  7531. _("Include a sequence to zero the height (Z)\n"
  7532. "of the verification tool.")
  7533. )
  7534. grid_lay.addWidget(self.zeroz_cb, 5, 0, 1, 3)
  7535. # Toochange Z entry
  7536. toolchangez_lbl = QtWidgets.QLabel('%s:' % _("Toolchange Z"))
  7537. toolchangez_lbl.setToolTip(
  7538. _("Height (Z) for mounting the verification probe.")
  7539. )
  7540. self.toolchangez_entry = FCDoubleSpinner()
  7541. self.toolchangez_entry.set_range(0.0000, 9999.9999)
  7542. self.toolchangez_entry.set_precision(self.decimals)
  7543. self.toolchangez_entry.setSingleStep(0.1)
  7544. grid_lay.addWidget(toolchangez_lbl, 6, 0)
  7545. grid_lay.addWidget(self.toolchangez_entry, 6, 1, 1, 2)
  7546. # Toolchange X-Y entry
  7547. toolchangexy_lbl = QtWidgets.QLabel('%s:' % _('Toolchange X-Y'))
  7548. toolchangexy_lbl.setToolTip(
  7549. _("Toolchange X,Y position.\n"
  7550. "If no value is entered then the current\n"
  7551. "(x, y) point will be used,")
  7552. )
  7553. self.toolchange_xy_entry = FCEntry()
  7554. grid_lay.addWidget(toolchangexy_lbl, 7, 0)
  7555. grid_lay.addWidget(self.toolchange_xy_entry, 7, 1, 1, 2)
  7556. # Second point choice
  7557. second_point_lbl = QtWidgets.QLabel('%s:' % _("Second point"))
  7558. second_point_lbl.setToolTip(
  7559. _("Second point in the Gcode verification can be:\n"
  7560. "- top-left -> the user will align the PCB vertically\n"
  7561. "- bottom-right -> the user will align the PCB horizontally")
  7562. )
  7563. self.second_point_radio = RadioSet([{'label': _('Top-Left'), 'value': 'tl'},
  7564. {'label': _('Bottom-Right'), 'value': 'br'}],
  7565. orientation='vertical')
  7566. grid_lay.addWidget(second_point_lbl, 8, 0)
  7567. grid_lay.addWidget(self.second_point_radio, 8, 1, 1, 2)
  7568. self.layout.addStretch()
  7569. class Tools2EDrillsPrefGroupUI(OptionsGroupUI):
  7570. def __init__(self, decimals=4, parent=None):
  7571. super(Tools2EDrillsPrefGroupUI, self).__init__(self)
  7572. self.setTitle(str(_("Extract Drills Options")))
  7573. self.decimals = decimals
  7574. # ## Grid Layout
  7575. grid_lay = QtWidgets.QGridLayout()
  7576. self.layout.addLayout(grid_lay)
  7577. grid_lay.setColumnStretch(0, 0)
  7578. grid_lay.setColumnStretch(1, 1)
  7579. self.param_label = QtWidgets.QLabel('<b>%s:</b>' % _('Parameters'))
  7580. self.param_label.setToolTip(
  7581. _("Parameters used for this tool.")
  7582. )
  7583. grid_lay.addWidget(self.param_label, 0, 0, 1, 2)
  7584. self.padt_label = QtWidgets.QLabel("<b>%s:</b>" % _("Processed Pads Type"))
  7585. self.padt_label.setToolTip(
  7586. _("The type of pads shape to be processed.\n"
  7587. "If the PCB has many SMD pads with rectangular pads,\n"
  7588. "disable the Rectangular aperture.")
  7589. )
  7590. grid_lay.addWidget(self.padt_label, 2, 0, 1, 2)
  7591. # Circular Aperture Selection
  7592. self.circular_cb = FCCheckBox('%s' % _("Circular"))
  7593. self.circular_cb.setToolTip(
  7594. _("Process Circular Pads.")
  7595. )
  7596. grid_lay.addWidget(self.circular_cb, 3, 0, 1, 2)
  7597. # Oblong Aperture Selection
  7598. self.oblong_cb = FCCheckBox('%s' % _("Oblong"))
  7599. self.oblong_cb.setToolTip(
  7600. _("Process Oblong Pads.")
  7601. )
  7602. grid_lay.addWidget(self.oblong_cb, 4, 0, 1, 2)
  7603. # Square Aperture Selection
  7604. self.square_cb = FCCheckBox('%s' % _("Square"))
  7605. self.square_cb.setToolTip(
  7606. _("Process Square Pads.")
  7607. )
  7608. grid_lay.addWidget(self.square_cb, 5, 0, 1, 2)
  7609. # Rectangular Aperture Selection
  7610. self.rectangular_cb = FCCheckBox('%s' % _("Rectangular"))
  7611. self.rectangular_cb.setToolTip(
  7612. _("Process Rectangular Pads.")
  7613. )
  7614. grid_lay.addWidget(self.rectangular_cb, 6, 0, 1, 2)
  7615. # Others type of Apertures Selection
  7616. self.other_cb = FCCheckBox('%s' % _("Others"))
  7617. self.other_cb.setToolTip(
  7618. _("Process pads not in the categories above.")
  7619. )
  7620. grid_lay.addWidget(self.other_cb, 7, 0, 1, 2)
  7621. separator_line = QtWidgets.QFrame()
  7622. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  7623. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  7624. grid_lay.addWidget(separator_line, 8, 0, 1, 2)
  7625. # ## Axis
  7626. self.hole_size_radio = RadioSet(
  7627. [
  7628. {'label': _("Fixed Diameter"), 'value': 'fixed'},
  7629. {'label': _("Fixed Annular Ring"), 'value': 'ring'},
  7630. {'label': _("Proportional"), 'value': 'prop'}
  7631. ],
  7632. orientation='vertical',
  7633. stretch=False)
  7634. self.hole_size_label = QtWidgets.QLabel('<b>%s:</b>' % _("Method"))
  7635. self.hole_size_label.setToolTip(
  7636. _("The method for processing pads. Can be:\n"
  7637. "- Fixed Diameter -> all holes will have a set size\n"
  7638. "- Fixed Annular Ring -> all holes will have a set annular ring\n"
  7639. "- Proportional -> each hole size will be a fraction of the pad size"))
  7640. grid_lay.addWidget(self.hole_size_label, 9, 0)
  7641. grid_lay.addWidget(self.hole_size_radio, 9, 1)
  7642. # grid_lay1.addWidget(QtWidgets.QLabel(''))
  7643. separator_line = QtWidgets.QFrame()
  7644. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  7645. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  7646. grid_lay.addWidget(separator_line, 10, 0, 1, 2)
  7647. # Annular Ring
  7648. self.fixed_label = QtWidgets.QLabel('<b>%s</b>' % _("Fixed Diameter"))
  7649. grid_lay.addWidget(self.fixed_label, 11, 0, 1, 2)
  7650. # Diameter value
  7651. self.dia_entry = FCDoubleSpinner()
  7652. self.dia_entry.set_precision(self.decimals)
  7653. self.dia_entry.set_range(0.0000, 9999.9999)
  7654. self.dia_label = QtWidgets.QLabel('%s:' % _("Value"))
  7655. self.dia_label.setToolTip(
  7656. _("Fixed hole diameter.")
  7657. )
  7658. grid_lay.addWidget(self.dia_label, 12, 0)
  7659. grid_lay.addWidget(self.dia_entry, 12, 1)
  7660. # Annular Ring value
  7661. self.ring_label = QtWidgets.QLabel('<b>%s</b>' % _("Fixed Annular Ring"))
  7662. self.ring_label.setToolTip(
  7663. _("The size of annular ring.\n"
  7664. "The copper sliver between the hole exterior\n"
  7665. "and the margin of the copper pad.")
  7666. )
  7667. grid_lay.addWidget(self.ring_label, 13, 0, 1, 2)
  7668. # Circular Annular Ring Value
  7669. self.circular_ring_label = QtWidgets.QLabel('%s:' % _("Circular"))
  7670. self.circular_ring_label.setToolTip(
  7671. _("The size of annular ring for circular pads.")
  7672. )
  7673. self.circular_ring_entry = FCDoubleSpinner()
  7674. self.circular_ring_entry.set_precision(self.decimals)
  7675. self.circular_ring_entry.set_range(0.0000, 9999.9999)
  7676. grid_lay.addWidget(self.circular_ring_label, 14, 0)
  7677. grid_lay.addWidget(self.circular_ring_entry, 14, 1)
  7678. # Oblong Annular Ring Value
  7679. self.oblong_ring_label = QtWidgets.QLabel('%s:' % _("Oblong"))
  7680. self.oblong_ring_label.setToolTip(
  7681. _("The size of annular ring for oblong pads.")
  7682. )
  7683. self.oblong_ring_entry = FCDoubleSpinner()
  7684. self.oblong_ring_entry.set_precision(self.decimals)
  7685. self.oblong_ring_entry.set_range(0.0000, 9999.9999)
  7686. grid_lay.addWidget(self.oblong_ring_label, 15, 0)
  7687. grid_lay.addWidget(self.oblong_ring_entry, 15, 1)
  7688. # Square Annular Ring Value
  7689. self.square_ring_label = QtWidgets.QLabel('%s:' % _("Square"))
  7690. self.square_ring_label.setToolTip(
  7691. _("The size of annular ring for square pads.")
  7692. )
  7693. self.square_ring_entry = FCDoubleSpinner()
  7694. self.square_ring_entry.set_precision(self.decimals)
  7695. self.square_ring_entry.set_range(0.0000, 9999.9999)
  7696. grid_lay.addWidget(self.square_ring_label, 16, 0)
  7697. grid_lay.addWidget(self.square_ring_entry, 16, 1)
  7698. # Rectangular Annular Ring Value
  7699. self.rectangular_ring_label = QtWidgets.QLabel('%s:' % _("Rectangular"))
  7700. self.rectangular_ring_label.setToolTip(
  7701. _("The size of annular ring for rectangular pads.")
  7702. )
  7703. self.rectangular_ring_entry = FCDoubleSpinner()
  7704. self.rectangular_ring_entry.set_precision(self.decimals)
  7705. self.rectangular_ring_entry.set_range(0.0000, 9999.9999)
  7706. grid_lay.addWidget(self.rectangular_ring_label, 17, 0)
  7707. grid_lay.addWidget(self.rectangular_ring_entry, 17, 1)
  7708. # Others Annular Ring Value
  7709. self.other_ring_label = QtWidgets.QLabel('%s:' % _("Others"))
  7710. self.other_ring_label.setToolTip(
  7711. _("The size of annular ring for other pads.")
  7712. )
  7713. self.other_ring_entry = FCDoubleSpinner()
  7714. self.other_ring_entry.set_precision(self.decimals)
  7715. self.other_ring_entry.set_range(0.0000, 9999.9999)
  7716. grid_lay.addWidget(self.other_ring_label, 18, 0)
  7717. grid_lay.addWidget(self.other_ring_entry, 18, 1)
  7718. self.prop_label = QtWidgets.QLabel('<b>%s</b>' % _("Proportional Diameter"))
  7719. grid_lay.addWidget(self.prop_label, 19, 0, 1, 2)
  7720. # Factor value
  7721. self.factor_entry = FCDoubleSpinner(suffix='%')
  7722. self.factor_entry.set_precision(self.decimals)
  7723. self.factor_entry.set_range(0.0000, 100.0000)
  7724. self.factor_entry.setSingleStep(0.1)
  7725. self.factor_label = QtWidgets.QLabel('%s:' % _("Factor"))
  7726. self.factor_label.setToolTip(
  7727. _("Proportional Diameter.\n"
  7728. "The hole diameter will be a fraction of the pad size.")
  7729. )
  7730. grid_lay.addWidget(self.factor_label, 20, 0)
  7731. grid_lay.addWidget(self.factor_entry, 20, 1)
  7732. self.layout.addStretch()
  7733. class Tools2PunchGerberPrefGroupUI(OptionsGroupUI):
  7734. def __init__(self, decimals=4, parent=None):
  7735. super(Tools2PunchGerberPrefGroupUI, self).__init__(self)
  7736. self.setTitle(str(_("Punch Gerber Options")))
  7737. self.decimals = decimals
  7738. # ## Grid Layout
  7739. grid_lay = QtWidgets.QGridLayout()
  7740. self.layout.addLayout(grid_lay)
  7741. grid_lay.setColumnStretch(0, 0)
  7742. grid_lay.setColumnStretch(1, 1)
  7743. self.param_label = QtWidgets.QLabel('<b>%s:</b>' % _('Parameters'))
  7744. self.param_label.setToolTip(
  7745. _("Parameters used for this tool.")
  7746. )
  7747. grid_lay.addWidget(self.param_label, 0, 0, 1, 2)
  7748. self.padt_label = QtWidgets.QLabel("<b>%s:</b>" % _("Processed Pads Type"))
  7749. self.padt_label.setToolTip(
  7750. _("The type of pads shape to be processed.\n"
  7751. "If the PCB has many SMD pads with rectangular pads,\n"
  7752. "disable the Rectangular aperture.")
  7753. )
  7754. grid_lay.addWidget(self.padt_label, 2, 0, 1, 2)
  7755. # Circular Aperture Selection
  7756. self.circular_cb = FCCheckBox('%s' % _("Circular"))
  7757. self.circular_cb.setToolTip(
  7758. _("Process Circular Pads.")
  7759. )
  7760. grid_lay.addWidget(self.circular_cb, 3, 0, 1, 2)
  7761. # Oblong Aperture Selection
  7762. self.oblong_cb = FCCheckBox('%s' % _("Oblong"))
  7763. self.oblong_cb.setToolTip(
  7764. _("Process Oblong Pads.")
  7765. )
  7766. grid_lay.addWidget(self.oblong_cb, 4, 0, 1, 2)
  7767. # Square Aperture Selection
  7768. self.square_cb = FCCheckBox('%s' % _("Square"))
  7769. self.square_cb.setToolTip(
  7770. _("Process Square Pads.")
  7771. )
  7772. grid_lay.addWidget(self.square_cb, 5, 0, 1, 2)
  7773. # Rectangular Aperture Selection
  7774. self.rectangular_cb = FCCheckBox('%s' % _("Rectangular"))
  7775. self.rectangular_cb.setToolTip(
  7776. _("Process Rectangular Pads.")
  7777. )
  7778. grid_lay.addWidget(self.rectangular_cb, 6, 0, 1, 2)
  7779. # Others type of Apertures Selection
  7780. self.other_cb = FCCheckBox('%s' % _("Others"))
  7781. self.other_cb.setToolTip(
  7782. _("Process pads not in the categories above.")
  7783. )
  7784. grid_lay.addWidget(self.other_cb, 7, 0, 1, 2)
  7785. separator_line = QtWidgets.QFrame()
  7786. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  7787. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  7788. grid_lay.addWidget(separator_line, 8, 0, 1, 2)
  7789. # ## Axis
  7790. self.hole_size_radio = RadioSet(
  7791. [
  7792. {'label': _("Excellon"), 'value': 'exc'},
  7793. {'label': _("Fixed Diameter"), 'value': 'fixed'},
  7794. {'label': _("Fixed Annular Ring"), 'value': 'ring'},
  7795. {'label': _("Proportional"), 'value': 'prop'}
  7796. ],
  7797. orientation='vertical',
  7798. stretch=False)
  7799. self.hole_size_label = QtWidgets.QLabel('<b>%s:</b>' % _("Method"))
  7800. self.hole_size_label.setToolTip(
  7801. _("The punch hole source can be:\n"
  7802. "- Excellon Object-> the Excellon object drills center will serve as reference.\n"
  7803. "- Fixed Diameter -> will try to use the pads center as reference adding fixed diameter holes.\n"
  7804. "- Fixed Annular Ring -> will try to keep a set annular ring.\n"
  7805. "- Proportional -> will make a Gerber punch hole having the diameter a percentage of the pad diameter.")
  7806. )
  7807. grid_lay.addWidget(self.hole_size_label, 9, 0)
  7808. grid_lay.addWidget(self.hole_size_radio, 9, 1)
  7809. # grid_lay1.addWidget(QtWidgets.QLabel(''))
  7810. separator_line = QtWidgets.QFrame()
  7811. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  7812. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  7813. grid_lay.addWidget(separator_line, 10, 0, 1, 2)
  7814. # Annular Ring
  7815. self.fixed_label = QtWidgets.QLabel('<b>%s</b>' % _("Fixed Diameter"))
  7816. grid_lay.addWidget(self.fixed_label, 11, 0, 1, 2)
  7817. # Diameter value
  7818. self.dia_entry = FCDoubleSpinner()
  7819. self.dia_entry.set_precision(self.decimals)
  7820. self.dia_entry.set_range(0.0000, 9999.9999)
  7821. self.dia_label = QtWidgets.QLabel('%s:' % _("Value"))
  7822. self.dia_label.setToolTip(
  7823. _("Fixed hole diameter.")
  7824. )
  7825. grid_lay.addWidget(self.dia_label, 12, 0)
  7826. grid_lay.addWidget(self.dia_entry, 12, 1)
  7827. # Annular Ring value
  7828. self.ring_label = QtWidgets.QLabel('<b>%s</b>' % _("Fixed Annular Ring"))
  7829. self.ring_label.setToolTip(
  7830. _("The size of annular ring.\n"
  7831. "The copper sliver between the hole exterior\n"
  7832. "and the margin of the copper pad.")
  7833. )
  7834. grid_lay.addWidget(self.ring_label, 13, 0, 1, 2)
  7835. # Circular Annular Ring Value
  7836. self.circular_ring_label = QtWidgets.QLabel('%s:' % _("Circular"))
  7837. self.circular_ring_label.setToolTip(
  7838. _("The size of annular ring for circular pads.")
  7839. )
  7840. self.circular_ring_entry = FCDoubleSpinner()
  7841. self.circular_ring_entry.set_precision(self.decimals)
  7842. self.circular_ring_entry.set_range(0.0000, 9999.9999)
  7843. grid_lay.addWidget(self.circular_ring_label, 14, 0)
  7844. grid_lay.addWidget(self.circular_ring_entry, 14, 1)
  7845. # Oblong Annular Ring Value
  7846. self.oblong_ring_label = QtWidgets.QLabel('%s:' % _("Oblong"))
  7847. self.oblong_ring_label.setToolTip(
  7848. _("The size of annular ring for oblong pads.")
  7849. )
  7850. self.oblong_ring_entry = FCDoubleSpinner()
  7851. self.oblong_ring_entry.set_precision(self.decimals)
  7852. self.oblong_ring_entry.set_range(0.0000, 9999.9999)
  7853. grid_lay.addWidget(self.oblong_ring_label, 15, 0)
  7854. grid_lay.addWidget(self.oblong_ring_entry, 15, 1)
  7855. # Square Annular Ring Value
  7856. self.square_ring_label = QtWidgets.QLabel('%s:' % _("Square"))
  7857. self.square_ring_label.setToolTip(
  7858. _("The size of annular ring for square pads.")
  7859. )
  7860. self.square_ring_entry = FCDoubleSpinner()
  7861. self.square_ring_entry.set_precision(self.decimals)
  7862. self.square_ring_entry.set_range(0.0000, 9999.9999)
  7863. grid_lay.addWidget(self.square_ring_label, 16, 0)
  7864. grid_lay.addWidget(self.square_ring_entry, 16, 1)
  7865. # Rectangular Annular Ring Value
  7866. self.rectangular_ring_label = QtWidgets.QLabel('%s:' % _("Rectangular"))
  7867. self.rectangular_ring_label.setToolTip(
  7868. _("The size of annular ring for rectangular pads.")
  7869. )
  7870. self.rectangular_ring_entry = FCDoubleSpinner()
  7871. self.rectangular_ring_entry.set_precision(self.decimals)
  7872. self.rectangular_ring_entry.set_range(0.0000, 9999.9999)
  7873. grid_lay.addWidget(self.rectangular_ring_label, 17, 0)
  7874. grid_lay.addWidget(self.rectangular_ring_entry, 17, 1)
  7875. # Others Annular Ring Value
  7876. self.other_ring_label = QtWidgets.QLabel('%s:' % _("Others"))
  7877. self.other_ring_label.setToolTip(
  7878. _("The size of annular ring for other pads.")
  7879. )
  7880. self.other_ring_entry = FCDoubleSpinner()
  7881. self.other_ring_entry.set_precision(self.decimals)
  7882. self.other_ring_entry.set_range(0.0000, 9999.9999)
  7883. grid_lay.addWidget(self.other_ring_label, 18, 0)
  7884. grid_lay.addWidget(self.other_ring_entry, 18, 1)
  7885. self.prop_label = QtWidgets.QLabel('<b>%s</b>' % _("Proportional Diameter"))
  7886. grid_lay.addWidget(self.prop_label, 19, 0, 1, 2)
  7887. # Factor value
  7888. self.factor_entry = FCDoubleSpinner(suffix='%')
  7889. self.factor_entry.set_precision(self.decimals)
  7890. self.factor_entry.set_range(0.0000, 100.0000)
  7891. self.factor_entry.setSingleStep(0.1)
  7892. self.factor_label = QtWidgets.QLabel('%s:' % _("Factor"))
  7893. self.factor_label.setToolTip(
  7894. _("Proportional Diameter.\n"
  7895. "The hole diameter will be a fraction of the pad size.")
  7896. )
  7897. grid_lay.addWidget(self.factor_label, 20, 0)
  7898. grid_lay.addWidget(self.factor_entry, 20, 1)
  7899. self.layout.addStretch()
  7900. class Tools2InvertPrefGroupUI(OptionsGroupUI):
  7901. def __init__(self, decimals=4, parent=None):
  7902. super(Tools2InvertPrefGroupUI, self).__init__(self)
  7903. self.setTitle(str(_("Invert Gerber Tool Options")))
  7904. self.decimals = decimals
  7905. # ## Subtractor Tool Parameters
  7906. self.sublabel = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  7907. self.sublabel.setToolTip(
  7908. _("A tool to invert Gerber geometry from positive to negative\n"
  7909. "and in revers.")
  7910. )
  7911. self.layout.addWidget(self.sublabel)
  7912. # Grid Layout
  7913. grid0 = QtWidgets.QGridLayout()
  7914. grid0.setColumnStretch(0, 0)
  7915. grid0.setColumnStretch(1, 1)
  7916. self.layout.addLayout(grid0)
  7917. # Margin
  7918. self.margin_label = QtWidgets.QLabel('%s:' % _('Margin'))
  7919. self.margin_label.setToolTip(
  7920. _("Distance by which to avoid\n"
  7921. "the edges of the Gerber object.")
  7922. )
  7923. self.margin_entry = FCDoubleSpinner()
  7924. self.margin_entry.set_precision(self.decimals)
  7925. self.margin_entry.set_range(0.0000, 9999.9999)
  7926. self.margin_entry.setObjectName(_("Margin"))
  7927. grid0.addWidget(self.margin_label, 2, 0, 1, 2)
  7928. grid0.addWidget(self.margin_entry, 3, 0, 1, 2)
  7929. self.join_label = QtWidgets.QLabel('%s:' % _("Lines Join Style"))
  7930. self.join_label.setToolTip(
  7931. _("The way that the lines in the object outline will be joined.\n"
  7932. "Can be:\n"
  7933. "- rounded -> an arc is added between two joining lines\n"
  7934. "- square -> the lines meet in 90 degrees angle\n"
  7935. "- bevel -> the lines are joined by a third line")
  7936. )
  7937. self.join_radio = RadioSet([
  7938. {'label': 'Rounded', 'value': 'r'},
  7939. {'label': 'Square', 'value': 's'},
  7940. {'label': 'Bevel', 'value': 'b'}
  7941. ], orientation='vertical', stretch=False)
  7942. grid0.addWidget(self.join_label, 5, 0, 1, 2)
  7943. grid0.addWidget(self.join_radio, 7, 0, 1, 2)
  7944. self.layout.addStretch()
  7945. class FAExcPrefGroupUI(OptionsGroupUI):
  7946. def __init__(self, decimals=4, parent=None):
  7947. # OptionsGroupUI.__init__(self, "Excellon File associations Preferences", parent=None)
  7948. super().__init__(self)
  7949. self.setTitle(str(_("Excellon File associations")))
  7950. self.decimals = decimals
  7951. self.layout.setContentsMargins(2, 2, 2, 2)
  7952. self.vertical_lay = QtWidgets.QVBoxLayout()
  7953. scroll_widget = QtWidgets.QWidget()
  7954. scroll = VerticalScrollArea()
  7955. scroll.setWidget(scroll_widget)
  7956. scroll.setWidgetResizable(True)
  7957. scroll.setFrameShape(QtWidgets.QFrame.NoFrame)
  7958. self.restore_btn = FCButton(_("Restore"))
  7959. self.restore_btn.setToolTip(_("Restore the extension list to the default state."))
  7960. self.del_all_btn = FCButton(_("Delete All"))
  7961. self.del_all_btn.setToolTip(_("Delete all extensions from the list."))
  7962. hlay0 = QtWidgets.QHBoxLayout()
  7963. hlay0.addWidget(self.restore_btn)
  7964. hlay0.addWidget(self.del_all_btn)
  7965. self.vertical_lay.addLayout(hlay0)
  7966. # # ## Excellon associations
  7967. list_label = QtWidgets.QLabel("<b>%s:</b>" % _("Extensions list"))
  7968. list_label.setToolTip(
  7969. _("List of file extensions to be\n"
  7970. "associated with FlatCAM.")
  7971. )
  7972. self.vertical_lay.addWidget(list_label)
  7973. qsettings = QSettings("Open Source", "FlatCAM")
  7974. if qsettings.contains("textbox_font_size"):
  7975. tb_fsize = qsettings.value('textbox_font_size', type=int)
  7976. else:
  7977. tb_fsize = 10
  7978. self.exc_list_text = FCTextArea()
  7979. self.exc_list_text.setReadOnly(True)
  7980. # self.exc_list_text.sizeHint(custom_sizehint=150)
  7981. font = QtGui.QFont()
  7982. font.setPointSize(tb_fsize)
  7983. self.exc_list_text.setFont(font)
  7984. self.vertical_lay.addWidget(self.exc_list_text)
  7985. self.ext_label = QtWidgets.QLabel('%s:' % _("Extension"))
  7986. self.ext_label.setToolTip(_("A file extension to be added or deleted to the list."))
  7987. self.ext_entry = FCEntry()
  7988. hlay1 = QtWidgets.QHBoxLayout()
  7989. self.vertical_lay.addLayout(hlay1)
  7990. hlay1.addWidget(self.ext_label)
  7991. hlay1.addWidget(self.ext_entry)
  7992. self.add_btn = FCButton(_("Add Extension"))
  7993. self.add_btn.setToolTip(_("Add a file extension to the list"))
  7994. self.del_btn = FCButton(_("Delete Extension"))
  7995. self.del_btn.setToolTip(_("Delete a file extension from the list"))
  7996. hlay2 = QtWidgets.QHBoxLayout()
  7997. self.vertical_lay.addLayout(hlay2)
  7998. hlay2.addWidget(self.add_btn)
  7999. hlay2.addWidget(self.del_btn)
  8000. self.exc_list_btn = FCButton(_("Apply Association"))
  8001. self.exc_list_btn.setToolTip(_("Apply the file associations between\n"
  8002. "FlatCAM and the files with above extensions.\n"
  8003. "They will be active after next logon.\n"
  8004. "This work only in Windows."))
  8005. self.vertical_lay.addWidget(self.exc_list_btn)
  8006. scroll_widget.setLayout(self.vertical_lay)
  8007. self.layout.addWidget(scroll)
  8008. # self.vertical_lay.addStretch()
  8009. class FAGcoPrefGroupUI(OptionsGroupUI):
  8010. def __init__(self, decimals=4, parent=None):
  8011. # OptionsGroupUI.__init__(self, "Gcode File associations Preferences", parent=None)
  8012. super(FAGcoPrefGroupUI, self).__init__(self)
  8013. self.setTitle(str(_("GCode File associations")))
  8014. self.decimals = decimals
  8015. self.restore_btn = FCButton(_("Restore"))
  8016. self.restore_btn.setToolTip(_("Restore the extension list to the default state."))
  8017. self.del_all_btn = FCButton(_("Delete All"))
  8018. self.del_all_btn.setToolTip(_("Delete all extensions from the list."))
  8019. hlay0 = QtWidgets.QHBoxLayout()
  8020. self.layout.addLayout(hlay0)
  8021. hlay0.addWidget(self.restore_btn)
  8022. hlay0.addWidget(self.del_all_btn)
  8023. # ## G-Code associations
  8024. self.gco_list_label = QtWidgets.QLabel("<b>%s:</b>" % _("Extensions list"))
  8025. self.gco_list_label.setToolTip(
  8026. _("List of file extensions to be\n"
  8027. "associated with FlatCAM.")
  8028. )
  8029. self.layout.addWidget(self.gco_list_label)
  8030. qsettings = QSettings("Open Source", "FlatCAM")
  8031. if qsettings.contains("textbox_font_size"):
  8032. tb_fsize = qsettings.value('textbox_font_size', type=int)
  8033. else:
  8034. tb_fsize = 10
  8035. self.gco_list_text = FCTextArea()
  8036. self.gco_list_text.setReadOnly(True)
  8037. # self.gco_list_text.sizeHint(custom_sizehint=150)
  8038. font = QtGui.QFont()
  8039. font.setPointSize(tb_fsize)
  8040. self.gco_list_text.setFont(font)
  8041. self.layout.addWidget(self.gco_list_text)
  8042. self.ext_label = QtWidgets.QLabel('%s:' % _("Extension"))
  8043. self.ext_label.setToolTip(_("A file extension to be added or deleted to the list."))
  8044. self.ext_entry = FCEntry()
  8045. hlay1 = QtWidgets.QHBoxLayout()
  8046. self.layout.addLayout(hlay1)
  8047. hlay1.addWidget(self.ext_label)
  8048. hlay1.addWidget(self.ext_entry)
  8049. self.add_btn = FCButton(_("Add Extension"))
  8050. self.add_btn.setToolTip(_("Add a file extension to the list"))
  8051. self.del_btn = FCButton(_("Delete Extension"))
  8052. self.del_btn.setToolTip(_("Delete a file extension from the list"))
  8053. hlay2 = QtWidgets.QHBoxLayout()
  8054. self.layout.addLayout(hlay2)
  8055. hlay2.addWidget(self.add_btn)
  8056. hlay2.addWidget(self.del_btn)
  8057. self.gco_list_btn = FCButton(_("Apply Association"))
  8058. self.gco_list_btn.setToolTip(_("Apply the file associations between\n"
  8059. "FlatCAM and the files with above extensions.\n"
  8060. "They will be active after next logon.\n"
  8061. "This work only in Windows."))
  8062. self.layout.addWidget(self.gco_list_btn)
  8063. # self.layout.addStretch()
  8064. class FAGrbPrefGroupUI(OptionsGroupUI):
  8065. def __init__(self, decimals=4, parent=None):
  8066. # OptionsGroupUI.__init__(self, "Gerber File associations Preferences", parent=None)
  8067. super(FAGrbPrefGroupUI, self).__init__(self)
  8068. self.setTitle(str(_("Gerber File associations")))
  8069. self.decimals = decimals
  8070. self.restore_btn = FCButton(_("Restore"))
  8071. self.restore_btn.setToolTip(_("Restore the extension list to the default state."))
  8072. self.del_all_btn = FCButton(_("Delete All"))
  8073. self.del_all_btn.setToolTip(_("Delete all extensions from the list."))
  8074. hlay0 = QtWidgets.QHBoxLayout()
  8075. self.layout.addLayout(hlay0)
  8076. hlay0.addWidget(self.restore_btn)
  8077. hlay0.addWidget(self.del_all_btn)
  8078. # ## Gerber associations
  8079. self.grb_list_label = QtWidgets.QLabel("<b>%s:</b>" % _("Extensions list"))
  8080. self.grb_list_label.setToolTip(
  8081. _("List of file extensions to be\n"
  8082. "associated with FlatCAM.")
  8083. )
  8084. self.layout.addWidget(self.grb_list_label)
  8085. qsettings = QSettings("Open Source", "FlatCAM")
  8086. if qsettings.contains("textbox_font_size"):
  8087. tb_fsize = qsettings.value('textbox_font_size', type=int)
  8088. else:
  8089. tb_fsize = 10
  8090. self.grb_list_text = FCTextArea()
  8091. self.grb_list_text.setReadOnly(True)
  8092. # self.grb_list_text.sizeHint(custom_sizehint=150)
  8093. self.layout.addWidget(self.grb_list_text)
  8094. font = QtGui.QFont()
  8095. font.setPointSize(tb_fsize)
  8096. self.grb_list_text.setFont(font)
  8097. self.ext_label = QtWidgets.QLabel('%s:' % _("Extension"))
  8098. self.ext_label.setToolTip(_("A file extension to be added or deleted to the list."))
  8099. self.ext_entry = FCEntry()
  8100. hlay1 = QtWidgets.QHBoxLayout()
  8101. self.layout.addLayout(hlay1)
  8102. hlay1.addWidget(self.ext_label)
  8103. hlay1.addWidget(self.ext_entry)
  8104. self.add_btn = FCButton(_("Add Extension"))
  8105. self.add_btn.setToolTip(_("Add a file extension to the list"))
  8106. self.del_btn = FCButton(_("Delete Extension"))
  8107. self.del_btn.setToolTip(_("Delete a file extension from the list"))
  8108. hlay2 = QtWidgets.QHBoxLayout()
  8109. self.layout.addLayout(hlay2)
  8110. hlay2.addWidget(self.add_btn)
  8111. hlay2.addWidget(self.del_btn)
  8112. self.grb_list_btn = FCButton(_("Apply Association"))
  8113. self.grb_list_btn.setToolTip(_("Apply the file associations between\n"
  8114. "FlatCAM and the files with above extensions.\n"
  8115. "They will be active after next logon.\n"
  8116. "This work only in Windows."))
  8117. self.layout.addWidget(self.grb_list_btn)
  8118. # self.layout.addStretch()
  8119. class AutoCompletePrefGroupUI(OptionsGroupUI):
  8120. def __init__(self, decimals=4, parent=None):
  8121. # OptionsGroupUI.__init__(self, "Gerber File associations Preferences", parent=None)
  8122. super().__init__(self, parent=parent)
  8123. self.setTitle(str(_("Autocompleter Keywords")))
  8124. self.decimals = decimals
  8125. self.restore_btn = FCButton(_("Restore"))
  8126. self.restore_btn.setToolTip(_("Restore the autocompleter keywords list to the default state."))
  8127. self.del_all_btn = FCButton(_("Delete All"))
  8128. self.del_all_btn.setToolTip(_("Delete all autocompleter keywords from the list."))
  8129. hlay0 = QtWidgets.QHBoxLayout()
  8130. self.layout.addLayout(hlay0)
  8131. hlay0.addWidget(self.restore_btn)
  8132. hlay0.addWidget(self.del_all_btn)
  8133. # ## Gerber associations
  8134. self.grb_list_label = QtWidgets.QLabel("<b>%s:</b>" % _("Keywords list"))
  8135. self.grb_list_label.setToolTip(
  8136. _("List of keywords used by\n"
  8137. "the autocompleter in FlatCAM.\n"
  8138. "The autocompleter is installed\n"
  8139. "in the Code Editor and for the Tcl Shell.")
  8140. )
  8141. self.layout.addWidget(self.grb_list_label)
  8142. qsettings = QSettings("Open Source", "FlatCAM")
  8143. if qsettings.contains("textbox_font_size"):
  8144. tb_fsize = qsettings.value('textbox_font_size', type=int)
  8145. else:
  8146. tb_fsize = 10
  8147. self.kw_list_text = FCTextArea()
  8148. self.kw_list_text.setReadOnly(True)
  8149. # self.grb_list_text.sizeHint(custom_sizehint=150)
  8150. self.layout.addWidget(self.kw_list_text)
  8151. font = QtGui.QFont()
  8152. font.setPointSize(tb_fsize)
  8153. self.kw_list_text.setFont(font)
  8154. self.kw_label = QtWidgets.QLabel('%s:' % _("Extension"))
  8155. self.kw_label.setToolTip(_("A keyword to be added or deleted to the list."))
  8156. self.kw_entry = FCEntry()
  8157. hlay1 = QtWidgets.QHBoxLayout()
  8158. self.layout.addLayout(hlay1)
  8159. hlay1.addWidget(self.kw_label)
  8160. hlay1.addWidget(self.kw_entry)
  8161. self.add_btn = FCButton(_("Add keyword"))
  8162. self.add_btn.setToolTip(_("Add a keyword to the list"))
  8163. self.del_btn = FCButton(_("Delete keyword"))
  8164. self.del_btn.setToolTip(_("Delete a keyword from the list"))
  8165. hlay2 = QtWidgets.QHBoxLayout()
  8166. self.layout.addLayout(hlay2)
  8167. hlay2.addWidget(self.add_btn)
  8168. hlay2.addWidget(self.del_btn)
  8169. # self.layout.addStretch()