FlatCAMGUI.py 351 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973
  1. # ##########################################################
  2. # FlatCAM: 2D Post-processing for Manufacturing #
  3. # http://flatcam.org #
  4. # Author: Juan Pablo Caram (c) #
  5. # Date: 2/5/2014 #
  6. # MIT Licence #
  7. # ##########################################################
  8. # ##########################################################
  9. # File Modified (major mod): Marius Adrian Stanciu #
  10. # Date: 3/10/2019 #
  11. # ##########################################################
  12. from PyQt5.QtCore import QSettings
  13. from flatcamGUI.GUIElements import *
  14. import platform
  15. import webbrowser
  16. import sys
  17. from flatcamEditors.FlatCAMGeoEditor import FCShapeTool
  18. import gettext
  19. import FlatCAMTranslation as fcTranslate
  20. import builtins
  21. fcTranslate.apply_language('strings')
  22. if '_' not in builtins.__dict__:
  23. _ = gettext.gettext
  24. class FlatCAMGUI(QtWidgets.QMainWindow):
  25. # Emitted when persistent window geometry needs to be retained
  26. geom_update = QtCore.pyqtSignal(int, int, int, int, int, name='geomUpdate')
  27. final_save = QtCore.pyqtSignal(name='saveBeforeExit')
  28. def __init__(self, version, beta, app):
  29. super(FlatCAMGUI, self).__init__()
  30. self.app = app
  31. # Divine icon pack by Ipapun @ finicons.com
  32. # ################################## ##
  33. # ## BUILDING THE GUI IS DONE HERE # ##
  34. # ################################## ##
  35. # ######### ##
  36. # ## Menu # ##
  37. # ######### ##
  38. self.menu = self.menuBar()
  39. # ## File # ##
  40. self.menufile = self.menu.addMenu(_('&File'))
  41. self.menufile.setToolTipsVisible(True)
  42. # New Project
  43. self.menufilenewproject = QtWidgets.QAction(QtGui.QIcon('share/file16.png'),
  44. _('&New Project ...\tCTRL+N'), self)
  45. self.menufilenewproject.setToolTip(
  46. _("Will create a new, blank project")
  47. )
  48. self.menufile.addAction(self.menufilenewproject)
  49. # New Category (Excellon, Geometry)
  50. self.menufilenew = self.menufile.addMenu(QtGui.QIcon('share/file16.png'), _('&New'))
  51. self.menufilenew.setToolTipsVisible(True)
  52. self.menufilenewgeo = self.menufilenew.addAction(QtGui.QIcon('share/geometry16.png'), _('Geometry\tN'))
  53. self.menufilenewgeo.setToolTip(
  54. _("Will create a new, empty Geometry Object.")
  55. )
  56. self.menufilenewgrb = self.menufilenew.addAction(QtGui.QIcon('share/flatcam_icon32.png'), _('Gerber\tB'))
  57. self.menufilenewgrb.setToolTip(
  58. _("Will create a new, empty Gerber Object.")
  59. )
  60. self.menufilenewexc = self.menufilenew.addAction(QtGui.QIcon('share/drill16.png'), _('Excellon\tL'))
  61. self.menufilenewexc.setToolTip(
  62. _("Will create a new, empty Excellon Object.")
  63. )
  64. self.menufile_open = self.menufile.addMenu(QtGui.QIcon('share/folder32_bis.png'), _('Open'))
  65. self.menufile_open.setToolTipsVisible(True)
  66. # Open Project ...
  67. self.menufileopenproject = QtWidgets.QAction(QtGui.QIcon('share/folder16.png'), _('Open &Project ...'), self)
  68. self.menufile_open.addAction(self.menufileopenproject)
  69. self.menufile_open.addSeparator()
  70. # Open Gerber ...
  71. self.menufileopengerber = QtWidgets.QAction(QtGui.QIcon('share/flatcam_icon24.png'),
  72. _('Open &Gerber ...\tCTRL+G'), self)
  73. self.menufile_open.addAction(self.menufileopengerber)
  74. # Open Excellon ...
  75. self.menufileopenexcellon = QtWidgets.QAction(QtGui.QIcon('share/open_excellon32.png'),
  76. _('Open &Excellon ...\tCTRL+E'), self)
  77. self.menufile_open.addAction(self.menufileopenexcellon)
  78. # Open G-Code ...
  79. self.menufileopengcode = QtWidgets.QAction(QtGui.QIcon('share/code.png'), _('Open G-&Code ...'), self)
  80. self.menufile_open.addAction(self.menufileopengcode)
  81. self.menufile_open.addSeparator()
  82. # Open Config File...
  83. self.menufileopenconfig = QtWidgets.QAction(QtGui.QIcon('share/folder16.png'), _('Open Config ...'), self)
  84. self.menufile_open.addAction(self.menufileopenconfig)
  85. # Recent
  86. self.recent_projects = self.menufile.addMenu(QtGui.QIcon('share/recent_files.png'), _("Recent projects"))
  87. self.recent = self.menufile.addMenu(QtGui.QIcon('share/recent_files.png'), _("Recent files"))
  88. # Separator
  89. self.menufile.addSeparator()
  90. # Scripting
  91. self.menufile_scripting = self.menufile.addMenu(QtGui.QIcon('share/script16.png'), _('Scripting'))
  92. self.menufile_scripting.setToolTipsVisible(True)
  93. self.menufilenewscript = QtWidgets.QAction(QtGui.QIcon('share/script_new16.png'), _('New Script ...'), self)
  94. self.menufileopenscript = QtWidgets.QAction(QtGui.QIcon('share/script_open16.png'), _('Open Script ...'), self)
  95. self.menufilerunscript = QtWidgets.QAction(QtGui.QIcon('share/script16.png'),
  96. '%s\tSHIFT+S' % _('Run Script ...'), self)
  97. self.menufilerunscript.setToolTip(
  98. _("Will run the opened Tcl Script thus\n"
  99. "enabling the automation of certain\n"
  100. "functions of FlatCAM.")
  101. )
  102. self.menufile_scripting.addAction(self.menufilenewscript)
  103. self.menufile_scripting.addAction(self.menufileopenscript)
  104. self.menufile_scripting.addSeparator()
  105. self.menufile_scripting.addAction(self.menufilerunscript)
  106. # Separator
  107. self.menufile.addSeparator()
  108. # Import ...
  109. self.menufileimport = self.menufile.addMenu(QtGui.QIcon('share/import.png'), _('Import'))
  110. self.menufileimportsvg = QtWidgets.QAction(QtGui.QIcon('share/svg16.png'),
  111. _('&SVG as Geometry Object ...'), self)
  112. self.menufileimport.addAction(self.menufileimportsvg)
  113. self.menufileimportsvg_as_gerber = QtWidgets.QAction(QtGui.QIcon('share/svg16.png'),
  114. _('&SVG as Gerber Object ...'), self)
  115. self.menufileimport.addAction(self.menufileimportsvg_as_gerber)
  116. self.menufileimport.addSeparator()
  117. self.menufileimportdxf = QtWidgets.QAction(QtGui.QIcon('share/dxf16.png'),
  118. _('&DXF as Geometry Object ...'), self)
  119. self.menufileimport.addAction(self.menufileimportdxf)
  120. self.menufileimportdxf_as_gerber = QtWidgets.QAction(QtGui.QIcon('share/dxf16.png'),
  121. _('&DXF as Gerber Object ...'), self)
  122. self.menufileimport.addAction(self.menufileimportdxf_as_gerber)
  123. self.menufileimport.addSeparator()
  124. # Export ...
  125. self.menufileexport = self.menufile.addMenu(QtGui.QIcon('share/export.png'), _('Export'))
  126. self.menufileexport.setToolTipsVisible(True)
  127. self.menufileexportsvg = QtWidgets.QAction(QtGui.QIcon('share/export.png'), _('Export &SVG ...'), self)
  128. self.menufileexport.addAction(self.menufileexportsvg)
  129. self.menufileexportdxf = QtWidgets.QAction(QtGui.QIcon('share/export.png'), _('Export DXF ...'), self)
  130. self.menufileexport.addAction(self.menufileexportdxf)
  131. self.menufileexport.addSeparator()
  132. self.menufileexportpng = QtWidgets.QAction(QtGui.QIcon('share/export_png32.png'), _('Export &PNG ...'), self)
  133. self.menufileexportpng.setToolTip(
  134. _("Will export an image in PNG format,\n"
  135. "the saved image will contain the visual \n"
  136. "information currently in FlatCAM Plot Area.")
  137. )
  138. self.menufileexport.addAction(self.menufileexportpng)
  139. self.menufileexport.addSeparator()
  140. self.menufileexportexcellon = QtWidgets.QAction(QtGui.QIcon('share/drill32.png'),
  141. _('Export &Excellon ...'), self)
  142. self.menufileexportexcellon.setToolTip(
  143. _("Will export an Excellon Object as Excellon file,\n"
  144. "the coordinates format, the file units and zeros\n"
  145. "are set in Preferences -> Excellon Export.")
  146. )
  147. self.menufileexport.addAction(self.menufileexportexcellon)
  148. self.menufileexportgerber = QtWidgets.QAction(QtGui.QIcon('share/flatcam_icon32.png'),
  149. _('Export &Gerber ...'), self)
  150. self.menufileexportgerber.setToolTip(
  151. _("Will export an Gerber Object as Gerber file,\n"
  152. "the coordinates format, the file units and zeros\n"
  153. "are set in Preferences -> Gerber Export.")
  154. )
  155. self.menufileexport.addAction(self.menufileexportgerber)
  156. # Separator
  157. self.menufile.addSeparator()
  158. # Save Defaults
  159. self.menufilesavedefaults = QtWidgets.QAction(QtGui.QIcon('share/defaults.png'), _('Save Preferences'), self)
  160. self.menufile.addAction(self.menufilesavedefaults)
  161. # Separator
  162. self.menufile.addSeparator()
  163. self.menufile_backup = self.menufile.addMenu(QtGui.QIcon('share/backup24.png'), _('Backup'))
  164. # Import Preferences
  165. self.menufileimportpref = QtWidgets.QAction(QtGui.QIcon('share/backup_import24.png'),
  166. _('Import Preferences from file ...'), self)
  167. self.menufile_backup.addAction(self.menufileimportpref)
  168. # Export Preferences
  169. self.menufileexportpref = QtWidgets.QAction(QtGui.QIcon('share/backup_export24.png'),
  170. _('Export Preferences to file ...'), self)
  171. self.menufile_backup.addAction(self.menufileexportpref)
  172. # Separator
  173. self.menufile.addSeparator()
  174. self.menufile_save = self.menufile.addMenu(QtGui.QIcon('share/save_as.png'), _('Save'))
  175. # Save Project
  176. self.menufilesaveproject = QtWidgets.QAction(QtGui.QIcon('share/floppy16.png'), _('&Save Project ...'), self)
  177. self.menufile_save.addAction(self.menufilesaveproject)
  178. # Save Project As ...
  179. self.menufilesaveprojectas = QtWidgets.QAction(QtGui.QIcon('share/save_as.png'),
  180. _('Save Project &As ...\tCTRL+S'), self)
  181. self.menufile_save.addAction(self.menufilesaveprojectas)
  182. # Save Project Copy ...
  183. self.menufilesaveprojectcopy = QtWidgets.QAction(QtGui.QIcon('share/floppy16.png'),
  184. _('Save Project C&opy ...'), self)
  185. self.menufile_save.addAction(self.menufilesaveprojectcopy)
  186. # Separator
  187. self.menufile.addSeparator()
  188. # Quit
  189. self.menufile_exit = QtWidgets.QAction(QtGui.QIcon('share/power16.png'), _('E&xit'), self)
  190. # exitAction.setShortcut('Ctrl+Q')
  191. # exitAction.setStatusTip('Exit application')
  192. self.menufile.addAction(self.menufile_exit)
  193. # ## Edit # ##
  194. self.menuedit = self.menu.addMenu(_('&Edit'))
  195. # Separator
  196. self.menuedit.addSeparator()
  197. self.menueditedit = self.menuedit.addAction(QtGui.QIcon('share/edit16.png'), _('Edit Object\tE'))
  198. self.menueditok = self.menuedit.addAction(QtGui.QIcon('share/edit_ok16.png'), _('Close Editor\tCTRL+S'))
  199. # adjust the initial state of the menu entries related to the editor
  200. self.menueditedit.setDisabled(False)
  201. self.menueditok.setDisabled(True)
  202. # Separator
  203. self.menuedit.addSeparator()
  204. self.menuedit_convert = self.menuedit.addMenu(QtGui.QIcon('share/convert24.png'), _('Conversion'))
  205. self.menuedit_convertjoin = self.menuedit_convert.addAction(
  206. QtGui.QIcon('share/join16.png'), _('&Join Geo/Gerber/Exc -> Geo'))
  207. self.menuedit_convertjoin.setToolTip(
  208. _("Merge a selection of objects, which can be of type:\n"
  209. "- Gerber\n"
  210. "- Excellon\n"
  211. "- Geometry\n"
  212. "into a new combo Geometry object.")
  213. )
  214. self.menuedit_convertjoinexc = self.menuedit_convert.addAction(
  215. QtGui.QIcon('share/join16.png'), _('Join Excellon(s) -> Excellon'))
  216. self.menuedit_convertjoinexc.setToolTip(
  217. _("Merge a selection of Excellon objects into a new combo Excellon object.")
  218. )
  219. self.menuedit_convertjoingrb = self.menuedit_convert.addAction(
  220. QtGui.QIcon('share/join16.png'), _('Join Gerber(s) -> Gerber'))
  221. self.menuedit_convertjoingrb.setToolTip(
  222. _("Merge a selection of Gerber objects into a new combo Gerber object.")
  223. )
  224. # Separator
  225. self.menuedit_convert.addSeparator()
  226. self.menuedit_convert_sg2mg = self.menuedit_convert.addAction(
  227. QtGui.QIcon('share/convert24.png'), _('Convert Single to MultiGeo'))
  228. self.menuedit_convert_sg2mg.setToolTip(
  229. _("Will convert a Geometry object from single_geometry type\n"
  230. "to a multi_geometry type.")
  231. )
  232. self.menuedit_convert_mg2sg = self.menuedit_convert.addAction(
  233. QtGui.QIcon('share/convert24.png'), _('Convert Multi to SingleGeo'))
  234. self.menuedit_convert_mg2sg.setToolTip(
  235. _("Will convert a Geometry object from multi_geometry type\n"
  236. "to a single_geometry type.")
  237. )
  238. # Separator
  239. self.menuedit_convert.addSeparator()
  240. self.menueditconvert_any2geo = self.menuedit_convert.addAction(QtGui.QIcon('share/copy_geo.png'),
  241. _('Convert Any to Geo'))
  242. self.menueditconvert_any2gerber = self.menuedit_convert.addAction(QtGui.QIcon('share/copy_geo.png'),
  243. _('Convert Any to Gerber'))
  244. self.menuedit_convert.setToolTipsVisible(True)
  245. # Separator
  246. self.menuedit.addSeparator()
  247. self.menueditcopyobject = self.menuedit.addAction(QtGui.QIcon('share/copy.png'), _('&Copy\tCTRL+C'))
  248. # Separator
  249. self.menuedit.addSeparator()
  250. self.menueditdelete = self.menuedit.addAction(QtGui.QIcon('share/trash16.png'), _('&Delete\tDEL'))
  251. # Separator
  252. self.menuedit.addSeparator()
  253. self.menueditorigin = self.menuedit.addAction(QtGui.QIcon('share/origin.png'), _('Se&t Origin\tO'))
  254. self.menueditjump = self.menuedit.addAction(QtGui.QIcon('share/jump_to16.png'), _('Jump to Location\tJ'))
  255. # Separator
  256. self.menuedit.addSeparator()
  257. self.menuedittoggleunits = self.menuedit.addAction(QtGui.QIcon('share/toggle_units16.png'),
  258. _('Toggle Units\tQ'))
  259. self.menueditselectall = self.menuedit.addAction(QtGui.QIcon('share/select_all.png'), _('&Select All\tCTRL+A'))
  260. # Separator
  261. self.menuedit.addSeparator()
  262. self.menueditpreferences = self.menuedit.addAction(QtGui.QIcon('share/pref.png'), _('&Preferences\tSHIFT+P'))
  263. # ## Options # ##
  264. self.menuoptions = self.menu.addMenu(_('&Options'))
  265. # self.menuoptions_transfer = self.menuoptions.addMenu(QtGui.QIcon('share/transfer.png'), 'Transfer options')
  266. # self.menuoptions_transfer_a2p = self.menuoptions_transfer.addAction("Application to Project")
  267. # self.menuoptions_transfer_p2a = self.menuoptions_transfer.addAction("Project to Application")
  268. # self.menuoptions_transfer_p2o = self.menuoptions_transfer.addAction("Project to Object")
  269. # self.menuoptions_transfer_o2p = self.menuoptions_transfer.addAction("Object to Project")
  270. # self.menuoptions_transfer_a2o = self.menuoptions_transfer.addAction("Application to Object")
  271. # self.menuoptions_transfer_o2a = self.menuoptions_transfer.addAction("Object to Application")
  272. # Separator
  273. # self.menuoptions.addSeparator()
  274. # self.menuoptions_transform = self.menuoptions.addMenu(QtGui.QIcon('share/transform.png'),
  275. # '&Transform Object')
  276. self.menuoptions_transform_rotate = self.menuoptions.addAction(QtGui.QIcon('share/rotate.png'),
  277. _("&Rotate Selection\tSHIFT+(R)"))
  278. # Separator
  279. self.menuoptions.addSeparator()
  280. self.menuoptions_transform_skewx = self.menuoptions.addAction(QtGui.QIcon('share/skewX.png'),
  281. _("&Skew on X axis\tSHIFT+X"))
  282. self.menuoptions_transform_skewy = self.menuoptions.addAction(QtGui.QIcon('share/skewY.png'),
  283. _("S&kew on Y axis\tSHIFT+Y"))
  284. # Separator
  285. self.menuoptions.addSeparator()
  286. self.menuoptions_transform_flipx = self.menuoptions.addAction(QtGui.QIcon('share/flipx.png'),
  287. _("Flip on &X axis\tX"))
  288. self.menuoptions_transform_flipy = self.menuoptions.addAction(QtGui.QIcon('share/flipy.png'),
  289. _("Flip on &Y axis\tY"))
  290. # Separator
  291. self.menuoptions.addSeparator()
  292. self.menuoptions_view_source = self.menuoptions.addAction(QtGui.QIcon('share/source32.png'),
  293. _("View source\tALT+S"))
  294. # Separator
  295. self.menuoptions.addSeparator()
  296. # ## View # ##
  297. self.menuview = self.menu.addMenu(_('&View'))
  298. self.menuviewenable = self.menuview.addAction(QtGui.QIcon('share/replot16.png'), _('Enable all plots\tALT+1'))
  299. self.menuviewdisableall = self.menuview.addAction(QtGui.QIcon('share/clear_plot16.png'),
  300. _('Disable all plots\tALT+2'))
  301. self.menuviewdisableother = self.menuview.addAction(QtGui.QIcon('share/clear_plot16.png'),
  302. _('Disable non-selected\tALT+3'))
  303. # Separator
  304. self.menuview.addSeparator()
  305. self.menuview_zoom_fit = self.menuview.addAction(QtGui.QIcon('share/zoom_fit32.png'), _("&Zoom Fit\tV"))
  306. self.menuview_zoom_in = self.menuview.addAction(QtGui.QIcon('share/zoom_in32.png'), _("&Zoom In\t="))
  307. self.menuview_zoom_out = self.menuview.addAction(QtGui.QIcon('share/zoom_out32.png'), _("&Zoom Out\t-"))
  308. self.menuview.addSeparator()
  309. # Replot all
  310. self.menuview_replot = self.menuview.addAction(QtGui.QIcon('share/replot32.png'), _("Redraw All\tF5"))
  311. self.menuview.addSeparator()
  312. self.menuview_toggle_code_editor = self.menuview.addAction(QtGui.QIcon('share/code_editor32.png'),
  313. _('Toggle Code Editor\tCTRL+E'))
  314. self.menuview.addSeparator()
  315. self.menuview_toggle_fscreen = self.menuview.addAction(
  316. QtGui.QIcon('share/fscreen32.png'), _("&Toggle FullScreen\tALT+F10"))
  317. self.menuview_toggle_parea = self.menuview.addAction(
  318. QtGui.QIcon('share/plot32.png'), _("&Toggle Plot Area\tCTRL+F10"))
  319. self.menuview_toggle_notebook = self.menuview.addAction(
  320. QtGui.QIcon('share/notebook32.png'), _("&Toggle Project/Sel/Tool\t`"))
  321. self.menuview.addSeparator()
  322. self.menuview_toggle_grid = self.menuview.addAction(QtGui.QIcon('share/grid32.png'), _("&Toggle Grid Snap\tG")
  323. )
  324. self.menuview_toggle_axis = self.menuview.addAction(QtGui.QIcon('share/axis32.png'), _("&Toggle Axis\tSHIFT+G")
  325. )
  326. self.menuview_toggle_workspace = self.menuview.addAction(QtGui.QIcon('share/workspace24.png'),
  327. _("Toggle Workspace\tSHIFT+W"))
  328. # ## Tool ###
  329. self.menutool = QtWidgets.QMenu(_('&Tool'))
  330. self.menutoolaction = self.menu.addMenu(self.menutool)
  331. self.menutoolshell = self.menutool.addAction(QtGui.QIcon('share/shell16.png'), _('&Command Line\tS'))
  332. # ## Help ###
  333. self.menuhelp = self.menu.addMenu(_('&Help'))
  334. self.menuhelp_manual = self.menuhelp.addAction(QtGui.QIcon('share/globe16.png'), _('Online Help\tF1'))
  335. self.menuhelp_home = self.menuhelp.addAction(QtGui.QIcon('share/home16.png'), _('FlatCAM.org'))
  336. self.menuhelp.addSeparator()
  337. self.menuhelp_report_bug = self.menuhelp.addAction(QtGui.QIcon('share/bug16.png'), _('Report a bug'))
  338. self.menuhelp.addSeparator()
  339. self.menuhelp_exc_spec = self.menuhelp.addAction(QtGui.QIcon('share/pdf_link16.png'),
  340. _('Excellon Specification'))
  341. self.menuhelp_gerber_spec = self.menuhelp.addAction(QtGui.QIcon('share/pdf_link16.png'),
  342. _('Gerber Specification'))
  343. self.menuhelp.addSeparator()
  344. self.menuhelp_shortcut_list = self.menuhelp.addAction(QtGui.QIcon('share/shortcuts24.png'),
  345. _('Shortcuts List\tF3'))
  346. self.menuhelp_videohelp = self.menuhelp.addAction(QtGui.QIcon('share/youtube32.png'), _('YouTube Channel\tF4')
  347. )
  348. self.menuhelp_about = self.menuhelp.addAction(QtGui.QIcon('share/about32.png'), _('About FlatCAM'))
  349. # ## FlatCAM Editor menu ###
  350. self.geo_editor_menu = QtWidgets.QMenu(">Geo Editor<")
  351. self.menu.addMenu(self.geo_editor_menu)
  352. self.geo_add_circle_menuitem = self.geo_editor_menu.addAction(
  353. QtGui.QIcon('share/circle32.png'), _('Add Circle\tO')
  354. )
  355. self.geo_add_arc_menuitem = self.geo_editor_menu.addAction(QtGui.QIcon('share/arc16.png'), _('Add Arc\tA'))
  356. self.geo_editor_menu.addSeparator()
  357. self.geo_add_rectangle_menuitem = self.geo_editor_menu.addAction(
  358. QtGui.QIcon('share/rectangle32.png'), _('Add Rectangle\tR')
  359. )
  360. self.geo_add_polygon_menuitem = self.geo_editor_menu.addAction(
  361. QtGui.QIcon('share/polygon32.png'), _('Add Polygon\tN')
  362. )
  363. self.geo_add_path_menuitem = self.geo_editor_menu.addAction(QtGui.QIcon('share/path32.png'), _('Add Path\tP'))
  364. self.geo_editor_menu.addSeparator()
  365. self.geo_add_text_menuitem = self.geo_editor_menu.addAction(QtGui.QIcon('share/text32.png'), _('Add Text\tT'))
  366. self.geo_editor_menu.addSeparator()
  367. self.geo_union_menuitem = self.geo_editor_menu.addAction(QtGui.QIcon('share/union16.png'),
  368. _('Polygon Union\tU'))
  369. self.geo_intersection_menuitem = self.geo_editor_menu.addAction(QtGui.QIcon('share/intersection16.png'),
  370. _('Polygon Intersection\tE'))
  371. self.geo_subtract_menuitem = self.geo_editor_menu.addAction(
  372. QtGui.QIcon('share/subtract16.png'), _('Polygon Subtraction\tS')
  373. )
  374. self.geo_editor_menu.addSeparator()
  375. self.geo_cutpath_menuitem = self.geo_editor_menu.addAction(QtGui.QIcon('share/cutpath16.png'),
  376. _('Cut Path\tX'))
  377. # self.move_menuitem = self.menu.addAction(QtGui.QIcon('share/move16.png'), "Move Objects 'm'")
  378. self.geo_copy_menuitem = self.geo_editor_menu.addAction(QtGui.QIcon('share/copy16.png'), _("Copy Geom\tC"))
  379. self.geo_delete_menuitem = self.geo_editor_menu.addAction(
  380. QtGui.QIcon('share/deleteshape16.png'), _("Delete Shape\tDEL")
  381. )
  382. self.geo_editor_menu.addSeparator()
  383. self.geo_move_menuitem = self.geo_editor_menu.addAction(QtGui.QIcon('share/move32.png'), _("Move\tM"))
  384. self.geo_buffer_menuitem = self.geo_editor_menu.addAction(
  385. QtGui.QIcon('share/buffer16.png'), _("Buffer Tool\tB")
  386. )
  387. self.geo_paint_menuitem = self.geo_editor_menu.addAction(
  388. QtGui.QIcon('share/paint16.png'), _("Paint Tool\tI")
  389. )
  390. self.geo_transform_menuitem = self.geo_editor_menu.addAction(
  391. QtGui.QIcon('share/transform.png'), _("Transform Tool\tALT+R")
  392. )
  393. self.geo_editor_menu.addSeparator()
  394. self.geo_cornersnap_menuitem = self.geo_editor_menu.addAction(
  395. QtGui.QIcon('share/corner32.png'), _("Toggle Corner Snap\tK")
  396. )
  397. self.exc_editor_menu = QtWidgets.QMenu(_(">Excellon Editor<"))
  398. self.menu.addMenu(self.exc_editor_menu)
  399. self.exc_add_array_drill_menuitem = self.exc_editor_menu.addAction(
  400. QtGui.QIcon('share/rectangle32.png'), _('Add Drill Array\tA'))
  401. self.exc_add_drill_menuitem = self.exc_editor_menu.addAction(QtGui.QIcon('share/plus16.png'),
  402. _('Add Drill\tD'))
  403. self.exc_editor_menu.addSeparator()
  404. self.exc_add_array_slot_menuitem = self.exc_editor_menu.addAction(
  405. QtGui.QIcon('share/slot_array26.png'), _('Add Slot Array\tQ'))
  406. self.exc_add_slot_menuitem = self.exc_editor_menu.addAction(QtGui.QIcon('share/slot26.png'),
  407. _('Add Slot\tW'))
  408. self.exc_editor_menu.addSeparator()
  409. self.exc_resize_drill_menuitem = self.exc_editor_menu.addAction(
  410. QtGui.QIcon('share/resize16.png'), _('Resize Drill(S)\tR')
  411. )
  412. self.exc_copy_drill_menuitem = self.exc_editor_menu.addAction(QtGui.QIcon('share/copy32.png'), _('Copy\tC'))
  413. self.exc_delete_drill_menuitem = self.exc_editor_menu.addAction(
  414. QtGui.QIcon('share/deleteshape32.png'), _('Delete\tDEL')
  415. )
  416. self.exc_editor_menu.addSeparator()
  417. self.exc_move_drill_menuitem = self.exc_editor_menu.addAction(QtGui.QIcon('share/move32.png'),
  418. _('Move Drill(s)\tM'))
  419. # ## APPLICATION GERBER EDITOR MENU ###
  420. self.grb_editor_menu = QtWidgets.QMenu(_(">Gerber Editor<"))
  421. self.menu.addMenu(self.grb_editor_menu)
  422. self.grb_add_pad_menuitem = self.grb_editor_menu.addAction(QtGui.QIcon('share/aperture16.png'),
  423. _('Add Pad\tP'))
  424. self.grb_add_pad_array_menuitem = self.grb_editor_menu.addAction(QtGui.QIcon('share/padarray32.png'),
  425. _('Add Pad Array\tA'))
  426. self.grb_add_track_menuitem = self.grb_editor_menu.addAction(QtGui.QIcon('share/track32.png'),
  427. _('Add Track\tT'))
  428. self.grb_add_region_menuitem = self.grb_editor_menu.addAction(QtGui.QIcon('share/rectangle32.png'),
  429. _('Add Region\tN'))
  430. self.grb_editor_menu.addSeparator()
  431. self.grb_convert_poly_menuitem = self.grb_editor_menu.addAction(QtGui.QIcon('share/poligonize32.png'),
  432. _("Poligonize\tALT+N"))
  433. self.grb_add_semidisc_menuitem = self.grb_editor_menu.addAction(QtGui.QIcon('share/semidisc32.png'),
  434. _("Add SemiDisc\tE"))
  435. self.grb_add_disc_menuitem = self.grb_editor_menu.addAction(QtGui.QIcon('share/disc32.png'), _("Add Disc\tD"))
  436. self.grb_add_buffer_menuitem = self.grb_editor_menu.addAction(QtGui.QIcon('share/buffer16-2.png'),
  437. _('Buffer\tB'))
  438. self.grb_add_scale_menuitem = self.grb_editor_menu.addAction(QtGui.QIcon('share/scale32.png'), _('Scale\tS'))
  439. self.grb_add_markarea_menuitem = self.grb_editor_menu.addAction(QtGui.QIcon('share/markarea32.png'),
  440. _('Mark Area\tALT+A'))
  441. self.grb_add_eraser_menuitem = self.grb_editor_menu.addAction(QtGui.QIcon('share/eraser26.png'),
  442. _('Eraser\tCTRL+E'))
  443. self.grb_transform_menuitem = self.grb_editor_menu.addAction(QtGui.QIcon('share/transform.png'),
  444. _("Transform\tALT+R"))
  445. self.grb_editor_menu.addSeparator()
  446. self.grb_copy_menuitem = self.grb_editor_menu.addAction(QtGui.QIcon('share/copy32.png'), _('Copy\tC'))
  447. self.grb_delete_menuitem = self.grb_editor_menu.addAction(QtGui.QIcon('share/deleteshape32.png'),
  448. _('Delete\tDEL'))
  449. self.grb_editor_menu.addSeparator()
  450. self.grb_move_menuitem = self.grb_editor_menu.addAction(QtGui.QIcon('share/move32.png'), _('Move\tM'))
  451. self.grb_editor_menu.menuAction().setVisible(False)
  452. self.grb_editor_menu.setDisabled(True)
  453. self.geo_editor_menu.menuAction().setVisible(False)
  454. self.geo_editor_menu.setDisabled(True)
  455. self.exc_editor_menu.menuAction().setVisible(False)
  456. self.exc_editor_menu.setDisabled(True)
  457. # ################################
  458. # ### Project Tab Context menu ###
  459. # ################################
  460. self.menuproject = QtWidgets.QMenu()
  461. self.menuprojectenable = self.menuproject.addAction(QtGui.QIcon('share/replot32.png'), _('Enable Plot'))
  462. self.menuprojectdisable = self.menuproject.addAction(QtGui.QIcon('share/clear_plot32.png'), _('Disable Plot'))
  463. self.menuproject.addSeparator()
  464. self.menuprojectgeneratecnc = self.menuproject.addAction(QtGui.QIcon('share/cnc32.png'), _('Generate CNC'))
  465. self.menuprojectviewsource = self.menuproject.addAction(QtGui.QIcon('share/source32.png'), _('View Source'))
  466. self.menuprojectedit = self.menuproject.addAction(QtGui.QIcon('share/edit_ok32.png'), _('Edit'))
  467. self.menuprojectcopy = self.menuproject.addAction(QtGui.QIcon('share/copy32.png'), _('Copy'))
  468. self.menuprojectdelete = self.menuproject.addAction(QtGui.QIcon('share/delete32.png'), _('Delete'))
  469. self.menuprojectsave = self.menuproject.addAction(QtGui.QIcon('share/save_as.png'), _('Save'))
  470. self.menuproject.addSeparator()
  471. self.menuprojectproperties = self.menuproject.addAction(QtGui.QIcon('share/properties32.png'), _('Properties'))
  472. # ################
  473. # ### Splitter ###
  474. # ################
  475. # IMPORTANT #
  476. # The order: SPITTER -> NOTEBOOK -> SNAP TOOLBAR is important and without it the GUI will not be initialized as
  477. # desired.
  478. self.splitter = QtWidgets.QSplitter()
  479. self.setCentralWidget(self.splitter)
  480. # self.notebook = QtWidgets.QTabWidget()
  481. self.notebook = FCDetachableTab(protect=True)
  482. self.notebook.setTabsClosable(False)
  483. self.notebook.useOldIndex(True)
  484. self.splitter.addWidget(self.notebook)
  485. self.splitter_left = QtWidgets.QSplitter(Qt.Vertical)
  486. self.splitter.addWidget(self.splitter_left)
  487. self.splitter_left.addWidget(self.notebook)
  488. self.splitter_left.setHandleWidth(0)
  489. # ##############
  490. # ## Toolbar ###
  491. # ##############
  492. # ## TOOLBAR INSTALLATION ###
  493. self.toolbarfile = QtWidgets.QToolBar(_('File Toolbar'))
  494. self.toolbarfile.setObjectName('File_TB')
  495. self.addToolBar(self.toolbarfile)
  496. self.toolbargeo = QtWidgets.QToolBar(_('Edit Toolbar'))
  497. self.toolbargeo.setObjectName('Edit_TB')
  498. self.addToolBar(self.toolbargeo)
  499. self.toolbarview = QtWidgets.QToolBar(_('View Toolbar'))
  500. self.toolbarview.setObjectName('View_TB')
  501. self.addToolBar(self.toolbarview)
  502. self.toolbarshell = QtWidgets.QToolBar(_('Shell Toolbar'))
  503. self.toolbarshell.setObjectName('Shell_TB')
  504. self.addToolBar(self.toolbarshell)
  505. self.toolbartools = QtWidgets.QToolBar(_('Tools Toolbar'))
  506. self.toolbartools.setObjectName('Tools_TB')
  507. self.addToolBar(self.toolbartools)
  508. self.exc_edit_toolbar = QtWidgets.QToolBar(_('Excellon Editor Toolbar'))
  509. self.exc_edit_toolbar.setObjectName('ExcEditor_TB')
  510. self.addToolBar(self.exc_edit_toolbar)
  511. self.addToolBarBreak()
  512. self.geo_edit_toolbar = QtWidgets.QToolBar(_('Geometry Editor Toolbar'))
  513. self.geo_edit_toolbar.setObjectName('GeoEditor_TB')
  514. self.addToolBar(self.geo_edit_toolbar)
  515. self.grb_edit_toolbar = QtWidgets.QToolBar(_('Gerber Editor Toolbar'))
  516. self.grb_edit_toolbar.setObjectName('GrbEditor_TB')
  517. self.addToolBar(self.grb_edit_toolbar)
  518. self.snap_toolbar = QtWidgets.QToolBar(_('Grid Toolbar'))
  519. self.snap_toolbar.setObjectName('Snap_TB')
  520. self.addToolBar(self.snap_toolbar)
  521. settings = QSettings("Open Source", "FlatCAM")
  522. if settings.contains("layout"):
  523. layout = settings.value('layout', type=str)
  524. if layout == 'standard':
  525. pass
  526. elif layout == 'compact':
  527. self.removeToolBar(self.snap_toolbar)
  528. self.snap_toolbar.setMaximumHeight(30)
  529. self.splitter_left.addWidget(self.snap_toolbar)
  530. # ## File Toolbar ###
  531. self.file_open_gerber_btn = self.toolbarfile.addAction(QtGui.QIcon('share/flatcam_icon32.png'),
  532. _("Open Gerber"))
  533. self.file_open_excellon_btn = self.toolbarfile.addAction(QtGui.QIcon('share/drill32.png'), _("Open Excellon"))
  534. self.toolbarfile.addSeparator()
  535. self.file_open_btn = self.toolbarfile.addAction(QtGui.QIcon('share/folder32.png'), _("Open project"))
  536. self.file_save_btn = self.toolbarfile.addAction(QtGui.QIcon('share/floppy32.png'), _("Save project"))
  537. # ## Edit Toolbar ###
  538. self.newgeo_btn = self.toolbargeo.addAction(QtGui.QIcon('share/new_geo32_bis.png'), _("New Blank Geometry"))
  539. self.newgrb_btn = self.toolbargeo.addAction(QtGui.QIcon('share/new_geo32.png'), _("New Blank Gerber"))
  540. self.newexc_btn = self.toolbargeo.addAction(QtGui.QIcon('share/new_exc32.png'), _("New Blank Excellon"))
  541. self.toolbargeo.addSeparator()
  542. self.editgeo_btn = self.toolbargeo.addAction(QtGui.QIcon('share/edit32.png'), _("Editor"))
  543. self.update_obj_btn = self.toolbargeo.addAction(
  544. QtGui.QIcon('share/edit_ok32_bis.png'), _("Save Object and close the Editor")
  545. )
  546. self.toolbargeo.addSeparator()
  547. self.delete_btn = self.toolbargeo.addAction(QtGui.QIcon('share/cancel_edit32.png'), _("&Delete"))
  548. # ## View Toolbar # ##
  549. self.replot_btn = self.toolbarview.addAction(QtGui.QIcon('share/replot32.png'), _("&Replot"))
  550. self.clear_plot_btn = self.toolbarview.addAction(QtGui.QIcon('share/clear_plot32.png'), _("&Clear plot"))
  551. self.zoom_in_btn = self.toolbarview.addAction(QtGui.QIcon('share/zoom_in32.png'), _("Zoom In"))
  552. self.zoom_out_btn = self.toolbarview.addAction(QtGui.QIcon('share/zoom_out32.png'), _("Zoom Out"))
  553. self.zoom_fit_btn = self.toolbarview.addAction(QtGui.QIcon('share/zoom_fit32.png'), _("Zoom Fit"))
  554. # self.toolbarview.setVisible(False)
  555. # ## Shell Toolbar ##
  556. self.shell_btn = self.toolbarshell.addAction(QtGui.QIcon('share/shell32.png'), _("&Command Line"))
  557. self.new_script_btn = self.toolbarshell.addAction(QtGui.QIcon('share/script_new24.png'), _('New Script ...'))
  558. self.open_script_btn = self.toolbarshell.addAction(QtGui.QIcon('share/script_open18.png'), _('Open Script ...'))
  559. self.run_script_btn = self.toolbarshell.addAction(QtGui.QIcon('share/script16.png'), _('Run Script ...'))
  560. # ## Tools Toolbar ##
  561. self.dblsided_btn = self.toolbartools.addAction(QtGui.QIcon('share/doubleside32.png'), _("2Sided Tool"))
  562. self.cutout_btn = self.toolbartools.addAction(QtGui.QIcon('share/cut16_bis.png'), _("&Cutout Tool"))
  563. self.ncc_btn = self.toolbartools.addAction(QtGui.QIcon('share/ncc16.png'), _("NCC Tool"))
  564. self.paint_btn = self.toolbartools.addAction(QtGui.QIcon('share/paint20_1.png'), _("Paint Tool"))
  565. self.toolbartools.addSeparator()
  566. self.panelize_btn = self.toolbartools.addAction(QtGui.QIcon('share/panel16.png'), _("Panel Tool"))
  567. self.film_btn = self.toolbartools.addAction(QtGui.QIcon('share/film16.png'), _("Film Tool"))
  568. self.solder_btn = self.toolbartools.addAction(QtGui.QIcon('share/solderpastebis32.png'), _("SolderPaste Tool"))
  569. self.sub_btn = self.toolbartools.addAction(QtGui.QIcon('share/sub32.png'), _("Substract Tool"))
  570. self.toolbartools.addSeparator()
  571. self.calculators_btn = self.toolbartools.addAction(QtGui.QIcon('share/calculator24.png'), _("Calculators Tool"))
  572. self.transform_btn = self.toolbartools.addAction(QtGui.QIcon('share/transform.png'), _("Transform Tool"))
  573. # ## Drill Editor Toolbar ###
  574. self.select_drill_btn = self.exc_edit_toolbar.addAction(QtGui.QIcon('share/pointer32.png'), _("Select"))
  575. self.add_drill_btn = self.exc_edit_toolbar.addAction(QtGui.QIcon('share/plus16.png'), _('Add Drill Hole'))
  576. self.add_drill_array_btn = self.exc_edit_toolbar.addAction(
  577. QtGui.QIcon('share/addarray16.png'), _('Add Drill Hole Array'))
  578. self.add_slot_btn = self.exc_edit_toolbar.addAction(QtGui.QIcon('share/slot26.png'), _('Add Slot'))
  579. self.add_slot_array_btn = self.exc_edit_toolbar.addAction(
  580. QtGui.QIcon('share/slot_array26.png'), _('Add Slot Array'))
  581. self.resize_drill_btn = self.exc_edit_toolbar.addAction(QtGui.QIcon('share/resize16.png'), _('Resize Drill'))
  582. self.exc_edit_toolbar.addSeparator()
  583. self.copy_drill_btn = self.exc_edit_toolbar.addAction(QtGui.QIcon('share/copy32.png'), _('Copy Drill'))
  584. self.delete_drill_btn = self.exc_edit_toolbar.addAction(QtGui.QIcon('share/trash32.png'), _("Delete Drill"))
  585. self.exc_edit_toolbar.addSeparator()
  586. self.move_drill_btn = self.exc_edit_toolbar.addAction(QtGui.QIcon('share/move32.png'), _("Move Drill"))
  587. # ## Geometry Editor Toolbar ###
  588. self.geo_select_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/pointer32.png'), _("Select"))
  589. self.geo_add_circle_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/circle32.png'), _('Add Circle'))
  590. self.geo_add_arc_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/arc32.png'), _('Add Arc'))
  591. self.geo_add_rectangle_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/rectangle32.png'),
  592. _('Add Rectangle'))
  593. self.geo_edit_toolbar.addSeparator()
  594. self.geo_add_path_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/path32.png'), _('Add Path'))
  595. self.geo_add_polygon_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/polygon32.png'), _('Add Polygon'))
  596. self.geo_edit_toolbar.addSeparator()
  597. self.geo_add_text_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/text32.png'), _('Add Text'))
  598. self.geo_add_buffer_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/buffer16-2.png'), _('Add Buffer'))
  599. self.geo_add_paint_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/paint20_1.png'), _('Paint Shape'))
  600. self.geo_eraser_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/eraser26.png'), _('Eraser'))
  601. self.geo_edit_toolbar.addSeparator()
  602. self.geo_union_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/union32.png'), _('Polygon Union'))
  603. self.geo_intersection_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/intersection32.png'),
  604. _('Polygon Intersection'))
  605. self.geo_subtract_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/subtract32.png'),
  606. _('Polygon Subtraction'))
  607. self.geo_edit_toolbar.addSeparator()
  608. self.geo_cutpath_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/cutpath32.png'), _('Cut Path'))
  609. self.geo_copy_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/copy32.png'), _("Copy Shape(s)"))
  610. self.geo_delete_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/trash32.png'),
  611. _("Delete Shape '-'"))
  612. self.geo_transform_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/transform.png'),
  613. _("Transformations"))
  614. self.geo_edit_toolbar.addSeparator()
  615. self.geo_move_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/move32.png'), _("Move Objects "))
  616. # ## Gerber Editor Toolbar # ##
  617. self.grb_select_btn = self.grb_edit_toolbar.addAction(QtGui.QIcon('share/pointer32.png'), _("Select"))
  618. self.grb_add_pad_btn = self.grb_edit_toolbar.addAction(QtGui.QIcon('share/aperture32.png'), _("Add Pad"))
  619. self.add_pad_ar_btn = self.grb_edit_toolbar.addAction(QtGui.QIcon('share/padarray32.png'), _('Add Pad Array'))
  620. self.grb_add_track_btn = self.grb_edit_toolbar.addAction(QtGui.QIcon('share/track32.png'), _("Add Track"))
  621. self.grb_add_region_btn = self.grb_edit_toolbar.addAction(QtGui.QIcon('share/polygon32.png'), _("Add Region"))
  622. self.grb_convert_poly_btn = self.grb_edit_toolbar.addAction(QtGui.QIcon('share/poligonize32.png'),
  623. _("Poligonize"))
  624. self.grb_add_semidisc_btn = self.grb_edit_toolbar.addAction(QtGui.QIcon('share/semidisc32.png'), _("SemiDisc"))
  625. self.grb_add_disc_btn = self.grb_edit_toolbar.addAction(QtGui.QIcon('share/disc32.png'), _("Disc"))
  626. self.grb_edit_toolbar.addSeparator()
  627. self.aperture_buffer_btn = self.grb_edit_toolbar.addAction(QtGui.QIcon('share/buffer16-2.png'), _('Buffer'))
  628. self.aperture_scale_btn = self.grb_edit_toolbar.addAction(QtGui.QIcon('share/scale32.png'), _('Scale'))
  629. self.aperture_markarea_btn = self.grb_edit_toolbar.addAction(QtGui.QIcon('share/markarea32.png'),
  630. _('Mark Area'))
  631. self.aperture_eraser_btn = self.grb_edit_toolbar.addAction(QtGui.QIcon('share/eraser26.png'), _('Eraser'))
  632. self.grb_edit_toolbar.addSeparator()
  633. self.aperture_copy_btn = self.grb_edit_toolbar.addAction(QtGui.QIcon('share/copy32.png'), _("Copy"))
  634. self.aperture_delete_btn = self.grb_edit_toolbar.addAction(QtGui.QIcon('share/trash32.png'),
  635. _("Delete"))
  636. self.grb_transform_btn = self.grb_edit_toolbar.addAction(QtGui.QIcon('share/transform.png'),
  637. _("Transformations"))
  638. self.grb_edit_toolbar.addSeparator()
  639. self.aperture_move_btn = self.grb_edit_toolbar.addAction(QtGui.QIcon('share/move32.png'), _("Move"))
  640. # # ## Snap Toolbar # ##
  641. # Snap GRID toolbar is always active to facilitate usage of measurements done on GRID
  642. # self.addToolBar(self.snap_toolbar)
  643. self.grid_snap_btn = self.snap_toolbar.addAction(QtGui.QIcon('share/grid32.png'), _('Snap to grid'))
  644. self.grid_gap_x_entry = FCEntry2()
  645. self.grid_gap_x_entry.setMaximumWidth(70)
  646. self.grid_gap_x_entry.setToolTip(_("Grid X snapping distance"))
  647. self.snap_toolbar.addWidget(self.grid_gap_x_entry)
  648. self.grid_gap_y_entry = FCEntry2()
  649. self.grid_gap_y_entry.setMaximumWidth(70)
  650. self.grid_gap_y_entry.setToolTip(_("Grid Y snapping distance"))
  651. self.snap_toolbar.addWidget(self.grid_gap_y_entry)
  652. self.grid_space_label = QtWidgets.QLabel(" ")
  653. self.snap_toolbar.addWidget(self.grid_space_label)
  654. self.grid_gap_link_cb = FCCheckBox()
  655. self.grid_gap_link_cb.setToolTip(_("When active, value on Grid_X\n"
  656. "is copied to the Grid_Y value."))
  657. self.snap_toolbar.addWidget(self.grid_gap_link_cb)
  658. self.ois_grid = OptionalInputSection(self.grid_gap_link_cb, [self.grid_gap_y_entry], logic=False)
  659. self.corner_snap_btn = self.snap_toolbar.addAction(QtGui.QIcon('share/corner32.png'), _('Snap to corner'))
  660. self.snap_max_dist_entry = FCEntry()
  661. self.snap_max_dist_entry.setMaximumWidth(70)
  662. self.snap_max_dist_entry.setToolTip(_("Max. magnet distance"))
  663. self.snap_magnet = self.snap_toolbar.addWidget(self.snap_max_dist_entry)
  664. # ############# ##
  665. # ## Notebook # ##
  666. # ############# ##
  667. # ## Project # ##
  668. # self.project_tab = QtWidgets.QWidget()
  669. # self.project_tab.setObjectName("project_tab")
  670. # # project_tab.setMinimumWidth(250) # Hack
  671. # self.project_tab_layout = QtWidgets.QVBoxLayout(self.project_tab)
  672. # self.project_tab_layout.setContentsMargins(2, 2, 2, 2)
  673. # self.notebook.addTab(self.project_tab,_( "Project"))
  674. self.project_tab = QtWidgets.QWidget()
  675. self.project_tab.setObjectName("project_tab")
  676. self.project_frame_lay = QtWidgets.QVBoxLayout(self.project_tab)
  677. self.project_frame_lay.setContentsMargins(0, 0, 0, 0)
  678. self.project_frame = QtWidgets.QFrame()
  679. self.project_frame.setContentsMargins(0, 0, 0, 0)
  680. self.project_frame_lay.addWidget(self.project_frame)
  681. self.project_tab_layout = QtWidgets.QVBoxLayout(self.project_frame)
  682. self.project_tab_layout.setContentsMargins(2, 2, 2, 2)
  683. self.notebook.addTab(self.project_tab, _("Project"))
  684. self.project_frame.setDisabled(False)
  685. # ## Selected # ##
  686. self.selected_tab = QtWidgets.QWidget()
  687. self.selected_tab.setObjectName("selected_tab")
  688. self.selected_tab_layout = QtWidgets.QVBoxLayout(self.selected_tab)
  689. self.selected_tab_layout.setContentsMargins(2, 2, 2, 2)
  690. self.selected_scroll_area = VerticalScrollArea()
  691. self.selected_tab_layout.addWidget(self.selected_scroll_area)
  692. self.notebook.addTab(self.selected_tab, _("Selected"))
  693. # ## Tool # ##
  694. self.tool_tab = QtWidgets.QWidget()
  695. self.tool_tab.setObjectName("tool_tab")
  696. self.tool_tab_layout = QtWidgets.QVBoxLayout(self.tool_tab)
  697. self.tool_tab_layout.setContentsMargins(2, 2, 2, 2)
  698. self.notebook.addTab(self.tool_tab, _("Tool"))
  699. self.tool_scroll_area = VerticalScrollArea()
  700. self.tool_tab_layout.addWidget(self.tool_scroll_area)
  701. self.right_widget = QtWidgets.QWidget()
  702. self.right_widget.setSizePolicy(QtWidgets.QSizePolicy.Ignored, QtWidgets.QSizePolicy.Ignored)
  703. self.splitter.addWidget(self.right_widget)
  704. self.right_lay = QtWidgets.QVBoxLayout()
  705. self.right_lay.setContentsMargins(0, 0, 0, 0)
  706. self.right_widget.setLayout(self.right_lay)
  707. # self.plot_tab_area = FCTab()
  708. self.plot_tab_area = FCDetachableTab2(protect=False, protect_by_name=[_('Plot Area')])
  709. self.plot_tab_area.useOldIndex(True)
  710. self.right_lay.addWidget(self.plot_tab_area)
  711. self.plot_tab_area.setTabsClosable(True)
  712. self.plot_tab = QtWidgets.QWidget()
  713. self.plot_tab.setObjectName("plotarea")
  714. self.plot_tab_area.addTab(self.plot_tab, _("Plot Area"))
  715. self.right_layout = QtWidgets.QVBoxLayout()
  716. self.right_layout.setObjectName("right_layout")
  717. self.right_layout.setContentsMargins(2, 2, 2, 2)
  718. self.plot_tab.setLayout(self.right_layout)
  719. # remove the close button from the Plot Area tab (first tab index = 0) as this one will always be ON
  720. self.plot_tab_area.protectTab(0)
  721. # ##################################### ##
  722. # ## HERE WE BUILD THE PREF. TAB AREA # ##
  723. # ##################################### ##
  724. self.preferences_tab = QtWidgets.QWidget()
  725. self.pref_tab_layout = QtWidgets.QVBoxLayout(self.preferences_tab)
  726. self.pref_tab_layout.setContentsMargins(2, 2, 2, 2)
  727. self.pref_tab_area = FCTab()
  728. self.pref_tab_area.setTabsClosable(False)
  729. self.pref_tab_area_tabBar = self.pref_tab_area.tabBar()
  730. self.pref_tab_area_tabBar.setStyleSheet("QTabBar::tab{min-width:90px;}")
  731. self.pref_tab_area_tabBar.setExpanding(True)
  732. self.pref_tab_layout.addWidget(self.pref_tab_area)
  733. self.general_tab = QtWidgets.QWidget()
  734. self.general_tab.setObjectName("general_tab")
  735. self.pref_tab_area.addTab(self.general_tab, _("General"))
  736. self.general_tab_lay = QtWidgets.QVBoxLayout()
  737. self.general_tab_lay.setContentsMargins(2, 2, 2, 2)
  738. self.general_tab.setLayout(self.general_tab_lay)
  739. self.hlay1 = QtWidgets.QHBoxLayout()
  740. self.general_tab_lay.addLayout(self.hlay1)
  741. self.options_combo = QtWidgets.QComboBox()
  742. self.options_combo.addItem(_("APP. DEFAULTS"))
  743. self.options_combo.addItem(_("PROJ. OPTIONS "))
  744. self.hlay1.addWidget(self.options_combo)
  745. # disable this button as it may no longer be useful
  746. self.options_combo.setVisible(False)
  747. self.hlay1.addStretch()
  748. self.general_scroll_area = QtWidgets.QScrollArea()
  749. self.general_tab_lay.addWidget(self.general_scroll_area)
  750. self.gerber_tab = QtWidgets.QWidget()
  751. self.gerber_tab.setObjectName("gerber_tab")
  752. self.pref_tab_area.addTab(self.gerber_tab, _("GERBER"))
  753. self.gerber_tab_lay = QtWidgets.QVBoxLayout()
  754. self.gerber_tab_lay.setContentsMargins(2, 2, 2, 2)
  755. self.gerber_tab.setLayout(self.gerber_tab_lay)
  756. self.gerber_scroll_area = QtWidgets.QScrollArea()
  757. self.gerber_tab_lay.addWidget(self.gerber_scroll_area)
  758. self.excellon_tab = QtWidgets.QWidget()
  759. self.excellon_tab.setObjectName("excellon_tab")
  760. self.pref_tab_area.addTab(self.excellon_tab, _("EXCELLON"))
  761. self.excellon_tab_lay = QtWidgets.QVBoxLayout()
  762. self.excellon_tab_lay.setContentsMargins(2, 2, 2, 2)
  763. self.excellon_tab.setLayout(self.excellon_tab_lay)
  764. self.excellon_scroll_area = QtWidgets.QScrollArea()
  765. self.excellon_tab_lay.addWidget(self.excellon_scroll_area)
  766. self.geometry_tab = QtWidgets.QWidget()
  767. self.geometry_tab.setObjectName("geometry_tab")
  768. self.pref_tab_area.addTab(self.geometry_tab, _("GEOMETRY"))
  769. self.geometry_tab_lay = QtWidgets.QVBoxLayout()
  770. self.geometry_tab_lay.setContentsMargins(2, 2, 2, 2)
  771. self.geometry_tab.setLayout(self.geometry_tab_lay)
  772. self.geometry_scroll_area = QtWidgets.QScrollArea()
  773. self.geometry_tab_lay.addWidget(self.geometry_scroll_area)
  774. self.cncjob_tab = QtWidgets.QWidget()
  775. self.cncjob_tab.setObjectName("cncjob_tab")
  776. self.pref_tab_area.addTab(self.cncjob_tab, _("CNC-JOB"))
  777. self.cncjob_tab_lay = QtWidgets.QVBoxLayout()
  778. self.cncjob_tab_lay.setContentsMargins(2, 2, 2, 2)
  779. self.cncjob_tab.setLayout(self.cncjob_tab_lay)
  780. self.cncjob_scroll_area = QtWidgets.QScrollArea()
  781. self.cncjob_tab_lay.addWidget(self.cncjob_scroll_area)
  782. self.tools_tab = QtWidgets.QWidget()
  783. self.pref_tab_area.addTab(self.tools_tab, _("TOOLS"))
  784. self.tools_tab_lay = QtWidgets.QVBoxLayout()
  785. self.tools_tab_lay.setContentsMargins(2, 2, 2, 2)
  786. self.tools_tab.setLayout(self.tools_tab_lay)
  787. self.tools_scroll_area = QtWidgets.QScrollArea()
  788. self.tools_tab_lay.addWidget(self.tools_scroll_area)
  789. self.fa_tab = QtWidgets.QWidget()
  790. self.fa_tab.setObjectName("fa_tab")
  791. self.pref_tab_area.addTab(self.fa_tab, _("FILE ASSOCIATIONS"))
  792. self.fa_tab_lay = QtWidgets.QVBoxLayout()
  793. self.fa_tab_lay.setContentsMargins(2, 2, 2, 2)
  794. self.fa_tab.setLayout(self.fa_tab_lay)
  795. self.fa_scroll_area = QtWidgets.QScrollArea()
  796. self.fa_tab_lay.addWidget(self.fa_scroll_area)
  797. self.pref_tab_bottom_layout = QtWidgets.QHBoxLayout()
  798. self.pref_tab_bottom_layout.setAlignment(QtCore.Qt.AlignVCenter)
  799. self.pref_tab_layout.addLayout(self.pref_tab_bottom_layout)
  800. self.pref_tab_bottom_layout_1 = QtWidgets.QHBoxLayout()
  801. self.pref_tab_bottom_layout_1.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  802. self.pref_tab_bottom_layout.addLayout(self.pref_tab_bottom_layout_1)
  803. self.pref_import_button = QtWidgets.QPushButton()
  804. self.pref_import_button.setText(_("Import Preferences"))
  805. self.pref_import_button.setMinimumWidth(130)
  806. self.pref_import_button.setToolTip(
  807. _("Import a full set of FlatCAM settings from a file\n"
  808. "previously saved on HDD.\n\n"
  809. "FlatCAM automatically save a 'factory_defaults' file\n"
  810. "on the first start. Do not delete that file."))
  811. self.pref_tab_bottom_layout_1.addWidget(self.pref_import_button)
  812. self.pref_export_button = QtWidgets.QPushButton()
  813. self.pref_export_button.setText(_("Export Preferences"))
  814. self.pref_export_button.setMinimumWidth(130)
  815. self.pref_export_button.setToolTip(
  816. _("Export a full set of FlatCAM settings in a file\n"
  817. "that is saved on HDD."))
  818. self.pref_tab_bottom_layout_1.addWidget(self.pref_export_button)
  819. self.pref_open_button = QtWidgets.QPushButton()
  820. self.pref_open_button.setText(_("Open Pref Folder"))
  821. self.pref_open_button.setMinimumWidth(130)
  822. self.pref_open_button.setToolTip(
  823. _("Open the folder where FlatCAM save the preferences files."))
  824. self.pref_tab_bottom_layout_1.addWidget(self.pref_open_button)
  825. self.pref_tab_bottom_layout_2 = QtWidgets.QHBoxLayout()
  826. self.pref_tab_bottom_layout_2.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
  827. self.pref_tab_bottom_layout.addLayout(self.pref_tab_bottom_layout_2)
  828. self.pref_save_button = QtWidgets.QPushButton()
  829. self.pref_save_button.setText(_("Save Preferences"))
  830. self.pref_save_button.setMinimumWidth(130)
  831. self.pref_save_button.setToolTip(
  832. _("Save the current settings in the 'current_defaults' file\n"
  833. "which is the file storing the working default preferences."))
  834. self.pref_tab_bottom_layout_2.addWidget(self.pref_save_button)
  835. # #################################################
  836. # ## HERE WE BUILD THE SHORTCUTS LIST. TAB AREA ###
  837. # #################################################
  838. self.shortcuts_tab = QtWidgets.QWidget()
  839. self.sh_tab_layout = QtWidgets.QVBoxLayout()
  840. self.sh_tab_layout.setContentsMargins(2, 2, 2, 2)
  841. self.shortcuts_tab.setLayout(self.sh_tab_layout)
  842. self.sh_hlay = QtWidgets.QHBoxLayout()
  843. self.sh_title = QtWidgets.QTextEdit(
  844. _('<b>Shortcut Key List</b>'))
  845. self.sh_title.setTextInteractionFlags(QtCore.Qt.NoTextInteraction)
  846. self.sh_title.setFrameStyle(QtWidgets.QFrame.NoFrame)
  847. self.sh_title.setMaximumHeight(30)
  848. font = self.sh_title.font()
  849. font.setPointSize(12)
  850. self.sh_title.setFont(font)
  851. self.sh_tab_layout.addWidget(self.sh_title)
  852. self.sh_tab_layout.addLayout(self.sh_hlay)
  853. self.app_sh_msg = (
  854. '''<b>General Shortcut list</b><br>
  855. <table border="0" cellpadding="0" cellspacing="0" style="width:283px">
  856. <tbody>
  857. <tr height="20">
  858. <td height="20" width="89"><strong>F3</strong></td>
  859. <td width="194"><span style="color:#006400"><strong>&nbsp;%s</strong></span></td>
  860. </tr>
  861. <tr height="20">
  862. <td height="20">&nbsp;</td>
  863. <td>&nbsp;</td>
  864. </tr>
  865. <tr height="20">
  866. <td height="20"><strong>1</strong></td>
  867. <td>&nbsp;%s</td>
  868. </tr>
  869. <tr height="20">
  870. <td height="20"><strong>2</strong></td>
  871. <td>&nbsp;%s</td>
  872. </tr>
  873. <tr height="20">
  874. <td height="20"><strong>3</strong></td>
  875. <td>&nbsp;%s</td>
  876. </tr>
  877. <tr height="20">
  878. <td height="20">&nbsp;</td>
  879. <td>&nbsp;</td>
  880. </tr>
  881. <tr height="20">
  882. <td height="20"><strong>B</strong></td>
  883. <td>&nbsp;%s</td>
  884. </tr>
  885. <tr height="20">
  886. <td height="20"><strong>E</strong></td>
  887. <td>&nbsp;%s</td>
  888. </tr>
  889. <tr height="20">
  890. <td height="20"><strong>G</strong></td>
  891. <td>&nbsp;%s</td>
  892. </tr>
  893. <tr height="20">
  894. <td height="20"><strong>J</strong></td>
  895. <td>&nbsp;%s</td>
  896. </tr>
  897. <tr height="20">
  898. <td height="20"><strong>L</strong></td>
  899. <td>&nbsp;%s</td>
  900. </tr>
  901. <tr height="20">
  902. <td height="20"><strong>M</strong></td>
  903. <td>&nbsp;%s</td>
  904. </tr>
  905. <tr height="20">
  906. <td height="20"><strong>N</strong></td>
  907. <td>&nbsp;%s</td>
  908. </tr>
  909. <tr height="20">
  910. <td height="20"><strong>O</strong></td>
  911. <td>&nbsp;%s</td>
  912. </tr>
  913. <tr height="20">
  914. <td height="20"><strong>Q</strong></td>
  915. <td>&nbsp;%s</td>
  916. </tr>
  917. <tr height="20">
  918. <td height="20"><strong>P</strong></td>
  919. <td>&nbsp;%s</td>
  920. </tr>
  921. <tr height="20">
  922. <td height="20"><strong>R</strong></td>
  923. <td>&nbsp;%s</td>
  924. </tr>
  925. <tr height="20">
  926. <td height="20"><strong>S</strong></td>
  927. <td>&nbsp;%s</td>
  928. </tr>
  929. <tr height="20">
  930. <td height="20"><strong>T</strong></td>
  931. <td>&nbsp;%s</td>
  932. </tr>
  933. <tr height="20">
  934. <td height="20"><strong>V</strong></td>
  935. <td>&nbsp;%s</td>
  936. </tr>
  937. <tr height="20">
  938. <td height="20"><strong>X</strong></td>
  939. <td>&nbsp;%s</td>
  940. </tr>
  941. <tr height="20">
  942. <td height="20"><strong>Y</strong></td>
  943. <td>&nbsp;%s</td>
  944. </tr>
  945. <tr height="20">
  946. <td height="20"><strong>&#39;-&#39;</strong></td>
  947. <td>&nbsp;%s</td>
  948. </tr>
  949. <tr height="20">
  950. <td height="20"><strong>&#39;=&#39;</strong></td>
  951. <td>&nbsp;%s</td>
  952. </tr>
  953. <tr height="20">
  954. <td height="20">&nbsp;</td>
  955. <td>&nbsp;</td>
  956. </tr>
  957. <tr height="20">
  958. <td height="20"><strong>CTRL+A</strong></td>
  959. <td>&nbsp;%s</td>
  960. </tr>
  961. <tr height="20">
  962. <td height="20"><strong>CTRL+C</strong></td>
  963. <td>&nbsp;%s</td>
  964. </tr>
  965. <tr height="20">
  966. <td height="20"><strong>CTRL+E</strong></td>
  967. <td>&nbsp;%s</td>
  968. </tr>
  969. <tr height="20">
  970. <td height="20"><strong>CTRL+G</strong></td>
  971. <td>&nbsp;%s</td>
  972. </tr>
  973. <tr height="20">
  974. <td height="20"><strong>CTRL+N</strong></td>
  975. <td>&nbsp;%s</td>
  976. </tr>
  977. <tr height="20">
  978. <td height="20"><strong>CTRL+M</strong></td>
  979. <td>&nbsp;%s</td>
  980. </tr>
  981. <tr height="20">
  982. <td height="20"><strong>CTRL+O</strong></td>
  983. <td>&nbsp;%s</td>
  984. </tr>
  985. <tr height="20">
  986. <td height="20"><strong>CTRL+S</strong></td>
  987. <td>&nbsp;%s</td>
  988. </tr>
  989. <tr height="20">
  990. <td height="20"><strong>CTRL+F10</strong></td>
  991. <td>&nbsp;%s</td>
  992. </tr>
  993. <tr height="20">
  994. <td height="20">&nbsp;</td>
  995. <td>&nbsp;</td>
  996. </tr>
  997. <tr height="20">
  998. <td height="20"><strong>SHIFT+C</strong></td>
  999. <td>&nbsp;%s</td>
  1000. </tr>
  1001. <tr height="20">
  1002. <td height="20"><strong>SHIFT+E</strong></td>
  1003. <td>&nbsp;%s</td>
  1004. </tr>
  1005. <tr height="20">
  1006. <td height="20"><strong>SHIFT+G</strong></td>
  1007. <td>&nbsp;%s</td>
  1008. </tr>
  1009. <tr height="20">
  1010. <td height="20"><strong>SHIFT+P</strong></td>
  1011. <td>&nbsp;%s</td>
  1012. </tr>
  1013. <tr height="20">
  1014. <td height="20"><strong>SHIFT+R</strong></td>
  1015. <td>&nbsp;%s</td>
  1016. </tr>
  1017. <tr height="20">
  1018. <td height="20"><strong>SHIFT+S</strong></td>
  1019. <td>&nbsp;%s</td>
  1020. </tr>
  1021. <tr height="20">
  1022. <td height="20"><strong>SHIFT+W</strong></td>
  1023. <td>&nbsp;%s</td>
  1024. </tr>
  1025. <tr height="20">
  1026. <td height="20"><strong>SHIFT+X</strong></td>
  1027. <td>&nbsp;%s</td>
  1028. </tr>
  1029. <tr height="20">
  1030. <td height="20"><strong>SHIFT+Y</strong></td>
  1031. <td>&nbsp;%s</td>
  1032. </tr>
  1033. <tr height="20">
  1034. <td height="20">&nbsp;</td>
  1035. <td>&nbsp;</td>
  1036. </tr>
  1037. <tr height="20">
  1038. <td height="20"><strong>ALT+C</strong></td>
  1039. <td>&nbsp;%s</td>
  1040. </tr>
  1041. <tr height="20">
  1042. <td height="20"><strong>ALT+D</strong></td>
  1043. <td>&nbsp;%s</td>
  1044. </tr>
  1045. <tr height="20">
  1046. <td height="20"><strong>ALT+K</strong></td>
  1047. <td>&nbsp;%s</td>
  1048. </tr>
  1049. <tr height="20">
  1050. <td height="20"><strong>ALT+L</strong></td>
  1051. <td>&nbsp;%s</td>
  1052. </tr>
  1053. <tr height="20">
  1054. <td height="20"><strong>ALT+N</strong></td>
  1055. <td>&nbsp;%s</td>
  1056. </tr>
  1057. <tr height="20">
  1058. <td height="20"><strong>ALT+P</strong></td>
  1059. <td>&nbsp;%s</td>
  1060. </tr>
  1061. <tr height="20">
  1062. <td height="20"><strong>ALT+Q</strong></td>
  1063. <td>&nbsp;%s</td>
  1064. </tr>
  1065. <tr height="20">
  1066. <td height="20"><strong>ALT+R</strong></td>
  1067. <td>&nbsp;%s</td>
  1068. </tr>
  1069. <tr height="20">
  1070. <td height="20"><strong>ALT+S</strong></td>
  1071. <td>&nbsp;%s</td>
  1072. </tr>
  1073. <tr height="20">
  1074. <td height="20"><strong>ALT+U</strong></td>
  1075. <td>&nbsp;%s</td>
  1076. </tr>
  1077. <tr height="20">
  1078. <td height="20"><strong>ALT+1</strong></td>
  1079. <td>&nbsp;%s</td>
  1080. </tr>
  1081. <tr height="20">
  1082. <td height="20"><strong>ALT+2</strong></td>
  1083. <td>&nbsp;%s</td>
  1084. </tr>
  1085. <tr height="20">
  1086. <td height="20"><strong>ALT+3</strong></td>
  1087. <td>&nbsp;%s</td>
  1088. </tr>
  1089. <tr height="20">
  1090. <td height="20"><strong>ALT+F10</strong></td>
  1091. <td>&nbsp;%s</td>
  1092. </tr>
  1093. <tr height="20">
  1094. <td height="20">&nbsp;</td>
  1095. <td>&nbsp;</td>
  1096. </tr>
  1097. <tr height="20">
  1098. <td height="20"><strong>CTRL+ALT+X</strong></td>
  1099. <td>&nbsp;%s</td>
  1100. </tr>
  1101. <tr height="20">
  1102. <td height="20">&nbsp;</td>
  1103. <td>&nbsp;</td>
  1104. </tr>
  1105. <tr height="20">
  1106. <td height="20"><strong>F1</strong></td>
  1107. <td>&nbsp;%s</td>
  1108. </tr>
  1109. <tr height="20">
  1110. <td height="20"><strong>F4</strong></td>
  1111. <td>&nbsp;%s</td>
  1112. </tr>
  1113. <tr height="20">
  1114. <td height="20"><strong>F5</strong></td>
  1115. <td>&nbsp;%s</td>
  1116. </tr>
  1117. <tr height="20">
  1118. <td height="20"><strong>Del</strong></td>
  1119. <td>&nbsp;%s</td>
  1120. </tr>
  1121. <tr height="20">
  1122. <td height="20"><strong>Del</strong></td>
  1123. <td>&nbsp;%s</td>
  1124. </tr>
  1125. <tr height="20">
  1126. <td height="20"><strong>'`'</strong></td>
  1127. <td>&nbsp;%s</td>
  1128. </tr>
  1129. <tr height="20">
  1130. <td height="20"><strong>SPACE</strong></td>
  1131. <td>&nbsp;%s</td>
  1132. </tr>
  1133. <tr height="20">
  1134. <td height="20"><strong>Escape</strong></td>
  1135. <td>&nbsp;%s</td>
  1136. </tr>
  1137. </tbody>
  1138. </table>
  1139. ''' % (
  1140. _("SHOW SHORTCUT LIST"), _("Switch to Project Tab"), _("Switch to Selected Tab"), _("Switch to Tool Tab"),
  1141. _("New Gerber"), _("Edit Object (if selected)"), _("Grid On/Off"), _("Jump to Coordinates"),
  1142. _("New Excellon"), _("Move Obj"), _("New Geometry"), _("Set Origin"), _("Change Units"),
  1143. _("Open Properties Tool"), _("Rotate by 90 degree CW"), _("Shell Toggle"),
  1144. _("Add a Tool (when in Geometry Selected Tab or in Tools NCC or Tools Paint)"), _("Zoom Fit"),
  1145. _("Flip on X_axis"), _("Flip on Y_axis"), _("Zoom Out"), _("Zoom In"), _("Select All"), _("Copy Obj"),
  1146. _("Open Excellon File"), _("Open Gerber File"), _("New Project"), _("Measurement Tool"), _("Open Project"),
  1147. _("Save Project As"), _("Toggle Plot Area"), _("Copy Obj_Name"), _("Toggle Code Editor"),
  1148. _("Toggle the axis"), _("Open Preferences Window"), _("Rotate by 90 degree CCW"), _("Run a Script"),
  1149. _("Toggle the workspace"), _("Skew on X axis"), _("Skew on Y axis"), _("Calculators Tool"),
  1150. _("2-Sided PCB Tool"), _("Solder Paste Dispensing Tool"), _("Film PCB Tool"), _("Non-Copper Clearing Tool"),
  1151. _("Paint Area Tool"), _("PDF Import Tool"), _("Transformations Tool"), _("View File Source"),
  1152. _("Cutout PCB Tool"), _("Enable all Plots"), _("Disable all Plots"), _("Disable Non-selected Plots"),
  1153. _("Toggle Full Screen"), _("Abort current task (gracefully)"), _("Open Online Manual"),
  1154. _("Open Online Tutorials"), _("Refresh Plots"), _("Delete Object"), _("Alternate: Delete Tool"),
  1155. _("(left to Key_1)Toogle Notebook Area (Left Side)"), _("En(Dis)able Obj Plot"), _("Deselects all objects")
  1156. )
  1157. )
  1158. self.sh_app = QtWidgets.QTextEdit()
  1159. self.sh_app.setTextInteractionFlags(QtCore.Qt.NoTextInteraction)
  1160. self.sh_app.setText(self.app_sh_msg)
  1161. self.sh_app.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
  1162. self.sh_hlay.addWidget(self.sh_app)
  1163. editor_title = """
  1164. <b>%s</b><br>
  1165. <br>
  1166. """ % _("Editor Shortcut list")
  1167. geo_sh_messages = """
  1168. <strong><span style="color:#0000ff">%s</span></strong><br>
  1169. <table border="0" cellpadding="0" cellspacing="0" style="width:283px">
  1170. <tbody>
  1171. <tr height="20">
  1172. <td height="20" width="89"><strong>A</strong></td>
  1173. <td width="194">&nbsp;%s</td>
  1174. </tr>
  1175. <tr height="20">
  1176. <td height="20"><strong>B</strong></td>
  1177. <td>&nbsp;%s</td>
  1178. </tr>
  1179. <tr height="20">
  1180. <td height="20"><strong>C</strong></td>
  1181. <td>&nbsp;%s</td>
  1182. </tr>
  1183. <tr height="20">
  1184. <td height="20"><strong>D</strong></td>
  1185. <td>&nbsp;%s</td>
  1186. </tr>
  1187. <tr height="20">
  1188. <td height="20"><strong>E</strong></td>
  1189. <td>&nbsp;%s</td>
  1190. </tr>
  1191. <tr height="20">
  1192. <td height="20"><strong>I</strong></td>
  1193. <td>&nbsp;%s</td>
  1194. </tr>
  1195. <tr height="20">
  1196. <td height="20"><strong>J</strong></td>
  1197. <td>&nbsp;%s</td>
  1198. </tr>
  1199. <tr height="20">
  1200. <td height="20"><strong>K</strong></td>
  1201. <td>&nbsp;%s</td>
  1202. </tr>
  1203. <tr height="20">
  1204. <td height="20"><strong>M</strong></td>
  1205. <td>&nbsp;%s</td>
  1206. </tr>
  1207. <tr height="20">
  1208. <td height="20"><strong>M</strong></td>
  1209. <td>&nbsp;%s</td>
  1210. </tr>
  1211. <tr height="20">
  1212. <td height="20"><strong>N</strong></td>
  1213. <td>&nbsp;%s</td>
  1214. </tr>
  1215. <tr height="20">
  1216. <td height="20"><strong>O</strong></td>
  1217. <td>&nbsp;%s</td>
  1218. </tr>
  1219. <tr height="20">
  1220. <td height="20"><strong>P</strong></td>
  1221. <td>&nbsp;%s</td>
  1222. </tr>
  1223. <tr height="20">
  1224. <td height="20"><strong>R</strong></td>
  1225. <td>&nbsp;%s</td>
  1226. </tr>
  1227. <tr height="20">
  1228. <td height="20"><strong>S</strong></td>
  1229. <td>&nbsp;%s</td>
  1230. </tr>
  1231. <tr height="20">
  1232. <td height="20"><strong>T</strong></td>
  1233. <td>&nbsp;%s</td>
  1234. </tr>
  1235. <tr height="20">
  1236. <td height="20"><strong>U</strong></td>
  1237. <td>&nbsp;%s</td>
  1238. </tr>
  1239. <tr height="20">
  1240. <td height="20"><strong>X</strong></td>
  1241. <td>&nbsp;%s</td>
  1242. </tr>
  1243. <tr height="20">
  1244. <td height="20"><strong>Y</strong></td>
  1245. <td>&nbsp;%s</td>
  1246. </tr>
  1247. <tr height="20">
  1248. <td height="20">&nbsp;</td>
  1249. <td>&nbsp;</td>
  1250. </tr>
  1251. <tr height="20">
  1252. <td height="20"><strong>SHIFT+X</strong></td>
  1253. <td>&nbsp;%s</td>
  1254. </tr>
  1255. <tr height="20">
  1256. <td height="20"><strong>SHIFT+Y</strong></td>
  1257. <td>&nbsp;%s</td>
  1258. </tr>
  1259. <tr height="20">
  1260. <td height="20">&nbsp;</td>
  1261. <td>&nbsp;</td>
  1262. </tr>
  1263. <tr height="20">
  1264. <td height="20"><strong>ALT+R</strong></td>
  1265. <td>&nbsp;%s</td>
  1266. </tr>
  1267. <tr height="20">
  1268. <td height="20"><strong>ALT+X</strong></td>
  1269. <td>&nbsp;%s</td>
  1270. </tr>
  1271. <tr height="20">
  1272. <td height="20"><strong>ALT+Y</strong></td>
  1273. <td>&nbsp;%s</td>
  1274. </tr>
  1275. <tr height="20">
  1276. <td height="20">&nbsp;</td>
  1277. <td>&nbsp;</td>
  1278. </tr>
  1279. <tr height="20">
  1280. <td height="20"><strong>CTRL+M</strong></td>
  1281. <td>&nbsp;%s</td>
  1282. </tr>
  1283. <tr height="20">
  1284. <td height="20"><strong>CTRL+S</strong></td>
  1285. <td>&nbsp;%s</td>
  1286. </tr>
  1287. <tr height="20">
  1288. <td height="20"><strong>CTRL+X</strong></td>
  1289. <td>&nbsp;%s</td>
  1290. </tr>
  1291. <tr height="20">
  1292. <td height="20">&nbsp;</td>
  1293. <td>&nbsp;</td>
  1294. </tr>
  1295. <tr height="20">
  1296. <td height="20"><strong>Space</strong></td>
  1297. <td>&nbsp;%s</td>
  1298. </tr>
  1299. <tr height="20">
  1300. <td height="20"><strong>ENTER</strong></td>
  1301. <td>&nbsp;%s</td>
  1302. </tr>
  1303. <tr height="20">
  1304. <td height="20"><strong>ESC</strong></td>
  1305. <td>&nbsp;%s</td>
  1306. </tr>
  1307. <tr height="20">
  1308. <td height="20"><strong>Del</strong></td>
  1309. <td>&nbsp;%s</td>
  1310. </tr>
  1311. </tbody>
  1312. </table>
  1313. <br>
  1314. """ % (
  1315. _("GEOMETRY EDITOR"), _("Draw an Arc"), _("Buffer Tool"), _("Copy Geo Item"),
  1316. _("Within Add Arc will toogle the ARC direction: CW or CCW"), _("Polygon Intersection Tool"),
  1317. _("Geo Paint Tool"), _("Jump to Location (x, y)"), _("Toggle Corner Snap"), _("Move Geo Item"),
  1318. _("Within Add Arc will cycle through the ARC modes"), _("Draw a Polygon"), _("Draw a Circle"),
  1319. _("Draw a Path"), _("Draw Rectangle"), _("Polygon Subtraction Tool"), _("Add Text Tool"),
  1320. _("Polygon Union Tool"), _("Flip shape on X axis"), _("Flip shape on Y axis"), _("Skew shape on X axis"),
  1321. _("Skew shape on Y axis"), _("Editor Transformation Tool"), _("Offset shape on X axis"),
  1322. _("Offset shape on Y axis"), _("Measurement Tool"), _("Save Object and Exit Editor"), _("Polygon Cut Tool"),
  1323. _("Rotate Geometry"), _("Finish drawing for certain tools"), _("Abort and return to Select"),
  1324. _("Delete Shape")
  1325. )
  1326. exc_sh_messages = """
  1327. <br>
  1328. <strong><span style="color:#ff0000">%s</span></strong><br>
  1329. <table border="0" cellpadding="0" cellspacing="0" style="width:283px">
  1330. <tbody>
  1331. <tr height="20">
  1332. <td height="20" width="89"><strong>A</strong></td>
  1333. <td width="194">&nbsp;%s</td>
  1334. </tr>
  1335. <tr height="20">
  1336. <td height="20"><strong>C</strong></td>
  1337. <td>&nbsp;%s</td>
  1338. </tr>
  1339. <tr height="20">
  1340. <td height="20"><strong>D</strong></td>
  1341. <td>&nbsp;%s</td>
  1342. </tr>
  1343. <tr height="20">
  1344. <td height="20"><strong>J</strong></td>
  1345. <td>&nbsp;%s</td>
  1346. </tr>
  1347. <tr height="20">
  1348. <td height="20"><strong>M</strong></td>
  1349. <td>&nbsp;%s</td>
  1350. </tr>
  1351. <tr height="20">
  1352. <td height="20" width="89"><strong>Q</strong></td>
  1353. <td width="194">&nbsp;%s</td>
  1354. </tr>
  1355. <tr height="20">
  1356. <td height="20"><strong>R</strong></td>
  1357. <td>&nbsp;%s</td>
  1358. </tr>
  1359. <tr height="20">
  1360. <td height="20"><strong>T</strong></td>
  1361. <td>&nbsp;%s</td>
  1362. </tr>
  1363. <tr height="20">
  1364. <td height="20" width="89"><strong>W</strong></td>
  1365. <td width="194">&nbsp;%s</td>
  1366. </tr>
  1367. <tr height="20">
  1368. <td height="20">&nbsp;</td>
  1369. <td>&nbsp;</td>
  1370. </tr>
  1371. <tr height="20">
  1372. <td height="20"><strong>Del</strong></td>
  1373. <td>&nbsp;%s</td>
  1374. </tr>
  1375. <tr height="20">
  1376. <td height="20"><strong>Del</strong></td>
  1377. <td>&nbsp;%s</td>
  1378. </tr>
  1379. <tr height="20">
  1380. <td height="20">&nbsp;</td>
  1381. <td>&nbsp;</td>
  1382. </tr>
  1383. <tr height="20">
  1384. <td height="20"><strong>ESC</strong></td>
  1385. <td>&nbsp;%s</td>
  1386. </tr>
  1387. <tr height="20">
  1388. <td height="20"><strong>CTRL+S</strong></td>
  1389. <td>&nbsp;%s</td>
  1390. </tr>
  1391. </tbody>
  1392. </table>
  1393. <br>
  1394. """ % (
  1395. _("EXCELLON EDITOR"), _("Add Drill Array"), _("Copy Drill(s)"), _("Add Drill"),
  1396. _("Jump to Location (x, y)"), _("Move Drill(s)"), _("Add Slot Array"), _("Resize Drill(s)"),
  1397. _("Add a new Tool"), _("Add Slot"), _("Delete Drill(s)"), _("Alternate: Delete Tool(s)"),
  1398. _("Abort and return to Select"), _("Save Object and Exit Editor")
  1399. )
  1400. grb_sh_messages = """
  1401. <br>
  1402. <strong><span style="color:#00ff00">%s</span></strong><br>
  1403. <table border="0" cellpadding="0" cellspacing="0" style="width:283px">
  1404. <tbody>
  1405. <tr height="20">
  1406. <td height="20" width="89"><strong>A</strong></td>
  1407. <td width="194">&nbsp;%s</td>
  1408. </tr>
  1409. <tr height="20">
  1410. <td height="20"><strong>B</strong></td>
  1411. <td>&nbsp;%s</td>
  1412. </tr>
  1413. <tr height="20">
  1414. <td height="20"><strong>C</strong></td>
  1415. <td>&nbsp;%s</td>
  1416. </tr>
  1417. <tr height="20">
  1418. <td height="20"><strong>D</strong></td>
  1419. <td>&nbsp;%s</td>
  1420. </tr>
  1421. <tr height="20">
  1422. <td height="20"><strong>E</strong></td>
  1423. <td>&nbsp;%s</td>
  1424. </tr>
  1425. <tr height="20">
  1426. <td height="20"><strong>J</strong></td>
  1427. <td>&nbsp;%s</td>
  1428. </tr>
  1429. <tr height="20">
  1430. <td height="20"><strong>M</strong></td>
  1431. <td>&nbsp;%s</td>
  1432. </tr>
  1433. <tr height="20">
  1434. <td height="20"><strong>N</strong></td>
  1435. <td>&nbsp;%s</td>
  1436. </tr>
  1437. <tr height="20">
  1438. <td height="20"><strong>P</strong></td>
  1439. <td>&nbsp;%s</td>
  1440. </tr>
  1441. <tr height="20">
  1442. <td height="20"><strong>R</strong></td>
  1443. <td>&nbsp;%s</td>
  1444. </tr>
  1445. <tr height="20">
  1446. <td height="20"><strong>S</strong></td>
  1447. <td>&nbsp;%s</td>
  1448. </tr>
  1449. <tr height="20">
  1450. <td height="20"><strong>T</strong></td>
  1451. <td>&nbsp;%s</td>
  1452. </tr>
  1453. <tr height="20">
  1454. <td height="20"><strong>T</strong></td>
  1455. <td>&nbsp;%s</td>
  1456. </tr>
  1457. <tr height="20">
  1458. <td height="20">&nbsp;</td>
  1459. <td>&nbsp;</td>
  1460. </tr>
  1461. <tr height="20">
  1462. <td height="20"><strong>Del</strong></td>
  1463. <td>&nbsp;%s</td>
  1464. </tr>
  1465. <tr height="20">
  1466. <td height="20"><strong>Del</strong></td>
  1467. <td>&nbsp;%s</td>
  1468. </tr>
  1469. <tr height="20">
  1470. <td height="20">&nbsp;</td>
  1471. <td>&nbsp;</td>
  1472. </tr>
  1473. <tr height="20">
  1474. <td height="20"><strong>ESC</strong></td>
  1475. <td>&nbsp;%s</td>
  1476. </tr>
  1477. <tr height="20">
  1478. <td height="20"><strong>CTRL+E</strong></td>
  1479. <td>&nbsp;%s</td>
  1480. </tr>
  1481. <tr height="20">
  1482. <td height="20"><strong>CTRL+S</strong></td>
  1483. <td>&nbsp;%s</td>
  1484. </tr>
  1485. <tr height="20">
  1486. <td height="20">&nbsp;</td>
  1487. <td>&nbsp;</td>
  1488. </tr>
  1489. <tr height="20">
  1490. <td height="20"><strong>ALT+A</strong></td>
  1491. <td>&nbsp;%s</td>
  1492. </tr>
  1493. <tr height="20">
  1494. <td height="20"><strong>ALT+N</strong></td>
  1495. <td>&nbsp;%s</td>
  1496. </tr>
  1497. <tr height="20">
  1498. <td height="20"><strong>ALT+R</strong></td>
  1499. <td>&nbsp;%s</td>
  1500. </tr>
  1501. </tbody>
  1502. </table>
  1503. <br>
  1504. """ % (
  1505. _("GERBER EDITOR"), _("Add Pad Array"), _("Buffer"), _("Copy"), _("Add Disc"), _("Add SemiDisc"),
  1506. _("Jump to Location (x, y)"), _("Move"), _("Add Region"), _("Add Pad"),
  1507. _("Within Track & Region Tools will cycle in REVERSE the bend modes"), _("Scale"), _("Add Track"),
  1508. _("Within Track & Region Tools will cycle FORWARD the bend modes"), _("Delete"),
  1509. _("Alternate: Delete Apertures"), _("Abort and return to Select"), _("Eraser Tool"),
  1510. _("Save Object and Exit Editor"), _("Mark Area Tool"), _("Poligonize Tool"), _("Transformation Tool")
  1511. )
  1512. self.editor_sh_msg = editor_title + geo_sh_messages + grb_sh_messages + exc_sh_messages
  1513. self.sh_editor = QtWidgets.QTextEdit()
  1514. self.sh_editor.setTextInteractionFlags(QtCore.Qt.NoTextInteraction)
  1515. self.sh_editor.setText(self.editor_sh_msg)
  1516. self.sh_editor.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
  1517. self.sh_hlay.addWidget(self.sh_editor)
  1518. # ########################################################### ##
  1519. # # ## HERE WE BUILD THE CONTEXT MENU FOR RMB CLICK ON CANVAS # ##
  1520. # ########################################################### ##
  1521. self.popMenu = FCMenu()
  1522. self.popmenu_disable = self.popMenu.addAction(QtGui.QIcon('share/disable32.png'), _("Toggle Visibility"))
  1523. self.popmenu_panel_toggle = self.popMenu.addAction(QtGui.QIcon('share/notebook16.png'), _("Toggle Panel"))
  1524. self.popMenu.addSeparator()
  1525. self.cmenu_newmenu = self.popMenu.addMenu(QtGui.QIcon('share/file32.png'), _("New"))
  1526. self.popmenu_new_geo = self.cmenu_newmenu.addAction(QtGui.QIcon('share/new_geo32_bis.png'), _("Geometry"))
  1527. self.popmenu_new_grb = self.cmenu_newmenu.addAction(QtGui.QIcon('share/flatcam_icon32.png'), "Gerber")
  1528. self.popmenu_new_exc = self.cmenu_newmenu.addAction(QtGui.QIcon('share/new_exc32.png'), _("Excellon"))
  1529. self.cmenu_newmenu.addSeparator()
  1530. self.popmenu_new_prj = self.cmenu_newmenu.addAction(QtGui.QIcon('share/file16.png'), _("Project"))
  1531. self.popMenu.addSeparator()
  1532. self.cmenu_gridmenu = self.popMenu.addMenu(QtGui.QIcon('share/grid32_menu.png'), _("Grids"))
  1533. self.cmenu_viewmenu = self.popMenu.addMenu(QtGui.QIcon('share/view64.png'), _("View"))
  1534. self.zoomfit = self.cmenu_viewmenu.addAction(QtGui.QIcon('share/zoom_fit32.png'), _("Zoom Fit"))
  1535. self.clearplot = self.cmenu_viewmenu.addAction(QtGui.QIcon('share/clear_plot32.png'), _("Clear Plot"))
  1536. self.replot = self.cmenu_viewmenu.addAction(QtGui.QIcon('share/replot32.png'), _("Replot"))
  1537. self.popMenu.addSeparator()
  1538. self.g_editor_cmenu = self.popMenu.addMenu(QtGui.QIcon('share/draw32.png'), _("Geo Editor"))
  1539. self.draw_line = self.g_editor_cmenu.addAction(QtGui.QIcon('share/path32.png'), _("Path"))
  1540. self.draw_rect = self.g_editor_cmenu.addAction(QtGui.QIcon('share/rectangle32.png'), _("Rectangle"))
  1541. self.g_editor_cmenu.addSeparator()
  1542. self.draw_circle = self.g_editor_cmenu.addAction(QtGui.QIcon('share/circle32.png'), _("Circle"))
  1543. self.draw_poly = self.g_editor_cmenu.addAction(QtGui.QIcon('share/polygon32.png'), _("Polygon"))
  1544. self.draw_arc = self.g_editor_cmenu.addAction(QtGui.QIcon('share/arc32.png'), _("Arc"))
  1545. self.g_editor_cmenu.addSeparator()
  1546. self.draw_text = self.g_editor_cmenu.addAction(QtGui.QIcon('share/text32.png'), _("Text"))
  1547. self.draw_buffer = self.g_editor_cmenu.addAction(QtGui.QIcon('share/buffer16-2.png'), _("Buffer"))
  1548. self.draw_paint = self.g_editor_cmenu.addAction(QtGui.QIcon('share/paint20_1.png'), _("Paint"))
  1549. self.draw_eraser = self.g_editor_cmenu.addAction(QtGui.QIcon('share/eraser26.png'), _("Eraser"))
  1550. self.g_editor_cmenu.addSeparator()
  1551. self.draw_union = self.g_editor_cmenu.addAction(QtGui.QIcon('share/union32.png'), _("Union"))
  1552. self.draw_intersect = self.g_editor_cmenu.addAction(QtGui.QIcon('share/intersection32.png'), _("Intersection"))
  1553. self.draw_substract = self.g_editor_cmenu.addAction(QtGui.QIcon('share/subtract32.png'), _("Substraction"))
  1554. self.draw_cut = self.g_editor_cmenu.addAction(QtGui.QIcon('share/cutpath32.png'), _("Cut"))
  1555. self.draw_transform = self.g_editor_cmenu.addAction(QtGui.QIcon('share/transform.png'), _("Transformations"))
  1556. self.g_editor_cmenu.addSeparator()
  1557. self.draw_move = self.g_editor_cmenu.addAction(QtGui.QIcon('share/move32.png'), _("Move"))
  1558. self.grb_editor_cmenu = self.popMenu.addMenu(QtGui.QIcon('share/draw32.png'), _("Gerber Editor"))
  1559. self.grb_draw_pad = self.grb_editor_cmenu.addAction(QtGui.QIcon('share/aperture32.png'), _("Pad"))
  1560. self.grb_draw_pad_array = self.grb_editor_cmenu.addAction(QtGui.QIcon('share/padarray32.png'), _("Pad Array"))
  1561. self.grb_editor_cmenu.addSeparator()
  1562. self.grb_draw_track = self.grb_editor_cmenu.addAction(QtGui.QIcon('share/track32.png'), _("Track"))
  1563. self.grb_draw_region = self.grb_editor_cmenu.addAction(QtGui.QIcon('share/polygon32.png'), _("Region"))
  1564. self.grb_draw_poligonize = self.grb_editor_cmenu.addAction(QtGui.QIcon('share/poligonize32.png'),
  1565. _("Poligonize"))
  1566. self.grb_draw_semidisc = self.grb_editor_cmenu.addAction(QtGui.QIcon('share/semidisc32.png'), _("SemiDisc"))
  1567. self.grb_draw_disc = self.grb_editor_cmenu.addAction(QtGui.QIcon('share/disc32.png'), _("Disc"))
  1568. self.grb_editor_cmenu.addSeparator()
  1569. self.grb_draw_buffer = self.grb_editor_cmenu.addAction(QtGui.QIcon('share/buffer16-2.png'), _("Buffer"))
  1570. self.grb_draw_scale = self.grb_editor_cmenu.addAction(QtGui.QIcon('share/scale32.png'), _("Scale"))
  1571. self.grb_draw_markarea = self.grb_editor_cmenu.addAction(QtGui.QIcon('share/markarea32.png'), _("Mark Area"))
  1572. self.grb_draw_eraser = self.grb_editor_cmenu.addAction(QtGui.QIcon('share/eraser26.png'), _("Eraser"))
  1573. self.grb_editor_cmenu.addSeparator()
  1574. self.grb_draw_transformations = self.grb_editor_cmenu.addAction(QtGui.QIcon('share/transform.png'),
  1575. _("Transformations"))
  1576. self.e_editor_cmenu = self.popMenu.addMenu(QtGui.QIcon('share/drill32.png'), _("Exc Editor"))
  1577. self.drill = self.e_editor_cmenu.addAction(QtGui.QIcon('share/drill32.png'), _("Add Drill"))
  1578. self.drill_array = self.e_editor_cmenu.addAction(QtGui.QIcon('share/addarray32.png'), _("Add Drill Array"))
  1579. self.e_editor_cmenu.addSeparator()
  1580. self.slot = self.e_editor_cmenu.addAction(QtGui.QIcon('share/slot26.png'), _("Add Slot"))
  1581. self.slot_array = self.e_editor_cmenu.addAction(QtGui.QIcon('share/slot_array26.png'), _("Add Slot Array"))
  1582. self.e_editor_cmenu.addSeparator()
  1583. self.drill_resize = self.e_editor_cmenu.addAction(QtGui.QIcon('share/resize16.png'), _("Resize Drill"))
  1584. self.popMenu.addSeparator()
  1585. self.popmenu_copy = self.popMenu.addAction(QtGui.QIcon('share/copy32.png'), _("Copy"))
  1586. self.popmenu_delete = self.popMenu.addAction(QtGui.QIcon('share/delete32.png'), _("Delete"))
  1587. self.popmenu_edit = self.popMenu.addAction(QtGui.QIcon('share/edit32.png'), _("Edit"))
  1588. self.popmenu_save = self.popMenu.addAction(QtGui.QIcon('share/floppy32.png'), _("Close Editor"))
  1589. self.popmenu_save.setVisible(False)
  1590. self.popMenu.addSeparator()
  1591. self.popmenu_move = self.popMenu.addAction(QtGui.QIcon('share/move32.png'), _("Move"))
  1592. self.popmenu_properties = self.popMenu.addAction(QtGui.QIcon('share/properties32.png'), _("Properties"))
  1593. # ###################################
  1594. # ## Here we build the CNCJob Tab ###
  1595. # ###################################
  1596. # self.cncjob_tab = QtWidgets.QWidget()
  1597. # self.cncjob_tab_layout = QtWidgets.QGridLayout(self.cncjob_tab)
  1598. # self.cncjob_tab_layout.setContentsMargins(2, 2, 2, 2)
  1599. # self.cncjob_tab.setLayout(self.cncjob_tab_layout)
  1600. self.cncjob_tab = QtWidgets.QWidget()
  1601. self.c_temp_layout = QtWidgets.QVBoxLayout(self.cncjob_tab)
  1602. self.c_temp_layout.setContentsMargins(0, 0, 0, 0)
  1603. self.cncjob_frame = QtWidgets.QFrame()
  1604. self.cncjob_frame.setContentsMargins(0, 0, 0, 0)
  1605. self.c_temp_layout.addWidget(self.cncjob_frame)
  1606. self.cncjob_tab_layout = QtWidgets.QGridLayout(self.cncjob_frame)
  1607. self.cncjob_tab_layout.setContentsMargins(2, 2, 2, 2)
  1608. self.cncjob_frame.setLayout(self.cncjob_tab_layout)
  1609. self.code_editor = FCTextAreaExtended()
  1610. stylesheet = """
  1611. QTextEdit { selection-background-color:yellow;
  1612. selection-color:black;
  1613. }
  1614. """
  1615. self.code_editor.setStyleSheet(stylesheet)
  1616. self.buttonPreview = QtWidgets.QPushButton(_('Print Preview'))
  1617. self.buttonPreview.setToolTip(_("Open a OS standard Preview Print window."))
  1618. self.buttonPrint = QtWidgets.QPushButton(_('Print Code'))
  1619. self.buttonPrint.setToolTip(_("Open a OS standard Print window."))
  1620. self.buttonFind = QtWidgets.QPushButton(_('Find in Code'))
  1621. self.buttonFind.setToolTip(_("Will search and highlight in yellow the string in the Find box."))
  1622. self.buttonFind.setMinimumWidth(100)
  1623. self.buttonPreview.setMinimumWidth(100)
  1624. self.entryFind = FCEntry()
  1625. self.entryFind.setToolTip(_("Find box. Enter here the strings to be searched in the text."))
  1626. self.buttonReplace = QtWidgets.QPushButton(_('Replace With'))
  1627. self.buttonReplace.setToolTip(_("Will replace the string from the Find box with the one in the Replace box."))
  1628. self.buttonReplace.setMinimumWidth(100)
  1629. self.entryReplace = FCEntry()
  1630. self.entryReplace.setToolTip(_("String to replace the one in the Find box throughout the text."))
  1631. self.sel_all_cb = QtWidgets.QCheckBox(_('All'))
  1632. self.sel_all_cb.setToolTip(_("When checked it will replace all instances in the 'Find' box\n"
  1633. "with the text in the 'Replace' box.."))
  1634. self.buttonOpen = QtWidgets.QPushButton(_('Open Code'))
  1635. self.buttonOpen.setToolTip(_("Will open a text file in the editor."))
  1636. self.buttonSave = QtWidgets.QPushButton(_('Save Code'))
  1637. self.buttonSave.setToolTip(_("Will save the text in the editor into a file."))
  1638. self.buttonRun = QtWidgets.QPushButton(_('Run Code'))
  1639. self.buttonRun.setToolTip(_("Will run the TCL commands found in the text file, one by one."))
  1640. self.buttonRun.hide()
  1641. self.cncjob_tab_layout.addWidget(self.code_editor, 0, 0, 1, 5)
  1642. cnc_tab_lay_1 = QtWidgets.QHBoxLayout()
  1643. # cnc_tab_lay_1.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  1644. cnc_tab_lay_1.addWidget(self.buttonFind)
  1645. cnc_tab_lay_1.addWidget(self.entryFind)
  1646. cnc_tab_lay_1.addWidget(self.buttonReplace)
  1647. cnc_tab_lay_1.addWidget(self.entryReplace)
  1648. cnc_tab_lay_1.addWidget(self.sel_all_cb)
  1649. self.cncjob_tab_layout.addLayout(cnc_tab_lay_1, 1, 0, 1, 5)
  1650. cnc_tab_lay_3 = QtWidgets.QHBoxLayout()
  1651. cnc_tab_lay_3.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  1652. cnc_tab_lay_3.addWidget(self.buttonPreview)
  1653. cnc_tab_lay_3.addWidget(self.buttonPrint)
  1654. self.cncjob_tab_layout.addLayout(cnc_tab_lay_3, 2, 0, 1, 1, QtCore.Qt.AlignLeft)
  1655. cnc_tab_lay_4 = QtWidgets.QHBoxLayout()
  1656. cnc_tab_lay_4.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
  1657. cnc_tab_lay_4.addWidget(self.buttonOpen)
  1658. cnc_tab_lay_4.addWidget(self.buttonSave)
  1659. cnc_tab_lay_4.addWidget(self.buttonRun)
  1660. self.cncjob_tab_layout.addLayout(cnc_tab_lay_4, 2, 4, 1, 1)
  1661. # #################################
  1662. # ## Build InfoBar is done here ###
  1663. # #################################
  1664. self.infobar = self.statusBar()
  1665. self.fcinfo = FlatCAMInfoBar()
  1666. self.infobar.addWidget(self.fcinfo, stretch=1)
  1667. self.rel_position_label = QtWidgets.QLabel(
  1668. "<b>Dx</b>: 0.0000&nbsp;&nbsp; <b>Dy</b>: 0.0000&nbsp;&nbsp;&nbsp;&nbsp;")
  1669. self.rel_position_label.setMinimumWidth(110)
  1670. self.rel_position_label.setToolTip(_("Relative neasurement.\nReference is last click position"))
  1671. self.infobar.addWidget(self.rel_position_label)
  1672. self.position_label = QtWidgets.QLabel(
  1673. "&nbsp;&nbsp;&nbsp;&nbsp;<b>X</b>: 0.0000&nbsp;&nbsp; <b>Y</b>: 0.0000")
  1674. self.position_label.setMinimumWidth(110)
  1675. self.position_label.setToolTip(_("Absolute neasurement.\nReference is (X=0, Y= 0) position"))
  1676. self.infobar.addWidget(self.position_label)
  1677. self.units_label = QtWidgets.QLabel("[in]")
  1678. self.units_label.setMargin(2)
  1679. self.infobar.addWidget(self.units_label)
  1680. # disabled
  1681. self.progress_bar = QtWidgets.QProgressBar()
  1682. self.progress_bar.setMinimum(0)
  1683. self.progress_bar.setMaximum(100)
  1684. # infobar.addWidget(self.progress_bar)
  1685. self.activity_view = FlatCAMActivityView()
  1686. self.infobar.addWidget(self.activity_view)
  1687. # ###########################################################################
  1688. # ####### Set the APP ICON and the WINDOW TITLE and GEOMETRY ################
  1689. # ###########################################################################
  1690. self.app_icon = QtGui.QIcon()
  1691. self.app_icon.addFile('share/flatcam_icon16.png', QtCore.QSize(16, 16))
  1692. self.app_icon.addFile('share/flatcam_icon24.png', QtCore.QSize(24, 24))
  1693. self.app_icon.addFile('share/flatcam_icon32.png', QtCore.QSize(32, 32))
  1694. self.app_icon.addFile('share/flatcam_icon48.png', QtCore.QSize(48, 48))
  1695. self.app_icon.addFile('share/flatcam_icon128.png', QtCore.QSize(128, 128))
  1696. self.app_icon.addFile('share/flatcam_icon256.png', QtCore.QSize(256, 256))
  1697. self.setWindowIcon(self.app_icon)
  1698. self.setGeometry(100, 100, 1024, 650)
  1699. self.setWindowTitle('FlatCAM %s %s - %s' %
  1700. (version,
  1701. ('BETA' if beta else ''),
  1702. platform.architecture()[0])
  1703. )
  1704. self.filename = ""
  1705. self.units = ""
  1706. self.setAcceptDrops(True)
  1707. # # restore the Toolbar State from file
  1708. # try:
  1709. # with open(self.app.data_path + '\gui_state.config', 'rb') as stream:
  1710. # self.restoreState(QtCore.QByteArray(stream.read()))
  1711. # log.debug("FlatCAMGUI.__init__() --> UI state restored.")
  1712. # except IOError:
  1713. # log.debug("FlatCAMGUI.__init__() --> UI state not restored. IOError")
  1714. # pass
  1715. # ################### ##
  1716. # ## INITIALIZE GUI # ##
  1717. # ################### ##
  1718. self.grid_snap_btn.setCheckable(True)
  1719. self.corner_snap_btn.setCheckable(True)
  1720. self.update_obj_btn.setEnabled(False)
  1721. # start with GRID activated
  1722. self.grid_snap_btn.trigger()
  1723. self.g_editor_cmenu.menuAction().setVisible(False)
  1724. self.grb_editor_cmenu.menuAction().setVisible(False)
  1725. self.e_editor_cmenu.menuAction().setVisible(False)
  1726. self.general_defaults_form = GeneralPreferencesUI()
  1727. self.gerber_defaults_form = GerberPreferencesUI()
  1728. self.excellon_defaults_form = ExcellonPreferencesUI()
  1729. self.geometry_defaults_form = GeometryPreferencesUI()
  1730. self.cncjob_defaults_form = CNCJobPreferencesUI()
  1731. self.tools_defaults_form = ToolsPreferencesUI()
  1732. self.fa_defaults_form = FAPreferencesUI()
  1733. self.general_options_form = GeneralPreferencesUI()
  1734. self.gerber_options_form = GerberPreferencesUI()
  1735. self.excellon_options_form = ExcellonPreferencesUI()
  1736. self.geometry_options_form = GeometryPreferencesUI()
  1737. self.cncjob_options_form = CNCJobPreferencesUI()
  1738. self.tools_options_form = ToolsPreferencesUI()
  1739. self.fa_options_form = FAPreferencesUI()
  1740. QtWidgets.qApp.installEventFilter(self)
  1741. # restore the Toolbar State from file
  1742. settings = QSettings("Open Source", "FlatCAM")
  1743. if settings.contains("saved_gui_state"):
  1744. saved_gui_state = settings.value('saved_gui_state')
  1745. self.restoreState(saved_gui_state)
  1746. log.debug("FlatCAMGUI.__init__() --> UI state restored.")
  1747. settings = QSettings("Open Source", "FlatCAM")
  1748. if settings.contains("layout"):
  1749. layout = settings.value('layout', type=str)
  1750. if layout == 'standard':
  1751. self.exc_edit_toolbar.setVisible(False)
  1752. self.exc_edit_toolbar.setDisabled(True)
  1753. self.geo_edit_toolbar.setVisible(False)
  1754. self.geo_edit_toolbar.setDisabled(True)
  1755. self.grb_edit_toolbar.setVisible(False)
  1756. self.grb_edit_toolbar.setDisabled(True)
  1757. self.corner_snap_btn.setVisible(False)
  1758. self.snap_magnet.setVisible(False)
  1759. elif layout == 'compact':
  1760. self.exc_edit_toolbar.setDisabled(True)
  1761. self.geo_edit_toolbar.setDisabled(True)
  1762. self.grb_edit_toolbar.setDisabled(True)
  1763. self.snap_magnet.setVisible(True)
  1764. self.corner_snap_btn.setVisible(True)
  1765. self.snap_magnet.setDisabled(True)
  1766. self.corner_snap_btn.setDisabled(True)
  1767. log.debug("FlatCAMGUI.__init__() --> UI layout restored from QSettings.")
  1768. else:
  1769. self.exc_edit_toolbar.setVisible(False)
  1770. self.exc_edit_toolbar.setDisabled(True)
  1771. self.geo_edit_toolbar.setVisible(False)
  1772. self.geo_edit_toolbar.setDisabled(True)
  1773. self.grb_edit_toolbar.setVisible(False)
  1774. self.grb_edit_toolbar.setDisabled(True)
  1775. self.corner_snap_btn.setVisible(False)
  1776. self.snap_magnet.setVisible(False)
  1777. settings.setValue('layout', "standard")
  1778. # This will write the setting to the platform specific storage.
  1779. del settings
  1780. log.debug("FlatCAMGUI.__init__() --> UI layout restored from defaults. QSettings set to 'standard'")
  1781. # construct the Toolbar Lock menu entry to the context menu of the QMainWindow
  1782. self.lock_action = QtWidgets.QAction()
  1783. self.lock_action.setText(_("Lock Toolbars"))
  1784. self.lock_action.setCheckable(True)
  1785. settings = QSettings("Open Source", "FlatCAM")
  1786. if settings.contains("toolbar_lock"):
  1787. lock_val = settings.value('toolbar_lock')
  1788. if lock_val == 'true':
  1789. lock_state = True
  1790. self.lock_action.setChecked(True)
  1791. else:
  1792. lock_state = False
  1793. self.lock_action.setChecked(False)
  1794. else:
  1795. lock_state = False
  1796. settings.setValue('toolbar_lock', lock_state)
  1797. # This will write the setting to the platform specific storage.
  1798. del settings
  1799. self.lock_toolbar(lock=lock_state)
  1800. self.lock_action.triggered[bool].connect(self.lock_toolbar)
  1801. def eventFilter(self, obj, event):
  1802. # filter the ToolTips display based on a Preferences setting
  1803. if self.general_defaults_form.general_gui_set_group.toggle_tooltips_cb.get_value() is False:
  1804. if event.type() == QtCore.QEvent.ToolTip:
  1805. return True
  1806. else:
  1807. return False
  1808. return False
  1809. def populate_toolbars(self):
  1810. # ## File Toolbar # ##
  1811. self.file_open_gerber_btn = self.toolbarfile.addAction(QtGui.QIcon('share/flatcam_icon32.png'),
  1812. _("Open Gerber"))
  1813. self.file_open_excellon_btn = self.toolbarfile.addAction(QtGui.QIcon('share/drill32.png'), _("Open Excellon"))
  1814. self.toolbarfile.addSeparator()
  1815. self.file_open_btn = self.toolbarfile.addAction(QtGui.QIcon('share/folder32.png'), _("Open project"))
  1816. self.file_save_btn = self.toolbarfile.addAction(QtGui.QIcon('share/floppy32.png'), _("Save project"))
  1817. # ## Edit Toolbar # ##
  1818. self.newgeo_btn = self.toolbargeo.addAction(QtGui.QIcon('share/new_geo32_bis.png'), _("New Blank Geometry"))
  1819. self.newexc_btn = self.toolbargeo.addAction(QtGui.QIcon('share/new_exc32.png'), _("New Blank Excellon"))
  1820. self.toolbargeo.addSeparator()
  1821. self.editgeo_btn = self.toolbargeo.addAction(QtGui.QIcon('share/edit32.png'), _("Editor"))
  1822. self.update_obj_btn = self.toolbargeo.addAction(
  1823. QtGui.QIcon('share/edit_ok32_bis.png'), _("Save Object and close the Editor")
  1824. )
  1825. self.toolbargeo.addSeparator()
  1826. self.delete_btn = self.toolbargeo.addAction(QtGui.QIcon('share/cancel_edit32.png'), _("&Delete"))
  1827. # ## View Toolbar # ##
  1828. self.replot_btn = self.toolbarview.addAction(QtGui.QIcon('share/replot32.png'), _("&Replot"))
  1829. self.clear_plot_btn = self.toolbarview.addAction(QtGui.QIcon('share/clear_plot32.png'), _("&Clear plot"))
  1830. self.zoom_in_btn = self.toolbarview.addAction(QtGui.QIcon('share/zoom_in32.png'), _("Zoom In"))
  1831. self.zoom_out_btn = self.toolbarview.addAction(QtGui.QIcon('share/zoom_out32.png'), _("Zoom Out"))
  1832. self.zoom_fit_btn = self.toolbarview.addAction(QtGui.QIcon('share/zoom_fit32.png'), _("Zoom Fit"))
  1833. # self.toolbarview.setVisible(False)
  1834. # ## Shell Toolbar # ##
  1835. self.shell_btn = self.toolbarshell.addAction(QtGui.QIcon('share/shell32.png'), _("&Command Line"))
  1836. self.new_script_btn = self.toolbarshell.addAction(QtGui.QIcon('share/script_new24.png'), _('New Script ...'))
  1837. self.open_script_btn = self.toolbarshell.addAction(QtGui.QIcon('share/script_open18.png'), _('Open Script ...'))
  1838. self.run_script_btn = self.toolbarshell.addAction(QtGui.QIcon('share/script16.png'), _('Run Script ...'))
  1839. # ## Tools Toolbar # ##
  1840. self.dblsided_btn = self.toolbartools.addAction(QtGui.QIcon('share/doubleside32.png'), _("2Sided Tool"))
  1841. self.cutout_btn = self.toolbartools.addAction(QtGui.QIcon('share/cut16_bis.png'), _("&Cutout Tool"))
  1842. self.ncc_btn = self.toolbartools.addAction(QtGui.QIcon('share/ncc16.png'), _("NCC Tool"))
  1843. self.paint_btn = self.toolbartools.addAction(QtGui.QIcon('share/paint20_1.png'), _("Paint Tool"))
  1844. self.toolbartools.addSeparator()
  1845. self.panelize_btn = self.toolbartools.addAction(QtGui.QIcon('share/panel16.png'), _("Panel Tool"))
  1846. self.film_btn = self.toolbartools.addAction(QtGui.QIcon('share/film16.png'), _("Film Tool"))
  1847. self.solder_btn = self.toolbartools.addAction(QtGui.QIcon('share/solderpastebis32.png'),
  1848. _("SolderPaste Tool"))
  1849. self.sub_btn = self.toolbartools.addAction(QtGui.QIcon('share/sub32.png'), _("Substract Tool"))
  1850. self.toolbartools.addSeparator()
  1851. self.calculators_btn = self.toolbartools.addAction(QtGui.QIcon('share/calculator24.png'),
  1852. _("Calculators Tool"))
  1853. self.transform_btn = self.toolbartools.addAction(QtGui.QIcon('share/transform.png'), _("Transform Tool"))
  1854. # ## Excellon Editor Toolbar # ##
  1855. self.select_drill_btn = self.exc_edit_toolbar.addAction(QtGui.QIcon('share/pointer32.png'), _("Select"))
  1856. self.add_drill_btn = self.exc_edit_toolbar.addAction(QtGui.QIcon('share/plus16.png'), _('Add Drill Hole'))
  1857. self.add_drill_array_btn = self.exc_edit_toolbar.addAction(
  1858. QtGui.QIcon('share/addarray16.png'), _('Add Drill Hole Array'))
  1859. self.resize_drill_btn = self.exc_edit_toolbar.addAction(QtGui.QIcon('share/resize16.png'), _('Resize Drill'))
  1860. self.add_slot_btn = self.exc_edit_toolbar.addAction(QtGui.QIcon('share/slot26.png'), _('Add Slot'))
  1861. self.add_slot_array_btn = self.exc_edit_toolbar.addAction(
  1862. QtGui.QIcon('share/slot_array26.png'), _('Add Slot Array'))
  1863. self.exc_edit_toolbar.addSeparator()
  1864. self.copy_drill_btn = self.exc_edit_toolbar.addAction(QtGui.QIcon('share/copy32.png'), _('Copy Drill'))
  1865. self.delete_drill_btn = self.exc_edit_toolbar.addAction(QtGui.QIcon('share/trash32.png'),
  1866. _("Delete Drill"))
  1867. self.exc_edit_toolbar.addSeparator()
  1868. self.move_drill_btn = self.exc_edit_toolbar.addAction(QtGui.QIcon('share/move32.png'), _("Move Drill"))
  1869. # ## Geometry Editor Toolbar # ##
  1870. self.geo_select_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/pointer32.png'), _("Select 'Esc'"))
  1871. self.geo_add_circle_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/circle32.png'), _('Add Circle'))
  1872. self.geo_add_arc_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/arc32.png'), _('Add Arc'))
  1873. self.geo_add_rectangle_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/rectangle32.png'),
  1874. _('Add Rectangle'))
  1875. self.geo_edit_toolbar.addSeparator()
  1876. self.geo_add_path_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/path32.png'), _('Add Path'))
  1877. self.geo_add_polygon_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/polygon32.png'),
  1878. _('Add Polygon'))
  1879. self.geo_edit_toolbar.addSeparator()
  1880. self.geo_add_text_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/text32.png'), _('Add Text'))
  1881. self.geo_add_buffer_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/buffer16-2.png'), _('Add Buffer'))
  1882. self.geo_add_paint_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/paint20_1.png'), _('Paint Shape'))
  1883. self.geo_eraser_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/eraser26.png'), _('Eraser'))
  1884. self.geo_edit_toolbar.addSeparator()
  1885. self.geo_union_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/union32.png'), _('Polygon Union'))
  1886. self.geo_intersection_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/intersection32.png'),
  1887. _('Polygon Intersection'))
  1888. self.geo_subtract_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/subtract32.png'),
  1889. _('Polygon Subtraction'))
  1890. self.geo_edit_toolbar.addSeparator()
  1891. self.geo_cutpath_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/cutpath32.png'), _('Cut Path'))
  1892. self.geo_copy_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/copy32.png'), _("Copy Objects"))
  1893. self.geo_delete_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/trash32.png'),
  1894. _("Delete Shape"))
  1895. self.geo_transform_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/transform.png'),
  1896. _("Transformations"))
  1897. self.geo_edit_toolbar.addSeparator()
  1898. self.geo_move_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/move32.png'), _("Move Objects"))
  1899. # ## Gerber Editor Toolbar # ##
  1900. self.grb_select_btn = self.grb_edit_toolbar.addAction(QtGui.QIcon('share/pointer32.png'), _("Select"))
  1901. self.grb_add_pad_btn = self.grb_edit_toolbar.addAction(QtGui.QIcon('share/aperture32.png'), _("Add Pad"))
  1902. self.add_pad_ar_btn = self.grb_edit_toolbar.addAction(QtGui.QIcon('share/padarray32.png'), _('Add Pad Array'))
  1903. self.grb_add_track_btn = self.grb_edit_toolbar.addAction(QtGui.QIcon('share/track32.png'), _("Add Track"))
  1904. self.grb_add_region_btn = self.grb_edit_toolbar.addAction(QtGui.QIcon('share/polygon32.png'), _("Add Region"))
  1905. self.grb_convert_poly_btn = self.grb_edit_toolbar.addAction(QtGui.QIcon('share/poligonize32.png'),
  1906. _("Poligonize"))
  1907. self.grb_add_semidisc_btn = self.grb_edit_toolbar.addAction(QtGui.QIcon('share/semidisc32.png'), _("SemiDisc"))
  1908. self.grb_add_disc_btn = self.grb_edit_toolbar.addAction(QtGui.QIcon('share/disc32.png'), _("Disc"))
  1909. self.grb_edit_toolbar.addSeparator()
  1910. self.aperture_buffer_btn = self.grb_edit_toolbar.addAction(QtGui.QIcon('share/buffer16-2.png'), _('Buffer'))
  1911. self.aperture_scale_btn = self.grb_edit_toolbar.addAction(QtGui.QIcon('share/scale32.png'), _('Scale'))
  1912. self.aperture_markarea_btn = self.grb_edit_toolbar.addAction(QtGui.QIcon('share/markarea32.png'),
  1913. _('Mark Area'))
  1914. self.aperture_eraser_btn = self.grb_edit_toolbar.addAction(QtGui.QIcon('share/eraser26.png'), _('Eraser'))
  1915. self.grb_edit_toolbar.addSeparator()
  1916. self.aperture_copy_btn = self.grb_edit_toolbar.addAction(QtGui.QIcon('share/copy32.png'), _("Copy"))
  1917. self.aperture_delete_btn = self.grb_edit_toolbar.addAction(QtGui.QIcon('share/trash32.png'),
  1918. _("Delete"))
  1919. self.grb_transform_btn = self.grb_edit_toolbar.addAction(QtGui.QIcon('share/transform.png'),
  1920. _("Transformations"))
  1921. self.grb_edit_toolbar.addSeparator()
  1922. self.aperture_move_btn = self.grb_edit_toolbar.addAction(QtGui.QIcon('share/move32.png'), _("Move"))
  1923. # ## Snap Toolbar # ##
  1924. # Snap GRID toolbar is always active to facilitate usage of measurements done on GRID
  1925. # self.addToolBar(self.snap_toolbar)
  1926. self.grid_snap_btn = self.snap_toolbar.addAction(QtGui.QIcon('share/grid32.png'), _('Snap to grid'))
  1927. self.grid_gap_x_entry = FCEntry2()
  1928. self.grid_gap_x_entry.setMaximumWidth(70)
  1929. self.grid_gap_x_entry.setToolTip(_("Grid X snapping distance"))
  1930. self.snap_toolbar.addWidget(self.grid_gap_x_entry)
  1931. self.grid_gap_y_entry = FCEntry2()
  1932. self.grid_gap_y_entry.setMaximumWidth(70)
  1933. self.grid_gap_y_entry.setToolTip(_("Grid Y snapping distance"))
  1934. self.snap_toolbar.addWidget(self.grid_gap_y_entry)
  1935. self.grid_space_label = QtWidgets.QLabel(" ")
  1936. self.snap_toolbar.addWidget(self.grid_space_label)
  1937. self.grid_gap_link_cb = FCCheckBox()
  1938. self.grid_gap_link_cb.setToolTip(_("When active, value on Grid_X\n"
  1939. "is copied to the Grid_Y value."))
  1940. self.snap_toolbar.addWidget(self.grid_gap_link_cb)
  1941. self.ois_grid = OptionalInputSection(self.grid_gap_link_cb, [self.grid_gap_y_entry], logic=False)
  1942. self.corner_snap_btn = self.snap_toolbar.addAction(QtGui.QIcon('share/corner32.png'), _('Snap to corner'))
  1943. self.snap_max_dist_entry = FCEntry()
  1944. self.snap_max_dist_entry.setMaximumWidth(70)
  1945. self.snap_max_dist_entry.setToolTip(_("Max. magnet distance"))
  1946. self.snap_magnet = self.snap_toolbar.addWidget(self.snap_max_dist_entry)
  1947. self.grid_snap_btn.setCheckable(True)
  1948. self.corner_snap_btn.setCheckable(True)
  1949. self.update_obj_btn.setEnabled(False)
  1950. # start with GRID activated
  1951. self.grid_snap_btn.trigger()
  1952. settings = QSettings("Open Source", "FlatCAM")
  1953. if settings.contains("layout"):
  1954. layout = settings.value('layout', type=str)
  1955. if layout == 'standard':
  1956. self.exc_edit_toolbar.setVisible(True)
  1957. self.exc_edit_toolbar.setDisabled(True)
  1958. self.geo_edit_toolbar.setVisible(True)
  1959. self.geo_edit_toolbar.setDisabled(True)
  1960. self.grb_edit_toolbar.setVisible(True)
  1961. self.grb_edit_toolbar.setDisabled(True)
  1962. self.corner_snap_btn.setVisible(False)
  1963. self.snap_magnet.setVisible(False)
  1964. elif layout == 'compact':
  1965. self.exc_edit_toolbar.setVisible(True)
  1966. self.exc_edit_toolbar.setDisabled(True)
  1967. self.geo_edit_toolbar.setVisible(True)
  1968. self.geo_edit_toolbar.setDisabled(True)
  1969. self.grb_edit_toolbar.setVisible(True)
  1970. self.grb_edit_toolbar.setDisabled(True)
  1971. self.corner_snap_btn.setVisible(True)
  1972. self.snap_magnet.setVisible(True)
  1973. self.corner_snap_btn.setDisabled(True)
  1974. self.snap_magnet.setDisabled(True)
  1975. def keyPressEvent(self, event):
  1976. modifiers = QtWidgets.QApplication.keyboardModifiers()
  1977. active = self.app.collection.get_active()
  1978. selected = self.app.collection.get_selected()
  1979. # events out of the self.app.collection view (it's about Project Tab) are of type int
  1980. if type(event) is int:
  1981. key = event
  1982. # events from the GUI are of type QKeyEvent
  1983. elif type(event) == QtGui.QKeyEvent:
  1984. key = event.key()
  1985. # events from Vispy are of type KeyEvent
  1986. else:
  1987. key = event.key
  1988. if self.app.call_source == 'app':
  1989. if modifiers == QtCore.Qt.ControlModifier | QtCore.Qt.AltModifier:
  1990. if key == QtCore.Qt.Key_X:
  1991. self.app.abort_all_tasks()
  1992. return
  1993. elif modifiers == QtCore.Qt.ControlModifier:
  1994. if key == QtCore.Qt.Key_A:
  1995. self.app.on_selectall()
  1996. if key == QtCore.Qt.Key_C:
  1997. self.app.on_copy_object()
  1998. if key == QtCore.Qt.Key_E:
  1999. self.app.on_fileopenexcellon()
  2000. if key == QtCore.Qt.Key_G:
  2001. self.app.on_fileopengerber()
  2002. if key == QtCore.Qt.Key_N:
  2003. self.app.on_file_new_click()
  2004. if key == QtCore.Qt.Key_M:
  2005. self.app.measurement_tool.run()
  2006. if key == QtCore.Qt.Key_O:
  2007. self.app.on_file_openproject()
  2008. if key == QtCore.Qt.Key_S:
  2009. self.app.on_file_saveproject()
  2010. # Toggle Plot Area
  2011. if key == QtCore.Qt.Key_F10 or key == 'F10':
  2012. self.app.on_toggle_plotarea()
  2013. return
  2014. elif modifiers == QtCore.Qt.ShiftModifier:
  2015. # Copy Object Name
  2016. if key == QtCore.Qt.Key_C:
  2017. self.app.on_copy_name()
  2018. # Toggle Code Editor
  2019. if key == QtCore.Qt.Key_E:
  2020. self.app.on_toggle_code_editor()
  2021. # Toggle axis
  2022. if key == QtCore.Qt.Key_G:
  2023. if self.app.toggle_axis is False:
  2024. self.app.plotcanvas.v_line.set_data(color=(0.70, 0.3, 0.3, 1.0))
  2025. self.app.plotcanvas.h_line.set_data(color=(0.70, 0.3, 0.3, 1.0))
  2026. self.app.plotcanvas.redraw()
  2027. self.app.toggle_axis = True
  2028. else:
  2029. self.app.plotcanvas.v_line.set_data(color=(0.0, 0.0, 0.0, 0.0))
  2030. self.app.plotcanvas.h_line.set_data(color=(0.0, 0.0, 0.0, 0.0))
  2031. self.app.plotcanvas.redraw()
  2032. self.app.toggle_axis = False
  2033. # Open Preferences Window
  2034. if key == QtCore.Qt.Key_P:
  2035. self.app.on_preferences()
  2036. return
  2037. # Rotate Object by 90 degree CCW
  2038. if key == QtCore.Qt.Key_R:
  2039. self.app.on_rotate(silent=True, preset=-float(self.app.defaults['tools_transform_rotate']))
  2040. return
  2041. # Run a Script
  2042. if key == QtCore.Qt.Key_S:
  2043. self.app.on_filerunscript()
  2044. return
  2045. # Toggle Workspace
  2046. if key == QtCore.Qt.Key_W:
  2047. self.app.on_workspace_menu()
  2048. return
  2049. # Skew on X axis
  2050. if key == QtCore.Qt.Key_X:
  2051. self.app.on_skewx()
  2052. return
  2053. # Skew on Y axis
  2054. if key == QtCore.Qt.Key_Y:
  2055. self.app.on_skewy()
  2056. return
  2057. elif modifiers == QtCore.Qt.AltModifier:
  2058. # Eanble all plots
  2059. if key == Qt.Key_1:
  2060. self.app.enable_all_plots()
  2061. # Disable all plots
  2062. if key == Qt.Key_2:
  2063. self.app.disable_all_plots()
  2064. # Disable all other plots
  2065. if key == Qt.Key_3:
  2066. self.app.disable_other_plots()
  2067. # Calculator Tool
  2068. if key == QtCore.Qt.Key_C:
  2069. self.app.calculator_tool.run(toggle=True)
  2070. # 2-Sided PCB Tool
  2071. if key == QtCore.Qt.Key_D:
  2072. self.app.dblsidedtool.run(toggle=True)
  2073. return
  2074. # Solder Paste Dispensing Tool
  2075. if key == QtCore.Qt.Key_K:
  2076. self.app.paste_tool.run(toggle=True)
  2077. return
  2078. # Film Tool
  2079. if key == QtCore.Qt.Key_L:
  2080. self.app.film_tool.run(toggle=True)
  2081. return
  2082. # Non-Copper Clear Tool
  2083. if key == QtCore.Qt.Key_N:
  2084. self.app.ncclear_tool.run(toggle=True)
  2085. return
  2086. # Paint Tool
  2087. if key == QtCore.Qt.Key_P:
  2088. self.app.paint_tool.run(toggle=True)
  2089. return
  2090. # Paint Tool
  2091. if key == QtCore.Qt.Key_Q:
  2092. self.app.pdf_tool.run()
  2093. return
  2094. # Transformation Tool
  2095. if key == QtCore.Qt.Key_R:
  2096. self.app.transform_tool.run(toggle=True)
  2097. return
  2098. # View Source Object Content
  2099. if key == QtCore.Qt.Key_S:
  2100. self.app.on_view_source()
  2101. return
  2102. # Cutout Tool
  2103. if key == QtCore.Qt.Key_U:
  2104. self.app.cutout_tool.run(toggle=True)
  2105. return
  2106. # Substract Tool
  2107. if key == QtCore.Qt.Key_W:
  2108. self.app.sub_tool.run(toggle=True)
  2109. return
  2110. # Panelize Tool
  2111. if key == QtCore.Qt.Key_Z:
  2112. self.app.panelize_tool.run(toggle=True)
  2113. return
  2114. # Toggle Fullscreen
  2115. if key == QtCore.Qt.Key_F10 or key == 'F10':
  2116. self.app.on_fullscreen()
  2117. return
  2118. elif modifiers == QtCore.Qt.NoModifier:
  2119. # Open Manual
  2120. if key == QtCore.Qt.Key_F1 or key == 'F1':
  2121. webbrowser.open(self.app.manual_url)
  2122. # Show shortcut list
  2123. if key == QtCore.Qt.Key_F3 or key == 'F3':
  2124. self.app.on_shortcut_list()
  2125. # Open Video Help
  2126. if key == QtCore.Qt.Key_F4 or key == 'F4':
  2127. webbrowser.open(self.app.video_url)
  2128. # Open Video Help
  2129. if key == QtCore.Qt.Key_F5 or key == 'F5':
  2130. self.app.plot_all()
  2131. # Switch to Project Tab
  2132. if key == QtCore.Qt.Key_1:
  2133. self.app.on_select_tab('project')
  2134. # Switch to Selected Tab
  2135. if key == QtCore.Qt.Key_2:
  2136. self.app.on_select_tab('selected')
  2137. # Switch to Tool Tab
  2138. if key == QtCore.Qt.Key_3:
  2139. self.app.on_select_tab('tool')
  2140. # Delete from PyQt
  2141. # It's meant to make a difference between delete objects and delete tools in
  2142. # Geometry Selected tool table
  2143. if key == QtCore.Qt.Key_Delete:
  2144. self.app.on_delete_keypress()
  2145. # Delete from canvas
  2146. if key == 'Delete':
  2147. # Delete via the application to
  2148. # ensure cleanup of the GUI
  2149. if active:
  2150. active.app.on_delete()
  2151. # Escape = Deselect All
  2152. if key == QtCore.Qt.Key_Escape or key == 'Escape':
  2153. self.app.on_deselect_all()
  2154. # if in full screen, exit to normal view
  2155. self.showNormal()
  2156. self.app.restore_toolbar_view()
  2157. self.splitter_left.setVisible(True)
  2158. self.app.toggle_fscreen = False
  2159. # try to disconnect the slot from Set Origin
  2160. try:
  2161. self.app.plotcanvas.vis_disconnect('mouse_press', self.app.on_set_zero_click)
  2162. except TypeError:
  2163. pass
  2164. self.app.inform.emit("")
  2165. # Space = Toggle Active/Inactive
  2166. if key == QtCore.Qt.Key_Space:
  2167. for select in selected:
  2168. select.ui.plot_cb.toggle()
  2169. self.app.collection.update_view()
  2170. self.app.delete_selection_shape()
  2171. # New Geometry
  2172. if key == QtCore.Qt.Key_B:
  2173. self.app.new_gerber_object()
  2174. # Copy Object Name
  2175. if key == QtCore.Qt.Key_E:
  2176. self.app.object2editor()
  2177. # Grid toggle
  2178. if key == QtCore.Qt.Key_G:
  2179. self.app.ui.grid_snap_btn.trigger()
  2180. # Jump to coords
  2181. if key == QtCore.Qt.Key_J:
  2182. self.app.on_jump_to()
  2183. # New Excellon
  2184. if key == QtCore.Qt.Key_L:
  2185. self.app.new_excellon_object()
  2186. # Move tool toggle
  2187. if key == QtCore.Qt.Key_M:
  2188. self.app.move_tool.toggle()
  2189. # New Geometry
  2190. if key == QtCore.Qt.Key_N:
  2191. self.app.new_geometry_object()
  2192. # Set Origin
  2193. if key == QtCore.Qt.Key_O:
  2194. self.app.on_set_origin()
  2195. return
  2196. # Properties Tool
  2197. if key == QtCore.Qt.Key_P:
  2198. self.app.properties_tool.run()
  2199. return
  2200. # Change Units
  2201. if key == QtCore.Qt.Key_Q:
  2202. # if self.app.defaults["units"] == 'MM':
  2203. # self.app.ui.general_defaults_form.general_app_group.units_radio.set_value("IN")
  2204. # else:
  2205. # self.app.ui.general_defaults_form.general_app_group.units_radio.set_value("MM")
  2206. # self.app.on_toggle_units(no_pref=True)
  2207. self.app.on_toggle_units_click()
  2208. # Rotate Object by 90 degree CW
  2209. if key == QtCore.Qt.Key_R:
  2210. self.app.on_rotate(silent=True, preset=self.app.defaults['tools_transform_rotate'])
  2211. # Shell toggle
  2212. if key == QtCore.Qt.Key_S:
  2213. self.app.on_toggle_shell()
  2214. # Add a Tool from shortcut
  2215. if key == QtCore.Qt.Key_T:
  2216. self.app.on_tool_add_keypress()
  2217. # Zoom Fit
  2218. if key == QtCore.Qt.Key_V:
  2219. self.app.on_zoom_fit(None)
  2220. # Mirror on X the selected object(s)
  2221. if key == QtCore.Qt.Key_X:
  2222. self.app.on_flipx()
  2223. # Mirror on Y the selected object(s)
  2224. if key == QtCore.Qt.Key_Y:
  2225. self.app.on_flipy()
  2226. # Zoom In
  2227. if key == QtCore.Qt.Key_Equal:
  2228. self.app.plotcanvas.zoom(1 / self.app.defaults['global_zoom_ratio'], self.app.mouse)
  2229. # Zoom Out
  2230. if key == QtCore.Qt.Key_Minus:
  2231. self.app.plotcanvas.zoom(self.app.defaults['global_zoom_ratio'], self.app.mouse)
  2232. # toggle display of Notebook area
  2233. if key == QtCore.Qt.Key_QuoteLeft:
  2234. self.app.on_toggle_notebook()
  2235. return
  2236. elif self.app.call_source == 'geo_editor':
  2237. if modifiers == QtCore.Qt.ControlModifier:
  2238. # save (update) the current geometry and return to the App
  2239. if key == QtCore.Qt.Key_S or key == 'S':
  2240. self.app.editor2object()
  2241. return
  2242. # toggle the measurement tool
  2243. if key == QtCore.Qt.Key_M or key == 'M':
  2244. self.app.measurement_tool.run()
  2245. return
  2246. # Cut Action Tool
  2247. if key == QtCore.Qt.Key_X or key == 'X':
  2248. if self.app.geo_editor.get_selected() is not None:
  2249. self.app.geo_editor.cutpath()
  2250. else:
  2251. msg = _('Please first select a geometry item to be cutted\n'
  2252. 'then select the geometry item that will be cutted\n'
  2253. 'out of the first item. In the end press ~X~ key or\n'
  2254. 'the toolbar button.')
  2255. messagebox = QtWidgets.QMessageBox()
  2256. messagebox.setText(msg)
  2257. messagebox.setWindowTitle(_("Warning"))
  2258. messagebox.setWindowIcon(QtGui.QIcon('share/warning.png'))
  2259. messagebox.setStandardButtons(QtWidgets.QMessageBox.Ok)
  2260. messagebox.setDefaultButton(QtWidgets.QMessageBox.Ok)
  2261. messagebox.exec_()
  2262. return
  2263. elif modifiers == QtCore.Qt.ShiftModifier:
  2264. # Skew on X axis
  2265. if key == QtCore.Qt.Key_X or key == 'X':
  2266. self.app.geo_editor.transform_tool.on_skewx_key()
  2267. return
  2268. # Skew on Y axis
  2269. if key == QtCore.Qt.Key_Y or key == 'Y':
  2270. self.app.geo_editor.transform_tool.on_skewy_key()
  2271. return
  2272. elif modifiers == QtCore.Qt.AltModifier:
  2273. # Transformation Tool
  2274. if key == QtCore.Qt.Key_R or key == 'R':
  2275. self.app.geo_editor.select_tool('transform')
  2276. return
  2277. # Offset on X axis
  2278. if key == QtCore.Qt.Key_X or key == 'X':
  2279. self.app.geo_editor.transform_tool.on_offx_key()
  2280. return
  2281. # Offset on Y axis
  2282. if key == QtCore.Qt.Key_Y or key == 'Y':
  2283. self.app.geo_editor.transform_tool.on_offy_key()
  2284. return
  2285. elif modifiers == QtCore.Qt.NoModifier:
  2286. # toggle display of Notebook area
  2287. if key == QtCore.Qt.Key_QuoteLeft or key == '`':
  2288. self.app.on_toggle_notebook()
  2289. # Finish the current action. Use with tools that do not
  2290. # complete automatically, like a polygon or path.
  2291. if key == QtCore.Qt.Key_Enter or key == 'Enter':
  2292. if isinstance(self.app.geo_editor.active_tool, FCShapeTool):
  2293. if self.app.geo_editor.active_tool.name == 'rotate':
  2294. self.app.geo_editor.active_tool.make()
  2295. if self.app.geo_editor.active_tool.complete:
  2296. self.app.geo_editor.on_shape_complete()
  2297. self.app.inform.emit('[success] %s' % _("Done."))
  2298. # automatically make the selection tool active after completing current action
  2299. self.app.geo_editor.select_tool('select')
  2300. return
  2301. else:
  2302. self.app.geo_editor.active_tool.click(
  2303. self.app.geo_editor.snap(self.app.geo_editor.x, self.app.geo_editor.y))
  2304. self.app.geo_editor.active_tool.make()
  2305. if self.app.geo_editor.active_tool.complete:
  2306. self.app.geo_editor.on_shape_complete()
  2307. self.app.inform.emit('[success] %s' % _("Done."))
  2308. # automatically make the selection tool active after completing current action
  2309. self.app.geo_editor.select_tool('select')
  2310. # Abort the current action
  2311. if key == QtCore.Qt.Key_Escape or key == 'Escape':
  2312. # TODO: ...?
  2313. # self.on_tool_select("select")
  2314. self.app.inform.emit('[WARNING_NOTCL] %s' %
  2315. _("Cancelled."))
  2316. self.app.geo_editor.delete_utility_geometry()
  2317. # deselect any shape that might be selected
  2318. self.app.geo_editor.selected = []
  2319. self.app.geo_editor.replot()
  2320. self.app.geo_editor.select_tool('select')
  2321. # hide the notebook
  2322. self.app.ui.splitter.setSizes([0, 1])
  2323. return
  2324. # Delete selected object
  2325. if key == QtCore.Qt.Key_Delete or key == 'Delete':
  2326. self.app.geo_editor.delete_selected()
  2327. self.app.geo_editor.replot()
  2328. # Rotate
  2329. if key == QtCore.Qt.Key_Space or key == 'Space':
  2330. self.app.geo_editor.transform_tool.on_rotate_key()
  2331. if key == QtCore.Qt.Key_Minus or key == '-':
  2332. self.app.plotcanvas.zoom(1 / self.app.defaults['global_zoom_ratio'],
  2333. [self.app.geo_editor.snap_x, self.app.geo_editor.snap_y])
  2334. if key == QtCore.Qt.Key_Equal or key == '=':
  2335. self.app.plotcanvas.zoom(self.app.defaults['global_zoom_ratio'],
  2336. [self.app.geo_editor.snap_x, self.app.geo_editor.snap_y])
  2337. # Switch to Project Tab
  2338. if key == QtCore.Qt.Key_1 or key == '1':
  2339. self.app.on_select_tab('project')
  2340. # Switch to Selected Tab
  2341. if key == QtCore.Qt.Key_2 or key == '2':
  2342. self.app.on_select_tab('selected')
  2343. # Switch to Tool Tab
  2344. if key == QtCore.Qt.Key_3 or key == '3':
  2345. self.app.on_select_tab('tool')
  2346. if self.app.geo_editor.active_tool is not None and self.geo_select_btn.isChecked() is False:
  2347. response = self.app.geo_editor.active_tool.on_key(key=key)
  2348. if response is not None:
  2349. self.app.inform.emit(response)
  2350. else:
  2351. # Arc Tool
  2352. if key == QtCore.Qt.Key_A or key == 'A':
  2353. self.app.geo_editor.select_tool('arc')
  2354. # Buffer
  2355. if key == QtCore.Qt.Key_B or key == 'B':
  2356. self.app.geo_editor.select_tool('buffer')
  2357. # Copy
  2358. if key == QtCore.Qt.Key_C or key == 'C':
  2359. self.app.geo_editor.on_copy_click()
  2360. # Substract Tool
  2361. if key == QtCore.Qt.Key_E or key == 'E':
  2362. if self.app.geo_editor.get_selected() is not None:
  2363. self.app.geo_editor.intersection()
  2364. else:
  2365. msg = _("Please select geometry items \n"
  2366. "on which to perform Intersection Tool.")
  2367. messagebox = QtWidgets.QMessageBox()
  2368. messagebox.setText(msg)
  2369. messagebox.setWindowTitle(_("Warning"))
  2370. messagebox.setWindowIcon(QtGui.QIcon('share/warning.png'))
  2371. messagebox.setStandardButtons(QtWidgets.QMessageBox.Ok)
  2372. messagebox.setDefaultButton(QtWidgets.QMessageBox.Ok)
  2373. messagebox.exec_()
  2374. # Grid Snap
  2375. if key == QtCore.Qt.Key_G or key == 'G':
  2376. self.app.ui.grid_snap_btn.trigger()
  2377. # make sure that the cursor shape is enabled/disabled, too
  2378. if self.app.geo_editor.options['grid_snap'] is True:
  2379. self.app.app_cursor.enabled = True
  2380. else:
  2381. self.app.app_cursor.enabled = False
  2382. # Paint
  2383. if key == QtCore.Qt.Key_I or key == 'I':
  2384. self.app.geo_editor.select_tool('paint')
  2385. # Jump to coords
  2386. if key == QtCore.Qt.Key_J or key == 'J':
  2387. self.app.on_jump_to()
  2388. # Corner Snap
  2389. if key == QtCore.Qt.Key_K or key == 'K':
  2390. self.app.geo_editor.on_corner_snap()
  2391. # Move
  2392. if key == QtCore.Qt.Key_M or key == 'M':
  2393. self.app.geo_editor.on_move_click()
  2394. # Polygon Tool
  2395. if key == QtCore.Qt.Key_N or key == 'N':
  2396. self.app.geo_editor.select_tool('polygon')
  2397. # Circle Tool
  2398. if key == QtCore.Qt.Key_O or key == 'O':
  2399. self.app.geo_editor.select_tool('circle')
  2400. # Path Tool
  2401. if key == QtCore.Qt.Key_P or key == 'P':
  2402. self.app.geo_editor.select_tool('path')
  2403. # Rectangle Tool
  2404. if key == QtCore.Qt.Key_R or key == 'R':
  2405. self.app.geo_editor.select_tool('rectangle')
  2406. # Substract Tool
  2407. if key == QtCore.Qt.Key_S or key == 'S':
  2408. if self.app.geo_editor.get_selected() is not None:
  2409. self.app.geo_editor.subtract()
  2410. else:
  2411. msg = _(
  2412. "Please select geometry items \n"
  2413. "on which to perform Substraction Tool.")
  2414. messagebox = QtWidgets.QMessageBox()
  2415. messagebox.setText(msg)
  2416. messagebox.setWindowTitle(_("Warning"))
  2417. messagebox.setWindowIcon(QtGui.QIcon('share/warning.png'))
  2418. messagebox.setStandardButtons(QtWidgets.QMessageBox.Ok)
  2419. messagebox.setDefaultButton(QtWidgets.QMessageBox.Ok)
  2420. messagebox.exec_()
  2421. # Add Text Tool
  2422. if key == QtCore.Qt.Key_T or key == 'T':
  2423. self.app.geo_editor.select_tool('text')
  2424. # Substract Tool
  2425. if key == QtCore.Qt.Key_U or key == 'U':
  2426. if self.app.geo_editor.get_selected() is not None:
  2427. self.app.geo_editor.union()
  2428. else:
  2429. msg = _("Please select geometry items \n"
  2430. "on which to perform union.")
  2431. messagebox = QtWidgets.QMessageBox()
  2432. messagebox.setText(msg)
  2433. messagebox.setWindowTitle(_("Warning"))
  2434. messagebox.setWindowIcon(QtGui.QIcon('share/warning.png'))
  2435. messagebox.setStandardButtons(QtWidgets.QMessageBox.Ok)
  2436. messagebox.setDefaultButton(QtWidgets.QMessageBox.Ok)
  2437. messagebox.exec_()
  2438. if key == QtCore.Qt.Key_V or key == 'V':
  2439. self.app.on_zoom_fit(None)
  2440. # Flip on X axis
  2441. if key == QtCore.Qt.Key_X or key == 'X':
  2442. self.app.geo_editor.transform_tool.on_flipx()
  2443. return
  2444. # Flip on Y axis
  2445. if key == QtCore.Qt.Key_Y or key == 'Y':
  2446. self.app.geo_editor.transform_tool.on_flipy()
  2447. return
  2448. # Show Shortcut list
  2449. if key == 'F3':
  2450. self.app.on_shortcut_list()
  2451. elif self.app.call_source == 'grb_editor':
  2452. if modifiers == QtCore.Qt.ControlModifier:
  2453. # Eraser Tool
  2454. if key == QtCore.Qt.Key_E or key == 'E':
  2455. self.app.grb_editor.on_eraser()
  2456. return
  2457. # save (update) the current geometry and return to the App
  2458. if key == QtCore.Qt.Key_S or key == 'S':
  2459. self.app.editor2object()
  2460. return
  2461. # toggle the measurement tool
  2462. if key == QtCore.Qt.Key_M or key == 'M':
  2463. self.app.measurement_tool.run()
  2464. return
  2465. elif modifiers == QtCore.Qt.ShiftModifier:
  2466. pass
  2467. elif modifiers == QtCore.Qt.AltModifier:
  2468. # Mark Area Tool
  2469. if key == QtCore.Qt.Key_A or key == 'A':
  2470. self.app.grb_editor.on_markarea()
  2471. return
  2472. # Poligonize Tool
  2473. if key == QtCore.Qt.Key_N or key == 'N':
  2474. self.app.grb_editor.on_poligonize()
  2475. return
  2476. # Transformation Tool
  2477. if key == QtCore.Qt.Key_R or key == 'R':
  2478. self.app.grb_editor.on_transform()
  2479. return
  2480. elif modifiers == QtCore.Qt.NoModifier:
  2481. # Abort the current action
  2482. if key == QtCore.Qt.Key_Escape or key == 'Escape':
  2483. # self.on_tool_select("select")
  2484. self.app.inform.emit('[WARNING_NOTCL] %s' % _("Cancelled."))
  2485. self.app.grb_editor.delete_utility_geometry()
  2486. # self.app.grb_editor.plot_all()
  2487. self.app.grb_editor.active_tool.clean_up()
  2488. self.app.grb_editor.select_tool('select')
  2489. return
  2490. # Delete selected object if delete key event comes out of canvas
  2491. if key == 'Delete':
  2492. self.app.grb_editor.launched_from_shortcuts = True
  2493. if self.app.grb_editor.selected:
  2494. self.app.grb_editor.delete_selected()
  2495. self.app.grb_editor.plot_all()
  2496. else:
  2497. self.app.inform.emit('[WARNING_NOTCL] %s' %
  2498. _("Cancelled. Nothing selected to delete."))
  2499. return
  2500. # Delete aperture in apertures table if delete key event comes from the Selected Tab
  2501. if key == QtCore.Qt.Key_Delete:
  2502. self.app.grb_editor.launched_from_shortcuts = True
  2503. self.app.grb_editor.on_aperture_delete()
  2504. return
  2505. if key == QtCore.Qt.Key_Minus or key == '-':
  2506. self.app.grb_editor.launched_from_shortcuts = True
  2507. self.app.plotcanvas.zoom(1 / self.app.defaults['global_zoom_ratio'],
  2508. [self.app.grb_editor.snap_x, self.app.grb_editor.snap_y])
  2509. return
  2510. if key == QtCore.Qt.Key_Equal or key == '=':
  2511. self.app.grb_editor.launched_from_shortcuts = True
  2512. self.app.plotcanvas.zoom(self.app.defaults['global_zoom_ratio'],
  2513. [self.app.grb_editor.snap_x, self.app.grb_editor.snap_y])
  2514. return
  2515. # toggle display of Notebook area
  2516. if key == QtCore.Qt.Key_QuoteLeft or key == '`':
  2517. self.app.grb_editor.launched_from_shortcuts = True
  2518. self.app.on_toggle_notebook()
  2519. return
  2520. # Rotate
  2521. if key == QtCore.Qt.Key_Space or key == 'Space':
  2522. self.app.grb_editor.transform_tool.on_rotate_key()
  2523. # Switch to Project Tab
  2524. if key == QtCore.Qt.Key_1 or key == '1':
  2525. self.app.grb_editor.launched_from_shortcuts = True
  2526. self.app.on_select_tab('project')
  2527. return
  2528. # Switch to Selected Tab
  2529. if key == QtCore.Qt.Key_2 or key == '2':
  2530. self.app.grb_editor.launched_from_shortcuts = True
  2531. self.app.on_select_tab('selected')
  2532. return
  2533. # Switch to Tool Tab
  2534. if key == QtCore.Qt.Key_3 or key == '3':
  2535. self.app.grb_editor.launched_from_shortcuts = True
  2536. self.app.on_select_tab('tool')
  2537. return
  2538. # we do this so we can reuse the following keys while inside a Tool
  2539. # the above keys are general enough so were left outside
  2540. if self.app.grb_editor.active_tool is not None and self.grb_select_btn.isChecked() is False:
  2541. response = self.app.grb_editor.active_tool.on_key(key=key)
  2542. if response is not None:
  2543. self.app.inform.emit(response)
  2544. else:
  2545. # Add Array of pads
  2546. if key == QtCore.Qt.Key_A or key == 'A':
  2547. self.app.grb_editor.launched_from_shortcuts = True
  2548. self.app.inform.emit("Click on target point.")
  2549. self.app.ui.add_pad_ar_btn.setChecked(True)
  2550. self.app.grb_editor.x = self.app.mouse[0]
  2551. self.app.grb_editor.y = self.app.mouse[1]
  2552. self.app.grb_editor.select_tool('array')
  2553. return
  2554. # Scale Tool
  2555. if key == QtCore.Qt.Key_B or key == 'B':
  2556. self.app.grb_editor.launched_from_shortcuts = True
  2557. self.app.grb_editor.select_tool('buffer')
  2558. return
  2559. # Copy
  2560. if key == QtCore.Qt.Key_C or key == 'C':
  2561. self.app.grb_editor.launched_from_shortcuts = True
  2562. if self.app.grb_editor.selected:
  2563. self.app.inform.emit(_("Click on target point."))
  2564. self.app.ui.aperture_copy_btn.setChecked(True)
  2565. self.app.grb_editor.on_tool_select('copy')
  2566. self.app.grb_editor.active_tool.set_origin(
  2567. (self.app.grb_editor.snap_x, self.app.grb_editor.snap_y))
  2568. else:
  2569. self.app.inform.emit('[WARNING_NOTCL] %s' %
  2570. _("Cancelled. Nothing selected to copy."))
  2571. return
  2572. # Add Disc Tool
  2573. if key == QtCore.Qt.Key_D or key == 'D':
  2574. self.app.grb_editor.launched_from_shortcuts = True
  2575. self.app.grb_editor.select_tool('disc')
  2576. return
  2577. # Add SemiDisc Tool
  2578. if key == QtCore.Qt.Key_E or key == 'E':
  2579. self.app.grb_editor.launched_from_shortcuts = True
  2580. self.app.grb_editor.select_tool('semidisc')
  2581. return
  2582. # Grid Snap
  2583. if key == QtCore.Qt.Key_G or key == 'G':
  2584. self.app.grb_editor.launched_from_shortcuts = True
  2585. # make sure that the cursor shape is enabled/disabled, too
  2586. if self.app.grb_editor.options['grid_snap'] is True:
  2587. self.app.app_cursor.enabled = False
  2588. else:
  2589. self.app.app_cursor.enabled = True
  2590. self.app.ui.grid_snap_btn.trigger()
  2591. return
  2592. # Jump to coords
  2593. if key == QtCore.Qt.Key_J or key == 'J':
  2594. self.app.on_jump_to()
  2595. # Corner Snap
  2596. if key == QtCore.Qt.Key_K or key == 'K':
  2597. self.app.grb_editor.launched_from_shortcuts = True
  2598. self.app.ui.corner_snap_btn.trigger()
  2599. return
  2600. # Move
  2601. if key == QtCore.Qt.Key_M or key == 'M':
  2602. self.app.grb_editor.launched_from_shortcuts = True
  2603. if self.app.grb_editor.selected:
  2604. self.app.inform.emit(_("Click on target point."))
  2605. self.app.ui.aperture_move_btn.setChecked(True)
  2606. self.app.grb_editor.on_tool_select('move')
  2607. self.app.grb_editor.active_tool.set_origin(
  2608. (self.app.grb_editor.snap_x, self.app.grb_editor.snap_y))
  2609. else:
  2610. self.app.inform.emit('[WARNING_NOTCL] %s' %
  2611. _("Cancelled. Nothing selected to move."))
  2612. return
  2613. # Add Region Tool
  2614. if key == QtCore.Qt.Key_N or key == 'N':
  2615. self.app.grb_editor.launched_from_shortcuts = True
  2616. self.app.grb_editor.select_tool('region')
  2617. return
  2618. # Add Pad Tool
  2619. if key == QtCore.Qt.Key_P or key == 'P':
  2620. self.app.grb_editor.launched_from_shortcuts = True
  2621. self.app.inform.emit(_("Click on target point."))
  2622. self.app.ui.add_pad_ar_btn.setChecked(True)
  2623. self.app.grb_editor.x = self.app.mouse[0]
  2624. self.app.grb_editor.y = self.app.mouse[1]
  2625. self.app.grb_editor.select_tool('pad')
  2626. return
  2627. # Scale Tool
  2628. if key == QtCore.Qt.Key_S or key == 'S':
  2629. self.app.grb_editor.launched_from_shortcuts = True
  2630. self.app.grb_editor.select_tool('scale')
  2631. return
  2632. # Add Track
  2633. if key == QtCore.Qt.Key_T or key == 'T':
  2634. self.app.grb_editor.launched_from_shortcuts = True
  2635. # ## Current application units in Upper Case
  2636. self.app.grb_editor.select_tool('track')
  2637. return
  2638. # Zoom Fit
  2639. if key == QtCore.Qt.Key_V or key == 'V':
  2640. self.app.grb_editor.launched_from_shortcuts = True
  2641. self.app.on_zoom_fit(None)
  2642. return
  2643. # Show Shortcut list
  2644. if key == QtCore.Qt.Key_F3 or key == 'F3':
  2645. self.app.on_shortcut_list()
  2646. return
  2647. elif self.app.call_source == 'exc_editor':
  2648. if modifiers == QtCore.Qt.ControlModifier:
  2649. # save (update) the current geometry and return to the App
  2650. if key == QtCore.Qt.Key_S or key == 'S':
  2651. self.app.editor2object()
  2652. return
  2653. # toggle the measurement tool
  2654. if key == QtCore.Qt.Key_M or key == 'M':
  2655. self.app.measurement_tool.run()
  2656. return
  2657. elif modifiers == QtCore.Qt.ShiftModifier:
  2658. pass
  2659. elif modifiers == QtCore.Qt.AltModifier:
  2660. pass
  2661. elif modifiers == QtCore.Qt.NoModifier:
  2662. # Abort the current action
  2663. if key == QtCore.Qt.Key_Escape or key == 'Escape':
  2664. # TODO: ...?
  2665. # self.on_tool_select("select")
  2666. self.app.inform.emit('[WARNING_NOTCL] %s' % _("Cancelled."))
  2667. self.app.exc_editor.delete_utility_geometry()
  2668. self.app.exc_editor.replot()
  2669. # self.select_btn.setChecked(True)
  2670. # self.on_tool_select('select')
  2671. self.app.exc_editor.select_tool('drill_select')
  2672. return
  2673. # Delete selected object if delete key event comes out of canvas
  2674. if key == 'Delete':
  2675. self.app.exc_editor.launched_from_shortcuts = True
  2676. if self.app.exc_editor.selected:
  2677. self.app.exc_editor.delete_selected()
  2678. self.app.exc_editor.replot()
  2679. else:
  2680. self.app.inform.emit('[WARNING_NOTCL] %s' %
  2681. _("Cancelled. Nothing selected to delete."))
  2682. return
  2683. # Delete tools in tools table if delete key event comes from the Selected Tab
  2684. if key == QtCore.Qt.Key_Delete:
  2685. self.app.exc_editor.launched_from_shortcuts = True
  2686. self.app.exc_editor.on_tool_delete()
  2687. return
  2688. if key == QtCore.Qt.Key_Minus or key == '-':
  2689. self.app.exc_editor.launched_from_shortcuts = True
  2690. self.app.plotcanvas.zoom(1 / self.app.defaults['global_zoom_ratio'],
  2691. [self.app.exc_editor.snap_x, self.app.exc_editor.snap_y])
  2692. return
  2693. if key == QtCore.Qt.Key_Equal or key == '=':
  2694. self.app.exc_editor.launched_from_shortcuts = True
  2695. self.app.plotcanvas.zoom(self.app.defaults['global_zoom_ratio'],
  2696. [self.app.exc_editor.snap_x, self.app.exc_editor.snap_y])
  2697. return
  2698. # toggle display of Notebook area
  2699. if key == QtCore.Qt.Key_QuoteLeft or key == '`':
  2700. self.app.exc_editor.launched_from_shortcuts = True
  2701. self.app.on_toggle_notebook()
  2702. return
  2703. # Switch to Project Tab
  2704. if key == QtCore.Qt.Key_1 or key == '1':
  2705. self.app.exc_editor.launched_from_shortcuts = True
  2706. self.app.on_select_tab('project')
  2707. return
  2708. # Switch to Selected Tab
  2709. if key == QtCore.Qt.Key_2 or key == '2':
  2710. self.app.exc_editor.launched_from_shortcuts = True
  2711. self.app.on_select_tab('selected')
  2712. return
  2713. # Switch to Tool Tab
  2714. if key == QtCore.Qt.Key_3 or key == '3':
  2715. self.app.exc_editor.launched_from_shortcuts = True
  2716. self.app.on_select_tab('tool')
  2717. return
  2718. # Add Array of Drill Hole Tool
  2719. if key == QtCore.Qt.Key_A or key == 'A':
  2720. self.app.exc_editor.launched_from_shortcuts = True
  2721. self.app.inform.emit("Click on target point.")
  2722. self.app.ui.add_drill_array_btn.setChecked(True)
  2723. self.app.exc_editor.x = self.app.mouse[0]
  2724. self.app.exc_editor.y = self.app.mouse[1]
  2725. self.app.exc_editor.select_tool('drill_array')
  2726. return
  2727. # Copy
  2728. if key == QtCore.Qt.Key_C or key == 'C':
  2729. self.app.exc_editor.launched_from_shortcuts = True
  2730. if self.app.exc_editor.selected:
  2731. self.app.inform.emit(_("Click on target point."))
  2732. self.app.ui.copy_drill_btn.setChecked(True)
  2733. self.app.exc_editor.on_tool_select('drill_copy')
  2734. self.app.exc_editor.active_tool.set_origin(
  2735. (self.app.exc_editor.snap_x, self.app.exc_editor.snap_y))
  2736. else:
  2737. self.app.inform.emit('[WARNING_NOTCL] %s' %
  2738. _("Cancelled. Nothing selected to copy."))
  2739. return
  2740. # Add Drill Hole Tool
  2741. if key == QtCore.Qt.Key_D or key == 'D':
  2742. self.app.exc_editor.launched_from_shortcuts = True
  2743. self.app.inform.emit(_("Click on target point."))
  2744. self.app.ui.add_drill_btn.setChecked(True)
  2745. self.app.exc_editor.x = self.app.mouse[0]
  2746. self.app.exc_editor.y = self.app.mouse[1]
  2747. self.app.exc_editor.select_tool('drill_add')
  2748. return
  2749. # Grid Snap
  2750. if key == QtCore.Qt.Key_G or key == 'G':
  2751. self.app.exc_editor.launched_from_shortcuts = True
  2752. # make sure that the cursor shape is enabled/disabled, too
  2753. if self.app.exc_editor.options['grid_snap'] is True:
  2754. self.app.app_cursor.enabled = False
  2755. else:
  2756. self.app.app_cursor.enabled = True
  2757. self.app.ui.grid_snap_btn.trigger()
  2758. return
  2759. # Jump to coords
  2760. if key == QtCore.Qt.Key_J or key == 'J':
  2761. self.app.on_jump_to()
  2762. # Corner Snap
  2763. if key == QtCore.Qt.Key_K or key == 'K':
  2764. self.app.exc_editor.launched_from_shortcuts = True
  2765. self.app.ui.corner_snap_btn.trigger()
  2766. return
  2767. # Move
  2768. if key == QtCore.Qt.Key_M or key == 'M':
  2769. self.app.exc_editor.launched_from_shortcuts = True
  2770. if self.app.exc_editor.selected:
  2771. self.app.inform.emit(_("Click on target point."))
  2772. self.app.ui.move_drill_btn.setChecked(True)
  2773. self.app.exc_editor.on_tool_select('drill_move')
  2774. self.app.exc_editor.active_tool.set_origin(
  2775. (self.app.exc_editor.snap_x, self.app.exc_editor.snap_y))
  2776. else:
  2777. self.app.inform.emit('[WARNING_NOTCL] %s' %
  2778. _("Cancelled. Nothing selected to move."))
  2779. return
  2780. # Add Array of Slote Hole Tool
  2781. if key == QtCore.Qt.Key_Q or key == 'Q':
  2782. self.app.exc_editor.launched_from_shortcuts = True
  2783. self.app.inform.emit("Click on target point.")
  2784. self.app.ui.add_slot_array_btn.setChecked(True)
  2785. self.app.exc_editor.x = self.app.mouse[0]
  2786. self.app.exc_editor.y = self.app.mouse[1]
  2787. self.app.exc_editor.select_tool('slot_array')
  2788. return
  2789. # Resize Tool
  2790. if key == QtCore.Qt.Key_R or key == 'R':
  2791. self.app.exc_editor.launched_from_shortcuts = True
  2792. self.app.exc_editor.select_tool('drill_resize')
  2793. return
  2794. # Add Tool
  2795. if key == QtCore.Qt.Key_T or key == 'T':
  2796. self.app.exc_editor.launched_from_shortcuts = True
  2797. # ## Current application units in Upper Case
  2798. self.units = self.general_defaults_form.general_app_group.units_radio.get_value().upper()
  2799. tool_add_popup = FCInputDialog(title=_("New Tool ..."),
  2800. text='%s:' % _('Enter a Tool Diameter'),
  2801. min=0.0000, max=99.9999, decimals=4)
  2802. tool_add_popup.setWindowIcon(QtGui.QIcon('share/letter_t_32.png'))
  2803. val, ok = tool_add_popup.get_value()
  2804. if ok:
  2805. self.app.exc_editor.on_tool_add(tooldia=val)
  2806. formated_val = '%.4f' % float(val)
  2807. self.app.inform.emit('[success] %s: %s %s' %
  2808. (_("Added new tool with dia"),
  2809. formated_val,
  2810. str(self.units)
  2811. )
  2812. )
  2813. else:
  2814. self.app.inform.emit(
  2815. '[WARNING_NOTCL] %s' % _("Adding Tool cancelled ..."))
  2816. return
  2817. # Zoom Fit
  2818. if key == QtCore.Qt.Key_V or key == 'V':
  2819. self.app.exc_editor.launched_from_shortcuts = True
  2820. self.app.on_zoom_fit(None)
  2821. return
  2822. # Add Slot Hole Tool
  2823. if key == QtCore.Qt.Key_W or key == 'W':
  2824. self.app.exc_editor.launched_from_shortcuts = True
  2825. self.app.inform.emit(_("Click on target point."))
  2826. self.app.ui.add_slot_btn.setChecked(True)
  2827. self.app.exc_editor.x = self.app.mouse[0]
  2828. self.app.exc_editor.y = self.app.mouse[1]
  2829. self.app.exc_editor.select_tool('slot_add')
  2830. return
  2831. # Propagate to tool
  2832. response = None
  2833. if self.app.exc_editor.active_tool is not None:
  2834. response = self.app.exc_editor.active_tool.on_key(key=key)
  2835. if response is not None:
  2836. self.app.inform.emit(response)
  2837. # Show Shortcut list
  2838. if key == QtCore.Qt.Key_F3 or key == 'F3':
  2839. self.app.on_shortcut_list()
  2840. return
  2841. elif self.app.call_source == 'measurement':
  2842. if modifiers == QtCore.Qt.ControlModifier:
  2843. pass
  2844. elif modifiers == QtCore.Qt.AltModifier:
  2845. pass
  2846. elif modifiers == QtCore.Qt.ShiftModifier:
  2847. pass
  2848. elif modifiers == QtCore.Qt.NoModifier:
  2849. if key == QtCore.Qt.Key_Escape or key == 'Escape':
  2850. # abort the measurement action
  2851. self.app.measurement_tool.deactivate_measure_tool()
  2852. self.app.inform.emit(_("Measurement Tool exit..."))
  2853. return
  2854. if key == QtCore.Qt.Key_G or key == 'G':
  2855. self.app.ui.grid_snap_btn.trigger()
  2856. return
  2857. def createPopupMenu(self):
  2858. menu = super().createPopupMenu()
  2859. menu.addSeparator()
  2860. menu.addAction(self.lock_action)
  2861. return menu
  2862. def lock_toolbar(self, lock=False):
  2863. """
  2864. Used to (un)lock the toolbars of the app.
  2865. :param lock: boolean, will lock all toolbars in place when set True
  2866. :return: None
  2867. """
  2868. if lock:
  2869. for widget in self.children():
  2870. if isinstance(widget, QtWidgets.QToolBar):
  2871. widget.setMovable(False)
  2872. else:
  2873. for widget in self.children():
  2874. if isinstance(widget, QtWidgets.QToolBar):
  2875. widget.setMovable(True)
  2876. def dragEnterEvent(self, event):
  2877. if event.mimeData().hasUrls:
  2878. event.accept()
  2879. else:
  2880. event.ignore()
  2881. def dragMoveEvent(self, event):
  2882. if event.mimeData().hasUrls:
  2883. event.accept()
  2884. else:
  2885. event.ignore()
  2886. def dropEvent(self, event):
  2887. if event.mimeData().hasUrls:
  2888. event.setDropAction(QtCore.Qt.CopyAction)
  2889. event.accept()
  2890. for url in event.mimeData().urls():
  2891. self.filename = str(url.toLocalFile())
  2892. if self.filename == "":
  2893. self.app.inform.emit("Open cancelled.")
  2894. else:
  2895. extension = self.filename.lower().rpartition('.')[-1]
  2896. if extension in self.app.grb_list:
  2897. self.app.worker_task.emit({'fcn': self.app.open_gerber,
  2898. 'params': [self.filename]})
  2899. else:
  2900. event.ignore()
  2901. if extension in self.app.exc_list:
  2902. self.app.worker_task.emit({'fcn': self.app.open_excellon,
  2903. 'params': [self.filename]})
  2904. else:
  2905. event.ignore()
  2906. if extension in self.app.gcode_list:
  2907. self.app.worker_task.emit({'fcn': self.app.open_gcode,
  2908. 'params': [self.filename]})
  2909. else:
  2910. event.ignore()
  2911. if extension in self.app.svg_list:
  2912. object_type = 'geometry'
  2913. self.app.worker_task.emit({'fcn': self.app.import_svg,
  2914. 'params': [self.filename, object_type, None]})
  2915. if extension in self.app.dxf_list:
  2916. object_type = 'geometry'
  2917. self.app.worker_task.emit({'fcn': self.app.import_dxf,
  2918. 'params': [self.filename, object_type, None]})
  2919. if extension in self.app.pdf_list:
  2920. self.app.pdf_tool.periodic_check(1000)
  2921. self.app.worker_task.emit({'fcn': self.app.pdf_tool.open_pdf,
  2922. 'params': [self.filename]})
  2923. if extension in self.app.prj_list:
  2924. # self.app.open_project() is not Thread Safe
  2925. self.app.open_project(self.filename)
  2926. if extension in self.app.conf_list:
  2927. self.app.open_config_file(self.filename)
  2928. else:
  2929. event.ignore()
  2930. else:
  2931. event.ignore()
  2932. def closeEvent(self, event):
  2933. if self.app.save_in_progress:
  2934. self.app.inform.emit('[WARNING_NOTCL] %s' %
  2935. _("Application is saving the project. Please wait ..."))
  2936. else:
  2937. grect = self.geometry()
  2938. # self.splitter.sizes()[0] is actually the size of the "notebook"
  2939. if not self.isMaximized():
  2940. self.geom_update.emit(grect.x(), grect.y(), grect.width(), grect.height(), self.splitter.sizes()[0])
  2941. self.final_save.emit()
  2942. event.ignore()
  2943. class GeneralPreferencesUI(QtWidgets.QWidget):
  2944. def __init__(self, parent=None):
  2945. QtWidgets.QWidget.__init__(self, parent=parent)
  2946. self.layout = QtWidgets.QHBoxLayout()
  2947. self.setLayout(self.layout)
  2948. self.general_app_group = GeneralAppPrefGroupUI()
  2949. self.general_app_group.setMinimumWidth(290)
  2950. self.general_gui_group = GeneralGUIPrefGroupUI()
  2951. self.general_gui_group.setMinimumWidth(250)
  2952. self.general_gui_set_group = GeneralGUISetGroupUI()
  2953. self.general_gui_set_group.setMinimumWidth(250)
  2954. self.layout.addWidget(self.general_app_group)
  2955. self.layout.addWidget(self.general_gui_group)
  2956. self.layout.addWidget(self.general_gui_set_group)
  2957. self.layout.addStretch()
  2958. class GerberPreferencesUI(QtWidgets.QWidget):
  2959. def __init__(self, parent=None):
  2960. QtWidgets.QWidget.__init__(self, parent=parent)
  2961. self.layout = QtWidgets.QHBoxLayout()
  2962. self.setLayout(self.layout)
  2963. self.gerber_gen_group = GerberGenPrefGroupUI()
  2964. self.gerber_gen_group.setMinimumWidth(250)
  2965. self.gerber_opt_group = GerberOptPrefGroupUI()
  2966. self.gerber_opt_group.setMinimumWidth(250)
  2967. self.gerber_exp_group = GerberExpPrefGroupUI()
  2968. self.gerber_exp_group.setMinimumWidth(230)
  2969. self.gerber_adv_opt_group = GerberAdvOptPrefGroupUI()
  2970. self.gerber_adv_opt_group.setMinimumWidth(200)
  2971. self.gerber_editor_group = GerberEditorPrefGroupUI()
  2972. self.gerber_editor_group.setMinimumWidth(200)
  2973. self.vlay = QtWidgets.QVBoxLayout()
  2974. self.vlay.addWidget(self.gerber_opt_group)
  2975. self.vlay.addWidget(self.gerber_exp_group)
  2976. self.layout.addWidget(self.gerber_gen_group)
  2977. self.layout.addLayout(self.vlay)
  2978. self.layout.addWidget(self.gerber_adv_opt_group)
  2979. self.layout.addWidget(self.gerber_editor_group)
  2980. self.layout.addStretch()
  2981. class ExcellonPreferencesUI(QtWidgets.QWidget):
  2982. def __init__(self, parent=None):
  2983. QtWidgets.QWidget.__init__(self, parent=parent)
  2984. self.layout = QtWidgets.QHBoxLayout()
  2985. self.setLayout(self.layout)
  2986. self.excellon_gen_group = ExcellonGenPrefGroupUI()
  2987. self.excellon_gen_group.setMinimumWidth(220)
  2988. self.excellon_opt_group = ExcellonOptPrefGroupUI()
  2989. self.excellon_opt_group.setMinimumWidth(290)
  2990. self.excellon_exp_group = ExcellonExpPrefGroupUI()
  2991. self.excellon_exp_group.setMinimumWidth(250)
  2992. self.excellon_adv_opt_group = ExcellonAdvOptPrefGroupUI()
  2993. self.excellon_adv_opt_group.setMinimumWidth(250)
  2994. self.excellon_editor_group = ExcellonEditorPrefGroupUI()
  2995. self.excellon_editor_group.setMinimumWidth(260)
  2996. self.vlay = QtWidgets.QVBoxLayout()
  2997. self.vlay.addWidget(self.excellon_opt_group)
  2998. self.vlay.addWidget(self.excellon_exp_group)
  2999. self.layout.addWidget(self.excellon_gen_group)
  3000. self.layout.addLayout(self.vlay)
  3001. self.layout.addWidget(self.excellon_adv_opt_group)
  3002. self.layout.addWidget(self.excellon_editor_group)
  3003. self.layout.addStretch()
  3004. class GeometryPreferencesUI(QtWidgets.QWidget):
  3005. def __init__(self, parent=None):
  3006. QtWidgets.QWidget.__init__(self, parent=parent)
  3007. self.layout = QtWidgets.QHBoxLayout()
  3008. self.setLayout(self.layout)
  3009. self.geometry_gen_group = GeometryGenPrefGroupUI()
  3010. self.geometry_gen_group.setMinimumWidth(220)
  3011. self.geometry_opt_group = GeometryOptPrefGroupUI()
  3012. self.geometry_opt_group.setMinimumWidth(300)
  3013. self.geometry_adv_opt_group = GeometryAdvOptPrefGroupUI()
  3014. self.geometry_adv_opt_group.setMinimumWidth(270)
  3015. self.geometry_editor_group = GeometryEditorPrefGroupUI()
  3016. self.geometry_editor_group.setMinimumWidth(250)
  3017. self.layout.addWidget(self.geometry_gen_group)
  3018. self.layout.addWidget(self.geometry_opt_group)
  3019. self.layout.addWidget(self.geometry_adv_opt_group)
  3020. self.layout.addWidget(self.geometry_editor_group)
  3021. self.layout.addStretch()
  3022. class ToolsPreferencesUI(QtWidgets.QWidget):
  3023. def __init__(self, parent=None):
  3024. QtWidgets.QWidget.__init__(self, parent=parent)
  3025. self.layout = QtWidgets.QHBoxLayout()
  3026. self.setLayout(self.layout)
  3027. self.tools_ncc_group = ToolsNCCPrefGroupUI()
  3028. self.tools_ncc_group.setMinimumWidth(220)
  3029. self.tools_paint_group = ToolsPaintPrefGroupUI()
  3030. self.tools_paint_group.setMinimumWidth(220)
  3031. self.tools_cutout_group = ToolsCutoutPrefGroupUI()
  3032. self.tools_cutout_group.setMinimumWidth(220)
  3033. self.tools_2sided_group = Tools2sidedPrefGroupUI()
  3034. self.tools_2sided_group.setMinimumWidth(220)
  3035. self.tools_film_group = ToolsFilmPrefGroupUI()
  3036. self.tools_film_group.setMinimumWidth(220)
  3037. self.tools_panelize_group = ToolsPanelizePrefGroupUI()
  3038. self.tools_panelize_group.setMinimumWidth(220)
  3039. self.tools_calculators_group = ToolsCalculatorsPrefGroupUI()
  3040. self.tools_calculators_group.setMinimumWidth(220)
  3041. self.tools_transform_group = ToolsTransformPrefGroupUI()
  3042. self.tools_transform_group.setMinimumWidth(200)
  3043. self.tools_solderpaste_group = ToolsSolderpastePrefGroupUI()
  3044. self.tools_solderpaste_group.setMinimumWidth(200)
  3045. self.tools_sub_group = ToolsSubPrefGroupUI()
  3046. self.tools_sub_group.setMinimumWidth(200)
  3047. self.vlay = QtWidgets.QVBoxLayout()
  3048. self.vlay.addWidget(self.tools_ncc_group)
  3049. self.vlay.addWidget(self.tools_paint_group)
  3050. self.vlay1 = QtWidgets.QVBoxLayout()
  3051. self.vlay1.addWidget(self.tools_cutout_group)
  3052. self.vlay1.addWidget(self.tools_transform_group)
  3053. self.vlay1.addWidget(self.tools_2sided_group)
  3054. self.vlay2 = QtWidgets.QVBoxLayout()
  3055. self.vlay2.addWidget(self.tools_panelize_group)
  3056. self.vlay2.addWidget(self.tools_calculators_group)
  3057. self.vlay3 = QtWidgets.QVBoxLayout()
  3058. self.vlay3.addWidget(self.tools_solderpaste_group)
  3059. self.vlay3.addWidget(self.tools_sub_group)
  3060. self.vlay3.addWidget(self.tools_film_group)
  3061. self.layout.addLayout(self.vlay)
  3062. self.layout.addLayout(self.vlay1)
  3063. self.layout.addLayout(self.vlay2)
  3064. self.layout.addLayout(self.vlay3)
  3065. self.layout.addStretch()
  3066. class CNCJobPreferencesUI(QtWidgets.QWidget):
  3067. def __init__(self, parent=None):
  3068. QtWidgets.QWidget.__init__(self, parent=parent)
  3069. self.layout = QtWidgets.QHBoxLayout()
  3070. self.setLayout(self.layout)
  3071. self.cncjob_gen_group = CNCJobGenPrefGroupUI()
  3072. self.cncjob_gen_group.setMinimumWidth(320)
  3073. self.cncjob_opt_group = CNCJobOptPrefGroupUI()
  3074. self.cncjob_opt_group.setMinimumWidth(260)
  3075. self.cncjob_adv_opt_group = CNCJobAdvOptPrefGroupUI()
  3076. self.cncjob_adv_opt_group.setMinimumWidth(260)
  3077. self.layout.addWidget(self.cncjob_gen_group)
  3078. self.layout.addWidget(self.cncjob_opt_group)
  3079. self.layout.addWidget(self.cncjob_adv_opt_group)
  3080. self.layout.addStretch()
  3081. class FAPreferencesUI(QtWidgets.QWidget):
  3082. def __init__(self, parent=None):
  3083. QtWidgets.QWidget.__init__(self, parent=parent)
  3084. self.layout = QtWidgets.QHBoxLayout()
  3085. self.setLayout(self.layout)
  3086. self.fa_excellon_group = FAExcPrefGroupUI()
  3087. self.fa_excellon_group.setMinimumWidth(260)
  3088. self.fa_gcode_group = FAGcoPrefGroupUI()
  3089. self.fa_gcode_group.setMinimumWidth(260)
  3090. self.fa_gerber_group = FAGrbPrefGroupUI()
  3091. self.fa_gerber_group.setMinimumWidth(260)
  3092. self.layout.addWidget(self.fa_excellon_group)
  3093. self.layout.addWidget(self.fa_gcode_group)
  3094. self.layout.addWidget(self.fa_gerber_group)
  3095. self.layout.addStretch()
  3096. class OptionsGroupUI(QtWidgets.QGroupBox):
  3097. def __init__(self, title, parent=None):
  3098. # QtGui.QGroupBox.__init__(self, title, parent=parent)
  3099. super(OptionsGroupUI, self).__init__()
  3100. self.setStyleSheet("""
  3101. QGroupBox
  3102. {
  3103. font-size: 16px;
  3104. font-weight: bold;
  3105. }
  3106. """)
  3107. self.layout = QtWidgets.QVBoxLayout()
  3108. self.setLayout(self.layout)
  3109. class GeneralGUIPrefGroupUI(OptionsGroupUI):
  3110. def __init__(self, parent=None):
  3111. super(GeneralGUIPrefGroupUI, self).__init__(self)
  3112. self.setTitle(str(_("GUI Preferences")))
  3113. # Create a form layout for the Application general settings
  3114. self.form_box = QtWidgets.QFormLayout()
  3115. # Grid X Entry
  3116. self.gridx_label = QtWidgets.QLabel('%s:' % _('Grid X value'))
  3117. self.gridx_label.setToolTip(
  3118. _("This is the Grid snap value on X axis.")
  3119. )
  3120. self.gridx_entry = FCEntry3()
  3121. # Grid Y Entry
  3122. self.gridy_label = QtWidgets.QLabel('%s:' % _('Grid Y value'))
  3123. self.gridy_label.setToolTip(
  3124. _("This is the Grid snap value on Y axis.")
  3125. )
  3126. self.gridy_entry = FCEntry3()
  3127. # Snap Max Entry
  3128. self.snap_max_label = QtWidgets.QLabel('%s:' % _('Snap Max'))
  3129. self.snap_max_label.setToolTip(_("Max. magnet distance"))
  3130. self.snap_max_dist_entry = FCEntry()
  3131. # Workspace
  3132. self.workspace_lbl = QtWidgets.QLabel('%s:' % _('Workspace'))
  3133. self.workspace_lbl.setToolTip(
  3134. _("Draw a delimiting rectangle on canvas.\n"
  3135. "The purpose is to illustrate the limits for our work.")
  3136. )
  3137. self.workspace_type_lbl = QtWidgets.QLabel('%s:' % _('Wk. format'))
  3138. self.workspace_type_lbl.setToolTip(
  3139. _("Select the type of rectangle to be used on canvas,\n"
  3140. "as valid workspace.")
  3141. )
  3142. self.workspace_cb = FCCheckBox()
  3143. self.wk_cb = FCComboBox()
  3144. self.wk_cb.addItem('A4P')
  3145. self.wk_cb.addItem('A4L')
  3146. self.wk_cb.addItem('A3P')
  3147. self.wk_cb.addItem('A3L')
  3148. self.wks = OptionalInputSection(self.workspace_cb, [self.workspace_type_lbl, self.wk_cb])
  3149. # Plot Fill Color
  3150. self.pf_color_label = QtWidgets.QLabel('%s:' % _('Plot Fill'))
  3151. self.pf_color_label.setToolTip(
  3152. _("Set the fill color for plotted objects.\n"
  3153. "First 6 digits are the color and the last 2\n"
  3154. "digits are for alpha (transparency) level.")
  3155. )
  3156. self.pf_color_entry = FCEntry()
  3157. self.pf_color_button = QtWidgets.QPushButton()
  3158. self.pf_color_button.setFixedSize(15, 15)
  3159. self.form_box_child_1 = QtWidgets.QHBoxLayout()
  3160. self.form_box_child_1.addWidget(self.pf_color_entry)
  3161. self.form_box_child_1.addWidget(self.pf_color_button)
  3162. self.form_box_child_1.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  3163. # Plot Fill Transparency Level
  3164. self.pf_alpha_label = QtWidgets.QLabel('%s:' % _('Alpha Level'))
  3165. self.pf_alpha_label.setToolTip(
  3166. _("Set the fill transparency for plotted objects.")
  3167. )
  3168. self.pf_color_alpha_slider = QtWidgets.QSlider(QtCore.Qt.Horizontal)
  3169. self.pf_color_alpha_slider.setMinimum(0)
  3170. self.pf_color_alpha_slider.setMaximum(255)
  3171. self.pf_color_alpha_slider.setSingleStep(1)
  3172. self.pf_color_alpha_spinner = FCSpinner()
  3173. self.pf_color_alpha_spinner.setMinimumWidth(70)
  3174. self.pf_color_alpha_spinner.setMinimum(0)
  3175. self.pf_color_alpha_spinner.setMaximum(255)
  3176. self.form_box_child_2 = QtWidgets.QHBoxLayout()
  3177. self.form_box_child_2.addWidget(self.pf_color_alpha_slider)
  3178. self.form_box_child_2.addWidget(self.pf_color_alpha_spinner)
  3179. # Plot Line Color
  3180. self.pl_color_label = QtWidgets.QLabel('%s:' % _('Plot Line'))
  3181. self.pl_color_label.setToolTip(
  3182. _("Set the line color for plotted objects.")
  3183. )
  3184. self.pl_color_entry = FCEntry()
  3185. self.pl_color_button = QtWidgets.QPushButton()
  3186. self.pl_color_button.setFixedSize(15, 15)
  3187. self.form_box_child_3 = QtWidgets.QHBoxLayout()
  3188. self.form_box_child_3.addWidget(self.pl_color_entry)
  3189. self.form_box_child_3.addWidget(self.pl_color_button)
  3190. self.form_box_child_3.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  3191. # Plot Selection (left - right) Fill Color
  3192. self.sf_color_label = QtWidgets.QLabel('%s:' % _('Sel. Fill'))
  3193. self.sf_color_label.setToolTip(
  3194. _("Set the fill color for the selection box\n"
  3195. "in case that the selection is done from left to right.\n"
  3196. "First 6 digits are the color and the last 2\n"
  3197. "digits are for alpha (transparency) level.")
  3198. )
  3199. self.sf_color_entry = FCEntry()
  3200. self.sf_color_button = QtWidgets.QPushButton()
  3201. self.sf_color_button.setFixedSize(15, 15)
  3202. self.form_box_child_4 = QtWidgets.QHBoxLayout()
  3203. self.form_box_child_4.addWidget(self.sf_color_entry)
  3204. self.form_box_child_4.addWidget(self.sf_color_button)
  3205. self.form_box_child_4.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  3206. # Plot Selection (left - right) Fill Transparency Level
  3207. self.sf_alpha_label = QtWidgets.QLabel('%s:' % _('Alpha Level'))
  3208. self.sf_alpha_label.setToolTip(
  3209. _("Set the fill transparency for the 'left to right' selection box.")
  3210. )
  3211. self.sf_color_alpha_slider = QtWidgets.QSlider(QtCore.Qt.Horizontal)
  3212. self.sf_color_alpha_slider.setMinimum(0)
  3213. self.sf_color_alpha_slider.setMaximum(255)
  3214. self.sf_color_alpha_slider.setSingleStep(1)
  3215. self.sf_color_alpha_spinner = FCSpinner()
  3216. self.sf_color_alpha_spinner.setMinimumWidth(70)
  3217. self.sf_color_alpha_spinner.setMinimum(0)
  3218. self.sf_color_alpha_spinner.setMaximum(255)
  3219. self.form_box_child_5 = QtWidgets.QHBoxLayout()
  3220. self.form_box_child_5.addWidget(self.sf_color_alpha_slider)
  3221. self.form_box_child_5.addWidget(self.sf_color_alpha_spinner)
  3222. # Plot Selection (left - right) Line Color
  3223. self.sl_color_label = QtWidgets.QLabel('%s:' % _('Sel. Line'))
  3224. self.sl_color_label.setToolTip(
  3225. _("Set the line color for the 'left to right' selection box.")
  3226. )
  3227. self.sl_color_entry = FCEntry()
  3228. self.sl_color_button = QtWidgets.QPushButton()
  3229. self.sl_color_button.setFixedSize(15, 15)
  3230. self.form_box_child_6 = QtWidgets.QHBoxLayout()
  3231. self.form_box_child_6.addWidget(self.sl_color_entry)
  3232. self.form_box_child_6.addWidget(self.sl_color_button)
  3233. self.form_box_child_6.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  3234. # Plot Selection (right - left) Fill Color
  3235. self.alt_sf_color_label = QtWidgets.QLabel('%s:' % _('Sel2. Fill'))
  3236. self.alt_sf_color_label.setToolTip(
  3237. _("Set the fill color for the selection box\n"
  3238. "in case that the selection is done from right to left.\n"
  3239. "First 6 digits are the color and the last 2\n"
  3240. "digits are for alpha (transparency) level.")
  3241. )
  3242. self.alt_sf_color_entry = FCEntry()
  3243. self.alt_sf_color_button = QtWidgets.QPushButton()
  3244. self.alt_sf_color_button.setFixedSize(15, 15)
  3245. self.form_box_child_7 = QtWidgets.QHBoxLayout()
  3246. self.form_box_child_7.addWidget(self.alt_sf_color_entry)
  3247. self.form_box_child_7.addWidget(self.alt_sf_color_button)
  3248. self.form_box_child_7.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  3249. # Plot Selection (right - left) Fill Transparency Level
  3250. self.alt_sf_alpha_label = QtWidgets.QLabel('%s:' % _('Alpha Level'))
  3251. self.alt_sf_alpha_label.setToolTip(
  3252. _("Set the fill transparency for selection 'right to left' box.")
  3253. )
  3254. self.alt_sf_color_alpha_slider = QtWidgets.QSlider(QtCore.Qt.Horizontal)
  3255. self.alt_sf_color_alpha_slider.setMinimum(0)
  3256. self.alt_sf_color_alpha_slider.setMaximum(255)
  3257. self.alt_sf_color_alpha_slider.setSingleStep(1)
  3258. self.alt_sf_color_alpha_spinner = FCSpinner()
  3259. self.alt_sf_color_alpha_spinner.setMinimumWidth(70)
  3260. self.alt_sf_color_alpha_spinner.setMinimum(0)
  3261. self.alt_sf_color_alpha_spinner.setMaximum(255)
  3262. self.form_box_child_8 = QtWidgets.QHBoxLayout()
  3263. self.form_box_child_8.addWidget(self.alt_sf_color_alpha_slider)
  3264. self.form_box_child_8.addWidget(self.alt_sf_color_alpha_spinner)
  3265. # Plot Selection (right - left) Line Color
  3266. self.alt_sl_color_label = QtWidgets.QLabel('%s:' % _('Sel2. Line'))
  3267. self.alt_sl_color_label.setToolTip(
  3268. _("Set the line color for the 'right to left' selection box.")
  3269. )
  3270. self.alt_sl_color_entry = FCEntry()
  3271. self.alt_sl_color_button = QtWidgets.QPushButton()
  3272. self.alt_sl_color_button.setFixedSize(15, 15)
  3273. self.form_box_child_9 = QtWidgets.QHBoxLayout()
  3274. self.form_box_child_9.addWidget(self.alt_sl_color_entry)
  3275. self.form_box_child_9.addWidget(self.alt_sl_color_button)
  3276. self.form_box_child_9.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  3277. # Editor Draw Color
  3278. self.draw_color_label = QtWidgets.QLabel('%s:' % _('Editor Draw'))
  3279. self.alt_sf_color_label.setToolTip(
  3280. _("Set the color for the shape.")
  3281. )
  3282. self.draw_color_entry = FCEntry()
  3283. self.draw_color_button = QtWidgets.QPushButton()
  3284. self.draw_color_button.setFixedSize(15, 15)
  3285. self.form_box_child_10 = QtWidgets.QHBoxLayout()
  3286. self.form_box_child_10.addWidget(self.draw_color_entry)
  3287. self.form_box_child_10.addWidget(self.draw_color_button)
  3288. self.form_box_child_10.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  3289. # Editor Draw Selection Color
  3290. self.sel_draw_color_label = QtWidgets.QLabel('%s:' % _('Editor Draw Sel.'))
  3291. self.sel_draw_color_label.setToolTip(
  3292. _("Set the color of the shape when selected.")
  3293. )
  3294. self.sel_draw_color_entry = FCEntry()
  3295. self.sel_draw_color_button = QtWidgets.QPushButton()
  3296. self.sel_draw_color_button.setFixedSize(15, 15)
  3297. self.form_box_child_11 = QtWidgets.QHBoxLayout()
  3298. self.form_box_child_11.addWidget(self.sel_draw_color_entry)
  3299. self.form_box_child_11.addWidget(self.sel_draw_color_button)
  3300. self.form_box_child_11.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  3301. # Project Tab items color
  3302. self.proj_color_label = QtWidgets.QLabel('%s:' % _('Project Items'))
  3303. self.proj_color_label.setToolTip(
  3304. _("Set the color of the items in Project Tab Tree.")
  3305. )
  3306. self.proj_color_entry = FCEntry()
  3307. self.proj_color_button = QtWidgets.QPushButton()
  3308. self.proj_color_button.setFixedSize(15, 15)
  3309. self.form_box_child_12 = QtWidgets.QHBoxLayout()
  3310. self.form_box_child_12.addWidget(self.proj_color_entry)
  3311. self.form_box_child_12.addWidget(self.proj_color_button)
  3312. self.form_box_child_12.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  3313. self.proj_color_dis_label = QtWidgets.QLabel('%s:' % _('Proj. Dis. Items'))
  3314. self.proj_color_dis_label.setToolTip(
  3315. _("Set the color of the items in Project Tab Tree,\n"
  3316. "for the case when the items are disabled.")
  3317. )
  3318. self.proj_color_dis_entry = FCEntry()
  3319. self.proj_color_dis_button = QtWidgets.QPushButton()
  3320. self.proj_color_dis_button.setFixedSize(15, 15)
  3321. self.form_box_child_13 = QtWidgets.QHBoxLayout()
  3322. self.form_box_child_13.addWidget(self.proj_color_dis_entry)
  3323. self.form_box_child_13.addWidget(self.proj_color_dis_button)
  3324. self.form_box_child_13.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  3325. # Just to add empty rows
  3326. self.spacelabel = QtWidgets.QLabel('')
  3327. # Add (label - input field) pair to the QFormLayout
  3328. self.form_box.addRow(self.spacelabel, self.spacelabel)
  3329. self.form_box.addRow(self.gridx_label, self.gridx_entry)
  3330. self.form_box.addRow(self.gridy_label, self.gridy_entry)
  3331. self.form_box.addRow(self.snap_max_label, self.snap_max_dist_entry)
  3332. self.form_box.addRow(self.workspace_lbl, self.workspace_cb)
  3333. self.form_box.addRow(self.workspace_type_lbl, self.wk_cb)
  3334. self.form_box.addRow(self.spacelabel, self.spacelabel)
  3335. self.form_box.addRow(self.pf_color_label, self.form_box_child_1)
  3336. self.form_box.addRow(self.pf_alpha_label, self.form_box_child_2)
  3337. self.form_box.addRow(self.pl_color_label, self.form_box_child_3)
  3338. self.form_box.addRow(self.sf_color_label, self.form_box_child_4)
  3339. self.form_box.addRow(self.sf_alpha_label, self.form_box_child_5)
  3340. self.form_box.addRow(self.sl_color_label, self.form_box_child_6)
  3341. self.form_box.addRow(self.alt_sf_color_label, self.form_box_child_7)
  3342. self.form_box.addRow(self.alt_sf_alpha_label, self.form_box_child_8)
  3343. self.form_box.addRow(self.alt_sl_color_label, self.form_box_child_9)
  3344. self.form_box.addRow(self.draw_color_label, self.form_box_child_10)
  3345. self.form_box.addRow(self.sel_draw_color_label, self.form_box_child_11)
  3346. self.form_box.addRow(QtWidgets.QLabel(""))
  3347. self.form_box.addRow(self.proj_color_label, self.form_box_child_12)
  3348. self.form_box.addRow(self.proj_color_dis_label, self.form_box_child_13)
  3349. self.form_box.addRow(self.spacelabel, self.spacelabel)
  3350. # Add the QFormLayout that holds the Application general defaults
  3351. # to the main layout of this TAB
  3352. self.layout.addLayout(self.form_box)
  3353. class GeneralGUISetGroupUI(OptionsGroupUI):
  3354. def __init__(self, parent=None):
  3355. super(GeneralGUISetGroupUI, self).__init__(self)
  3356. self.setTitle(str(_("GUI Settings")))
  3357. # Create a form layout for the Application general settings
  3358. self.form_box = QtWidgets.QFormLayout()
  3359. # Layout selection
  3360. self.layout_label = QtWidgets.QLabel('%s:' % _('Layout'))
  3361. self.layout_label.setToolTip(
  3362. _("Select an layout for FlatCAM.\n"
  3363. "It is applied immediately.")
  3364. )
  3365. self.layout_combo = FCComboBox()
  3366. # don't translate the QCombo items as they are used in QSettings and identified by name
  3367. self.layout_combo.addItem("standard")
  3368. self.layout_combo.addItem("compact")
  3369. # Set the current index for layout_combo
  3370. settings = QSettings("Open Source", "FlatCAM")
  3371. if settings.contains("layout"):
  3372. layout = settings.value('layout', type=str)
  3373. idx = self.layout_combo.findText(layout.capitalize())
  3374. self.layout_combo.setCurrentIndex(idx)
  3375. # Style selection
  3376. self.style_label = QtWidgets.QLabel('%s:' % _('Style'))
  3377. self.style_label.setToolTip(
  3378. _("Select an style for FlatCAM.\n"
  3379. "It will be applied at the next app start.")
  3380. )
  3381. self.style_combo = FCComboBox()
  3382. self.style_combo.addItems(QtWidgets.QStyleFactory.keys())
  3383. # find current style
  3384. index = self.style_combo.findText(QtWidgets.qApp.style().objectName(), QtCore.Qt.MatchFixedString)
  3385. self.style_combo.setCurrentIndex(index)
  3386. self.style_combo.activated[str].connect(self.handle_style)
  3387. # Enable High DPI Support
  3388. self.hdpi_label = QtWidgets.QLabel('%s:' % _('HDPI Support'))
  3389. self.hdpi_label.setToolTip(
  3390. _("Enable High DPI support for FlatCAM.\n"
  3391. "It will be applied at the next app start.")
  3392. )
  3393. self.hdpi_cb = FCCheckBox()
  3394. settings = QSettings("Open Source", "FlatCAM")
  3395. if settings.contains("hdpi"):
  3396. self.hdpi_cb.set_value(settings.value('hdpi', type=int))
  3397. else:
  3398. self.hdpi_cb.set_value(False)
  3399. self.hdpi_cb.stateChanged.connect(self.handle_hdpi)
  3400. # Clear Settings
  3401. self.clear_label = QtWidgets.QLabel('%s:' % _('Clear GUI Settings'))
  3402. self.clear_label.setToolTip(
  3403. _("Clear the GUI settings for FlatCAM,\n"
  3404. "such as: layout, gui state, style, hdpi support etc.")
  3405. )
  3406. self.clear_btn = FCButton(_("Clear"))
  3407. self.clear_btn.clicked.connect(self.handle_clear)
  3408. # Enable Hover box
  3409. self.hover_label = QtWidgets.QLabel('%s:' % _('Hover Shape'))
  3410. self.hover_label.setToolTip(
  3411. _("Enable display of a hover shape for FlatCAM objects.\n"
  3412. "It is displayed whenever the mouse cursor is hovering\n"
  3413. "over any kind of not-selected object.")
  3414. )
  3415. self.hover_cb = FCCheckBox()
  3416. # Enable Selection box
  3417. self.selection_label = QtWidgets.QLabel('%s:' % _('Sel. Shape'))
  3418. self.selection_label.setToolTip(
  3419. _("Enable the display of a selection shape for FlatCAM objects.\n"
  3420. "It is displayed whenever the mouse selects an object\n"
  3421. "either by clicking or dragging mouse from left to right or\n"
  3422. "right to left.")
  3423. )
  3424. self.selection_cb = FCCheckBox()
  3425. # Notebook Font Size
  3426. self.notebook_font_size_label = QtWidgets.QLabel('%s:' % _('NB Font Size'))
  3427. self.notebook_font_size_label.setToolTip(
  3428. _("This sets the font size for the elements found in the Notebook.\n"
  3429. "The notebook is the collapsible area in the left side of the GUI,\n"
  3430. "and include the Project, Selected and Tool tabs.")
  3431. )
  3432. self.notebook_font_size_spinner = FCSpinner()
  3433. self.notebook_font_size_spinner.setRange(8, 40)
  3434. self.notebook_font_size_spinner.setWrapping(True)
  3435. settings = QSettings("Open Source", "FlatCAM")
  3436. if settings.contains("notebook_font_size"):
  3437. self.notebook_font_size_spinner.set_value(settings.value('notebook_font_size', type=int))
  3438. else:
  3439. self.notebook_font_size_spinner.set_value(12)
  3440. # Axis Font Size
  3441. self.axis_font_size_label = QtWidgets.QLabel('%s:' % _('Axis Font Size'))
  3442. self.axis_font_size_label.setToolTip(
  3443. _("This sets the font size for canvas axis.")
  3444. )
  3445. self.axis_font_size_spinner = FCSpinner()
  3446. self.axis_font_size_spinner.setRange(8, 40)
  3447. self.axis_font_size_spinner.setWrapping(True)
  3448. settings = QSettings("Open Source", "FlatCAM")
  3449. if settings.contains("axis_font_size"):
  3450. self.axis_font_size_spinner.set_value(settings.value('axis_font_size', type=int))
  3451. else:
  3452. self.axis_font_size_spinner.set_value(8)
  3453. # Just to add empty rows
  3454. self.spacelabel = QtWidgets.QLabel('')
  3455. # Splash Screen
  3456. self.splash_label = QtWidgets.QLabel('%s:' % _('Splash Screen'))
  3457. self.splash_label.setToolTip(
  3458. _("Enable display of the splash screen at application startup.")
  3459. )
  3460. self.splash_cb = FCCheckBox()
  3461. settings = QSettings("Open Source", "FlatCAM")
  3462. if settings.value("splash_screen"):
  3463. self.splash_cb.set_value(True)
  3464. else:
  3465. self.splash_cb.set_value(False)
  3466. # Shell StartUp CB
  3467. self.shell_startup_label = QtWidgets.QLabel('%s:' % _('Shell at StartUp'))
  3468. self.shell_startup_label.setToolTip(
  3469. _("Check this box if you want the shell to\n"
  3470. "start automatically at startup.")
  3471. )
  3472. self.shell_startup_cb = FCCheckBox(label='')
  3473. self.shell_startup_cb.setToolTip(
  3474. _("Check this box if you want the shell to\n"
  3475. "start automatically at startup.")
  3476. )
  3477. # Project at StartUp CB
  3478. self.project_startup_label = QtWidgets.QLabel('%s:' % _('Project at StartUp'))
  3479. self.project_startup_label.setToolTip(
  3480. _("Check this box if you want the project/selected/tool tab area to\n"
  3481. "to be shown automatically at startup.")
  3482. )
  3483. self.project_startup_cb = FCCheckBox(label='')
  3484. self.project_startup_cb.setToolTip(
  3485. _("Check this box if you want the project/selected/tool tab area to\n"
  3486. "to be shown automatically at startup.")
  3487. )
  3488. # Project autohide CB
  3489. self.project_autohide_label = QtWidgets.QLabel('%s:' % _('Project AutoHide'))
  3490. self.project_autohide_label.setToolTip(
  3491. _("Check this box if you want the project/selected/tool tab area to\n"
  3492. "hide automatically when there are no objects loaded and\n"
  3493. "to show whenever a new object is created.")
  3494. )
  3495. self.project_autohide_cb = FCCheckBox(label='')
  3496. self.project_autohide_cb.setToolTip(
  3497. _("Check this box if you want the project/selected/tool tab area to\n"
  3498. "hide automatically when there are no objects loaded and\n"
  3499. "to show whenever a new object is created.")
  3500. )
  3501. # Enable/Disable ToolTips globally
  3502. self.toggle_tooltips_label = QtWidgets.QLabel('<b>%s:</b>' % _('Enable ToolTips'))
  3503. self.toggle_tooltips_label.setToolTip(
  3504. _("Check this box if you want to have toolTips displayed\n"
  3505. "when hovering with mouse over items throughout the App.")
  3506. )
  3507. self.toggle_tooltips_cb = FCCheckBox(label='')
  3508. self.toggle_tooltips_cb.setToolTip(
  3509. _("Check this box if you want to have toolTips displayed\n"
  3510. "when hovering with mouse over items throughout the App.")
  3511. )
  3512. # Add (label - input field) pair to the QFormLayout
  3513. self.form_box.addRow(self.spacelabel, self.spacelabel)
  3514. self.form_box.addRow(self.layout_label, self.layout_combo)
  3515. self.form_box.addRow(self.style_label, self.style_combo)
  3516. self.form_box.addRow(self.hdpi_label, self.hdpi_cb)
  3517. self.form_box.addRow(self.clear_label, self.clear_btn)
  3518. self.form_box.addRow(self.hover_label, self.hover_cb)
  3519. self.form_box.addRow(self.selection_label, self.selection_cb)
  3520. self.form_box.addRow(QtWidgets.QLabel(''))
  3521. self.form_box.addRow(self.notebook_font_size_label, self.notebook_font_size_spinner)
  3522. self.form_box.addRow(self.axis_font_size_label, self.axis_font_size_spinner)
  3523. self.form_box.addRow(QtWidgets.QLabel(''))
  3524. self.form_box.addRow(self.splash_label, self.splash_cb)
  3525. self.form_box.addRow(self.shell_startup_label, self.shell_startup_cb)
  3526. self.form_box.addRow(self.project_startup_label, self.project_startup_cb)
  3527. self.form_box.addRow(self.project_autohide_label, self.project_autohide_cb)
  3528. self.form_box.addRow(QtWidgets.QLabel(''))
  3529. self.form_box.addRow(self.toggle_tooltips_label, self.toggle_tooltips_cb)
  3530. # Add the QFormLayout that holds the Application general defaults
  3531. # to the main layout of this TAB
  3532. self.layout.addLayout(self.form_box)
  3533. # Delete confirmation
  3534. self.delete_conf_cb = FCCheckBox(_('Delete object confirmation'))
  3535. self.delete_conf_cb.setToolTip(
  3536. _("When checked the application will ask for user confirmation\n"
  3537. "whenever the Delete object(s) event is triggered, either by\n"
  3538. "menu shortcut or key shortcut.")
  3539. )
  3540. self.layout.addWidget(self.delete_conf_cb)
  3541. self.layout.addStretch()
  3542. def handle_style(self, style):
  3543. # set current style
  3544. settings = QSettings("Open Source", "FlatCAM")
  3545. settings.setValue('style', style)
  3546. # This will write the setting to the platform specific storage.
  3547. del settings
  3548. def handle_hdpi(self, state):
  3549. # set current HDPI
  3550. settings = QSettings("Open Source", "FlatCAM")
  3551. settings.setValue('hdpi', state)
  3552. # This will write the setting to the platform specific storage.
  3553. del settings
  3554. def handle_clear(self):
  3555. msgbox = QtWidgets.QMessageBox()
  3556. msgbox.setText(_("Are you sure you want to delete the GUI Settings? "
  3557. "\n")
  3558. )
  3559. msgbox.setWindowTitle(_("Clear GUI Settings"))
  3560. msgbox.setWindowIcon(QtGui.QIcon('share/trash32.png'))
  3561. bt_yes = msgbox.addButton(_('Yes'), QtWidgets.QMessageBox.YesRole)
  3562. bt_no = msgbox.addButton(_('No'), QtWidgets.QMessageBox.NoRole)
  3563. msgbox.setDefaultButton(bt_no)
  3564. msgbox.exec_()
  3565. response = msgbox.clickedButton()
  3566. if response == bt_yes:
  3567. settings = QSettings("Open Source", "FlatCAM")
  3568. for key in settings.allKeys():
  3569. settings.remove(key)
  3570. # This will write the setting to the platform specific storage.
  3571. del settings
  3572. class GeneralAppPrefGroupUI(OptionsGroupUI):
  3573. def __init__(self, parent=None):
  3574. super(GeneralAppPrefGroupUI, self).__init__(self)
  3575. self.setTitle(str(_("App Preferences")))
  3576. # Create a form layout for the Application general settings
  3577. self.form_box = QtWidgets.QFormLayout()
  3578. # Units for FlatCAM
  3579. self.unitslabel = QtWidgets.QLabel('<span style="color:red;"><b>%s:</b></span>' % _('Units'))
  3580. self.unitslabel.setToolTip(_("The default value for FlatCAM units.\n"
  3581. "Whatever is selected here is set every time\n"
  3582. "FLatCAM is started."))
  3583. self.units_radio = RadioSet([{'label': _('IN'), 'value': 'IN'},
  3584. {'label': _('MM'), 'value': 'MM'}])
  3585. # Application Level for FlatCAM
  3586. self.app_level_label = QtWidgets.QLabel('<b>%s:</b>' % _('APP. LEVEL'))
  3587. self.app_level_label.setToolTip(_("Choose the default level of usage for FlatCAM.\n"
  3588. "BASIC level -> reduced functionality, best for beginner's.\n"
  3589. "ADVANCED level -> full functionality.\n\n"
  3590. "The choice here will influence the parameters in\n"
  3591. "the Selected Tab for all kinds of FlatCAM objects."))
  3592. self.app_level_radio = RadioSet([{'label': _('Basic'), 'value': 'b'},
  3593. {'label': _('Advanced'), 'value': 'a'}])
  3594. # Application Level for FlatCAM
  3595. self.portability_label = QtWidgets.QLabel('%s:' % _('Portable app'))
  3596. self.portability_label.setToolTip(_("Choose if the application should run as portable.\n\n"
  3597. "If Checked the application will run portable,\n"
  3598. "which means that the preferences files will be saved\n"
  3599. "in the application folder, in the lib\config subfolder."))
  3600. self.portability_cb = FCCheckBox()
  3601. # Languages for FlatCAM
  3602. self.languagelabel = QtWidgets.QLabel('<b>%s:</b>' % _('Languages'))
  3603. self.languagelabel.setToolTip(_("Set the language used throughout FlatCAM."))
  3604. self.language_cb = FCComboBox()
  3605. self.languagespace = QtWidgets.QLabel('')
  3606. self.language_apply_btn = FCButton(_("Apply Language"))
  3607. self.language_apply_btn.setToolTip(_("Set the language used throughout FlatCAM.\n"
  3608. "The app will restart after click."
  3609. "Windows: When FlatCAM is installed in Program Files\n"
  3610. "directory, it is possible that the app will not\n"
  3611. "restart after the button is clicked due of Windows\n"
  3612. "security features. In this case the language will be\n"
  3613. "applied at the next app start."))
  3614. # Version Check CB
  3615. self.version_check_label = QtWidgets.QLabel('%s:' % _('Version Check'))
  3616. self.version_check_label.setToolTip(
  3617. _("Check this box if you want to check\n"
  3618. "for a new version automatically at startup.")
  3619. )
  3620. self.version_check_cb = FCCheckBox(label='')
  3621. self.version_check_cb.setToolTip(
  3622. _("Check this box if you want to check\n"
  3623. "for a new version automatically at startup.")
  3624. )
  3625. # Send Stats CB
  3626. self.send_stats_label = QtWidgets.QLabel('%s:' % _('Send Stats'))
  3627. self.send_stats_label.setToolTip(
  3628. _("Check this box if you agree to send anonymous\n"
  3629. "stats automatically at startup, to help improve FlatCAM.")
  3630. )
  3631. self.send_stats_cb = FCCheckBox(label='')
  3632. self.send_stats_cb.setToolTip(
  3633. _("Check this box if you agree to send anonymous\n"
  3634. "stats automatically at startup, to help improve FlatCAM.")
  3635. )
  3636. self.ois_version_check = OptionalInputSection(self.version_check_cb, [self.send_stats_cb])
  3637. # Select mouse pan button
  3638. self.panbuttonlabel = QtWidgets.QLabel('<b>%s:</b>' % _('Pan Button'))
  3639. self.panbuttonlabel.setToolTip(_("Select the mouse button to use for panning:\n"
  3640. "- MMB --> Middle Mouse Button\n"
  3641. "- RMB --> Right Mouse Button"))
  3642. self.pan_button_radio = RadioSet([{'label': _('MMB'), 'value': '3'},
  3643. {'label': _('RMB'), 'value': '2'}])
  3644. # Multiple Selection Modifier Key
  3645. self.mselectlabel = QtWidgets.QLabel('<b>%s:</b>' % _('Multiple Sel'))
  3646. self.mselectlabel.setToolTip(_("Select the key used for multiple selection."))
  3647. self.mselect_radio = RadioSet([{'label': _('CTRL'), 'value': 'Control'},
  3648. {'label': _('SHIFT'), 'value': 'Shift'}])
  3649. # Worker Numbers
  3650. self.worker_number_label = QtWidgets.QLabel('%s:' % _('Workers number'))
  3651. self.worker_number_label.setToolTip(
  3652. _("The number of Qthreads made available to the App.\n"
  3653. "A bigger number may finish the jobs more quickly but\n"
  3654. "depending on your computer speed, may make the App\n"
  3655. "unresponsive. Can have a value between 2 and 16.\n"
  3656. "Default value is 2.\n"
  3657. "After change, it will be applied at next App start.")
  3658. )
  3659. self.worker_number_sb = FCSpinner()
  3660. self.worker_number_sb.setToolTip(
  3661. _("The number of Qthreads made available to the App.\n"
  3662. "A bigger number may finish the jobs more quickly but\n"
  3663. "depending on your computer speed, may make the App\n"
  3664. "unresponsive. Can have a value between 2 and 16.\n"
  3665. "Default value is 2.\n"
  3666. "After change, it will be applied at next App start.")
  3667. )
  3668. self.worker_number_sb.set_range(2, 16)
  3669. # Geometric tolerance
  3670. tol_label = QtWidgets.QLabel('%s:' % _("Geo Tolerance"))
  3671. tol_label.setToolTip(_(
  3672. "This value can counter the effect of the Circle Steps\n"
  3673. "parameter. Default value is 0.01.\n"
  3674. "A lower value will increase the detail both in image\n"
  3675. "and in Gcode for the circles, with a higher cost in\n"
  3676. "performance. Higher value will provide more\n"
  3677. "performance at the expense of level of detail."
  3678. ))
  3679. self.tol_entry = FCEntry()
  3680. self.tol_entry.setToolTip(_(
  3681. "This value can counter the effect of the Circle Steps\n"
  3682. "parameter. Default value is 0.01.\n"
  3683. "A lower value will increase the detail both in image\n"
  3684. "and in Gcode for the circles, with a higher cost in\n"
  3685. "performance. Higher value will provide more\n"
  3686. "performance at the expense of level of detail."
  3687. ))
  3688. # Just to add empty rows
  3689. self.spacelabel = QtWidgets.QLabel('')
  3690. # Add (label - input field) pair to the QFormLayout
  3691. self.form_box.addRow(self.unitslabel, self.units_radio)
  3692. self.form_box.addRow(self.app_level_label, self.app_level_radio)
  3693. self.form_box.addRow(self.portability_label, self.portability_cb)
  3694. self.form_box.addRow(QtWidgets.QLabel(''))
  3695. self.form_box.addRow(self.languagelabel, self.language_cb)
  3696. self.form_box.addRow(self.languagespace, self.language_apply_btn)
  3697. self.form_box.addRow(self.spacelabel, self.spacelabel)
  3698. self.form_box.addRow(self.version_check_label, self.version_check_cb)
  3699. self.form_box.addRow(self.send_stats_label, self.send_stats_cb)
  3700. self.form_box.addRow(self.panbuttonlabel, self.pan_button_radio)
  3701. self.form_box.addRow(self.mselectlabel, self.mselect_radio)
  3702. self.form_box.addRow(self.worker_number_label, self.worker_number_sb)
  3703. self.form_box.addRow(tol_label, self.tol_entry)
  3704. self.form_box.addRow(self.spacelabel, self.spacelabel)
  3705. # Add the QFormLayout that holds the Application general defaults
  3706. # to the main layout of this TAB
  3707. self.layout.addLayout(self.form_box)
  3708. # Open behavior
  3709. self.open_style_cb = FCCheckBox('%s' % _('"Open" behavior'))
  3710. self.open_style_cb.setToolTip(
  3711. _("When checked the path for the last saved file is used when saving files,\n"
  3712. "and the path for the last opened file is used when opening files.\n\n"
  3713. "When unchecked the path for opening files is the one used last: either the\n"
  3714. "path for saving files or the path for opening files.")
  3715. )
  3716. # self.advanced_cb.setLayoutDirection(QtCore.Qt.RightToLeft)
  3717. self.layout.addWidget(self.open_style_cb)
  3718. # Save compressed project CB
  3719. self.save_type_cb = FCCheckBox(_('Save Compressed Project'))
  3720. self.save_type_cb.setToolTip(
  3721. _("Whether to save a compressed or uncompressed project.\n"
  3722. "When checked it will save a compressed FlatCAM project.")
  3723. )
  3724. # self.advanced_cb.setLayoutDirection(QtCore.Qt.RightToLeft)
  3725. self.layout.addWidget(self.save_type_cb)
  3726. hlay1 = QtWidgets.QHBoxLayout()
  3727. self.layout.addLayout(hlay1)
  3728. # Project LZMA Comppression Level
  3729. self.compress_combo = FCComboBox()
  3730. self.compress_label = QtWidgets.QLabel('%s:' % _('Compression Level'))
  3731. self.compress_label.setToolTip(
  3732. _("The level of compression used when saving\n"
  3733. "a FlatCAM project. Higher value means better compression\n"
  3734. "but require more RAM usage and more processing time.")
  3735. )
  3736. # self.advanced_cb.setLayoutDirection(QtCore.Qt.RightToLeft)
  3737. self.compress_combo.addItems([str(i) for i in range(10)])
  3738. hlay1.addWidget(self.compress_label)
  3739. hlay1.addWidget(self.compress_combo)
  3740. self.proj_ois = OptionalInputSection(self.save_type_cb, [self.compress_label, self.compress_combo], True)
  3741. self.form_box_2 = QtWidgets.QFormLayout()
  3742. self.layout.addLayout(self.form_box_2)
  3743. self.layout.addStretch()
  3744. if sys.platform != 'win32':
  3745. self.portability_label.hide()
  3746. self.portability_cb.hide()
  3747. class GerberGenPrefGroupUI(OptionsGroupUI):
  3748. def __init__(self, parent=None):
  3749. # OptionsGroupUI.__init__(self, "Gerber General Preferences", parent=parent)
  3750. super(GerberGenPrefGroupUI, self).__init__(self)
  3751. self.setTitle(str(_("Gerber General")))
  3752. # ## Plot options
  3753. self.plot_options_label = QtWidgets.QLabel("<b>%s:</b>" % _("Plot Options"))
  3754. self.layout.addWidget(self.plot_options_label)
  3755. grid0 = QtWidgets.QGridLayout()
  3756. self.layout.addLayout(grid0)
  3757. # Solid CB
  3758. self.solid_cb = FCCheckBox(label='%s' % _('Solid'))
  3759. self.solid_cb.setToolTip(
  3760. _("Solid color polygons.")
  3761. )
  3762. grid0.addWidget(self.solid_cb, 0, 0)
  3763. # Multicolored CB
  3764. self.multicolored_cb = FCCheckBox(label='%s' % _('M-Color'))
  3765. self.multicolored_cb.setToolTip(
  3766. _("Draw polygons in different colors.")
  3767. )
  3768. grid0.addWidget(self.multicolored_cb, 0, 1)
  3769. # Plot CB
  3770. self.plot_cb = FCCheckBox(label='%s' % _('Plot'))
  3771. self.plot_options_label.setToolTip(
  3772. _("Plot (show) this object.")
  3773. )
  3774. grid0.addWidget(self.plot_cb, 0, 2)
  3775. # Number of circle steps for circular aperture linear approximation
  3776. self.circle_steps_label = QtWidgets.QLabel('%s:' % _("Circle Steps"))
  3777. self.circle_steps_label.setToolTip(
  3778. _("The number of circle steps for Gerber \n"
  3779. "circular aperture linear approximation.")
  3780. )
  3781. self.circle_steps_entry = IntEntry()
  3782. grid0.addWidget(self.circle_steps_label, 1, 0)
  3783. grid0.addWidget(self.circle_steps_entry, 1, 1)
  3784. self.layout.addStretch()
  3785. class GerberOptPrefGroupUI(OptionsGroupUI):
  3786. def __init__(self, parent=None):
  3787. # OptionsGroupUI.__init__(self, "Gerber Options Preferences", parent=parent)
  3788. super(GerberOptPrefGroupUI, self).__init__(self)
  3789. self.setTitle(str(_("Gerber Options")))
  3790. # ## Isolation Routing
  3791. self.isolation_routing_label = QtWidgets.QLabel("<b>%s:</b>" % _("Isolation Routing"))
  3792. self.isolation_routing_label.setToolTip(
  3793. _("Create a Geometry object with\n"
  3794. "toolpaths to cut outside polygons.")
  3795. )
  3796. self.layout.addWidget(self.isolation_routing_label)
  3797. # Cutting Tool Diameter
  3798. grid0 = QtWidgets.QGridLayout()
  3799. self.layout.addLayout(grid0)
  3800. tdlabel = QtWidgets.QLabel('%s:' % _('Tool dia'))
  3801. tdlabel.setToolTip(
  3802. _("Diameter of the cutting tool.")
  3803. )
  3804. grid0.addWidget(tdlabel, 0, 0)
  3805. self.iso_tool_dia_entry = LengthEntry()
  3806. grid0.addWidget(self.iso_tool_dia_entry, 0, 1)
  3807. # Nr of passes
  3808. passlabel = QtWidgets.QLabel('%s:' % _('# Passes'))
  3809. passlabel.setToolTip(
  3810. _("Width of the isolation gap in\n"
  3811. "number (integer) of tool widths.")
  3812. )
  3813. grid0.addWidget(passlabel, 1, 0)
  3814. self.iso_width_entry = FCSpinner()
  3815. self.iso_width_entry.setRange(1, 999)
  3816. grid0.addWidget(self.iso_width_entry, 1, 1)
  3817. # Pass overlap
  3818. overlabel = QtWidgets.QLabel('%s:' % _('Pass overlap'))
  3819. overlabel.setToolTip(
  3820. _("How much (fraction) of the tool width to overlap each tool pass.\n"
  3821. "Example:\n"
  3822. "A value here of 0.25 means an overlap of 25%% from the tool diameter found above.")
  3823. )
  3824. grid0.addWidget(overlabel, 2, 0)
  3825. self.iso_overlap_entry = FCDoubleSpinner()
  3826. self.iso_overlap_entry.set_precision(3)
  3827. self.iso_overlap_entry.setWrapping(True)
  3828. self.iso_overlap_entry.setRange(0.000, 0.999)
  3829. self.iso_overlap_entry.setSingleStep(0.1)
  3830. grid0.addWidget(self.iso_overlap_entry, 2, 1)
  3831. # Milling Type
  3832. milling_type_label = QtWidgets.QLabel('%s:' % _('Milling Type'))
  3833. milling_type_label.setToolTip(
  3834. _("Milling type:\n"
  3835. "- climb / best for precision milling and to reduce tool usage\n"
  3836. "- conventional / useful when there is no backlash compensation")
  3837. )
  3838. grid0.addWidget(milling_type_label, 3, 0)
  3839. self.milling_type_radio = RadioSet([{'label': _('Climb'), 'value': 'cl'},
  3840. {'label': _('Conv.'), 'value': 'cv'}])
  3841. grid0.addWidget(self.milling_type_radio, 3, 1)
  3842. # Combine passes
  3843. self.combine_passes_cb = FCCheckBox(label=_('Combine Passes'))
  3844. self.combine_passes_cb.setToolTip(
  3845. _("Combine all passes into one object")
  3846. )
  3847. grid0.addWidget(self.combine_passes_cb, 4, 0, 1, 2)
  3848. # ## Clear non-copper regions
  3849. self.clearcopper_label = QtWidgets.QLabel("<b>%s:</b>" % _("Non-copper regions"))
  3850. self.clearcopper_label.setToolTip(
  3851. _("Create polygons covering the\n"
  3852. "areas without copper on the PCB.\n"
  3853. "Equivalent to the inverse of this\n"
  3854. "object. Can be used to remove all\n"
  3855. "copper from a specified region.")
  3856. )
  3857. self.layout.addWidget(self.clearcopper_label)
  3858. grid1 = QtWidgets.QGridLayout()
  3859. self.layout.addLayout(grid1)
  3860. # Margin
  3861. bmlabel = QtWidgets.QLabel('%s:' % _('Boundary Margin'))
  3862. bmlabel.setToolTip(
  3863. _("Specify the edge of the PCB\n"
  3864. "by drawing a box around all\n"
  3865. "objects with this minimum\n"
  3866. "distance.")
  3867. )
  3868. grid1.addWidget(bmlabel, 0, 0)
  3869. self.noncopper_margin_entry = LengthEntry()
  3870. grid1.addWidget(self.noncopper_margin_entry, 0, 1)
  3871. # Rounded corners
  3872. self.noncopper_rounded_cb = FCCheckBox(label=_("Rounded Geo"))
  3873. self.noncopper_rounded_cb.setToolTip(
  3874. _("Resulting geometry will have rounded corners.")
  3875. )
  3876. grid1.addWidget(self.noncopper_rounded_cb, 1, 0, 1, 2)
  3877. # ## Bounding box
  3878. self.boundingbox_label = QtWidgets.QLabel('<b>%s:</b>' % _('Bounding Box'))
  3879. self.layout.addWidget(self.boundingbox_label)
  3880. grid2 = QtWidgets.QGridLayout()
  3881. self.layout.addLayout(grid2)
  3882. bbmargin = QtWidgets.QLabel('%s:' % _('Boundary Margin'))
  3883. bbmargin.setToolTip(
  3884. _("Distance of the edges of the box\n"
  3885. "to the nearest polygon.")
  3886. )
  3887. grid2.addWidget(bbmargin, 0, 0)
  3888. self.bbmargin_entry = LengthEntry()
  3889. grid2.addWidget(self.bbmargin_entry, 0, 1)
  3890. self.bbrounded_cb = FCCheckBox(label='%s' % _("Rounded Geo"))
  3891. self.bbrounded_cb.setToolTip(
  3892. _("If the bounding box is \n"
  3893. "to have rounded corners\n"
  3894. "their radius is equal to\n"
  3895. "the margin.")
  3896. )
  3897. grid2.addWidget(self.bbrounded_cb, 1, 0, 1, 2)
  3898. self.layout.addStretch()
  3899. class GerberAdvOptPrefGroupUI(OptionsGroupUI):
  3900. def __init__(self, parent=None):
  3901. # OptionsGroupUI.__init__(self, "Gerber Adv. Options Preferences", parent=parent)
  3902. super(GerberAdvOptPrefGroupUI, self).__init__(self)
  3903. self.setTitle(str(_("Gerber Adv. Options")))
  3904. # ## Advanced Gerber Parameters
  3905. self.adv_param_label = QtWidgets.QLabel('<b>%s:</b>' % _('Advanced Options'))
  3906. self.adv_param_label.setToolTip(
  3907. _("A list of Gerber advanced parameters.\n"
  3908. "Those parameters are available only for\n"
  3909. "Advanced App. Level.")
  3910. )
  3911. self.layout.addWidget(self.adv_param_label)
  3912. grid0 = QtWidgets.QGridLayout()
  3913. self.layout.addLayout(grid0)
  3914. # Follow Attribute
  3915. self.follow_cb = FCCheckBox(label=_('"Follow"'))
  3916. self.follow_cb.setToolTip(
  3917. _("Generate a 'Follow' geometry.\n"
  3918. "This means that it will cut through\n"
  3919. "the middle of the trace.")
  3920. )
  3921. grid0.addWidget(self.follow_cb, 0, 0, 1, 2)
  3922. # Aperture Table Visibility CB
  3923. self.aperture_table_visibility_cb = FCCheckBox(label=_('Table Show/Hide'))
  3924. self.aperture_table_visibility_cb.setToolTip(
  3925. _("Toggle the display of the Gerber Apertures Table.\n"
  3926. "Also, on hide, it will delete all mark shapes\n"
  3927. "that are drawn on canvas.")
  3928. )
  3929. grid0.addWidget(self.aperture_table_visibility_cb, 1, 0, 1, 2)
  3930. # Buffering Type
  3931. buffering_label = QtWidgets.QLabel('%s:' % _('Buffering'))
  3932. buffering_label.setToolTip(
  3933. _("Buffering type:\n"
  3934. "- None --> best performance, fast file loading but no so good display\n"
  3935. "- Full --> slow file loading but good visuals. This is the default.\n"
  3936. "<<WARNING>>: Don't change this unless you know what you are doing !!!")
  3937. )
  3938. self.buffering_radio = RadioSet([{'label': _('None'), 'value': 'no'},
  3939. {'label': _('Full'), 'value': 'full'}])
  3940. grid0.addWidget(buffering_label, 2, 0)
  3941. grid0.addWidget(self.buffering_radio, 2, 1)
  3942. # Simplification
  3943. self.simplify_cb = FCCheckBox(label=_('Simplify'))
  3944. self.simplify_cb.setToolTip(_("When checked all the Gerber polygons will be\n"
  3945. "loaded with simplification having a set tolerance."))
  3946. grid0.addWidget(self.simplify_cb, 3, 0, 1, 2)
  3947. # Simplification tolerance
  3948. self.simplification_tol_label = QtWidgets.QLabel(_('Tolerance'))
  3949. self.simplification_tol_label.setToolTip(_("Tolerance for poligon simplification."))
  3950. self.simplification_tol_spinner = FCDoubleSpinner()
  3951. self.simplification_tol_spinner.set_precision(5)
  3952. self.simplification_tol_spinner.setWrapping(True)
  3953. self.simplification_tol_spinner.setRange(0.00000, 0.01000)
  3954. self.simplification_tol_spinner.setSingleStep(0.0001)
  3955. grid0.addWidget(self.simplification_tol_label, 4, 0)
  3956. grid0.addWidget(self.simplification_tol_spinner, 4, 1)
  3957. self.ois_simplif = OptionalInputSection(self.simplify_cb,
  3958. [self.simplification_tol_label, self.simplification_tol_spinner],
  3959. logic=True)
  3960. # Scale Aperture Factor
  3961. # self.scale_aperture_label = QtWidgets.QLabel(_('Ap. Scale Factor:'))
  3962. # self.scale_aperture_label.setToolTip(
  3963. # _("Change the size of the selected apertures.\n"
  3964. # "Factor by which to multiply\n"
  3965. # "geometric features of this object.")
  3966. # )
  3967. # grid0.addWidget(self.scale_aperture_label, 2, 0)
  3968. #
  3969. # self.scale_aperture_entry = FloatEntry2()
  3970. # grid0.addWidget(self.scale_aperture_entry, 2, 1)
  3971. # Buffer Aperture Factor
  3972. # self.buffer_aperture_label = QtWidgets.QLabel(_('Ap. Buffer Factor:'))
  3973. # self.buffer_aperture_label.setToolTip(
  3974. # _("Change the size of the selected apertures.\n"
  3975. # "Factor by which to expand/shrink\n"
  3976. # "geometric features of this object.")
  3977. # )
  3978. # grid0.addWidget(self.buffer_aperture_label, 3, 0)
  3979. #
  3980. # self.buffer_aperture_entry = FloatEntry2()
  3981. # grid0.addWidget(self.buffer_aperture_entry, 3, 1)
  3982. self.layout.addStretch()
  3983. class GerberExpPrefGroupUI(OptionsGroupUI):
  3984. def __init__(self, parent=None):
  3985. super(GerberExpPrefGroupUI, self).__init__(self)
  3986. self.setTitle(str(_("Gerber Export")))
  3987. # Plot options
  3988. self.export_options_label = QtWidgets.QLabel("<b>%s:</b>" % _("Export Options"))
  3989. self.export_options_label.setToolTip(
  3990. _("The parameters set here are used in the file exported\n"
  3991. "when using the File -> Export -> Export Gerber menu entry.")
  3992. )
  3993. self.layout.addWidget(self.export_options_label)
  3994. form = QtWidgets.QFormLayout()
  3995. self.layout.addLayout(form)
  3996. # Gerber Units
  3997. self.gerber_units_label = QtWidgets.QLabel('<b>%s:</b>' % _('Units'))
  3998. self.gerber_units_label.setToolTip(
  3999. _("The units used in the Gerber file.")
  4000. )
  4001. self.gerber_units_radio = RadioSet([{'label': _('INCH'), 'value': 'IN'},
  4002. {'label': _('MM'), 'value': 'MM'}])
  4003. self.gerber_units_radio.setToolTip(
  4004. _("The units used in the Gerber file.")
  4005. )
  4006. form.addRow(self.gerber_units_label, self.gerber_units_radio)
  4007. # Gerber format
  4008. self.digits_label = QtWidgets.QLabel("<b>%s:</b>" % _("Int/Decimals"))
  4009. self.digits_label.setToolTip(
  4010. _("The number of digits in the whole part of the number\n"
  4011. "and in the fractional part of the number.")
  4012. )
  4013. hlay1 = QtWidgets.QHBoxLayout()
  4014. self.format_whole_entry = IntEntry()
  4015. self.format_whole_entry.setMaxLength(1)
  4016. self.format_whole_entry.setAlignment(QtCore.Qt.AlignRight)
  4017. self.format_whole_entry.setMinimumWidth(30)
  4018. self.format_whole_entry.setToolTip(
  4019. _("This numbers signify the number of digits in\n"
  4020. "the whole part of Gerber coordinates.")
  4021. )
  4022. hlay1.addWidget(self.format_whole_entry, QtCore.Qt.AlignLeft)
  4023. gerber_separator_label = QtWidgets.QLabel(':')
  4024. gerber_separator_label.setFixedWidth(5)
  4025. hlay1.addWidget(gerber_separator_label, QtCore.Qt.AlignLeft)
  4026. self.format_dec_entry = IntEntry()
  4027. self.format_dec_entry.setMaxLength(1)
  4028. self.format_dec_entry.setAlignment(QtCore.Qt.AlignRight)
  4029. self.format_dec_entry.setMinimumWidth(30)
  4030. self.format_dec_entry.setToolTip(
  4031. _("This numbers signify the number of digits in\n"
  4032. "the decimal part of Gerber coordinates.")
  4033. )
  4034. hlay1.addWidget(self.format_dec_entry, QtCore.Qt.AlignLeft)
  4035. hlay1.addStretch()
  4036. form.addRow(self.digits_label, hlay1)
  4037. # Gerber Zeros
  4038. self.zeros_label = QtWidgets.QLabel('<b>%s:</b>' % _('Zeros'))
  4039. self.zeros_label.setAlignment(QtCore.Qt.AlignLeft)
  4040. self.zeros_label.setToolTip(
  4041. _("This sets the type of Gerber zeros.\n"
  4042. "If LZ then Leading Zeros are removed and\n"
  4043. "Trailing Zeros are kept.\n"
  4044. "If TZ is checked then Trailing Zeros are removed\n"
  4045. "and Leading Zeros are kept.")
  4046. )
  4047. self.zeros_radio = RadioSet([{'label': _('LZ'), 'value': 'L'},
  4048. {'label': _('TZ'), 'value': 'T'}])
  4049. self.zeros_radio.setToolTip(
  4050. _("This sets the type of Gerber zeros.\n"
  4051. "If LZ then Leading Zeros are removed and\n"
  4052. "Trailing Zeros are kept.\n"
  4053. "If TZ is checked then Trailing Zeros are removed\n"
  4054. "and Leading Zeros are kept.")
  4055. )
  4056. form.addRow(self.zeros_label, self.zeros_radio)
  4057. self.layout.addStretch()
  4058. class GerberEditorPrefGroupUI(OptionsGroupUI):
  4059. def __init__(self, parent=None):
  4060. # OptionsGroupUI.__init__(self, "Gerber Adv. Options Preferences", parent=parent)
  4061. super(GerberEditorPrefGroupUI, self).__init__(self)
  4062. self.setTitle(str(_("Gerber Editor")))
  4063. # Advanced Gerber Parameters
  4064. self.param_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  4065. self.param_label.setToolTip(
  4066. _("A list of Gerber Editor parameters.")
  4067. )
  4068. self.layout.addWidget(self.param_label)
  4069. grid0 = QtWidgets.QGridLayout()
  4070. self.layout.addLayout(grid0)
  4071. # Selection Limit
  4072. self.sel_limit_label = QtWidgets.QLabel('%s:' % _("Selection limit"))
  4073. self.sel_limit_label.setToolTip(
  4074. _("Set the number of selected Gerber geometry\n"
  4075. "items above which the utility geometry\n"
  4076. "becomes just a selection rectangle.\n"
  4077. "Increases the performance when moving a\n"
  4078. "large number of geometric elements.")
  4079. )
  4080. self.sel_limit_entry = IntEntry()
  4081. grid0.addWidget(self.sel_limit_label, 0, 0)
  4082. grid0.addWidget(self.sel_limit_entry, 0, 1)
  4083. # New aperture code
  4084. self.addcode_entry_lbl = QtWidgets.QLabel('%s:' % _('New Aperture code'))
  4085. self.addcode_entry_lbl.setToolTip(
  4086. _("Code for the new aperture")
  4087. )
  4088. self.addcode_entry = FCEntry()
  4089. self.addcode_entry.setValidator(QtGui.QIntValidator(0, 99))
  4090. grid0.addWidget(self.addcode_entry_lbl, 1, 0)
  4091. grid0.addWidget(self.addcode_entry, 1, 1)
  4092. # New aperture size
  4093. self.addsize_entry_lbl = QtWidgets.QLabel('%s:' % _('New Aperture size'))
  4094. self.addsize_entry_lbl.setToolTip(
  4095. _("Size for the new aperture")
  4096. )
  4097. self.addsize_entry = FCEntry()
  4098. self.addsize_entry.setValidator(QtGui.QDoubleValidator(0.0001, 99.9999, 4))
  4099. grid0.addWidget(self.addsize_entry_lbl, 2, 0)
  4100. grid0.addWidget(self.addsize_entry, 2, 1)
  4101. # New aperture type
  4102. self.addtype_combo_lbl = QtWidgets.QLabel('%s:' % _('New Aperture type'))
  4103. self.addtype_combo_lbl.setToolTip(
  4104. _("Type for the new aperture.\n"
  4105. "Can be 'C', 'R' or 'O'.")
  4106. )
  4107. self.addtype_combo = FCComboBox()
  4108. self.addtype_combo.addItems(['C', 'R', 'O'])
  4109. grid0.addWidget(self.addtype_combo_lbl, 3, 0)
  4110. grid0.addWidget(self.addtype_combo, 3, 1)
  4111. # Number of pads in a pad array
  4112. self.grb_array_size_label = QtWidgets.QLabel('%s:' % _('Nr of pads'))
  4113. self.grb_array_size_label.setToolTip(
  4114. _("Specify how many pads to be in the array.")
  4115. )
  4116. self.grb_array_size_entry = LengthEntry()
  4117. grid0.addWidget(self.grb_array_size_label, 4, 0)
  4118. grid0.addWidget(self.grb_array_size_entry, 4, 1)
  4119. self.adddim_label = QtWidgets.QLabel('%s:' % _('Aperture Dimensions'))
  4120. self.adddim_label.setToolTip(
  4121. _("Diameters of the cutting tools, separated by ','")
  4122. )
  4123. grid0.addWidget(self.adddim_label, 5, 0)
  4124. self.adddim_entry = FCEntry()
  4125. grid0.addWidget(self.adddim_entry, 5, 1)
  4126. self.grb_array_linear_label = QtWidgets.QLabel('<b>%s:</b>' % _('Linear Pad Array'))
  4127. grid0.addWidget(self.grb_array_linear_label, 6, 0, 1, 2)
  4128. # Linear Pad Array direction
  4129. self.grb_axis_label = QtWidgets.QLabel('%s:' % _('Linear Dir.'))
  4130. self.grb_axis_label.setToolTip(
  4131. _("Direction on which the linear array is oriented:\n"
  4132. "- 'X' - horizontal axis \n"
  4133. "- 'Y' - vertical axis or \n"
  4134. "- 'Angle' - a custom angle for the array inclination")
  4135. )
  4136. self.grb_axis_radio = RadioSet([{'label': _('X'), 'value': 'X'},
  4137. {'label': _('Y'), 'value': 'Y'},
  4138. {'label': _('Angle'), 'value': 'A'}])
  4139. grid0.addWidget(self.grb_axis_label, 7, 0)
  4140. grid0.addWidget(self.grb_axis_radio, 7, 1)
  4141. # Linear Pad Array pitch distance
  4142. self.grb_pitch_label = QtWidgets.QLabel('%s:' % _('Pitch'))
  4143. self.grb_pitch_label.setToolTip(
  4144. _("Pitch = Distance between elements of the array.")
  4145. )
  4146. # self.drill_pitch_label.setMinimumWidth(100)
  4147. self.grb_pitch_entry = LengthEntry()
  4148. grid0.addWidget(self.grb_pitch_label, 8, 0)
  4149. grid0.addWidget(self.grb_pitch_entry, 8, 1)
  4150. # Linear Pad Array custom angle
  4151. self.grb_angle_label = QtWidgets.QLabel('%s:' % _('Angle'))
  4152. self.grb_angle_label.setToolTip(
  4153. _("Angle at which each element in circular array is placed.")
  4154. )
  4155. self.grb_angle_entry = LengthEntry()
  4156. grid0.addWidget(self.grb_angle_label, 9, 0)
  4157. grid0.addWidget(self.grb_angle_entry, 9, 1)
  4158. self.grb_array_circ_label = QtWidgets.QLabel('<b>%s:</b>' % _('Circular Pad Array'))
  4159. grid0.addWidget(self.grb_array_circ_label, 10, 0, 1, 2)
  4160. # Circular Pad Array direction
  4161. self.grb_circular_direction_label = QtWidgets.QLabel('%s:' % _('Circular Dir.'))
  4162. self.grb_circular_direction_label.setToolTip(
  4163. _("Direction for circular array.\n"
  4164. "Can be CW = clockwise or CCW = counter clockwise.")
  4165. )
  4166. self.grb_circular_dir_radio = RadioSet([{'label': _('CW'), 'value': 'CW'},
  4167. {'label': _('CCW'), 'value': 'CCW'}])
  4168. grid0.addWidget(self.grb_circular_direction_label, 11, 0)
  4169. grid0.addWidget(self.grb_circular_dir_radio, 11, 1)
  4170. # Circular Pad Array Angle
  4171. self.grb_circular_angle_label = QtWidgets.QLabel('%s:' % _('Circ. Angle'))
  4172. self.grb_circular_angle_label.setToolTip(
  4173. _("Angle at which each element in circular array is placed.")
  4174. )
  4175. self.grb_circular_angle_entry = LengthEntry()
  4176. grid0.addWidget(self.grb_circular_angle_label, 12, 0)
  4177. grid0.addWidget(self.grb_circular_angle_entry, 12, 1)
  4178. self.grb_array_tools_b_label = QtWidgets.QLabel('<b>%s:</b>' % _('Buffer Tool'))
  4179. grid0.addWidget(self.grb_array_tools_b_label, 13, 0, 1, 2)
  4180. # Buffer Distance
  4181. self.grb_buff_label = QtWidgets.QLabel('%s:' % _('Buffer distance'))
  4182. self.grb_buff_label.setToolTip(
  4183. _("Distance at which to buffer the Gerber element.")
  4184. )
  4185. self.grb_buff_entry = LengthEntry()
  4186. grid0.addWidget(self.grb_buff_label, 14, 0)
  4187. grid0.addWidget(self.grb_buff_entry, 14, 1)
  4188. self.grb_array_tools_s_label = QtWidgets.QLabel('<b>%s:</b>' % _('Scale Tool'))
  4189. grid0.addWidget(self.grb_array_tools_s_label, 15, 0, 1, 2)
  4190. # Scale Factor
  4191. self.grb_scale_label = QtWidgets.QLabel('%s:' % _('Scale factor'))
  4192. self.grb_scale_label.setToolTip(
  4193. _("Factor to scale the Gerber element.")
  4194. )
  4195. self.grb_scale_entry = LengthEntry()
  4196. grid0.addWidget(self.grb_scale_label, 16, 0)
  4197. grid0.addWidget(self.grb_scale_entry, 16, 1)
  4198. self.grb_array_tools_ma_label = QtWidgets.QLabel('<b>%s:</b>' % _('Mark Area Tool'))
  4199. grid0.addWidget(self.grb_array_tools_ma_label, 17, 0, 1, 2)
  4200. # Mark area Tool low threshold
  4201. self.grb_ma_low_label = QtWidgets.QLabel('%s:' % _('Threshold low'))
  4202. self.grb_ma_low_label.setToolTip(
  4203. _("Threshold value under which the apertures are not marked.")
  4204. )
  4205. self.grb_ma_low_entry = LengthEntry()
  4206. grid0.addWidget(self.grb_ma_low_label, 18, 0)
  4207. grid0.addWidget(self.grb_ma_low_entry, 18, 1)
  4208. # Mark area Tool high threshold
  4209. self.grb_ma_high_label = QtWidgets.QLabel('%s:' % _('Threshold low'))
  4210. self.grb_ma_high_label.setToolTip(
  4211. _("Threshold value over which the apertures are not marked.")
  4212. )
  4213. self.grb_ma_high_entry = LengthEntry()
  4214. grid0.addWidget(self.grb_ma_high_label, 19, 0)
  4215. grid0.addWidget(self.grb_ma_high_entry, 19, 1)
  4216. self.layout.addStretch()
  4217. class ExcellonGenPrefGroupUI(OptionsGroupUI):
  4218. def __init__(self, parent=None):
  4219. # OptionsGroupUI.__init__(self, "Excellon Options", parent=parent)
  4220. super(ExcellonGenPrefGroupUI, self).__init__(self)
  4221. self.setTitle(str(_("Excellon General")))
  4222. # Plot options
  4223. self.plot_options_label = QtWidgets.QLabel("<b>%s:</b>" % _("Plot Options"))
  4224. self.layout.addWidget(self.plot_options_label)
  4225. grid1 = QtWidgets.QGridLayout()
  4226. self.layout.addLayout(grid1)
  4227. self.plot_cb = FCCheckBox(label=_('Plot'))
  4228. self.plot_cb.setToolTip(
  4229. "Plot (show) this object."
  4230. )
  4231. grid1.addWidget(self.plot_cb, 0, 0)
  4232. self.solid_cb = FCCheckBox(label=_('Solid'))
  4233. self.solid_cb.setToolTip(
  4234. "Plot as solid circles."
  4235. )
  4236. grid1.addWidget(self.solid_cb, 0, 1)
  4237. # Excellon format
  4238. self.excellon_format_label = QtWidgets.QLabel("<b>%s:</b>" % _("Excellon Format"))
  4239. self.excellon_format_label.setToolTip(
  4240. _("The NC drill files, usually named Excellon files\n"
  4241. "are files that can be found in different formats.\n"
  4242. "Here we set the format used when the provided\n"
  4243. "coordinates are not using period.\n"
  4244. "\n"
  4245. "Possible presets:\n"
  4246. "\n"
  4247. "PROTEUS 3:3 MM LZ\n"
  4248. "DipTrace 5:2 MM TZ\n"
  4249. "DipTrace 4:3 MM LZ\n"
  4250. "\n"
  4251. "EAGLE 3:3 MM TZ\n"
  4252. "EAGLE 4:3 MM TZ\n"
  4253. "EAGLE 2:5 INCH TZ\n"
  4254. "EAGLE 3:5 INCH TZ\n"
  4255. "\n"
  4256. "ALTIUM 2:4 INCH LZ\n"
  4257. "Sprint Layout 2:4 INCH LZ"
  4258. "\n"
  4259. "KiCAD 3:5 INCH TZ")
  4260. )
  4261. self.layout.addWidget(self.excellon_format_label)
  4262. hlay1 = QtWidgets.QHBoxLayout()
  4263. self.layout.addLayout(hlay1)
  4264. self.excellon_format_in_label = QtWidgets.QLabel('%s:' % _("INCH"))
  4265. self.excellon_format_in_label.setAlignment(QtCore.Qt.AlignLeft)
  4266. self.excellon_format_in_label.setToolTip(
  4267. _("Default values for INCH are 2:4"))
  4268. hlay1.addWidget(self.excellon_format_in_label, QtCore.Qt.AlignLeft)
  4269. self.excellon_format_upper_in_entry = IntEntry()
  4270. self.excellon_format_upper_in_entry.setMaxLength(1)
  4271. self.excellon_format_upper_in_entry.setAlignment(QtCore.Qt.AlignRight)
  4272. self.excellon_format_upper_in_entry.setMinimumWidth(30)
  4273. self.excellon_format_upper_in_entry.setToolTip(
  4274. _("This numbers signify the number of digits in\n"
  4275. "the whole part of Excellon coordinates.")
  4276. )
  4277. hlay1.addWidget(self.excellon_format_upper_in_entry, QtCore.Qt.AlignLeft)
  4278. excellon_separator_in_label = QtWidgets.QLabel(':')
  4279. excellon_separator_in_label.setFixedWidth(5)
  4280. hlay1.addWidget(excellon_separator_in_label, QtCore.Qt.AlignLeft)
  4281. self.excellon_format_lower_in_entry = IntEntry()
  4282. self.excellon_format_lower_in_entry.setMaxLength(1)
  4283. self.excellon_format_lower_in_entry.setAlignment(QtCore.Qt.AlignRight)
  4284. self.excellon_format_lower_in_entry.setMinimumWidth(30)
  4285. self.excellon_format_lower_in_entry.setToolTip(
  4286. _("This numbers signify the number of digits in\n"
  4287. "the decimal part of Excellon coordinates.")
  4288. )
  4289. hlay1.addWidget(self.excellon_format_lower_in_entry, QtCore.Qt.AlignLeft)
  4290. hlay1.addStretch()
  4291. hlay2 = QtWidgets.QHBoxLayout()
  4292. self.layout.addLayout(hlay2)
  4293. self.excellon_format_mm_label = QtWidgets.QLabel('%s:' % _("METRIC"))
  4294. self.excellon_format_mm_label.setAlignment(QtCore.Qt.AlignLeft)
  4295. self.excellon_format_mm_label.setToolTip(
  4296. _("Default values for METRIC are 3:3"))
  4297. hlay2.addWidget(self.excellon_format_mm_label, QtCore.Qt.AlignLeft)
  4298. self.excellon_format_upper_mm_entry = IntEntry()
  4299. self.excellon_format_upper_mm_entry.setMaxLength(1)
  4300. self.excellon_format_upper_mm_entry.setAlignment(QtCore.Qt.AlignRight)
  4301. self.excellon_format_upper_mm_entry.setMinimumWidth(30)
  4302. self.excellon_format_upper_mm_entry.setToolTip(
  4303. _("This numbers signify the number of digits in\n"
  4304. "the whole part of Excellon coordinates.")
  4305. )
  4306. hlay2.addWidget(self.excellon_format_upper_mm_entry, QtCore.Qt.AlignLeft)
  4307. excellon_separator_mm_label = QtWidgets.QLabel(':')
  4308. excellon_separator_mm_label.setFixedWidth(5)
  4309. hlay2.addWidget(excellon_separator_mm_label, QtCore.Qt.AlignLeft)
  4310. self.excellon_format_lower_mm_entry = IntEntry()
  4311. self.excellon_format_lower_mm_entry.setMaxLength(1)
  4312. self.excellon_format_lower_mm_entry.setAlignment(QtCore.Qt.AlignRight)
  4313. self.excellon_format_lower_mm_entry.setMinimumWidth(30)
  4314. self.excellon_format_lower_mm_entry.setToolTip(
  4315. _("This numbers signify the number of digits in\n"
  4316. "the decimal part of Excellon coordinates.")
  4317. )
  4318. hlay2.addWidget(self.excellon_format_lower_mm_entry, QtCore.Qt.AlignLeft)
  4319. hlay2.addStretch()
  4320. grid2 = QtWidgets.QGridLayout()
  4321. self.layout.addLayout(grid2)
  4322. self.excellon_zeros_label = QtWidgets.QLabel('%s:' % _('Default <b>Zeros</b>'))
  4323. self.excellon_zeros_label.setAlignment(QtCore.Qt.AlignLeft)
  4324. self.excellon_zeros_label.setToolTip(
  4325. _("This sets the type of Excellon zeros.\n"
  4326. "If LZ then Leading Zeros are kept and\n"
  4327. "Trailing Zeros are removed.\n"
  4328. "If TZ is checked then Trailing Zeros are kept\n"
  4329. "and Leading Zeros are removed.")
  4330. )
  4331. grid2.addWidget(self.excellon_zeros_label, 0, 0)
  4332. self.excellon_zeros_radio = RadioSet([{'label': _('LZ'), 'value': 'L'},
  4333. {'label': _('TZ'), 'value': 'T'}])
  4334. self.excellon_zeros_radio.setToolTip(
  4335. _("This sets the default type of Excellon zeros.\n"
  4336. "If it is not detected in the parsed file the value here\n"
  4337. "will be used."
  4338. "If LZ then Leading Zeros are kept and\n"
  4339. "Trailing Zeros are removed.\n"
  4340. "If TZ is checked then Trailing Zeros are kept\n"
  4341. "and Leading Zeros are removed.")
  4342. )
  4343. grid2.addWidget(self.excellon_zeros_radio, 0, 1)
  4344. self.excellon_units_label = QtWidgets.QLabel('%s:' % _('Default <b>Units</b>'))
  4345. self.excellon_units_label.setAlignment(QtCore.Qt.AlignLeft)
  4346. self.excellon_units_label.setToolTip(
  4347. _("This sets the default units of Excellon files.\n"
  4348. "If it is not detected in the parsed file the value here\n"
  4349. "will be used."
  4350. "Some Excellon files don't have an header\n"
  4351. "therefore this parameter will be used.")
  4352. )
  4353. grid2.addWidget(self.excellon_units_label, 1, 0)
  4354. self.excellon_units_radio = RadioSet([{'label': _('INCH'), 'value': 'INCH'},
  4355. {'label': _('MM'), 'value': 'METRIC'}])
  4356. self.excellon_units_radio.setToolTip(
  4357. _("This sets the units of Excellon files.\n"
  4358. "Some Excellon files don't have an header\n"
  4359. "therefore this parameter will be used.")
  4360. )
  4361. grid2.addWidget(self.excellon_units_radio, 1, 1)
  4362. self.update_excellon_cb = FCCheckBox(label=_('Update Export settings'))
  4363. self.update_excellon_cb.setToolTip(
  4364. "If checked, the Excellon Export settings will be updated with the ones above."
  4365. )
  4366. grid2.addWidget(self.update_excellon_cb, 2, 0, 1, 2)
  4367. grid2.addWidget(QtWidgets.QLabel(""), 3, 0)
  4368. self.excellon_general_label = QtWidgets.QLabel("<b>%s:</b>" % _("Excellon Optimization"))
  4369. grid2.addWidget(self.excellon_general_label, 4, 0, 1, 2)
  4370. self.excellon_optimization_label = QtWidgets.QLabel(_('Algorithm:'))
  4371. self.excellon_optimization_label.setToolTip(
  4372. _("This sets the optimization type for the Excellon drill path.\n"
  4373. "If <<MetaHeuristic>> is checked then Google OR-Tools algorithm with MetaHeuristic\n"
  4374. "Guided Local Path is used. Default search time is 3sec.\n"
  4375. "If <<Basic>> is checked then Google OR-Tools Basic algorithm is used.\n"
  4376. "If <<TSA>> is checked then Travelling Salesman algorithm is used for\n"
  4377. "drill path optimization.\n"
  4378. "\n"
  4379. "If this control is disabled, then FlatCAM works in 32bit mode and it uses\n"
  4380. "Travelling Salesman algorithm for path optimization.")
  4381. )
  4382. grid2.addWidget(self.excellon_optimization_label, 5, 0)
  4383. self.excellon_optimization_radio = RadioSet([{'label': _('MetaHeuristic'), 'value': 'M'},
  4384. {'label': _('Basic'), 'value': 'B'},
  4385. {'label': _('TSA'), 'value': 'T'}],
  4386. orientation='vertical', stretch=False)
  4387. self.excellon_optimization_radio.setToolTip(
  4388. _("This sets the optimization type for the Excellon drill path.\n"
  4389. "If <<MetaHeuristic>> is checked then Google OR-Tools algorithm with MetaHeuristic\n"
  4390. "Guided Local Path is used. Default search time is 3sec.\n"
  4391. "If <<Basic>> is checked then Google OR-Tools Basic algorithm is used.\n"
  4392. "If <<TSA>> is checked then Travelling Salesman algorithm is used for\n"
  4393. "drill path optimization.\n"
  4394. "\n"
  4395. "If this control is disabled, then FlatCAM works in 32bit mode and it uses\n"
  4396. "Travelling Salesman algorithm for path optimization.")
  4397. )
  4398. grid2.addWidget(self.excellon_optimization_radio, 5, 1)
  4399. self.optimization_time_label = QtWidgets.QLabel('%s:' % _('Optimization Time'))
  4400. self.optimization_time_label.setAlignment(QtCore.Qt.AlignLeft)
  4401. self.optimization_time_label.setToolTip(
  4402. _("When OR-Tools Metaheuristic (MH) is enabled there is a\n"
  4403. "maximum threshold for how much time is spent doing the\n"
  4404. "path optimization. This max duration is set here.\n"
  4405. "In seconds.")
  4406. )
  4407. grid2.addWidget(self.optimization_time_label, 6, 0)
  4408. self.optimization_time_entry = IntEntry()
  4409. self.optimization_time_entry.setValidator(QtGui.QIntValidator(0, 999))
  4410. grid2.addWidget(self.optimization_time_entry, 6, 1)
  4411. current_platform = platform.architecture()[0]
  4412. if current_platform == '64bit':
  4413. self.excellon_optimization_label.setDisabled(False)
  4414. self.excellon_optimization_radio.setDisabled(False)
  4415. self.optimization_time_label.setDisabled(False)
  4416. self.optimization_time_entry.setDisabled(False)
  4417. self.excellon_optimization_radio.activated_custom.connect(self.optimization_selection)
  4418. else:
  4419. self.excellon_optimization_label.setDisabled(True)
  4420. self.excellon_optimization_radio.setDisabled(True)
  4421. self.optimization_time_label.setDisabled(True)
  4422. self.optimization_time_entry.setDisabled(True)
  4423. self.layout.addStretch()
  4424. def optimization_selection(self):
  4425. if self.excellon_optimization_radio.get_value() == 'M':
  4426. self.optimization_time_label.setDisabled(False)
  4427. self.optimization_time_entry.setDisabled(False)
  4428. else:
  4429. self.optimization_time_label.setDisabled(True)
  4430. self.optimization_time_entry.setDisabled(True)
  4431. class ExcellonOptPrefGroupUI(OptionsGroupUI):
  4432. def __init__(self, parent=None):
  4433. # OptionsGroupUI.__init__(self, "Excellon Options", parent=parent)
  4434. super(ExcellonOptPrefGroupUI, self).__init__(self)
  4435. self.setTitle(str(_("Excellon Options")))
  4436. # ## Create CNC Job
  4437. self.cncjob_label = QtWidgets.QLabel('<b>%s</b>' % _('Create CNC Job'))
  4438. self.cncjob_label.setToolTip(
  4439. _("Parameters used to create a CNC Job object\n"
  4440. "for this drill object.")
  4441. )
  4442. self.layout.addWidget(self.cncjob_label)
  4443. grid2 = QtWidgets.QGridLayout()
  4444. self.layout.addLayout(grid2)
  4445. # Cut Z
  4446. cutzlabel = QtWidgets.QLabel('%s:' % _('Cut Z'))
  4447. cutzlabel.setToolTip(
  4448. _("Drill depth (negative)\n"
  4449. "below the copper surface.")
  4450. )
  4451. grid2.addWidget(cutzlabel, 0, 0)
  4452. self.cutz_entry = LengthEntry()
  4453. grid2.addWidget(self.cutz_entry, 0, 1)
  4454. # Travel Z
  4455. travelzlabel = QtWidgets.QLabel('%s:' % _('Travel Z'))
  4456. travelzlabel.setToolTip(
  4457. _("Tool height when travelling\n"
  4458. "across the XY plane.")
  4459. )
  4460. grid2.addWidget(travelzlabel, 1, 0)
  4461. self.travelz_entry = LengthEntry()
  4462. grid2.addWidget(self.travelz_entry, 1, 1)
  4463. # Tool change:
  4464. toolchlabel = QtWidgets.QLabel('%s:' % _("Tool change"))
  4465. toolchlabel.setToolTip(
  4466. _("Include tool-change sequence\n"
  4467. "in G-Code (Pause for tool change).")
  4468. )
  4469. self.toolchange_cb = FCCheckBox()
  4470. grid2.addWidget(toolchlabel, 2, 0)
  4471. grid2.addWidget(self.toolchange_cb, 2, 1)
  4472. toolchangezlabel = QtWidgets.QLabel('%s:' % _('Toolchange Z'))
  4473. toolchangezlabel.setToolTip(
  4474. _("Z-axis position (height) for\n"
  4475. "tool change.")
  4476. )
  4477. grid2.addWidget(toolchangezlabel, 3, 0)
  4478. self.toolchangez_entry = LengthEntry()
  4479. grid2.addWidget(self.toolchangez_entry, 3, 1)
  4480. # End Move Z
  4481. endzlabel = QtWidgets.QLabel('%s:' % _('End move Z'))
  4482. endzlabel.setToolTip(
  4483. _("Height of the tool after\n"
  4484. "the last move at the end of the job.")
  4485. )
  4486. grid2.addWidget(endzlabel, 4, 0)
  4487. self.eendz_entry = LengthEntry()
  4488. grid2.addWidget(self.eendz_entry, 4, 1)
  4489. # Feedrate Z
  4490. frlabel = QtWidgets.QLabel('%s:' % _('Feedrate Z'))
  4491. frlabel.setToolTip(
  4492. _("Tool speed while drilling\n"
  4493. "(in units per minute).\n"
  4494. "So called 'Plunge' feedrate.\n"
  4495. "This is for linear move G01.")
  4496. )
  4497. grid2.addWidget(frlabel, 5, 0)
  4498. self.feedrate_entry = LengthEntry()
  4499. grid2.addWidget(self.feedrate_entry, 5, 1)
  4500. # Spindle speed
  4501. spdlabel = QtWidgets.QLabel('%s:' % _('Spindle Speed'))
  4502. spdlabel.setToolTip(
  4503. _("Speed of the spindle\n"
  4504. "in RPM (optional)")
  4505. )
  4506. grid2.addWidget(spdlabel, 6, 0)
  4507. self.spindlespeed_entry = IntEntry(allow_empty=True)
  4508. grid2.addWidget(self.spindlespeed_entry, 6, 1)
  4509. # Dwell
  4510. dwelllabel = QtWidgets.QLabel('%s:' % _('Dwell'))
  4511. dwelllabel.setToolTip(
  4512. _("Pause to allow the spindle to reach its\n"
  4513. "speed before cutting.")
  4514. )
  4515. dwelltime = QtWidgets.QLabel('%s:' % _('Duration'))
  4516. dwelltime.setToolTip(
  4517. _("Number of time units for spindle to dwell.")
  4518. )
  4519. self.dwell_cb = FCCheckBox()
  4520. self.dwelltime_entry = FCEntry()
  4521. grid2.addWidget(dwelllabel, 7, 0)
  4522. grid2.addWidget(self.dwell_cb, 7, 1)
  4523. grid2.addWidget(dwelltime, 8, 0)
  4524. grid2.addWidget(self.dwelltime_entry, 8, 1)
  4525. self.ois_dwell_exc = OptionalInputSection(self.dwell_cb, [self.dwelltime_entry])
  4526. # postprocessor selection
  4527. pp_excellon_label = QtWidgets.QLabel('%s:' % _("Postprocessor"))
  4528. pp_excellon_label.setToolTip(
  4529. _("The postprocessor JSON file that dictates\n"
  4530. "Gcode output.")
  4531. )
  4532. grid2.addWidget(pp_excellon_label, 9, 0)
  4533. self.pp_excellon_name_cb = FCComboBox()
  4534. self.pp_excellon_name_cb.setFocusPolicy(Qt.StrongFocus)
  4535. grid2.addWidget(self.pp_excellon_name_cb, 9, 1)
  4536. # ### Choose what to use for Gcode creation: Drills, Slots or Both
  4537. excellon_gcode_type_label = QtWidgets.QLabel('<b>%s</b>' % _('Gcode'))
  4538. excellon_gcode_type_label.setToolTip(
  4539. _("Choose what to use for GCode generation:\n"
  4540. "'Drills', 'Slots' or 'Both'.\n"
  4541. "When choosing 'Slots' or 'Both', slots will be\n"
  4542. "converted to drills.")
  4543. )
  4544. self.excellon_gcode_type_radio = RadioSet([{'label': 'Drills', 'value': 'drills'},
  4545. {'label': 'Slots', 'value': 'slots'},
  4546. {'label': 'Both', 'value': 'both'}])
  4547. grid2.addWidget(excellon_gcode_type_label, 10, 0)
  4548. grid2.addWidget(self.excellon_gcode_type_radio, 10, 1)
  4549. # until I decide to implement this feature those remain disabled
  4550. excellon_gcode_type_label.hide()
  4551. self.excellon_gcode_type_radio.setVisible(False)
  4552. # ### Milling Holes ## ##
  4553. self.mill_hole_label = QtWidgets.QLabel('<b>%s</b>' % _('Mill Holes'))
  4554. self.mill_hole_label.setToolTip(
  4555. _("Create Geometry for milling holes.")
  4556. )
  4557. grid2.addWidget(self.mill_hole_label, 11, 0, 1, 2)
  4558. tdlabel = QtWidgets.QLabel('%s:' % _('Drill Tool dia'))
  4559. tdlabel.setToolTip(
  4560. _("Diameter of the cutting tool.")
  4561. )
  4562. grid2.addWidget(tdlabel, 12, 0)
  4563. self.tooldia_entry = LengthEntry()
  4564. grid2.addWidget(self.tooldia_entry, 12, 1)
  4565. stdlabel = QtWidgets.QLabel('%s:' % _('Slot Tool dia'))
  4566. stdlabel.setToolTip(
  4567. _("Diameter of the cutting tool\n"
  4568. "when milling slots.")
  4569. )
  4570. grid2.addWidget(stdlabel, 13, 0)
  4571. self.slot_tooldia_entry = LengthEntry()
  4572. grid2.addWidget(self.slot_tooldia_entry, 13, 1)
  4573. grid4 = QtWidgets.QGridLayout()
  4574. self.layout.addLayout(grid4)
  4575. # Adding the Excellon Format Defaults Button
  4576. self.excellon_defaults_button = QtWidgets.QPushButton()
  4577. self.excellon_defaults_button.setText(str(_("Defaults")))
  4578. self.excellon_defaults_button.setMinimumWidth(80)
  4579. grid4.addWidget(self.excellon_defaults_button, 0, 0, QtCore.Qt.AlignRight)
  4580. self.layout.addStretch()
  4581. class ExcellonAdvOptPrefGroupUI(OptionsGroupUI):
  4582. def __init__(self, parent=None):
  4583. # OptionsGroupUI.__init__(self, "Excellon Advanced Options", parent=parent)
  4584. super(ExcellonAdvOptPrefGroupUI, self).__init__(self)
  4585. self.setTitle(str(_("Excellon Adv. Options")))
  4586. # #######################
  4587. # ## ADVANCED OPTIONS ###
  4588. # #######################
  4589. self.exc_label = QtWidgets.QLabel('<b>%s:</b>' % _('Advanced Options'))
  4590. self.exc_label.setToolTip(
  4591. _("A list of Excellon advanced parameters.\n"
  4592. "Those parameters are available only for\n"
  4593. "Advanced App. Level.")
  4594. )
  4595. self.layout.addWidget(self.exc_label)
  4596. grid1 = QtWidgets.QGridLayout()
  4597. self.layout.addLayout(grid1)
  4598. offsetlabel = QtWidgets.QLabel('%s:' % _('Offset Z'))
  4599. offsetlabel.setToolTip(
  4600. _("Some drill bits (the larger ones) need to drill deeper\n"
  4601. "to create the desired exit hole diameter due of the tip shape.\n"
  4602. "The value here can compensate the Cut Z parameter."))
  4603. grid1.addWidget(offsetlabel, 0, 0)
  4604. self.offset_entry = LengthEntry()
  4605. grid1.addWidget(self.offset_entry, 0, 1)
  4606. toolchange_xy_label = QtWidgets.QLabel('%s:' % _('Toolchange X,Y'))
  4607. toolchange_xy_label.setToolTip(
  4608. _("Toolchange X,Y position.")
  4609. )
  4610. grid1.addWidget(toolchange_xy_label, 1, 0)
  4611. self.toolchangexy_entry = FCEntry()
  4612. grid1.addWidget(self.toolchangexy_entry, 1, 1)
  4613. startzlabel = QtWidgets.QLabel('%s:' % _('Start move Z'))
  4614. startzlabel.setToolTip(
  4615. _("Height of the tool just after start.\n"
  4616. "Delete the value if you don't need this feature.")
  4617. )
  4618. grid1.addWidget(startzlabel, 2, 0)
  4619. self.estartz_entry = FloatEntry()
  4620. grid1.addWidget(self.estartz_entry, 2, 1)
  4621. # Feedrate Rapids
  4622. fr_rapid_label = QtWidgets.QLabel('%s:' % _('Feedrate Rapids'))
  4623. fr_rapid_label.setToolTip(
  4624. _("Tool speed while drilling\n"
  4625. "(in units per minute).\n"
  4626. "This is for the rapid move G00.\n"
  4627. "It is useful only for Marlin,\n"
  4628. "ignore for any other cases.")
  4629. )
  4630. grid1.addWidget(fr_rapid_label, 3, 0)
  4631. self.feedrate_rapid_entry = LengthEntry()
  4632. grid1.addWidget(self.feedrate_rapid_entry, 3, 1)
  4633. # Probe depth
  4634. self.pdepth_label = QtWidgets.QLabel('%s:' % _("Probe Z depth"))
  4635. self.pdepth_label.setToolTip(
  4636. _("The maximum depth that the probe is allowed\n"
  4637. "to probe. Negative value, in current units.")
  4638. )
  4639. grid1.addWidget(self.pdepth_label, 4, 0)
  4640. self.pdepth_entry = FCEntry()
  4641. grid1.addWidget(self.pdepth_entry, 4, 1)
  4642. # Probe feedrate
  4643. self.feedrate_probe_label = QtWidgets.QLabel('%s:' % _("Feedrate Probe"))
  4644. self.feedrate_probe_label.setToolTip(
  4645. _("The feedrate used while the probe is probing.")
  4646. )
  4647. grid1.addWidget(self.feedrate_probe_label, 5, 0)
  4648. self.feedrate_probe_entry = FCEntry()
  4649. grid1.addWidget(self.feedrate_probe_entry, 5, 1)
  4650. # Spindle direction
  4651. spindle_dir_label = QtWidgets.QLabel('%s:' % _('Spindle dir.'))
  4652. spindle_dir_label.setToolTip(
  4653. _("This sets the direction that the spindle is rotating.\n"
  4654. "It can be either:\n"
  4655. "- CW = clockwise or\n"
  4656. "- CCW = counter clockwise")
  4657. )
  4658. self.spindledir_radio = RadioSet([{'label': _('CW'), 'value': 'CW'},
  4659. {'label': _('CCW'), 'value': 'CCW'}])
  4660. grid1.addWidget(spindle_dir_label, 6, 0)
  4661. grid1.addWidget(self.spindledir_radio, 6, 1)
  4662. fplungelabel = QtWidgets.QLabel('%s:' % _('Fast Plunge'))
  4663. fplungelabel.setToolTip(
  4664. _("By checking this, the vertical move from\n"
  4665. "Z_Toolchange to Z_move is done with G0,\n"
  4666. "meaning the fastest speed available.\n"
  4667. "WARNING: the move is done at Toolchange X,Y coords.")
  4668. )
  4669. self.fplunge_cb = FCCheckBox()
  4670. grid1.addWidget(fplungelabel, 7, 0)
  4671. grid1.addWidget(self.fplunge_cb, 7, 1)
  4672. fretractlabel = QtWidgets.QLabel('%s:' % _('Fast Retract'))
  4673. fretractlabel.setToolTip(
  4674. _("Exit hole strategy.\n"
  4675. " - When uncheked, while exiting the drilled hole the drill bit\n"
  4676. "will travel slow, with set feedrate (G1), up to zero depth and then\n"
  4677. "travel as fast as possible (G0) to the Z Move (travel height).\n"
  4678. " - When checked the travel from Z cut (cut depth) to Z_move\n"
  4679. "(travel height) is done as fast as possible (G0) in one move.")
  4680. )
  4681. self.fretract_cb = FCCheckBox()
  4682. grid1.addWidget(fretractlabel, 8, 0)
  4683. grid1.addWidget(self.fretract_cb, 8, 1)
  4684. self.layout.addStretch()
  4685. class ExcellonExpPrefGroupUI(OptionsGroupUI):
  4686. def __init__(self, parent=None):
  4687. super(ExcellonExpPrefGroupUI, self).__init__(self)
  4688. self.setTitle(str(_("Excellon Export")))
  4689. # Plot options
  4690. self.export_options_label = QtWidgets.QLabel("<b>%s:</b>" % _("Export Options"))
  4691. self.export_options_label.setToolTip(
  4692. _("The parameters set here are used in the file exported\n"
  4693. "when using the File -> Export -> Export Excellon menu entry.")
  4694. )
  4695. self.layout.addWidget(self.export_options_label)
  4696. form = QtWidgets.QFormLayout()
  4697. self.layout.addLayout(form)
  4698. # Excellon Units
  4699. self.excellon_units_label = QtWidgets.QLabel('<b>%s:</b>' % _('Units'))
  4700. self.excellon_units_label.setToolTip(
  4701. _("The units used in the Excellon file.")
  4702. )
  4703. self.excellon_units_radio = RadioSet([{'label': _('INCH'), 'value': 'INCH'},
  4704. {'label': _('MM'), 'value': 'METRIC'}])
  4705. self.excellon_units_radio.setToolTip(
  4706. _("The units used in the Excellon file.")
  4707. )
  4708. form.addRow(self.excellon_units_label, self.excellon_units_radio)
  4709. # Excellon non-decimal format
  4710. self.digits_label = QtWidgets.QLabel("<b>%s:</b>" % _("Int/Decimals"))
  4711. self.digits_label.setToolTip(
  4712. _("The NC drill files, usually named Excellon files\n"
  4713. "are files that can be found in different formats.\n"
  4714. "Here we set the format used when the provided\n"
  4715. "coordinates are not using period.")
  4716. )
  4717. hlay1 = QtWidgets.QHBoxLayout()
  4718. self.format_whole_entry = IntEntry()
  4719. self.format_whole_entry.setMaxLength(1)
  4720. self.format_whole_entry.setAlignment(QtCore.Qt.AlignRight)
  4721. self.format_whole_entry.setMinimumWidth(30)
  4722. self.format_whole_entry.setToolTip(
  4723. _("This numbers signify the number of digits in\n"
  4724. "the whole part of Excellon coordinates.")
  4725. )
  4726. hlay1.addWidget(self.format_whole_entry, QtCore.Qt.AlignLeft)
  4727. excellon_separator_label = QtWidgets.QLabel(':')
  4728. excellon_separator_label.setFixedWidth(5)
  4729. hlay1.addWidget(excellon_separator_label, QtCore.Qt.AlignLeft)
  4730. self.format_dec_entry = IntEntry()
  4731. self.format_dec_entry.setMaxLength(1)
  4732. self.format_dec_entry.setAlignment(QtCore.Qt.AlignRight)
  4733. self.format_dec_entry.setMinimumWidth(30)
  4734. self.format_dec_entry.setToolTip(
  4735. _("This numbers signify the number of digits in\n"
  4736. "the decimal part of Excellon coordinates.")
  4737. )
  4738. hlay1.addWidget(self.format_dec_entry, QtCore.Qt.AlignLeft)
  4739. hlay1.addStretch()
  4740. form.addRow(self.digits_label, hlay1)
  4741. # Select the Excellon Format
  4742. self.format_label = QtWidgets.QLabel("<b>%s:</b>" % _("Format"))
  4743. self.format_label.setToolTip(
  4744. _("Select the kind of coordinates format used.\n"
  4745. "Coordinates can be saved with decimal point or without.\n"
  4746. "When there is no decimal point, it is required to specify\n"
  4747. "the number of digits for integer part and the number of decimals.\n"
  4748. "Also it will have to be specified if LZ = leading zeros are kept\n"
  4749. "or TZ = trailing zeros are kept.")
  4750. )
  4751. self.format_radio = RadioSet([{'label': _('Decimal'), 'value': 'dec'},
  4752. {'label': _('No-Decimal'), 'value': 'ndec'}])
  4753. self.format_radio.setToolTip(
  4754. _("Select the kind of coordinates format used.\n"
  4755. "Coordinates can be saved with decimal point or without.\n"
  4756. "When there is no decimal point, it is required to specify\n"
  4757. "the number of digits for integer part and the number of decimals.\n"
  4758. "Also it will have to be specified if LZ = leading zeros are kept\n"
  4759. "or TZ = trailing zeros are kept.")
  4760. )
  4761. form.addRow(self.format_label, self.format_radio)
  4762. # Excellon Zeros
  4763. self.zeros_label = QtWidgets.QLabel('<b>%s:</b>' % _('Zeros'))
  4764. self.zeros_label.setAlignment(QtCore.Qt.AlignLeft)
  4765. self.zeros_label.setToolTip(
  4766. _("This sets the type of Excellon zeros.\n"
  4767. "If LZ then Leading Zeros are kept and\n"
  4768. "Trailing Zeros are removed.\n"
  4769. "If TZ is checked then Trailing Zeros are kept\n"
  4770. "and Leading Zeros are removed.")
  4771. )
  4772. self.zeros_radio = RadioSet([{'label': _('LZ'), 'value': 'LZ'},
  4773. {'label': _('TZ'), 'value': 'TZ'}])
  4774. self.zeros_radio.setToolTip(
  4775. _("This sets the default type of Excellon zeros.\n"
  4776. "If LZ then Leading Zeros are kept and\n"
  4777. "Trailing Zeros are removed.\n"
  4778. "If TZ is checked then Trailing Zeros are kept\n"
  4779. "and Leading Zeros are removed.")
  4780. )
  4781. form.addRow(self.zeros_label, self.zeros_radio)
  4782. # Slot type
  4783. self.slot_type_label = QtWidgets.QLabel('<b>%s:</b>' % _('Slot type'))
  4784. self.slot_type_label.setAlignment(QtCore.Qt.AlignLeft)
  4785. self.slot_type_label.setToolTip(
  4786. _("This sets how the slots will be exported.\n"
  4787. "If ROUTED then the slots will be routed\n"
  4788. "using M15/M16 commands.\n"
  4789. "If DRILLED(G85) the slots will be exported\n"
  4790. "using the Drilled slot command (G85).")
  4791. )
  4792. self.slot_type_radio = RadioSet([{'label': _('Routed'), 'value': 'routing'},
  4793. {'label': _('Drilled(G85)'), 'value': 'drilling'}])
  4794. self.slot_type_radio.setToolTip(
  4795. _("This sets how the slots will be exported.\n"
  4796. "If ROUTED then the slots will be routed\n"
  4797. "using M15/M16 commands.\n"
  4798. "If DRILLED(G85) the slots will be exported\n"
  4799. "using the Drilled slot command (G85).")
  4800. )
  4801. form.addRow(self.slot_type_label, self.slot_type_radio)
  4802. self.layout.addStretch()
  4803. self.format_radio.activated_custom.connect(self.optimization_selection)
  4804. def optimization_selection(self):
  4805. if self.format_radio.get_value() == 'dec':
  4806. self.zeros_label.setDisabled(True)
  4807. self.zeros_radio.setDisabled(True)
  4808. else:
  4809. self.zeros_label.setDisabled(False)
  4810. self.zeros_radio.setDisabled(False)
  4811. class ExcellonEditorPrefGroupUI(OptionsGroupUI):
  4812. def __init__(self, parent=None):
  4813. super(ExcellonEditorPrefGroupUI, self).__init__(self)
  4814. self.setTitle(str(_("Excellon Editor")))
  4815. # Excellon Editor Parameters
  4816. self.param_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  4817. self.param_label.setToolTip(
  4818. _("A list of Excellon Editor parameters.")
  4819. )
  4820. self.layout.addWidget(self.param_label)
  4821. grid0 = QtWidgets.QGridLayout()
  4822. self.layout.addLayout(grid0)
  4823. # Selection Limit
  4824. self.sel_limit_label = QtWidgets.QLabel('%s:' % _("Selection limit"))
  4825. self.sel_limit_label.setToolTip(
  4826. _("Set the number of selected Excellon geometry\n"
  4827. "items above which the utility geometry\n"
  4828. "becomes just a selection rectangle.\n"
  4829. "Increases the performance when moving a\n"
  4830. "large number of geometric elements.")
  4831. )
  4832. self.sel_limit_entry = IntEntry()
  4833. grid0.addWidget(self.sel_limit_label, 0, 0)
  4834. grid0.addWidget(self.sel_limit_entry, 0, 1)
  4835. # New tool diameter
  4836. self.addtool_entry_lbl = QtWidgets.QLabel('%s:' % _('New Tool Dia'))
  4837. self.addtool_entry_lbl.setToolTip(
  4838. _("Diameter for the new tool")
  4839. )
  4840. self.addtool_entry = FCEntry()
  4841. self.addtool_entry.setValidator(QtGui.QDoubleValidator(0.0001, 99.9999, 4))
  4842. grid0.addWidget(self.addtool_entry_lbl, 1, 0)
  4843. grid0.addWidget(self.addtool_entry, 1, 1)
  4844. # Number of drill holes in a drill array
  4845. self.drill_array_size_label = QtWidgets.QLabel('%s:' % _('Nr of drills'))
  4846. self.drill_array_size_label.setToolTip(
  4847. _("Specify how many drills to be in the array.")
  4848. )
  4849. # self.drill_array_size_label.setMinimumWidth(100)
  4850. self.drill_array_size_entry = LengthEntry()
  4851. grid0.addWidget(self.drill_array_size_label, 2, 0)
  4852. grid0.addWidget(self.drill_array_size_entry, 2, 1)
  4853. self.drill_array_linear_label = QtWidgets.QLabel('<b>%s:</b>' % _('Linear Drill Array'))
  4854. grid0.addWidget(self.drill_array_linear_label, 3, 0, 1, 2)
  4855. # Linear Drill Array direction
  4856. self.drill_axis_label = QtWidgets.QLabel('%s:' % _('Linear Dir.'))
  4857. self.drill_axis_label.setToolTip(
  4858. _("Direction on which the linear array is oriented:\n"
  4859. "- 'X' - horizontal axis \n"
  4860. "- 'Y' - vertical axis or \n"
  4861. "- 'Angle' - a custom angle for the array inclination")
  4862. )
  4863. # self.drill_axis_label.setMinimumWidth(100)
  4864. self.drill_axis_radio = RadioSet([{'label': _('X'), 'value': 'X'},
  4865. {'label': _('Y'), 'value': 'Y'},
  4866. {'label': _('Angle'), 'value': 'A'}])
  4867. grid0.addWidget(self.drill_axis_label, 4, 0)
  4868. grid0.addWidget(self.drill_axis_radio, 4, 1)
  4869. # Linear Drill Array pitch distance
  4870. self.drill_pitch_label = QtWidgets.QLabel('%s:' % _('Pitch'))
  4871. self.drill_pitch_label.setToolTip(
  4872. _("Pitch = Distance between elements of the array.")
  4873. )
  4874. # self.drill_pitch_label.setMinimumWidth(100)
  4875. self.drill_pitch_entry = LengthEntry()
  4876. grid0.addWidget(self.drill_pitch_label, 5, 0)
  4877. grid0.addWidget(self.drill_pitch_entry, 5, 1)
  4878. # Linear Drill Array custom angle
  4879. self.drill_angle_label = QtWidgets.QLabel('%s:' % _('Angle'))
  4880. self.drill_angle_label.setToolTip(
  4881. _("Angle at which each element in circular array is placed.")
  4882. )
  4883. self.drill_angle_entry = LengthEntry()
  4884. grid0.addWidget(self.drill_angle_label, 6, 0)
  4885. grid0.addWidget(self.drill_angle_entry, 6, 1)
  4886. self.drill_array_circ_label = QtWidgets.QLabel('<b>%s:</b>' % _('Circular Drill Array'))
  4887. grid0.addWidget(self.drill_array_circ_label, 7, 0, 1, 2)
  4888. # Circular Drill Array direction
  4889. self.drill_circular_direction_label = QtWidgets.QLabel('%s:' % _('Circular Dir.'))
  4890. self.drill_circular_direction_label.setToolTip(
  4891. _("Direction for circular array.\n"
  4892. "Can be CW = clockwise or CCW = counter clockwise.")
  4893. )
  4894. self.drill_circular_dir_radio = RadioSet([{'label': _('CW'), 'value': 'CW'},
  4895. {'label': _('CCW'), 'value': 'CCW'}])
  4896. grid0.addWidget(self.drill_circular_direction_label, 8, 0)
  4897. grid0.addWidget(self.drill_circular_dir_radio, 8, 1)
  4898. # Circular Drill Array Angle
  4899. self.drill_circular_angle_label = QtWidgets.QLabel('%s:' % _('Circ. Angle'))
  4900. self.drill_circular_angle_label.setToolTip(
  4901. _("Angle at which each element in circular array is placed.")
  4902. )
  4903. self.drill_circular_angle_entry = LengthEntry()
  4904. grid0.addWidget(self.drill_circular_angle_label, 9, 0)
  4905. grid0.addWidget(self.drill_circular_angle_entry, 9, 1)
  4906. # ##### SLOTS #####
  4907. # #################
  4908. self.drill_array_circ_label = QtWidgets.QLabel('<b>%s:</b>' % _('Slots'))
  4909. grid0.addWidget(self.drill_array_circ_label, 10, 0, 1, 2)
  4910. # Slot length
  4911. self.slot_length_label = QtWidgets.QLabel('%s:' % _('Length'))
  4912. self.slot_length_label.setToolTip(
  4913. _("Length = The length of the slot.")
  4914. )
  4915. self.slot_length_label.setMinimumWidth(100)
  4916. self.slot_length_entry = LengthEntry()
  4917. grid0.addWidget(self.slot_length_label, 11, 0)
  4918. grid0.addWidget(self.slot_length_entry, 11, 1)
  4919. # Slot direction
  4920. self.slot_axis_label = QtWidgets.QLabel('%s:' % _('Direction'))
  4921. self.slot_axis_label.setToolTip(
  4922. _("Direction on which the slot is oriented:\n"
  4923. "- 'X' - horizontal axis \n"
  4924. "- 'Y' - vertical axis or \n"
  4925. "- 'Angle' - a custom angle for the slot inclination")
  4926. )
  4927. self.slot_axis_label.setMinimumWidth(100)
  4928. self.slot_axis_radio = RadioSet([{'label': _('X'), 'value': 'X'},
  4929. {'label': _('Y'), 'value': 'Y'},
  4930. {'label': _('Angle'), 'value': 'A'}])
  4931. grid0.addWidget(self.slot_axis_label, 12, 0)
  4932. grid0.addWidget(self.slot_axis_radio, 12, 1)
  4933. # Slot custom angle
  4934. self.slot_angle_label = QtWidgets.QLabel('%s:' % _('Angle'))
  4935. self.slot_angle_label.setToolTip(
  4936. _("Angle at which the slot is placed.\n"
  4937. "The precision is of max 2 decimals.\n"
  4938. "Min value is: -359.99 degrees.\n"
  4939. "Max value is: 360.00 degrees.")
  4940. )
  4941. self.slot_angle_label.setMinimumWidth(100)
  4942. self.slot_angle_spinner = FCDoubleSpinner()
  4943. self.slot_angle_spinner.set_precision(2)
  4944. self.slot_angle_spinner.setWrapping(True)
  4945. self.slot_angle_spinner.setRange(-359.99, 360.00)
  4946. self.slot_angle_spinner.setSingleStep(1.0)
  4947. grid0.addWidget(self.slot_angle_label, 13, 0)
  4948. grid0.addWidget(self.slot_angle_spinner, 13, 1)
  4949. # #### SLOTS ARRAY #######
  4950. # ########################
  4951. self.slot_array_linear_label = QtWidgets.QLabel('<b>%s:</b>' % _('Linear Slot Array'))
  4952. grid0.addWidget(self.slot_array_linear_label, 14, 0, 1, 2)
  4953. # Number of slot holes in a drill array
  4954. self.slot_array_size_label = QtWidgets.QLabel('%s:' % _('Nr of slots'))
  4955. self.drill_array_size_label.setToolTip(
  4956. _("Specify how many slots to be in the array.")
  4957. )
  4958. # self.slot_array_size_label.setMinimumWidth(100)
  4959. self.slot_array_size_entry = LengthEntry()
  4960. grid0.addWidget(self.slot_array_size_label, 15, 0)
  4961. grid0.addWidget(self.slot_array_size_entry, 15, 1)
  4962. # Linear Slot Array direction
  4963. self.slot_array_axis_label = QtWidgets.QLabel('%s:' % _('Linear Dir.'))
  4964. self.slot_array_axis_label.setToolTip(
  4965. _("Direction on which the linear array is oriented:\n"
  4966. "- 'X' - horizontal axis \n"
  4967. "- 'Y' - vertical axis or \n"
  4968. "- 'Angle' - a custom angle for the array inclination")
  4969. )
  4970. # self.slot_axis_label.setMinimumWidth(100)
  4971. self.slot_array_axis_radio = RadioSet([{'label': _('X'), 'value': 'X'},
  4972. {'label': _('Y'), 'value': 'Y'},
  4973. {'label': _('Angle'), 'value': 'A'}])
  4974. grid0.addWidget(self.slot_array_axis_label, 16, 0)
  4975. grid0.addWidget(self.slot_array_axis_radio, 16, 1)
  4976. # Linear Slot Array pitch distance
  4977. self.slot_array_pitch_label = QtWidgets.QLabel('%s:' % _('Pitch'))
  4978. self.slot_array_pitch_label.setToolTip(
  4979. _("Pitch = Distance between elements of the array.")
  4980. )
  4981. # self.drill_pitch_label.setMinimumWidth(100)
  4982. self.slot_array_pitch_entry = LengthEntry()
  4983. grid0.addWidget(self.slot_array_pitch_label, 17, 0)
  4984. grid0.addWidget(self.slot_array_pitch_entry, 17, 1)
  4985. # Linear Slot Array custom angle
  4986. self.slot_array_angle_label = QtWidgets.QLabel('%s:' % _('Angle'))
  4987. self.slot_array_angle_label.setToolTip(
  4988. _("Angle at which each element in circular array is placed.")
  4989. )
  4990. self.slot_array_angle_entry = LengthEntry()
  4991. grid0.addWidget(self.slot_array_angle_label, 18, 0)
  4992. grid0.addWidget(self.slot_array_angle_entry, 18, 1)
  4993. self.slot_array_circ_label = QtWidgets.QLabel('<b>%s:</b>' % _('Circular Slot Array'))
  4994. grid0.addWidget(self.slot_array_circ_label, 19, 0, 1, 2)
  4995. # Circular Slot Array direction
  4996. self.slot_array_circular_direction_label = QtWidgets.QLabel('%s:' % _('Circular Dir.'))
  4997. self.slot_array_circular_direction_label.setToolTip(
  4998. _("Direction for circular array.\n"
  4999. "Can be CW = clockwise or CCW = counter clockwise.")
  5000. )
  5001. self.slot_array_circular_dir_radio = RadioSet([{'label': _('CW'), 'value': 'CW'},
  5002. {'label': _('CCW'), 'value': 'CCW'}])
  5003. grid0.addWidget(self.slot_array_circular_direction_label, 20, 0)
  5004. grid0.addWidget(self.slot_array_circular_dir_radio, 20, 1)
  5005. # Circular Slot Array Angle
  5006. self.slot_array_circular_angle_label = QtWidgets.QLabel('%s:' % _('Circ. Angle'))
  5007. self.slot_array_circular_angle_label.setToolTip(
  5008. _("Angle at which each element in circular array is placed.")
  5009. )
  5010. self.slot_array_circular_angle_entry = LengthEntry()
  5011. grid0.addWidget(self.slot_array_circular_angle_label, 21, 0)
  5012. grid0.addWidget(self.slot_array_circular_angle_entry, 21, 1)
  5013. self.layout.addStretch()
  5014. class GeometryGenPrefGroupUI(OptionsGroupUI):
  5015. def __init__(self, parent=None):
  5016. # OptionsGroupUI.__init__(self, "Geometry General Preferences", parent=parent)
  5017. super(GeometryGenPrefGroupUI, self).__init__(self)
  5018. self.setTitle(str(_("Geometry General")))
  5019. # ## Plot options
  5020. self.plot_options_label = QtWidgets.QLabel("<b>%s:</b>" % _("Plot Options"))
  5021. self.layout.addWidget(self.plot_options_label)
  5022. # Plot CB
  5023. self.plot_cb = FCCheckBox(label=_('Plot'))
  5024. self.plot_cb.setToolTip(
  5025. _("Plot (show) this object.")
  5026. )
  5027. self.layout.addWidget(self.plot_cb)
  5028. grid0 = QtWidgets.QGridLayout()
  5029. self.layout.addLayout(grid0)
  5030. # Number of circle steps for circular aperture linear approximation
  5031. self.circle_steps_label = QtWidgets.QLabel('%s:' % _("Circle Steps"))
  5032. self.circle_steps_label.setToolTip(
  5033. _("The number of circle steps for <b>Geometry</b> \n"
  5034. "circle and arc shapes linear approximation.")
  5035. )
  5036. grid0.addWidget(self.circle_steps_label, 1, 0)
  5037. self.circle_steps_entry = IntEntry()
  5038. grid0.addWidget(self.circle_steps_entry, 1, 1)
  5039. # Tools
  5040. self.tools_label = QtWidgets.QLabel("<b>%s:</b>" % _("Tools"))
  5041. grid0.addWidget(self.tools_label, 2, 0, 1, 2)
  5042. # Tooldia
  5043. tdlabel = QtWidgets.QLabel('%s:' % _('Tool dia'))
  5044. tdlabel.setToolTip(
  5045. _("Diameters of the cutting tools, separated by ','")
  5046. )
  5047. grid0.addWidget(tdlabel, 3, 0)
  5048. self.cnctooldia_entry = FCEntry()
  5049. grid0.addWidget(self.cnctooldia_entry, 3, 1)
  5050. self.layout.addStretch()
  5051. class GeometryOptPrefGroupUI(OptionsGroupUI):
  5052. def __init__(self, parent=None):
  5053. # OptionsGroupUI.__init__(self, "Geometry Options Preferences", parent=parent)
  5054. super(GeometryOptPrefGroupUI, self).__init__(self)
  5055. self.setTitle(str(_("Geometry Options")))
  5056. # ------------------------------
  5057. # ## Create CNC Job
  5058. # ------------------------------
  5059. self.cncjob_label = QtWidgets.QLabel('<b>%s:</b>' % _('Create CNC Job'))
  5060. self.cncjob_label.setToolTip(
  5061. _("Create a CNC Job object\n"
  5062. "tracing the contours of this\n"
  5063. "Geometry object.")
  5064. )
  5065. self.layout.addWidget(self.cncjob_label)
  5066. grid1 = QtWidgets.QGridLayout()
  5067. self.layout.addLayout(grid1)
  5068. # Cut Z
  5069. cutzlabel = QtWidgets.QLabel('%s:' % _('Cut Z'))
  5070. cutzlabel.setToolTip(
  5071. _("Cutting depth (negative)\n"
  5072. "below the copper surface.")
  5073. )
  5074. grid1.addWidget(cutzlabel, 0, 0)
  5075. self.cutz_entry = LengthEntry()
  5076. grid1.addWidget(self.cutz_entry, 0, 1)
  5077. # Multidepth CheckBox
  5078. self.multidepth_cb = FCCheckBox(label=_('Multi-Depth'))
  5079. self.multidepth_cb.setToolTip(
  5080. _(
  5081. "Use multiple passes to limit\n"
  5082. "the cut depth in each pass. Will\n"
  5083. "cut multiple times until Cut Z is\n"
  5084. "reached."
  5085. )
  5086. )
  5087. grid1.addWidget(self.multidepth_cb, 1, 0)
  5088. # Depth/pass
  5089. dplabel = QtWidgets.QLabel('%s:' % _('Depth/Pass'))
  5090. dplabel.setToolTip(
  5091. _("The depth to cut on each pass,\n"
  5092. "when multidepth is enabled.\n"
  5093. "It has positive value although\n"
  5094. "it is a fraction from the depth\n"
  5095. "which has negative value.")
  5096. )
  5097. grid1.addWidget(dplabel, 2, 0)
  5098. self.depthperpass_entry = LengthEntry()
  5099. grid1.addWidget(self.depthperpass_entry, 2, 1)
  5100. self.ois_multidepth = OptionalInputSection(self.multidepth_cb, [self.depthperpass_entry])
  5101. # Travel Z
  5102. travelzlabel = QtWidgets.QLabel('%s:' % _('Travel Z'))
  5103. travelzlabel.setToolTip(
  5104. _("Height of the tool when\n"
  5105. "moving without cutting.")
  5106. )
  5107. grid1.addWidget(travelzlabel, 3, 0)
  5108. self.travelz_entry = LengthEntry()
  5109. grid1.addWidget(self.travelz_entry, 3, 1)
  5110. # Tool change:
  5111. toolchlabel = QtWidgets.QLabel('%s:' % _("Tool change"))
  5112. toolchlabel.setToolTip(
  5113. _(
  5114. "Include tool-change sequence\n"
  5115. "in the Machine Code (Pause for tool change)."
  5116. )
  5117. )
  5118. self.toolchange_cb = FCCheckBox()
  5119. grid1.addWidget(toolchlabel, 4, 0)
  5120. grid1.addWidget(self.toolchange_cb, 4, 1)
  5121. # Toolchange Z
  5122. toolchangezlabel = QtWidgets.QLabel('%s:' % _('Toolchange Z'))
  5123. toolchangezlabel.setToolTip(
  5124. _(
  5125. "Z-axis position (height) for\n"
  5126. "tool change."
  5127. )
  5128. )
  5129. grid1.addWidget(toolchangezlabel, 5, 0)
  5130. self.toolchangez_entry = LengthEntry()
  5131. grid1.addWidget(self.toolchangez_entry, 5, 1)
  5132. # End move Z
  5133. endzlabel = QtWidgets.QLabel('%s:' % _('End move Z'))
  5134. endzlabel.setToolTip(
  5135. _("Height of the tool after\n"
  5136. "the last move at the end of the job.")
  5137. )
  5138. grid1.addWidget(endzlabel, 6, 0)
  5139. self.gendz_entry = LengthEntry()
  5140. grid1.addWidget(self.gendz_entry, 6, 1)
  5141. # Feedrate X-Y
  5142. frlabel = QtWidgets.QLabel('%s:' % _('Feed Rate X-Y'))
  5143. frlabel.setToolTip(
  5144. _("Cutting speed in the XY\n"
  5145. "plane in units per minute")
  5146. )
  5147. grid1.addWidget(frlabel, 7, 0)
  5148. self.cncfeedrate_entry = LengthEntry()
  5149. grid1.addWidget(self.cncfeedrate_entry, 7, 1)
  5150. # Feedrate Z (Plunge)
  5151. frz_label = QtWidgets.QLabel('%s:' % _('Feed Rate Z'))
  5152. frz_label.setToolTip(
  5153. _("Cutting speed in the XY\n"
  5154. "plane in units per minute.\n"
  5155. "It is called also Plunge.")
  5156. )
  5157. grid1.addWidget(frz_label, 8, 0)
  5158. self.cncplunge_entry = LengthEntry()
  5159. grid1.addWidget(self.cncplunge_entry, 8, 1)
  5160. # Spindle Speed
  5161. spdlabel = QtWidgets.QLabel('%s:' % _('Spindle speed'))
  5162. spdlabel.setToolTip(
  5163. _(
  5164. "Speed of the spindle in RPM (optional).\n"
  5165. "If LASER postprocessor is used,\n"
  5166. "this value is the power of laser."
  5167. )
  5168. )
  5169. grid1.addWidget(spdlabel, 9, 0)
  5170. self.cncspindlespeed_entry = IntEntry(allow_empty=True)
  5171. grid1.addWidget(self.cncspindlespeed_entry, 9, 1)
  5172. # Dwell
  5173. self.dwell_cb = FCCheckBox(label='%s:' % _('Dwell'))
  5174. self.dwell_cb.setToolTip(
  5175. _("Pause to allow the spindle to reach its\n"
  5176. "speed before cutting.")
  5177. )
  5178. dwelltime = QtWidgets.QLabel('%s:' % _('Duration'))
  5179. dwelltime.setToolTip(
  5180. _("Number of time units for spindle to dwell.")
  5181. )
  5182. self.dwelltime_entry = FCEntry()
  5183. grid1.addWidget(self.dwell_cb, 10, 0)
  5184. grid1.addWidget(dwelltime, 11, 0)
  5185. grid1.addWidget(self.dwelltime_entry, 11, 1)
  5186. self.ois_dwell = OptionalInputSection(self.dwell_cb, [self.dwelltime_entry])
  5187. # postprocessor selection
  5188. pp_label = QtWidgets.QLabel('%s:' % _("Postprocessor"))
  5189. pp_label.setToolTip(
  5190. _("The Postprocessor file that dictates\n"
  5191. "the Machine Code (like GCode, RML, HPGL) output.")
  5192. )
  5193. grid1.addWidget(pp_label, 12, 0)
  5194. self.pp_geometry_name_cb = FCComboBox()
  5195. self.pp_geometry_name_cb.setFocusPolicy(Qt.StrongFocus)
  5196. grid1.addWidget(self.pp_geometry_name_cb, 12, 1)
  5197. self.layout.addStretch()
  5198. class GeometryAdvOptPrefGroupUI(OptionsGroupUI):
  5199. def __init__(self, parent=None):
  5200. # OptionsGroupUI.__init__(self, "Geometry Advanced Options Preferences", parent=parent)
  5201. super(GeometryAdvOptPrefGroupUI, self).__init__(self)
  5202. self.setTitle(str(_("Geometry Adv. Options")))
  5203. # ------------------------------
  5204. # ## Advanced Options
  5205. # ------------------------------
  5206. self.geo_label = QtWidgets.QLabel('<b>%s:</b>' % _('Advanced Options'))
  5207. self.geo_label.setToolTip(
  5208. _("A list of Geometry advanced parameters.\n"
  5209. "Those parameters are available only for\n"
  5210. "Advanced App. Level.")
  5211. )
  5212. self.layout.addWidget(self.geo_label)
  5213. grid1 = QtWidgets.QGridLayout()
  5214. self.layout.addLayout(grid1)
  5215. # Toolchange X,Y
  5216. toolchange_xy_label = QtWidgets.QLabel('%s:' % _('Toolchange X-Y'))
  5217. toolchange_xy_label.setToolTip(
  5218. _("Toolchange X,Y position.")
  5219. )
  5220. grid1.addWidget(toolchange_xy_label, 1, 0)
  5221. self.toolchangexy_entry = FCEntry()
  5222. grid1.addWidget(self.toolchangexy_entry, 1, 1)
  5223. # Start move Z
  5224. startzlabel = QtWidgets.QLabel('%s:' % _('Start move Z'))
  5225. startzlabel.setToolTip(
  5226. _("Height of the tool just after starting the work.\n"
  5227. "Delete the value if you don't need this feature.")
  5228. )
  5229. grid1.addWidget(startzlabel, 2, 0)
  5230. self.gstartz_entry = FloatEntry()
  5231. grid1.addWidget(self.gstartz_entry, 2, 1)
  5232. # Feedrate rapids
  5233. fr_rapid_label = QtWidgets.QLabel('%s:' % _('Feed Rate Rapids'))
  5234. fr_rapid_label.setToolTip(
  5235. _("Cutting speed in the XY plane\n"
  5236. "(in units per minute).\n"
  5237. "This is for the rapid move G00.\n"
  5238. "It is useful only for Marlin,\n"
  5239. "ignore for any other cases.")
  5240. )
  5241. grid1.addWidget(fr_rapid_label, 4, 0)
  5242. self.cncfeedrate_rapid_entry = LengthEntry()
  5243. grid1.addWidget(self.cncfeedrate_rapid_entry, 4, 1)
  5244. # End move extra cut
  5245. self.extracut_cb = FCCheckBox(label='%s' % _('Re-cut 1st pt.'))
  5246. self.extracut_cb.setToolTip(
  5247. _("In order to remove possible\n"
  5248. "copper leftovers where first cut\n"
  5249. "meet with last cut, we generate an\n"
  5250. "extended cut over the first cut section.")
  5251. )
  5252. grid1.addWidget(self.extracut_cb, 5, 0)
  5253. # Probe depth
  5254. self.pdepth_label = QtWidgets.QLabel('%s:' % _("Probe Z depth"))
  5255. self.pdepth_label.setToolTip(
  5256. _("The maximum depth that the probe is allowed\n"
  5257. "to probe. Negative value, in current units.")
  5258. )
  5259. grid1.addWidget(self.pdepth_label, 6, 0)
  5260. self.pdepth_entry = FCEntry()
  5261. grid1.addWidget(self.pdepth_entry, 6, 1)
  5262. # Probe feedrate
  5263. self.feedrate_probe_label = QtWidgets.QLabel('%s:' % _("Feedrate Probe"))
  5264. self.feedrate_probe_label.setToolTip(
  5265. _("The feedrate used while the probe is probing.")
  5266. )
  5267. grid1.addWidget(self.feedrate_probe_label, 7, 0)
  5268. self.feedrate_probe_entry = FCEntry()
  5269. grid1.addWidget(self.feedrate_probe_entry, 7, 1)
  5270. # Spindle direction
  5271. spindle_dir_label = QtWidgets.QLabel('%s:' % _('Spindle dir.'))
  5272. spindle_dir_label.setToolTip(
  5273. _("This sets the direction that the spindle is rotating.\n"
  5274. "It can be either:\n"
  5275. "- CW = clockwise or\n"
  5276. "- CCW = counter clockwise")
  5277. )
  5278. self.spindledir_radio = RadioSet([{'label': _('CW'), 'value': 'CW'},
  5279. {'label': _('CCW'), 'value': 'CCW'}])
  5280. grid1.addWidget(spindle_dir_label, 8, 0)
  5281. grid1.addWidget(self.spindledir_radio, 8, 1)
  5282. # Fast Move from Z Toolchange
  5283. fplungelabel = QtWidgets.QLabel('%s:' % _('Fast Plunge'))
  5284. fplungelabel.setToolTip(
  5285. _("By checking this, the vertical move from\n"
  5286. "Z_Toolchange to Z_move is done with G0,\n"
  5287. "meaning the fastest speed available.\n"
  5288. "WARNING: the move is done at Toolchange X,Y coords.")
  5289. )
  5290. self.fplunge_cb = FCCheckBox()
  5291. grid1.addWidget(fplungelabel, 9, 0)
  5292. grid1.addWidget(self.fplunge_cb, 9, 1)
  5293. # Size of trace segment on X axis
  5294. segx_label = QtWidgets.QLabel('%s:' % _("Seg. X size"))
  5295. segx_label.setToolTip(
  5296. _("The size of the trace segment on the X axis.\n"
  5297. "Useful for auto-leveling.\n"
  5298. "A value of 0 means no segmentation on the X axis.")
  5299. )
  5300. grid1.addWidget(segx_label, 10, 0)
  5301. self.segx_entry = FCEntry()
  5302. grid1.addWidget(self.segx_entry, 10, 1)
  5303. # Size of trace segment on Y axis
  5304. segy_label = QtWidgets.QLabel('%s:' % _("Seg. Y size"))
  5305. segy_label.setToolTip(
  5306. _("The size of the trace segment on the Y axis.\n"
  5307. "Useful for auto-leveling.\n"
  5308. "A value of 0 means no segmentation on the Y axis.")
  5309. )
  5310. grid1.addWidget(segy_label, 11, 0)
  5311. self.segy_entry = FCEntry()
  5312. grid1.addWidget(self.segy_entry, 11, 1)
  5313. self.layout.addStretch()
  5314. class GeometryEditorPrefGroupUI(OptionsGroupUI):
  5315. def __init__(self, parent=None):
  5316. # OptionsGroupUI.__init__(self, "Gerber Adv. Options Preferences", parent=parent)
  5317. super(GeometryEditorPrefGroupUI, self).__init__(self)
  5318. self.setTitle(str(_("Geometry Editor")))
  5319. # Advanced Geometry Parameters
  5320. self.param_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  5321. self.param_label.setToolTip(
  5322. _("A list of Geometry Editor parameters.")
  5323. )
  5324. self.layout.addWidget(self.param_label)
  5325. grid0 = QtWidgets.QGridLayout()
  5326. self.layout.addLayout(grid0)
  5327. # Selection Limit
  5328. self.sel_limit_label = QtWidgets.QLabel('%s:' % _("Selection limit"))
  5329. self.sel_limit_label.setToolTip(
  5330. _("Set the number of selected geometry\n"
  5331. "items above which the utility geometry\n"
  5332. "becomes just a selection rectangle.\n"
  5333. "Increases the performance when moving a\n"
  5334. "large number of geometric elements.")
  5335. )
  5336. self.sel_limit_entry = IntEntry()
  5337. grid0.addWidget(self.sel_limit_label, 0, 0)
  5338. grid0.addWidget(self.sel_limit_entry, 0, 1)
  5339. self.layout.addStretch()
  5340. class CNCJobGenPrefGroupUI(OptionsGroupUI):
  5341. def __init__(self, parent=None):
  5342. # OptionsGroupUI.__init__(self, "CNC Job General Preferences", parent=None)
  5343. super(CNCJobGenPrefGroupUI, self).__init__(self)
  5344. self.setTitle(str(_("CNC Job General")))
  5345. # ## Plot options
  5346. self.plot_options_label = QtWidgets.QLabel("<b>%s:</b>" % _("Plot Options"))
  5347. self.layout.addWidget(self.plot_options_label)
  5348. grid0 = QtWidgets.QGridLayout()
  5349. self.layout.addLayout(grid0)
  5350. # grid0.setColumnStretch(1, 1)
  5351. # grid0.setColumnStretch(2, 1)
  5352. # Plot CB
  5353. # self.plot_cb = QtWidgets.QCheckBox('Plot')
  5354. self.plot_cb = FCCheckBox(_('Plot Object'))
  5355. self.plot_cb.setToolTip(_("Plot (show) this object."))
  5356. grid0.addWidget(self.plot_cb, 0, 0)
  5357. # Plot Kind
  5358. self.cncplot_method_label = QtWidgets.QLabel('%s:' % _("Plot kind"))
  5359. self.cncplot_method_label.setToolTip(
  5360. _("This selects the kind of geometries on the canvas to plot.\n"
  5361. "Those can be either of type 'Travel' which means the moves\n"
  5362. "above the work piece or it can be of type 'Cut',\n"
  5363. "which means the moves that cut into the material.")
  5364. )
  5365. self.cncplot_method_radio = RadioSet([
  5366. {"label": _("All"), "value": "all"},
  5367. {"label": _("Travel"), "value": "travel"},
  5368. {"label": _("Cut"), "value": "cut"}
  5369. ], stretch=False)
  5370. grid0.addWidget(self.cncplot_method_label, 1, 0)
  5371. grid0.addWidget(self.cncplot_method_radio, 1, 1)
  5372. grid0.addWidget(QtWidgets.QLabel(''), 1, 2)
  5373. # Display Annotation
  5374. self.annotation_label = QtWidgets.QLabel('%s:' % _("Display Annotation"))
  5375. self.annotation_label.setToolTip(
  5376. _("This selects if to display text annotation on the plot.\n"
  5377. "When checked it will display numbers in order for each end\n"
  5378. "of a travel line."
  5379. )
  5380. )
  5381. self.annotation_cb = FCCheckBox()
  5382. grid0.addWidget(self.annotation_label, 2, 0)
  5383. grid0.addWidget(self.annotation_cb, 2, 1)
  5384. grid0.addWidget(QtWidgets.QLabel(''), 2, 2)
  5385. # ###################################################################
  5386. # Number of circle steps for circular aperture linear approximation #
  5387. # ###################################################################
  5388. self.steps_per_circle_label = QtWidgets.QLabel('%s:' % _("Circle Steps"))
  5389. self.steps_per_circle_label.setToolTip(
  5390. _("The number of circle steps for <b>GCode</b> \n"
  5391. "circle and arc shapes linear approximation.")
  5392. )
  5393. grid0.addWidget(self.steps_per_circle_label, 3, 0)
  5394. self.steps_per_circle_entry = IntEntry()
  5395. grid0.addWidget(self.steps_per_circle_entry, 3, 1)
  5396. # Tool dia for plot
  5397. tdlabel = QtWidgets.QLabel('%s:' % _('Travel dia'))
  5398. tdlabel.setToolTip(
  5399. _("The width of the travel lines to be\n"
  5400. "rendered in the plot.")
  5401. )
  5402. self.tooldia_entry = LengthEntry()
  5403. grid0.addWidget(tdlabel, 4, 0)
  5404. grid0.addWidget(self.tooldia_entry, 4, 1)
  5405. # add a space
  5406. grid0.addWidget(QtWidgets.QLabel(''), 5, 0)
  5407. # Number of decimals to use in GCODE coordinates
  5408. cdeclabel = QtWidgets.QLabel('%s:' % _('Coordinates decimals'))
  5409. cdeclabel.setToolTip(
  5410. _("The number of decimals to be used for \n"
  5411. "the X, Y, Z coordinates in CNC code (GCODE, etc.)")
  5412. )
  5413. self.coords_dec_entry = IntEntry()
  5414. grid0.addWidget(cdeclabel, 6, 0)
  5415. grid0.addWidget(self.coords_dec_entry, 6, 1)
  5416. # Number of decimals to use in GCODE feedrate
  5417. frdeclabel = QtWidgets.QLabel('%s:' % _('Feedrate decimals'))
  5418. frdeclabel.setToolTip(
  5419. _("The number of decimals to be used for \n"
  5420. "the Feedrate parameter in CNC code (GCODE, etc.)")
  5421. )
  5422. self.fr_dec_entry = IntEntry()
  5423. grid0.addWidget(frdeclabel, 7, 0)
  5424. grid0.addWidget(self.fr_dec_entry, 7, 1)
  5425. # The type of coordinates used in the Gcode: Absolute or Incremental
  5426. coords_type_label = QtWidgets.QLabel('%s:' % _('Coordinates type'))
  5427. coords_type_label.setToolTip(
  5428. _("The type of coordinates to be used in Gcode.\n"
  5429. "Can be:\n"
  5430. "- Absolute G90 -> the reference is the origin x=0, y=0\n"
  5431. "- Incremental G91 -> the reference is the previous position")
  5432. )
  5433. self.coords_type_radio = RadioSet([
  5434. {"label": _("Absolute G90"), "value": "G90"},
  5435. {"label": _("Incremental G91"), "value": "G91"}
  5436. ], orientation='vertical', stretch=False)
  5437. grid0.addWidget(coords_type_label, 8, 0)
  5438. grid0.addWidget(self.coords_type_radio, 8, 1)
  5439. # hidden for the time being, until implemented
  5440. coords_type_label.hide()
  5441. self.coords_type_radio.hide()
  5442. self.layout.addStretch()
  5443. class CNCJobOptPrefGroupUI(OptionsGroupUI):
  5444. def __init__(self, parent=None):
  5445. # OptionsGroupUI.__init__(self, "CNC Job Options Preferences", parent=None)
  5446. super(CNCJobOptPrefGroupUI, self).__init__(self)
  5447. self.setTitle(str(_("CNC Job Options")))
  5448. # ## Export G-Code
  5449. self.export_gcode_label = QtWidgets.QLabel("<b>%s:</b>" % _("Export G-Code"))
  5450. self.export_gcode_label.setToolTip(
  5451. _("Export and save G-Code to\n"
  5452. "make this object to a file.")
  5453. )
  5454. self.layout.addWidget(self.export_gcode_label)
  5455. # Prepend to G-Code
  5456. prependlabel = QtWidgets.QLabel('%s:' % _('Prepend to G-Code'))
  5457. prependlabel.setToolTip(
  5458. _("Type here any G-Code commands you would\n"
  5459. "like to add at the beginning of the G-Code file.")
  5460. )
  5461. self.layout.addWidget(prependlabel)
  5462. self.prepend_text = FCTextArea()
  5463. self.layout.addWidget(self.prepend_text)
  5464. # Append text to G-Code
  5465. appendlabel = QtWidgets.QLabel('%s:' % _('Append to G-Code'))
  5466. appendlabel.setToolTip(
  5467. _("Type here any G-Code commands you would\n"
  5468. "like to append to the generated file.\n"
  5469. "I.e.: M2 (End of program)")
  5470. )
  5471. self.layout.addWidget(appendlabel)
  5472. self.append_text = FCTextArea()
  5473. self.layout.addWidget(self.append_text)
  5474. self.layout.addStretch()
  5475. class CNCJobAdvOptPrefGroupUI(OptionsGroupUI):
  5476. def __init__(self, parent=None):
  5477. # OptionsGroupUI.__init__(self, "CNC Job Advanced Options Preferences", parent=None)
  5478. super(CNCJobAdvOptPrefGroupUI, self).__init__(self)
  5479. self.setTitle(str(_("CNC Job Adv. Options")))
  5480. # ## Export G-Code
  5481. self.export_gcode_label = QtWidgets.QLabel("<b>%s:</b>" % _("Export CNC Code"))
  5482. self.export_gcode_label.setToolTip(
  5483. _("Export and save G-Code to\n"
  5484. "make this object to a file.")
  5485. )
  5486. self.layout.addWidget(self.export_gcode_label)
  5487. # Prepend to G-Code
  5488. toolchangelabel = QtWidgets.QLabel('%s:' % _('Toolchange G-Code'))
  5489. toolchangelabel.setToolTip(
  5490. _(
  5491. "Type here any G-Code commands you would\n"
  5492. "like to be executed when Toolchange event is encountered.\n"
  5493. "This will constitute a Custom Toolchange GCode,\n"
  5494. "or a Toolchange Macro.\n"
  5495. "The FlatCAM variables are surrounded by '%' symbol.\n\n"
  5496. "WARNING: it can be used only with a postprocessor file\n"
  5497. "that has 'toolchange_custom' in it's name and this is built\n"
  5498. "having as template the 'Toolchange Custom' posprocessor file."
  5499. )
  5500. )
  5501. self.layout.addWidget(toolchangelabel)
  5502. self.toolchange_text = FCTextArea()
  5503. self.layout.addWidget(self.toolchange_text)
  5504. hlay = QtWidgets.QHBoxLayout()
  5505. self.layout.addLayout(hlay)
  5506. # Toolchange Replacement GCode
  5507. self.toolchange_cb = FCCheckBox(label='%s' % _('Use Toolchange Macro'))
  5508. self.toolchange_cb.setToolTip(
  5509. _("Check this box if you want to use\n"
  5510. "a Custom Toolchange GCode (macro).")
  5511. )
  5512. hlay.addWidget(self.toolchange_cb)
  5513. hlay.addStretch()
  5514. hlay1 = QtWidgets.QHBoxLayout()
  5515. self.layout.addLayout(hlay1)
  5516. # Variable list
  5517. self.tc_variable_combo = FCComboBox()
  5518. self.tc_variable_combo.setToolTip(
  5519. _("A list of the FlatCAM variables that can be used\n"
  5520. "in the Toolchange event.\n"
  5521. "They have to be surrounded by the '%' symbol")
  5522. )
  5523. hlay1.addWidget(self.tc_variable_combo)
  5524. # Populate the Combo Box
  5525. variables = [_('Parameters'), 'tool', 'tooldia', 't_drills', 'x_toolchange', 'y_toolchange', 'z_toolchange',
  5526. 'z_cut', 'z_move', 'z_depthpercut', 'spindlespeed', 'dwelltime']
  5527. self.tc_variable_combo.addItems(variables)
  5528. self.tc_variable_combo.setItemData(0, _("FlatCAM CNC parameters"), Qt.ToolTipRole)
  5529. self.tc_variable_combo.setItemData(1, _("tool = tool number"), Qt.ToolTipRole)
  5530. self.tc_variable_combo.setItemData(2, _("tooldia = tool diameter"), Qt.ToolTipRole)
  5531. self.tc_variable_combo.setItemData(3, _("t_drills = for Excellon, total number of drills"), Qt.ToolTipRole)
  5532. self.tc_variable_combo.setItemData(4, _("x_toolchange = X coord for Toolchange"), Qt.ToolTipRole)
  5533. self.tc_variable_combo.setItemData(5, _("y_toolchange = Y coord for Toolchange"), Qt.ToolTipRole)
  5534. self.tc_variable_combo.setItemData(6, _("z_toolchange = Z coord for Toolchange"), Qt.ToolTipRole)
  5535. self.tc_variable_combo.setItemData(7, _("z_cut = Z depth for the cut"), Qt.ToolTipRole)
  5536. self.tc_variable_combo.setItemData(8, _("z_move = Z height for travel"), Qt.ToolTipRole)
  5537. self.tc_variable_combo.setItemData(9, _("z_depthpercut = the step value for multidepth cut"), Qt.ToolTipRole)
  5538. self.tc_variable_combo.setItemData(10, _("spindlesspeed = the value for the spindle speed"), Qt.ToolTipRole)
  5539. self.tc_variable_combo.setItemData(11,
  5540. _("dwelltime = time to dwell to allow the spindle to reach it's set RPM"),
  5541. Qt.ToolTipRole)
  5542. hlay1.addStretch()
  5543. # Insert Variable into the Toolchange G-Code Text Box
  5544. # self.tc_insert_buton = FCButton("Insert")
  5545. # self.tc_insert_buton.setToolTip(
  5546. # "Insert the variable in the GCode Box\n"
  5547. # "surrounded by the '%' symbol."
  5548. # )
  5549. # hlay1.addWidget(self.tc_insert_buton)
  5550. grid0 = QtWidgets.QGridLayout()
  5551. self.layout.addLayout(grid0)
  5552. grid0.addWidget(QtWidgets.QLabel(''), 1, 0, 1, 2)
  5553. # Annotation Font Size
  5554. self.annotation_fontsize_label = QtWidgets.QLabel('%s:' % _("Annotation Size"))
  5555. self.annotation_fontsize_label.setToolTip(
  5556. _("The font size of the annotation text. In pixels.")
  5557. )
  5558. grid0.addWidget(self.annotation_fontsize_label, 2, 0)
  5559. self.annotation_fontsize_sp = FCSpinner()
  5560. grid0.addWidget(self.annotation_fontsize_sp, 2, 1)
  5561. grid0.addWidget(QtWidgets.QLabel(''), 2, 2)
  5562. # Annotation Font Color
  5563. self.annotation_color_label = QtWidgets.QLabel('%s:' % _('Annotation Color'))
  5564. self.annotation_color_label.setToolTip(
  5565. _("Set the font color for the annotation texts.")
  5566. )
  5567. self.annotation_fontcolor_entry = FCEntry()
  5568. self.annotation_fontcolor_button = QtWidgets.QPushButton()
  5569. self.annotation_fontcolor_button.setFixedSize(15, 15)
  5570. self.form_box_child = QtWidgets.QHBoxLayout()
  5571. self.form_box_child.setContentsMargins(0, 0, 0, 0)
  5572. self.form_box_child.addWidget(self.annotation_fontcolor_entry)
  5573. self.form_box_child.addWidget(self.annotation_fontcolor_button, alignment=Qt.AlignRight)
  5574. self.form_box_child.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  5575. color_widget = QtWidgets.QWidget()
  5576. color_widget.setLayout(self.form_box_child)
  5577. grid0.addWidget(self.annotation_color_label, 3, 0)
  5578. grid0.addWidget(color_widget, 3, 1)
  5579. grid0.addWidget(QtWidgets.QLabel(''), 3, 2)
  5580. self.layout.addStretch()
  5581. class ToolsNCCPrefGroupUI(OptionsGroupUI):
  5582. def __init__(self, parent=None):
  5583. # OptionsGroupUI.__init__(self, "NCC Tool Options", parent=parent)
  5584. super(ToolsNCCPrefGroupUI, self).__init__(self)
  5585. self.setTitle(str(_("NCC Tool Options")))
  5586. # ## Clear non-copper regions
  5587. self.clearcopper_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  5588. self.clearcopper_label.setToolTip(
  5589. _("Create a Geometry object with\n"
  5590. "toolpaths to cut all non-copper regions.")
  5591. )
  5592. self.layout.addWidget(self.clearcopper_label)
  5593. grid0 = QtWidgets.QGridLayout()
  5594. self.layout.addLayout(grid0)
  5595. ncctdlabel = QtWidgets.QLabel('%s:' % _('Tools dia'))
  5596. ncctdlabel.setToolTip(
  5597. _("Diameters of the cutting tools, separated by ','")
  5598. )
  5599. grid0.addWidget(ncctdlabel, 0, 0)
  5600. self.ncc_tool_dia_entry = FCEntry()
  5601. grid0.addWidget(self.ncc_tool_dia_entry, 0, 1)
  5602. # Tool Type Radio Button
  5603. self.tool_type_label = QtWidgets.QLabel('%s:' % _('Tool Type'))
  5604. self.tool_type_label.setToolTip(
  5605. _("Default tool type:\n"
  5606. "- 'V-shape'\n"
  5607. "- Circular")
  5608. )
  5609. self.tool_type_radio = RadioSet([{'label': _('V-shape'), 'value': 'V'},
  5610. {'label': _('Circular'), 'value': 'C1'}])
  5611. self.tool_type_radio.setToolTip(
  5612. _("Default tool type:\n"
  5613. "- 'V-shape'\n"
  5614. "- Circular")
  5615. )
  5616. grid0.addWidget(self.tool_type_label, 1, 0)
  5617. grid0.addWidget(self.tool_type_radio, 1, 1)
  5618. # Tip Dia
  5619. self.tipdialabel = QtWidgets.QLabel('%s:' % _('V-Tip Dia'))
  5620. self.tipdialabel.setToolTip(
  5621. _("The tip diameter for V-Shape Tool"))
  5622. self.tipdia_entry = LengthEntry()
  5623. grid0.addWidget(self.tipdialabel, 2, 0)
  5624. grid0.addWidget(self.tipdia_entry, 2, 1)
  5625. # Tip Angle
  5626. self.tipanglelabel = QtWidgets.QLabel('%s:' % _('V-Tip Angle'))
  5627. self.tipanglelabel.setToolTip(
  5628. _("The tip angle for V-Shape Tool.\n"
  5629. "In degree."))
  5630. self.tipangle_entry = LengthEntry()
  5631. grid0.addWidget(self.tipanglelabel, 3, 0)
  5632. grid0.addWidget(self.tipangle_entry, 3, 1)
  5633. # Milling Type Radio Button
  5634. self.milling_type_label = QtWidgets.QLabel('%s:' % _('Milling Type'))
  5635. self.milling_type_label.setToolTip(
  5636. _("Milling type when the selected tool is of type: 'iso_op':\n"
  5637. "- climb / best for precision milling and to reduce tool usage\n"
  5638. "- conventional / useful when there is no backlash compensation")
  5639. )
  5640. self.milling_type_radio = RadioSet([{'label': _('Climb'), 'value': 'cl'},
  5641. {'label': _('Conv.'), 'value': 'cv'}])
  5642. self.milling_type_radio.setToolTip(
  5643. _("Milling type when the selected tool is of type: 'iso_op':\n"
  5644. "- climb / best for precision milling and to reduce tool usage\n"
  5645. "- conventional / useful when there is no backlash compensation")
  5646. )
  5647. grid0.addWidget(self.milling_type_label, 4, 0)
  5648. grid0.addWidget(self.milling_type_radio, 4, 1)
  5649. # Tool order Radio Button
  5650. self.ncc_order_label = QtWidgets.QLabel('%s:' % _('Tool order'))
  5651. self.ncc_order_label.setToolTip(_("This set the way that the tools in the tools table are used.\n"
  5652. "'No' --> means that the used order is the one in the tool table\n"
  5653. "'Forward' --> means that the tools will be ordered from small to big\n"
  5654. "'Reverse' --> menas that the tools will ordered from big to small\n\n"
  5655. "WARNING: using rest machining will automatically set the order\n"
  5656. "in reverse and disable this control."))
  5657. self.ncc_order_radio = RadioSet([{'label': _('No'), 'value': 'no'},
  5658. {'label': _('Forward'), 'value': 'fwd'},
  5659. {'label': _('Reverse'), 'value': 'rev'}])
  5660. self.ncc_order_radio.setToolTip(_("This set the way that the tools in the tools table are used.\n"
  5661. "'No' --> means that the used order is the one in the tool table\n"
  5662. "'Forward' --> means that the tools will be ordered from small to big\n"
  5663. "'Reverse' --> menas that the tools will ordered from big to small\n\n"
  5664. "WARNING: using rest machining will automatically set the order\n"
  5665. "in reverse and disable this control."))
  5666. grid0.addWidget(self.ncc_order_label, 5, 0)
  5667. grid0.addWidget(self.ncc_order_radio, 5, 1)
  5668. # Cut Z entry
  5669. cutzlabel = QtWidgets.QLabel('%s:' % _('Cut Z'))
  5670. cutzlabel.setToolTip(
  5671. _("Depth of cut into material. Negative value.\n"
  5672. "In FlatCAM units.")
  5673. )
  5674. self.cutz_entry = FloatEntry()
  5675. self.cutz_entry.setToolTip(
  5676. _("Depth of cut into material. Negative value.\n"
  5677. "In FlatCAM units.")
  5678. )
  5679. grid0.addWidget(cutzlabel, 6, 0)
  5680. grid0.addWidget(self.cutz_entry, 6, 1)
  5681. # Overlap Entry
  5682. nccoverlabel = QtWidgets.QLabel('%s:' % _('Overlap Rate'))
  5683. nccoverlabel.setToolTip(
  5684. _("How much (fraction) of the tool width to overlap each tool pass.\n"
  5685. "Example:\n"
  5686. "A value here of 0.25 means 25%% from the tool diameter found above.\n\n"
  5687. "Adjust the value starting with lower values\n"
  5688. "and increasing it if areas that should be cleared are still \n"
  5689. "not cleared.\n"
  5690. "Lower values = faster processing, faster execution on PCB.\n"
  5691. "Higher values = slow processing and slow execution on CNC\n"
  5692. "due of too many paths.")
  5693. )
  5694. self.ncc_overlap_entry = FCDoubleSpinner()
  5695. self.ncc_overlap_entry.set_precision(3)
  5696. self.ncc_overlap_entry.setWrapping(True)
  5697. self.ncc_overlap_entry.setRange(0.000, 0.999)
  5698. self.ncc_overlap_entry.setSingleStep(0.1)
  5699. grid0.addWidget(nccoverlabel, 7, 0)
  5700. grid0.addWidget(self.ncc_overlap_entry, 7, 1)
  5701. # Margin entry
  5702. nccmarginlabel = QtWidgets.QLabel('%s:' % _('Margin'))
  5703. nccmarginlabel.setToolTip(
  5704. _("Bounding box margin.")
  5705. )
  5706. grid0.addWidget(nccmarginlabel, 8, 0)
  5707. self.ncc_margin_entry = FloatEntry()
  5708. grid0.addWidget(self.ncc_margin_entry, 8, 1)
  5709. # Method
  5710. methodlabel = QtWidgets.QLabel('%s:' % _('Method'))
  5711. methodlabel.setToolTip(
  5712. _("Algorithm for non-copper clearing:<BR>"
  5713. "<B>Standard</B>: Fixed step inwards.<BR>"
  5714. "<B>Seed-based</B>: Outwards from seed.<BR>"
  5715. "<B>Line-based</B>: Parallel lines.")
  5716. )
  5717. grid0.addWidget(methodlabel, 9, 0)
  5718. self.ncc_method_radio = RadioSet([
  5719. {"label": _("Standard"), "value": "standard"},
  5720. {"label": _("Seed-based"), "value": "seed"},
  5721. {"label": _("Straight lines"), "value": "lines"}
  5722. ], orientation='vertical', stretch=False)
  5723. grid0.addWidget(self.ncc_method_radio, 9, 1)
  5724. # Connect lines
  5725. pathconnectlabel = QtWidgets.QLabel('%s:' % _("Connect"))
  5726. pathconnectlabel.setToolTip(
  5727. _("Draw lines between resulting\n"
  5728. "segments to minimize tool lifts.")
  5729. )
  5730. grid0.addWidget(pathconnectlabel, 10, 0)
  5731. self.ncc_connect_cb = FCCheckBox()
  5732. grid0.addWidget(self.ncc_connect_cb, 10, 1)
  5733. # Contour Checkbox
  5734. contourlabel = QtWidgets.QLabel('%s:' % _("Contour"))
  5735. contourlabel.setToolTip(
  5736. _("Cut around the perimeter of the polygon\n"
  5737. "to trim rough edges.")
  5738. )
  5739. grid0.addWidget(contourlabel, 11, 0)
  5740. self.ncc_contour_cb = FCCheckBox()
  5741. grid0.addWidget(self.ncc_contour_cb, 11, 1)
  5742. # Rest machining CheckBox
  5743. restlabel = QtWidgets.QLabel('%s:' % _("Rest M."))
  5744. restlabel.setToolTip(
  5745. _("If checked, use 'rest machining'.\n"
  5746. "Basically it will clear copper outside PCB features,\n"
  5747. "using the biggest tool and continue with the next tools,\n"
  5748. "from bigger to smaller, to clear areas of copper that\n"
  5749. "could not be cleared by previous tool, until there is\n"
  5750. "no more copper to clear or there are no more tools.\n"
  5751. "If not checked, use the standard algorithm.")
  5752. )
  5753. grid0.addWidget(restlabel, 12, 0)
  5754. self.ncc_rest_cb = FCCheckBox()
  5755. grid0.addWidget(self.ncc_rest_cb, 12, 1)
  5756. # ## NCC Offset choice
  5757. self.ncc_offset_choice_label = QtWidgets.QLabel('%s:' % _("Offset"))
  5758. self.ncc_offset_choice_label.setToolTip(
  5759. _("If used, it will add an offset to the copper features.\n"
  5760. "The copper clearing will finish to a distance\n"
  5761. "from the copper features.\n"
  5762. "The value can be between 0 and 10 FlatCAM units.")
  5763. )
  5764. grid0.addWidget(self.ncc_offset_choice_label, 13, 0)
  5765. self.ncc_choice_offset_cb = FCCheckBox()
  5766. grid0.addWidget(self.ncc_choice_offset_cb, 13, 1)
  5767. # ## NCC Offset value
  5768. self.ncc_offset_label = QtWidgets.QLabel('%s:' % _("Offset value"))
  5769. self.ncc_offset_label.setToolTip(
  5770. _("If used, it will add an offset to the copper features.\n"
  5771. "The copper clearing will finish to a distance\n"
  5772. "from the copper features.\n"
  5773. "The value can be between 0 and 10 FlatCAM units.")
  5774. )
  5775. grid0.addWidget(self.ncc_offset_label, 14, 0)
  5776. self.ncc_offset_spinner = FCDoubleSpinner()
  5777. self.ncc_offset_spinner.set_range(0.00, 10.00)
  5778. self.ncc_offset_spinner.set_precision(4)
  5779. self.ncc_offset_spinner.setWrapping(True)
  5780. self.ncc_offset_spinner.setSingleStep(0.1)
  5781. grid0.addWidget(self.ncc_offset_spinner, 14, 1)
  5782. # ## Reference
  5783. self.reference_radio = RadioSet([{'label': _('Itself'), 'value': 'itself'},
  5784. {"label": _("Area"), "value": "area"},
  5785. {'label': _('Ref'), 'value': 'box'}])
  5786. reference_label = QtWidgets.QLabel('%s:' % _("Reference"))
  5787. reference_label.setToolTip(
  5788. _("- 'Itself' - the non copper clearing extent\n"
  5789. "is based on the object that is copper cleared.\n "
  5790. "- 'Area Selection' - left mouse click to start selection of the area to be painted.\n"
  5791. "Keeping a modifier key pressed (CTRL or SHIFT) will allow to add multiple areas.\n"
  5792. "- 'Reference Object' - will do non copper clearing within the area\n"
  5793. "specified by another object.")
  5794. )
  5795. grid0.addWidget(reference_label, 15, 0)
  5796. grid0.addWidget(self.reference_radio, 15, 1)
  5797. # ## Plotting type
  5798. self.ncc_plotting_radio = RadioSet([{'label': _('Normal'), 'value': 'normal'},
  5799. {"label": _("Progressive"), "value": "progressive"}])
  5800. plotting_label = QtWidgets.QLabel('%s:' % _("NCC Plotting"))
  5801. plotting_label.setToolTip(
  5802. _("- 'Normal' - normal plotting, done at the end of the NCC job\n"
  5803. "- 'Progressive' - after each shape is generated it will be plotted.")
  5804. )
  5805. grid0.addWidget(plotting_label, 16, 0)
  5806. grid0.addWidget(self.ncc_plotting_radio, 16, 1)
  5807. self.layout.addStretch()
  5808. class ToolsCutoutPrefGroupUI(OptionsGroupUI):
  5809. def __init__(self, parent=None):
  5810. # OptionsGroupUI.__init__(self, "Cutout Tool Options", parent=parent)
  5811. super(ToolsCutoutPrefGroupUI, self).__init__(self)
  5812. self.setTitle(str(_("Cutout Tool Options")))
  5813. # ## Board cuttout
  5814. self.board_cutout_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  5815. self.board_cutout_label.setToolTip(
  5816. _("Create toolpaths to cut around\n"
  5817. "the PCB and separate it from\n"
  5818. "the original board.")
  5819. )
  5820. self.layout.addWidget(self.board_cutout_label)
  5821. grid0 = QtWidgets.QGridLayout()
  5822. self.layout.addLayout(grid0)
  5823. tdclabel = QtWidgets.QLabel('%s:' % _('Tool dia'))
  5824. tdclabel.setToolTip(
  5825. _("Diameter of the tool used to cutout\n"
  5826. "the PCB shape out of the surrounding material.")
  5827. )
  5828. grid0.addWidget(tdclabel, 0, 0)
  5829. self.cutout_tooldia_entry = LengthEntry()
  5830. grid0.addWidget(self.cutout_tooldia_entry, 0, 1)
  5831. # Object kind
  5832. kindlabel = QtWidgets.QLabel('%s:' % _('Obj kind'))
  5833. kindlabel.setToolTip(
  5834. _("Choice of what kind the object we want to cutout is.<BR>"
  5835. "- <B>Single</B>: contain a single PCB Gerber outline object.<BR>"
  5836. "- <B>Panel</B>: a panel PCB Gerber object, which is made\n"
  5837. "out of many individual PCB outlines.")
  5838. )
  5839. grid0.addWidget(kindlabel, 1, 0)
  5840. self.obj_kind_combo = RadioSet([
  5841. {"label": _("Single"), "value": "single"},
  5842. {"label": _("Panel"), "value": "panel"},
  5843. ])
  5844. grid0.addWidget(self.obj_kind_combo, 1, 1)
  5845. marginlabel = QtWidgets.QLabel('%s:' % _('Margin'))
  5846. marginlabel.setToolTip(
  5847. _("Margin over bounds. A positive value here\n"
  5848. "will make the cutout of the PCB further from\n"
  5849. "the actual PCB border")
  5850. )
  5851. grid0.addWidget(marginlabel, 2, 0)
  5852. self.cutout_margin_entry = LengthEntry()
  5853. grid0.addWidget(self.cutout_margin_entry, 2, 1)
  5854. gaplabel = QtWidgets.QLabel('%s:' % _('Gap size'))
  5855. gaplabel.setToolTip(
  5856. _("The size of the bridge gaps in the cutout\n"
  5857. "used to keep the board connected to\n"
  5858. "the surrounding material (the one \n"
  5859. "from which the PCB is cutout).")
  5860. )
  5861. grid0.addWidget(gaplabel, 3, 0)
  5862. self.cutout_gap_entry = LengthEntry()
  5863. grid0.addWidget(self.cutout_gap_entry, 3, 1)
  5864. gaps_label = QtWidgets.QLabel('%s:' % _('Gaps'))
  5865. gaps_label.setToolTip(
  5866. _("Number of gaps used for the cutout.\n"
  5867. "There can be maximum 8 bridges/gaps.\n"
  5868. "The choices are:\n"
  5869. "- None - no gaps\n"
  5870. "- lr - left + right\n"
  5871. "- tb - top + bottom\n"
  5872. "- 4 - left + right +top + bottom\n"
  5873. "- 2lr - 2*left + 2*right\n"
  5874. "- 2tb - 2*top + 2*bottom\n"
  5875. "- 8 - 2*left + 2*right +2*top + 2*bottom")
  5876. )
  5877. grid0.addWidget(gaps_label, 4, 0)
  5878. self.gaps_combo = FCComboBox()
  5879. grid0.addWidget(self.gaps_combo, 4, 1)
  5880. gaps_items = ['None', 'LR', 'TB', '4', '2LR', '2TB', '8']
  5881. for it in gaps_items:
  5882. self.gaps_combo.addItem(it)
  5883. self.gaps_combo.setStyleSheet('background-color: rgb(255,255,255)')
  5884. # Surrounding convex box shape
  5885. self.convex_box = FCCheckBox()
  5886. self.convex_box_label = QtWidgets.QLabel('%s:' % _("Convex Sh."))
  5887. self.convex_box_label.setToolTip(
  5888. _("Create a convex shape surrounding the entire PCB.\n"
  5889. "Used only if the source object type is Gerber.")
  5890. )
  5891. grid0.addWidget(self.convex_box_label, 5, 0)
  5892. grid0.addWidget(self.convex_box, 5, 1)
  5893. self.layout.addStretch()
  5894. class Tools2sidedPrefGroupUI(OptionsGroupUI):
  5895. def __init__(self, parent=None):
  5896. # OptionsGroupUI.__init__(self, "2sided Tool Options", parent=parent)
  5897. super(Tools2sidedPrefGroupUI, self).__init__(self)
  5898. self.setTitle(str(_("2Sided Tool Options")))
  5899. # ## Board cuttout
  5900. self.dblsided_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  5901. self.dblsided_label.setToolTip(
  5902. _("A tool to help in creating a double sided\n"
  5903. "PCB using alignment holes.")
  5904. )
  5905. self.layout.addWidget(self.dblsided_label)
  5906. grid0 = QtWidgets.QGridLayout()
  5907. self.layout.addLayout(grid0)
  5908. # ## Drill diameter for alignment holes
  5909. self.drill_dia_entry = LengthEntry()
  5910. self.dd_label = QtWidgets.QLabel('%s:' % _("Drill dia"))
  5911. self.dd_label.setToolTip(
  5912. _("Diameter of the drill for the "
  5913. "alignment holes.")
  5914. )
  5915. grid0.addWidget(self.dd_label, 0, 0)
  5916. grid0.addWidget(self.drill_dia_entry, 0, 1)
  5917. # ## Axis
  5918. self.mirror_axis_radio = RadioSet([{'label': 'X', 'value': 'X'},
  5919. {'label': 'Y', 'value': 'Y'}])
  5920. self.mirax_label = QtWidgets.QLabel(_("Mirror Axis:"))
  5921. self.mirax_label.setToolTip(
  5922. _("Mirror vertically (X) or horizontally (Y).")
  5923. )
  5924. # grid_lay.addRow("Mirror Axis:", self.mirror_axis)
  5925. self.empty_lb1 = QtWidgets.QLabel("")
  5926. grid0.addWidget(self.empty_lb1, 1, 0)
  5927. grid0.addWidget(self.mirax_label, 2, 0)
  5928. grid0.addWidget(self.mirror_axis_radio, 2, 1)
  5929. # ## Axis Location
  5930. self.axis_location_radio = RadioSet([{'label': _('Point'), 'value': 'point'},
  5931. {'label': _('Box'), 'value': 'box'}])
  5932. self.axloc_label = QtWidgets.QLabel('%s:' % _("Axis Ref"))
  5933. self.axloc_label.setToolTip(
  5934. _("The axis should pass through a <b>point</b> or cut\n "
  5935. "a specified <b>box</b> (in a FlatCAM object) through \n"
  5936. "the center.")
  5937. )
  5938. # grid_lay.addRow("Axis Location:", self.axis_location)
  5939. grid0.addWidget(self.axloc_label, 3, 0)
  5940. grid0.addWidget(self.axis_location_radio, 3, 1)
  5941. self.layout.addStretch()
  5942. class ToolsPaintPrefGroupUI(OptionsGroupUI):
  5943. def __init__(self, parent=None):
  5944. # OptionsGroupUI.__init__(self, "Paint Area Tool Options", parent=parent)
  5945. super(ToolsPaintPrefGroupUI, self).__init__(self)
  5946. self.setTitle(str(_("Paint Tool Options")))
  5947. # ------------------------------
  5948. # ## Paint area
  5949. # ------------------------------
  5950. self.paint_label = QtWidgets.QLabel(_('<b>Parameters:</b>'))
  5951. self.paint_label.setToolTip(
  5952. _("Creates tool paths to cover the\n"
  5953. "whole area of a polygon (remove\n"
  5954. "all copper). You will be asked\n"
  5955. "to click on the desired polygon.")
  5956. )
  5957. self.layout.addWidget(self.paint_label)
  5958. grid0 = QtWidgets.QGridLayout()
  5959. self.layout.addLayout(grid0)
  5960. # Tool dia
  5961. ptdlabel = QtWidgets.QLabel('%s:' % _('Tool dia'))
  5962. ptdlabel.setToolTip(
  5963. _("Diameter of the tool to\n"
  5964. "be used in the operation.")
  5965. )
  5966. grid0.addWidget(ptdlabel, 0, 0)
  5967. self.painttooldia_entry = LengthEntry()
  5968. grid0.addWidget(self.painttooldia_entry, 0, 1)
  5969. self.paint_order_label = QtWidgets.QLabel('<b>%s:</b>' % _('Tool order'))
  5970. self.paint_order_label.setToolTip(_("This set the way that the tools in the tools table are used.\n"
  5971. "'No' --> means that the used order is the one in the tool table\n"
  5972. "'Forward' --> means that the tools will be ordered from small to big\n"
  5973. "'Reverse' --> menas that the tools will ordered from big to small\n\n"
  5974. "WARNING: using rest machining will automatically set the order\n"
  5975. "in reverse and disable this control."))
  5976. self.paint_order_radio = RadioSet([{'label': _('No'), 'value': 'no'},
  5977. {'label': _('Forward'), 'value': 'fwd'},
  5978. {'label': _('Reverse'), 'value': 'rev'}])
  5979. self.paint_order_radio.setToolTip(_("This set the way that the tools in the tools table are used.\n"
  5980. "'No' --> means that the used order is the one in the tool table\n"
  5981. "'Forward' --> means that the tools will be ordered from small to big\n"
  5982. "'Reverse' --> menas that the tools will ordered from big to small\n\n"
  5983. "WARNING: using rest machining will automatically set the order\n"
  5984. "in reverse and disable this control."))
  5985. grid0.addWidget(self.paint_order_label, 1, 0)
  5986. grid0.addWidget(self.paint_order_radio, 1, 1)
  5987. # Overlap
  5988. ovlabel = QtWidgets.QLabel('%s:' % _('Overlap Rate'))
  5989. ovlabel.setToolTip(
  5990. _("How much (fraction) of the tool width to overlap each tool pass.\n"
  5991. "Example:\n"
  5992. "A value here of 0.25 means 25%% from the tool diameter found above.\n\n"
  5993. "Adjust the value starting with lower values\n"
  5994. "and increasing it if areas that should be painted are still \n"
  5995. "not painted.\n"
  5996. "Lower values = faster processing, faster execution on PCB.\n"
  5997. "Higher values = slow processing and slow execution on CNC\n"
  5998. "due of too many paths.")
  5999. )
  6000. self.paintoverlap_entry = FCDoubleSpinner()
  6001. self.paintoverlap_entry.set_precision(3)
  6002. self.paintoverlap_entry.setWrapping(True)
  6003. self.paintoverlap_entry.setRange(0.000, 0.999)
  6004. self.paintoverlap_entry.setSingleStep(0.1)
  6005. grid0.addWidget(ovlabel, 2, 0)
  6006. grid0.addWidget(self.paintoverlap_entry, 2, 1)
  6007. # Margin
  6008. marginlabel = QtWidgets.QLabel('%s:' % _('Margin'))
  6009. marginlabel.setToolTip(
  6010. _("Distance by which to avoid\n"
  6011. "the edges of the polygon to\n"
  6012. "be painted.")
  6013. )
  6014. grid0.addWidget(marginlabel, 3, 0)
  6015. self.paintmargin_entry = LengthEntry()
  6016. grid0.addWidget(self.paintmargin_entry, 3, 1)
  6017. # Method
  6018. methodlabel = QtWidgets.QLabel('%s:' % _('Method'))
  6019. methodlabel.setToolTip(
  6020. _("Algorithm for non-copper clearing:<BR>"
  6021. "<B>Standard</B>: Fixed step inwards.<BR>"
  6022. "<B>Seed-based</B>: Outwards from seed.<BR>"
  6023. "<B>Line-based</B>: Parallel lines.")
  6024. )
  6025. grid0.addWidget(methodlabel, 4, 0)
  6026. self.paintmethod_combo = RadioSet([
  6027. {"label": _("Standard"), "value": "standard"},
  6028. {"label": _("Seed-based"), "value": "seed"},
  6029. {"label": _("Straight lines"), "value": "lines"}
  6030. ], orientation='vertical', stretch=False)
  6031. grid0.addWidget(self.paintmethod_combo, 4, 1)
  6032. # Connect lines
  6033. pathconnectlabel = QtWidgets.QLabel('%s:' % _("Connect"))
  6034. pathconnectlabel.setToolTip(
  6035. _("Draw lines between resulting\n"
  6036. "segments to minimize tool lifts.")
  6037. )
  6038. grid0.addWidget(pathconnectlabel, 5, 0)
  6039. self.pathconnect_cb = FCCheckBox()
  6040. grid0.addWidget(self.pathconnect_cb, 5, 1)
  6041. # Paint contour
  6042. contourlabel = QtWidgets.QLabel('%s:' % _("Contour"))
  6043. contourlabel.setToolTip(
  6044. _("Cut around the perimeter of the polygon\n"
  6045. "to trim rough edges.")
  6046. )
  6047. grid0.addWidget(contourlabel, 6, 0)
  6048. self.contour_cb = FCCheckBox()
  6049. grid0.addWidget(self.contour_cb, 6, 1)
  6050. # Polygon selection
  6051. selectlabel = QtWidgets.QLabel('%s:' % _('Selection'))
  6052. selectlabel.setToolTip(
  6053. _("How to select Polygons to be painted.\n\n"
  6054. "- 'Area Selection' - left mouse click to start selection of the area to be painted.\n"
  6055. "Keeping a modifier key pressed (CTRL or SHIFT) will allow to add multiple areas.\n"
  6056. "- 'All Polygons' - the Paint will start after click.\n"
  6057. "- 'Reference Object' - will do non copper clearing within the area\n"
  6058. "specified by another object.")
  6059. )
  6060. self.selectmethod_combo = RadioSet([
  6061. {"label": _("Single"), "value": "single"},
  6062. {"label": _("Area"), "value": "area"},
  6063. {"label": _("All"), "value": "all"},
  6064. {"label": _("Ref."), "value": "ref"}
  6065. ])
  6066. grid0.addWidget(selectlabel, 7, 0)
  6067. grid0.addWidget(self.selectmethod_combo, 7, 1)
  6068. # ## Plotting type
  6069. self.paint_plotting_radio = RadioSet([{'label': _('Normal'), 'value': 'normal'},
  6070. {"label": _("Progressive"), "value": "progressive"}])
  6071. plotting_label = QtWidgets.QLabel('%s:' % _("Paint Plotting"))
  6072. plotting_label.setToolTip(
  6073. _("- 'Normal' - normal plotting, done at the end of the Paint job\n"
  6074. "- 'Progressive' - after each shape is generated it will be plotted.")
  6075. )
  6076. grid0.addWidget(plotting_label, 8, 0)
  6077. grid0.addWidget(self.paint_plotting_radio, 8, 1)
  6078. self.layout.addStretch()
  6079. class ToolsFilmPrefGroupUI(OptionsGroupUI):
  6080. def __init__(self, parent=None):
  6081. # OptionsGroupUI.__init__(self, "Cutout Tool Options", parent=parent)
  6082. super(ToolsFilmPrefGroupUI, self).__init__(self)
  6083. self.setTitle(str(_("Film Tool Options")))
  6084. # ## Board cuttout
  6085. self.film_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  6086. self.film_label.setToolTip(
  6087. _("Create a PCB film from a Gerber or Geometry\n"
  6088. "FlatCAM object.\n"
  6089. "The file is saved in SVG format.")
  6090. )
  6091. self.layout.addWidget(self.film_label)
  6092. grid0 = QtWidgets.QGridLayout()
  6093. self.layout.addLayout(grid0)
  6094. self.film_type_radio = RadioSet([{'label': 'Pos', 'value': 'pos'},
  6095. {'label': 'Neg', 'value': 'neg'}])
  6096. ftypelbl = QtWidgets.QLabel('%s:' % _('Film Type'))
  6097. ftypelbl.setToolTip(
  6098. _("Generate a Positive black film or a Negative film.\n"
  6099. "Positive means that it will print the features\n"
  6100. "with black on a white canvas.\n"
  6101. "Negative means that it will print the features\n"
  6102. "with white on a black canvas.\n"
  6103. "The Film format is SVG.")
  6104. )
  6105. grid0.addWidget(ftypelbl, 0, 0)
  6106. grid0.addWidget(self.film_type_radio, 0, 1)
  6107. # Film Color
  6108. self.film_color_label = QtWidgets.QLabel('%s:' % _('Film Color'))
  6109. self.film_color_label.setToolTip(
  6110. _("Set the film color when positive film is selected.")
  6111. )
  6112. self.film_color_entry = FCEntry()
  6113. self.film_color_button = QtWidgets.QPushButton()
  6114. self.film_color_button.setFixedSize(15, 15)
  6115. self.form_box_child = QtWidgets.QHBoxLayout()
  6116. self.form_box_child.setContentsMargins(0, 0, 0, 0)
  6117. self.form_box_child.addWidget(self.film_color_entry)
  6118. self.form_box_child.addWidget(self.film_color_button, alignment=Qt.AlignRight)
  6119. self.form_box_child.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  6120. film_color_widget = QtWidgets.QWidget()
  6121. film_color_widget.setLayout(self.form_box_child)
  6122. grid0.addWidget(self.film_color_label, 1, 0)
  6123. grid0.addWidget(film_color_widget, 1, 1)
  6124. self.film_boundary_entry = FCEntry()
  6125. self.film_boundary_label = QtWidgets.QLabel('%s:' % _("Border"))
  6126. self.film_boundary_label.setToolTip(
  6127. _("Specify a border around the object.\n"
  6128. "Only for negative film.\n"
  6129. "It helps if we use as a Box Object the same \n"
  6130. "object as in Film Object. It will create a thick\n"
  6131. "black bar around the actual print allowing for a\n"
  6132. "better delimitation of the outline features which are of\n"
  6133. "white color like the rest and which may confound with the\n"
  6134. "surroundings if not for this border.")
  6135. )
  6136. grid0.addWidget(self.film_boundary_label, 2, 0)
  6137. grid0.addWidget(self.film_boundary_entry, 2, 1)
  6138. self.film_scale_entry = FCEntry()
  6139. self.film_scale_label = QtWidgets.QLabel('%s:' % _("Scale Stroke"))
  6140. self.film_scale_label.setToolTip(
  6141. _("Scale the line stroke thickness of each feature in the SVG file.\n"
  6142. "It means that the line that envelope each SVG feature will be thicker or thinner,\n"
  6143. "therefore the fine features may be more affected by this parameter.")
  6144. )
  6145. grid0.addWidget(self.film_scale_label, 3, 0)
  6146. grid0.addWidget(self.film_scale_entry, 3, 1)
  6147. self.layout.addStretch()
  6148. class ToolsPanelizePrefGroupUI(OptionsGroupUI):
  6149. def __init__(self, parent=None):
  6150. # OptionsGroupUI.__init__(self, "Cutout Tool Options", parent=parent)
  6151. super(ToolsPanelizePrefGroupUI, self).__init__(self)
  6152. self.setTitle(str(_("Panelize Tool Options")))
  6153. # ## Board cuttout
  6154. self.panelize_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  6155. self.panelize_label.setToolTip(
  6156. _("Create an object that contains an array of (x, y) elements,\n"
  6157. "each element is a copy of the source object spaced\n"
  6158. "at a X distance, Y distance of each other.")
  6159. )
  6160. self.layout.addWidget(self.panelize_label)
  6161. grid0 = QtWidgets.QGridLayout()
  6162. self.layout.addLayout(grid0)
  6163. # ## Spacing Columns
  6164. self.pspacing_columns = FCEntry()
  6165. self.spacing_columns_label = QtWidgets.QLabel('%s:' % _("Spacing cols"))
  6166. self.spacing_columns_label.setToolTip(
  6167. _("Spacing between columns of the desired panel.\n"
  6168. "In current units.")
  6169. )
  6170. grid0.addWidget(self.spacing_columns_label, 0, 0)
  6171. grid0.addWidget(self.pspacing_columns, 0, 1)
  6172. # ## Spacing Rows
  6173. self.pspacing_rows = FCEntry()
  6174. self.spacing_rows_label = QtWidgets.QLabel('%s:' % _("Spacing rows"))
  6175. self.spacing_rows_label.setToolTip(
  6176. _("Spacing between rows of the desired panel.\n"
  6177. "In current units.")
  6178. )
  6179. grid0.addWidget(self.spacing_rows_label, 1, 0)
  6180. grid0.addWidget(self.pspacing_rows, 1, 1)
  6181. # ## Columns
  6182. self.pcolumns = FCEntry()
  6183. self.columns_label = QtWidgets.QLabel('%s:' % _("Columns"))
  6184. self.columns_label.setToolTip(
  6185. _("Number of columns of the desired panel")
  6186. )
  6187. grid0.addWidget(self.columns_label, 2, 0)
  6188. grid0.addWidget(self.pcolumns, 2, 1)
  6189. # ## Rows
  6190. self.prows = FCEntry()
  6191. self.rows_label = QtWidgets.QLabel('%s:' % _("Rows"))
  6192. self.rows_label.setToolTip(
  6193. _("Number of rows of the desired panel")
  6194. )
  6195. grid0.addWidget(self.rows_label, 3, 0)
  6196. grid0.addWidget(self.prows, 3, 1)
  6197. # ## Type of resulting Panel object
  6198. self.panel_type_radio = RadioSet([{'label': _('Gerber'), 'value': 'gerber'},
  6199. {'label': _('Geo'), 'value': 'geometry'}])
  6200. self.panel_type_label = QtWidgets.QLabel('%s:' % _("Panel Type"))
  6201. self.panel_type_label.setToolTip(
  6202. _("Choose the type of object for the panel object:\n"
  6203. "- Gerber\n"
  6204. "- Geometry")
  6205. )
  6206. grid0.addWidget(self.panel_type_label, 4, 0)
  6207. grid0.addWidget(self.panel_type_radio, 4, 1)
  6208. # ## Constrains
  6209. self.pconstrain_cb = FCCheckBox('%s:' % _("Constrain within"))
  6210. self.pconstrain_cb.setToolTip(
  6211. _("Area define by DX and DY within to constrain the panel.\n"
  6212. "DX and DY values are in current units.\n"
  6213. "Regardless of how many columns and rows are desired,\n"
  6214. "the final panel will have as many columns and rows as\n"
  6215. "they fit completely within selected area.")
  6216. )
  6217. grid0.addWidget(self.pconstrain_cb, 5, 0)
  6218. self.px_width_entry = FCEntry()
  6219. self.x_width_lbl = QtWidgets.QLabel('%s:' % _("Width (DX)"))
  6220. self.x_width_lbl.setToolTip(
  6221. _("The width (DX) within which the panel must fit.\n"
  6222. "In current units.")
  6223. )
  6224. grid0.addWidget(self.x_width_lbl, 6, 0)
  6225. grid0.addWidget(self.px_width_entry, 6, 1)
  6226. self.py_height_entry = FCEntry()
  6227. self.y_height_lbl = QtWidgets.QLabel('%s:' % _("Height (DY)"))
  6228. self.y_height_lbl.setToolTip(
  6229. _("The height (DY)within which the panel must fit.\n"
  6230. "In current units.")
  6231. )
  6232. grid0.addWidget(self.y_height_lbl, 7, 0)
  6233. grid0.addWidget(self.py_height_entry, 7, 1)
  6234. self.layout.addStretch()
  6235. class ToolsCalculatorsPrefGroupUI(OptionsGroupUI):
  6236. def __init__(self, parent=None):
  6237. # OptionsGroupUI.__init__(self, "Calculators Tool Options", parent=parent)
  6238. super(ToolsCalculatorsPrefGroupUI, self).__init__(self)
  6239. self.setTitle(str(_("Calculators Tool Options")))
  6240. # ## V-shape Calculator Tool
  6241. self.vshape_tool_label = QtWidgets.QLabel("<b>%s:</b>" % _("V-Shape Tool Calculator"))
  6242. self.vshape_tool_label.setToolTip(
  6243. _("Calculate the tool diameter for a given V-shape tool,\n"
  6244. "having the tip diameter, tip angle and\n"
  6245. "depth-of-cut as parameters.")
  6246. )
  6247. self.layout.addWidget(self.vshape_tool_label)
  6248. grid0 = QtWidgets.QGridLayout()
  6249. self.layout.addLayout(grid0)
  6250. # ## Tip Diameter
  6251. self.tip_dia_entry = FCEntry()
  6252. self.tip_dia_label = QtWidgets.QLabel('%s:' % _("Tip Diameter"))
  6253. self.tip_dia_label.setToolTip(
  6254. _("This is the tool tip diameter.\n"
  6255. "It is specified by manufacturer.")
  6256. )
  6257. grid0.addWidget(self.tip_dia_label, 0, 0)
  6258. grid0.addWidget(self.tip_dia_entry, 0, 1)
  6259. # ## Tip angle
  6260. self.tip_angle_entry = FCEntry()
  6261. self.tip_angle_label = QtWidgets.QLabel('%s:' % _("Tip Angle"))
  6262. self.tip_angle_label.setToolTip(
  6263. _("This is the angle on the tip of the tool.\n"
  6264. "It is specified by manufacturer.")
  6265. )
  6266. grid0.addWidget(self.tip_angle_label, 1, 0)
  6267. grid0.addWidget(self.tip_angle_entry, 1, 1)
  6268. # ## Depth-of-cut Cut Z
  6269. self.cut_z_entry = FCEntry()
  6270. self.cut_z_label = QtWidgets.QLabel('%s:' % _("Cut Z"))
  6271. self.cut_z_label.setToolTip(
  6272. _("This is depth to cut into material.\n"
  6273. "In the CNCJob object it is the CutZ parameter.")
  6274. )
  6275. grid0.addWidget(self.cut_z_label, 2, 0)
  6276. grid0.addWidget(self.cut_z_entry, 2, 1)
  6277. # ## Electroplating Calculator Tool
  6278. self.plate_title_label = QtWidgets.QLabel("<b>%s:</b>" % _("ElectroPlating Calculator"))
  6279. self.plate_title_label.setToolTip(
  6280. _("This calculator is useful for those who plate the via/pad/drill holes,\n"
  6281. "using a method like grahite ink or calcium hypophosphite ink or palladium chloride.")
  6282. )
  6283. self.layout.addWidget(self.plate_title_label)
  6284. grid1 = QtWidgets.QGridLayout()
  6285. self.layout.addLayout(grid1)
  6286. # ## PCB Length
  6287. self.pcblength_entry = FCEntry()
  6288. self.pcblengthlabel = QtWidgets.QLabel('%s:' % _("Board Length"))
  6289. self.pcblengthlabel.setToolTip(_('This is the board length. In centimeters.'))
  6290. grid1.addWidget(self.pcblengthlabel, 0, 0)
  6291. grid1.addWidget(self.pcblength_entry, 0, 1)
  6292. # ## PCB Width
  6293. self.pcbwidth_entry = FCEntry()
  6294. self.pcbwidthlabel = QtWidgets.QLabel('%s:' % _("Board Width"))
  6295. self.pcbwidthlabel.setToolTip(_('This is the board width.In centimeters.'))
  6296. grid1.addWidget(self.pcbwidthlabel, 1, 0)
  6297. grid1.addWidget(self.pcbwidth_entry, 1, 1)
  6298. # ## Current Density
  6299. self.cdensity_label = QtWidgets.QLabel('%s:' % _("Current Density"))
  6300. self.cdensity_entry = FCEntry()
  6301. self.cdensity_label.setToolTip(_("Current density to pass through the board. \n"
  6302. "In Amps per Square Feet ASF."))
  6303. grid1.addWidget(self.cdensity_label, 2, 0)
  6304. grid1.addWidget(self.cdensity_entry, 2, 1)
  6305. # ## PCB Copper Growth
  6306. self.growth_label = QtWidgets.QLabel('%s:' % _("Copper Growth"))
  6307. self.growth_entry = FCEntry()
  6308. self.growth_label.setToolTip(_("How thick the copper growth is intended to be.\n"
  6309. "In microns."))
  6310. grid1.addWidget(self.growth_label, 3, 0)
  6311. grid1.addWidget(self.growth_entry, 3, 1)
  6312. self.layout.addStretch()
  6313. class ToolsTransformPrefGroupUI(OptionsGroupUI):
  6314. def __init__(self, parent=None):
  6315. super(ToolsTransformPrefGroupUI, self).__init__(self)
  6316. self.setTitle(str(_("Transform Tool Options")))
  6317. # ## Transformations
  6318. self.transform_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  6319. self.transform_label.setToolTip(
  6320. _("Various transformations that can be applied\n"
  6321. "on a FlatCAM object.")
  6322. )
  6323. self.layout.addWidget(self.transform_label)
  6324. grid0 = QtWidgets.QGridLayout()
  6325. self.layout.addLayout(grid0)
  6326. # ## Rotate Angle
  6327. self.rotate_entry = FCEntry()
  6328. self.rotate_label = QtWidgets.QLabel('%s:' % _("Rotate Angle"))
  6329. self.rotate_label.setToolTip(
  6330. _("Angle for Rotation action, in degrees.\n"
  6331. "Float number between -360 and 359.\n"
  6332. "Positive numbers for CW motion.\n"
  6333. "Negative numbers for CCW motion.")
  6334. )
  6335. grid0.addWidget(self.rotate_label, 0, 0)
  6336. grid0.addWidget(self.rotate_entry, 0, 1)
  6337. # ## Skew/Shear Angle on X axis
  6338. self.skewx_entry = FCEntry()
  6339. self.skewx_label = QtWidgets.QLabel('%s:' % _("Skew_X angle"))
  6340. self.skewx_label.setToolTip(
  6341. _("Angle for Skew action, in degrees.\n"
  6342. "Float number between -360 and 359.")
  6343. )
  6344. grid0.addWidget(self.skewx_label, 1, 0)
  6345. grid0.addWidget(self.skewx_entry, 1, 1)
  6346. # ## Skew/Shear Angle on Y axis
  6347. self.skewy_entry = FCEntry()
  6348. self.skewy_label = QtWidgets.QLabel('%s:' % _("Skew_Y angle"))
  6349. self.skewy_label.setToolTip(
  6350. _("Angle for Skew action, in degrees.\n"
  6351. "Float number between -360 and 359.")
  6352. )
  6353. grid0.addWidget(self.skewy_label, 2, 0)
  6354. grid0.addWidget(self.skewy_entry, 2, 1)
  6355. # ## Scale factor on X axis
  6356. self.scalex_entry = FCEntry()
  6357. self.scalex_label = QtWidgets.QLabel('%s:' % _("Scale_X factor"))
  6358. self.scalex_label.setToolTip(
  6359. _("Factor for scaling on X axis.")
  6360. )
  6361. grid0.addWidget(self.scalex_label, 3, 0)
  6362. grid0.addWidget(self.scalex_entry, 3, 1)
  6363. # ## Scale factor on X axis
  6364. self.scaley_entry = FCEntry()
  6365. self.scaley_label = QtWidgets.QLabel('%s:' % _("Scale_Y factor"))
  6366. self.scaley_label.setToolTip(
  6367. _("Factor for scaling on Y axis.")
  6368. )
  6369. grid0.addWidget(self.scaley_label, 4, 0)
  6370. grid0.addWidget(self.scaley_entry, 4, 1)
  6371. # ## Link Scale factors
  6372. self.link_cb = FCCheckBox(_("Link"))
  6373. self.link_cb.setToolTip(
  6374. _("Scale the selected object(s)\n"
  6375. "using the Scale_X factor for both axis.")
  6376. )
  6377. grid0.addWidget(self.link_cb, 5, 0)
  6378. # ## Scale Reference
  6379. self.reference_cb = FCCheckBox('%s' % _("Scale Reference"))
  6380. self.reference_cb.setToolTip(
  6381. _("Scale the selected object(s)\n"
  6382. "using the origin reference when checked,\n"
  6383. "and the center of the biggest bounding box\n"
  6384. "of the selected objects when unchecked.")
  6385. )
  6386. grid0.addWidget(self.reference_cb, 5, 1)
  6387. # ## Offset distance on X axis
  6388. self.offx_entry = FCEntry()
  6389. self.offx_label = QtWidgets.QLabel('%s:' % _("Offset_X val"))
  6390. self.offx_label.setToolTip(
  6391. _("Distance to offset on X axis. In current units.")
  6392. )
  6393. grid0.addWidget(self.offx_label, 6, 0)
  6394. grid0.addWidget(self.offx_entry, 6, 1)
  6395. # ## Offset distance on Y axis
  6396. self.offy_entry = FCEntry()
  6397. self.offy_label = QtWidgets.QLabel('%s:' % _("Offset_Y val"))
  6398. self.offy_label.setToolTip(
  6399. _("Distance to offset on Y axis. In current units.")
  6400. )
  6401. grid0.addWidget(self.offy_label, 7, 0)
  6402. grid0.addWidget(self.offy_entry, 7, 1)
  6403. # ## Mirror (Flip) Reference Point
  6404. self.mirror_reference_cb = FCCheckBox('%s' % _("Mirror Reference"))
  6405. self.mirror_reference_cb.setToolTip(
  6406. _("Flip the selected object(s)\n"
  6407. "around the point in Point Entry Field.\n"
  6408. "\n"
  6409. "The point coordinates can be captured by\n"
  6410. "left click on canvas together with pressing\n"
  6411. "SHIFT key. \n"
  6412. "Then click Add button to insert coordinates.\n"
  6413. "Or enter the coords in format (x, y) in the\n"
  6414. "Point Entry field and click Flip on X(Y)"))
  6415. grid0.addWidget(self.mirror_reference_cb, 8, 1)
  6416. self.flip_ref_label = QtWidgets.QLabel('%s:' % _(" Mirror Ref. Point"))
  6417. self.flip_ref_label.setToolTip(
  6418. _("Coordinates in format (x, y) used as reference for mirroring.\n"
  6419. "The 'x' in (x, y) will be used when using Flip on X and\n"
  6420. "the 'y' in (x, y) will be used when using Flip on Y and")
  6421. )
  6422. self.flip_ref_entry = EvalEntry2("(0, 0)")
  6423. grid0.addWidget(self.flip_ref_label, 9, 0)
  6424. grid0.addWidget(self.flip_ref_entry, 9, 1)
  6425. self.layout.addStretch()
  6426. class ToolsSolderpastePrefGroupUI(OptionsGroupUI):
  6427. def __init__(self, parent=None):
  6428. super(ToolsSolderpastePrefGroupUI, self).__init__(self)
  6429. self.setTitle(str(_("SolderPaste Tool Options")))
  6430. # ## Solder Paste Dispensing
  6431. self.solderpastelabel = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  6432. self.solderpastelabel.setToolTip(
  6433. _("A tool to create GCode for dispensing\n"
  6434. "solder paste onto a PCB.")
  6435. )
  6436. self.layout.addWidget(self.solderpastelabel)
  6437. grid0 = QtWidgets.QGridLayout()
  6438. self.layout.addLayout(grid0)
  6439. # Nozzle Tool Diameters
  6440. nozzletdlabel = QtWidgets.QLabel('%s:' % _('Tools dia'))
  6441. nozzletdlabel.setToolTip(
  6442. _("Diameters of nozzle tools, separated by ','")
  6443. )
  6444. self.nozzle_tool_dia_entry = FCEntry()
  6445. grid0.addWidget(nozzletdlabel, 0, 0)
  6446. grid0.addWidget(self.nozzle_tool_dia_entry, 0, 1)
  6447. # New Nozzle Tool Dia
  6448. self.addtool_entry_lbl = QtWidgets.QLabel('<b>%s:</b>' % _('New Nozzle Dia'))
  6449. self.addtool_entry_lbl.setToolTip(
  6450. _("Diameter for the new Nozzle tool to add in the Tool Table")
  6451. )
  6452. self.addtool_entry = FCEntry()
  6453. grid0.addWidget(self.addtool_entry_lbl, 1, 0)
  6454. grid0.addWidget(self.addtool_entry, 1, 1)
  6455. # Z dispense start
  6456. self.z_start_entry = FCEntry()
  6457. self.z_start_label = QtWidgets.QLabel('%s:' % _("Z Dispense Start"))
  6458. self.z_start_label.setToolTip(
  6459. _("The height (Z) when solder paste dispensing starts.")
  6460. )
  6461. grid0.addWidget(self.z_start_label, 2, 0)
  6462. grid0.addWidget(self.z_start_entry, 2, 1)
  6463. # Z dispense
  6464. self.z_dispense_entry = FCEntry()
  6465. self.z_dispense_label = QtWidgets.QLabel('%s:' % _("Z Dispense"))
  6466. self.z_dispense_label.setToolTip(
  6467. _("The height (Z) when doing solder paste dispensing.")
  6468. )
  6469. grid0.addWidget(self.z_dispense_label, 3, 0)
  6470. grid0.addWidget(self.z_dispense_entry, 3, 1)
  6471. # Z dispense stop
  6472. self.z_stop_entry = FCEntry()
  6473. self.z_stop_label = QtWidgets.QLabel('%s:' % _("Z Dispense Stop"))
  6474. self.z_stop_label.setToolTip(
  6475. _("The height (Z) when solder paste dispensing stops.")
  6476. )
  6477. grid0.addWidget(self.z_stop_label, 4, 0)
  6478. grid0.addWidget(self.z_stop_entry, 4, 1)
  6479. # Z travel
  6480. self.z_travel_entry = FCEntry()
  6481. self.z_travel_label = QtWidgets.QLabel('%s:' % _("Z Travel"))
  6482. self.z_travel_label.setToolTip(
  6483. _("The height (Z) for travel between pads\n"
  6484. "(without dispensing solder paste).")
  6485. )
  6486. grid0.addWidget(self.z_travel_label, 5, 0)
  6487. grid0.addWidget(self.z_travel_entry, 5, 1)
  6488. # Z toolchange location
  6489. self.z_toolchange_entry = FCEntry()
  6490. self.z_toolchange_label = QtWidgets.QLabel('%s:' % _("Z Toolchange"))
  6491. self.z_toolchange_label.setToolTip(
  6492. _("The height (Z) for tool (nozzle) change.")
  6493. )
  6494. grid0.addWidget(self.z_toolchange_label, 6, 0)
  6495. grid0.addWidget(self.z_toolchange_entry, 6, 1)
  6496. # X,Y Toolchange location
  6497. self.xy_toolchange_entry = FCEntry()
  6498. self.xy_toolchange_label = QtWidgets.QLabel('%s:' % _("Toolchange X-Y"))
  6499. self.xy_toolchange_label.setToolTip(
  6500. _("The X,Y location for tool (nozzle) change.\n"
  6501. "The format is (x, y) where x and y are real numbers.")
  6502. )
  6503. grid0.addWidget(self.xy_toolchange_label, 7, 0)
  6504. grid0.addWidget(self.xy_toolchange_entry, 7, 1)
  6505. # Feedrate X-Y
  6506. self.frxy_entry = FCEntry()
  6507. self.frxy_label = QtWidgets.QLabel('%s:' % _("Feedrate X-Y"))
  6508. self.frxy_label.setToolTip(
  6509. _("Feedrate (speed) while moving on the X-Y plane.")
  6510. )
  6511. grid0.addWidget(self.frxy_label, 8, 0)
  6512. grid0.addWidget(self.frxy_entry, 8, 1)
  6513. # Feedrate Z
  6514. self.frz_entry = FCEntry()
  6515. self.frz_label = QtWidgets.QLabel('%s:' % _("Feedrate Z"))
  6516. self.frz_label.setToolTip(
  6517. _("Feedrate (speed) while moving vertically\n"
  6518. "(on Z plane).")
  6519. )
  6520. grid0.addWidget(self.frz_label, 9, 0)
  6521. grid0.addWidget(self.frz_entry, 9, 1)
  6522. # Feedrate Z Dispense
  6523. self.frz_dispense_entry = FCEntry()
  6524. self.frz_dispense_label = QtWidgets.QLabel('%s:' % _("Feedrate Z Dispense"))
  6525. self.frz_dispense_label.setToolTip(
  6526. _("Feedrate (speed) while moving up vertically\n"
  6527. "to Dispense position (on Z plane).")
  6528. )
  6529. grid0.addWidget(self.frz_dispense_label, 10, 0)
  6530. grid0.addWidget(self.frz_dispense_entry, 10, 1)
  6531. # Spindle Speed Forward
  6532. self.speedfwd_entry = FCEntry()
  6533. self.speedfwd_label = QtWidgets.QLabel('%s:' % _("Spindle Speed FWD"))
  6534. self.speedfwd_label.setToolTip(
  6535. _("The dispenser speed while pushing solder paste\n"
  6536. "through the dispenser nozzle.")
  6537. )
  6538. grid0.addWidget(self.speedfwd_label, 11, 0)
  6539. grid0.addWidget(self.speedfwd_entry, 11, 1)
  6540. # Dwell Forward
  6541. self.dwellfwd_entry = FCEntry()
  6542. self.dwellfwd_label = QtWidgets.QLabel('%s:' % _("Dwell FWD"))
  6543. self.dwellfwd_label.setToolTip(
  6544. _("Pause after solder dispensing.")
  6545. )
  6546. grid0.addWidget(self.dwellfwd_label, 12, 0)
  6547. grid0.addWidget(self.dwellfwd_entry, 12, 1)
  6548. # Spindle Speed Reverse
  6549. self.speedrev_entry = FCEntry()
  6550. self.speedrev_label = QtWidgets.QLabel('%s:' % _("Spindle Speed REV"))
  6551. self.speedrev_label.setToolTip(
  6552. _("The dispenser speed while retracting solder paste\n"
  6553. "through the dispenser nozzle.")
  6554. )
  6555. grid0.addWidget(self.speedrev_label, 13, 0)
  6556. grid0.addWidget(self.speedrev_entry, 13, 1)
  6557. # Dwell Reverse
  6558. self.dwellrev_entry = FCEntry()
  6559. self.dwellrev_label = QtWidgets.QLabel('%s:' % _("Dwell REV"))
  6560. self.dwellrev_label.setToolTip(
  6561. _("Pause after solder paste dispenser retracted,\n"
  6562. "to allow pressure equilibrium.")
  6563. )
  6564. grid0.addWidget(self.dwellrev_label, 14, 0)
  6565. grid0.addWidget(self.dwellrev_entry, 14, 1)
  6566. # Postprocessors
  6567. pp_label = QtWidgets.QLabel('%s:' % _('PostProcessor'))
  6568. pp_label.setToolTip(
  6569. _("Files that control the GCode generation.")
  6570. )
  6571. self.pp_combo = FCComboBox()
  6572. grid0.addWidget(pp_label, 15, 0)
  6573. grid0.addWidget(self.pp_combo, 15, 1)
  6574. self.layout.addStretch()
  6575. class ToolsSubPrefGroupUI(OptionsGroupUI):
  6576. def __init__(self, parent=None):
  6577. super(ToolsSubPrefGroupUI, self).__init__(self)
  6578. self.setTitle(str(_("Substractor Tool Options")))
  6579. # ## Solder Paste Dispensing
  6580. self.sublabel = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  6581. self.sublabel.setToolTip(
  6582. _("A tool to substract one Gerber or Geometry object\n"
  6583. "from another of the same type.")
  6584. )
  6585. self.layout.addWidget(self.sublabel)
  6586. self.close_paths_cb = FCCheckBox(_("Close paths"))
  6587. self.close_paths_cb.setToolTip(_("Checking this will close the paths cut by the Geometry substractor object."))
  6588. self.layout.addWidget(self.close_paths_cb)
  6589. self.layout.addStretch()
  6590. class FAExcPrefGroupUI(OptionsGroupUI):
  6591. def __init__(self, parent=None):
  6592. # OptionsGroupUI.__init__(self, "Excellon File associations Preferences", parent=None)
  6593. super(FAExcPrefGroupUI, self).__init__(self)
  6594. self.setTitle(str(_("Excellon File associations")))
  6595. # ## Export G-Code
  6596. self.exc_list_label = QtWidgets.QLabel("<b>%s:</b>" % _("Extensions list"))
  6597. self.exc_list_label.setToolTip(
  6598. _("List of file extensions to be\n"
  6599. "associated with FlatCAM.")
  6600. )
  6601. self.layout.addWidget(self.exc_list_label)
  6602. self.exc_list_text = FCTextArea()
  6603. # self.exc_list_text.sizeHint(custom_sizehint=150)
  6604. font = QtGui.QFont()
  6605. font.setPointSize(12)
  6606. self.exc_list_text.setFont(font)
  6607. self.layout.addWidget(self.exc_list_text)
  6608. self.exc_list_btn = FCButton(_("Apply"))
  6609. self.exc_list_btn.setToolTip(_("Apply the file associations between\n"
  6610. "FlatCAM and the files with above extensions.\n"
  6611. "They will be active after next logon.\n"
  6612. "This work only in Windows."))
  6613. self.layout.addWidget(self.exc_list_btn)
  6614. # self.layout.addStretch()
  6615. class FAGcoPrefGroupUI(OptionsGroupUI):
  6616. def __init__(self, parent=None):
  6617. # OptionsGroupUI.__init__(self, "Gcode File associations Preferences", parent=None)
  6618. super(FAGcoPrefGroupUI, self).__init__(self)
  6619. self.setTitle(str(_("GCode File associations")))
  6620. # ## Export G-Code
  6621. self.gco_list_label = QtWidgets.QLabel("<b>%s:</b>" % _("Extensions list"))
  6622. self.gco_list_label.setToolTip(
  6623. _("List of file extensions to be\n"
  6624. "associated with FlatCAM.")
  6625. )
  6626. self.layout.addWidget(self.gco_list_label)
  6627. self.gco_list_text = FCTextArea()
  6628. # self.gco_list_text.sizeHint(custom_sizehint=150)
  6629. font = QtGui.QFont()
  6630. font.setPointSize(12)
  6631. self.gco_list_text.setFont(font)
  6632. self.layout.addWidget(self.gco_list_text)
  6633. self.gco_list_btn = FCButton(_("Apply"))
  6634. self.gco_list_btn.setToolTip(_("Apply the file associations between\n"
  6635. "FlatCAM and the files with above extensions.\n"
  6636. "They will be active after next logon.\n"
  6637. "This work only in Windows."))
  6638. self.layout.addWidget(self.gco_list_btn)
  6639. # self.layout.addStretch()
  6640. class FAGrbPrefGroupUI(OptionsGroupUI):
  6641. def __init__(self, parent=None):
  6642. # OptionsGroupUI.__init__(self, "Gerber File associations Preferences", parent=None)
  6643. super(FAGrbPrefGroupUI, self).__init__(self)
  6644. self.setTitle(str(_("Gerber File associations")))
  6645. # ## Export G-Code
  6646. self.grb_list_label = QtWidgets.QLabel("<b>%s:</b>" % _("Extensions list"))
  6647. self.grb_list_label.setToolTip(
  6648. _("List of file extensions to be\n"
  6649. "associated with FlatCAM.")
  6650. )
  6651. self.layout.addWidget(self.grb_list_label)
  6652. self.grb_list_text = FCTextArea()
  6653. # self.grb_list_text.sizeHint(custom_sizehint=150)
  6654. self.layout.addWidget(self.grb_list_text)
  6655. font = QtGui.QFont()
  6656. font.setPointSize(12)
  6657. self.grb_list_text.setFont(font)
  6658. self.grb_list_btn = FCButton(_("Apply"))
  6659. self.grb_list_btn.setToolTip(_("Apply the file associations between\n"
  6660. "FlatCAM and the files with above extensions.\n"
  6661. "They will be active after next logon.\n"
  6662. "This work only in Windows."))
  6663. self.layout.addWidget(self.grb_list_btn)
  6664. # self.layout.addStretch()
  6665. class FlatCAMActivityView(QtWidgets.QWidget):
  6666. def __init__(self, parent=None):
  6667. super().__init__(parent=parent)
  6668. self.setMinimumWidth(200)
  6669. self.icon = QtWidgets.QLabel(self)
  6670. self.icon.setGeometry(0, 0, 16, 12)
  6671. self.movie = QtGui.QMovie("share/active.gif")
  6672. self.icon.setMovie(self.movie)
  6673. # self.movie.start()
  6674. layout = QtWidgets.QHBoxLayout()
  6675. layout.setContentsMargins(5, 0, 5, 0)
  6676. layout.setAlignment(QtCore.Qt.AlignLeft)
  6677. self.setLayout(layout)
  6678. layout.addWidget(self.icon)
  6679. self.text = QtWidgets.QLabel(self)
  6680. self.text.setText(_("Idle."))
  6681. layout.addWidget(self.text)
  6682. def set_idle(self):
  6683. self.movie.stop()
  6684. self.text.setText(_("Idle."))
  6685. def set_busy(self, msg, no_movie=None):
  6686. if no_movie is not True:
  6687. self.movie.start()
  6688. self.text.setText(msg)
  6689. class FlatCAMInfoBar(QtWidgets.QWidget):
  6690. def __init__(self, parent=None):
  6691. super(FlatCAMInfoBar, self).__init__(parent=parent)
  6692. self.icon = QtWidgets.QLabel(self)
  6693. self.icon.setGeometry(0, 0, 12, 12)
  6694. self.pmap = QtGui.QPixmap('share/graylight12.png')
  6695. self.icon.setPixmap(self.pmap)
  6696. layout = QtWidgets.QHBoxLayout()
  6697. layout.setContentsMargins(5, 0, 5, 0)
  6698. self.setLayout(layout)
  6699. layout.addWidget(self.icon)
  6700. self.text = QtWidgets.QLabel(self)
  6701. self.text.setText(_("Application started ..."))
  6702. self.text.setToolTip(_("Hello!"))
  6703. layout.addWidget(self.text)
  6704. layout.addStretch()
  6705. def set_text_(self, text, color=None):
  6706. self.text.setText(text)
  6707. self.text.setToolTip(text)
  6708. if color:
  6709. self.text.setStyleSheet('color: %s' % str(color))
  6710. def set_status(self, text, level="info"):
  6711. level = str(level)
  6712. self.pmap.fill()
  6713. if level == "ERROR" or level == "ERROR_NOTCL":
  6714. self.pmap = QtGui.QPixmap('share/redlight12.png')
  6715. elif level == "success" or level == "SUCCESS":
  6716. self.pmap = QtGui.QPixmap('share/greenlight12.png')
  6717. elif level == "WARNING" or level == "WARNING_NOTCL":
  6718. self.pmap = QtGui.QPixmap('share/yellowlight12.png')
  6719. elif level == "selected" or level == "SELECTED":
  6720. self.pmap = QtGui.QPixmap('share/bluelight12.png')
  6721. else:
  6722. self.pmap = QtGui.QPixmap('share/graylight12.png')
  6723. self.set_text_(text)
  6724. self.icon.setPixmap(self.pmap)
  6725. # end of file