FlatCAMGUI.py 294 KB

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