PreferencesUI.py 294 KB

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