FlatCAMGUI.py 313 KB

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