PreferencesUI.py 273 KB

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