PreferencesUI.py 325 KB

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