FlatCAMGUI.py 296 KB

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