FlatCAMGUI.py 296 KB

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