PreferencesUI.py 351 KB

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