FlatCAMGUI.py 340 KB

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