PreferencesUI.py 338 KB

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