FlatCAMGUI.py 295 KB

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