FlatCAMGUI.py 315 KB

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