FlatCAMGUI.py 327 KB

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