FlatCAMGUI.py 294 KB

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