PreferencesUI.py 354 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707
  1. # ##########################################################
  2. # FlatCAM: 2D Post-processing for Manufacturing #
  3. # File Author: Marius Adrian Stanciu (c) #
  4. # Date: 10/10/2019 #
  5. # MIT Licence #
  6. # ##########################################################
  7. from PyQt5.QtCore import QSettings
  8. from flatcamGUI.GUIElements import *
  9. import platform
  10. import sys
  11. import gettext
  12. import FlatCAMTranslation as fcTranslate
  13. import builtins
  14. fcTranslate.apply_language('strings')
  15. if '_' not in builtins.__dict__:
  16. _ = gettext.gettext
  17. settings = QtCore.QSettings("Open Source", "FlatCAM")
  18. if settings.contains("machinist"):
  19. machinist_setting = settings.value('machinist', type=int)
  20. else:
  21. machinist_setting = 0
  22. class OptionsGroupUI(QtWidgets.QGroupBox):
  23. app = None
  24. def __init__(self, title, parent=None):
  25. # QtGui.QGroupBox.__init__(self, title, parent=parent)
  26. super(OptionsGroupUI, self).__init__()
  27. self.setStyleSheet("""
  28. QGroupBox
  29. {
  30. font-size: 16px;
  31. font-weight: bold;
  32. }
  33. """)
  34. self.layout = QtWidgets.QVBoxLayout()
  35. self.setLayout(self.layout)
  36. class GeneralPreferencesUI(QtWidgets.QWidget):
  37. def __init__(self, decimals, parent=None):
  38. QtWidgets.QWidget.__init__(self, parent=parent)
  39. self.layout = QtWidgets.QHBoxLayout()
  40. self.setLayout(self.layout)
  41. self.decimals = decimals
  42. self.general_app_group = GeneralAppPrefGroupUI(decimals=self.decimals)
  43. self.general_app_group.setMinimumWidth(250)
  44. self.general_gui_group = GeneralGUIPrefGroupUI(decimals=self.decimals)
  45. self.general_gui_group.setMinimumWidth(250)
  46. self.general_app_set_group = GeneralAPPSetGroupUI(decimals=self.decimals)
  47. self.general_app_set_group.setMinimumWidth(250)
  48. self.layout.addWidget(self.general_app_group)
  49. self.layout.addWidget(self.general_gui_group)
  50. self.layout.addWidget(self.general_app_set_group)
  51. self.layout.addStretch()
  52. class GerberPreferencesUI(QtWidgets.QWidget):
  53. def __init__(self, decimals, parent=None):
  54. QtWidgets.QWidget.__init__(self, parent=parent)
  55. self.layout = QtWidgets.QHBoxLayout()
  56. self.setLayout(self.layout)
  57. self.decimals = decimals
  58. self.gerber_gen_group = GerberGenPrefGroupUI(decimals=self.decimals)
  59. self.gerber_gen_group.setMinimumWidth(250)
  60. self.gerber_opt_group = GerberOptPrefGroupUI(decimals=self.decimals)
  61. self.gerber_opt_group.setMinimumWidth(250)
  62. self.gerber_exp_group = GerberExpPrefGroupUI(decimals=self.decimals)
  63. self.gerber_exp_group.setMinimumWidth(230)
  64. self.gerber_adv_opt_group = GerberAdvOptPrefGroupUI(decimals=self.decimals)
  65. self.gerber_adv_opt_group.setMinimumWidth(200)
  66. self.gerber_editor_group = GerberEditorPrefGroupUI(decimals=self.decimals)
  67. self.gerber_editor_group.setMinimumWidth(200)
  68. self.vlay = QtWidgets.QVBoxLayout()
  69. self.vlay.addWidget(self.gerber_opt_group)
  70. self.vlay.addWidget(self.gerber_exp_group)
  71. self.layout.addWidget(self.gerber_gen_group)
  72. self.layout.addLayout(self.vlay)
  73. self.layout.addWidget(self.gerber_adv_opt_group)
  74. self.layout.addWidget(self.gerber_editor_group)
  75. self.layout.addStretch()
  76. class ExcellonPreferencesUI(QtWidgets.QWidget):
  77. def __init__(self, decimals, parent=None):
  78. QtWidgets.QWidget.__init__(self, parent=parent)
  79. self.layout = QtWidgets.QHBoxLayout()
  80. self.setLayout(self.layout)
  81. self.decimals = decimals
  82. self.excellon_gen_group = ExcellonGenPrefGroupUI(decimals=self.decimals)
  83. self.excellon_gen_group.setMinimumWidth(220)
  84. self.excellon_opt_group = ExcellonOptPrefGroupUI(decimals=self.decimals)
  85. self.excellon_opt_group.setMinimumWidth(290)
  86. self.excellon_exp_group = ExcellonExpPrefGroupUI(decimals=self.decimals)
  87. self.excellon_exp_group.setMinimumWidth(250)
  88. self.excellon_adv_opt_group = ExcellonAdvOptPrefGroupUI(decimals=self.decimals)
  89. self.excellon_adv_opt_group.setMinimumWidth(250)
  90. self.excellon_editor_group = ExcellonEditorPrefGroupUI(decimals=self.decimals)
  91. self.excellon_editor_group.setMinimumWidth(260)
  92. self.vlay = QtWidgets.QVBoxLayout()
  93. self.vlay.addWidget(self.excellon_opt_group)
  94. self.vlay.addWidget(self.excellon_exp_group)
  95. self.layout.addWidget(self.excellon_gen_group)
  96. self.layout.addLayout(self.vlay)
  97. self.layout.addWidget(self.excellon_adv_opt_group)
  98. self.layout.addWidget(self.excellon_editor_group)
  99. self.layout.addStretch()
  100. class GeometryPreferencesUI(QtWidgets.QWidget):
  101. def __init__(self, decimals, parent=None):
  102. QtWidgets.QWidget.__init__(self, parent=parent)
  103. self.layout = QtWidgets.QHBoxLayout()
  104. self.setLayout(self.layout)
  105. self.decimals = decimals
  106. self.geometry_gen_group = GeometryGenPrefGroupUI(decimals=self.decimals)
  107. self.geometry_gen_group.setMinimumWidth(220)
  108. self.geometry_opt_group = GeometryOptPrefGroupUI(decimals=self.decimals)
  109. self.geometry_opt_group.setMinimumWidth(300)
  110. self.geometry_adv_opt_group = GeometryAdvOptPrefGroupUI(decimals=self.decimals)
  111. self.geometry_adv_opt_group.setMinimumWidth(270)
  112. self.geometry_editor_group = GeometryEditorPrefGroupUI(decimals=self.decimals)
  113. self.geometry_editor_group.setMinimumWidth(250)
  114. self.layout.addWidget(self.geometry_gen_group)
  115. self.layout.addWidget(self.geometry_opt_group)
  116. self.layout.addWidget(self.geometry_adv_opt_group)
  117. self.layout.addWidget(self.geometry_editor_group)
  118. self.layout.addStretch()
  119. class ToolsPreferencesUI(QtWidgets.QWidget):
  120. def __init__(self, decimals, parent=None):
  121. QtWidgets.QWidget.__init__(self, parent=parent)
  122. self.layout = QtWidgets.QHBoxLayout()
  123. self.setLayout(self.layout)
  124. self.decimals = decimals
  125. self.tools_ncc_group = ToolsNCCPrefGroupUI(decimals=self.decimals)
  126. self.tools_ncc_group.setMinimumWidth(220)
  127. self.tools_paint_group = ToolsPaintPrefGroupUI(decimals=self.decimals)
  128. self.tools_paint_group.setMinimumWidth(220)
  129. self.tools_cutout_group = ToolsCutoutPrefGroupUI(decimals=self.decimals)
  130. self.tools_cutout_group.setMinimumWidth(220)
  131. self.tools_2sided_group = Tools2sidedPrefGroupUI(decimals=self.decimals)
  132. self.tools_2sided_group.setMinimumWidth(220)
  133. self.tools_film_group = ToolsFilmPrefGroupUI(decimals=self.decimals)
  134. self.tools_film_group.setMinimumWidth(220)
  135. self.tools_panelize_group = ToolsPanelizePrefGroupUI(decimals=self.decimals)
  136. self.tools_panelize_group.setMinimumWidth(220)
  137. self.tools_calculators_group = ToolsCalculatorsPrefGroupUI(decimals=self.decimals)
  138. self.tools_calculators_group.setMinimumWidth(220)
  139. self.tools_transform_group = ToolsTransformPrefGroupUI(decimals=self.decimals)
  140. self.tools_transform_group.setMinimumWidth(200)
  141. self.tools_solderpaste_group = ToolsSolderpastePrefGroupUI(decimals=self.decimals)
  142. self.tools_solderpaste_group.setMinimumWidth(200)
  143. self.tools_sub_group = ToolsSubPrefGroupUI(decimals=self.decimals)
  144. self.tools_sub_group.setMinimumWidth(200)
  145. self.vlay = QtWidgets.QVBoxLayout()
  146. self.vlay.addWidget(self.tools_ncc_group)
  147. self.vlay.addWidget(self.tools_cutout_group)
  148. self.vlay1 = QtWidgets.QVBoxLayout()
  149. self.vlay1.addWidget(self.tools_paint_group)
  150. self.vlay1.addWidget(self.tools_panelize_group)
  151. self.vlay2 = QtWidgets.QVBoxLayout()
  152. self.vlay2.addWidget(self.tools_transform_group)
  153. self.vlay2.addWidget(self.tools_2sided_group)
  154. self.vlay2.addWidget(self.tools_sub_group)
  155. self.vlay3 = QtWidgets.QVBoxLayout()
  156. self.vlay3.addWidget(self.tools_film_group)
  157. self.vlay3.addWidget(self.tools_calculators_group)
  158. self.vlay4 = QtWidgets.QVBoxLayout()
  159. self.vlay4.addWidget(self.tools_solderpaste_group)
  160. self.layout.addLayout(self.vlay)
  161. self.layout.addLayout(self.vlay1)
  162. self.layout.addLayout(self.vlay2)
  163. self.layout.addLayout(self.vlay3)
  164. self.layout.addLayout(self.vlay4)
  165. self.layout.addStretch()
  166. class Tools2PreferencesUI(QtWidgets.QWidget):
  167. def __init__(self, decimals, parent=None):
  168. QtWidgets.QWidget.__init__(self, parent=parent)
  169. self.layout = QtWidgets.QHBoxLayout()
  170. self.setLayout(self.layout)
  171. self.decimals = decimals
  172. self.tools2_checkrules_group = Tools2RulesCheckPrefGroupUI(decimals=self.decimals)
  173. self.tools2_checkrules_group.setMinimumWidth(220)
  174. self.tools2_optimal_group = Tools2OptimalPrefGroupUI(decimals=self.decimals)
  175. self.tools2_optimal_group.setMinimumWidth(220)
  176. self.tools2_qrcode_group = Tools2QRCodePrefGroupUI(decimals=self.decimals)
  177. self.tools2_qrcode_group.setMinimumWidth(220)
  178. self.tools2_cfill_group = Tools2CThievingPrefGroupUI(decimals=self.decimals)
  179. self.tools2_cfill_group.setMinimumWidth(220)
  180. self.tools2_fiducials_group = Tools2FiducialsPrefGroupUI(decimals=self.decimals)
  181. self.tools2_fiducials_group.setMinimumWidth(220)
  182. self.tools2_cal_group = Tools2CalPrefGroupUI(decimals=self.decimals)
  183. self.tools2_cal_group.setMinimumWidth(220)
  184. self.tools2_edrills_group = Tools2EDrillsPrefGroupUI(decimals=self.decimals)
  185. self.tools2_edrills_group.setMinimumWidth(220)
  186. self.tools2_punch_group = Tools2PunchGerberPrefGroupUI(decimals=self.decimals)
  187. self.tools2_punch_group.setMinimumWidth(220)
  188. self.tools2_invert_group = Tools2InvertPrefGroupUI(decimals=self.decimals)
  189. self.tools2_invert_group.setMinimumWidth(220)
  190. self.vlay = QtWidgets.QVBoxLayout()
  191. self.vlay.addWidget(self.tools2_checkrules_group)
  192. self.vlay.addWidget(self.tools2_optimal_group)
  193. self.vlay1 = QtWidgets.QVBoxLayout()
  194. self.vlay1.addWidget(self.tools2_qrcode_group)
  195. self.vlay1.addWidget(self.tools2_fiducials_group)
  196. self.vlay2 = QtWidgets.QVBoxLayout()
  197. self.vlay2.addWidget(self.tools2_cfill_group)
  198. self.vlay3 = QtWidgets.QVBoxLayout()
  199. self.vlay3.addWidget(self.tools2_cal_group)
  200. self.vlay3.addWidget(self.tools2_edrills_group)
  201. self.vlay4 = QtWidgets.QVBoxLayout()
  202. self.vlay4.addWidget(self.tools2_punch_group)
  203. self.vlay4.addWidget(self.tools2_invert_group)
  204. self.layout.addLayout(self.vlay)
  205. self.layout.addLayout(self.vlay1)
  206. self.layout.addLayout(self.vlay2)
  207. self.layout.addLayout(self.vlay3)
  208. self.layout.addLayout(self.vlay4)
  209. self.layout.addStretch()
  210. class CNCJobPreferencesUI(QtWidgets.QWidget):
  211. def __init__(self, decimals, parent=None):
  212. QtWidgets.QWidget.__init__(self, parent=parent)
  213. self.layout = QtWidgets.QHBoxLayout()
  214. self.setLayout(self.layout)
  215. self.decimals = decimals
  216. self.cncjob_gen_group = CNCJobGenPrefGroupUI(decimals=self.decimals)
  217. self.cncjob_gen_group.setMinimumWidth(260)
  218. self.cncjob_opt_group = CNCJobOptPrefGroupUI(decimals=self.decimals)
  219. self.cncjob_opt_group.setMinimumWidth(260)
  220. self.cncjob_adv_opt_group = CNCJobAdvOptPrefGroupUI(decimals=self.decimals)
  221. self.cncjob_adv_opt_group.setMinimumWidth(260)
  222. self.layout.addWidget(self.cncjob_gen_group)
  223. self.layout.addWidget(self.cncjob_opt_group)
  224. self.layout.addWidget(self.cncjob_adv_opt_group)
  225. self.layout.addStretch()
  226. class UtilPreferencesUI(QtWidgets.QWidget):
  227. def __init__(self, decimals, parent=None):
  228. QtWidgets.QWidget.__init__(self, parent=parent)
  229. self.layout = QtWidgets.QHBoxLayout()
  230. self.setLayout(self.layout)
  231. self.decimals = decimals
  232. self.vlay = QtWidgets.QVBoxLayout()
  233. self.fa_excellon_group = FAExcPrefGroupUI(decimals=self.decimals)
  234. self.fa_excellon_group.setMinimumWidth(260)
  235. self.fa_gcode_group = FAGcoPrefGroupUI(decimals=self.decimals)
  236. self.fa_gcode_group.setMinimumWidth(260)
  237. self.vlay.addWidget(self.fa_excellon_group)
  238. self.vlay.addWidget(self.fa_gcode_group)
  239. self.fa_gerber_group = FAGrbPrefGroupUI(decimals=self.decimals)
  240. self.fa_gerber_group.setMinimumWidth(260)
  241. self.kw_group = AutoCompletePrefGroupUI(decimals=self.decimals)
  242. self.kw_group.setMinimumWidth(260)
  243. self.layout.addLayout(self.vlay)
  244. self.layout.addWidget(self.fa_gerber_group)
  245. self.layout.addWidget(self.kw_group)
  246. self.layout.addStretch()
  247. class GeneralGUIPrefGroupUI(OptionsGroupUI):
  248. def __init__(self, decimals=4, parent=None):
  249. super(GeneralGUIPrefGroupUI, self).__init__(self)
  250. self.setTitle(str(_("GUI Preferences")))
  251. self.decimals = decimals
  252. # Create a grid layout for the Application general settings
  253. grid0 = QtWidgets.QGridLayout()
  254. self.layout.addLayout(grid0)
  255. grid0.setColumnStretch(0, 0)
  256. grid0.setColumnStretch(1, 1)
  257. # Theme selection
  258. self.theme_label = QtWidgets.QLabel('%s:' % _('Theme'))
  259. self.theme_label.setToolTip(
  260. _("Select a theme for FlatCAM.\n"
  261. "It will theme the plot area.")
  262. )
  263. self.theme_radio = RadioSet([
  264. {"label": _("Light"), "value": "white"},
  265. {"label": _("Dark"), "value": "black"}
  266. ], orientation='vertical')
  267. grid0.addWidget(self.theme_label, 0, 0)
  268. grid0.addWidget(self.theme_radio, 0, 1)
  269. # Enable Gray Icons
  270. self.gray_icons_cb = FCCheckBox('%s' % _('Use Gray Icons'))
  271. self.gray_icons_cb.setToolTip(
  272. _("Check this box to use a set of icons with\n"
  273. "a lighter (gray) color. To be used when a\n"
  274. "full dark theme is applied.")
  275. )
  276. grid0.addWidget(self.gray_icons_cb, 1, 0, 1, 3)
  277. self.theme_button = FCButton(_("Apply Theme"))
  278. self.theme_button.setToolTip(
  279. _("Select a theme for FlatCAM.\n"
  280. "It will theme the plot area.\n"
  281. "The application will restart after change.")
  282. )
  283. grid0.addWidget(self.theme_button, 2, 0, 1, 3)
  284. separator_line = QtWidgets.QFrame()
  285. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  286. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  287. grid0.addWidget(separator_line, 3, 0, 1, 2)
  288. # Layout selection
  289. self.layout_label = QtWidgets.QLabel('%s:' % _('Layout'))
  290. self.layout_label.setToolTip(
  291. _("Select an layout for FlatCAM.\n"
  292. "It is applied immediately.")
  293. )
  294. self.layout_combo = FCComboBox()
  295. # don't translate the QCombo items as they are used in QSettings and identified by name
  296. self.layout_combo.addItem("standard")
  297. self.layout_combo.addItem("compact")
  298. grid0.addWidget(self.layout_label, 4, 0)
  299. grid0.addWidget(self.layout_combo, 4, 1)
  300. # Set the current index for layout_combo
  301. settings = QSettings("Open Source", "FlatCAM")
  302. if settings.contains("layout"):
  303. layout = settings.value('layout', type=str)
  304. idx = self.layout_combo.findText(layout.capitalize())
  305. self.layout_combo.setCurrentIndex(idx)
  306. # Style selection
  307. self.style_label = QtWidgets.QLabel('%s:' % _('Style'))
  308. self.style_label.setToolTip(
  309. _("Select an style for FlatCAM.\n"
  310. "It will be applied at the next app start.")
  311. )
  312. self.style_combo = FCComboBox()
  313. self.style_combo.addItems(QtWidgets.QStyleFactory.keys())
  314. # find current style
  315. index = self.style_combo.findText(QtWidgets.qApp.style().objectName(), QtCore.Qt.MatchFixedString)
  316. self.style_combo.setCurrentIndex(index)
  317. self.style_combo.activated[str].connect(self.handle_style)
  318. grid0.addWidget(self.style_label, 5, 0)
  319. grid0.addWidget(self.style_combo, 5, 1)
  320. # Enable High DPI Support
  321. self.hdpi_cb = FCCheckBox('%s' % _('Activate HDPI Support'))
  322. self.hdpi_cb.setToolTip(
  323. _("Enable High DPI support for FlatCAM.\n"
  324. "It will be applied at the next app start.")
  325. )
  326. settings = QSettings("Open Source", "FlatCAM")
  327. if settings.contains("hdpi"):
  328. self.hdpi_cb.set_value(settings.value('hdpi', type=int))
  329. else:
  330. self.hdpi_cb.set_value(False)
  331. self.hdpi_cb.stateChanged.connect(self.handle_hdpi)
  332. grid0.addWidget(self.hdpi_cb, 6, 0, 1, 3)
  333. # Enable Hover box
  334. self.hover_cb = FCCheckBox('%s' % _('Display Hover Shape'))
  335. self.hover_cb.setToolTip(
  336. _("Enable display of a hover shape for FlatCAM objects.\n"
  337. "It is displayed whenever the mouse cursor is hovering\n"
  338. "over any kind of not-selected object.")
  339. )
  340. grid0.addWidget(self.hover_cb, 8, 0, 1, 3)
  341. # Enable Selection box
  342. self.selection_cb = FCCheckBox('%s' % _('Display Selection Shape'))
  343. self.selection_cb.setToolTip(
  344. _("Enable the display of a selection shape for FlatCAM objects.\n"
  345. "It is displayed whenever the mouse selects an object\n"
  346. "either by clicking or dragging mouse from left to right or\n"
  347. "right to left.")
  348. )
  349. grid0.addWidget(self.selection_cb, 9, 0, 1, 3)
  350. separator_line = QtWidgets.QFrame()
  351. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  352. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  353. grid0.addWidget(separator_line, 14, 0, 1, 2)
  354. # Plot Selection (left - right) Color
  355. self.sel_lr_label = QtWidgets.QLabel('<b>%s</b>' % _('Left-Right Selection Color'))
  356. grid0.addWidget(self.sel_lr_label, 15, 0, 1, 2)
  357. self.sl_color_label = QtWidgets.QLabel('%s:' % _('Outline'))
  358. self.sl_color_label.setToolTip(
  359. _("Set the line color for the 'left to right' selection box.")
  360. )
  361. self.sl_color_entry = FCEntry()
  362. self.sl_color_button = QtWidgets.QPushButton()
  363. self.sl_color_button.setFixedSize(15, 15)
  364. self.form_box_child_4 = QtWidgets.QHBoxLayout()
  365. self.form_box_child_4.addWidget(self.sl_color_entry)
  366. self.form_box_child_4.addWidget(self.sl_color_button)
  367. self.form_box_child_4.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  368. grid0.addWidget(self.sl_color_label, 16, 0)
  369. grid0.addLayout(self.form_box_child_4, 16, 1)
  370. self.sf_color_label = QtWidgets.QLabel('%s:' % _('Fill'))
  371. self.sf_color_label.setToolTip(
  372. _("Set the fill color for the selection box\n"
  373. "in case that the selection is done from left to right.\n"
  374. "First 6 digits are the color and the last 2\n"
  375. "digits are for alpha (transparency) level.")
  376. )
  377. self.sf_color_entry = FCEntry()
  378. self.sf_color_button = QtWidgets.QPushButton()
  379. self.sf_color_button.setFixedSize(15, 15)
  380. self.form_box_child_5 = QtWidgets.QHBoxLayout()
  381. self.form_box_child_5.addWidget(self.sf_color_entry)
  382. self.form_box_child_5.addWidget(self.sf_color_button)
  383. self.form_box_child_5.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  384. grid0.addWidget(self.sf_color_label, 17, 0)
  385. grid0.addLayout(self.form_box_child_5, 17, 1)
  386. # Plot Selection (left - right) Fill Transparency Level
  387. self.sf_alpha_label = QtWidgets.QLabel('%s:' % _('Alpha'))
  388. self.sf_alpha_label.setToolTip(
  389. _("Set the fill transparency for the 'left to right' selection box.")
  390. )
  391. self.sf_color_alpha_slider = QtWidgets.QSlider(QtCore.Qt.Horizontal)
  392. self.sf_color_alpha_slider.setMinimum(0)
  393. self.sf_color_alpha_slider.setMaximum(255)
  394. self.sf_color_alpha_slider.setSingleStep(1)
  395. self.sf_color_alpha_spinner = FCSpinner()
  396. self.sf_color_alpha_spinner.setMinimumWidth(70)
  397. self.sf_color_alpha_spinner.set_range(0, 255)
  398. self.form_box_child_6 = QtWidgets.QHBoxLayout()
  399. self.form_box_child_6.addWidget(self.sf_color_alpha_slider)
  400. self.form_box_child_6.addWidget(self.sf_color_alpha_spinner)
  401. grid0.addWidget(self.sf_alpha_label, 18, 0)
  402. grid0.addLayout(self.form_box_child_6, 18, 1)
  403. separator_line = QtWidgets.QFrame()
  404. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  405. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  406. grid0.addWidget(separator_line, 19, 0, 1, 2)
  407. # Plot Selection (left - right) Color
  408. self.sel_rl_label = QtWidgets.QLabel('<b>%s</b>' % _('Right-Left Selection Color'))
  409. grid0.addWidget(self.sel_rl_label, 20, 0, 1, 2)
  410. # Plot Selection (right - left) Line Color
  411. self.alt_sl_color_label = QtWidgets.QLabel('%s:' % _('Outline'))
  412. self.alt_sl_color_label.setToolTip(
  413. _("Set the line color for the 'right to left' selection box.")
  414. )
  415. self.alt_sl_color_entry = FCEntry()
  416. self.alt_sl_color_button = QtWidgets.QPushButton()
  417. self.alt_sl_color_button.setFixedSize(15, 15)
  418. self.form_box_child_7 = QtWidgets.QHBoxLayout()
  419. self.form_box_child_7.addWidget(self.alt_sl_color_entry)
  420. self.form_box_child_7.addWidget(self.alt_sl_color_button)
  421. self.form_box_child_7.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  422. grid0.addWidget(self.alt_sl_color_label, 21, 0)
  423. grid0.addLayout(self.form_box_child_7, 21, 1)
  424. # Plot Selection (right - left) Fill Color
  425. self.alt_sf_color_label = QtWidgets.QLabel('%s:' % _('Fill'))
  426. self.alt_sf_color_label.setToolTip(
  427. _("Set the fill color for the selection box\n"
  428. "in case that the selection is done from right to left.\n"
  429. "First 6 digits are the color and the last 2\n"
  430. "digits are for alpha (transparency) level.")
  431. )
  432. self.alt_sf_color_entry = FCEntry()
  433. self.alt_sf_color_button = QtWidgets.QPushButton()
  434. self.alt_sf_color_button.setFixedSize(15, 15)
  435. self.form_box_child_8 = QtWidgets.QHBoxLayout()
  436. self.form_box_child_8.addWidget(self.alt_sf_color_entry)
  437. self.form_box_child_8.addWidget(self.alt_sf_color_button)
  438. self.form_box_child_8.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  439. grid0.addWidget(self.alt_sf_color_label, 22, 0)
  440. grid0.addLayout(self.form_box_child_8, 22, 1)
  441. # Plot Selection (right - left) Fill Transparency Level
  442. self.alt_sf_alpha_label = QtWidgets.QLabel('%s:' % _('Alpha'))
  443. self.alt_sf_alpha_label.setToolTip(
  444. _("Set the fill transparency for selection 'right to left' box.")
  445. )
  446. self.alt_sf_color_alpha_slider = QtWidgets.QSlider(QtCore.Qt.Horizontal)
  447. self.alt_sf_color_alpha_slider.setMinimum(0)
  448. self.alt_sf_color_alpha_slider.setMaximum(255)
  449. self.alt_sf_color_alpha_slider.setSingleStep(1)
  450. self.alt_sf_color_alpha_spinner = FCSpinner()
  451. self.alt_sf_color_alpha_spinner.setMinimumWidth(70)
  452. self.alt_sf_color_alpha_spinner.set_range(0, 255)
  453. self.form_box_child_9 = QtWidgets.QHBoxLayout()
  454. self.form_box_child_9.addWidget(self.alt_sf_color_alpha_slider)
  455. self.form_box_child_9.addWidget(self.alt_sf_color_alpha_spinner)
  456. grid0.addWidget(self.alt_sf_alpha_label, 23, 0)
  457. grid0.addLayout(self.form_box_child_9, 23, 1)
  458. separator_line = QtWidgets.QFrame()
  459. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  460. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  461. grid0.addWidget(separator_line, 24, 0, 1, 2)
  462. # ------------------------------------------------------------------
  463. # ----------------------- Editor Color -----------------------------
  464. # ------------------------------------------------------------------
  465. self.editor_color_label = QtWidgets.QLabel('<b>%s</b>' % _('Editor Color'))
  466. grid0.addWidget(self.editor_color_label, 25, 0, 1, 2)
  467. # Editor Draw Color
  468. self.draw_color_label = QtWidgets.QLabel('%s:' % _('Drawing'))
  469. self.alt_sf_color_label.setToolTip(
  470. _("Set the color for the shape.")
  471. )
  472. self.draw_color_entry = FCEntry()
  473. self.draw_color_button = QtWidgets.QPushButton()
  474. self.draw_color_button.setFixedSize(15, 15)
  475. self.form_box_child_10 = QtWidgets.QHBoxLayout()
  476. self.form_box_child_10.addWidget(self.draw_color_entry)
  477. self.form_box_child_10.addWidget(self.draw_color_button)
  478. self.form_box_child_10.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  479. grid0.addWidget(self.draw_color_label, 26, 0)
  480. grid0.addLayout(self.form_box_child_10, 26, 1)
  481. # Editor Draw Selection Color
  482. self.sel_draw_color_label = QtWidgets.QLabel('%s:' % _('Selection'))
  483. self.sel_draw_color_label.setToolTip(
  484. _("Set the color of the shape when selected.")
  485. )
  486. self.sel_draw_color_entry = FCEntry()
  487. self.sel_draw_color_button = QtWidgets.QPushButton()
  488. self.sel_draw_color_button.setFixedSize(15, 15)
  489. self.form_box_child_11 = QtWidgets.QHBoxLayout()
  490. self.form_box_child_11.addWidget(self.sel_draw_color_entry)
  491. self.form_box_child_11.addWidget(self.sel_draw_color_button)
  492. self.form_box_child_11.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  493. grid0.addWidget(self.sel_draw_color_label, 27, 0)
  494. grid0.addLayout(self.form_box_child_11, 27, 1)
  495. separator_line = QtWidgets.QFrame()
  496. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  497. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  498. grid0.addWidget(separator_line, 28, 0, 1, 2)
  499. # ------------------------------------------------------------------
  500. # ----------------------- Project Settings -----------------------------
  501. # ------------------------------------------------------------------
  502. self.proj_settings_label = QtWidgets.QLabel('<b>%s</b>' % _('Project Items Color'))
  503. grid0.addWidget(self.proj_settings_label, 29, 0, 1, 2)
  504. # Project Tab items color
  505. self.proj_color_label = QtWidgets.QLabel('%s:' % _('Enabled'))
  506. self.proj_color_label.setToolTip(
  507. _("Set the color of the items in Project Tab Tree.")
  508. )
  509. self.proj_color_entry = FCEntry()
  510. self.proj_color_button = QtWidgets.QPushButton()
  511. self.proj_color_button.setFixedSize(15, 15)
  512. self.form_box_child_12 = QtWidgets.QHBoxLayout()
  513. self.form_box_child_12.addWidget(self.proj_color_entry)
  514. self.form_box_child_12.addWidget(self.proj_color_button)
  515. self.form_box_child_12.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  516. grid0.addWidget(self.proj_color_label, 30, 0)
  517. grid0.addLayout(self.form_box_child_12, 30, 1)
  518. self.proj_color_dis_label = QtWidgets.QLabel('%s:' % _('Disabled'))
  519. self.proj_color_dis_label.setToolTip(
  520. _("Set the color of the items in Project Tab Tree,\n"
  521. "for the case when the items are disabled.")
  522. )
  523. self.proj_color_dis_entry = FCEntry()
  524. self.proj_color_dis_button = QtWidgets.QPushButton()
  525. self.proj_color_dis_button.setFixedSize(15, 15)
  526. self.form_box_child_13 = QtWidgets.QHBoxLayout()
  527. self.form_box_child_13.addWidget(self.proj_color_dis_entry)
  528. self.form_box_child_13.addWidget(self.proj_color_dis_button)
  529. self.form_box_child_13.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  530. grid0.addWidget(self.proj_color_dis_label, 31, 0)
  531. grid0.addLayout(self.form_box_child_13, 31, 1)
  532. # Project autohide CB
  533. self.project_autohide_cb = FCCheckBox(label=_('Project AutoHide'))
  534. self.project_autohide_cb.setToolTip(
  535. _("Check this box if you want the project/selected/tool tab area to\n"
  536. "hide automatically when there are no objects loaded and\n"
  537. "to show whenever a new object is created.")
  538. )
  539. grid0.addWidget(self.project_autohide_cb, 32, 0, 1, 2)
  540. # Just to add empty rows
  541. grid0.addWidget(QtWidgets.QLabel(''), 33, 0, 1, 2)
  542. self.layout.addStretch()
  543. self.theme_button.clicked.connect(self.on_theme_change)
  544. # #############################################################################
  545. # ############################# GUI COLORS SIGNALS ############################
  546. # #############################################################################
  547. # Setting selection (left - right) colors signals
  548. self.sf_color_entry.editingFinished.connect(self.on_sf_color_entry)
  549. self.sf_color_button.clicked.connect(self.on_sf_color_button)
  550. self.sf_color_alpha_spinner.valueChanged.connect(self.on_sf_color_spinner)
  551. self.sf_color_alpha_slider.valueChanged.connect(self.on_sf_color_slider)
  552. self.sl_color_entry.editingFinished.connect(self.on_sl_color_entry)
  553. self.sl_color_button.clicked.connect(self.on_sl_color_button)
  554. # Setting selection (right - left) colors signals
  555. self.alt_sf_color_entry.editingFinished.connect(self.on_alt_sf_color_entry)
  556. self.alt_sf_color_button.clicked.connect(self.on_alt_sf_color_button)
  557. self.alt_sf_color_alpha_spinner.valueChanged.connect(self.on_alt_sf_color_spinner)
  558. self.alt_sf_color_alpha_slider.valueChanged.connect(self.on_alt_sf_color_slider)
  559. self.alt_sl_color_entry.editingFinished.connect(self.on_alt_sl_color_entry)
  560. self.alt_sl_color_button.clicked.connect(self.on_alt_sl_color_button)
  561. # Setting Editor Draw colors signals
  562. self.draw_color_entry.editingFinished.connect(self.on_draw_color_entry)
  563. self.draw_color_button.clicked.connect( self.on_draw_color_button)
  564. self.sel_draw_color_entry.editingFinished.connect(self.on_sel_draw_color_entry)
  565. self.sel_draw_color_button.clicked.connect(self.on_sel_draw_color_button)
  566. self.proj_color_entry.editingFinished.connect(self.on_proj_color_entry)
  567. self.proj_color_button.clicked.connect(self.on_proj_color_button)
  568. self.proj_color_dis_entry.editingFinished.connect(self.on_proj_color_dis_entry)
  569. self.proj_color_dis_button.clicked.connect(self.on_proj_color_dis_button)
  570. def on_theme_change(self):
  571. val = self.theme_radio.get_value()
  572. t_settings = QSettings("Open Source", "FlatCAM")
  573. t_settings.setValue('theme', val)
  574. # This will write the setting to the platform specific storage.
  575. del t_settings
  576. self.app.on_app_restart()
  577. def handle_style(self, style):
  578. # set current style
  579. settings = QSettings("Open Source", "FlatCAM")
  580. settings.setValue('style', style)
  581. # This will write the setting to the platform specific storage.
  582. del settings
  583. def handle_hdpi(self, state):
  584. # set current HDPI
  585. settings = QSettings("Open Source", "FlatCAM")
  586. settings.setValue('hdpi', state)
  587. # This will write the setting to the platform specific storage.
  588. del settings
  589. # Setting selection colors (left - right) handlers
  590. def on_sf_color_entry(self):
  591. self.app.defaults['global_sel_fill'] = self.app.defaults['global_sel_fill'][7:9]
  592. self.sf_color_button.setStyleSheet("background-color:%s" % str(self.app.defaults['global_sel_fill'])[:7])
  593. def on_sf_color_button(self):
  594. current_color = QtGui.QColor(self.app.defaults['global_sel_fill'][:7])
  595. c_dialog = QtWidgets.QColorDialog()
  596. plot_fill_color = c_dialog.getColor(initial=current_color)
  597. if plot_fill_color.isValid() is False:
  598. return
  599. self.sf_color_button.setStyleSheet("background-color:%s" % str(plot_fill_color.name()))
  600. new_val = str(plot_fill_color.name()) + str(self.app.defaults['global_sel_fill'][7:9])
  601. self.sf_color_entry.set_value(new_val)
  602. self.app.defaults['global_sel_fill'] = new_val
  603. def on_sf_color_spinner(self):
  604. spinner_value = self.sf_color_alpha_spinner.value()
  605. self.sf_color_alpha_slider.setValue(spinner_value)
  606. self.app.defaults['global_sel_fill'] = self.app.defaults['global_sel_fill'][:7] + \
  607. (hex(spinner_value)[2:] if int(hex(spinner_value)[2:], 16) > 0 else '00')
  608. self.app.defaults['global_sel_line'] = self.app.defaults['global_sel_line'][:7] + \
  609. (hex(spinner_value)[2:] if int(hex(spinner_value)[2:], 16) > 0 else '00')
  610. def on_sf_color_slider(self):
  611. slider_value = self.sf_color_alpha_slider.value()
  612. self.sf_color_alpha_spinner.setValue(slider_value)
  613. def on_sl_color_entry(self):
  614. self.app.defaults['global_sel_line'] = self.sl_color_entry.get_value()[:7] + \
  615. self.app.defaults['global_sel_line'][7:9]
  616. self.sl_color_button.setStyleSheet("background-color:%s" % str(self.app.defaults['global_sel_line'])[:7])
  617. def on_sl_color_button(self):
  618. current_color = QtGui.QColor(self.app.defaults['global_sel_line'][:7])
  619. c_dialog = QtWidgets.QColorDialog()
  620. plot_line_color = c_dialog.getColor(initial=current_color)
  621. if plot_line_color.isValid() is False:
  622. return
  623. self.sl_color_button.setStyleSheet("background-color:%s" % str(plot_line_color.name()))
  624. new_val_line = str(plot_line_color.name()) + str(self.app.defaults['global_sel_line'][7:9])
  625. self.sl_color_entry.set_value(new_val_line)
  626. self.app.defaults['global_sel_line'] = new_val_line
  627. # Setting selection colors (right - left) handlers
  628. def on_alt_sf_color_entry(self):
  629. self.app.defaults['global_alt_sel_fill'] = self.alt_sf_color_entry.get_value()[:7] + \
  630. self.app.defaults['global_alt_sel_fill'][7:9]
  631. self.alt_sf_color_button.setStyleSheet(
  632. "background-color:%s" % str(self.app.defaults['global_alt_sel_fill'])[:7]
  633. )
  634. def on_alt_sf_color_button(self):
  635. current_color = QtGui.QColor(self.app.defaults['global_alt_sel_fill'][:7])
  636. c_dialog = QtWidgets.QColorDialog()
  637. plot_fill_color = c_dialog.getColor(initial=current_color)
  638. if plot_fill_color.isValid() is False:
  639. return
  640. self.alt_sf_color_button.setStyleSheet("background-color:%s" % str(plot_fill_color.name()))
  641. new_val = str(plot_fill_color.name()) + str(self.app.defaults['global_alt_sel_fill'][7:9])
  642. self.alt_sf_color_entry.set_value(new_val)
  643. self.app.defaults['global_alt_sel_fill'] = new_val
  644. def on_alt_sf_color_spinner(self):
  645. spinner_value = self.alt_sf_color_alpha_spinner.value()
  646. self.alt_sf_color_alpha_slider.setValue(spinner_value)
  647. self.app.defaults['global_alt_sel_fill'] = self.app.defaults['global_alt_sel_fill'][:7] + \
  648. (hex(spinner_value)[2:] if int(hex(spinner_value)[2:], 16) > 0 else '00')
  649. self.app.defaults['global_alt_sel_line'] = self.app.defaults['global_alt_sel_line'][:7] + \
  650. (hex(spinner_value)[2:] if int(hex(spinner_value)[2:], 16) > 0 else '00')
  651. def on_alt_sf_color_slider(self):
  652. slider_value = self.alt_sf_color_alpha_slider.value()
  653. self.alt_sf_color_alpha_spinner.setValue(slider_value)
  654. def on_alt_sl_color_entry(self):
  655. self.app.defaults['global_alt_sel_line'] = self.alt_sl_color_entry.get_value()[:7] + \
  656. self.app.defaults['global_alt_sel_line'][7:9]
  657. self.alt_sl_color_button.setStyleSheet(
  658. "background-color:%s" % str(self.app.defaults['global_alt_sel_line'])[:7]
  659. )
  660. def on_alt_sl_color_button(self):
  661. current_color = QtGui.QColor(self.app.defaults['global_alt_sel_line'][:7])
  662. c_dialog = QtWidgets.QColorDialog()
  663. plot_line_color = c_dialog.getColor(initial=current_color)
  664. if plot_line_color.isValid() is False:
  665. return
  666. self.alt_sl_color_button.setStyleSheet("background-color:%s" % str(plot_line_color.name()))
  667. new_val_line = str(plot_line_color.name()) + str(self.app.defaults['global_alt_sel_line'][7:9])
  668. self.alt_sl_color_entry.set_value(new_val_line)
  669. self.app.defaults['global_alt_sel_line'] = new_val_line
  670. # Setting Editor colors
  671. def on_draw_color_entry(self):
  672. self.app.defaults['global_draw_color'] = self.draw_color_entry.get_value()
  673. self.draw_color_button.setStyleSheet("background-color:%s" % str(self.app.defaults['global_draw_color']))
  674. def on_draw_color_button(self):
  675. current_color = QtGui.QColor(self.app.defaults['global_draw_color'])
  676. c_dialog = QtWidgets.QColorDialog()
  677. draw_color = c_dialog.getColor(initial=current_color)
  678. if draw_color.isValid() is False:
  679. return
  680. self.draw_color_button.setStyleSheet("background-color:%s" % str(draw_color.name()))
  681. new_val = str(draw_color.name())
  682. self.draw_color_entry.set_value(new_val)
  683. self.app.defaults['global_draw_color'] = new_val
  684. def on_sel_draw_color_entry(self):
  685. self.app.defaults['global_sel_draw_color'] = self.sel_draw_color_entry.get_value()
  686. self.sel_draw_color_button.setStyleSheet(
  687. "background-color:%s" % str(self.app.defaults['global_sel_draw_color']))
  688. def on_sel_draw_color_button(self):
  689. current_color = QtGui.QColor(self.app.defaults['global_sel_draw_color'])
  690. c_dialog = QtWidgets.QColorDialog()
  691. sel_draw_color = c_dialog.getColor(initial=current_color)
  692. if sel_draw_color.isValid() is False:
  693. return
  694. self.sel_draw_color_button.setStyleSheet("background-color:%s" % str(sel_draw_color.name()))
  695. new_val_sel = str(sel_draw_color.name())
  696. self.sel_draw_color_entry.set_value(new_val_sel)
  697. self.app.defaults['global_sel_draw_color'] = new_val_sel
  698. def on_proj_color_entry(self):
  699. self.app.defaults['global_proj_item_color'] = self.proj_color_entry.get_value()
  700. self.proj_color_button.setStyleSheet(
  701. "background-color:%s" % str(self.app.defaults['global_proj_item_color']))
  702. def on_proj_color_button(self):
  703. current_color = QtGui.QColor(self.app.defaults['global_proj_item_color'])
  704. c_dialog = QtWidgets.QColorDialog()
  705. proj_color = c_dialog.getColor(initial=current_color)
  706. if proj_color.isValid() is False:
  707. return
  708. self.proj_color_button.setStyleSheet("background-color:%s" % str(proj_color.name()))
  709. new_val_sel = str(proj_color.name())
  710. self.proj_color_entry.set_value(new_val_sel)
  711. self.app.defaults['global_proj_item_color'] = new_val_sel
  712. def on_proj_color_dis_entry(self):
  713. self.app.defaults['global_proj_item_dis_color'] = self.proj_color_dis_entry.get_value()
  714. self.proj_color_dis_button.setStyleSheet(
  715. "background-color:%s" % str(self.app.defaults['global_proj_item_dis_color']))
  716. def on_proj_color_dis_button(self):
  717. current_color = QtGui.QColor(self.app.defaults['global_proj_item_dis_color'])
  718. c_dialog = QtWidgets.QColorDialog()
  719. proj_color = c_dialog.getColor(initial=current_color)
  720. if proj_color.isValid() is False:
  721. return
  722. self.proj_color_dis_button.setStyleSheet("background-color:%s" % str(proj_color.name()))
  723. new_val_sel = str(proj_color.name())
  724. self.proj_color_dis_entry.set_value(new_val_sel)
  725. self.app.defaults['global_proj_item_dis_color'] = new_val_sel
  726. class GeneralAPPSetGroupUI(OptionsGroupUI):
  727. def __init__(self, decimals=4, parent=None):
  728. super(GeneralAPPSetGroupUI, self).__init__(self)
  729. self.setTitle(str(_("App Settings")))
  730. self.decimals = decimals
  731. theme_settings = QtCore.QSettings("Open Source", "FlatCAM")
  732. if theme_settings.contains("theme"):
  733. theme = theme_settings.value('theme', type=str)
  734. else:
  735. theme = 'white'
  736. if theme == 'white':
  737. self.resource_loc = 'share'
  738. else:
  739. self.resource_loc = 'share'
  740. # Create a grid layout for the Application general settings
  741. grid0 = QtWidgets.QGridLayout()
  742. self.layout.addLayout(grid0)
  743. grid0.setColumnStretch(0, 0)
  744. grid0.setColumnStretch(1, 1)
  745. # GRID Settings
  746. self.grid_label = QtWidgets.QLabel('<b>%s</b>' % _('Grid Settings'))
  747. grid0.addWidget(self.grid_label, 0, 0, 1, 2)
  748. # Grid X Entry
  749. self.gridx_label = QtWidgets.QLabel('%s:' % _('X value'))
  750. self.gridx_label.setToolTip(
  751. _("This is the Grid snap value on X axis.")
  752. )
  753. self.gridx_entry = FCDoubleSpinner()
  754. self.gridx_entry.set_precision(self.decimals)
  755. self.gridx_entry.setSingleStep(0.1)
  756. grid0.addWidget(self.gridx_label, 1, 0)
  757. grid0.addWidget(self.gridx_entry, 1, 1)
  758. # Grid Y Entry
  759. self.gridy_label = QtWidgets.QLabel('%s:' % _('Y value'))
  760. self.gridy_label.setToolTip(
  761. _("This is the Grid snap value on Y axis.")
  762. )
  763. self.gridy_entry = FCDoubleSpinner()
  764. self.gridy_entry.set_precision(self.decimals)
  765. self.gridy_entry.setSingleStep(0.1)
  766. grid0.addWidget(self.gridy_label, 2, 0)
  767. grid0.addWidget(self.gridy_entry, 2, 1)
  768. # Snap Max Entry
  769. self.snap_max_label = QtWidgets.QLabel('%s:' % _('Snap Max'))
  770. self.snap_max_label.setToolTip(_("Max. magnet distance"))
  771. self.snap_max_dist_entry = FCDoubleSpinner()
  772. self.snap_max_dist_entry.set_precision(self.decimals)
  773. self.snap_max_dist_entry.setSingleStep(0.1)
  774. grid0.addWidget(self.snap_max_label, 3, 0)
  775. grid0.addWidget(self.snap_max_dist_entry, 3, 1)
  776. separator_line = QtWidgets.QFrame()
  777. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  778. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  779. grid0.addWidget(separator_line, 4, 0, 1, 2)
  780. # Workspace
  781. self.workspace_label = QtWidgets.QLabel('<b>%s</b>' % _('Workspace Settings'))
  782. grid0.addWidget(self.workspace_label, 5, 0, 1, 2)
  783. self.workspace_cb = FCCheckBox('%s' % _('Active'))
  784. self.workspace_cb.setToolTip(
  785. _("Draw a delimiting rectangle on canvas.\n"
  786. "The purpose is to illustrate the limits for our work.")
  787. )
  788. grid0.addWidget(self.workspace_cb, 6, 0, 1, 2)
  789. self.workspace_type_lbl = QtWidgets.QLabel('%s:' % _('Size'))
  790. self.workspace_type_lbl.setToolTip(
  791. _("Select the type of rectangle to be used on canvas,\n"
  792. "as valid workspace.")
  793. )
  794. self.wk_cb = FCComboBox()
  795. grid0.addWidget(self.workspace_type_lbl, 7, 0)
  796. grid0.addWidget(self.wk_cb, 7, 1)
  797. self.pagesize = {}
  798. self.pagesize.update(
  799. {
  800. 'A0': (841, 1189),
  801. 'A1': (594, 841),
  802. 'A2': (420, 594),
  803. 'A3': (297, 420),
  804. 'A4': (210, 297),
  805. 'A5': (148, 210),
  806. 'A6': (105, 148),
  807. 'A7': (74, 105),
  808. 'A8': (52, 74),
  809. 'A9': (37, 52),
  810. 'A10': (26, 37),
  811. 'B0': (1000, 1414),
  812. 'B1': (707, 1000),
  813. 'B2': (500, 707),
  814. 'B3': (353, 500),
  815. 'B4': (250, 353),
  816. 'B5': (176, 250),
  817. 'B6': (125, 176),
  818. 'B7': (88, 125),
  819. 'B8': (62, 88),
  820. 'B9': (44, 62),
  821. 'B10': (31, 44),
  822. 'C0': (917, 1297),
  823. 'C1': (648, 917),
  824. 'C2': (458, 648),
  825. 'C3': (324, 458),
  826. 'C4': (229, 324),
  827. 'C5': (162, 229),
  828. 'C6': (114, 162),
  829. 'C7': (81, 114),
  830. 'C8': (57, 81),
  831. 'C9': (40, 57),
  832. 'C10': (28, 40),
  833. # American paper sizes
  834. 'LETTER': (8.5, 11),
  835. 'LEGAL': (8.5, 14),
  836. 'ELEVENSEVENTEEN': (11, 17),
  837. # From https://en.wikipedia.org/wiki/Paper_size
  838. 'JUNIOR_LEGAL': (5, 8),
  839. 'HALF_LETTER': (5.5, 8),
  840. 'GOV_LETTER': (8, 10.5),
  841. 'GOV_LEGAL': (8.5, 13),
  842. 'LEDGER': (17, 11),
  843. }
  844. )
  845. page_size_list = list(self.pagesize.keys())
  846. self.wk_cb.addItems(page_size_list)
  847. # Page orientation
  848. self.wk_orientation_label = QtWidgets.QLabel('%s:' % _("Orientation"))
  849. self.wk_orientation_label.setToolTip(_("Can be:\n"
  850. "- Portrait\n"
  851. "- Landscape"))
  852. self.wk_orientation_radio = RadioSet([{'label': _('Portrait'), 'value': 'p'},
  853. {'label': _('Landscape'), 'value': 'l'},
  854. ], stretch=False)
  855. self.wks = OptionalInputSection(self.workspace_cb,
  856. [
  857. self.workspace_type_lbl,
  858. self.wk_cb,
  859. self.wk_orientation_label,
  860. self.wk_orientation_radio
  861. ])
  862. grid0.addWidget(self.wk_orientation_label, 8, 0)
  863. grid0.addWidget(self.wk_orientation_radio, 8, 1)
  864. separator_line = QtWidgets.QFrame()
  865. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  866. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  867. grid0.addWidget(separator_line, 9, 0, 1, 2)
  868. # Font Size
  869. self.font_size_label = QtWidgets.QLabel('<b>%s</b>' % _('Font Size'))
  870. grid0.addWidget(self.font_size_label, 10, 0, 1, 2)
  871. # Notebook Font Size
  872. self.notebook_font_size_label = QtWidgets.QLabel('%s:' % _('Notebook'))
  873. self.notebook_font_size_label.setToolTip(
  874. _("This sets the font size for the elements found in the Notebook.\n"
  875. "The notebook is the collapsible area in the left side of the GUI,\n"
  876. "and include the Project, Selected and Tool tabs.")
  877. )
  878. self.notebook_font_size_spinner = FCSpinner()
  879. self.notebook_font_size_spinner.set_range(8, 40)
  880. self.notebook_font_size_spinner.setWrapping(True)
  881. settings = QSettings("Open Source", "FlatCAM")
  882. if settings.contains("notebook_font_size"):
  883. self.notebook_font_size_spinner.set_value(settings.value('notebook_font_size', type=int))
  884. else:
  885. self.notebook_font_size_spinner.set_value(12)
  886. grid0.addWidget(self.notebook_font_size_label, 11, 0)
  887. grid0.addWidget(self.notebook_font_size_spinner, 11, 1)
  888. # Axis Font Size
  889. self.axis_font_size_label = QtWidgets.QLabel('%s:' % _('Axis'))
  890. self.axis_font_size_label.setToolTip(
  891. _("This sets the font size for canvas axis.")
  892. )
  893. self.axis_font_size_spinner = FCSpinner()
  894. self.axis_font_size_spinner.set_range(0, 40)
  895. self.axis_font_size_spinner.setWrapping(True)
  896. settings = QSettings("Open Source", "FlatCAM")
  897. if settings.contains("axis_font_size"):
  898. self.axis_font_size_spinner.set_value(settings.value('axis_font_size', type=int))
  899. else:
  900. self.axis_font_size_spinner.set_value(8)
  901. grid0.addWidget(self.axis_font_size_label, 12, 0)
  902. grid0.addWidget(self.axis_font_size_spinner, 12, 1)
  903. # TextBox Font Size
  904. self.textbox_font_size_label = QtWidgets.QLabel('%s:' % _('Textbox'))
  905. self.textbox_font_size_label.setToolTip(
  906. _("This sets the font size for the Textbox GUI\n"
  907. "elements that are used in FlatCAM.")
  908. )
  909. self.textbox_font_size_spinner = FCSpinner()
  910. self.textbox_font_size_spinner.set_range(8, 40)
  911. self.textbox_font_size_spinner.setWrapping(True)
  912. settings = QSettings("Open Source", "FlatCAM")
  913. if settings.contains("textbox_font_size"):
  914. self.textbox_font_size_spinner.set_value(settings.value('textbox_font_size', type=int))
  915. else:
  916. self.textbox_font_size_spinner.set_value(10)
  917. grid0.addWidget(self.textbox_font_size_label, 13, 0)
  918. grid0.addWidget(self.textbox_font_size_spinner, 13, 1)
  919. separator_line = QtWidgets.QFrame()
  920. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  921. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  922. grid0.addWidget(separator_line, 14, 0, 1, 2)
  923. # -----------------------------------------------------------
  924. # -------------- MOUSE SETTINGS -----------------------------
  925. # -----------------------------------------------------------
  926. self.mouse_lbl = QtWidgets.QLabel('<b>%s</b>' % _('Mouse Settings'))
  927. grid0.addWidget(self.mouse_lbl, 21, 0, 1, 2)
  928. # Mouse Cursor Shape
  929. self.cursor_lbl = QtWidgets.QLabel('%s:' % _('Cursor Shape'))
  930. self.cursor_lbl.setToolTip(
  931. _("Choose a mouse cursor shape.\n"
  932. "- Small -> with a customizable size.\n"
  933. "- Big -> Infinite lines")
  934. )
  935. self.cursor_radio = RadioSet([
  936. {"label": _("Small"), "value": "small"},
  937. {"label": _("Big"), "value": "big"}
  938. ], orientation='horizontal', stretch=False)
  939. grid0.addWidget(self.cursor_lbl, 22, 0)
  940. grid0.addWidget(self.cursor_radio, 22, 1)
  941. # Mouse Cursor Size
  942. self.cursor_size_lbl = QtWidgets.QLabel('%s:' % _('Cursor Size'))
  943. self.cursor_size_lbl.setToolTip(
  944. _("Set the size of the mouse cursor, in pixels.")
  945. )
  946. self.cursor_size_entry = FCSpinner()
  947. self.cursor_size_entry.set_range(10, 70)
  948. self.cursor_size_entry.setWrapping(True)
  949. grid0.addWidget(self.cursor_size_lbl, 23, 0)
  950. grid0.addWidget(self.cursor_size_entry, 23, 1)
  951. # Cursor Width
  952. self.cursor_width_lbl = QtWidgets.QLabel('%s:' % _('Cursor Width'))
  953. self.cursor_width_lbl.setToolTip(
  954. _("Set the line width of the mouse cursor, in pixels.")
  955. )
  956. self.cursor_width_entry = FCSpinner()
  957. self.cursor_width_entry.set_range(1, 10)
  958. self.cursor_width_entry.setWrapping(True)
  959. grid0.addWidget(self.cursor_width_lbl, 24, 0)
  960. grid0.addWidget(self.cursor_width_entry, 24, 1)
  961. # Cursor Color Enable
  962. self.mouse_cursor_color_cb = FCCheckBox(label='%s' % _('Cursor Color'))
  963. self.mouse_cursor_color_cb.setToolTip(
  964. _("Check this box to color mouse cursor.")
  965. )
  966. grid0.addWidget(self.mouse_cursor_color_cb, 25, 0, 1, 2)
  967. # Cursor Color
  968. self.mouse_color_label = QtWidgets.QLabel('%s:' % _('Cursor Color'))
  969. self.mouse_color_label.setToolTip(
  970. _("Set the color of the mouse cursor.")
  971. )
  972. self.mouse_cursor_entry = FCEntry()
  973. self.mouse_cursor_button = QtWidgets.QPushButton()
  974. self.mouse_cursor_button.setFixedSize(15, 15)
  975. self.form_box_child_1 = QtWidgets.QHBoxLayout()
  976. self.form_box_child_1.addWidget(self.mouse_cursor_entry)
  977. self.form_box_child_1.addWidget(self.mouse_cursor_button)
  978. self.form_box_child_1.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  979. grid0.addWidget(self.mouse_color_label, 26, 0)
  980. grid0.addLayout(self.form_box_child_1, 26, 1)
  981. self.mois = OptionalInputSection(
  982. self.mouse_cursor_color_cb,
  983. [
  984. self.mouse_color_label,
  985. self.mouse_cursor_entry,
  986. self.mouse_cursor_button
  987. ]
  988. )
  989. # Select mouse pan button
  990. self.panbuttonlabel = QtWidgets.QLabel('%s:' % _('Pan Button'))
  991. self.panbuttonlabel.setToolTip(
  992. _("Select the mouse button to use for panning:\n"
  993. "- MMB --> Middle Mouse Button\n"
  994. "- RMB --> Right Mouse Button")
  995. )
  996. self.pan_button_radio = RadioSet([{'label': _('MMB'), 'value': '3'},
  997. {'label': _('RMB'), 'value': '2'}])
  998. grid0.addWidget(self.panbuttonlabel, 27, 0)
  999. grid0.addWidget(self.pan_button_radio, 27, 1)
  1000. # Multiple Selection Modifier Key
  1001. self.mselectlabel = QtWidgets.QLabel('%s:' % _('Multiple Selection'))
  1002. self.mselectlabel.setToolTip(
  1003. _("Select the key used for multiple selection.")
  1004. )
  1005. self.mselect_radio = RadioSet([{'label': _('CTRL'), 'value': 'Control'},
  1006. {'label': _('SHIFT'), 'value': 'Shift'}])
  1007. grid0.addWidget(self.mselectlabel, 28, 0)
  1008. grid0.addWidget(self.mselect_radio, 28, 1)
  1009. separator_line = QtWidgets.QFrame()
  1010. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  1011. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  1012. grid0.addWidget(separator_line, 29, 0, 1, 2)
  1013. # Delete confirmation
  1014. self.delete_conf_cb = FCCheckBox(_('Delete object confirmation'))
  1015. self.delete_conf_cb.setToolTip(
  1016. _("When checked the application will ask for user confirmation\n"
  1017. "whenever the Delete object(s) event is triggered, either by\n"
  1018. "menu shortcut or key shortcut.")
  1019. )
  1020. grid0.addWidget(self.delete_conf_cb, 30, 0, 1, 2)
  1021. # Open behavior
  1022. self.open_style_cb = FCCheckBox('%s' % _('"Open" behavior'))
  1023. self.open_style_cb.setToolTip(
  1024. _("When checked the path for the last saved file is used when saving files,\n"
  1025. "and the path for the last opened file is used when opening files.\n\n"
  1026. "When unchecked the path for opening files is the one used last: either the\n"
  1027. "path for saving files or the path for opening files.")
  1028. )
  1029. grid0.addWidget(self.open_style_cb, 31, 0, 1, 2)
  1030. # Enable/Disable ToolTips globally
  1031. self.toggle_tooltips_cb = FCCheckBox(label=_('Enable ToolTips'))
  1032. self.toggle_tooltips_cb.setToolTip(
  1033. _("Check this box if you want to have toolTips displayed\n"
  1034. "when hovering with mouse over items throughout the App.")
  1035. )
  1036. grid0.addWidget(self.toggle_tooltips_cb, 32, 0, 1, 2)
  1037. # Machinist settings that allow unsafe settings
  1038. self.machinist_cb = FCCheckBox(_("Allow Machinist Unsafe Settings"))
  1039. self.machinist_cb.setToolTip(
  1040. _("If checked, some of the application settings will be allowed\n"
  1041. "to have values that are usually unsafe to use.\n"
  1042. "Like Z travel negative values or Z Cut positive values.\n"
  1043. "It will applied at the next application start.\n"
  1044. "<<WARNING>>: Don't change this unless you know what you are doing !!!")
  1045. )
  1046. grid0.addWidget(self.machinist_cb, 33, 0, 1, 2)
  1047. # Bookmarks Limit in the Help Menu
  1048. self.bm_limit_spinner = FCSpinner()
  1049. self.bm_limit_spinner.set_range(0, 9999)
  1050. self.bm_limit_label = QtWidgets.QLabel('%s:' % _('Bookmarks limit'))
  1051. self.bm_limit_label.setToolTip(
  1052. _("The maximum number of bookmarks that may be installed in the menu.\n"
  1053. "The number of bookmarks in the bookmark manager may be greater\n"
  1054. "but the menu will hold only so much.")
  1055. )
  1056. grid0.addWidget(self.bm_limit_label, 34, 0)
  1057. grid0.addWidget(self.bm_limit_spinner, 34, 1)
  1058. # Activity monitor icon
  1059. self.activity_label = QtWidgets.QLabel('%s:' % _("Activity Icon"))
  1060. self.activity_label.setToolTip(
  1061. _("Select the GIF that show activity when FlatCAM is active.")
  1062. )
  1063. self.activity_combo = FCComboBox()
  1064. self.activity_combo.addItems(['Ball black', 'Ball green', 'Arrow green', 'Eclipse green'])
  1065. grid0.addWidget(self.activity_label, 35, 0)
  1066. grid0.addWidget(self.activity_combo, 35, 1)
  1067. self.layout.addStretch()
  1068. self.mouse_cursor_color_cb.stateChanged.connect(self.on_mouse_cursor_color_enable)
  1069. self.mouse_cursor_entry.editingFinished.connect(self.on_mouse_cursor_entry)
  1070. self.mouse_cursor_button.clicked.connect(self.on_mouse_cursor_button)
  1071. def on_mouse_cursor_color_enable(self, val):
  1072. if val:
  1073. self.app.cursor_color_3D = self.app.defaults["global_cursor_color"]
  1074. else:
  1075. theme_settings = QtCore.QSettings("Open Source", "FlatCAM")
  1076. if theme_settings.contains("theme"):
  1077. theme = theme_settings.value('theme', type=str)
  1078. else:
  1079. theme = 'white'
  1080. if theme == 'white':
  1081. self.app.cursor_color_3D = 'black'
  1082. else:
  1083. self.app.cursor_color_3D = 'gray'
  1084. def on_mouse_cursor_entry(self):
  1085. self.app.defaults['global_cursor_color'] = self.mouse_cursor_entry.get_value()
  1086. self.mouse_cursor_button.setStyleSheet("background-color:%s" % str(self.app.defaults['global_cursor_color']))
  1087. self.app.cursor_color_3D = self.app.defaults["global_cursor_color"]
  1088. def on_mouse_cursor_button(self):
  1089. current_color = QtGui.QColor(self.app.defaults['global_cursor_color'])
  1090. c_dialog = QtWidgets.QColorDialog()
  1091. proj_color = c_dialog.getColor(initial=current_color)
  1092. if proj_color.isValid() is False:
  1093. return
  1094. self.mouse_cursor_button.setStyleSheet("background-color:%s" % str(proj_color.name()))
  1095. new_val_sel = str(proj_color.name())
  1096. self.mouse_cursor_entry.set_value(new_val_sel)
  1097. self.app.defaults['global_cursor_color'] = new_val_sel
  1098. self.app.cursor_color_3D = self.app.defaults["global_cursor_color"]
  1099. class GeneralAppPrefGroupUI(OptionsGroupUI):
  1100. def __init__(self, decimals=4, parent=None):
  1101. super(GeneralAppPrefGroupUI, self).__init__(self)
  1102. self.setTitle(_("App Preferences"))
  1103. self.decimals = decimals
  1104. # Create a form layout for the Application general settings
  1105. grid0 = QtWidgets.QGridLayout()
  1106. self.layout.addLayout(grid0)
  1107. grid0.setColumnStretch(0, 0)
  1108. grid0.setColumnStretch(1, 1)
  1109. # Units for FlatCAM
  1110. self.unitslabel = QtWidgets.QLabel('<span style="color:red;"><b>%s:</b></span>' % _('Units'))
  1111. self.unitslabel.setToolTip(_("The default value for FlatCAM units.\n"
  1112. "Whatever is selected here is set every time\n"
  1113. "FLatCAM is started."))
  1114. self.units_radio = RadioSet([{'label': _('MM'), 'value': 'MM'},
  1115. {'label': _('IN'), 'value': 'IN'}])
  1116. grid0.addWidget(self.unitslabel, 0, 0)
  1117. grid0.addWidget(self.units_radio, 0, 1)
  1118. # Precision Metric
  1119. self.precision_metric_label = QtWidgets.QLabel('%s:' % _('Precision MM'))
  1120. self.precision_metric_label.setToolTip(
  1121. _("The number of decimals used throughout the application\n"
  1122. "when the set units are in METRIC system.\n"
  1123. "Any change here require an application restart.")
  1124. )
  1125. self.precision_metric_entry = FCSpinner()
  1126. self.precision_metric_entry.set_range(2, 16)
  1127. self.precision_metric_entry.setWrapping(True)
  1128. grid0.addWidget(self.precision_metric_label, 1, 0)
  1129. grid0.addWidget(self.precision_metric_entry, 1, 1)
  1130. # Precision Inch
  1131. self.precision_inch_label = QtWidgets.QLabel('%s:' % _('Precision INCH'))
  1132. self.precision_inch_label.setToolTip(
  1133. _("The number of decimals used throughout the application\n"
  1134. "when the set units are in INCH system.\n"
  1135. "Any change here require an application restart.")
  1136. )
  1137. self.precision_inch_entry = FCSpinner()
  1138. self.precision_inch_entry.set_range(2, 16)
  1139. self.precision_inch_entry.setWrapping(True)
  1140. grid0.addWidget(self.precision_inch_label, 2, 0)
  1141. grid0.addWidget(self.precision_inch_entry, 2, 1)
  1142. # Graphic Engine for FlatCAM
  1143. self.ge_label = QtWidgets.QLabel('<b>%s:</b>' % _('Graphic Engine'))
  1144. self.ge_label.setToolTip(_("Choose what graphic engine to use in FlatCAM.\n"
  1145. "Legacy(2D) -> reduced functionality, slow performance but enhanced compatibility.\n"
  1146. "OpenGL(3D) -> full functionality, high performance\n"
  1147. "Some graphic cards are too old and do not work in OpenGL(3D) mode, like:\n"
  1148. "Intel HD3000 or older. In this case the plot area will be black therefore\n"
  1149. "use the Legacy(2D) mode."))
  1150. self.ge_radio = RadioSet([{'label': _('Legacy(2D)'), 'value': '2D'},
  1151. {'label': _('OpenGL(3D)'), 'value': '3D'}],
  1152. orientation='vertical')
  1153. grid0.addWidget(self.ge_label, 3, 0)
  1154. grid0.addWidget(self.ge_radio, 3, 1)
  1155. separator_line = QtWidgets.QFrame()
  1156. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  1157. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  1158. grid0.addWidget(separator_line, 4, 0, 1, 2)
  1159. # Application Level for FlatCAM
  1160. self.app_level_label = QtWidgets.QLabel('<span style="color:red;"><b>%s:</b></span>' % _('APP. LEVEL'))
  1161. self.app_level_label.setToolTip(_("Choose the default level of usage for FlatCAM.\n"
  1162. "BASIC level -> reduced functionality, best for beginner's.\n"
  1163. "ADVANCED level -> full functionality.\n\n"
  1164. "The choice here will influence the parameters in\n"
  1165. "the Selected Tab for all kinds of FlatCAM objects."))
  1166. self.app_level_radio = RadioSet([{'label': _('Basic'), 'value': 'b'},
  1167. {'label': _('Advanced'), 'value': 'a'}])
  1168. grid0.addWidget(self.app_level_label, 5, 0)
  1169. grid0.addWidget(self.app_level_radio, 5, 1)
  1170. # Portability for FlatCAM
  1171. self.portability_cb = FCCheckBox('%s' % _('Portable app'))
  1172. self.portability_cb.setToolTip(_("Choose if the application should run as portable.\n\n"
  1173. "If Checked the application will run portable,\n"
  1174. "which means that the preferences files will be saved\n"
  1175. "in the application folder, in the lib\\config subfolder."))
  1176. grid0.addWidget(self.portability_cb, 6, 0, 1, 2)
  1177. separator_line = QtWidgets.QFrame()
  1178. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  1179. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  1180. grid0.addWidget(separator_line, 7, 0, 1, 2)
  1181. # Languages for FlatCAM
  1182. self.languagelabel = QtWidgets.QLabel('<b>%s</b>' % _('Languages'))
  1183. self.languagelabel.setToolTip(_("Set the language used throughout FlatCAM."))
  1184. self.language_cb = FCComboBox()
  1185. grid0.addWidget(self.languagelabel, 8, 0, 1, 2)
  1186. grid0.addWidget(self.language_cb, 9, 0, 1, 2)
  1187. self.language_apply_btn = FCButton(_("Apply Language"))
  1188. self.language_apply_btn.setToolTip(_("Set the language used throughout FlatCAM.\n"
  1189. "The app will restart after click."))
  1190. grid0.addWidget(self.language_apply_btn, 15, 0, 1, 2)
  1191. separator_line = QtWidgets.QFrame()
  1192. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  1193. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  1194. grid0.addWidget(separator_line, 16, 0, 1, 2)
  1195. # -----------------------------------------------------------
  1196. # ----------- APPLICATION STARTUP SETTINGS ------------------
  1197. # -----------------------------------------------------------
  1198. self.startup_label = QtWidgets.QLabel('<b>%s</b>' % _('Startup Settings'))
  1199. grid0.addWidget(self.startup_label, 17, 0, 1, 2)
  1200. # Splash Screen
  1201. self.splash_cb = FCCheckBox('%s' % _('Splash Screen'))
  1202. self.splash_cb.setToolTip(
  1203. _("Enable display of the splash screen at application startup.")
  1204. )
  1205. settings = QSettings("Open Source", "FlatCAM")
  1206. if settings.value("splash_screen"):
  1207. self.splash_cb.set_value(True)
  1208. else:
  1209. self.splash_cb.set_value(False)
  1210. grid0.addWidget(self.splash_cb, 18, 0, 1, 2)
  1211. # Sys Tray Icon
  1212. self.systray_cb = FCCheckBox('%s' % _('Sys Tray Icon'))
  1213. self.systray_cb.setToolTip(
  1214. _("Enable display of FlatCAM icon in Sys Tray.")
  1215. )
  1216. grid0.addWidget(self.systray_cb, 19, 0, 1, 2)
  1217. # Shell StartUp CB
  1218. self.shell_startup_cb = FCCheckBox(label='%s' % _('Show Shell'))
  1219. self.shell_startup_cb.setToolTip(
  1220. _("Check this box if you want the shell to\n"
  1221. "start automatically at startup.")
  1222. )
  1223. grid0.addWidget(self.shell_startup_cb, 20, 0, 1, 2)
  1224. # Project at StartUp CB
  1225. self.project_startup_cb = FCCheckBox(label='%s' % _('Show Project'))
  1226. self.project_startup_cb.setToolTip(
  1227. _("Check this box if you want the project/selected/tool tab area to\n"
  1228. "to be shown automatically at startup.")
  1229. )
  1230. grid0.addWidget(self.project_startup_cb, 21, 0, 1, 2)
  1231. # Version Check CB
  1232. self.version_check_cb = FCCheckBox(label='%s' % _('Version Check'))
  1233. self.version_check_cb.setToolTip(
  1234. _("Check this box if you want to check\n"
  1235. "for a new version automatically at startup.")
  1236. )
  1237. grid0.addWidget(self.version_check_cb, 22, 0, 1, 2)
  1238. # Send Stats CB
  1239. self.send_stats_cb = FCCheckBox(label='%s' % _('Send Statistics'))
  1240. self.send_stats_cb.setToolTip(
  1241. _("Check this box if you agree to send anonymous\n"
  1242. "stats automatically at startup, to help improve FlatCAM.")
  1243. )
  1244. grid0.addWidget(self.send_stats_cb, 23, 0, 1, 2)
  1245. self.ois_version_check = OptionalInputSection(self.version_check_cb, [self.send_stats_cb])
  1246. separator_line = QtWidgets.QFrame()
  1247. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  1248. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  1249. grid0.addWidget(separator_line, 24, 0, 1, 2)
  1250. # Worker Numbers
  1251. self.worker_number_label = QtWidgets.QLabel('%s:' % _('Workers number'))
  1252. self.worker_number_label.setToolTip(
  1253. _("The number of Qthreads made available to the App.\n"
  1254. "A bigger number may finish the jobs more quickly but\n"
  1255. "depending on your computer speed, may make the App\n"
  1256. "unresponsive. Can have a value between 2 and 16.\n"
  1257. "Default value is 2.\n"
  1258. "After change, it will be applied at next App start.")
  1259. )
  1260. self.worker_number_sb = FCSpinner()
  1261. self.worker_number_sb.set_range(2, 16)
  1262. grid0.addWidget(self.worker_number_label, 25, 0)
  1263. grid0.addWidget(self.worker_number_sb, 25, 1)
  1264. # Geometric tolerance
  1265. tol_label = QtWidgets.QLabel('%s:' % _("Geo Tolerance"))
  1266. tol_label.setToolTip(_(
  1267. "This value can counter the effect of the Circle Steps\n"
  1268. "parameter. Default value is 0.005.\n"
  1269. "A lower value will increase the detail both in image\n"
  1270. "and in Gcode for the circles, with a higher cost in\n"
  1271. "performance. Higher value will provide more\n"
  1272. "performance at the expense of level of detail."
  1273. ))
  1274. self.tol_entry = FCDoubleSpinner()
  1275. self.tol_entry.setSingleStep(0.001)
  1276. self.tol_entry.set_precision(6)
  1277. grid0.addWidget(tol_label, 26, 0)
  1278. grid0.addWidget(self.tol_entry, 26, 1)
  1279. separator_line = QtWidgets.QFrame()
  1280. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  1281. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  1282. grid0.addWidget(separator_line, 27, 0, 1, 2)
  1283. # Save Settings
  1284. self.save_label = QtWidgets.QLabel('<b>%s</b>' % _("Save Settings"))
  1285. grid0.addWidget(self.save_label, 28, 0, 1, 2)
  1286. # Save compressed project CB
  1287. self.save_type_cb = FCCheckBox(_('Save Compressed Project'))
  1288. self.save_type_cb.setToolTip(
  1289. _("Whether to save a compressed or uncompressed project.\n"
  1290. "When checked it will save a compressed FlatCAM project.")
  1291. )
  1292. grid0.addWidget(self.save_type_cb, 29, 0, 1, 2)
  1293. # Project LZMA Comppression Level
  1294. self.compress_spinner = FCSpinner()
  1295. self.compress_spinner.set_range(0, 9)
  1296. self.compress_label = QtWidgets.QLabel('%s:' % _('Compression'))
  1297. self.compress_label.setToolTip(
  1298. _("The level of compression used when saving\n"
  1299. "a FlatCAM project. Higher value means better compression\n"
  1300. "but require more RAM usage and more processing time.")
  1301. )
  1302. grid0.addWidget(self.compress_label, 30, 0)
  1303. grid0.addWidget(self.compress_spinner, 30, 1)
  1304. self.proj_ois = OptionalInputSection(self.save_type_cb, [self.compress_label, self.compress_spinner], True)
  1305. separator_line = QtWidgets.QFrame()
  1306. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  1307. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  1308. grid0.addWidget(separator_line, 31, 0, 1, 2)
  1309. self.pdf_param_label = QtWidgets.QLabel('<B>%s:</b>' % _("Text to PDF parameters"))
  1310. self.pdf_param_label.setToolTip(
  1311. _("Used when saving text in Code Editor or in FlatCAM Document objects.")
  1312. )
  1313. grid0.addWidget(self.pdf_param_label, 32, 0, 1, 2)
  1314. # Top Margin value
  1315. self.tmargin_entry = FCDoubleSpinner()
  1316. self.tmargin_entry.set_precision(self.decimals)
  1317. self.tmargin_entry.set_range(0.0000, 9999.9999)
  1318. self.tmargin_label = QtWidgets.QLabel('%s:' % _("Top Margin"))
  1319. self.tmargin_label.setToolTip(
  1320. _("Distance between text body and the top of the PDF file.")
  1321. )
  1322. grid0.addWidget(self.tmargin_label, 33, 0)
  1323. grid0.addWidget(self.tmargin_entry, 33, 1)
  1324. # Bottom Margin value
  1325. self.bmargin_entry = FCDoubleSpinner()
  1326. self.bmargin_entry.set_precision(self.decimals)
  1327. self.bmargin_entry.set_range(0.0000, 9999.9999)
  1328. self.bmargin_label = QtWidgets.QLabel('%s:' % _("Bottom Margin"))
  1329. self.bmargin_label.setToolTip(
  1330. _("Distance between text body and the bottom of the PDF file.")
  1331. )
  1332. grid0.addWidget(self.bmargin_label, 34, 0)
  1333. grid0.addWidget(self.bmargin_entry, 34, 1)
  1334. # Left Margin value
  1335. self.lmargin_entry = FCDoubleSpinner()
  1336. self.lmargin_entry.set_precision(self.decimals)
  1337. self.lmargin_entry.set_range(0.0000, 9999.9999)
  1338. self.lmargin_label = QtWidgets.QLabel('%s:' % _("Left Margin"))
  1339. self.lmargin_label.setToolTip(
  1340. _("Distance between text body and the left of the PDF file.")
  1341. )
  1342. grid0.addWidget(self.lmargin_label, 35, 0)
  1343. grid0.addWidget(self.lmargin_entry, 35, 1)
  1344. # Right Margin value
  1345. self.rmargin_entry = FCDoubleSpinner()
  1346. self.rmargin_entry.set_precision(self.decimals)
  1347. self.rmargin_entry.set_range(0.0000, 9999.9999)
  1348. self.rmargin_label = QtWidgets.QLabel('%s:' % _("Right Margin"))
  1349. self.rmargin_label.setToolTip(
  1350. _("Distance between text body and the right of the PDF file.")
  1351. )
  1352. grid0.addWidget(self.rmargin_label, 36, 0)
  1353. grid0.addWidget(self.rmargin_entry, 36, 1)
  1354. self.layout.addStretch()
  1355. if sys.platform != 'win32':
  1356. self.portability_cb.hide()
  1357. # splash screen button signal
  1358. self.splash_cb.stateChanged.connect(self.on_splash_changed)
  1359. # Monitor the checkbox from the Application Defaults Tab and show the TCL shell or not depending on it's value
  1360. self.shell_startup_cb.clicked.connect(self.app.on_toggle_shell_from_settings)
  1361. self.language_apply_btn.clicked.connect(lambda: fcTranslate.on_language_apply_click(app=self.app, restart=True))
  1362. def on_splash_changed(self, state):
  1363. settings = QSettings("Open Source", "FlatCAM")
  1364. settings.setValue('splash_screen', 1) if state else settings.setValue('splash_screen', 0)
  1365. # This will write the setting to the platform specific storage.
  1366. del settings
  1367. class GerberGenPrefGroupUI(OptionsGroupUI):
  1368. def __init__(self, decimals=4, parent=None):
  1369. # OptionsGroupUI.__init__(self, "Gerber General Preferences", parent=parent)
  1370. super(GerberGenPrefGroupUI, self).__init__(self)
  1371. self.setTitle(str(_("Gerber General")))
  1372. self.decimals = decimals
  1373. # ## Plot options
  1374. self.plot_options_label = QtWidgets.QLabel("<b>%s:</b>" % _("Plot Options"))
  1375. self.layout.addWidget(self.plot_options_label)
  1376. grid0 = QtWidgets.QGridLayout()
  1377. self.layout.addLayout(grid0)
  1378. # Solid CB
  1379. self.solid_cb = FCCheckBox(label='%s' % _('Solid'))
  1380. self.solid_cb.setToolTip(
  1381. _("Solid color polygons.")
  1382. )
  1383. grid0.addWidget(self.solid_cb, 0, 0)
  1384. # Multicolored CB
  1385. self.multicolored_cb = FCCheckBox(label='%s' % _('M-Color'))
  1386. self.multicolored_cb.setToolTip(
  1387. _("Draw polygons in different colors.")
  1388. )
  1389. grid0.addWidget(self.multicolored_cb, 0, 1)
  1390. # Plot CB
  1391. self.plot_cb = FCCheckBox(label='%s' % _('Plot'))
  1392. self.plot_options_label.setToolTip(
  1393. _("Plot (show) this object.")
  1394. )
  1395. grid0.addWidget(self.plot_cb, 0, 2)
  1396. # Number of circle steps for circular aperture linear approximation
  1397. self.circle_steps_label = QtWidgets.QLabel('%s:' % _("Circle Steps"))
  1398. self.circle_steps_label.setToolTip(
  1399. _("The number of circle steps for Gerber \n"
  1400. "circular aperture linear approximation.")
  1401. )
  1402. self.circle_steps_entry = FCSpinner()
  1403. self.circle_steps_entry.set_range(0, 9999)
  1404. grid0.addWidget(self.circle_steps_label, 1, 0)
  1405. grid0.addWidget(self.circle_steps_entry, 1, 1, 1, 2)
  1406. grid0.addWidget(QtWidgets.QLabel(''), 2, 0, 1, 3)
  1407. # Default format for Gerber
  1408. self.gerber_default_label = QtWidgets.QLabel('<b>%s:</b>' % _('Default Values'))
  1409. self.gerber_default_label.setToolTip(
  1410. _("Those values will be used as fallback values\n"
  1411. "in case that they are not found in the Gerber file.")
  1412. )
  1413. grid0.addWidget(self.gerber_default_label, 3, 0, 1, 3)
  1414. # Gerber Units
  1415. self.gerber_units_label = QtWidgets.QLabel('%s:' % _('Units'))
  1416. self.gerber_units_label.setToolTip(
  1417. _("The units used in the Gerber file.")
  1418. )
  1419. self.gerber_units_radio = RadioSet([{'label': _('INCH'), 'value': 'IN'},
  1420. {'label': _('MM'), 'value': 'MM'}])
  1421. self.gerber_units_radio.setToolTip(
  1422. _("The units used in the Gerber file.")
  1423. )
  1424. grid0.addWidget(self.gerber_units_label, 4, 0)
  1425. grid0.addWidget(self.gerber_units_radio, 4, 1, 1, 2)
  1426. # Gerber Zeros
  1427. self.gerber_zeros_label = QtWidgets.QLabel('%s:' % _('Zeros'))
  1428. self.gerber_zeros_label.setAlignment(QtCore.Qt.AlignLeft)
  1429. self.gerber_zeros_label.setToolTip(
  1430. _("This sets the type of Gerber zeros.\n"
  1431. "If LZ then Leading Zeros are removed and\n"
  1432. "Trailing Zeros are kept.\n"
  1433. "If TZ is checked then Trailing Zeros are removed\n"
  1434. "and Leading Zeros are kept.")
  1435. )
  1436. self.gerber_zeros_radio = RadioSet([{'label': _('LZ'), 'value': 'L'},
  1437. {'label': _('TZ'), 'value': 'T'}])
  1438. self.gerber_zeros_radio.setToolTip(
  1439. _("This sets the type of Gerber zeros.\n"
  1440. "If LZ then Leading Zeros are removed and\n"
  1441. "Trailing Zeros are kept.\n"
  1442. "If TZ is checked then Trailing Zeros are removed\n"
  1443. "and Leading Zeros are kept.")
  1444. )
  1445. grid0.addWidget(self.gerber_zeros_label, 5, 0)
  1446. grid0.addWidget(self.gerber_zeros_radio, 5, 1, 1, 2)
  1447. separator_line = QtWidgets.QFrame()
  1448. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  1449. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  1450. grid0.addWidget(separator_line, 6, 0, 1, 3)
  1451. # Apertures Cleaning
  1452. self.gerber_clean_cb = FCCheckBox(label='%s' % _('Clean Apertures'))
  1453. self.gerber_clean_cb.setToolTip(
  1454. _("Will remove apertures that do not have geometry\n"
  1455. "thus lowering the number of apertures in the Gerber object.")
  1456. )
  1457. grid0.addWidget(self.gerber_clean_cb, 7, 0, 1, 3)
  1458. # Apply Extra Buffering
  1459. self.gerber_extra_buffering = FCCheckBox(label='%s' % _('Polarity change buffer'))
  1460. self.gerber_extra_buffering.setToolTip(
  1461. _("Will apply extra buffering for the\n"
  1462. "solid geometry when we have polarity changes.\n"
  1463. "May help loading Gerber files that otherwise\n"
  1464. "do not load correctly.")
  1465. )
  1466. grid0.addWidget(self.gerber_extra_buffering, 8, 0, 1, 3)
  1467. separator_line = QtWidgets.QFrame()
  1468. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  1469. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  1470. grid0.addWidget(separator_line, 9, 0, 1, 3)
  1471. # Gerber Object Color
  1472. self.gerber_color_label = QtWidgets.QLabel('<b>%s</b>' % _('Gerber Object Color'))
  1473. grid0.addWidget(self.gerber_color_label, 10, 0, 1, 3)
  1474. # Plot Line Color
  1475. self.pl_color_label = QtWidgets.QLabel('%s:' % _('Outline'))
  1476. self.pl_color_label.setToolTip(
  1477. _("Set the line color for plotted objects.")
  1478. )
  1479. self.pl_color_entry = FCEntry()
  1480. self.pl_color_button = QtWidgets.QPushButton()
  1481. self.pl_color_button.setFixedSize(15, 15)
  1482. self.form_box_child_2 = QtWidgets.QHBoxLayout()
  1483. self.form_box_child_2.addWidget(self.pl_color_entry)
  1484. self.form_box_child_2.addWidget(self.pl_color_button)
  1485. self.form_box_child_2.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  1486. grid0.addWidget(self.pl_color_label, 11, 0)
  1487. grid0.addLayout(self.form_box_child_2, 11, 1, 1, 2)
  1488. # Plot Fill Color
  1489. self.pf_color_label = QtWidgets.QLabel('%s:' % _('Fill'))
  1490. self.pf_color_label.setToolTip(
  1491. _("Set the fill color for plotted objects.\n"
  1492. "First 6 digits are the color and the last 2\n"
  1493. "digits are for alpha (transparency) level.")
  1494. )
  1495. self.pf_color_entry = FCEntry()
  1496. self.pf_color_button = QtWidgets.QPushButton()
  1497. self.pf_color_button.setFixedSize(15, 15)
  1498. self.form_box_child_1 = QtWidgets.QHBoxLayout()
  1499. self.form_box_child_1.addWidget(self.pf_color_entry)
  1500. self.form_box_child_1.addWidget(self.pf_color_button)
  1501. self.form_box_child_1.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  1502. grid0.addWidget(self.pf_color_label, 12, 0)
  1503. grid0.addLayout(self.form_box_child_1, 12, 1, 1, 2)
  1504. # Plot Fill Transparency Level
  1505. self.pf_alpha_label = QtWidgets.QLabel('%s:' % _('Alpha'))
  1506. self.pf_alpha_label.setToolTip(
  1507. _("Set the fill transparency for plotted objects.")
  1508. )
  1509. self.pf_color_alpha_slider = QtWidgets.QSlider(QtCore.Qt.Horizontal)
  1510. self.pf_color_alpha_slider.setMinimum(0)
  1511. self.pf_color_alpha_slider.setMaximum(255)
  1512. self.pf_color_alpha_slider.setSingleStep(1)
  1513. self.pf_color_alpha_spinner = FCSpinner()
  1514. self.pf_color_alpha_spinner.setMinimumWidth(70)
  1515. self.pf_color_alpha_spinner.set_range(0, 255)
  1516. self.form_box_child_3 = QtWidgets.QHBoxLayout()
  1517. self.form_box_child_3.addWidget(self.pf_color_alpha_slider)
  1518. self.form_box_child_3.addWidget(self.pf_color_alpha_spinner)
  1519. grid0.addWidget(self.pf_alpha_label, 13, 0)
  1520. grid0.addLayout(self.form_box_child_3, 13, 1, 1, 2)
  1521. self.layout.addStretch()
  1522. # Setting plot colors signals
  1523. self.pl_color_entry.editingFinished.connect(self.on_pl_color_entry)
  1524. self.pl_color_button.clicked.connect(self.on_pl_color_button)
  1525. self.pf_color_entry.editingFinished.connect(self.on_pf_color_entry)
  1526. self.pf_color_button.clicked.connect(self.on_pf_color_button)
  1527. self.pf_color_alpha_spinner.valueChanged.connect(self.on_pf_color_spinner)
  1528. self.pf_color_alpha_slider.valueChanged.connect(self.on_pf_color_slider)
  1529. # Setting plot colors handlers
  1530. def on_pf_color_entry(self):
  1531. self.app.defaults['gerber_plot_fill'] = self.pf_color_entry.get_value()[:7] + \
  1532. self.app.defaults['gerber_plot_fill'][7:9]
  1533. self.pf_color_button.setStyleSheet("background-color:%s" % str(self.defaults['gerber_plot_fill'])[:7])
  1534. def on_pf_color_button(self):
  1535. current_color = QtGui.QColor(self.app.defaults['gerber_plot_fill'][:7])
  1536. c_dialog = QtWidgets.QColorDialog()
  1537. plot_fill_color = c_dialog.getColor(initial=current_color)
  1538. if plot_fill_color.isValid() is False:
  1539. return
  1540. self.pf_color_button.setStyleSheet("background-color:%s" % str(plot_fill_color.name()))
  1541. new_val = str(plot_fill_color.name()) + str(self.app.defaults['gerber_plot_fill'][7:9])
  1542. self.pf_color_entry.set_value(new_val)
  1543. self.app.defaults['gerber_plot_fill'] = new_val
  1544. def on_pf_color_spinner(self):
  1545. spinner_value = self.pf_color_alpha_spinner.value()
  1546. self.pf_color_alpha_slider.setValue(spinner_value)
  1547. self.app.defaults['gerber_plot_fill'] = \
  1548. self.app.defaults['gerber_plot_fill'][:7] + \
  1549. (hex(spinner_value)[2:] if int(hex(spinner_value)[2:], 16) > 0 else '00')
  1550. self.app.defaults['gerber_plot_line'] = \
  1551. self.app.defaults['gerber_plot_line'][:7] + \
  1552. (hex(spinner_value)[2:] if int(hex(spinner_value)[2:], 16) > 0 else '00')
  1553. def on_pf_color_slider(self):
  1554. slider_value = self.pf_color_alpha_slider.value()
  1555. self.pf_color_alpha_spinner.setValue(slider_value)
  1556. def on_pl_color_entry(self):
  1557. self.app.defaults['gerber_plot_line'] = self.pl_color_entry.get_value()[:7] + \
  1558. self.app.defaults['gerber_plot_line'][7:9]
  1559. self.pl_color_button.setStyleSheet("background-color:%s" % str(self.defaults['gerber_plot_line'])[:7])
  1560. def on_pl_color_button(self):
  1561. current_color = QtGui.QColor(self.app.defaults['gerber_plot_line'][:7])
  1562. # print(current_color)
  1563. c_dialog = QtWidgets.QColorDialog()
  1564. plot_line_color = c_dialog.getColor(initial=current_color)
  1565. if plot_line_color.isValid() is False:
  1566. return
  1567. self.pl_color_button.setStyleSheet("background-color:%s" % str(plot_line_color.name()))
  1568. new_val_line = str(plot_line_color.name()) + str(self.app.defaults['gerber_plot_line'][7:9])
  1569. self.pl_color_entry.set_value(new_val_line)
  1570. self.app.defaults['gerber_plot_line'] = new_val_line
  1571. class GerberOptPrefGroupUI(OptionsGroupUI):
  1572. def __init__(self, decimals=4, parent=None):
  1573. # OptionsGroupUI.__init__(self, "Gerber Options Preferences", parent=parent)
  1574. super(GerberOptPrefGroupUI, self).__init__(self)
  1575. self.decimals = decimals
  1576. self.setTitle(str(_("Gerber Options")))
  1577. # ## Isolation Routing
  1578. self.isolation_routing_label = QtWidgets.QLabel("<b>%s:</b>" % _("Isolation Routing"))
  1579. self.isolation_routing_label.setToolTip(
  1580. _("Create a Geometry object with\n"
  1581. "toolpaths to cut outside polygons.")
  1582. )
  1583. self.layout.addWidget(self.isolation_routing_label)
  1584. # Cutting Tool Diameter
  1585. grid0 = QtWidgets.QGridLayout()
  1586. self.layout.addLayout(grid0)
  1587. tdlabel = QtWidgets.QLabel('%s:' % _('Tool dia'))
  1588. tdlabel.setToolTip(
  1589. _("Diameter of the cutting tool.")
  1590. )
  1591. grid0.addWidget(tdlabel, 0, 0)
  1592. self.iso_tool_dia_entry = FCDoubleSpinner()
  1593. self.iso_tool_dia_entry.set_precision(self.decimals)
  1594. self.iso_tool_dia_entry.setSingleStep(0.1)
  1595. self.iso_tool_dia_entry.set_range(-9999, 9999)
  1596. grid0.addWidget(self.iso_tool_dia_entry, 0, 1)
  1597. # Nr of passes
  1598. passlabel = QtWidgets.QLabel('%s:' % _('# Passes'))
  1599. passlabel.setToolTip(
  1600. _("Width of the isolation gap in\n"
  1601. "number (integer) of tool widths.")
  1602. )
  1603. self.iso_width_entry = FCSpinner()
  1604. self.iso_width_entry.set_range(1, 999)
  1605. grid0.addWidget(passlabel, 1, 0)
  1606. grid0.addWidget(self.iso_width_entry, 1, 1)
  1607. # Pass overlap
  1608. overlabel = QtWidgets.QLabel('%s:' % _('Pass overlap'))
  1609. overlabel.setToolTip(
  1610. _("How much (percentage) of the tool width to overlap each tool pass.")
  1611. )
  1612. self.iso_overlap_entry = FCDoubleSpinner(suffix='%')
  1613. self.iso_overlap_entry.set_precision(self.decimals)
  1614. self.iso_overlap_entry.setWrapping(True)
  1615. self.iso_overlap_entry.setRange(0.0000, 99.9999)
  1616. self.iso_overlap_entry.setSingleStep(0.1)
  1617. grid0.addWidget(overlabel, 2, 0)
  1618. grid0.addWidget(self.iso_overlap_entry, 2, 1)
  1619. # Isolation Scope
  1620. self.iso_scope_label = QtWidgets.QLabel('%s:' % _('Scope'))
  1621. self.iso_scope_label.setToolTip(
  1622. _("Isolation scope. Choose what to isolate:\n"
  1623. "- 'All' -> Isolate all the polygons in the object\n"
  1624. "- 'Selection' -> Isolate a selection of polygons.")
  1625. )
  1626. self.iso_scope_radio = RadioSet([{'label': _('All'), 'value': 'all'},
  1627. {'label': _('Selection'), 'value': 'single'}])
  1628. grid0.addWidget(self.iso_scope_label, 3, 0)
  1629. grid0.addWidget(self.iso_scope_radio, 3, 1, 1, 2)
  1630. # Milling Type
  1631. milling_type_label = QtWidgets.QLabel('%s:' % _('Milling Type'))
  1632. milling_type_label.setToolTip(
  1633. _("Milling type:\n"
  1634. "- climb / best for precision milling and to reduce tool usage\n"
  1635. "- conventional / useful when there is no backlash compensation")
  1636. )
  1637. grid0.addWidget(milling_type_label, 4, 0)
  1638. self.milling_type_radio = RadioSet([{'label': _('Climb'), 'value': 'cl'},
  1639. {'label': _('Conventional'), 'value': 'cv'}])
  1640. grid0.addWidget(self.milling_type_radio, 4, 1)
  1641. # Combine passes
  1642. self.combine_passes_cb = FCCheckBox(label=_('Combine Passes'))
  1643. self.combine_passes_cb.setToolTip(
  1644. _("Combine all passes into one object")
  1645. )
  1646. grid0.addWidget(self.combine_passes_cb, 5, 0, 1, 2)
  1647. separator_line = QtWidgets.QFrame()
  1648. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  1649. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  1650. grid0.addWidget(separator_line, 6, 0, 1, 2)
  1651. # ## Clear non-copper regions
  1652. self.clearcopper_label = QtWidgets.QLabel("<b>%s:</b>" % _("Non-copper regions"))
  1653. self.clearcopper_label.setToolTip(
  1654. _("Create polygons covering the\n"
  1655. "areas without copper on the PCB.\n"
  1656. "Equivalent to the inverse of this\n"
  1657. "object. Can be used to remove all\n"
  1658. "copper from a specified region.")
  1659. )
  1660. self.layout.addWidget(self.clearcopper_label)
  1661. grid1 = QtWidgets.QGridLayout()
  1662. self.layout.addLayout(grid1)
  1663. # Margin
  1664. bmlabel = QtWidgets.QLabel('%s:' % _('Boundary Margin'))
  1665. bmlabel.setToolTip(
  1666. _("Specify the edge of the PCB\n"
  1667. "by drawing a box around all\n"
  1668. "objects with this minimum\n"
  1669. "distance.")
  1670. )
  1671. grid1.addWidget(bmlabel, 0, 0)
  1672. self.noncopper_margin_entry = FCDoubleSpinner()
  1673. self.noncopper_margin_entry.set_precision(self.decimals)
  1674. self.noncopper_margin_entry.setSingleStep(0.1)
  1675. self.noncopper_margin_entry.set_range(-9999, 9999)
  1676. grid1.addWidget(self.noncopper_margin_entry, 0, 1)
  1677. # Rounded corners
  1678. self.noncopper_rounded_cb = FCCheckBox(label=_("Rounded Geo"))
  1679. self.noncopper_rounded_cb.setToolTip(
  1680. _("Resulting geometry will have rounded corners.")
  1681. )
  1682. grid1.addWidget(self.noncopper_rounded_cb, 1, 0, 1, 2)
  1683. separator_line = QtWidgets.QFrame()
  1684. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  1685. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  1686. grid1.addWidget(separator_line, 2, 0, 1, 2)
  1687. # ## Bounding box
  1688. self.boundingbox_label = QtWidgets.QLabel('<b>%s:</b>' % _('Bounding Box'))
  1689. self.layout.addWidget(self.boundingbox_label)
  1690. grid2 = QtWidgets.QGridLayout()
  1691. self.layout.addLayout(grid2)
  1692. bbmargin = QtWidgets.QLabel('%s:' % _('Boundary Margin'))
  1693. bbmargin.setToolTip(
  1694. _("Distance of the edges of the box\n"
  1695. "to the nearest polygon.")
  1696. )
  1697. self.bbmargin_entry = FCDoubleSpinner()
  1698. self.bbmargin_entry.set_precision(self.decimals)
  1699. self.bbmargin_entry.setSingleStep(0.1)
  1700. self.bbmargin_entry.set_range(-9999, 9999)
  1701. grid2.addWidget(bbmargin, 0, 0)
  1702. grid2.addWidget(self.bbmargin_entry, 0, 1)
  1703. self.bbrounded_cb = FCCheckBox(label='%s' % _("Rounded Geo"))
  1704. self.bbrounded_cb.setToolTip(
  1705. _("If the bounding box is \n"
  1706. "to have rounded corners\n"
  1707. "their radius is equal to\n"
  1708. "the margin.")
  1709. )
  1710. grid2.addWidget(self.bbrounded_cb, 1, 0, 1, 2)
  1711. self.layout.addStretch()
  1712. class GerberAdvOptPrefGroupUI(OptionsGroupUI):
  1713. def __init__(self, decimals=4, parent=None):
  1714. # OptionsGroupUI.__init__(self, "Gerber Adv. Options Preferences", parent=parent)
  1715. super(GerberAdvOptPrefGroupUI, self).__init__(self)
  1716. self.setTitle(str(_("Gerber Adv. Options")))
  1717. self.decimals = decimals
  1718. # ## Advanced Gerber Parameters
  1719. self.adv_param_label = QtWidgets.QLabel('<b>%s:</b>' % _('Advanced Options'))
  1720. self.adv_param_label.setToolTip(
  1721. _("A list of Gerber advanced parameters.\n"
  1722. "Those parameters are available only for\n"
  1723. "Advanced App. Level.")
  1724. )
  1725. self.layout.addWidget(self.adv_param_label)
  1726. grid0 = QtWidgets.QGridLayout()
  1727. self.layout.addLayout(grid0)
  1728. # Follow Attribute
  1729. self.follow_cb = FCCheckBox(label=_('"Follow"'))
  1730. self.follow_cb.setToolTip(
  1731. _("Generate a 'Follow' geometry.\n"
  1732. "This means that it will cut through\n"
  1733. "the middle of the trace.")
  1734. )
  1735. grid0.addWidget(self.follow_cb, 0, 0, 1, 2)
  1736. # Aperture Table Visibility CB
  1737. self.aperture_table_visibility_cb = FCCheckBox(label=_('Table Show/Hide'))
  1738. self.aperture_table_visibility_cb.setToolTip(
  1739. _("Toggle the display of the Gerber Apertures Table.\n"
  1740. "Also, on hide, it will delete all mark shapes\n"
  1741. "that are drawn on canvas.")
  1742. )
  1743. grid0.addWidget(self.aperture_table_visibility_cb, 1, 0, 1, 2)
  1744. separator_line = QtWidgets.QFrame()
  1745. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  1746. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  1747. grid0.addWidget(separator_line, 2, 0, 1, 2)
  1748. # Tool Type
  1749. self.tool_type_label = QtWidgets.QLabel('<b>%s</b>' % _('Tool Type'))
  1750. self.tool_type_label.setToolTip(
  1751. _("Choose what tool to use for Gerber isolation:\n"
  1752. "'Circular' or 'V-shape'.\n"
  1753. "When the 'V-shape' is selected then the tool\n"
  1754. "diameter will depend on the chosen cut depth.")
  1755. )
  1756. self.tool_type_radio = RadioSet([{'label': 'Circular', 'value': 'circular'},
  1757. {'label': 'V-Shape', 'value': 'v'}])
  1758. grid0.addWidget(self.tool_type_label, 3, 0)
  1759. grid0.addWidget(self.tool_type_radio, 3, 1, 1, 2)
  1760. # Tip Dia
  1761. self.tipdialabel = QtWidgets.QLabel('%s:' % _('V-Tip Dia'))
  1762. self.tipdialabel.setToolTip(
  1763. _("The tip diameter for V-Shape Tool")
  1764. )
  1765. self.tipdia_spinner = FCDoubleSpinner()
  1766. self.tipdia_spinner.set_precision(self.decimals)
  1767. self.tipdia_spinner.set_range(-99.9999, 99.9999)
  1768. self.tipdia_spinner.setSingleStep(0.1)
  1769. self.tipdia_spinner.setWrapping(True)
  1770. grid0.addWidget(self.tipdialabel, 4, 0)
  1771. grid0.addWidget(self.tipdia_spinner, 4, 1, 1, 2)
  1772. # Tip Angle
  1773. self.tipanglelabel = QtWidgets.QLabel('%s:' % _('V-Tip Angle'))
  1774. self.tipanglelabel.setToolTip(
  1775. _("The tip angle for V-Shape Tool.\n"
  1776. "In degree.")
  1777. )
  1778. self.tipangle_spinner = FCSpinner()
  1779. self.tipangle_spinner.set_range(1, 180)
  1780. self.tipangle_spinner.set_step(5)
  1781. self.tipangle_spinner.setWrapping(True)
  1782. grid0.addWidget(self.tipanglelabel, 5, 0)
  1783. grid0.addWidget(self.tipangle_spinner, 5, 1, 1, 2)
  1784. # Cut Z
  1785. self.cutzlabel = QtWidgets.QLabel('%s:' % _('Cut Z'))
  1786. self.cutzlabel.setToolTip(
  1787. _("Cutting depth (negative)\n"
  1788. "below the copper surface.")
  1789. )
  1790. self.cutz_spinner = FCDoubleSpinner()
  1791. self.cutz_spinner.set_precision(self.decimals)
  1792. self.cutz_spinner.set_range(-99.9999, 0.0000)
  1793. self.cutz_spinner.setSingleStep(0.1)
  1794. self.cutz_spinner.setWrapping(True)
  1795. grid0.addWidget(self.cutzlabel, 6, 0)
  1796. grid0.addWidget(self.cutz_spinner, 6, 1, 1, 2)
  1797. # Isolation Type
  1798. self.iso_type_label = QtWidgets.QLabel('%s:' % _('Isolation Type'))
  1799. self.iso_type_label.setToolTip(
  1800. _("Choose how the isolation will be executed:\n"
  1801. "- 'Full' -> complete isolation of polygons\n"
  1802. "- 'Ext' -> will isolate only on the outside\n"
  1803. "- 'Int' -> will isolate only on the inside\n"
  1804. "'Exterior' isolation is almost always possible\n"
  1805. "(with the right tool) but 'Interior'\n"
  1806. "isolation can be done only when there is an opening\n"
  1807. "inside of the polygon (e.g polygon is a 'doughnut' shape).")
  1808. )
  1809. self.iso_type_radio = RadioSet([{'label': _('Full'), 'value': 'full'},
  1810. {'label': _('Exterior'), 'value': 'ext'},
  1811. {'label': _('Interior'), 'value': 'int'}])
  1812. grid0.addWidget(self.iso_type_label, 7, 0,)
  1813. grid0.addWidget(self.iso_type_radio, 7, 1, 1, 2)
  1814. separator_line = QtWidgets.QFrame()
  1815. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  1816. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  1817. grid0.addWidget(separator_line, 8, 0, 1, 2)
  1818. # Buffering Type
  1819. buffering_label = QtWidgets.QLabel('%s:' % _('Buffering'))
  1820. buffering_label.setToolTip(
  1821. _("Buffering type:\n"
  1822. "- None --> best performance, fast file loading but no so good display\n"
  1823. "- Full --> slow file loading but good visuals. This is the default.\n"
  1824. "<<WARNING>>: Don't change this unless you know what you are doing !!!")
  1825. )
  1826. self.buffering_radio = RadioSet([{'label': _('None'), 'value': 'no'},
  1827. {'label': _('Full'), 'value': 'full'}])
  1828. grid0.addWidget(buffering_label, 9, 0)
  1829. grid0.addWidget(self.buffering_radio, 9, 1)
  1830. # Simplification
  1831. self.simplify_cb = FCCheckBox(label=_('Simplify'))
  1832. self.simplify_cb.setToolTip(
  1833. _("When checked all the Gerber polygons will be\n"
  1834. "loaded with simplification having a set tolerance.\n"
  1835. "<<WARNING>>: Don't change this unless you know what you are doing !!!")
  1836. )
  1837. grid0.addWidget(self.simplify_cb, 10, 0, 1, 2)
  1838. # Simplification tolerance
  1839. self.simplification_tol_label = QtWidgets.QLabel(_('Tolerance'))
  1840. self.simplification_tol_label.setToolTip(_("Tolerance for polygon simplification."))
  1841. self.simplification_tol_spinner = FCDoubleSpinner()
  1842. self.simplification_tol_spinner.set_precision(self.decimals + 1)
  1843. self.simplification_tol_spinner.setWrapping(True)
  1844. self.simplification_tol_spinner.setRange(0.00000, 0.01000)
  1845. self.simplification_tol_spinner.setSingleStep(0.0001)
  1846. grid0.addWidget(self.simplification_tol_label, 11, 0)
  1847. grid0.addWidget(self.simplification_tol_spinner, 11, 1)
  1848. self.ois_simplif = OptionalInputSection(
  1849. self.simplify_cb,
  1850. [
  1851. self.simplification_tol_label, self.simplification_tol_spinner
  1852. ],
  1853. logic=True)
  1854. self.layout.addStretch()
  1855. class GerberExpPrefGroupUI(OptionsGroupUI):
  1856. def __init__(self, decimals=4, parent=None):
  1857. super(GerberExpPrefGroupUI, self).__init__(self)
  1858. self.setTitle(str(_("Gerber Export")))
  1859. self.decimals = decimals
  1860. # Plot options
  1861. self.export_options_label = QtWidgets.QLabel("<b>%s:</b>" % _("Export Options"))
  1862. self.export_options_label.setToolTip(
  1863. _("The parameters set here are used in the file exported\n"
  1864. "when using the File -> Export -> Export Gerber menu entry.")
  1865. )
  1866. self.layout.addWidget(self.export_options_label)
  1867. form = QtWidgets.QFormLayout()
  1868. self.layout.addLayout(form)
  1869. # Gerber Units
  1870. self.gerber_units_label = QtWidgets.QLabel('%s:' % _('Units'))
  1871. self.gerber_units_label.setToolTip(
  1872. _("The units used in the Gerber file.")
  1873. )
  1874. self.gerber_units_radio = RadioSet([{'label': _('INCH'), 'value': 'IN'},
  1875. {'label': _('MM'), 'value': 'MM'}])
  1876. self.gerber_units_radio.setToolTip(
  1877. _("The units used in the Gerber file.")
  1878. )
  1879. form.addRow(self.gerber_units_label, self.gerber_units_radio)
  1880. # Gerber format
  1881. self.digits_label = QtWidgets.QLabel("%s:" % _("Int/Decimals"))
  1882. self.digits_label.setToolTip(
  1883. _("The number of digits in the whole part of the number\n"
  1884. "and in the fractional part of the number.")
  1885. )
  1886. hlay1 = QtWidgets.QHBoxLayout()
  1887. self.format_whole_entry = FCSpinner()
  1888. self.format_whole_entry.set_range(0, 9)
  1889. self.format_whole_entry.set_step(1)
  1890. self.format_whole_entry.setWrapping(True)
  1891. self.format_whole_entry.setMinimumWidth(30)
  1892. self.format_whole_entry.setToolTip(
  1893. _("This numbers signify the number of digits in\n"
  1894. "the whole part of Gerber coordinates.")
  1895. )
  1896. hlay1.addWidget(self.format_whole_entry, QtCore.Qt.AlignLeft)
  1897. gerber_separator_label = QtWidgets.QLabel(':')
  1898. gerber_separator_label.setFixedWidth(5)
  1899. hlay1.addWidget(gerber_separator_label, QtCore.Qt.AlignLeft)
  1900. self.format_dec_entry = FCSpinner()
  1901. self.format_dec_entry.set_range(0, 9)
  1902. self.format_dec_entry.set_step(1)
  1903. self.format_dec_entry.setWrapping(True)
  1904. self.format_dec_entry.setMinimumWidth(30)
  1905. self.format_dec_entry.setToolTip(
  1906. _("This numbers signify the number of digits in\n"
  1907. "the decimal part of Gerber coordinates.")
  1908. )
  1909. hlay1.addWidget(self.format_dec_entry, QtCore.Qt.AlignLeft)
  1910. hlay1.addStretch()
  1911. form.addRow(self.digits_label, hlay1)
  1912. # Gerber Zeros
  1913. self.zeros_label = QtWidgets.QLabel('%s:' % _('Zeros'))
  1914. self.zeros_label.setAlignment(QtCore.Qt.AlignLeft)
  1915. self.zeros_label.setToolTip(
  1916. _("This sets the type of Gerber zeros.\n"
  1917. "If LZ then Leading Zeros are removed and\n"
  1918. "Trailing Zeros are kept.\n"
  1919. "If TZ is checked then Trailing Zeros are removed\n"
  1920. "and Leading Zeros are kept.")
  1921. )
  1922. self.zeros_radio = RadioSet([{'label': _('LZ'), 'value': 'L'},
  1923. {'label': _('TZ'), 'value': 'T'}])
  1924. self.zeros_radio.setToolTip(
  1925. _("This sets the type of Gerber zeros.\n"
  1926. "If LZ then Leading Zeros are removed and\n"
  1927. "Trailing Zeros are kept.\n"
  1928. "If TZ is checked then Trailing Zeros are removed\n"
  1929. "and Leading Zeros are kept.")
  1930. )
  1931. form.addRow(self.zeros_label, self.zeros_radio)
  1932. self.layout.addStretch()
  1933. class GerberEditorPrefGroupUI(OptionsGroupUI):
  1934. def __init__(self, decimals=4, parent=None):
  1935. # OptionsGroupUI.__init__(self, "Gerber Adv. Options Preferences", parent=parent)
  1936. super(GerberEditorPrefGroupUI, self).__init__(self)
  1937. self.setTitle(str(_("Gerber Editor")))
  1938. self.decimals = decimals
  1939. # Advanced Gerber Parameters
  1940. self.param_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  1941. self.param_label.setToolTip(
  1942. _("A list of Gerber Editor parameters.")
  1943. )
  1944. self.layout.addWidget(self.param_label)
  1945. grid0 = QtWidgets.QGridLayout()
  1946. self.layout.addLayout(grid0)
  1947. # Selection Limit
  1948. self.sel_limit_label = QtWidgets.QLabel('%s:' % _("Selection limit"))
  1949. self.sel_limit_label.setToolTip(
  1950. _("Set the number of selected Gerber geometry\n"
  1951. "items above which the utility geometry\n"
  1952. "becomes just a selection rectangle.\n"
  1953. "Increases the performance when moving a\n"
  1954. "large number of geometric elements.")
  1955. )
  1956. self.sel_limit_entry = FCSpinner()
  1957. self.sel_limit_entry.set_range(0, 9999)
  1958. grid0.addWidget(self.sel_limit_label, 0, 0)
  1959. grid0.addWidget(self.sel_limit_entry, 0, 1)
  1960. # New aperture code
  1961. self.addcode_entry_lbl = QtWidgets.QLabel('%s:' % _('New Aperture code'))
  1962. self.addcode_entry_lbl.setToolTip(
  1963. _("Code for the new aperture")
  1964. )
  1965. self.addcode_entry = FCSpinner()
  1966. self.addcode_entry.set_range(10, 99)
  1967. self.addcode_entry.setWrapping(True)
  1968. grid0.addWidget(self.addcode_entry_lbl, 1, 0)
  1969. grid0.addWidget(self.addcode_entry, 1, 1)
  1970. # New aperture size
  1971. self.addsize_entry_lbl = QtWidgets.QLabel('%s:' % _('New Aperture size'))
  1972. self.addsize_entry_lbl.setToolTip(
  1973. _("Size for the new aperture")
  1974. )
  1975. self.addsize_entry = FCDoubleSpinner()
  1976. self.addsize_entry.set_range(0, 100)
  1977. self.addsize_entry.set_precision(self.decimals)
  1978. grid0.addWidget(self.addsize_entry_lbl, 2, 0)
  1979. grid0.addWidget(self.addsize_entry, 2, 1)
  1980. # New aperture type
  1981. self.addtype_combo_lbl = QtWidgets.QLabel('%s:' % _('New Aperture type'))
  1982. self.addtype_combo_lbl.setToolTip(
  1983. _("Type for the new aperture.\n"
  1984. "Can be 'C', 'R' or 'O'.")
  1985. )
  1986. self.addtype_combo = FCComboBox()
  1987. self.addtype_combo.addItems(['C', 'R', 'O'])
  1988. grid0.addWidget(self.addtype_combo_lbl, 3, 0)
  1989. grid0.addWidget(self.addtype_combo, 3, 1)
  1990. # Number of pads in a pad array
  1991. self.grb_array_size_label = QtWidgets.QLabel('%s:' % _('Nr of pads'))
  1992. self.grb_array_size_label.setToolTip(
  1993. _("Specify how many pads to be in the array.")
  1994. )
  1995. self.grb_array_size_entry = FCSpinner()
  1996. self.grb_array_size_entry.set_range(0, 9999)
  1997. grid0.addWidget(self.grb_array_size_label, 4, 0)
  1998. grid0.addWidget(self.grb_array_size_entry, 4, 1)
  1999. self.adddim_label = QtWidgets.QLabel('%s:' % _('Aperture Dimensions'))
  2000. self.adddim_label.setToolTip(
  2001. _("Diameters of the tools, separated by comma.\n"
  2002. "The value of the diameter has to use the dot decimals separator.\n"
  2003. "Valid values: 0.3, 1.0")
  2004. )
  2005. grid0.addWidget(self.adddim_label, 5, 0)
  2006. self.adddim_entry = FCEntry()
  2007. grid0.addWidget(self.adddim_entry, 5, 1)
  2008. self.grb_array_linear_label = QtWidgets.QLabel('<b>%s:</b>' % _('Linear Pad Array'))
  2009. grid0.addWidget(self.grb_array_linear_label, 6, 0, 1, 2)
  2010. # Linear Pad Array direction
  2011. self.grb_axis_label = QtWidgets.QLabel('%s:' % _('Linear Direction'))
  2012. self.grb_axis_label.setToolTip(
  2013. _("Direction on which the linear array is oriented:\n"
  2014. "- 'X' - horizontal axis \n"
  2015. "- 'Y' - vertical axis or \n"
  2016. "- 'Angle' - a custom angle for the array inclination")
  2017. )
  2018. self.grb_axis_radio = RadioSet([{'label': _('X'), 'value': 'X'},
  2019. {'label': _('Y'), 'value': 'Y'},
  2020. {'label': _('Angle'), 'value': 'A'}])
  2021. grid0.addWidget(self.grb_axis_label, 7, 0)
  2022. grid0.addWidget(self.grb_axis_radio, 7, 1)
  2023. # Linear Pad Array pitch distance
  2024. self.grb_pitch_label = QtWidgets.QLabel('%s:' % _('Pitch'))
  2025. self.grb_pitch_label.setToolTip(
  2026. _("Pitch = Distance between elements of the array.")
  2027. )
  2028. # self.drill_pitch_label.setMinimumWidth(100)
  2029. self.grb_pitch_entry = FCDoubleSpinner()
  2030. self.grb_pitch_entry.set_precision(self.decimals)
  2031. grid0.addWidget(self.grb_pitch_label, 8, 0)
  2032. grid0.addWidget(self.grb_pitch_entry, 8, 1)
  2033. # Linear Pad Array custom angle
  2034. self.grb_angle_label = QtWidgets.QLabel('%s:' % _('Angle'))
  2035. self.grb_angle_label.setToolTip(
  2036. _("Angle at which each element in circular array is placed.")
  2037. )
  2038. self.grb_angle_entry = FCDoubleSpinner()
  2039. self.grb_angle_entry.set_precision(self.decimals)
  2040. self.grb_angle_entry.set_range(-360, 360)
  2041. self.grb_angle_entry.setSingleStep(5)
  2042. grid0.addWidget(self.grb_angle_label, 9, 0)
  2043. grid0.addWidget(self.grb_angle_entry, 9, 1)
  2044. self.grb_array_circ_label = QtWidgets.QLabel('<b>%s:</b>' % _('Circular Pad Array'))
  2045. grid0.addWidget(self.grb_array_circ_label, 10, 0, 1, 2)
  2046. # Circular Pad Array direction
  2047. self.grb_circular_direction_label = QtWidgets.QLabel('%s:' % _('Circular Direction'))
  2048. self.grb_circular_direction_label.setToolTip(
  2049. _("Direction for circular array.\n"
  2050. "Can be CW = clockwise or CCW = counter clockwise.")
  2051. )
  2052. self.grb_circular_dir_radio = RadioSet([{'label': _('CW'), 'value': 'CW'},
  2053. {'label': _('CCW'), 'value': 'CCW'}])
  2054. grid0.addWidget(self.grb_circular_direction_label, 11, 0)
  2055. grid0.addWidget(self.grb_circular_dir_radio, 11, 1)
  2056. # Circular Pad Array Angle
  2057. self.grb_circular_angle_label = QtWidgets.QLabel('%s:' % _('Circular Angle'))
  2058. self.grb_circular_angle_label.setToolTip(
  2059. _("Angle at which each element in circular array is placed.")
  2060. )
  2061. self.grb_circular_angle_entry = FCDoubleSpinner()
  2062. self.grb_circular_angle_entry.set_precision(self.decimals)
  2063. self.grb_circular_angle_entry.set_range(-360, 360)
  2064. self.grb_circular_angle_entry.setSingleStep(5)
  2065. grid0.addWidget(self.grb_circular_angle_label, 12, 0)
  2066. grid0.addWidget(self.grb_circular_angle_entry, 12, 1)
  2067. self.grb_array_tools_b_label = QtWidgets.QLabel('<b>%s:</b>' % _('Buffer Tool'))
  2068. grid0.addWidget(self.grb_array_tools_b_label, 13, 0, 1, 2)
  2069. # Buffer Distance
  2070. self.grb_buff_label = QtWidgets.QLabel('%s:' % _('Buffer distance'))
  2071. self.grb_buff_label.setToolTip(
  2072. _("Distance at which to buffer the Gerber element.")
  2073. )
  2074. self.grb_buff_entry = FCDoubleSpinner()
  2075. self.grb_buff_entry.set_precision(self.decimals)
  2076. self.grb_buff_entry.set_range(-9999, 9999)
  2077. grid0.addWidget(self.grb_buff_label, 14, 0)
  2078. grid0.addWidget(self.grb_buff_entry, 14, 1)
  2079. self.grb_array_tools_s_label = QtWidgets.QLabel('<b>%s:</b>' % _('Scale Tool'))
  2080. grid0.addWidget(self.grb_array_tools_s_label, 15, 0, 1, 2)
  2081. # Scale Factor
  2082. self.grb_scale_label = QtWidgets.QLabel('%s:' % _('Scale factor'))
  2083. self.grb_scale_label.setToolTip(
  2084. _("Factor to scale the Gerber element.")
  2085. )
  2086. self.grb_scale_entry = FCDoubleSpinner()
  2087. self.grb_scale_entry.set_precision(self.decimals)
  2088. self.grb_scale_entry.set_range(0, 9999)
  2089. grid0.addWidget(self.grb_scale_label, 16, 0)
  2090. grid0.addWidget(self.grb_scale_entry, 16, 1)
  2091. self.grb_array_tools_ma_label = QtWidgets.QLabel('<b>%s:</b>' % _('Mark Area Tool'))
  2092. grid0.addWidget(self.grb_array_tools_ma_label, 17, 0, 1, 2)
  2093. # Mark area Tool low threshold
  2094. self.grb_ma_low_label = QtWidgets.QLabel('%s:' % _('Threshold low'))
  2095. self.grb_ma_low_label.setToolTip(
  2096. _("Threshold value under which the apertures are not marked.")
  2097. )
  2098. self.grb_ma_low_entry = FCDoubleSpinner()
  2099. self.grb_ma_low_entry.set_precision(self.decimals)
  2100. self.grb_ma_low_entry.set_range(0, 9999)
  2101. grid0.addWidget(self.grb_ma_low_label, 18, 0)
  2102. grid0.addWidget(self.grb_ma_low_entry, 18, 1)
  2103. # Mark area Tool high threshold
  2104. self.grb_ma_high_label = QtWidgets.QLabel('%s:' % _('Threshold high'))
  2105. self.grb_ma_high_label.setToolTip(
  2106. _("Threshold value over which the apertures are not marked.")
  2107. )
  2108. self.grb_ma_high_entry = FCDoubleSpinner()
  2109. self.grb_ma_high_entry.set_precision(self.decimals)
  2110. self.grb_ma_high_entry.set_range(0, 9999)
  2111. grid0.addWidget(self.grb_ma_high_label, 19, 0)
  2112. grid0.addWidget(self.grb_ma_high_entry, 19, 1)
  2113. self.layout.addStretch()
  2114. class ExcellonGenPrefGroupUI(OptionsGroupUI):
  2115. def __init__(self, decimals=4, parent=None):
  2116. # OptionsGroupUI.__init__(self, "Excellon Options", parent=parent)
  2117. super(ExcellonGenPrefGroupUI, self).__init__(self)
  2118. self.setTitle(str(_("Excellon General")))
  2119. self.decimals = decimals
  2120. # Plot options
  2121. self.plot_options_label = QtWidgets.QLabel("<b>%s:</b>" % _("Plot Options"))
  2122. self.layout.addWidget(self.plot_options_label)
  2123. grid1 = QtWidgets.QGridLayout()
  2124. self.layout.addLayout(grid1)
  2125. self.plot_cb = FCCheckBox(label=_('Plot'))
  2126. self.plot_cb.setToolTip(
  2127. "Plot (show) this object."
  2128. )
  2129. grid1.addWidget(self.plot_cb, 0, 0)
  2130. self.solid_cb = FCCheckBox(label=_('Solid'))
  2131. self.solid_cb.setToolTip(
  2132. "Plot as solid circles."
  2133. )
  2134. grid1.addWidget(self.solid_cb, 0, 1)
  2135. separator_line = QtWidgets.QFrame()
  2136. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  2137. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  2138. grid1.addWidget(separator_line, 1, 0, 1, 2)
  2139. grid2 = QtWidgets.QGridLayout()
  2140. self.layout.addLayout(grid2)
  2141. grid2.setColumnStretch(0, 0)
  2142. grid2.setColumnStretch(1, 1)
  2143. # Excellon format
  2144. self.excellon_format_label = QtWidgets.QLabel("<b>%s:</b>" % _("Excellon Format"))
  2145. self.excellon_format_label.setToolTip(
  2146. _("The NC drill files, usually named Excellon files\n"
  2147. "are files that can be found in different formats.\n"
  2148. "Here we set the format used when the provided\n"
  2149. "coordinates are not using period.\n"
  2150. "\n"
  2151. "Possible presets:\n"
  2152. "\n"
  2153. "PROTEUS 3:3 MM LZ\n"
  2154. "DipTrace 5:2 MM TZ\n"
  2155. "DipTrace 4:3 MM LZ\n"
  2156. "\n"
  2157. "EAGLE 3:3 MM TZ\n"
  2158. "EAGLE 4:3 MM TZ\n"
  2159. "EAGLE 2:5 INCH TZ\n"
  2160. "EAGLE 3:5 INCH TZ\n"
  2161. "\n"
  2162. "ALTIUM 2:4 INCH LZ\n"
  2163. "Sprint Layout 2:4 INCH LZ"
  2164. "\n"
  2165. "KiCAD 3:5 INCH TZ")
  2166. )
  2167. grid2.addWidget(self.excellon_format_label, 0, 0, 1, 2)
  2168. self.excellon_format_in_label = QtWidgets.QLabel('%s:' % _("INCH"))
  2169. self.excellon_format_in_label.setToolTip(_("Default values for INCH are 2:4"))
  2170. hlay1 = QtWidgets.QHBoxLayout()
  2171. self.excellon_format_upper_in_entry = FCSpinner()
  2172. self.excellon_format_upper_in_entry.set_range(0, 9)
  2173. self.excellon_format_upper_in_entry.setMinimumWidth(30)
  2174. self.excellon_format_upper_in_entry.setToolTip(
  2175. _("This numbers signify the number of digits in\n"
  2176. "the whole part of Excellon coordinates.")
  2177. )
  2178. hlay1.addWidget(self.excellon_format_upper_in_entry)
  2179. excellon_separator_in_label = QtWidgets.QLabel(':')
  2180. excellon_separator_in_label.setFixedWidth(5)
  2181. hlay1.addWidget(excellon_separator_in_label)
  2182. self.excellon_format_lower_in_entry = FCSpinner()
  2183. self.excellon_format_lower_in_entry.set_range(0, 9)
  2184. self.excellon_format_lower_in_entry.setMinimumWidth(30)
  2185. self.excellon_format_lower_in_entry.setToolTip(
  2186. _("This numbers signify the number of digits in\n"
  2187. "the decimal part of Excellon coordinates.")
  2188. )
  2189. hlay1.addWidget(self.excellon_format_lower_in_entry)
  2190. grid2.addWidget(self.excellon_format_in_label, 1, 0)
  2191. grid2.addLayout(hlay1, 1, 1)
  2192. self.excellon_format_mm_label = QtWidgets.QLabel('%s:' % _("METRIC"))
  2193. self.excellon_format_mm_label.setToolTip(_("Default values for METRIC are 3:3"))
  2194. hlay2 = QtWidgets.QHBoxLayout()
  2195. self.excellon_format_upper_mm_entry = FCSpinner()
  2196. self.excellon_format_upper_mm_entry.set_range(0, 9)
  2197. self.excellon_format_upper_mm_entry.setMinimumWidth(30)
  2198. self.excellon_format_upper_mm_entry.setToolTip(
  2199. _("This numbers signify the number of digits in\n"
  2200. "the whole part of Excellon coordinates.")
  2201. )
  2202. hlay2.addWidget(self.excellon_format_upper_mm_entry)
  2203. excellon_separator_mm_label = QtWidgets.QLabel(':')
  2204. excellon_separator_mm_label.setFixedWidth(5)
  2205. hlay2.addWidget(excellon_separator_mm_label, QtCore.Qt.AlignLeft)
  2206. self.excellon_format_lower_mm_entry = FCSpinner()
  2207. self.excellon_format_lower_mm_entry.set_range(0, 9)
  2208. self.excellon_format_lower_mm_entry.setMinimumWidth(30)
  2209. self.excellon_format_lower_mm_entry.setToolTip(
  2210. _("This numbers signify the number of digits in\n"
  2211. "the decimal part of Excellon coordinates.")
  2212. )
  2213. hlay2.addWidget(self.excellon_format_lower_mm_entry)
  2214. grid2.addWidget(self.excellon_format_mm_label, 2, 0)
  2215. grid2.addLayout(hlay2, 2, 1)
  2216. self.excellon_zeros_label = QtWidgets.QLabel('%s:' % _('Zeros'))
  2217. self.excellon_zeros_label.setAlignment(QtCore.Qt.AlignLeft)
  2218. self.excellon_zeros_label.setToolTip(
  2219. _("This sets the type of Excellon zeros.\n"
  2220. "If LZ then Leading Zeros are kept and\n"
  2221. "Trailing Zeros are removed.\n"
  2222. "If TZ is checked then Trailing Zeros are kept\n"
  2223. "and Leading Zeros are removed.\n\n"
  2224. "This is used when there is no information\n"
  2225. "stored in the Excellon file.")
  2226. )
  2227. grid2.addWidget(self.excellon_zeros_label, 3, 0)
  2228. self.excellon_zeros_radio = RadioSet([{'label': _('LZ'), 'value': 'L'},
  2229. {'label': _('TZ'), 'value': 'T'}])
  2230. grid2.addWidget(self.excellon_zeros_radio, 3, 1)
  2231. self.excellon_units_label = QtWidgets.QLabel('%s:' % _('Units'))
  2232. self.excellon_units_label.setAlignment(QtCore.Qt.AlignLeft)
  2233. self.excellon_units_label.setToolTip(
  2234. _("This sets the default units of Excellon files.\n"
  2235. "If it is not detected in the parsed file the value here\n"
  2236. "will be used."
  2237. "Some Excellon files don't have an header\n"
  2238. "therefore this parameter will be used.")
  2239. )
  2240. self.excellon_units_radio = RadioSet([{'label': _('INCH'), 'value': 'INCH'},
  2241. {'label': _('MM'), 'value': 'METRIC'}])
  2242. self.excellon_units_radio.setToolTip(
  2243. _("This sets the units of Excellon files.\n"
  2244. "Some Excellon files don't have an header\n"
  2245. "therefore this parameter will be used.")
  2246. )
  2247. grid2.addWidget(self.excellon_units_label, 4, 0)
  2248. grid2.addWidget(self.excellon_units_radio, 4, 1)
  2249. self.update_excellon_cb = FCCheckBox(label=_('Update Export settings'))
  2250. self.update_excellon_cb.setToolTip(
  2251. "If checked, the Excellon Export settings will be updated with the ones above."
  2252. )
  2253. grid2.addWidget(self.update_excellon_cb, 5, 0, 1, 2)
  2254. # Adding the Excellon Format Defaults Button
  2255. self.excellon_defaults_button = QtWidgets.QPushButton()
  2256. self.excellon_defaults_button.setText(str(_("Restore Defaults")))
  2257. self.excellon_defaults_button.setMinimumWidth(80)
  2258. grid2.addWidget(self.excellon_defaults_button, 6, 0, 1, 2)
  2259. separator_line = QtWidgets.QFrame()
  2260. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  2261. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  2262. grid2.addWidget(separator_line, 7, 0, 1, 2)
  2263. self.excellon_general_label = QtWidgets.QLabel("<b>%s:</b>" % _("Excellon Optimization"))
  2264. grid2.addWidget(self.excellon_general_label, 8, 0, 1, 2)
  2265. self.excellon_optimization_label = QtWidgets.QLabel(_('Algorithm:'))
  2266. self.excellon_optimization_label.setToolTip(
  2267. _("This sets the optimization type for the Excellon drill path.\n"
  2268. "If <<MetaHeuristic>> is checked then Google OR-Tools algorithm with\n"
  2269. "MetaHeuristic Guided Local Path is used. Default search time is 3sec.\n"
  2270. "If <<Basic>> is checked then Google OR-Tools Basic algorithm is used.\n"
  2271. "If <<TSA>> is checked then Travelling Salesman algorithm is used for\n"
  2272. "drill path optimization.\n"
  2273. "\n"
  2274. "If this control is disabled, then FlatCAM works in 32bit mode and it uses\n"
  2275. "Travelling Salesman algorithm for path optimization.")
  2276. )
  2277. self.excellon_optimization_radio = RadioSet([{'label': _('MetaHeuristic'), 'value': 'M'},
  2278. {'label': _('Basic'), 'value': 'B'},
  2279. {'label': _('TSA'), 'value': 'T'}],
  2280. orientation='vertical', stretch=False)
  2281. self.excellon_optimization_radio.setToolTip(
  2282. _("This sets the optimization type for the Excellon drill path.\n"
  2283. "If <<MetaHeuristic>> is checked then Google OR-Tools algorithm with\n"
  2284. "MetaHeuristic Guided Local Path is used. Default search time is 3sec.\n"
  2285. "If <<Basic>> is checked then Google OR-Tools Basic algorithm is used.\n"
  2286. "If <<TSA>> is checked then Travelling Salesman algorithm is used for\n"
  2287. "drill path optimization.\n"
  2288. "\n"
  2289. "If this control is disabled, then FlatCAM works in 32bit mode and it uses\n"
  2290. "Travelling Salesman algorithm for path optimization.")
  2291. )
  2292. grid2.addWidget(self.excellon_optimization_label, 9, 0)
  2293. grid2.addWidget(self.excellon_optimization_radio, 9, 1)
  2294. self.optimization_time_label = QtWidgets.QLabel('%s:' % _('Duration'))
  2295. self.optimization_time_label.setAlignment(QtCore.Qt.AlignLeft)
  2296. self.optimization_time_label.setToolTip(
  2297. _("When OR-Tools Metaheuristic (MH) is enabled there is a\n"
  2298. "maximum threshold for how much time is spent doing the\n"
  2299. "path optimization. This max duration is set here.\n"
  2300. "In seconds.")
  2301. )
  2302. self.optimization_time_entry = FCSpinner()
  2303. self.optimization_time_entry.set_range(0, 999)
  2304. grid2.addWidget(self.optimization_time_label, 10, 0)
  2305. grid2.addWidget(self.optimization_time_entry, 10, 1)
  2306. separator_line = QtWidgets.QFrame()
  2307. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  2308. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  2309. grid2.addWidget(separator_line, 11, 0, 1, 2)
  2310. # Excellon Object Color
  2311. self.gerber_color_label = QtWidgets.QLabel('<b>%s</b>' % _('Excellon Object Color'))
  2312. grid2.addWidget(self.gerber_color_label, 12, 0, 1, 2)
  2313. # Plot Line Color
  2314. self.line_color_label = QtWidgets.QLabel('%s:' % _('Outline'))
  2315. self.line_color_label.setToolTip(
  2316. _("Set the line color for plotted objects.")
  2317. )
  2318. self.line_color_entry = FCEntry()
  2319. self.line_color_button = QtWidgets.QPushButton()
  2320. self.line_color_button.setFixedSize(15, 15)
  2321. self.form_box_child_2 = QtWidgets.QHBoxLayout()
  2322. self.form_box_child_2.addWidget(self.line_color_entry)
  2323. self.form_box_child_2.addWidget(self.line_color_button)
  2324. self.form_box_child_2.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  2325. grid2.addWidget(self.line_color_label, 13, 0)
  2326. grid2.addLayout(self.form_box_child_2, 13, 1)
  2327. # Plot Fill Color
  2328. self.fill_color_label = QtWidgets.QLabel('%s:' % _('Fill'))
  2329. self.fill_color_label.setToolTip(
  2330. _("Set the fill color for plotted objects.\n"
  2331. "First 6 digits are the color and the last 2\n"
  2332. "digits are for alpha (transparency) level.")
  2333. )
  2334. self.fill_color_entry = FCEntry()
  2335. self.fill_color_button = QtWidgets.QPushButton()
  2336. self.fill_color_button.setFixedSize(15, 15)
  2337. self.form_box_child_1 = QtWidgets.QHBoxLayout()
  2338. self.form_box_child_1.addWidget(self.fill_color_entry)
  2339. self.form_box_child_1.addWidget(self.fill_color_button)
  2340. self.form_box_child_1.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  2341. grid2.addWidget(self.fill_color_label, 14, 0)
  2342. grid2.addLayout(self.form_box_child_1, 14, 1)
  2343. # Plot Fill Transparency Level
  2344. self.alpha_label = QtWidgets.QLabel('%s:' % _('Alpha'))
  2345. self.alpha_label.setToolTip(
  2346. _("Set the fill transparency for plotted objects.")
  2347. )
  2348. self.color_alpha_slider = QtWidgets.QSlider(QtCore.Qt.Horizontal)
  2349. self.color_alpha_slider.setMinimum(0)
  2350. self.color_alpha_slider.setMaximum(255)
  2351. self.color_alpha_slider.setSingleStep(1)
  2352. self.color_alpha_spinner = FCSpinner()
  2353. self.color_alpha_spinner.setMinimumWidth(70)
  2354. self.color_alpha_spinner.set_range(0, 255)
  2355. self.form_box_child_3 = QtWidgets.QHBoxLayout()
  2356. self.form_box_child_3.addWidget(self.color_alpha_slider)
  2357. self.form_box_child_3.addWidget(self.color_alpha_spinner)
  2358. grid2.addWidget(self.alpha_label, 15, 0)
  2359. grid2.addLayout(self.form_box_child_3, 15, 1)
  2360. self.layout.addStretch()
  2361. current_platform = platform.architecture()[0]
  2362. if current_platform == '64bit':
  2363. self.excellon_optimization_label.setDisabled(False)
  2364. self.excellon_optimization_radio.setDisabled(False)
  2365. self.optimization_time_label.setDisabled(False)
  2366. self.optimization_time_entry.setDisabled(False)
  2367. self.excellon_optimization_radio.activated_custom.connect(self.optimization_selection)
  2368. else:
  2369. self.excellon_optimization_label.setDisabled(True)
  2370. self.excellon_optimization_radio.setDisabled(True)
  2371. self.optimization_time_label.setDisabled(True)
  2372. self.optimization_time_entry.setDisabled(True)
  2373. # Setting plot colors signals
  2374. self.line_color_entry.editingFinished.connect(self.on_line_color_entry)
  2375. self.line_color_button.clicked.connect(self.on_line_color_button)
  2376. self.fill_color_entry.editingFinished.connect(self.on_fill_color_entry)
  2377. self.fill_color_button.clicked.connect(self.on_fill_color_button)
  2378. self.color_alpha_spinner.valueChanged.connect(self.on_color_spinner)
  2379. self.color_alpha_slider.valueChanged.connect(self.on_color_slider)
  2380. # Load the defaults values into the Excellon Format and Excellon Zeros fields
  2381. self.excellon_defaults_button.clicked.connect(self.on_excellon_defaults_button)
  2382. def optimization_selection(self):
  2383. if self.excellon_optimization_radio.get_value() == 'M':
  2384. self.optimization_time_label.setDisabled(False)
  2385. self.optimization_time_entry.setDisabled(False)
  2386. else:
  2387. self.optimization_time_label.setDisabled(True)
  2388. self.optimization_time_entry.setDisabled(True)
  2389. # Setting plot colors handlers
  2390. def on_fill_color_entry(self):
  2391. self.app.defaults['excellon_plot_fill'] = self.fill_color_entry.get_value()[:7] + \
  2392. self.app.defaults['excellon_plot_fill'][7:9]
  2393. self.fill_color_button.setStyleSheet("background-color:%s" % str(self.app.defaults['excellon_plot_fill'])[:7])
  2394. def on_fill_color_button(self):
  2395. current_color = QtGui.QColor(self.app.defaults['excellon_plot_fill'][:7])
  2396. c_dialog = QtWidgets.QColorDialog()
  2397. plot_fill_color = c_dialog.getColor(initial=current_color)
  2398. if plot_fill_color.isValid() is False:
  2399. return
  2400. self.fill_color_button.setStyleSheet("background-color:%s" % str(plot_fill_color.name()))
  2401. new_val = str(plot_fill_color.name()) + str(self.app.defaults['excellon_plot_fill'][7:9])
  2402. self.fill_color_entry.set_value(new_val)
  2403. self.app.defaults['excellon_plot_fill'] = new_val
  2404. def on_color_spinner(self):
  2405. spinner_value = self.color_alpha_spinner.value()
  2406. self.color_alpha_slider.setValue(spinner_value)
  2407. self.app.defaults['excellon_plot_fill'] = \
  2408. self.app.defaults['excellon_plot_fill'][:7] + \
  2409. (hex(spinner_value)[2:] if int(hex(spinner_value)[2:], 16) > 0 else '00')
  2410. self.app.defaults['excellon_plot_line'] = \
  2411. self.app.defaults['excellon_plot_line'][:7] + \
  2412. (hex(spinner_value)[2:] if int(hex(spinner_value)[2:], 16) > 0 else '00')
  2413. def on_color_slider(self):
  2414. slider_value = self.color_alpha_slider.value()
  2415. self.color_alpha_spinner.setValue(slider_value)
  2416. def on_line_color_entry(self):
  2417. self.app.defaults['excellon_plot_line'] = self.line_color_entry.get_value()[:7] + \
  2418. self.app.defaults['excellon_plot_line'][7:9]
  2419. self.line_color_button.setStyleSheet("background-color:%s" % str(self.app.defaults['excellon_plot_line'])[:7])
  2420. def on_line_color_button(self):
  2421. current_color = QtGui.QColor(self.app.defaults['excellon_plot_line'][:7])
  2422. # print(current_color)
  2423. c_dialog = QtWidgets.QColorDialog()
  2424. plot_line_color = c_dialog.getColor(initial=current_color)
  2425. if plot_line_color.isValid() is False:
  2426. return
  2427. self.line_color_button.setStyleSheet("background-color:%s" % str(plot_line_color.name()))
  2428. new_val_line = str(plot_line_color.name()) + str(self.app.defaults['excellon_plot_line'][7:9])
  2429. self.line_color_entry.set_value(new_val_line)
  2430. self.app.defaults['excellon_plot_line'] = new_val_line
  2431. def on_excellon_defaults_button(self):
  2432. self.app.defaults_form_fields["excellon_format_lower_in"].set_value('4')
  2433. self.app.defaults_form_fields["excellon_format_upper_in"].set_value('2')
  2434. self.app.defaults_form_fields["excellon_format_lower_mm"].set_value('3')
  2435. self.app.defaults_form_fields["excellon_format_upper_mm"].set_value('3')
  2436. self.app.defaults_form_fields["excellon_zeros"].set_value('L')
  2437. self.app.defaults_form_fields["excellon_units"].set_value('INCH')
  2438. class ExcellonOptPrefGroupUI(OptionsGroupUI):
  2439. def __init__(self, decimals=4, parent=None):
  2440. # OptionsGroupUI.__init__(self, "Excellon Options", parent=parent)
  2441. super(ExcellonOptPrefGroupUI, self).__init__(self)
  2442. self.setTitle(str(_("Excellon Options")))
  2443. self.decimals = decimals
  2444. # ## Create CNC Job
  2445. self.cncjob_label = QtWidgets.QLabel('<b>%s</b>' % _('Create CNC Job'))
  2446. self.cncjob_label.setToolTip(
  2447. _("Parameters used to create a CNC Job object\n"
  2448. "for this drill object.")
  2449. )
  2450. self.layout.addWidget(self.cncjob_label)
  2451. grid2 = QtWidgets.QGridLayout()
  2452. self.layout.addLayout(grid2)
  2453. grid2.setColumnStretch(0, 0)
  2454. grid2.setColumnStretch(1, 1)
  2455. # Operation Type
  2456. self.operation_label = QtWidgets.QLabel('<b>%s:</b>' % _('Operation'))
  2457. self.operation_label.setToolTip(
  2458. _("Operation type:\n"
  2459. "- Drilling -> will drill the drills/slots associated with this tool\n"
  2460. "- Milling -> will mill the drills/slots")
  2461. )
  2462. self.operation_radio = RadioSet(
  2463. [
  2464. {'label': _('Drilling'), 'value': 'drill'},
  2465. {'label': _("Milling"), 'value': 'mill'}
  2466. ]
  2467. )
  2468. grid2.addWidget(self.operation_label, 0, 0)
  2469. grid2.addWidget(self.operation_radio, 0, 1)
  2470. self.mill_type_label = QtWidgets.QLabel('%s:' % _('Milling Type'))
  2471. self.mill_type_label.setToolTip(
  2472. _("Milling type:\n"
  2473. "- Drills -> will mill the drills associated with this tool\n"
  2474. "- Slots -> will mill the slots associated with this tool\n"
  2475. "- Both -> will mill both drills and mills or whatever is available")
  2476. )
  2477. self.milling_type_radio = RadioSet(
  2478. [
  2479. {'label': _('Drills'), 'value': 'drills'},
  2480. {'label': _("Slots"), 'value': 'slots'},
  2481. {'label': _("Both"), 'value': 'both'},
  2482. ]
  2483. )
  2484. grid2.addWidget(self.mill_type_label, 1, 0)
  2485. grid2.addWidget(self.milling_type_radio, 1, 1)
  2486. self.mill_dia_label = QtWidgets.QLabel('%s:' % _('Milling Diameter'))
  2487. self.mill_dia_label.setToolTip(
  2488. _("The diameter of the tool who will do the milling")
  2489. )
  2490. self.mill_dia_entry = FCDoubleSpinner()
  2491. self.mill_dia_entry.set_precision(self.decimals)
  2492. self.mill_dia_entry.set_range(0.0000, 9999.9999)
  2493. grid2.addWidget(self.mill_dia_label, 2, 0)
  2494. grid2.addWidget(self.mill_dia_entry, 2, 1)
  2495. # Cut Z
  2496. cutzlabel = QtWidgets.QLabel('%s:' % _('Cut Z'))
  2497. cutzlabel.setToolTip(
  2498. _("Drill depth (negative)\n"
  2499. "below the copper surface.")
  2500. )
  2501. self.cutz_entry = FCDoubleSpinner()
  2502. if machinist_setting == 0:
  2503. self.cutz_entry.set_range(-9999.9999, 0.0000)
  2504. else:
  2505. self.cutz_entry.set_range(-9999.9999, 9999.9999)
  2506. self.cutz_entry.setSingleStep(0.1)
  2507. self.cutz_entry.set_precision(self.decimals)
  2508. grid2.addWidget(cutzlabel, 3, 0)
  2509. grid2.addWidget(self.cutz_entry, 3, 1)
  2510. # Multi-Depth
  2511. self.mpass_cb = FCCheckBox('%s:' % _("Multi-Depth"))
  2512. self.mpass_cb.setToolTip(
  2513. _(
  2514. "Use multiple passes to limit\n"
  2515. "the cut depth in each pass. Will\n"
  2516. "cut multiple times until Cut Z is\n"
  2517. "reached."
  2518. )
  2519. )
  2520. self.maxdepth_entry = FCDoubleSpinner()
  2521. self.maxdepth_entry.set_precision(self.decimals)
  2522. self.maxdepth_entry.set_range(0, 9999.9999)
  2523. self.maxdepth_entry.setSingleStep(0.1)
  2524. self.maxdepth_entry.setToolTip(_("Depth of each pass (positive)."))
  2525. grid2.addWidget(self.mpass_cb, 4, 0)
  2526. grid2.addWidget(self.maxdepth_entry, 4, 1)
  2527. # Travel Z
  2528. travelzlabel = QtWidgets.QLabel('%s:' % _('Travel Z'))
  2529. travelzlabel.setToolTip(
  2530. _("Tool height when travelling\n"
  2531. "across the XY plane.")
  2532. )
  2533. self.travelz_entry = FCDoubleSpinner()
  2534. self.travelz_entry.set_precision(self.decimals)
  2535. if machinist_setting == 0:
  2536. self.travelz_entry.set_range(0.0001, 9999.9999)
  2537. else:
  2538. self.travelz_entry.set_range(-9999.9999, 9999.9999)
  2539. grid2.addWidget(travelzlabel, 5, 0)
  2540. grid2.addWidget(self.travelz_entry, 5, 1)
  2541. # Tool change:
  2542. self.toolchange_cb = FCCheckBox('%s' % _("Tool change"))
  2543. self.toolchange_cb.setToolTip(
  2544. _("Include tool-change sequence\n"
  2545. "in G-Code (Pause for tool change).")
  2546. )
  2547. grid2.addWidget(self.toolchange_cb, 6, 0, 1, 2)
  2548. # Tool Change Z
  2549. toolchangezlabel = QtWidgets.QLabel('%s:' % _('Toolchange Z'))
  2550. toolchangezlabel.setToolTip(
  2551. _("Z-axis position (height) for\n"
  2552. "tool change.")
  2553. )
  2554. self.toolchangez_entry = FCDoubleSpinner()
  2555. self.toolchangez_entry.set_precision(self.decimals)
  2556. if machinist_setting == 0:
  2557. self.toolchangez_entry.set_range(0.0001, 9999.9999)
  2558. else:
  2559. self.toolchangez_entry.set_range(-9999.9999, 9999.9999)
  2560. grid2.addWidget(toolchangezlabel, 7, 0)
  2561. grid2.addWidget(self.toolchangez_entry, 7, 1)
  2562. # End Move Z
  2563. endz_label = QtWidgets.QLabel('%s:' % _('End move Z'))
  2564. endz_label.setToolTip(
  2565. _("Height of the tool after\n"
  2566. "the last move at the end of the job.")
  2567. )
  2568. self.endz_entry = FCDoubleSpinner()
  2569. self.endz_entry.set_precision(self.decimals)
  2570. if machinist_setting == 0:
  2571. self.endz_entry.set_range(0.0000, 9999.9999)
  2572. else:
  2573. self.endz_entry.set_range(-9999.9999, 9999.9999)
  2574. grid2.addWidget(endz_label, 8, 0)
  2575. grid2.addWidget(self.endz_entry, 8, 1)
  2576. # End Move X,Y
  2577. endmove_xy_label = QtWidgets.QLabel('%s:' % _('End move X,Y'))
  2578. endmove_xy_label.setToolTip(
  2579. _("End move X,Y position. In format (x,y).\n"
  2580. "If no value is entered then there is no move\n"
  2581. "on X,Y plane at the end of the job.")
  2582. )
  2583. self.endxy_entry = FCEntry()
  2584. grid2.addWidget(endmove_xy_label, 9, 0)
  2585. grid2.addWidget(self.endxy_entry, 9, 1)
  2586. # Feedrate Z
  2587. frlabel = QtWidgets.QLabel('%s:' % _('Feedrate Z'))
  2588. frlabel.setToolTip(
  2589. _("Tool speed while drilling\n"
  2590. "(in units per minute).\n"
  2591. "So called 'Plunge' feedrate.\n"
  2592. "This is for linear move G01.")
  2593. )
  2594. self.feedrate_z_entry = FCDoubleSpinner()
  2595. self.feedrate_z_entry.set_precision(self.decimals)
  2596. self.feedrate_z_entry.set_range(0, 99999.9999)
  2597. grid2.addWidget(frlabel, 10, 0)
  2598. grid2.addWidget(self.feedrate_z_entry, 10, 1)
  2599. # Spindle speed
  2600. spdlabel = QtWidgets.QLabel('%s:' % _('Spindle Speed'))
  2601. spdlabel.setToolTip(
  2602. _("Speed of the spindle\n"
  2603. "in RPM (optional)")
  2604. )
  2605. self.spindlespeed_entry = FCSpinner()
  2606. self.spindlespeed_entry.set_range(0, 1000000)
  2607. self.spindlespeed_entry.set_step(100)
  2608. grid2.addWidget(spdlabel, 11, 0)
  2609. grid2.addWidget(self.spindlespeed_entry, 11, 1)
  2610. # Dwell
  2611. self.dwell_cb = FCCheckBox('%s' % _('Enable Dwell'))
  2612. self.dwell_cb .setToolTip(
  2613. _("Pause to allow the spindle to reach its\n"
  2614. "speed before cutting.")
  2615. )
  2616. grid2.addWidget(self.dwell_cb, 12, 0, 1, 2)
  2617. # Dwell Time
  2618. dwelltime = QtWidgets.QLabel('%s:' % _('Duration'))
  2619. dwelltime.setToolTip(_("Number of time units for spindle to dwell."))
  2620. self.dwelltime_entry = FCDoubleSpinner()
  2621. self.dwelltime_entry.set_precision(self.decimals)
  2622. self.dwelltime_entry.set_range(0, 99999.9999)
  2623. grid2.addWidget(dwelltime, 13, 0)
  2624. grid2.addWidget(self.dwelltime_entry, 13, 1)
  2625. self.ois_dwell_exc = OptionalInputSection(self.dwell_cb, [self.dwelltime_entry])
  2626. # preprocessor selection
  2627. pp_excellon_label = QtWidgets.QLabel('%s:' % _("Preprocessor"))
  2628. pp_excellon_label.setToolTip(
  2629. _("The preprocessor JSON file that dictates\n"
  2630. "Gcode output.")
  2631. )
  2632. self.pp_excellon_name_cb = FCComboBox()
  2633. self.pp_excellon_name_cb.setFocusPolicy(Qt.StrongFocus)
  2634. grid2.addWidget(pp_excellon_label, 14, 0)
  2635. grid2.addWidget(self.pp_excellon_name_cb, 14, 1)
  2636. # ### Choose what to use for Gcode creation: Drills, Slots or Both
  2637. excellon_gcode_type_label = QtWidgets.QLabel('<b>%s</b>' % _('Gcode'))
  2638. excellon_gcode_type_label.setToolTip(
  2639. _("Choose what to use for GCode generation:\n"
  2640. "'Drills', 'Slots' or 'Both'.\n"
  2641. "When choosing 'Slots' or 'Both', slots will be\n"
  2642. "converted to drills.")
  2643. )
  2644. self.excellon_gcode_type_radio = RadioSet([{'label': 'Drills', 'value': 'drills'},
  2645. {'label': 'Slots', 'value': 'slots'},
  2646. {'label': 'Both', 'value': 'both'}])
  2647. grid2.addWidget(excellon_gcode_type_label, 15, 0)
  2648. grid2.addWidget(self.excellon_gcode_type_radio, 15, 1)
  2649. # until I decide to implement this feature those remain disabled
  2650. excellon_gcode_type_label.hide()
  2651. self.excellon_gcode_type_radio.setVisible(False)
  2652. # ### Milling Holes ## ##
  2653. self.mill_hole_label = QtWidgets.QLabel('<b>%s</b>' % _('Mill Holes'))
  2654. self.mill_hole_label.setToolTip(
  2655. _("Create Geometry for milling holes.")
  2656. )
  2657. grid2.addWidget(self.mill_hole_label, 16, 0, 1, 2)
  2658. tdlabel = QtWidgets.QLabel('%s:' % _('Drill Tool dia'))
  2659. tdlabel.setToolTip(
  2660. _("Diameter of the cutting tool.")
  2661. )
  2662. self.tooldia_entry = FCDoubleSpinner()
  2663. self.tooldia_entry.set_precision(self.decimals)
  2664. self.tooldia_entry.set_range(0, 999.9999)
  2665. grid2.addWidget(tdlabel, 18, 0)
  2666. grid2.addWidget(self.tooldia_entry, 18, 1)
  2667. stdlabel = QtWidgets.QLabel('%s:' % _('Slot Tool dia'))
  2668. stdlabel.setToolTip(
  2669. _("Diameter of the cutting tool\n"
  2670. "when milling slots.")
  2671. )
  2672. self.slot_tooldia_entry = FCDoubleSpinner()
  2673. self.slot_tooldia_entry.set_precision(self.decimals)
  2674. self.slot_tooldia_entry.set_range(0, 999.9999)
  2675. grid2.addWidget(stdlabel, 21, 0)
  2676. grid2.addWidget(self.slot_tooldia_entry, 21, 1)
  2677. self.layout.addStretch()
  2678. class ExcellonAdvOptPrefGroupUI(OptionsGroupUI):
  2679. def __init__(self, decimals=4, parent=None):
  2680. # OptionsGroupUI.__init__(self, "Excellon Advanced Options", parent=parent)
  2681. super(ExcellonAdvOptPrefGroupUI, self).__init__(self)
  2682. self.setTitle(str(_("Excellon Adv. Options")))
  2683. self.decimals = decimals
  2684. # #######################
  2685. # ## ADVANCED OPTIONS ###
  2686. # #######################
  2687. self.exc_label = QtWidgets.QLabel('<b>%s:</b>' % _('Advanced Options'))
  2688. self.exc_label.setToolTip(
  2689. _("A list of Excellon advanced parameters.\n"
  2690. "Those parameters are available only for\n"
  2691. "Advanced App. Level.")
  2692. )
  2693. self.layout.addWidget(self.exc_label)
  2694. grid1 = QtWidgets.QGridLayout()
  2695. self.layout.addLayout(grid1)
  2696. # Offset Z
  2697. offsetlabel = QtWidgets.QLabel('%s:' % _('Offset Z'))
  2698. offsetlabel.setToolTip(
  2699. _("Some drill bits (the larger ones) need to drill deeper\n"
  2700. "to create the desired exit hole diameter due of the tip shape.\n"
  2701. "The value here can compensate the Cut Z parameter."))
  2702. self.offset_entry = FCDoubleSpinner()
  2703. self.offset_entry.set_precision(self.decimals)
  2704. self.offset_entry.set_range(-999.9999, 999.9999)
  2705. grid1.addWidget(offsetlabel, 0, 0)
  2706. grid1.addWidget(self.offset_entry, 0, 1)
  2707. # ToolChange X,Y
  2708. toolchange_xy_label = QtWidgets.QLabel('%s:' % _('Toolchange X,Y'))
  2709. toolchange_xy_label.setToolTip(
  2710. _("Toolchange X,Y position.")
  2711. )
  2712. self.toolchangexy_entry = FCEntry()
  2713. grid1.addWidget(toolchange_xy_label, 1, 0)
  2714. grid1.addWidget(self.toolchangexy_entry, 1, 1)
  2715. # Start Z
  2716. startzlabel = QtWidgets.QLabel('%s:' % _('Start Z'))
  2717. startzlabel.setToolTip(
  2718. _("Height of the tool just after start.\n"
  2719. "Delete the value if you don't need this feature.")
  2720. )
  2721. self.estartz_entry = FloatEntry()
  2722. grid1.addWidget(startzlabel, 2, 0)
  2723. grid1.addWidget(self.estartz_entry, 2, 1)
  2724. # Feedrate Rapids
  2725. fr_rapid_label = QtWidgets.QLabel('%s:' % _('Feedrate Rapids'))
  2726. fr_rapid_label.setToolTip(
  2727. _("Tool speed while drilling\n"
  2728. "(in units per minute).\n"
  2729. "This is for the rapid move G00.\n"
  2730. "It is useful only for Marlin,\n"
  2731. "ignore for any other cases.")
  2732. )
  2733. self.feedrate_rapid_entry = FCDoubleSpinner()
  2734. self.feedrate_rapid_entry.set_precision(self.decimals)
  2735. self.feedrate_rapid_entry.set_range(0, 99999.9999)
  2736. grid1.addWidget(fr_rapid_label, 3, 0)
  2737. grid1.addWidget(self.feedrate_rapid_entry, 3, 1)
  2738. # Probe depth
  2739. self.pdepth_label = QtWidgets.QLabel('%s:' % _("Probe Z depth"))
  2740. self.pdepth_label.setToolTip(
  2741. _("The maximum depth that the probe is allowed\n"
  2742. "to probe. Negative value, in current units.")
  2743. )
  2744. self.pdepth_entry = FCDoubleSpinner()
  2745. self.pdepth_entry.set_precision(self.decimals)
  2746. self.pdepth_entry.set_range(-99999.9999, 0.0000)
  2747. grid1.addWidget(self.pdepth_label, 4, 0)
  2748. grid1.addWidget(self.pdepth_entry, 4, 1)
  2749. # Probe feedrate
  2750. self.feedrate_probe_label = QtWidgets.QLabel('%s:' % _("Feedrate Probe"))
  2751. self.feedrate_probe_label.setToolTip(
  2752. _("The feedrate used while the probe is probing.")
  2753. )
  2754. self.feedrate_probe_entry = FCDoubleSpinner()
  2755. self.feedrate_probe_entry.set_precision(self.decimals)
  2756. self.feedrate_probe_entry.set_range(0, 99999.9999)
  2757. grid1.addWidget(self.feedrate_probe_label, 5, 0)
  2758. grid1.addWidget(self.feedrate_probe_entry, 5, 1)
  2759. # Spindle direction
  2760. spindle_dir_label = QtWidgets.QLabel('%s:' % _('Spindle direction'))
  2761. spindle_dir_label.setToolTip(
  2762. _("This sets the direction that the spindle is rotating.\n"
  2763. "It can be either:\n"
  2764. "- CW = clockwise or\n"
  2765. "- CCW = counter clockwise")
  2766. )
  2767. self.spindledir_radio = RadioSet([{'label': _('CW'), 'value': 'CW'},
  2768. {'label': _('CCW'), 'value': 'CCW'}])
  2769. grid1.addWidget(spindle_dir_label, 6, 0)
  2770. grid1.addWidget(self.spindledir_radio, 6, 1)
  2771. self.fplunge_cb = FCCheckBox('%s' % _('Fast Plunge'))
  2772. self.fplunge_cb.setToolTip(
  2773. _("By checking this, the vertical move from\n"
  2774. "Z_Toolchange to Z_move is done with G0,\n"
  2775. "meaning the fastest speed available.\n"
  2776. "WARNING: the move is done at Toolchange X,Y coords.")
  2777. )
  2778. grid1.addWidget(self.fplunge_cb, 7, 0, 1, 2)
  2779. self.fretract_cb = FCCheckBox('%s' % _('Fast Retract'))
  2780. self.fretract_cb.setToolTip(
  2781. _("Exit hole strategy.\n"
  2782. " - When uncheked, while exiting the drilled hole the drill bit\n"
  2783. "will travel slow, with set feedrate (G1), up to zero depth and then\n"
  2784. "travel as fast as possible (G0) to the Z Move (travel height).\n"
  2785. " - When checked the travel from Z cut (cut depth) to Z_move\n"
  2786. "(travel height) is done as fast as possible (G0) in one move.")
  2787. )
  2788. grid1.addWidget(self.fretract_cb, 8, 0, 1, 2)
  2789. self.layout.addStretch()
  2790. class ExcellonExpPrefGroupUI(OptionsGroupUI):
  2791. def __init__(self, decimals=4, parent=None):
  2792. super(ExcellonExpPrefGroupUI, self).__init__(self)
  2793. self.setTitle(str(_("Excellon Export")))
  2794. self.decimals = decimals
  2795. # Plot options
  2796. self.export_options_label = QtWidgets.QLabel("<b>%s:</b>" % _("Export Options"))
  2797. self.export_options_label.setToolTip(
  2798. _("The parameters set here are used in the file exported\n"
  2799. "when using the File -> Export -> Export Excellon menu entry.")
  2800. )
  2801. self.layout.addWidget(self.export_options_label)
  2802. form = QtWidgets.QFormLayout()
  2803. self.layout.addLayout(form)
  2804. # Excellon Units
  2805. self.excellon_units_label = QtWidgets.QLabel('%s:' % _('Units'))
  2806. self.excellon_units_label.setToolTip(
  2807. _("The units used in the Excellon file.")
  2808. )
  2809. self.excellon_units_radio = RadioSet([{'label': _('INCH'), 'value': 'INCH'},
  2810. {'label': _('MM'), 'value': 'METRIC'}])
  2811. self.excellon_units_radio.setToolTip(
  2812. _("The units used in the Excellon file.")
  2813. )
  2814. form.addRow(self.excellon_units_label, self.excellon_units_radio)
  2815. # Excellon non-decimal format
  2816. self.digits_label = QtWidgets.QLabel("%s:" % _("Int/Decimals"))
  2817. self.digits_label.setToolTip(
  2818. _("The NC drill files, usually named Excellon files\n"
  2819. "are files that can be found in different formats.\n"
  2820. "Here we set the format used when the provided\n"
  2821. "coordinates are not using period.")
  2822. )
  2823. hlay1 = QtWidgets.QHBoxLayout()
  2824. self.format_whole_entry = FCSpinner()
  2825. self.format_whole_entry.set_range(0, 9)
  2826. self.format_whole_entry.setMinimumWidth(30)
  2827. self.format_whole_entry.setToolTip(
  2828. _("This numbers signify the number of digits in\n"
  2829. "the whole part of Excellon coordinates.")
  2830. )
  2831. hlay1.addWidget(self.format_whole_entry, QtCore.Qt.AlignLeft)
  2832. excellon_separator_label = QtWidgets.QLabel(':')
  2833. excellon_separator_label.setFixedWidth(5)
  2834. hlay1.addWidget(excellon_separator_label, QtCore.Qt.AlignLeft)
  2835. self.format_dec_entry = FCSpinner()
  2836. self.format_dec_entry.set_range(0, 9)
  2837. self.format_dec_entry.setMinimumWidth(30)
  2838. self.format_dec_entry.setToolTip(
  2839. _("This numbers signify the number of digits in\n"
  2840. "the decimal part of Excellon coordinates.")
  2841. )
  2842. hlay1.addWidget(self.format_dec_entry, QtCore.Qt.AlignLeft)
  2843. hlay1.addStretch()
  2844. form.addRow(self.digits_label, hlay1)
  2845. # Select the Excellon Format
  2846. self.format_label = QtWidgets.QLabel("%s:" % _("Format"))
  2847. self.format_label.setToolTip(
  2848. _("Select the kind of coordinates format used.\n"
  2849. "Coordinates can be saved with decimal point or without.\n"
  2850. "When there is no decimal point, it is required to specify\n"
  2851. "the number of digits for integer part and the number of decimals.\n"
  2852. "Also it will have to be specified if LZ = leading zeros are kept\n"
  2853. "or TZ = trailing zeros are kept.")
  2854. )
  2855. self.format_radio = RadioSet([{'label': _('Decimal'), 'value': 'dec'},
  2856. {'label': _('No-Decimal'), 'value': 'ndec'}])
  2857. self.format_radio.setToolTip(
  2858. _("Select the kind of coordinates format used.\n"
  2859. "Coordinates can be saved with decimal point or without.\n"
  2860. "When there is no decimal point, it is required to specify\n"
  2861. "the number of digits for integer part and the number of decimals.\n"
  2862. "Also it will have to be specified if LZ = leading zeros are kept\n"
  2863. "or TZ = trailing zeros are kept.")
  2864. )
  2865. form.addRow(self.format_label, self.format_radio)
  2866. # Excellon Zeros
  2867. self.zeros_label = QtWidgets.QLabel('%s:' % _('Zeros'))
  2868. self.zeros_label.setAlignment(QtCore.Qt.AlignLeft)
  2869. self.zeros_label.setToolTip(
  2870. _("This sets the type of Excellon zeros.\n"
  2871. "If LZ then Leading Zeros are kept and\n"
  2872. "Trailing Zeros are removed.\n"
  2873. "If TZ is checked then Trailing Zeros are kept\n"
  2874. "and Leading Zeros are removed.")
  2875. )
  2876. self.zeros_radio = RadioSet([{'label': _('LZ'), 'value': 'LZ'},
  2877. {'label': _('TZ'), 'value': 'TZ'}])
  2878. self.zeros_radio.setToolTip(
  2879. _("This sets the default type of Excellon zeros.\n"
  2880. "If LZ then Leading Zeros are kept and\n"
  2881. "Trailing Zeros are removed.\n"
  2882. "If TZ is checked then Trailing Zeros are kept\n"
  2883. "and Leading Zeros are removed.")
  2884. )
  2885. form.addRow(self.zeros_label, self.zeros_radio)
  2886. # Slot type
  2887. self.slot_type_label = QtWidgets.QLabel('%s:' % _('Slot type'))
  2888. self.slot_type_label.setAlignment(QtCore.Qt.AlignLeft)
  2889. self.slot_type_label.setToolTip(
  2890. _("This sets how the slots will be exported.\n"
  2891. "If ROUTED then the slots will be routed\n"
  2892. "using M15/M16 commands.\n"
  2893. "If DRILLED(G85) the slots will be exported\n"
  2894. "using the Drilled slot command (G85).")
  2895. )
  2896. self.slot_type_radio = RadioSet([{'label': _('Routed'), 'value': 'routing'},
  2897. {'label': _('Drilled(G85)'), 'value': 'drilling'}])
  2898. self.slot_type_radio.setToolTip(
  2899. _("This sets how the slots will be exported.\n"
  2900. "If ROUTED then the slots will be routed\n"
  2901. "using M15/M16 commands.\n"
  2902. "If DRILLED(G85) the slots will be exported\n"
  2903. "using the Drilled slot command (G85).")
  2904. )
  2905. form.addRow(self.slot_type_label, self.slot_type_radio)
  2906. self.layout.addStretch()
  2907. self.format_radio.activated_custom.connect(self.optimization_selection)
  2908. def optimization_selection(self):
  2909. if self.format_radio.get_value() == 'dec':
  2910. self.zeros_label.setDisabled(True)
  2911. self.zeros_radio.setDisabled(True)
  2912. else:
  2913. self.zeros_label.setDisabled(False)
  2914. self.zeros_radio.setDisabled(False)
  2915. class ExcellonEditorPrefGroupUI(OptionsGroupUI):
  2916. def __init__(self, decimals=4, parent=None):
  2917. super(ExcellonEditorPrefGroupUI, self).__init__(self)
  2918. self.setTitle(str(_("Excellon Editor")))
  2919. self.decimals = decimals
  2920. # Excellon Editor Parameters
  2921. self.param_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  2922. self.param_label.setToolTip(
  2923. _("A list of Excellon Editor parameters.")
  2924. )
  2925. self.layout.addWidget(self.param_label)
  2926. grid0 = QtWidgets.QGridLayout()
  2927. self.layout.addLayout(grid0)
  2928. # Selection Limit
  2929. self.sel_limit_label = QtWidgets.QLabel('%s:' % _("Selection limit"))
  2930. self.sel_limit_label.setToolTip(
  2931. _("Set the number of selected Excellon geometry\n"
  2932. "items above which the utility geometry\n"
  2933. "becomes just a selection rectangle.\n"
  2934. "Increases the performance when moving a\n"
  2935. "large number of geometric elements.")
  2936. )
  2937. self.sel_limit_entry = FCSpinner()
  2938. self.sel_limit_entry.set_range(0, 99999)
  2939. grid0.addWidget(self.sel_limit_label, 0, 0)
  2940. grid0.addWidget(self.sel_limit_entry, 0, 1)
  2941. # New Diameter
  2942. self.addtool_entry_lbl = QtWidgets.QLabel('%s:' % _('New Dia'))
  2943. self.addtool_entry_lbl.setToolTip(
  2944. _("Diameter for the new tool")
  2945. )
  2946. self.addtool_entry = FCDoubleSpinner()
  2947. self.addtool_entry.set_range(0.000001, 99.9999)
  2948. self.addtool_entry.set_precision(self.decimals)
  2949. grid0.addWidget(self.addtool_entry_lbl, 1, 0)
  2950. grid0.addWidget(self.addtool_entry, 1, 1)
  2951. # Number of drill holes in a drill array
  2952. self.drill_array_size_label = QtWidgets.QLabel('%s:' % _('Nr of drills'))
  2953. self.drill_array_size_label.setToolTip(
  2954. _("Specify how many drills to be in the array.")
  2955. )
  2956. # self.drill_array_size_label.setMinimumWidth(100)
  2957. self.drill_array_size_entry = FCSpinner()
  2958. self.drill_array_size_entry.set_range(0, 9999)
  2959. grid0.addWidget(self.drill_array_size_label, 2, 0)
  2960. grid0.addWidget(self.drill_array_size_entry, 2, 1)
  2961. self.drill_array_linear_label = QtWidgets.QLabel('<b>%s:</b>' % _('Linear Drill Array'))
  2962. grid0.addWidget(self.drill_array_linear_label, 3, 0, 1, 2)
  2963. # Linear Drill Array direction
  2964. self.drill_axis_label = QtWidgets.QLabel('%s:' % _('Linear Direction'))
  2965. self.drill_axis_label.setToolTip(
  2966. _("Direction on which the linear array is oriented:\n"
  2967. "- 'X' - horizontal axis \n"
  2968. "- 'Y' - vertical axis or \n"
  2969. "- 'Angle' - a custom angle for the array inclination")
  2970. )
  2971. # self.drill_axis_label.setMinimumWidth(100)
  2972. self.drill_axis_radio = RadioSet([{'label': _('X'), 'value': 'X'},
  2973. {'label': _('Y'), 'value': 'Y'},
  2974. {'label': _('Angle'), 'value': 'A'}])
  2975. grid0.addWidget(self.drill_axis_label, 4, 0)
  2976. grid0.addWidget(self.drill_axis_radio, 4, 1)
  2977. # Linear Drill Array pitch distance
  2978. self.drill_pitch_label = QtWidgets.QLabel('%s:' % _('Pitch'))
  2979. self.drill_pitch_label.setToolTip(
  2980. _("Pitch = Distance between elements of the array.")
  2981. )
  2982. # self.drill_pitch_label.setMinimumWidth(100)
  2983. self.drill_pitch_entry = FCDoubleSpinner()
  2984. self.drill_pitch_entry.set_range(0, 99999.9999)
  2985. self.drill_pitch_entry.set_precision(self.decimals)
  2986. grid0.addWidget(self.drill_pitch_label, 5, 0)
  2987. grid0.addWidget(self.drill_pitch_entry, 5, 1)
  2988. # Linear Drill Array custom angle
  2989. self.drill_angle_label = QtWidgets.QLabel('%s:' % _('Angle'))
  2990. self.drill_angle_label.setToolTip(
  2991. _("Angle at which each element in circular array is placed.")
  2992. )
  2993. self.drill_angle_entry = FCDoubleSpinner()
  2994. self.drill_pitch_entry.set_range(-360, 360)
  2995. self.drill_pitch_entry.set_precision(self.decimals)
  2996. self.drill_angle_entry.setWrapping(True)
  2997. self.drill_angle_entry.setSingleStep(5)
  2998. grid0.addWidget(self.drill_angle_label, 6, 0)
  2999. grid0.addWidget(self.drill_angle_entry, 6, 1)
  3000. self.drill_array_circ_label = QtWidgets.QLabel('<b>%s:</b>' % _('Circular Drill Array'))
  3001. grid0.addWidget(self.drill_array_circ_label, 7, 0, 1, 2)
  3002. # Circular Drill Array direction
  3003. self.drill_circular_direction_label = QtWidgets.QLabel('%s:' % _('Circular Direction'))
  3004. self.drill_circular_direction_label.setToolTip(
  3005. _("Direction for circular array.\n"
  3006. "Can be CW = clockwise or CCW = counter clockwise.")
  3007. )
  3008. self.drill_circular_dir_radio = RadioSet([{'label': _('CW'), 'value': 'CW'},
  3009. {'label': _('CCW'), 'value': 'CCW'}])
  3010. grid0.addWidget(self.drill_circular_direction_label, 8, 0)
  3011. grid0.addWidget(self.drill_circular_dir_radio, 8, 1)
  3012. # Circular Drill Array Angle
  3013. self.drill_circular_angle_label = QtWidgets.QLabel('%s:' % _('Circular Angle'))
  3014. self.drill_circular_angle_label.setToolTip(
  3015. _("Angle at which each element in circular array is placed.")
  3016. )
  3017. self.drill_circular_angle_entry = FCDoubleSpinner()
  3018. self.drill_circular_angle_entry.set_range(-360, 360)
  3019. self.drill_circular_angle_entry.set_precision(self.decimals)
  3020. self.drill_circular_angle_entry.setWrapping(True)
  3021. self.drill_circular_angle_entry.setSingleStep(5)
  3022. grid0.addWidget(self.drill_circular_angle_label, 9, 0)
  3023. grid0.addWidget(self.drill_circular_angle_entry, 9, 1)
  3024. # ##### SLOTS #####
  3025. # #################
  3026. self.drill_array_circ_label = QtWidgets.QLabel('<b>%s:</b>' % _('Slots'))
  3027. grid0.addWidget(self.drill_array_circ_label, 10, 0, 1, 2)
  3028. # Slot length
  3029. self.slot_length_label = QtWidgets.QLabel('%s:' % _('Length'))
  3030. self.slot_length_label.setToolTip(
  3031. _("Length = The length of the slot.")
  3032. )
  3033. self.slot_length_label.setMinimumWidth(100)
  3034. self.slot_length_entry = FCDoubleSpinner()
  3035. self.slot_length_entry.set_range(0, 99999)
  3036. self.slot_length_entry.set_precision(self.decimals)
  3037. self.slot_length_entry.setWrapping(True)
  3038. self.slot_length_entry.setSingleStep(1)
  3039. grid0.addWidget(self.slot_length_label, 11, 0)
  3040. grid0.addWidget(self.slot_length_entry, 11, 1)
  3041. # Slot direction
  3042. self.slot_axis_label = QtWidgets.QLabel('%s:' % _('Direction'))
  3043. self.slot_axis_label.setToolTip(
  3044. _("Direction on which the slot is oriented:\n"
  3045. "- 'X' - horizontal axis \n"
  3046. "- 'Y' - vertical axis or \n"
  3047. "- 'Angle' - a custom angle for the slot inclination")
  3048. )
  3049. self.slot_axis_label.setMinimumWidth(100)
  3050. self.slot_axis_radio = RadioSet([{'label': _('X'), 'value': 'X'},
  3051. {'label': _('Y'), 'value': 'Y'},
  3052. {'label': _('Angle'), 'value': 'A'}])
  3053. grid0.addWidget(self.slot_axis_label, 12, 0)
  3054. grid0.addWidget(self.slot_axis_radio, 12, 1)
  3055. # Slot custom angle
  3056. self.slot_angle_label = QtWidgets.QLabel('%s:' % _('Angle'))
  3057. self.slot_angle_label.setToolTip(
  3058. _("Angle at which the slot is placed.\n"
  3059. "The precision is of max 2 decimals.\n"
  3060. "Min value is: -359.99 degrees.\n"
  3061. "Max value is: 360.00 degrees.")
  3062. )
  3063. self.slot_angle_label.setMinimumWidth(100)
  3064. self.slot_angle_spinner = FCDoubleSpinner()
  3065. self.slot_angle_spinner.set_precision(self.decimals)
  3066. self.slot_angle_spinner.setWrapping(True)
  3067. self.slot_angle_spinner.setRange(-359.99, 360.00)
  3068. self.slot_angle_spinner.setSingleStep(5)
  3069. grid0.addWidget(self.slot_angle_label, 13, 0)
  3070. grid0.addWidget(self.slot_angle_spinner, 13, 1)
  3071. # #### SLOTS ARRAY #######
  3072. # ########################
  3073. self.slot_array_linear_label = QtWidgets.QLabel('<b>%s:</b>' % _('Linear Slot Array'))
  3074. grid0.addWidget(self.slot_array_linear_label, 14, 0, 1, 2)
  3075. # Number of slot holes in a drill array
  3076. self.slot_array_size_label = QtWidgets.QLabel('%s:' % _('Nr of slots'))
  3077. self.drill_array_size_label.setToolTip(
  3078. _("Specify how many slots to be in the array.")
  3079. )
  3080. # self.slot_array_size_label.setMinimumWidth(100)
  3081. self.slot_array_size_entry = FCSpinner()
  3082. self.slot_array_size_entry.set_range(0, 999999)
  3083. grid0.addWidget(self.slot_array_size_label, 15, 0)
  3084. grid0.addWidget(self.slot_array_size_entry, 15, 1)
  3085. # Linear Slot Array direction
  3086. self.slot_array_axis_label = QtWidgets.QLabel('%s:' % _('Linear Direction'))
  3087. self.slot_array_axis_label.setToolTip(
  3088. _("Direction on which the linear array is oriented:\n"
  3089. "- 'X' - horizontal axis \n"
  3090. "- 'Y' - vertical axis or \n"
  3091. "- 'Angle' - a custom angle for the array inclination")
  3092. )
  3093. # self.slot_axis_label.setMinimumWidth(100)
  3094. self.slot_array_axis_radio = RadioSet([{'label': _('X'), 'value': 'X'},
  3095. {'label': _('Y'), 'value': 'Y'},
  3096. {'label': _('Angle'), 'value': 'A'}])
  3097. grid0.addWidget(self.slot_array_axis_label, 16, 0)
  3098. grid0.addWidget(self.slot_array_axis_radio, 16, 1)
  3099. # Linear Slot Array pitch distance
  3100. self.slot_array_pitch_label = QtWidgets.QLabel('%s:' % _('Pitch'))
  3101. self.slot_array_pitch_label.setToolTip(
  3102. _("Pitch = Distance between elements of the array.")
  3103. )
  3104. # self.drill_pitch_label.setMinimumWidth(100)
  3105. self.slot_array_pitch_entry = FCDoubleSpinner()
  3106. self.slot_array_pitch_entry.set_precision(self.decimals)
  3107. self.slot_array_pitch_entry.setWrapping(True)
  3108. self.slot_array_pitch_entry.setRange(0, 999999)
  3109. self.slot_array_pitch_entry.setSingleStep(1)
  3110. grid0.addWidget(self.slot_array_pitch_label, 17, 0)
  3111. grid0.addWidget(self.slot_array_pitch_entry, 17, 1)
  3112. # Linear Slot Array custom angle
  3113. self.slot_array_angle_label = QtWidgets.QLabel('%s:' % _('Angle'))
  3114. self.slot_array_angle_label.setToolTip(
  3115. _("Angle at which each element in circular array is placed.")
  3116. )
  3117. self.slot_array_angle_entry = FCDoubleSpinner()
  3118. self.slot_array_angle_entry.set_precision(self.decimals)
  3119. self.slot_array_angle_entry.setWrapping(True)
  3120. self.slot_array_angle_entry.setRange(-360, 360)
  3121. self.slot_array_angle_entry.setSingleStep(5)
  3122. grid0.addWidget(self.slot_array_angle_label, 18, 0)
  3123. grid0.addWidget(self.slot_array_angle_entry, 18, 1)
  3124. self.slot_array_circ_label = QtWidgets.QLabel('<b>%s:</b>' % _('Circular Slot Array'))
  3125. grid0.addWidget(self.slot_array_circ_label, 19, 0, 1, 2)
  3126. # Circular Slot Array direction
  3127. self.slot_array_circular_direction_label = QtWidgets.QLabel('%s:' % _('Circular Direction'))
  3128. self.slot_array_circular_direction_label.setToolTip(
  3129. _("Direction for circular array.\n"
  3130. "Can be CW = clockwise or CCW = counter clockwise.")
  3131. )
  3132. self.slot_array_circular_dir_radio = RadioSet([{'label': _('CW'), 'value': 'CW'},
  3133. {'label': _('CCW'), 'value': 'CCW'}])
  3134. grid0.addWidget(self.slot_array_circular_direction_label, 20, 0)
  3135. grid0.addWidget(self.slot_array_circular_dir_radio, 20, 1)
  3136. # Circular Slot Array Angle
  3137. self.slot_array_circular_angle_label = QtWidgets.QLabel('%s:' % _('Circular Angle'))
  3138. self.slot_array_circular_angle_label.setToolTip(
  3139. _("Angle at which each element in circular array is placed.")
  3140. )
  3141. self.slot_array_circular_angle_entry = FCDoubleSpinner()
  3142. self.slot_array_circular_angle_entry.set_precision(self.decimals)
  3143. self.slot_array_circular_angle_entry.setWrapping(True)
  3144. self.slot_array_circular_angle_entry.setRange(-360, 360)
  3145. self.slot_array_circular_angle_entry.setSingleStep(5)
  3146. grid0.addWidget(self.slot_array_circular_angle_label, 21, 0)
  3147. grid0.addWidget(self.slot_array_circular_angle_entry, 21, 1)
  3148. self.layout.addStretch()
  3149. class GeometryGenPrefGroupUI(OptionsGroupUI):
  3150. def __init__(self, decimals=4, parent=None):
  3151. # OptionsGroupUI.__init__(self, "Geometry General Preferences", parent=parent)
  3152. super(GeometryGenPrefGroupUI, self).__init__(self)
  3153. self.setTitle(str(_("Geometry General")))
  3154. self.decimals = decimals
  3155. # ## Plot options
  3156. self.plot_options_label = QtWidgets.QLabel("<b>%s:</b>" % _("Plot Options"))
  3157. self.layout.addWidget(self.plot_options_label)
  3158. # Plot CB
  3159. self.plot_cb = FCCheckBox(label=_('Plot'))
  3160. self.plot_cb.setToolTip(
  3161. _("Plot (show) this object.")
  3162. )
  3163. self.layout.addWidget(self.plot_cb)
  3164. grid0 = QtWidgets.QGridLayout()
  3165. self.layout.addLayout(grid0)
  3166. grid0.setColumnStretch(0, 0)
  3167. grid0.setColumnStretch(1, 1)
  3168. # Number of circle steps for circular aperture linear approximation
  3169. self.circle_steps_label = QtWidgets.QLabel('%s:' % _("Circle Steps"))
  3170. self.circle_steps_label.setToolTip(
  3171. _("The number of circle steps for <b>Geometry</b> \n"
  3172. "circle and arc shapes linear approximation.")
  3173. )
  3174. self.circle_steps_entry = FCSpinner()
  3175. self.circle_steps_entry.set_range(0, 999)
  3176. grid0.addWidget(self.circle_steps_label, 1, 0)
  3177. grid0.addWidget(self.circle_steps_entry, 1, 1)
  3178. # Tools
  3179. self.tools_label = QtWidgets.QLabel("<b>%s:</b>" % _("Tools"))
  3180. grid0.addWidget(self.tools_label, 2, 0, 1, 2)
  3181. # Tooldia
  3182. tdlabel = QtWidgets.QLabel('<b><font color="green">%s:</font></b>' % _('Tools Dia'))
  3183. tdlabel.setToolTip(
  3184. _("Diameters of the tools, separated by comma.\n"
  3185. "The value of the diameter has to use the dot decimals separator.\n"
  3186. "Valid values: 0.3, 1.0")
  3187. )
  3188. self.cnctooldia_entry = FCEntry()
  3189. grid0.addWidget(tdlabel, 3, 0)
  3190. grid0.addWidget(self.cnctooldia_entry, 3, 1)
  3191. separator_line = QtWidgets.QFrame()
  3192. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  3193. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  3194. grid0.addWidget(separator_line, 9, 0, 1, 2)
  3195. # Geometry Object Color
  3196. self.gerber_color_label = QtWidgets.QLabel('<b>%s</b>' % _('Geometry Object Color'))
  3197. grid0.addWidget(self.gerber_color_label, 10, 0, 1, 2)
  3198. # Plot Line Color
  3199. self.line_color_label = QtWidgets.QLabel('%s:' % _('Outline'))
  3200. self.line_color_label.setToolTip(
  3201. _("Set the line color for plotted objects.")
  3202. )
  3203. self.line_color_entry = FCEntry()
  3204. self.line_color_button = QtWidgets.QPushButton()
  3205. self.line_color_button.setFixedSize(15, 15)
  3206. self.form_box_child_2 = QtWidgets.QHBoxLayout()
  3207. self.form_box_child_2.addWidget(self.line_color_entry)
  3208. self.form_box_child_2.addWidget(self.line_color_button)
  3209. self.form_box_child_2.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  3210. grid0.addWidget(self.line_color_label, 11, 0)
  3211. grid0.addLayout(self.form_box_child_2, 11, 1)
  3212. self.layout.addStretch()
  3213. # Setting plot colors signals
  3214. self.line_color_entry.editingFinished.connect(self.on_line_color_entry)
  3215. self.line_color_button.clicked.connect(self.on_line_color_button)
  3216. def on_line_color_entry(self):
  3217. self.app.defaults['geometry_plot_line'] = self.line_color_entry.get_value()[:7] + 'FF'
  3218. self.line_color_button.setStyleSheet("background-color:%s" % str(self.app.defaults['geometry_plot_line'])[:7])
  3219. def on_line_color_button(self):
  3220. current_color = QtGui.QColor(self.app.defaults['geometry_plot_line'][:7])
  3221. # print(current_color)
  3222. c_dialog = QtWidgets.QColorDialog()
  3223. plot_line_color = c_dialog.getColor(initial=current_color)
  3224. if plot_line_color.isValid() is False:
  3225. return
  3226. self.line_color_button.setStyleSheet("background-color:%s" % str(plot_line_color.name()))
  3227. new_val_line = str(plot_line_color.name()) + str(self.app.defaults['geometry_plot_line'][7:9])
  3228. self.line_color_entry.set_value(new_val_line)
  3229. class GeometryOptPrefGroupUI(OptionsGroupUI):
  3230. def __init__(self, decimals=4, parent=None):
  3231. # OptionsGroupUI.__init__(self, "Geometry Options Preferences", parent=parent)
  3232. super(GeometryOptPrefGroupUI, self).__init__(self)
  3233. self.setTitle(str(_("Geometry Options")))
  3234. self.decimals = decimals
  3235. # ------------------------------
  3236. # ## Create CNC Job
  3237. # ------------------------------
  3238. self.cncjob_label = QtWidgets.QLabel('<b>%s:</b>' % _('Create CNC Job'))
  3239. self.cncjob_label.setToolTip(
  3240. _("Create a CNC Job object\n"
  3241. "tracing the contours of this\n"
  3242. "Geometry object.")
  3243. )
  3244. self.layout.addWidget(self.cncjob_label)
  3245. grid1 = QtWidgets.QGridLayout()
  3246. self.layout.addLayout(grid1)
  3247. grid1.setColumnStretch(0, 0)
  3248. grid1.setColumnStretch(1, 1)
  3249. # Cut Z
  3250. cutzlabel = QtWidgets.QLabel('%s:' % _('Cut Z'))
  3251. cutzlabel.setToolTip(
  3252. _("Cutting depth (negative)\n"
  3253. "below the copper surface.")
  3254. )
  3255. self.cutz_entry = FCDoubleSpinner()
  3256. if machinist_setting == 0:
  3257. self.cutz_entry.set_range(-9999.9999, 0.0000)
  3258. else:
  3259. self.cutz_entry.set_range(-9999.9999, 9999.9999)
  3260. self.cutz_entry.set_precision(self.decimals)
  3261. self.cutz_entry.setSingleStep(0.1)
  3262. self.cutz_entry.setWrapping(True)
  3263. grid1.addWidget(cutzlabel, 0, 0)
  3264. grid1.addWidget(self.cutz_entry, 0, 1)
  3265. # Multidepth CheckBox
  3266. self.multidepth_cb = FCCheckBox(label=_('Multi-Depth'))
  3267. self.multidepth_cb.setToolTip(
  3268. _(
  3269. "Use multiple passes to limit\n"
  3270. "the cut depth in each pass. Will\n"
  3271. "cut multiple times until Cut Z is\n"
  3272. "reached."
  3273. )
  3274. )
  3275. grid1.addWidget(self.multidepth_cb, 1, 0)
  3276. # Depth/pass
  3277. dplabel = QtWidgets.QLabel('%s:' % _('Depth/Pass'))
  3278. dplabel.setToolTip(
  3279. _("The depth to cut on each pass,\n"
  3280. "when multidepth is enabled.\n"
  3281. "It has positive value although\n"
  3282. "it is a fraction from the depth\n"
  3283. "which has negative value.")
  3284. )
  3285. self.depthperpass_entry = FCDoubleSpinner()
  3286. self.depthperpass_entry.set_range(0, 99999)
  3287. self.depthperpass_entry.set_precision(self.decimals)
  3288. self.depthperpass_entry.setSingleStep(0.1)
  3289. self.depthperpass_entry.setWrapping(True)
  3290. grid1.addWidget(dplabel, 2, 0)
  3291. grid1.addWidget(self.depthperpass_entry, 2, 1)
  3292. self.ois_multidepth = OptionalInputSection(self.multidepth_cb, [self.depthperpass_entry])
  3293. # Travel Z
  3294. travelzlabel = QtWidgets.QLabel('%s:' % _('Travel Z'))
  3295. travelzlabel.setToolTip(
  3296. _("Height of the tool when\n"
  3297. "moving without cutting.")
  3298. )
  3299. self.travelz_entry = FCDoubleSpinner()
  3300. if machinist_setting == 0:
  3301. self.travelz_entry.set_range(0.0001, 9999.9999)
  3302. else:
  3303. self.travelz_entry.set_range(-9999.9999, 9999.9999)
  3304. self.travelz_entry.set_precision(self.decimals)
  3305. self.travelz_entry.setSingleStep(0.1)
  3306. self.travelz_entry.setWrapping(True)
  3307. grid1.addWidget(travelzlabel, 3, 0)
  3308. grid1.addWidget(self.travelz_entry, 3, 1)
  3309. # Tool change:
  3310. self.toolchange_cb = FCCheckBox('%s' % _("Tool change"))
  3311. self.toolchange_cb.setToolTip(
  3312. _(
  3313. "Include tool-change sequence\n"
  3314. "in the Machine Code (Pause for tool change)."
  3315. )
  3316. )
  3317. grid1.addWidget(self.toolchange_cb, 4, 0, 1, 2)
  3318. # Toolchange Z
  3319. toolchangezlabel = QtWidgets.QLabel('%s:' % _('Toolchange Z'))
  3320. toolchangezlabel.setToolTip(
  3321. _(
  3322. "Z-axis position (height) for\n"
  3323. "tool change."
  3324. )
  3325. )
  3326. self.toolchangez_entry = FCDoubleSpinner()
  3327. if machinist_setting == 0:
  3328. self.toolchangez_entry.set_range(0.000, 9999.9999)
  3329. else:
  3330. self.toolchangez_entry.set_range(-9999.9999, 9999.9999)
  3331. self.toolchangez_entry.set_precision(self.decimals)
  3332. self.toolchangez_entry.setSingleStep(0.1)
  3333. self.toolchangez_entry.setWrapping(True)
  3334. grid1.addWidget(toolchangezlabel, 5, 0)
  3335. grid1.addWidget(self.toolchangez_entry, 5, 1)
  3336. # End move Z
  3337. endz_label = QtWidgets.QLabel('%s:' % _('End move Z'))
  3338. endz_label.setToolTip(
  3339. _("Height of the tool after\n"
  3340. "the last move at the end of the job.")
  3341. )
  3342. self.endz_entry = FCDoubleSpinner()
  3343. if machinist_setting == 0:
  3344. self.endz_entry.set_range(0.000, 9999.9999)
  3345. else:
  3346. self.endz_entry.set_range(-9999.9999, 9999.9999)
  3347. self.endz_entry.set_precision(self.decimals)
  3348. self.endz_entry.setSingleStep(0.1)
  3349. self.endz_entry.setWrapping(True)
  3350. grid1.addWidget(endz_label, 6, 0)
  3351. grid1.addWidget(self.endz_entry, 6, 1)
  3352. # End Move X,Y
  3353. endmove_xy_label = QtWidgets.QLabel('%s:' % _('End move X,Y'))
  3354. endmove_xy_label.setToolTip(
  3355. _("End move X,Y position. In format (x,y).\n"
  3356. "If no value is entered then there is no move\n"
  3357. "on X,Y plane at the end of the job.")
  3358. )
  3359. self.endxy_entry = FCEntry()
  3360. grid1.addWidget(endmove_xy_label, 7, 0)
  3361. grid1.addWidget(self.endxy_entry, 7, 1)
  3362. # Feedrate X-Y
  3363. frlabel = QtWidgets.QLabel('%s:' % _('Feedrate X-Y'))
  3364. frlabel.setToolTip(
  3365. _("Cutting speed in the XY\n"
  3366. "plane in units per minute")
  3367. )
  3368. self.cncfeedrate_entry = FCDoubleSpinner()
  3369. self.cncfeedrate_entry.set_range(0, 99999.9999)
  3370. self.cncfeedrate_entry.set_precision(self.decimals)
  3371. self.cncfeedrate_entry.setSingleStep(0.1)
  3372. self.cncfeedrate_entry.setWrapping(True)
  3373. grid1.addWidget(frlabel, 8, 0)
  3374. grid1.addWidget(self.cncfeedrate_entry, 8, 1)
  3375. # Feedrate Z (Plunge)
  3376. frz_label = QtWidgets.QLabel('%s:' % _('Feedrate Z'))
  3377. frz_label.setToolTip(
  3378. _("Cutting speed in the XY\n"
  3379. "plane in units per minute.\n"
  3380. "It is called also Plunge.")
  3381. )
  3382. self.feedrate_z_entry = FCDoubleSpinner()
  3383. self.feedrate_z_entry.set_range(0, 99999.9999)
  3384. self.feedrate_z_entry.set_precision(self.decimals)
  3385. self.feedrate_z_entry.setSingleStep(0.1)
  3386. self.feedrate_z_entry.setWrapping(True)
  3387. grid1.addWidget(frz_label, 9, 0)
  3388. grid1.addWidget(self.feedrate_z_entry, 9, 1)
  3389. # Spindle Speed
  3390. spdlabel = QtWidgets.QLabel('%s:' % _('Spindle speed'))
  3391. spdlabel.setToolTip(
  3392. _(
  3393. "Speed of the spindle in RPM (optional).\n"
  3394. "If LASER preprocessor is used,\n"
  3395. "this value is the power of laser."
  3396. )
  3397. )
  3398. self.cncspindlespeed_entry = FCSpinner()
  3399. self.cncspindlespeed_entry.set_range(0, 1000000)
  3400. self.cncspindlespeed_entry.set_step(100)
  3401. grid1.addWidget(spdlabel, 10, 0)
  3402. grid1.addWidget(self.cncspindlespeed_entry, 10, 1)
  3403. # Dwell
  3404. self.dwell_cb = FCCheckBox(label='%s' % _('Enable Dwell'))
  3405. self.dwell_cb.setToolTip(
  3406. _("Pause to allow the spindle to reach its\n"
  3407. "speed before cutting.")
  3408. )
  3409. dwelltime = QtWidgets.QLabel('%s:' % _('Duration'))
  3410. dwelltime.setToolTip(
  3411. _("Number of time units for spindle to dwell.")
  3412. )
  3413. self.dwelltime_entry = FCDoubleSpinner()
  3414. self.dwelltime_entry.set_range(0, 99999)
  3415. self.dwelltime_entry.set_precision(self.decimals)
  3416. self.dwelltime_entry.setSingleStep(0.1)
  3417. self.dwelltime_entry.setWrapping(True)
  3418. grid1.addWidget(self.dwell_cb, 11, 0)
  3419. grid1.addWidget(dwelltime, 12, 0)
  3420. grid1.addWidget(self.dwelltime_entry, 12, 1)
  3421. self.ois_dwell = OptionalInputSection(self.dwell_cb, [self.dwelltime_entry])
  3422. # preprocessor selection
  3423. pp_label = QtWidgets.QLabel('%s:' % _("Preprocessor"))
  3424. pp_label.setToolTip(
  3425. _("The Preprocessor file that dictates\n"
  3426. "the Machine Code (like GCode, RML, HPGL) output.")
  3427. )
  3428. self.pp_geometry_name_cb = FCComboBox()
  3429. self.pp_geometry_name_cb.setFocusPolicy(Qt.StrongFocus)
  3430. grid1.addWidget(pp_label, 13, 0)
  3431. grid1.addWidget(self.pp_geometry_name_cb, 13, 1)
  3432. self.layout.addStretch()
  3433. class GeometryAdvOptPrefGroupUI(OptionsGroupUI):
  3434. def __init__(self, decimals=4, parent=None):
  3435. # OptionsGroupUI.__init__(self, "Geometry Advanced Options Preferences", parent=parent)
  3436. super(GeometryAdvOptPrefGroupUI, self).__init__(self)
  3437. self.setTitle(str(_("Geometry Adv. Options")))
  3438. self.decimals = decimals
  3439. # ------------------------------
  3440. # ## Advanced Options
  3441. # ------------------------------
  3442. self.geo_label = QtWidgets.QLabel('<b>%s:</b>' % _('Advanced Options'))
  3443. self.geo_label.setToolTip(
  3444. _("A list of Geometry advanced parameters.\n"
  3445. "Those parameters are available only for\n"
  3446. "Advanced App. Level.")
  3447. )
  3448. self.layout.addWidget(self.geo_label)
  3449. grid1 = QtWidgets.QGridLayout()
  3450. self.layout.addLayout(grid1)
  3451. # Toolchange X,Y
  3452. toolchange_xy_label = QtWidgets.QLabel('%s:' % _('Toolchange X-Y'))
  3453. toolchange_xy_label.setToolTip(
  3454. _("Toolchange X,Y position.")
  3455. )
  3456. grid1.addWidget(toolchange_xy_label, 1, 0)
  3457. self.toolchangexy_entry = FCEntry()
  3458. grid1.addWidget(self.toolchangexy_entry, 1, 1)
  3459. # Start move Z
  3460. startzlabel = QtWidgets.QLabel('%s:' % _('Start Z'))
  3461. startzlabel.setToolTip(
  3462. _("Height of the tool just after starting the work.\n"
  3463. "Delete the value if you don't need this feature.")
  3464. )
  3465. grid1.addWidget(startzlabel, 2, 0)
  3466. self.gstartz_entry = FloatEntry()
  3467. grid1.addWidget(self.gstartz_entry, 2, 1)
  3468. # Feedrate rapids
  3469. fr_rapid_label = QtWidgets.QLabel('%s:' % _('Feedrate Rapids'))
  3470. fr_rapid_label.setToolTip(
  3471. _("Cutting speed in the XY plane\n"
  3472. "(in units per minute).\n"
  3473. "This is for the rapid move G00.\n"
  3474. "It is useful only for Marlin,\n"
  3475. "ignore for any other cases.")
  3476. )
  3477. self.feedrate_rapid_entry = FCDoubleSpinner()
  3478. self.feedrate_rapid_entry.set_range(0, 99999.9999)
  3479. self.feedrate_rapid_entry.set_precision(self.decimals)
  3480. self.feedrate_rapid_entry.setSingleStep(0.1)
  3481. self.feedrate_rapid_entry.setWrapping(True)
  3482. grid1.addWidget(fr_rapid_label, 4, 0)
  3483. grid1.addWidget(self.feedrate_rapid_entry, 4, 1)
  3484. # End move extra cut
  3485. self.extracut_cb = FCCheckBox('%s' % _('Re-cut'))
  3486. self.extracut_cb.setToolTip(
  3487. _("In order to remove possible\n"
  3488. "copper leftovers where first cut\n"
  3489. "meet with last cut, we generate an\n"
  3490. "extended cut over the first cut section.")
  3491. )
  3492. self.e_cut_entry = FCDoubleSpinner()
  3493. self.e_cut_entry.set_range(0, 99999)
  3494. self.e_cut_entry.set_precision(self.decimals)
  3495. self.e_cut_entry.setSingleStep(0.1)
  3496. self.e_cut_entry.setWrapping(True)
  3497. self.e_cut_entry.setToolTip(
  3498. _("In order to remove possible\n"
  3499. "copper leftovers where first cut\n"
  3500. "meet with last cut, we generate an\n"
  3501. "extended cut over the first cut section.")
  3502. )
  3503. grid1.addWidget(self.extracut_cb, 5, 0)
  3504. grid1.addWidget(self.e_cut_entry, 5, 1)
  3505. # Probe depth
  3506. self.pdepth_label = QtWidgets.QLabel('%s:' % _("Probe Z depth"))
  3507. self.pdepth_label.setToolTip(
  3508. _("The maximum depth that the probe is allowed\n"
  3509. "to probe. Negative value, in current units.")
  3510. )
  3511. self.pdepth_entry = FCDoubleSpinner()
  3512. self.pdepth_entry.set_range(-99999, 0.0000)
  3513. self.pdepth_entry.set_precision(self.decimals)
  3514. self.pdepth_entry.setSingleStep(0.1)
  3515. self.pdepth_entry.setWrapping(True)
  3516. grid1.addWidget(self.pdepth_label, 6, 0)
  3517. grid1.addWidget(self.pdepth_entry, 6, 1)
  3518. # Probe feedrate
  3519. self.feedrate_probe_label = QtWidgets.QLabel('%s:' % _("Feedrate Probe"))
  3520. self.feedrate_probe_label.setToolTip(
  3521. _("The feedrate used while the probe is probing.")
  3522. )
  3523. self.feedrate_probe_entry = FCDoubleSpinner()
  3524. self.feedrate_probe_entry.set_range(0, 99999.9999)
  3525. self.feedrate_probe_entry.set_precision(self.decimals)
  3526. self.feedrate_probe_entry.setSingleStep(0.1)
  3527. self.feedrate_probe_entry.setWrapping(True)
  3528. grid1.addWidget(self.feedrate_probe_label, 7, 0)
  3529. grid1.addWidget(self.feedrate_probe_entry, 7, 1)
  3530. # Spindle direction
  3531. spindle_dir_label = QtWidgets.QLabel('%s:' % _('Spindle direction'))
  3532. spindle_dir_label.setToolTip(
  3533. _("This sets the direction that the spindle is rotating.\n"
  3534. "It can be either:\n"
  3535. "- CW = clockwise or\n"
  3536. "- CCW = counter clockwise")
  3537. )
  3538. self.spindledir_radio = RadioSet([{'label': _('CW'), 'value': 'CW'},
  3539. {'label': _('CCW'), 'value': 'CCW'}])
  3540. grid1.addWidget(spindle_dir_label, 8, 0)
  3541. grid1.addWidget(self.spindledir_radio, 8, 1)
  3542. # Fast Move from Z Toolchange
  3543. self.fplunge_cb = FCCheckBox('%s' % _('Fast Plunge'))
  3544. self.fplunge_cb.setToolTip(
  3545. _("By checking this, the vertical move from\n"
  3546. "Z_Toolchange to Z_move is done with G0,\n"
  3547. "meaning the fastest speed available.\n"
  3548. "WARNING: the move is done at Toolchange X,Y coords.")
  3549. )
  3550. grid1.addWidget(self.fplunge_cb, 9, 0, 1, 2)
  3551. # Size of trace segment on X axis
  3552. segx_label = QtWidgets.QLabel('%s:' % _("Segment X size"))
  3553. segx_label.setToolTip(
  3554. _("The size of the trace segment on the X axis.\n"
  3555. "Useful for auto-leveling.\n"
  3556. "A value of 0 means no segmentation on the X axis.")
  3557. )
  3558. self.segx_entry = FCDoubleSpinner()
  3559. self.segx_entry.set_range(0, 99999)
  3560. self.segx_entry.set_precision(self.decimals)
  3561. self.segx_entry.setSingleStep(0.1)
  3562. self.segx_entry.setWrapping(True)
  3563. grid1.addWidget(segx_label, 10, 0)
  3564. grid1.addWidget(self.segx_entry, 10, 1)
  3565. # Size of trace segment on Y axis
  3566. segy_label = QtWidgets.QLabel('%s:' % _("Segment Y size"))
  3567. segy_label.setToolTip(
  3568. _("The size of the trace segment on the Y axis.\n"
  3569. "Useful for auto-leveling.\n"
  3570. "A value of 0 means no segmentation on the Y axis.")
  3571. )
  3572. self.segy_entry = FCDoubleSpinner()
  3573. self.segy_entry.set_range(0, 99999)
  3574. self.segy_entry.set_precision(self.decimals)
  3575. self.segy_entry.setSingleStep(0.1)
  3576. self.segy_entry.setWrapping(True)
  3577. grid1.addWidget(segy_label, 11, 0)
  3578. grid1.addWidget(self.segy_entry, 11, 1)
  3579. self.layout.addStretch()
  3580. class GeometryEditorPrefGroupUI(OptionsGroupUI):
  3581. def __init__(self, decimals=4, parent=None):
  3582. # OptionsGroupUI.__init__(self, "Gerber Adv. Options Preferences", parent=parent)
  3583. super(GeometryEditorPrefGroupUI, self).__init__(self)
  3584. self.setTitle(str(_("Geometry Editor")))
  3585. self.decimals = decimals
  3586. # Advanced Geometry Parameters
  3587. self.param_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  3588. self.param_label.setToolTip(
  3589. _("A list of Geometry Editor parameters.")
  3590. )
  3591. self.layout.addWidget(self.param_label)
  3592. grid0 = QtWidgets.QGridLayout()
  3593. self.layout.addLayout(grid0)
  3594. # Selection Limit
  3595. self.sel_limit_label = QtWidgets.QLabel('%s:' % _("Selection limit"))
  3596. self.sel_limit_label.setToolTip(
  3597. _("Set the number of selected geometry\n"
  3598. "items above which the utility geometry\n"
  3599. "becomes just a selection rectangle.\n"
  3600. "Increases the performance when moving a\n"
  3601. "large number of geometric elements.")
  3602. )
  3603. self.sel_limit_entry = FCSpinner()
  3604. self.sel_limit_entry.set_range(0, 9999)
  3605. grid0.addWidget(self.sel_limit_label, 0, 0)
  3606. grid0.addWidget(self.sel_limit_entry, 0, 1)
  3607. # Milling Type
  3608. milling_type_label = QtWidgets.QLabel('%s:' % _('Milling Type'))
  3609. milling_type_label.setToolTip(
  3610. _("Milling type:\n"
  3611. "- climb / best for precision milling and to reduce tool usage\n"
  3612. "- conventional / useful when there is no backlash compensation")
  3613. )
  3614. self.milling_type_radio = RadioSet([{'label': _('Climb'), 'value': 'cl'},
  3615. {'label': _('Conventional'), 'value': 'cv'}])
  3616. grid0.addWidget(milling_type_label, 1, 0)
  3617. grid0.addWidget(self.milling_type_radio, 1, 1)
  3618. self.layout.addStretch()
  3619. class CNCJobGenPrefGroupUI(OptionsGroupUI):
  3620. def __init__(self, decimals=4, parent=None):
  3621. # OptionsGroupUI.__init__(self, "CNC Job General Preferences", parent=None)
  3622. super(CNCJobGenPrefGroupUI, self).__init__(self)
  3623. self.setTitle(str(_("CNC Job General")))
  3624. self.decimals = decimals
  3625. # ## Plot options
  3626. self.plot_options_label = QtWidgets.QLabel("<b>%s:</b>" % _("Plot Options"))
  3627. self.layout.addWidget(self.plot_options_label)
  3628. grid0 = QtWidgets.QGridLayout()
  3629. self.layout.addLayout(grid0)
  3630. grid0.setColumnStretch(0, 0)
  3631. grid0.setColumnStretch(1, 1)
  3632. # Plot CB
  3633. # self.plot_cb = QtWidgets.QCheckBox('Plot')
  3634. self.plot_cb = FCCheckBox(_('Plot Object'))
  3635. self.plot_cb.setToolTip(_("Plot (show) this object."))
  3636. grid0.addWidget(self.plot_cb, 0, 0, 1, 2)
  3637. # Plot Kind
  3638. self.cncplot_method_label = QtWidgets.QLabel('%s:' % _("Plot kind"))
  3639. self.cncplot_method_label.setToolTip(
  3640. _("This selects the kind of geometries on the canvas to plot.\n"
  3641. "Those can be either of type 'Travel' which means the moves\n"
  3642. "above the work piece or it can be of type 'Cut',\n"
  3643. "which means the moves that cut into the material.")
  3644. )
  3645. self.cncplot_method_radio = RadioSet([
  3646. {"label": _("All"), "value": "all"},
  3647. {"label": _("Travel"), "value": "travel"},
  3648. {"label": _("Cut"), "value": "cut"}
  3649. ], orientation='vertical')
  3650. grid0.addWidget(self.cncplot_method_label, 1, 0)
  3651. grid0.addWidget(self.cncplot_method_radio, 1, 1)
  3652. grid0.addWidget(QtWidgets.QLabel(''), 1, 2)
  3653. # Display Annotation
  3654. self.annotation_cb = FCCheckBox(_("Display Annotation"))
  3655. self.annotation_cb.setToolTip(
  3656. _("This selects if to display text annotation on the plot.\n"
  3657. "When checked it will display numbers in order for each end\n"
  3658. "of a travel line."
  3659. )
  3660. )
  3661. grid0.addWidget(self.annotation_cb, 2, 0, 1, 3)
  3662. # ###################################################################
  3663. # Number of circle steps for circular aperture linear approximation #
  3664. # ###################################################################
  3665. self.steps_per_circle_label = QtWidgets.QLabel('%s:' % _("Circle Steps"))
  3666. self.steps_per_circle_label.setToolTip(
  3667. _("The number of circle steps for <b>GCode</b> \n"
  3668. "circle and arc shapes linear approximation.")
  3669. )
  3670. grid0.addWidget(self.steps_per_circle_label, 3, 0)
  3671. self.steps_per_circle_entry = FCSpinner()
  3672. self.steps_per_circle_entry.set_range(0, 99999)
  3673. grid0.addWidget(self.steps_per_circle_entry, 3, 1)
  3674. # Tool dia for plot
  3675. tdlabel = QtWidgets.QLabel('%s:' % _('Travel dia'))
  3676. tdlabel.setToolTip(
  3677. _("The width of the travel lines to be\n"
  3678. "rendered in the plot.")
  3679. )
  3680. self.tooldia_entry = FCDoubleSpinner()
  3681. self.tooldia_entry.set_range(0, 99999)
  3682. self.tooldia_entry.set_precision(self.decimals)
  3683. self.tooldia_entry.setSingleStep(0.1)
  3684. self.tooldia_entry.setWrapping(True)
  3685. grid0.addWidget(tdlabel, 4, 0)
  3686. grid0.addWidget(self.tooldia_entry, 4, 1)
  3687. # add a space
  3688. grid0.addWidget(QtWidgets.QLabel('<b>%s:</b>' % _("G-code Decimals")), 5, 0, 1, 2)
  3689. # Number of decimals to use in GCODE coordinates
  3690. cdeclabel = QtWidgets.QLabel('%s:' % _('Coordinates'))
  3691. cdeclabel.setToolTip(
  3692. _("The number of decimals to be used for \n"
  3693. "the X, Y, Z coordinates in CNC code (GCODE, etc.)")
  3694. )
  3695. self.coords_dec_entry = FCSpinner()
  3696. self.coords_dec_entry.set_range(0, 9)
  3697. self.coords_dec_entry.setWrapping(True)
  3698. grid0.addWidget(cdeclabel, 6, 0)
  3699. grid0.addWidget(self.coords_dec_entry, 6, 1)
  3700. # Number of decimals to use in GCODE feedrate
  3701. frdeclabel = QtWidgets.QLabel('%s:' % _('Feedrate'))
  3702. frdeclabel.setToolTip(
  3703. _("The number of decimals to be used for \n"
  3704. "the Feedrate parameter in CNC code (GCODE, etc.)")
  3705. )
  3706. self.fr_dec_entry = FCSpinner()
  3707. self.fr_dec_entry.set_range(0, 9)
  3708. self.fr_dec_entry.setWrapping(True)
  3709. grid0.addWidget(frdeclabel, 7, 0)
  3710. grid0.addWidget(self.fr_dec_entry, 7, 1)
  3711. # The type of coordinates used in the Gcode: Absolute or Incremental
  3712. coords_type_label = QtWidgets.QLabel('%s:' % _('Coordinates type'))
  3713. coords_type_label.setToolTip(
  3714. _("The type of coordinates to be used in Gcode.\n"
  3715. "Can be:\n"
  3716. "- Absolute G90 -> the reference is the origin x=0, y=0\n"
  3717. "- Incremental G91 -> the reference is the previous position")
  3718. )
  3719. self.coords_type_radio = RadioSet([
  3720. {"label": _("Absolute G90"), "value": "G90"},
  3721. {"label": _("Incremental G91"), "value": "G91"}
  3722. ], orientation='vertical', stretch=False)
  3723. grid0.addWidget(coords_type_label, 8, 0)
  3724. grid0.addWidget(self.coords_type_radio, 8, 1)
  3725. # hidden for the time being, until implemented
  3726. coords_type_label.hide()
  3727. self.coords_type_radio.hide()
  3728. # Line Endings
  3729. self.line_ending_cb = FCCheckBox(_("Force Windows style line-ending"))
  3730. self.line_ending_cb.setToolTip(
  3731. _("When checked will force a Windows style line-ending\n"
  3732. "(\\r\\n) on non-Windows OS's.")
  3733. )
  3734. grid0.addWidget(self.line_ending_cb, 9, 0, 1, 3)
  3735. separator_line = QtWidgets.QFrame()
  3736. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  3737. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  3738. grid0.addWidget(separator_line, 12, 0, 1, 2)
  3739. # Travel Line Color
  3740. self.travel_color_label = QtWidgets.QLabel('<b>%s</b>' % _('Travel Line Color'))
  3741. grid0.addWidget(self.travel_color_label, 13, 0, 1, 2)
  3742. # Plot Line Color
  3743. self.tline_color_label = QtWidgets.QLabel('%s:' % _('Outline'))
  3744. self.tline_color_label.setToolTip(
  3745. _("Set the travel line color for plotted objects.")
  3746. )
  3747. self.tline_color_entry = FCEntry()
  3748. self.tline_color_button = QtWidgets.QPushButton()
  3749. self.tline_color_button.setFixedSize(15, 15)
  3750. self.form_box_child_2 = QtWidgets.QHBoxLayout()
  3751. self.form_box_child_2.addWidget(self.tline_color_entry)
  3752. self.form_box_child_2.addWidget(self.tline_color_button)
  3753. self.form_box_child_2.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  3754. grid0.addWidget(self.tline_color_label, 14, 0)
  3755. grid0.addLayout(self.form_box_child_2, 14, 1)
  3756. # Plot Fill Color
  3757. self.tfill_color_label = QtWidgets.QLabel('%s:' % _('Fill'))
  3758. self.tfill_color_label.setToolTip(
  3759. _("Set the fill color for plotted objects.\n"
  3760. "First 6 digits are the color and the last 2\n"
  3761. "digits are for alpha (transparency) level.")
  3762. )
  3763. self.tfill_color_entry = FCEntry()
  3764. self.tfill_color_button = QtWidgets.QPushButton()
  3765. self.tfill_color_button.setFixedSize(15, 15)
  3766. self.form_box_child_1 = QtWidgets.QHBoxLayout()
  3767. self.form_box_child_1.addWidget(self.tfill_color_entry)
  3768. self.form_box_child_1.addWidget(self.tfill_color_button)
  3769. self.form_box_child_1.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  3770. grid0.addWidget(self.tfill_color_label, 15, 0)
  3771. grid0.addLayout(self.form_box_child_1, 15, 1)
  3772. # Plot Fill Transparency Level
  3773. self.alpha_label = QtWidgets.QLabel('%s:' % _('Alpha'))
  3774. self.alpha_label.setToolTip(
  3775. _("Set the fill transparency for plotted objects.")
  3776. )
  3777. self.tcolor_alpha_slider = QtWidgets.QSlider(QtCore.Qt.Horizontal)
  3778. self.tcolor_alpha_slider.setMinimum(0)
  3779. self.tcolor_alpha_slider.setMaximum(255)
  3780. self.tcolor_alpha_slider.setSingleStep(1)
  3781. self.tcolor_alpha_spinner = FCSpinner()
  3782. self.tcolor_alpha_spinner.setMinimumWidth(70)
  3783. self.tcolor_alpha_spinner.set_range(0, 255)
  3784. self.form_box_child_3 = QtWidgets.QHBoxLayout()
  3785. self.form_box_child_3.addWidget(self.tcolor_alpha_slider)
  3786. self.form_box_child_3.addWidget(self.tcolor_alpha_spinner)
  3787. grid0.addWidget(self.alpha_label, 16, 0)
  3788. grid0.addLayout(self.form_box_child_3, 16, 1)
  3789. separator_line = QtWidgets.QFrame()
  3790. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  3791. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  3792. grid0.addWidget(separator_line, 17, 0, 1, 2)
  3793. # CNCJob Object Color
  3794. self.cnc_color_label = QtWidgets.QLabel('<b>%s</b>' % _('CNCJob Object Color'))
  3795. grid0.addWidget(self.cnc_color_label, 18, 0, 1, 2)
  3796. # Plot Line Color
  3797. self.line_color_label = QtWidgets.QLabel('%s:' % _('Outline'))
  3798. self.line_color_label.setToolTip(
  3799. _("Set the color for plotted objects.")
  3800. )
  3801. self.line_color_entry = FCEntry()
  3802. self.line_color_button = QtWidgets.QPushButton()
  3803. self.line_color_button.setFixedSize(15, 15)
  3804. self.form_box_child_2 = QtWidgets.QHBoxLayout()
  3805. self.form_box_child_2.addWidget(self.line_color_entry)
  3806. self.form_box_child_2.addWidget(self.line_color_button)
  3807. self.form_box_child_2.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  3808. grid0.addWidget(self.line_color_label, 19, 0)
  3809. grid0.addLayout(self.form_box_child_2, 19, 1)
  3810. # Plot Fill Color
  3811. self.fill_color_label = QtWidgets.QLabel('%s:' % _('Fill'))
  3812. self.fill_color_label.setToolTip(
  3813. _("Set the fill color for plotted objects.\n"
  3814. "First 6 digits are the color and the last 2\n"
  3815. "digits are for alpha (transparency) level.")
  3816. )
  3817. self.fill_color_entry = FCEntry()
  3818. self.fill_color_button = QtWidgets.QPushButton()
  3819. self.fill_color_button.setFixedSize(15, 15)
  3820. self.form_box_child_1 = QtWidgets.QHBoxLayout()
  3821. self.form_box_child_1.addWidget(self.fill_color_entry)
  3822. self.form_box_child_1.addWidget(self.fill_color_button)
  3823. self.form_box_child_1.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  3824. grid0.addWidget(self.fill_color_label, 20, 0)
  3825. grid0.addLayout(self.form_box_child_1, 20, 1)
  3826. self.layout.addStretch()
  3827. # Setting plot colors signals
  3828. self.tline_color_entry.editingFinished.connect(self.on_tline_color_entry)
  3829. self.tline_color_button.clicked.connect(self.on_tline_color_button)
  3830. self.tfill_color_entry.editingFinished.connect(self.on_tfill_color_entry)
  3831. self.tfill_color_button.clicked.connect(self.on_tfill_color_button)
  3832. self.tcolor_alpha_spinner.valueChanged.connect(self.on_tcolor_spinner)
  3833. self.tcolor_alpha_slider.valueChanged.connect(self.on_tcolor_slider)
  3834. self.line_color_entry.editingFinished.connect(self.on_line_color_entry)
  3835. self.line_color_button.clicked.connect(self.on_line_color_button)
  3836. self.fill_color_entry.editingFinished.connect(self.on_fill_color_entry)
  3837. self.fill_color_button.clicked.connect(self.on_fill_color_button)
  3838. # ------------------------------------------------------
  3839. # Setting travel colors handlers
  3840. # ------------------------------------------------------
  3841. def on_tfill_color_entry(self):
  3842. self.app.defaults['cncjob_travel_fill'] = self.tfill_color_entry.get_value()[:7] + \
  3843. self.app.defaults['cncjob_travel_fill'][7:9]
  3844. self.tfill_color_button.setStyleSheet(
  3845. "background-color:%s" % str(self.app.defaults['cncjob_travel_fill'])[:7])
  3846. def on_tfill_color_button(self):
  3847. current_color = QtGui.QColor(self.app.defaults['cncjob_travel_fill'][:7])
  3848. c_dialog = QtWidgets.QColorDialog()
  3849. plot_fill_color = c_dialog.getColor(initial=current_color)
  3850. if plot_fill_color.isValid() is False:
  3851. return
  3852. self.tfill_color_button.setStyleSheet("background-color:%s" % str(plot_fill_color.name()))
  3853. new_val = str(plot_fill_color.name()) + str(self.app.defaults['cncjob_travel_fill'][7:9])
  3854. self.tfill_color_entry.set_value(new_val)
  3855. self.app.defaults['cncjob_travel_fill'] = new_val
  3856. def on_tcolor_spinner(self):
  3857. spinner_value = self.tcolor_alpha_spinner.value()
  3858. self.tcolor_alpha_slider.setValue(spinner_value)
  3859. self.app.defaults['cncjob_travel_fill'] = \
  3860. self.app.defaults['cncjob_travel_fill'][:7] + \
  3861. (hex(spinner_value)[2:] if int(hex(spinner_value)[2:], 16) > 0 else '00')
  3862. self.app.defaults['cncjob_travel_line'] = \
  3863. self.app.defaults['cncjob_travel_line'][:7] + \
  3864. (hex(spinner_value)[2:] if int(hex(spinner_value)[2:], 16) > 0 else '00')
  3865. def on_tcolor_slider(self):
  3866. slider_value = self.tcolor_alpha_slider.value()
  3867. self.tcolor_alpha_spinner.setValue(slider_value)
  3868. def on_tline_color_entry(self):
  3869. self.app.defaults['cncjob_travel_line'] = self.tline_color_entry.get_value()[:7] + \
  3870. self.app.defaults['cncjob_travel_line'][7:9]
  3871. self.tline_color_button.setStyleSheet(
  3872. "background-color:%s" % str(self.app.defaults['cncjob_travel_line'])[:7])
  3873. def on_tline_color_button(self):
  3874. current_color = QtGui.QColor(self.app.defaults['cncjob_travel_line'][:7])
  3875. # print(current_color)
  3876. c_dialog = QtWidgets.QColorDialog()
  3877. plot_line_color = c_dialog.getColor(initial=current_color)
  3878. if plot_line_color.isValid() is False:
  3879. return
  3880. self.tline_color_button.setStyleSheet("background-color:%s" % str(plot_line_color.name()))
  3881. new_val_line = str(plot_line_color.name()) + str(self.app.defaults['cncjob_travel_line'][7:9])
  3882. self.tline_color_entry.set_value(new_val_line)
  3883. self.app.defaults['cncjob_travel_line'] = new_val_line
  3884. # ------------------------------------------------------
  3885. # Setting plot colors handlers
  3886. # ------------------------------------------------------
  3887. def on_fill_color_entry(self):
  3888. self.app.defaults['cncjob_plot_fill'] = self.fill_color_entry.get_value()[:7] + \
  3889. self.app.defaults['cncjob_plot_fill'][7:9]
  3890. self.fill_color_button.setStyleSheet(
  3891. "background-color:%s" % str(self.app.defaults['cncjob_plot_fill'])[:7])
  3892. def on_fill_color_button(self):
  3893. current_color = QtGui.QColor(self.app.defaults['cncjob_plot_fill'][:7])
  3894. c_dialog = QtWidgets.QColorDialog()
  3895. plot_fill_color = c_dialog.getColor(initial=current_color)
  3896. if plot_fill_color.isValid() is False:
  3897. return
  3898. self.fill_color_button.setStyleSheet("background-color:%s" % str(plot_fill_color.name()))
  3899. new_val = str(plot_fill_color.name()) + str(self.app.defaults['cncjob_plot_fill'][7:9])
  3900. self.fill_color_entry.set_value(new_val)
  3901. self.app.defaults['cncjob_plot_fill'] = new_val
  3902. def on_line_color_entry(self):
  3903. self.app.defaults['cncjob_plot_line'] = self.line_color_entry.get_value()[:7] + \
  3904. self.app.defaults['cncjob_plot_line'][7:9]
  3905. self.line_color_button.setStyleSheet(
  3906. "background-color:%s" % str(self.app.defaults['cncjob_plot_line'])[:7])
  3907. def on_line_color_button(self):
  3908. current_color = QtGui.QColor(self.app.defaults['cncjob_plot_line'][:7])
  3909. # print(current_color)
  3910. c_dialog = QtWidgets.QColorDialog()
  3911. plot_line_color = c_dialog.getColor(initial=current_color)
  3912. if plot_line_color.isValid() is False:
  3913. return
  3914. self.line_color_button.setStyleSheet("background-color:%s" % str(plot_line_color.name()))
  3915. new_val_line = str(plot_line_color.name()) + str(self.app.defaults['cncjob_plot_line'][7:9])
  3916. self.line_color_entry.set_value(new_val_line)
  3917. self.app.defaults['cncjob_plot_line'] = new_val_line
  3918. class CNCJobOptPrefGroupUI(OptionsGroupUI):
  3919. def __init__(self, decimals=4, parent=None):
  3920. # OptionsGroupUI.__init__(self, "CNC Job Options Preferences", parent=None)
  3921. super(CNCJobOptPrefGroupUI, self).__init__(self)
  3922. self.setTitle(str(_("CNC Job Options")))
  3923. self.decimals = decimals
  3924. # ## Export G-Code
  3925. self.export_gcode_label = QtWidgets.QLabel("<b>%s:</b>" % _("Export G-Code"))
  3926. self.export_gcode_label.setToolTip(
  3927. _("Export and save G-Code to\n"
  3928. "make this object to a file.")
  3929. )
  3930. self.layout.addWidget(self.export_gcode_label)
  3931. settings = QSettings("Open Source", "FlatCAM")
  3932. if settings.contains("textbox_font_size"):
  3933. tb_fsize = settings.value('textbox_font_size', type=int)
  3934. else:
  3935. tb_fsize = 10
  3936. font = QtGui.QFont()
  3937. font.setPointSize(tb_fsize)
  3938. # Prepend to G-Code
  3939. prependlabel = QtWidgets.QLabel('%s:' % _('Prepend to G-Code'))
  3940. prependlabel.setToolTip(
  3941. _("Type here any G-Code commands you would\n"
  3942. "like to add at the beginning of the G-Code file.")
  3943. )
  3944. self.layout.addWidget(prependlabel)
  3945. self.prepend_text = FCTextArea()
  3946. self.prepend_text.setPlaceholderText(
  3947. _("Type here any G-Code commands you would "
  3948. "like to add at the beginning of the G-Code file.")
  3949. )
  3950. self.layout.addWidget(self.prepend_text)
  3951. self.prepend_text.setFont(font)
  3952. # Append text to G-Code
  3953. appendlabel = QtWidgets.QLabel('%s:' % _('Append to G-Code'))
  3954. appendlabel.setToolTip(
  3955. _("Type here any G-Code commands you would\n"
  3956. "like to append to the generated file.\n"
  3957. "I.e.: M2 (End of program)")
  3958. )
  3959. self.layout.addWidget(appendlabel)
  3960. self.append_text = FCTextArea()
  3961. self.append_text.setPlaceholderText(
  3962. _("Type here any G-Code commands you would "
  3963. "like to append to the generated file.\n"
  3964. "I.e.: M2 (End of program)")
  3965. )
  3966. self.layout.addWidget(self.append_text)
  3967. self.append_text.setFont(font)
  3968. self.layout.addStretch()
  3969. class CNCJobAdvOptPrefGroupUI(OptionsGroupUI):
  3970. def __init__(self, decimals=4, parent=None):
  3971. # OptionsGroupUI.__init__(self, "CNC Job Advanced Options Preferences", parent=None)
  3972. super(CNCJobAdvOptPrefGroupUI, self).__init__(self)
  3973. self.decimals = decimals
  3974. self.setTitle(str(_("CNC Job Adv. Options")))
  3975. # ## Export G-Code
  3976. self.export_gcode_label = QtWidgets.QLabel("<b>%s:</b>" % _("Export CNC Code"))
  3977. self.export_gcode_label.setToolTip(
  3978. _("Export and save G-Code to\n"
  3979. "make this object to a file.")
  3980. )
  3981. self.layout.addWidget(self.export_gcode_label)
  3982. # Prepend to G-Code
  3983. toolchangelabel = QtWidgets.QLabel('%s' % _('Toolchange G-Code'))
  3984. toolchangelabel.setToolTip(
  3985. _(
  3986. "Type here any G-Code commands you would\n"
  3987. "like to be executed when Toolchange event is encountered.\n"
  3988. "This will constitute a Custom Toolchange GCode,\n"
  3989. "or a Toolchange Macro.\n"
  3990. "The FlatCAM variables are surrounded by '%' symbol.\n\n"
  3991. "WARNING: it can be used only with a preprocessor file\n"
  3992. "that has 'toolchange_custom' in it's name and this is built\n"
  3993. "having as template the 'Toolchange Custom' posprocessor file."
  3994. )
  3995. )
  3996. self.layout.addWidget(toolchangelabel)
  3997. settings = QSettings("Open Source", "FlatCAM")
  3998. if settings.contains("textbox_font_size"):
  3999. tb_fsize = settings.value('textbox_font_size', type=int)
  4000. else:
  4001. tb_fsize = 10
  4002. font = QtGui.QFont()
  4003. font.setPointSize(tb_fsize)
  4004. self.toolchange_text = FCTextArea()
  4005. self.toolchange_text.setPlaceholderText(
  4006. _(
  4007. "Type here any G-Code commands you would "
  4008. "like to be executed when Toolchange event is encountered.\n"
  4009. "This will constitute a Custom Toolchange GCode, "
  4010. "or a Toolchange Macro.\n"
  4011. "The FlatCAM variables are surrounded by '%' symbol.\n"
  4012. "WARNING: it can be used only with a preprocessor file "
  4013. "that has 'toolchange_custom' in it's name."
  4014. )
  4015. )
  4016. self.layout.addWidget(self.toolchange_text)
  4017. self.toolchange_text.setFont(font)
  4018. hlay = QtWidgets.QHBoxLayout()
  4019. self.layout.addLayout(hlay)
  4020. # Toolchange Replacement GCode
  4021. self.toolchange_cb = FCCheckBox(label='%s' % _('Use Toolchange Macro'))
  4022. self.toolchange_cb.setToolTip(
  4023. _("Check this box if you want to use\n"
  4024. "a Custom Toolchange GCode (macro).")
  4025. )
  4026. hlay.addWidget(self.toolchange_cb)
  4027. hlay.addStretch()
  4028. hlay1 = QtWidgets.QHBoxLayout()
  4029. self.layout.addLayout(hlay1)
  4030. # Variable list
  4031. self.tc_variable_combo = FCComboBox()
  4032. self.tc_variable_combo.setToolTip(
  4033. _("A list of the FlatCAM variables that can be used\n"
  4034. "in the Toolchange event.\n"
  4035. "They have to be surrounded by the '%' symbol")
  4036. )
  4037. hlay1.addWidget(self.tc_variable_combo)
  4038. # Populate the Combo Box
  4039. variables = [_('Parameters'), 'tool', 'tooldia', 't_drills', 'x_toolchange', 'y_toolchange', 'z_toolchange',
  4040. 'z_cut', 'z_move', 'z_depthpercut', 'spindlespeed', 'dwelltime']
  4041. self.tc_variable_combo.addItems(variables)
  4042. self.tc_variable_combo.insertSeparator(1)
  4043. self.tc_variable_combo.setItemData(0, _("FlatCAM CNC parameters"), Qt.ToolTipRole)
  4044. fnt = QtGui.QFont()
  4045. fnt.setBold(True)
  4046. self.tc_variable_combo.setItemData(0, fnt, Qt.FontRole)
  4047. self.tc_variable_combo.setItemData(2, 'tool = %s' % _("tool number"), Qt.ToolTipRole)
  4048. self.tc_variable_combo.setItemData(3, 'tooldia = %s' % _("tool diameter"), Qt.ToolTipRole)
  4049. self.tc_variable_combo.setItemData(4, 't_drills = %s' % _("for Excellon, total number of drills"),
  4050. Qt.ToolTipRole)
  4051. self.tc_variable_combo.setItemData(5, 'x_toolchange = %s' % _("X coord for Toolchange"), Qt.ToolTipRole)
  4052. self.tc_variable_combo.setItemData(6, 'y_toolchange = %s' % _("Y coord for Toolchange"),
  4053. Qt.ToolTipRole)
  4054. self.tc_variable_combo.setItemData(7, 'z_toolchange = %s' % _("Z coord for Toolchange"), Qt.ToolTipRole)
  4055. self.tc_variable_combo.setItemData(8, 'z_cut = %s' % _("Z depth for the cut"), Qt.ToolTipRole)
  4056. self.tc_variable_combo.setItemData(9, 'z_move = %s' % _("Z height for travel"), Qt.ToolTipRole)
  4057. self.tc_variable_combo.setItemData(10, 'z_depthpercut = %s' % _("the step value for multidepth cut"),
  4058. Qt.ToolTipRole)
  4059. self.tc_variable_combo.setItemData(11, 'spindlesspeed = %s' % _("the value for the spindle speed"),
  4060. Qt.ToolTipRole)
  4061. self.tc_variable_combo.setItemData(12,
  4062. _("dwelltime = time to dwell to allow the spindle to reach it's set RPM"),
  4063. Qt.ToolTipRole)
  4064. # hlay1.addStretch()
  4065. # Insert Variable into the Toolchange G-Code Text Box
  4066. # self.tc_insert_buton = FCButton("Insert")
  4067. # self.tc_insert_buton.setToolTip(
  4068. # "Insert the variable in the GCode Box\n"
  4069. # "surrounded by the '%' symbol."
  4070. # )
  4071. # hlay1.addWidget(self.tc_insert_buton)
  4072. grid0 = QtWidgets.QGridLayout()
  4073. self.layout.addLayout(grid0)
  4074. grid0.addWidget(QtWidgets.QLabel(''), 1, 0, 1, 2)
  4075. # Annotation Font Size
  4076. self.annotation_fontsize_label = QtWidgets.QLabel('%s:' % _("Annotation Size"))
  4077. self.annotation_fontsize_label.setToolTip(
  4078. _("The font size of the annotation text. In pixels.")
  4079. )
  4080. grid0.addWidget(self.annotation_fontsize_label, 2, 0)
  4081. self.annotation_fontsize_sp = FCSpinner()
  4082. self.annotation_fontsize_sp.set_range(0, 9999)
  4083. grid0.addWidget(self.annotation_fontsize_sp, 2, 1)
  4084. grid0.addWidget(QtWidgets.QLabel(''), 2, 2)
  4085. # Annotation Font Color
  4086. self.annotation_color_label = QtWidgets.QLabel('%s:' % _('Annotation Color'))
  4087. self.annotation_color_label.setToolTip(
  4088. _("Set the font color for the annotation texts.")
  4089. )
  4090. self.annotation_fontcolor_entry = FCEntry()
  4091. self.annotation_fontcolor_button = QtWidgets.QPushButton()
  4092. self.annotation_fontcolor_button.setFixedSize(15, 15)
  4093. self.form_box_child = QtWidgets.QHBoxLayout()
  4094. self.form_box_child.setContentsMargins(0, 0, 0, 0)
  4095. self.form_box_child.addWidget(self.annotation_fontcolor_entry)
  4096. self.form_box_child.addWidget(self.annotation_fontcolor_button, alignment=Qt.AlignRight)
  4097. self.form_box_child.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  4098. color_widget = QtWidgets.QWidget()
  4099. color_widget.setLayout(self.form_box_child)
  4100. grid0.addWidget(self.annotation_color_label, 3, 0)
  4101. grid0.addWidget(color_widget, 3, 1)
  4102. grid0.addWidget(QtWidgets.QLabel(''), 3, 2)
  4103. self.layout.addStretch()
  4104. self.tc_variable_combo.currentIndexChanged[str].connect(self.on_cnc_custom_parameters)
  4105. self.annotation_fontcolor_entry.editingFinished.connect(self.on_annotation_fontcolor_entry)
  4106. self.annotation_fontcolor_button.clicked.connect(self.on_annotation_fontcolor_button)
  4107. def on_cnc_custom_parameters(self, signal_text):
  4108. if signal_text == 'Parameters':
  4109. return
  4110. else:
  4111. self.toolchange_text.insertPlainText('%%%s%%' % signal_text)
  4112. def on_annotation_fontcolor_entry(self):
  4113. self.app.defaults['cncjob_annotation_fontcolor'] = self.annotation_fontcolor_entry.get_value()
  4114. self.annotation_fontcolor_button.setStyleSheet(
  4115. "background-color:%s" % str(self.app.defaults['cncjob_annotation_fontcolor']))
  4116. def on_annotation_fontcolor_button(self):
  4117. current_color = QtGui.QColor(self.app.defaults['cncjob_annotation_fontcolor'])
  4118. c_dialog = QtWidgets.QColorDialog()
  4119. annotation_color = c_dialog.getColor(initial=current_color)
  4120. if annotation_color.isValid() is False:
  4121. return
  4122. self.annotation_fontcolor_button.setStyleSheet("background-color:%s" % str(annotation_color.name()))
  4123. new_val_sel = str(annotation_color.name())
  4124. self.annotation_fontcolor_entry.set_value(new_val_sel)
  4125. self.app.defaults['cncjob_annotation_fontcolor'] = new_val_sel
  4126. class ToolsNCCPrefGroupUI(OptionsGroupUI):
  4127. def __init__(self, decimals=4, parent=None):
  4128. # OptionsGroupUI.__init__(self, "NCC Tool Options", parent=parent)
  4129. super(ToolsNCCPrefGroupUI, self).__init__(self)
  4130. self.setTitle(str(_("NCC Tool Options")))
  4131. self.decimals = decimals
  4132. # ## Clear non-copper regions
  4133. self.clearcopper_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  4134. self.clearcopper_label.setToolTip(
  4135. _("Create a Geometry object with\n"
  4136. "toolpaths to cut all non-copper regions.")
  4137. )
  4138. self.layout.addWidget(self.clearcopper_label)
  4139. grid0 = QtWidgets.QGridLayout()
  4140. self.layout.addLayout(grid0)
  4141. ncctdlabel = QtWidgets.QLabel('<b><font color="green">%s:</font></b>' % _('Tools Dia'))
  4142. ncctdlabel.setToolTip(
  4143. _("Diameters of the tools, separated by comma.\n"
  4144. "The value of the diameter has to use the dot decimals separator.\n"
  4145. "Valid values: 0.3, 1.0")
  4146. )
  4147. grid0.addWidget(ncctdlabel, 0, 0)
  4148. self.ncc_tool_dia_entry = FCEntry(border_color='#0069A9')
  4149. self.ncc_tool_dia_entry.setPlaceholderText(_("Comma separated values"))
  4150. grid0.addWidget(self.ncc_tool_dia_entry, 0, 1)
  4151. # Tool Type Radio Button
  4152. self.tool_type_label = QtWidgets.QLabel('%s:' % _('Tool Type'))
  4153. self.tool_type_label.setToolTip(
  4154. _("Default tool type:\n"
  4155. "- 'V-shape'\n"
  4156. "- Circular")
  4157. )
  4158. self.tool_type_radio = RadioSet([{'label': _('V-shape'), 'value': 'V'},
  4159. {'label': _('Circular'), 'value': 'C1'}])
  4160. self.tool_type_radio.setToolTip(
  4161. _("Default tool type:\n"
  4162. "- 'V-shape'\n"
  4163. "- Circular")
  4164. )
  4165. grid0.addWidget(self.tool_type_label, 1, 0)
  4166. grid0.addWidget(self.tool_type_radio, 1, 1)
  4167. # Tip Dia
  4168. self.tipdialabel = QtWidgets.QLabel('%s:' % _('V-Tip Dia'))
  4169. self.tipdialabel.setToolTip(
  4170. _("The tip diameter for V-Shape Tool"))
  4171. self.tipdia_entry = FCDoubleSpinner()
  4172. self.tipdia_entry.set_precision(self.decimals)
  4173. self.tipdia_entry.set_range(0, 1000)
  4174. self.tipdia_entry.setSingleStep(0.1)
  4175. grid0.addWidget(self.tipdialabel, 2, 0)
  4176. grid0.addWidget(self.tipdia_entry, 2, 1)
  4177. # Tip Angle
  4178. self.tipanglelabel = QtWidgets.QLabel('%s:' % _('V-Tip Angle'))
  4179. self.tipanglelabel.setToolTip(
  4180. _("The tip angle for V-Shape Tool.\n"
  4181. "In degree."))
  4182. self.tipangle_entry = FCDoubleSpinner()
  4183. self.tipangle_entry.set_precision(self.decimals)
  4184. self.tipangle_entry.set_range(1, 180)
  4185. self.tipangle_entry.setSingleStep(5)
  4186. self.tipangle_entry.setWrapping(True)
  4187. grid0.addWidget(self.tipanglelabel, 3, 0)
  4188. grid0.addWidget(self.tipangle_entry, 3, 1)
  4189. # Cut Z entry
  4190. cutzlabel = QtWidgets.QLabel('%s:' % _('Cut Z'))
  4191. cutzlabel.setToolTip(
  4192. _("Depth of cut into material. Negative value.\n"
  4193. "In FlatCAM units.")
  4194. )
  4195. self.cutz_entry = FCDoubleSpinner()
  4196. self.cutz_entry.set_precision(self.decimals)
  4197. self.cutz_entry.set_range(-9999.9999, 0.0000)
  4198. self.cutz_entry.setSingleStep(0.1)
  4199. self.cutz_entry.setToolTip(
  4200. _("Depth of cut into material. Negative value.\n"
  4201. "In FlatCAM units.")
  4202. )
  4203. grid0.addWidget(cutzlabel, 4, 0)
  4204. grid0.addWidget(self.cutz_entry, 4, 1)
  4205. # New Diameter
  4206. self.newdialabel = QtWidgets.QLabel('%s:' % _('New Dia'))
  4207. self.newdialabel.setToolTip(
  4208. _("Diameter for the new tool to add in the Tool Table.\n"
  4209. "If the tool is V-shape type then this value is automatically\n"
  4210. "calculated from the other parameters.")
  4211. )
  4212. self.newdia_entry = FCDoubleSpinner()
  4213. self.newdia_entry.set_precision(self.decimals)
  4214. self.newdia_entry.set_range(0.0001, 9999.9999)
  4215. self.newdia_entry.setSingleStep(0.1)
  4216. grid0.addWidget(self.newdialabel, 5, 0)
  4217. grid0.addWidget(self.newdia_entry, 5, 1)
  4218. separator_line = QtWidgets.QFrame()
  4219. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  4220. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  4221. grid0.addWidget(separator_line, 6, 0, 1, 2)
  4222. # Milling Type Radio Button
  4223. self.milling_type_label = QtWidgets.QLabel('%s:' % _('Milling Type'))
  4224. self.milling_type_label.setToolTip(
  4225. _("Milling type when the selected tool is of type: 'iso_op':\n"
  4226. "- climb / best for precision milling and to reduce tool usage\n"
  4227. "- conventional / useful when there is no backlash compensation")
  4228. )
  4229. self.milling_type_radio = RadioSet([{'label': _('Climb'), 'value': 'cl'},
  4230. {'label': _('Conventional'), 'value': 'cv'}])
  4231. self.milling_type_radio.setToolTip(
  4232. _("Milling type when the selected tool is of type: 'iso_op':\n"
  4233. "- climb / best for precision milling and to reduce tool usage\n"
  4234. "- conventional / useful when there is no backlash compensation")
  4235. )
  4236. grid0.addWidget(self.milling_type_label, 7, 0)
  4237. grid0.addWidget(self.milling_type_radio, 7, 1)
  4238. # Tool order Radio Button
  4239. self.ncc_order_label = QtWidgets.QLabel('%s:' % _('Tool order'))
  4240. self.ncc_order_label.setToolTip(_("This set the way that the tools in the tools table are used.\n"
  4241. "'No' --> means that the used order is the one in the tool table\n"
  4242. "'Forward' --> means that the tools will be ordered from small to big\n"
  4243. "'Reverse' --> menas that the tools will ordered from big to small\n\n"
  4244. "WARNING: using rest machining will automatically set the order\n"
  4245. "in reverse and disable this control."))
  4246. self.ncc_order_radio = RadioSet([{'label': _('No'), 'value': 'no'},
  4247. {'label': _('Forward'), 'value': 'fwd'},
  4248. {'label': _('Reverse'), 'value': 'rev'}])
  4249. self.ncc_order_radio.setToolTip(_("This set the way that the tools in the tools table are used.\n"
  4250. "'No' --> means that the used order is the one in the tool table\n"
  4251. "'Forward' --> means that the tools will be ordered from small to big\n"
  4252. "'Reverse' --> menas that the tools will ordered from big to small\n\n"
  4253. "WARNING: using rest machining will automatically set the order\n"
  4254. "in reverse and disable this control."))
  4255. grid0.addWidget(self.ncc_order_label, 8, 0)
  4256. grid0.addWidget(self.ncc_order_radio, 8, 1)
  4257. separator_line = QtWidgets.QFrame()
  4258. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  4259. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  4260. grid0.addWidget(separator_line, 9, 0, 1, 2)
  4261. # Overlap Entry
  4262. nccoverlabel = QtWidgets.QLabel('%s:' % _('Overlap'))
  4263. nccoverlabel.setToolTip(
  4264. _("How much (percentage) of the tool width to overlap each tool pass.\n"
  4265. "Adjust the value starting with lower values\n"
  4266. "and increasing it if areas that should be cleared are still \n"
  4267. "not cleared.\n"
  4268. "Lower values = faster processing, faster execution on CNC.\n"
  4269. "Higher values = slow processing and slow execution on CNC\n"
  4270. "due of too many paths.")
  4271. )
  4272. self.ncc_overlap_entry = FCDoubleSpinner(suffix='%')
  4273. self.ncc_overlap_entry.set_precision(self.decimals)
  4274. self.ncc_overlap_entry.setWrapping(True)
  4275. self.ncc_overlap_entry.setRange(0.0000, 99.9999)
  4276. self.ncc_overlap_entry.setSingleStep(0.1)
  4277. grid0.addWidget(nccoverlabel, 10, 0)
  4278. grid0.addWidget(self.ncc_overlap_entry, 10, 1)
  4279. # Margin entry
  4280. nccmarginlabel = QtWidgets.QLabel('%s:' % _('Margin'))
  4281. nccmarginlabel.setToolTip(
  4282. _("Bounding box margin.")
  4283. )
  4284. self.ncc_margin_entry = FCDoubleSpinner()
  4285. self.ncc_margin_entry.set_precision(self.decimals)
  4286. self.ncc_margin_entry.set_range(-10000, 10000)
  4287. self.ncc_margin_entry.setSingleStep(0.1)
  4288. grid0.addWidget(nccmarginlabel, 11, 0)
  4289. grid0.addWidget(self.ncc_margin_entry, 11, 1)
  4290. # Method
  4291. methodlabel = QtWidgets.QLabel('%s:' % _('Method'))
  4292. methodlabel.setToolTip(
  4293. _("Algorithm for copper clearing:\n"
  4294. "- Standard: Fixed step inwards.\n"
  4295. "- Seed-based: Outwards from seed.\n"
  4296. "- Line-based: Parallel lines.")
  4297. )
  4298. # self.ncc_method_radio = RadioSet([
  4299. # {"label": _("Standard"), "value": "standard"},
  4300. # {"label": _("Seed-based"), "value": "seed"},
  4301. # {"label": _("Straight lines"), "value": "lines"}
  4302. # ], orientation='vertical', stretch=False)
  4303. self.ncc_method_combo = FCComboBox()
  4304. self.ncc_method_combo.addItems(
  4305. [_("Standard"), _("Seed"), _("Lines")]
  4306. )
  4307. grid0.addWidget(methodlabel, 12, 0)
  4308. grid0.addWidget(self.ncc_method_combo, 12, 1)
  4309. # Connect lines
  4310. self.ncc_connect_cb = FCCheckBox('%s' % _("Connect"))
  4311. self.ncc_connect_cb.setToolTip(
  4312. _("Draw lines between resulting\n"
  4313. "segments to minimize tool lifts.")
  4314. )
  4315. grid0.addWidget(self.ncc_connect_cb, 13, 0)
  4316. # Contour Checkbox
  4317. self.ncc_contour_cb = FCCheckBox('%s' % _("Contour"))
  4318. self.ncc_contour_cb.setToolTip(
  4319. _("Cut around the perimeter of the polygon\n"
  4320. "to trim rough edges.")
  4321. )
  4322. grid0.addWidget(self.ncc_contour_cb, 13, 1)
  4323. # ## NCC Offset choice
  4324. self.ncc_choice_offset_cb = FCCheckBox('%s' % _("Offset"))
  4325. self.ncc_choice_offset_cb.setToolTip(
  4326. _("If used, it will add an offset to the copper features.\n"
  4327. "The copper clearing will finish to a distance\n"
  4328. "from the copper features.\n"
  4329. "The value can be between 0 and 10 FlatCAM units.")
  4330. )
  4331. grid0.addWidget(self.ncc_choice_offset_cb, 14, 0, 1, 2)
  4332. # ## NCC Offset value
  4333. self.ncc_offset_label = QtWidgets.QLabel('%s:' % _("Offset value"))
  4334. self.ncc_offset_label.setToolTip(
  4335. _("If used, it will add an offset to the copper features.\n"
  4336. "The copper clearing will finish to a distance\n"
  4337. "from the copper features.\n"
  4338. "The value can be between 0.0 and 9999.9 FlatCAM units.")
  4339. )
  4340. self.ncc_offset_spinner = FCDoubleSpinner()
  4341. self.ncc_offset_spinner.set_range(0.00, 9999.9999)
  4342. self.ncc_offset_spinner.set_precision(self.decimals)
  4343. self.ncc_offset_spinner.setWrapping(True)
  4344. self.ncc_offset_spinner.setSingleStep(0.1)
  4345. grid0.addWidget(self.ncc_offset_label, 15, 0)
  4346. grid0.addWidget(self.ncc_offset_spinner, 15, 1)
  4347. separator_line = QtWidgets.QFrame()
  4348. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  4349. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  4350. grid0.addWidget(separator_line, 16, 0, 1, 2)
  4351. # Rest machining CheckBox
  4352. self.ncc_rest_cb = FCCheckBox('%s' % _("Rest Machining"))
  4353. self.ncc_rest_cb.setToolTip(
  4354. _("If checked, use 'rest machining'.\n"
  4355. "Basically it will clear copper outside PCB features,\n"
  4356. "using the biggest tool and continue with the next tools,\n"
  4357. "from bigger to smaller, to clear areas of copper that\n"
  4358. "could not be cleared by previous tool, until there is\n"
  4359. "no more copper to clear or there are no more tools.\n"
  4360. "If not checked, use the standard algorithm.")
  4361. )
  4362. grid0.addWidget(self.ncc_rest_cb, 17, 0, 1, 2)
  4363. # ## Reference
  4364. # self.reference_radio = RadioSet([{'label': _('Itself'), 'value': 'itself'},
  4365. # {"label": _("Area Selection"), "value": "area"},
  4366. # {'label': _('Reference Object'), 'value': 'box'}],
  4367. # orientation='vertical',
  4368. # stretch=None)
  4369. self.select_combo = FCComboBox()
  4370. self.select_combo.addItems(
  4371. [_("Itself"), _("Area Selection"), _("Reference Object")]
  4372. )
  4373. select_label = QtWidgets.QLabel('%s:' % _("Selection"))
  4374. select_label.setToolTip(
  4375. _("Selection of area to be processed.\n"
  4376. "- 'Itself' - the processing extent is based on the object that is processed.\n "
  4377. "- 'Area Selection' - left mouse click to start selection of the area to be processed.\n"
  4378. "- 'Reference Object' - will process the area specified by another object.")
  4379. )
  4380. grid0.addWidget(select_label, 18, 0)
  4381. grid0.addWidget(self.select_combo, 18, 1)
  4382. self.area_shape_label = QtWidgets.QLabel('%s:' % _("Shape"))
  4383. self.area_shape_label.setToolTip(
  4384. _("The kind of selection shape used for area selection.")
  4385. )
  4386. self.area_shape_radio = RadioSet([{'label': _("Square"), 'value': 'square'},
  4387. {'label': _("Polygon"), 'value': 'polygon'}])
  4388. grid0.addWidget(self.area_shape_label, 19, 0)
  4389. grid0.addWidget(self.area_shape_radio, 19, 1)
  4390. separator_line = QtWidgets.QFrame()
  4391. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  4392. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  4393. grid0.addWidget(separator_line, 20, 0, 1, 2)
  4394. # ## Plotting type
  4395. self.ncc_plotting_radio = RadioSet([{'label': _('Normal'), 'value': 'normal'},
  4396. {"label": _("Progressive"), "value": "progressive"}])
  4397. plotting_label = QtWidgets.QLabel('%s:' % _("NCC Plotting"))
  4398. plotting_label.setToolTip(
  4399. _("- 'Normal' - normal plotting, done at the end of the NCC job\n"
  4400. "- 'Progressive' - after each shape is generated it will be plotted.")
  4401. )
  4402. grid0.addWidget(plotting_label, 21, 0)
  4403. grid0.addWidget(self.ncc_plotting_radio, 21, 1)
  4404. self.layout.addStretch()
  4405. class ToolsCutoutPrefGroupUI(OptionsGroupUI):
  4406. def __init__(self, decimals=4, parent=None):
  4407. # OptionsGroupUI.__init__(self, "Cutout Tool Options", parent=parent)
  4408. super(ToolsCutoutPrefGroupUI, self).__init__(self)
  4409. self.setTitle(str(_("Cutout Tool Options")))
  4410. self.decimals = decimals
  4411. # ## Board cutout
  4412. self.board_cutout_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  4413. self.board_cutout_label.setToolTip(
  4414. _("Create toolpaths to cut around\n"
  4415. "the PCB and separate it from\n"
  4416. "the original board.")
  4417. )
  4418. self.layout.addWidget(self.board_cutout_label)
  4419. grid0 = QtWidgets.QGridLayout()
  4420. self.layout.addLayout(grid0)
  4421. tdclabel = QtWidgets.QLabel('%s:' % _('Tool Diameter'))
  4422. tdclabel.setToolTip(
  4423. _("Diameter of the tool used to cutout\n"
  4424. "the PCB shape out of the surrounding material.")
  4425. )
  4426. self.cutout_tooldia_entry = FCDoubleSpinner()
  4427. self.cutout_tooldia_entry.set_range(0.000001, 9999.9999)
  4428. self.cutout_tooldia_entry.set_precision(self.decimals)
  4429. self.cutout_tooldia_entry.setSingleStep(0.1)
  4430. grid0.addWidget(tdclabel, 0, 0)
  4431. grid0.addWidget(self.cutout_tooldia_entry, 0, 1)
  4432. # Cut Z
  4433. cutzlabel = QtWidgets.QLabel('%s:' % _('Cut Z'))
  4434. cutzlabel.setToolTip(
  4435. _(
  4436. "Cutting depth (negative)\n"
  4437. "below the copper surface."
  4438. )
  4439. )
  4440. self.cutz_entry = FCDoubleSpinner()
  4441. self.cutz_entry.set_precision(self.decimals)
  4442. if machinist_setting == 0:
  4443. self.cutz_entry.setRange(-9999.9999, 0.0000)
  4444. else:
  4445. self.cutz_entry.setRange(-9999.9999, 9999.9999)
  4446. self.cutz_entry.setSingleStep(0.1)
  4447. grid0.addWidget(cutzlabel, 1, 0)
  4448. grid0.addWidget(self.cutz_entry, 1, 1)
  4449. # Multi-pass
  4450. self.mpass_cb = FCCheckBox('%s:' % _("Multi-Depth"))
  4451. self.mpass_cb.setToolTip(
  4452. _(
  4453. "Use multiple passes to limit\n"
  4454. "the cut depth in each pass. Will\n"
  4455. "cut multiple times until Cut Z is\n"
  4456. "reached."
  4457. )
  4458. )
  4459. self.maxdepth_entry = FCDoubleSpinner()
  4460. self.maxdepth_entry.set_precision(self.decimals)
  4461. self.maxdepth_entry.setRange(0, 9999.9999)
  4462. self.maxdepth_entry.setSingleStep(0.1)
  4463. self.maxdepth_entry.setToolTip(_("Depth of each pass (positive)."))
  4464. grid0.addWidget(self.mpass_cb, 2, 0)
  4465. grid0.addWidget(self.maxdepth_entry, 2, 1)
  4466. # Object kind
  4467. kindlabel = QtWidgets.QLabel('%s:' % _('Object kind'))
  4468. kindlabel.setToolTip(
  4469. _("Choice of what kind the object we want to cutout is.<BR>"
  4470. "- <B>Single</B>: contain a single PCB Gerber outline object.<BR>"
  4471. "- <B>Panel</B>: a panel PCB Gerber object, which is made\n"
  4472. "out of many individual PCB outlines.")
  4473. )
  4474. self.obj_kind_combo = RadioSet([
  4475. {"label": _("Single"), "value": "single"},
  4476. {"label": _("Panel"), "value": "panel"},
  4477. ])
  4478. grid0.addWidget(kindlabel, 3, 0)
  4479. grid0.addWidget(self.obj_kind_combo, 3, 1)
  4480. marginlabel = QtWidgets.QLabel('%s:' % _('Margin'))
  4481. marginlabel.setToolTip(
  4482. _("Margin over bounds. A positive value here\n"
  4483. "will make the cutout of the PCB further from\n"
  4484. "the actual PCB border")
  4485. )
  4486. self.cutout_margin_entry = FCDoubleSpinner()
  4487. self.cutout_margin_entry.set_range(-9999.9999, 9999.9999)
  4488. self.cutout_margin_entry.set_precision(self.decimals)
  4489. self.cutout_margin_entry.setSingleStep(0.1)
  4490. grid0.addWidget(marginlabel, 4, 0)
  4491. grid0.addWidget(self.cutout_margin_entry, 4, 1)
  4492. gaplabel = QtWidgets.QLabel('%s:' % _('Gap size'))
  4493. gaplabel.setToolTip(
  4494. _("The size of the bridge gaps in the cutout\n"
  4495. "used to keep the board connected to\n"
  4496. "the surrounding material (the one \n"
  4497. "from which the PCB is cutout).")
  4498. )
  4499. self.cutout_gap_entry = FCDoubleSpinner()
  4500. self.cutout_gap_entry.set_range(0.000001, 9999.9999)
  4501. self.cutout_gap_entry.set_precision(self.decimals)
  4502. self.cutout_gap_entry.setSingleStep(0.1)
  4503. grid0.addWidget(gaplabel, 5, 0)
  4504. grid0.addWidget(self.cutout_gap_entry, 5, 1)
  4505. gaps_label = QtWidgets.QLabel('%s:' % _('Gaps'))
  4506. gaps_label.setToolTip(
  4507. _("Number of gaps used for the cutout.\n"
  4508. "There can be maximum 8 bridges/gaps.\n"
  4509. "The choices are:\n"
  4510. "- None - no gaps\n"
  4511. "- lr - left + right\n"
  4512. "- tb - top + bottom\n"
  4513. "- 4 - left + right +top + bottom\n"
  4514. "- 2lr - 2*left + 2*right\n"
  4515. "- 2tb - 2*top + 2*bottom\n"
  4516. "- 8 - 2*left + 2*right +2*top + 2*bottom")
  4517. )
  4518. self.gaps_combo = FCComboBox()
  4519. grid0.addWidget(gaps_label, 6, 0)
  4520. grid0.addWidget(self.gaps_combo, 6, 1)
  4521. gaps_items = ['None', 'LR', 'TB', '4', '2LR', '2TB', '8']
  4522. for it in gaps_items:
  4523. self.gaps_combo.addItem(it)
  4524. self.gaps_combo.setStyleSheet('background-color: rgb(255,255,255)')
  4525. # Surrounding convex box shape
  4526. self.convex_box = FCCheckBox('%s' % _("Convex Shape"))
  4527. self.convex_box.setToolTip(
  4528. _("Create a convex shape surrounding the entire PCB.\n"
  4529. "Used only if the source object type is Gerber.")
  4530. )
  4531. grid0.addWidget(self.convex_box, 7, 0, 1, 2)
  4532. self.layout.addStretch()
  4533. class Tools2sidedPrefGroupUI(OptionsGroupUI):
  4534. def __init__(self, decimals=4, parent=None):
  4535. # OptionsGroupUI.__init__(self, "2sided Tool Options", parent=parent)
  4536. super(Tools2sidedPrefGroupUI, self).__init__(self)
  4537. self.setTitle(str(_("2Sided Tool Options")))
  4538. self.decimals = decimals
  4539. # ## Board cuttout
  4540. self.dblsided_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  4541. self.dblsided_label.setToolTip(
  4542. _("A tool to help in creating a double sided\n"
  4543. "PCB using alignment holes.")
  4544. )
  4545. self.layout.addWidget(self.dblsided_label)
  4546. grid0 = QtWidgets.QGridLayout()
  4547. self.layout.addLayout(grid0)
  4548. # ## Drill diameter for alignment holes
  4549. self.drill_dia_entry = FCDoubleSpinner()
  4550. self.drill_dia_entry.set_range(0.000001, 9999.9999)
  4551. self.drill_dia_entry.set_precision(self.decimals)
  4552. self.drill_dia_entry.setSingleStep(0.1)
  4553. self.dd_label = QtWidgets.QLabel('%s:' % _("Drill dia"))
  4554. self.dd_label.setToolTip(
  4555. _("Diameter of the drill for the "
  4556. "alignment holes.")
  4557. )
  4558. grid0.addWidget(self.dd_label, 0, 0)
  4559. grid0.addWidget(self.drill_dia_entry, 0, 1)
  4560. # ## Alignment Axis
  4561. self.align_ax_label = QtWidgets.QLabel('%s:' % _("Align Axis"))
  4562. self.align_ax_label.setToolTip(
  4563. _("Mirror vertically (X) or horizontally (Y).")
  4564. )
  4565. self.align_axis_radio = RadioSet([{'label': 'X', 'value': 'X'},
  4566. {'label': 'Y', 'value': 'Y'}])
  4567. grid0.addWidget(self.align_ax_label, 1, 0)
  4568. grid0.addWidget(self.align_axis_radio, 1, 1)
  4569. # ## Axis
  4570. self.mirror_axis_radio = RadioSet([{'label': 'X', 'value': 'X'},
  4571. {'label': 'Y', 'value': 'Y'}])
  4572. self.mirax_label = QtWidgets.QLabel(_("Mirror Axis:"))
  4573. self.mirax_label.setToolTip(
  4574. _("Mirror vertically (X) or horizontally (Y).")
  4575. )
  4576. self.empty_lb1 = QtWidgets.QLabel("")
  4577. grid0.addWidget(self.empty_lb1, 2, 0)
  4578. grid0.addWidget(self.mirax_label, 3, 0)
  4579. grid0.addWidget(self.mirror_axis_radio, 3, 1)
  4580. # ## Axis Location
  4581. self.axis_location_radio = RadioSet([{'label': _('Point'), 'value': 'point'},
  4582. {'label': _('Box'), 'value': 'box'}])
  4583. self.axloc_label = QtWidgets.QLabel('%s:' % _("Axis Ref"))
  4584. self.axloc_label.setToolTip(
  4585. _("The axis should pass through a <b>point</b> or cut\n "
  4586. "a specified <b>box</b> (in a FlatCAM object) through \n"
  4587. "the center.")
  4588. )
  4589. grid0.addWidget(self.axloc_label, 4, 0)
  4590. grid0.addWidget(self.axis_location_radio, 4, 1)
  4591. self.layout.addStretch()
  4592. class ToolsPaintPrefGroupUI(OptionsGroupUI):
  4593. def __init__(self, decimals=4, parent=None):
  4594. # OptionsGroupUI.__init__(self, "Paint Area Tool Options", parent=parent)
  4595. super(ToolsPaintPrefGroupUI, self).__init__(self)
  4596. self.setTitle(str(_("Paint Tool Options")))
  4597. self.decimals = decimals
  4598. # ------------------------------
  4599. # ## Paint area
  4600. # ------------------------------
  4601. self.paint_label = QtWidgets.QLabel(_('<b>Parameters:</b>'))
  4602. self.paint_label.setToolTip(
  4603. _("Creates tool paths to cover the\n"
  4604. "whole area of a polygon (remove\n"
  4605. "all copper). You will be asked\n"
  4606. "to click on the desired polygon.")
  4607. )
  4608. self.layout.addWidget(self.paint_label)
  4609. grid0 = QtWidgets.QGridLayout()
  4610. grid0.setColumnStretch(0, 0)
  4611. grid0.setColumnStretch(1, 1)
  4612. self.layout.addLayout(grid0)
  4613. # Tool dia
  4614. ptdlabel = QtWidgets.QLabel('<b><font color="green">%s:</font></b>' % _('Tools Dia'))
  4615. ptdlabel.setToolTip(
  4616. _("Diameters of the tools, separated by comma.\n"
  4617. "The value of the diameter has to use the dot decimals separator.\n"
  4618. "Valid values: 0.3, 1.0")
  4619. )
  4620. grid0.addWidget(ptdlabel, 0, 0)
  4621. self.painttooldia_entry = FCEntry(border_color='#0069A9')
  4622. self.painttooldia_entry.setPlaceholderText(_("Comma separated values"))
  4623. grid0.addWidget(self.painttooldia_entry, 0, 1)
  4624. # Tool Type Radio Button
  4625. self.tool_type_label = QtWidgets.QLabel('%s:' % _('Tool Type'))
  4626. self.tool_type_label.setToolTip(
  4627. _("Default tool type:\n"
  4628. "- 'V-shape'\n"
  4629. "- Circular")
  4630. )
  4631. self.tool_type_radio = RadioSet([{'label': _('V-shape'), 'value': 'V'},
  4632. {'label': _('Circular'), 'value': 'C1'}])
  4633. self.tool_type_radio.setObjectName(_("Tool Type"))
  4634. grid0.addWidget(self.tool_type_label, 1, 0)
  4635. grid0.addWidget(self.tool_type_radio, 1, 1)
  4636. # Tip Dia
  4637. self.tipdialabel = QtWidgets.QLabel('%s:' % _('V-Tip Dia'))
  4638. self.tipdialabel.setToolTip(
  4639. _("The tip diameter for V-Shape Tool"))
  4640. self.tipdia_entry = FCDoubleSpinner()
  4641. self.tipdia_entry.set_precision(self.decimals)
  4642. self.tipdia_entry.set_range(0.0000, 9999.9999)
  4643. self.tipdia_entry.setSingleStep(0.1)
  4644. self.tipdia_entry.setObjectName(_("V-Tip Dia"))
  4645. grid0.addWidget(self.tipdialabel, 2, 0)
  4646. grid0.addWidget(self.tipdia_entry, 2, 1)
  4647. # Tip Angle
  4648. self.tipanglelabel = QtWidgets.QLabel('%s:' % _('V-Tip Angle'))
  4649. self.tipanglelabel.setToolTip(
  4650. _("The tip angle for V-Shape Tool.\n"
  4651. "In degree."))
  4652. self.tipangle_entry = FCDoubleSpinner()
  4653. self.tipangle_entry.set_precision(self.decimals)
  4654. self.tipangle_entry.set_range(1.0000, 180.0000)
  4655. self.tipangle_entry.setSingleStep(5)
  4656. self.tipangle_entry.setObjectName(_("V-Tip Angle"))
  4657. grid0.addWidget(self.tipanglelabel, 3, 0)
  4658. grid0.addWidget(self.tipangle_entry, 3, 1)
  4659. # Cut Z entry
  4660. cutzlabel = QtWidgets.QLabel('%s:' % _('Cut Z'))
  4661. cutzlabel.setToolTip(
  4662. _("Depth of cut into material. Negative value.\n"
  4663. "In FlatCAM units.")
  4664. )
  4665. self.cutz_entry = FCDoubleSpinner()
  4666. self.cutz_entry.set_precision(self.decimals)
  4667. self.cutz_entry.set_range(-99999.9999, 0.0000)
  4668. self.cutz_entry.setObjectName(_("Cut Z"))
  4669. self.cutz_entry.setToolTip(
  4670. _("Depth of cut into material. Negative value.\n"
  4671. "In FlatCAM units.")
  4672. )
  4673. grid0.addWidget(cutzlabel, 4, 0)
  4674. grid0.addWidget(self.cutz_entry, 4, 1)
  4675. # ### Tool Diameter ####
  4676. self.newdialabel = QtWidgets.QLabel('%s:' % _('New Dia'))
  4677. self.newdialabel.setToolTip(
  4678. _("Diameter for the new tool to add in the Tool Table.\n"
  4679. "If the tool is V-shape type then this value is automatically\n"
  4680. "calculated from the other parameters.")
  4681. )
  4682. self.newdia_entry = FCDoubleSpinner()
  4683. self.newdia_entry.set_precision(self.decimals)
  4684. self.newdia_entry.set_range(0.000, 9999.9999)
  4685. self.newdia_entry.setObjectName(_("Tool Dia"))
  4686. grid0.addWidget(self.newdialabel, 5, 0)
  4687. grid0.addWidget(self.newdia_entry, 5, 1)
  4688. separator_line = QtWidgets.QFrame()
  4689. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  4690. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  4691. grid0.addWidget(separator_line, 6, 0, 1, 2)
  4692. self.paint_order_label = QtWidgets.QLabel('%s:' % _('Tool order'))
  4693. self.paint_order_label.setToolTip(_("This set the way that the tools in the tools table are used.\n"
  4694. "'No' --> means that the used order is the one in the tool table\n"
  4695. "'Forward' --> means that the tools will be ordered from small to big\n"
  4696. "'Reverse' --> menas that the tools will ordered from big to small\n\n"
  4697. "WARNING: using rest machining will automatically set the order\n"
  4698. "in reverse and disable this control."))
  4699. self.paint_order_radio = RadioSet([{'label': _('No'), 'value': 'no'},
  4700. {'label': _('Forward'), 'value': 'fwd'},
  4701. {'label': _('Reverse'), 'value': 'rev'}])
  4702. grid0.addWidget(self.paint_order_label, 7, 0)
  4703. grid0.addWidget(self.paint_order_radio, 7, 1)
  4704. separator_line = QtWidgets.QFrame()
  4705. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  4706. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  4707. grid0.addWidget(separator_line, 8, 0, 1, 2)
  4708. # Overlap
  4709. ovlabel = QtWidgets.QLabel('%s:' % _('Overlap'))
  4710. ovlabel.setToolTip(
  4711. _("How much (percentage) of the tool width to overlap each tool pass.\n"
  4712. "Adjust the value starting with lower values\n"
  4713. "and increasing it if areas that should be painted are still \n"
  4714. "not painted.\n"
  4715. "Lower values = faster processing, faster execution on CNC.\n"
  4716. "Higher values = slow processing and slow execution on CNC\n"
  4717. "due of too many paths.")
  4718. )
  4719. self.paintoverlap_entry = FCDoubleSpinner(suffix='%')
  4720. self.paintoverlap_entry.set_precision(self.decimals)
  4721. self.paintoverlap_entry.setWrapping(True)
  4722. self.paintoverlap_entry.setRange(0.0000, 99.9999)
  4723. self.paintoverlap_entry.setSingleStep(0.1)
  4724. grid0.addWidget(ovlabel, 9, 0)
  4725. grid0.addWidget(self.paintoverlap_entry, 9, 1)
  4726. # Margin
  4727. marginlabel = QtWidgets.QLabel('%s:' % _('Margin'))
  4728. marginlabel.setToolTip(
  4729. _("Distance by which to avoid\n"
  4730. "the edges of the polygon to\n"
  4731. "be painted.")
  4732. )
  4733. self.paintmargin_entry = FCDoubleSpinner()
  4734. self.paintmargin_entry.set_range(-9999.9999, 9999.9999)
  4735. self.paintmargin_entry.set_precision(self.decimals)
  4736. self.paintmargin_entry.setSingleStep(0.1)
  4737. grid0.addWidget(marginlabel, 10, 0)
  4738. grid0.addWidget(self.paintmargin_entry, 10, 1)
  4739. # Method
  4740. methodlabel = QtWidgets.QLabel('%s:' % _('Method'))
  4741. methodlabel.setToolTip(
  4742. _("Algorithm for painting:\n"
  4743. "- Standard: Fixed step inwards.\n"
  4744. "- Seed-based: Outwards from seed.\n"
  4745. "- Line-based: Parallel lines.\n"
  4746. "- Laser-lines: Active only for Gerber objects.\n"
  4747. "Will create lines that follow the traces.\n"
  4748. "- Combo: In case of failure a new method will be picked from the above\n"
  4749. "in the order specified.")
  4750. )
  4751. # self.paintmethod_combo = RadioSet([
  4752. # {"label": _("Standard"), "value": "standard"},
  4753. # {"label": _("Seed-based"), "value": "seed"},
  4754. # {"label": _("Straight lines"), "value": "lines"}
  4755. # ], orientation='vertical', stretch=False)
  4756. self.paintmethod_combo = FCComboBox()
  4757. self.paintmethod_combo.addItems(
  4758. [_("Standard"), _("Seed"), _("Lines"), _("Laser_lines"), _("Combo")]
  4759. )
  4760. grid0.addWidget(methodlabel, 11, 0)
  4761. grid0.addWidget(self.paintmethod_combo, 11, 1)
  4762. # Connect lines
  4763. self.pathconnect_cb = FCCheckBox('%s' % _("Connect"))
  4764. self.pathconnect_cb.setToolTip(
  4765. _("Draw lines between resulting\n"
  4766. "segments to minimize tool lifts.")
  4767. )
  4768. grid0.addWidget(self.pathconnect_cb, 12, 0)
  4769. # Paint contour
  4770. self.contour_cb = FCCheckBox('%s' % _("Contour"))
  4771. self.contour_cb.setToolTip(
  4772. _("Cut around the perimeter of the polygon\n"
  4773. "to trim rough edges.")
  4774. )
  4775. grid0.addWidget(self.contour_cb, 12, 1)
  4776. separator_line = QtWidgets.QFrame()
  4777. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  4778. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  4779. grid0.addWidget(separator_line, 13, 0, 1, 2)
  4780. self.rest_cb = FCCheckBox('%s' % _("Rest Machining"))
  4781. self.rest_cb.setObjectName(_("Rest Machining"))
  4782. self.rest_cb.setToolTip(
  4783. _("If checked, use 'rest machining'.\n"
  4784. "Basically it will clear copper outside PCB features,\n"
  4785. "using the biggest tool and continue with the next tools,\n"
  4786. "from bigger to smaller, to clear areas of copper that\n"
  4787. "could not be cleared by previous tool, until there is\n"
  4788. "no more copper to clear or there are no more tools.\n\n"
  4789. "If not checked, use the standard algorithm.")
  4790. )
  4791. grid0.addWidget(self.rest_cb, 14, 0, 1, 2)
  4792. # Polygon selection
  4793. selectlabel = QtWidgets.QLabel('%s:' % _('Selection'))
  4794. selectlabel.setToolTip(
  4795. _("Selection of area to be processed.\n"
  4796. "- 'Polygon Selection' - left mouse click to add/remove polygons to be processed.\n"
  4797. "- 'Area Selection' - left mouse click to start selection of the area to be processed.\n"
  4798. "Keeping a modifier key pressed (CTRL or SHIFT) will allow to add multiple areas.\n"
  4799. "- 'All Polygons' - the process will start after click.\n"
  4800. "- 'Reference Object' - will process the area specified by another object.")
  4801. )
  4802. # self.selectmethod_combo = RadioSet(
  4803. # [
  4804. # {"label": _("Polygon Selection"), "value": "single"},
  4805. # {"label": _("Area Selection"), "value": "area"},
  4806. # {"label": _("All Polygons"), "value": "all"},
  4807. # {"label": _("Reference Object"), "value": "ref"}
  4808. # ],
  4809. # orientation='vertical',
  4810. # stretch=None
  4811. # )
  4812. self.selectmethod_combo = FCComboBox()
  4813. self.selectmethod_combo.addItems(
  4814. [_("Polygon Selection"), _("Area Selection"), _("All Polygons"), _("Reference Object")]
  4815. )
  4816. grid0.addWidget(selectlabel, 15, 0)
  4817. grid0.addWidget(self.selectmethod_combo, 15, 1)
  4818. self.area_shape_label = QtWidgets.QLabel('%s:' % _("Shape"))
  4819. self.area_shape_label.setToolTip(
  4820. _("The kind of selection shape used for area selection.")
  4821. )
  4822. self.area_shape_radio = RadioSet([{'label': _("Square"), 'value': 'square'},
  4823. {'label': _("Polygon"), 'value': 'polygon'}])
  4824. grid0.addWidget(self.area_shape_label, 18, 0)
  4825. grid0.addWidget(self.area_shape_radio, 18, 1)
  4826. separator_line = QtWidgets.QFrame()
  4827. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  4828. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  4829. grid0.addWidget(separator_line, 19, 0, 1, 2)
  4830. # ## Plotting type
  4831. self.paint_plotting_radio = RadioSet([{'label': _('Normal'), 'value': 'normal'},
  4832. {"label": _("Progressive"), "value": "progressive"}])
  4833. plotting_label = QtWidgets.QLabel('%s:' % _("Paint Plotting"))
  4834. plotting_label.setToolTip(
  4835. _("- 'Normal' - normal plotting, done at the end of the Paint job\n"
  4836. "- 'Progressive' - after each shape is generated it will be plotted.")
  4837. )
  4838. grid0.addWidget(plotting_label, 20, 0)
  4839. grid0.addWidget(self.paint_plotting_radio, 20, 1)
  4840. self.layout.addStretch()
  4841. class ToolsFilmPrefGroupUI(OptionsGroupUI):
  4842. def __init__(self, decimals=4, parent=None):
  4843. # OptionsGroupUI.__init__(self, "Cutout Tool Options", parent=parent)
  4844. super(ToolsFilmPrefGroupUI, self).__init__(self)
  4845. self.setTitle(str(_("Film Tool Options")))
  4846. self.decimals = decimals
  4847. # ## Parameters
  4848. self.film_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  4849. self.film_label.setToolTip(
  4850. _("Create a PCB film from a Gerber or Geometry\n"
  4851. "FlatCAM object.\n"
  4852. "The file is saved in SVG format.")
  4853. )
  4854. self.layout.addWidget(self.film_label)
  4855. grid0 = QtWidgets.QGridLayout()
  4856. self.layout.addLayout(grid0)
  4857. self.film_type_radio = RadioSet([{'label': 'Pos', 'value': 'pos'},
  4858. {'label': 'Neg', 'value': 'neg'}])
  4859. ftypelbl = QtWidgets.QLabel('%s:' % _('Film Type'))
  4860. ftypelbl.setToolTip(
  4861. _("Generate a Positive black film or a Negative film.\n"
  4862. "Positive means that it will print the features\n"
  4863. "with black on a white canvas.\n"
  4864. "Negative means that it will print the features\n"
  4865. "with white on a black canvas.\n"
  4866. "The Film format is SVG.")
  4867. )
  4868. grid0.addWidget(ftypelbl, 0, 0)
  4869. grid0.addWidget(self.film_type_radio, 0, 1)
  4870. # Film Color
  4871. self.film_color_label = QtWidgets.QLabel('%s:' % _('Film Color'))
  4872. self.film_color_label.setToolTip(
  4873. _("Set the film color when positive film is selected.")
  4874. )
  4875. self.film_color_entry = FCEntry()
  4876. self.film_color_button = QtWidgets.QPushButton()
  4877. self.film_color_button.setFixedSize(15, 15)
  4878. self.form_box_child = QtWidgets.QHBoxLayout()
  4879. self.form_box_child.setContentsMargins(0, 0, 0, 0)
  4880. self.form_box_child.addWidget(self.film_color_entry)
  4881. self.form_box_child.addWidget(self.film_color_button, alignment=Qt.AlignRight)
  4882. self.form_box_child.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  4883. film_color_widget = QtWidgets.QWidget()
  4884. film_color_widget.setLayout(self.form_box_child)
  4885. grid0.addWidget(self.film_color_label, 1, 0)
  4886. grid0.addWidget(film_color_widget, 1, 1)
  4887. # Film Border
  4888. self.film_boundary_entry = FCDoubleSpinner()
  4889. self.film_boundary_entry.set_precision(self.decimals)
  4890. self.film_boundary_entry.set_range(0, 9999.9999)
  4891. self.film_boundary_entry.setSingleStep(0.1)
  4892. self.film_boundary_label = QtWidgets.QLabel('%s:' % _("Border"))
  4893. self.film_boundary_label.setToolTip(
  4894. _("Specify a border around the object.\n"
  4895. "Only for negative film.\n"
  4896. "It helps if we use as a Box Object the same \n"
  4897. "object as in Film Object. It will create a thick\n"
  4898. "black bar around the actual print allowing for a\n"
  4899. "better delimitation of the outline features which are of\n"
  4900. "white color like the rest and which may confound with the\n"
  4901. "surroundings if not for this border.")
  4902. )
  4903. grid0.addWidget(self.film_boundary_label, 2, 0)
  4904. grid0.addWidget(self.film_boundary_entry, 2, 1)
  4905. self.film_scale_stroke_entry = FCDoubleSpinner()
  4906. self.film_scale_stroke_entry.set_precision(self.decimals)
  4907. self.film_scale_stroke_entry.set_range(0, 9999.9999)
  4908. self.film_scale_stroke_entry.setSingleStep(0.1)
  4909. self.film_scale_stroke_label = QtWidgets.QLabel('%s:' % _("Scale Stroke"))
  4910. self.film_scale_stroke_label.setToolTip(
  4911. _("Scale the line stroke thickness of each feature in the SVG file.\n"
  4912. "It means that the line that envelope each SVG feature will be thicker or thinner,\n"
  4913. "therefore the fine features may be more affected by this parameter.")
  4914. )
  4915. grid0.addWidget(self.film_scale_stroke_label, 3, 0)
  4916. grid0.addWidget(self.film_scale_stroke_entry, 3, 1)
  4917. self.film_adj_label = QtWidgets.QLabel('<b>%s</b>' % _("Film Adjustments"))
  4918. self.film_adj_label.setToolTip(
  4919. _("Sometime the printers will distort the print shape, especially the Laser types.\n"
  4920. "This section provide the tools to compensate for the print distortions.")
  4921. )
  4922. grid0.addWidget(self.film_adj_label, 4, 0, 1, 2)
  4923. # Scale Geometry
  4924. self.film_scale_cb = FCCheckBox('%s' % _("Scale Film geometry"))
  4925. self.film_scale_cb.setToolTip(
  4926. _("A value greater than 1 will stretch the film\n"
  4927. "while a value less than 1 will jolt it.")
  4928. )
  4929. self.film_scale_cb.setStyleSheet(
  4930. """
  4931. QCheckBox {font-weight: bold; color: black}
  4932. """
  4933. )
  4934. grid0.addWidget(self.film_scale_cb, 5, 0, 1, 2)
  4935. self.film_scalex_label = QtWidgets.QLabel('%s:' % _("X factor"))
  4936. self.film_scalex_entry = FCDoubleSpinner()
  4937. self.film_scalex_entry.set_range(-999.9999, 999.9999)
  4938. self.film_scalex_entry.set_precision(self.decimals)
  4939. self.film_scalex_entry.setSingleStep(0.01)
  4940. grid0.addWidget(self.film_scalex_label, 6, 0)
  4941. grid0.addWidget(self.film_scalex_entry, 6, 1)
  4942. self.film_scaley_label = QtWidgets.QLabel('%s:' % _("Y factor"))
  4943. self.film_scaley_entry = FCDoubleSpinner()
  4944. self.film_scaley_entry.set_range(-999.9999, 999.9999)
  4945. self.film_scaley_entry.set_precision(self.decimals)
  4946. self.film_scaley_entry.setSingleStep(0.01)
  4947. grid0.addWidget(self.film_scaley_label, 7, 0)
  4948. grid0.addWidget(self.film_scaley_entry, 7, 1)
  4949. # Skew Geometry
  4950. self.film_skew_cb = FCCheckBox('%s' % _("Skew Film geometry"))
  4951. self.film_skew_cb.setToolTip(
  4952. _("Positive values will skew to the right\n"
  4953. "while negative values will skew to the left.")
  4954. )
  4955. self.film_skew_cb.setStyleSheet(
  4956. """
  4957. QCheckBox {font-weight: bold; color: black}
  4958. """
  4959. )
  4960. grid0.addWidget(self.film_skew_cb, 8, 0, 1, 2)
  4961. self.film_skewx_label = QtWidgets.QLabel('%s:' % _("X angle"))
  4962. self.film_skewx_entry = FCDoubleSpinner()
  4963. self.film_skewx_entry.set_range(-999.9999, 999.9999)
  4964. self.film_skewx_entry.set_precision(self.decimals)
  4965. self.film_skewx_entry.setSingleStep(0.01)
  4966. grid0.addWidget(self.film_skewx_label, 9, 0)
  4967. grid0.addWidget(self.film_skewx_entry, 9, 1)
  4968. self.film_skewy_label = QtWidgets.QLabel('%s:' % _("Y angle"))
  4969. self.film_skewy_entry = FCDoubleSpinner()
  4970. self.film_skewy_entry.set_range(-999.9999, 999.9999)
  4971. self.film_skewy_entry.set_precision(self.decimals)
  4972. self.film_skewy_entry.setSingleStep(0.01)
  4973. grid0.addWidget(self.film_skewy_label, 10, 0)
  4974. grid0.addWidget(self.film_skewy_entry, 10, 1)
  4975. self.film_skew_ref_label = QtWidgets.QLabel('%s:' % _("Reference"))
  4976. self.film_skew_ref_label.setToolTip(
  4977. _("The reference point to be used as origin for the skew.\n"
  4978. "It can be one of the four points of the geometry bounding box.")
  4979. )
  4980. self.film_skew_reference = RadioSet([{'label': _('Bottom Left'), 'value': 'bottomleft'},
  4981. {'label': _('Top Left'), 'value': 'topleft'},
  4982. {'label': _('Bottom Right'), 'value': 'bottomright'},
  4983. {'label': _('Top right'), 'value': 'topright'}],
  4984. orientation='vertical',
  4985. stretch=False)
  4986. grid0.addWidget(self.film_skew_ref_label, 11, 0)
  4987. grid0.addWidget(self.film_skew_reference, 11, 1)
  4988. # Mirror Geometry
  4989. self.film_mirror_cb = FCCheckBox('%s' % _("Mirror Film geometry"))
  4990. self.film_mirror_cb.setToolTip(
  4991. _("Mirror the film geometry on the selected axis or on both.")
  4992. )
  4993. self.film_mirror_cb.setStyleSheet(
  4994. """
  4995. QCheckBox {font-weight: bold; color: black}
  4996. """
  4997. )
  4998. grid0.addWidget(self.film_mirror_cb, 12, 0, 1, 2)
  4999. self.film_mirror_axis = RadioSet([{'label': _('None'), 'value': 'none'},
  5000. {'label': _('X'), 'value': 'x'},
  5001. {'label': _('Y'), 'value': 'y'},
  5002. {'label': _('Both'), 'value': 'both'}],
  5003. stretch=False)
  5004. self.film_mirror_axis_label = QtWidgets.QLabel('%s:' % _("Mirror axis"))
  5005. grid0.addWidget(self.film_mirror_axis_label, 13, 0)
  5006. grid0.addWidget(self.film_mirror_axis, 13, 1)
  5007. separator_line3 = QtWidgets.QFrame()
  5008. separator_line3.setFrameShape(QtWidgets.QFrame.HLine)
  5009. separator_line3.setFrameShadow(QtWidgets.QFrame.Sunken)
  5010. grid0.addWidget(separator_line3, 14, 0, 1, 2)
  5011. self.file_type_radio = RadioSet([{'label': _('SVG'), 'value': 'svg'},
  5012. {'label': _('PNG'), 'value': 'png'},
  5013. {'label': _('PDF'), 'value': 'pdf'}
  5014. ], stretch=False)
  5015. self.file_type_label = QtWidgets.QLabel(_("Film Type:"))
  5016. self.file_type_label.setToolTip(
  5017. _("The file type of the saved film. Can be:\n"
  5018. "- 'SVG' -> open-source vectorial format\n"
  5019. "- 'PNG' -> raster image\n"
  5020. "- 'PDF' -> portable document format")
  5021. )
  5022. grid0.addWidget(self.file_type_label, 15, 0)
  5023. grid0.addWidget(self.file_type_radio, 15, 1)
  5024. # Page orientation
  5025. self.orientation_label = QtWidgets.QLabel('%s:' % _("Page Orientation"))
  5026. self.orientation_label.setToolTip(_("Can be:\n"
  5027. "- Portrait\n"
  5028. "- Landscape"))
  5029. self.orientation_radio = RadioSet([{'label': _('Portrait'), 'value': 'p'},
  5030. {'label': _('Landscape'), 'value': 'l'},
  5031. ], stretch=False)
  5032. grid0.addWidget(self.orientation_label, 16, 0)
  5033. grid0.addWidget(self.orientation_radio, 16, 1)
  5034. # Page Size
  5035. self.pagesize_label = QtWidgets.QLabel('%s:' % _("Page Size"))
  5036. self.pagesize_label.setToolTip(_("A selection of standard ISO 216 page sizes."))
  5037. self.pagesize_combo = FCComboBox()
  5038. self.pagesize = {}
  5039. self.pagesize.update(
  5040. {
  5041. 'Bounds': None,
  5042. 'A0': (841, 1189),
  5043. 'A1': (594, 841),
  5044. 'A2': (420, 594),
  5045. 'A3': (297, 420),
  5046. 'A4': (210, 297),
  5047. 'A5': (148, 210),
  5048. 'A6': (105, 148),
  5049. 'A7': (74, 105),
  5050. 'A8': (52, 74),
  5051. 'A9': (37, 52),
  5052. 'A10': (26, 37),
  5053. 'B0': (1000, 1414),
  5054. 'B1': (707, 1000),
  5055. 'B2': (500, 707),
  5056. 'B3': (353, 500),
  5057. 'B4': (250, 353),
  5058. 'B5': (176, 250),
  5059. 'B6': (125, 176),
  5060. 'B7': (88, 125),
  5061. 'B8': (62, 88),
  5062. 'B9': (44, 62),
  5063. 'B10': (31, 44),
  5064. 'C0': (917, 1297),
  5065. 'C1': (648, 917),
  5066. 'C2': (458, 648),
  5067. 'C3': (324, 458),
  5068. 'C4': (229, 324),
  5069. 'C5': (162, 229),
  5070. 'C6': (114, 162),
  5071. 'C7': (81, 114),
  5072. 'C8': (57, 81),
  5073. 'C9': (40, 57),
  5074. 'C10': (28, 40),
  5075. # American paper sizes
  5076. 'LETTER': (8.5, 11),
  5077. 'LEGAL': (8.5, 14),
  5078. 'ELEVENSEVENTEEN': (11, 17),
  5079. # From https://en.wikipedia.org/wiki/Paper_size
  5080. 'JUNIOR_LEGAL': (5, 8),
  5081. 'HALF_LETTER': (5.5, 8),
  5082. 'GOV_LETTER': (8, 10.5),
  5083. 'GOV_LEGAL': (8.5, 13),
  5084. 'LEDGER': (17, 11),
  5085. }
  5086. )
  5087. page_size_list = list(self.pagesize.keys())
  5088. self.pagesize_combo.addItems(page_size_list)
  5089. grid0.addWidget(self.pagesize_label, 17, 0)
  5090. grid0.addWidget(self.pagesize_combo, 17, 1)
  5091. self.layout.addStretch()
  5092. class ToolsPanelizePrefGroupUI(OptionsGroupUI):
  5093. def __init__(self, decimals=4, parent=None):
  5094. # OptionsGroupUI.__init__(self, "Cutout Tool Options", parent=parent)
  5095. super(ToolsPanelizePrefGroupUI, self).__init__(self)
  5096. self.setTitle(str(_("Panelize Tool Options")))
  5097. self.decimals = decimals
  5098. # ## Board cuttout
  5099. self.panelize_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  5100. self.panelize_label.setToolTip(
  5101. _("Create an object that contains an array of (x, y) elements,\n"
  5102. "each element is a copy of the source object spaced\n"
  5103. "at a X distance, Y distance of each other.")
  5104. )
  5105. self.layout.addWidget(self.panelize_label)
  5106. grid0 = QtWidgets.QGridLayout()
  5107. self.layout.addLayout(grid0)
  5108. grid0.setColumnStretch(0, 0)
  5109. grid0.setColumnStretch(1, 1)
  5110. # ## Spacing Columns
  5111. self.pspacing_columns = FCDoubleSpinner()
  5112. self.pspacing_columns.set_range(0.000001, 9999.9999)
  5113. self.pspacing_columns.set_precision(self.decimals)
  5114. self.pspacing_columns.setSingleStep(0.1)
  5115. self.spacing_columns_label = QtWidgets.QLabel('%s:' % _("Spacing cols"))
  5116. self.spacing_columns_label.setToolTip(
  5117. _("Spacing between columns of the desired panel.\n"
  5118. "In current units.")
  5119. )
  5120. grid0.addWidget(self.spacing_columns_label, 0, 0)
  5121. grid0.addWidget(self.pspacing_columns, 0, 1)
  5122. # ## Spacing Rows
  5123. self.pspacing_rows = FCDoubleSpinner()
  5124. self.pspacing_rows.set_range(0.000001, 9999.9999)
  5125. self.pspacing_rows.set_precision(self.decimals)
  5126. self.pspacing_rows.setSingleStep(0.1)
  5127. self.spacing_rows_label = QtWidgets.QLabel('%s:' % _("Spacing rows"))
  5128. self.spacing_rows_label.setToolTip(
  5129. _("Spacing between rows of the desired panel.\n"
  5130. "In current units.")
  5131. )
  5132. grid0.addWidget(self.spacing_rows_label, 1, 0)
  5133. grid0.addWidget(self.pspacing_rows, 1, 1)
  5134. # ## Columns
  5135. self.pcolumns = FCSpinner()
  5136. self.pcolumns.set_range(1, 1000)
  5137. self.pcolumns.set_step(1)
  5138. self.columns_label = QtWidgets.QLabel('%s:' % _("Columns"))
  5139. self.columns_label.setToolTip(
  5140. _("Number of columns of the desired panel")
  5141. )
  5142. grid0.addWidget(self.columns_label, 2, 0)
  5143. grid0.addWidget(self.pcolumns, 2, 1)
  5144. # ## Rows
  5145. self.prows = FCSpinner()
  5146. self.prows.set_range(1, 1000)
  5147. self.prows.set_step(1)
  5148. self.rows_label = QtWidgets.QLabel('%s:' % _("Rows"))
  5149. self.rows_label.setToolTip(
  5150. _("Number of rows of the desired panel")
  5151. )
  5152. grid0.addWidget(self.rows_label, 3, 0)
  5153. grid0.addWidget(self.prows, 3, 1)
  5154. # ## Type of resulting Panel object
  5155. self.panel_type_radio = RadioSet([{'label': _('Gerber'), 'value': 'gerber'},
  5156. {'label': _('Geo'), 'value': 'geometry'}])
  5157. self.panel_type_label = QtWidgets.QLabel('%s:' % _("Panel Type"))
  5158. self.panel_type_label.setToolTip(
  5159. _("Choose the type of object for the panel object:\n"
  5160. "- Gerber\n"
  5161. "- Geometry")
  5162. )
  5163. grid0.addWidget(self.panel_type_label, 4, 0)
  5164. grid0.addWidget(self.panel_type_radio, 4, 1)
  5165. # ## Constrains
  5166. self.pconstrain_cb = FCCheckBox('%s:' % _("Constrain within"))
  5167. self.pconstrain_cb.setToolTip(
  5168. _("Area define by DX and DY within to constrain the panel.\n"
  5169. "DX and DY values are in current units.\n"
  5170. "Regardless of how many columns and rows are desired,\n"
  5171. "the final panel will have as many columns and rows as\n"
  5172. "they fit completely within selected area.")
  5173. )
  5174. grid0.addWidget(self.pconstrain_cb, 5, 0, 1, 2)
  5175. self.px_width_entry = FCDoubleSpinner()
  5176. self.px_width_entry.set_range(0.000001, 9999.9999)
  5177. self.px_width_entry.set_precision(self.decimals)
  5178. self.px_width_entry.setSingleStep(0.1)
  5179. self.x_width_lbl = QtWidgets.QLabel('%s:' % _("Width (DX)"))
  5180. self.x_width_lbl.setToolTip(
  5181. _("The width (DX) within which the panel must fit.\n"
  5182. "In current units.")
  5183. )
  5184. grid0.addWidget(self.x_width_lbl, 6, 0)
  5185. grid0.addWidget(self.px_width_entry, 6, 1)
  5186. self.py_height_entry = FCDoubleSpinner()
  5187. self.py_height_entry.set_range(0.000001, 9999.9999)
  5188. self.py_height_entry.set_precision(self.decimals)
  5189. self.py_height_entry.setSingleStep(0.1)
  5190. self.y_height_lbl = QtWidgets.QLabel('%s:' % _("Height (DY)"))
  5191. self.y_height_lbl.setToolTip(
  5192. _("The height (DY)within which the panel must fit.\n"
  5193. "In current units.")
  5194. )
  5195. grid0.addWidget(self.y_height_lbl, 7, 0)
  5196. grid0.addWidget(self.py_height_entry, 7, 1)
  5197. self.layout.addStretch()
  5198. class ToolsCalculatorsPrefGroupUI(OptionsGroupUI):
  5199. def __init__(self, decimals=4, parent=None):
  5200. # OptionsGroupUI.__init__(self, "Calculators Tool Options", parent=parent)
  5201. super(ToolsCalculatorsPrefGroupUI, self).__init__(self)
  5202. self.setTitle(str(_("Calculators Tool Options")))
  5203. self.decimals = decimals
  5204. # ## V-shape Calculator Tool
  5205. self.vshape_tool_label = QtWidgets.QLabel("<b>%s:</b>" % _("V-Shape Tool Calculator"))
  5206. self.vshape_tool_label.setToolTip(
  5207. _("Calculate the tool diameter for a given V-shape tool,\n"
  5208. "having the tip diameter, tip angle and\n"
  5209. "depth-of-cut as parameters.")
  5210. )
  5211. self.layout.addWidget(self.vshape_tool_label)
  5212. grid0 = QtWidgets.QGridLayout()
  5213. grid0.setColumnStretch(0, 0)
  5214. grid0.setColumnStretch(1, 1)
  5215. self.layout.addLayout(grid0)
  5216. # ## Tip Diameter
  5217. self.tip_dia_entry = FCDoubleSpinner()
  5218. self.tip_dia_entry.set_range(0.000001, 9999.9999)
  5219. self.tip_dia_entry.set_precision(self.decimals)
  5220. self.tip_dia_entry.setSingleStep(0.1)
  5221. self.tip_dia_label = QtWidgets.QLabel('%s:' % _("Tip Diameter"))
  5222. self.tip_dia_label.setToolTip(
  5223. _("This is the tool tip diameter.\n"
  5224. "It is specified by manufacturer.")
  5225. )
  5226. grid0.addWidget(self.tip_dia_label, 0, 0)
  5227. grid0.addWidget(self.tip_dia_entry, 0, 1)
  5228. # ## Tip angle
  5229. self.tip_angle_entry = FCDoubleSpinner()
  5230. self.tip_angle_entry.set_range(0.0, 180.0)
  5231. self.tip_angle_entry.set_precision(self.decimals)
  5232. self.tip_angle_entry.setSingleStep(5)
  5233. self.tip_angle_label = QtWidgets.QLabel('%s:' % _("Tip Angle"))
  5234. self.tip_angle_label.setToolTip(
  5235. _("This is the angle on the tip of the tool.\n"
  5236. "It is specified by manufacturer.")
  5237. )
  5238. grid0.addWidget(self.tip_angle_label, 1, 0)
  5239. grid0.addWidget(self.tip_angle_entry, 1, 1)
  5240. # ## Depth-of-cut Cut Z
  5241. self.cut_z_entry = FCDoubleSpinner()
  5242. self.cut_z_entry.set_range(-9999.9999, 0.0000)
  5243. self.cut_z_entry.set_precision(self.decimals)
  5244. self.cut_z_entry.setSingleStep(0.01)
  5245. self.cut_z_label = QtWidgets.QLabel('%s:' % _("Cut Z"))
  5246. self.cut_z_label.setToolTip(
  5247. _("This is depth to cut into material.\n"
  5248. "In the CNCJob object it is the CutZ parameter.")
  5249. )
  5250. grid0.addWidget(self.cut_z_label, 2, 0)
  5251. grid0.addWidget(self.cut_z_entry, 2, 1)
  5252. # ## Electroplating Calculator Tool
  5253. self.plate_title_label = QtWidgets.QLabel("<b>%s:</b>" % _("ElectroPlating Calculator"))
  5254. self.plate_title_label.setToolTip(
  5255. _("This calculator is useful for those who plate the via/pad/drill holes,\n"
  5256. "using a method like grahite ink or calcium hypophosphite ink or palladium chloride.")
  5257. )
  5258. grid0.addWidget(self.plate_title_label, 3, 0, 1, 2)
  5259. # ## PCB Length
  5260. self.pcblength_entry = FCDoubleSpinner()
  5261. self.pcblength_entry.set_range(0.000001, 9999.9999)
  5262. self.pcblength_entry.set_precision(self.decimals)
  5263. self.pcblength_entry.setSingleStep(0.1)
  5264. self.pcblengthlabel = QtWidgets.QLabel('%s:' % _("Board Length"))
  5265. self.pcblengthlabel.setToolTip(_('This is the board length. In centimeters.'))
  5266. grid0.addWidget(self.pcblengthlabel, 4, 0)
  5267. grid0.addWidget(self.pcblength_entry, 4, 1)
  5268. # ## PCB Width
  5269. self.pcbwidth_entry = FCDoubleSpinner()
  5270. self.pcbwidth_entry.set_range(0.000001, 9999.9999)
  5271. self.pcbwidth_entry.set_precision(self.decimals)
  5272. self.pcbwidth_entry.setSingleStep(0.1)
  5273. self.pcbwidthlabel = QtWidgets.QLabel('%s:' % _("Board Width"))
  5274. self.pcbwidthlabel.setToolTip(_('This is the board width.In centimeters.'))
  5275. grid0.addWidget(self.pcbwidthlabel, 5, 0)
  5276. grid0.addWidget(self.pcbwidth_entry, 5, 1)
  5277. # ## Current Density
  5278. self.cdensity_label = QtWidgets.QLabel('%s:' % _("Current Density"))
  5279. self.cdensity_entry = FCDoubleSpinner()
  5280. self.cdensity_entry.set_range(0.000001, 9999.9999)
  5281. self.cdensity_entry.set_precision(self.decimals)
  5282. self.cdensity_entry.setSingleStep(0.1)
  5283. self.cdensity_label.setToolTip(_("Current density to pass through the board. \n"
  5284. "In Amps per Square Feet ASF."))
  5285. grid0.addWidget(self.cdensity_label, 6, 0)
  5286. grid0.addWidget(self.cdensity_entry, 6, 1)
  5287. # ## PCB Copper Growth
  5288. self.growth_label = QtWidgets.QLabel('%s:' % _("Copper Growth"))
  5289. self.growth_entry = FCDoubleSpinner()
  5290. self.growth_entry.set_range(0.000001, 9999.9999)
  5291. self.growth_entry.set_precision(self.decimals)
  5292. self.growth_entry.setSingleStep(0.01)
  5293. self.growth_label.setToolTip(_("How thick the copper growth is intended to be.\n"
  5294. "In microns."))
  5295. grid0.addWidget(self.growth_label, 7, 0)
  5296. grid0.addWidget(self.growth_entry, 7, 1)
  5297. self.layout.addStretch()
  5298. class ToolsTransformPrefGroupUI(OptionsGroupUI):
  5299. def __init__(self, decimals=4, parent=None):
  5300. super(ToolsTransformPrefGroupUI, self).__init__(self)
  5301. self.setTitle(str(_("Transform Tool Options")))
  5302. self.decimals = decimals
  5303. # ## Transformations
  5304. self.transform_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  5305. self.transform_label.setToolTip(
  5306. _("Various transformations that can be applied\n"
  5307. "on a FlatCAM object.")
  5308. )
  5309. self.layout.addWidget(self.transform_label)
  5310. grid0 = QtWidgets.QGridLayout()
  5311. self.layout.addLayout(grid0)
  5312. grid0.setColumnStretch(0, 0)
  5313. grid0.setColumnStretch(1, 1)
  5314. # ## Rotate Angle
  5315. rotate_title_lbl = QtWidgets.QLabel('<b>%s</b>' % _("Rotate"))
  5316. grid0.addWidget(rotate_title_lbl, 0, 0, 1, 2)
  5317. self.rotate_entry = FCDoubleSpinner()
  5318. self.rotate_entry.set_range(-360.0, 360.0)
  5319. self.rotate_entry.set_precision(self.decimals)
  5320. self.rotate_entry.setSingleStep(15)
  5321. self.rotate_label = QtWidgets.QLabel('%s:' % _("Angle"))
  5322. self.rotate_label.setToolTip(
  5323. _("Angle for Rotation action, in degrees.\n"
  5324. "Float number between -360 and 359.\n"
  5325. "Positive numbers for CW motion.\n"
  5326. "Negative numbers for CCW motion.")
  5327. )
  5328. grid0.addWidget(self.rotate_label, 1, 0)
  5329. grid0.addWidget(self.rotate_entry, 1, 1)
  5330. # ## Skew/Shear Angle on X axis
  5331. skew_title_lbl = QtWidgets.QLabel('<b>%s</b>' % _("Skew"))
  5332. grid0.addWidget(skew_title_lbl, 2, 0, 1, 2)
  5333. self.skewx_entry = FCDoubleSpinner()
  5334. self.skewx_entry.set_range(-360.0, 360.0)
  5335. self.skewx_entry.set_precision(self.decimals)
  5336. self.skewx_entry.setSingleStep(0.1)
  5337. self.skewx_label = QtWidgets.QLabel('%s:' % _("X angle"))
  5338. self.skewx_label.setToolTip(
  5339. _("Angle for Skew action, in degrees.\n"
  5340. "Float number between -360 and 359.")
  5341. )
  5342. grid0.addWidget(self.skewx_label, 3, 0)
  5343. grid0.addWidget(self.skewx_entry, 3, 1)
  5344. # ## Skew/Shear Angle on Y axis
  5345. self.skewy_entry = FCDoubleSpinner()
  5346. self.skewy_entry.set_range(-360.0, 360.0)
  5347. self.skewy_entry.set_precision(self.decimals)
  5348. self.skewy_entry.setSingleStep(0.1)
  5349. self.skewy_label = QtWidgets.QLabel('%s:' % _("Y angle"))
  5350. self.skewy_label.setToolTip(
  5351. _("Angle for Skew action, in degrees.\n"
  5352. "Float number between -360 and 359.")
  5353. )
  5354. grid0.addWidget(self.skewy_label, 4, 0)
  5355. grid0.addWidget(self.skewy_entry, 4, 1)
  5356. # ## Scale
  5357. scale_title_lbl = QtWidgets.QLabel('<b>%s</b>' % _("Scale"))
  5358. grid0.addWidget(scale_title_lbl, 5, 0, 1, 2)
  5359. self.scalex_entry = FCDoubleSpinner()
  5360. self.scalex_entry.set_range(0, 9999.9999)
  5361. self.scalex_entry.set_precision(self.decimals)
  5362. self.scalex_entry.setSingleStep(0.1)
  5363. self.scalex_label = QtWidgets.QLabel('%s:' % _("X factor"))
  5364. self.scalex_label.setToolTip(
  5365. _("Factor for scaling on X axis.")
  5366. )
  5367. grid0.addWidget(self.scalex_label, 6, 0)
  5368. grid0.addWidget(self.scalex_entry, 6, 1)
  5369. # ## Scale factor on X axis
  5370. self.scaley_entry = FCDoubleSpinner()
  5371. self.scaley_entry.set_range(0, 9999.9999)
  5372. self.scaley_entry.set_precision(self.decimals)
  5373. self.scaley_entry.setSingleStep(0.1)
  5374. self.scaley_label = QtWidgets.QLabel('%s:' % _("Y factor"))
  5375. self.scaley_label.setToolTip(
  5376. _("Factor for scaling on Y axis.")
  5377. )
  5378. grid0.addWidget(self.scaley_label, 7, 0)
  5379. grid0.addWidget(self.scaley_entry, 7, 1)
  5380. # ## Link Scale factors
  5381. self.link_cb = FCCheckBox(_("Link"))
  5382. self.link_cb.setToolTip(
  5383. _("Scale the selected object(s)\n"
  5384. "using the Scale_X factor for both axis.")
  5385. )
  5386. grid0.addWidget(self.link_cb, 8, 0)
  5387. # ## Scale Reference
  5388. self.reference_cb = FCCheckBox('%s' % _("Scale Reference"))
  5389. self.reference_cb.setToolTip(
  5390. _("Scale the selected object(s)\n"
  5391. "using the origin reference when checked,\n"
  5392. "and the center of the biggest bounding box\n"
  5393. "of the selected objects when unchecked.")
  5394. )
  5395. grid0.addWidget(self.reference_cb, 8, 1)
  5396. # ## Offset
  5397. offset_title_lbl = QtWidgets.QLabel('<b>%s</b>' % _("Offset"))
  5398. grid0.addWidget(offset_title_lbl, 9, 0, 1, 2)
  5399. self.offx_entry = FCDoubleSpinner()
  5400. self.offx_entry.set_range(-9999.9999, 9999.9999)
  5401. self.offx_entry.set_precision(self.decimals)
  5402. self.offx_entry.setSingleStep(0.1)
  5403. self.offx_label = QtWidgets.QLabel('%s:' % _("X val"))
  5404. self.offx_label.setToolTip(
  5405. _("Distance to offset on X axis. In current units.")
  5406. )
  5407. grid0.addWidget(self.offx_label, 10, 0)
  5408. grid0.addWidget(self.offx_entry, 10, 1)
  5409. # ## Offset distance on Y axis
  5410. self.offy_entry = FCDoubleSpinner()
  5411. self.offy_entry.set_range(-9999.9999, 9999.9999)
  5412. self.offy_entry.set_precision(self.decimals)
  5413. self.offy_entry.setSingleStep(0.1)
  5414. self.offy_label = QtWidgets.QLabel('%s:' % _("Y val"))
  5415. self.offy_label.setToolTip(
  5416. _("Distance to offset on Y axis. In current units.")
  5417. )
  5418. grid0.addWidget(self.offy_label, 11, 0)
  5419. grid0.addWidget(self.offy_entry, 11, 1)
  5420. # ## Mirror
  5421. mirror_title_lbl = QtWidgets.QLabel('<b>%s</b>' % _("Mirror"))
  5422. grid0.addWidget(mirror_title_lbl, 12, 0, 1, 2)
  5423. # ## Mirror (Flip) Reference Point
  5424. self.mirror_reference_cb = FCCheckBox('%s' % _("Mirror Reference"))
  5425. self.mirror_reference_cb.setToolTip(
  5426. _("Flip the selected object(s)\n"
  5427. "around the point in Point Entry Field.\n"
  5428. "\n"
  5429. "The point coordinates can be captured by\n"
  5430. "left click on canvas together with pressing\n"
  5431. "SHIFT key. \n"
  5432. "Then click Add button to insert coordinates.\n"
  5433. "Or enter the coords in format (x, y) in the\n"
  5434. "Point Entry field and click Flip on X(Y)"))
  5435. grid0.addWidget(self.mirror_reference_cb, 13, 0, 1, 2)
  5436. self.flip_ref_label = QtWidgets.QLabel('%s' % _("Mirror Reference point"))
  5437. self.flip_ref_label.setToolTip(
  5438. _("Coordinates in format (x, y) used as reference for mirroring.\n"
  5439. "The 'x' in (x, y) will be used when using Flip on X and\n"
  5440. "the 'y' in (x, y) will be used when using Flip on Y and")
  5441. )
  5442. self.flip_ref_entry = EvalEntry2("(0, 0)")
  5443. grid0.addWidget(self.flip_ref_label, 14, 0, 1, 2)
  5444. grid0.addWidget(self.flip_ref_entry, 15, 0, 1, 2)
  5445. # ## Buffer
  5446. buffer_title_lbl = QtWidgets.QLabel('<b>%s</b>' % _("Buffer"))
  5447. grid0.addWidget(buffer_title_lbl, 16, 0, 1, 2)
  5448. self.buffer_label = QtWidgets.QLabel('%s:' % _("Distance"))
  5449. self.buffer_label.setToolTip(
  5450. _("A positive value will create the effect of dilation,\n"
  5451. "while a negative value will create the effect of erosion.\n"
  5452. "Each geometry element of the object will be increased\n"
  5453. "or decreased with the 'distance'.")
  5454. )
  5455. self.buffer_entry = FCDoubleSpinner()
  5456. self.buffer_entry.set_precision(self.decimals)
  5457. self.buffer_entry.setSingleStep(0.1)
  5458. self.buffer_entry.setWrapping(True)
  5459. self.buffer_entry.set_range(-9999.9999, 9999.9999)
  5460. grid0.addWidget(self.buffer_label, 17, 0)
  5461. grid0.addWidget(self.buffer_entry, 17, 1)
  5462. self.buffer_factor_label = QtWidgets.QLabel('%s:' % _("Value"))
  5463. self.buffer_factor_label.setToolTip(
  5464. _("A positive value will create the effect of dilation,\n"
  5465. "while a negative value will create the effect of erosion.\n"
  5466. "Each geometry element of the object will be increased\n"
  5467. "or decreased to fit the 'Value'. Value is a percentage\n"
  5468. "of the initial dimension.")
  5469. )
  5470. self.buffer_factor_entry = FCDoubleSpinner(suffix='%')
  5471. self.buffer_factor_entry.set_range(-100.0000, 1000.0000)
  5472. self.buffer_factor_entry.set_precision(self.decimals)
  5473. self.buffer_factor_entry.setWrapping(True)
  5474. self.buffer_factor_entry.setSingleStep(1)
  5475. grid0.addWidget(self.buffer_factor_label, 18, 0)
  5476. grid0.addWidget(self.buffer_factor_entry, 18, 1)
  5477. self.buffer_rounded_cb = FCCheckBox()
  5478. self.buffer_rounded_cb.setText('%s' % _("Rounded"))
  5479. self.buffer_rounded_cb.setToolTip(
  5480. _("If checked then the buffer will surround the buffered shape,\n"
  5481. "every corner will be rounded.\n"
  5482. "If not checked then the buffer will follow the exact geometry\n"
  5483. "of the buffered shape.")
  5484. )
  5485. grid0.addWidget(self.buffer_rounded_cb, 19, 0, 1, 2)
  5486. self.layout.addStretch()
  5487. class ToolsSolderpastePrefGroupUI(OptionsGroupUI):
  5488. def __init__(self, decimals=4, parent=None):
  5489. super(ToolsSolderpastePrefGroupUI, self).__init__(self)
  5490. self.setTitle(str(_("SolderPaste Tool Options")))
  5491. self.decimals = decimals
  5492. # ## Solder Paste Dispensing
  5493. self.solderpastelabel = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  5494. self.solderpastelabel.setToolTip(
  5495. _("A tool to create GCode for dispensing\n"
  5496. "solder paste onto a PCB.")
  5497. )
  5498. self.layout.addWidget(self.solderpastelabel)
  5499. grid0 = QtWidgets.QGridLayout()
  5500. self.layout.addLayout(grid0)
  5501. # Nozzle Tool Diameters
  5502. nozzletdlabel = QtWidgets.QLabel('<b><font color="green">%s:</font></b>' % _('Tools Dia'))
  5503. nozzletdlabel.setToolTip(
  5504. _("Diameters of the tools, separated by comma.\n"
  5505. "The value of the diameter has to use the dot decimals separator.\n"
  5506. "Valid values: 0.3, 1.0")
  5507. )
  5508. self.nozzle_tool_dia_entry = FCEntry()
  5509. grid0.addWidget(nozzletdlabel, 0, 0)
  5510. grid0.addWidget(self.nozzle_tool_dia_entry, 0, 1)
  5511. # New Nozzle Tool Dia
  5512. self.addtool_entry_lbl = QtWidgets.QLabel('<b>%s:</b>' % _('New Nozzle Dia'))
  5513. self.addtool_entry_lbl.setToolTip(
  5514. _("Diameter for the new Nozzle tool to add in the Tool Table")
  5515. )
  5516. self.addtool_entry = FCDoubleSpinner()
  5517. self.addtool_entry.set_precision(self.decimals)
  5518. self.addtool_entry.set_range(0.0000001, 9999.9999)
  5519. self.addtool_entry.setSingleStep(0.1)
  5520. grid0.addWidget(self.addtool_entry_lbl, 1, 0)
  5521. grid0.addWidget(self.addtool_entry, 1, 1)
  5522. # Z dispense start
  5523. self.z_start_entry = FCDoubleSpinner()
  5524. self.z_start_entry.set_precision(self.decimals)
  5525. self.z_start_entry.set_range(0.0000001, 9999.9999)
  5526. self.z_start_entry.setSingleStep(0.1)
  5527. self.z_start_label = QtWidgets.QLabel('%s:' % _("Z Dispense Start"))
  5528. self.z_start_label.setToolTip(
  5529. _("The height (Z) when solder paste dispensing starts.")
  5530. )
  5531. grid0.addWidget(self.z_start_label, 2, 0)
  5532. grid0.addWidget(self.z_start_entry, 2, 1)
  5533. # Z dispense
  5534. self.z_dispense_entry = FCDoubleSpinner()
  5535. self.z_dispense_entry.set_precision(self.decimals)
  5536. self.z_dispense_entry.set_range(0.0000001, 9999.9999)
  5537. self.z_dispense_entry.setSingleStep(0.1)
  5538. self.z_dispense_label = QtWidgets.QLabel('%s:' % _("Z Dispense"))
  5539. self.z_dispense_label.setToolTip(
  5540. _("The height (Z) when doing solder paste dispensing.")
  5541. )
  5542. grid0.addWidget(self.z_dispense_label, 3, 0)
  5543. grid0.addWidget(self.z_dispense_entry, 3, 1)
  5544. # Z dispense stop
  5545. self.z_stop_entry = FCDoubleSpinner()
  5546. self.z_stop_entry.set_precision(self.decimals)
  5547. self.z_stop_entry.set_range(0.0000001, 9999.9999)
  5548. self.z_stop_entry.setSingleStep(0.1)
  5549. self.z_stop_label = QtWidgets.QLabel('%s:' % _("Z Dispense Stop"))
  5550. self.z_stop_label.setToolTip(
  5551. _("The height (Z) when solder paste dispensing stops.")
  5552. )
  5553. grid0.addWidget(self.z_stop_label, 4, 0)
  5554. grid0.addWidget(self.z_stop_entry, 4, 1)
  5555. # Z travel
  5556. self.z_travel_entry = FCDoubleSpinner()
  5557. self.z_travel_entry.set_precision(self.decimals)
  5558. self.z_travel_entry.set_range(0.0000001, 9999.9999)
  5559. self.z_travel_entry.setSingleStep(0.1)
  5560. self.z_travel_label = QtWidgets.QLabel('%s:' % _("Z Travel"))
  5561. self.z_travel_label.setToolTip(
  5562. _("The height (Z) for travel between pads\n"
  5563. "(without dispensing solder paste).")
  5564. )
  5565. grid0.addWidget(self.z_travel_label, 5, 0)
  5566. grid0.addWidget(self.z_travel_entry, 5, 1)
  5567. # Z toolchange location
  5568. self.z_toolchange_entry = FCDoubleSpinner()
  5569. self.z_toolchange_entry.set_precision(self.decimals)
  5570. self.z_toolchange_entry.set_range(0.0000001, 9999.9999)
  5571. self.z_toolchange_entry.setSingleStep(0.1)
  5572. self.z_toolchange_label = QtWidgets.QLabel('%s:' % _("Z Toolchange"))
  5573. self.z_toolchange_label.setToolTip(
  5574. _("The height (Z) for tool (nozzle) change.")
  5575. )
  5576. grid0.addWidget(self.z_toolchange_label, 6, 0)
  5577. grid0.addWidget(self.z_toolchange_entry, 6, 1)
  5578. # X,Y Toolchange location
  5579. self.xy_toolchange_entry = FCEntry()
  5580. self.xy_toolchange_label = QtWidgets.QLabel('%s:' % _("Toolchange X-Y"))
  5581. self.xy_toolchange_label.setToolTip(
  5582. _("The X,Y location for tool (nozzle) change.\n"
  5583. "The format is (x, y) where x and y are real numbers.")
  5584. )
  5585. grid0.addWidget(self.xy_toolchange_label, 7, 0)
  5586. grid0.addWidget(self.xy_toolchange_entry, 7, 1)
  5587. # Feedrate X-Y
  5588. self.frxy_entry = FCDoubleSpinner()
  5589. self.frxy_entry.set_precision(self.decimals)
  5590. self.frxy_entry.set_range(0.0000001, 99999.9999)
  5591. self.frxy_entry.setSingleStep(0.1)
  5592. self.frxy_label = QtWidgets.QLabel('%s:' % _("Feedrate X-Y"))
  5593. self.frxy_label.setToolTip(
  5594. _("Feedrate (speed) while moving on the X-Y plane.")
  5595. )
  5596. grid0.addWidget(self.frxy_label, 8, 0)
  5597. grid0.addWidget(self.frxy_entry, 8, 1)
  5598. # Feedrate Z
  5599. self.frz_entry = FCDoubleSpinner()
  5600. self.frz_entry.set_precision(self.decimals)
  5601. self.frz_entry.set_range(0.0000001, 99999.9999)
  5602. self.frz_entry.setSingleStep(0.1)
  5603. self.frz_label = QtWidgets.QLabel('%s:' % _("Feedrate Z"))
  5604. self.frz_label.setToolTip(
  5605. _("Feedrate (speed) while moving vertically\n"
  5606. "(on Z plane).")
  5607. )
  5608. grid0.addWidget(self.frz_label, 9, 0)
  5609. grid0.addWidget(self.frz_entry, 9, 1)
  5610. # Feedrate Z Dispense
  5611. self.frz_dispense_entry = FCDoubleSpinner()
  5612. self.frz_dispense_entry.set_precision(self.decimals)
  5613. self.frz_dispense_entry.set_range(0.0000001, 99999.9999)
  5614. self.frz_dispense_entry.setSingleStep(0.1)
  5615. self.frz_dispense_label = QtWidgets.QLabel('%s:' % _("Feedrate Z Dispense"))
  5616. self.frz_dispense_label.setToolTip(
  5617. _("Feedrate (speed) while moving up vertically\n"
  5618. "to Dispense position (on Z plane).")
  5619. )
  5620. grid0.addWidget(self.frz_dispense_label, 10, 0)
  5621. grid0.addWidget(self.frz_dispense_entry, 10, 1)
  5622. # Spindle Speed Forward
  5623. self.speedfwd_entry = FCSpinner()
  5624. self.speedfwd_entry.set_range(0, 99999)
  5625. self.speedfwd_entry.set_step(1000)
  5626. self.speedfwd_label = QtWidgets.QLabel('%s:' % _("Spindle Speed FWD"))
  5627. self.speedfwd_label.setToolTip(
  5628. _("The dispenser speed while pushing solder paste\n"
  5629. "through the dispenser nozzle.")
  5630. )
  5631. grid0.addWidget(self.speedfwd_label, 11, 0)
  5632. grid0.addWidget(self.speedfwd_entry, 11, 1)
  5633. # Dwell Forward
  5634. self.dwellfwd_entry = FCDoubleSpinner()
  5635. self.dwellfwd_entry.set_precision(self.decimals)
  5636. self.dwellfwd_entry.set_range(0.0000001, 9999.9999)
  5637. self.dwellfwd_entry.setSingleStep(0.1)
  5638. self.dwellfwd_label = QtWidgets.QLabel('%s:' % _("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 = FCSpinner()
  5646. self.speedrev_entry.set_range(0, 999999)
  5647. self.speedrev_entry.set_step(1000)
  5648. self.speedrev_label = QtWidgets.QLabel('%s:' % _("Spindle Speed REV"))
  5649. self.speedrev_label.setToolTip(
  5650. _("The dispenser speed while retracting solder paste\n"
  5651. "through the dispenser nozzle.")
  5652. )
  5653. grid0.addWidget(self.speedrev_label, 13, 0)
  5654. grid0.addWidget(self.speedrev_entry, 13, 1)
  5655. # Dwell Reverse
  5656. self.dwellrev_entry = FCDoubleSpinner()
  5657. self.dwellrev_entry.set_precision(self.decimals)
  5658. self.dwellrev_entry.set_range(0.0000001, 9999.9999)
  5659. self.dwellrev_entry.setSingleStep(0.1)
  5660. self.dwellrev_label = QtWidgets.QLabel('%s:' % _("Dwell REV"))
  5661. self.dwellrev_label.setToolTip(
  5662. _("Pause after solder paste dispenser retracted,\n"
  5663. "to allow pressure equilibrium.")
  5664. )
  5665. grid0.addWidget(self.dwellrev_label, 14, 0)
  5666. grid0.addWidget(self.dwellrev_entry, 14, 1)
  5667. # Preprocessors
  5668. pp_label = QtWidgets.QLabel('%s:' % _('Preprocessor'))
  5669. pp_label.setToolTip(
  5670. _("Files that control the GCode generation.")
  5671. )
  5672. self.pp_combo = FCComboBox()
  5673. grid0.addWidget(pp_label, 15, 0)
  5674. grid0.addWidget(self.pp_combo, 15, 1)
  5675. self.layout.addStretch()
  5676. class ToolsSubPrefGroupUI(OptionsGroupUI):
  5677. def __init__(self, decimals=4, parent=None):
  5678. super(ToolsSubPrefGroupUI, self).__init__(self)
  5679. self.setTitle(str(_("Substractor Tool Options")))
  5680. self.decimals = decimals
  5681. # ## Subtractor Tool Parameters
  5682. self.sublabel = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  5683. self.sublabel.setToolTip(
  5684. _("A tool to substract one Gerber or Geometry object\n"
  5685. "from another of the same type.")
  5686. )
  5687. self.layout.addWidget(self.sublabel)
  5688. self.close_paths_cb = FCCheckBox(_("Close paths"))
  5689. self.close_paths_cb.setToolTip(_("Checking this will close the paths cut by the Geometry substractor object."))
  5690. self.layout.addWidget(self.close_paths_cb)
  5691. self.layout.addStretch()
  5692. class Tools2RulesCheckPrefGroupUI(OptionsGroupUI):
  5693. def __init__(self, decimals=4, parent=None):
  5694. super(Tools2RulesCheckPrefGroupUI, self).__init__(self)
  5695. self.setTitle(str(_("Check Rules Tool Options")))
  5696. self.decimals = decimals
  5697. self.crlabel = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  5698. self.crlabel.setToolTip(
  5699. _("A tool to check if Gerber files are within a set\n"
  5700. "of Manufacturing Rules.")
  5701. )
  5702. self.layout.addWidget(self.crlabel)
  5703. # Form Layout
  5704. self.form_layout_1 = QtWidgets.QFormLayout()
  5705. self.layout.addLayout(self.form_layout_1)
  5706. # Trace size
  5707. self.trace_size_cb = FCCheckBox('%s:' % _("Trace Size"))
  5708. self.trace_size_cb.setToolTip(
  5709. _("This checks if the minimum size for traces is met.")
  5710. )
  5711. self.form_layout_1.addRow(self.trace_size_cb)
  5712. # Trace size value
  5713. self.trace_size_entry = FCDoubleSpinner()
  5714. self.trace_size_entry.set_range(0.00001, 999.99999)
  5715. self.trace_size_entry.set_precision(self.decimals)
  5716. self.trace_size_entry.setSingleStep(0.1)
  5717. self.trace_size_lbl = QtWidgets.QLabel('%s:' % _("Min value"))
  5718. self.trace_size_lbl.setToolTip(
  5719. _("Minimum acceptable trace size.")
  5720. )
  5721. self.form_layout_1.addRow(self.trace_size_lbl, self.trace_size_entry)
  5722. # Copper2copper clearance
  5723. self.clearance_copper2copper_cb = FCCheckBox('%s:' % _("Copper to Copper clearance"))
  5724. self.clearance_copper2copper_cb.setToolTip(
  5725. _("This checks if the minimum clearance between copper\n"
  5726. "features is met.")
  5727. )
  5728. self.form_layout_1.addRow(self.clearance_copper2copper_cb)
  5729. # Copper2copper clearance value
  5730. self.clearance_copper2copper_entry = FCDoubleSpinner()
  5731. self.clearance_copper2copper_entry.set_range(0.00001, 999.99999)
  5732. self.clearance_copper2copper_entry.set_precision(self.decimals)
  5733. self.clearance_copper2copper_entry.setSingleStep(0.1)
  5734. self.clearance_copper2copper_lbl = QtWidgets.QLabel('%s:' % _("Min value"))
  5735. self.clearance_copper2copper_lbl.setToolTip(
  5736. _("Minimum acceptable clearance value.")
  5737. )
  5738. self.form_layout_1.addRow(self.clearance_copper2copper_lbl, self.clearance_copper2copper_entry)
  5739. # Copper2outline clearance
  5740. self.clearance_copper2ol_cb = FCCheckBox('%s:' % _("Copper to Outline clearance"))
  5741. self.clearance_copper2ol_cb.setToolTip(
  5742. _("This checks if the minimum clearance between copper\n"
  5743. "features and the outline is met.")
  5744. )
  5745. self.form_layout_1.addRow(self.clearance_copper2ol_cb)
  5746. # Copper2outline clearance value
  5747. self.clearance_copper2ol_entry = FCDoubleSpinner()
  5748. self.clearance_copper2ol_entry.set_range(0.00001, 999.99999)
  5749. self.clearance_copper2ol_entry.set_precision(self.decimals)
  5750. self.clearance_copper2ol_entry.setSingleStep(0.1)
  5751. self.clearance_copper2ol_lbl = QtWidgets.QLabel('%s:' % _("Min value"))
  5752. self.clearance_copper2ol_lbl.setToolTip(
  5753. _("Minimum acceptable clearance value.")
  5754. )
  5755. self.form_layout_1.addRow(self.clearance_copper2ol_lbl, self.clearance_copper2ol_entry)
  5756. # Silkscreen2silkscreen clearance
  5757. self.clearance_silk2silk_cb = FCCheckBox('%s:' % _("Silk to Silk Clearance"))
  5758. self.clearance_silk2silk_cb.setToolTip(
  5759. _("This checks if the minimum clearance between silkscreen\n"
  5760. "features and silkscreen features is met.")
  5761. )
  5762. self.form_layout_1.addRow(self.clearance_silk2silk_cb)
  5763. # Copper2silkscreen clearance value
  5764. self.clearance_silk2silk_entry = FCDoubleSpinner()
  5765. self.clearance_silk2silk_entry.set_range(0.00001, 999.99999)
  5766. self.clearance_silk2silk_entry.set_precision(self.decimals)
  5767. self.clearance_silk2silk_entry.setSingleStep(0.1)
  5768. self.clearance_silk2silk_lbl = QtWidgets.QLabel('%s:' % _("Min value"))
  5769. self.clearance_silk2silk_lbl.setToolTip(
  5770. _("Minimum acceptable clearance value.")
  5771. )
  5772. self.form_layout_1.addRow(self.clearance_silk2silk_lbl, self.clearance_silk2silk_entry)
  5773. # Silkscreen2soldermask clearance
  5774. self.clearance_silk2sm_cb = FCCheckBox('%s:' % _("Silk to Solder Mask Clearance"))
  5775. self.clearance_silk2sm_cb.setToolTip(
  5776. _("This checks if the minimum clearance between silkscreen\n"
  5777. "features and soldermask features is met.")
  5778. )
  5779. self.form_layout_1.addRow(self.clearance_silk2sm_cb)
  5780. # Silkscreen2soldermask clearance value
  5781. self.clearance_silk2sm_entry = FCDoubleSpinner()
  5782. self.clearance_silk2sm_entry.set_range(0.00001, 999.99999)
  5783. self.clearance_silk2sm_entry.set_precision(self.decimals)
  5784. self.clearance_silk2sm_entry.setSingleStep(0.1)
  5785. self.clearance_silk2sm_lbl = QtWidgets.QLabel('%s:' % _("Min value"))
  5786. self.clearance_silk2sm_lbl.setToolTip(
  5787. _("Minimum acceptable clearance value.")
  5788. )
  5789. self.form_layout_1.addRow(self.clearance_silk2sm_lbl, self.clearance_silk2sm_entry)
  5790. # Silk2outline clearance
  5791. self.clearance_silk2ol_cb = FCCheckBox('%s:' % _("Silk to Outline Clearance"))
  5792. self.clearance_silk2ol_cb.setToolTip(
  5793. _("This checks if the minimum clearance between silk\n"
  5794. "features and the outline is met.")
  5795. )
  5796. self.form_layout_1.addRow(self.clearance_silk2ol_cb)
  5797. # Silk2outline clearance value
  5798. self.clearance_silk2ol_entry = FCDoubleSpinner()
  5799. self.clearance_silk2ol_entry.set_range(0.00001, 999.99999)
  5800. self.clearance_silk2ol_entry.set_precision(self.decimals)
  5801. self.clearance_silk2ol_entry.setSingleStep(0.1)
  5802. self.clearance_silk2ol_lbl = QtWidgets.QLabel('%s:' % _("Min value"))
  5803. self.clearance_silk2ol_lbl.setToolTip(
  5804. _("Minimum acceptable clearance value.")
  5805. )
  5806. self.form_layout_1.addRow(self.clearance_silk2ol_lbl, self.clearance_silk2ol_entry)
  5807. # Soldermask2soldermask clearance
  5808. self.clearance_sm2sm_cb = FCCheckBox('%s:' % _("Minimum Solder Mask Sliver"))
  5809. self.clearance_sm2sm_cb.setToolTip(
  5810. _("This checks if the minimum clearance between soldermask\n"
  5811. "features and soldermask features is met.")
  5812. )
  5813. self.form_layout_1.addRow(self.clearance_sm2sm_cb)
  5814. # Soldermask2soldermask clearance value
  5815. self.clearance_sm2sm_entry = FCDoubleSpinner()
  5816. self.clearance_sm2sm_entry.set_range(0.00001, 999.99999)
  5817. self.clearance_sm2sm_entry.set_precision(self.decimals)
  5818. self.clearance_sm2sm_entry.setSingleStep(0.1)
  5819. self.clearance_sm2sm_lbl = QtWidgets.QLabel('%s:' % _("Min value"))
  5820. self.clearance_sm2sm_lbl.setToolTip(
  5821. _("Minimum acceptable clearance value.")
  5822. )
  5823. self.form_layout_1.addRow(self.clearance_sm2sm_lbl, self.clearance_sm2sm_entry)
  5824. # Ring integrity check
  5825. self.ring_integrity_cb = FCCheckBox('%s:' % _("Minimum Annular Ring"))
  5826. self.ring_integrity_cb.setToolTip(
  5827. _("This checks if the minimum copper ring left by drilling\n"
  5828. "a hole into a pad is met.")
  5829. )
  5830. self.form_layout_1.addRow(self.ring_integrity_cb)
  5831. # Ring integrity value
  5832. self.ring_integrity_entry = FCDoubleSpinner()
  5833. self.ring_integrity_entry.set_range(0.00001, 999.99999)
  5834. self.ring_integrity_entry.set_precision(self.decimals)
  5835. self.ring_integrity_entry.setSingleStep(0.1)
  5836. self.ring_integrity_lbl = QtWidgets.QLabel('%s:' % _("Min value"))
  5837. self.ring_integrity_lbl.setToolTip(
  5838. _("Minimum acceptable ring value.")
  5839. )
  5840. self.form_layout_1.addRow(self.ring_integrity_lbl, self.ring_integrity_entry)
  5841. self.form_layout_1.addRow(QtWidgets.QLabel(""))
  5842. # Hole2Hole clearance
  5843. self.clearance_d2d_cb = FCCheckBox('%s:' % _("Hole to Hole Clearance"))
  5844. self.clearance_d2d_cb.setToolTip(
  5845. _("This checks if the minimum clearance between a drill hole\n"
  5846. "and another drill hole is met.")
  5847. )
  5848. self.form_layout_1.addRow(self.clearance_d2d_cb)
  5849. # Hole2Hole clearance value
  5850. self.clearance_d2d_entry = FCDoubleSpinner()
  5851. self.clearance_d2d_entry.set_range(0.00001, 999.99999)
  5852. self.clearance_d2d_entry.set_precision(self.decimals)
  5853. self.clearance_d2d_entry.setSingleStep(0.1)
  5854. self.clearance_d2d_lbl = QtWidgets.QLabel('%s:' % _("Min value"))
  5855. self.clearance_d2d_lbl.setToolTip(
  5856. _("Minimum acceptable drill size.")
  5857. )
  5858. self.form_layout_1.addRow(self.clearance_d2d_lbl, self.clearance_d2d_entry)
  5859. # Drill holes size check
  5860. self.drill_size_cb = FCCheckBox('%s:' % _("Hole Size"))
  5861. self.drill_size_cb.setToolTip(
  5862. _("This checks if the drill holes\n"
  5863. "sizes are above the threshold.")
  5864. )
  5865. self.form_layout_1.addRow(self.drill_size_cb)
  5866. # Drile holes value
  5867. self.drill_size_entry = FCDoubleSpinner()
  5868. self.drill_size_entry.set_range(0.00001, 999.99999)
  5869. self.drill_size_entry.set_precision(self.decimals)
  5870. self.drill_size_entry.setSingleStep(0.1)
  5871. self.drill_size_lbl = QtWidgets.QLabel('%s:' % _("Min value"))
  5872. self.drill_size_lbl.setToolTip(
  5873. _("Minimum acceptable clearance value.")
  5874. )
  5875. self.form_layout_1.addRow(self.drill_size_lbl, self.drill_size_entry)
  5876. self.layout.addStretch()
  5877. class Tools2OptimalPrefGroupUI(OptionsGroupUI):
  5878. def __init__(self, decimals=4, parent=None):
  5879. super(Tools2OptimalPrefGroupUI, self).__init__(self)
  5880. self.setTitle(str(_("Optimal Tool Options")))
  5881. self.decimals = decimals
  5882. # ## Parameters
  5883. self.optlabel = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  5884. self.optlabel.setToolTip(
  5885. _("A tool to find the minimum distance between\n"
  5886. "every two Gerber geometric elements")
  5887. )
  5888. self.layout.addWidget(self.optlabel)
  5889. grid0 = QtWidgets.QGridLayout()
  5890. self.layout.addLayout(grid0)
  5891. grid0.setColumnStretch(0, 0)
  5892. grid0.setColumnStretch(1, 1)
  5893. self.precision_sp = FCSpinner()
  5894. self.precision_sp.set_range(2, 10)
  5895. self.precision_sp.set_step(1)
  5896. self.precision_sp.setWrapping(True)
  5897. self.precision_lbl = QtWidgets.QLabel('%s:' % _("Precision"))
  5898. self.precision_lbl.setToolTip(
  5899. _("Number of decimals for the distances and coordinates in this tool.")
  5900. )
  5901. grid0.addWidget(self.precision_lbl, 0, 0)
  5902. grid0.addWidget(self.precision_sp, 0, 1)
  5903. self.layout.addStretch()
  5904. class Tools2QRCodePrefGroupUI(OptionsGroupUI):
  5905. def __init__(self, decimals=4, parent=None):
  5906. super(Tools2QRCodePrefGroupUI, self).__init__(self)
  5907. self.setTitle(str(_("QRCode Tool Options")))
  5908. self.decimals = decimals
  5909. # ## Parameters
  5910. self.qrlabel = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  5911. self.qrlabel.setToolTip(
  5912. _("A tool to create a QRCode that can be inserted\n"
  5913. "into a selected Gerber file, or it can be exported as a file.")
  5914. )
  5915. self.layout.addWidget(self.qrlabel)
  5916. # ## Grid Layout
  5917. grid_lay = QtWidgets.QGridLayout()
  5918. self.layout.addLayout(grid_lay)
  5919. grid_lay.setColumnStretch(0, 0)
  5920. grid_lay.setColumnStretch(1, 1)
  5921. # VERSION #
  5922. self.version_label = QtWidgets.QLabel('%s:' % _("Version"))
  5923. self.version_label.setToolTip(
  5924. _("QRCode version can have values from 1 (21x21 boxes)\n"
  5925. "to 40 (177x177 boxes).")
  5926. )
  5927. self.version_entry = FCSpinner()
  5928. self.version_entry.set_range(1, 40)
  5929. self.version_entry.setWrapping(True)
  5930. grid_lay.addWidget(self.version_label, 1, 0)
  5931. grid_lay.addWidget(self.version_entry, 1, 1)
  5932. # ERROR CORRECTION #
  5933. self.error_label = QtWidgets.QLabel('%s:' % _("Error correction"))
  5934. self.error_label.setToolTip(
  5935. _("Parameter that controls the error correction used for the QR Code.\n"
  5936. "L = maximum 7%% errors can be corrected\n"
  5937. "M = maximum 15%% errors can be corrected\n"
  5938. "Q = maximum 25%% errors can be corrected\n"
  5939. "H = maximum 30%% errors can be corrected.")
  5940. )
  5941. self.error_radio = RadioSet([{'label': 'L', 'value': 'L'},
  5942. {'label': 'M', 'value': 'M'},
  5943. {'label': 'Q', 'value': 'Q'},
  5944. {'label': 'H', 'value': 'H'}])
  5945. self.error_radio.setToolTip(
  5946. _("Parameter that controls the error correction used for the QR Code.\n"
  5947. "L = maximum 7%% errors can be corrected\n"
  5948. "M = maximum 15%% errors can be corrected\n"
  5949. "Q = maximum 25%% errors can be corrected\n"
  5950. "H = maximum 30%% errors can be corrected.")
  5951. )
  5952. grid_lay.addWidget(self.error_label, 2, 0)
  5953. grid_lay.addWidget(self.error_radio, 2, 1)
  5954. # BOX SIZE #
  5955. self.bsize_label = QtWidgets.QLabel('%s:' % _("Box Size"))
  5956. self.bsize_label.setToolTip(
  5957. _("Box size control the overall size of the QRcode\n"
  5958. "by adjusting the size of each box in the code.")
  5959. )
  5960. self.bsize_entry = FCSpinner()
  5961. self.bsize_entry.set_range(1, 9999)
  5962. self.bsize_entry.setWrapping(True)
  5963. grid_lay.addWidget(self.bsize_label, 3, 0)
  5964. grid_lay.addWidget(self.bsize_entry, 3, 1)
  5965. # BORDER SIZE #
  5966. self.border_size_label = QtWidgets.QLabel('%s:' % _("Border Size"))
  5967. self.border_size_label.setToolTip(
  5968. _("Size of the QRCode border. How many boxes thick is the border.\n"
  5969. "Default value is 4. The width of the clearance around the QRCode.")
  5970. )
  5971. self.border_size_entry = FCSpinner()
  5972. self.border_size_entry.set_range(1, 9999)
  5973. self.border_size_entry.setWrapping(True)
  5974. grid_lay.addWidget(self.border_size_label, 4, 0)
  5975. grid_lay.addWidget(self.border_size_entry, 4, 1)
  5976. # Text box
  5977. self.text_label = QtWidgets.QLabel('%s:' % _("QRCode Data"))
  5978. self.text_label.setToolTip(
  5979. _("QRCode Data. Alphanumeric text to be encoded in the QRCode.")
  5980. )
  5981. self.text_data = FCTextArea()
  5982. self.text_data.setPlaceholderText(
  5983. _("Add here the text to be included in the QRCode...")
  5984. )
  5985. grid_lay.addWidget(self.text_label, 5, 0)
  5986. grid_lay.addWidget(self.text_data, 6, 0, 1, 2)
  5987. # POLARITY CHOICE #
  5988. self.pol_label = QtWidgets.QLabel('%s:' % _("Polarity"))
  5989. self.pol_label.setToolTip(
  5990. _("Choose the polarity of the QRCode.\n"
  5991. "It can be drawn in a negative way (squares are clear)\n"
  5992. "or in a positive way (squares are opaque).")
  5993. )
  5994. self.pol_radio = RadioSet([{'label': _('Negative'), 'value': 'neg'},
  5995. {'label': _('Positive'), 'value': 'pos'}])
  5996. self.pol_radio.setToolTip(
  5997. _("Choose the type of QRCode to be created.\n"
  5998. "If added on a Silkscreen Gerber file the QRCode may\n"
  5999. "be added as positive. If it is added to a Copper Gerber\n"
  6000. "file then perhaps the QRCode can be added as negative.")
  6001. )
  6002. grid_lay.addWidget(self.pol_label, 7, 0)
  6003. grid_lay.addWidget(self.pol_radio, 7, 1)
  6004. # BOUNDING BOX TYPE #
  6005. self.bb_label = QtWidgets.QLabel('%s:' % _("Bounding Box"))
  6006. self.bb_label.setToolTip(
  6007. _("The bounding box, meaning the empty space that surrounds\n"
  6008. "the QRCode geometry, can have a rounded or a square shape.")
  6009. )
  6010. self.bb_radio = RadioSet([{'label': _('Rounded'), 'value': 'r'},
  6011. {'label': _('Square'), 'value': 's'}])
  6012. self.bb_radio.setToolTip(
  6013. _("The bounding box, meaning the empty space that surrounds\n"
  6014. "the QRCode geometry, can have a rounded or a square shape.")
  6015. )
  6016. grid_lay.addWidget(self.bb_label, 8, 0)
  6017. grid_lay.addWidget(self.bb_radio, 8, 1)
  6018. # FILL COLOR #
  6019. self.fill_color_label = QtWidgets.QLabel('%s:' % _('Fill Color'))
  6020. self.fill_color_label.setToolTip(
  6021. _("Set the QRCode fill color (squares color).")
  6022. )
  6023. self.fill_color_entry = FCEntry()
  6024. self.fill_color_button = QtWidgets.QPushButton()
  6025. self.fill_color_button.setFixedSize(15, 15)
  6026. fill_lay_child = QtWidgets.QHBoxLayout()
  6027. fill_lay_child.setContentsMargins(0, 0, 0, 0)
  6028. fill_lay_child.addWidget(self.fill_color_entry)
  6029. fill_lay_child.addWidget(self.fill_color_button, alignment=Qt.AlignRight)
  6030. fill_lay_child.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  6031. fill_color_widget = QtWidgets.QWidget()
  6032. fill_color_widget.setLayout(fill_lay_child)
  6033. grid_lay.addWidget(self.fill_color_label, 9, 0)
  6034. grid_lay.addWidget(fill_color_widget, 9, 1)
  6035. # BACK COLOR #
  6036. self.back_color_label = QtWidgets.QLabel('%s:' % _('Back Color'))
  6037. self.back_color_label.setToolTip(
  6038. _("Set the QRCode background color.")
  6039. )
  6040. self.back_color_entry = FCEntry()
  6041. self.back_color_button = QtWidgets.QPushButton()
  6042. self.back_color_button.setFixedSize(15, 15)
  6043. back_lay_child = QtWidgets.QHBoxLayout()
  6044. back_lay_child.setContentsMargins(0, 0, 0, 0)
  6045. back_lay_child.addWidget(self.back_color_entry)
  6046. back_lay_child.addWidget(self.back_color_button, alignment=Qt.AlignRight)
  6047. back_lay_child.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  6048. back_color_widget = QtWidgets.QWidget()
  6049. back_color_widget.setLayout(back_lay_child)
  6050. grid_lay.addWidget(self.back_color_label, 10, 0)
  6051. grid_lay.addWidget(back_color_widget, 10, 1)
  6052. # Selection Limit
  6053. self.sel_limit_label = QtWidgets.QLabel('%s:' % _("Selection limit"))
  6054. self.sel_limit_label.setToolTip(
  6055. _("Set the number of selected geometry\n"
  6056. "items above which the utility geometry\n"
  6057. "becomes just a selection rectangle.\n"
  6058. "Increases the performance when moving a\n"
  6059. "large number of geometric elements.")
  6060. )
  6061. self.sel_limit_entry = FCSpinner()
  6062. self.sel_limit_entry.set_range(0, 9999)
  6063. grid_lay.addWidget(self.sel_limit_label, 11, 0)
  6064. grid_lay.addWidget(self.sel_limit_entry, 11, 1)
  6065. # self.layout.addStretch()
  6066. class Tools2CThievingPrefGroupUI(OptionsGroupUI):
  6067. def __init__(self, decimals=4, parent=None):
  6068. super(Tools2CThievingPrefGroupUI, self).__init__(self)
  6069. self.setTitle(str(_("Copper Thieving Tool Options")))
  6070. self.decimals = decimals
  6071. # ## Grid Layout
  6072. grid_lay = QtWidgets.QGridLayout()
  6073. self.layout.addLayout(grid_lay)
  6074. grid_lay.setColumnStretch(0, 0)
  6075. grid_lay.setColumnStretch(1, 1)
  6076. # ## Parameters
  6077. self.cflabel = QtWidgets.QLabel('<b>%s</b>' % _('Parameters'))
  6078. self.cflabel.setToolTip(
  6079. _("A tool to generate a Copper Thieving that can be added\n"
  6080. "to a selected Gerber file.")
  6081. )
  6082. grid_lay.addWidget(self.cflabel, 0, 0, 1, 2)
  6083. # CIRCLE STEPS - to be used when buffering
  6084. self.circle_steps_lbl = QtWidgets.QLabel('%s:' % _("Circle Steps"))
  6085. self.circle_steps_lbl.setToolTip(
  6086. _("Number of steps (lines) used to interpolate circles.")
  6087. )
  6088. self.circlesteps_entry = FCSpinner()
  6089. self.circlesteps_entry.set_range(1, 9999)
  6090. grid_lay.addWidget(self.circle_steps_lbl, 1, 0)
  6091. grid_lay.addWidget(self.circlesteps_entry, 1, 1)
  6092. # CLEARANCE #
  6093. self.clearance_label = QtWidgets.QLabel('%s:' % _("Clearance"))
  6094. self.clearance_label.setToolTip(
  6095. _("This set the distance between the copper Thieving components\n"
  6096. "(the polygon fill may be split in multiple polygons)\n"
  6097. "and the copper traces in the Gerber file.")
  6098. )
  6099. self.clearance_entry = FCDoubleSpinner()
  6100. self.clearance_entry.setMinimum(0.00001)
  6101. self.clearance_entry.set_precision(self.decimals)
  6102. self.clearance_entry.setSingleStep(0.1)
  6103. grid_lay.addWidget(self.clearance_label, 2, 0)
  6104. grid_lay.addWidget(self.clearance_entry, 2, 1)
  6105. # MARGIN #
  6106. self.margin_label = QtWidgets.QLabel('%s:' % _("Margin"))
  6107. self.margin_label.setToolTip(
  6108. _("Bounding box margin.")
  6109. )
  6110. self.margin_entry = FCDoubleSpinner()
  6111. self.margin_entry.setMinimum(0.0)
  6112. self.margin_entry.set_precision(self.decimals)
  6113. self.margin_entry.setSingleStep(0.1)
  6114. grid_lay.addWidget(self.margin_label, 3, 0)
  6115. grid_lay.addWidget(self.margin_entry, 3, 1)
  6116. # Reference #
  6117. self.reference_radio = RadioSet([
  6118. {'label': _('Itself'), 'value': 'itself'},
  6119. {"label": _("Area Selection"), "value": "area"},
  6120. {'label': _("Reference Object"), 'value': 'box'}
  6121. ], orientation='vertical', stretch=False)
  6122. self.reference_label = QtWidgets.QLabel(_("Reference:"))
  6123. self.reference_label.setToolTip(
  6124. _("- 'Itself' - the copper Thieving extent is based on the object extent.\n"
  6125. "- 'Area Selection' - left mouse click to start selection of the area to be filled.\n"
  6126. "- 'Reference Object' - will do copper thieving within the area specified by another object.")
  6127. )
  6128. grid_lay.addWidget(self.reference_label, 4, 0)
  6129. grid_lay.addWidget(self.reference_radio, 4, 1)
  6130. # Bounding Box Type #
  6131. self.bbox_type_radio = RadioSet([
  6132. {'label': _('Rectangular'), 'value': 'rect'},
  6133. {"label": _("Minimal"), "value": "min"}
  6134. ], stretch=False)
  6135. self.bbox_type_label = QtWidgets.QLabel(_("Box Type:"))
  6136. self.bbox_type_label.setToolTip(
  6137. _("- 'Rectangular' - the bounding box will be of rectangular shape.\n"
  6138. "- 'Minimal' - the bounding box will be the convex hull shape.")
  6139. )
  6140. grid_lay.addWidget(self.bbox_type_label, 5, 0)
  6141. grid_lay.addWidget(self.bbox_type_radio, 5, 1)
  6142. separator_line = QtWidgets.QFrame()
  6143. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  6144. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  6145. grid_lay.addWidget(separator_line, 6, 0, 1, 2)
  6146. # Fill Type
  6147. self.fill_type_radio = RadioSet([
  6148. {'label': _('Solid'), 'value': 'solid'},
  6149. {"label": _("Dots Grid"), "value": "dot"},
  6150. {"label": _("Squares Grid"), "value": "square"},
  6151. {"label": _("Lines Grid"), "value": "line"}
  6152. ], orientation='vertical', stretch=False)
  6153. self.fill_type_label = QtWidgets.QLabel(_("Fill Type:"))
  6154. self.fill_type_label.setToolTip(
  6155. _("- 'Solid' - copper thieving will be a solid polygon.\n"
  6156. "- 'Dots Grid' - the empty area will be filled with a pattern of dots.\n"
  6157. "- 'Squares Grid' - the empty area will be filled with a pattern of squares.\n"
  6158. "- 'Lines Grid' - the empty area will be filled with a pattern of lines.")
  6159. )
  6160. grid_lay.addWidget(self.fill_type_label, 7, 0)
  6161. grid_lay.addWidget(self.fill_type_radio, 7, 1)
  6162. self.dots_label = QtWidgets.QLabel('<b>%s</b>:' % _("Dots Grid Parameters"))
  6163. grid_lay.addWidget(self.dots_label, 8, 0, 1, 2)
  6164. # Dot diameter #
  6165. self.dotdia_label = QtWidgets.QLabel('%s:' % _("Dia"))
  6166. self.dotdia_label.setToolTip(
  6167. _("Dot diameter in Dots Grid.")
  6168. )
  6169. self.dot_dia_entry = FCDoubleSpinner()
  6170. self.dot_dia_entry.set_range(0.0, 9999.9999)
  6171. self.dot_dia_entry.set_precision(self.decimals)
  6172. self.dot_dia_entry.setSingleStep(0.1)
  6173. grid_lay.addWidget(self.dotdia_label, 9, 0)
  6174. grid_lay.addWidget(self.dot_dia_entry, 9, 1)
  6175. # Dot spacing #
  6176. self.dotspacing_label = QtWidgets.QLabel('%s:' % _("Spacing"))
  6177. self.dotspacing_label.setToolTip(
  6178. _("Distance between each two dots in Dots Grid.")
  6179. )
  6180. self.dot_spacing_entry = FCDoubleSpinner()
  6181. self.dot_spacing_entry.set_range(0.0, 9999.9999)
  6182. self.dot_spacing_entry.set_precision(self.decimals)
  6183. self.dot_spacing_entry.setSingleStep(0.1)
  6184. grid_lay.addWidget(self.dotspacing_label, 10, 0)
  6185. grid_lay.addWidget(self.dot_spacing_entry, 10, 1)
  6186. self.squares_label = QtWidgets.QLabel('<b>%s</b>:' % _("Squares Grid Parameters"))
  6187. grid_lay.addWidget(self.squares_label, 11, 0, 1, 2)
  6188. # Square Size #
  6189. self.square_size_label = QtWidgets.QLabel('%s:' % _("Size"))
  6190. self.square_size_label.setToolTip(
  6191. _("Square side size in Squares Grid.")
  6192. )
  6193. self.square_size_entry = FCDoubleSpinner()
  6194. self.square_size_entry.set_range(0.0, 9999.9999)
  6195. self.square_size_entry.set_precision(self.decimals)
  6196. self.square_size_entry.setSingleStep(0.1)
  6197. grid_lay.addWidget(self.square_size_label, 12, 0)
  6198. grid_lay.addWidget(self.square_size_entry, 12, 1)
  6199. # Squares spacing #
  6200. self.squares_spacing_label = QtWidgets.QLabel('%s:' % _("Spacing"))
  6201. self.squares_spacing_label.setToolTip(
  6202. _("Distance between each two squares in Squares Grid.")
  6203. )
  6204. self.squares_spacing_entry = FCDoubleSpinner()
  6205. self.squares_spacing_entry.set_range(0.0, 9999.9999)
  6206. self.squares_spacing_entry.set_precision(self.decimals)
  6207. self.squares_spacing_entry.setSingleStep(0.1)
  6208. grid_lay.addWidget(self.squares_spacing_label, 13, 0)
  6209. grid_lay.addWidget(self.squares_spacing_entry, 13, 1)
  6210. self.lines_label = QtWidgets.QLabel('<b>%s</b>:' % _("Lines Grid Parameters"))
  6211. grid_lay.addWidget(self.lines_label, 14, 0, 1, 2)
  6212. # Square Size #
  6213. self.line_size_label = QtWidgets.QLabel('%s:' % _("Size"))
  6214. self.line_size_label.setToolTip(
  6215. _("Line thickness size in Lines Grid.")
  6216. )
  6217. self.line_size_entry = FCDoubleSpinner()
  6218. self.line_size_entry.set_range(0.0, 9999.9999)
  6219. self.line_size_entry.set_precision(self.decimals)
  6220. self.line_size_entry.setSingleStep(0.1)
  6221. grid_lay.addWidget(self.line_size_label, 15, 0)
  6222. grid_lay.addWidget(self.line_size_entry, 15, 1)
  6223. # Lines spacing #
  6224. self.lines_spacing_label = QtWidgets.QLabel('%s:' % _("Spacing"))
  6225. self.lines_spacing_label.setToolTip(
  6226. _("Distance between each two lines in Lines Grid.")
  6227. )
  6228. self.lines_spacing_entry = FCDoubleSpinner()
  6229. self.lines_spacing_entry.set_range(0.0, 9999.9999)
  6230. self.lines_spacing_entry.set_precision(self.decimals)
  6231. self.lines_spacing_entry.setSingleStep(0.1)
  6232. grid_lay.addWidget(self.lines_spacing_label, 16, 0)
  6233. grid_lay.addWidget(self.lines_spacing_entry, 16, 1)
  6234. self.robber_bar_label = QtWidgets.QLabel('<b>%s</b>' % _('Robber Bar Parameters'))
  6235. self.robber_bar_label.setToolTip(
  6236. _("Parameters used for the robber bar.\n"
  6237. "Robber bar = copper border to help in pattern hole plating.")
  6238. )
  6239. grid_lay.addWidget(self.robber_bar_label, 17, 0, 1, 2)
  6240. # ROBBER BAR MARGIN #
  6241. self.rb_margin_label = QtWidgets.QLabel('%s:' % _("Margin"))
  6242. self.rb_margin_label.setToolTip(
  6243. _("Bounding box margin for robber bar.")
  6244. )
  6245. self.rb_margin_entry = FCDoubleSpinner()
  6246. self.rb_margin_entry.set_range(-9999.9999, 9999.9999)
  6247. self.rb_margin_entry.set_precision(self.decimals)
  6248. self.rb_margin_entry.setSingleStep(0.1)
  6249. grid_lay.addWidget(self.rb_margin_label, 18, 0)
  6250. grid_lay.addWidget(self.rb_margin_entry, 18, 1)
  6251. # THICKNESS #
  6252. self.rb_thickness_label = QtWidgets.QLabel('%s:' % _("Thickness"))
  6253. self.rb_thickness_label.setToolTip(
  6254. _("The robber bar thickness.")
  6255. )
  6256. self.rb_thickness_entry = FCDoubleSpinner()
  6257. self.rb_thickness_entry.set_range(0.0000, 9999.9999)
  6258. self.rb_thickness_entry.set_precision(self.decimals)
  6259. self.rb_thickness_entry.setSingleStep(0.1)
  6260. grid_lay.addWidget(self.rb_thickness_label, 19, 0)
  6261. grid_lay.addWidget(self.rb_thickness_entry, 19, 1)
  6262. self.patern_mask_label = QtWidgets.QLabel('<b>%s</b>' % _('Pattern Plating Mask'))
  6263. self.patern_mask_label.setToolTip(
  6264. _("Generate a mask for pattern plating.")
  6265. )
  6266. grid_lay.addWidget(self.patern_mask_label, 20, 0, 1, 2)
  6267. # Openings CLEARANCE #
  6268. self.clearance_ppm_label = QtWidgets.QLabel('%s:' % _("Clearance"))
  6269. self.clearance_ppm_label.setToolTip(
  6270. _("The distance between the possible copper thieving elements\n"
  6271. "and/or robber bar and the actual openings in the mask.")
  6272. )
  6273. self.clearance_ppm_entry = FCDoubleSpinner()
  6274. self.clearance_ppm_entry.set_range(-9999.9999, 9999.9999)
  6275. self.clearance_ppm_entry.set_precision(self.decimals)
  6276. self.clearance_ppm_entry.setSingleStep(0.1)
  6277. grid_lay.addWidget(self.clearance_ppm_label, 21, 0)
  6278. grid_lay.addWidget(self.clearance_ppm_entry, 21, 1)
  6279. self.layout.addStretch()
  6280. class Tools2FiducialsPrefGroupUI(OptionsGroupUI):
  6281. def __init__(self, decimals=4, parent=None):
  6282. super(Tools2FiducialsPrefGroupUI, self).__init__(self)
  6283. self.setTitle(str(_("Fiducials Tool Options")))
  6284. self.decimals = decimals
  6285. # ## Grid Layout
  6286. grid_lay = QtWidgets.QGridLayout()
  6287. self.layout.addLayout(grid_lay)
  6288. grid_lay.setColumnStretch(0, 0)
  6289. grid_lay.setColumnStretch(1, 1)
  6290. self.param_label = QtWidgets.QLabel('<b>%s:</b>' % _('Parameters'))
  6291. self.param_label.setToolTip(
  6292. _("Parameters used for this tool.")
  6293. )
  6294. grid_lay.addWidget(self.param_label, 0, 0, 1, 2)
  6295. # DIAMETER #
  6296. self.dia_label = QtWidgets.QLabel('%s:' % _("Size"))
  6297. self.dia_label.setToolTip(
  6298. _("This set the fiducial diameter if fiducial type is circular,\n"
  6299. "otherwise is the size of the fiducial.\n"
  6300. "The soldermask opening is double than that.")
  6301. )
  6302. self.dia_entry = FCDoubleSpinner()
  6303. self.dia_entry.set_range(1.0000, 3.0000)
  6304. self.dia_entry.set_precision(self.decimals)
  6305. self.dia_entry.setWrapping(True)
  6306. self.dia_entry.setSingleStep(0.1)
  6307. grid_lay.addWidget(self.dia_label, 1, 0)
  6308. grid_lay.addWidget(self.dia_entry, 1, 1)
  6309. # MARGIN #
  6310. self.margin_label = QtWidgets.QLabel('%s:' % _("Margin"))
  6311. self.margin_label.setToolTip(
  6312. _("Bounding box margin.")
  6313. )
  6314. self.margin_entry = FCDoubleSpinner()
  6315. self.margin_entry.set_range(-9999.9999, 9999.9999)
  6316. self.margin_entry.set_precision(self.decimals)
  6317. self.margin_entry.setSingleStep(0.1)
  6318. grid_lay.addWidget(self.margin_label, 2, 0)
  6319. grid_lay.addWidget(self.margin_entry, 2, 1)
  6320. # Mode #
  6321. self.mode_radio = RadioSet([
  6322. {'label': _('Auto'), 'value': 'auto'},
  6323. {"label": _("Manual"), "value": "manual"}
  6324. ], stretch=False)
  6325. self.mode_label = QtWidgets.QLabel(_("Mode:"))
  6326. self.mode_label.setToolTip(
  6327. _("- 'Auto' - automatic placement of fiducials in the corners of the bounding box.\n"
  6328. "- 'Manual' - manual placement of fiducials.")
  6329. )
  6330. grid_lay.addWidget(self.mode_label, 3, 0)
  6331. grid_lay.addWidget(self.mode_radio, 3, 1)
  6332. # Position for second fiducial #
  6333. self.pos_radio = RadioSet([
  6334. {'label': _('Up'), 'value': 'up'},
  6335. {"label": _("Down"), "value": "down"},
  6336. {"label": _("None"), "value": "no"}
  6337. ], stretch=False)
  6338. self.pos_label = QtWidgets.QLabel('%s:' % _("Second fiducial"))
  6339. self.pos_label.setToolTip(
  6340. _("The position for the second fiducial.\n"
  6341. "- 'Up' - the order is: bottom-left, top-left, top-right.\n"
  6342. "- 'Down' - the order is: bottom-left, bottom-right, top-right.\n"
  6343. "- 'None' - there is no second fiducial. The order is: bottom-left, top-right.")
  6344. )
  6345. grid_lay.addWidget(self.pos_label, 4, 0)
  6346. grid_lay.addWidget(self.pos_radio, 4, 1)
  6347. separator_line = QtWidgets.QFrame()
  6348. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  6349. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  6350. grid_lay.addWidget(separator_line, 5, 0, 1, 2)
  6351. # Fiducial type #
  6352. self.fid_type_radio = RadioSet([
  6353. {'label': _('Circular'), 'value': 'circular'},
  6354. {"label": _("Cross"), "value": "cross"},
  6355. {"label": _("Chess"), "value": "chess"}
  6356. ], stretch=False)
  6357. self.fid_type_label = QtWidgets.QLabel('%s:' % _("Fiducial Type"))
  6358. self.fid_type_label.setToolTip(
  6359. _("The type of fiducial.\n"
  6360. "- 'Circular' - this is the regular fiducial.\n"
  6361. "- 'Cross' - cross lines fiducial.\n"
  6362. "- 'Chess' - chess pattern fiducial.")
  6363. )
  6364. grid_lay.addWidget(self.fid_type_label, 6, 0)
  6365. grid_lay.addWidget(self.fid_type_radio, 6, 1)
  6366. # Line Thickness #
  6367. self.line_thickness_label = QtWidgets.QLabel('%s:' % _("Line thickness"))
  6368. self.line_thickness_label.setToolTip(
  6369. _("Bounding box margin.")
  6370. )
  6371. self.line_thickness_entry = FCDoubleSpinner()
  6372. self.line_thickness_entry.set_range(0.00001, 9999.9999)
  6373. self.line_thickness_entry.set_precision(self.decimals)
  6374. self.line_thickness_entry.setSingleStep(0.1)
  6375. grid_lay.addWidget(self.line_thickness_label, 7, 0)
  6376. grid_lay.addWidget(self.line_thickness_entry, 7, 1)
  6377. self.layout.addStretch()
  6378. class Tools2CalPrefGroupUI(OptionsGroupUI):
  6379. def __init__(self, decimals=4, parent=None):
  6380. super(Tools2CalPrefGroupUI, self).__init__(self)
  6381. self.setTitle(str(_("Calibration Tool Options")))
  6382. self.decimals = decimals
  6383. # ## Grid Layout
  6384. grid_lay = QtWidgets.QGridLayout()
  6385. self.layout.addLayout(grid_lay)
  6386. grid_lay.setColumnStretch(0, 0)
  6387. grid_lay.setColumnStretch(1, 1)
  6388. self.param_label = QtWidgets.QLabel('<b>%s:</b>' % _('Parameters'))
  6389. self.param_label.setToolTip(
  6390. _("Parameters used for this tool.")
  6391. )
  6392. grid_lay.addWidget(self.param_label, 0, 0, 1, 2)
  6393. # Calibration source
  6394. self.cal_source_lbl = QtWidgets.QLabel("<b>%s:</b>" % _("Source Type"))
  6395. self.cal_source_lbl.setToolTip(_("The source of calibration points.\n"
  6396. "It can be:\n"
  6397. "- Object -> click a hole geo for Excellon or a pad for Gerber\n"
  6398. "- Free -> click freely on canvas to acquire the calibration points"))
  6399. self.cal_source_radio = RadioSet([{'label': _('Object'), 'value': 'object'},
  6400. {'label': _('Free'), 'value': 'free'}],
  6401. stretch=False)
  6402. grid_lay.addWidget(self.cal_source_lbl, 1, 0)
  6403. grid_lay.addWidget(self.cal_source_radio, 1, 1, 1, 2)
  6404. separator_line = QtWidgets.QFrame()
  6405. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  6406. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  6407. grid_lay.addWidget(separator_line, 2, 0, 1, 2)
  6408. # Travel Z entry
  6409. travelz_lbl = QtWidgets.QLabel('%s:' % _("Travel Z"))
  6410. travelz_lbl.setToolTip(
  6411. _("Height (Z) for travelling between the points.")
  6412. )
  6413. self.travelz_entry = FCDoubleSpinner()
  6414. self.travelz_entry.set_range(-9999.9999, 9999.9999)
  6415. self.travelz_entry.set_precision(self.decimals)
  6416. self.travelz_entry.setSingleStep(0.1)
  6417. grid_lay.addWidget(travelz_lbl, 3, 0)
  6418. grid_lay.addWidget(self.travelz_entry, 3, 1, 1, 2)
  6419. # Verification Z entry
  6420. verz_lbl = QtWidgets.QLabel('%s:' % _("Verification Z"))
  6421. verz_lbl.setToolTip(
  6422. _("Height (Z) for checking the point.")
  6423. )
  6424. self.verz_entry = FCDoubleSpinner()
  6425. self.verz_entry.set_range(-9999.9999, 9999.9999)
  6426. self.verz_entry.set_precision(self.decimals)
  6427. self.verz_entry.setSingleStep(0.1)
  6428. grid_lay.addWidget(verz_lbl, 4, 0)
  6429. grid_lay.addWidget(self.verz_entry, 4, 1, 1, 2)
  6430. # Zero the Z of the verification tool
  6431. self.zeroz_cb = FCCheckBox('%s' % _("Zero Z tool"))
  6432. self.zeroz_cb.setToolTip(
  6433. _("Include a sequence to zero the height (Z)\n"
  6434. "of the verification tool.")
  6435. )
  6436. grid_lay.addWidget(self.zeroz_cb, 5, 0, 1, 3)
  6437. # Toochange Z entry
  6438. toolchangez_lbl = QtWidgets.QLabel('%s:' % _("Toolchange Z"))
  6439. toolchangez_lbl.setToolTip(
  6440. _("Height (Z) for mounting the verification probe.")
  6441. )
  6442. self.toolchangez_entry = FCDoubleSpinner()
  6443. self.toolchangez_entry.set_range(0.0000, 9999.9999)
  6444. self.toolchangez_entry.set_precision(self.decimals)
  6445. self.toolchangez_entry.setSingleStep(0.1)
  6446. grid_lay.addWidget(toolchangez_lbl, 6, 0)
  6447. grid_lay.addWidget(self.toolchangez_entry, 6, 1, 1, 2)
  6448. # Toolchange X-Y entry
  6449. toolchangexy_lbl = QtWidgets.QLabel('%s:' % _('Toolchange X-Y'))
  6450. toolchangexy_lbl.setToolTip(
  6451. _("Toolchange X,Y position.\n"
  6452. "If no value is entered then the current\n"
  6453. "(x, y) point will be used,")
  6454. )
  6455. self.toolchange_xy_entry = FCEntry()
  6456. grid_lay.addWidget(toolchangexy_lbl, 7, 0)
  6457. grid_lay.addWidget(self.toolchange_xy_entry, 7, 1, 1, 2)
  6458. # Second point choice
  6459. second_point_lbl = QtWidgets.QLabel('%s:' % _("Second point"))
  6460. second_point_lbl.setToolTip(
  6461. _("Second point in the Gcode verification can be:\n"
  6462. "- top-left -> the user will align the PCB vertically\n"
  6463. "- bottom-right -> the user will align the PCB horizontally")
  6464. )
  6465. self.second_point_radio = RadioSet([{'label': _('Top-Left'), 'value': 'tl'},
  6466. {'label': _('Bottom-Right'), 'value': 'br'}],
  6467. orientation='vertical')
  6468. grid_lay.addWidget(second_point_lbl, 8, 0)
  6469. grid_lay.addWidget(self.second_point_radio, 8, 1, 1, 2)
  6470. self.layout.addStretch()
  6471. class Tools2EDrillsPrefGroupUI(OptionsGroupUI):
  6472. def __init__(self, decimals=4, parent=None):
  6473. super(Tools2EDrillsPrefGroupUI, self).__init__(self)
  6474. self.setTitle(str(_("Extract Drills Options")))
  6475. self.decimals = decimals
  6476. # ## Grid Layout
  6477. grid_lay = QtWidgets.QGridLayout()
  6478. self.layout.addLayout(grid_lay)
  6479. grid_lay.setColumnStretch(0, 0)
  6480. grid_lay.setColumnStretch(1, 1)
  6481. self.param_label = QtWidgets.QLabel('<b>%s:</b>' % _('Parameters'))
  6482. self.param_label.setToolTip(
  6483. _("Parameters used for this tool.")
  6484. )
  6485. grid_lay.addWidget(self.param_label, 0, 0, 1, 2)
  6486. self.padt_label = QtWidgets.QLabel("<b>%s:</b>" % _("Processed Pads Type"))
  6487. self.padt_label.setToolTip(
  6488. _("The type of pads shape to be processed.\n"
  6489. "If the PCB has many SMD pads with rectangular pads,\n"
  6490. "disable the Rectangular aperture.")
  6491. )
  6492. grid_lay.addWidget(self.padt_label, 2, 0, 1, 2)
  6493. # Circular Aperture Selection
  6494. self.circular_cb = FCCheckBox('%s' % _("Circular"))
  6495. self.circular_cb.setToolTip(
  6496. _("Process Circular Pads.")
  6497. )
  6498. grid_lay.addWidget(self.circular_cb, 3, 0, 1, 2)
  6499. # Oblong Aperture Selection
  6500. self.oblong_cb = FCCheckBox('%s' % _("Oblong"))
  6501. self.oblong_cb.setToolTip(
  6502. _("Process Oblong Pads.")
  6503. )
  6504. grid_lay.addWidget(self.oblong_cb, 4, 0, 1, 2)
  6505. # Square Aperture Selection
  6506. self.square_cb = FCCheckBox('%s' % _("Square"))
  6507. self.square_cb.setToolTip(
  6508. _("Process Square Pads.")
  6509. )
  6510. grid_lay.addWidget(self.square_cb, 5, 0, 1, 2)
  6511. # Rectangular Aperture Selection
  6512. self.rectangular_cb = FCCheckBox('%s' % _("Rectangular"))
  6513. self.rectangular_cb.setToolTip(
  6514. _("Process Rectangular Pads.")
  6515. )
  6516. grid_lay.addWidget(self.rectangular_cb, 6, 0, 1, 2)
  6517. # Others type of Apertures Selection
  6518. self.other_cb = FCCheckBox('%s' % _("Others"))
  6519. self.other_cb.setToolTip(
  6520. _("Process pads not in the categories above.")
  6521. )
  6522. grid_lay.addWidget(self.other_cb, 7, 0, 1, 2)
  6523. separator_line = QtWidgets.QFrame()
  6524. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  6525. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  6526. grid_lay.addWidget(separator_line, 8, 0, 1, 2)
  6527. # ## Axis
  6528. self.hole_size_radio = RadioSet(
  6529. [
  6530. {'label': _("Fixed Diameter"), 'value': 'fixed'},
  6531. {'label': _("Fixed Annular Ring"), 'value': 'ring'},
  6532. {'label': _("Proportional"), 'value': 'prop'}
  6533. ],
  6534. orientation='vertical',
  6535. stretch=False)
  6536. self.hole_size_label = QtWidgets.QLabel('<b>%s:</b>' % _("Method"))
  6537. self.hole_size_label.setToolTip(
  6538. _("The method for processing pads. Can be:\n"
  6539. "- Fixed Diameter -> all holes will have a set size\n"
  6540. "- Fixed Annular Ring -> all holes will have a set annular ring\n"
  6541. "- Proportional -> each hole size will be a fraction of the pad size"))
  6542. grid_lay.addWidget(self.hole_size_label, 9, 0)
  6543. grid_lay.addWidget(self.hole_size_radio, 9, 1)
  6544. # grid_lay1.addWidget(QtWidgets.QLabel(''))
  6545. separator_line = QtWidgets.QFrame()
  6546. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  6547. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  6548. grid_lay.addWidget(separator_line, 10, 0, 1, 2)
  6549. # Annular Ring
  6550. self.fixed_label = QtWidgets.QLabel('<b>%s</b>' % _("Fixed Diameter"))
  6551. grid_lay.addWidget(self.fixed_label, 11, 0, 1, 2)
  6552. # Diameter value
  6553. self.dia_entry = FCDoubleSpinner()
  6554. self.dia_entry.set_precision(self.decimals)
  6555. self.dia_entry.set_range(0.0000, 9999.9999)
  6556. self.dia_label = QtWidgets.QLabel('%s:' % _("Value"))
  6557. self.dia_label.setToolTip(
  6558. _("Fixed hole diameter.")
  6559. )
  6560. grid_lay.addWidget(self.dia_label, 12, 0)
  6561. grid_lay.addWidget(self.dia_entry, 12, 1)
  6562. # Annular Ring value
  6563. self.ring_label = QtWidgets.QLabel('<b>%s</b>' % _("Fixed Annular Ring"))
  6564. self.ring_label.setToolTip(
  6565. _("The size of annular ring.\n"
  6566. "The copper sliver between the hole exterior\n"
  6567. "and the margin of the copper pad.")
  6568. )
  6569. grid_lay.addWidget(self.ring_label, 13, 0, 1, 2)
  6570. # Circular Annular Ring Value
  6571. self.circular_ring_label = QtWidgets.QLabel('%s:' % _("Circular"))
  6572. self.circular_ring_label.setToolTip(
  6573. _("The size of annular ring for circular pads.")
  6574. )
  6575. self.circular_ring_entry = FCDoubleSpinner()
  6576. self.circular_ring_entry.set_precision(self.decimals)
  6577. self.circular_ring_entry.set_range(0.0000, 9999.9999)
  6578. grid_lay.addWidget(self.circular_ring_label, 14, 0)
  6579. grid_lay.addWidget(self.circular_ring_entry, 14, 1)
  6580. # Oblong Annular Ring Value
  6581. self.oblong_ring_label = QtWidgets.QLabel('%s:' % _("Oblong"))
  6582. self.oblong_ring_label.setToolTip(
  6583. _("The size of annular ring for oblong pads.")
  6584. )
  6585. self.oblong_ring_entry = FCDoubleSpinner()
  6586. self.oblong_ring_entry.set_precision(self.decimals)
  6587. self.oblong_ring_entry.set_range(0.0000, 9999.9999)
  6588. grid_lay.addWidget(self.oblong_ring_label, 15, 0)
  6589. grid_lay.addWidget(self.oblong_ring_entry, 15, 1)
  6590. # Square Annular Ring Value
  6591. self.square_ring_label = QtWidgets.QLabel('%s:' % _("Square"))
  6592. self.square_ring_label.setToolTip(
  6593. _("The size of annular ring for square pads.")
  6594. )
  6595. self.square_ring_entry = FCDoubleSpinner()
  6596. self.square_ring_entry.set_precision(self.decimals)
  6597. self.square_ring_entry.set_range(0.0000, 9999.9999)
  6598. grid_lay.addWidget(self.square_ring_label, 16, 0)
  6599. grid_lay.addWidget(self.square_ring_entry, 16, 1)
  6600. # Rectangular Annular Ring Value
  6601. self.rectangular_ring_label = QtWidgets.QLabel('%s:' % _("Rectangular"))
  6602. self.rectangular_ring_label.setToolTip(
  6603. _("The size of annular ring for rectangular pads.")
  6604. )
  6605. self.rectangular_ring_entry = FCDoubleSpinner()
  6606. self.rectangular_ring_entry.set_precision(self.decimals)
  6607. self.rectangular_ring_entry.set_range(0.0000, 9999.9999)
  6608. grid_lay.addWidget(self.rectangular_ring_label, 17, 0)
  6609. grid_lay.addWidget(self.rectangular_ring_entry, 17, 1)
  6610. # Others Annular Ring Value
  6611. self.other_ring_label = QtWidgets.QLabel('%s:' % _("Others"))
  6612. self.other_ring_label.setToolTip(
  6613. _("The size of annular ring for other pads.")
  6614. )
  6615. self.other_ring_entry = FCDoubleSpinner()
  6616. self.other_ring_entry.set_precision(self.decimals)
  6617. self.other_ring_entry.set_range(0.0000, 9999.9999)
  6618. grid_lay.addWidget(self.other_ring_label, 18, 0)
  6619. grid_lay.addWidget(self.other_ring_entry, 18, 1)
  6620. self.prop_label = QtWidgets.QLabel('<b>%s</b>' % _("Proportional Diameter"))
  6621. grid_lay.addWidget(self.prop_label, 19, 0, 1, 2)
  6622. # Factor value
  6623. self.factor_entry = FCDoubleSpinner(suffix='%')
  6624. self.factor_entry.set_precision(self.decimals)
  6625. self.factor_entry.set_range(0.0000, 100.0000)
  6626. self.factor_entry.setSingleStep(0.1)
  6627. self.factor_label = QtWidgets.QLabel('%s:' % _("Factor"))
  6628. self.factor_label.setToolTip(
  6629. _("Proportional Diameter.\n"
  6630. "The hole diameter will be a fraction of the pad size.")
  6631. )
  6632. grid_lay.addWidget(self.factor_label, 20, 0)
  6633. grid_lay.addWidget(self.factor_entry, 20, 1)
  6634. self.layout.addStretch()
  6635. class Tools2PunchGerberPrefGroupUI(OptionsGroupUI):
  6636. def __init__(self, decimals=4, parent=None):
  6637. super(Tools2PunchGerberPrefGroupUI, self).__init__(self)
  6638. self.setTitle(str(_("Punch Gerber Options")))
  6639. self.decimals = decimals
  6640. # ## Grid Layout
  6641. grid_lay = QtWidgets.QGridLayout()
  6642. self.layout.addLayout(grid_lay)
  6643. grid_lay.setColumnStretch(0, 0)
  6644. grid_lay.setColumnStretch(1, 1)
  6645. self.param_label = QtWidgets.QLabel('<b>%s:</b>' % _('Parameters'))
  6646. self.param_label.setToolTip(
  6647. _("Parameters used for this tool.")
  6648. )
  6649. grid_lay.addWidget(self.param_label, 0, 0, 1, 2)
  6650. self.padt_label = QtWidgets.QLabel("<b>%s:</b>" % _("Processed Pads Type"))
  6651. self.padt_label.setToolTip(
  6652. _("The type of pads shape to be processed.\n"
  6653. "If the PCB has many SMD pads with rectangular pads,\n"
  6654. "disable the Rectangular aperture.")
  6655. )
  6656. grid_lay.addWidget(self.padt_label, 2, 0, 1, 2)
  6657. # Circular Aperture Selection
  6658. self.circular_cb = FCCheckBox('%s' % _("Circular"))
  6659. self.circular_cb.setToolTip(
  6660. _("Process Circular Pads.")
  6661. )
  6662. grid_lay.addWidget(self.circular_cb, 3, 0, 1, 2)
  6663. # Oblong Aperture Selection
  6664. self.oblong_cb = FCCheckBox('%s' % _("Oblong"))
  6665. self.oblong_cb.setToolTip(
  6666. _("Process Oblong Pads.")
  6667. )
  6668. grid_lay.addWidget(self.oblong_cb, 4, 0, 1, 2)
  6669. # Square Aperture Selection
  6670. self.square_cb = FCCheckBox('%s' % _("Square"))
  6671. self.square_cb.setToolTip(
  6672. _("Process Square Pads.")
  6673. )
  6674. grid_lay.addWidget(self.square_cb, 5, 0, 1, 2)
  6675. # Rectangular Aperture Selection
  6676. self.rectangular_cb = FCCheckBox('%s' % _("Rectangular"))
  6677. self.rectangular_cb.setToolTip(
  6678. _("Process Rectangular Pads.")
  6679. )
  6680. grid_lay.addWidget(self.rectangular_cb, 6, 0, 1, 2)
  6681. # Others type of Apertures Selection
  6682. self.other_cb = FCCheckBox('%s' % _("Others"))
  6683. self.other_cb.setToolTip(
  6684. _("Process pads not in the categories above.")
  6685. )
  6686. grid_lay.addWidget(self.other_cb, 7, 0, 1, 2)
  6687. separator_line = QtWidgets.QFrame()
  6688. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  6689. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  6690. grid_lay.addWidget(separator_line, 8, 0, 1, 2)
  6691. # ## Axis
  6692. self.hole_size_radio = RadioSet(
  6693. [
  6694. {'label': _("Excellon"), 'value': 'exc'},
  6695. {'label': _("Fixed Diameter"), 'value': 'fixed'},
  6696. {'label': _("Fixed Annular Ring"), 'value': 'ring'},
  6697. {'label': _("Proportional"), 'value': 'prop'}
  6698. ],
  6699. orientation='vertical',
  6700. stretch=False)
  6701. self.hole_size_label = QtWidgets.QLabel('<b>%s:</b>' % _("Method"))
  6702. self.hole_size_label.setToolTip(
  6703. _("The punch hole source can be:\n"
  6704. "- Excellon Object-> the Excellon object drills center will serve as reference.\n"
  6705. "- Fixed Diameter -> will try to use the pads center as reference adding fixed diameter holes.\n"
  6706. "- Fixed Annular Ring -> will try to keep a set annular ring.\n"
  6707. "- Proportional -> will make a Gerber punch hole having the diameter a percentage of the pad diameter.\n")
  6708. )
  6709. grid_lay.addWidget(self.hole_size_label, 9, 0)
  6710. grid_lay.addWidget(self.hole_size_radio, 9, 1)
  6711. # grid_lay1.addWidget(QtWidgets.QLabel(''))
  6712. separator_line = QtWidgets.QFrame()
  6713. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  6714. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  6715. grid_lay.addWidget(separator_line, 10, 0, 1, 2)
  6716. # Annular Ring
  6717. self.fixed_label = QtWidgets.QLabel('<b>%s</b>' % _("Fixed Diameter"))
  6718. grid_lay.addWidget(self.fixed_label, 11, 0, 1, 2)
  6719. # Diameter value
  6720. self.dia_entry = FCDoubleSpinner()
  6721. self.dia_entry.set_precision(self.decimals)
  6722. self.dia_entry.set_range(0.0000, 9999.9999)
  6723. self.dia_label = QtWidgets.QLabel('%s:' % _("Value"))
  6724. self.dia_label.setToolTip(
  6725. _("Fixed hole diameter.")
  6726. )
  6727. grid_lay.addWidget(self.dia_label, 12, 0)
  6728. grid_lay.addWidget(self.dia_entry, 12, 1)
  6729. # Annular Ring value
  6730. self.ring_label = QtWidgets.QLabel('<b>%s</b>' % _("Fixed Annular Ring"))
  6731. self.ring_label.setToolTip(
  6732. _("The size of annular ring.\n"
  6733. "The copper sliver between the hole exterior\n"
  6734. "and the margin of the copper pad.")
  6735. )
  6736. grid_lay.addWidget(self.ring_label, 13, 0, 1, 2)
  6737. # Circular Annular Ring Value
  6738. self.circular_ring_label = QtWidgets.QLabel('%s:' % _("Circular"))
  6739. self.circular_ring_label.setToolTip(
  6740. _("The size of annular ring for circular pads.")
  6741. )
  6742. self.circular_ring_entry = FCDoubleSpinner()
  6743. self.circular_ring_entry.set_precision(self.decimals)
  6744. self.circular_ring_entry.set_range(0.0000, 9999.9999)
  6745. grid_lay.addWidget(self.circular_ring_label, 14, 0)
  6746. grid_lay.addWidget(self.circular_ring_entry, 14, 1)
  6747. # Oblong Annular Ring Value
  6748. self.oblong_ring_label = QtWidgets.QLabel('%s:' % _("Oblong"))
  6749. self.oblong_ring_label.setToolTip(
  6750. _("The size of annular ring for oblong pads.")
  6751. )
  6752. self.oblong_ring_entry = FCDoubleSpinner()
  6753. self.oblong_ring_entry.set_precision(self.decimals)
  6754. self.oblong_ring_entry.set_range(0.0000, 9999.9999)
  6755. grid_lay.addWidget(self.oblong_ring_label, 15, 0)
  6756. grid_lay.addWidget(self.oblong_ring_entry, 15, 1)
  6757. # Square Annular Ring Value
  6758. self.square_ring_label = QtWidgets.QLabel('%s:' % _("Square"))
  6759. self.square_ring_label.setToolTip(
  6760. _("The size of annular ring for square pads.")
  6761. )
  6762. self.square_ring_entry = FCDoubleSpinner()
  6763. self.square_ring_entry.set_precision(self.decimals)
  6764. self.square_ring_entry.set_range(0.0000, 9999.9999)
  6765. grid_lay.addWidget(self.square_ring_label, 16, 0)
  6766. grid_lay.addWidget(self.square_ring_entry, 16, 1)
  6767. # Rectangular Annular Ring Value
  6768. self.rectangular_ring_label = QtWidgets.QLabel('%s:' % _("Rectangular"))
  6769. self.rectangular_ring_label.setToolTip(
  6770. _("The size of annular ring for rectangular pads.")
  6771. )
  6772. self.rectangular_ring_entry = FCDoubleSpinner()
  6773. self.rectangular_ring_entry.set_precision(self.decimals)
  6774. self.rectangular_ring_entry.set_range(0.0000, 9999.9999)
  6775. grid_lay.addWidget(self.rectangular_ring_label, 17, 0)
  6776. grid_lay.addWidget(self.rectangular_ring_entry, 17, 1)
  6777. # Others Annular Ring Value
  6778. self.other_ring_label = QtWidgets.QLabel('%s:' % _("Others"))
  6779. self.other_ring_label.setToolTip(
  6780. _("The size of annular ring for other pads.")
  6781. )
  6782. self.other_ring_entry = FCDoubleSpinner()
  6783. self.other_ring_entry.set_precision(self.decimals)
  6784. self.other_ring_entry.set_range(0.0000, 9999.9999)
  6785. grid_lay.addWidget(self.other_ring_label, 18, 0)
  6786. grid_lay.addWidget(self.other_ring_entry, 18, 1)
  6787. self.prop_label = QtWidgets.QLabel('<b>%s</b>' % _("Proportional Diameter"))
  6788. grid_lay.addWidget(self.prop_label, 19, 0, 1, 2)
  6789. # Factor value
  6790. self.factor_entry = FCDoubleSpinner(suffix='%')
  6791. self.factor_entry.set_precision(self.decimals)
  6792. self.factor_entry.set_range(0.0000, 100.0000)
  6793. self.factor_entry.setSingleStep(0.1)
  6794. self.factor_label = QtWidgets.QLabel('%s:' % _("Factor"))
  6795. self.factor_label.setToolTip(
  6796. _("Proportional Diameter.\n"
  6797. "The hole diameter will be a fraction of the pad size.")
  6798. )
  6799. grid_lay.addWidget(self.factor_label, 20, 0)
  6800. grid_lay.addWidget(self.factor_entry, 20, 1)
  6801. self.layout.addStretch()
  6802. class Tools2InvertPrefGroupUI(OptionsGroupUI):
  6803. def __init__(self, decimals=4, parent=None):
  6804. super(Tools2InvertPrefGroupUI, self).__init__(self)
  6805. self.setTitle(str(_("Invert Gerber Tool Options")))
  6806. self.decimals = decimals
  6807. # ## Subtractor Tool Parameters
  6808. self.sublabel = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  6809. self.sublabel.setToolTip(
  6810. _("A tool to invert Gerber geometry from positive to negative\n"
  6811. "and in revers.")
  6812. )
  6813. self.layout.addWidget(self.sublabel)
  6814. # Grid Layout
  6815. grid0 = QtWidgets.QGridLayout()
  6816. grid0.setColumnStretch(0, 0)
  6817. grid0.setColumnStretch(1, 1)
  6818. self.layout.addLayout(grid0)
  6819. # Margin
  6820. self.margin_label = QtWidgets.QLabel('%s:' % _('Margin'))
  6821. self.margin_label.setToolTip(
  6822. _("Distance by which to avoid\n"
  6823. "the edges of the Gerber object.")
  6824. )
  6825. self.margin_entry = FCDoubleSpinner()
  6826. self.margin_entry.set_precision(self.decimals)
  6827. self.margin_entry.set_range(0.0000, 9999.9999)
  6828. self.margin_entry.setObjectName(_("Margin"))
  6829. grid0.addWidget(self.margin_label, 2, 0, 1, 2)
  6830. grid0.addWidget(self.margin_entry, 3, 0, 1, 2)
  6831. self.join_label = QtWidgets.QLabel('%s:' % _("Lines Join Style"))
  6832. self.join_label.setToolTip(
  6833. _("The way that the lines in the object outline will be joined.\n"
  6834. "Can be:\n"
  6835. "- rounded -> an arc is added between two joining lines\n"
  6836. "- square -> the lines meet in 90 degrees angle\n"
  6837. "- bevel -> the lines are joined by a third line")
  6838. )
  6839. self.join_radio = RadioSet([
  6840. {'label': 'Rounded', 'value': 'r'},
  6841. {'label': 'Square', 'value': 's'},
  6842. {'label': 'Bevel', 'value': 'b'}
  6843. ], orientation='vertical', stretch=False)
  6844. grid0.addWidget(self.join_label, 5, 0, 1, 2)
  6845. grid0.addWidget(self.join_radio, 7, 0, 1, 2)
  6846. self.layout.addStretch()
  6847. class FAExcPrefGroupUI(OptionsGroupUI):
  6848. def __init__(self, decimals=4, parent=None):
  6849. # OptionsGroupUI.__init__(self, "Excellon File associations Preferences", parent=None)
  6850. super().__init__(self)
  6851. self.setTitle(str(_("Excellon File associations")))
  6852. self.decimals = decimals
  6853. self.layout.setContentsMargins(2, 2, 2, 2)
  6854. self.vertical_lay = QtWidgets.QVBoxLayout()
  6855. scroll_widget = QtWidgets.QWidget()
  6856. scroll = VerticalScrollArea()
  6857. scroll.setWidget(scroll_widget)
  6858. scroll.setWidgetResizable(True)
  6859. scroll.setFrameShape(QtWidgets.QFrame.NoFrame)
  6860. self.restore_btn = FCButton(_("Restore"))
  6861. self.restore_btn.setToolTip(_("Restore the extension list to the default state."))
  6862. self.del_all_btn = FCButton(_("Delete All"))
  6863. self.del_all_btn.setToolTip(_("Delete all extensions from the list."))
  6864. hlay0 = QtWidgets.QHBoxLayout()
  6865. hlay0.addWidget(self.restore_btn)
  6866. hlay0.addWidget(self.del_all_btn)
  6867. self.vertical_lay.addLayout(hlay0)
  6868. # # ## Excellon associations
  6869. list_label = QtWidgets.QLabel("<b>%s:</b>" % _("Extensions list"))
  6870. list_label.setToolTip(
  6871. _("List of file extensions to be\n"
  6872. "associated with FlatCAM.")
  6873. )
  6874. self.vertical_lay.addWidget(list_label)
  6875. settings = QSettings("Open Source", "FlatCAM")
  6876. if settings.contains("textbox_font_size"):
  6877. tb_fsize = settings.value('textbox_font_size', type=int)
  6878. else:
  6879. tb_fsize = 10
  6880. self.exc_list_text = FCTextArea()
  6881. self.exc_list_text.setReadOnly(True)
  6882. # self.exc_list_text.sizeHint(custom_sizehint=150)
  6883. font = QtGui.QFont()
  6884. font.setPointSize(tb_fsize)
  6885. self.exc_list_text.setFont(font)
  6886. self.vertical_lay.addWidget(self.exc_list_text)
  6887. self.ext_label = QtWidgets.QLabel('%s:' % _("Extension"))
  6888. self.ext_label.setToolTip(_("A file extension to be added or deleted to the list."))
  6889. self.ext_entry = FCEntry()
  6890. hlay1 = QtWidgets.QHBoxLayout()
  6891. self.vertical_lay.addLayout(hlay1)
  6892. hlay1.addWidget(self.ext_label)
  6893. hlay1.addWidget(self.ext_entry)
  6894. self.add_btn = FCButton(_("Add Extension"))
  6895. self.add_btn.setToolTip(_("Add a file extension to the list"))
  6896. self.del_btn = FCButton(_("Delete Extension"))
  6897. self.del_btn.setToolTip(_("Delete a file extension from the list"))
  6898. hlay2 = QtWidgets.QHBoxLayout()
  6899. self.vertical_lay.addLayout(hlay2)
  6900. hlay2.addWidget(self.add_btn)
  6901. hlay2.addWidget(self.del_btn)
  6902. self.exc_list_btn = FCButton(_("Apply Association"))
  6903. self.exc_list_btn.setToolTip(_("Apply the file associations between\n"
  6904. "FlatCAM and the files with above extensions.\n"
  6905. "They will be active after next logon.\n"
  6906. "This work only in Windows."))
  6907. self.vertical_lay.addWidget(self.exc_list_btn)
  6908. scroll_widget.setLayout(self.vertical_lay)
  6909. self.layout.addWidget(scroll)
  6910. # self.vertical_lay.addStretch()
  6911. class FAGcoPrefGroupUI(OptionsGroupUI):
  6912. def __init__(self, decimals=4, parent=None):
  6913. # OptionsGroupUI.__init__(self, "Gcode File associations Preferences", parent=None)
  6914. super(FAGcoPrefGroupUI, self).__init__(self)
  6915. self.setTitle(str(_("GCode File associations")))
  6916. self.decimals = decimals
  6917. self.restore_btn = FCButton(_("Restore"))
  6918. self.restore_btn.setToolTip(_("Restore the extension list to the default state."))
  6919. self.del_all_btn = FCButton(_("Delete All"))
  6920. self.del_all_btn.setToolTip(_("Delete all extensions from the list."))
  6921. hlay0 = QtWidgets.QHBoxLayout()
  6922. self.layout.addLayout(hlay0)
  6923. hlay0.addWidget(self.restore_btn)
  6924. hlay0.addWidget(self.del_all_btn)
  6925. # ## G-Code associations
  6926. self.gco_list_label = QtWidgets.QLabel("<b>%s:</b>" % _("Extensions list"))
  6927. self.gco_list_label.setToolTip(
  6928. _("List of file extensions to be\n"
  6929. "associated with FlatCAM.")
  6930. )
  6931. self.layout.addWidget(self.gco_list_label)
  6932. settings = QSettings("Open Source", "FlatCAM")
  6933. if settings.contains("textbox_font_size"):
  6934. tb_fsize = settings.value('textbox_font_size', type=int)
  6935. else:
  6936. tb_fsize = 10
  6937. self.gco_list_text = FCTextArea()
  6938. self.gco_list_text.setReadOnly(True)
  6939. # self.gco_list_text.sizeHint(custom_sizehint=150)
  6940. font = QtGui.QFont()
  6941. font.setPointSize(tb_fsize)
  6942. self.gco_list_text.setFont(font)
  6943. self.layout.addWidget(self.gco_list_text)
  6944. self.ext_label = QtWidgets.QLabel('%s:' % _("Extension"))
  6945. self.ext_label.setToolTip(_("A file extension to be added or deleted to the list."))
  6946. self.ext_entry = FCEntry()
  6947. hlay1 = QtWidgets.QHBoxLayout()
  6948. self.layout.addLayout(hlay1)
  6949. hlay1.addWidget(self.ext_label)
  6950. hlay1.addWidget(self.ext_entry)
  6951. self.add_btn = FCButton(_("Add Extension"))
  6952. self.add_btn.setToolTip(_("Add a file extension to the list"))
  6953. self.del_btn = FCButton(_("Delete Extension"))
  6954. self.del_btn.setToolTip(_("Delete a file extension from the list"))
  6955. hlay2 = QtWidgets.QHBoxLayout()
  6956. self.layout.addLayout(hlay2)
  6957. hlay2.addWidget(self.add_btn)
  6958. hlay2.addWidget(self.del_btn)
  6959. self.gco_list_btn = FCButton(_("Apply Association"))
  6960. self.gco_list_btn.setToolTip(_("Apply the file associations between\n"
  6961. "FlatCAM and the files with above extensions.\n"
  6962. "They will be active after next logon.\n"
  6963. "This work only in Windows."))
  6964. self.layout.addWidget(self.gco_list_btn)
  6965. # self.layout.addStretch()
  6966. class FAGrbPrefGroupUI(OptionsGroupUI):
  6967. def __init__(self, decimals=4, parent=None):
  6968. # OptionsGroupUI.__init__(self, "Gerber File associations Preferences", parent=None)
  6969. super(FAGrbPrefGroupUI, self).__init__(self)
  6970. self.setTitle(str(_("Gerber File associations")))
  6971. self.decimals = decimals
  6972. self.restore_btn = FCButton(_("Restore"))
  6973. self.restore_btn.setToolTip(_("Restore the extension list to the default state."))
  6974. self.del_all_btn = FCButton(_("Delete All"))
  6975. self.del_all_btn.setToolTip(_("Delete all extensions from the list."))
  6976. hlay0 = QtWidgets.QHBoxLayout()
  6977. self.layout.addLayout(hlay0)
  6978. hlay0.addWidget(self.restore_btn)
  6979. hlay0.addWidget(self.del_all_btn)
  6980. # ## Gerber associations
  6981. self.grb_list_label = QtWidgets.QLabel("<b>%s:</b>" % _("Extensions list"))
  6982. self.grb_list_label.setToolTip(
  6983. _("List of file extensions to be\n"
  6984. "associated with FlatCAM.")
  6985. )
  6986. self.layout.addWidget(self.grb_list_label)
  6987. settings = QSettings("Open Source", "FlatCAM")
  6988. if settings.contains("textbox_font_size"):
  6989. tb_fsize = settings.value('textbox_font_size', type=int)
  6990. else:
  6991. tb_fsize = 10
  6992. self.grb_list_text = FCTextArea()
  6993. self.grb_list_text.setReadOnly(True)
  6994. # self.grb_list_text.sizeHint(custom_sizehint=150)
  6995. self.layout.addWidget(self.grb_list_text)
  6996. font = QtGui.QFont()
  6997. font.setPointSize(tb_fsize)
  6998. self.grb_list_text.setFont(font)
  6999. self.ext_label = QtWidgets.QLabel('%s:' % _("Extension"))
  7000. self.ext_label.setToolTip(_("A file extension to be added or deleted to the list."))
  7001. self.ext_entry = FCEntry()
  7002. hlay1 = QtWidgets.QHBoxLayout()
  7003. self.layout.addLayout(hlay1)
  7004. hlay1.addWidget(self.ext_label)
  7005. hlay1.addWidget(self.ext_entry)
  7006. self.add_btn = FCButton(_("Add Extension"))
  7007. self.add_btn.setToolTip(_("Add a file extension to the list"))
  7008. self.del_btn = FCButton(_("Delete Extension"))
  7009. self.del_btn.setToolTip(_("Delete a file extension from the list"))
  7010. hlay2 = QtWidgets.QHBoxLayout()
  7011. self.layout.addLayout(hlay2)
  7012. hlay2.addWidget(self.add_btn)
  7013. hlay2.addWidget(self.del_btn)
  7014. self.grb_list_btn = FCButton(_("Apply Association"))
  7015. self.grb_list_btn.setToolTip(_("Apply the file associations between\n"
  7016. "FlatCAM and the files with above extensions.\n"
  7017. "They will be active after next logon.\n"
  7018. "This work only in Windows."))
  7019. self.layout.addWidget(self.grb_list_btn)
  7020. # self.layout.addStretch()
  7021. class AutoCompletePrefGroupUI(OptionsGroupUI):
  7022. def __init__(self, decimals=4, parent=None):
  7023. # OptionsGroupUI.__init__(self, "Gerber File associations Preferences", parent=None)
  7024. super().__init__(self, parent=parent)
  7025. self.setTitle(str(_("Autocompleter Keywords")))
  7026. self.decimals = decimals
  7027. self.restore_btn = FCButton(_("Restore"))
  7028. self.restore_btn.setToolTip(_("Restore the autocompleter keywords list to the default state."))
  7029. self.del_all_btn = FCButton(_("Delete All"))
  7030. self.del_all_btn.setToolTip(_("Delete all autocompleter keywords from the list."))
  7031. hlay0 = QtWidgets.QHBoxLayout()
  7032. self.layout.addLayout(hlay0)
  7033. hlay0.addWidget(self.restore_btn)
  7034. hlay0.addWidget(self.del_all_btn)
  7035. # ## Gerber associations
  7036. self.grb_list_label = QtWidgets.QLabel("<b>%s:</b>" % _("Keywords list"))
  7037. self.grb_list_label.setToolTip(
  7038. _("List of keywords used by\n"
  7039. "the autocompleter in FlatCAM.\n"
  7040. "The autocompleter is installed\n"
  7041. "in the Code Editor and for the Tcl Shell.")
  7042. )
  7043. self.layout.addWidget(self.grb_list_label)
  7044. settings = QSettings("Open Source", "FlatCAM")
  7045. if settings.contains("textbox_font_size"):
  7046. tb_fsize = settings.value('textbox_font_size', type=int)
  7047. else:
  7048. tb_fsize = 10
  7049. self.kw_list_text = FCTextArea()
  7050. self.kw_list_text.setReadOnly(True)
  7051. # self.grb_list_text.sizeHint(custom_sizehint=150)
  7052. self.layout.addWidget(self.kw_list_text)
  7053. font = QtGui.QFont()
  7054. font.setPointSize(tb_fsize)
  7055. self.kw_list_text.setFont(font)
  7056. self.kw_label = QtWidgets.QLabel('%s:' % _("Extension"))
  7057. self.kw_label.setToolTip(_("A keyword to be added or deleted to the list."))
  7058. self.kw_entry = FCEntry()
  7059. hlay1 = QtWidgets.QHBoxLayout()
  7060. self.layout.addLayout(hlay1)
  7061. hlay1.addWidget(self.kw_label)
  7062. hlay1.addWidget(self.kw_entry)
  7063. self.add_btn = FCButton(_("Add keyword"))
  7064. self.add_btn.setToolTip(_("Add a keyword to the list"))
  7065. self.del_btn = FCButton(_("Delete keyword"))
  7066. self.del_btn.setToolTip(_("Delete a keyword from the list"))
  7067. hlay2 = QtWidgets.QHBoxLayout()
  7068. self.layout.addLayout(hlay2)
  7069. hlay2.addWidget(self.add_btn)
  7070. hlay2.addWidget(self.del_btn)
  7071. # self.layout.addStretch()