PreferencesUI.py 431 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991
  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. import os
  8. from defaults import FlatCAMDefaults
  9. from flatcamGUI.GUIElements import *
  10. import platform
  11. import sys
  12. import logging
  13. import gettext
  14. import FlatCAMTranslation as fcTranslate
  15. import builtins
  16. log = logging.getLogger('PreferencesUI')
  17. fcTranslate.apply_language('strings')
  18. if '_' not in builtins.__dict__:
  19. _ = gettext.gettext
  20. settings = QSettings("Open Source", "FlatCAM")
  21. if settings.contains("machinist"):
  22. machinist_setting = settings.value('machinist', type=int)
  23. else:
  24. machinist_setting = 0
  25. class PreferencesUIManager():
  26. def __init__(self, defaults: FlatCAMDefaults, data_path: str, ui, inform, app):
  27. # FIXME: Ideally we would not pass in the app here
  28. self.app = app
  29. self.defaults = defaults
  30. self.data_path = data_path
  31. self.ui = ui
  32. self.inform = inform
  33. self.ignore_tab_close_event = False
  34. # if Preferences are changed in the Edit -> Preferences tab the value will be set to True
  35. self.preferences_changed_flag = False
  36. # when adding entries here read the comments in the method found bellow named:
  37. # def new_object(self, kind, name, initialize, active=True, fit=True, plot=True)
  38. self.defaults_form_fields = {
  39. # General App
  40. "decimals_inch": self.ui.general_defaults_form.general_app_group.precision_inch_entry,
  41. "decimals_metric": self.ui.general_defaults_form.general_app_group.precision_metric_entry,
  42. "units": self.ui.general_defaults_form.general_app_group.units_radio,
  43. "global_graphic_engine": self.ui.general_defaults_form.general_app_group.ge_radio,
  44. "global_app_level": self.ui.general_defaults_form.general_app_group.app_level_radio,
  45. "global_portable": self.ui.general_defaults_form.general_app_group.portability_cb,
  46. "global_language": self.ui.general_defaults_form.general_app_group.language_cb,
  47. "global_systray_icon": self.ui.general_defaults_form.general_app_group.systray_cb,
  48. "global_shell_at_startup": self.ui.general_defaults_form.general_app_group.shell_startup_cb,
  49. "global_project_at_startup": self.ui.general_defaults_form.general_app_group.project_startup_cb,
  50. "global_version_check": self.ui.general_defaults_form.general_app_group.version_check_cb,
  51. "global_send_stats": self.ui.general_defaults_form.general_app_group.send_stats_cb,
  52. "global_worker_number": self.ui.general_defaults_form.general_app_group.worker_number_sb,
  53. "global_tolerance": self.ui.general_defaults_form.general_app_group.tol_entry,
  54. "global_compression_level": self.ui.general_defaults_form.general_app_group.compress_spinner,
  55. "global_save_compressed": self.ui.general_defaults_form.general_app_group.save_type_cb,
  56. "global_autosave": self.ui.general_defaults_form.general_app_group.autosave_cb,
  57. "global_autosave_timeout": self.ui.general_defaults_form.general_app_group.autosave_entry,
  58. "global_tpdf_tmargin": self.ui.general_defaults_form.general_app_group.tmargin_entry,
  59. "global_tpdf_bmargin": self.ui.general_defaults_form.general_app_group.bmargin_entry,
  60. "global_tpdf_lmargin": self.ui.general_defaults_form.general_app_group.lmargin_entry,
  61. "global_tpdf_rmargin": self.ui.general_defaults_form.general_app_group.rmargin_entry,
  62. # General GUI Preferences
  63. "global_theme": self.ui.general_defaults_form.general_gui_group.theme_radio,
  64. "global_gray_icons": self.ui.general_defaults_form.general_gui_group.gray_icons_cb,
  65. "global_layout": self.ui.general_defaults_form.general_gui_group.layout_combo,
  66. "global_hover": self.ui.general_defaults_form.general_gui_group.hover_cb,
  67. "global_selection_shape": self.ui.general_defaults_form.general_gui_group.selection_cb,
  68. "global_sel_fill": self.ui.general_defaults_form.general_gui_group.sf_color_entry,
  69. "global_sel_line": self.ui.general_defaults_form.general_gui_group.sl_color_entry,
  70. "global_alt_sel_fill": self.ui.general_defaults_form.general_gui_group.alt_sf_color_entry,
  71. "global_alt_sel_line": self.ui.general_defaults_form.general_gui_group.alt_sl_color_entry,
  72. "global_draw_color": self.ui.general_defaults_form.general_gui_group.draw_color_entry,
  73. "global_sel_draw_color": self.ui.general_defaults_form.general_gui_group.sel_draw_color_entry,
  74. "global_proj_item_color": self.ui.general_defaults_form.general_gui_group.proj_color_entry,
  75. "global_proj_item_dis_color": self.ui.general_defaults_form.general_gui_group.proj_color_dis_entry,
  76. "global_project_autohide": self.ui.general_defaults_form.general_gui_group.project_autohide_cb,
  77. # General GUI Settings
  78. "global_gridx": self.ui.general_defaults_form.general_app_set_group.gridx_entry,
  79. "global_gridy": self.ui.general_defaults_form.general_app_set_group.gridy_entry,
  80. "global_snap_max": self.ui.general_defaults_form.general_app_set_group.snap_max_dist_entry,
  81. "global_workspace": self.ui.general_defaults_form.general_app_set_group.workspace_cb,
  82. "global_workspaceT": self.ui.general_defaults_form.general_app_set_group.wk_cb,
  83. "global_workspace_orientation": self.ui.general_defaults_form.general_app_set_group.wk_orientation_radio,
  84. "global_cursor_type": self.ui.general_defaults_form.general_app_set_group.cursor_radio,
  85. "global_cursor_size": self.ui.general_defaults_form.general_app_set_group.cursor_size_entry,
  86. "global_cursor_width": self.ui.general_defaults_form.general_app_set_group.cursor_width_entry,
  87. "global_cursor_color_enabled": self.ui.general_defaults_form.general_app_set_group.mouse_cursor_color_cb,
  88. "global_cursor_color": self.ui.general_defaults_form.general_app_set_group.mouse_cursor_entry,
  89. "global_pan_button": self.ui.general_defaults_form.general_app_set_group.pan_button_radio,
  90. "global_mselect_key": self.ui.general_defaults_form.general_app_set_group.mselect_radio,
  91. "global_delete_confirmation": self.ui.general_defaults_form.general_app_set_group.delete_conf_cb,
  92. "global_open_style": self.ui.general_defaults_form.general_app_set_group.open_style_cb,
  93. "global_toggle_tooltips": self.ui.general_defaults_form.general_app_set_group.toggle_tooltips_cb,
  94. "global_machinist_setting": self.ui.general_defaults_form.general_app_set_group.machinist_cb,
  95. "global_bookmarks_limit": self.ui.general_defaults_form.general_app_set_group.bm_limit_spinner,
  96. "global_activity_icon": self.ui.general_defaults_form.general_app_set_group.activity_combo,
  97. # Gerber General
  98. "gerber_plot": self.ui.gerber_defaults_form.gerber_gen_group.plot_cb,
  99. "gerber_solid": self.ui.gerber_defaults_form.gerber_gen_group.solid_cb,
  100. "gerber_multicolored": self.ui.gerber_defaults_form.gerber_gen_group.multicolored_cb,
  101. "gerber_circle_steps": self.ui.gerber_defaults_form.gerber_gen_group.circle_steps_entry,
  102. "gerber_def_units": self.ui.gerber_defaults_form.gerber_gen_group.gerber_units_radio,
  103. "gerber_def_zeros": self.ui.gerber_defaults_form.gerber_gen_group.gerber_zeros_radio,
  104. "gerber_clean_apertures": self.ui.gerber_defaults_form.gerber_gen_group.gerber_clean_cb,
  105. "gerber_extra_buffering": self.ui.gerber_defaults_form.gerber_gen_group.gerber_extra_buffering,
  106. "gerber_plot_fill": self.ui.gerber_defaults_form.gerber_gen_group.pf_color_entry,
  107. "gerber_plot_line": self.ui.gerber_defaults_form.gerber_gen_group.pl_color_entry,
  108. # Gerber Options
  109. "gerber_isotooldia": self.ui.gerber_defaults_form.gerber_opt_group.iso_tool_dia_entry,
  110. "gerber_isopasses": self.ui.gerber_defaults_form.gerber_opt_group.iso_width_entry,
  111. "gerber_isooverlap": self.ui.gerber_defaults_form.gerber_opt_group.iso_overlap_entry,
  112. "gerber_combine_passes": self.ui.gerber_defaults_form.gerber_opt_group.combine_passes_cb,
  113. "gerber_iso_scope": self.ui.gerber_defaults_form.gerber_opt_group.iso_scope_radio,
  114. "gerber_milling_type": self.ui.gerber_defaults_form.gerber_opt_group.milling_type_radio,
  115. "gerber_noncoppermargin": self.ui.gerber_defaults_form.gerber_opt_group.noncopper_margin_entry,
  116. "gerber_noncopperrounded": self.ui.gerber_defaults_form.gerber_opt_group.noncopper_rounded_cb,
  117. "gerber_bboxmargin": self.ui.gerber_defaults_form.gerber_opt_group.bbmargin_entry,
  118. "gerber_bboxrounded": self.ui.gerber_defaults_form.gerber_opt_group.bbrounded_cb,
  119. # Gerber Advanced Options
  120. "gerber_aperture_display": self.ui.gerber_defaults_form.gerber_adv_opt_group.aperture_table_visibility_cb,
  121. # "gerber_aperture_scale_factor": self.ui.gerber_defaults_form.gerber_adv_opt_group.scale_aperture_entry,
  122. # "gerber_aperture_buffer_factor": self.ui.gerber_defaults_form.gerber_adv_opt_group.buffer_aperture_entry,
  123. "gerber_follow": self.ui.gerber_defaults_form.gerber_adv_opt_group.follow_cb,
  124. "gerber_tool_type": self.ui.gerber_defaults_form.gerber_adv_opt_group.tool_type_radio,
  125. "gerber_vtipdia": self.ui.gerber_defaults_form.gerber_adv_opt_group.tipdia_spinner,
  126. "gerber_vtipangle": self.ui.gerber_defaults_form.gerber_adv_opt_group.tipangle_spinner,
  127. "gerber_vcutz": self.ui.gerber_defaults_form.gerber_adv_opt_group.cutz_spinner,
  128. "gerber_iso_type": self.ui.gerber_defaults_form.gerber_adv_opt_group.iso_type_radio,
  129. "gerber_buffering": self.ui.gerber_defaults_form.gerber_adv_opt_group.buffering_radio,
  130. "gerber_simplification": self.ui.gerber_defaults_form.gerber_adv_opt_group.simplify_cb,
  131. "gerber_simp_tolerance": self.ui.gerber_defaults_form.gerber_adv_opt_group.simplification_tol_spinner,
  132. # Gerber Export
  133. "gerber_exp_units": self.ui.gerber_defaults_form.gerber_exp_group.gerber_units_radio,
  134. "gerber_exp_integer": self.ui.gerber_defaults_form.gerber_exp_group.format_whole_entry,
  135. "gerber_exp_decimals": self.ui.gerber_defaults_form.gerber_exp_group.format_dec_entry,
  136. "gerber_exp_zeros": self.ui.gerber_defaults_form.gerber_exp_group.zeros_radio,
  137. # Gerber Editor
  138. "gerber_editor_sel_limit": self.ui.gerber_defaults_form.gerber_editor_group.sel_limit_entry,
  139. "gerber_editor_newcode": self.ui.gerber_defaults_form.gerber_editor_group.addcode_entry,
  140. "gerber_editor_newsize": self.ui.gerber_defaults_form.gerber_editor_group.addsize_entry,
  141. "gerber_editor_newtype": self.ui.gerber_defaults_form.gerber_editor_group.addtype_combo,
  142. "gerber_editor_newdim": self.ui.gerber_defaults_form.gerber_editor_group.adddim_entry,
  143. "gerber_editor_array_size": self.ui.gerber_defaults_form.gerber_editor_group.grb_array_size_entry,
  144. "gerber_editor_lin_axis": self.ui.gerber_defaults_form.gerber_editor_group.grb_axis_radio,
  145. "gerber_editor_lin_pitch": self.ui.gerber_defaults_form.gerber_editor_group.grb_pitch_entry,
  146. "gerber_editor_lin_angle": self.ui.gerber_defaults_form.gerber_editor_group.grb_angle_entry,
  147. "gerber_editor_circ_dir": self.ui.gerber_defaults_form.gerber_editor_group.grb_circular_dir_radio,
  148. "gerber_editor_circ_angle":
  149. self.ui.gerber_defaults_form.gerber_editor_group.grb_circular_angle_entry,
  150. "gerber_editor_scale_f": self.ui.gerber_defaults_form.gerber_editor_group.grb_scale_entry,
  151. "gerber_editor_buff_f": self.ui.gerber_defaults_form.gerber_editor_group.grb_buff_entry,
  152. "gerber_editor_ma_low": self.ui.gerber_defaults_form.gerber_editor_group.grb_ma_low_entry,
  153. "gerber_editor_ma_high": self.ui.gerber_defaults_form.gerber_editor_group.grb_ma_high_entry,
  154. # Excellon General
  155. "excellon_plot": self.ui.excellon_defaults_form.excellon_gen_group.plot_cb,
  156. "excellon_solid": self.ui.excellon_defaults_form.excellon_gen_group.solid_cb,
  157. "excellon_format_upper_in":
  158. self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_upper_in_entry,
  159. "excellon_format_lower_in":
  160. self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_lower_in_entry,
  161. "excellon_format_upper_mm":
  162. self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_upper_mm_entry,
  163. "excellon_format_lower_mm":
  164. self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_lower_mm_entry,
  165. "excellon_zeros": self.ui.excellon_defaults_form.excellon_gen_group.excellon_zeros_radio,
  166. "excellon_units": self.ui.excellon_defaults_form.excellon_gen_group.excellon_units_radio,
  167. "excellon_update": self.ui.excellon_defaults_form.excellon_gen_group.update_excellon_cb,
  168. "excellon_optimization_type": self.ui.excellon_defaults_form.excellon_gen_group.excellon_optimization_radio,
  169. "excellon_search_time": self.ui.excellon_defaults_form.excellon_gen_group.optimization_time_entry,
  170. "excellon_plot_fill": self.ui.excellon_defaults_form.excellon_gen_group.fill_color_entry,
  171. "excellon_plot_line": self.ui.excellon_defaults_form.excellon_gen_group.line_color_entry,
  172. # Excellon Options
  173. "excellon_operation": self.ui.excellon_defaults_form.excellon_opt_group.operation_radio,
  174. "excellon_milling_type": self.ui.excellon_defaults_form.excellon_opt_group.milling_type_radio,
  175. "excellon_milling_dia": self.ui.excellon_defaults_form.excellon_opt_group.mill_dia_entry,
  176. "excellon_cutz": self.ui.excellon_defaults_form.excellon_opt_group.cutz_entry,
  177. "excellon_multidepth": self.ui.excellon_defaults_form.excellon_opt_group.mpass_cb,
  178. "excellon_depthperpass": self.ui.excellon_defaults_form.excellon_opt_group.maxdepth_entry,
  179. "excellon_travelz": self.ui.excellon_defaults_form.excellon_opt_group.travelz_entry,
  180. "excellon_endz": self.ui.excellon_defaults_form.excellon_opt_group.endz_entry,
  181. "excellon_endxy": self.ui.excellon_defaults_form.excellon_opt_group.endxy_entry,
  182. "excellon_feedrate_z": self.ui.excellon_defaults_form.excellon_opt_group.feedrate_z_entry,
  183. "excellon_spindlespeed": self.ui.excellon_defaults_form.excellon_opt_group.spindlespeed_entry,
  184. "excellon_dwell": self.ui.excellon_defaults_form.excellon_opt_group.dwell_cb,
  185. "excellon_dwelltime": self.ui.excellon_defaults_form.excellon_opt_group.dwelltime_entry,
  186. "excellon_toolchange": self.ui.excellon_defaults_form.excellon_opt_group.toolchange_cb,
  187. "excellon_toolchangez": self.ui.excellon_defaults_form.excellon_opt_group.toolchangez_entry,
  188. "excellon_ppname_e": self.ui.excellon_defaults_form.excellon_opt_group.pp_excellon_name_cb,
  189. "excellon_tooldia": self.ui.excellon_defaults_form.excellon_opt_group.tooldia_entry,
  190. "excellon_slot_tooldia": self.ui.excellon_defaults_form.excellon_opt_group.slot_tooldia_entry,
  191. "excellon_gcode_type": self.ui.excellon_defaults_form.excellon_opt_group.excellon_gcode_type_radio,
  192. # Excellon Advanced Options
  193. "excellon_offset": self.ui.excellon_defaults_form.excellon_adv_opt_group.offset_entry,
  194. "excellon_toolchangexy": self.ui.excellon_defaults_form.excellon_adv_opt_group.toolchangexy_entry,
  195. "excellon_startz": self.ui.excellon_defaults_form.excellon_adv_opt_group.estartz_entry,
  196. "excellon_feedrate_rapid": self.ui.excellon_defaults_form.excellon_adv_opt_group.feedrate_rapid_entry,
  197. "excellon_z_pdepth": self.ui.excellon_defaults_form.excellon_adv_opt_group.pdepth_entry,
  198. "excellon_feedrate_probe": self.ui.excellon_defaults_form.excellon_adv_opt_group.feedrate_probe_entry,
  199. "excellon_spindledir": self.ui.excellon_defaults_form.excellon_adv_opt_group.spindledir_radio,
  200. "excellon_f_plunge": self.ui.excellon_defaults_form.excellon_adv_opt_group.fplunge_cb,
  201. "excellon_f_retract": self.ui.excellon_defaults_form.excellon_adv_opt_group.fretract_cb,
  202. # Excellon Export
  203. "excellon_exp_units": self.ui.excellon_defaults_form.excellon_exp_group.excellon_units_radio,
  204. "excellon_exp_format": self.ui.excellon_defaults_form.excellon_exp_group.format_radio,
  205. "excellon_exp_integer": self.ui.excellon_defaults_form.excellon_exp_group.format_whole_entry,
  206. "excellon_exp_decimals": self.ui.excellon_defaults_form.excellon_exp_group.format_dec_entry,
  207. "excellon_exp_zeros": self.ui.excellon_defaults_form.excellon_exp_group.zeros_radio,
  208. "excellon_exp_slot_type": self.ui.excellon_defaults_form.excellon_exp_group.slot_type_radio,
  209. # Excellon Editor
  210. "excellon_editor_sel_limit": self.ui.excellon_defaults_form.excellon_editor_group.sel_limit_entry,
  211. "excellon_editor_newdia": self.ui.excellon_defaults_form.excellon_editor_group.addtool_entry,
  212. "excellon_editor_array_size": self.ui.excellon_defaults_form.excellon_editor_group.drill_array_size_entry,
  213. "excellon_editor_lin_dir": self.ui.excellon_defaults_form.excellon_editor_group.drill_axis_radio,
  214. "excellon_editor_lin_pitch": self.ui.excellon_defaults_form.excellon_editor_group.drill_pitch_entry,
  215. "excellon_editor_lin_angle": self.ui.excellon_defaults_form.excellon_editor_group.drill_angle_entry,
  216. "excellon_editor_circ_dir": self.ui.excellon_defaults_form.excellon_editor_group.drill_circular_dir_radio,
  217. "excellon_editor_circ_angle":
  218. self.ui.excellon_defaults_form.excellon_editor_group.drill_circular_angle_entry,
  219. # Excellon Slots
  220. "excellon_editor_slot_direction":
  221. self.ui.excellon_defaults_form.excellon_editor_group.slot_axis_radio,
  222. "excellon_editor_slot_angle":
  223. self.ui.excellon_defaults_form.excellon_editor_group.slot_angle_spinner,
  224. "excellon_editor_slot_length":
  225. self.ui.excellon_defaults_form.excellon_editor_group.slot_length_entry,
  226. # Excellon Slots
  227. "excellon_editor_slot_array_size":
  228. self.ui.excellon_defaults_form.excellon_editor_group.slot_array_size_entry,
  229. "excellon_editor_slot_lin_dir": self.ui.excellon_defaults_form.excellon_editor_group.slot_array_axis_radio,
  230. "excellon_editor_slot_lin_pitch":
  231. self.ui.excellon_defaults_form.excellon_editor_group.slot_array_pitch_entry,
  232. "excellon_editor_slot_lin_angle":
  233. self.ui.excellon_defaults_form.excellon_editor_group.slot_array_angle_entry,
  234. "excellon_editor_slot_circ_dir":
  235. self.ui.excellon_defaults_form.excellon_editor_group.slot_array_circular_dir_radio,
  236. "excellon_editor_slot_circ_angle":
  237. self.ui.excellon_defaults_form.excellon_editor_group.slot_array_circular_angle_entry,
  238. # Geometry General
  239. "geometry_plot": self.ui.geometry_defaults_form.geometry_gen_group.plot_cb,
  240. "geometry_circle_steps": self.ui.geometry_defaults_form.geometry_gen_group.circle_steps_entry,
  241. "geometry_cnctooldia": self.ui.geometry_defaults_form.geometry_gen_group.cnctooldia_entry,
  242. "geometry_plot_line": self.ui.geometry_defaults_form.geometry_gen_group.line_color_entry,
  243. # Geometry Options
  244. "geometry_cutz": self.ui.geometry_defaults_form.geometry_opt_group.cutz_entry,
  245. "geometry_travelz": self.ui.geometry_defaults_form.geometry_opt_group.travelz_entry,
  246. "geometry_feedrate": self.ui.geometry_defaults_form.geometry_opt_group.cncfeedrate_entry,
  247. "geometry_feedrate_z": self.ui.geometry_defaults_form.geometry_opt_group.feedrate_z_entry,
  248. "geometry_spindlespeed": self.ui.geometry_defaults_form.geometry_opt_group.cncspindlespeed_entry,
  249. "geometry_dwell": self.ui.geometry_defaults_form.geometry_opt_group.dwell_cb,
  250. "geometry_dwelltime": self.ui.geometry_defaults_form.geometry_opt_group.dwelltime_entry,
  251. "geometry_ppname_g": self.ui.geometry_defaults_form.geometry_opt_group.pp_geometry_name_cb,
  252. "geometry_toolchange": self.ui.geometry_defaults_form.geometry_opt_group.toolchange_cb,
  253. "geometry_toolchangez": self.ui.geometry_defaults_form.geometry_opt_group.toolchangez_entry,
  254. "geometry_endz": self.ui.geometry_defaults_form.geometry_opt_group.endz_entry,
  255. "geometry_endxy": self.ui.geometry_defaults_form.geometry_opt_group.endxy_entry,
  256. "geometry_depthperpass": self.ui.geometry_defaults_form.geometry_opt_group.depthperpass_entry,
  257. "geometry_multidepth": self.ui.geometry_defaults_form.geometry_opt_group.multidepth_cb,
  258. # Geometry Advanced Options
  259. "geometry_toolchangexy": self.ui.geometry_defaults_form.geometry_adv_opt_group.toolchangexy_entry,
  260. "geometry_startz": self.ui.geometry_defaults_form.geometry_adv_opt_group.gstartz_entry,
  261. "geometry_feedrate_rapid": self.ui.geometry_defaults_form.geometry_adv_opt_group.feedrate_rapid_entry,
  262. "geometry_extracut": self.ui.geometry_defaults_form.geometry_adv_opt_group.extracut_cb,
  263. "geometry_extracut_length": self.ui.geometry_defaults_form.geometry_adv_opt_group.e_cut_entry,
  264. "geometry_z_pdepth": self.ui.geometry_defaults_form.geometry_adv_opt_group.pdepth_entry,
  265. "geometry_feedrate_probe": self.ui.geometry_defaults_form.geometry_adv_opt_group.feedrate_probe_entry,
  266. "geometry_spindledir": self.ui.geometry_defaults_form.geometry_adv_opt_group.spindledir_radio,
  267. "geometry_f_plunge": self.ui.geometry_defaults_form.geometry_adv_opt_group.fplunge_cb,
  268. "geometry_segx": self.ui.geometry_defaults_form.geometry_adv_opt_group.segx_entry,
  269. "geometry_segy": self.ui.geometry_defaults_form.geometry_adv_opt_group.segy_entry,
  270. # Geometry Editor
  271. "geometry_editor_sel_limit": self.ui.geometry_defaults_form.geometry_editor_group.sel_limit_entry,
  272. "geometry_editor_milling_type": self.ui.geometry_defaults_form.geometry_editor_group.milling_type_radio,
  273. # CNCJob General
  274. "cncjob_plot": self.ui.cncjob_defaults_form.cncjob_gen_group.plot_cb,
  275. "cncjob_plot_kind": self.ui.cncjob_defaults_form.cncjob_gen_group.cncplot_method_radio,
  276. "cncjob_annotation": self.ui.cncjob_defaults_form.cncjob_gen_group.annotation_cb,
  277. "cncjob_tooldia": self.ui.cncjob_defaults_form.cncjob_gen_group.tooldia_entry,
  278. "cncjob_coords_type": self.ui.cncjob_defaults_form.cncjob_gen_group.coords_type_radio,
  279. "cncjob_coords_decimals": self.ui.cncjob_defaults_form.cncjob_gen_group.coords_dec_entry,
  280. "cncjob_fr_decimals": self.ui.cncjob_defaults_form.cncjob_gen_group.fr_dec_entry,
  281. "cncjob_steps_per_circle": self.ui.cncjob_defaults_form.cncjob_gen_group.steps_per_circle_entry,
  282. "cncjob_line_ending": self.ui.cncjob_defaults_form.cncjob_gen_group.line_ending_cb,
  283. "cncjob_plot_line": self.ui.cncjob_defaults_form.cncjob_gen_group.line_color_entry,
  284. "cncjob_plot_fill": self.ui.cncjob_defaults_form.cncjob_gen_group.fill_color_entry,
  285. "cncjob_travel_line": self.ui.cncjob_defaults_form.cncjob_gen_group.tline_color_entry,
  286. "cncjob_travel_fill": self.ui.cncjob_defaults_form.cncjob_gen_group.tfill_color_entry,
  287. # CNC Job Options
  288. "cncjob_prepend": self.ui.cncjob_defaults_form.cncjob_opt_group.prepend_text,
  289. "cncjob_append": self.ui.cncjob_defaults_form.cncjob_opt_group.append_text,
  290. # CNC Job Advanced Options
  291. "cncjob_toolchange_macro": self.ui.cncjob_defaults_form.cncjob_adv_opt_group.toolchange_text,
  292. "cncjob_toolchange_macro_enable": self.ui.cncjob_defaults_form.cncjob_adv_opt_group.toolchange_cb,
  293. "cncjob_annotation_fontsize": self.ui.cncjob_defaults_form.cncjob_adv_opt_group.annotation_fontsize_sp,
  294. "cncjob_annotation_fontcolor": self.ui.cncjob_defaults_form.cncjob_adv_opt_group.annotation_fontcolor_entry,
  295. # NCC Tool
  296. "tools_ncctools": self.ui.tools_defaults_form.tools_ncc_group.ncc_tool_dia_entry,
  297. "tools_nccorder": self.ui.tools_defaults_form.tools_ncc_group.ncc_order_radio,
  298. "tools_nccoverlap": self.ui.tools_defaults_form.tools_ncc_group.ncc_overlap_entry,
  299. "tools_nccmargin": self.ui.tools_defaults_form.tools_ncc_group.ncc_margin_entry,
  300. "tools_nccmethod": self.ui.tools_defaults_form.tools_ncc_group.ncc_method_combo,
  301. "tools_nccconnect": self.ui.tools_defaults_form.tools_ncc_group.ncc_connect_cb,
  302. "tools_ncccontour": self.ui.tools_defaults_form.tools_ncc_group.ncc_contour_cb,
  303. "tools_nccrest": self.ui.tools_defaults_form.tools_ncc_group.ncc_rest_cb,
  304. "tools_ncc_offset_choice": self.ui.tools_defaults_form.tools_ncc_group.ncc_choice_offset_cb,
  305. "tools_ncc_offset_value": self.ui.tools_defaults_form.tools_ncc_group.ncc_offset_spinner,
  306. "tools_nccref": self.ui.tools_defaults_form.tools_ncc_group.select_combo,
  307. "tools_ncc_area_shape": self.ui.tools_defaults_form.tools_ncc_group.area_shape_radio,
  308. "tools_ncc_plotting": self.ui.tools_defaults_form.tools_ncc_group.ncc_plotting_radio,
  309. "tools_nccmilling_type": self.ui.tools_defaults_form.tools_ncc_group.milling_type_radio,
  310. "tools_ncctool_type": self.ui.tools_defaults_form.tools_ncc_group.tool_type_radio,
  311. "tools_ncccutz": self.ui.tools_defaults_form.tools_ncc_group.cutz_entry,
  312. "tools_ncctipdia": self.ui.tools_defaults_form.tools_ncc_group.tipdia_entry,
  313. "tools_ncctipangle": self.ui.tools_defaults_form.tools_ncc_group.tipangle_entry,
  314. "tools_nccnewdia": self.ui.tools_defaults_form.tools_ncc_group.newdia_entry,
  315. # CutOut Tool
  316. "tools_cutouttooldia": self.ui.tools_defaults_form.tools_cutout_group.cutout_tooldia_entry,
  317. "tools_cutoutkind": self.ui.tools_defaults_form.tools_cutout_group.obj_kind_combo,
  318. "tools_cutoutmargin": self.ui.tools_defaults_form.tools_cutout_group.cutout_margin_entry,
  319. "tools_cutout_z": self.ui.tools_defaults_form.tools_cutout_group.cutz_entry,
  320. "tools_cutout_depthperpass": self.ui.tools_defaults_form.tools_cutout_group.maxdepth_entry,
  321. "tools_cutout_mdepth": self.ui.tools_defaults_form.tools_cutout_group.mpass_cb,
  322. "tools_cutoutgapsize": self.ui.tools_defaults_form.tools_cutout_group.cutout_gap_entry,
  323. "tools_gaps_ff": self.ui.tools_defaults_form.tools_cutout_group.gaps_combo,
  324. "tools_cutout_convexshape": self.ui.tools_defaults_form.tools_cutout_group.convex_box,
  325. # Paint Area Tool
  326. "tools_painttooldia": self.ui.tools_defaults_form.tools_paint_group.painttooldia_entry,
  327. "tools_paintorder": self.ui.tools_defaults_form.tools_paint_group.paint_order_radio,
  328. "tools_paintoverlap": self.ui.tools_defaults_form.tools_paint_group.paintoverlap_entry,
  329. "tools_paintmargin": self.ui.tools_defaults_form.tools_paint_group.paintmargin_entry,
  330. "tools_paintmethod": self.ui.tools_defaults_form.tools_paint_group.paintmethod_combo,
  331. "tools_selectmethod": self.ui.tools_defaults_form.tools_paint_group.selectmethod_combo,
  332. "tools_paint_area_shape": self.ui.tools_defaults_form.tools_paint_group.area_shape_radio,
  333. "tools_pathconnect": self.ui.tools_defaults_form.tools_paint_group.pathconnect_cb,
  334. "tools_paintcontour": self.ui.tools_defaults_form.tools_paint_group.contour_cb,
  335. "tools_paint_plotting": self.ui.tools_defaults_form.tools_paint_group.paint_plotting_radio,
  336. "tools_paintrest": self.ui.tools_defaults_form.tools_paint_group.rest_cb,
  337. "tools_painttool_type": self.ui.tools_defaults_form.tools_paint_group.tool_type_radio,
  338. "tools_paintcutz": self.ui.tools_defaults_form.tools_paint_group.cutz_entry,
  339. "tools_painttipdia": self.ui.tools_defaults_form.tools_paint_group.tipdia_entry,
  340. "tools_painttipangle": self.ui.tools_defaults_form.tools_paint_group.tipangle_entry,
  341. "tools_paintnewdia": self.ui.tools_defaults_form.tools_paint_group.newdia_entry,
  342. # 2-sided Tool
  343. "tools_2sided_mirror_axis": self.ui.tools_defaults_form.tools_2sided_group.mirror_axis_radio,
  344. "tools_2sided_axis_loc": self.ui.tools_defaults_form.tools_2sided_group.axis_location_radio,
  345. "tools_2sided_drilldia": self.ui.tools_defaults_form.tools_2sided_group.drill_dia_entry,
  346. "tools_2sided_allign_axis": self.ui.tools_defaults_form.tools_2sided_group.align_axis_radio,
  347. # Film Tool
  348. "tools_film_type": self.ui.tools_defaults_form.tools_film_group.film_type_radio,
  349. "tools_film_boundary": self.ui.tools_defaults_form.tools_film_group.film_boundary_entry,
  350. "tools_film_scale_stroke": self.ui.tools_defaults_form.tools_film_group.film_scale_stroke_entry,
  351. "tools_film_color": self.ui.tools_defaults_form.tools_film_group.film_color_entry,
  352. "tools_film_scale_cb": self.ui.tools_defaults_form.tools_film_group.film_scale_cb,
  353. "tools_film_scale_x_entry": self.ui.tools_defaults_form.tools_film_group.film_scalex_entry,
  354. "tools_film_scale_y_entry": self.ui.tools_defaults_form.tools_film_group.film_scaley_entry,
  355. "tools_film_skew_cb": self.ui.tools_defaults_form.tools_film_group.film_skew_cb,
  356. "tools_film_skew_x_entry": self.ui.tools_defaults_form.tools_film_group.film_skewx_entry,
  357. "tools_film_skew_y_entry": self.ui.tools_defaults_form.tools_film_group.film_skewy_entry,
  358. "tools_film_skew_ref_radio": self.ui.tools_defaults_form.tools_film_group.film_skew_reference,
  359. "tools_film_mirror_cb": self.ui.tools_defaults_form.tools_film_group.film_mirror_cb,
  360. "tools_film_mirror_axis_radio": self.ui.tools_defaults_form.tools_film_group.film_mirror_axis,
  361. "tools_film_file_type_radio": self.ui.tools_defaults_form.tools_film_group.file_type_radio,
  362. "tools_film_orientation": self.ui.tools_defaults_form.tools_film_group.orientation_radio,
  363. "tools_film_pagesize": self.ui.tools_defaults_form.tools_film_group.pagesize_combo,
  364. # Panelize Tool
  365. "tools_panelize_spacing_columns": self.ui.tools_defaults_form.tools_panelize_group.pspacing_columns,
  366. "tools_panelize_spacing_rows": self.ui.tools_defaults_form.tools_panelize_group.pspacing_rows,
  367. "tools_panelize_columns": self.ui.tools_defaults_form.tools_panelize_group.pcolumns,
  368. "tools_panelize_rows": self.ui.tools_defaults_form.tools_panelize_group.prows,
  369. "tools_panelize_constrain": self.ui.tools_defaults_form.tools_panelize_group.pconstrain_cb,
  370. "tools_panelize_constrainx": self.ui.tools_defaults_form.tools_panelize_group.px_width_entry,
  371. "tools_panelize_constrainy": self.ui.tools_defaults_form.tools_panelize_group.py_height_entry,
  372. "tools_panelize_panel_type": self.ui.tools_defaults_form.tools_panelize_group.panel_type_radio,
  373. # Calculators Tool
  374. "tools_calc_vshape_tip_dia": self.ui.tools_defaults_form.tools_calculators_group.tip_dia_entry,
  375. "tools_calc_vshape_tip_angle": self.ui.tools_defaults_form.tools_calculators_group.tip_angle_entry,
  376. "tools_calc_vshape_cut_z": self.ui.tools_defaults_form.tools_calculators_group.cut_z_entry,
  377. "tools_calc_electro_length": self.ui.tools_defaults_form.tools_calculators_group.pcblength_entry,
  378. "tools_calc_electro_width": self.ui.tools_defaults_form.tools_calculators_group.pcbwidth_entry,
  379. "tools_calc_electro_cdensity": self.ui.tools_defaults_form.tools_calculators_group.cdensity_entry,
  380. "tools_calc_electro_growth": self.ui.tools_defaults_form.tools_calculators_group.growth_entry,
  381. # Transformations Tool
  382. "tools_transform_rotate": self.ui.tools_defaults_form.tools_transform_group.rotate_entry,
  383. "tools_transform_skew_x": self.ui.tools_defaults_form.tools_transform_group.skewx_entry,
  384. "tools_transform_skew_y": self.ui.tools_defaults_form.tools_transform_group.skewy_entry,
  385. "tools_transform_scale_x": self.ui.tools_defaults_form.tools_transform_group.scalex_entry,
  386. "tools_transform_scale_y": self.ui.tools_defaults_form.tools_transform_group.scaley_entry,
  387. "tools_transform_scale_link": self.ui.tools_defaults_form.tools_transform_group.link_cb,
  388. "tools_transform_scale_reference": self.ui.tools_defaults_form.tools_transform_group.reference_cb,
  389. "tools_transform_offset_x": self.ui.tools_defaults_form.tools_transform_group.offx_entry,
  390. "tools_transform_offset_y": self.ui.tools_defaults_form.tools_transform_group.offy_entry,
  391. "tools_transform_mirror_reference": self.ui.tools_defaults_form.tools_transform_group.mirror_reference_cb,
  392. "tools_transform_mirror_point": self.ui.tools_defaults_form.tools_transform_group.flip_ref_entry,
  393. "tools_transform_buffer_dis": self.ui.tools_defaults_form.tools_transform_group.buffer_entry,
  394. "tools_transform_buffer_factor": self.ui.tools_defaults_form.tools_transform_group.buffer_factor_entry,
  395. "tools_transform_buffer_corner": self.ui.tools_defaults_form.tools_transform_group.buffer_rounded_cb,
  396. # SolderPaste Dispensing Tool
  397. "tools_solderpaste_tools": self.ui.tools_defaults_form.tools_solderpaste_group.nozzle_tool_dia_entry,
  398. "tools_solderpaste_new": self.ui.tools_defaults_form.tools_solderpaste_group.addtool_entry,
  399. "tools_solderpaste_z_start": self.ui.tools_defaults_form.tools_solderpaste_group.z_start_entry,
  400. "tools_solderpaste_z_dispense": self.ui.tools_defaults_form.tools_solderpaste_group.z_dispense_entry,
  401. "tools_solderpaste_z_stop": self.ui.tools_defaults_form.tools_solderpaste_group.z_stop_entry,
  402. "tools_solderpaste_z_travel": self.ui.tools_defaults_form.tools_solderpaste_group.z_travel_entry,
  403. "tools_solderpaste_z_toolchange": self.ui.tools_defaults_form.tools_solderpaste_group.z_toolchange_entry,
  404. "tools_solderpaste_xy_toolchange": self.ui.tools_defaults_form.tools_solderpaste_group.xy_toolchange_entry,
  405. "tools_solderpaste_frxy": self.ui.tools_defaults_form.tools_solderpaste_group.frxy_entry,
  406. "tools_solderpaste_frz": self.ui.tools_defaults_form.tools_solderpaste_group.frz_entry,
  407. "tools_solderpaste_frz_dispense": self.ui.tools_defaults_form.tools_solderpaste_group.frz_dispense_entry,
  408. "tools_solderpaste_speedfwd": self.ui.tools_defaults_form.tools_solderpaste_group.speedfwd_entry,
  409. "tools_solderpaste_dwellfwd": self.ui.tools_defaults_form.tools_solderpaste_group.dwellfwd_entry,
  410. "tools_solderpaste_speedrev": self.ui.tools_defaults_form.tools_solderpaste_group.speedrev_entry,
  411. "tools_solderpaste_dwellrev": self.ui.tools_defaults_form.tools_solderpaste_group.dwellrev_entry,
  412. "tools_solderpaste_pp": self.ui.tools_defaults_form.tools_solderpaste_group.pp_combo,
  413. "tools_sub_close_paths": self.ui.tools_defaults_form.tools_sub_group.close_paths_cb,
  414. # #######################################################################################################
  415. # ########################################## TOOLS 2 ####################################################
  416. # #######################################################################################################
  417. # Optimal Tool
  418. "tools_opt_precision": self.ui.tools2_defaults_form.tools2_optimal_group.precision_sp,
  419. # Check Rules Tool
  420. "tools_cr_trace_size": self.ui.tools2_defaults_form.tools2_checkrules_group.trace_size_cb,
  421. "tools_cr_trace_size_val": self.ui.tools2_defaults_form.tools2_checkrules_group.trace_size_entry,
  422. "tools_cr_c2c": self.ui.tools2_defaults_form.tools2_checkrules_group.clearance_copper2copper_cb,
  423. "tools_cr_c2c_val": self.ui.tools2_defaults_form.tools2_checkrules_group.clearance_copper2copper_entry,
  424. "tools_cr_c2o": self.ui.tools2_defaults_form.tools2_checkrules_group.clearance_copper2ol_cb,
  425. "tools_cr_c2o_val": self.ui.tools2_defaults_form.tools2_checkrules_group.clearance_copper2ol_entry,
  426. "tools_cr_s2s": self.ui.tools2_defaults_form.tools2_checkrules_group.clearance_silk2silk_cb,
  427. "tools_cr_s2s_val": self.ui.tools2_defaults_form.tools2_checkrules_group.clearance_silk2silk_entry,
  428. "tools_cr_s2sm": self.ui.tools2_defaults_form.tools2_checkrules_group.clearance_silk2sm_cb,
  429. "tools_cr_s2sm_val": self.ui.tools2_defaults_form.tools2_checkrules_group.clearance_silk2sm_entry,
  430. "tools_cr_s2o": self.ui.tools2_defaults_form.tools2_checkrules_group.clearance_silk2ol_cb,
  431. "tools_cr_s2o_val": self.ui.tools2_defaults_form.tools2_checkrules_group.clearance_silk2ol_entry,
  432. "tools_cr_sm2sm": self.ui.tools2_defaults_form.tools2_checkrules_group.clearance_sm2sm_cb,
  433. "tools_cr_sm2sm_val": self.ui.tools2_defaults_form.tools2_checkrules_group.clearance_sm2sm_entry,
  434. "tools_cr_ri": self.ui.tools2_defaults_form.tools2_checkrules_group.ring_integrity_cb,
  435. "tools_cr_ri_val": self.ui.tools2_defaults_form.tools2_checkrules_group.ring_integrity_entry,
  436. "tools_cr_h2h": self.ui.tools2_defaults_form.tools2_checkrules_group.clearance_d2d_cb,
  437. "tools_cr_h2h_val": self.ui.tools2_defaults_form.tools2_checkrules_group.clearance_d2d_entry,
  438. "tools_cr_dh": self.ui.tools2_defaults_form.tools2_checkrules_group.drill_size_cb,
  439. "tools_cr_dh_val": self.ui.tools2_defaults_form.tools2_checkrules_group.drill_size_entry,
  440. # QRCode Tool
  441. "tools_qrcode_version": self.ui.tools2_defaults_form.tools2_qrcode_group.version_entry,
  442. "tools_qrcode_error": self.ui.tools2_defaults_form.tools2_qrcode_group.error_radio,
  443. "tools_qrcode_box_size": self.ui.tools2_defaults_form.tools2_qrcode_group.bsize_entry,
  444. "tools_qrcode_border_size": self.ui.tools2_defaults_form.tools2_qrcode_group.border_size_entry,
  445. "tools_qrcode_qrdata": self.ui.tools2_defaults_form.tools2_qrcode_group.text_data,
  446. "tools_qrcode_polarity": self.ui.tools2_defaults_form.tools2_qrcode_group.pol_radio,
  447. "tools_qrcode_rounded": self.ui.tools2_defaults_form.tools2_qrcode_group.bb_radio,
  448. "tools_qrcode_fill_color": self.ui.tools2_defaults_form.tools2_qrcode_group.fill_color_entry,
  449. "tools_qrcode_back_color": self.ui.tools2_defaults_form.tools2_qrcode_group.back_color_entry,
  450. "tools_qrcode_sel_limit": self.ui.tools2_defaults_form.tools2_qrcode_group.sel_limit_entry,
  451. # Copper Thieving Tool
  452. "tools_copper_thieving_clearance": self.ui.tools2_defaults_form.tools2_cfill_group.clearance_entry,
  453. "tools_copper_thieving_margin": self.ui.tools2_defaults_form.tools2_cfill_group.margin_entry,
  454. "tools_copper_thieving_reference": self.ui.tools2_defaults_form.tools2_cfill_group.reference_radio,
  455. "tools_copper_thieving_box_type": self.ui.tools2_defaults_form.tools2_cfill_group.bbox_type_radio,
  456. "tools_copper_thieving_circle_steps": self.ui.tools2_defaults_form.tools2_cfill_group.circlesteps_entry,
  457. "tools_copper_thieving_fill_type": self.ui.tools2_defaults_form.tools2_cfill_group.fill_type_radio,
  458. "tools_copper_thieving_dots_dia": self.ui.tools2_defaults_form.tools2_cfill_group.dot_dia_entry,
  459. "tools_copper_thieving_dots_spacing": self.ui.tools2_defaults_form.tools2_cfill_group.dot_spacing_entry,
  460. "tools_copper_thieving_squares_size": self.ui.tools2_defaults_form.tools2_cfill_group.square_size_entry,
  461. "tools_copper_thieving_squares_spacing":
  462. self.ui.tools2_defaults_form.tools2_cfill_group.squares_spacing_entry,
  463. "tools_copper_thieving_lines_size": self.ui.tools2_defaults_form.tools2_cfill_group.line_size_entry,
  464. "tools_copper_thieving_lines_spacing": self.ui.tools2_defaults_form.tools2_cfill_group.lines_spacing_entry,
  465. "tools_copper_thieving_rb_margin": self.ui.tools2_defaults_form.tools2_cfill_group.rb_margin_entry,
  466. "tools_copper_thieving_rb_thickness": self.ui.tools2_defaults_form.tools2_cfill_group.rb_thickness_entry,
  467. "tools_copper_thieving_mask_clearance": self.ui.tools2_defaults_form.tools2_cfill_group.clearance_ppm_entry,
  468. # Fiducials Tool
  469. "tools_fiducials_dia": self.ui.tools2_defaults_form.tools2_fiducials_group.dia_entry,
  470. "tools_fiducials_margin": self.ui.tools2_defaults_form.tools2_fiducials_group.margin_entry,
  471. "tools_fiducials_mode": self.ui.tools2_defaults_form.tools2_fiducials_group.mode_radio,
  472. "tools_fiducials_second_pos": self.ui.tools2_defaults_form.tools2_fiducials_group.pos_radio,
  473. "tools_fiducials_type": self.ui.tools2_defaults_form.tools2_fiducials_group.fid_type_radio,
  474. "tools_fiducials_line_thickness": self.ui.tools2_defaults_form.tools2_fiducials_group.line_thickness_entry,
  475. # Calibration Tool
  476. "tools_cal_calsource": self.ui.tools2_defaults_form.tools2_cal_group.cal_source_radio,
  477. "tools_cal_travelz": self.ui.tools2_defaults_form.tools2_cal_group.travelz_entry,
  478. "tools_cal_verz": self.ui.tools2_defaults_form.tools2_cal_group.verz_entry,
  479. "tools_cal_zeroz": self.ui.tools2_defaults_form.tools2_cal_group.zeroz_cb,
  480. "tools_cal_toolchangez": self.ui.tools2_defaults_form.tools2_cal_group.toolchangez_entry,
  481. "tools_cal_toolchange_xy": self.ui.tools2_defaults_form.tools2_cal_group.toolchange_xy_entry,
  482. "tools_cal_sec_point": self.ui.tools2_defaults_form.tools2_cal_group.second_point_radio,
  483. # Extract Drills Tool
  484. "tools_edrills_hole_type": self.ui.tools2_defaults_form.tools2_edrills_group.hole_size_radio,
  485. "tools_edrills_hole_fixed_dia": self.ui.tools2_defaults_form.tools2_edrills_group.dia_entry,
  486. "tools_edrills_hole_prop_factor": self.ui.tools2_defaults_form.tools2_edrills_group.factor_entry,
  487. "tools_edrills_circular_ring": self.ui.tools2_defaults_form.tools2_edrills_group.circular_ring_entry,
  488. "tools_edrills_oblong_ring": self.ui.tools2_defaults_form.tools2_edrills_group.oblong_ring_entry,
  489. "tools_edrills_square_ring": self.ui.tools2_defaults_form.tools2_edrills_group.square_ring_entry,
  490. "tools_edrills_rectangular_ring": self.ui.tools2_defaults_form.tools2_edrills_group.rectangular_ring_entry,
  491. "tools_edrills_others_ring": self.ui.tools2_defaults_form.tools2_edrills_group.other_ring_entry,
  492. "tools_edrills_circular": self.ui.tools2_defaults_form.tools2_edrills_group.circular_cb,
  493. "tools_edrills_oblong": self.ui.tools2_defaults_form.tools2_edrills_group.oblong_cb,
  494. "tools_edrills_square": self.ui.tools2_defaults_form.tools2_edrills_group.square_cb,
  495. "tools_edrills_rectangular": self.ui.tools2_defaults_form.tools2_edrills_group.rectangular_cb,
  496. "tools_edrills_others": self.ui.tools2_defaults_form.tools2_edrills_group.other_cb,
  497. # Punch Gerber Tool
  498. "tools_punch_hole_type": self.ui.tools2_defaults_form.tools2_punch_group.hole_size_radio,
  499. "tools_punch_hole_fixed_dia": self.ui.tools2_defaults_form.tools2_punch_group.dia_entry,
  500. "tools_punch_hole_prop_factor": self.ui.tools2_defaults_form.tools2_punch_group.factor_entry,
  501. "tools_punch_circular_ring": self.ui.tools2_defaults_form.tools2_punch_group.circular_ring_entry,
  502. "tools_punch_oblong_ring": self.ui.tools2_defaults_form.tools2_punch_group.oblong_ring_entry,
  503. "tools_punch_square_ring": self.ui.tools2_defaults_form.tools2_punch_group.square_ring_entry,
  504. "tools_punch_rectangular_ring": self.ui.tools2_defaults_form.tools2_punch_group.rectangular_ring_entry,
  505. "tools_punch_others_ring": self.ui.tools2_defaults_form.tools2_punch_group.other_ring_entry,
  506. "tools_punch_circular": self.ui.tools2_defaults_form.tools2_punch_group.circular_cb,
  507. "tools_punch_oblong": self.ui.tools2_defaults_form.tools2_punch_group.oblong_cb,
  508. "tools_punch_square": self.ui.tools2_defaults_form.tools2_punch_group.square_cb,
  509. "tools_punch_rectangular": self.ui.tools2_defaults_form.tools2_punch_group.rectangular_cb,
  510. "tools_punch_others": self.ui.tools2_defaults_form.tools2_punch_group.other_cb,
  511. # Invert Gerber Tool
  512. "tools_invert_margin": self.ui.tools2_defaults_form.tools2_invert_group.margin_entry,
  513. "tools_invert_join_style": self.ui.tools2_defaults_form.tools2_invert_group.join_radio,
  514. # Utilities
  515. # File associations
  516. "fa_excellon": self.ui.util_defaults_form.fa_excellon_group.exc_list_text,
  517. "fa_gcode": self.ui.util_defaults_form.fa_gcode_group.gco_list_text,
  518. # "fa_geometry": self.ui.util_defaults_form.fa_geometry_group.close_paths_cb,
  519. "fa_gerber": self.ui.util_defaults_form.fa_gerber_group.grb_list_text,
  520. "util_autocomplete_keywords": self.ui.util_defaults_form.kw_group.kw_list_text,
  521. }
  522. def defaults_read_form(self):
  523. """
  524. Will read all the values in the Preferences GUI and update the defaults dictionary.
  525. :return: None
  526. """
  527. for option in self.defaults_form_fields:
  528. try:
  529. self.defaults[option] = self.defaults_form_fields[option].get_value()
  530. except Exception as e:
  531. log.debug("App.defaults_read_form() --> %s" % str(e))
  532. def defaults_write_form(self, factor=None, fl_units=None, source_dict=None):
  533. """
  534. Will set the values for all the GUI elements in Preferences GUI based on the values found in the
  535. self.defaults dictionary.
  536. :param factor: will apply a factor to the values that written in the GUI elements
  537. :param fl_units: current measuring units in FlatCAM: Metric or Inch
  538. :param source_dict: the repository of options, usually is the self.defaults
  539. :return: None
  540. """
  541. options_storage = self.defaults if source_dict is None else source_dict
  542. for option in options_storage:
  543. if source_dict:
  544. self.defaults_write_form_field(option, factor=factor, units=fl_units, defaults_dict=source_dict)
  545. else:
  546. self.defaults_write_form_field(option, factor=factor, units=fl_units)
  547. def defaults_write_form_field(self, field, factor=None, units=None, defaults_dict=None):
  548. """
  549. Basically it is the worker in the self.defaults_write_form()
  550. :param field: the GUI element in Preferences GUI to be updated
  551. :param factor: factor to be applied to the field parameter
  552. :param units: current FLatCAM measuring units
  553. :param defaults_dict: the defaults storage
  554. :return: None, it updates GUI elements
  555. """
  556. def_dict = self.defaults if defaults_dict is None else defaults_dict
  557. try:
  558. value = def_dict[field]
  559. log.debug("value is "+str(value)+ " and factor is "+str(factor))
  560. if factor is not None:
  561. value *= factor
  562. form_field = self.defaults_form_fields[field]
  563. if units is None:
  564. form_field.set_value(value)
  565. elif (units == 'IN' or units == 'MM') and (field == 'global_gridx' or field == 'global_gridy'):
  566. form_field.set_value(value)
  567. except KeyError:
  568. pass
  569. except AttributeError:
  570. log.debug(field)
  571. def show_preferences_gui(self):
  572. """
  573. Called to initialize and show the Preferences GUI
  574. :return: None
  575. """
  576. gen_form = self.ui.general_defaults_form
  577. try:
  578. self.ui.general_scroll_area.takeWidget()
  579. except Exception:
  580. log.debug("Nothing to remove")
  581. self.ui.general_scroll_area.setWidget(gen_form)
  582. gen_form.show()
  583. ger_form = self.ui.gerber_defaults_form
  584. try:
  585. self.ui.gerber_scroll_area.takeWidget()
  586. except Exception:
  587. log.debug("Nothing to remove")
  588. self.ui.gerber_scroll_area.setWidget(ger_form)
  589. ger_form.show()
  590. exc_form = self.ui.excellon_defaults_form
  591. try:
  592. self.ui.excellon_scroll_area.takeWidget()
  593. except Exception:
  594. log.debug("Nothing to remove")
  595. self.ui.excellon_scroll_area.setWidget(exc_form)
  596. exc_form.show()
  597. geo_form = self.ui.geometry_defaults_form
  598. try:
  599. self.ui.geometry_scroll_area.takeWidget()
  600. except Exception:
  601. log.debug("Nothing to remove")
  602. self.ui.geometry_scroll_area.setWidget(geo_form)
  603. geo_form.show()
  604. cnc_form = self.ui.cncjob_defaults_form
  605. try:
  606. self.ui.cncjob_scroll_area.takeWidget()
  607. except Exception:
  608. log.debug("Nothing to remove")
  609. self.ui.cncjob_scroll_area.setWidget(cnc_form)
  610. cnc_form.show()
  611. tools_form = self.ui.tools_defaults_form
  612. try:
  613. self.ui.tools_scroll_area.takeWidget()
  614. except Exception:
  615. log.debug("Nothing to remove")
  616. self.ui.tools_scroll_area.setWidget(tools_form)
  617. tools_form.show()
  618. tools2_form = self.ui.tools2_defaults_form
  619. try:
  620. self.ui.tools2_scroll_area.takeWidget()
  621. except Exception:
  622. log.debug("Nothing to remove")
  623. self.ui.tools2_scroll_area.setWidget(tools2_form)
  624. tools2_form.show()
  625. fa_form = self.ui.util_defaults_form
  626. try:
  627. self.ui.fa_scroll_area.takeWidget()
  628. except Exception:
  629. log.debug("Nothing to remove")
  630. self.ui.fa_scroll_area.setWidget(fa_form)
  631. fa_form.show()
  632. # Initialize the color box's color in Preferences -> Global -> Colo
  633. self.__init_color_pickers()
  634. # Button handlers
  635. self.ui.pref_save_button.clicked.connect(lambda: self.on_save_button(save_to_file=True))
  636. self.ui.pref_apply_button.clicked.connect(lambda: self.on_save_button(save_to_file=False))
  637. self.ui.pref_close_button.clicked.connect(self.on_pref_close_button)
  638. self.ui.pref_defaults_button.clicked.connect(self.on_restore_defaults_preferences)
  639. log.debug("Finished Preferences GUI form initialization.")
  640. def __init_color_pickers(self):
  641. # Init Gerber Plot Colors
  642. self.ui.gerber_defaults_form.gerber_gen_group.pf_color_entry.set_value(self.defaults['gerber_plot_fill'])
  643. self.ui.gerber_defaults_form.gerber_gen_group.pf_color_button.setStyleSheet(
  644. "background-color:%s;"
  645. "border-color: dimgray" % str(self.defaults['gerber_plot_fill'])[:7])
  646. self.ui.gerber_defaults_form.gerber_gen_group.pf_color_alpha_spinner.set_value(
  647. int(self.defaults['gerber_plot_fill'][7:9], 16))
  648. self.ui.gerber_defaults_form.gerber_gen_group.pf_color_alpha_slider.setValue(
  649. int(self.defaults['gerber_plot_fill'][7:9], 16))
  650. self.ui.gerber_defaults_form.gerber_gen_group.pl_color_entry.set_value(self.defaults['gerber_plot_line'])
  651. self.ui.gerber_defaults_form.gerber_gen_group.pl_color_button.setStyleSheet(
  652. "background-color:%s;"
  653. "border-color: dimgray" % str(self.defaults['gerber_plot_line'])[:7])
  654. # Init Excellon Plot Colors
  655. self.ui.excellon_defaults_form.excellon_gen_group.fill_color_entry.set_value(
  656. self.defaults['excellon_plot_fill'])
  657. self.ui.excellon_defaults_form.excellon_gen_group.fill_color_button.setStyleSheet(
  658. "background-color:%s;"
  659. "border-color: dimgray" % str(self.defaults['excellon_plot_fill'])[:7])
  660. self.ui.excellon_defaults_form.excellon_gen_group.color_alpha_spinner.set_value(
  661. int(self.defaults['excellon_plot_fill'][7:9], 16))
  662. self.ui.excellon_defaults_form.excellon_gen_group.color_alpha_slider.setValue(
  663. int(self.defaults['excellon_plot_fill'][7:9], 16))
  664. self.ui.excellon_defaults_form.excellon_gen_group.line_color_entry.set_value(
  665. self.defaults['excellon_plot_line'])
  666. self.ui.excellon_defaults_form.excellon_gen_group.line_color_button.setStyleSheet(
  667. "background-color:%s;"
  668. "border-color: dimgray" % str(self.defaults['excellon_plot_line'])[:7])
  669. # Init Geometry Plot Colors
  670. self.ui.geometry_defaults_form.geometry_gen_group.line_color_entry.set_value(
  671. self.defaults['geometry_plot_line'])
  672. self.ui.geometry_defaults_form.geometry_gen_group.line_color_button.setStyleSheet(
  673. "background-color:%s;"
  674. "border-color: dimgray" % str(self.defaults['geometry_plot_line'])[:7])
  675. # Init CNCJob Travel Line Colors
  676. self.ui.cncjob_defaults_form.cncjob_gen_group.tfill_color_entry.set_value(
  677. self.defaults['cncjob_travel_fill'])
  678. self.ui.cncjob_defaults_form.cncjob_gen_group.tfill_color_button.setStyleSheet(
  679. "background-color:%s;"
  680. "border-color: dimgray" % str(self.defaults['cncjob_travel_fill'])[:7])
  681. self.ui.cncjob_defaults_form.cncjob_gen_group.tcolor_alpha_spinner.set_value(
  682. int(self.defaults['cncjob_travel_fill'][7:9], 16))
  683. self.ui.cncjob_defaults_form.cncjob_gen_group.tcolor_alpha_slider.setValue(
  684. int(self.defaults['cncjob_travel_fill'][7:9], 16))
  685. self.ui.cncjob_defaults_form.cncjob_gen_group.tline_color_entry.set_value(
  686. self.defaults['cncjob_travel_line'])
  687. self.ui.cncjob_defaults_form.cncjob_gen_group.tline_color_button.setStyleSheet(
  688. "background-color:%s;"
  689. "border-color: dimgray" % str(self.defaults['cncjob_travel_line'])[:7])
  690. # Init CNCJob Plot Colors
  691. self.ui.cncjob_defaults_form.cncjob_gen_group.fill_color_entry.set_value(
  692. self.defaults['cncjob_plot_fill'])
  693. self.ui.cncjob_defaults_form.cncjob_gen_group.fill_color_button.setStyleSheet(
  694. "background-color:%s;"
  695. "border-color: dimgray" % str(self.defaults['cncjob_plot_fill'])[:7])
  696. self.ui.cncjob_defaults_form.cncjob_gen_group.line_color_entry.set_value(
  697. self.defaults['cncjob_plot_line'])
  698. self.ui.cncjob_defaults_form.cncjob_gen_group.line_color_button.setStyleSheet(
  699. "background-color:%s;"
  700. "border-color: dimgray" % str(self.defaults['cncjob_plot_line'])[:7])
  701. # Init Left-Right Selection colors
  702. self.ui.general_defaults_form.general_gui_group.sf_color_entry.set_value(self.defaults['global_sel_fill'])
  703. self.ui.general_defaults_form.general_gui_group.sf_color_button.setStyleSheet(
  704. "background-color:%s;"
  705. "border-color: dimgray" % str(self.defaults['global_sel_fill'])[:7])
  706. self.ui.general_defaults_form.general_gui_group.sf_color_alpha_spinner.set_value(
  707. int(self.defaults['global_sel_fill'][7:9], 16))
  708. self.ui.general_defaults_form.general_gui_group.sf_color_alpha_slider.setValue(
  709. int(self.defaults['global_sel_fill'][7:9], 16))
  710. self.ui.general_defaults_form.general_gui_group.sl_color_entry.set_value(self.defaults['global_sel_line'])
  711. self.ui.general_defaults_form.general_gui_group.sl_color_button.setStyleSheet(
  712. "background-color:%s;"
  713. "border-color: dimgray" % str(self.defaults['global_sel_line'])[:7])
  714. # Init Right-Left Selection colors
  715. self.ui.general_defaults_form.general_gui_group.alt_sf_color_entry.set_value(
  716. self.defaults['global_alt_sel_fill'])
  717. self.ui.general_defaults_form.general_gui_group.alt_sf_color_button.setStyleSheet(
  718. "background-color:%s;"
  719. "border-color: dimgray" % str(self.defaults['global_alt_sel_fill'])[:7])
  720. self.ui.general_defaults_form.general_gui_group.alt_sf_color_alpha_spinner.set_value(
  721. int(self.defaults['global_sel_fill'][7:9], 16))
  722. self.ui.general_defaults_form.general_gui_group.alt_sf_color_alpha_slider.setValue(
  723. int(self.defaults['global_sel_fill'][7:9], 16))
  724. self.ui.general_defaults_form.general_gui_group.alt_sl_color_entry.set_value(
  725. self.defaults['global_alt_sel_line'])
  726. self.ui.general_defaults_form.general_gui_group.alt_sl_color_button.setStyleSheet(
  727. "background-color:%s;"
  728. "border-color: dimgray" % str(self.defaults['global_alt_sel_line'])[:7])
  729. # Init Draw color and Selection Draw Color
  730. self.ui.general_defaults_form.general_gui_group.draw_color_entry.set_value(
  731. self.defaults['global_draw_color'])
  732. self.ui.general_defaults_form.general_gui_group.draw_color_button.setStyleSheet(
  733. "background-color:%s;"
  734. "border-color: dimgray" % str(self.defaults['global_draw_color'])[:7])
  735. self.ui.general_defaults_form.general_gui_group.sel_draw_color_entry.set_value(
  736. self.defaults['global_sel_draw_color'])
  737. self.ui.general_defaults_form.general_gui_group.sel_draw_color_button.setStyleSheet(
  738. "background-color:%s;"
  739. "border-color: dimgray" % str(self.defaults['global_sel_draw_color'])[:7])
  740. # Init Project Items color
  741. self.ui.general_defaults_form.general_gui_group.proj_color_entry.set_value(
  742. self.defaults['global_proj_item_color'])
  743. self.ui.general_defaults_form.general_gui_group.proj_color_button.setStyleSheet(
  744. "background-color:%s;"
  745. "border-color: dimgray" % str(self.defaults['global_proj_item_color'])[:7])
  746. # Init Project Disabled Items color
  747. self.ui.general_defaults_form.general_gui_group.proj_color_dis_entry.set_value(
  748. self.defaults['global_proj_item_dis_color'])
  749. self.ui.general_defaults_form.general_gui_group.proj_color_dis_button.setStyleSheet(
  750. "background-color:%s;"
  751. "border-color: dimgray" % str(self.defaults['global_proj_item_dis_color'])[:7])
  752. # Init Project Disabled Items color
  753. self.ui.general_defaults_form.general_app_set_group.mouse_cursor_entry.set_value(
  754. self.defaults['global_cursor_color'])
  755. self.ui.general_defaults_form.general_app_set_group.mouse_cursor_button.setStyleSheet(
  756. "background-color:%s;"
  757. "border-color: dimgray" % str(self.defaults['global_cursor_color'])[:7])
  758. # Init the Annotation CNC Job color
  759. self.ui.cncjob_defaults_form.cncjob_adv_opt_group.annotation_fontcolor_entry.set_value(
  760. self.defaults['cncjob_annotation_fontcolor'])
  761. self.ui.cncjob_defaults_form.cncjob_adv_opt_group.annotation_fontcolor_button.setStyleSheet(
  762. "background-color:%s;"
  763. "border-color: dimgray" % str(self.defaults['cncjob_annotation_fontcolor'])[:7])
  764. # Init the Tool Film color
  765. self.ui.tools_defaults_form.tools_film_group.film_color_entry.set_value(
  766. self.defaults['tools_film_color'])
  767. self.ui.tools_defaults_form.tools_film_group.film_color_button.setStyleSheet(
  768. "background-color:%s;"
  769. "border-color: dimgray" % str(self.defaults['tools_film_color'])[:7]
  770. )
  771. # Init the Tool QRCode colors
  772. self.ui.tools2_defaults_form.tools2_qrcode_group.fill_color_entry.set_value(
  773. self.defaults['tools_qrcode_fill_color'])
  774. self.ui.tools2_defaults_form.tools2_qrcode_group.fill_color_button.setStyleSheet(
  775. "background-color:%s;"
  776. "border-color: dimgray" % str(self.defaults['tools_qrcode_fill_color'])[:7])
  777. self.ui.tools2_defaults_form.tools2_qrcode_group.back_color_entry.set_value(
  778. self.defaults['tools_qrcode_back_color'])
  779. self.ui.tools2_defaults_form.tools2_qrcode_group.back_color_button.setStyleSheet(
  780. "background-color:%s;"
  781. "border-color: dimgray" % str(self.defaults['tools_qrcode_back_color'])[:7])
  782. def on_save_button(self, save_to_file=True):
  783. log.debug("on_save_button() --> Applying preferences to file.")
  784. # Preferences saved, update flag
  785. self.preferences_changed_flag = False
  786. # Preferences save, update the color of the Preferences Tab text
  787. for idx in range(self.ui.plot_tab_area.count()):
  788. if self.ui.plot_tab_area.tabText(idx) == _("Preferences"):
  789. self.ui.plot_tab_area.tabBar.setTabTextColor(idx, QtGui.QColor('black'))
  790. # restore the default stylesheet by setting a blank one
  791. self.ui.pref_apply_button.setStyleSheet("")
  792. self.inform.emit('%s' % _("Preferences applied."))
  793. # make sure we update the self.current_defaults dict used to undo changes to self.defaults
  794. self.defaults.current_defaults.update(self.defaults)
  795. if save_to_file:
  796. self.save_defaults(silent=False)
  797. # load the defaults so they are updated into the app
  798. self.defaults.load(filename=os.path.join(self.data_path, 'current_defaults.FlatConfig'))
  799. # Re-fresh project options
  800. self.app.on_options_app2project()
  801. settgs = QSettings("Open Source", "FlatCAM")
  802. # save the notebook font size
  803. fsize = self.ui.general_defaults_form.general_app_set_group.notebook_font_size_spinner.get_value()
  804. settgs.setValue('notebook_font_size', fsize)
  805. # save the axis font size
  806. g_fsize = self.ui.general_defaults_form.general_app_set_group.axis_font_size_spinner.get_value()
  807. settgs.setValue('axis_font_size', g_fsize)
  808. # save the textbox font size
  809. tb_fsize = self.ui.general_defaults_form.general_app_set_group.textbox_font_size_spinner.get_value()
  810. settgs.setValue('textbox_font_size', tb_fsize)
  811. settgs.setValue(
  812. 'machinist',
  813. 1 if self.ui.general_defaults_form.general_app_set_group.machinist_cb.get_value() else 0
  814. )
  815. # This will write the setting to the platform specific storage.
  816. del settgs
  817. if save_to_file:
  818. # close the tab and delete it
  819. for idx in range(self.ui.plot_tab_area.count()):
  820. if self.ui.plot_tab_area.tabText(idx) == _("Preferences"):
  821. self.ui.plot_tab_area.tabBar.setTabTextColor(idx, QtGui.QColor('black'))
  822. self.ui.plot_tab_area.closeTab(idx)
  823. break
  824. def on_pref_close_button(self):
  825. # Preferences saved, update flag
  826. self.preferences_changed_flag = False
  827. self.ignore_tab_close_event = True
  828. try:
  829. self.ui.general_defaults_form.general_app_group.units_radio.activated_custom.disconnect()
  830. except (TypeError, AttributeError):
  831. pass
  832. self.defaults_write_form(source_dict=self.defaults.current_defaults)
  833. self.ui.general_defaults_form.general_app_group.units_radio.activated_custom.connect(
  834. lambda: self.app.on_toggle_units(no_pref=False))
  835. self.defaults.update(self.defaults.current_defaults)
  836. # Preferences save, update the color of the Preferences Tab text
  837. for idx in range(self.ui.plot_tab_area.count()):
  838. if self.ui.plot_tab_area.tabText(idx) == _("Preferences"):
  839. self.ui.plot_tab_area.tabBar.setTabTextColor(idx, QtGui.QColor('black'))
  840. self.ui.plot_tab_area.closeTab(idx)
  841. break
  842. self.inform.emit('%s' % _("Preferences closed without saving."))
  843. self.ignore_tab_close_event = False
  844. def on_restore_defaults_preferences(self):
  845. """
  846. Loads the application's factory default settings into ``self.defaults``.
  847. :return: None
  848. """
  849. log.debug("on_restore_defaults_preferences()")
  850. self.defaults.reset_to_factory_defaults()
  851. self.on_preferences_edited()
  852. self.inform.emit('[success] %s' % _("Preferences default values are restored."))
  853. def save_defaults(self, silent=False, data_path=None, first_time=False):
  854. """
  855. Saves application default options
  856. ``self.defaults`` to current_defaults.FlatConfig file.
  857. Save the toolbars visibility status to the preferences file (current_defaults.FlatConfig) to be
  858. used at the next launch of the application.
  859. :param silent: Whether to display a message in status bar or not; boolean
  860. :param data_path: The path where to save the preferences file (current_defaults.FlatConfig)
  861. When the application is portable it should be a mobile location.
  862. :param first_time: Boolean. If True will execute some code when the app is run first time
  863. :return: None
  864. """
  865. self.defaults.report_usage("save_defaults")
  866. if data_path is None:
  867. data_path = self.data_path
  868. self.defaults.propagate_defaults()
  869. if first_time is False:
  870. self.save_toolbar_view()
  871. # Save the options to disk
  872. filename = os.path.join(data_path, "current_defaults.FlatConfig")
  873. try:
  874. self.defaults.write(filename=filename)
  875. except Exception as e:
  876. log.error("save_defaults() --> Failed to write defaults to file %s" % str(e))
  877. self.inform.emit('[ERROR_NOTCL] %s %s' % (_("Failed to write defaults to file."), str(filename)))
  878. return
  879. if not silent:
  880. self.inform.emit('[success] %s' % _("Preferences saved."))
  881. # update the autosave timer
  882. self.app.save_project_auto_update()
  883. def save_toolbar_view(self):
  884. """
  885. Will save the toolbar view state to the defaults
  886. :return: None
  887. """
  888. # Save the toolbar view
  889. tb_status = 0
  890. if self.ui.toolbarfile.isVisible():
  891. tb_status += 1
  892. if self.ui.toolbargeo.isVisible():
  893. tb_status += 2
  894. if self.ui.toolbarview.isVisible():
  895. tb_status += 4
  896. if self.ui.toolbartools.isVisible():
  897. tb_status += 8
  898. if self.ui.exc_edit_toolbar.isVisible():
  899. tb_status += 16
  900. if self.ui.geo_edit_toolbar.isVisible():
  901. tb_status += 32
  902. if self.ui.grb_edit_toolbar.isVisible():
  903. tb_status += 64
  904. if self.ui.snap_toolbar.isVisible():
  905. tb_status += 128
  906. if self.ui.toolbarshell.isVisible():
  907. tb_status += 256
  908. self.defaults["global_toolbar_view"] = tb_status
  909. def on_preferences_edited(self):
  910. """
  911. Executed when a preference was changed in the Edit -> Preferences tab.
  912. Will color the Preferences tab text to Red color.
  913. :return:
  914. """
  915. if self.preferences_changed_flag is False:
  916. self.inform.emit('[WARNING_NOTCL] %s' % _("Preferences edited but not saved."))
  917. for idx in range(self.ui.plot_tab_area.count()):
  918. if self.ui.plot_tab_area.tabText(idx) == _("Preferences"):
  919. self.ui.plot_tab_area.tabBar.setTabTextColor(idx, QtGui.QColor('red'))
  920. self.ui.pref_apply_button.setStyleSheet("QPushButton {color: red;}")
  921. self.preferences_changed_flag = True
  922. def on_close_preferences_tab(self):
  923. if self.ignore_tab_close_event:
  924. return
  925. # disconnect
  926. for idx in range(self.ui.pref_tab_area.count()):
  927. for tb in self.ui.pref_tab_area.widget(idx).findChildren(QtCore.QObject):
  928. try:
  929. tb.textEdited.disconnect(self.on_preferences_edited)
  930. except (TypeError, AttributeError):
  931. pass
  932. try:
  933. tb.modificationChanged.disconnect(self.on_preferences_edited)
  934. except (TypeError, AttributeError):
  935. pass
  936. try:
  937. tb.toggled.disconnect(self.on_preferences_edited)
  938. except (TypeError, AttributeError):
  939. pass
  940. try:
  941. tb.valueChanged.disconnect(self.on_preferences_edited)
  942. except (TypeError, AttributeError):
  943. pass
  944. try:
  945. tb.currentIndexChanged.disconnect(self.on_preferences_edited)
  946. except (TypeError, AttributeError):
  947. pass
  948. # Prompt user to save
  949. if self.preferences_changed_flag is True:
  950. msgbox = QtWidgets.QMessageBox()
  951. msgbox.setText(_("One or more values are changed.\n"
  952. "Do you want to save the Preferences?"))
  953. msgbox.setWindowTitle(_("Save Preferences"))
  954. msgbox.setWindowIcon(QtGui.QIcon(self.app.resource_location + '/save_as.png'))
  955. bt_yes = msgbox.addButton(_('Yes'), QtWidgets.QMessageBox.YesRole)
  956. msgbox.addButton(_('No'), QtWidgets.QMessageBox.NoRole)
  957. msgbox.setDefaultButton(bt_yes)
  958. msgbox.exec_()
  959. response = msgbox.clickedButton()
  960. if response == bt_yes:
  961. self.on_save_button(save_to_file=True)
  962. self.inform.emit('[success] %s' % _("Preferences saved."))
  963. else:
  964. self.preferences_changed_flag = False
  965. self.inform.emit('')
  966. return
  967. class OptionsGroupUI(QtWidgets.QGroupBox):
  968. app = None
  969. def __init__(self, title, parent=None):
  970. # QtGui.QGroupBox.__init__(self, title, parent=parent)
  971. super(OptionsGroupUI, self).__init__()
  972. self.setStyleSheet("""
  973. QGroupBox
  974. {
  975. font-size: 16px;
  976. font-weight: bold;
  977. }
  978. """)
  979. self.layout = QtWidgets.QVBoxLayout()
  980. self.setLayout(self.layout)
  981. class GeneralPreferencesUI(QtWidgets.QWidget):
  982. def __init__(self, decimals, parent=None):
  983. QtWidgets.QWidget.__init__(self, parent=parent)
  984. self.layout = QtWidgets.QHBoxLayout()
  985. self.setLayout(self.layout)
  986. self.decimals = decimals
  987. self.general_app_group = GeneralAppPrefGroupUI(decimals=self.decimals)
  988. self.general_app_group.setMinimumWidth(250)
  989. self.general_gui_group = GeneralGUIPrefGroupUI(decimals=self.decimals)
  990. self.general_gui_group.setMinimumWidth(250)
  991. self.general_app_set_group = GeneralAPPSetGroupUI(decimals=self.decimals)
  992. self.general_app_set_group.setMinimumWidth(250)
  993. self.layout.addWidget(self.general_app_group)
  994. self.layout.addWidget(self.general_gui_group)
  995. self.layout.addWidget(self.general_app_set_group)
  996. self.layout.addStretch()
  997. class GerberPreferencesUI(QtWidgets.QWidget):
  998. def __init__(self, decimals, parent=None):
  999. QtWidgets.QWidget.__init__(self, parent=parent)
  1000. self.layout = QtWidgets.QHBoxLayout()
  1001. self.setLayout(self.layout)
  1002. self.decimals = decimals
  1003. self.gerber_gen_group = GerberGenPrefGroupUI(decimals=self.decimals)
  1004. self.gerber_gen_group.setMinimumWidth(250)
  1005. self.gerber_opt_group = GerberOptPrefGroupUI(decimals=self.decimals)
  1006. self.gerber_opt_group.setMinimumWidth(250)
  1007. self.gerber_exp_group = GerberExpPrefGroupUI(decimals=self.decimals)
  1008. self.gerber_exp_group.setMinimumWidth(230)
  1009. self.gerber_adv_opt_group = GerberAdvOptPrefGroupUI(decimals=self.decimals)
  1010. self.gerber_adv_opt_group.setMinimumWidth(200)
  1011. self.gerber_editor_group = GerberEditorPrefGroupUI(decimals=self.decimals)
  1012. self.gerber_editor_group.setMinimumWidth(200)
  1013. self.vlay = QtWidgets.QVBoxLayout()
  1014. self.vlay.addWidget(self.gerber_opt_group)
  1015. self.vlay.addWidget(self.gerber_exp_group)
  1016. self.layout.addWidget(self.gerber_gen_group)
  1017. self.layout.addLayout(self.vlay)
  1018. self.layout.addWidget(self.gerber_adv_opt_group)
  1019. self.layout.addWidget(self.gerber_editor_group)
  1020. self.layout.addStretch()
  1021. class ExcellonPreferencesUI(QtWidgets.QWidget):
  1022. def __init__(self, decimals, parent=None):
  1023. QtWidgets.QWidget.__init__(self, parent=parent)
  1024. self.layout = QtWidgets.QHBoxLayout()
  1025. self.setLayout(self.layout)
  1026. self.decimals = decimals
  1027. self.excellon_gen_group = ExcellonGenPrefGroupUI(decimals=self.decimals)
  1028. self.excellon_gen_group.setMinimumWidth(220)
  1029. self.excellon_opt_group = ExcellonOptPrefGroupUI(decimals=self.decimals)
  1030. self.excellon_opt_group.setMinimumWidth(290)
  1031. self.excellon_exp_group = ExcellonExpPrefGroupUI(decimals=self.decimals)
  1032. self.excellon_exp_group.setMinimumWidth(250)
  1033. self.excellon_adv_opt_group = ExcellonAdvOptPrefGroupUI(decimals=self.decimals)
  1034. self.excellon_adv_opt_group.setMinimumWidth(250)
  1035. self.excellon_editor_group = ExcellonEditorPrefGroupUI(decimals=self.decimals)
  1036. self.excellon_editor_group.setMinimumWidth(260)
  1037. self.vlay = QtWidgets.QVBoxLayout()
  1038. self.vlay.addWidget(self.excellon_opt_group)
  1039. self.vlay.addWidget(self.excellon_exp_group)
  1040. self.layout.addWidget(self.excellon_gen_group)
  1041. self.layout.addLayout(self.vlay)
  1042. self.layout.addWidget(self.excellon_adv_opt_group)
  1043. self.layout.addWidget(self.excellon_editor_group)
  1044. self.layout.addStretch()
  1045. class GeometryPreferencesUI(QtWidgets.QWidget):
  1046. def __init__(self, decimals, parent=None):
  1047. QtWidgets.QWidget.__init__(self, parent=parent)
  1048. self.layout = QtWidgets.QHBoxLayout()
  1049. self.setLayout(self.layout)
  1050. self.decimals = decimals
  1051. self.geometry_gen_group = GeometryGenPrefGroupUI(decimals=self.decimals)
  1052. self.geometry_gen_group.setMinimumWidth(220)
  1053. self.geometry_opt_group = GeometryOptPrefGroupUI(decimals=self.decimals)
  1054. self.geometry_opt_group.setMinimumWidth(300)
  1055. self.geometry_adv_opt_group = GeometryAdvOptPrefGroupUI(decimals=self.decimals)
  1056. self.geometry_adv_opt_group.setMinimumWidth(270)
  1057. self.geometry_editor_group = GeometryEditorPrefGroupUI(decimals=self.decimals)
  1058. self.geometry_editor_group.setMinimumWidth(250)
  1059. self.layout.addWidget(self.geometry_gen_group)
  1060. self.layout.addWidget(self.geometry_opt_group)
  1061. self.layout.addWidget(self.geometry_adv_opt_group)
  1062. self.layout.addWidget(self.geometry_editor_group)
  1063. self.layout.addStretch()
  1064. class ToolsPreferencesUI(QtWidgets.QWidget):
  1065. def __init__(self, decimals, parent=None):
  1066. QtWidgets.QWidget.__init__(self, parent=parent)
  1067. self.layout = QtWidgets.QHBoxLayout()
  1068. self.setLayout(self.layout)
  1069. self.decimals = decimals
  1070. self.tools_ncc_group = ToolsNCCPrefGroupUI(decimals=self.decimals)
  1071. self.tools_ncc_group.setMinimumWidth(220)
  1072. self.tools_paint_group = ToolsPaintPrefGroupUI(decimals=self.decimals)
  1073. self.tools_paint_group.setMinimumWidth(220)
  1074. self.tools_cutout_group = ToolsCutoutPrefGroupUI(decimals=self.decimals)
  1075. self.tools_cutout_group.setMinimumWidth(220)
  1076. self.tools_2sided_group = Tools2sidedPrefGroupUI(decimals=self.decimals)
  1077. self.tools_2sided_group.setMinimumWidth(220)
  1078. self.tools_film_group = ToolsFilmPrefGroupUI(decimals=self.decimals)
  1079. self.tools_film_group.setMinimumWidth(220)
  1080. self.tools_panelize_group = ToolsPanelizePrefGroupUI(decimals=self.decimals)
  1081. self.tools_panelize_group.setMinimumWidth(220)
  1082. self.tools_calculators_group = ToolsCalculatorsPrefGroupUI(decimals=self.decimals)
  1083. self.tools_calculators_group.setMinimumWidth(220)
  1084. self.tools_transform_group = ToolsTransformPrefGroupUI(decimals=self.decimals)
  1085. self.tools_transform_group.setMinimumWidth(200)
  1086. self.tools_solderpaste_group = ToolsSolderpastePrefGroupUI(decimals=self.decimals)
  1087. self.tools_solderpaste_group.setMinimumWidth(200)
  1088. self.tools_sub_group = ToolsSubPrefGroupUI(decimals=self.decimals)
  1089. self.tools_sub_group.setMinimumWidth(200)
  1090. self.vlay = QtWidgets.QVBoxLayout()
  1091. self.vlay.addWidget(self.tools_ncc_group)
  1092. self.vlay.addWidget(self.tools_cutout_group)
  1093. self.vlay1 = QtWidgets.QVBoxLayout()
  1094. self.vlay1.addWidget(self.tools_paint_group)
  1095. self.vlay1.addWidget(self.tools_panelize_group)
  1096. self.vlay2 = QtWidgets.QVBoxLayout()
  1097. self.vlay2.addWidget(self.tools_transform_group)
  1098. self.vlay2.addWidget(self.tools_2sided_group)
  1099. self.vlay2.addWidget(self.tools_sub_group)
  1100. self.vlay3 = QtWidgets.QVBoxLayout()
  1101. self.vlay3.addWidget(self.tools_film_group)
  1102. self.vlay3.addWidget(self.tools_calculators_group)
  1103. self.vlay4 = QtWidgets.QVBoxLayout()
  1104. self.vlay4.addWidget(self.tools_solderpaste_group)
  1105. self.layout.addLayout(self.vlay)
  1106. self.layout.addLayout(self.vlay1)
  1107. self.layout.addLayout(self.vlay2)
  1108. self.layout.addLayout(self.vlay3)
  1109. self.layout.addLayout(self.vlay4)
  1110. self.layout.addStretch()
  1111. class Tools2PreferencesUI(QtWidgets.QWidget):
  1112. def __init__(self, decimals, parent=None):
  1113. QtWidgets.QWidget.__init__(self, parent=parent)
  1114. self.layout = QtWidgets.QHBoxLayout()
  1115. self.setLayout(self.layout)
  1116. self.decimals = decimals
  1117. self.tools2_checkrules_group = Tools2RulesCheckPrefGroupUI(decimals=self.decimals)
  1118. self.tools2_checkrules_group.setMinimumWidth(220)
  1119. self.tools2_optimal_group = Tools2OptimalPrefGroupUI(decimals=self.decimals)
  1120. self.tools2_optimal_group.setMinimumWidth(220)
  1121. self.tools2_qrcode_group = Tools2QRCodePrefGroupUI(decimals=self.decimals)
  1122. self.tools2_qrcode_group.setMinimumWidth(220)
  1123. self.tools2_cfill_group = Tools2CThievingPrefGroupUI(decimals=self.decimals)
  1124. self.tools2_cfill_group.setMinimumWidth(220)
  1125. self.tools2_fiducials_group = Tools2FiducialsPrefGroupUI(decimals=self.decimals)
  1126. self.tools2_fiducials_group.setMinimumWidth(220)
  1127. self.tools2_cal_group = Tools2CalPrefGroupUI(decimals=self.decimals)
  1128. self.tools2_cal_group.setMinimumWidth(220)
  1129. self.tools2_edrills_group = Tools2EDrillsPrefGroupUI(decimals=self.decimals)
  1130. self.tools2_edrills_group.setMinimumWidth(220)
  1131. self.tools2_punch_group = Tools2PunchGerberPrefGroupUI(decimals=self.decimals)
  1132. self.tools2_punch_group.setMinimumWidth(220)
  1133. self.tools2_invert_group = Tools2InvertPrefGroupUI(decimals=self.decimals)
  1134. self.tools2_invert_group.setMinimumWidth(220)
  1135. self.vlay = QtWidgets.QVBoxLayout()
  1136. self.vlay.addWidget(self.tools2_checkrules_group)
  1137. self.vlay.addWidget(self.tools2_optimal_group)
  1138. self.vlay1 = QtWidgets.QVBoxLayout()
  1139. self.vlay1.addWidget(self.tools2_qrcode_group)
  1140. self.vlay1.addWidget(self.tools2_fiducials_group)
  1141. self.vlay2 = QtWidgets.QVBoxLayout()
  1142. self.vlay2.addWidget(self.tools2_cfill_group)
  1143. self.vlay3 = QtWidgets.QVBoxLayout()
  1144. self.vlay3.addWidget(self.tools2_cal_group)
  1145. self.vlay3.addWidget(self.tools2_edrills_group)
  1146. self.vlay4 = QtWidgets.QVBoxLayout()
  1147. self.vlay4.addWidget(self.tools2_punch_group)
  1148. self.vlay4.addWidget(self.tools2_invert_group)
  1149. self.layout.addLayout(self.vlay)
  1150. self.layout.addLayout(self.vlay1)
  1151. self.layout.addLayout(self.vlay2)
  1152. self.layout.addLayout(self.vlay3)
  1153. self.layout.addLayout(self.vlay4)
  1154. self.layout.addStretch()
  1155. class CNCJobPreferencesUI(QtWidgets.QWidget):
  1156. def __init__(self, decimals, parent=None):
  1157. QtWidgets.QWidget.__init__(self, parent=parent)
  1158. self.layout = QtWidgets.QHBoxLayout()
  1159. self.setLayout(self.layout)
  1160. self.decimals = decimals
  1161. self.cncjob_gen_group = CNCJobGenPrefGroupUI(decimals=self.decimals)
  1162. self.cncjob_gen_group.setMinimumWidth(260)
  1163. self.cncjob_opt_group = CNCJobOptPrefGroupUI(decimals=self.decimals)
  1164. self.cncjob_opt_group.setMinimumWidth(260)
  1165. self.cncjob_adv_opt_group = CNCJobAdvOptPrefGroupUI(decimals=self.decimals)
  1166. self.cncjob_adv_opt_group.setMinimumWidth(260)
  1167. self.layout.addWidget(self.cncjob_gen_group)
  1168. self.layout.addWidget(self.cncjob_opt_group)
  1169. self.layout.addWidget(self.cncjob_adv_opt_group)
  1170. self.layout.addStretch()
  1171. class UtilPreferencesUI(QtWidgets.QWidget):
  1172. def __init__(self, decimals, parent=None):
  1173. QtWidgets.QWidget.__init__(self, parent=parent)
  1174. self.layout = QtWidgets.QHBoxLayout()
  1175. self.setLayout(self.layout)
  1176. self.decimals = decimals
  1177. self.vlay = QtWidgets.QVBoxLayout()
  1178. self.fa_excellon_group = FAExcPrefGroupUI(decimals=self.decimals)
  1179. self.fa_excellon_group.setMinimumWidth(260)
  1180. self.fa_gcode_group = FAGcoPrefGroupUI(decimals=self.decimals)
  1181. self.fa_gcode_group.setMinimumWidth(260)
  1182. self.vlay.addWidget(self.fa_excellon_group)
  1183. self.vlay.addWidget(self.fa_gcode_group)
  1184. self.fa_gerber_group = FAGrbPrefGroupUI(decimals=self.decimals)
  1185. self.fa_gerber_group.setMinimumWidth(260)
  1186. self.kw_group = AutoCompletePrefGroupUI(decimals=self.decimals)
  1187. self.kw_group.setMinimumWidth(260)
  1188. self.layout.addLayout(self.vlay)
  1189. self.layout.addWidget(self.fa_gerber_group)
  1190. self.layout.addWidget(self.kw_group)
  1191. self.layout.addStretch()
  1192. class GeneralGUIPrefGroupUI(OptionsGroupUI):
  1193. def __init__(self, decimals=4, parent=None):
  1194. super(GeneralGUIPrefGroupUI, self).__init__(self)
  1195. self.setTitle(str(_("GUI Preferences")))
  1196. self.decimals = decimals
  1197. # Create a grid layout for the Application general settings
  1198. grid0 = QtWidgets.QGridLayout()
  1199. self.layout.addLayout(grid0)
  1200. grid0.setColumnStretch(0, 0)
  1201. grid0.setColumnStretch(1, 1)
  1202. # Theme selection
  1203. self.theme_label = QtWidgets.QLabel('%s:' % _('Theme'))
  1204. self.theme_label.setToolTip(
  1205. _("Select a theme for FlatCAM.\n"
  1206. "It will theme the plot area.")
  1207. )
  1208. self.theme_radio = RadioSet([
  1209. {"label": _("Light"), "value": "white"},
  1210. {"label": _("Dark"), "value": "black"}
  1211. ], orientation='vertical')
  1212. grid0.addWidget(self.theme_label, 0, 0)
  1213. grid0.addWidget(self.theme_radio, 0, 1)
  1214. # Enable Gray Icons
  1215. self.gray_icons_cb = FCCheckBox('%s' % _('Use Gray Icons'))
  1216. self.gray_icons_cb.setToolTip(
  1217. _("Check this box to use a set of icons with\n"
  1218. "a lighter (gray) color. To be used when a\n"
  1219. "full dark theme is applied.")
  1220. )
  1221. grid0.addWidget(self.gray_icons_cb, 1, 0, 1, 3)
  1222. self.theme_button = FCButton(_("Apply Theme"))
  1223. self.theme_button.setToolTip(
  1224. _("Select a theme for FlatCAM.\n"
  1225. "It will theme the plot area.\n"
  1226. "The application will restart after change.")
  1227. )
  1228. grid0.addWidget(self.theme_button, 2, 0, 1, 3)
  1229. separator_line = QtWidgets.QFrame()
  1230. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  1231. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  1232. grid0.addWidget(separator_line, 3, 0, 1, 2)
  1233. # Layout selection
  1234. self.layout_label = QtWidgets.QLabel('%s:' % _('Layout'))
  1235. self.layout_label.setToolTip(
  1236. _("Select an layout for FlatCAM.\n"
  1237. "It is applied immediately.")
  1238. )
  1239. self.layout_combo = FCComboBox()
  1240. # don't translate the QCombo items as they are used in QSettings and identified by name
  1241. self.layout_combo.addItem("standard")
  1242. self.layout_combo.addItem("compact")
  1243. self.layout_combo.addItem("minimal")
  1244. grid0.addWidget(self.layout_label, 4, 0)
  1245. grid0.addWidget(self.layout_combo, 4, 1)
  1246. # Set the current index for layout_combo
  1247. settings = QSettings("Open Source", "FlatCAM")
  1248. if settings.contains("layout"):
  1249. layout = settings.value('layout', type=str)
  1250. idx = self.layout_combo.findText(layout.capitalize())
  1251. self.layout_combo.setCurrentIndex(idx)
  1252. # Style selection
  1253. self.style_label = QtWidgets.QLabel('%s:' % _('Style'))
  1254. self.style_label.setToolTip(
  1255. _("Select an style for FlatCAM.\n"
  1256. "It will be applied at the next app start.")
  1257. )
  1258. self.style_combo = FCComboBox()
  1259. self.style_combo.addItems(QtWidgets.QStyleFactory.keys())
  1260. # find current style
  1261. index = self.style_combo.findText(QtWidgets.qApp.style().objectName(), QtCore.Qt.MatchFixedString)
  1262. self.style_combo.setCurrentIndex(index)
  1263. self.style_combo.activated[str].connect(self.handle_style)
  1264. grid0.addWidget(self.style_label, 5, 0)
  1265. grid0.addWidget(self.style_combo, 5, 1)
  1266. # Enable High DPI Support
  1267. self.hdpi_cb = FCCheckBox('%s' % _('Activate HDPI Support'))
  1268. self.hdpi_cb.setToolTip(
  1269. _("Enable High DPI support for FlatCAM.\n"
  1270. "It will be applied at the next app start.")
  1271. )
  1272. settings = QSettings("Open Source", "FlatCAM")
  1273. if settings.contains("hdpi"):
  1274. self.hdpi_cb.set_value(settings.value('hdpi', type=int))
  1275. else:
  1276. self.hdpi_cb.set_value(False)
  1277. self.hdpi_cb.stateChanged.connect(self.handle_hdpi)
  1278. grid0.addWidget(self.hdpi_cb, 6, 0, 1, 3)
  1279. # Enable Hover box
  1280. self.hover_cb = FCCheckBox('%s' % _('Display Hover Shape'))
  1281. self.hover_cb.setToolTip(
  1282. _("Enable display of a hover shape for FlatCAM objects.\n"
  1283. "It is displayed whenever the mouse cursor is hovering\n"
  1284. "over any kind of not-selected object.")
  1285. )
  1286. grid0.addWidget(self.hover_cb, 8, 0, 1, 3)
  1287. # Enable Selection box
  1288. self.selection_cb = FCCheckBox('%s' % _('Display Selection Shape'))
  1289. self.selection_cb.setToolTip(
  1290. _("Enable the display of a selection shape for FlatCAM objects.\n"
  1291. "It is displayed whenever the mouse selects an object\n"
  1292. "either by clicking or dragging mouse from left to right or\n"
  1293. "right to left.")
  1294. )
  1295. grid0.addWidget(self.selection_cb, 9, 0, 1, 3)
  1296. separator_line = QtWidgets.QFrame()
  1297. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  1298. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  1299. grid0.addWidget(separator_line, 14, 0, 1, 2)
  1300. # Plot Selection (left - right) Color
  1301. self.sel_lr_label = QtWidgets.QLabel('<b>%s</b>' % _('Left-Right Selection Color'))
  1302. grid0.addWidget(self.sel_lr_label, 15, 0, 1, 2)
  1303. self.sl_color_label = QtWidgets.QLabel('%s:' % _('Outline'))
  1304. self.sl_color_label.setToolTip(
  1305. _("Set the line color for the 'left to right' selection box.")
  1306. )
  1307. self.sl_color_entry = FCEntry()
  1308. self.sl_color_button = QtWidgets.QPushButton()
  1309. self.sl_color_button.setFixedSize(15, 15)
  1310. self.form_box_child_4 = QtWidgets.QHBoxLayout()
  1311. self.form_box_child_4.addWidget(self.sl_color_entry)
  1312. self.form_box_child_4.addWidget(self.sl_color_button)
  1313. self.form_box_child_4.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  1314. grid0.addWidget(self.sl_color_label, 16, 0)
  1315. grid0.addLayout(self.form_box_child_4, 16, 1)
  1316. self.sf_color_label = QtWidgets.QLabel('%s:' % _('Fill'))
  1317. self.sf_color_label.setToolTip(
  1318. _("Set the fill color for the selection box\n"
  1319. "in case that the selection is done from left to right.\n"
  1320. "First 6 digits are the color and the last 2\n"
  1321. "digits are for alpha (transparency) level.")
  1322. )
  1323. self.sf_color_entry = FCEntry()
  1324. self.sf_color_button = QtWidgets.QPushButton()
  1325. self.sf_color_button.setFixedSize(15, 15)
  1326. self.form_box_child_5 = QtWidgets.QHBoxLayout()
  1327. self.form_box_child_5.addWidget(self.sf_color_entry)
  1328. self.form_box_child_5.addWidget(self.sf_color_button)
  1329. self.form_box_child_5.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  1330. grid0.addWidget(self.sf_color_label, 17, 0)
  1331. grid0.addLayout(self.form_box_child_5, 17, 1)
  1332. # Plot Selection (left - right) Fill Transparency Level
  1333. self.sf_alpha_label = QtWidgets.QLabel('%s:' % _('Alpha'))
  1334. self.sf_alpha_label.setToolTip(
  1335. _("Set the fill transparency for the 'left to right' selection box.")
  1336. )
  1337. self.sf_color_alpha_slider = QtWidgets.QSlider(QtCore.Qt.Horizontal)
  1338. self.sf_color_alpha_slider.setMinimum(0)
  1339. self.sf_color_alpha_slider.setMaximum(255)
  1340. self.sf_color_alpha_slider.setSingleStep(1)
  1341. self.sf_color_alpha_spinner = FCSpinner()
  1342. self.sf_color_alpha_spinner.setMinimumWidth(70)
  1343. self.sf_color_alpha_spinner.set_range(0, 255)
  1344. self.form_box_child_6 = QtWidgets.QHBoxLayout()
  1345. self.form_box_child_6.addWidget(self.sf_color_alpha_slider)
  1346. self.form_box_child_6.addWidget(self.sf_color_alpha_spinner)
  1347. grid0.addWidget(self.sf_alpha_label, 18, 0)
  1348. grid0.addLayout(self.form_box_child_6, 18, 1)
  1349. separator_line = QtWidgets.QFrame()
  1350. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  1351. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  1352. grid0.addWidget(separator_line, 19, 0, 1, 2)
  1353. # Plot Selection (left - right) Color
  1354. self.sel_rl_label = QtWidgets.QLabel('<b>%s</b>' % _('Right-Left Selection Color'))
  1355. grid0.addWidget(self.sel_rl_label, 20, 0, 1, 2)
  1356. # Plot Selection (right - left) Line Color
  1357. self.alt_sl_color_label = QtWidgets.QLabel('%s:' % _('Outline'))
  1358. self.alt_sl_color_label.setToolTip(
  1359. _("Set the line color for the 'right to left' selection box.")
  1360. )
  1361. self.alt_sl_color_entry = FCEntry()
  1362. self.alt_sl_color_button = QtWidgets.QPushButton()
  1363. self.alt_sl_color_button.setFixedSize(15, 15)
  1364. self.form_box_child_7 = QtWidgets.QHBoxLayout()
  1365. self.form_box_child_7.addWidget(self.alt_sl_color_entry)
  1366. self.form_box_child_7.addWidget(self.alt_sl_color_button)
  1367. self.form_box_child_7.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  1368. grid0.addWidget(self.alt_sl_color_label, 21, 0)
  1369. grid0.addLayout(self.form_box_child_7, 21, 1)
  1370. # Plot Selection (right - left) Fill Color
  1371. self.alt_sf_color_label = QtWidgets.QLabel('%s:' % _('Fill'))
  1372. self.alt_sf_color_label.setToolTip(
  1373. _("Set the fill color for the selection box\n"
  1374. "in case that the selection is done from right to left.\n"
  1375. "First 6 digits are the color and the last 2\n"
  1376. "digits are for alpha (transparency) level.")
  1377. )
  1378. self.alt_sf_color_entry = FCEntry()
  1379. self.alt_sf_color_button = QtWidgets.QPushButton()
  1380. self.alt_sf_color_button.setFixedSize(15, 15)
  1381. self.form_box_child_8 = QtWidgets.QHBoxLayout()
  1382. self.form_box_child_8.addWidget(self.alt_sf_color_entry)
  1383. self.form_box_child_8.addWidget(self.alt_sf_color_button)
  1384. self.form_box_child_8.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  1385. grid0.addWidget(self.alt_sf_color_label, 22, 0)
  1386. grid0.addLayout(self.form_box_child_8, 22, 1)
  1387. # Plot Selection (right - left) Fill Transparency Level
  1388. self.alt_sf_alpha_label = QtWidgets.QLabel('%s:' % _('Alpha'))
  1389. self.alt_sf_alpha_label.setToolTip(
  1390. _("Set the fill transparency for selection 'right to left' box.")
  1391. )
  1392. self.alt_sf_color_alpha_slider = QtWidgets.QSlider(QtCore.Qt.Horizontal)
  1393. self.alt_sf_color_alpha_slider.setMinimum(0)
  1394. self.alt_sf_color_alpha_slider.setMaximum(255)
  1395. self.alt_sf_color_alpha_slider.setSingleStep(1)
  1396. self.alt_sf_color_alpha_spinner = FCSpinner()
  1397. self.alt_sf_color_alpha_spinner.setMinimumWidth(70)
  1398. self.alt_sf_color_alpha_spinner.set_range(0, 255)
  1399. self.form_box_child_9 = QtWidgets.QHBoxLayout()
  1400. self.form_box_child_9.addWidget(self.alt_sf_color_alpha_slider)
  1401. self.form_box_child_9.addWidget(self.alt_sf_color_alpha_spinner)
  1402. grid0.addWidget(self.alt_sf_alpha_label, 23, 0)
  1403. grid0.addLayout(self.form_box_child_9, 23, 1)
  1404. separator_line = QtWidgets.QFrame()
  1405. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  1406. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  1407. grid0.addWidget(separator_line, 24, 0, 1, 2)
  1408. # ------------------------------------------------------------------
  1409. # ----------------------- Editor Color -----------------------------
  1410. # ------------------------------------------------------------------
  1411. self.editor_color_label = QtWidgets.QLabel('<b>%s</b>' % _('Editor Color'))
  1412. grid0.addWidget(self.editor_color_label, 25, 0, 1, 2)
  1413. # Editor Draw Color
  1414. self.draw_color_label = QtWidgets.QLabel('%s:' % _('Drawing'))
  1415. self.alt_sf_color_label.setToolTip(
  1416. _("Set the color for the shape.")
  1417. )
  1418. self.draw_color_entry = FCEntry()
  1419. self.draw_color_button = QtWidgets.QPushButton()
  1420. self.draw_color_button.setFixedSize(15, 15)
  1421. self.form_box_child_10 = QtWidgets.QHBoxLayout()
  1422. self.form_box_child_10.addWidget(self.draw_color_entry)
  1423. self.form_box_child_10.addWidget(self.draw_color_button)
  1424. self.form_box_child_10.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  1425. grid0.addWidget(self.draw_color_label, 26, 0)
  1426. grid0.addLayout(self.form_box_child_10, 26, 1)
  1427. # Editor Draw Selection Color
  1428. self.sel_draw_color_label = QtWidgets.QLabel('%s:' % _('Selection'))
  1429. self.sel_draw_color_label.setToolTip(
  1430. _("Set the color of the shape when selected.")
  1431. )
  1432. self.sel_draw_color_entry = FCEntry()
  1433. self.sel_draw_color_button = QtWidgets.QPushButton()
  1434. self.sel_draw_color_button.setFixedSize(15, 15)
  1435. self.form_box_child_11 = QtWidgets.QHBoxLayout()
  1436. self.form_box_child_11.addWidget(self.sel_draw_color_entry)
  1437. self.form_box_child_11.addWidget(self.sel_draw_color_button)
  1438. self.form_box_child_11.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  1439. grid0.addWidget(self.sel_draw_color_label, 27, 0)
  1440. grid0.addLayout(self.form_box_child_11, 27, 1)
  1441. separator_line = QtWidgets.QFrame()
  1442. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  1443. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  1444. grid0.addWidget(separator_line, 28, 0, 1, 2)
  1445. # ------------------------------------------------------------------
  1446. # ----------------------- Project Settings -----------------------------
  1447. # ------------------------------------------------------------------
  1448. self.proj_settings_label = QtWidgets.QLabel('<b>%s</b>' % _('Project Items Color'))
  1449. grid0.addWidget(self.proj_settings_label, 29, 0, 1, 2)
  1450. # Project Tab items color
  1451. self.proj_color_label = QtWidgets.QLabel('%s:' % _('Enabled'))
  1452. self.proj_color_label.setToolTip(
  1453. _("Set the color of the items in Project Tab Tree.")
  1454. )
  1455. self.proj_color_entry = FCEntry()
  1456. self.proj_color_button = QtWidgets.QPushButton()
  1457. self.proj_color_button.setFixedSize(15, 15)
  1458. self.form_box_child_12 = QtWidgets.QHBoxLayout()
  1459. self.form_box_child_12.addWidget(self.proj_color_entry)
  1460. self.form_box_child_12.addWidget(self.proj_color_button)
  1461. self.form_box_child_12.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  1462. grid0.addWidget(self.proj_color_label, 30, 0)
  1463. grid0.addLayout(self.form_box_child_12, 30, 1)
  1464. self.proj_color_dis_label = QtWidgets.QLabel('%s:' % _('Disabled'))
  1465. self.proj_color_dis_label.setToolTip(
  1466. _("Set the color of the items in Project Tab Tree,\n"
  1467. "for the case when the items are disabled.")
  1468. )
  1469. self.proj_color_dis_entry = FCEntry()
  1470. self.proj_color_dis_button = QtWidgets.QPushButton()
  1471. self.proj_color_dis_button.setFixedSize(15, 15)
  1472. self.form_box_child_13 = QtWidgets.QHBoxLayout()
  1473. self.form_box_child_13.addWidget(self.proj_color_dis_entry)
  1474. self.form_box_child_13.addWidget(self.proj_color_dis_button)
  1475. self.form_box_child_13.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  1476. grid0.addWidget(self.proj_color_dis_label, 31, 0)
  1477. grid0.addLayout(self.form_box_child_13, 31, 1)
  1478. # Project autohide CB
  1479. self.project_autohide_cb = FCCheckBox(label=_('Project AutoHide'))
  1480. self.project_autohide_cb.setToolTip(
  1481. _("Check this box if you want the project/selected/tool tab area to\n"
  1482. "hide automatically when there are no objects loaded and\n"
  1483. "to show whenever a new object is created.")
  1484. )
  1485. grid0.addWidget(self.project_autohide_cb, 32, 0, 1, 2)
  1486. # Just to add empty rows
  1487. grid0.addWidget(QtWidgets.QLabel(''), 33, 0, 1, 2)
  1488. self.layout.addStretch()
  1489. self.theme_button.clicked.connect(self.on_theme_change)
  1490. # #############################################################################
  1491. # ############################# GUI COLORS SIGNALS ############################
  1492. # #############################################################################
  1493. # Setting selection (left - right) colors signals
  1494. self.sf_color_entry.editingFinished.connect(self.on_sf_color_entry)
  1495. self.sf_color_button.clicked.connect(self.on_sf_color_button)
  1496. self.sf_color_alpha_spinner.valueChanged.connect(self.on_sf_color_spinner)
  1497. self.sf_color_alpha_slider.valueChanged.connect(self.on_sf_color_slider)
  1498. self.sl_color_entry.editingFinished.connect(self.on_sl_color_entry)
  1499. self.sl_color_button.clicked.connect(self.on_sl_color_button)
  1500. # Setting selection (right - left) colors signals
  1501. self.alt_sf_color_entry.editingFinished.connect(self.on_alt_sf_color_entry)
  1502. self.alt_sf_color_button.clicked.connect(self.on_alt_sf_color_button)
  1503. self.alt_sf_color_alpha_spinner.valueChanged.connect(self.on_alt_sf_color_spinner)
  1504. self.alt_sf_color_alpha_slider.valueChanged.connect(self.on_alt_sf_color_slider)
  1505. self.alt_sl_color_entry.editingFinished.connect(self.on_alt_sl_color_entry)
  1506. self.alt_sl_color_button.clicked.connect(self.on_alt_sl_color_button)
  1507. # Setting Editor Draw colors signals
  1508. self.draw_color_entry.editingFinished.connect(self.on_draw_color_entry)
  1509. self.draw_color_button.clicked.connect( self.on_draw_color_button)
  1510. self.sel_draw_color_entry.editingFinished.connect(self.on_sel_draw_color_entry)
  1511. self.sel_draw_color_button.clicked.connect(self.on_sel_draw_color_button)
  1512. self.proj_color_entry.editingFinished.connect(self.on_proj_color_entry)
  1513. self.proj_color_button.clicked.connect(self.on_proj_color_button)
  1514. self.proj_color_dis_entry.editingFinished.connect(self.on_proj_color_dis_entry)
  1515. self.proj_color_dis_button.clicked.connect(self.on_proj_color_dis_button)
  1516. self.layout_combo.activated.connect(self.on_layout)
  1517. def on_theme_change(self):
  1518. val = self.theme_radio.get_value()
  1519. t_settings = QSettings("Open Source", "FlatCAM")
  1520. t_settings.setValue('theme', val)
  1521. # This will write the setting to the platform specific storage.
  1522. del t_settings
  1523. self.app.on_app_restart()
  1524. def handle_style(self, style):
  1525. # set current style
  1526. settings = QSettings("Open Source", "FlatCAM")
  1527. settings.setValue('style', style)
  1528. # This will write the setting to the platform specific storage.
  1529. del settings
  1530. def handle_hdpi(self, state):
  1531. # set current HDPI
  1532. settings = QSettings("Open Source", "FlatCAM")
  1533. settings.setValue('hdpi', state)
  1534. # This will write the setting to the platform specific storage.
  1535. del settings
  1536. # Setting selection colors (left - right) handlers
  1537. def on_sf_color_entry(self):
  1538. self.app.defaults['global_sel_fill'] = self.app.defaults['global_sel_fill'][7:9]
  1539. self.sf_color_button.setStyleSheet("background-color:%s" % str(self.app.defaults['global_sel_fill'])[:7])
  1540. def on_sf_color_button(self):
  1541. current_color = QtGui.QColor(self.app.defaults['global_sel_fill'][:7])
  1542. c_dialog = QtWidgets.QColorDialog()
  1543. plot_fill_color = c_dialog.getColor(initial=current_color)
  1544. if plot_fill_color.isValid() is False:
  1545. return
  1546. self.sf_color_button.setStyleSheet("background-color:%s" % str(plot_fill_color.name()))
  1547. new_val = str(plot_fill_color.name()) + str(self.app.defaults['global_sel_fill'][7:9])
  1548. self.sf_color_entry.set_value(new_val)
  1549. self.app.defaults['global_sel_fill'] = new_val
  1550. def on_sf_color_spinner(self):
  1551. spinner_value = self.sf_color_alpha_spinner.value()
  1552. self.sf_color_alpha_slider.setValue(spinner_value)
  1553. self.app.defaults['global_sel_fill'] = self.app.defaults['global_sel_fill'][:7] + \
  1554. (hex(spinner_value)[2:] if int(hex(spinner_value)[2:], 16) > 0 else '00')
  1555. self.app.defaults['global_sel_line'] = self.app.defaults['global_sel_line'][:7] + \
  1556. (hex(spinner_value)[2:] if int(hex(spinner_value)[2:], 16) > 0 else '00')
  1557. def on_sf_color_slider(self):
  1558. slider_value = self.sf_color_alpha_slider.value()
  1559. self.sf_color_alpha_spinner.setValue(slider_value)
  1560. def on_sl_color_entry(self):
  1561. self.app.defaults['global_sel_line'] = self.sl_color_entry.get_value()[:7] + \
  1562. self.app.defaults['global_sel_line'][7:9]
  1563. self.sl_color_button.setStyleSheet("background-color:%s" % str(self.app.defaults['global_sel_line'])[:7])
  1564. def on_sl_color_button(self):
  1565. current_color = QtGui.QColor(self.app.defaults['global_sel_line'][:7])
  1566. c_dialog = QtWidgets.QColorDialog()
  1567. plot_line_color = c_dialog.getColor(initial=current_color)
  1568. if plot_line_color.isValid() is False:
  1569. return
  1570. self.sl_color_button.setStyleSheet("background-color:%s" % str(plot_line_color.name()))
  1571. new_val_line = str(plot_line_color.name()) + str(self.app.defaults['global_sel_line'][7:9])
  1572. self.sl_color_entry.set_value(new_val_line)
  1573. self.app.defaults['global_sel_line'] = new_val_line
  1574. # Setting selection colors (right - left) handlers
  1575. def on_alt_sf_color_entry(self):
  1576. self.app.defaults['global_alt_sel_fill'] = self.alt_sf_color_entry.get_value()[:7] + \
  1577. self.app.defaults['global_alt_sel_fill'][7:9]
  1578. self.alt_sf_color_button.setStyleSheet(
  1579. "background-color:%s" % str(self.app.defaults['global_alt_sel_fill'])[:7]
  1580. )
  1581. def on_alt_sf_color_button(self):
  1582. current_color = QtGui.QColor(self.app.defaults['global_alt_sel_fill'][:7])
  1583. c_dialog = QtWidgets.QColorDialog()
  1584. plot_fill_color = c_dialog.getColor(initial=current_color)
  1585. if plot_fill_color.isValid() is False:
  1586. return
  1587. self.alt_sf_color_button.setStyleSheet("background-color:%s" % str(plot_fill_color.name()))
  1588. new_val = str(plot_fill_color.name()) + str(self.app.defaults['global_alt_sel_fill'][7:9])
  1589. self.alt_sf_color_entry.set_value(new_val)
  1590. self.app.defaults['global_alt_sel_fill'] = new_val
  1591. def on_alt_sf_color_spinner(self):
  1592. spinner_value = self.alt_sf_color_alpha_spinner.value()
  1593. self.alt_sf_color_alpha_slider.setValue(spinner_value)
  1594. self.app.defaults['global_alt_sel_fill'] = self.app.defaults['global_alt_sel_fill'][:7] + \
  1595. (hex(spinner_value)[2:] if int(hex(spinner_value)[2:], 16) > 0 else '00')
  1596. self.app.defaults['global_alt_sel_line'] = self.app.defaults['global_alt_sel_line'][:7] + \
  1597. (hex(spinner_value)[2:] if int(hex(spinner_value)[2:], 16) > 0 else '00')
  1598. def on_alt_sf_color_slider(self):
  1599. slider_value = self.alt_sf_color_alpha_slider.value()
  1600. self.alt_sf_color_alpha_spinner.setValue(slider_value)
  1601. def on_alt_sl_color_entry(self):
  1602. self.app.defaults['global_alt_sel_line'] = self.alt_sl_color_entry.get_value()[:7] + \
  1603. self.app.defaults['global_alt_sel_line'][7:9]
  1604. self.alt_sl_color_button.setStyleSheet(
  1605. "background-color:%s" % str(self.app.defaults['global_alt_sel_line'])[:7]
  1606. )
  1607. def on_alt_sl_color_button(self):
  1608. current_color = QtGui.QColor(self.app.defaults['global_alt_sel_line'][:7])
  1609. c_dialog = QtWidgets.QColorDialog()
  1610. plot_line_color = c_dialog.getColor(initial=current_color)
  1611. if plot_line_color.isValid() is False:
  1612. return
  1613. self.alt_sl_color_button.setStyleSheet("background-color:%s" % str(plot_line_color.name()))
  1614. new_val_line = str(plot_line_color.name()) + str(self.app.defaults['global_alt_sel_line'][7:9])
  1615. self.alt_sl_color_entry.set_value(new_val_line)
  1616. self.app.defaults['global_alt_sel_line'] = new_val_line
  1617. # Setting Editor colors
  1618. def on_draw_color_entry(self):
  1619. self.app.defaults['global_draw_color'] = self.draw_color_entry.get_value()
  1620. self.draw_color_button.setStyleSheet("background-color:%s" % str(self.app.defaults['global_draw_color']))
  1621. def on_draw_color_button(self):
  1622. current_color = QtGui.QColor(self.app.defaults['global_draw_color'])
  1623. c_dialog = QtWidgets.QColorDialog()
  1624. draw_color = c_dialog.getColor(initial=current_color)
  1625. if draw_color.isValid() is False:
  1626. return
  1627. self.draw_color_button.setStyleSheet("background-color:%s" % str(draw_color.name()))
  1628. new_val = str(draw_color.name())
  1629. self.draw_color_entry.set_value(new_val)
  1630. self.app.defaults['global_draw_color'] = new_val
  1631. def on_sel_draw_color_entry(self):
  1632. self.app.defaults['global_sel_draw_color'] = self.sel_draw_color_entry.get_value()
  1633. self.sel_draw_color_button.setStyleSheet(
  1634. "background-color:%s" % str(self.app.defaults['global_sel_draw_color']))
  1635. def on_sel_draw_color_button(self):
  1636. current_color = QtGui.QColor(self.app.defaults['global_sel_draw_color'])
  1637. c_dialog = QtWidgets.QColorDialog()
  1638. sel_draw_color = c_dialog.getColor(initial=current_color)
  1639. if sel_draw_color.isValid() is False:
  1640. return
  1641. self.sel_draw_color_button.setStyleSheet("background-color:%s" % str(sel_draw_color.name()))
  1642. new_val_sel = str(sel_draw_color.name())
  1643. self.sel_draw_color_entry.set_value(new_val_sel)
  1644. self.app.defaults['global_sel_draw_color'] = new_val_sel
  1645. def on_proj_color_entry(self):
  1646. self.app.defaults['global_proj_item_color'] = self.proj_color_entry.get_value()
  1647. self.proj_color_button.setStyleSheet(
  1648. "background-color:%s" % str(self.app.defaults['global_proj_item_color']))
  1649. def on_proj_color_button(self):
  1650. current_color = QtGui.QColor(self.app.defaults['global_proj_item_color'])
  1651. c_dialog = QtWidgets.QColorDialog()
  1652. proj_color = c_dialog.getColor(initial=current_color)
  1653. if proj_color.isValid() is False:
  1654. return
  1655. self.proj_color_button.setStyleSheet("background-color:%s" % str(proj_color.name()))
  1656. new_val_sel = str(proj_color.name())
  1657. self.proj_color_entry.set_value(new_val_sel)
  1658. self.app.defaults['global_proj_item_color'] = new_val_sel
  1659. def on_proj_color_dis_entry(self):
  1660. self.app.defaults['global_proj_item_dis_color'] = self.proj_color_dis_entry.get_value()
  1661. self.proj_color_dis_button.setStyleSheet(
  1662. "background-color:%s" % str(self.app.defaults['global_proj_item_dis_color']))
  1663. def on_proj_color_dis_button(self):
  1664. current_color = QtGui.QColor(self.app.defaults['global_proj_item_dis_color'])
  1665. c_dialog = QtWidgets.QColorDialog()
  1666. proj_color = c_dialog.getColor(initial=current_color)
  1667. if proj_color.isValid() is False:
  1668. return
  1669. self.proj_color_dis_button.setStyleSheet("background-color:%s" % str(proj_color.name()))
  1670. new_val_sel = str(proj_color.name())
  1671. self.proj_color_dis_entry.set_value(new_val_sel)
  1672. self.app.defaults['global_proj_item_dis_color'] = new_val_sel
  1673. def on_layout(self, index=None, lay=None):
  1674. """
  1675. Set the toolbars layout (location)
  1676. :param index:
  1677. :param lay: Type of layout to be set on the toolbard
  1678. :return: None
  1679. """
  1680. self.app.defaults.report_usage("on_layout()")
  1681. if lay:
  1682. current_layout = lay
  1683. else:
  1684. current_layout = self.layout_combo.get_value()
  1685. lay_settings = QSettings("Open Source", "FlatCAM")
  1686. lay_settings.setValue('layout', current_layout)
  1687. # This will write the setting to the platform specific storage.
  1688. del lay_settings
  1689. # first remove the toolbars:
  1690. try:
  1691. self.app.ui.removeToolBar(self.app.ui.toolbarfile)
  1692. self.app.ui.removeToolBar(self.app.ui.toolbargeo)
  1693. self.app.ui.removeToolBar(self.app.ui.toolbarview)
  1694. self.app.ui.removeToolBar(self.app.ui.toolbarshell)
  1695. self.app.ui.removeToolBar(self.app.ui.toolbartools)
  1696. self.app.ui.removeToolBar(self.app.ui.exc_edit_toolbar)
  1697. self.app.ui.removeToolBar(self.app.ui.geo_edit_toolbar)
  1698. self.app.ui.removeToolBar(self.app.ui.grb_edit_toolbar)
  1699. self.app.ui.removeToolBar(self.app.ui.snap_toolbar)
  1700. self.app.ui.removeToolBar(self.app.ui.toolbarshell)
  1701. except Exception:
  1702. pass
  1703. if current_layout == 'compact':
  1704. # ## TOOLBAR INSTALLATION # ##
  1705. self.app.ui.toolbarfile = QtWidgets.QToolBar('File Toolbar')
  1706. self.app.ui.toolbarfile.setObjectName('File_TB')
  1707. self.app.ui.addToolBar(Qt.LeftToolBarArea, self.app.ui.toolbarfile)
  1708. self.app.ui.toolbargeo = QtWidgets.QToolBar('Edit Toolbar')
  1709. self.app.ui.toolbargeo.setObjectName('Edit_TB')
  1710. self.app.ui.addToolBar(Qt.LeftToolBarArea, self.app.ui.toolbargeo)
  1711. self.app.ui.toolbarshell = QtWidgets.QToolBar('Shell Toolbar')
  1712. self.app.ui.toolbarshell.setObjectName('Shell_TB')
  1713. self.app.ui.addToolBar(Qt.LeftToolBarArea, self.app.ui.toolbarshell)
  1714. self.app.ui.toolbartools = QtWidgets.QToolBar('Tools Toolbar')
  1715. self.app.ui.toolbartools.setObjectName('Tools_TB')
  1716. self.app.ui.addToolBar(Qt.LeftToolBarArea, self.app.ui.toolbartools)
  1717. self.app.ui.geo_edit_toolbar = QtWidgets.QToolBar('Geometry Editor Toolbar')
  1718. # self.app.ui.geo_edit_toolbar.setVisible(False)
  1719. self.app.ui.geo_edit_toolbar.setObjectName('GeoEditor_TB')
  1720. self.app.ui.addToolBar(Qt.RightToolBarArea, self.app.ui.geo_edit_toolbar)
  1721. self.app.ui.toolbarview = QtWidgets.QToolBar('View Toolbar')
  1722. self.app.ui.toolbarview.setObjectName('View_TB')
  1723. self.app.ui.addToolBar(Qt.RightToolBarArea, self.app.ui.toolbarview)
  1724. self.app.ui.addToolBarBreak(area=Qt.RightToolBarArea)
  1725. self.app.ui.grb_edit_toolbar = QtWidgets.QToolBar('Gerber Editor Toolbar')
  1726. # self.app.ui.grb_edit_toolbar.setVisible(False)
  1727. self.app.ui.grb_edit_toolbar.setObjectName('GrbEditor_TB')
  1728. self.app.ui.addToolBar(Qt.RightToolBarArea, self.app.ui.grb_edit_toolbar)
  1729. self.app.ui.exc_edit_toolbar = QtWidgets.QToolBar('Excellon Editor Toolbar')
  1730. self.app.ui.exc_edit_toolbar.setObjectName('ExcEditor_TB')
  1731. self.app.ui.addToolBar(Qt.RightToolBarArea, self.app.ui.exc_edit_toolbar)
  1732. self.app.ui.snap_toolbar = QtWidgets.QToolBar('Grid Toolbar')
  1733. self.app.ui.snap_toolbar.setObjectName('Snap_TB')
  1734. self.app.ui.snap_toolbar.setMaximumHeight(30)
  1735. self.app.ui.splitter_left.addWidget(self.app.ui.snap_toolbar)
  1736. self.app.ui.corner_snap_btn.setVisible(True)
  1737. self.app.ui.snap_magnet.setVisible(True)
  1738. else:
  1739. # ## TOOLBAR INSTALLATION # ##
  1740. self.app.ui.toolbarfile = QtWidgets.QToolBar('File Toolbar')
  1741. self.app.ui.toolbarfile.setObjectName('File_TB')
  1742. self.app.ui.addToolBar(self.app.ui.toolbarfile)
  1743. self.app.ui.toolbargeo = QtWidgets.QToolBar('Edit Toolbar')
  1744. self.app.ui.toolbargeo.setObjectName('Edit_TB')
  1745. self.app.ui.addToolBar(self.app.ui.toolbargeo)
  1746. self.app.ui.toolbarview = QtWidgets.QToolBar('View Toolbar')
  1747. self.app.ui.toolbarview.setObjectName('View_TB')
  1748. self.app.ui.addToolBar(self.app.ui.toolbarview)
  1749. self.app.ui.toolbarshell = QtWidgets.QToolBar('Shell Toolbar')
  1750. self.app.ui.toolbarshell.setObjectName('Shell_TB')
  1751. self.app.ui.addToolBar(self.app.ui.toolbarshell)
  1752. self.app.ui.toolbartools = QtWidgets.QToolBar('Tools Toolbar')
  1753. self.app.ui.toolbartools.setObjectName('Tools_TB')
  1754. self.app.ui.addToolBar(self.app.ui.toolbartools)
  1755. self.app.ui.exc_edit_toolbar = QtWidgets.QToolBar('Excellon Editor Toolbar')
  1756. # self.app.ui.exc_edit_toolbar.setVisible(False)
  1757. self.app.ui.exc_edit_toolbar.setObjectName('ExcEditor_TB')
  1758. self.app.ui.addToolBar(self.app.ui.exc_edit_toolbar)
  1759. self.app.ui.addToolBarBreak()
  1760. self.app.ui.geo_edit_toolbar = QtWidgets.QToolBar('Geometry Editor Toolbar')
  1761. # self.app.ui.geo_edit_toolbar.setVisible(False)
  1762. self.app.ui.geo_edit_toolbar.setObjectName('GeoEditor_TB')
  1763. self.app.ui.addToolBar(self.app.ui.geo_edit_toolbar)
  1764. self.app.ui.grb_edit_toolbar = QtWidgets.QToolBar('Gerber Editor Toolbar')
  1765. # self.app.ui.grb_edit_toolbar.setVisible(False)
  1766. self.app.ui.grb_edit_toolbar.setObjectName('GrbEditor_TB')
  1767. self.app.ui.addToolBar(self.app.ui.grb_edit_toolbar)
  1768. self.app.ui.snap_toolbar = QtWidgets.QToolBar('Grid Toolbar')
  1769. self.app.ui.snap_toolbar.setObjectName('Snap_TB')
  1770. # self.app.ui.snap_toolbar.setMaximumHeight(30)
  1771. self.app.ui.addToolBar(self.app.ui.snap_toolbar)
  1772. self.app.ui.corner_snap_btn.setVisible(False)
  1773. self.app.ui.snap_magnet.setVisible(False)
  1774. if current_layout == 'minimal':
  1775. self.app.ui.toolbarview.setVisible(False)
  1776. self.app.ui.toolbarshell.setVisible(False)
  1777. self.app.ui.snap_toolbar.setVisible(False)
  1778. self.app.ui.geo_edit_toolbar.setVisible(False)
  1779. self.app.ui.grb_edit_toolbar.setVisible(False)
  1780. self.app.ui.exc_edit_toolbar.setVisible(False)
  1781. self.app.ui.lock_toolbar(lock=True)
  1782. # add all the actions to the toolbars
  1783. self.app.ui.populate_toolbars()
  1784. # reconnect all the signals to the toolbar actions
  1785. self.app.connect_toolbar_signals()
  1786. self.app.ui.grid_snap_btn.setChecked(True)
  1787. self.app.on_grid_snap_triggered(state=True)
  1788. self.app.ui.grid_gap_x_entry.setText(str(self.app.defaults["global_gridx"]))
  1789. self.app.ui.grid_gap_y_entry.setText(str(self.app.defaults["global_gridy"]))
  1790. self.app.ui.snap_max_dist_entry.setText(str(self.app.defaults["global_snap_max"]))
  1791. self.app.ui.grid_gap_link_cb.setChecked(True)
  1792. class GeneralAPPSetGroupUI(OptionsGroupUI):
  1793. def __init__(self, decimals=4, parent=None):
  1794. super(GeneralAPPSetGroupUI, self).__init__(self)
  1795. self.setTitle(str(_("App Settings")))
  1796. self.decimals = decimals
  1797. theme_settings = QtCore.QSettings("Open Source", "FlatCAM")
  1798. if theme_settings.contains("theme"):
  1799. theme = theme_settings.value('theme', type=str)
  1800. else:
  1801. theme = 'white'
  1802. if theme == 'white':
  1803. self.resource_loc = 'share'
  1804. else:
  1805. self.resource_loc = 'share'
  1806. # Create a grid layout for the Application general settings
  1807. grid0 = QtWidgets.QGridLayout()
  1808. self.layout.addLayout(grid0)
  1809. grid0.setColumnStretch(0, 0)
  1810. grid0.setColumnStretch(1, 1)
  1811. # GRID Settings
  1812. self.grid_label = QtWidgets.QLabel('<b>%s</b>' % _('Grid Settings'))
  1813. grid0.addWidget(self.grid_label, 0, 0, 1, 2)
  1814. # Grid X Entry
  1815. self.gridx_label = QtWidgets.QLabel('%s:' % _('X value'))
  1816. self.gridx_label.setToolTip(
  1817. _("This is the Grid snap value on X axis.")
  1818. )
  1819. self.gridx_entry = FCDoubleSpinner()
  1820. self.gridx_entry.set_precision(self.decimals)
  1821. self.gridx_entry.setSingleStep(0.1)
  1822. grid0.addWidget(self.gridx_label, 1, 0)
  1823. grid0.addWidget(self.gridx_entry, 1, 1)
  1824. # Grid Y Entry
  1825. self.gridy_label = QtWidgets.QLabel('%s:' % _('Y value'))
  1826. self.gridy_label.setToolTip(
  1827. _("This is the Grid snap value on Y axis.")
  1828. )
  1829. self.gridy_entry = FCDoubleSpinner()
  1830. self.gridy_entry.set_precision(self.decimals)
  1831. self.gridy_entry.setSingleStep(0.1)
  1832. grid0.addWidget(self.gridy_label, 2, 0)
  1833. grid0.addWidget(self.gridy_entry, 2, 1)
  1834. # Snap Max Entry
  1835. self.snap_max_label = QtWidgets.QLabel('%s:' % _('Snap Max'))
  1836. self.snap_max_label.setToolTip(_("Max. magnet distance"))
  1837. self.snap_max_dist_entry = FCDoubleSpinner()
  1838. self.snap_max_dist_entry.set_precision(self.decimals)
  1839. self.snap_max_dist_entry.setSingleStep(0.1)
  1840. grid0.addWidget(self.snap_max_label, 3, 0)
  1841. grid0.addWidget(self.snap_max_dist_entry, 3, 1)
  1842. separator_line = QtWidgets.QFrame()
  1843. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  1844. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  1845. grid0.addWidget(separator_line, 4, 0, 1, 2)
  1846. # Workspace
  1847. self.workspace_label = QtWidgets.QLabel('<b>%s</b>' % _('Workspace Settings'))
  1848. grid0.addWidget(self.workspace_label, 5, 0, 1, 2)
  1849. self.workspace_cb = FCCheckBox('%s' % _('Active'))
  1850. self.workspace_cb.setToolTip(
  1851. _("Draw a delimiting rectangle on canvas.\n"
  1852. "The purpose is to illustrate the limits for our work.")
  1853. )
  1854. grid0.addWidget(self.workspace_cb, 6, 0, 1, 2)
  1855. self.workspace_type_lbl = QtWidgets.QLabel('%s:' % _('Size'))
  1856. self.workspace_type_lbl.setToolTip(
  1857. _("Select the type of rectangle to be used on canvas,\n"
  1858. "as valid workspace.")
  1859. )
  1860. self.wk_cb = FCComboBox()
  1861. grid0.addWidget(self.workspace_type_lbl, 7, 0)
  1862. grid0.addWidget(self.wk_cb, 7, 1)
  1863. self.pagesize = {}
  1864. self.pagesize.update(
  1865. {
  1866. 'A0': (841, 1189),
  1867. 'A1': (594, 841),
  1868. 'A2': (420, 594),
  1869. 'A3': (297, 420),
  1870. 'A4': (210, 297),
  1871. 'A5': (148, 210),
  1872. 'A6': (105, 148),
  1873. 'A7': (74, 105),
  1874. 'A8': (52, 74),
  1875. 'A9': (37, 52),
  1876. 'A10': (26, 37),
  1877. 'B0': (1000, 1414),
  1878. 'B1': (707, 1000),
  1879. 'B2': (500, 707),
  1880. 'B3': (353, 500),
  1881. 'B4': (250, 353),
  1882. 'B5': (176, 250),
  1883. 'B6': (125, 176),
  1884. 'B7': (88, 125),
  1885. 'B8': (62, 88),
  1886. 'B9': (44, 62),
  1887. 'B10': (31, 44),
  1888. 'C0': (917, 1297),
  1889. 'C1': (648, 917),
  1890. 'C2': (458, 648),
  1891. 'C3': (324, 458),
  1892. 'C4': (229, 324),
  1893. 'C5': (162, 229),
  1894. 'C6': (114, 162),
  1895. 'C7': (81, 114),
  1896. 'C8': (57, 81),
  1897. 'C9': (40, 57),
  1898. 'C10': (28, 40),
  1899. # American paper sizes
  1900. 'LETTER': (8.5, 11),
  1901. 'LEGAL': (8.5, 14),
  1902. 'ELEVENSEVENTEEN': (11, 17),
  1903. # From https://en.wikipedia.org/wiki/Paper_size
  1904. 'JUNIOR_LEGAL': (5, 8),
  1905. 'HALF_LETTER': (5.5, 8),
  1906. 'GOV_LETTER': (8, 10.5),
  1907. 'GOV_LEGAL': (8.5, 13),
  1908. 'LEDGER': (17, 11),
  1909. }
  1910. )
  1911. page_size_list = list(self.pagesize.keys())
  1912. self.wk_cb.addItems(page_size_list)
  1913. # Page orientation
  1914. self.wk_orientation_label = QtWidgets.QLabel('%s:' % _("Orientation"))
  1915. self.wk_orientation_label.setToolTip(_("Can be:\n"
  1916. "- Portrait\n"
  1917. "- Landscape"))
  1918. self.wk_orientation_radio = RadioSet([{'label': _('Portrait'), 'value': 'p'},
  1919. {'label': _('Landscape'), 'value': 'l'},
  1920. ], stretch=False)
  1921. self.wks = OptionalInputSection(self.workspace_cb,
  1922. [
  1923. self.workspace_type_lbl,
  1924. self.wk_cb,
  1925. self.wk_orientation_label,
  1926. self.wk_orientation_radio
  1927. ])
  1928. grid0.addWidget(self.wk_orientation_label, 8, 0)
  1929. grid0.addWidget(self.wk_orientation_radio, 8, 1)
  1930. separator_line = QtWidgets.QFrame()
  1931. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  1932. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  1933. grid0.addWidget(separator_line, 9, 0, 1, 2)
  1934. # Font Size
  1935. self.font_size_label = QtWidgets.QLabel('<b>%s</b>' % _('Font Size'))
  1936. grid0.addWidget(self.font_size_label, 10, 0, 1, 2)
  1937. # Notebook Font Size
  1938. self.notebook_font_size_label = QtWidgets.QLabel('%s:' % _('Notebook'))
  1939. self.notebook_font_size_label.setToolTip(
  1940. _("This sets the font size for the elements found in the Notebook.\n"
  1941. "The notebook is the collapsible area in the left side of the GUI,\n"
  1942. "and include the Project, Selected and Tool tabs.")
  1943. )
  1944. self.notebook_font_size_spinner = FCSpinner()
  1945. self.notebook_font_size_spinner.set_range(8, 40)
  1946. self.notebook_font_size_spinner.setWrapping(True)
  1947. settings = QSettings("Open Source", "FlatCAM")
  1948. if settings.contains("notebook_font_size"):
  1949. self.notebook_font_size_spinner.set_value(settings.value('notebook_font_size', type=int))
  1950. else:
  1951. self.notebook_font_size_spinner.set_value(12)
  1952. grid0.addWidget(self.notebook_font_size_label, 11, 0)
  1953. grid0.addWidget(self.notebook_font_size_spinner, 11, 1)
  1954. # Axis Font Size
  1955. self.axis_font_size_label = QtWidgets.QLabel('%s:' % _('Axis'))
  1956. self.axis_font_size_label.setToolTip(
  1957. _("This sets the font size for canvas axis.")
  1958. )
  1959. self.axis_font_size_spinner = FCSpinner()
  1960. self.axis_font_size_spinner.set_range(0, 40)
  1961. self.axis_font_size_spinner.setWrapping(True)
  1962. settings = QSettings("Open Source", "FlatCAM")
  1963. if settings.contains("axis_font_size"):
  1964. self.axis_font_size_spinner.set_value(settings.value('axis_font_size', type=int))
  1965. else:
  1966. self.axis_font_size_spinner.set_value(8)
  1967. grid0.addWidget(self.axis_font_size_label, 12, 0)
  1968. grid0.addWidget(self.axis_font_size_spinner, 12, 1)
  1969. # TextBox Font Size
  1970. self.textbox_font_size_label = QtWidgets.QLabel('%s:' % _('Textbox'))
  1971. self.textbox_font_size_label.setToolTip(
  1972. _("This sets the font size for the Textbox GUI\n"
  1973. "elements that are used in FlatCAM.")
  1974. )
  1975. self.textbox_font_size_spinner = FCSpinner()
  1976. self.textbox_font_size_spinner.set_range(8, 40)
  1977. self.textbox_font_size_spinner.setWrapping(True)
  1978. settings = QSettings("Open Source", "FlatCAM")
  1979. if settings.contains("textbox_font_size"):
  1980. self.textbox_font_size_spinner.set_value(settings.value('textbox_font_size', type=int))
  1981. else:
  1982. self.textbox_font_size_spinner.set_value(10)
  1983. grid0.addWidget(self.textbox_font_size_label, 13, 0)
  1984. grid0.addWidget(self.textbox_font_size_spinner, 13, 1)
  1985. separator_line = QtWidgets.QFrame()
  1986. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  1987. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  1988. grid0.addWidget(separator_line, 14, 0, 1, 2)
  1989. # -----------------------------------------------------------
  1990. # -------------- MOUSE SETTINGS -----------------------------
  1991. # -----------------------------------------------------------
  1992. self.mouse_lbl = QtWidgets.QLabel('<b>%s</b>' % _('Mouse Settings'))
  1993. grid0.addWidget(self.mouse_lbl, 21, 0, 1, 2)
  1994. # Mouse Cursor Shape
  1995. self.cursor_lbl = QtWidgets.QLabel('%s:' % _('Cursor Shape'))
  1996. self.cursor_lbl.setToolTip(
  1997. _("Choose a mouse cursor shape.\n"
  1998. "- Small -> with a customizable size.\n"
  1999. "- Big -> Infinite lines")
  2000. )
  2001. self.cursor_radio = RadioSet([
  2002. {"label": _("Small"), "value": "small"},
  2003. {"label": _("Big"), "value": "big"}
  2004. ], orientation='horizontal', stretch=False)
  2005. grid0.addWidget(self.cursor_lbl, 22, 0)
  2006. grid0.addWidget(self.cursor_radio, 22, 1)
  2007. # Mouse Cursor Size
  2008. self.cursor_size_lbl = QtWidgets.QLabel('%s:' % _('Cursor Size'))
  2009. self.cursor_size_lbl.setToolTip(
  2010. _("Set the size of the mouse cursor, in pixels.")
  2011. )
  2012. self.cursor_size_entry = FCSpinner()
  2013. self.cursor_size_entry.set_range(10, 70)
  2014. self.cursor_size_entry.setWrapping(True)
  2015. grid0.addWidget(self.cursor_size_lbl, 23, 0)
  2016. grid0.addWidget(self.cursor_size_entry, 23, 1)
  2017. # Cursor Width
  2018. self.cursor_width_lbl = QtWidgets.QLabel('%s:' % _('Cursor Width'))
  2019. self.cursor_width_lbl.setToolTip(
  2020. _("Set the line width of the mouse cursor, in pixels.")
  2021. )
  2022. self.cursor_width_entry = FCSpinner()
  2023. self.cursor_width_entry.set_range(1, 10)
  2024. self.cursor_width_entry.setWrapping(True)
  2025. grid0.addWidget(self.cursor_width_lbl, 24, 0)
  2026. grid0.addWidget(self.cursor_width_entry, 24, 1)
  2027. # Cursor Color Enable
  2028. self.mouse_cursor_color_cb = FCCheckBox(label='%s' % _('Cursor Color'))
  2029. self.mouse_cursor_color_cb.setToolTip(
  2030. _("Check this box to color mouse cursor.")
  2031. )
  2032. grid0.addWidget(self.mouse_cursor_color_cb, 25, 0, 1, 2)
  2033. # Cursor Color
  2034. self.mouse_color_label = QtWidgets.QLabel('%s:' % _('Cursor Color'))
  2035. self.mouse_color_label.setToolTip(
  2036. _("Set the color of the mouse cursor.")
  2037. )
  2038. self.mouse_cursor_entry = FCEntry()
  2039. self.mouse_cursor_button = QtWidgets.QPushButton()
  2040. self.mouse_cursor_button.setFixedSize(15, 15)
  2041. self.form_box_child_1 = QtWidgets.QHBoxLayout()
  2042. self.form_box_child_1.addWidget(self.mouse_cursor_entry)
  2043. self.form_box_child_1.addWidget(self.mouse_cursor_button)
  2044. self.form_box_child_1.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  2045. grid0.addWidget(self.mouse_color_label, 26, 0)
  2046. grid0.addLayout(self.form_box_child_1, 26, 1)
  2047. self.mois = OptionalInputSection(
  2048. self.mouse_cursor_color_cb,
  2049. [
  2050. self.mouse_color_label,
  2051. self.mouse_cursor_entry,
  2052. self.mouse_cursor_button
  2053. ]
  2054. )
  2055. # Select mouse pan button
  2056. self.panbuttonlabel = QtWidgets.QLabel('%s:' % _('Pan Button'))
  2057. self.panbuttonlabel.setToolTip(
  2058. _("Select the mouse button to use for panning:\n"
  2059. "- MMB --> Middle Mouse Button\n"
  2060. "- RMB --> Right Mouse Button")
  2061. )
  2062. self.pan_button_radio = RadioSet([{'label': _('MMB'), 'value': '3'},
  2063. {'label': _('RMB'), 'value': '2'}])
  2064. grid0.addWidget(self.panbuttonlabel, 27, 0)
  2065. grid0.addWidget(self.pan_button_radio, 27, 1)
  2066. # Multiple Selection Modifier Key
  2067. self.mselectlabel = QtWidgets.QLabel('%s:' % _('Multiple Selection'))
  2068. self.mselectlabel.setToolTip(
  2069. _("Select the key used for multiple selection.")
  2070. )
  2071. self.mselect_radio = RadioSet([{'label': _('CTRL'), 'value': 'Control'},
  2072. {'label': _('SHIFT'), 'value': 'Shift'}])
  2073. grid0.addWidget(self.mselectlabel, 28, 0)
  2074. grid0.addWidget(self.mselect_radio, 28, 1)
  2075. separator_line = QtWidgets.QFrame()
  2076. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  2077. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  2078. grid0.addWidget(separator_line, 29, 0, 1, 2)
  2079. # Delete confirmation
  2080. self.delete_conf_cb = FCCheckBox(_('Delete object confirmation'))
  2081. self.delete_conf_cb.setToolTip(
  2082. _("When checked the application will ask for user confirmation\n"
  2083. "whenever the Delete object(s) event is triggered, either by\n"
  2084. "menu shortcut or key shortcut.")
  2085. )
  2086. grid0.addWidget(self.delete_conf_cb, 30, 0, 1, 2)
  2087. # Open behavior
  2088. self.open_style_cb = FCCheckBox('%s' % _('"Open" behavior'))
  2089. self.open_style_cb.setToolTip(
  2090. _("When checked the path for the last saved file is used when saving files,\n"
  2091. "and the path for the last opened file is used when opening files.\n\n"
  2092. "When unchecked the path for opening files is the one used last: either the\n"
  2093. "path for saving files or the path for opening files.")
  2094. )
  2095. grid0.addWidget(self.open_style_cb, 31, 0, 1, 2)
  2096. # Enable/Disable ToolTips globally
  2097. self.toggle_tooltips_cb = FCCheckBox(label=_('Enable ToolTips'))
  2098. self.toggle_tooltips_cb.setToolTip(
  2099. _("Check this box if you want to have toolTips displayed\n"
  2100. "when hovering with mouse over items throughout the App.")
  2101. )
  2102. grid0.addWidget(self.toggle_tooltips_cb, 32, 0, 1, 2)
  2103. # Machinist settings that allow unsafe settings
  2104. self.machinist_cb = FCCheckBox(_("Allow Machinist Unsafe Settings"))
  2105. self.machinist_cb.setToolTip(
  2106. _("If checked, some of the application settings will be allowed\n"
  2107. "to have values that are usually unsafe to use.\n"
  2108. "Like Z travel negative values or Z Cut positive values.\n"
  2109. "It will applied at the next application start.\n"
  2110. "<<WARNING>>: Don't change this unless you know what you are doing !!!")
  2111. )
  2112. grid0.addWidget(self.machinist_cb, 33, 0, 1, 2)
  2113. # Bookmarks Limit in the Help Menu
  2114. self.bm_limit_spinner = FCSpinner()
  2115. self.bm_limit_spinner.set_range(0, 9999)
  2116. self.bm_limit_label = QtWidgets.QLabel('%s:' % _('Bookmarks limit'))
  2117. self.bm_limit_label.setToolTip(
  2118. _("The maximum number of bookmarks that may be installed in the menu.\n"
  2119. "The number of bookmarks in the bookmark manager may be greater\n"
  2120. "but the menu will hold only so much.")
  2121. )
  2122. grid0.addWidget(self.bm_limit_label, 34, 0)
  2123. grid0.addWidget(self.bm_limit_spinner, 34, 1)
  2124. # Activity monitor icon
  2125. self.activity_label = QtWidgets.QLabel('%s:' % _("Activity Icon"))
  2126. self.activity_label.setToolTip(
  2127. _("Select the GIF that show activity when FlatCAM is active.")
  2128. )
  2129. self.activity_combo = FCComboBox()
  2130. self.activity_combo.addItems(['Ball black', 'Ball green', 'Arrow green', 'Eclipse green'])
  2131. grid0.addWidget(self.activity_label, 35, 0)
  2132. grid0.addWidget(self.activity_combo, 35, 1)
  2133. self.layout.addStretch()
  2134. self.mouse_cursor_color_cb.stateChanged.connect(self.on_mouse_cursor_color_enable)
  2135. self.mouse_cursor_entry.editingFinished.connect(self.on_mouse_cursor_entry)
  2136. self.mouse_cursor_button.clicked.connect(self.on_mouse_cursor_button)
  2137. def on_mouse_cursor_color_enable(self, val):
  2138. if val:
  2139. self.app.cursor_color_3D = self.app.defaults["global_cursor_color"]
  2140. else:
  2141. theme_settings = QtCore.QSettings("Open Source", "FlatCAM")
  2142. if theme_settings.contains("theme"):
  2143. theme = theme_settings.value('theme', type=str)
  2144. else:
  2145. theme = 'white'
  2146. if theme == 'white':
  2147. self.app.cursor_color_3D = 'black'
  2148. else:
  2149. self.app.cursor_color_3D = 'gray'
  2150. def on_mouse_cursor_entry(self):
  2151. self.app.defaults['global_cursor_color'] = self.mouse_cursor_entry.get_value()
  2152. self.mouse_cursor_button.setStyleSheet("background-color:%s" % str(self.app.defaults['global_cursor_color']))
  2153. self.app.cursor_color_3D = self.app.defaults["global_cursor_color"]
  2154. def on_mouse_cursor_button(self):
  2155. current_color = QtGui.QColor(self.app.defaults['global_cursor_color'])
  2156. c_dialog = QtWidgets.QColorDialog()
  2157. proj_color = c_dialog.getColor(initial=current_color)
  2158. if proj_color.isValid() is False:
  2159. return
  2160. self.mouse_cursor_button.setStyleSheet("background-color:%s" % str(proj_color.name()))
  2161. new_val_sel = str(proj_color.name())
  2162. self.mouse_cursor_entry.set_value(new_val_sel)
  2163. self.app.defaults['global_cursor_color'] = new_val_sel
  2164. self.app.cursor_color_3D = self.app.defaults["global_cursor_color"]
  2165. class GeneralAppPrefGroupUI(OptionsGroupUI):
  2166. def __init__(self, decimals=4, parent=None):
  2167. super(GeneralAppPrefGroupUI, self).__init__(self)
  2168. self.setTitle(_("App Preferences"))
  2169. self.decimals = decimals
  2170. # Create a form layout for the Application general settings
  2171. grid0 = QtWidgets.QGridLayout()
  2172. self.layout.addLayout(grid0)
  2173. grid0.setColumnStretch(0, 0)
  2174. grid0.setColumnStretch(1, 1)
  2175. # Units for FlatCAM
  2176. self.unitslabel = QtWidgets.QLabel('<span style="color:red;"><b>%s:</b></span>' % _('Units'))
  2177. self.unitslabel.setToolTip(_("The default value for FlatCAM units.\n"
  2178. "Whatever is selected here is set every time\n"
  2179. "FLatCAM is started."))
  2180. self.units_radio = RadioSet([{'label': _('MM'), 'value': 'MM'},
  2181. {'label': _('IN'), 'value': 'IN'}])
  2182. grid0.addWidget(self.unitslabel, 0, 0)
  2183. grid0.addWidget(self.units_radio, 0, 1)
  2184. # Precision Metric
  2185. self.precision_metric_label = QtWidgets.QLabel('%s:' % _('Precision MM'))
  2186. self.precision_metric_label.setToolTip(
  2187. _("The number of decimals used throughout the application\n"
  2188. "when the set units are in METRIC system.\n"
  2189. "Any change here require an application restart.")
  2190. )
  2191. self.precision_metric_entry = FCSpinner()
  2192. self.precision_metric_entry.set_range(2, 16)
  2193. self.precision_metric_entry.setWrapping(True)
  2194. grid0.addWidget(self.precision_metric_label, 1, 0)
  2195. grid0.addWidget(self.precision_metric_entry, 1, 1)
  2196. # Precision Inch
  2197. self.precision_inch_label = QtWidgets.QLabel('%s:' % _('Precision INCH'))
  2198. self.precision_inch_label.setToolTip(
  2199. _("The number of decimals used throughout the application\n"
  2200. "when the set units are in INCH system.\n"
  2201. "Any change here require an application restart.")
  2202. )
  2203. self.precision_inch_entry = FCSpinner()
  2204. self.precision_inch_entry.set_range(2, 16)
  2205. self.precision_inch_entry.setWrapping(True)
  2206. grid0.addWidget(self.precision_inch_label, 2, 0)
  2207. grid0.addWidget(self.precision_inch_entry, 2, 1)
  2208. # Graphic Engine for FlatCAM
  2209. self.ge_label = QtWidgets.QLabel('<b>%s:</b>' % _('Graphic Engine'))
  2210. self.ge_label.setToolTip(_("Choose what graphic engine to use in FlatCAM.\n"
  2211. "Legacy(2D) -> reduced functionality, slow performance but enhanced compatibility.\n"
  2212. "OpenGL(3D) -> full functionality, high performance\n"
  2213. "Some graphic cards are too old and do not work in OpenGL(3D) mode, like:\n"
  2214. "Intel HD3000 or older. In this case the plot area will be black therefore\n"
  2215. "use the Legacy(2D) mode."))
  2216. self.ge_radio = RadioSet([{'label': _('Legacy(2D)'), 'value': '2D'},
  2217. {'label': _('OpenGL(3D)'), 'value': '3D'}],
  2218. orientation='vertical')
  2219. grid0.addWidget(self.ge_label, 3, 0)
  2220. grid0.addWidget(self.ge_radio, 3, 1)
  2221. separator_line = QtWidgets.QFrame()
  2222. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  2223. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  2224. grid0.addWidget(separator_line, 4, 0, 1, 2)
  2225. # Application Level for FlatCAM
  2226. self.app_level_label = QtWidgets.QLabel('<span style="color:red;"><b>%s:</b></span>' % _('APP. LEVEL'))
  2227. self.app_level_label.setToolTip(_("Choose the default level of usage for FlatCAM.\n"
  2228. "BASIC level -> reduced functionality, best for beginner's.\n"
  2229. "ADVANCED level -> full functionality.\n\n"
  2230. "The choice here will influence the parameters in\n"
  2231. "the Selected Tab for all kinds of FlatCAM objects."))
  2232. self.app_level_radio = RadioSet([{'label': _('Basic'), 'value': 'b'},
  2233. {'label': _('Advanced'), 'value': 'a'}])
  2234. grid0.addWidget(self.app_level_label, 5, 0)
  2235. grid0.addWidget(self.app_level_radio, 5, 1)
  2236. # Portability for FlatCAM
  2237. self.portability_cb = FCCheckBox('%s' % _('Portable app'))
  2238. self.portability_cb.setToolTip(_("Choose if the application should run as portable.\n\n"
  2239. "If Checked the application will run portable,\n"
  2240. "which means that the preferences files will be saved\n"
  2241. "in the application folder, in the lib\\config subfolder."))
  2242. grid0.addWidget(self.portability_cb, 6, 0, 1, 2)
  2243. separator_line = QtWidgets.QFrame()
  2244. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  2245. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  2246. grid0.addWidget(separator_line, 7, 0, 1, 2)
  2247. # Languages for FlatCAM
  2248. self.languagelabel = QtWidgets.QLabel('<b>%s</b>' % _('Languages'))
  2249. self.languagelabel.setToolTip(_("Set the language used throughout FlatCAM."))
  2250. self.language_cb = FCComboBox()
  2251. grid0.addWidget(self.languagelabel, 8, 0, 1, 2)
  2252. grid0.addWidget(self.language_cb, 9, 0, 1, 2)
  2253. self.language_apply_btn = FCButton(_("Apply Language"))
  2254. self.language_apply_btn.setToolTip(_("Set the language used throughout FlatCAM.\n"
  2255. "The app will restart after click."))
  2256. grid0.addWidget(self.language_apply_btn, 15, 0, 1, 2)
  2257. separator_line = QtWidgets.QFrame()
  2258. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  2259. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  2260. grid0.addWidget(separator_line, 16, 0, 1, 2)
  2261. # -----------------------------------------------------------
  2262. # ----------- APPLICATION STARTUP SETTINGS ------------------
  2263. # -----------------------------------------------------------
  2264. self.startup_label = QtWidgets.QLabel('<b>%s</b>' % _('Startup Settings'))
  2265. grid0.addWidget(self.startup_label, 17, 0, 1, 2)
  2266. # Splash Screen
  2267. self.splash_cb = FCCheckBox('%s' % _('Splash Screen'))
  2268. self.splash_cb.setToolTip(
  2269. _("Enable display of the splash screen at application startup.")
  2270. )
  2271. settings = QSettings("Open Source", "FlatCAM")
  2272. if settings.value("splash_screen"):
  2273. self.splash_cb.set_value(True)
  2274. else:
  2275. self.splash_cb.set_value(False)
  2276. grid0.addWidget(self.splash_cb, 18, 0, 1, 2)
  2277. # Sys Tray Icon
  2278. self.systray_cb = FCCheckBox('%s' % _('Sys Tray Icon'))
  2279. self.systray_cb.setToolTip(
  2280. _("Enable display of FlatCAM icon in Sys Tray.")
  2281. )
  2282. grid0.addWidget(self.systray_cb, 19, 0, 1, 2)
  2283. # Shell StartUp CB
  2284. self.shell_startup_cb = FCCheckBox(label='%s' % _('Show Shell'))
  2285. self.shell_startup_cb.setToolTip(
  2286. _("Check this box if you want the shell to\n"
  2287. "start automatically at startup.")
  2288. )
  2289. grid0.addWidget(self.shell_startup_cb, 20, 0, 1, 2)
  2290. # Project at StartUp CB
  2291. self.project_startup_cb = FCCheckBox(label='%s' % _('Show Project'))
  2292. self.project_startup_cb.setToolTip(
  2293. _("Check this box if you want the project/selected/tool tab area to\n"
  2294. "to be shown automatically at startup.")
  2295. )
  2296. grid0.addWidget(self.project_startup_cb, 21, 0, 1, 2)
  2297. # Version Check CB
  2298. self.version_check_cb = FCCheckBox(label='%s' % _('Version Check'))
  2299. self.version_check_cb.setToolTip(
  2300. _("Check this box if you want to check\n"
  2301. "for a new version automatically at startup.")
  2302. )
  2303. grid0.addWidget(self.version_check_cb, 22, 0, 1, 2)
  2304. # Send Stats CB
  2305. self.send_stats_cb = FCCheckBox(label='%s' % _('Send Statistics'))
  2306. self.send_stats_cb.setToolTip(
  2307. _("Check this box if you agree to send anonymous\n"
  2308. "stats automatically at startup, to help improve FlatCAM.")
  2309. )
  2310. grid0.addWidget(self.send_stats_cb, 23, 0, 1, 2)
  2311. self.ois_version_check = OptionalInputSection(self.version_check_cb, [self.send_stats_cb])
  2312. separator_line = QtWidgets.QFrame()
  2313. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  2314. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  2315. grid0.addWidget(separator_line, 24, 0, 1, 2)
  2316. # Worker Numbers
  2317. self.worker_number_label = QtWidgets.QLabel('%s:' % _('Workers number'))
  2318. self.worker_number_label.setToolTip(
  2319. _("The number of Qthreads made available to the App.\n"
  2320. "A bigger number may finish the jobs more quickly but\n"
  2321. "depending on your computer speed, may make the App\n"
  2322. "unresponsive. Can have a value between 2 and 16.\n"
  2323. "Default value is 2.\n"
  2324. "After change, it will be applied at next App start.")
  2325. )
  2326. self.worker_number_sb = FCSpinner()
  2327. self.worker_number_sb.set_range(2, 16)
  2328. grid0.addWidget(self.worker_number_label, 25, 0)
  2329. grid0.addWidget(self.worker_number_sb, 25, 1)
  2330. # Geometric tolerance
  2331. tol_label = QtWidgets.QLabel('%s:' % _("Geo Tolerance"))
  2332. tol_label.setToolTip(_(
  2333. "This value can counter the effect of the Circle Steps\n"
  2334. "parameter. Default value is 0.005.\n"
  2335. "A lower value will increase the detail both in image\n"
  2336. "and in Gcode for the circles, with a higher cost in\n"
  2337. "performance. Higher value will provide more\n"
  2338. "performance at the expense of level of detail."
  2339. ))
  2340. self.tol_entry = FCDoubleSpinner()
  2341. self.tol_entry.setSingleStep(0.001)
  2342. self.tol_entry.set_precision(6)
  2343. grid0.addWidget(tol_label, 26, 0)
  2344. grid0.addWidget(self.tol_entry, 26, 1)
  2345. separator_line = QtWidgets.QFrame()
  2346. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  2347. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  2348. grid0.addWidget(separator_line, 27, 0, 1, 2)
  2349. # Save Settings
  2350. self.save_label = QtWidgets.QLabel('<b>%s</b>' % _("Save Settings"))
  2351. grid0.addWidget(self.save_label, 28, 0, 1, 2)
  2352. # Save compressed project CB
  2353. self.save_type_cb = FCCheckBox(_('Save Compressed Project'))
  2354. self.save_type_cb.setToolTip(
  2355. _("Whether to save a compressed or uncompressed project.\n"
  2356. "When checked it will save a compressed FlatCAM project.")
  2357. )
  2358. grid0.addWidget(self.save_type_cb, 29, 0, 1, 2)
  2359. # Project LZMA Comppression Level
  2360. self.compress_spinner = FCSpinner()
  2361. self.compress_spinner.set_range(0, 9)
  2362. self.compress_label = QtWidgets.QLabel('%s:' % _('Compression'))
  2363. self.compress_label.setToolTip(
  2364. _("The level of compression used when saving\n"
  2365. "a FlatCAM project. Higher value means better compression\n"
  2366. "but require more RAM usage and more processing time.")
  2367. )
  2368. grid0.addWidget(self.compress_label, 30, 0)
  2369. grid0.addWidget(self.compress_spinner, 30, 1)
  2370. self.proj_ois = OptionalInputSection(self.save_type_cb, [self.compress_label, self.compress_spinner], True)
  2371. # Auto save CB
  2372. self.autosave_cb = FCCheckBox(_('Enable Auto Save'))
  2373. self.autosave_cb.setToolTip(
  2374. _("Check to enable the autosave feature.\n"
  2375. "When enabled, the application will try to save a project\n"
  2376. "at the set interval.")
  2377. )
  2378. grid0.addWidget(self.autosave_cb, 31, 0, 1, 2)
  2379. # Auto Save Timeout Interval
  2380. self.autosave_entry = FCSpinner()
  2381. self.autosave_entry.set_range(0, 9999999)
  2382. self.autosave_label = QtWidgets.QLabel('%s:' % _('Interval'))
  2383. self.autosave_label.setToolTip(
  2384. _("Time interval for autosaving. In milliseconds.\n"
  2385. "The application will try to save periodically but only\n"
  2386. "if the project was saved manually at least once.\n"
  2387. "While active, some operations may block this feature.")
  2388. )
  2389. grid0.addWidget(self.autosave_label, 32, 0)
  2390. grid0.addWidget(self.autosave_entry, 32, 1)
  2391. # self.as_ois = OptionalInputSection(self.autosave_cb, [self.autosave_label, self.autosave_entry], True)
  2392. separator_line = QtWidgets.QFrame()
  2393. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  2394. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  2395. grid0.addWidget(separator_line, 33, 0, 1, 2)
  2396. self.pdf_param_label = QtWidgets.QLabel('<B>%s:</b>' % _("Text to PDF parameters"))
  2397. self.pdf_param_label.setToolTip(
  2398. _("Used when saving text in Code Editor or in FlatCAM Document objects.")
  2399. )
  2400. grid0.addWidget(self.pdf_param_label, 34, 0, 1, 2)
  2401. # Top Margin value
  2402. self.tmargin_entry = FCDoubleSpinner()
  2403. self.tmargin_entry.set_precision(self.decimals)
  2404. self.tmargin_entry.set_range(0.0000, 9999.9999)
  2405. self.tmargin_label = QtWidgets.QLabel('%s:' % _("Top Margin"))
  2406. self.tmargin_label.setToolTip(
  2407. _("Distance between text body and the top of the PDF file.")
  2408. )
  2409. grid0.addWidget(self.tmargin_label, 35, 0)
  2410. grid0.addWidget(self.tmargin_entry, 35, 1)
  2411. # Bottom Margin value
  2412. self.bmargin_entry = FCDoubleSpinner()
  2413. self.bmargin_entry.set_precision(self.decimals)
  2414. self.bmargin_entry.set_range(0.0000, 9999.9999)
  2415. self.bmargin_label = QtWidgets.QLabel('%s:' % _("Bottom Margin"))
  2416. self.bmargin_label.setToolTip(
  2417. _("Distance between text body and the bottom of the PDF file.")
  2418. )
  2419. grid0.addWidget(self.bmargin_label, 36, 0)
  2420. grid0.addWidget(self.bmargin_entry, 36, 1)
  2421. # Left Margin value
  2422. self.lmargin_entry = FCDoubleSpinner()
  2423. self.lmargin_entry.set_precision(self.decimals)
  2424. self.lmargin_entry.set_range(0.0000, 9999.9999)
  2425. self.lmargin_label = QtWidgets.QLabel('%s:' % _("Left Margin"))
  2426. self.lmargin_label.setToolTip(
  2427. _("Distance between text body and the left of the PDF file.")
  2428. )
  2429. grid0.addWidget(self.lmargin_label, 37, 0)
  2430. grid0.addWidget(self.lmargin_entry, 37, 1)
  2431. # Right Margin value
  2432. self.rmargin_entry = FCDoubleSpinner()
  2433. self.rmargin_entry.set_precision(self.decimals)
  2434. self.rmargin_entry.set_range(0.0000, 9999.9999)
  2435. self.rmargin_label = QtWidgets.QLabel('%s:' % _("Right Margin"))
  2436. self.rmargin_label.setToolTip(
  2437. _("Distance between text body and the right of the PDF file.")
  2438. )
  2439. grid0.addWidget(self.rmargin_label, 38, 0)
  2440. grid0.addWidget(self.rmargin_entry, 38, 1)
  2441. self.layout.addStretch()
  2442. if sys.platform != 'win32':
  2443. self.portability_cb.hide()
  2444. # splash screen button signal
  2445. self.splash_cb.stateChanged.connect(self.on_splash_changed)
  2446. # Monitor the checkbox from the Application Defaults Tab and show the TCL shell or not depending on it's value
  2447. self.shell_startup_cb.clicked.connect(self.app.on_toggle_shell_from_settings)
  2448. self.language_apply_btn.clicked.connect(lambda: fcTranslate.on_language_apply_click(app=self.app, restart=True))
  2449. def on_splash_changed(self, state):
  2450. settings = QSettings("Open Source", "FlatCAM")
  2451. settings.setValue('splash_screen', 1) if state else settings.setValue('splash_screen', 0)
  2452. # This will write the setting to the platform specific storage.
  2453. del settings
  2454. class GerberGenPrefGroupUI(OptionsGroupUI):
  2455. def __init__(self, decimals=4, parent=None):
  2456. # OptionsGroupUI.__init__(self, "Gerber General Preferences", parent=parent)
  2457. super(GerberGenPrefGroupUI, self).__init__(self)
  2458. self.setTitle(str(_("Gerber General")))
  2459. self.decimals = decimals
  2460. # ## Plot options
  2461. self.plot_options_label = QtWidgets.QLabel("<b>%s:</b>" % _("Plot Options"))
  2462. self.layout.addWidget(self.plot_options_label)
  2463. grid0 = QtWidgets.QGridLayout()
  2464. self.layout.addLayout(grid0)
  2465. # Solid CB
  2466. self.solid_cb = FCCheckBox(label='%s' % _('Solid'))
  2467. self.solid_cb.setToolTip(
  2468. _("Solid color polygons.")
  2469. )
  2470. grid0.addWidget(self.solid_cb, 0, 0)
  2471. # Multicolored CB
  2472. self.multicolored_cb = FCCheckBox(label='%s' % _('M-Color'))
  2473. self.multicolored_cb.setToolTip(
  2474. _("Draw polygons in different colors.")
  2475. )
  2476. grid0.addWidget(self.multicolored_cb, 0, 1)
  2477. # Plot CB
  2478. self.plot_cb = FCCheckBox(label='%s' % _('Plot'))
  2479. self.plot_options_label.setToolTip(
  2480. _("Plot (show) this object.")
  2481. )
  2482. grid0.addWidget(self.plot_cb, 0, 2)
  2483. # Number of circle steps for circular aperture linear approximation
  2484. self.circle_steps_label = QtWidgets.QLabel('%s:' % _("Circle Steps"))
  2485. self.circle_steps_label.setToolTip(
  2486. _("The number of circle steps for Gerber \n"
  2487. "circular aperture linear approximation.")
  2488. )
  2489. self.circle_steps_entry = FCSpinner()
  2490. self.circle_steps_entry.set_range(0, 9999)
  2491. grid0.addWidget(self.circle_steps_label, 1, 0)
  2492. grid0.addWidget(self.circle_steps_entry, 1, 1, 1, 2)
  2493. grid0.addWidget(QtWidgets.QLabel(''), 2, 0, 1, 3)
  2494. # Default format for Gerber
  2495. self.gerber_default_label = QtWidgets.QLabel('<b>%s:</b>' % _('Default Values'))
  2496. self.gerber_default_label.setToolTip(
  2497. _("Those values will be used as fallback values\n"
  2498. "in case that they are not found in the Gerber file.")
  2499. )
  2500. grid0.addWidget(self.gerber_default_label, 3, 0, 1, 3)
  2501. # Gerber Units
  2502. self.gerber_units_label = QtWidgets.QLabel('%s:' % _('Units'))
  2503. self.gerber_units_label.setToolTip(
  2504. _("The units used in the Gerber file.")
  2505. )
  2506. self.gerber_units_radio = RadioSet([{'label': _('INCH'), 'value': 'IN'},
  2507. {'label': _('MM'), 'value': 'MM'}])
  2508. self.gerber_units_radio.setToolTip(
  2509. _("The units used in the Gerber file.")
  2510. )
  2511. grid0.addWidget(self.gerber_units_label, 4, 0)
  2512. grid0.addWidget(self.gerber_units_radio, 4, 1, 1, 2)
  2513. # Gerber Zeros
  2514. self.gerber_zeros_label = QtWidgets.QLabel('%s:' % _('Zeros'))
  2515. self.gerber_zeros_label.setAlignment(QtCore.Qt.AlignLeft)
  2516. self.gerber_zeros_label.setToolTip(
  2517. _("This sets the type of Gerber zeros.\n"
  2518. "If LZ then Leading Zeros are removed and\n"
  2519. "Trailing Zeros are kept.\n"
  2520. "If TZ is checked then Trailing Zeros are removed\n"
  2521. "and Leading Zeros are kept.")
  2522. )
  2523. self.gerber_zeros_radio = RadioSet([{'label': _('LZ'), 'value': 'L'},
  2524. {'label': _('TZ'), 'value': 'T'}])
  2525. self.gerber_zeros_radio.setToolTip(
  2526. _("This sets the type of Gerber zeros.\n"
  2527. "If LZ then Leading Zeros are removed and\n"
  2528. "Trailing Zeros are kept.\n"
  2529. "If TZ is checked then Trailing Zeros are removed\n"
  2530. "and Leading Zeros are kept.")
  2531. )
  2532. grid0.addWidget(self.gerber_zeros_label, 5, 0)
  2533. grid0.addWidget(self.gerber_zeros_radio, 5, 1, 1, 2)
  2534. separator_line = QtWidgets.QFrame()
  2535. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  2536. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  2537. grid0.addWidget(separator_line, 6, 0, 1, 3)
  2538. # Apertures Cleaning
  2539. self.gerber_clean_cb = FCCheckBox(label='%s' % _('Clean Apertures'))
  2540. self.gerber_clean_cb.setToolTip(
  2541. _("Will remove apertures that do not have geometry\n"
  2542. "thus lowering the number of apertures in the Gerber object.")
  2543. )
  2544. grid0.addWidget(self.gerber_clean_cb, 7, 0, 1, 3)
  2545. # Apply Extra Buffering
  2546. self.gerber_extra_buffering = FCCheckBox(label='%s' % _('Polarity change buffer'))
  2547. self.gerber_extra_buffering.setToolTip(
  2548. _("Will apply extra buffering for the\n"
  2549. "solid geometry when we have polarity changes.\n"
  2550. "May help loading Gerber files that otherwise\n"
  2551. "do not load correctly.")
  2552. )
  2553. grid0.addWidget(self.gerber_extra_buffering, 8, 0, 1, 3)
  2554. separator_line = QtWidgets.QFrame()
  2555. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  2556. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  2557. grid0.addWidget(separator_line, 9, 0, 1, 3)
  2558. # Gerber Object Color
  2559. self.gerber_color_label = QtWidgets.QLabel('<b>%s</b>' % _('Gerber Object Color'))
  2560. grid0.addWidget(self.gerber_color_label, 10, 0, 1, 3)
  2561. # Plot Line Color
  2562. self.pl_color_label = QtWidgets.QLabel('%s:' % _('Outline'))
  2563. self.pl_color_label.setToolTip(
  2564. _("Set the line color for plotted objects.")
  2565. )
  2566. self.pl_color_entry = FCEntry()
  2567. self.pl_color_button = QtWidgets.QPushButton()
  2568. self.pl_color_button.setFixedSize(15, 15)
  2569. self.form_box_child_2 = QtWidgets.QHBoxLayout()
  2570. self.form_box_child_2.addWidget(self.pl_color_entry)
  2571. self.form_box_child_2.addWidget(self.pl_color_button)
  2572. self.form_box_child_2.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  2573. grid0.addWidget(self.pl_color_label, 11, 0)
  2574. grid0.addLayout(self.form_box_child_2, 11, 1, 1, 2)
  2575. # Plot Fill Color
  2576. self.pf_color_label = QtWidgets.QLabel('%s:' % _('Fill'))
  2577. self.pf_color_label.setToolTip(
  2578. _("Set the fill color for plotted objects.\n"
  2579. "First 6 digits are the color and the last 2\n"
  2580. "digits are for alpha (transparency) level.")
  2581. )
  2582. self.pf_color_entry = FCEntry()
  2583. self.pf_color_button = QtWidgets.QPushButton()
  2584. self.pf_color_button.setFixedSize(15, 15)
  2585. self.form_box_child_1 = QtWidgets.QHBoxLayout()
  2586. self.form_box_child_1.addWidget(self.pf_color_entry)
  2587. self.form_box_child_1.addWidget(self.pf_color_button)
  2588. self.form_box_child_1.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  2589. grid0.addWidget(self.pf_color_label, 12, 0)
  2590. grid0.addLayout(self.form_box_child_1, 12, 1, 1, 2)
  2591. # Plot Fill Transparency Level
  2592. self.pf_alpha_label = QtWidgets.QLabel('%s:' % _('Alpha'))
  2593. self.pf_alpha_label.setToolTip(
  2594. _("Set the fill transparency for plotted objects.")
  2595. )
  2596. self.pf_color_alpha_slider = QtWidgets.QSlider(QtCore.Qt.Horizontal)
  2597. self.pf_color_alpha_slider.setMinimum(0)
  2598. self.pf_color_alpha_slider.setMaximum(255)
  2599. self.pf_color_alpha_slider.setSingleStep(1)
  2600. self.pf_color_alpha_spinner = FCSpinner()
  2601. self.pf_color_alpha_spinner.setMinimumWidth(70)
  2602. self.pf_color_alpha_spinner.set_range(0, 255)
  2603. self.form_box_child_3 = QtWidgets.QHBoxLayout()
  2604. self.form_box_child_3.addWidget(self.pf_color_alpha_slider)
  2605. self.form_box_child_3.addWidget(self.pf_color_alpha_spinner)
  2606. grid0.addWidget(self.pf_alpha_label, 13, 0)
  2607. grid0.addLayout(self.form_box_child_3, 13, 1, 1, 2)
  2608. self.layout.addStretch()
  2609. # Setting plot colors signals
  2610. self.pl_color_entry.editingFinished.connect(self.on_pl_color_entry)
  2611. self.pl_color_button.clicked.connect(self.on_pl_color_button)
  2612. self.pf_color_entry.editingFinished.connect(self.on_pf_color_entry)
  2613. self.pf_color_button.clicked.connect(self.on_pf_color_button)
  2614. self.pf_color_alpha_spinner.valueChanged.connect(self.on_pf_color_spinner)
  2615. self.pf_color_alpha_slider.valueChanged.connect(self.on_pf_color_slider)
  2616. # Setting plot colors handlers
  2617. def on_pf_color_entry(self):
  2618. self.app.defaults['gerber_plot_fill'] = self.pf_color_entry.get_value()[:7] + \
  2619. self.app.defaults['gerber_plot_fill'][7:9]
  2620. self.pf_color_button.setStyleSheet("background-color:%s" % str(self.defaults['gerber_plot_fill'])[:7])
  2621. def on_pf_color_button(self):
  2622. current_color = QtGui.QColor(self.app.defaults['gerber_plot_fill'][:7])
  2623. c_dialog = QtWidgets.QColorDialog()
  2624. plot_fill_color = c_dialog.getColor(initial=current_color)
  2625. if plot_fill_color.isValid() is False:
  2626. return
  2627. self.pf_color_button.setStyleSheet("background-color:%s" % str(plot_fill_color.name()))
  2628. new_val = str(plot_fill_color.name()) + str(self.app.defaults['gerber_plot_fill'][7:9])
  2629. self.pf_color_entry.set_value(new_val)
  2630. self.app.defaults['gerber_plot_fill'] = new_val
  2631. def on_pf_color_spinner(self):
  2632. spinner_value = self.pf_color_alpha_spinner.value()
  2633. self.pf_color_alpha_slider.setValue(spinner_value)
  2634. self.app.defaults['gerber_plot_fill'] = \
  2635. self.app.defaults['gerber_plot_fill'][:7] + \
  2636. (hex(spinner_value)[2:] if int(hex(spinner_value)[2:], 16) > 0 else '00')
  2637. self.app.defaults['gerber_plot_line'] = \
  2638. self.app.defaults['gerber_plot_line'][:7] + \
  2639. (hex(spinner_value)[2:] if int(hex(spinner_value)[2:], 16) > 0 else '00')
  2640. def on_pf_color_slider(self):
  2641. slider_value = self.pf_color_alpha_slider.value()
  2642. self.pf_color_alpha_spinner.setValue(slider_value)
  2643. def on_pl_color_entry(self):
  2644. self.app.defaults['gerber_plot_line'] = self.pl_color_entry.get_value()[:7] + \
  2645. self.app.defaults['gerber_plot_line'][7:9]
  2646. self.pl_color_button.setStyleSheet("background-color:%s" % str(self.app.defaults['gerber_plot_line'])[:7])
  2647. def on_pl_color_button(self):
  2648. current_color = QtGui.QColor(self.app.defaults['gerber_plot_line'][:7])
  2649. # print(current_color)
  2650. c_dialog = QtWidgets.QColorDialog()
  2651. plot_line_color = c_dialog.getColor(initial=current_color)
  2652. if plot_line_color.isValid() is False:
  2653. return
  2654. self.pl_color_button.setStyleSheet("background-color:%s" % str(plot_line_color.name()))
  2655. new_val_line = str(plot_line_color.name()) + str(self.app.defaults['gerber_plot_line'][7:9])
  2656. self.pl_color_entry.set_value(new_val_line)
  2657. self.app.defaults['gerber_plot_line'] = new_val_line
  2658. class GerberOptPrefGroupUI(OptionsGroupUI):
  2659. def __init__(self, decimals=4, parent=None):
  2660. # OptionsGroupUI.__init__(self, "Gerber Options Preferences", parent=parent)
  2661. super(GerberOptPrefGroupUI, self).__init__(self)
  2662. self.decimals = decimals
  2663. self.setTitle(str(_("Gerber Options")))
  2664. # ## Isolation Routing
  2665. self.isolation_routing_label = QtWidgets.QLabel("<b>%s:</b>" % _("Isolation Routing"))
  2666. self.isolation_routing_label.setToolTip(
  2667. _("Create a Geometry object with\n"
  2668. "toolpaths to cut outside polygons.")
  2669. )
  2670. self.layout.addWidget(self.isolation_routing_label)
  2671. # Cutting Tool Diameter
  2672. grid0 = QtWidgets.QGridLayout()
  2673. self.layout.addLayout(grid0)
  2674. tdlabel = QtWidgets.QLabel('%s:' % _('Tool dia'))
  2675. tdlabel.setToolTip(
  2676. _("Diameter of the cutting tool.")
  2677. )
  2678. grid0.addWidget(tdlabel, 0, 0)
  2679. self.iso_tool_dia_entry = FCDoubleSpinner()
  2680. self.iso_tool_dia_entry.set_precision(self.decimals)
  2681. self.iso_tool_dia_entry.setSingleStep(0.1)
  2682. self.iso_tool_dia_entry.set_range(-9999, 9999)
  2683. grid0.addWidget(self.iso_tool_dia_entry, 0, 1)
  2684. # Nr of passes
  2685. passlabel = QtWidgets.QLabel('%s:' % _('# Passes'))
  2686. passlabel.setToolTip(
  2687. _("Width of the isolation gap in\n"
  2688. "number (integer) of tool widths.")
  2689. )
  2690. self.iso_width_entry = FCSpinner()
  2691. self.iso_width_entry.set_range(1, 999)
  2692. grid0.addWidget(passlabel, 1, 0)
  2693. grid0.addWidget(self.iso_width_entry, 1, 1)
  2694. # Pass overlap
  2695. overlabel = QtWidgets.QLabel('%s:' % _('Pass overlap'))
  2696. overlabel.setToolTip(
  2697. _("How much (percentage) of the tool width to overlap each tool pass.")
  2698. )
  2699. self.iso_overlap_entry = FCDoubleSpinner(suffix='%')
  2700. self.iso_overlap_entry.set_precision(self.decimals)
  2701. self.iso_overlap_entry.setWrapping(True)
  2702. self.iso_overlap_entry.setRange(0.0000, 99.9999)
  2703. self.iso_overlap_entry.setSingleStep(0.1)
  2704. grid0.addWidget(overlabel, 2, 0)
  2705. grid0.addWidget(self.iso_overlap_entry, 2, 1)
  2706. # Isolation Scope
  2707. self.iso_scope_label = QtWidgets.QLabel('%s:' % _('Scope'))
  2708. self.iso_scope_label.setToolTip(
  2709. _("Isolation scope. Choose what to isolate:\n"
  2710. "- 'All' -> Isolate all the polygons in the object\n"
  2711. "- 'Selection' -> Isolate a selection of polygons.")
  2712. )
  2713. self.iso_scope_radio = RadioSet([{'label': _('All'), 'value': 'all'},
  2714. {'label': _('Selection'), 'value': 'single'}])
  2715. grid0.addWidget(self.iso_scope_label, 3, 0)
  2716. grid0.addWidget(self.iso_scope_radio, 3, 1, 1, 2)
  2717. # Milling Type
  2718. milling_type_label = QtWidgets.QLabel('%s:' % _('Milling Type'))
  2719. milling_type_label.setToolTip(
  2720. _("Milling type:\n"
  2721. "- climb / best for precision milling and to reduce tool usage\n"
  2722. "- conventional / useful when there is no backlash compensation")
  2723. )
  2724. grid0.addWidget(milling_type_label, 4, 0)
  2725. self.milling_type_radio = RadioSet([{'label': _('Climb'), 'value': 'cl'},
  2726. {'label': _('Conventional'), 'value': 'cv'}])
  2727. grid0.addWidget(self.milling_type_radio, 4, 1)
  2728. # Combine passes
  2729. self.combine_passes_cb = FCCheckBox(label=_('Combine Passes'))
  2730. self.combine_passes_cb.setToolTip(
  2731. _("Combine all passes into one object")
  2732. )
  2733. grid0.addWidget(self.combine_passes_cb, 5, 0, 1, 2)
  2734. separator_line = QtWidgets.QFrame()
  2735. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  2736. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  2737. grid0.addWidget(separator_line, 6, 0, 1, 2)
  2738. # ## Clear non-copper regions
  2739. self.clearcopper_label = QtWidgets.QLabel("<b>%s:</b>" % _("Non-copper regions"))
  2740. self.clearcopper_label.setToolTip(
  2741. _("Create polygons covering the\n"
  2742. "areas without copper on the PCB.\n"
  2743. "Equivalent to the inverse of this\n"
  2744. "object. Can be used to remove all\n"
  2745. "copper from a specified region.")
  2746. )
  2747. self.layout.addWidget(self.clearcopper_label)
  2748. grid1 = QtWidgets.QGridLayout()
  2749. self.layout.addLayout(grid1)
  2750. # Margin
  2751. bmlabel = QtWidgets.QLabel('%s:' % _('Boundary Margin'))
  2752. bmlabel.setToolTip(
  2753. _("Specify the edge of the PCB\n"
  2754. "by drawing a box around all\n"
  2755. "objects with this minimum\n"
  2756. "distance.")
  2757. )
  2758. grid1.addWidget(bmlabel, 0, 0)
  2759. self.noncopper_margin_entry = FCDoubleSpinner()
  2760. self.noncopper_margin_entry.set_precision(self.decimals)
  2761. self.noncopper_margin_entry.setSingleStep(0.1)
  2762. self.noncopper_margin_entry.set_range(-9999, 9999)
  2763. grid1.addWidget(self.noncopper_margin_entry, 0, 1)
  2764. # Rounded corners
  2765. self.noncopper_rounded_cb = FCCheckBox(label=_("Rounded Geo"))
  2766. self.noncopper_rounded_cb.setToolTip(
  2767. _("Resulting geometry will have rounded corners.")
  2768. )
  2769. grid1.addWidget(self.noncopper_rounded_cb, 1, 0, 1, 2)
  2770. separator_line = QtWidgets.QFrame()
  2771. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  2772. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  2773. grid1.addWidget(separator_line, 2, 0, 1, 2)
  2774. # ## Bounding box
  2775. self.boundingbox_label = QtWidgets.QLabel('<b>%s:</b>' % _('Bounding Box'))
  2776. self.layout.addWidget(self.boundingbox_label)
  2777. grid2 = QtWidgets.QGridLayout()
  2778. self.layout.addLayout(grid2)
  2779. bbmargin = QtWidgets.QLabel('%s:' % _('Boundary Margin'))
  2780. bbmargin.setToolTip(
  2781. _("Distance of the edges of the box\n"
  2782. "to the nearest polygon.")
  2783. )
  2784. self.bbmargin_entry = FCDoubleSpinner()
  2785. self.bbmargin_entry.set_precision(self.decimals)
  2786. self.bbmargin_entry.setSingleStep(0.1)
  2787. self.bbmargin_entry.set_range(-9999, 9999)
  2788. grid2.addWidget(bbmargin, 0, 0)
  2789. grid2.addWidget(self.bbmargin_entry, 0, 1)
  2790. self.bbrounded_cb = FCCheckBox(label='%s' % _("Rounded Geo"))
  2791. self.bbrounded_cb.setToolTip(
  2792. _("If the bounding box is \n"
  2793. "to have rounded corners\n"
  2794. "their radius is equal to\n"
  2795. "the margin.")
  2796. )
  2797. grid2.addWidget(self.bbrounded_cb, 1, 0, 1, 2)
  2798. self.layout.addStretch()
  2799. class GerberAdvOptPrefGroupUI(OptionsGroupUI):
  2800. def __init__(self, decimals=4, parent=None):
  2801. # OptionsGroupUI.__init__(self, "Gerber Adv. Options Preferences", parent=parent)
  2802. super(GerberAdvOptPrefGroupUI, self).__init__(self)
  2803. self.setTitle(str(_("Gerber Adv. Options")))
  2804. self.decimals = decimals
  2805. # ## Advanced Gerber Parameters
  2806. self.adv_param_label = QtWidgets.QLabel('<b>%s:</b>' % _('Advanced Options'))
  2807. self.adv_param_label.setToolTip(
  2808. _("A list of Gerber advanced parameters.\n"
  2809. "Those parameters are available only for\n"
  2810. "Advanced App. Level.")
  2811. )
  2812. self.layout.addWidget(self.adv_param_label)
  2813. grid0 = QtWidgets.QGridLayout()
  2814. self.layout.addLayout(grid0)
  2815. # Follow Attribute
  2816. self.follow_cb = FCCheckBox(label=_('"Follow"'))
  2817. self.follow_cb.setToolTip(
  2818. _("Generate a 'Follow' geometry.\n"
  2819. "This means that it will cut through\n"
  2820. "the middle of the trace.")
  2821. )
  2822. grid0.addWidget(self.follow_cb, 0, 0, 1, 2)
  2823. # Aperture Table Visibility CB
  2824. self.aperture_table_visibility_cb = FCCheckBox(label=_('Table Show/Hide'))
  2825. self.aperture_table_visibility_cb.setToolTip(
  2826. _("Toggle the display of the Gerber Apertures Table.\n"
  2827. "Also, on hide, it will delete all mark shapes\n"
  2828. "that are drawn on canvas.")
  2829. )
  2830. grid0.addWidget(self.aperture_table_visibility_cb, 1, 0, 1, 2)
  2831. separator_line = QtWidgets.QFrame()
  2832. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  2833. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  2834. grid0.addWidget(separator_line, 2, 0, 1, 2)
  2835. # Tool Type
  2836. self.tool_type_label = QtWidgets.QLabel('<b>%s</b>' % _('Tool Type'))
  2837. self.tool_type_label.setToolTip(
  2838. _("Choose what tool to use for Gerber isolation:\n"
  2839. "'Circular' or 'V-shape'.\n"
  2840. "When the 'V-shape' is selected then the tool\n"
  2841. "diameter will depend on the chosen cut depth.")
  2842. )
  2843. self.tool_type_radio = RadioSet([{'label': 'Circular', 'value': 'circular'},
  2844. {'label': 'V-Shape', 'value': 'v'}])
  2845. grid0.addWidget(self.tool_type_label, 3, 0)
  2846. grid0.addWidget(self.tool_type_radio, 3, 1, 1, 2)
  2847. # Tip Dia
  2848. self.tipdialabel = QtWidgets.QLabel('%s:' % _('V-Tip Dia'))
  2849. self.tipdialabel.setToolTip(
  2850. _("The tip diameter for V-Shape Tool")
  2851. )
  2852. self.tipdia_spinner = FCDoubleSpinner()
  2853. self.tipdia_spinner.set_precision(self.decimals)
  2854. self.tipdia_spinner.set_range(-99.9999, 99.9999)
  2855. self.tipdia_spinner.setSingleStep(0.1)
  2856. self.tipdia_spinner.setWrapping(True)
  2857. grid0.addWidget(self.tipdialabel, 4, 0)
  2858. grid0.addWidget(self.tipdia_spinner, 4, 1, 1, 2)
  2859. # Tip Angle
  2860. self.tipanglelabel = QtWidgets.QLabel('%s:' % _('V-Tip Angle'))
  2861. self.tipanglelabel.setToolTip(
  2862. _("The tip angle for V-Shape Tool.\n"
  2863. "In degree.")
  2864. )
  2865. self.tipangle_spinner = FCSpinner()
  2866. self.tipangle_spinner.set_range(1, 180)
  2867. self.tipangle_spinner.set_step(5)
  2868. self.tipangle_spinner.setWrapping(True)
  2869. grid0.addWidget(self.tipanglelabel, 5, 0)
  2870. grid0.addWidget(self.tipangle_spinner, 5, 1, 1, 2)
  2871. # Cut Z
  2872. self.cutzlabel = QtWidgets.QLabel('%s:' % _('Cut Z'))
  2873. self.cutzlabel.setToolTip(
  2874. _("Cutting depth (negative)\n"
  2875. "below the copper surface.")
  2876. )
  2877. self.cutz_spinner = FCDoubleSpinner()
  2878. self.cutz_spinner.set_precision(self.decimals)
  2879. self.cutz_spinner.set_range(-99.9999, 0.0000)
  2880. self.cutz_spinner.setSingleStep(0.1)
  2881. self.cutz_spinner.setWrapping(True)
  2882. grid0.addWidget(self.cutzlabel, 6, 0)
  2883. grid0.addWidget(self.cutz_spinner, 6, 1, 1, 2)
  2884. # Isolation Type
  2885. self.iso_type_label = QtWidgets.QLabel('%s:' % _('Isolation Type'))
  2886. self.iso_type_label.setToolTip(
  2887. _("Choose how the isolation will be executed:\n"
  2888. "- 'Full' -> complete isolation of polygons\n"
  2889. "- 'Ext' -> will isolate only on the outside\n"
  2890. "- 'Int' -> will isolate only on the inside\n"
  2891. "'Exterior' isolation is almost always possible\n"
  2892. "(with the right tool) but 'Interior'\n"
  2893. "isolation can be done only when there is an opening\n"
  2894. "inside of the polygon (e.g polygon is a 'doughnut' shape).")
  2895. )
  2896. self.iso_type_radio = RadioSet([{'label': _('Full'), 'value': 'full'},
  2897. {'label': _('Exterior'), 'value': 'ext'},
  2898. {'label': _('Interior'), 'value': 'int'}])
  2899. grid0.addWidget(self.iso_type_label, 7, 0,)
  2900. grid0.addWidget(self.iso_type_radio, 7, 1, 1, 2)
  2901. separator_line = QtWidgets.QFrame()
  2902. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  2903. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  2904. grid0.addWidget(separator_line, 8, 0, 1, 2)
  2905. # Buffering Type
  2906. buffering_label = QtWidgets.QLabel('%s:' % _('Buffering'))
  2907. buffering_label.setToolTip(
  2908. _("Buffering type:\n"
  2909. "- None --> best performance, fast file loading but no so good display\n"
  2910. "- Full --> slow file loading but good visuals. This is the default.\n"
  2911. "<<WARNING>>: Don't change this unless you know what you are doing !!!")
  2912. )
  2913. self.buffering_radio = RadioSet([{'label': _('None'), 'value': 'no'},
  2914. {'label': _('Full'), 'value': 'full'}])
  2915. grid0.addWidget(buffering_label, 9, 0)
  2916. grid0.addWidget(self.buffering_radio, 9, 1)
  2917. # Simplification
  2918. self.simplify_cb = FCCheckBox(label=_('Simplify'))
  2919. self.simplify_cb.setToolTip(
  2920. _("When checked all the Gerber polygons will be\n"
  2921. "loaded with simplification having a set tolerance.\n"
  2922. "<<WARNING>>: Don't change this unless you know what you are doing !!!")
  2923. )
  2924. grid0.addWidget(self.simplify_cb, 10, 0, 1, 2)
  2925. # Simplification tolerance
  2926. self.simplification_tol_label = QtWidgets.QLabel(_('Tolerance'))
  2927. self.simplification_tol_label.setToolTip(_("Tolerance for polygon simplification."))
  2928. self.simplification_tol_spinner = FCDoubleSpinner()
  2929. self.simplification_tol_spinner.set_precision(self.decimals + 1)
  2930. self.simplification_tol_spinner.setWrapping(True)
  2931. self.simplification_tol_spinner.setRange(0.00000, 0.01000)
  2932. self.simplification_tol_spinner.setSingleStep(0.0001)
  2933. grid0.addWidget(self.simplification_tol_label, 11, 0)
  2934. grid0.addWidget(self.simplification_tol_spinner, 11, 1)
  2935. self.ois_simplif = OptionalInputSection(
  2936. self.simplify_cb,
  2937. [
  2938. self.simplification_tol_label, self.simplification_tol_spinner
  2939. ],
  2940. logic=True)
  2941. self.layout.addStretch()
  2942. class GerberExpPrefGroupUI(OptionsGroupUI):
  2943. def __init__(self, decimals=4, parent=None):
  2944. super(GerberExpPrefGroupUI, self).__init__(self)
  2945. self.setTitle(str(_("Gerber Export")))
  2946. self.decimals = decimals
  2947. # Plot options
  2948. self.export_options_label = QtWidgets.QLabel("<b>%s:</b>" % _("Export Options"))
  2949. self.export_options_label.setToolTip(
  2950. _("The parameters set here are used in the file exported\n"
  2951. "when using the File -> Export -> Export Gerber menu entry.")
  2952. )
  2953. self.layout.addWidget(self.export_options_label)
  2954. form = QtWidgets.QFormLayout()
  2955. self.layout.addLayout(form)
  2956. # Gerber Units
  2957. self.gerber_units_label = QtWidgets.QLabel('%s:' % _('Units'))
  2958. self.gerber_units_label.setToolTip(
  2959. _("The units used in the Gerber file.")
  2960. )
  2961. self.gerber_units_radio = RadioSet([{'label': _('INCH'), 'value': 'IN'},
  2962. {'label': _('MM'), 'value': 'MM'}])
  2963. self.gerber_units_radio.setToolTip(
  2964. _("The units used in the Gerber file.")
  2965. )
  2966. form.addRow(self.gerber_units_label, self.gerber_units_radio)
  2967. # Gerber format
  2968. self.digits_label = QtWidgets.QLabel("%s:" % _("Int/Decimals"))
  2969. self.digits_label.setToolTip(
  2970. _("The number of digits in the whole part of the number\n"
  2971. "and in the fractional part of the number.")
  2972. )
  2973. hlay1 = QtWidgets.QHBoxLayout()
  2974. self.format_whole_entry = FCSpinner()
  2975. self.format_whole_entry.set_range(0, 9)
  2976. self.format_whole_entry.set_step(1)
  2977. self.format_whole_entry.setWrapping(True)
  2978. self.format_whole_entry.setMinimumWidth(30)
  2979. self.format_whole_entry.setToolTip(
  2980. _("This numbers signify the number of digits in\n"
  2981. "the whole part of Gerber coordinates.")
  2982. )
  2983. hlay1.addWidget(self.format_whole_entry, QtCore.Qt.AlignLeft)
  2984. gerber_separator_label = QtWidgets.QLabel(':')
  2985. gerber_separator_label.setFixedWidth(5)
  2986. hlay1.addWidget(gerber_separator_label, QtCore.Qt.AlignLeft)
  2987. self.format_dec_entry = FCSpinner()
  2988. self.format_dec_entry.set_range(0, 9)
  2989. self.format_dec_entry.set_step(1)
  2990. self.format_dec_entry.setWrapping(True)
  2991. self.format_dec_entry.setMinimumWidth(30)
  2992. self.format_dec_entry.setToolTip(
  2993. _("This numbers signify the number of digits in\n"
  2994. "the decimal part of Gerber coordinates.")
  2995. )
  2996. hlay1.addWidget(self.format_dec_entry, QtCore.Qt.AlignLeft)
  2997. hlay1.addStretch()
  2998. form.addRow(self.digits_label, hlay1)
  2999. # Gerber Zeros
  3000. self.zeros_label = QtWidgets.QLabel('%s:' % _('Zeros'))
  3001. self.zeros_label.setAlignment(QtCore.Qt.AlignLeft)
  3002. self.zeros_label.setToolTip(
  3003. _("This sets the type of Gerber zeros.\n"
  3004. "If LZ then Leading Zeros are removed and\n"
  3005. "Trailing Zeros are kept.\n"
  3006. "If TZ is checked then Trailing Zeros are removed\n"
  3007. "and Leading Zeros are kept.")
  3008. )
  3009. self.zeros_radio = RadioSet([{'label': _('LZ'), 'value': 'L'},
  3010. {'label': _('TZ'), 'value': 'T'}])
  3011. self.zeros_radio.setToolTip(
  3012. _("This sets the type of Gerber zeros.\n"
  3013. "If LZ then Leading Zeros are removed and\n"
  3014. "Trailing Zeros are kept.\n"
  3015. "If TZ is checked then Trailing Zeros are removed\n"
  3016. "and Leading Zeros are kept.")
  3017. )
  3018. form.addRow(self.zeros_label, self.zeros_radio)
  3019. self.layout.addStretch()
  3020. class GerberEditorPrefGroupUI(OptionsGroupUI):
  3021. def __init__(self, decimals=4, parent=None):
  3022. # OptionsGroupUI.__init__(self, "Gerber Adv. Options Preferences", parent=parent)
  3023. super(GerberEditorPrefGroupUI, self).__init__(self)
  3024. self.setTitle(str(_("Gerber Editor")))
  3025. self.decimals = decimals
  3026. # Advanced Gerber Parameters
  3027. self.param_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  3028. self.param_label.setToolTip(
  3029. _("A list of Gerber Editor parameters.")
  3030. )
  3031. self.layout.addWidget(self.param_label)
  3032. grid0 = QtWidgets.QGridLayout()
  3033. self.layout.addLayout(grid0)
  3034. # Selection Limit
  3035. self.sel_limit_label = QtWidgets.QLabel('%s:' % _("Selection limit"))
  3036. self.sel_limit_label.setToolTip(
  3037. _("Set the number of selected Gerber geometry\n"
  3038. "items above which the utility geometry\n"
  3039. "becomes just a selection rectangle.\n"
  3040. "Increases the performance when moving a\n"
  3041. "large number of geometric elements.")
  3042. )
  3043. self.sel_limit_entry = FCSpinner()
  3044. self.sel_limit_entry.set_range(0, 9999)
  3045. grid0.addWidget(self.sel_limit_label, 0, 0)
  3046. grid0.addWidget(self.sel_limit_entry, 0, 1)
  3047. # New aperture code
  3048. self.addcode_entry_lbl = QtWidgets.QLabel('%s:' % _('New Aperture code'))
  3049. self.addcode_entry_lbl.setToolTip(
  3050. _("Code for the new aperture")
  3051. )
  3052. self.addcode_entry = FCSpinner()
  3053. self.addcode_entry.set_range(10, 99)
  3054. self.addcode_entry.setWrapping(True)
  3055. grid0.addWidget(self.addcode_entry_lbl, 1, 0)
  3056. grid0.addWidget(self.addcode_entry, 1, 1)
  3057. # New aperture size
  3058. self.addsize_entry_lbl = QtWidgets.QLabel('%s:' % _('New Aperture size'))
  3059. self.addsize_entry_lbl.setToolTip(
  3060. _("Size for the new aperture")
  3061. )
  3062. self.addsize_entry = FCDoubleSpinner()
  3063. self.addsize_entry.set_range(0, 100)
  3064. self.addsize_entry.set_precision(self.decimals)
  3065. grid0.addWidget(self.addsize_entry_lbl, 2, 0)
  3066. grid0.addWidget(self.addsize_entry, 2, 1)
  3067. # New aperture type
  3068. self.addtype_combo_lbl = QtWidgets.QLabel('%s:' % _('New Aperture type'))
  3069. self.addtype_combo_lbl.setToolTip(
  3070. _("Type for the new aperture.\n"
  3071. "Can be 'C', 'R' or 'O'.")
  3072. )
  3073. self.addtype_combo = FCComboBox()
  3074. self.addtype_combo.addItems(['C', 'R', 'O'])
  3075. grid0.addWidget(self.addtype_combo_lbl, 3, 0)
  3076. grid0.addWidget(self.addtype_combo, 3, 1)
  3077. # Number of pads in a pad array
  3078. self.grb_array_size_label = QtWidgets.QLabel('%s:' % _('Nr of pads'))
  3079. self.grb_array_size_label.setToolTip(
  3080. _("Specify how many pads to be in the array.")
  3081. )
  3082. self.grb_array_size_entry = FCSpinner()
  3083. self.grb_array_size_entry.set_range(0, 9999)
  3084. grid0.addWidget(self.grb_array_size_label, 4, 0)
  3085. grid0.addWidget(self.grb_array_size_entry, 4, 1)
  3086. self.adddim_label = QtWidgets.QLabel('%s:' % _('Aperture Dimensions'))
  3087. self.adddim_label.setToolTip(
  3088. _("Diameters of the tools, separated by comma.\n"
  3089. "The value of the diameter has to use the dot decimals separator.\n"
  3090. "Valid values: 0.3, 1.0")
  3091. )
  3092. grid0.addWidget(self.adddim_label, 5, 0)
  3093. self.adddim_entry = FCEntry()
  3094. grid0.addWidget(self.adddim_entry, 5, 1)
  3095. self.grb_array_linear_label = QtWidgets.QLabel('<b>%s:</b>' % _('Linear Pad Array'))
  3096. grid0.addWidget(self.grb_array_linear_label, 6, 0, 1, 2)
  3097. # Linear Pad Array direction
  3098. self.grb_axis_label = QtWidgets.QLabel('%s:' % _('Linear Direction'))
  3099. self.grb_axis_label.setToolTip(
  3100. _("Direction on which the linear array is oriented:\n"
  3101. "- 'X' - horizontal axis \n"
  3102. "- 'Y' - vertical axis or \n"
  3103. "- 'Angle' - a custom angle for the array inclination")
  3104. )
  3105. self.grb_axis_radio = RadioSet([{'label': _('X'), 'value': 'X'},
  3106. {'label': _('Y'), 'value': 'Y'},
  3107. {'label': _('Angle'), 'value': 'A'}])
  3108. grid0.addWidget(self.grb_axis_label, 7, 0)
  3109. grid0.addWidget(self.grb_axis_radio, 7, 1)
  3110. # Linear Pad Array pitch distance
  3111. self.grb_pitch_label = QtWidgets.QLabel('%s:' % _('Pitch'))
  3112. self.grb_pitch_label.setToolTip(
  3113. _("Pitch = Distance between elements of the array.")
  3114. )
  3115. # self.drill_pitch_label.setMinimumWidth(100)
  3116. self.grb_pitch_entry = FCDoubleSpinner()
  3117. self.grb_pitch_entry.set_precision(self.decimals)
  3118. grid0.addWidget(self.grb_pitch_label, 8, 0)
  3119. grid0.addWidget(self.grb_pitch_entry, 8, 1)
  3120. # Linear Pad Array custom angle
  3121. self.grb_angle_label = QtWidgets.QLabel('%s:' % _('Angle'))
  3122. self.grb_angle_label.setToolTip(
  3123. _("Angle at which each element in circular array is placed.")
  3124. )
  3125. self.grb_angle_entry = FCDoubleSpinner()
  3126. self.grb_angle_entry.set_precision(self.decimals)
  3127. self.grb_angle_entry.set_range(-360, 360)
  3128. self.grb_angle_entry.setSingleStep(5)
  3129. grid0.addWidget(self.grb_angle_label, 9, 0)
  3130. grid0.addWidget(self.grb_angle_entry, 9, 1)
  3131. self.grb_array_circ_label = QtWidgets.QLabel('<b>%s:</b>' % _('Circular Pad Array'))
  3132. grid0.addWidget(self.grb_array_circ_label, 10, 0, 1, 2)
  3133. # Circular Pad Array direction
  3134. self.grb_circular_direction_label = QtWidgets.QLabel('%s:' % _('Circular Direction'))
  3135. self.grb_circular_direction_label.setToolTip(
  3136. _("Direction for circular array.\n"
  3137. "Can be CW = clockwise or CCW = counter clockwise.")
  3138. )
  3139. self.grb_circular_dir_radio = RadioSet([{'label': _('CW'), 'value': 'CW'},
  3140. {'label': _('CCW'), 'value': 'CCW'}])
  3141. grid0.addWidget(self.grb_circular_direction_label, 11, 0)
  3142. grid0.addWidget(self.grb_circular_dir_radio, 11, 1)
  3143. # Circular Pad Array Angle
  3144. self.grb_circular_angle_label = QtWidgets.QLabel('%s:' % _('Circular Angle'))
  3145. self.grb_circular_angle_label.setToolTip(
  3146. _("Angle at which each element in circular array is placed.")
  3147. )
  3148. self.grb_circular_angle_entry = FCDoubleSpinner()
  3149. self.grb_circular_angle_entry.set_precision(self.decimals)
  3150. self.grb_circular_angle_entry.set_range(-360, 360)
  3151. self.grb_circular_angle_entry.setSingleStep(5)
  3152. grid0.addWidget(self.grb_circular_angle_label, 12, 0)
  3153. grid0.addWidget(self.grb_circular_angle_entry, 12, 1)
  3154. self.grb_array_tools_b_label = QtWidgets.QLabel('<b>%s:</b>' % _('Buffer Tool'))
  3155. grid0.addWidget(self.grb_array_tools_b_label, 13, 0, 1, 2)
  3156. # Buffer Distance
  3157. self.grb_buff_label = QtWidgets.QLabel('%s:' % _('Buffer distance'))
  3158. self.grb_buff_label.setToolTip(
  3159. _("Distance at which to buffer the Gerber element.")
  3160. )
  3161. self.grb_buff_entry = FCDoubleSpinner()
  3162. self.grb_buff_entry.set_precision(self.decimals)
  3163. self.grb_buff_entry.set_range(-9999, 9999)
  3164. grid0.addWidget(self.grb_buff_label, 14, 0)
  3165. grid0.addWidget(self.grb_buff_entry, 14, 1)
  3166. self.grb_array_tools_s_label = QtWidgets.QLabel('<b>%s:</b>' % _('Scale Tool'))
  3167. grid0.addWidget(self.grb_array_tools_s_label, 15, 0, 1, 2)
  3168. # Scale Factor
  3169. self.grb_scale_label = QtWidgets.QLabel('%s:' % _('Scale factor'))
  3170. self.grb_scale_label.setToolTip(
  3171. _("Factor to scale the Gerber element.")
  3172. )
  3173. self.grb_scale_entry = FCDoubleSpinner()
  3174. self.grb_scale_entry.set_precision(self.decimals)
  3175. self.grb_scale_entry.set_range(0, 9999)
  3176. grid0.addWidget(self.grb_scale_label, 16, 0)
  3177. grid0.addWidget(self.grb_scale_entry, 16, 1)
  3178. self.grb_array_tools_ma_label = QtWidgets.QLabel('<b>%s:</b>' % _('Mark Area Tool'))
  3179. grid0.addWidget(self.grb_array_tools_ma_label, 17, 0, 1, 2)
  3180. # Mark area Tool low threshold
  3181. self.grb_ma_low_label = QtWidgets.QLabel('%s:' % _('Threshold low'))
  3182. self.grb_ma_low_label.setToolTip(
  3183. _("Threshold value under which the apertures are not marked.")
  3184. )
  3185. self.grb_ma_low_entry = FCDoubleSpinner()
  3186. self.grb_ma_low_entry.set_precision(self.decimals)
  3187. self.grb_ma_low_entry.set_range(0, 9999)
  3188. grid0.addWidget(self.grb_ma_low_label, 18, 0)
  3189. grid0.addWidget(self.grb_ma_low_entry, 18, 1)
  3190. # Mark area Tool high threshold
  3191. self.grb_ma_high_label = QtWidgets.QLabel('%s:' % _('Threshold high'))
  3192. self.grb_ma_high_label.setToolTip(
  3193. _("Threshold value over which the apertures are not marked.")
  3194. )
  3195. self.grb_ma_high_entry = FCDoubleSpinner()
  3196. self.grb_ma_high_entry.set_precision(self.decimals)
  3197. self.grb_ma_high_entry.set_range(0, 9999)
  3198. grid0.addWidget(self.grb_ma_high_label, 19, 0)
  3199. grid0.addWidget(self.grb_ma_high_entry, 19, 1)
  3200. self.layout.addStretch()
  3201. class ExcellonGenPrefGroupUI(OptionsGroupUI):
  3202. def __init__(self, decimals=4, parent=None):
  3203. # OptionsGroupUI.__init__(self, "Excellon Options", parent=parent)
  3204. super(ExcellonGenPrefGroupUI, self).__init__(self)
  3205. self.setTitle(str(_("Excellon General")))
  3206. self.decimals = decimals
  3207. # Plot options
  3208. self.plot_options_label = QtWidgets.QLabel("<b>%s:</b>" % _("Plot Options"))
  3209. self.layout.addWidget(self.plot_options_label)
  3210. grid1 = QtWidgets.QGridLayout()
  3211. self.layout.addLayout(grid1)
  3212. self.plot_cb = FCCheckBox(label=_('Plot'))
  3213. self.plot_cb.setToolTip(
  3214. "Plot (show) this object."
  3215. )
  3216. grid1.addWidget(self.plot_cb, 0, 0)
  3217. self.solid_cb = FCCheckBox(label=_('Solid'))
  3218. self.solid_cb.setToolTip(
  3219. "Plot as solid circles."
  3220. )
  3221. grid1.addWidget(self.solid_cb, 0, 1)
  3222. separator_line = QtWidgets.QFrame()
  3223. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  3224. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  3225. grid1.addWidget(separator_line, 1, 0, 1, 2)
  3226. grid2 = QtWidgets.QGridLayout()
  3227. self.layout.addLayout(grid2)
  3228. grid2.setColumnStretch(0, 0)
  3229. grid2.setColumnStretch(1, 1)
  3230. # Excellon format
  3231. self.excellon_format_label = QtWidgets.QLabel("<b>%s:</b>" % _("Excellon Format"))
  3232. self.excellon_format_label.setToolTip(
  3233. _("The NC drill files, usually named Excellon files\n"
  3234. "are files that can be found in different formats.\n"
  3235. "Here we set the format used when the provided\n"
  3236. "coordinates are not using period.\n"
  3237. "\n"
  3238. "Possible presets:\n"
  3239. "\n"
  3240. "PROTEUS 3:3 MM LZ\n"
  3241. "DipTrace 5:2 MM TZ\n"
  3242. "DipTrace 4:3 MM LZ\n"
  3243. "\n"
  3244. "EAGLE 3:3 MM TZ\n"
  3245. "EAGLE 4:3 MM TZ\n"
  3246. "EAGLE 2:5 INCH TZ\n"
  3247. "EAGLE 3:5 INCH TZ\n"
  3248. "\n"
  3249. "ALTIUM 2:4 INCH LZ\n"
  3250. "Sprint Layout 2:4 INCH LZ"
  3251. "\n"
  3252. "KiCAD 3:5 INCH TZ")
  3253. )
  3254. grid2.addWidget(self.excellon_format_label, 0, 0, 1, 2)
  3255. self.excellon_format_in_label = QtWidgets.QLabel('%s:' % _("INCH"))
  3256. self.excellon_format_in_label.setToolTip(_("Default values for INCH are 2:4"))
  3257. hlay1 = QtWidgets.QHBoxLayout()
  3258. self.excellon_format_upper_in_entry = FCSpinner()
  3259. self.excellon_format_upper_in_entry.set_range(0, 9)
  3260. self.excellon_format_upper_in_entry.setMinimumWidth(30)
  3261. self.excellon_format_upper_in_entry.setToolTip(
  3262. _("This numbers signify the number of digits in\n"
  3263. "the whole part of Excellon coordinates.")
  3264. )
  3265. hlay1.addWidget(self.excellon_format_upper_in_entry)
  3266. excellon_separator_in_label = QtWidgets.QLabel(':')
  3267. excellon_separator_in_label.setFixedWidth(5)
  3268. hlay1.addWidget(excellon_separator_in_label)
  3269. self.excellon_format_lower_in_entry = FCSpinner()
  3270. self.excellon_format_lower_in_entry.set_range(0, 9)
  3271. self.excellon_format_lower_in_entry.setMinimumWidth(30)
  3272. self.excellon_format_lower_in_entry.setToolTip(
  3273. _("This numbers signify the number of digits in\n"
  3274. "the decimal part of Excellon coordinates.")
  3275. )
  3276. hlay1.addWidget(self.excellon_format_lower_in_entry)
  3277. grid2.addWidget(self.excellon_format_in_label, 1, 0)
  3278. grid2.addLayout(hlay1, 1, 1)
  3279. self.excellon_format_mm_label = QtWidgets.QLabel('%s:' % _("METRIC"))
  3280. self.excellon_format_mm_label.setToolTip(_("Default values for METRIC are 3:3"))
  3281. hlay2 = QtWidgets.QHBoxLayout()
  3282. self.excellon_format_upper_mm_entry = FCSpinner()
  3283. self.excellon_format_upper_mm_entry.set_range(0, 9)
  3284. self.excellon_format_upper_mm_entry.setMinimumWidth(30)
  3285. self.excellon_format_upper_mm_entry.setToolTip(
  3286. _("This numbers signify the number of digits in\n"
  3287. "the whole part of Excellon coordinates.")
  3288. )
  3289. hlay2.addWidget(self.excellon_format_upper_mm_entry)
  3290. excellon_separator_mm_label = QtWidgets.QLabel(':')
  3291. excellon_separator_mm_label.setFixedWidth(5)
  3292. hlay2.addWidget(excellon_separator_mm_label, QtCore.Qt.AlignLeft)
  3293. self.excellon_format_lower_mm_entry = FCSpinner()
  3294. self.excellon_format_lower_mm_entry.set_range(0, 9)
  3295. self.excellon_format_lower_mm_entry.setMinimumWidth(30)
  3296. self.excellon_format_lower_mm_entry.setToolTip(
  3297. _("This numbers signify the number of digits in\n"
  3298. "the decimal part of Excellon coordinates.")
  3299. )
  3300. hlay2.addWidget(self.excellon_format_lower_mm_entry)
  3301. grid2.addWidget(self.excellon_format_mm_label, 2, 0)
  3302. grid2.addLayout(hlay2, 2, 1)
  3303. self.excellon_zeros_label = QtWidgets.QLabel('%s:' % _('Zeros'))
  3304. self.excellon_zeros_label.setAlignment(QtCore.Qt.AlignLeft)
  3305. self.excellon_zeros_label.setToolTip(
  3306. _("This sets the type of Excellon zeros.\n"
  3307. "If LZ then Leading Zeros are kept and\n"
  3308. "Trailing Zeros are removed.\n"
  3309. "If TZ is checked then Trailing Zeros are kept\n"
  3310. "and Leading Zeros are removed.\n\n"
  3311. "This is used when there is no information\n"
  3312. "stored in the Excellon file.")
  3313. )
  3314. grid2.addWidget(self.excellon_zeros_label, 3, 0)
  3315. self.excellon_zeros_radio = RadioSet([{'label': _('LZ'), 'value': 'L'},
  3316. {'label': _('TZ'), 'value': 'T'}])
  3317. grid2.addWidget(self.excellon_zeros_radio, 3, 1)
  3318. self.excellon_units_label = QtWidgets.QLabel('%s:' % _('Units'))
  3319. self.excellon_units_label.setAlignment(QtCore.Qt.AlignLeft)
  3320. self.excellon_units_label.setToolTip(
  3321. _("This sets the default units of Excellon files.\n"
  3322. "If it is not detected in the parsed file the value here\n"
  3323. "will be used."
  3324. "Some Excellon files don't have an header\n"
  3325. "therefore this parameter will be used.")
  3326. )
  3327. self.excellon_units_radio = RadioSet([{'label': _('INCH'), 'value': 'INCH'},
  3328. {'label': _('MM'), 'value': 'METRIC'}])
  3329. self.excellon_units_radio.setToolTip(
  3330. _("This sets the units of Excellon files.\n"
  3331. "Some Excellon files don't have an header\n"
  3332. "therefore this parameter will be used.")
  3333. )
  3334. grid2.addWidget(self.excellon_units_label, 4, 0)
  3335. grid2.addWidget(self.excellon_units_radio, 4, 1)
  3336. self.update_excellon_cb = FCCheckBox(label=_('Update Export settings'))
  3337. self.update_excellon_cb.setToolTip(
  3338. "If checked, the Excellon Export settings will be updated with the ones above."
  3339. )
  3340. grid2.addWidget(self.update_excellon_cb, 5, 0, 1, 2)
  3341. # Adding the Excellon Format Defaults Button
  3342. self.excellon_defaults_button = QtWidgets.QPushButton()
  3343. self.excellon_defaults_button.setText(str(_("Restore Defaults")))
  3344. self.excellon_defaults_button.setMinimumWidth(80)
  3345. grid2.addWidget(self.excellon_defaults_button, 6, 0, 1, 2)
  3346. separator_line = QtWidgets.QFrame()
  3347. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  3348. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  3349. grid2.addWidget(separator_line, 7, 0, 1, 2)
  3350. self.excellon_general_label = QtWidgets.QLabel("<b>%s:</b>" % _("Excellon Optimization"))
  3351. grid2.addWidget(self.excellon_general_label, 8, 0, 1, 2)
  3352. self.excellon_optimization_label = QtWidgets.QLabel(_('Algorithm:'))
  3353. self.excellon_optimization_label.setToolTip(
  3354. _("This sets the optimization type for the Excellon drill path.\n"
  3355. "If <<MetaHeuristic>> is checked then Google OR-Tools algorithm with\n"
  3356. "MetaHeuristic Guided Local Path is used. Default search time is 3sec.\n"
  3357. "If <<Basic>> is checked then Google OR-Tools Basic algorithm is used.\n"
  3358. "If <<TSA>> is checked then Travelling Salesman algorithm is used for\n"
  3359. "drill path optimization.\n"
  3360. "\n"
  3361. "If this control is disabled, then FlatCAM works in 32bit mode and it uses\n"
  3362. "Travelling Salesman algorithm for path optimization.")
  3363. )
  3364. self.excellon_optimization_radio = RadioSet([{'label': _('MetaHeuristic'), 'value': 'M'},
  3365. {'label': _('Basic'), 'value': 'B'},
  3366. {'label': _('TSA'), 'value': 'T'}],
  3367. orientation='vertical', stretch=False)
  3368. self.excellon_optimization_radio.setToolTip(
  3369. _("This sets the optimization type for the Excellon drill path.\n"
  3370. "If <<MetaHeuristic>> is checked then Google OR-Tools algorithm with\n"
  3371. "MetaHeuristic Guided Local Path is used. Default search time is 3sec.\n"
  3372. "If <<Basic>> is checked then Google OR-Tools Basic algorithm is used.\n"
  3373. "If <<TSA>> is checked then Travelling Salesman algorithm is used for\n"
  3374. "drill path optimization.\n"
  3375. "\n"
  3376. "If this control is disabled, then FlatCAM works in 32bit mode and it uses\n"
  3377. "Travelling Salesman algorithm for path optimization.")
  3378. )
  3379. grid2.addWidget(self.excellon_optimization_label, 9, 0)
  3380. grid2.addWidget(self.excellon_optimization_radio, 9, 1)
  3381. self.optimization_time_label = QtWidgets.QLabel('%s:' % _('Duration'))
  3382. self.optimization_time_label.setAlignment(QtCore.Qt.AlignLeft)
  3383. self.optimization_time_label.setToolTip(
  3384. _("When OR-Tools Metaheuristic (MH) is enabled there is a\n"
  3385. "maximum threshold for how much time is spent doing the\n"
  3386. "path optimization. This max duration is set here.\n"
  3387. "In seconds.")
  3388. )
  3389. self.optimization_time_entry = FCSpinner()
  3390. self.optimization_time_entry.set_range(0, 999)
  3391. grid2.addWidget(self.optimization_time_label, 10, 0)
  3392. grid2.addWidget(self.optimization_time_entry, 10, 1)
  3393. separator_line = QtWidgets.QFrame()
  3394. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  3395. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  3396. grid2.addWidget(separator_line, 11, 0, 1, 2)
  3397. # Excellon Object Color
  3398. self.gerber_color_label = QtWidgets.QLabel('<b>%s</b>' % _('Excellon Object Color'))
  3399. grid2.addWidget(self.gerber_color_label, 12, 0, 1, 2)
  3400. # Plot Line Color
  3401. self.line_color_label = QtWidgets.QLabel('%s:' % _('Outline'))
  3402. self.line_color_label.setToolTip(
  3403. _("Set the line color for plotted objects.")
  3404. )
  3405. self.line_color_entry = FCEntry()
  3406. self.line_color_button = QtWidgets.QPushButton()
  3407. self.line_color_button.setFixedSize(15, 15)
  3408. self.form_box_child_2 = QtWidgets.QHBoxLayout()
  3409. self.form_box_child_2.addWidget(self.line_color_entry)
  3410. self.form_box_child_2.addWidget(self.line_color_button)
  3411. self.form_box_child_2.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  3412. grid2.addWidget(self.line_color_label, 13, 0)
  3413. grid2.addLayout(self.form_box_child_2, 13, 1)
  3414. # Plot Fill Color
  3415. self.fill_color_label = QtWidgets.QLabel('%s:' % _('Fill'))
  3416. self.fill_color_label.setToolTip(
  3417. _("Set the fill color for plotted objects.\n"
  3418. "First 6 digits are the color and the last 2\n"
  3419. "digits are for alpha (transparency) level.")
  3420. )
  3421. self.fill_color_entry = FCEntry()
  3422. self.fill_color_button = QtWidgets.QPushButton()
  3423. self.fill_color_button.setFixedSize(15, 15)
  3424. self.form_box_child_1 = QtWidgets.QHBoxLayout()
  3425. self.form_box_child_1.addWidget(self.fill_color_entry)
  3426. self.form_box_child_1.addWidget(self.fill_color_button)
  3427. self.form_box_child_1.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  3428. grid2.addWidget(self.fill_color_label, 14, 0)
  3429. grid2.addLayout(self.form_box_child_1, 14, 1)
  3430. # Plot Fill Transparency Level
  3431. self.alpha_label = QtWidgets.QLabel('%s:' % _('Alpha'))
  3432. self.alpha_label.setToolTip(
  3433. _("Set the fill transparency for plotted objects.")
  3434. )
  3435. self.color_alpha_slider = QtWidgets.QSlider(QtCore.Qt.Horizontal)
  3436. self.color_alpha_slider.setMinimum(0)
  3437. self.color_alpha_slider.setMaximum(255)
  3438. self.color_alpha_slider.setSingleStep(1)
  3439. self.color_alpha_spinner = FCSpinner()
  3440. self.color_alpha_spinner.setMinimumWidth(70)
  3441. self.color_alpha_spinner.set_range(0, 255)
  3442. self.form_box_child_3 = QtWidgets.QHBoxLayout()
  3443. self.form_box_child_3.addWidget(self.color_alpha_slider)
  3444. self.form_box_child_3.addWidget(self.color_alpha_spinner)
  3445. grid2.addWidget(self.alpha_label, 15, 0)
  3446. grid2.addLayout(self.form_box_child_3, 15, 1)
  3447. self.layout.addStretch()
  3448. current_platform = platform.architecture()[0]
  3449. if current_platform == '64bit':
  3450. self.excellon_optimization_label.setDisabled(False)
  3451. self.excellon_optimization_radio.setDisabled(False)
  3452. self.optimization_time_label.setDisabled(False)
  3453. self.optimization_time_entry.setDisabled(False)
  3454. self.excellon_optimization_radio.activated_custom.connect(self.optimization_selection)
  3455. else:
  3456. self.excellon_optimization_label.setDisabled(True)
  3457. self.excellon_optimization_radio.setDisabled(True)
  3458. self.optimization_time_label.setDisabled(True)
  3459. self.optimization_time_entry.setDisabled(True)
  3460. # Setting plot colors signals
  3461. self.line_color_entry.editingFinished.connect(self.on_line_color_entry)
  3462. self.line_color_button.clicked.connect(self.on_line_color_button)
  3463. self.fill_color_entry.editingFinished.connect(self.on_fill_color_entry)
  3464. self.fill_color_button.clicked.connect(self.on_fill_color_button)
  3465. self.color_alpha_spinner.valueChanged.connect(self.on_color_spinner)
  3466. self.color_alpha_slider.valueChanged.connect(self.on_color_slider)
  3467. # Load the defaults values into the Excellon Format and Excellon Zeros fields
  3468. self.excellon_defaults_button.clicked.connect(self.on_excellon_defaults_button)
  3469. def optimization_selection(self):
  3470. if self.excellon_optimization_radio.get_value() == 'M':
  3471. self.optimization_time_label.setDisabled(False)
  3472. self.optimization_time_entry.setDisabled(False)
  3473. else:
  3474. self.optimization_time_label.setDisabled(True)
  3475. self.optimization_time_entry.setDisabled(True)
  3476. # Setting plot colors handlers
  3477. def on_fill_color_entry(self):
  3478. self.app.defaults['excellon_plot_fill'] = self.fill_color_entry.get_value()[:7] + \
  3479. self.app.defaults['excellon_plot_fill'][7:9]
  3480. self.fill_color_button.setStyleSheet("background-color:%s" % str(self.app.defaults['excellon_plot_fill'])[:7])
  3481. def on_fill_color_button(self):
  3482. current_color = QtGui.QColor(self.app.defaults['excellon_plot_fill'][:7])
  3483. c_dialog = QtWidgets.QColorDialog()
  3484. plot_fill_color = c_dialog.getColor(initial=current_color)
  3485. if plot_fill_color.isValid() is False:
  3486. return
  3487. self.fill_color_button.setStyleSheet("background-color:%s" % str(plot_fill_color.name()))
  3488. new_val = str(plot_fill_color.name()) + str(self.app.defaults['excellon_plot_fill'][7:9])
  3489. self.fill_color_entry.set_value(new_val)
  3490. self.app.defaults['excellon_plot_fill'] = new_val
  3491. def on_color_spinner(self):
  3492. spinner_value = self.color_alpha_spinner.value()
  3493. self.color_alpha_slider.setValue(spinner_value)
  3494. self.app.defaults['excellon_plot_fill'] = \
  3495. self.app.defaults['excellon_plot_fill'][:7] + \
  3496. (hex(spinner_value)[2:] if int(hex(spinner_value)[2:], 16) > 0 else '00')
  3497. self.app.defaults['excellon_plot_line'] = \
  3498. self.app.defaults['excellon_plot_line'][:7] + \
  3499. (hex(spinner_value)[2:] if int(hex(spinner_value)[2:], 16) > 0 else '00')
  3500. def on_color_slider(self):
  3501. slider_value = self.color_alpha_slider.value()
  3502. self.color_alpha_spinner.setValue(slider_value)
  3503. def on_line_color_entry(self):
  3504. self.app.defaults['excellon_plot_line'] = self.line_color_entry.get_value()[:7] + \
  3505. self.app.defaults['excellon_plot_line'][7:9]
  3506. self.line_color_button.setStyleSheet("background-color:%s" % str(self.app.defaults['excellon_plot_line'])[:7])
  3507. def on_line_color_button(self):
  3508. current_color = QtGui.QColor(self.app.defaults['excellon_plot_line'][:7])
  3509. # print(current_color)
  3510. c_dialog = QtWidgets.QColorDialog()
  3511. plot_line_color = c_dialog.getColor(initial=current_color)
  3512. if plot_line_color.isValid() is False:
  3513. return
  3514. self.line_color_button.setStyleSheet("background-color:%s" % str(plot_line_color.name()))
  3515. new_val_line = str(plot_line_color.name()) + str(self.app.defaults['excellon_plot_line'][7:9])
  3516. self.line_color_entry.set_value(new_val_line)
  3517. self.app.defaults['excellon_plot_line'] = new_val_line
  3518. def on_excellon_defaults_button(self):
  3519. self.app.preferencesUiManager.defaults_form_fields["excellon_format_lower_in"].set_value('4')
  3520. self.app.preferencesUiManager.defaults_form_fields["excellon_format_upper_in"].set_value('2')
  3521. self.app.preferencesUiManager.defaults_form_fields["excellon_format_lower_mm"].set_value('3')
  3522. self.app.preferencesUiManager.defaults_form_fields["excellon_format_upper_mm"].set_value('3')
  3523. self.app.preferencesUiManager.defaults_form_fields["excellon_zeros"].set_value('L')
  3524. self.app.preferencesUiManager.defaults_form_fields["excellon_units"].set_value('INCH')
  3525. class ExcellonOptPrefGroupUI(OptionsGroupUI):
  3526. def __init__(self, decimals=4, parent=None):
  3527. # OptionsGroupUI.__init__(self, "Excellon Options", parent=parent)
  3528. super(ExcellonOptPrefGroupUI, self).__init__(self)
  3529. self.setTitle(str(_("Excellon Options")))
  3530. self.decimals = decimals
  3531. # ## Create CNC Job
  3532. self.cncjob_label = QtWidgets.QLabel('<b>%s</b>' % _('Create CNC Job'))
  3533. self.cncjob_label.setToolTip(
  3534. _("Parameters used to create a CNC Job object\n"
  3535. "for this drill object.")
  3536. )
  3537. self.layout.addWidget(self.cncjob_label)
  3538. grid2 = QtWidgets.QGridLayout()
  3539. self.layout.addLayout(grid2)
  3540. grid2.setColumnStretch(0, 0)
  3541. grid2.setColumnStretch(1, 1)
  3542. # Operation Type
  3543. self.operation_label = QtWidgets.QLabel('<b>%s:</b>' % _('Operation'))
  3544. self.operation_label.setToolTip(
  3545. _("Operation type:\n"
  3546. "- Drilling -> will drill the drills/slots associated with this tool\n"
  3547. "- Milling -> will mill the drills/slots")
  3548. )
  3549. self.operation_radio = RadioSet(
  3550. [
  3551. {'label': _('Drilling'), 'value': 'drill'},
  3552. {'label': _("Milling"), 'value': 'mill'}
  3553. ]
  3554. )
  3555. grid2.addWidget(self.operation_label, 0, 0)
  3556. grid2.addWidget(self.operation_radio, 0, 1)
  3557. self.mill_type_label = QtWidgets.QLabel('%s:' % _('Milling Type'))
  3558. self.mill_type_label.setToolTip(
  3559. _("Milling type:\n"
  3560. "- Drills -> will mill the drills associated with this tool\n"
  3561. "- Slots -> will mill the slots associated with this tool\n"
  3562. "- Both -> will mill both drills and mills or whatever is available")
  3563. )
  3564. self.milling_type_radio = RadioSet(
  3565. [
  3566. {'label': _('Drills'), 'value': 'drills'},
  3567. {'label': _("Slots"), 'value': 'slots'},
  3568. {'label': _("Both"), 'value': 'both'},
  3569. ]
  3570. )
  3571. grid2.addWidget(self.mill_type_label, 1, 0)
  3572. grid2.addWidget(self.milling_type_radio, 1, 1)
  3573. self.mill_dia_label = QtWidgets.QLabel('%s:' % _('Milling Diameter'))
  3574. self.mill_dia_label.setToolTip(
  3575. _("The diameter of the tool who will do the milling")
  3576. )
  3577. self.mill_dia_entry = FCDoubleSpinner()
  3578. self.mill_dia_entry.set_precision(self.decimals)
  3579. self.mill_dia_entry.set_range(0.0000, 9999.9999)
  3580. grid2.addWidget(self.mill_dia_label, 2, 0)
  3581. grid2.addWidget(self.mill_dia_entry, 2, 1)
  3582. # Cut Z
  3583. cutzlabel = QtWidgets.QLabel('%s:' % _('Cut Z'))
  3584. cutzlabel.setToolTip(
  3585. _("Drill depth (negative)\n"
  3586. "below the copper surface.")
  3587. )
  3588. self.cutz_entry = FCDoubleSpinner()
  3589. if machinist_setting == 0:
  3590. self.cutz_entry.set_range(-9999.9999, 0.0000)
  3591. else:
  3592. self.cutz_entry.set_range(-9999.9999, 9999.9999)
  3593. self.cutz_entry.setSingleStep(0.1)
  3594. self.cutz_entry.set_precision(self.decimals)
  3595. grid2.addWidget(cutzlabel, 3, 0)
  3596. grid2.addWidget(self.cutz_entry, 3, 1)
  3597. # Multi-Depth
  3598. self.mpass_cb = FCCheckBox('%s:' % _("Multi-Depth"))
  3599. self.mpass_cb.setToolTip(
  3600. _(
  3601. "Use multiple passes to limit\n"
  3602. "the cut depth in each pass. Will\n"
  3603. "cut multiple times until Cut Z is\n"
  3604. "reached."
  3605. )
  3606. )
  3607. self.maxdepth_entry = FCDoubleSpinner()
  3608. self.maxdepth_entry.set_precision(self.decimals)
  3609. self.maxdepth_entry.set_range(0, 9999.9999)
  3610. self.maxdepth_entry.setSingleStep(0.1)
  3611. self.maxdepth_entry.setToolTip(_("Depth of each pass (positive)."))
  3612. grid2.addWidget(self.mpass_cb, 4, 0)
  3613. grid2.addWidget(self.maxdepth_entry, 4, 1)
  3614. # Travel Z
  3615. travelzlabel = QtWidgets.QLabel('%s:' % _('Travel Z'))
  3616. travelzlabel.setToolTip(
  3617. _("Tool height when travelling\n"
  3618. "across the XY plane.")
  3619. )
  3620. self.travelz_entry = FCDoubleSpinner()
  3621. self.travelz_entry.set_precision(self.decimals)
  3622. if machinist_setting == 0:
  3623. self.travelz_entry.set_range(0.0001, 9999.9999)
  3624. else:
  3625. self.travelz_entry.set_range(-9999.9999, 9999.9999)
  3626. grid2.addWidget(travelzlabel, 5, 0)
  3627. grid2.addWidget(self.travelz_entry, 5, 1)
  3628. # Tool change:
  3629. self.toolchange_cb = FCCheckBox('%s' % _("Tool change"))
  3630. self.toolchange_cb.setToolTip(
  3631. _("Include tool-change sequence\n"
  3632. "in G-Code (Pause for tool change).")
  3633. )
  3634. grid2.addWidget(self.toolchange_cb, 6, 0, 1, 2)
  3635. # Tool Change Z
  3636. toolchangezlabel = QtWidgets.QLabel('%s:' % _('Toolchange Z'))
  3637. toolchangezlabel.setToolTip(
  3638. _("Z-axis position (height) for\n"
  3639. "tool change.")
  3640. )
  3641. self.toolchangez_entry = FCDoubleSpinner()
  3642. self.toolchangez_entry.set_precision(self.decimals)
  3643. if machinist_setting == 0:
  3644. self.toolchangez_entry.set_range(0.0001, 9999.9999)
  3645. else:
  3646. self.toolchangez_entry.set_range(-9999.9999, 9999.9999)
  3647. grid2.addWidget(toolchangezlabel, 7, 0)
  3648. grid2.addWidget(self.toolchangez_entry, 7, 1)
  3649. # End Move Z
  3650. endz_label = QtWidgets.QLabel('%s:' % _('End move Z'))
  3651. endz_label.setToolTip(
  3652. _("Height of the tool after\n"
  3653. "the last move at the end of the job.")
  3654. )
  3655. self.endz_entry = FCDoubleSpinner()
  3656. self.endz_entry.set_precision(self.decimals)
  3657. if machinist_setting == 0:
  3658. self.endz_entry.set_range(0.0000, 9999.9999)
  3659. else:
  3660. self.endz_entry.set_range(-9999.9999, 9999.9999)
  3661. grid2.addWidget(endz_label, 8, 0)
  3662. grid2.addWidget(self.endz_entry, 8, 1)
  3663. # End Move X,Y
  3664. endmove_xy_label = QtWidgets.QLabel('%s:' % _('End move X,Y'))
  3665. endmove_xy_label.setToolTip(
  3666. _("End move X,Y position. In format (x,y).\n"
  3667. "If no value is entered then there is no move\n"
  3668. "on X,Y plane at the end of the job.")
  3669. )
  3670. self.endxy_entry = FCEntry()
  3671. grid2.addWidget(endmove_xy_label, 9, 0)
  3672. grid2.addWidget(self.endxy_entry, 9, 1)
  3673. # Feedrate Z
  3674. frlabel = QtWidgets.QLabel('%s:' % _('Feedrate Z'))
  3675. frlabel.setToolTip(
  3676. _("Tool speed while drilling\n"
  3677. "(in units per minute).\n"
  3678. "So called 'Plunge' feedrate.\n"
  3679. "This is for linear move G01.")
  3680. )
  3681. self.feedrate_z_entry = FCDoubleSpinner()
  3682. self.feedrate_z_entry.set_precision(self.decimals)
  3683. self.feedrate_z_entry.set_range(0, 99999.9999)
  3684. grid2.addWidget(frlabel, 10, 0)
  3685. grid2.addWidget(self.feedrate_z_entry, 10, 1)
  3686. # Spindle speed
  3687. spdlabel = QtWidgets.QLabel('%s:' % _('Spindle Speed'))
  3688. spdlabel.setToolTip(
  3689. _("Speed of the spindle\n"
  3690. "in RPM (optional)")
  3691. )
  3692. self.spindlespeed_entry = FCSpinner()
  3693. self.spindlespeed_entry.set_range(0, 1000000)
  3694. self.spindlespeed_entry.set_step(100)
  3695. grid2.addWidget(spdlabel, 11, 0)
  3696. grid2.addWidget(self.spindlespeed_entry, 11, 1)
  3697. # Dwell
  3698. self.dwell_cb = FCCheckBox('%s' % _('Enable Dwell'))
  3699. self.dwell_cb .setToolTip(
  3700. _("Pause to allow the spindle to reach its\n"
  3701. "speed before cutting.")
  3702. )
  3703. grid2.addWidget(self.dwell_cb, 12, 0, 1, 2)
  3704. # Dwell Time
  3705. dwelltime = QtWidgets.QLabel('%s:' % _('Duration'))
  3706. dwelltime.setToolTip(_("Number of time units for spindle to dwell."))
  3707. self.dwelltime_entry = FCDoubleSpinner()
  3708. self.dwelltime_entry.set_precision(self.decimals)
  3709. self.dwelltime_entry.set_range(0, 99999.9999)
  3710. grid2.addWidget(dwelltime, 13, 0)
  3711. grid2.addWidget(self.dwelltime_entry, 13, 1)
  3712. self.ois_dwell_exc = OptionalInputSection(self.dwell_cb, [self.dwelltime_entry])
  3713. # preprocessor selection
  3714. pp_excellon_label = QtWidgets.QLabel('%s:' % _("Preprocessor"))
  3715. pp_excellon_label.setToolTip(
  3716. _("The preprocessor JSON file that dictates\n"
  3717. "Gcode output.")
  3718. )
  3719. self.pp_excellon_name_cb = FCComboBox()
  3720. self.pp_excellon_name_cb.setFocusPolicy(Qt.StrongFocus)
  3721. grid2.addWidget(pp_excellon_label, 14, 0)
  3722. grid2.addWidget(self.pp_excellon_name_cb, 14, 1)
  3723. # ### Choose what to use for Gcode creation: Drills, Slots or Both
  3724. excellon_gcode_type_label = QtWidgets.QLabel('<b>%s</b>' % _('Gcode'))
  3725. excellon_gcode_type_label.setToolTip(
  3726. _("Choose what to use for GCode generation:\n"
  3727. "'Drills', 'Slots' or 'Both'.\n"
  3728. "When choosing 'Slots' or 'Both', slots will be\n"
  3729. "converted to drills.")
  3730. )
  3731. self.excellon_gcode_type_radio = RadioSet([{'label': 'Drills', 'value': 'drills'},
  3732. {'label': 'Slots', 'value': 'slots'},
  3733. {'label': 'Both', 'value': 'both'}])
  3734. grid2.addWidget(excellon_gcode_type_label, 15, 0)
  3735. grid2.addWidget(self.excellon_gcode_type_radio, 15, 1)
  3736. # until I decide to implement this feature those remain disabled
  3737. excellon_gcode_type_label.hide()
  3738. self.excellon_gcode_type_radio.setVisible(False)
  3739. # ### Milling Holes ## ##
  3740. self.mill_hole_label = QtWidgets.QLabel('<b>%s</b>' % _('Mill Holes'))
  3741. self.mill_hole_label.setToolTip(
  3742. _("Create Geometry for milling holes.")
  3743. )
  3744. grid2.addWidget(self.mill_hole_label, 16, 0, 1, 2)
  3745. tdlabel = QtWidgets.QLabel('%s:' % _('Drill Tool dia'))
  3746. tdlabel.setToolTip(
  3747. _("Diameter of the cutting tool.")
  3748. )
  3749. self.tooldia_entry = FCDoubleSpinner()
  3750. self.tooldia_entry.set_precision(self.decimals)
  3751. self.tooldia_entry.set_range(0, 999.9999)
  3752. grid2.addWidget(tdlabel, 18, 0)
  3753. grid2.addWidget(self.tooldia_entry, 18, 1)
  3754. stdlabel = QtWidgets.QLabel('%s:' % _('Slot Tool dia'))
  3755. stdlabel.setToolTip(
  3756. _("Diameter of the cutting tool\n"
  3757. "when milling slots.")
  3758. )
  3759. self.slot_tooldia_entry = FCDoubleSpinner()
  3760. self.slot_tooldia_entry.set_precision(self.decimals)
  3761. self.slot_tooldia_entry.set_range(0, 999.9999)
  3762. grid2.addWidget(stdlabel, 21, 0)
  3763. grid2.addWidget(self.slot_tooldia_entry, 21, 1)
  3764. self.layout.addStretch()
  3765. class ExcellonAdvOptPrefGroupUI(OptionsGroupUI):
  3766. def __init__(self, decimals=4, parent=None):
  3767. # OptionsGroupUI.__init__(self, "Excellon Advanced Options", parent=parent)
  3768. super(ExcellonAdvOptPrefGroupUI, self).__init__(self)
  3769. self.setTitle(str(_("Excellon Adv. Options")))
  3770. self.decimals = decimals
  3771. # #######################
  3772. # ## ADVANCED OPTIONS ###
  3773. # #######################
  3774. self.exc_label = QtWidgets.QLabel('<b>%s:</b>' % _('Advanced Options'))
  3775. self.exc_label.setToolTip(
  3776. _("A list of Excellon advanced parameters.\n"
  3777. "Those parameters are available only for\n"
  3778. "Advanced App. Level.")
  3779. )
  3780. self.layout.addWidget(self.exc_label)
  3781. grid1 = QtWidgets.QGridLayout()
  3782. self.layout.addLayout(grid1)
  3783. # Offset Z
  3784. offsetlabel = QtWidgets.QLabel('%s:' % _('Offset Z'))
  3785. offsetlabel.setToolTip(
  3786. _("Some drill bits (the larger ones) need to drill deeper\n"
  3787. "to create the desired exit hole diameter due of the tip shape.\n"
  3788. "The value here can compensate the Cut Z parameter."))
  3789. self.offset_entry = FCDoubleSpinner()
  3790. self.offset_entry.set_precision(self.decimals)
  3791. self.offset_entry.set_range(-999.9999, 999.9999)
  3792. grid1.addWidget(offsetlabel, 0, 0)
  3793. grid1.addWidget(self.offset_entry, 0, 1)
  3794. # ToolChange X,Y
  3795. toolchange_xy_label = QtWidgets.QLabel('%s:' % _('Toolchange X,Y'))
  3796. toolchange_xy_label.setToolTip(
  3797. _("Toolchange X,Y position.")
  3798. )
  3799. self.toolchangexy_entry = FCEntry()
  3800. grid1.addWidget(toolchange_xy_label, 1, 0)
  3801. grid1.addWidget(self.toolchangexy_entry, 1, 1)
  3802. # Start Z
  3803. startzlabel = QtWidgets.QLabel('%s:' % _('Start Z'))
  3804. startzlabel.setToolTip(
  3805. _("Height of the tool just after start.\n"
  3806. "Delete the value if you don't need this feature.")
  3807. )
  3808. self.estartz_entry = FloatEntry()
  3809. grid1.addWidget(startzlabel, 2, 0)
  3810. grid1.addWidget(self.estartz_entry, 2, 1)
  3811. # Feedrate Rapids
  3812. fr_rapid_label = QtWidgets.QLabel('%s:' % _('Feedrate Rapids'))
  3813. fr_rapid_label.setToolTip(
  3814. _("Tool speed while drilling\n"
  3815. "(in units per minute).\n"
  3816. "This is for the rapid move G00.\n"
  3817. "It is useful only for Marlin,\n"
  3818. "ignore for any other cases.")
  3819. )
  3820. self.feedrate_rapid_entry = FCDoubleSpinner()
  3821. self.feedrate_rapid_entry.set_precision(self.decimals)
  3822. self.feedrate_rapid_entry.set_range(0, 99999.9999)
  3823. grid1.addWidget(fr_rapid_label, 3, 0)
  3824. grid1.addWidget(self.feedrate_rapid_entry, 3, 1)
  3825. # Probe depth
  3826. self.pdepth_label = QtWidgets.QLabel('%s:' % _("Probe Z depth"))
  3827. self.pdepth_label.setToolTip(
  3828. _("The maximum depth that the probe is allowed\n"
  3829. "to probe. Negative value, in current units.")
  3830. )
  3831. self.pdepth_entry = FCDoubleSpinner()
  3832. self.pdepth_entry.set_precision(self.decimals)
  3833. self.pdepth_entry.set_range(-99999.9999, 0.0000)
  3834. grid1.addWidget(self.pdepth_label, 4, 0)
  3835. grid1.addWidget(self.pdepth_entry, 4, 1)
  3836. # Probe feedrate
  3837. self.feedrate_probe_label = QtWidgets.QLabel('%s:' % _("Feedrate Probe"))
  3838. self.feedrate_probe_label.setToolTip(
  3839. _("The feedrate used while the probe is probing.")
  3840. )
  3841. self.feedrate_probe_entry = FCDoubleSpinner()
  3842. self.feedrate_probe_entry.set_precision(self.decimals)
  3843. self.feedrate_probe_entry.set_range(0, 99999.9999)
  3844. grid1.addWidget(self.feedrate_probe_label, 5, 0)
  3845. grid1.addWidget(self.feedrate_probe_entry, 5, 1)
  3846. # Spindle direction
  3847. spindle_dir_label = QtWidgets.QLabel('%s:' % _('Spindle direction'))
  3848. spindle_dir_label.setToolTip(
  3849. _("This sets the direction that the spindle is rotating.\n"
  3850. "It can be either:\n"
  3851. "- CW = clockwise or\n"
  3852. "- CCW = counter clockwise")
  3853. )
  3854. self.spindledir_radio = RadioSet([{'label': _('CW'), 'value': 'CW'},
  3855. {'label': _('CCW'), 'value': 'CCW'}])
  3856. grid1.addWidget(spindle_dir_label, 6, 0)
  3857. grid1.addWidget(self.spindledir_radio, 6, 1)
  3858. self.fplunge_cb = FCCheckBox('%s' % _('Fast Plunge'))
  3859. self.fplunge_cb.setToolTip(
  3860. _("By checking this, the vertical move from\n"
  3861. "Z_Toolchange to Z_move is done with G0,\n"
  3862. "meaning the fastest speed available.\n"
  3863. "WARNING: the move is done at Toolchange X,Y coords.")
  3864. )
  3865. grid1.addWidget(self.fplunge_cb, 7, 0, 1, 2)
  3866. self.fretract_cb = FCCheckBox('%s' % _('Fast Retract'))
  3867. self.fretract_cb.setToolTip(
  3868. _("Exit hole strategy.\n"
  3869. " - When uncheked, while exiting the drilled hole the drill bit\n"
  3870. "will travel slow, with set feedrate (G1), up to zero depth and then\n"
  3871. "travel as fast as possible (G0) to the Z Move (travel height).\n"
  3872. " - When checked the travel from Z cut (cut depth) to Z_move\n"
  3873. "(travel height) is done as fast as possible (G0) in one move.")
  3874. )
  3875. grid1.addWidget(self.fretract_cb, 8, 0, 1, 2)
  3876. self.layout.addStretch()
  3877. class ExcellonExpPrefGroupUI(OptionsGroupUI):
  3878. def __init__(self, decimals=4, parent=None):
  3879. super(ExcellonExpPrefGroupUI, self).__init__(self)
  3880. self.setTitle(str(_("Excellon Export")))
  3881. self.decimals = decimals
  3882. # Plot options
  3883. self.export_options_label = QtWidgets.QLabel("<b>%s:</b>" % _("Export Options"))
  3884. self.export_options_label.setToolTip(
  3885. _("The parameters set here are used in the file exported\n"
  3886. "when using the File -> Export -> Export Excellon menu entry.")
  3887. )
  3888. self.layout.addWidget(self.export_options_label)
  3889. form = QtWidgets.QFormLayout()
  3890. self.layout.addLayout(form)
  3891. # Excellon Units
  3892. self.excellon_units_label = QtWidgets.QLabel('%s:' % _('Units'))
  3893. self.excellon_units_label.setToolTip(
  3894. _("The units used in the Excellon file.")
  3895. )
  3896. self.excellon_units_radio = RadioSet([{'label': _('INCH'), 'value': 'INCH'},
  3897. {'label': _('MM'), 'value': 'METRIC'}])
  3898. self.excellon_units_radio.setToolTip(
  3899. _("The units used in the Excellon file.")
  3900. )
  3901. form.addRow(self.excellon_units_label, self.excellon_units_radio)
  3902. # Excellon non-decimal format
  3903. self.digits_label = QtWidgets.QLabel("%s:" % _("Int/Decimals"))
  3904. self.digits_label.setToolTip(
  3905. _("The NC drill files, usually named Excellon files\n"
  3906. "are files that can be found in different formats.\n"
  3907. "Here we set the format used when the provided\n"
  3908. "coordinates are not using period.")
  3909. )
  3910. hlay1 = QtWidgets.QHBoxLayout()
  3911. self.format_whole_entry = FCSpinner()
  3912. self.format_whole_entry.set_range(0, 9)
  3913. self.format_whole_entry.setMinimumWidth(30)
  3914. self.format_whole_entry.setToolTip(
  3915. _("This numbers signify the number of digits in\n"
  3916. "the whole part of Excellon coordinates.")
  3917. )
  3918. hlay1.addWidget(self.format_whole_entry, QtCore.Qt.AlignLeft)
  3919. excellon_separator_label = QtWidgets.QLabel(':')
  3920. excellon_separator_label.setFixedWidth(5)
  3921. hlay1.addWidget(excellon_separator_label, QtCore.Qt.AlignLeft)
  3922. self.format_dec_entry = FCSpinner()
  3923. self.format_dec_entry.set_range(0, 9)
  3924. self.format_dec_entry.setMinimumWidth(30)
  3925. self.format_dec_entry.setToolTip(
  3926. _("This numbers signify the number of digits in\n"
  3927. "the decimal part of Excellon coordinates.")
  3928. )
  3929. hlay1.addWidget(self.format_dec_entry, QtCore.Qt.AlignLeft)
  3930. hlay1.addStretch()
  3931. form.addRow(self.digits_label, hlay1)
  3932. # Select the Excellon Format
  3933. self.format_label = QtWidgets.QLabel("%s:" % _("Format"))
  3934. self.format_label.setToolTip(
  3935. _("Select the kind of coordinates format used.\n"
  3936. "Coordinates can be saved with decimal point or without.\n"
  3937. "When there is no decimal point, it is required to specify\n"
  3938. "the number of digits for integer part and the number of decimals.\n"
  3939. "Also it will have to be specified if LZ = leading zeros are kept\n"
  3940. "or TZ = trailing zeros are kept.")
  3941. )
  3942. self.format_radio = RadioSet([{'label': _('Decimal'), 'value': 'dec'},
  3943. {'label': _('No-Decimal'), 'value': 'ndec'}])
  3944. self.format_radio.setToolTip(
  3945. _("Select the kind of coordinates format used.\n"
  3946. "Coordinates can be saved with decimal point or without.\n"
  3947. "When there is no decimal point, it is required to specify\n"
  3948. "the number of digits for integer part and the number of decimals.\n"
  3949. "Also it will have to be specified if LZ = leading zeros are kept\n"
  3950. "or TZ = trailing zeros are kept.")
  3951. )
  3952. form.addRow(self.format_label, self.format_radio)
  3953. # Excellon Zeros
  3954. self.zeros_label = QtWidgets.QLabel('%s:' % _('Zeros'))
  3955. self.zeros_label.setAlignment(QtCore.Qt.AlignLeft)
  3956. self.zeros_label.setToolTip(
  3957. _("This sets the type of Excellon zeros.\n"
  3958. "If LZ then Leading Zeros are kept and\n"
  3959. "Trailing Zeros are removed.\n"
  3960. "If TZ is checked then Trailing Zeros are kept\n"
  3961. "and Leading Zeros are removed.")
  3962. )
  3963. self.zeros_radio = RadioSet([{'label': _('LZ'), 'value': 'LZ'},
  3964. {'label': _('TZ'), 'value': 'TZ'}])
  3965. self.zeros_radio.setToolTip(
  3966. _("This sets the default type of Excellon zeros.\n"
  3967. "If LZ then Leading Zeros are kept and\n"
  3968. "Trailing Zeros are removed.\n"
  3969. "If TZ is checked then Trailing Zeros are kept\n"
  3970. "and Leading Zeros are removed.")
  3971. )
  3972. form.addRow(self.zeros_label, self.zeros_radio)
  3973. # Slot type
  3974. self.slot_type_label = QtWidgets.QLabel('%s:' % _('Slot type'))
  3975. self.slot_type_label.setAlignment(QtCore.Qt.AlignLeft)
  3976. self.slot_type_label.setToolTip(
  3977. _("This sets how the slots will be exported.\n"
  3978. "If ROUTED then the slots will be routed\n"
  3979. "using M15/M16 commands.\n"
  3980. "If DRILLED(G85) the slots will be exported\n"
  3981. "using the Drilled slot command (G85).")
  3982. )
  3983. self.slot_type_radio = RadioSet([{'label': _('Routed'), 'value': 'routing'},
  3984. {'label': _('Drilled(G85)'), 'value': 'drilling'}])
  3985. self.slot_type_radio.setToolTip(
  3986. _("This sets how the slots will be exported.\n"
  3987. "If ROUTED then the slots will be routed\n"
  3988. "using M15/M16 commands.\n"
  3989. "If DRILLED(G85) the slots will be exported\n"
  3990. "using the Drilled slot command (G85).")
  3991. )
  3992. form.addRow(self.slot_type_label, self.slot_type_radio)
  3993. self.layout.addStretch()
  3994. self.format_radio.activated_custom.connect(self.optimization_selection)
  3995. def optimization_selection(self):
  3996. if self.format_radio.get_value() == 'dec':
  3997. self.zeros_label.setDisabled(True)
  3998. self.zeros_radio.setDisabled(True)
  3999. else:
  4000. self.zeros_label.setDisabled(False)
  4001. self.zeros_radio.setDisabled(False)
  4002. class ExcellonEditorPrefGroupUI(OptionsGroupUI):
  4003. def __init__(self, decimals=4, parent=None):
  4004. super(ExcellonEditorPrefGroupUI, self).__init__(self)
  4005. self.setTitle(str(_("Excellon Editor")))
  4006. self.decimals = decimals
  4007. # Excellon Editor Parameters
  4008. self.param_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  4009. self.param_label.setToolTip(
  4010. _("A list of Excellon Editor parameters.")
  4011. )
  4012. self.layout.addWidget(self.param_label)
  4013. grid0 = QtWidgets.QGridLayout()
  4014. self.layout.addLayout(grid0)
  4015. # Selection Limit
  4016. self.sel_limit_label = QtWidgets.QLabel('%s:' % _("Selection limit"))
  4017. self.sel_limit_label.setToolTip(
  4018. _("Set the number of selected Excellon geometry\n"
  4019. "items above which the utility geometry\n"
  4020. "becomes just a selection rectangle.\n"
  4021. "Increases the performance when moving a\n"
  4022. "large number of geometric elements.")
  4023. )
  4024. self.sel_limit_entry = FCSpinner()
  4025. self.sel_limit_entry.set_range(0, 99999)
  4026. grid0.addWidget(self.sel_limit_label, 0, 0)
  4027. grid0.addWidget(self.sel_limit_entry, 0, 1)
  4028. # New Diameter
  4029. self.addtool_entry_lbl = QtWidgets.QLabel('%s:' % _('New Dia'))
  4030. self.addtool_entry_lbl.setToolTip(
  4031. _("Diameter for the new tool")
  4032. )
  4033. self.addtool_entry = FCDoubleSpinner()
  4034. self.addtool_entry.set_range(0.000001, 99.9999)
  4035. self.addtool_entry.set_precision(self.decimals)
  4036. grid0.addWidget(self.addtool_entry_lbl, 1, 0)
  4037. grid0.addWidget(self.addtool_entry, 1, 1)
  4038. # Number of drill holes in a drill array
  4039. self.drill_array_size_label = QtWidgets.QLabel('%s:' % _('Nr of drills'))
  4040. self.drill_array_size_label.setToolTip(
  4041. _("Specify how many drills to be in the array.")
  4042. )
  4043. # self.drill_array_size_label.setMinimumWidth(100)
  4044. self.drill_array_size_entry = FCSpinner()
  4045. self.drill_array_size_entry.set_range(0, 9999)
  4046. grid0.addWidget(self.drill_array_size_label, 2, 0)
  4047. grid0.addWidget(self.drill_array_size_entry, 2, 1)
  4048. self.drill_array_linear_label = QtWidgets.QLabel('<b>%s:</b>' % _('Linear Drill Array'))
  4049. grid0.addWidget(self.drill_array_linear_label, 3, 0, 1, 2)
  4050. # Linear Drill Array direction
  4051. self.drill_axis_label = QtWidgets.QLabel('%s:' % _('Linear Direction'))
  4052. self.drill_axis_label.setToolTip(
  4053. _("Direction on which the linear array is oriented:\n"
  4054. "- 'X' - horizontal axis \n"
  4055. "- 'Y' - vertical axis or \n"
  4056. "- 'Angle' - a custom angle for the array inclination")
  4057. )
  4058. # self.drill_axis_label.setMinimumWidth(100)
  4059. self.drill_axis_radio = RadioSet([{'label': _('X'), 'value': 'X'},
  4060. {'label': _('Y'), 'value': 'Y'},
  4061. {'label': _('Angle'), 'value': 'A'}])
  4062. grid0.addWidget(self.drill_axis_label, 4, 0)
  4063. grid0.addWidget(self.drill_axis_radio, 4, 1)
  4064. # Linear Drill Array pitch distance
  4065. self.drill_pitch_label = QtWidgets.QLabel('%s:' % _('Pitch'))
  4066. self.drill_pitch_label.setToolTip(
  4067. _("Pitch = Distance between elements of the array.")
  4068. )
  4069. # self.drill_pitch_label.setMinimumWidth(100)
  4070. self.drill_pitch_entry = FCDoubleSpinner()
  4071. self.drill_pitch_entry.set_range(0, 99999.9999)
  4072. self.drill_pitch_entry.set_precision(self.decimals)
  4073. grid0.addWidget(self.drill_pitch_label, 5, 0)
  4074. grid0.addWidget(self.drill_pitch_entry, 5, 1)
  4075. # Linear Drill Array custom angle
  4076. self.drill_angle_label = QtWidgets.QLabel('%s:' % _('Angle'))
  4077. self.drill_angle_label.setToolTip(
  4078. _("Angle at which each element in circular array is placed.")
  4079. )
  4080. self.drill_angle_entry = FCDoubleSpinner()
  4081. self.drill_pitch_entry.set_range(-360, 360)
  4082. self.drill_pitch_entry.set_precision(self.decimals)
  4083. self.drill_angle_entry.setWrapping(True)
  4084. self.drill_angle_entry.setSingleStep(5)
  4085. grid0.addWidget(self.drill_angle_label, 6, 0)
  4086. grid0.addWidget(self.drill_angle_entry, 6, 1)
  4087. self.drill_array_circ_label = QtWidgets.QLabel('<b>%s:</b>' % _('Circular Drill Array'))
  4088. grid0.addWidget(self.drill_array_circ_label, 7, 0, 1, 2)
  4089. # Circular Drill Array direction
  4090. self.drill_circular_direction_label = QtWidgets.QLabel('%s:' % _('Circular Direction'))
  4091. self.drill_circular_direction_label.setToolTip(
  4092. _("Direction for circular array.\n"
  4093. "Can be CW = clockwise or CCW = counter clockwise.")
  4094. )
  4095. self.drill_circular_dir_radio = RadioSet([{'label': _('CW'), 'value': 'CW'},
  4096. {'label': _('CCW'), 'value': 'CCW'}])
  4097. grid0.addWidget(self.drill_circular_direction_label, 8, 0)
  4098. grid0.addWidget(self.drill_circular_dir_radio, 8, 1)
  4099. # Circular Drill Array Angle
  4100. self.drill_circular_angle_label = QtWidgets.QLabel('%s:' % _('Circular Angle'))
  4101. self.drill_circular_angle_label.setToolTip(
  4102. _("Angle at which each element in circular array is placed.")
  4103. )
  4104. self.drill_circular_angle_entry = FCDoubleSpinner()
  4105. self.drill_circular_angle_entry.set_range(-360, 360)
  4106. self.drill_circular_angle_entry.set_precision(self.decimals)
  4107. self.drill_circular_angle_entry.setWrapping(True)
  4108. self.drill_circular_angle_entry.setSingleStep(5)
  4109. grid0.addWidget(self.drill_circular_angle_label, 9, 0)
  4110. grid0.addWidget(self.drill_circular_angle_entry, 9, 1)
  4111. # ##### SLOTS #####
  4112. # #################
  4113. self.drill_array_circ_label = QtWidgets.QLabel('<b>%s:</b>' % _('Slots'))
  4114. grid0.addWidget(self.drill_array_circ_label, 10, 0, 1, 2)
  4115. # Slot length
  4116. self.slot_length_label = QtWidgets.QLabel('%s:' % _('Length'))
  4117. self.slot_length_label.setToolTip(
  4118. _("Length = The length of the slot.")
  4119. )
  4120. self.slot_length_label.setMinimumWidth(100)
  4121. self.slot_length_entry = FCDoubleSpinner()
  4122. self.slot_length_entry.set_range(0, 99999)
  4123. self.slot_length_entry.set_precision(self.decimals)
  4124. self.slot_length_entry.setWrapping(True)
  4125. self.slot_length_entry.setSingleStep(1)
  4126. grid0.addWidget(self.slot_length_label, 11, 0)
  4127. grid0.addWidget(self.slot_length_entry, 11, 1)
  4128. # Slot direction
  4129. self.slot_axis_label = QtWidgets.QLabel('%s:' % _('Direction'))
  4130. self.slot_axis_label.setToolTip(
  4131. _("Direction on which the slot is oriented:\n"
  4132. "- 'X' - horizontal axis \n"
  4133. "- 'Y' - vertical axis or \n"
  4134. "- 'Angle' - a custom angle for the slot inclination")
  4135. )
  4136. self.slot_axis_label.setMinimumWidth(100)
  4137. self.slot_axis_radio = RadioSet([{'label': _('X'), 'value': 'X'},
  4138. {'label': _('Y'), 'value': 'Y'},
  4139. {'label': _('Angle'), 'value': 'A'}])
  4140. grid0.addWidget(self.slot_axis_label, 12, 0)
  4141. grid0.addWidget(self.slot_axis_radio, 12, 1)
  4142. # Slot custom angle
  4143. self.slot_angle_label = QtWidgets.QLabel('%s:' % _('Angle'))
  4144. self.slot_angle_label.setToolTip(
  4145. _("Angle at which the slot is placed.\n"
  4146. "The precision is of max 2 decimals.\n"
  4147. "Min value is: -359.99 degrees.\n"
  4148. "Max value is: 360.00 degrees.")
  4149. )
  4150. self.slot_angle_label.setMinimumWidth(100)
  4151. self.slot_angle_spinner = FCDoubleSpinner()
  4152. self.slot_angle_spinner.set_precision(self.decimals)
  4153. self.slot_angle_spinner.setWrapping(True)
  4154. self.slot_angle_spinner.setRange(-359.99, 360.00)
  4155. self.slot_angle_spinner.setSingleStep(5)
  4156. grid0.addWidget(self.slot_angle_label, 13, 0)
  4157. grid0.addWidget(self.slot_angle_spinner, 13, 1)
  4158. # #### SLOTS ARRAY #######
  4159. # ########################
  4160. self.slot_array_linear_label = QtWidgets.QLabel('<b>%s:</b>' % _('Linear Slot Array'))
  4161. grid0.addWidget(self.slot_array_linear_label, 14, 0, 1, 2)
  4162. # Number of slot holes in a drill array
  4163. self.slot_array_size_label = QtWidgets.QLabel('%s:' % _('Nr of slots'))
  4164. self.drill_array_size_label.setToolTip(
  4165. _("Specify how many slots to be in the array.")
  4166. )
  4167. # self.slot_array_size_label.setMinimumWidth(100)
  4168. self.slot_array_size_entry = FCSpinner()
  4169. self.slot_array_size_entry.set_range(0, 999999)
  4170. grid0.addWidget(self.slot_array_size_label, 15, 0)
  4171. grid0.addWidget(self.slot_array_size_entry, 15, 1)
  4172. # Linear Slot Array direction
  4173. self.slot_array_axis_label = QtWidgets.QLabel('%s:' % _('Linear Direction'))
  4174. self.slot_array_axis_label.setToolTip(
  4175. _("Direction on which the linear array is oriented:\n"
  4176. "- 'X' - horizontal axis \n"
  4177. "- 'Y' - vertical axis or \n"
  4178. "- 'Angle' - a custom angle for the array inclination")
  4179. )
  4180. # self.slot_axis_label.setMinimumWidth(100)
  4181. self.slot_array_axis_radio = RadioSet([{'label': _('X'), 'value': 'X'},
  4182. {'label': _('Y'), 'value': 'Y'},
  4183. {'label': _('Angle'), 'value': 'A'}])
  4184. grid0.addWidget(self.slot_array_axis_label, 16, 0)
  4185. grid0.addWidget(self.slot_array_axis_radio, 16, 1)
  4186. # Linear Slot Array pitch distance
  4187. self.slot_array_pitch_label = QtWidgets.QLabel('%s:' % _('Pitch'))
  4188. self.slot_array_pitch_label.setToolTip(
  4189. _("Pitch = Distance between elements of the array.")
  4190. )
  4191. # self.drill_pitch_label.setMinimumWidth(100)
  4192. self.slot_array_pitch_entry = FCDoubleSpinner()
  4193. self.slot_array_pitch_entry.set_precision(self.decimals)
  4194. self.slot_array_pitch_entry.setWrapping(True)
  4195. self.slot_array_pitch_entry.setRange(0, 999999)
  4196. self.slot_array_pitch_entry.setSingleStep(1)
  4197. grid0.addWidget(self.slot_array_pitch_label, 17, 0)
  4198. grid0.addWidget(self.slot_array_pitch_entry, 17, 1)
  4199. # Linear Slot Array custom angle
  4200. self.slot_array_angle_label = QtWidgets.QLabel('%s:' % _('Angle'))
  4201. self.slot_array_angle_label.setToolTip(
  4202. _("Angle at which each element in circular array is placed.")
  4203. )
  4204. self.slot_array_angle_entry = FCDoubleSpinner()
  4205. self.slot_array_angle_entry.set_precision(self.decimals)
  4206. self.slot_array_angle_entry.setWrapping(True)
  4207. self.slot_array_angle_entry.setRange(-360, 360)
  4208. self.slot_array_angle_entry.setSingleStep(5)
  4209. grid0.addWidget(self.slot_array_angle_label, 18, 0)
  4210. grid0.addWidget(self.slot_array_angle_entry, 18, 1)
  4211. self.slot_array_circ_label = QtWidgets.QLabel('<b>%s:</b>' % _('Circular Slot Array'))
  4212. grid0.addWidget(self.slot_array_circ_label, 19, 0, 1, 2)
  4213. # Circular Slot Array direction
  4214. self.slot_array_circular_direction_label = QtWidgets.QLabel('%s:' % _('Circular Direction'))
  4215. self.slot_array_circular_direction_label.setToolTip(
  4216. _("Direction for circular array.\n"
  4217. "Can be CW = clockwise or CCW = counter clockwise.")
  4218. )
  4219. self.slot_array_circular_dir_radio = RadioSet([{'label': _('CW'), 'value': 'CW'},
  4220. {'label': _('CCW'), 'value': 'CCW'}])
  4221. grid0.addWidget(self.slot_array_circular_direction_label, 20, 0)
  4222. grid0.addWidget(self.slot_array_circular_dir_radio, 20, 1)
  4223. # Circular Slot Array Angle
  4224. self.slot_array_circular_angle_label = QtWidgets.QLabel('%s:' % _('Circular Angle'))
  4225. self.slot_array_circular_angle_label.setToolTip(
  4226. _("Angle at which each element in circular array is placed.")
  4227. )
  4228. self.slot_array_circular_angle_entry = FCDoubleSpinner()
  4229. self.slot_array_circular_angle_entry.set_precision(self.decimals)
  4230. self.slot_array_circular_angle_entry.setWrapping(True)
  4231. self.slot_array_circular_angle_entry.setRange(-360, 360)
  4232. self.slot_array_circular_angle_entry.setSingleStep(5)
  4233. grid0.addWidget(self.slot_array_circular_angle_label, 21, 0)
  4234. grid0.addWidget(self.slot_array_circular_angle_entry, 21, 1)
  4235. self.layout.addStretch()
  4236. class GeometryGenPrefGroupUI(OptionsGroupUI):
  4237. def __init__(self, decimals=4, parent=None):
  4238. # OptionsGroupUI.__init__(self, "Geometry General Preferences", parent=parent)
  4239. super(GeometryGenPrefGroupUI, self).__init__(self)
  4240. self.setTitle(str(_("Geometry General")))
  4241. self.decimals = decimals
  4242. # ## Plot options
  4243. self.plot_options_label = QtWidgets.QLabel("<b>%s:</b>" % _("Plot Options"))
  4244. self.layout.addWidget(self.plot_options_label)
  4245. # Plot CB
  4246. self.plot_cb = FCCheckBox(label=_('Plot'))
  4247. self.plot_cb.setToolTip(
  4248. _("Plot (show) this object.")
  4249. )
  4250. self.layout.addWidget(self.plot_cb)
  4251. grid0 = QtWidgets.QGridLayout()
  4252. self.layout.addLayout(grid0)
  4253. grid0.setColumnStretch(0, 0)
  4254. grid0.setColumnStretch(1, 1)
  4255. # Number of circle steps for circular aperture linear approximation
  4256. self.circle_steps_label = QtWidgets.QLabel('%s:' % _("Circle Steps"))
  4257. self.circle_steps_label.setToolTip(
  4258. _("The number of circle steps for <b>Geometry</b> \n"
  4259. "circle and arc shapes linear approximation.")
  4260. )
  4261. self.circle_steps_entry = FCSpinner()
  4262. self.circle_steps_entry.set_range(0, 999)
  4263. grid0.addWidget(self.circle_steps_label, 1, 0)
  4264. grid0.addWidget(self.circle_steps_entry, 1, 1)
  4265. # Tools
  4266. self.tools_label = QtWidgets.QLabel("<b>%s:</b>" % _("Tools"))
  4267. grid0.addWidget(self.tools_label, 2, 0, 1, 2)
  4268. # Tooldia
  4269. tdlabel = QtWidgets.QLabel('<b><font color="green">%s:</font></b>' % _('Tools Dia'))
  4270. tdlabel.setToolTip(
  4271. _("Diameters of the tools, separated by comma.\n"
  4272. "The value of the diameter has to use the dot decimals separator.\n"
  4273. "Valid values: 0.3, 1.0")
  4274. )
  4275. self.cnctooldia_entry = FCEntry()
  4276. grid0.addWidget(tdlabel, 3, 0)
  4277. grid0.addWidget(self.cnctooldia_entry, 3, 1)
  4278. separator_line = QtWidgets.QFrame()
  4279. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  4280. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  4281. grid0.addWidget(separator_line, 9, 0, 1, 2)
  4282. # Geometry Object Color
  4283. self.gerber_color_label = QtWidgets.QLabel('<b>%s</b>' % _('Geometry Object Color'))
  4284. grid0.addWidget(self.gerber_color_label, 10, 0, 1, 2)
  4285. # Plot Line Color
  4286. self.line_color_label = QtWidgets.QLabel('%s:' % _('Outline'))
  4287. self.line_color_label.setToolTip(
  4288. _("Set the line color for plotted objects.")
  4289. )
  4290. self.line_color_entry = FCEntry()
  4291. self.line_color_button = QtWidgets.QPushButton()
  4292. self.line_color_button.setFixedSize(15, 15)
  4293. self.form_box_child_2 = QtWidgets.QHBoxLayout()
  4294. self.form_box_child_2.addWidget(self.line_color_entry)
  4295. self.form_box_child_2.addWidget(self.line_color_button)
  4296. self.form_box_child_2.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  4297. grid0.addWidget(self.line_color_label, 11, 0)
  4298. grid0.addLayout(self.form_box_child_2, 11, 1)
  4299. self.layout.addStretch()
  4300. # Setting plot colors signals
  4301. self.line_color_entry.editingFinished.connect(self.on_line_color_entry)
  4302. self.line_color_button.clicked.connect(self.on_line_color_button)
  4303. def on_line_color_entry(self):
  4304. self.app.defaults['geometry_plot_line'] = self.line_color_entry.get_value()[:7] + 'FF'
  4305. self.line_color_button.setStyleSheet("background-color:%s" % str(self.app.defaults['geometry_plot_line'])[:7])
  4306. def on_line_color_button(self):
  4307. current_color = QtGui.QColor(self.app.defaults['geometry_plot_line'][:7])
  4308. # print(current_color)
  4309. c_dialog = QtWidgets.QColorDialog()
  4310. plot_line_color = c_dialog.getColor(initial=current_color)
  4311. if plot_line_color.isValid() is False:
  4312. return
  4313. self.line_color_button.setStyleSheet("background-color:%s" % str(plot_line_color.name()))
  4314. new_val_line = str(plot_line_color.name()) + str(self.app.defaults['geometry_plot_line'][7:9])
  4315. self.line_color_entry.set_value(new_val_line)
  4316. class GeometryOptPrefGroupUI(OptionsGroupUI):
  4317. def __init__(self, decimals=4, parent=None):
  4318. # OptionsGroupUI.__init__(self, "Geometry Options Preferences", parent=parent)
  4319. super(GeometryOptPrefGroupUI, self).__init__(self)
  4320. self.setTitle(str(_("Geometry Options")))
  4321. self.decimals = decimals
  4322. # ------------------------------
  4323. # ## Create CNC Job
  4324. # ------------------------------
  4325. self.cncjob_label = QtWidgets.QLabel('<b>%s:</b>' % _('Create CNC Job'))
  4326. self.cncjob_label.setToolTip(
  4327. _("Create a CNC Job object\n"
  4328. "tracing the contours of this\n"
  4329. "Geometry object.")
  4330. )
  4331. self.layout.addWidget(self.cncjob_label)
  4332. grid1 = QtWidgets.QGridLayout()
  4333. self.layout.addLayout(grid1)
  4334. grid1.setColumnStretch(0, 0)
  4335. grid1.setColumnStretch(1, 1)
  4336. # Cut Z
  4337. cutzlabel = QtWidgets.QLabel('%s:' % _('Cut Z'))
  4338. cutzlabel.setToolTip(
  4339. _("Cutting depth (negative)\n"
  4340. "below the copper surface.")
  4341. )
  4342. self.cutz_entry = FCDoubleSpinner()
  4343. if machinist_setting == 0:
  4344. self.cutz_entry.set_range(-9999.9999, 0.0000)
  4345. else:
  4346. self.cutz_entry.set_range(-9999.9999, 9999.9999)
  4347. self.cutz_entry.set_precision(self.decimals)
  4348. self.cutz_entry.setSingleStep(0.1)
  4349. self.cutz_entry.setWrapping(True)
  4350. grid1.addWidget(cutzlabel, 0, 0)
  4351. grid1.addWidget(self.cutz_entry, 0, 1)
  4352. # Multidepth CheckBox
  4353. self.multidepth_cb = FCCheckBox(label=_('Multi-Depth'))
  4354. self.multidepth_cb.setToolTip(
  4355. _(
  4356. "Use multiple passes to limit\n"
  4357. "the cut depth in each pass. Will\n"
  4358. "cut multiple times until Cut Z is\n"
  4359. "reached."
  4360. )
  4361. )
  4362. grid1.addWidget(self.multidepth_cb, 1, 0)
  4363. # Depth/pass
  4364. dplabel = QtWidgets.QLabel('%s:' % _('Depth/Pass'))
  4365. dplabel.setToolTip(
  4366. _("The depth to cut on each pass,\n"
  4367. "when multidepth is enabled.\n"
  4368. "It has positive value although\n"
  4369. "it is a fraction from the depth\n"
  4370. "which has negative value.")
  4371. )
  4372. self.depthperpass_entry = FCDoubleSpinner()
  4373. self.depthperpass_entry.set_range(0, 99999)
  4374. self.depthperpass_entry.set_precision(self.decimals)
  4375. self.depthperpass_entry.setSingleStep(0.1)
  4376. self.depthperpass_entry.setWrapping(True)
  4377. grid1.addWidget(dplabel, 2, 0)
  4378. grid1.addWidget(self.depthperpass_entry, 2, 1)
  4379. self.ois_multidepth = OptionalInputSection(self.multidepth_cb, [self.depthperpass_entry])
  4380. # Travel Z
  4381. travelzlabel = QtWidgets.QLabel('%s:' % _('Travel Z'))
  4382. travelzlabel.setToolTip(
  4383. _("Height of the tool when\n"
  4384. "moving without cutting.")
  4385. )
  4386. self.travelz_entry = FCDoubleSpinner()
  4387. if machinist_setting == 0:
  4388. self.travelz_entry.set_range(0.0001, 9999.9999)
  4389. else:
  4390. self.travelz_entry.set_range(-9999.9999, 9999.9999)
  4391. self.travelz_entry.set_precision(self.decimals)
  4392. self.travelz_entry.setSingleStep(0.1)
  4393. self.travelz_entry.setWrapping(True)
  4394. grid1.addWidget(travelzlabel, 3, 0)
  4395. grid1.addWidget(self.travelz_entry, 3, 1)
  4396. # Tool change:
  4397. self.toolchange_cb = FCCheckBox('%s' % _("Tool change"))
  4398. self.toolchange_cb.setToolTip(
  4399. _(
  4400. "Include tool-change sequence\n"
  4401. "in the Machine Code (Pause for tool change)."
  4402. )
  4403. )
  4404. grid1.addWidget(self.toolchange_cb, 4, 0, 1, 2)
  4405. # Toolchange Z
  4406. toolchangezlabel = QtWidgets.QLabel('%s:' % _('Toolchange Z'))
  4407. toolchangezlabel.setToolTip(
  4408. _(
  4409. "Z-axis position (height) for\n"
  4410. "tool change."
  4411. )
  4412. )
  4413. self.toolchangez_entry = FCDoubleSpinner()
  4414. if machinist_setting == 0:
  4415. self.toolchangez_entry.set_range(0.000, 9999.9999)
  4416. else:
  4417. self.toolchangez_entry.set_range(-9999.9999, 9999.9999)
  4418. self.toolchangez_entry.set_precision(self.decimals)
  4419. self.toolchangez_entry.setSingleStep(0.1)
  4420. self.toolchangez_entry.setWrapping(True)
  4421. grid1.addWidget(toolchangezlabel, 5, 0)
  4422. grid1.addWidget(self.toolchangez_entry, 5, 1)
  4423. # End move Z
  4424. endz_label = QtWidgets.QLabel('%s:' % _('End move Z'))
  4425. endz_label.setToolTip(
  4426. _("Height of the tool after\n"
  4427. "the last move at the end of the job.")
  4428. )
  4429. self.endz_entry = FCDoubleSpinner()
  4430. if machinist_setting == 0:
  4431. self.endz_entry.set_range(0.000, 9999.9999)
  4432. else:
  4433. self.endz_entry.set_range(-9999.9999, 9999.9999)
  4434. self.endz_entry.set_precision(self.decimals)
  4435. self.endz_entry.setSingleStep(0.1)
  4436. self.endz_entry.setWrapping(True)
  4437. grid1.addWidget(endz_label, 6, 0)
  4438. grid1.addWidget(self.endz_entry, 6, 1)
  4439. # End Move X,Y
  4440. endmove_xy_label = QtWidgets.QLabel('%s:' % _('End move X,Y'))
  4441. endmove_xy_label.setToolTip(
  4442. _("End move X,Y position. In format (x,y).\n"
  4443. "If no value is entered then there is no move\n"
  4444. "on X,Y plane at the end of the job.")
  4445. )
  4446. self.endxy_entry = FCEntry()
  4447. grid1.addWidget(endmove_xy_label, 7, 0)
  4448. grid1.addWidget(self.endxy_entry, 7, 1)
  4449. # Feedrate X-Y
  4450. frlabel = QtWidgets.QLabel('%s:' % _('Feedrate X-Y'))
  4451. frlabel.setToolTip(
  4452. _("Cutting speed in the XY\n"
  4453. "plane in units per minute")
  4454. )
  4455. self.cncfeedrate_entry = FCDoubleSpinner()
  4456. self.cncfeedrate_entry.set_range(0, 99999.9999)
  4457. self.cncfeedrate_entry.set_precision(self.decimals)
  4458. self.cncfeedrate_entry.setSingleStep(0.1)
  4459. self.cncfeedrate_entry.setWrapping(True)
  4460. grid1.addWidget(frlabel, 8, 0)
  4461. grid1.addWidget(self.cncfeedrate_entry, 8, 1)
  4462. # Feedrate Z (Plunge)
  4463. frz_label = QtWidgets.QLabel('%s:' % _('Feedrate Z'))
  4464. frz_label.setToolTip(
  4465. _("Cutting speed in the XY\n"
  4466. "plane in units per minute.\n"
  4467. "It is called also Plunge.")
  4468. )
  4469. self.feedrate_z_entry = FCDoubleSpinner()
  4470. self.feedrate_z_entry.set_range(0, 99999.9999)
  4471. self.feedrate_z_entry.set_precision(self.decimals)
  4472. self.feedrate_z_entry.setSingleStep(0.1)
  4473. self.feedrate_z_entry.setWrapping(True)
  4474. grid1.addWidget(frz_label, 9, 0)
  4475. grid1.addWidget(self.feedrate_z_entry, 9, 1)
  4476. # Spindle Speed
  4477. spdlabel = QtWidgets.QLabel('%s:' % _('Spindle speed'))
  4478. spdlabel.setToolTip(
  4479. _(
  4480. "Speed of the spindle in RPM (optional).\n"
  4481. "If LASER preprocessor is used,\n"
  4482. "this value is the power of laser."
  4483. )
  4484. )
  4485. self.cncspindlespeed_entry = FCSpinner()
  4486. self.cncspindlespeed_entry.set_range(0, 1000000)
  4487. self.cncspindlespeed_entry.set_step(100)
  4488. grid1.addWidget(spdlabel, 10, 0)
  4489. grid1.addWidget(self.cncspindlespeed_entry, 10, 1)
  4490. # Dwell
  4491. self.dwell_cb = FCCheckBox(label='%s' % _('Enable Dwell'))
  4492. self.dwell_cb.setToolTip(
  4493. _("Pause to allow the spindle to reach its\n"
  4494. "speed before cutting.")
  4495. )
  4496. dwelltime = QtWidgets.QLabel('%s:' % _('Duration'))
  4497. dwelltime.setToolTip(
  4498. _("Number of time units for spindle to dwell.")
  4499. )
  4500. self.dwelltime_entry = FCDoubleSpinner()
  4501. self.dwelltime_entry.set_range(0, 99999)
  4502. self.dwelltime_entry.set_precision(self.decimals)
  4503. self.dwelltime_entry.setSingleStep(0.1)
  4504. self.dwelltime_entry.setWrapping(True)
  4505. grid1.addWidget(self.dwell_cb, 11, 0)
  4506. grid1.addWidget(dwelltime, 12, 0)
  4507. grid1.addWidget(self.dwelltime_entry, 12, 1)
  4508. self.ois_dwell = OptionalInputSection(self.dwell_cb, [self.dwelltime_entry])
  4509. # preprocessor selection
  4510. pp_label = QtWidgets.QLabel('%s:' % _("Preprocessor"))
  4511. pp_label.setToolTip(
  4512. _("The Preprocessor file that dictates\n"
  4513. "the Machine Code (like GCode, RML, HPGL) output.")
  4514. )
  4515. self.pp_geometry_name_cb = FCComboBox()
  4516. self.pp_geometry_name_cb.setFocusPolicy(Qt.StrongFocus)
  4517. grid1.addWidget(pp_label, 13, 0)
  4518. grid1.addWidget(self.pp_geometry_name_cb, 13, 1)
  4519. self.layout.addStretch()
  4520. class GeometryAdvOptPrefGroupUI(OptionsGroupUI):
  4521. def __init__(self, decimals=4, parent=None):
  4522. # OptionsGroupUI.__init__(self, "Geometry Advanced Options Preferences", parent=parent)
  4523. super(GeometryAdvOptPrefGroupUI, self).__init__(self)
  4524. self.setTitle(str(_("Geometry Adv. Options")))
  4525. self.decimals = decimals
  4526. # ------------------------------
  4527. # ## Advanced Options
  4528. # ------------------------------
  4529. self.geo_label = QtWidgets.QLabel('<b>%s:</b>' % _('Advanced Options'))
  4530. self.geo_label.setToolTip(
  4531. _("A list of Geometry advanced parameters.\n"
  4532. "Those parameters are available only for\n"
  4533. "Advanced App. Level.")
  4534. )
  4535. self.layout.addWidget(self.geo_label)
  4536. grid1 = QtWidgets.QGridLayout()
  4537. self.layout.addLayout(grid1)
  4538. # Toolchange X,Y
  4539. toolchange_xy_label = QtWidgets.QLabel('%s:' % _('Toolchange X-Y'))
  4540. toolchange_xy_label.setToolTip(
  4541. _("Toolchange X,Y position.")
  4542. )
  4543. grid1.addWidget(toolchange_xy_label, 1, 0)
  4544. self.toolchangexy_entry = FCEntry()
  4545. grid1.addWidget(self.toolchangexy_entry, 1, 1)
  4546. # Start move Z
  4547. startzlabel = QtWidgets.QLabel('%s:' % _('Start Z'))
  4548. startzlabel.setToolTip(
  4549. _("Height of the tool just after starting the work.\n"
  4550. "Delete the value if you don't need this feature.")
  4551. )
  4552. grid1.addWidget(startzlabel, 2, 0)
  4553. self.gstartz_entry = FloatEntry()
  4554. grid1.addWidget(self.gstartz_entry, 2, 1)
  4555. # Feedrate rapids
  4556. fr_rapid_label = QtWidgets.QLabel('%s:' % _('Feedrate Rapids'))
  4557. fr_rapid_label.setToolTip(
  4558. _("Cutting speed in the XY plane\n"
  4559. "(in units per minute).\n"
  4560. "This is for the rapid move G00.\n"
  4561. "It is useful only for Marlin,\n"
  4562. "ignore for any other cases.")
  4563. )
  4564. self.feedrate_rapid_entry = FCDoubleSpinner()
  4565. self.feedrate_rapid_entry.set_range(0, 99999.9999)
  4566. self.feedrate_rapid_entry.set_precision(self.decimals)
  4567. self.feedrate_rapid_entry.setSingleStep(0.1)
  4568. self.feedrate_rapid_entry.setWrapping(True)
  4569. grid1.addWidget(fr_rapid_label, 4, 0)
  4570. grid1.addWidget(self.feedrate_rapid_entry, 4, 1)
  4571. # End move extra cut
  4572. self.extracut_cb = FCCheckBox('%s' % _('Re-cut'))
  4573. self.extracut_cb.setToolTip(
  4574. _("In order to remove possible\n"
  4575. "copper leftovers where first cut\n"
  4576. "meet with last cut, we generate an\n"
  4577. "extended cut over the first cut section.")
  4578. )
  4579. self.e_cut_entry = FCDoubleSpinner()
  4580. self.e_cut_entry.set_range(0, 99999)
  4581. self.e_cut_entry.set_precision(self.decimals)
  4582. self.e_cut_entry.setSingleStep(0.1)
  4583. self.e_cut_entry.setWrapping(True)
  4584. self.e_cut_entry.setToolTip(
  4585. _("In order to remove possible\n"
  4586. "copper leftovers where first cut\n"
  4587. "meet with last cut, we generate an\n"
  4588. "extended cut over the first cut section.")
  4589. )
  4590. grid1.addWidget(self.extracut_cb, 5, 0)
  4591. grid1.addWidget(self.e_cut_entry, 5, 1)
  4592. # Probe depth
  4593. self.pdepth_label = QtWidgets.QLabel('%s:' % _("Probe Z depth"))
  4594. self.pdepth_label.setToolTip(
  4595. _("The maximum depth that the probe is allowed\n"
  4596. "to probe. Negative value, in current units.")
  4597. )
  4598. self.pdepth_entry = FCDoubleSpinner()
  4599. self.pdepth_entry.set_range(-99999, 0.0000)
  4600. self.pdepth_entry.set_precision(self.decimals)
  4601. self.pdepth_entry.setSingleStep(0.1)
  4602. self.pdepth_entry.setWrapping(True)
  4603. grid1.addWidget(self.pdepth_label, 6, 0)
  4604. grid1.addWidget(self.pdepth_entry, 6, 1)
  4605. # Probe feedrate
  4606. self.feedrate_probe_label = QtWidgets.QLabel('%s:' % _("Feedrate Probe"))
  4607. self.feedrate_probe_label.setToolTip(
  4608. _("The feedrate used while the probe is probing.")
  4609. )
  4610. self.feedrate_probe_entry = FCDoubleSpinner()
  4611. self.feedrate_probe_entry.set_range(0, 99999.9999)
  4612. self.feedrate_probe_entry.set_precision(self.decimals)
  4613. self.feedrate_probe_entry.setSingleStep(0.1)
  4614. self.feedrate_probe_entry.setWrapping(True)
  4615. grid1.addWidget(self.feedrate_probe_label, 7, 0)
  4616. grid1.addWidget(self.feedrate_probe_entry, 7, 1)
  4617. # Spindle direction
  4618. spindle_dir_label = QtWidgets.QLabel('%s:' % _('Spindle direction'))
  4619. spindle_dir_label.setToolTip(
  4620. _("This sets the direction that the spindle is rotating.\n"
  4621. "It can be either:\n"
  4622. "- CW = clockwise or\n"
  4623. "- CCW = counter clockwise")
  4624. )
  4625. self.spindledir_radio = RadioSet([{'label': _('CW'), 'value': 'CW'},
  4626. {'label': _('CCW'), 'value': 'CCW'}])
  4627. grid1.addWidget(spindle_dir_label, 8, 0)
  4628. grid1.addWidget(self.spindledir_radio, 8, 1)
  4629. # Fast Move from Z Toolchange
  4630. self.fplunge_cb = FCCheckBox('%s' % _('Fast Plunge'))
  4631. self.fplunge_cb.setToolTip(
  4632. _("By checking this, the vertical move from\n"
  4633. "Z_Toolchange to Z_move is done with G0,\n"
  4634. "meaning the fastest speed available.\n"
  4635. "WARNING: the move is done at Toolchange X,Y coords.")
  4636. )
  4637. grid1.addWidget(self.fplunge_cb, 9, 0, 1, 2)
  4638. # Size of trace segment on X axis
  4639. segx_label = QtWidgets.QLabel('%s:' % _("Segment X size"))
  4640. segx_label.setToolTip(
  4641. _("The size of the trace segment on the X axis.\n"
  4642. "Useful for auto-leveling.\n"
  4643. "A value of 0 means no segmentation on the X axis.")
  4644. )
  4645. self.segx_entry = FCDoubleSpinner()
  4646. self.segx_entry.set_range(0, 99999)
  4647. self.segx_entry.set_precision(self.decimals)
  4648. self.segx_entry.setSingleStep(0.1)
  4649. self.segx_entry.setWrapping(True)
  4650. grid1.addWidget(segx_label, 10, 0)
  4651. grid1.addWidget(self.segx_entry, 10, 1)
  4652. # Size of trace segment on Y axis
  4653. segy_label = QtWidgets.QLabel('%s:' % _("Segment Y size"))
  4654. segy_label.setToolTip(
  4655. _("The size of the trace segment on the Y axis.\n"
  4656. "Useful for auto-leveling.\n"
  4657. "A value of 0 means no segmentation on the Y axis.")
  4658. )
  4659. self.segy_entry = FCDoubleSpinner()
  4660. self.segy_entry.set_range(0, 99999)
  4661. self.segy_entry.set_precision(self.decimals)
  4662. self.segy_entry.setSingleStep(0.1)
  4663. self.segy_entry.setWrapping(True)
  4664. grid1.addWidget(segy_label, 11, 0)
  4665. grid1.addWidget(self.segy_entry, 11, 1)
  4666. self.layout.addStretch()
  4667. class GeometryEditorPrefGroupUI(OptionsGroupUI):
  4668. def __init__(self, decimals=4, parent=None):
  4669. # OptionsGroupUI.__init__(self, "Gerber Adv. Options Preferences", parent=parent)
  4670. super(GeometryEditorPrefGroupUI, self).__init__(self)
  4671. self.setTitle(str(_("Geometry Editor")))
  4672. self.decimals = decimals
  4673. # Advanced Geometry Parameters
  4674. self.param_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  4675. self.param_label.setToolTip(
  4676. _("A list of Geometry Editor parameters.")
  4677. )
  4678. self.layout.addWidget(self.param_label)
  4679. grid0 = QtWidgets.QGridLayout()
  4680. self.layout.addLayout(grid0)
  4681. # Selection Limit
  4682. self.sel_limit_label = QtWidgets.QLabel('%s:' % _("Selection limit"))
  4683. self.sel_limit_label.setToolTip(
  4684. _("Set the number of selected geometry\n"
  4685. "items above which the utility geometry\n"
  4686. "becomes just a selection rectangle.\n"
  4687. "Increases the performance when moving a\n"
  4688. "large number of geometric elements.")
  4689. )
  4690. self.sel_limit_entry = FCSpinner()
  4691. self.sel_limit_entry.set_range(0, 9999)
  4692. grid0.addWidget(self.sel_limit_label, 0, 0)
  4693. grid0.addWidget(self.sel_limit_entry, 0, 1)
  4694. # Milling Type
  4695. milling_type_label = QtWidgets.QLabel('%s:' % _('Milling Type'))
  4696. milling_type_label.setToolTip(
  4697. _("Milling type:\n"
  4698. "- climb / best for precision milling and to reduce tool usage\n"
  4699. "- conventional / useful when there is no backlash compensation")
  4700. )
  4701. self.milling_type_radio = RadioSet([{'label': _('Climb'), 'value': 'cl'},
  4702. {'label': _('Conventional'), 'value': 'cv'}])
  4703. grid0.addWidget(milling_type_label, 1, 0)
  4704. grid0.addWidget(self.milling_type_radio, 1, 1)
  4705. self.layout.addStretch()
  4706. class CNCJobGenPrefGroupUI(OptionsGroupUI):
  4707. def __init__(self, decimals=4, parent=None):
  4708. # OptionsGroupUI.__init__(self, "CNC Job General Preferences", parent=None)
  4709. super(CNCJobGenPrefGroupUI, self).__init__(self)
  4710. self.setTitle(str(_("CNC Job General")))
  4711. self.decimals = decimals
  4712. # ## Plot options
  4713. self.plot_options_label = QtWidgets.QLabel("<b>%s:</b>" % _("Plot Options"))
  4714. self.layout.addWidget(self.plot_options_label)
  4715. grid0 = QtWidgets.QGridLayout()
  4716. self.layout.addLayout(grid0)
  4717. grid0.setColumnStretch(0, 0)
  4718. grid0.setColumnStretch(1, 1)
  4719. # Plot CB
  4720. # self.plot_cb = QtWidgets.QCheckBox('Plot')
  4721. self.plot_cb = FCCheckBox(_('Plot Object'))
  4722. self.plot_cb.setToolTip(_("Plot (show) this object."))
  4723. grid0.addWidget(self.plot_cb, 0, 0, 1, 2)
  4724. # Plot Kind
  4725. self.cncplot_method_label = QtWidgets.QLabel('%s:' % _("Plot kind"))
  4726. self.cncplot_method_label.setToolTip(
  4727. _("This selects the kind of geometries on the canvas to plot.\n"
  4728. "Those can be either of type 'Travel' which means the moves\n"
  4729. "above the work piece or it can be of type 'Cut',\n"
  4730. "which means the moves that cut into the material.")
  4731. )
  4732. self.cncplot_method_radio = RadioSet([
  4733. {"label": _("All"), "value": "all"},
  4734. {"label": _("Travel"), "value": "travel"},
  4735. {"label": _("Cut"), "value": "cut"}
  4736. ], orientation='vertical')
  4737. grid0.addWidget(self.cncplot_method_label, 1, 0)
  4738. grid0.addWidget(self.cncplot_method_radio, 1, 1)
  4739. grid0.addWidget(QtWidgets.QLabel(''), 1, 2)
  4740. # Display Annotation
  4741. self.annotation_cb = FCCheckBox(_("Display Annotation"))
  4742. self.annotation_cb.setToolTip(
  4743. _("This selects if to display text annotation on the plot.\n"
  4744. "When checked it will display numbers in order for each end\n"
  4745. "of a travel line."
  4746. )
  4747. )
  4748. grid0.addWidget(self.annotation_cb, 2, 0, 1, 3)
  4749. # ###################################################################
  4750. # Number of circle steps for circular aperture linear approximation #
  4751. # ###################################################################
  4752. self.steps_per_circle_label = QtWidgets.QLabel('%s:' % _("Circle Steps"))
  4753. self.steps_per_circle_label.setToolTip(
  4754. _("The number of circle steps for <b>GCode</b> \n"
  4755. "circle and arc shapes linear approximation.")
  4756. )
  4757. grid0.addWidget(self.steps_per_circle_label, 3, 0)
  4758. self.steps_per_circle_entry = FCSpinner()
  4759. self.steps_per_circle_entry.set_range(0, 99999)
  4760. grid0.addWidget(self.steps_per_circle_entry, 3, 1)
  4761. # Tool dia for plot
  4762. tdlabel = QtWidgets.QLabel('%s:' % _('Travel dia'))
  4763. tdlabel.setToolTip(
  4764. _("The width of the travel lines to be\n"
  4765. "rendered in the plot.")
  4766. )
  4767. self.tooldia_entry = FCDoubleSpinner()
  4768. self.tooldia_entry.set_range(0, 99999)
  4769. self.tooldia_entry.set_precision(self.decimals)
  4770. self.tooldia_entry.setSingleStep(0.1)
  4771. self.tooldia_entry.setWrapping(True)
  4772. grid0.addWidget(tdlabel, 4, 0)
  4773. grid0.addWidget(self.tooldia_entry, 4, 1)
  4774. # add a space
  4775. grid0.addWidget(QtWidgets.QLabel('<b>%s:</b>' % _("G-code Decimals")), 5, 0, 1, 2)
  4776. # Number of decimals to use in GCODE coordinates
  4777. cdeclabel = QtWidgets.QLabel('%s:' % _('Coordinates'))
  4778. cdeclabel.setToolTip(
  4779. _("The number of decimals to be used for \n"
  4780. "the X, Y, Z coordinates in CNC code (GCODE, etc.)")
  4781. )
  4782. self.coords_dec_entry = FCSpinner()
  4783. self.coords_dec_entry.set_range(0, 9)
  4784. self.coords_dec_entry.setWrapping(True)
  4785. grid0.addWidget(cdeclabel, 6, 0)
  4786. grid0.addWidget(self.coords_dec_entry, 6, 1)
  4787. # Number of decimals to use in GCODE feedrate
  4788. frdeclabel = QtWidgets.QLabel('%s:' % _('Feedrate'))
  4789. frdeclabel.setToolTip(
  4790. _("The number of decimals to be used for \n"
  4791. "the Feedrate parameter in CNC code (GCODE, etc.)")
  4792. )
  4793. self.fr_dec_entry = FCSpinner()
  4794. self.fr_dec_entry.set_range(0, 9)
  4795. self.fr_dec_entry.setWrapping(True)
  4796. grid0.addWidget(frdeclabel, 7, 0)
  4797. grid0.addWidget(self.fr_dec_entry, 7, 1)
  4798. # The type of coordinates used in the Gcode: Absolute or Incremental
  4799. coords_type_label = QtWidgets.QLabel('%s:' % _('Coordinates type'))
  4800. coords_type_label.setToolTip(
  4801. _("The type of coordinates to be used in Gcode.\n"
  4802. "Can be:\n"
  4803. "- Absolute G90 -> the reference is the origin x=0, y=0\n"
  4804. "- Incremental G91 -> the reference is the previous position")
  4805. )
  4806. self.coords_type_radio = RadioSet([
  4807. {"label": _("Absolute G90"), "value": "G90"},
  4808. {"label": _("Incremental G91"), "value": "G91"}
  4809. ], orientation='vertical', stretch=False)
  4810. grid0.addWidget(coords_type_label, 8, 0)
  4811. grid0.addWidget(self.coords_type_radio, 8, 1)
  4812. # hidden for the time being, until implemented
  4813. coords_type_label.hide()
  4814. self.coords_type_radio.hide()
  4815. # Line Endings
  4816. self.line_ending_cb = FCCheckBox(_("Force Windows style line-ending"))
  4817. self.line_ending_cb.setToolTip(
  4818. _("When checked will force a Windows style line-ending\n"
  4819. "(\\r\\n) on non-Windows OS's.")
  4820. )
  4821. grid0.addWidget(self.line_ending_cb, 9, 0, 1, 3)
  4822. separator_line = QtWidgets.QFrame()
  4823. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  4824. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  4825. grid0.addWidget(separator_line, 12, 0, 1, 2)
  4826. # Travel Line Color
  4827. self.travel_color_label = QtWidgets.QLabel('<b>%s</b>' % _('Travel Line Color'))
  4828. grid0.addWidget(self.travel_color_label, 13, 0, 1, 2)
  4829. # Plot Line Color
  4830. self.tline_color_label = QtWidgets.QLabel('%s:' % _('Outline'))
  4831. self.tline_color_label.setToolTip(
  4832. _("Set the travel line color for plotted objects.")
  4833. )
  4834. self.tline_color_entry = FCEntry()
  4835. self.tline_color_button = QtWidgets.QPushButton()
  4836. self.tline_color_button.setFixedSize(15, 15)
  4837. self.form_box_child_2 = QtWidgets.QHBoxLayout()
  4838. self.form_box_child_2.addWidget(self.tline_color_entry)
  4839. self.form_box_child_2.addWidget(self.tline_color_button)
  4840. self.form_box_child_2.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  4841. grid0.addWidget(self.tline_color_label, 14, 0)
  4842. grid0.addLayout(self.form_box_child_2, 14, 1)
  4843. # Plot Fill Color
  4844. self.tfill_color_label = QtWidgets.QLabel('%s:' % _('Fill'))
  4845. self.tfill_color_label.setToolTip(
  4846. _("Set the fill color for plotted objects.\n"
  4847. "First 6 digits are the color and the last 2\n"
  4848. "digits are for alpha (transparency) level.")
  4849. )
  4850. self.tfill_color_entry = FCEntry()
  4851. self.tfill_color_button = QtWidgets.QPushButton()
  4852. self.tfill_color_button.setFixedSize(15, 15)
  4853. self.form_box_child_1 = QtWidgets.QHBoxLayout()
  4854. self.form_box_child_1.addWidget(self.tfill_color_entry)
  4855. self.form_box_child_1.addWidget(self.tfill_color_button)
  4856. self.form_box_child_1.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  4857. grid0.addWidget(self.tfill_color_label, 15, 0)
  4858. grid0.addLayout(self.form_box_child_1, 15, 1)
  4859. # Plot Fill Transparency Level
  4860. self.alpha_label = QtWidgets.QLabel('%s:' % _('Alpha'))
  4861. self.alpha_label.setToolTip(
  4862. _("Set the fill transparency for plotted objects.")
  4863. )
  4864. self.tcolor_alpha_slider = QtWidgets.QSlider(QtCore.Qt.Horizontal)
  4865. self.tcolor_alpha_slider.setMinimum(0)
  4866. self.tcolor_alpha_slider.setMaximum(255)
  4867. self.tcolor_alpha_slider.setSingleStep(1)
  4868. self.tcolor_alpha_spinner = FCSpinner()
  4869. self.tcolor_alpha_spinner.setMinimumWidth(70)
  4870. self.tcolor_alpha_spinner.set_range(0, 255)
  4871. self.form_box_child_3 = QtWidgets.QHBoxLayout()
  4872. self.form_box_child_3.addWidget(self.tcolor_alpha_slider)
  4873. self.form_box_child_3.addWidget(self.tcolor_alpha_spinner)
  4874. grid0.addWidget(self.alpha_label, 16, 0)
  4875. grid0.addLayout(self.form_box_child_3, 16, 1)
  4876. separator_line = QtWidgets.QFrame()
  4877. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  4878. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  4879. grid0.addWidget(separator_line, 17, 0, 1, 2)
  4880. # CNCJob Object Color
  4881. self.cnc_color_label = QtWidgets.QLabel('<b>%s</b>' % _('CNCJob Object Color'))
  4882. grid0.addWidget(self.cnc_color_label, 18, 0, 1, 2)
  4883. # Plot Line Color
  4884. self.line_color_label = QtWidgets.QLabel('%s:' % _('Outline'))
  4885. self.line_color_label.setToolTip(
  4886. _("Set the color for plotted objects.")
  4887. )
  4888. self.line_color_entry = FCEntry()
  4889. self.line_color_button = QtWidgets.QPushButton()
  4890. self.line_color_button.setFixedSize(15, 15)
  4891. self.form_box_child_2 = QtWidgets.QHBoxLayout()
  4892. self.form_box_child_2.addWidget(self.line_color_entry)
  4893. self.form_box_child_2.addWidget(self.line_color_button)
  4894. self.form_box_child_2.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  4895. grid0.addWidget(self.line_color_label, 19, 0)
  4896. grid0.addLayout(self.form_box_child_2, 19, 1)
  4897. # Plot Fill Color
  4898. self.fill_color_label = QtWidgets.QLabel('%s:' % _('Fill'))
  4899. self.fill_color_label.setToolTip(
  4900. _("Set the fill color for plotted objects.\n"
  4901. "First 6 digits are the color and the last 2\n"
  4902. "digits are for alpha (transparency) level.")
  4903. )
  4904. self.fill_color_entry = FCEntry()
  4905. self.fill_color_button = QtWidgets.QPushButton()
  4906. self.fill_color_button.setFixedSize(15, 15)
  4907. self.form_box_child_1 = QtWidgets.QHBoxLayout()
  4908. self.form_box_child_1.addWidget(self.fill_color_entry)
  4909. self.form_box_child_1.addWidget(self.fill_color_button)
  4910. self.form_box_child_1.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  4911. grid0.addWidget(self.fill_color_label, 20, 0)
  4912. grid0.addLayout(self.form_box_child_1, 20, 1)
  4913. self.layout.addStretch()
  4914. # Setting plot colors signals
  4915. self.tline_color_entry.editingFinished.connect(self.on_tline_color_entry)
  4916. self.tline_color_button.clicked.connect(self.on_tline_color_button)
  4917. self.tfill_color_entry.editingFinished.connect(self.on_tfill_color_entry)
  4918. self.tfill_color_button.clicked.connect(self.on_tfill_color_button)
  4919. self.tcolor_alpha_spinner.valueChanged.connect(self.on_tcolor_spinner)
  4920. self.tcolor_alpha_slider.valueChanged.connect(self.on_tcolor_slider)
  4921. self.line_color_entry.editingFinished.connect(self.on_line_color_entry)
  4922. self.line_color_button.clicked.connect(self.on_line_color_button)
  4923. self.fill_color_entry.editingFinished.connect(self.on_fill_color_entry)
  4924. self.fill_color_button.clicked.connect(self.on_fill_color_button)
  4925. # ------------------------------------------------------
  4926. # Setting travel colors handlers
  4927. # ------------------------------------------------------
  4928. def on_tfill_color_entry(self):
  4929. self.app.defaults['cncjob_travel_fill'] = self.tfill_color_entry.get_value()[:7] + \
  4930. self.app.defaults['cncjob_travel_fill'][7:9]
  4931. self.tfill_color_button.setStyleSheet(
  4932. "background-color:%s" % str(self.app.defaults['cncjob_travel_fill'])[:7])
  4933. def on_tfill_color_button(self):
  4934. current_color = QtGui.QColor(self.app.defaults['cncjob_travel_fill'][:7])
  4935. c_dialog = QtWidgets.QColorDialog()
  4936. plot_fill_color = c_dialog.getColor(initial=current_color)
  4937. if plot_fill_color.isValid() is False:
  4938. return
  4939. self.tfill_color_button.setStyleSheet("background-color:%s" % str(plot_fill_color.name()))
  4940. new_val = str(plot_fill_color.name()) + str(self.app.defaults['cncjob_travel_fill'][7:9])
  4941. self.tfill_color_entry.set_value(new_val)
  4942. self.app.defaults['cncjob_travel_fill'] = new_val
  4943. def on_tcolor_spinner(self):
  4944. spinner_value = self.tcolor_alpha_spinner.value()
  4945. self.tcolor_alpha_slider.setValue(spinner_value)
  4946. self.app.defaults['cncjob_travel_fill'] = \
  4947. self.app.defaults['cncjob_travel_fill'][:7] + \
  4948. (hex(spinner_value)[2:] if int(hex(spinner_value)[2:], 16) > 0 else '00')
  4949. self.app.defaults['cncjob_travel_line'] = \
  4950. self.app.defaults['cncjob_travel_line'][:7] + \
  4951. (hex(spinner_value)[2:] if int(hex(spinner_value)[2:], 16) > 0 else '00')
  4952. def on_tcolor_slider(self):
  4953. slider_value = self.tcolor_alpha_slider.value()
  4954. self.tcolor_alpha_spinner.setValue(slider_value)
  4955. def on_tline_color_entry(self):
  4956. self.app.defaults['cncjob_travel_line'] = self.tline_color_entry.get_value()[:7] + \
  4957. self.app.defaults['cncjob_travel_line'][7:9]
  4958. self.tline_color_button.setStyleSheet(
  4959. "background-color:%s" % str(self.app.defaults['cncjob_travel_line'])[:7])
  4960. def on_tline_color_button(self):
  4961. current_color = QtGui.QColor(self.app.defaults['cncjob_travel_line'][:7])
  4962. # print(current_color)
  4963. c_dialog = QtWidgets.QColorDialog()
  4964. plot_line_color = c_dialog.getColor(initial=current_color)
  4965. if plot_line_color.isValid() is False:
  4966. return
  4967. self.tline_color_button.setStyleSheet("background-color:%s" % str(plot_line_color.name()))
  4968. new_val_line = str(plot_line_color.name()) + str(self.app.defaults['cncjob_travel_line'][7:9])
  4969. self.tline_color_entry.set_value(new_val_line)
  4970. self.app.defaults['cncjob_travel_line'] = new_val_line
  4971. # ------------------------------------------------------
  4972. # Setting plot colors handlers
  4973. # ------------------------------------------------------
  4974. def on_fill_color_entry(self):
  4975. self.app.defaults['cncjob_plot_fill'] = self.fill_color_entry.get_value()[:7] + \
  4976. self.app.defaults['cncjob_plot_fill'][7:9]
  4977. self.fill_color_button.setStyleSheet(
  4978. "background-color:%s" % str(self.app.defaults['cncjob_plot_fill'])[:7])
  4979. def on_fill_color_button(self):
  4980. current_color = QtGui.QColor(self.app.defaults['cncjob_plot_fill'][:7])
  4981. c_dialog = QtWidgets.QColorDialog()
  4982. plot_fill_color = c_dialog.getColor(initial=current_color)
  4983. if plot_fill_color.isValid() is False:
  4984. return
  4985. self.fill_color_button.setStyleSheet("background-color:%s" % str(plot_fill_color.name()))
  4986. new_val = str(plot_fill_color.name()) + str(self.app.defaults['cncjob_plot_fill'][7:9])
  4987. self.fill_color_entry.set_value(new_val)
  4988. self.app.defaults['cncjob_plot_fill'] = new_val
  4989. def on_line_color_entry(self):
  4990. self.app.defaults['cncjob_plot_line'] = self.line_color_entry.get_value()[:7] + \
  4991. self.app.defaults['cncjob_plot_line'][7:9]
  4992. self.line_color_button.setStyleSheet(
  4993. "background-color:%s" % str(self.app.defaults['cncjob_plot_line'])[:7])
  4994. def on_line_color_button(self):
  4995. current_color = QtGui.QColor(self.app.defaults['cncjob_plot_line'][:7])
  4996. # print(current_color)
  4997. c_dialog = QtWidgets.QColorDialog()
  4998. plot_line_color = c_dialog.getColor(initial=current_color)
  4999. if plot_line_color.isValid() is False:
  5000. return
  5001. self.line_color_button.setStyleSheet("background-color:%s" % str(plot_line_color.name()))
  5002. new_val_line = str(plot_line_color.name()) + str(self.app.defaults['cncjob_plot_line'][7:9])
  5003. self.line_color_entry.set_value(new_val_line)
  5004. self.app.defaults['cncjob_plot_line'] = new_val_line
  5005. class CNCJobOptPrefGroupUI(OptionsGroupUI):
  5006. def __init__(self, decimals=4, parent=None):
  5007. # OptionsGroupUI.__init__(self, "CNC Job Options Preferences", parent=None)
  5008. super(CNCJobOptPrefGroupUI, self).__init__(self)
  5009. self.setTitle(str(_("CNC Job Options")))
  5010. self.decimals = decimals
  5011. # ## Export G-Code
  5012. self.export_gcode_label = QtWidgets.QLabel("<b>%s:</b>" % _("Export G-Code"))
  5013. self.export_gcode_label.setToolTip(
  5014. _("Export and save G-Code to\n"
  5015. "make this object to a file.")
  5016. )
  5017. self.layout.addWidget(self.export_gcode_label)
  5018. settings = QSettings("Open Source", "FlatCAM")
  5019. if settings.contains("textbox_font_size"):
  5020. tb_fsize = settings.value('textbox_font_size', type=int)
  5021. else:
  5022. tb_fsize = 10
  5023. font = QtGui.QFont()
  5024. font.setPointSize(tb_fsize)
  5025. # Prepend to G-Code
  5026. prependlabel = QtWidgets.QLabel('%s:' % _('Prepend to G-Code'))
  5027. prependlabel.setToolTip(
  5028. _("Type here any G-Code commands you would\n"
  5029. "like to add at the beginning of the G-Code file.")
  5030. )
  5031. self.layout.addWidget(prependlabel)
  5032. self.prepend_text = FCTextArea()
  5033. self.prepend_text.setPlaceholderText(
  5034. _("Type here any G-Code commands you would "
  5035. "like to add at the beginning of the G-Code file.")
  5036. )
  5037. self.layout.addWidget(self.prepend_text)
  5038. self.prepend_text.setFont(font)
  5039. # Append text to G-Code
  5040. appendlabel = QtWidgets.QLabel('%s:' % _('Append to G-Code'))
  5041. appendlabel.setToolTip(
  5042. _("Type here any G-Code commands you would\n"
  5043. "like to append to the generated file.\n"
  5044. "I.e.: M2 (End of program)")
  5045. )
  5046. self.layout.addWidget(appendlabel)
  5047. self.append_text = FCTextArea()
  5048. self.append_text.setPlaceholderText(
  5049. _("Type here any G-Code commands you would "
  5050. "like to append to the generated file.\n"
  5051. "I.e.: M2 (End of program)")
  5052. )
  5053. self.layout.addWidget(self.append_text)
  5054. self.append_text.setFont(font)
  5055. self.layout.addStretch()
  5056. class CNCJobAdvOptPrefGroupUI(OptionsGroupUI):
  5057. def __init__(self, decimals=4, parent=None):
  5058. # OptionsGroupUI.__init__(self, "CNC Job Advanced Options Preferences", parent=None)
  5059. super(CNCJobAdvOptPrefGroupUI, self).__init__(self)
  5060. self.decimals = decimals
  5061. self.setTitle(str(_("CNC Job Adv. Options")))
  5062. # ## Export G-Code
  5063. self.export_gcode_label = QtWidgets.QLabel("<b>%s:</b>" % _("Export CNC Code"))
  5064. self.export_gcode_label.setToolTip(
  5065. _("Export and save G-Code to\n"
  5066. "make this object to a file.")
  5067. )
  5068. self.layout.addWidget(self.export_gcode_label)
  5069. # Prepend to G-Code
  5070. toolchangelabel = QtWidgets.QLabel('%s' % _('Toolchange G-Code'))
  5071. toolchangelabel.setToolTip(
  5072. _(
  5073. "Type here any G-Code commands you would\n"
  5074. "like to be executed when Toolchange event is encountered.\n"
  5075. "This will constitute a Custom Toolchange GCode,\n"
  5076. "or a Toolchange Macro.\n"
  5077. "The FlatCAM variables are surrounded by '%' symbol.\n\n"
  5078. "WARNING: it can be used only with a preprocessor file\n"
  5079. "that has 'toolchange_custom' in it's name and this is built\n"
  5080. "having as template the 'Toolchange Custom' posprocessor file."
  5081. )
  5082. )
  5083. self.layout.addWidget(toolchangelabel)
  5084. settings = QSettings("Open Source", "FlatCAM")
  5085. if settings.contains("textbox_font_size"):
  5086. tb_fsize = settings.value('textbox_font_size', type=int)
  5087. else:
  5088. tb_fsize = 10
  5089. font = QtGui.QFont()
  5090. font.setPointSize(tb_fsize)
  5091. self.toolchange_text = FCTextArea()
  5092. self.toolchange_text.setPlaceholderText(
  5093. _(
  5094. "Type here any G-Code commands you would "
  5095. "like to be executed when Toolchange event is encountered.\n"
  5096. "This will constitute a Custom Toolchange GCode, "
  5097. "or a Toolchange Macro.\n"
  5098. "The FlatCAM variables are surrounded by '%' symbol.\n"
  5099. "WARNING: it can be used only with a preprocessor file "
  5100. "that has 'toolchange_custom' in it's name."
  5101. )
  5102. )
  5103. self.layout.addWidget(self.toolchange_text)
  5104. self.toolchange_text.setFont(font)
  5105. hlay = QtWidgets.QHBoxLayout()
  5106. self.layout.addLayout(hlay)
  5107. # Toolchange Replacement GCode
  5108. self.toolchange_cb = FCCheckBox(label='%s' % _('Use Toolchange Macro'))
  5109. self.toolchange_cb.setToolTip(
  5110. _("Check this box if you want to use\n"
  5111. "a Custom Toolchange GCode (macro).")
  5112. )
  5113. hlay.addWidget(self.toolchange_cb)
  5114. hlay.addStretch()
  5115. hlay1 = QtWidgets.QHBoxLayout()
  5116. self.layout.addLayout(hlay1)
  5117. # Variable list
  5118. self.tc_variable_combo = FCComboBox()
  5119. self.tc_variable_combo.setToolTip(
  5120. _("A list of the FlatCAM variables that can be used\n"
  5121. "in the Toolchange event.\n"
  5122. "They have to be surrounded by the '%' symbol")
  5123. )
  5124. hlay1.addWidget(self.tc_variable_combo)
  5125. # Populate the Combo Box
  5126. variables = [_('Parameters'), 'tool', 'tooldia', 't_drills', 'x_toolchange', 'y_toolchange', 'z_toolchange',
  5127. 'z_cut', 'z_move', 'z_depthpercut', 'spindlespeed', 'dwelltime']
  5128. self.tc_variable_combo.addItems(variables)
  5129. self.tc_variable_combo.insertSeparator(1)
  5130. self.tc_variable_combo.setItemData(0, _("FlatCAM CNC parameters"), Qt.ToolTipRole)
  5131. fnt = QtGui.QFont()
  5132. fnt.setBold(True)
  5133. self.tc_variable_combo.setItemData(0, fnt, Qt.FontRole)
  5134. self.tc_variable_combo.setItemData(2, 'tool = %s' % _("tool number"), Qt.ToolTipRole)
  5135. self.tc_variable_combo.setItemData(3, 'tooldia = %s' % _("tool diameter"), Qt.ToolTipRole)
  5136. self.tc_variable_combo.setItemData(4, 't_drills = %s' % _("for Excellon, total number of drills"),
  5137. Qt.ToolTipRole)
  5138. self.tc_variable_combo.setItemData(5, 'x_toolchange = %s' % _("X coord for Toolchange"), Qt.ToolTipRole)
  5139. self.tc_variable_combo.setItemData(6, 'y_toolchange = %s' % _("Y coord for Toolchange"),
  5140. Qt.ToolTipRole)
  5141. self.tc_variable_combo.setItemData(7, 'z_toolchange = %s' % _("Z coord for Toolchange"), Qt.ToolTipRole)
  5142. self.tc_variable_combo.setItemData(8, 'z_cut = %s' % _("Z depth for the cut"), Qt.ToolTipRole)
  5143. self.tc_variable_combo.setItemData(9, 'z_move = %s' % _("Z height for travel"), Qt.ToolTipRole)
  5144. self.tc_variable_combo.setItemData(10, 'z_depthpercut = %s' % _("the step value for multidepth cut"),
  5145. Qt.ToolTipRole)
  5146. self.tc_variable_combo.setItemData(11, 'spindlesspeed = %s' % _("the value for the spindle speed"),
  5147. Qt.ToolTipRole)
  5148. self.tc_variable_combo.setItemData(12,
  5149. _("dwelltime = time to dwell to allow the spindle to reach it's set RPM"),
  5150. Qt.ToolTipRole)
  5151. # hlay1.addStretch()
  5152. # Insert Variable into the Toolchange G-Code Text Box
  5153. # self.tc_insert_buton = FCButton("Insert")
  5154. # self.tc_insert_buton.setToolTip(
  5155. # "Insert the variable in the GCode Box\n"
  5156. # "surrounded by the '%' symbol."
  5157. # )
  5158. # hlay1.addWidget(self.tc_insert_buton)
  5159. grid0 = QtWidgets.QGridLayout()
  5160. self.layout.addLayout(grid0)
  5161. grid0.addWidget(QtWidgets.QLabel(''), 1, 0, 1, 2)
  5162. # Annotation Font Size
  5163. self.annotation_fontsize_label = QtWidgets.QLabel('%s:' % _("Annotation Size"))
  5164. self.annotation_fontsize_label.setToolTip(
  5165. _("The font size of the annotation text. In pixels.")
  5166. )
  5167. grid0.addWidget(self.annotation_fontsize_label, 2, 0)
  5168. self.annotation_fontsize_sp = FCSpinner()
  5169. self.annotation_fontsize_sp.set_range(0, 9999)
  5170. grid0.addWidget(self.annotation_fontsize_sp, 2, 1)
  5171. grid0.addWidget(QtWidgets.QLabel(''), 2, 2)
  5172. # Annotation Font Color
  5173. self.annotation_color_label = QtWidgets.QLabel('%s:' % _('Annotation Color'))
  5174. self.annotation_color_label.setToolTip(
  5175. _("Set the font color for the annotation texts.")
  5176. )
  5177. self.annotation_fontcolor_entry = FCEntry()
  5178. self.annotation_fontcolor_button = QtWidgets.QPushButton()
  5179. self.annotation_fontcolor_button.setFixedSize(15, 15)
  5180. self.form_box_child = QtWidgets.QHBoxLayout()
  5181. self.form_box_child.setContentsMargins(0, 0, 0, 0)
  5182. self.form_box_child.addWidget(self.annotation_fontcolor_entry)
  5183. self.form_box_child.addWidget(self.annotation_fontcolor_button, alignment=Qt.AlignRight)
  5184. self.form_box_child.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  5185. color_widget = QtWidgets.QWidget()
  5186. color_widget.setLayout(self.form_box_child)
  5187. grid0.addWidget(self.annotation_color_label, 3, 0)
  5188. grid0.addWidget(color_widget, 3, 1)
  5189. grid0.addWidget(QtWidgets.QLabel(''), 3, 2)
  5190. self.layout.addStretch()
  5191. self.tc_variable_combo.currentIndexChanged[str].connect(self.on_cnc_custom_parameters)
  5192. self.annotation_fontcolor_entry.editingFinished.connect(self.on_annotation_fontcolor_entry)
  5193. self.annotation_fontcolor_button.clicked.connect(self.on_annotation_fontcolor_button)
  5194. def on_cnc_custom_parameters(self, signal_text):
  5195. if signal_text == 'Parameters':
  5196. return
  5197. else:
  5198. self.toolchange_text.insertPlainText('%%%s%%' % signal_text)
  5199. def on_annotation_fontcolor_entry(self):
  5200. self.app.defaults['cncjob_annotation_fontcolor'] = self.annotation_fontcolor_entry.get_value()
  5201. self.annotation_fontcolor_button.setStyleSheet(
  5202. "background-color:%s" % str(self.app.defaults['cncjob_annotation_fontcolor']))
  5203. def on_annotation_fontcolor_button(self):
  5204. current_color = QtGui.QColor(self.app.defaults['cncjob_annotation_fontcolor'])
  5205. c_dialog = QtWidgets.QColorDialog()
  5206. annotation_color = c_dialog.getColor(initial=current_color)
  5207. if annotation_color.isValid() is False:
  5208. return
  5209. self.annotation_fontcolor_button.setStyleSheet("background-color:%s" % str(annotation_color.name()))
  5210. new_val_sel = str(annotation_color.name())
  5211. self.annotation_fontcolor_entry.set_value(new_val_sel)
  5212. self.app.defaults['cncjob_annotation_fontcolor'] = new_val_sel
  5213. class ToolsNCCPrefGroupUI(OptionsGroupUI):
  5214. def __init__(self, decimals=4, parent=None):
  5215. # OptionsGroupUI.__init__(self, "NCC Tool Options", parent=parent)
  5216. super(ToolsNCCPrefGroupUI, self).__init__(self)
  5217. self.setTitle(str(_("NCC Tool Options")))
  5218. self.decimals = decimals
  5219. # ## Clear non-copper regions
  5220. self.clearcopper_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  5221. self.clearcopper_label.setToolTip(
  5222. _("Create a Geometry object with\n"
  5223. "toolpaths to cut all non-copper regions.")
  5224. )
  5225. self.layout.addWidget(self.clearcopper_label)
  5226. grid0 = QtWidgets.QGridLayout()
  5227. self.layout.addLayout(grid0)
  5228. ncctdlabel = QtWidgets.QLabel('<b><font color="green">%s:</font></b>' % _('Tools Dia'))
  5229. ncctdlabel.setToolTip(
  5230. _("Diameters of the tools, separated by comma.\n"
  5231. "The value of the diameter has to use the dot decimals separator.\n"
  5232. "Valid values: 0.3, 1.0")
  5233. )
  5234. grid0.addWidget(ncctdlabel, 0, 0)
  5235. self.ncc_tool_dia_entry = FCEntry(border_color='#0069A9')
  5236. self.ncc_tool_dia_entry.setPlaceholderText(_("Comma separated values"))
  5237. grid0.addWidget(self.ncc_tool_dia_entry, 0, 1)
  5238. # Tool Type Radio Button
  5239. self.tool_type_label = QtWidgets.QLabel('%s:' % _('Tool Type'))
  5240. self.tool_type_label.setToolTip(
  5241. _("Default tool type:\n"
  5242. "- 'V-shape'\n"
  5243. "- Circular")
  5244. )
  5245. self.tool_type_radio = RadioSet([{'label': _('V-shape'), 'value': 'V'},
  5246. {'label': _('Circular'), 'value': 'C1'}])
  5247. self.tool_type_radio.setToolTip(
  5248. _("Default tool type:\n"
  5249. "- 'V-shape'\n"
  5250. "- Circular")
  5251. )
  5252. grid0.addWidget(self.tool_type_label, 1, 0)
  5253. grid0.addWidget(self.tool_type_radio, 1, 1)
  5254. # Tip Dia
  5255. self.tipdialabel = QtWidgets.QLabel('%s:' % _('V-Tip Dia'))
  5256. self.tipdialabel.setToolTip(
  5257. _("The tip diameter for V-Shape Tool"))
  5258. self.tipdia_entry = FCDoubleSpinner()
  5259. self.tipdia_entry.set_precision(self.decimals)
  5260. self.tipdia_entry.set_range(0, 1000)
  5261. self.tipdia_entry.setSingleStep(0.1)
  5262. grid0.addWidget(self.tipdialabel, 2, 0)
  5263. grid0.addWidget(self.tipdia_entry, 2, 1)
  5264. # Tip Angle
  5265. self.tipanglelabel = QtWidgets.QLabel('%s:' % _('V-Tip Angle'))
  5266. self.tipanglelabel.setToolTip(
  5267. _("The tip angle for V-Shape Tool.\n"
  5268. "In degree."))
  5269. self.tipangle_entry = FCDoubleSpinner()
  5270. self.tipangle_entry.set_precision(self.decimals)
  5271. self.tipangle_entry.set_range(1, 180)
  5272. self.tipangle_entry.setSingleStep(5)
  5273. self.tipangle_entry.setWrapping(True)
  5274. grid0.addWidget(self.tipanglelabel, 3, 0)
  5275. grid0.addWidget(self.tipangle_entry, 3, 1)
  5276. # Cut Z entry
  5277. cutzlabel = QtWidgets.QLabel('%s:' % _('Cut Z'))
  5278. cutzlabel.setToolTip(
  5279. _("Depth of cut into material. Negative value.\n"
  5280. "In FlatCAM units.")
  5281. )
  5282. self.cutz_entry = FCDoubleSpinner()
  5283. self.cutz_entry.set_precision(self.decimals)
  5284. self.cutz_entry.set_range(-9999.9999, 0.0000)
  5285. self.cutz_entry.setSingleStep(0.1)
  5286. self.cutz_entry.setToolTip(
  5287. _("Depth of cut into material. Negative value.\n"
  5288. "In FlatCAM units.")
  5289. )
  5290. grid0.addWidget(cutzlabel, 4, 0)
  5291. grid0.addWidget(self.cutz_entry, 4, 1)
  5292. # New Diameter
  5293. self.newdialabel = QtWidgets.QLabel('%s:' % _('New Dia'))
  5294. self.newdialabel.setToolTip(
  5295. _("Diameter for the new tool to add in the Tool Table.\n"
  5296. "If the tool is V-shape type then this value is automatically\n"
  5297. "calculated from the other parameters.")
  5298. )
  5299. self.newdia_entry = FCDoubleSpinner()
  5300. self.newdia_entry.set_precision(self.decimals)
  5301. self.newdia_entry.set_range(0.0001, 9999.9999)
  5302. self.newdia_entry.setSingleStep(0.1)
  5303. grid0.addWidget(self.newdialabel, 5, 0)
  5304. grid0.addWidget(self.newdia_entry, 5, 1)
  5305. separator_line = QtWidgets.QFrame()
  5306. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  5307. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  5308. grid0.addWidget(separator_line, 6, 0, 1, 2)
  5309. # Milling Type Radio Button
  5310. self.milling_type_label = QtWidgets.QLabel('%s:' % _('Milling Type'))
  5311. self.milling_type_label.setToolTip(
  5312. _("Milling type when the selected tool is of type: 'iso_op':\n"
  5313. "- climb / best for precision milling and to reduce tool usage\n"
  5314. "- conventional / useful when there is no backlash compensation")
  5315. )
  5316. self.milling_type_radio = RadioSet([{'label': _('Climb'), 'value': 'cl'},
  5317. {'label': _('Conventional'), 'value': 'cv'}])
  5318. self.milling_type_radio.setToolTip(
  5319. _("Milling type when the selected tool is of type: 'iso_op':\n"
  5320. "- climb / best for precision milling and to reduce tool usage\n"
  5321. "- conventional / useful when there is no backlash compensation")
  5322. )
  5323. grid0.addWidget(self.milling_type_label, 7, 0)
  5324. grid0.addWidget(self.milling_type_radio, 7, 1)
  5325. # Tool order Radio Button
  5326. self.ncc_order_label = QtWidgets.QLabel('%s:' % _('Tool order'))
  5327. self.ncc_order_label.setToolTip(_("This set the way that the tools in the tools table are used.\n"
  5328. "'No' --> means that the used order is the one in the tool table\n"
  5329. "'Forward' --> means that the tools will be ordered from small to big\n"
  5330. "'Reverse' --> menas that the tools will ordered from big to small\n\n"
  5331. "WARNING: using rest machining will automatically set the order\n"
  5332. "in reverse and disable this control."))
  5333. self.ncc_order_radio = RadioSet([{'label': _('No'), 'value': 'no'},
  5334. {'label': _('Forward'), 'value': 'fwd'},
  5335. {'label': _('Reverse'), 'value': 'rev'}])
  5336. self.ncc_order_radio.setToolTip(_("This set the way that the tools in the tools table are used.\n"
  5337. "'No' --> means that the used order is the one in the tool table\n"
  5338. "'Forward' --> means that the tools will be ordered from small to big\n"
  5339. "'Reverse' --> menas that the tools will ordered from big to small\n\n"
  5340. "WARNING: using rest machining will automatically set the order\n"
  5341. "in reverse and disable this control."))
  5342. grid0.addWidget(self.ncc_order_label, 8, 0)
  5343. grid0.addWidget(self.ncc_order_radio, 8, 1)
  5344. separator_line = QtWidgets.QFrame()
  5345. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  5346. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  5347. grid0.addWidget(separator_line, 9, 0, 1, 2)
  5348. # Overlap Entry
  5349. nccoverlabel = QtWidgets.QLabel('%s:' % _('Overlap'))
  5350. nccoverlabel.setToolTip(
  5351. _("How much (percentage) of the tool width to overlap each tool pass.\n"
  5352. "Adjust the value starting with lower values\n"
  5353. "and increasing it if areas that should be cleared are still \n"
  5354. "not cleared.\n"
  5355. "Lower values = faster processing, faster execution on CNC.\n"
  5356. "Higher values = slow processing and slow execution on CNC\n"
  5357. "due of too many paths.")
  5358. )
  5359. self.ncc_overlap_entry = FCDoubleSpinner(suffix='%')
  5360. self.ncc_overlap_entry.set_precision(self.decimals)
  5361. self.ncc_overlap_entry.setWrapping(True)
  5362. self.ncc_overlap_entry.setRange(0.0000, 99.9999)
  5363. self.ncc_overlap_entry.setSingleStep(0.1)
  5364. grid0.addWidget(nccoverlabel, 10, 0)
  5365. grid0.addWidget(self.ncc_overlap_entry, 10, 1)
  5366. # Margin entry
  5367. nccmarginlabel = QtWidgets.QLabel('%s:' % _('Margin'))
  5368. nccmarginlabel.setToolTip(
  5369. _("Bounding box margin.")
  5370. )
  5371. self.ncc_margin_entry = FCDoubleSpinner()
  5372. self.ncc_margin_entry.set_precision(self.decimals)
  5373. self.ncc_margin_entry.set_range(-10000, 10000)
  5374. self.ncc_margin_entry.setSingleStep(0.1)
  5375. grid0.addWidget(nccmarginlabel, 11, 0)
  5376. grid0.addWidget(self.ncc_margin_entry, 11, 1)
  5377. # Method
  5378. methodlabel = QtWidgets.QLabel('%s:' % _('Method'))
  5379. methodlabel.setToolTip(
  5380. _("Algorithm for copper clearing:\n"
  5381. "- Standard: Fixed step inwards.\n"
  5382. "- Seed-based: Outwards from seed.\n"
  5383. "- Line-based: Parallel lines.")
  5384. )
  5385. # self.ncc_method_radio = RadioSet([
  5386. # {"label": _("Standard"), "value": "standard"},
  5387. # {"label": _("Seed-based"), "value": "seed"},
  5388. # {"label": _("Straight lines"), "value": "lines"}
  5389. # ], orientation='vertical', stretch=False)
  5390. self.ncc_method_combo = FCComboBox()
  5391. self.ncc_method_combo.addItems(
  5392. [_("Standard"), _("Seed"), _("Lines")]
  5393. )
  5394. grid0.addWidget(methodlabel, 12, 0)
  5395. grid0.addWidget(self.ncc_method_combo, 12, 1)
  5396. # Connect lines
  5397. self.ncc_connect_cb = FCCheckBox('%s' % _("Connect"))
  5398. self.ncc_connect_cb.setToolTip(
  5399. _("Draw lines between resulting\n"
  5400. "segments to minimize tool lifts.")
  5401. )
  5402. grid0.addWidget(self.ncc_connect_cb, 13, 0)
  5403. # Contour Checkbox
  5404. self.ncc_contour_cb = FCCheckBox('%s' % _("Contour"))
  5405. self.ncc_contour_cb.setToolTip(
  5406. _("Cut around the perimeter of the polygon\n"
  5407. "to trim rough edges.")
  5408. )
  5409. grid0.addWidget(self.ncc_contour_cb, 13, 1)
  5410. # ## NCC Offset choice
  5411. self.ncc_choice_offset_cb = FCCheckBox('%s' % _("Offset"))
  5412. self.ncc_choice_offset_cb.setToolTip(
  5413. _("If used, it will add an offset to the copper features.\n"
  5414. "The copper clearing will finish to a distance\n"
  5415. "from the copper features.\n"
  5416. "The value can be between 0 and 10 FlatCAM units.")
  5417. )
  5418. grid0.addWidget(self.ncc_choice_offset_cb, 14, 0, 1, 2)
  5419. # ## NCC Offset value
  5420. self.ncc_offset_label = QtWidgets.QLabel('%s:' % _("Offset value"))
  5421. self.ncc_offset_label.setToolTip(
  5422. _("If used, it will add an offset to the copper features.\n"
  5423. "The copper clearing will finish to a distance\n"
  5424. "from the copper features.\n"
  5425. "The value can be between 0.0 and 9999.9 FlatCAM units.")
  5426. )
  5427. self.ncc_offset_spinner = FCDoubleSpinner()
  5428. self.ncc_offset_spinner.set_range(0.00, 9999.9999)
  5429. self.ncc_offset_spinner.set_precision(self.decimals)
  5430. self.ncc_offset_spinner.setWrapping(True)
  5431. self.ncc_offset_spinner.setSingleStep(0.1)
  5432. grid0.addWidget(self.ncc_offset_label, 15, 0)
  5433. grid0.addWidget(self.ncc_offset_spinner, 15, 1)
  5434. separator_line = QtWidgets.QFrame()
  5435. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  5436. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  5437. grid0.addWidget(separator_line, 16, 0, 1, 2)
  5438. # Rest machining CheckBox
  5439. self.ncc_rest_cb = FCCheckBox('%s' % _("Rest Machining"))
  5440. self.ncc_rest_cb.setToolTip(
  5441. _("If checked, use 'rest machining'.\n"
  5442. "Basically it will clear copper outside PCB features,\n"
  5443. "using the biggest tool and continue with the next tools,\n"
  5444. "from bigger to smaller, to clear areas of copper that\n"
  5445. "could not be cleared by previous tool, until there is\n"
  5446. "no more copper to clear or there are no more tools.\n"
  5447. "If not checked, use the standard algorithm.")
  5448. )
  5449. grid0.addWidget(self.ncc_rest_cb, 17, 0, 1, 2)
  5450. # ## Reference
  5451. # self.reference_radio = RadioSet([{'label': _('Itself'), 'value': 'itself'},
  5452. # {"label": _("Area Selection"), "value": "area"},
  5453. # {'label': _('Reference Object'), 'value': 'box'}],
  5454. # orientation='vertical',
  5455. # stretch=None)
  5456. self.select_combo = FCComboBox()
  5457. self.select_combo.addItems(
  5458. [_("Itself"), _("Area Selection"), _("Reference Object")]
  5459. )
  5460. select_label = QtWidgets.QLabel('%s:' % _("Selection"))
  5461. select_label.setToolTip(
  5462. _("Selection of area to be processed.\n"
  5463. "- 'Itself' - the processing extent is based on the object that is processed.\n "
  5464. "- 'Area Selection' - left mouse click to start selection of the area to be processed.\n"
  5465. "- 'Reference Object' - will process the area specified by another object.")
  5466. )
  5467. grid0.addWidget(select_label, 18, 0)
  5468. grid0.addWidget(self.select_combo, 18, 1)
  5469. self.area_shape_label = QtWidgets.QLabel('%s:' % _("Shape"))
  5470. self.area_shape_label.setToolTip(
  5471. _("The kind of selection shape used for area selection.")
  5472. )
  5473. self.area_shape_radio = RadioSet([{'label': _("Square"), 'value': 'square'},
  5474. {'label': _("Polygon"), 'value': 'polygon'}])
  5475. grid0.addWidget(self.area_shape_label, 19, 0)
  5476. grid0.addWidget(self.area_shape_radio, 19, 1)
  5477. separator_line = QtWidgets.QFrame()
  5478. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  5479. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  5480. grid0.addWidget(separator_line, 20, 0, 1, 2)
  5481. # ## Plotting type
  5482. self.ncc_plotting_radio = RadioSet([{'label': _('Normal'), 'value': 'normal'},
  5483. {"label": _("Progressive"), "value": "progressive"}])
  5484. plotting_label = QtWidgets.QLabel('%s:' % _("NCC Plotting"))
  5485. plotting_label.setToolTip(
  5486. _("- 'Normal' - normal plotting, done at the end of the NCC job\n"
  5487. "- 'Progressive' - after each shape is generated it will be plotted.")
  5488. )
  5489. grid0.addWidget(plotting_label, 21, 0)
  5490. grid0.addWidget(self.ncc_plotting_radio, 21, 1)
  5491. self.layout.addStretch()
  5492. class ToolsCutoutPrefGroupUI(OptionsGroupUI):
  5493. def __init__(self, decimals=4, parent=None):
  5494. # OptionsGroupUI.__init__(self, "Cutout Tool Options", parent=parent)
  5495. super(ToolsCutoutPrefGroupUI, self).__init__(self)
  5496. self.setTitle(str(_("Cutout Tool Options")))
  5497. self.decimals = decimals
  5498. # ## Board cutout
  5499. self.board_cutout_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  5500. self.board_cutout_label.setToolTip(
  5501. _("Create toolpaths to cut around\n"
  5502. "the PCB and separate it from\n"
  5503. "the original board.")
  5504. )
  5505. self.layout.addWidget(self.board_cutout_label)
  5506. grid0 = QtWidgets.QGridLayout()
  5507. self.layout.addLayout(grid0)
  5508. tdclabel = QtWidgets.QLabel('%s:' % _('Tool Diameter'))
  5509. tdclabel.setToolTip(
  5510. _("Diameter of the tool used to cutout\n"
  5511. "the PCB shape out of the surrounding material.")
  5512. )
  5513. self.cutout_tooldia_entry = FCDoubleSpinner()
  5514. self.cutout_tooldia_entry.set_range(0.000001, 9999.9999)
  5515. self.cutout_tooldia_entry.set_precision(self.decimals)
  5516. self.cutout_tooldia_entry.setSingleStep(0.1)
  5517. grid0.addWidget(tdclabel, 0, 0)
  5518. grid0.addWidget(self.cutout_tooldia_entry, 0, 1)
  5519. # Cut Z
  5520. cutzlabel = QtWidgets.QLabel('%s:' % _('Cut Z'))
  5521. cutzlabel.setToolTip(
  5522. _(
  5523. "Cutting depth (negative)\n"
  5524. "below the copper surface."
  5525. )
  5526. )
  5527. self.cutz_entry = FCDoubleSpinner()
  5528. self.cutz_entry.set_precision(self.decimals)
  5529. if machinist_setting == 0:
  5530. self.cutz_entry.setRange(-9999.9999, 0.0000)
  5531. else:
  5532. self.cutz_entry.setRange(-9999.9999, 9999.9999)
  5533. self.cutz_entry.setSingleStep(0.1)
  5534. grid0.addWidget(cutzlabel, 1, 0)
  5535. grid0.addWidget(self.cutz_entry, 1, 1)
  5536. # Multi-pass
  5537. self.mpass_cb = FCCheckBox('%s:' % _("Multi-Depth"))
  5538. self.mpass_cb.setToolTip(
  5539. _(
  5540. "Use multiple passes to limit\n"
  5541. "the cut depth in each pass. Will\n"
  5542. "cut multiple times until Cut Z is\n"
  5543. "reached."
  5544. )
  5545. )
  5546. self.maxdepth_entry = FCDoubleSpinner()
  5547. self.maxdepth_entry.set_precision(self.decimals)
  5548. self.maxdepth_entry.setRange(0, 9999.9999)
  5549. self.maxdepth_entry.setSingleStep(0.1)
  5550. self.maxdepth_entry.setToolTip(_("Depth of each pass (positive)."))
  5551. grid0.addWidget(self.mpass_cb, 2, 0)
  5552. grid0.addWidget(self.maxdepth_entry, 2, 1)
  5553. # Object kind
  5554. kindlabel = QtWidgets.QLabel('%s:' % _('Object kind'))
  5555. kindlabel.setToolTip(
  5556. _("Choice of what kind the object we want to cutout is.<BR>"
  5557. "- <B>Single</B>: contain a single PCB Gerber outline object.<BR>"
  5558. "- <B>Panel</B>: a panel PCB Gerber object, which is made\n"
  5559. "out of many individual PCB outlines.")
  5560. )
  5561. self.obj_kind_combo = RadioSet([
  5562. {"label": _("Single"), "value": "single"},
  5563. {"label": _("Panel"), "value": "panel"},
  5564. ])
  5565. grid0.addWidget(kindlabel, 3, 0)
  5566. grid0.addWidget(self.obj_kind_combo, 3, 1)
  5567. marginlabel = QtWidgets.QLabel('%s:' % _('Margin'))
  5568. marginlabel.setToolTip(
  5569. _("Margin over bounds. A positive value here\n"
  5570. "will make the cutout of the PCB further from\n"
  5571. "the actual PCB border")
  5572. )
  5573. self.cutout_margin_entry = FCDoubleSpinner()
  5574. self.cutout_margin_entry.set_range(-9999.9999, 9999.9999)
  5575. self.cutout_margin_entry.set_precision(self.decimals)
  5576. self.cutout_margin_entry.setSingleStep(0.1)
  5577. grid0.addWidget(marginlabel, 4, 0)
  5578. grid0.addWidget(self.cutout_margin_entry, 4, 1)
  5579. gaplabel = QtWidgets.QLabel('%s:' % _('Gap size'))
  5580. gaplabel.setToolTip(
  5581. _("The size of the bridge gaps in the cutout\n"
  5582. "used to keep the board connected to\n"
  5583. "the surrounding material (the one \n"
  5584. "from which the PCB is cutout).")
  5585. )
  5586. self.cutout_gap_entry = FCDoubleSpinner()
  5587. self.cutout_gap_entry.set_range(0.000001, 9999.9999)
  5588. self.cutout_gap_entry.set_precision(self.decimals)
  5589. self.cutout_gap_entry.setSingleStep(0.1)
  5590. grid0.addWidget(gaplabel, 5, 0)
  5591. grid0.addWidget(self.cutout_gap_entry, 5, 1)
  5592. gaps_label = QtWidgets.QLabel('%s:' % _('Gaps'))
  5593. gaps_label.setToolTip(
  5594. _("Number of gaps used for the cutout.\n"
  5595. "There can be maximum 8 bridges/gaps.\n"
  5596. "The choices are:\n"
  5597. "- None - no gaps\n"
  5598. "- lr - left + right\n"
  5599. "- tb - top + bottom\n"
  5600. "- 4 - left + right +top + bottom\n"
  5601. "- 2lr - 2*left + 2*right\n"
  5602. "- 2tb - 2*top + 2*bottom\n"
  5603. "- 8 - 2*left + 2*right +2*top + 2*bottom")
  5604. )
  5605. self.gaps_combo = FCComboBox()
  5606. grid0.addWidget(gaps_label, 6, 0)
  5607. grid0.addWidget(self.gaps_combo, 6, 1)
  5608. gaps_items = ['None', 'LR', 'TB', '4', '2LR', '2TB', '8']
  5609. for it in gaps_items:
  5610. self.gaps_combo.addItem(it)
  5611. self.gaps_combo.setStyleSheet('background-color: rgb(255,255,255)')
  5612. # Surrounding convex box shape
  5613. self.convex_box = FCCheckBox('%s' % _("Convex Shape"))
  5614. self.convex_box.setToolTip(
  5615. _("Create a convex shape surrounding the entire PCB.\n"
  5616. "Used only if the source object type is Gerber.")
  5617. )
  5618. grid0.addWidget(self.convex_box, 7, 0, 1, 2)
  5619. self.layout.addStretch()
  5620. class Tools2sidedPrefGroupUI(OptionsGroupUI):
  5621. def __init__(self, decimals=4, parent=None):
  5622. # OptionsGroupUI.__init__(self, "2sided Tool Options", parent=parent)
  5623. super(Tools2sidedPrefGroupUI, self).__init__(self)
  5624. self.setTitle(str(_("2Sided Tool Options")))
  5625. self.decimals = decimals
  5626. # ## Board cuttout
  5627. self.dblsided_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  5628. self.dblsided_label.setToolTip(
  5629. _("A tool to help in creating a double sided\n"
  5630. "PCB using alignment holes.")
  5631. )
  5632. self.layout.addWidget(self.dblsided_label)
  5633. grid0 = QtWidgets.QGridLayout()
  5634. self.layout.addLayout(grid0)
  5635. # ## Drill diameter for alignment holes
  5636. self.drill_dia_entry = FCDoubleSpinner()
  5637. self.drill_dia_entry.set_range(0.000001, 9999.9999)
  5638. self.drill_dia_entry.set_precision(self.decimals)
  5639. self.drill_dia_entry.setSingleStep(0.1)
  5640. self.dd_label = QtWidgets.QLabel('%s:' % _("Drill dia"))
  5641. self.dd_label.setToolTip(
  5642. _("Diameter of the drill for the "
  5643. "alignment holes.")
  5644. )
  5645. grid0.addWidget(self.dd_label, 0, 0)
  5646. grid0.addWidget(self.drill_dia_entry, 0, 1)
  5647. # ## Alignment Axis
  5648. self.align_ax_label = QtWidgets.QLabel('%s:' % _("Align Axis"))
  5649. self.align_ax_label.setToolTip(
  5650. _("Mirror vertically (X) or horizontally (Y).")
  5651. )
  5652. self.align_axis_radio = RadioSet([{'label': 'X', 'value': 'X'},
  5653. {'label': 'Y', 'value': 'Y'}])
  5654. grid0.addWidget(self.align_ax_label, 1, 0)
  5655. grid0.addWidget(self.align_axis_radio, 1, 1)
  5656. # ## Axis
  5657. self.mirror_axis_radio = RadioSet([{'label': 'X', 'value': 'X'},
  5658. {'label': 'Y', 'value': 'Y'}])
  5659. self.mirax_label = QtWidgets.QLabel(_("Mirror Axis:"))
  5660. self.mirax_label.setToolTip(
  5661. _("Mirror vertically (X) or horizontally (Y).")
  5662. )
  5663. self.empty_lb1 = QtWidgets.QLabel("")
  5664. grid0.addWidget(self.empty_lb1, 2, 0)
  5665. grid0.addWidget(self.mirax_label, 3, 0)
  5666. grid0.addWidget(self.mirror_axis_radio, 3, 1)
  5667. # ## Axis Location
  5668. self.axis_location_radio = RadioSet([{'label': _('Point'), 'value': 'point'},
  5669. {'label': _('Box'), 'value': 'box'}])
  5670. self.axloc_label = QtWidgets.QLabel('%s:' % _("Axis Ref"))
  5671. self.axloc_label.setToolTip(
  5672. _("The axis should pass through a <b>point</b> or cut\n "
  5673. "a specified <b>box</b> (in a FlatCAM object) through \n"
  5674. "the center.")
  5675. )
  5676. grid0.addWidget(self.axloc_label, 4, 0)
  5677. grid0.addWidget(self.axis_location_radio, 4, 1)
  5678. self.layout.addStretch()
  5679. class ToolsPaintPrefGroupUI(OptionsGroupUI):
  5680. def __init__(self, decimals=4, parent=None):
  5681. # OptionsGroupUI.__init__(self, "Paint Area Tool Options", parent=parent)
  5682. super(ToolsPaintPrefGroupUI, self).__init__(self)
  5683. self.setTitle(str(_("Paint Tool Options")))
  5684. self.decimals = decimals
  5685. # ------------------------------
  5686. # ## Paint area
  5687. # ------------------------------
  5688. self.paint_label = QtWidgets.QLabel(_('<b>Parameters:</b>'))
  5689. self.paint_label.setToolTip(
  5690. _("Creates tool paths to cover the\n"
  5691. "whole area of a polygon (remove\n"
  5692. "all copper). You will be asked\n"
  5693. "to click on the desired polygon.")
  5694. )
  5695. self.layout.addWidget(self.paint_label)
  5696. grid0 = QtWidgets.QGridLayout()
  5697. grid0.setColumnStretch(0, 0)
  5698. grid0.setColumnStretch(1, 1)
  5699. self.layout.addLayout(grid0)
  5700. # Tool dia
  5701. ptdlabel = QtWidgets.QLabel('<b><font color="green">%s:</font></b>' % _('Tools Dia'))
  5702. ptdlabel.setToolTip(
  5703. _("Diameters of the tools, separated by comma.\n"
  5704. "The value of the diameter has to use the dot decimals separator.\n"
  5705. "Valid values: 0.3, 1.0")
  5706. )
  5707. grid0.addWidget(ptdlabel, 0, 0)
  5708. self.painttooldia_entry = FCEntry(border_color='#0069A9')
  5709. self.painttooldia_entry.setPlaceholderText(_("Comma separated values"))
  5710. grid0.addWidget(self.painttooldia_entry, 0, 1)
  5711. # Tool Type Radio Button
  5712. self.tool_type_label = QtWidgets.QLabel('%s:' % _('Tool Type'))
  5713. self.tool_type_label.setToolTip(
  5714. _("Default tool type:\n"
  5715. "- 'V-shape'\n"
  5716. "- Circular")
  5717. )
  5718. self.tool_type_radio = RadioSet([{'label': _('V-shape'), 'value': 'V'},
  5719. {'label': _('Circular'), 'value': 'C1'}])
  5720. self.tool_type_radio.setObjectName(_("Tool Type"))
  5721. grid0.addWidget(self.tool_type_label, 1, 0)
  5722. grid0.addWidget(self.tool_type_radio, 1, 1)
  5723. # Tip Dia
  5724. self.tipdialabel = QtWidgets.QLabel('%s:' % _('V-Tip Dia'))
  5725. self.tipdialabel.setToolTip(
  5726. _("The tip diameter for V-Shape Tool"))
  5727. self.tipdia_entry = FCDoubleSpinner()
  5728. self.tipdia_entry.set_precision(self.decimals)
  5729. self.tipdia_entry.set_range(0.0000, 9999.9999)
  5730. self.tipdia_entry.setSingleStep(0.1)
  5731. self.tipdia_entry.setObjectName(_("V-Tip Dia"))
  5732. grid0.addWidget(self.tipdialabel, 2, 0)
  5733. grid0.addWidget(self.tipdia_entry, 2, 1)
  5734. # Tip Angle
  5735. self.tipanglelabel = QtWidgets.QLabel('%s:' % _('V-Tip Angle'))
  5736. self.tipanglelabel.setToolTip(
  5737. _("The tip angle for V-Shape Tool.\n"
  5738. "In degree."))
  5739. self.tipangle_entry = FCDoubleSpinner()
  5740. self.tipangle_entry.set_precision(self.decimals)
  5741. self.tipangle_entry.set_range(1.0000, 180.0000)
  5742. self.tipangle_entry.setSingleStep(5)
  5743. self.tipangle_entry.setObjectName(_("V-Tip Angle"))
  5744. grid0.addWidget(self.tipanglelabel, 3, 0)
  5745. grid0.addWidget(self.tipangle_entry, 3, 1)
  5746. # Cut Z entry
  5747. cutzlabel = QtWidgets.QLabel('%s:' % _('Cut Z'))
  5748. cutzlabel.setToolTip(
  5749. _("Depth of cut into material. Negative value.\n"
  5750. "In FlatCAM units.")
  5751. )
  5752. self.cutz_entry = FCDoubleSpinner()
  5753. self.cutz_entry.set_precision(self.decimals)
  5754. self.cutz_entry.set_range(-99999.9999, 0.0000)
  5755. self.cutz_entry.setObjectName(_("Cut Z"))
  5756. self.cutz_entry.setToolTip(
  5757. _("Depth of cut into material. Negative value.\n"
  5758. "In FlatCAM units.")
  5759. )
  5760. grid0.addWidget(cutzlabel, 4, 0)
  5761. grid0.addWidget(self.cutz_entry, 4, 1)
  5762. # ### Tool Diameter ####
  5763. self.newdialabel = QtWidgets.QLabel('%s:' % _('New Dia'))
  5764. self.newdialabel.setToolTip(
  5765. _("Diameter for the new tool to add in the Tool Table.\n"
  5766. "If the tool is V-shape type then this value is automatically\n"
  5767. "calculated from the other parameters.")
  5768. )
  5769. self.newdia_entry = FCDoubleSpinner()
  5770. self.newdia_entry.set_precision(self.decimals)
  5771. self.newdia_entry.set_range(0.000, 9999.9999)
  5772. self.newdia_entry.setObjectName(_("Tool Dia"))
  5773. grid0.addWidget(self.newdialabel, 5, 0)
  5774. grid0.addWidget(self.newdia_entry, 5, 1)
  5775. separator_line = QtWidgets.QFrame()
  5776. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  5777. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  5778. grid0.addWidget(separator_line, 6, 0, 1, 2)
  5779. self.paint_order_label = QtWidgets.QLabel('%s:' % _('Tool order'))
  5780. self.paint_order_label.setToolTip(_("This set the way that the tools in the tools table are used.\n"
  5781. "'No' --> means that the used order is the one in the tool table\n"
  5782. "'Forward' --> means that the tools will be ordered from small to big\n"
  5783. "'Reverse' --> menas that the tools will ordered from big to small\n\n"
  5784. "WARNING: using rest machining will automatically set the order\n"
  5785. "in reverse and disable this control."))
  5786. self.paint_order_radio = RadioSet([{'label': _('No'), 'value': 'no'},
  5787. {'label': _('Forward'), 'value': 'fwd'},
  5788. {'label': _('Reverse'), 'value': 'rev'}])
  5789. grid0.addWidget(self.paint_order_label, 7, 0)
  5790. grid0.addWidget(self.paint_order_radio, 7, 1)
  5791. separator_line = QtWidgets.QFrame()
  5792. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  5793. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  5794. grid0.addWidget(separator_line, 8, 0, 1, 2)
  5795. # Overlap
  5796. ovlabel = QtWidgets.QLabel('%s:' % _('Overlap'))
  5797. ovlabel.setToolTip(
  5798. _("How much (percentage) of the tool width to overlap each tool pass.\n"
  5799. "Adjust the value starting with lower values\n"
  5800. "and increasing it if areas that should be painted are still \n"
  5801. "not painted.\n"
  5802. "Lower values = faster processing, faster execution on CNC.\n"
  5803. "Higher values = slow processing and slow execution on CNC\n"
  5804. "due of too many paths.")
  5805. )
  5806. self.paintoverlap_entry = FCDoubleSpinner(suffix='%')
  5807. self.paintoverlap_entry.set_precision(self.decimals)
  5808. self.paintoverlap_entry.setWrapping(True)
  5809. self.paintoverlap_entry.setRange(0.0000, 99.9999)
  5810. self.paintoverlap_entry.setSingleStep(0.1)
  5811. grid0.addWidget(ovlabel, 9, 0)
  5812. grid0.addWidget(self.paintoverlap_entry, 9, 1)
  5813. # Margin
  5814. marginlabel = QtWidgets.QLabel('%s:' % _('Margin'))
  5815. marginlabel.setToolTip(
  5816. _("Distance by which to avoid\n"
  5817. "the edges of the polygon to\n"
  5818. "be painted.")
  5819. )
  5820. self.paintmargin_entry = FCDoubleSpinner()
  5821. self.paintmargin_entry.set_range(-9999.9999, 9999.9999)
  5822. self.paintmargin_entry.set_precision(self.decimals)
  5823. self.paintmargin_entry.setSingleStep(0.1)
  5824. grid0.addWidget(marginlabel, 10, 0)
  5825. grid0.addWidget(self.paintmargin_entry, 10, 1)
  5826. # Method
  5827. methodlabel = QtWidgets.QLabel('%s:' % _('Method'))
  5828. methodlabel.setToolTip(
  5829. _("Algorithm for painting:\n"
  5830. "- Standard: Fixed step inwards.\n"
  5831. "- Seed-based: Outwards from seed.\n"
  5832. "- Line-based: Parallel lines.\n"
  5833. "- Laser-lines: Active only for Gerber objects.\n"
  5834. "Will create lines that follow the traces.\n"
  5835. "- Combo: In case of failure a new method will be picked from the above\n"
  5836. "in the order specified.")
  5837. )
  5838. # self.paintmethod_combo = RadioSet([
  5839. # {"label": _("Standard"), "value": "standard"},
  5840. # {"label": _("Seed-based"), "value": "seed"},
  5841. # {"label": _("Straight lines"), "value": "lines"}
  5842. # ], orientation='vertical', stretch=False)
  5843. self.paintmethod_combo = FCComboBox()
  5844. self.paintmethod_combo.addItems(
  5845. [_("Standard"), _("Seed"), _("Lines"), _("Laser_lines"), _("Combo")]
  5846. )
  5847. grid0.addWidget(methodlabel, 11, 0)
  5848. grid0.addWidget(self.paintmethod_combo, 11, 1)
  5849. # Connect lines
  5850. self.pathconnect_cb = FCCheckBox('%s' % _("Connect"))
  5851. self.pathconnect_cb.setToolTip(
  5852. _("Draw lines between resulting\n"
  5853. "segments to minimize tool lifts.")
  5854. )
  5855. grid0.addWidget(self.pathconnect_cb, 12, 0)
  5856. # Paint contour
  5857. self.contour_cb = FCCheckBox('%s' % _("Contour"))
  5858. self.contour_cb.setToolTip(
  5859. _("Cut around the perimeter of the polygon\n"
  5860. "to trim rough edges.")
  5861. )
  5862. grid0.addWidget(self.contour_cb, 12, 1)
  5863. separator_line = QtWidgets.QFrame()
  5864. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  5865. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  5866. grid0.addWidget(separator_line, 13, 0, 1, 2)
  5867. self.rest_cb = FCCheckBox('%s' % _("Rest Machining"))
  5868. self.rest_cb.setObjectName(_("Rest Machining"))
  5869. self.rest_cb.setToolTip(
  5870. _("If checked, use 'rest machining'.\n"
  5871. "Basically it will clear copper outside PCB features,\n"
  5872. "using the biggest tool and continue with the next tools,\n"
  5873. "from bigger to smaller, to clear areas of copper that\n"
  5874. "could not be cleared by previous tool, until there is\n"
  5875. "no more copper to clear or there are no more tools.\n\n"
  5876. "If not checked, use the standard algorithm.")
  5877. )
  5878. grid0.addWidget(self.rest_cb, 14, 0, 1, 2)
  5879. # Polygon selection
  5880. selectlabel = QtWidgets.QLabel('%s:' % _('Selection'))
  5881. selectlabel.setToolTip(
  5882. _("Selection of area to be processed.\n"
  5883. "- 'Polygon Selection' - left mouse click to add/remove polygons to be processed.\n"
  5884. "- 'Area Selection' - left mouse click to start selection of the area to be processed.\n"
  5885. "Keeping a modifier key pressed (CTRL or SHIFT) will allow to add multiple areas.\n"
  5886. "- 'All Polygons' - the process will start after click.\n"
  5887. "- 'Reference Object' - will process the area specified by another object.")
  5888. )
  5889. # self.selectmethod_combo = RadioSet(
  5890. # [
  5891. # {"label": _("Polygon Selection"), "value": "single"},
  5892. # {"label": _("Area Selection"), "value": "area"},
  5893. # {"label": _("All Polygons"), "value": "all"},
  5894. # {"label": _("Reference Object"), "value": "ref"}
  5895. # ],
  5896. # orientation='vertical',
  5897. # stretch=None
  5898. # )
  5899. self.selectmethod_combo = FCComboBox()
  5900. self.selectmethod_combo.addItems(
  5901. [_("Polygon Selection"), _("Area Selection"), _("All Polygons"), _("Reference Object")]
  5902. )
  5903. grid0.addWidget(selectlabel, 15, 0)
  5904. grid0.addWidget(self.selectmethod_combo, 15, 1)
  5905. self.area_shape_label = QtWidgets.QLabel('%s:' % _("Shape"))
  5906. self.area_shape_label.setToolTip(
  5907. _("The kind of selection shape used for area selection.")
  5908. )
  5909. self.area_shape_radio = RadioSet([{'label': _("Square"), 'value': 'square'},
  5910. {'label': _("Polygon"), 'value': 'polygon'}])
  5911. grid0.addWidget(self.area_shape_label, 18, 0)
  5912. grid0.addWidget(self.area_shape_radio, 18, 1)
  5913. separator_line = QtWidgets.QFrame()
  5914. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  5915. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  5916. grid0.addWidget(separator_line, 19, 0, 1, 2)
  5917. # ## Plotting type
  5918. self.paint_plotting_radio = RadioSet([{'label': _('Normal'), 'value': 'normal'},
  5919. {"label": _("Progressive"), "value": "progressive"}])
  5920. plotting_label = QtWidgets.QLabel('%s:' % _("Paint Plotting"))
  5921. plotting_label.setToolTip(
  5922. _("- 'Normal' - normal plotting, done at the end of the Paint job\n"
  5923. "- 'Progressive' - after each shape is generated it will be plotted.")
  5924. )
  5925. grid0.addWidget(plotting_label, 20, 0)
  5926. grid0.addWidget(self.paint_plotting_radio, 20, 1)
  5927. self.layout.addStretch()
  5928. class ToolsFilmPrefGroupUI(OptionsGroupUI):
  5929. def __init__(self, decimals=4, parent=None):
  5930. # OptionsGroupUI.__init__(self, "Cutout Tool Options", parent=parent)
  5931. super(ToolsFilmPrefGroupUI, self).__init__(self)
  5932. self.setTitle(str(_("Film Tool Options")))
  5933. self.decimals = decimals
  5934. # ## Parameters
  5935. self.film_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  5936. self.film_label.setToolTip(
  5937. _("Create a PCB film from a Gerber or Geometry\n"
  5938. "FlatCAM object.\n"
  5939. "The file is saved in SVG format.")
  5940. )
  5941. self.layout.addWidget(self.film_label)
  5942. grid0 = QtWidgets.QGridLayout()
  5943. self.layout.addLayout(grid0)
  5944. self.film_type_radio = RadioSet([{'label': 'Pos', 'value': 'pos'},
  5945. {'label': 'Neg', 'value': 'neg'}])
  5946. ftypelbl = QtWidgets.QLabel('%s:' % _('Film Type'))
  5947. ftypelbl.setToolTip(
  5948. _("Generate a Positive black film or a Negative film.\n"
  5949. "Positive means that it will print the features\n"
  5950. "with black on a white canvas.\n"
  5951. "Negative means that it will print the features\n"
  5952. "with white on a black canvas.\n"
  5953. "The Film format is SVG.")
  5954. )
  5955. grid0.addWidget(ftypelbl, 0, 0)
  5956. grid0.addWidget(self.film_type_radio, 0, 1)
  5957. # Film Color
  5958. self.film_color_label = QtWidgets.QLabel('%s:' % _('Film Color'))
  5959. self.film_color_label.setToolTip(
  5960. _("Set the film color when positive film is selected.")
  5961. )
  5962. self.film_color_entry = FCEntry()
  5963. self.film_color_button = QtWidgets.QPushButton()
  5964. self.film_color_button.setFixedSize(15, 15)
  5965. self.form_box_child = QtWidgets.QHBoxLayout()
  5966. self.form_box_child.setContentsMargins(0, 0, 0, 0)
  5967. self.form_box_child.addWidget(self.film_color_entry)
  5968. self.form_box_child.addWidget(self.film_color_button, alignment=Qt.AlignRight)
  5969. self.form_box_child.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  5970. film_color_widget = QtWidgets.QWidget()
  5971. film_color_widget.setLayout(self.form_box_child)
  5972. grid0.addWidget(self.film_color_label, 1, 0)
  5973. grid0.addWidget(film_color_widget, 1, 1)
  5974. # Film Border
  5975. self.film_boundary_entry = FCDoubleSpinner()
  5976. self.film_boundary_entry.set_precision(self.decimals)
  5977. self.film_boundary_entry.set_range(0, 9999.9999)
  5978. self.film_boundary_entry.setSingleStep(0.1)
  5979. self.film_boundary_label = QtWidgets.QLabel('%s:' % _("Border"))
  5980. self.film_boundary_label.setToolTip(
  5981. _("Specify a border around the object.\n"
  5982. "Only for negative film.\n"
  5983. "It helps if we use as a Box Object the same \n"
  5984. "object as in Film Object. It will create a thick\n"
  5985. "black bar around the actual print allowing for a\n"
  5986. "better delimitation of the outline features which are of\n"
  5987. "white color like the rest and which may confound with the\n"
  5988. "surroundings if not for this border.")
  5989. )
  5990. grid0.addWidget(self.film_boundary_label, 2, 0)
  5991. grid0.addWidget(self.film_boundary_entry, 2, 1)
  5992. self.film_scale_stroke_entry = FCDoubleSpinner()
  5993. self.film_scale_stroke_entry.set_precision(self.decimals)
  5994. self.film_scale_stroke_entry.set_range(0, 9999.9999)
  5995. self.film_scale_stroke_entry.setSingleStep(0.1)
  5996. self.film_scale_stroke_label = QtWidgets.QLabel('%s:' % _("Scale Stroke"))
  5997. self.film_scale_stroke_label.setToolTip(
  5998. _("Scale the line stroke thickness of each feature in the SVG file.\n"
  5999. "It means that the line that envelope each SVG feature will be thicker or thinner,\n"
  6000. "therefore the fine features may be more affected by this parameter.")
  6001. )
  6002. grid0.addWidget(self.film_scale_stroke_label, 3, 0)
  6003. grid0.addWidget(self.film_scale_stroke_entry, 3, 1)
  6004. self.film_adj_label = QtWidgets.QLabel('<b>%s</b>' % _("Film Adjustments"))
  6005. self.film_adj_label.setToolTip(
  6006. _("Sometime the printers will distort the print shape, especially the Laser types.\n"
  6007. "This section provide the tools to compensate for the print distortions.")
  6008. )
  6009. grid0.addWidget(self.film_adj_label, 4, 0, 1, 2)
  6010. # Scale Geometry
  6011. self.film_scale_cb = FCCheckBox('%s' % _("Scale Film geometry"))
  6012. self.film_scale_cb.setToolTip(
  6013. _("A value greater than 1 will stretch the film\n"
  6014. "while a value less than 1 will jolt it.")
  6015. )
  6016. self.film_scale_cb.setStyleSheet(
  6017. """
  6018. QCheckBox {font-weight: bold; color: black}
  6019. """
  6020. )
  6021. grid0.addWidget(self.film_scale_cb, 5, 0, 1, 2)
  6022. self.film_scalex_label = QtWidgets.QLabel('%s:' % _("X factor"))
  6023. self.film_scalex_entry = FCDoubleSpinner()
  6024. self.film_scalex_entry.set_range(-999.9999, 999.9999)
  6025. self.film_scalex_entry.set_precision(self.decimals)
  6026. self.film_scalex_entry.setSingleStep(0.01)
  6027. grid0.addWidget(self.film_scalex_label, 6, 0)
  6028. grid0.addWidget(self.film_scalex_entry, 6, 1)
  6029. self.film_scaley_label = QtWidgets.QLabel('%s:' % _("Y factor"))
  6030. self.film_scaley_entry = FCDoubleSpinner()
  6031. self.film_scaley_entry.set_range(-999.9999, 999.9999)
  6032. self.film_scaley_entry.set_precision(self.decimals)
  6033. self.film_scaley_entry.setSingleStep(0.01)
  6034. grid0.addWidget(self.film_scaley_label, 7, 0)
  6035. grid0.addWidget(self.film_scaley_entry, 7, 1)
  6036. # Skew Geometry
  6037. self.film_skew_cb = FCCheckBox('%s' % _("Skew Film geometry"))
  6038. self.film_skew_cb.setToolTip(
  6039. _("Positive values will skew to the right\n"
  6040. "while negative values will skew to the left.")
  6041. )
  6042. self.film_skew_cb.setStyleSheet(
  6043. """
  6044. QCheckBox {font-weight: bold; color: black}
  6045. """
  6046. )
  6047. grid0.addWidget(self.film_skew_cb, 8, 0, 1, 2)
  6048. self.film_skewx_label = QtWidgets.QLabel('%s:' % _("X angle"))
  6049. self.film_skewx_entry = FCDoubleSpinner()
  6050. self.film_skewx_entry.set_range(-999.9999, 999.9999)
  6051. self.film_skewx_entry.set_precision(self.decimals)
  6052. self.film_skewx_entry.setSingleStep(0.01)
  6053. grid0.addWidget(self.film_skewx_label, 9, 0)
  6054. grid0.addWidget(self.film_skewx_entry, 9, 1)
  6055. self.film_skewy_label = QtWidgets.QLabel('%s:' % _("Y angle"))
  6056. self.film_skewy_entry = FCDoubleSpinner()
  6057. self.film_skewy_entry.set_range(-999.9999, 999.9999)
  6058. self.film_skewy_entry.set_precision(self.decimals)
  6059. self.film_skewy_entry.setSingleStep(0.01)
  6060. grid0.addWidget(self.film_skewy_label, 10, 0)
  6061. grid0.addWidget(self.film_skewy_entry, 10, 1)
  6062. self.film_skew_ref_label = QtWidgets.QLabel('%s:' % _("Reference"))
  6063. self.film_skew_ref_label.setToolTip(
  6064. _("The reference point to be used as origin for the skew.\n"
  6065. "It can be one of the four points of the geometry bounding box.")
  6066. )
  6067. self.film_skew_reference = RadioSet([{'label': _('Bottom Left'), 'value': 'bottomleft'},
  6068. {'label': _('Top Left'), 'value': 'topleft'},
  6069. {'label': _('Bottom Right'), 'value': 'bottomright'},
  6070. {'label': _('Top right'), 'value': 'topright'}],
  6071. orientation='vertical',
  6072. stretch=False)
  6073. grid0.addWidget(self.film_skew_ref_label, 11, 0)
  6074. grid0.addWidget(self.film_skew_reference, 11, 1)
  6075. # Mirror Geometry
  6076. self.film_mirror_cb = FCCheckBox('%s' % _("Mirror Film geometry"))
  6077. self.film_mirror_cb.setToolTip(
  6078. _("Mirror the film geometry on the selected axis or on both.")
  6079. )
  6080. self.film_mirror_cb.setStyleSheet(
  6081. """
  6082. QCheckBox {font-weight: bold; color: black}
  6083. """
  6084. )
  6085. grid0.addWidget(self.film_mirror_cb, 12, 0, 1, 2)
  6086. self.film_mirror_axis = RadioSet([{'label': _('None'), 'value': 'none'},
  6087. {'label': _('X'), 'value': 'x'},
  6088. {'label': _('Y'), 'value': 'y'},
  6089. {'label': _('Both'), 'value': 'both'}],
  6090. stretch=False)
  6091. self.film_mirror_axis_label = QtWidgets.QLabel('%s:' % _("Mirror axis"))
  6092. grid0.addWidget(self.film_mirror_axis_label, 13, 0)
  6093. grid0.addWidget(self.film_mirror_axis, 13, 1)
  6094. separator_line3 = QtWidgets.QFrame()
  6095. separator_line3.setFrameShape(QtWidgets.QFrame.HLine)
  6096. separator_line3.setFrameShadow(QtWidgets.QFrame.Sunken)
  6097. grid0.addWidget(separator_line3, 14, 0, 1, 2)
  6098. self.file_type_radio = RadioSet([{'label': _('SVG'), 'value': 'svg'},
  6099. {'label': _('PNG'), 'value': 'png'},
  6100. {'label': _('PDF'), 'value': 'pdf'}
  6101. ], stretch=False)
  6102. self.file_type_label = QtWidgets.QLabel(_("Film Type:"))
  6103. self.file_type_label.setToolTip(
  6104. _("The file type of the saved film. Can be:\n"
  6105. "- 'SVG' -> open-source vectorial format\n"
  6106. "- 'PNG' -> raster image\n"
  6107. "- 'PDF' -> portable document format")
  6108. )
  6109. grid0.addWidget(self.file_type_label, 15, 0)
  6110. grid0.addWidget(self.file_type_radio, 15, 1)
  6111. # Page orientation
  6112. self.orientation_label = QtWidgets.QLabel('%s:' % _("Page Orientation"))
  6113. self.orientation_label.setToolTip(_("Can be:\n"
  6114. "- Portrait\n"
  6115. "- Landscape"))
  6116. self.orientation_radio = RadioSet([{'label': _('Portrait'), 'value': 'p'},
  6117. {'label': _('Landscape'), 'value': 'l'},
  6118. ], stretch=False)
  6119. grid0.addWidget(self.orientation_label, 16, 0)
  6120. grid0.addWidget(self.orientation_radio, 16, 1)
  6121. # Page Size
  6122. self.pagesize_label = QtWidgets.QLabel('%s:' % _("Page Size"))
  6123. self.pagesize_label.setToolTip(_("A selection of standard ISO 216 page sizes."))
  6124. self.pagesize_combo = FCComboBox()
  6125. self.pagesize = {}
  6126. self.pagesize.update(
  6127. {
  6128. 'Bounds': None,
  6129. 'A0': (841, 1189),
  6130. 'A1': (594, 841),
  6131. 'A2': (420, 594),
  6132. 'A3': (297, 420),
  6133. 'A4': (210, 297),
  6134. 'A5': (148, 210),
  6135. 'A6': (105, 148),
  6136. 'A7': (74, 105),
  6137. 'A8': (52, 74),
  6138. 'A9': (37, 52),
  6139. 'A10': (26, 37),
  6140. 'B0': (1000, 1414),
  6141. 'B1': (707, 1000),
  6142. 'B2': (500, 707),
  6143. 'B3': (353, 500),
  6144. 'B4': (250, 353),
  6145. 'B5': (176, 250),
  6146. 'B6': (125, 176),
  6147. 'B7': (88, 125),
  6148. 'B8': (62, 88),
  6149. 'B9': (44, 62),
  6150. 'B10': (31, 44),
  6151. 'C0': (917, 1297),
  6152. 'C1': (648, 917),
  6153. 'C2': (458, 648),
  6154. 'C3': (324, 458),
  6155. 'C4': (229, 324),
  6156. 'C5': (162, 229),
  6157. 'C6': (114, 162),
  6158. 'C7': (81, 114),
  6159. 'C8': (57, 81),
  6160. 'C9': (40, 57),
  6161. 'C10': (28, 40),
  6162. # American paper sizes
  6163. 'LETTER': (8.5, 11),
  6164. 'LEGAL': (8.5, 14),
  6165. 'ELEVENSEVENTEEN': (11, 17),
  6166. # From https://en.wikipedia.org/wiki/Paper_size
  6167. 'JUNIOR_LEGAL': (5, 8),
  6168. 'HALF_LETTER': (5.5, 8),
  6169. 'GOV_LETTER': (8, 10.5),
  6170. 'GOV_LEGAL': (8.5, 13),
  6171. 'LEDGER': (17, 11),
  6172. }
  6173. )
  6174. page_size_list = list(self.pagesize.keys())
  6175. self.pagesize_combo.addItems(page_size_list)
  6176. grid0.addWidget(self.pagesize_label, 17, 0)
  6177. grid0.addWidget(self.pagesize_combo, 17, 1)
  6178. self.layout.addStretch()
  6179. class ToolsPanelizePrefGroupUI(OptionsGroupUI):
  6180. def __init__(self, decimals=4, parent=None):
  6181. # OptionsGroupUI.__init__(self, "Cutout Tool Options", parent=parent)
  6182. super(ToolsPanelizePrefGroupUI, self).__init__(self)
  6183. self.setTitle(str(_("Panelize Tool Options")))
  6184. self.decimals = decimals
  6185. # ## Board cuttout
  6186. self.panelize_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  6187. self.panelize_label.setToolTip(
  6188. _("Create an object that contains an array of (x, y) elements,\n"
  6189. "each element is a copy of the source object spaced\n"
  6190. "at a X distance, Y distance of each other.")
  6191. )
  6192. self.layout.addWidget(self.panelize_label)
  6193. grid0 = QtWidgets.QGridLayout()
  6194. self.layout.addLayout(grid0)
  6195. grid0.setColumnStretch(0, 0)
  6196. grid0.setColumnStretch(1, 1)
  6197. # ## Spacing Columns
  6198. self.pspacing_columns = FCDoubleSpinner()
  6199. self.pspacing_columns.set_range(0.000001, 9999.9999)
  6200. self.pspacing_columns.set_precision(self.decimals)
  6201. self.pspacing_columns.setSingleStep(0.1)
  6202. self.spacing_columns_label = QtWidgets.QLabel('%s:' % _("Spacing cols"))
  6203. self.spacing_columns_label.setToolTip(
  6204. _("Spacing between columns of the desired panel.\n"
  6205. "In current units.")
  6206. )
  6207. grid0.addWidget(self.spacing_columns_label, 0, 0)
  6208. grid0.addWidget(self.pspacing_columns, 0, 1)
  6209. # ## Spacing Rows
  6210. self.pspacing_rows = FCDoubleSpinner()
  6211. self.pspacing_rows.set_range(0.000001, 9999.9999)
  6212. self.pspacing_rows.set_precision(self.decimals)
  6213. self.pspacing_rows.setSingleStep(0.1)
  6214. self.spacing_rows_label = QtWidgets.QLabel('%s:' % _("Spacing rows"))
  6215. self.spacing_rows_label.setToolTip(
  6216. _("Spacing between rows of the desired panel.\n"
  6217. "In current units.")
  6218. )
  6219. grid0.addWidget(self.spacing_rows_label, 1, 0)
  6220. grid0.addWidget(self.pspacing_rows, 1, 1)
  6221. # ## Columns
  6222. self.pcolumns = FCSpinner()
  6223. self.pcolumns.set_range(1, 1000)
  6224. self.pcolumns.set_step(1)
  6225. self.columns_label = QtWidgets.QLabel('%s:' % _("Columns"))
  6226. self.columns_label.setToolTip(
  6227. _("Number of columns of the desired panel")
  6228. )
  6229. grid0.addWidget(self.columns_label, 2, 0)
  6230. grid0.addWidget(self.pcolumns, 2, 1)
  6231. # ## Rows
  6232. self.prows = FCSpinner()
  6233. self.prows.set_range(1, 1000)
  6234. self.prows.set_step(1)
  6235. self.rows_label = QtWidgets.QLabel('%s:' % _("Rows"))
  6236. self.rows_label.setToolTip(
  6237. _("Number of rows of the desired panel")
  6238. )
  6239. grid0.addWidget(self.rows_label, 3, 0)
  6240. grid0.addWidget(self.prows, 3, 1)
  6241. # ## Type of resulting Panel object
  6242. self.panel_type_radio = RadioSet([{'label': _('Gerber'), 'value': 'gerber'},
  6243. {'label': _('Geo'), 'value': 'geometry'}])
  6244. self.panel_type_label = QtWidgets.QLabel('%s:' % _("Panel Type"))
  6245. self.panel_type_label.setToolTip(
  6246. _("Choose the type of object for the panel object:\n"
  6247. "- Gerber\n"
  6248. "- Geometry")
  6249. )
  6250. grid0.addWidget(self.panel_type_label, 4, 0)
  6251. grid0.addWidget(self.panel_type_radio, 4, 1)
  6252. # ## Constrains
  6253. self.pconstrain_cb = FCCheckBox('%s:' % _("Constrain within"))
  6254. self.pconstrain_cb.setToolTip(
  6255. _("Area define by DX and DY within to constrain the panel.\n"
  6256. "DX and DY values are in current units.\n"
  6257. "Regardless of how many columns and rows are desired,\n"
  6258. "the final panel will have as many columns and rows as\n"
  6259. "they fit completely within selected area.")
  6260. )
  6261. grid0.addWidget(self.pconstrain_cb, 5, 0, 1, 2)
  6262. self.px_width_entry = FCDoubleSpinner()
  6263. self.px_width_entry.set_range(0.000001, 9999.9999)
  6264. self.px_width_entry.set_precision(self.decimals)
  6265. self.px_width_entry.setSingleStep(0.1)
  6266. self.x_width_lbl = QtWidgets.QLabel('%s:' % _("Width (DX)"))
  6267. self.x_width_lbl.setToolTip(
  6268. _("The width (DX) within which the panel must fit.\n"
  6269. "In current units.")
  6270. )
  6271. grid0.addWidget(self.x_width_lbl, 6, 0)
  6272. grid0.addWidget(self.px_width_entry, 6, 1)
  6273. self.py_height_entry = FCDoubleSpinner()
  6274. self.py_height_entry.set_range(0.000001, 9999.9999)
  6275. self.py_height_entry.set_precision(self.decimals)
  6276. self.py_height_entry.setSingleStep(0.1)
  6277. self.y_height_lbl = QtWidgets.QLabel('%s:' % _("Height (DY)"))
  6278. self.y_height_lbl.setToolTip(
  6279. _("The height (DY)within which the panel must fit.\n"
  6280. "In current units.")
  6281. )
  6282. grid0.addWidget(self.y_height_lbl, 7, 0)
  6283. grid0.addWidget(self.py_height_entry, 7, 1)
  6284. self.layout.addStretch()
  6285. class ToolsCalculatorsPrefGroupUI(OptionsGroupUI):
  6286. def __init__(self, decimals=4, parent=None):
  6287. # OptionsGroupUI.__init__(self, "Calculators Tool Options", parent=parent)
  6288. super(ToolsCalculatorsPrefGroupUI, self).__init__(self)
  6289. self.setTitle(str(_("Calculators Tool Options")))
  6290. self.decimals = decimals
  6291. # ## V-shape Calculator Tool
  6292. self.vshape_tool_label = QtWidgets.QLabel("<b>%s:</b>" % _("V-Shape Tool Calculator"))
  6293. self.vshape_tool_label.setToolTip(
  6294. _("Calculate the tool diameter for a given V-shape tool,\n"
  6295. "having the tip diameter, tip angle and\n"
  6296. "depth-of-cut as parameters.")
  6297. )
  6298. self.layout.addWidget(self.vshape_tool_label)
  6299. grid0 = QtWidgets.QGridLayout()
  6300. grid0.setColumnStretch(0, 0)
  6301. grid0.setColumnStretch(1, 1)
  6302. self.layout.addLayout(grid0)
  6303. # ## Tip Diameter
  6304. self.tip_dia_entry = FCDoubleSpinner()
  6305. self.tip_dia_entry.set_range(0.000001, 9999.9999)
  6306. self.tip_dia_entry.set_precision(self.decimals)
  6307. self.tip_dia_entry.setSingleStep(0.1)
  6308. self.tip_dia_label = QtWidgets.QLabel('%s:' % _("Tip Diameter"))
  6309. self.tip_dia_label.setToolTip(
  6310. _("This is the tool tip diameter.\n"
  6311. "It is specified by manufacturer.")
  6312. )
  6313. grid0.addWidget(self.tip_dia_label, 0, 0)
  6314. grid0.addWidget(self.tip_dia_entry, 0, 1)
  6315. # ## Tip angle
  6316. self.tip_angle_entry = FCDoubleSpinner()
  6317. self.tip_angle_entry.set_range(0.0, 180.0)
  6318. self.tip_angle_entry.set_precision(self.decimals)
  6319. self.tip_angle_entry.setSingleStep(5)
  6320. self.tip_angle_label = QtWidgets.QLabel('%s:' % _("Tip Angle"))
  6321. self.tip_angle_label.setToolTip(
  6322. _("This is the angle on the tip of the tool.\n"
  6323. "It is specified by manufacturer.")
  6324. )
  6325. grid0.addWidget(self.tip_angle_label, 1, 0)
  6326. grid0.addWidget(self.tip_angle_entry, 1, 1)
  6327. # ## Depth-of-cut Cut Z
  6328. self.cut_z_entry = FCDoubleSpinner()
  6329. self.cut_z_entry.set_range(-9999.9999, 0.0000)
  6330. self.cut_z_entry.set_precision(self.decimals)
  6331. self.cut_z_entry.setSingleStep(0.01)
  6332. self.cut_z_label = QtWidgets.QLabel('%s:' % _("Cut Z"))
  6333. self.cut_z_label.setToolTip(
  6334. _("This is depth to cut into material.\n"
  6335. "In the CNCJob object it is the CutZ parameter.")
  6336. )
  6337. grid0.addWidget(self.cut_z_label, 2, 0)
  6338. grid0.addWidget(self.cut_z_entry, 2, 1)
  6339. # ## Electroplating Calculator Tool
  6340. self.plate_title_label = QtWidgets.QLabel("<b>%s:</b>" % _("ElectroPlating Calculator"))
  6341. self.plate_title_label.setToolTip(
  6342. _("This calculator is useful for those who plate the via/pad/drill holes,\n"
  6343. "using a method like grahite ink or calcium hypophosphite ink or palladium chloride.")
  6344. )
  6345. grid0.addWidget(self.plate_title_label, 3, 0, 1, 2)
  6346. # ## PCB Length
  6347. self.pcblength_entry = FCDoubleSpinner()
  6348. self.pcblength_entry.set_range(0.000001, 9999.9999)
  6349. self.pcblength_entry.set_precision(self.decimals)
  6350. self.pcblength_entry.setSingleStep(0.1)
  6351. self.pcblengthlabel = QtWidgets.QLabel('%s:' % _("Board Length"))
  6352. self.pcblengthlabel.setToolTip(_('This is the board length. In centimeters.'))
  6353. grid0.addWidget(self.pcblengthlabel, 4, 0)
  6354. grid0.addWidget(self.pcblength_entry, 4, 1)
  6355. # ## PCB Width
  6356. self.pcbwidth_entry = FCDoubleSpinner()
  6357. self.pcbwidth_entry.set_range(0.000001, 9999.9999)
  6358. self.pcbwidth_entry.set_precision(self.decimals)
  6359. self.pcbwidth_entry.setSingleStep(0.1)
  6360. self.pcbwidthlabel = QtWidgets.QLabel('%s:' % _("Board Width"))
  6361. self.pcbwidthlabel.setToolTip(_('This is the board width.In centimeters.'))
  6362. grid0.addWidget(self.pcbwidthlabel, 5, 0)
  6363. grid0.addWidget(self.pcbwidth_entry, 5, 1)
  6364. # ## Current Density
  6365. self.cdensity_label = QtWidgets.QLabel('%s:' % _("Current Density"))
  6366. self.cdensity_entry = FCDoubleSpinner()
  6367. self.cdensity_entry.set_range(0.000001, 9999.9999)
  6368. self.cdensity_entry.set_precision(self.decimals)
  6369. self.cdensity_entry.setSingleStep(0.1)
  6370. self.cdensity_label.setToolTip(_("Current density to pass through the board. \n"
  6371. "In Amps per Square Feet ASF."))
  6372. grid0.addWidget(self.cdensity_label, 6, 0)
  6373. grid0.addWidget(self.cdensity_entry, 6, 1)
  6374. # ## PCB Copper Growth
  6375. self.growth_label = QtWidgets.QLabel('%s:' % _("Copper Growth"))
  6376. self.growth_entry = FCDoubleSpinner()
  6377. self.growth_entry.set_range(0.000001, 9999.9999)
  6378. self.growth_entry.set_precision(self.decimals)
  6379. self.growth_entry.setSingleStep(0.01)
  6380. self.growth_label.setToolTip(_("How thick the copper growth is intended to be.\n"
  6381. "In microns."))
  6382. grid0.addWidget(self.growth_label, 7, 0)
  6383. grid0.addWidget(self.growth_entry, 7, 1)
  6384. self.layout.addStretch()
  6385. class ToolsTransformPrefGroupUI(OptionsGroupUI):
  6386. def __init__(self, decimals=4, parent=None):
  6387. super(ToolsTransformPrefGroupUI, self).__init__(self)
  6388. self.setTitle(str(_("Transform Tool Options")))
  6389. self.decimals = decimals
  6390. # ## Transformations
  6391. self.transform_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  6392. self.transform_label.setToolTip(
  6393. _("Various transformations that can be applied\n"
  6394. "on a FlatCAM object.")
  6395. )
  6396. self.layout.addWidget(self.transform_label)
  6397. grid0 = QtWidgets.QGridLayout()
  6398. self.layout.addLayout(grid0)
  6399. grid0.setColumnStretch(0, 0)
  6400. grid0.setColumnStretch(1, 1)
  6401. # ## Rotate Angle
  6402. rotate_title_lbl = QtWidgets.QLabel('<b>%s</b>' % _("Rotate"))
  6403. grid0.addWidget(rotate_title_lbl, 0, 0, 1, 2)
  6404. self.rotate_entry = FCDoubleSpinner()
  6405. self.rotate_entry.set_range(-360.0, 360.0)
  6406. self.rotate_entry.set_precision(self.decimals)
  6407. self.rotate_entry.setSingleStep(15)
  6408. self.rotate_label = QtWidgets.QLabel('%s:' % _("Angle"))
  6409. self.rotate_label.setToolTip(
  6410. _("Angle for Rotation action, in degrees.\n"
  6411. "Float number between -360 and 359.\n"
  6412. "Positive numbers for CW motion.\n"
  6413. "Negative numbers for CCW motion.")
  6414. )
  6415. grid0.addWidget(self.rotate_label, 1, 0)
  6416. grid0.addWidget(self.rotate_entry, 1, 1)
  6417. # ## Skew/Shear Angle on X axis
  6418. skew_title_lbl = QtWidgets.QLabel('<b>%s</b>' % _("Skew"))
  6419. grid0.addWidget(skew_title_lbl, 2, 0, 1, 2)
  6420. self.skewx_entry = FCDoubleSpinner()
  6421. self.skewx_entry.set_range(-360.0, 360.0)
  6422. self.skewx_entry.set_precision(self.decimals)
  6423. self.skewx_entry.setSingleStep(0.1)
  6424. self.skewx_label = QtWidgets.QLabel('%s:' % _("X angle"))
  6425. self.skewx_label.setToolTip(
  6426. _("Angle for Skew action, in degrees.\n"
  6427. "Float number between -360 and 359.")
  6428. )
  6429. grid0.addWidget(self.skewx_label, 3, 0)
  6430. grid0.addWidget(self.skewx_entry, 3, 1)
  6431. # ## Skew/Shear Angle on Y axis
  6432. self.skewy_entry = FCDoubleSpinner()
  6433. self.skewy_entry.set_range(-360.0, 360.0)
  6434. self.skewy_entry.set_precision(self.decimals)
  6435. self.skewy_entry.setSingleStep(0.1)
  6436. self.skewy_label = QtWidgets.QLabel('%s:' % _("Y angle"))
  6437. self.skewy_label.setToolTip(
  6438. _("Angle for Skew action, in degrees.\n"
  6439. "Float number between -360 and 359.")
  6440. )
  6441. grid0.addWidget(self.skewy_label, 4, 0)
  6442. grid0.addWidget(self.skewy_entry, 4, 1)
  6443. # ## Scale
  6444. scale_title_lbl = QtWidgets.QLabel('<b>%s</b>' % _("Scale"))
  6445. grid0.addWidget(scale_title_lbl, 5, 0, 1, 2)
  6446. self.scalex_entry = FCDoubleSpinner()
  6447. self.scalex_entry.set_range(0, 9999.9999)
  6448. self.scalex_entry.set_precision(self.decimals)
  6449. self.scalex_entry.setSingleStep(0.1)
  6450. self.scalex_label = QtWidgets.QLabel('%s:' % _("X factor"))
  6451. self.scalex_label.setToolTip(
  6452. _("Factor for scaling on X axis.")
  6453. )
  6454. grid0.addWidget(self.scalex_label, 6, 0)
  6455. grid0.addWidget(self.scalex_entry, 6, 1)
  6456. # ## Scale factor on X axis
  6457. self.scaley_entry = FCDoubleSpinner()
  6458. self.scaley_entry.set_range(0, 9999.9999)
  6459. self.scaley_entry.set_precision(self.decimals)
  6460. self.scaley_entry.setSingleStep(0.1)
  6461. self.scaley_label = QtWidgets.QLabel('%s:' % _("Y factor"))
  6462. self.scaley_label.setToolTip(
  6463. _("Factor for scaling on Y axis.")
  6464. )
  6465. grid0.addWidget(self.scaley_label, 7, 0)
  6466. grid0.addWidget(self.scaley_entry, 7, 1)
  6467. # ## Link Scale factors
  6468. self.link_cb = FCCheckBox(_("Link"))
  6469. self.link_cb.setToolTip(
  6470. _("Scale the selected object(s)\n"
  6471. "using the Scale_X factor for both axis.")
  6472. )
  6473. grid0.addWidget(self.link_cb, 8, 0)
  6474. # ## Scale Reference
  6475. self.reference_cb = FCCheckBox('%s' % _("Scale Reference"))
  6476. self.reference_cb.setToolTip(
  6477. _("Scale the selected object(s)\n"
  6478. "using the origin reference when checked,\n"
  6479. "and the center of the biggest bounding box\n"
  6480. "of the selected objects when unchecked.")
  6481. )
  6482. grid0.addWidget(self.reference_cb, 8, 1)
  6483. # ## Offset
  6484. offset_title_lbl = QtWidgets.QLabel('<b>%s</b>' % _("Offset"))
  6485. grid0.addWidget(offset_title_lbl, 9, 0, 1, 2)
  6486. self.offx_entry = FCDoubleSpinner()
  6487. self.offx_entry.set_range(-9999.9999, 9999.9999)
  6488. self.offx_entry.set_precision(self.decimals)
  6489. self.offx_entry.setSingleStep(0.1)
  6490. self.offx_label = QtWidgets.QLabel('%s:' % _("X val"))
  6491. self.offx_label.setToolTip(
  6492. _("Distance to offset on X axis. In current units.")
  6493. )
  6494. grid0.addWidget(self.offx_label, 10, 0)
  6495. grid0.addWidget(self.offx_entry, 10, 1)
  6496. # ## Offset distance on Y axis
  6497. self.offy_entry = FCDoubleSpinner()
  6498. self.offy_entry.set_range(-9999.9999, 9999.9999)
  6499. self.offy_entry.set_precision(self.decimals)
  6500. self.offy_entry.setSingleStep(0.1)
  6501. self.offy_label = QtWidgets.QLabel('%s:' % _("Y val"))
  6502. self.offy_label.setToolTip(
  6503. _("Distance to offset on Y axis. In current units.")
  6504. )
  6505. grid0.addWidget(self.offy_label, 11, 0)
  6506. grid0.addWidget(self.offy_entry, 11, 1)
  6507. # ## Mirror
  6508. mirror_title_lbl = QtWidgets.QLabel('<b>%s</b>' % _("Mirror"))
  6509. grid0.addWidget(mirror_title_lbl, 12, 0, 1, 2)
  6510. # ## Mirror (Flip) Reference Point
  6511. self.mirror_reference_cb = FCCheckBox('%s' % _("Mirror Reference"))
  6512. self.mirror_reference_cb.setToolTip(
  6513. _("Flip the selected object(s)\n"
  6514. "around the point in Point Entry Field.\n"
  6515. "\n"
  6516. "The point coordinates can be captured by\n"
  6517. "left click on canvas together with pressing\n"
  6518. "SHIFT key. \n"
  6519. "Then click Add button to insert coordinates.\n"
  6520. "Or enter the coords in format (x, y) in the\n"
  6521. "Point Entry field and click Flip on X(Y)"))
  6522. grid0.addWidget(self.mirror_reference_cb, 13, 0, 1, 2)
  6523. self.flip_ref_label = QtWidgets.QLabel('%s' % _("Mirror Reference point"))
  6524. self.flip_ref_label.setToolTip(
  6525. _("Coordinates in format (x, y) used as reference for mirroring.\n"
  6526. "The 'x' in (x, y) will be used when using Flip on X and\n"
  6527. "the 'y' in (x, y) will be used when using Flip on Y and")
  6528. )
  6529. self.flip_ref_entry = EvalEntry2("(0, 0)")
  6530. grid0.addWidget(self.flip_ref_label, 14, 0, 1, 2)
  6531. grid0.addWidget(self.flip_ref_entry, 15, 0, 1, 2)
  6532. # ## Buffer
  6533. buffer_title_lbl = QtWidgets.QLabel('<b>%s</b>' % _("Buffer"))
  6534. grid0.addWidget(buffer_title_lbl, 16, 0, 1, 2)
  6535. self.buffer_label = QtWidgets.QLabel('%s:' % _("Distance"))
  6536. self.buffer_label.setToolTip(
  6537. _("A positive value will create the effect of dilation,\n"
  6538. "while a negative value will create the effect of erosion.\n"
  6539. "Each geometry element of the object will be increased\n"
  6540. "or decreased with the 'distance'.")
  6541. )
  6542. self.buffer_entry = FCDoubleSpinner()
  6543. self.buffer_entry.set_precision(self.decimals)
  6544. self.buffer_entry.setSingleStep(0.1)
  6545. self.buffer_entry.setWrapping(True)
  6546. self.buffer_entry.set_range(-9999.9999, 9999.9999)
  6547. grid0.addWidget(self.buffer_label, 17, 0)
  6548. grid0.addWidget(self.buffer_entry, 17, 1)
  6549. self.buffer_factor_label = QtWidgets.QLabel('%s:' % _("Value"))
  6550. self.buffer_factor_label.setToolTip(
  6551. _("A positive value will create the effect of dilation,\n"
  6552. "while a negative value will create the effect of erosion.\n"
  6553. "Each geometry element of the object will be increased\n"
  6554. "or decreased to fit the 'Value'. Value is a percentage\n"
  6555. "of the initial dimension.")
  6556. )
  6557. self.buffer_factor_entry = FCDoubleSpinner(suffix='%')
  6558. self.buffer_factor_entry.set_range(-100.0000, 1000.0000)
  6559. self.buffer_factor_entry.set_precision(self.decimals)
  6560. self.buffer_factor_entry.setWrapping(True)
  6561. self.buffer_factor_entry.setSingleStep(1)
  6562. grid0.addWidget(self.buffer_factor_label, 18, 0)
  6563. grid0.addWidget(self.buffer_factor_entry, 18, 1)
  6564. self.buffer_rounded_cb = FCCheckBox()
  6565. self.buffer_rounded_cb.setText('%s' % _("Rounded"))
  6566. self.buffer_rounded_cb.setToolTip(
  6567. _("If checked then the buffer will surround the buffered shape,\n"
  6568. "every corner will be rounded.\n"
  6569. "If not checked then the buffer will follow the exact geometry\n"
  6570. "of the buffered shape.")
  6571. )
  6572. grid0.addWidget(self.buffer_rounded_cb, 19, 0, 1, 2)
  6573. self.layout.addStretch()
  6574. class ToolsSolderpastePrefGroupUI(OptionsGroupUI):
  6575. def __init__(self, decimals=4, parent=None):
  6576. super(ToolsSolderpastePrefGroupUI, self).__init__(self)
  6577. self.setTitle(str(_("SolderPaste Tool Options")))
  6578. self.decimals = decimals
  6579. # ## Solder Paste Dispensing
  6580. self.solderpastelabel = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  6581. self.solderpastelabel.setToolTip(
  6582. _("A tool to create GCode for dispensing\n"
  6583. "solder paste onto a PCB.")
  6584. )
  6585. self.layout.addWidget(self.solderpastelabel)
  6586. grid0 = QtWidgets.QGridLayout()
  6587. self.layout.addLayout(grid0)
  6588. # Nozzle Tool Diameters
  6589. nozzletdlabel = QtWidgets.QLabel('<b><font color="green">%s:</font></b>' % _('Tools Dia'))
  6590. nozzletdlabel.setToolTip(
  6591. _("Diameters of the tools, separated by comma.\n"
  6592. "The value of the diameter has to use the dot decimals separator.\n"
  6593. "Valid values: 0.3, 1.0")
  6594. )
  6595. self.nozzle_tool_dia_entry = FCEntry()
  6596. grid0.addWidget(nozzletdlabel, 0, 0)
  6597. grid0.addWidget(self.nozzle_tool_dia_entry, 0, 1)
  6598. # New Nozzle Tool Dia
  6599. self.addtool_entry_lbl = QtWidgets.QLabel('<b>%s:</b>' % _('New Nozzle Dia'))
  6600. self.addtool_entry_lbl.setToolTip(
  6601. _("Diameter for the new Nozzle tool to add in the Tool Table")
  6602. )
  6603. self.addtool_entry = FCDoubleSpinner()
  6604. self.addtool_entry.set_precision(self.decimals)
  6605. self.addtool_entry.set_range(0.0000001, 9999.9999)
  6606. self.addtool_entry.setSingleStep(0.1)
  6607. grid0.addWidget(self.addtool_entry_lbl, 1, 0)
  6608. grid0.addWidget(self.addtool_entry, 1, 1)
  6609. # Z dispense start
  6610. self.z_start_entry = FCDoubleSpinner()
  6611. self.z_start_entry.set_precision(self.decimals)
  6612. self.z_start_entry.set_range(0.0000001, 9999.9999)
  6613. self.z_start_entry.setSingleStep(0.1)
  6614. self.z_start_label = QtWidgets.QLabel('%s:' % _("Z Dispense Start"))
  6615. self.z_start_label.setToolTip(
  6616. _("The height (Z) when solder paste dispensing starts.")
  6617. )
  6618. grid0.addWidget(self.z_start_label, 2, 0)
  6619. grid0.addWidget(self.z_start_entry, 2, 1)
  6620. # Z dispense
  6621. self.z_dispense_entry = FCDoubleSpinner()
  6622. self.z_dispense_entry.set_precision(self.decimals)
  6623. self.z_dispense_entry.set_range(0.0000001, 9999.9999)
  6624. self.z_dispense_entry.setSingleStep(0.1)
  6625. self.z_dispense_label = QtWidgets.QLabel('%s:' % _("Z Dispense"))
  6626. self.z_dispense_label.setToolTip(
  6627. _("The height (Z) when doing solder paste dispensing.")
  6628. )
  6629. grid0.addWidget(self.z_dispense_label, 3, 0)
  6630. grid0.addWidget(self.z_dispense_entry, 3, 1)
  6631. # Z dispense stop
  6632. self.z_stop_entry = FCDoubleSpinner()
  6633. self.z_stop_entry.set_precision(self.decimals)
  6634. self.z_stop_entry.set_range(0.0000001, 9999.9999)
  6635. self.z_stop_entry.setSingleStep(0.1)
  6636. self.z_stop_label = QtWidgets.QLabel('%s:' % _("Z Dispense Stop"))
  6637. self.z_stop_label.setToolTip(
  6638. _("The height (Z) when solder paste dispensing stops.")
  6639. )
  6640. grid0.addWidget(self.z_stop_label, 4, 0)
  6641. grid0.addWidget(self.z_stop_entry, 4, 1)
  6642. # Z travel
  6643. self.z_travel_entry = FCDoubleSpinner()
  6644. self.z_travel_entry.set_precision(self.decimals)
  6645. self.z_travel_entry.set_range(0.0000001, 9999.9999)
  6646. self.z_travel_entry.setSingleStep(0.1)
  6647. self.z_travel_label = QtWidgets.QLabel('%s:' % _("Z Travel"))
  6648. self.z_travel_label.setToolTip(
  6649. _("The height (Z) for travel between pads\n"
  6650. "(without dispensing solder paste).")
  6651. )
  6652. grid0.addWidget(self.z_travel_label, 5, 0)
  6653. grid0.addWidget(self.z_travel_entry, 5, 1)
  6654. # Z toolchange location
  6655. self.z_toolchange_entry = FCDoubleSpinner()
  6656. self.z_toolchange_entry.set_precision(self.decimals)
  6657. self.z_toolchange_entry.set_range(0.0000001, 9999.9999)
  6658. self.z_toolchange_entry.setSingleStep(0.1)
  6659. self.z_toolchange_label = QtWidgets.QLabel('%s:' % _("Z Toolchange"))
  6660. self.z_toolchange_label.setToolTip(
  6661. _("The height (Z) for tool (nozzle) change.")
  6662. )
  6663. grid0.addWidget(self.z_toolchange_label, 6, 0)
  6664. grid0.addWidget(self.z_toolchange_entry, 6, 1)
  6665. # X,Y Toolchange location
  6666. self.xy_toolchange_entry = FCEntry()
  6667. self.xy_toolchange_label = QtWidgets.QLabel('%s:' % _("Toolchange X-Y"))
  6668. self.xy_toolchange_label.setToolTip(
  6669. _("The X,Y location for tool (nozzle) change.\n"
  6670. "The format is (x, y) where x and y are real numbers.")
  6671. )
  6672. grid0.addWidget(self.xy_toolchange_label, 7, 0)
  6673. grid0.addWidget(self.xy_toolchange_entry, 7, 1)
  6674. # Feedrate X-Y
  6675. self.frxy_entry = FCDoubleSpinner()
  6676. self.frxy_entry.set_precision(self.decimals)
  6677. self.frxy_entry.set_range(0.0000001, 99999.9999)
  6678. self.frxy_entry.setSingleStep(0.1)
  6679. self.frxy_label = QtWidgets.QLabel('%s:' % _("Feedrate X-Y"))
  6680. self.frxy_label.setToolTip(
  6681. _("Feedrate (speed) while moving on the X-Y plane.")
  6682. )
  6683. grid0.addWidget(self.frxy_label, 8, 0)
  6684. grid0.addWidget(self.frxy_entry, 8, 1)
  6685. # Feedrate Z
  6686. self.frz_entry = FCDoubleSpinner()
  6687. self.frz_entry.set_precision(self.decimals)
  6688. self.frz_entry.set_range(0.0000001, 99999.9999)
  6689. self.frz_entry.setSingleStep(0.1)
  6690. self.frz_label = QtWidgets.QLabel('%s:' % _("Feedrate Z"))
  6691. self.frz_label.setToolTip(
  6692. _("Feedrate (speed) while moving vertically\n"
  6693. "(on Z plane).")
  6694. )
  6695. grid0.addWidget(self.frz_label, 9, 0)
  6696. grid0.addWidget(self.frz_entry, 9, 1)
  6697. # Feedrate Z Dispense
  6698. self.frz_dispense_entry = FCDoubleSpinner()
  6699. self.frz_dispense_entry.set_precision(self.decimals)
  6700. self.frz_dispense_entry.set_range(0.0000001, 99999.9999)
  6701. self.frz_dispense_entry.setSingleStep(0.1)
  6702. self.frz_dispense_label = QtWidgets.QLabel('%s:' % _("Feedrate Z Dispense"))
  6703. self.frz_dispense_label.setToolTip(
  6704. _("Feedrate (speed) while moving up vertically\n"
  6705. "to Dispense position (on Z plane).")
  6706. )
  6707. grid0.addWidget(self.frz_dispense_label, 10, 0)
  6708. grid0.addWidget(self.frz_dispense_entry, 10, 1)
  6709. # Spindle Speed Forward
  6710. self.speedfwd_entry = FCSpinner()
  6711. self.speedfwd_entry.set_range(0, 99999)
  6712. self.speedfwd_entry.set_step(1000)
  6713. self.speedfwd_label = QtWidgets.QLabel('%s:' % _("Spindle Speed FWD"))
  6714. self.speedfwd_label.setToolTip(
  6715. _("The dispenser speed while pushing solder paste\n"
  6716. "through the dispenser nozzle.")
  6717. )
  6718. grid0.addWidget(self.speedfwd_label, 11, 0)
  6719. grid0.addWidget(self.speedfwd_entry, 11, 1)
  6720. # Dwell Forward
  6721. self.dwellfwd_entry = FCDoubleSpinner()
  6722. self.dwellfwd_entry.set_precision(self.decimals)
  6723. self.dwellfwd_entry.set_range(0.0000001, 9999.9999)
  6724. self.dwellfwd_entry.setSingleStep(0.1)
  6725. self.dwellfwd_label = QtWidgets.QLabel('%s:' % _("Dwell FWD"))
  6726. self.dwellfwd_label.setToolTip(
  6727. _("Pause after solder dispensing.")
  6728. )
  6729. grid0.addWidget(self.dwellfwd_label, 12, 0)
  6730. grid0.addWidget(self.dwellfwd_entry, 12, 1)
  6731. # Spindle Speed Reverse
  6732. self.speedrev_entry = FCSpinner()
  6733. self.speedrev_entry.set_range(0, 999999)
  6734. self.speedrev_entry.set_step(1000)
  6735. self.speedrev_label = QtWidgets.QLabel('%s:' % _("Spindle Speed REV"))
  6736. self.speedrev_label.setToolTip(
  6737. _("The dispenser speed while retracting solder paste\n"
  6738. "through the dispenser nozzle.")
  6739. )
  6740. grid0.addWidget(self.speedrev_label, 13, 0)
  6741. grid0.addWidget(self.speedrev_entry, 13, 1)
  6742. # Dwell Reverse
  6743. self.dwellrev_entry = FCDoubleSpinner()
  6744. self.dwellrev_entry.set_precision(self.decimals)
  6745. self.dwellrev_entry.set_range(0.0000001, 9999.9999)
  6746. self.dwellrev_entry.setSingleStep(0.1)
  6747. self.dwellrev_label = QtWidgets.QLabel('%s:' % _("Dwell REV"))
  6748. self.dwellrev_label.setToolTip(
  6749. _("Pause after solder paste dispenser retracted,\n"
  6750. "to allow pressure equilibrium.")
  6751. )
  6752. grid0.addWidget(self.dwellrev_label, 14, 0)
  6753. grid0.addWidget(self.dwellrev_entry, 14, 1)
  6754. # Preprocessors
  6755. pp_label = QtWidgets.QLabel('%s:' % _('Preprocessor'))
  6756. pp_label.setToolTip(
  6757. _("Files that control the GCode generation.")
  6758. )
  6759. self.pp_combo = FCComboBox()
  6760. grid0.addWidget(pp_label, 15, 0)
  6761. grid0.addWidget(self.pp_combo, 15, 1)
  6762. self.layout.addStretch()
  6763. class ToolsSubPrefGroupUI(OptionsGroupUI):
  6764. def __init__(self, decimals=4, parent=None):
  6765. super(ToolsSubPrefGroupUI, self).__init__(self)
  6766. self.setTitle(str(_("Substractor Tool Options")))
  6767. self.decimals = decimals
  6768. # ## Subtractor Tool Parameters
  6769. self.sublabel = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  6770. self.sublabel.setToolTip(
  6771. _("A tool to substract one Gerber or Geometry object\n"
  6772. "from another of the same type.")
  6773. )
  6774. self.layout.addWidget(self.sublabel)
  6775. self.close_paths_cb = FCCheckBox(_("Close paths"))
  6776. self.close_paths_cb.setToolTip(_("Checking this will close the paths cut by the Geometry substractor object."))
  6777. self.layout.addWidget(self.close_paths_cb)
  6778. self.layout.addStretch()
  6779. class Tools2RulesCheckPrefGroupUI(OptionsGroupUI):
  6780. def __init__(self, decimals=4, parent=None):
  6781. super(Tools2RulesCheckPrefGroupUI, self).__init__(self)
  6782. self.setTitle(str(_("Check Rules Tool Options")))
  6783. self.decimals = decimals
  6784. self.crlabel = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  6785. self.crlabel.setToolTip(
  6786. _("A tool to check if Gerber files are within a set\n"
  6787. "of Manufacturing Rules.")
  6788. )
  6789. self.layout.addWidget(self.crlabel)
  6790. # Form Layout
  6791. self.form_layout_1 = QtWidgets.QFormLayout()
  6792. self.layout.addLayout(self.form_layout_1)
  6793. # Trace size
  6794. self.trace_size_cb = FCCheckBox('%s:' % _("Trace Size"))
  6795. self.trace_size_cb.setToolTip(
  6796. _("This checks if the minimum size for traces is met.")
  6797. )
  6798. self.form_layout_1.addRow(self.trace_size_cb)
  6799. # Trace size value
  6800. self.trace_size_entry = FCDoubleSpinner()
  6801. self.trace_size_entry.set_range(0.00001, 999.99999)
  6802. self.trace_size_entry.set_precision(self.decimals)
  6803. self.trace_size_entry.setSingleStep(0.1)
  6804. self.trace_size_lbl = QtWidgets.QLabel('%s:' % _("Min value"))
  6805. self.trace_size_lbl.setToolTip(
  6806. _("Minimum acceptable trace size.")
  6807. )
  6808. self.form_layout_1.addRow(self.trace_size_lbl, self.trace_size_entry)
  6809. # Copper2copper clearance
  6810. self.clearance_copper2copper_cb = FCCheckBox('%s:' % _("Copper to Copper clearance"))
  6811. self.clearance_copper2copper_cb.setToolTip(
  6812. _("This checks if the minimum clearance between copper\n"
  6813. "features is met.")
  6814. )
  6815. self.form_layout_1.addRow(self.clearance_copper2copper_cb)
  6816. # Copper2copper clearance value
  6817. self.clearance_copper2copper_entry = FCDoubleSpinner()
  6818. self.clearance_copper2copper_entry.set_range(0.00001, 999.99999)
  6819. self.clearance_copper2copper_entry.set_precision(self.decimals)
  6820. self.clearance_copper2copper_entry.setSingleStep(0.1)
  6821. self.clearance_copper2copper_lbl = QtWidgets.QLabel('%s:' % _("Min value"))
  6822. self.clearance_copper2copper_lbl.setToolTip(
  6823. _("Minimum acceptable clearance value.")
  6824. )
  6825. self.form_layout_1.addRow(self.clearance_copper2copper_lbl, self.clearance_copper2copper_entry)
  6826. # Copper2outline clearance
  6827. self.clearance_copper2ol_cb = FCCheckBox('%s:' % _("Copper to Outline clearance"))
  6828. self.clearance_copper2ol_cb.setToolTip(
  6829. _("This checks if the minimum clearance between copper\n"
  6830. "features and the outline is met.")
  6831. )
  6832. self.form_layout_1.addRow(self.clearance_copper2ol_cb)
  6833. # Copper2outline clearance value
  6834. self.clearance_copper2ol_entry = FCDoubleSpinner()
  6835. self.clearance_copper2ol_entry.set_range(0.00001, 999.99999)
  6836. self.clearance_copper2ol_entry.set_precision(self.decimals)
  6837. self.clearance_copper2ol_entry.setSingleStep(0.1)
  6838. self.clearance_copper2ol_lbl = QtWidgets.QLabel('%s:' % _("Min value"))
  6839. self.clearance_copper2ol_lbl.setToolTip(
  6840. _("Minimum acceptable clearance value.")
  6841. )
  6842. self.form_layout_1.addRow(self.clearance_copper2ol_lbl, self.clearance_copper2ol_entry)
  6843. # Silkscreen2silkscreen clearance
  6844. self.clearance_silk2silk_cb = FCCheckBox('%s:' % _("Silk to Silk Clearance"))
  6845. self.clearance_silk2silk_cb.setToolTip(
  6846. _("This checks if the minimum clearance between silkscreen\n"
  6847. "features and silkscreen features is met.")
  6848. )
  6849. self.form_layout_1.addRow(self.clearance_silk2silk_cb)
  6850. # Copper2silkscreen clearance value
  6851. self.clearance_silk2silk_entry = FCDoubleSpinner()
  6852. self.clearance_silk2silk_entry.set_range(0.00001, 999.99999)
  6853. self.clearance_silk2silk_entry.set_precision(self.decimals)
  6854. self.clearance_silk2silk_entry.setSingleStep(0.1)
  6855. self.clearance_silk2silk_lbl = QtWidgets.QLabel('%s:' % _("Min value"))
  6856. self.clearance_silk2silk_lbl.setToolTip(
  6857. _("Minimum acceptable clearance value.")
  6858. )
  6859. self.form_layout_1.addRow(self.clearance_silk2silk_lbl, self.clearance_silk2silk_entry)
  6860. # Silkscreen2soldermask clearance
  6861. self.clearance_silk2sm_cb = FCCheckBox('%s:' % _("Silk to Solder Mask Clearance"))
  6862. self.clearance_silk2sm_cb.setToolTip(
  6863. _("This checks if the minimum clearance between silkscreen\n"
  6864. "features and soldermask features is met.")
  6865. )
  6866. self.form_layout_1.addRow(self.clearance_silk2sm_cb)
  6867. # Silkscreen2soldermask clearance value
  6868. self.clearance_silk2sm_entry = FCDoubleSpinner()
  6869. self.clearance_silk2sm_entry.set_range(0.00001, 999.99999)
  6870. self.clearance_silk2sm_entry.set_precision(self.decimals)
  6871. self.clearance_silk2sm_entry.setSingleStep(0.1)
  6872. self.clearance_silk2sm_lbl = QtWidgets.QLabel('%s:' % _("Min value"))
  6873. self.clearance_silk2sm_lbl.setToolTip(
  6874. _("Minimum acceptable clearance value.")
  6875. )
  6876. self.form_layout_1.addRow(self.clearance_silk2sm_lbl, self.clearance_silk2sm_entry)
  6877. # Silk2outline clearance
  6878. self.clearance_silk2ol_cb = FCCheckBox('%s:' % _("Silk to Outline Clearance"))
  6879. self.clearance_silk2ol_cb.setToolTip(
  6880. _("This checks if the minimum clearance between silk\n"
  6881. "features and the outline is met.")
  6882. )
  6883. self.form_layout_1.addRow(self.clearance_silk2ol_cb)
  6884. # Silk2outline clearance value
  6885. self.clearance_silk2ol_entry = FCDoubleSpinner()
  6886. self.clearance_silk2ol_entry.set_range(0.00001, 999.99999)
  6887. self.clearance_silk2ol_entry.set_precision(self.decimals)
  6888. self.clearance_silk2ol_entry.setSingleStep(0.1)
  6889. self.clearance_silk2ol_lbl = QtWidgets.QLabel('%s:' % _("Min value"))
  6890. self.clearance_silk2ol_lbl.setToolTip(
  6891. _("Minimum acceptable clearance value.")
  6892. )
  6893. self.form_layout_1.addRow(self.clearance_silk2ol_lbl, self.clearance_silk2ol_entry)
  6894. # Soldermask2soldermask clearance
  6895. self.clearance_sm2sm_cb = FCCheckBox('%s:' % _("Minimum Solder Mask Sliver"))
  6896. self.clearance_sm2sm_cb.setToolTip(
  6897. _("This checks if the minimum clearance between soldermask\n"
  6898. "features and soldermask features is met.")
  6899. )
  6900. self.form_layout_1.addRow(self.clearance_sm2sm_cb)
  6901. # Soldermask2soldermask clearance value
  6902. self.clearance_sm2sm_entry = FCDoubleSpinner()
  6903. self.clearance_sm2sm_entry.set_range(0.00001, 999.99999)
  6904. self.clearance_sm2sm_entry.set_precision(self.decimals)
  6905. self.clearance_sm2sm_entry.setSingleStep(0.1)
  6906. self.clearance_sm2sm_lbl = QtWidgets.QLabel('%s:' % _("Min value"))
  6907. self.clearance_sm2sm_lbl.setToolTip(
  6908. _("Minimum acceptable clearance value.")
  6909. )
  6910. self.form_layout_1.addRow(self.clearance_sm2sm_lbl, self.clearance_sm2sm_entry)
  6911. # Ring integrity check
  6912. self.ring_integrity_cb = FCCheckBox('%s:' % _("Minimum Annular Ring"))
  6913. self.ring_integrity_cb.setToolTip(
  6914. _("This checks if the minimum copper ring left by drilling\n"
  6915. "a hole into a pad is met.")
  6916. )
  6917. self.form_layout_1.addRow(self.ring_integrity_cb)
  6918. # Ring integrity value
  6919. self.ring_integrity_entry = FCDoubleSpinner()
  6920. self.ring_integrity_entry.set_range(0.00001, 999.99999)
  6921. self.ring_integrity_entry.set_precision(self.decimals)
  6922. self.ring_integrity_entry.setSingleStep(0.1)
  6923. self.ring_integrity_lbl = QtWidgets.QLabel('%s:' % _("Min value"))
  6924. self.ring_integrity_lbl.setToolTip(
  6925. _("Minimum acceptable ring value.")
  6926. )
  6927. self.form_layout_1.addRow(self.ring_integrity_lbl, self.ring_integrity_entry)
  6928. self.form_layout_1.addRow(QtWidgets.QLabel(""))
  6929. # Hole2Hole clearance
  6930. self.clearance_d2d_cb = FCCheckBox('%s:' % _("Hole to Hole Clearance"))
  6931. self.clearance_d2d_cb.setToolTip(
  6932. _("This checks if the minimum clearance between a drill hole\n"
  6933. "and another drill hole is met.")
  6934. )
  6935. self.form_layout_1.addRow(self.clearance_d2d_cb)
  6936. # Hole2Hole clearance value
  6937. self.clearance_d2d_entry = FCDoubleSpinner()
  6938. self.clearance_d2d_entry.set_range(0.00001, 999.99999)
  6939. self.clearance_d2d_entry.set_precision(self.decimals)
  6940. self.clearance_d2d_entry.setSingleStep(0.1)
  6941. self.clearance_d2d_lbl = QtWidgets.QLabel('%s:' % _("Min value"))
  6942. self.clearance_d2d_lbl.setToolTip(
  6943. _("Minimum acceptable drill size.")
  6944. )
  6945. self.form_layout_1.addRow(self.clearance_d2d_lbl, self.clearance_d2d_entry)
  6946. # Drill holes size check
  6947. self.drill_size_cb = FCCheckBox('%s:' % _("Hole Size"))
  6948. self.drill_size_cb.setToolTip(
  6949. _("This checks if the drill holes\n"
  6950. "sizes are above the threshold.")
  6951. )
  6952. self.form_layout_1.addRow(self.drill_size_cb)
  6953. # Drile holes value
  6954. self.drill_size_entry = FCDoubleSpinner()
  6955. self.drill_size_entry.set_range(0.00001, 999.99999)
  6956. self.drill_size_entry.set_precision(self.decimals)
  6957. self.drill_size_entry.setSingleStep(0.1)
  6958. self.drill_size_lbl = QtWidgets.QLabel('%s:' % _("Min value"))
  6959. self.drill_size_lbl.setToolTip(
  6960. _("Minimum acceptable clearance value.")
  6961. )
  6962. self.form_layout_1.addRow(self.drill_size_lbl, self.drill_size_entry)
  6963. self.layout.addStretch()
  6964. class Tools2OptimalPrefGroupUI(OptionsGroupUI):
  6965. def __init__(self, decimals=4, parent=None):
  6966. super(Tools2OptimalPrefGroupUI, self).__init__(self)
  6967. self.setTitle(str(_("Optimal Tool Options")))
  6968. self.decimals = decimals
  6969. # ## Parameters
  6970. self.optlabel = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  6971. self.optlabel.setToolTip(
  6972. _("A tool to find the minimum distance between\n"
  6973. "every two Gerber geometric elements")
  6974. )
  6975. self.layout.addWidget(self.optlabel)
  6976. grid0 = QtWidgets.QGridLayout()
  6977. self.layout.addLayout(grid0)
  6978. grid0.setColumnStretch(0, 0)
  6979. grid0.setColumnStretch(1, 1)
  6980. self.precision_sp = FCSpinner()
  6981. self.precision_sp.set_range(2, 10)
  6982. self.precision_sp.set_step(1)
  6983. self.precision_sp.setWrapping(True)
  6984. self.precision_lbl = QtWidgets.QLabel('%s:' % _("Precision"))
  6985. self.precision_lbl.setToolTip(
  6986. _("Number of decimals for the distances and coordinates in this tool.")
  6987. )
  6988. grid0.addWidget(self.precision_lbl, 0, 0)
  6989. grid0.addWidget(self.precision_sp, 0, 1)
  6990. self.layout.addStretch()
  6991. class Tools2QRCodePrefGroupUI(OptionsGroupUI):
  6992. def __init__(self, decimals=4, parent=None):
  6993. super(Tools2QRCodePrefGroupUI, self).__init__(self)
  6994. self.setTitle(str(_("QRCode Tool Options")))
  6995. self.decimals = decimals
  6996. # ## Parameters
  6997. self.qrlabel = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  6998. self.qrlabel.setToolTip(
  6999. _("A tool to create a QRCode that can be inserted\n"
  7000. "into a selected Gerber file, or it can be exported as a file.")
  7001. )
  7002. self.layout.addWidget(self.qrlabel)
  7003. # ## Grid Layout
  7004. grid_lay = QtWidgets.QGridLayout()
  7005. self.layout.addLayout(grid_lay)
  7006. grid_lay.setColumnStretch(0, 0)
  7007. grid_lay.setColumnStretch(1, 1)
  7008. # VERSION #
  7009. self.version_label = QtWidgets.QLabel('%s:' % _("Version"))
  7010. self.version_label.setToolTip(
  7011. _("QRCode version can have values from 1 (21x21 boxes)\n"
  7012. "to 40 (177x177 boxes).")
  7013. )
  7014. self.version_entry = FCSpinner()
  7015. self.version_entry.set_range(1, 40)
  7016. self.version_entry.setWrapping(True)
  7017. grid_lay.addWidget(self.version_label, 1, 0)
  7018. grid_lay.addWidget(self.version_entry, 1, 1)
  7019. # ERROR CORRECTION #
  7020. self.error_label = QtWidgets.QLabel('%s:' % _("Error correction"))
  7021. self.error_label.setToolTip(
  7022. _("Parameter that controls the error correction used for the QR Code.\n"
  7023. "L = maximum 7%% errors can be corrected\n"
  7024. "M = maximum 15%% errors can be corrected\n"
  7025. "Q = maximum 25%% errors can be corrected\n"
  7026. "H = maximum 30%% errors can be corrected.")
  7027. )
  7028. self.error_radio = RadioSet([{'label': 'L', 'value': 'L'},
  7029. {'label': 'M', 'value': 'M'},
  7030. {'label': 'Q', 'value': 'Q'},
  7031. {'label': 'H', 'value': 'H'}])
  7032. self.error_radio.setToolTip(
  7033. _("Parameter that controls the error correction used for the QR Code.\n"
  7034. "L = maximum 7%% errors can be corrected\n"
  7035. "M = maximum 15%% errors can be corrected\n"
  7036. "Q = maximum 25%% errors can be corrected\n"
  7037. "H = maximum 30%% errors can be corrected.")
  7038. )
  7039. grid_lay.addWidget(self.error_label, 2, 0)
  7040. grid_lay.addWidget(self.error_radio, 2, 1)
  7041. # BOX SIZE #
  7042. self.bsize_label = QtWidgets.QLabel('%s:' % _("Box Size"))
  7043. self.bsize_label.setToolTip(
  7044. _("Box size control the overall size of the QRcode\n"
  7045. "by adjusting the size of each box in the code.")
  7046. )
  7047. self.bsize_entry = FCSpinner()
  7048. self.bsize_entry.set_range(1, 9999)
  7049. self.bsize_entry.setWrapping(True)
  7050. grid_lay.addWidget(self.bsize_label, 3, 0)
  7051. grid_lay.addWidget(self.bsize_entry, 3, 1)
  7052. # BORDER SIZE #
  7053. self.border_size_label = QtWidgets.QLabel('%s:' % _("Border Size"))
  7054. self.border_size_label.setToolTip(
  7055. _("Size of the QRCode border. How many boxes thick is the border.\n"
  7056. "Default value is 4. The width of the clearance around the QRCode.")
  7057. )
  7058. self.border_size_entry = FCSpinner()
  7059. self.border_size_entry.set_range(1, 9999)
  7060. self.border_size_entry.setWrapping(True)
  7061. grid_lay.addWidget(self.border_size_label, 4, 0)
  7062. grid_lay.addWidget(self.border_size_entry, 4, 1)
  7063. # Text box
  7064. self.text_label = QtWidgets.QLabel('%s:' % _("QRCode Data"))
  7065. self.text_label.setToolTip(
  7066. _("QRCode Data. Alphanumeric text to be encoded in the QRCode.")
  7067. )
  7068. self.text_data = FCTextArea()
  7069. self.text_data.setPlaceholderText(
  7070. _("Add here the text to be included in the QRCode...")
  7071. )
  7072. grid_lay.addWidget(self.text_label, 5, 0)
  7073. grid_lay.addWidget(self.text_data, 6, 0, 1, 2)
  7074. # POLARITY CHOICE #
  7075. self.pol_label = QtWidgets.QLabel('%s:' % _("Polarity"))
  7076. self.pol_label.setToolTip(
  7077. _("Choose the polarity of the QRCode.\n"
  7078. "It can be drawn in a negative way (squares are clear)\n"
  7079. "or in a positive way (squares are opaque).")
  7080. )
  7081. self.pol_radio = RadioSet([{'label': _('Negative'), 'value': 'neg'},
  7082. {'label': _('Positive'), 'value': 'pos'}])
  7083. self.pol_radio.setToolTip(
  7084. _("Choose the type of QRCode to be created.\n"
  7085. "If added on a Silkscreen Gerber file the QRCode may\n"
  7086. "be added as positive. If it is added to a Copper Gerber\n"
  7087. "file then perhaps the QRCode can be added as negative.")
  7088. )
  7089. grid_lay.addWidget(self.pol_label, 7, 0)
  7090. grid_lay.addWidget(self.pol_radio, 7, 1)
  7091. # BOUNDING BOX TYPE #
  7092. self.bb_label = QtWidgets.QLabel('%s:' % _("Bounding Box"))
  7093. self.bb_label.setToolTip(
  7094. _("The bounding box, meaning the empty space that surrounds\n"
  7095. "the QRCode geometry, can have a rounded or a square shape.")
  7096. )
  7097. self.bb_radio = RadioSet([{'label': _('Rounded'), 'value': 'r'},
  7098. {'label': _('Square'), 'value': 's'}])
  7099. self.bb_radio.setToolTip(
  7100. _("The bounding box, meaning the empty space that surrounds\n"
  7101. "the QRCode geometry, can have a rounded or a square shape.")
  7102. )
  7103. grid_lay.addWidget(self.bb_label, 8, 0)
  7104. grid_lay.addWidget(self.bb_radio, 8, 1)
  7105. # FILL COLOR #
  7106. self.fill_color_label = QtWidgets.QLabel('%s:' % _('Fill Color'))
  7107. self.fill_color_label.setToolTip(
  7108. _("Set the QRCode fill color (squares color).")
  7109. )
  7110. self.fill_color_entry = FCEntry()
  7111. self.fill_color_button = QtWidgets.QPushButton()
  7112. self.fill_color_button.setFixedSize(15, 15)
  7113. fill_lay_child = QtWidgets.QHBoxLayout()
  7114. fill_lay_child.setContentsMargins(0, 0, 0, 0)
  7115. fill_lay_child.addWidget(self.fill_color_entry)
  7116. fill_lay_child.addWidget(self.fill_color_button, alignment=Qt.AlignRight)
  7117. fill_lay_child.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  7118. fill_color_widget = QtWidgets.QWidget()
  7119. fill_color_widget.setLayout(fill_lay_child)
  7120. grid_lay.addWidget(self.fill_color_label, 9, 0)
  7121. grid_lay.addWidget(fill_color_widget, 9, 1)
  7122. # BACK COLOR #
  7123. self.back_color_label = QtWidgets.QLabel('%s:' % _('Back Color'))
  7124. self.back_color_label.setToolTip(
  7125. _("Set the QRCode background color.")
  7126. )
  7127. self.back_color_entry = FCEntry()
  7128. self.back_color_button = QtWidgets.QPushButton()
  7129. self.back_color_button.setFixedSize(15, 15)
  7130. back_lay_child = QtWidgets.QHBoxLayout()
  7131. back_lay_child.setContentsMargins(0, 0, 0, 0)
  7132. back_lay_child.addWidget(self.back_color_entry)
  7133. back_lay_child.addWidget(self.back_color_button, alignment=Qt.AlignRight)
  7134. back_lay_child.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  7135. back_color_widget = QtWidgets.QWidget()
  7136. back_color_widget.setLayout(back_lay_child)
  7137. grid_lay.addWidget(self.back_color_label, 10, 0)
  7138. grid_lay.addWidget(back_color_widget, 10, 1)
  7139. # Selection Limit
  7140. self.sel_limit_label = QtWidgets.QLabel('%s:' % _("Selection limit"))
  7141. self.sel_limit_label.setToolTip(
  7142. _("Set the number of selected geometry\n"
  7143. "items above which the utility geometry\n"
  7144. "becomes just a selection rectangle.\n"
  7145. "Increases the performance when moving a\n"
  7146. "large number of geometric elements.")
  7147. )
  7148. self.sel_limit_entry = FCSpinner()
  7149. self.sel_limit_entry.set_range(0, 9999)
  7150. grid_lay.addWidget(self.sel_limit_label, 11, 0)
  7151. grid_lay.addWidget(self.sel_limit_entry, 11, 1)
  7152. # self.layout.addStretch()
  7153. class Tools2CThievingPrefGroupUI(OptionsGroupUI):
  7154. def __init__(self, decimals=4, parent=None):
  7155. super(Tools2CThievingPrefGroupUI, self).__init__(self)
  7156. self.setTitle(str(_("Copper Thieving Tool Options")))
  7157. self.decimals = decimals
  7158. # ## Grid Layout
  7159. grid_lay = QtWidgets.QGridLayout()
  7160. self.layout.addLayout(grid_lay)
  7161. grid_lay.setColumnStretch(0, 0)
  7162. grid_lay.setColumnStretch(1, 1)
  7163. # ## Parameters
  7164. self.cflabel = QtWidgets.QLabel('<b>%s</b>' % _('Parameters'))
  7165. self.cflabel.setToolTip(
  7166. _("A tool to generate a Copper Thieving that can be added\n"
  7167. "to a selected Gerber file.")
  7168. )
  7169. grid_lay.addWidget(self.cflabel, 0, 0, 1, 2)
  7170. # CIRCLE STEPS - to be used when buffering
  7171. self.circle_steps_lbl = QtWidgets.QLabel('%s:' % _("Circle Steps"))
  7172. self.circle_steps_lbl.setToolTip(
  7173. _("Number of steps (lines) used to interpolate circles.")
  7174. )
  7175. self.circlesteps_entry = FCSpinner()
  7176. self.circlesteps_entry.set_range(1, 9999)
  7177. grid_lay.addWidget(self.circle_steps_lbl, 1, 0)
  7178. grid_lay.addWidget(self.circlesteps_entry, 1, 1)
  7179. # CLEARANCE #
  7180. self.clearance_label = QtWidgets.QLabel('%s:' % _("Clearance"))
  7181. self.clearance_label.setToolTip(
  7182. _("This set the distance between the copper Thieving components\n"
  7183. "(the polygon fill may be split in multiple polygons)\n"
  7184. "and the copper traces in the Gerber file.")
  7185. )
  7186. self.clearance_entry = FCDoubleSpinner()
  7187. self.clearance_entry.setMinimum(0.00001)
  7188. self.clearance_entry.set_precision(self.decimals)
  7189. self.clearance_entry.setSingleStep(0.1)
  7190. grid_lay.addWidget(self.clearance_label, 2, 0)
  7191. grid_lay.addWidget(self.clearance_entry, 2, 1)
  7192. # MARGIN #
  7193. self.margin_label = QtWidgets.QLabel('%s:' % _("Margin"))
  7194. self.margin_label.setToolTip(
  7195. _("Bounding box margin.")
  7196. )
  7197. self.margin_entry = FCDoubleSpinner()
  7198. self.margin_entry.setMinimum(0.0)
  7199. self.margin_entry.set_precision(self.decimals)
  7200. self.margin_entry.setSingleStep(0.1)
  7201. grid_lay.addWidget(self.margin_label, 3, 0)
  7202. grid_lay.addWidget(self.margin_entry, 3, 1)
  7203. # Reference #
  7204. self.reference_radio = RadioSet([
  7205. {'label': _('Itself'), 'value': 'itself'},
  7206. {"label": _("Area Selection"), "value": "area"},
  7207. {'label': _("Reference Object"), 'value': 'box'}
  7208. ], orientation='vertical', stretch=False)
  7209. self.reference_label = QtWidgets.QLabel(_("Reference:"))
  7210. self.reference_label.setToolTip(
  7211. _("- 'Itself' - the copper Thieving extent is based on the object extent.\n"
  7212. "- 'Area Selection' - left mouse click to start selection of the area to be filled.\n"
  7213. "- 'Reference Object' - will do copper thieving within the area specified by another object.")
  7214. )
  7215. grid_lay.addWidget(self.reference_label, 4, 0)
  7216. grid_lay.addWidget(self.reference_radio, 4, 1)
  7217. # Bounding Box Type #
  7218. self.bbox_type_radio = RadioSet([
  7219. {'label': _('Rectangular'), 'value': 'rect'},
  7220. {"label": _("Minimal"), "value": "min"}
  7221. ], stretch=False)
  7222. self.bbox_type_label = QtWidgets.QLabel(_("Box Type:"))
  7223. self.bbox_type_label.setToolTip(
  7224. _("- 'Rectangular' - the bounding box will be of rectangular shape.\n"
  7225. "- 'Minimal' - the bounding box will be the convex hull shape.")
  7226. )
  7227. grid_lay.addWidget(self.bbox_type_label, 5, 0)
  7228. grid_lay.addWidget(self.bbox_type_radio, 5, 1)
  7229. separator_line = QtWidgets.QFrame()
  7230. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  7231. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  7232. grid_lay.addWidget(separator_line, 6, 0, 1, 2)
  7233. # Fill Type
  7234. self.fill_type_radio = RadioSet([
  7235. {'label': _('Solid'), 'value': 'solid'},
  7236. {"label": _("Dots Grid"), "value": "dot"},
  7237. {"label": _("Squares Grid"), "value": "square"},
  7238. {"label": _("Lines Grid"), "value": "line"}
  7239. ], orientation='vertical', stretch=False)
  7240. self.fill_type_label = QtWidgets.QLabel(_("Fill Type:"))
  7241. self.fill_type_label.setToolTip(
  7242. _("- 'Solid' - copper thieving will be a solid polygon.\n"
  7243. "- 'Dots Grid' - the empty area will be filled with a pattern of dots.\n"
  7244. "- 'Squares Grid' - the empty area will be filled with a pattern of squares.\n"
  7245. "- 'Lines Grid' - the empty area will be filled with a pattern of lines.")
  7246. )
  7247. grid_lay.addWidget(self.fill_type_label, 7, 0)
  7248. grid_lay.addWidget(self.fill_type_radio, 7, 1)
  7249. self.dots_label = QtWidgets.QLabel('<b>%s</b>:' % _("Dots Grid Parameters"))
  7250. grid_lay.addWidget(self.dots_label, 8, 0, 1, 2)
  7251. # Dot diameter #
  7252. self.dotdia_label = QtWidgets.QLabel('%s:' % _("Dia"))
  7253. self.dotdia_label.setToolTip(
  7254. _("Dot diameter in Dots Grid.")
  7255. )
  7256. self.dot_dia_entry = FCDoubleSpinner()
  7257. self.dot_dia_entry.set_range(0.0, 9999.9999)
  7258. self.dot_dia_entry.set_precision(self.decimals)
  7259. self.dot_dia_entry.setSingleStep(0.1)
  7260. grid_lay.addWidget(self.dotdia_label, 9, 0)
  7261. grid_lay.addWidget(self.dot_dia_entry, 9, 1)
  7262. # Dot spacing #
  7263. self.dotspacing_label = QtWidgets.QLabel('%s:' % _("Spacing"))
  7264. self.dotspacing_label.setToolTip(
  7265. _("Distance between each two dots in Dots Grid.")
  7266. )
  7267. self.dot_spacing_entry = FCDoubleSpinner()
  7268. self.dot_spacing_entry.set_range(0.0, 9999.9999)
  7269. self.dot_spacing_entry.set_precision(self.decimals)
  7270. self.dot_spacing_entry.setSingleStep(0.1)
  7271. grid_lay.addWidget(self.dotspacing_label, 10, 0)
  7272. grid_lay.addWidget(self.dot_spacing_entry, 10, 1)
  7273. self.squares_label = QtWidgets.QLabel('<b>%s</b>:' % _("Squares Grid Parameters"))
  7274. grid_lay.addWidget(self.squares_label, 11, 0, 1, 2)
  7275. # Square Size #
  7276. self.square_size_label = QtWidgets.QLabel('%s:' % _("Size"))
  7277. self.square_size_label.setToolTip(
  7278. _("Square side size in Squares Grid.")
  7279. )
  7280. self.square_size_entry = FCDoubleSpinner()
  7281. self.square_size_entry.set_range(0.0, 9999.9999)
  7282. self.square_size_entry.set_precision(self.decimals)
  7283. self.square_size_entry.setSingleStep(0.1)
  7284. grid_lay.addWidget(self.square_size_label, 12, 0)
  7285. grid_lay.addWidget(self.square_size_entry, 12, 1)
  7286. # Squares spacing #
  7287. self.squares_spacing_label = QtWidgets.QLabel('%s:' % _("Spacing"))
  7288. self.squares_spacing_label.setToolTip(
  7289. _("Distance between each two squares in Squares Grid.")
  7290. )
  7291. self.squares_spacing_entry = FCDoubleSpinner()
  7292. self.squares_spacing_entry.set_range(0.0, 9999.9999)
  7293. self.squares_spacing_entry.set_precision(self.decimals)
  7294. self.squares_spacing_entry.setSingleStep(0.1)
  7295. grid_lay.addWidget(self.squares_spacing_label, 13, 0)
  7296. grid_lay.addWidget(self.squares_spacing_entry, 13, 1)
  7297. self.lines_label = QtWidgets.QLabel('<b>%s</b>:' % _("Lines Grid Parameters"))
  7298. grid_lay.addWidget(self.lines_label, 14, 0, 1, 2)
  7299. # Square Size #
  7300. self.line_size_label = QtWidgets.QLabel('%s:' % _("Size"))
  7301. self.line_size_label.setToolTip(
  7302. _("Line thickness size in Lines Grid.")
  7303. )
  7304. self.line_size_entry = FCDoubleSpinner()
  7305. self.line_size_entry.set_range(0.0, 9999.9999)
  7306. self.line_size_entry.set_precision(self.decimals)
  7307. self.line_size_entry.setSingleStep(0.1)
  7308. grid_lay.addWidget(self.line_size_label, 15, 0)
  7309. grid_lay.addWidget(self.line_size_entry, 15, 1)
  7310. # Lines spacing #
  7311. self.lines_spacing_label = QtWidgets.QLabel('%s:' % _("Spacing"))
  7312. self.lines_spacing_label.setToolTip(
  7313. _("Distance between each two lines in Lines Grid.")
  7314. )
  7315. self.lines_spacing_entry = FCDoubleSpinner()
  7316. self.lines_spacing_entry.set_range(0.0, 9999.9999)
  7317. self.lines_spacing_entry.set_precision(self.decimals)
  7318. self.lines_spacing_entry.setSingleStep(0.1)
  7319. grid_lay.addWidget(self.lines_spacing_label, 16, 0)
  7320. grid_lay.addWidget(self.lines_spacing_entry, 16, 1)
  7321. self.robber_bar_label = QtWidgets.QLabel('<b>%s</b>' % _('Robber Bar Parameters'))
  7322. self.robber_bar_label.setToolTip(
  7323. _("Parameters used for the robber bar.\n"
  7324. "Robber bar = copper border to help in pattern hole plating.")
  7325. )
  7326. grid_lay.addWidget(self.robber_bar_label, 17, 0, 1, 2)
  7327. # ROBBER BAR MARGIN #
  7328. self.rb_margin_label = QtWidgets.QLabel('%s:' % _("Margin"))
  7329. self.rb_margin_label.setToolTip(
  7330. _("Bounding box margin for robber bar.")
  7331. )
  7332. self.rb_margin_entry = FCDoubleSpinner()
  7333. self.rb_margin_entry.set_range(-9999.9999, 9999.9999)
  7334. self.rb_margin_entry.set_precision(self.decimals)
  7335. self.rb_margin_entry.setSingleStep(0.1)
  7336. grid_lay.addWidget(self.rb_margin_label, 18, 0)
  7337. grid_lay.addWidget(self.rb_margin_entry, 18, 1)
  7338. # THICKNESS #
  7339. self.rb_thickness_label = QtWidgets.QLabel('%s:' % _("Thickness"))
  7340. self.rb_thickness_label.setToolTip(
  7341. _("The robber bar thickness.")
  7342. )
  7343. self.rb_thickness_entry = FCDoubleSpinner()
  7344. self.rb_thickness_entry.set_range(0.0000, 9999.9999)
  7345. self.rb_thickness_entry.set_precision(self.decimals)
  7346. self.rb_thickness_entry.setSingleStep(0.1)
  7347. grid_lay.addWidget(self.rb_thickness_label, 19, 0)
  7348. grid_lay.addWidget(self.rb_thickness_entry, 19, 1)
  7349. self.patern_mask_label = QtWidgets.QLabel('<b>%s</b>' % _('Pattern Plating Mask'))
  7350. self.patern_mask_label.setToolTip(
  7351. _("Generate a mask for pattern plating.")
  7352. )
  7353. grid_lay.addWidget(self.patern_mask_label, 20, 0, 1, 2)
  7354. # Openings CLEARANCE #
  7355. self.clearance_ppm_label = QtWidgets.QLabel('%s:' % _("Clearance"))
  7356. self.clearance_ppm_label.setToolTip(
  7357. _("The distance between the possible copper thieving elements\n"
  7358. "and/or robber bar and the actual openings in the mask.")
  7359. )
  7360. self.clearance_ppm_entry = FCDoubleSpinner()
  7361. self.clearance_ppm_entry.set_range(-9999.9999, 9999.9999)
  7362. self.clearance_ppm_entry.set_precision(self.decimals)
  7363. self.clearance_ppm_entry.setSingleStep(0.1)
  7364. grid_lay.addWidget(self.clearance_ppm_label, 21, 0)
  7365. grid_lay.addWidget(self.clearance_ppm_entry, 21, 1)
  7366. self.layout.addStretch()
  7367. class Tools2FiducialsPrefGroupUI(OptionsGroupUI):
  7368. def __init__(self, decimals=4, parent=None):
  7369. super(Tools2FiducialsPrefGroupUI, self).__init__(self)
  7370. self.setTitle(str(_("Fiducials Tool Options")))
  7371. self.decimals = decimals
  7372. # ## Grid Layout
  7373. grid_lay = QtWidgets.QGridLayout()
  7374. self.layout.addLayout(grid_lay)
  7375. grid_lay.setColumnStretch(0, 0)
  7376. grid_lay.setColumnStretch(1, 1)
  7377. self.param_label = QtWidgets.QLabel('<b>%s:</b>' % _('Parameters'))
  7378. self.param_label.setToolTip(
  7379. _("Parameters used for this tool.")
  7380. )
  7381. grid_lay.addWidget(self.param_label, 0, 0, 1, 2)
  7382. # DIAMETER #
  7383. self.dia_label = QtWidgets.QLabel('%s:' % _("Size"))
  7384. self.dia_label.setToolTip(
  7385. _("This set the fiducial diameter if fiducial type is circular,\n"
  7386. "otherwise is the size of the fiducial.\n"
  7387. "The soldermask opening is double than that.")
  7388. )
  7389. self.dia_entry = FCDoubleSpinner()
  7390. self.dia_entry.set_range(1.0000, 3.0000)
  7391. self.dia_entry.set_precision(self.decimals)
  7392. self.dia_entry.setWrapping(True)
  7393. self.dia_entry.setSingleStep(0.1)
  7394. grid_lay.addWidget(self.dia_label, 1, 0)
  7395. grid_lay.addWidget(self.dia_entry, 1, 1)
  7396. # MARGIN #
  7397. self.margin_label = QtWidgets.QLabel('%s:' % _("Margin"))
  7398. self.margin_label.setToolTip(
  7399. _("Bounding box margin.")
  7400. )
  7401. self.margin_entry = FCDoubleSpinner()
  7402. self.margin_entry.set_range(-9999.9999, 9999.9999)
  7403. self.margin_entry.set_precision(self.decimals)
  7404. self.margin_entry.setSingleStep(0.1)
  7405. grid_lay.addWidget(self.margin_label, 2, 0)
  7406. grid_lay.addWidget(self.margin_entry, 2, 1)
  7407. # Mode #
  7408. self.mode_radio = RadioSet([
  7409. {'label': _('Auto'), 'value': 'auto'},
  7410. {"label": _("Manual"), "value": "manual"}
  7411. ], stretch=False)
  7412. self.mode_label = QtWidgets.QLabel(_("Mode:"))
  7413. self.mode_label.setToolTip(
  7414. _("- 'Auto' - automatic placement of fiducials in the corners of the bounding box.\n"
  7415. "- 'Manual' - manual placement of fiducials.")
  7416. )
  7417. grid_lay.addWidget(self.mode_label, 3, 0)
  7418. grid_lay.addWidget(self.mode_radio, 3, 1)
  7419. # Position for second fiducial #
  7420. self.pos_radio = RadioSet([
  7421. {'label': _('Up'), 'value': 'up'},
  7422. {"label": _("Down"), "value": "down"},
  7423. {"label": _("None"), "value": "no"}
  7424. ], stretch=False)
  7425. self.pos_label = QtWidgets.QLabel('%s:' % _("Second fiducial"))
  7426. self.pos_label.setToolTip(
  7427. _("The position for the second fiducial.\n"
  7428. "- 'Up' - the order is: bottom-left, top-left, top-right.\n"
  7429. "- 'Down' - the order is: bottom-left, bottom-right, top-right.\n"
  7430. "- 'None' - there is no second fiducial. The order is: bottom-left, top-right.")
  7431. )
  7432. grid_lay.addWidget(self.pos_label, 4, 0)
  7433. grid_lay.addWidget(self.pos_radio, 4, 1)
  7434. separator_line = QtWidgets.QFrame()
  7435. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  7436. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  7437. grid_lay.addWidget(separator_line, 5, 0, 1, 2)
  7438. # Fiducial type #
  7439. self.fid_type_radio = RadioSet([
  7440. {'label': _('Circular'), 'value': 'circular'},
  7441. {"label": _("Cross"), "value": "cross"},
  7442. {"label": _("Chess"), "value": "chess"}
  7443. ], stretch=False)
  7444. self.fid_type_label = QtWidgets.QLabel('%s:' % _("Fiducial Type"))
  7445. self.fid_type_label.setToolTip(
  7446. _("The type of fiducial.\n"
  7447. "- 'Circular' - this is the regular fiducial.\n"
  7448. "- 'Cross' - cross lines fiducial.\n"
  7449. "- 'Chess' - chess pattern fiducial.")
  7450. )
  7451. grid_lay.addWidget(self.fid_type_label, 6, 0)
  7452. grid_lay.addWidget(self.fid_type_radio, 6, 1)
  7453. # Line Thickness #
  7454. self.line_thickness_label = QtWidgets.QLabel('%s:' % _("Line thickness"))
  7455. self.line_thickness_label.setToolTip(
  7456. _("Bounding box margin.")
  7457. )
  7458. self.line_thickness_entry = FCDoubleSpinner()
  7459. self.line_thickness_entry.set_range(0.00001, 9999.9999)
  7460. self.line_thickness_entry.set_precision(self.decimals)
  7461. self.line_thickness_entry.setSingleStep(0.1)
  7462. grid_lay.addWidget(self.line_thickness_label, 7, 0)
  7463. grid_lay.addWidget(self.line_thickness_entry, 7, 1)
  7464. self.layout.addStretch()
  7465. class Tools2CalPrefGroupUI(OptionsGroupUI):
  7466. def __init__(self, decimals=4, parent=None):
  7467. super(Tools2CalPrefGroupUI, self).__init__(self)
  7468. self.setTitle(str(_("Calibration Tool Options")))
  7469. self.decimals = decimals
  7470. # ## Grid Layout
  7471. grid_lay = QtWidgets.QGridLayout()
  7472. self.layout.addLayout(grid_lay)
  7473. grid_lay.setColumnStretch(0, 0)
  7474. grid_lay.setColumnStretch(1, 1)
  7475. self.param_label = QtWidgets.QLabel('<b>%s:</b>' % _('Parameters'))
  7476. self.param_label.setToolTip(
  7477. _("Parameters used for this tool.")
  7478. )
  7479. grid_lay.addWidget(self.param_label, 0, 0, 1, 2)
  7480. # Calibration source
  7481. self.cal_source_lbl = QtWidgets.QLabel("<b>%s:</b>" % _("Source Type"))
  7482. self.cal_source_lbl.setToolTip(_("The source of calibration points.\n"
  7483. "It can be:\n"
  7484. "- Object -> click a hole geo for Excellon or a pad for Gerber\n"
  7485. "- Free -> click freely on canvas to acquire the calibration points"))
  7486. self.cal_source_radio = RadioSet([{'label': _('Object'), 'value': 'object'},
  7487. {'label': _('Free'), 'value': 'free'}],
  7488. stretch=False)
  7489. grid_lay.addWidget(self.cal_source_lbl, 1, 0)
  7490. grid_lay.addWidget(self.cal_source_radio, 1, 1, 1, 2)
  7491. separator_line = QtWidgets.QFrame()
  7492. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  7493. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  7494. grid_lay.addWidget(separator_line, 2, 0, 1, 2)
  7495. # Travel Z entry
  7496. travelz_lbl = QtWidgets.QLabel('%s:' % _("Travel Z"))
  7497. travelz_lbl.setToolTip(
  7498. _("Height (Z) for travelling between the points.")
  7499. )
  7500. self.travelz_entry = FCDoubleSpinner()
  7501. self.travelz_entry.set_range(-9999.9999, 9999.9999)
  7502. self.travelz_entry.set_precision(self.decimals)
  7503. self.travelz_entry.setSingleStep(0.1)
  7504. grid_lay.addWidget(travelz_lbl, 3, 0)
  7505. grid_lay.addWidget(self.travelz_entry, 3, 1, 1, 2)
  7506. # Verification Z entry
  7507. verz_lbl = QtWidgets.QLabel('%s:' % _("Verification Z"))
  7508. verz_lbl.setToolTip(
  7509. _("Height (Z) for checking the point.")
  7510. )
  7511. self.verz_entry = FCDoubleSpinner()
  7512. self.verz_entry.set_range(-9999.9999, 9999.9999)
  7513. self.verz_entry.set_precision(self.decimals)
  7514. self.verz_entry.setSingleStep(0.1)
  7515. grid_lay.addWidget(verz_lbl, 4, 0)
  7516. grid_lay.addWidget(self.verz_entry, 4, 1, 1, 2)
  7517. # Zero the Z of the verification tool
  7518. self.zeroz_cb = FCCheckBox('%s' % _("Zero Z tool"))
  7519. self.zeroz_cb.setToolTip(
  7520. _("Include a sequence to zero the height (Z)\n"
  7521. "of the verification tool.")
  7522. )
  7523. grid_lay.addWidget(self.zeroz_cb, 5, 0, 1, 3)
  7524. # Toochange Z entry
  7525. toolchangez_lbl = QtWidgets.QLabel('%s:' % _("Toolchange Z"))
  7526. toolchangez_lbl.setToolTip(
  7527. _("Height (Z) for mounting the verification probe.")
  7528. )
  7529. self.toolchangez_entry = FCDoubleSpinner()
  7530. self.toolchangez_entry.set_range(0.0000, 9999.9999)
  7531. self.toolchangez_entry.set_precision(self.decimals)
  7532. self.toolchangez_entry.setSingleStep(0.1)
  7533. grid_lay.addWidget(toolchangez_lbl, 6, 0)
  7534. grid_lay.addWidget(self.toolchangez_entry, 6, 1, 1, 2)
  7535. # Toolchange X-Y entry
  7536. toolchangexy_lbl = QtWidgets.QLabel('%s:' % _('Toolchange X-Y'))
  7537. toolchangexy_lbl.setToolTip(
  7538. _("Toolchange X,Y position.\n"
  7539. "If no value is entered then the current\n"
  7540. "(x, y) point will be used,")
  7541. )
  7542. self.toolchange_xy_entry = FCEntry()
  7543. grid_lay.addWidget(toolchangexy_lbl, 7, 0)
  7544. grid_lay.addWidget(self.toolchange_xy_entry, 7, 1, 1, 2)
  7545. # Second point choice
  7546. second_point_lbl = QtWidgets.QLabel('%s:' % _("Second point"))
  7547. second_point_lbl.setToolTip(
  7548. _("Second point in the Gcode verification can be:\n"
  7549. "- top-left -> the user will align the PCB vertically\n"
  7550. "- bottom-right -> the user will align the PCB horizontally")
  7551. )
  7552. self.second_point_radio = RadioSet([{'label': _('Top-Left'), 'value': 'tl'},
  7553. {'label': _('Bottom-Right'), 'value': 'br'}],
  7554. orientation='vertical')
  7555. grid_lay.addWidget(second_point_lbl, 8, 0)
  7556. grid_lay.addWidget(self.second_point_radio, 8, 1, 1, 2)
  7557. self.layout.addStretch()
  7558. class Tools2EDrillsPrefGroupUI(OptionsGroupUI):
  7559. def __init__(self, decimals=4, parent=None):
  7560. super(Tools2EDrillsPrefGroupUI, self).__init__(self)
  7561. self.setTitle(str(_("Extract Drills Options")))
  7562. self.decimals = decimals
  7563. # ## Grid Layout
  7564. grid_lay = QtWidgets.QGridLayout()
  7565. self.layout.addLayout(grid_lay)
  7566. grid_lay.setColumnStretch(0, 0)
  7567. grid_lay.setColumnStretch(1, 1)
  7568. self.param_label = QtWidgets.QLabel('<b>%s:</b>' % _('Parameters'))
  7569. self.param_label.setToolTip(
  7570. _("Parameters used for this tool.")
  7571. )
  7572. grid_lay.addWidget(self.param_label, 0, 0, 1, 2)
  7573. self.padt_label = QtWidgets.QLabel("<b>%s:</b>" % _("Processed Pads Type"))
  7574. self.padt_label.setToolTip(
  7575. _("The type of pads shape to be processed.\n"
  7576. "If the PCB has many SMD pads with rectangular pads,\n"
  7577. "disable the Rectangular aperture.")
  7578. )
  7579. grid_lay.addWidget(self.padt_label, 2, 0, 1, 2)
  7580. # Circular Aperture Selection
  7581. self.circular_cb = FCCheckBox('%s' % _("Circular"))
  7582. self.circular_cb.setToolTip(
  7583. _("Process Circular Pads.")
  7584. )
  7585. grid_lay.addWidget(self.circular_cb, 3, 0, 1, 2)
  7586. # Oblong Aperture Selection
  7587. self.oblong_cb = FCCheckBox('%s' % _("Oblong"))
  7588. self.oblong_cb.setToolTip(
  7589. _("Process Oblong Pads.")
  7590. )
  7591. grid_lay.addWidget(self.oblong_cb, 4, 0, 1, 2)
  7592. # Square Aperture Selection
  7593. self.square_cb = FCCheckBox('%s' % _("Square"))
  7594. self.square_cb.setToolTip(
  7595. _("Process Square Pads.")
  7596. )
  7597. grid_lay.addWidget(self.square_cb, 5, 0, 1, 2)
  7598. # Rectangular Aperture Selection
  7599. self.rectangular_cb = FCCheckBox('%s' % _("Rectangular"))
  7600. self.rectangular_cb.setToolTip(
  7601. _("Process Rectangular Pads.")
  7602. )
  7603. grid_lay.addWidget(self.rectangular_cb, 6, 0, 1, 2)
  7604. # Others type of Apertures Selection
  7605. self.other_cb = FCCheckBox('%s' % _("Others"))
  7606. self.other_cb.setToolTip(
  7607. _("Process pads not in the categories above.")
  7608. )
  7609. grid_lay.addWidget(self.other_cb, 7, 0, 1, 2)
  7610. separator_line = QtWidgets.QFrame()
  7611. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  7612. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  7613. grid_lay.addWidget(separator_line, 8, 0, 1, 2)
  7614. # ## Axis
  7615. self.hole_size_radio = RadioSet(
  7616. [
  7617. {'label': _("Fixed Diameter"), 'value': 'fixed'},
  7618. {'label': _("Fixed Annular Ring"), 'value': 'ring'},
  7619. {'label': _("Proportional"), 'value': 'prop'}
  7620. ],
  7621. orientation='vertical',
  7622. stretch=False)
  7623. self.hole_size_label = QtWidgets.QLabel('<b>%s:</b>' % _("Method"))
  7624. self.hole_size_label.setToolTip(
  7625. _("The method for processing pads. Can be:\n"
  7626. "- Fixed Diameter -> all holes will have a set size\n"
  7627. "- Fixed Annular Ring -> all holes will have a set annular ring\n"
  7628. "- Proportional -> each hole size will be a fraction of the pad size"))
  7629. grid_lay.addWidget(self.hole_size_label, 9, 0)
  7630. grid_lay.addWidget(self.hole_size_radio, 9, 1)
  7631. # grid_lay1.addWidget(QtWidgets.QLabel(''))
  7632. separator_line = QtWidgets.QFrame()
  7633. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  7634. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  7635. grid_lay.addWidget(separator_line, 10, 0, 1, 2)
  7636. # Annular Ring
  7637. self.fixed_label = QtWidgets.QLabel('<b>%s</b>' % _("Fixed Diameter"))
  7638. grid_lay.addWidget(self.fixed_label, 11, 0, 1, 2)
  7639. # Diameter value
  7640. self.dia_entry = FCDoubleSpinner()
  7641. self.dia_entry.set_precision(self.decimals)
  7642. self.dia_entry.set_range(0.0000, 9999.9999)
  7643. self.dia_label = QtWidgets.QLabel('%s:' % _("Value"))
  7644. self.dia_label.setToolTip(
  7645. _("Fixed hole diameter.")
  7646. )
  7647. grid_lay.addWidget(self.dia_label, 12, 0)
  7648. grid_lay.addWidget(self.dia_entry, 12, 1)
  7649. # Annular Ring value
  7650. self.ring_label = QtWidgets.QLabel('<b>%s</b>' % _("Fixed Annular Ring"))
  7651. self.ring_label.setToolTip(
  7652. _("The size of annular ring.\n"
  7653. "The copper sliver between the hole exterior\n"
  7654. "and the margin of the copper pad.")
  7655. )
  7656. grid_lay.addWidget(self.ring_label, 13, 0, 1, 2)
  7657. # Circular Annular Ring Value
  7658. self.circular_ring_label = QtWidgets.QLabel('%s:' % _("Circular"))
  7659. self.circular_ring_label.setToolTip(
  7660. _("The size of annular ring for circular pads.")
  7661. )
  7662. self.circular_ring_entry = FCDoubleSpinner()
  7663. self.circular_ring_entry.set_precision(self.decimals)
  7664. self.circular_ring_entry.set_range(0.0000, 9999.9999)
  7665. grid_lay.addWidget(self.circular_ring_label, 14, 0)
  7666. grid_lay.addWidget(self.circular_ring_entry, 14, 1)
  7667. # Oblong Annular Ring Value
  7668. self.oblong_ring_label = QtWidgets.QLabel('%s:' % _("Oblong"))
  7669. self.oblong_ring_label.setToolTip(
  7670. _("The size of annular ring for oblong pads.")
  7671. )
  7672. self.oblong_ring_entry = FCDoubleSpinner()
  7673. self.oblong_ring_entry.set_precision(self.decimals)
  7674. self.oblong_ring_entry.set_range(0.0000, 9999.9999)
  7675. grid_lay.addWidget(self.oblong_ring_label, 15, 0)
  7676. grid_lay.addWidget(self.oblong_ring_entry, 15, 1)
  7677. # Square Annular Ring Value
  7678. self.square_ring_label = QtWidgets.QLabel('%s:' % _("Square"))
  7679. self.square_ring_label.setToolTip(
  7680. _("The size of annular ring for square pads.")
  7681. )
  7682. self.square_ring_entry = FCDoubleSpinner()
  7683. self.square_ring_entry.set_precision(self.decimals)
  7684. self.square_ring_entry.set_range(0.0000, 9999.9999)
  7685. grid_lay.addWidget(self.square_ring_label, 16, 0)
  7686. grid_lay.addWidget(self.square_ring_entry, 16, 1)
  7687. # Rectangular Annular Ring Value
  7688. self.rectangular_ring_label = QtWidgets.QLabel('%s:' % _("Rectangular"))
  7689. self.rectangular_ring_label.setToolTip(
  7690. _("The size of annular ring for rectangular pads.")
  7691. )
  7692. self.rectangular_ring_entry = FCDoubleSpinner()
  7693. self.rectangular_ring_entry.set_precision(self.decimals)
  7694. self.rectangular_ring_entry.set_range(0.0000, 9999.9999)
  7695. grid_lay.addWidget(self.rectangular_ring_label, 17, 0)
  7696. grid_lay.addWidget(self.rectangular_ring_entry, 17, 1)
  7697. # Others Annular Ring Value
  7698. self.other_ring_label = QtWidgets.QLabel('%s:' % _("Others"))
  7699. self.other_ring_label.setToolTip(
  7700. _("The size of annular ring for other pads.")
  7701. )
  7702. self.other_ring_entry = FCDoubleSpinner()
  7703. self.other_ring_entry.set_precision(self.decimals)
  7704. self.other_ring_entry.set_range(0.0000, 9999.9999)
  7705. grid_lay.addWidget(self.other_ring_label, 18, 0)
  7706. grid_lay.addWidget(self.other_ring_entry, 18, 1)
  7707. self.prop_label = QtWidgets.QLabel('<b>%s</b>' % _("Proportional Diameter"))
  7708. grid_lay.addWidget(self.prop_label, 19, 0, 1, 2)
  7709. # Factor value
  7710. self.factor_entry = FCDoubleSpinner(suffix='%')
  7711. self.factor_entry.set_precision(self.decimals)
  7712. self.factor_entry.set_range(0.0000, 100.0000)
  7713. self.factor_entry.setSingleStep(0.1)
  7714. self.factor_label = QtWidgets.QLabel('%s:' % _("Factor"))
  7715. self.factor_label.setToolTip(
  7716. _("Proportional Diameter.\n"
  7717. "The hole diameter will be a fraction of the pad size.")
  7718. )
  7719. grid_lay.addWidget(self.factor_label, 20, 0)
  7720. grid_lay.addWidget(self.factor_entry, 20, 1)
  7721. self.layout.addStretch()
  7722. class Tools2PunchGerberPrefGroupUI(OptionsGroupUI):
  7723. def __init__(self, decimals=4, parent=None):
  7724. super(Tools2PunchGerberPrefGroupUI, self).__init__(self)
  7725. self.setTitle(str(_("Punch Gerber Options")))
  7726. self.decimals = decimals
  7727. # ## Grid Layout
  7728. grid_lay = QtWidgets.QGridLayout()
  7729. self.layout.addLayout(grid_lay)
  7730. grid_lay.setColumnStretch(0, 0)
  7731. grid_lay.setColumnStretch(1, 1)
  7732. self.param_label = QtWidgets.QLabel('<b>%s:</b>' % _('Parameters'))
  7733. self.param_label.setToolTip(
  7734. _("Parameters used for this tool.")
  7735. )
  7736. grid_lay.addWidget(self.param_label, 0, 0, 1, 2)
  7737. self.padt_label = QtWidgets.QLabel("<b>%s:</b>" % _("Processed Pads Type"))
  7738. self.padt_label.setToolTip(
  7739. _("The type of pads shape to be processed.\n"
  7740. "If the PCB has many SMD pads with rectangular pads,\n"
  7741. "disable the Rectangular aperture.")
  7742. )
  7743. grid_lay.addWidget(self.padt_label, 2, 0, 1, 2)
  7744. # Circular Aperture Selection
  7745. self.circular_cb = FCCheckBox('%s' % _("Circular"))
  7746. self.circular_cb.setToolTip(
  7747. _("Process Circular Pads.")
  7748. )
  7749. grid_lay.addWidget(self.circular_cb, 3, 0, 1, 2)
  7750. # Oblong Aperture Selection
  7751. self.oblong_cb = FCCheckBox('%s' % _("Oblong"))
  7752. self.oblong_cb.setToolTip(
  7753. _("Process Oblong Pads.")
  7754. )
  7755. grid_lay.addWidget(self.oblong_cb, 4, 0, 1, 2)
  7756. # Square Aperture Selection
  7757. self.square_cb = FCCheckBox('%s' % _("Square"))
  7758. self.square_cb.setToolTip(
  7759. _("Process Square Pads.")
  7760. )
  7761. grid_lay.addWidget(self.square_cb, 5, 0, 1, 2)
  7762. # Rectangular Aperture Selection
  7763. self.rectangular_cb = FCCheckBox('%s' % _("Rectangular"))
  7764. self.rectangular_cb.setToolTip(
  7765. _("Process Rectangular Pads.")
  7766. )
  7767. grid_lay.addWidget(self.rectangular_cb, 6, 0, 1, 2)
  7768. # Others type of Apertures Selection
  7769. self.other_cb = FCCheckBox('%s' % _("Others"))
  7770. self.other_cb.setToolTip(
  7771. _("Process pads not in the categories above.")
  7772. )
  7773. grid_lay.addWidget(self.other_cb, 7, 0, 1, 2)
  7774. separator_line = QtWidgets.QFrame()
  7775. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  7776. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  7777. grid_lay.addWidget(separator_line, 8, 0, 1, 2)
  7778. # ## Axis
  7779. self.hole_size_radio = RadioSet(
  7780. [
  7781. {'label': _("Excellon"), 'value': 'exc'},
  7782. {'label': _("Fixed Diameter"), 'value': 'fixed'},
  7783. {'label': _("Fixed Annular Ring"), 'value': 'ring'},
  7784. {'label': _("Proportional"), 'value': 'prop'}
  7785. ],
  7786. orientation='vertical',
  7787. stretch=False)
  7788. self.hole_size_label = QtWidgets.QLabel('<b>%s:</b>' % _("Method"))
  7789. self.hole_size_label.setToolTip(
  7790. _("The punch hole source can be:\n"
  7791. "- Excellon Object-> the Excellon object drills center will serve as reference.\n"
  7792. "- Fixed Diameter -> will try to use the pads center as reference adding fixed diameter holes.\n"
  7793. "- Fixed Annular Ring -> will try to keep a set annular ring.\n"
  7794. "- Proportional -> will make a Gerber punch hole having the diameter a percentage of the pad diameter.")
  7795. )
  7796. grid_lay.addWidget(self.hole_size_label, 9, 0)
  7797. grid_lay.addWidget(self.hole_size_radio, 9, 1)
  7798. # grid_lay1.addWidget(QtWidgets.QLabel(''))
  7799. separator_line = QtWidgets.QFrame()
  7800. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  7801. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  7802. grid_lay.addWidget(separator_line, 10, 0, 1, 2)
  7803. # Annular Ring
  7804. self.fixed_label = QtWidgets.QLabel('<b>%s</b>' % _("Fixed Diameter"))
  7805. grid_lay.addWidget(self.fixed_label, 11, 0, 1, 2)
  7806. # Diameter value
  7807. self.dia_entry = FCDoubleSpinner()
  7808. self.dia_entry.set_precision(self.decimals)
  7809. self.dia_entry.set_range(0.0000, 9999.9999)
  7810. self.dia_label = QtWidgets.QLabel('%s:' % _("Value"))
  7811. self.dia_label.setToolTip(
  7812. _("Fixed hole diameter.")
  7813. )
  7814. grid_lay.addWidget(self.dia_label, 12, 0)
  7815. grid_lay.addWidget(self.dia_entry, 12, 1)
  7816. # Annular Ring value
  7817. self.ring_label = QtWidgets.QLabel('<b>%s</b>' % _("Fixed Annular Ring"))
  7818. self.ring_label.setToolTip(
  7819. _("The size of annular ring.\n"
  7820. "The copper sliver between the hole exterior\n"
  7821. "and the margin of the copper pad.")
  7822. )
  7823. grid_lay.addWidget(self.ring_label, 13, 0, 1, 2)
  7824. # Circular Annular Ring Value
  7825. self.circular_ring_label = QtWidgets.QLabel('%s:' % _("Circular"))
  7826. self.circular_ring_label.setToolTip(
  7827. _("The size of annular ring for circular pads.")
  7828. )
  7829. self.circular_ring_entry = FCDoubleSpinner()
  7830. self.circular_ring_entry.set_precision(self.decimals)
  7831. self.circular_ring_entry.set_range(0.0000, 9999.9999)
  7832. grid_lay.addWidget(self.circular_ring_label, 14, 0)
  7833. grid_lay.addWidget(self.circular_ring_entry, 14, 1)
  7834. # Oblong Annular Ring Value
  7835. self.oblong_ring_label = QtWidgets.QLabel('%s:' % _("Oblong"))
  7836. self.oblong_ring_label.setToolTip(
  7837. _("The size of annular ring for oblong pads.")
  7838. )
  7839. self.oblong_ring_entry = FCDoubleSpinner()
  7840. self.oblong_ring_entry.set_precision(self.decimals)
  7841. self.oblong_ring_entry.set_range(0.0000, 9999.9999)
  7842. grid_lay.addWidget(self.oblong_ring_label, 15, 0)
  7843. grid_lay.addWidget(self.oblong_ring_entry, 15, 1)
  7844. # Square Annular Ring Value
  7845. self.square_ring_label = QtWidgets.QLabel('%s:' % _("Square"))
  7846. self.square_ring_label.setToolTip(
  7847. _("The size of annular ring for square pads.")
  7848. )
  7849. self.square_ring_entry = FCDoubleSpinner()
  7850. self.square_ring_entry.set_precision(self.decimals)
  7851. self.square_ring_entry.set_range(0.0000, 9999.9999)
  7852. grid_lay.addWidget(self.square_ring_label, 16, 0)
  7853. grid_lay.addWidget(self.square_ring_entry, 16, 1)
  7854. # Rectangular Annular Ring Value
  7855. self.rectangular_ring_label = QtWidgets.QLabel('%s:' % _("Rectangular"))
  7856. self.rectangular_ring_label.setToolTip(
  7857. _("The size of annular ring for rectangular pads.")
  7858. )
  7859. self.rectangular_ring_entry = FCDoubleSpinner()
  7860. self.rectangular_ring_entry.set_precision(self.decimals)
  7861. self.rectangular_ring_entry.set_range(0.0000, 9999.9999)
  7862. grid_lay.addWidget(self.rectangular_ring_label, 17, 0)
  7863. grid_lay.addWidget(self.rectangular_ring_entry, 17, 1)
  7864. # Others Annular Ring Value
  7865. self.other_ring_label = QtWidgets.QLabel('%s:' % _("Others"))
  7866. self.other_ring_label.setToolTip(
  7867. _("The size of annular ring for other pads.")
  7868. )
  7869. self.other_ring_entry = FCDoubleSpinner()
  7870. self.other_ring_entry.set_precision(self.decimals)
  7871. self.other_ring_entry.set_range(0.0000, 9999.9999)
  7872. grid_lay.addWidget(self.other_ring_label, 18, 0)
  7873. grid_lay.addWidget(self.other_ring_entry, 18, 1)
  7874. self.prop_label = QtWidgets.QLabel('<b>%s</b>' % _("Proportional Diameter"))
  7875. grid_lay.addWidget(self.prop_label, 19, 0, 1, 2)
  7876. # Factor value
  7877. self.factor_entry = FCDoubleSpinner(suffix='%')
  7878. self.factor_entry.set_precision(self.decimals)
  7879. self.factor_entry.set_range(0.0000, 100.0000)
  7880. self.factor_entry.setSingleStep(0.1)
  7881. self.factor_label = QtWidgets.QLabel('%s:' % _("Factor"))
  7882. self.factor_label.setToolTip(
  7883. _("Proportional Diameter.\n"
  7884. "The hole diameter will be a fraction of the pad size.")
  7885. )
  7886. grid_lay.addWidget(self.factor_label, 20, 0)
  7887. grid_lay.addWidget(self.factor_entry, 20, 1)
  7888. self.layout.addStretch()
  7889. class Tools2InvertPrefGroupUI(OptionsGroupUI):
  7890. def __init__(self, decimals=4, parent=None):
  7891. super(Tools2InvertPrefGroupUI, self).__init__(self)
  7892. self.setTitle(str(_("Invert Gerber Tool Options")))
  7893. self.decimals = decimals
  7894. # ## Subtractor Tool Parameters
  7895. self.sublabel = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  7896. self.sublabel.setToolTip(
  7897. _("A tool to invert Gerber geometry from positive to negative\n"
  7898. "and in revers.")
  7899. )
  7900. self.layout.addWidget(self.sublabel)
  7901. # Grid Layout
  7902. grid0 = QtWidgets.QGridLayout()
  7903. grid0.setColumnStretch(0, 0)
  7904. grid0.setColumnStretch(1, 1)
  7905. self.layout.addLayout(grid0)
  7906. # Margin
  7907. self.margin_label = QtWidgets.QLabel('%s:' % _('Margin'))
  7908. self.margin_label.setToolTip(
  7909. _("Distance by which to avoid\n"
  7910. "the edges of the Gerber object.")
  7911. )
  7912. self.margin_entry = FCDoubleSpinner()
  7913. self.margin_entry.set_precision(self.decimals)
  7914. self.margin_entry.set_range(0.0000, 9999.9999)
  7915. self.margin_entry.setObjectName(_("Margin"))
  7916. grid0.addWidget(self.margin_label, 2, 0, 1, 2)
  7917. grid0.addWidget(self.margin_entry, 3, 0, 1, 2)
  7918. self.join_label = QtWidgets.QLabel('%s:' % _("Lines Join Style"))
  7919. self.join_label.setToolTip(
  7920. _("The way that the lines in the object outline will be joined.\n"
  7921. "Can be:\n"
  7922. "- rounded -> an arc is added between two joining lines\n"
  7923. "- square -> the lines meet in 90 degrees angle\n"
  7924. "- bevel -> the lines are joined by a third line")
  7925. )
  7926. self.join_radio = RadioSet([
  7927. {'label': 'Rounded', 'value': 'r'},
  7928. {'label': 'Square', 'value': 's'},
  7929. {'label': 'Bevel', 'value': 'b'}
  7930. ], orientation='vertical', stretch=False)
  7931. grid0.addWidget(self.join_label, 5, 0, 1, 2)
  7932. grid0.addWidget(self.join_radio, 7, 0, 1, 2)
  7933. self.layout.addStretch()
  7934. class FAExcPrefGroupUI(OptionsGroupUI):
  7935. def __init__(self, decimals=4, parent=None):
  7936. # OptionsGroupUI.__init__(self, "Excellon File associations Preferences", parent=None)
  7937. super().__init__(self)
  7938. self.setTitle(str(_("Excellon File associations")))
  7939. self.decimals = decimals
  7940. self.layout.setContentsMargins(2, 2, 2, 2)
  7941. self.vertical_lay = QtWidgets.QVBoxLayout()
  7942. scroll_widget = QtWidgets.QWidget()
  7943. scroll = VerticalScrollArea()
  7944. scroll.setWidget(scroll_widget)
  7945. scroll.setWidgetResizable(True)
  7946. scroll.setFrameShape(QtWidgets.QFrame.NoFrame)
  7947. self.restore_btn = FCButton(_("Restore"))
  7948. self.restore_btn.setToolTip(_("Restore the extension list to the default state."))
  7949. self.del_all_btn = FCButton(_("Delete All"))
  7950. self.del_all_btn.setToolTip(_("Delete all extensions from the list."))
  7951. hlay0 = QtWidgets.QHBoxLayout()
  7952. hlay0.addWidget(self.restore_btn)
  7953. hlay0.addWidget(self.del_all_btn)
  7954. self.vertical_lay.addLayout(hlay0)
  7955. # # ## Excellon associations
  7956. list_label = QtWidgets.QLabel("<b>%s:</b>" % _("Extensions list"))
  7957. list_label.setToolTip(
  7958. _("List of file extensions to be\n"
  7959. "associated with FlatCAM.")
  7960. )
  7961. self.vertical_lay.addWidget(list_label)
  7962. settings = QSettings("Open Source", "FlatCAM")
  7963. if settings.contains("textbox_font_size"):
  7964. tb_fsize = settings.value('textbox_font_size', type=int)
  7965. else:
  7966. tb_fsize = 10
  7967. self.exc_list_text = FCTextArea()
  7968. self.exc_list_text.setReadOnly(True)
  7969. # self.exc_list_text.sizeHint(custom_sizehint=150)
  7970. font = QtGui.QFont()
  7971. font.setPointSize(tb_fsize)
  7972. self.exc_list_text.setFont(font)
  7973. self.vertical_lay.addWidget(self.exc_list_text)
  7974. self.ext_label = QtWidgets.QLabel('%s:' % _("Extension"))
  7975. self.ext_label.setToolTip(_("A file extension to be added or deleted to the list."))
  7976. self.ext_entry = FCEntry()
  7977. hlay1 = QtWidgets.QHBoxLayout()
  7978. self.vertical_lay.addLayout(hlay1)
  7979. hlay1.addWidget(self.ext_label)
  7980. hlay1.addWidget(self.ext_entry)
  7981. self.add_btn = FCButton(_("Add Extension"))
  7982. self.add_btn.setToolTip(_("Add a file extension to the list"))
  7983. self.del_btn = FCButton(_("Delete Extension"))
  7984. self.del_btn.setToolTip(_("Delete a file extension from the list"))
  7985. hlay2 = QtWidgets.QHBoxLayout()
  7986. self.vertical_lay.addLayout(hlay2)
  7987. hlay2.addWidget(self.add_btn)
  7988. hlay2.addWidget(self.del_btn)
  7989. self.exc_list_btn = FCButton(_("Apply Association"))
  7990. self.exc_list_btn.setToolTip(_("Apply the file associations between\n"
  7991. "FlatCAM and the files with above extensions.\n"
  7992. "They will be active after next logon.\n"
  7993. "This work only in Windows."))
  7994. self.vertical_lay.addWidget(self.exc_list_btn)
  7995. scroll_widget.setLayout(self.vertical_lay)
  7996. self.layout.addWidget(scroll)
  7997. # self.vertical_lay.addStretch()
  7998. class FAGcoPrefGroupUI(OptionsGroupUI):
  7999. def __init__(self, decimals=4, parent=None):
  8000. # OptionsGroupUI.__init__(self, "Gcode File associations Preferences", parent=None)
  8001. super(FAGcoPrefGroupUI, self).__init__(self)
  8002. self.setTitle(str(_("GCode File associations")))
  8003. self.decimals = decimals
  8004. self.restore_btn = FCButton(_("Restore"))
  8005. self.restore_btn.setToolTip(_("Restore the extension list to the default state."))
  8006. self.del_all_btn = FCButton(_("Delete All"))
  8007. self.del_all_btn.setToolTip(_("Delete all extensions from the list."))
  8008. hlay0 = QtWidgets.QHBoxLayout()
  8009. self.layout.addLayout(hlay0)
  8010. hlay0.addWidget(self.restore_btn)
  8011. hlay0.addWidget(self.del_all_btn)
  8012. # ## G-Code associations
  8013. self.gco_list_label = QtWidgets.QLabel("<b>%s:</b>" % _("Extensions list"))
  8014. self.gco_list_label.setToolTip(
  8015. _("List of file extensions to be\n"
  8016. "associated with FlatCAM.")
  8017. )
  8018. self.layout.addWidget(self.gco_list_label)
  8019. settings = QSettings("Open Source", "FlatCAM")
  8020. if settings.contains("textbox_font_size"):
  8021. tb_fsize = settings.value('textbox_font_size', type=int)
  8022. else:
  8023. tb_fsize = 10
  8024. self.gco_list_text = FCTextArea()
  8025. self.gco_list_text.setReadOnly(True)
  8026. # self.gco_list_text.sizeHint(custom_sizehint=150)
  8027. font = QtGui.QFont()
  8028. font.setPointSize(tb_fsize)
  8029. self.gco_list_text.setFont(font)
  8030. self.layout.addWidget(self.gco_list_text)
  8031. self.ext_label = QtWidgets.QLabel('%s:' % _("Extension"))
  8032. self.ext_label.setToolTip(_("A file extension to be added or deleted to the list."))
  8033. self.ext_entry = FCEntry()
  8034. hlay1 = QtWidgets.QHBoxLayout()
  8035. self.layout.addLayout(hlay1)
  8036. hlay1.addWidget(self.ext_label)
  8037. hlay1.addWidget(self.ext_entry)
  8038. self.add_btn = FCButton(_("Add Extension"))
  8039. self.add_btn.setToolTip(_("Add a file extension to the list"))
  8040. self.del_btn = FCButton(_("Delete Extension"))
  8041. self.del_btn.setToolTip(_("Delete a file extension from the list"))
  8042. hlay2 = QtWidgets.QHBoxLayout()
  8043. self.layout.addLayout(hlay2)
  8044. hlay2.addWidget(self.add_btn)
  8045. hlay2.addWidget(self.del_btn)
  8046. self.gco_list_btn = FCButton(_("Apply Association"))
  8047. self.gco_list_btn.setToolTip(_("Apply the file associations between\n"
  8048. "FlatCAM and the files with above extensions.\n"
  8049. "They will be active after next logon.\n"
  8050. "This work only in Windows."))
  8051. self.layout.addWidget(self.gco_list_btn)
  8052. # self.layout.addStretch()
  8053. class FAGrbPrefGroupUI(OptionsGroupUI):
  8054. def __init__(self, decimals=4, parent=None):
  8055. # OptionsGroupUI.__init__(self, "Gerber File associations Preferences", parent=None)
  8056. super(FAGrbPrefGroupUI, self).__init__(self)
  8057. self.setTitle(str(_("Gerber File associations")))
  8058. self.decimals = decimals
  8059. self.restore_btn = FCButton(_("Restore"))
  8060. self.restore_btn.setToolTip(_("Restore the extension list to the default state."))
  8061. self.del_all_btn = FCButton(_("Delete All"))
  8062. self.del_all_btn.setToolTip(_("Delete all extensions from the list."))
  8063. hlay0 = QtWidgets.QHBoxLayout()
  8064. self.layout.addLayout(hlay0)
  8065. hlay0.addWidget(self.restore_btn)
  8066. hlay0.addWidget(self.del_all_btn)
  8067. # ## Gerber associations
  8068. self.grb_list_label = QtWidgets.QLabel("<b>%s:</b>" % _("Extensions list"))
  8069. self.grb_list_label.setToolTip(
  8070. _("List of file extensions to be\n"
  8071. "associated with FlatCAM.")
  8072. )
  8073. self.layout.addWidget(self.grb_list_label)
  8074. settings = QSettings("Open Source", "FlatCAM")
  8075. if settings.contains("textbox_font_size"):
  8076. tb_fsize = settings.value('textbox_font_size', type=int)
  8077. else:
  8078. tb_fsize = 10
  8079. self.grb_list_text = FCTextArea()
  8080. self.grb_list_text.setReadOnly(True)
  8081. # self.grb_list_text.sizeHint(custom_sizehint=150)
  8082. self.layout.addWidget(self.grb_list_text)
  8083. font = QtGui.QFont()
  8084. font.setPointSize(tb_fsize)
  8085. self.grb_list_text.setFont(font)
  8086. self.ext_label = QtWidgets.QLabel('%s:' % _("Extension"))
  8087. self.ext_label.setToolTip(_("A file extension to be added or deleted to the list."))
  8088. self.ext_entry = FCEntry()
  8089. hlay1 = QtWidgets.QHBoxLayout()
  8090. self.layout.addLayout(hlay1)
  8091. hlay1.addWidget(self.ext_label)
  8092. hlay1.addWidget(self.ext_entry)
  8093. self.add_btn = FCButton(_("Add Extension"))
  8094. self.add_btn.setToolTip(_("Add a file extension to the list"))
  8095. self.del_btn = FCButton(_("Delete Extension"))
  8096. self.del_btn.setToolTip(_("Delete a file extension from the list"))
  8097. hlay2 = QtWidgets.QHBoxLayout()
  8098. self.layout.addLayout(hlay2)
  8099. hlay2.addWidget(self.add_btn)
  8100. hlay2.addWidget(self.del_btn)
  8101. self.grb_list_btn = FCButton(_("Apply Association"))
  8102. self.grb_list_btn.setToolTip(_("Apply the file associations between\n"
  8103. "FlatCAM and the files with above extensions.\n"
  8104. "They will be active after next logon.\n"
  8105. "This work only in Windows."))
  8106. self.layout.addWidget(self.grb_list_btn)
  8107. # self.layout.addStretch()
  8108. class AutoCompletePrefGroupUI(OptionsGroupUI):
  8109. def __init__(self, decimals=4, parent=None):
  8110. # OptionsGroupUI.__init__(self, "Gerber File associations Preferences", parent=None)
  8111. super().__init__(self, parent=parent)
  8112. self.setTitle(str(_("Autocompleter Keywords")))
  8113. self.decimals = decimals
  8114. self.restore_btn = FCButton(_("Restore"))
  8115. self.restore_btn.setToolTip(_("Restore the autocompleter keywords list to the default state."))
  8116. self.del_all_btn = FCButton(_("Delete All"))
  8117. self.del_all_btn.setToolTip(_("Delete all autocompleter keywords from the list."))
  8118. hlay0 = QtWidgets.QHBoxLayout()
  8119. self.layout.addLayout(hlay0)
  8120. hlay0.addWidget(self.restore_btn)
  8121. hlay0.addWidget(self.del_all_btn)
  8122. # ## Gerber associations
  8123. self.grb_list_label = QtWidgets.QLabel("<b>%s:</b>" % _("Keywords list"))
  8124. self.grb_list_label.setToolTip(
  8125. _("List of keywords used by\n"
  8126. "the autocompleter in FlatCAM.\n"
  8127. "The autocompleter is installed\n"
  8128. "in the Code Editor and for the Tcl Shell.")
  8129. )
  8130. self.layout.addWidget(self.grb_list_label)
  8131. settings = QSettings("Open Source", "FlatCAM")
  8132. if settings.contains("textbox_font_size"):
  8133. tb_fsize = settings.value('textbox_font_size', type=int)
  8134. else:
  8135. tb_fsize = 10
  8136. self.kw_list_text = FCTextArea()
  8137. self.kw_list_text.setReadOnly(True)
  8138. # self.grb_list_text.sizeHint(custom_sizehint=150)
  8139. self.layout.addWidget(self.kw_list_text)
  8140. font = QtGui.QFont()
  8141. font.setPointSize(tb_fsize)
  8142. self.kw_list_text.setFont(font)
  8143. self.kw_label = QtWidgets.QLabel('%s:' % _("Extension"))
  8144. self.kw_label.setToolTip(_("A keyword to be added or deleted to the list."))
  8145. self.kw_entry = FCEntry()
  8146. hlay1 = QtWidgets.QHBoxLayout()
  8147. self.layout.addLayout(hlay1)
  8148. hlay1.addWidget(self.kw_label)
  8149. hlay1.addWidget(self.kw_entry)
  8150. self.add_btn = FCButton(_("Add keyword"))
  8151. self.add_btn.setToolTip(_("Add a keyword to the list"))
  8152. self.del_btn = FCButton(_("Delete keyword"))
  8153. self.del_btn.setToolTip(_("Delete a keyword from the list"))
  8154. hlay2 = QtWidgets.QHBoxLayout()
  8155. self.layout.addLayout(hlay2)
  8156. hlay2.addWidget(self.add_btn)
  8157. hlay2.addWidget(self.del_btn)
  8158. # self.layout.addStretch()