FlatCAMGUI.py 275 KB

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