FlatCAMGUI.py 295 KB

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