PreferencesUI.py 200 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846
  1. from PyQt5.QtCore import QSettings
  2. from flatcamGUI.GUIElements import *
  3. import platform
  4. import webbrowser
  5. import sys
  6. from flatcamEditors.FlatCAMGeoEditor import FCShapeTool
  7. import gettext
  8. import FlatCAMTranslation as fcTranslate
  9. import builtins
  10. fcTranslate.apply_language('strings')
  11. if '_' not in builtins.__dict__:
  12. _ = gettext.gettext
  13. class OptionsGroupUI(QtWidgets.QGroupBox):
  14. def __init__(self, title, parent=None):
  15. # QtGui.QGroupBox.__init__(self, title, parent=parent)
  16. super(OptionsGroupUI, self).__init__()
  17. self.setStyleSheet("""
  18. QGroupBox
  19. {
  20. font-size: 16px;
  21. font-weight: bold;
  22. }
  23. """)
  24. self.layout = QtWidgets.QVBoxLayout()
  25. self.setLayout(self.layout)
  26. class GeneralPreferencesUI(QtWidgets.QWidget):
  27. def __init__(self, parent=None):
  28. QtWidgets.QWidget.__init__(self, parent=parent)
  29. self.layout = QtWidgets.QHBoxLayout()
  30. self.setLayout(self.layout)
  31. self.general_app_group = GeneralAppPrefGroupUI()
  32. self.general_app_group.setMinimumWidth(290)
  33. self.general_gui_group = GeneralGUIPrefGroupUI()
  34. self.general_gui_group.setMinimumWidth(250)
  35. self.general_gui_set_group = GeneralGUISetGroupUI()
  36. self.general_gui_set_group.setMinimumWidth(250)
  37. self.layout.addWidget(self.general_app_group)
  38. self.layout.addWidget(self.general_gui_group)
  39. self.layout.addWidget(self.general_gui_set_group)
  40. self.layout.addStretch()
  41. class GerberPreferencesUI(QtWidgets.QWidget):
  42. def __init__(self, parent=None):
  43. QtWidgets.QWidget.__init__(self, parent=parent)
  44. self.layout = QtWidgets.QHBoxLayout()
  45. self.setLayout(self.layout)
  46. self.gerber_gen_group = GerberGenPrefGroupUI()
  47. self.gerber_gen_group.setMinimumWidth(250)
  48. self.gerber_opt_group = GerberOptPrefGroupUI()
  49. self.gerber_opt_group.setMinimumWidth(250)
  50. self.gerber_exp_group = GerberExpPrefGroupUI()
  51. self.gerber_exp_group.setMinimumWidth(230)
  52. self.gerber_adv_opt_group = GerberAdvOptPrefGroupUI()
  53. self.gerber_adv_opt_group.setMinimumWidth(200)
  54. self.gerber_editor_group = GerberEditorPrefGroupUI()
  55. self.gerber_editor_group.setMinimumWidth(200)
  56. self.vlay = QtWidgets.QVBoxLayout()
  57. self.vlay.addWidget(self.gerber_opt_group)
  58. self.vlay.addWidget(self.gerber_exp_group)
  59. self.layout.addWidget(self.gerber_gen_group)
  60. self.layout.addLayout(self.vlay)
  61. self.layout.addWidget(self.gerber_adv_opt_group)
  62. self.layout.addWidget(self.gerber_editor_group)
  63. self.layout.addStretch()
  64. class ExcellonPreferencesUI(QtWidgets.QWidget):
  65. def __init__(self, parent=None):
  66. QtWidgets.QWidget.__init__(self, parent=parent)
  67. self.layout = QtWidgets.QHBoxLayout()
  68. self.setLayout(self.layout)
  69. self.excellon_gen_group = ExcellonGenPrefGroupUI()
  70. self.excellon_gen_group.setMinimumWidth(220)
  71. self.excellon_opt_group = ExcellonOptPrefGroupUI()
  72. self.excellon_opt_group.setMinimumWidth(290)
  73. self.excellon_exp_group = ExcellonExpPrefGroupUI()
  74. self.excellon_exp_group.setMinimumWidth(250)
  75. self.excellon_adv_opt_group = ExcellonAdvOptPrefGroupUI()
  76. self.excellon_adv_opt_group.setMinimumWidth(250)
  77. self.excellon_editor_group = ExcellonEditorPrefGroupUI()
  78. self.excellon_editor_group.setMinimumWidth(260)
  79. self.vlay = QtWidgets.QVBoxLayout()
  80. self.vlay.addWidget(self.excellon_opt_group)
  81. self.vlay.addWidget(self.excellon_exp_group)
  82. self.layout.addWidget(self.excellon_gen_group)
  83. self.layout.addLayout(self.vlay)
  84. self.layout.addWidget(self.excellon_adv_opt_group)
  85. self.layout.addWidget(self.excellon_editor_group)
  86. self.layout.addStretch()
  87. class GeometryPreferencesUI(QtWidgets.QWidget):
  88. def __init__(self, parent=None):
  89. QtWidgets.QWidget.__init__(self, parent=parent)
  90. self.layout = QtWidgets.QHBoxLayout()
  91. self.setLayout(self.layout)
  92. self.geometry_gen_group = GeometryGenPrefGroupUI()
  93. self.geometry_gen_group.setMinimumWidth(220)
  94. self.geometry_opt_group = GeometryOptPrefGroupUI()
  95. self.geometry_opt_group.setMinimumWidth(300)
  96. self.geometry_adv_opt_group = GeometryAdvOptPrefGroupUI()
  97. self.geometry_adv_opt_group.setMinimumWidth(270)
  98. self.geometry_editor_group = GeometryEditorPrefGroupUI()
  99. self.geometry_editor_group.setMinimumWidth(250)
  100. self.layout.addWidget(self.geometry_gen_group)
  101. self.layout.addWidget(self.geometry_opt_group)
  102. self.layout.addWidget(self.geometry_adv_opt_group)
  103. self.layout.addWidget(self.geometry_editor_group)
  104. self.layout.addStretch()
  105. class ToolsPreferencesUI(QtWidgets.QWidget):
  106. def __init__(self, parent=None):
  107. QtWidgets.QWidget.__init__(self, parent=parent)
  108. self.layout = QtWidgets.QHBoxLayout()
  109. self.setLayout(self.layout)
  110. self.tools_ncc_group = ToolsNCCPrefGroupUI()
  111. self.tools_ncc_group.setMinimumWidth(220)
  112. self.tools_paint_group = ToolsPaintPrefGroupUI()
  113. self.tools_paint_group.setMinimumWidth(220)
  114. self.tools_cutout_group = ToolsCutoutPrefGroupUI()
  115. self.tools_cutout_group.setMinimumWidth(220)
  116. self.tools_2sided_group = Tools2sidedPrefGroupUI()
  117. self.tools_2sided_group.setMinimumWidth(220)
  118. self.tools_film_group = ToolsFilmPrefGroupUI()
  119. self.tools_film_group.setMinimumWidth(220)
  120. self.tools_panelize_group = ToolsPanelizePrefGroupUI()
  121. self.tools_panelize_group.setMinimumWidth(220)
  122. self.tools_calculators_group = ToolsCalculatorsPrefGroupUI()
  123. self.tools_calculators_group.setMinimumWidth(220)
  124. self.tools_transform_group = ToolsTransformPrefGroupUI()
  125. self.tools_transform_group.setMinimumWidth(200)
  126. self.tools_solderpaste_group = ToolsSolderpastePrefGroupUI()
  127. self.tools_solderpaste_group.setMinimumWidth(200)
  128. self.tools_sub_group = ToolsSubPrefGroupUI()
  129. self.tools_sub_group.setMinimumWidth(200)
  130. self.vlay = QtWidgets.QVBoxLayout()
  131. self.vlay.addWidget(self.tools_ncc_group)
  132. self.vlay.addWidget(self.tools_paint_group)
  133. self.vlay1 = QtWidgets.QVBoxLayout()
  134. self.vlay1.addWidget(self.tools_cutout_group)
  135. self.vlay1.addWidget(self.tools_transform_group)
  136. self.vlay1.addWidget(self.tools_2sided_group)
  137. self.vlay2 = QtWidgets.QVBoxLayout()
  138. self.vlay2.addWidget(self.tools_panelize_group)
  139. self.vlay2.addWidget(self.tools_calculators_group)
  140. self.vlay3 = QtWidgets.QVBoxLayout()
  141. self.vlay3.addWidget(self.tools_solderpaste_group)
  142. self.vlay3.addWidget(self.tools_sub_group)
  143. self.vlay3.addWidget(self.tools_film_group)
  144. self.layout.addLayout(self.vlay)
  145. self.layout.addLayout(self.vlay1)
  146. self.layout.addLayout(self.vlay2)
  147. self.layout.addLayout(self.vlay3)
  148. self.layout.addStretch()
  149. class CNCJobPreferencesUI(QtWidgets.QWidget):
  150. def __init__(self, parent=None):
  151. QtWidgets.QWidget.__init__(self, parent=parent)
  152. self.layout = QtWidgets.QHBoxLayout()
  153. self.setLayout(self.layout)
  154. self.cncjob_gen_group = CNCJobGenPrefGroupUI()
  155. self.cncjob_gen_group.setMinimumWidth(320)
  156. self.cncjob_opt_group = CNCJobOptPrefGroupUI()
  157. self.cncjob_opt_group.setMinimumWidth(260)
  158. self.cncjob_adv_opt_group = CNCJobAdvOptPrefGroupUI()
  159. self.cncjob_adv_opt_group.setMinimumWidth(260)
  160. self.layout.addWidget(self.cncjob_gen_group)
  161. self.layout.addWidget(self.cncjob_opt_group)
  162. self.layout.addWidget(self.cncjob_adv_opt_group)
  163. self.layout.addStretch()
  164. class UtilPreferencesUI(QtWidgets.QWidget):
  165. def __init__(self, parent=None):
  166. QtWidgets.QWidget.__init__(self, parent=parent)
  167. self.layout = QtWidgets.QHBoxLayout()
  168. self.setLayout(self.layout)
  169. self.vlay = QtWidgets.QVBoxLayout()
  170. self.fa_excellon_group = FAExcPrefGroupUI()
  171. self.fa_excellon_group.setMinimumWidth(260)
  172. self.fa_gcode_group = FAGcoPrefGroupUI()
  173. self.fa_gcode_group.setMinimumWidth(260)
  174. self.vlay.addWidget(self.fa_excellon_group)
  175. self.vlay.addWidget(self.fa_gcode_group)
  176. self.fa_gerber_group = FAGrbPrefGroupUI()
  177. self.fa_gerber_group.setMinimumWidth(260)
  178. self.kw_group = AutoCompletePrefGroupUI()
  179. self.kw_group.setMinimumWidth(260)
  180. self.layout.addLayout(self.vlay)
  181. self.layout.addWidget(self.fa_gerber_group)
  182. self.layout.addWidget(self.kw_group)
  183. self.layout.addStretch()
  184. class GeneralGUIPrefGroupUI(OptionsGroupUI):
  185. def __init__(self, parent=None):
  186. super(GeneralGUIPrefGroupUI, self).__init__(self)
  187. self.setTitle(str(_("GUI Preferences")))
  188. # Create a form layout for the Application general settings
  189. self.form_box = QtWidgets.QFormLayout()
  190. # Grid X Entry
  191. self.gridx_label = QtWidgets.QLabel('%s:' % _('Grid X value'))
  192. self.gridx_label.setToolTip(
  193. _("This is the Grid snap value on X axis.")
  194. )
  195. self.gridx_entry = FCEntry3()
  196. # Grid Y Entry
  197. self.gridy_label = QtWidgets.QLabel('%s:' % _('Grid Y value'))
  198. self.gridy_label.setToolTip(
  199. _("This is the Grid snap value on Y axis.")
  200. )
  201. self.gridy_entry = FCEntry3()
  202. # Snap Max Entry
  203. self.snap_max_label = QtWidgets.QLabel('%s:' % _('Snap Max'))
  204. self.snap_max_label.setToolTip(_("Max. magnet distance"))
  205. self.snap_max_dist_entry = FCEntry()
  206. # Workspace
  207. self.workspace_lbl = QtWidgets.QLabel('%s:' % _('Workspace'))
  208. self.workspace_lbl.setToolTip(
  209. _("Draw a delimiting rectangle on canvas.\n"
  210. "The purpose is to illustrate the limits for our work.")
  211. )
  212. self.workspace_type_lbl = QtWidgets.QLabel('%s:' % _('Wk. format'))
  213. self.workspace_type_lbl.setToolTip(
  214. _("Select the type of rectangle to be used on canvas,\n"
  215. "as valid workspace.")
  216. )
  217. self.workspace_cb = FCCheckBox()
  218. self.wk_cb = FCComboBox()
  219. self.wk_cb.addItem('A4P')
  220. self.wk_cb.addItem('A4L')
  221. self.wk_cb.addItem('A3P')
  222. self.wk_cb.addItem('A3L')
  223. self.wks = OptionalInputSection(self.workspace_cb, [self.workspace_type_lbl, self.wk_cb])
  224. # Plot Fill Color
  225. self.pf_color_label = QtWidgets.QLabel('%s:' % _('Plot Fill'))
  226. self.pf_color_label.setToolTip(
  227. _("Set the fill color for plotted objects.\n"
  228. "First 6 digits are the color and the last 2\n"
  229. "digits are for alpha (transparency) level.")
  230. )
  231. self.pf_color_entry = FCEntry()
  232. self.pf_color_button = QtWidgets.QPushButton()
  233. self.pf_color_button.setFixedSize(15, 15)
  234. self.form_box_child_1 = QtWidgets.QHBoxLayout()
  235. self.form_box_child_1.addWidget(self.pf_color_entry)
  236. self.form_box_child_1.addWidget(self.pf_color_button)
  237. self.form_box_child_1.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  238. # Plot Fill Transparency Level
  239. self.pf_alpha_label = QtWidgets.QLabel('%s:' % _('Alpha Level'))
  240. self.pf_alpha_label.setToolTip(
  241. _("Set the fill transparency for plotted objects.")
  242. )
  243. self.pf_color_alpha_slider = QtWidgets.QSlider(QtCore.Qt.Horizontal)
  244. self.pf_color_alpha_slider.setMinimum(0)
  245. self.pf_color_alpha_slider.setMaximum(255)
  246. self.pf_color_alpha_slider.setSingleStep(1)
  247. self.pf_color_alpha_spinner = FCSpinner()
  248. self.pf_color_alpha_spinner.setMinimumWidth(70)
  249. self.pf_color_alpha_spinner.setMinimum(0)
  250. self.pf_color_alpha_spinner.setMaximum(255)
  251. self.form_box_child_2 = QtWidgets.QHBoxLayout()
  252. self.form_box_child_2.addWidget(self.pf_color_alpha_slider)
  253. self.form_box_child_2.addWidget(self.pf_color_alpha_spinner)
  254. # Plot Line Color
  255. self.pl_color_label = QtWidgets.QLabel('%s:' % _('Plot Line'))
  256. self.pl_color_label.setToolTip(
  257. _("Set the line color for plotted objects.")
  258. )
  259. self.pl_color_entry = FCEntry()
  260. self.pl_color_button = QtWidgets.QPushButton()
  261. self.pl_color_button.setFixedSize(15, 15)
  262. self.form_box_child_3 = QtWidgets.QHBoxLayout()
  263. self.form_box_child_3.addWidget(self.pl_color_entry)
  264. self.form_box_child_3.addWidget(self.pl_color_button)
  265. self.form_box_child_3.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  266. # Plot Selection (left - right) Fill Color
  267. self.sf_color_label = QtWidgets.QLabel('%s:' % _('Sel. Fill'))
  268. self.sf_color_label.setToolTip(
  269. _("Set the fill color for the selection box\n"
  270. "in case that the selection is done from left to right.\n"
  271. "First 6 digits are the color and the last 2\n"
  272. "digits are for alpha (transparency) level.")
  273. )
  274. self.sf_color_entry = FCEntry()
  275. self.sf_color_button = QtWidgets.QPushButton()
  276. self.sf_color_button.setFixedSize(15, 15)
  277. self.form_box_child_4 = QtWidgets.QHBoxLayout()
  278. self.form_box_child_4.addWidget(self.sf_color_entry)
  279. self.form_box_child_4.addWidget(self.sf_color_button)
  280. self.form_box_child_4.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  281. # Plot Selection (left - right) Fill Transparency Level
  282. self.sf_alpha_label = QtWidgets.QLabel('%s:' % _('Alpha Level'))
  283. self.sf_alpha_label.setToolTip(
  284. _("Set the fill transparency for the 'left to right' selection box.")
  285. )
  286. self.sf_color_alpha_slider = QtWidgets.QSlider(QtCore.Qt.Horizontal)
  287. self.sf_color_alpha_slider.setMinimum(0)
  288. self.sf_color_alpha_slider.setMaximum(255)
  289. self.sf_color_alpha_slider.setSingleStep(1)
  290. self.sf_color_alpha_spinner = FCSpinner()
  291. self.sf_color_alpha_spinner.setMinimumWidth(70)
  292. self.sf_color_alpha_spinner.setMinimum(0)
  293. self.sf_color_alpha_spinner.setMaximum(255)
  294. self.form_box_child_5 = QtWidgets.QHBoxLayout()
  295. self.form_box_child_5.addWidget(self.sf_color_alpha_slider)
  296. self.form_box_child_5.addWidget(self.sf_color_alpha_spinner)
  297. # Plot Selection (left - right) Line Color
  298. self.sl_color_label = QtWidgets.QLabel('%s:' % _('Sel. Line'))
  299. self.sl_color_label.setToolTip(
  300. _("Set the line color for the 'left to right' selection box.")
  301. )
  302. self.sl_color_entry = FCEntry()
  303. self.sl_color_button = QtWidgets.QPushButton()
  304. self.sl_color_button.setFixedSize(15, 15)
  305. self.form_box_child_6 = QtWidgets.QHBoxLayout()
  306. self.form_box_child_6.addWidget(self.sl_color_entry)
  307. self.form_box_child_6.addWidget(self.sl_color_button)
  308. self.form_box_child_6.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  309. # Plot Selection (right - left) Fill Color
  310. self.alt_sf_color_label = QtWidgets.QLabel('%s:' % _('Sel2. Fill'))
  311. self.alt_sf_color_label.setToolTip(
  312. _("Set the fill color for the selection box\n"
  313. "in case that the selection is done from right to left.\n"
  314. "First 6 digits are the color and the last 2\n"
  315. "digits are for alpha (transparency) level.")
  316. )
  317. self.alt_sf_color_entry = FCEntry()
  318. self.alt_sf_color_button = QtWidgets.QPushButton()
  319. self.alt_sf_color_button.setFixedSize(15, 15)
  320. self.form_box_child_7 = QtWidgets.QHBoxLayout()
  321. self.form_box_child_7.addWidget(self.alt_sf_color_entry)
  322. self.form_box_child_7.addWidget(self.alt_sf_color_button)
  323. self.form_box_child_7.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  324. # Plot Selection (right - left) Fill Transparency Level
  325. self.alt_sf_alpha_label = QtWidgets.QLabel('%s:' % _('Alpha Level'))
  326. self.alt_sf_alpha_label.setToolTip(
  327. _("Set the fill transparency for selection 'right to left' box.")
  328. )
  329. self.alt_sf_color_alpha_slider = QtWidgets.QSlider(QtCore.Qt.Horizontal)
  330. self.alt_sf_color_alpha_slider.setMinimum(0)
  331. self.alt_sf_color_alpha_slider.setMaximum(255)
  332. self.alt_sf_color_alpha_slider.setSingleStep(1)
  333. self.alt_sf_color_alpha_spinner = FCSpinner()
  334. self.alt_sf_color_alpha_spinner.setMinimumWidth(70)
  335. self.alt_sf_color_alpha_spinner.setMinimum(0)
  336. self.alt_sf_color_alpha_spinner.setMaximum(255)
  337. self.form_box_child_8 = QtWidgets.QHBoxLayout()
  338. self.form_box_child_8.addWidget(self.alt_sf_color_alpha_slider)
  339. self.form_box_child_8.addWidget(self.alt_sf_color_alpha_spinner)
  340. # Plot Selection (right - left) Line Color
  341. self.alt_sl_color_label = QtWidgets.QLabel('%s:' % _('Sel2. Line'))
  342. self.alt_sl_color_label.setToolTip(
  343. _("Set the line color for the 'right to left' selection box.")
  344. )
  345. self.alt_sl_color_entry = FCEntry()
  346. self.alt_sl_color_button = QtWidgets.QPushButton()
  347. self.alt_sl_color_button.setFixedSize(15, 15)
  348. self.form_box_child_9 = QtWidgets.QHBoxLayout()
  349. self.form_box_child_9.addWidget(self.alt_sl_color_entry)
  350. self.form_box_child_9.addWidget(self.alt_sl_color_button)
  351. self.form_box_child_9.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  352. # Editor Draw Color
  353. self.draw_color_label = QtWidgets.QLabel('%s:' % _('Editor Draw'))
  354. self.alt_sf_color_label.setToolTip(
  355. _("Set the color for the shape.")
  356. )
  357. self.draw_color_entry = FCEntry()
  358. self.draw_color_button = QtWidgets.QPushButton()
  359. self.draw_color_button.setFixedSize(15, 15)
  360. self.form_box_child_10 = QtWidgets.QHBoxLayout()
  361. self.form_box_child_10.addWidget(self.draw_color_entry)
  362. self.form_box_child_10.addWidget(self.draw_color_button)
  363. self.form_box_child_10.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  364. # Editor Draw Selection Color
  365. self.sel_draw_color_label = QtWidgets.QLabel('%s:' % _('Editor Draw Sel.'))
  366. self.sel_draw_color_label.setToolTip(
  367. _("Set the color of the shape when selected.")
  368. )
  369. self.sel_draw_color_entry = FCEntry()
  370. self.sel_draw_color_button = QtWidgets.QPushButton()
  371. self.sel_draw_color_button.setFixedSize(15, 15)
  372. self.form_box_child_11 = QtWidgets.QHBoxLayout()
  373. self.form_box_child_11.addWidget(self.sel_draw_color_entry)
  374. self.form_box_child_11.addWidget(self.sel_draw_color_button)
  375. self.form_box_child_11.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  376. # Project Tab items color
  377. self.proj_color_label = QtWidgets.QLabel('%s:' % _('Project Items'))
  378. self.proj_color_label.setToolTip(
  379. _("Set the color of the items in Project Tab Tree.")
  380. )
  381. self.proj_color_entry = FCEntry()
  382. self.proj_color_button = QtWidgets.QPushButton()
  383. self.proj_color_button.setFixedSize(15, 15)
  384. self.form_box_child_12 = QtWidgets.QHBoxLayout()
  385. self.form_box_child_12.addWidget(self.proj_color_entry)
  386. self.form_box_child_12.addWidget(self.proj_color_button)
  387. self.form_box_child_12.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  388. self.proj_color_dis_label = QtWidgets.QLabel('%s:' % _('Proj. Dis. Items'))
  389. self.proj_color_dis_label.setToolTip(
  390. _("Set the color of the items in Project Tab Tree,\n"
  391. "for the case when the items are disabled.")
  392. )
  393. self.proj_color_dis_entry = FCEntry()
  394. self.proj_color_dis_button = QtWidgets.QPushButton()
  395. self.proj_color_dis_button.setFixedSize(15, 15)
  396. self.form_box_child_13 = QtWidgets.QHBoxLayout()
  397. self.form_box_child_13.addWidget(self.proj_color_dis_entry)
  398. self.form_box_child_13.addWidget(self.proj_color_dis_button)
  399. self.form_box_child_13.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  400. # Activity monitor icon
  401. self.activity_label = QtWidgets.QLabel('%s:' % _("Activity Icon"))
  402. self.activity_label.setToolTip(
  403. _("Select the GIF that show activity when FlatCAM is active.")
  404. )
  405. self.activity_combo = FCComboBox()
  406. self.activity_combo.addItems(['Ball black', 'Ball green', 'Arrow green', 'Eclipse green'])
  407. # Just to add empty rows
  408. self.spacelabel = QtWidgets.QLabel('')
  409. # Add (label - input field) pair to the QFormLayout
  410. self.form_box.addRow(self.spacelabel, self.spacelabel)
  411. self.form_box.addRow(self.gridx_label, self.gridx_entry)
  412. self.form_box.addRow(self.gridy_label, self.gridy_entry)
  413. self.form_box.addRow(self.snap_max_label, self.snap_max_dist_entry)
  414. self.form_box.addRow(self.workspace_lbl, self.workspace_cb)
  415. self.form_box.addRow(self.workspace_type_lbl, self.wk_cb)
  416. self.form_box.addRow(self.spacelabel, self.spacelabel)
  417. self.form_box.addRow(self.pf_color_label, self.form_box_child_1)
  418. self.form_box.addRow(self.pf_alpha_label, self.form_box_child_2)
  419. self.form_box.addRow(self.pl_color_label, self.form_box_child_3)
  420. self.form_box.addRow(self.sf_color_label, self.form_box_child_4)
  421. self.form_box.addRow(self.sf_alpha_label, self.form_box_child_5)
  422. self.form_box.addRow(self.sl_color_label, self.form_box_child_6)
  423. self.form_box.addRow(self.alt_sf_color_label, self.form_box_child_7)
  424. self.form_box.addRow(self.alt_sf_alpha_label, self.form_box_child_8)
  425. self.form_box.addRow(self.alt_sl_color_label, self.form_box_child_9)
  426. self.form_box.addRow(self.draw_color_label, self.form_box_child_10)
  427. self.form_box.addRow(self.sel_draw_color_label, self.form_box_child_11)
  428. self.form_box.addRow(QtWidgets.QLabel(""))
  429. self.form_box.addRow(self.proj_color_label, self.form_box_child_12)
  430. self.form_box.addRow(self.proj_color_dis_label, self.form_box_child_13)
  431. self.form_box.addRow(self.activity_label, self.activity_combo)
  432. self.form_box.addRow(self.spacelabel, self.spacelabel)
  433. # Add the QFormLayout that holds the Application general defaults
  434. # to the main layout of this TAB
  435. self.layout.addLayout(self.form_box)
  436. class GeneralGUISetGroupUI(OptionsGroupUI):
  437. def __init__(self, parent=None):
  438. super(GeneralGUISetGroupUI, self).__init__(self)
  439. self.setTitle(str(_("GUI Settings")))
  440. # Create a form layout for the Application general settings
  441. self.form_box = QtWidgets.QFormLayout()
  442. # Layout selection
  443. self.layout_label = QtWidgets.QLabel('%s:' % _('Layout'))
  444. self.layout_label.setToolTip(
  445. _("Select an layout for FlatCAM.\n"
  446. "It is applied immediately.")
  447. )
  448. self.layout_combo = FCComboBox()
  449. # don't translate the QCombo items as they are used in QSettings and identified by name
  450. self.layout_combo.addItem("standard")
  451. self.layout_combo.addItem("compact")
  452. # Set the current index for layout_combo
  453. settings = QSettings("Open Source", "FlatCAM")
  454. if settings.contains("layout"):
  455. layout = settings.value('layout', type=str)
  456. idx = self.layout_combo.findText(layout.capitalize())
  457. self.layout_combo.setCurrentIndex(idx)
  458. # Style selection
  459. self.style_label = QtWidgets.QLabel('%s:' % _('Style'))
  460. self.style_label.setToolTip(
  461. _("Select an style for FlatCAM.\n"
  462. "It will be applied at the next app start.")
  463. )
  464. self.style_combo = FCComboBox()
  465. self.style_combo.addItems(QtWidgets.QStyleFactory.keys())
  466. # find current style
  467. index = self.style_combo.findText(QtWidgets.qApp.style().objectName(), QtCore.Qt.MatchFixedString)
  468. self.style_combo.setCurrentIndex(index)
  469. self.style_combo.activated[str].connect(self.handle_style)
  470. # Enable High DPI Support
  471. self.hdpi_label = QtWidgets.QLabel('%s:' % _('HDPI Support'))
  472. self.hdpi_label.setToolTip(
  473. _("Enable High DPI support for FlatCAM.\n"
  474. "It will be applied at the next app start.")
  475. )
  476. self.hdpi_cb = FCCheckBox()
  477. settings = QSettings("Open Source", "FlatCAM")
  478. if settings.contains("hdpi"):
  479. self.hdpi_cb.set_value(settings.value('hdpi', type=int))
  480. else:
  481. self.hdpi_cb.set_value(False)
  482. self.hdpi_cb.stateChanged.connect(self.handle_hdpi)
  483. # Clear Settings
  484. self.clear_label = QtWidgets.QLabel('%s:' % _('Clear GUI Settings'))
  485. self.clear_label.setToolTip(
  486. _("Clear the GUI settings for FlatCAM,\n"
  487. "such as: layout, gui state, style, hdpi support etc.")
  488. )
  489. self.clear_btn = FCButton(_("Clear"))
  490. self.clear_btn.clicked.connect(self.handle_clear)
  491. # Enable Hover box
  492. self.hover_label = QtWidgets.QLabel('%s:' % _('Hover Shape'))
  493. self.hover_label.setToolTip(
  494. _("Enable display of a hover shape for FlatCAM objects.\n"
  495. "It is displayed whenever the mouse cursor is hovering\n"
  496. "over any kind of not-selected object.")
  497. )
  498. self.hover_cb = FCCheckBox()
  499. # Enable Selection box
  500. self.selection_label = QtWidgets.QLabel('%s:' % _('Sel. Shape'))
  501. self.selection_label.setToolTip(
  502. _("Enable the display of a selection shape for FlatCAM objects.\n"
  503. "It is displayed whenever the mouse selects an object\n"
  504. "either by clicking or dragging mouse from left to right or\n"
  505. "right to left.")
  506. )
  507. self.selection_cb = FCCheckBox()
  508. # Notebook Font Size
  509. self.notebook_font_size_label = QtWidgets.QLabel('%s:' % _('NB Font Size'))
  510. self.notebook_font_size_label.setToolTip(
  511. _("This sets the font size for the elements found in the Notebook.\n"
  512. "The notebook is the collapsible area in the left side of the GUI,\n"
  513. "and include the Project, Selected and Tool tabs.")
  514. )
  515. self.notebook_font_size_spinner = FCSpinner()
  516. self.notebook_font_size_spinner.setRange(8, 40)
  517. self.notebook_font_size_spinner.setWrapping(True)
  518. settings = QSettings("Open Source", "FlatCAM")
  519. if settings.contains("notebook_font_size"):
  520. self.notebook_font_size_spinner.set_value(settings.value('notebook_font_size', type=int))
  521. else:
  522. self.notebook_font_size_spinner.set_value(12)
  523. # Axis Font Size
  524. self.axis_font_size_label = QtWidgets.QLabel('%s:' % _('Axis Font Size'))
  525. self.axis_font_size_label.setToolTip(
  526. _("This sets the font size for canvas axis.")
  527. )
  528. self.axis_font_size_spinner = FCSpinner()
  529. self.axis_font_size_spinner.setRange(8, 40)
  530. self.axis_font_size_spinner.setWrapping(True)
  531. settings = QSettings("Open Source", "FlatCAM")
  532. if settings.contains("axis_font_size"):
  533. self.axis_font_size_spinner.set_value(settings.value('axis_font_size', type=int))
  534. else:
  535. self.axis_font_size_spinner.set_value(8)
  536. # TextBox Font Size
  537. self.textbox_font_size_label = QtWidgets.QLabel('%s:' % _('Textbox Font Size'))
  538. self.textbox_font_size_label.setToolTip(
  539. _("This sets the font size for the Textbox GUI\n"
  540. "elements that are used in FlatCAM.")
  541. )
  542. self.textbox_font_size_spinner = FCSpinner()
  543. self.textbox_font_size_spinner.setRange(8, 40)
  544. self.textbox_font_size_spinner.setWrapping(True)
  545. settings = QSettings("Open Source", "FlatCAM")
  546. if settings.contains("textbox_font_size"):
  547. self.textbox_font_size_spinner.set_value(settings.value('textbox_font_size', type=int))
  548. else:
  549. self.textbox_font_size_spinner.set_value(10)
  550. # Just to add empty rows
  551. self.spacelabel = QtWidgets.QLabel('')
  552. # Splash Screen
  553. self.splash_label = QtWidgets.QLabel('%s:' % _('Splash Screen'))
  554. self.splash_label.setToolTip(
  555. _("Enable display of the splash screen at application startup.")
  556. )
  557. self.splash_cb = FCCheckBox()
  558. settings = QSettings("Open Source", "FlatCAM")
  559. if settings.value("splash_screen"):
  560. self.splash_cb.set_value(True)
  561. else:
  562. self.splash_cb.set_value(False)
  563. # Sys Tray Icon
  564. self.systray_label = QtWidgets.QLabel('%s:' % _('Sys Tray Icon'))
  565. self.systray_label.setToolTip(
  566. _("Enable display of FlatCAM icon in Sys Tray.")
  567. )
  568. self.systray_cb = FCCheckBox()
  569. # Shell StartUp CB
  570. self.shell_startup_label = QtWidgets.QLabel('%s:' % _('Shell at StartUp'))
  571. self.shell_startup_label.setToolTip(
  572. _("Check this box if you want the shell to\n"
  573. "start automatically at startup.")
  574. )
  575. self.shell_startup_cb = FCCheckBox(label='')
  576. self.shell_startup_cb.setToolTip(
  577. _("Check this box if you want the shell to\n"
  578. "start automatically at startup.")
  579. )
  580. # Project at StartUp CB
  581. self.project_startup_label = QtWidgets.QLabel('%s:' % _('Project at StartUp'))
  582. self.project_startup_label.setToolTip(
  583. _("Check this box if you want the project/selected/tool tab area to\n"
  584. "to be shown automatically at startup.")
  585. )
  586. self.project_startup_cb = FCCheckBox(label='')
  587. self.project_startup_cb.setToolTip(
  588. _("Check this box if you want the project/selected/tool tab area to\n"
  589. "to be shown automatically at startup.")
  590. )
  591. # Project autohide CB
  592. self.project_autohide_label = QtWidgets.QLabel('%s:' % _('Project AutoHide'))
  593. self.project_autohide_label.setToolTip(
  594. _("Check this box if you want the project/selected/tool tab area to\n"
  595. "hide automatically when there are no objects loaded and\n"
  596. "to show whenever a new object is created.")
  597. )
  598. self.project_autohide_cb = FCCheckBox(label='')
  599. self.project_autohide_cb.setToolTip(
  600. _("Check this box if you want the project/selected/tool tab area to\n"
  601. "hide automatically when there are no objects loaded and\n"
  602. "to show whenever a new object is created.")
  603. )
  604. # Enable/Disable ToolTips globally
  605. self.toggle_tooltips_label = QtWidgets.QLabel('<b>%s:</b>' % _('Enable ToolTips'))
  606. self.toggle_tooltips_label.setToolTip(
  607. _("Check this box if you want to have toolTips displayed\n"
  608. "when hovering with mouse over items throughout the App.")
  609. )
  610. self.toggle_tooltips_cb = FCCheckBox(label='')
  611. self.toggle_tooltips_cb.setToolTip(
  612. _("Check this box if you want to have toolTips displayed\n"
  613. "when hovering with mouse over items throughout the App.")
  614. )
  615. # Mouse Cursor Shape
  616. self.cursor_lbl = QtWidgets.QLabel('%s:' % _('Mouse Cursor'))
  617. self.cursor_lbl.setToolTip(
  618. _("Choose a mouse cursor shape.\n"
  619. "- Small -> with a customizable size.\n"
  620. "- Big -> Infinite lines")
  621. )
  622. self.cursor_radio = RadioSet([
  623. {"label": _("Small"), "value": "small"},
  624. {"label": _("Big"), "value": "big"}
  625. ], orientation='horizontal', stretch=False)
  626. self.cursor_size_lbl = QtWidgets.QLabel('%s:' % _('Mouse Cursor Size'))
  627. self.cursor_size_lbl.setToolTip(
  628. _("Set the size of the mouse cursor, in pixels.")
  629. )
  630. self.cursor_size_entry = FCSpinner()
  631. self.cursor_size_entry.set_range(10, 70)
  632. self.cursor_size_entry.setWrapping(True)
  633. # Add (label - input field) pair to the QFormLayout
  634. self.form_box.addRow(self.spacelabel, self.spacelabel)
  635. self.form_box.addRow(self.layout_label, self.layout_combo)
  636. self.form_box.addRow(self.style_label, self.style_combo)
  637. self.form_box.addRow(self.hdpi_label, self.hdpi_cb)
  638. self.form_box.addRow(self.clear_label, self.clear_btn)
  639. self.form_box.addRow(self.hover_label, self.hover_cb)
  640. self.form_box.addRow(self.selection_label, self.selection_cb)
  641. self.form_box.addRow(QtWidgets.QLabel(''))
  642. self.form_box.addRow(self.notebook_font_size_label, self.notebook_font_size_spinner)
  643. self.form_box.addRow(self.axis_font_size_label, self.axis_font_size_spinner)
  644. self.form_box.addRow(self.textbox_font_size_label, self.textbox_font_size_spinner)
  645. self.form_box.addRow(QtWidgets.QLabel(''))
  646. self.form_box.addRow(self.splash_label, self.splash_cb)
  647. self.form_box.addRow(self.systray_label, self.systray_cb)
  648. self.form_box.addRow(self.shell_startup_label, self.shell_startup_cb)
  649. self.form_box.addRow(self.project_startup_label, self.project_startup_cb)
  650. self.form_box.addRow(self.project_autohide_label, self.project_autohide_cb)
  651. self.form_box.addRow(QtWidgets.QLabel(''))
  652. self.form_box.addRow(self.toggle_tooltips_label, self.toggle_tooltips_cb)
  653. self.form_box.addRow(self.cursor_lbl, self.cursor_radio)
  654. self.form_box.addRow(self.cursor_size_lbl, self.cursor_size_entry)
  655. # Add the QFormLayout that holds the Application general defaults
  656. # to the main layout of this TAB
  657. self.layout.addLayout(self.form_box)
  658. # Delete confirmation
  659. self.delete_conf_cb = FCCheckBox(_('Delete object confirmation'))
  660. self.delete_conf_cb.setToolTip(
  661. _("When checked the application will ask for user confirmation\n"
  662. "whenever the Delete object(s) event is triggered, either by\n"
  663. "menu shortcut or key shortcut.")
  664. )
  665. self.layout.addWidget(self.delete_conf_cb)
  666. self.layout.addStretch()
  667. def handle_style(self, style):
  668. # set current style
  669. settings = QSettings("Open Source", "FlatCAM")
  670. settings.setValue('style', style)
  671. # This will write the setting to the platform specific storage.
  672. del settings
  673. def handle_hdpi(self, state):
  674. # set current HDPI
  675. settings = QSettings("Open Source", "FlatCAM")
  676. settings.setValue('hdpi', state)
  677. # This will write the setting to the platform specific storage.
  678. del settings
  679. def handle_clear(self):
  680. msgbox = QtWidgets.QMessageBox()
  681. msgbox.setText(_("Are you sure you want to delete the GUI Settings? "
  682. "\n")
  683. )
  684. msgbox.setWindowTitle(_("Clear GUI Settings"))
  685. msgbox.setWindowIcon(QtGui.QIcon('share/trash32.png'))
  686. bt_yes = msgbox.addButton(_('Yes'), QtWidgets.QMessageBox.YesRole)
  687. bt_no = msgbox.addButton(_('No'), QtWidgets.QMessageBox.NoRole)
  688. msgbox.setDefaultButton(bt_no)
  689. msgbox.exec_()
  690. response = msgbox.clickedButton()
  691. if response == bt_yes:
  692. settings = QSettings("Open Source", "FlatCAM")
  693. for key in settings.allKeys():
  694. settings.remove(key)
  695. # This will write the setting to the platform specific storage.
  696. del settings
  697. class GeneralAppPrefGroupUI(OptionsGroupUI):
  698. def __init__(self, parent=None):
  699. super(GeneralAppPrefGroupUI, self).__init__(self)
  700. self.setTitle(str(_("App Preferences")))
  701. # Create a form layout for the Application general settings
  702. self.form_box = QtWidgets.QFormLayout()
  703. # Units for FlatCAM
  704. self.unitslabel = QtWidgets.QLabel('<span style="color:red;"><b>%s:</b></span>' % _('Units'))
  705. self.unitslabel.setToolTip(_("The default value for FlatCAM units.\n"
  706. "Whatever is selected here is set every time\n"
  707. "FLatCAM is started."))
  708. self.units_radio = RadioSet([{'label': _('IN'), 'value': 'IN'},
  709. {'label': _('MM'), 'value': 'MM'}])
  710. # Graphic Engine for FlatCAM
  711. self.ge_label = QtWidgets.QLabel('<b>%s:</b>' % _('Graphic Engine'))
  712. self.ge_label.setToolTip(_("Choose what graphic engine to use in FlatCAM.\n"
  713. "Legacy(2D) -> reduced functionality, slow performance but enhanced compatibility.\n"
  714. "OpenGL(3D) -> full functionality, high performance\n"
  715. "Some graphic cards are too old and do not work in OpenGL(3D) mode, like:\n"
  716. "Intel HD3000 or older. In this case the plot area will be black therefore\n"
  717. "use the Legacy(2D) mode."))
  718. self.ge_radio = RadioSet([{'label': _('Legacy(2D)'), 'value': '2D'},
  719. {'label': _('OpenGL(3D)'), 'value': '3D'}])
  720. # Application Level for FlatCAM
  721. self.app_level_label = QtWidgets.QLabel('<b>%s:</b>' % _('APP. LEVEL'))
  722. self.app_level_label.setToolTip(_("Choose the default level of usage for FlatCAM.\n"
  723. "BASIC level -> reduced functionality, best for beginner's.\n"
  724. "ADVANCED level -> full functionality.\n\n"
  725. "The choice here will influence the parameters in\n"
  726. "the Selected Tab for all kinds of FlatCAM objects."))
  727. self.app_level_radio = RadioSet([{'label': _('Basic'), 'value': 'b'},
  728. {'label': _('Advanced'), 'value': 'a'}])
  729. # Application Level for FlatCAM
  730. self.portability_label = QtWidgets.QLabel('%s:' % _('Portable app'))
  731. self.portability_label.setToolTip(_("Choose if the application should run as portable.\n\n"
  732. "If Checked the application will run portable,\n"
  733. "which means that the preferences files will be saved\n"
  734. "in the application folder, in the lib\\config subfolder."))
  735. self.portability_cb = FCCheckBox()
  736. # Languages for FlatCAM
  737. self.languagelabel = QtWidgets.QLabel('<b>%s:</b>' % _('Languages'))
  738. self.languagelabel.setToolTip(_("Set the language used throughout FlatCAM."))
  739. self.language_cb = FCComboBox()
  740. self.languagespace = QtWidgets.QLabel('')
  741. self.language_apply_btn = FCButton(_("Apply Language"))
  742. self.language_apply_btn.setToolTip(_("Set the language used throughout FlatCAM.\n"
  743. "The app will restart after click."
  744. "Windows: When FlatCAM is installed in Program Files\n"
  745. "directory, it is possible that the app will not\n"
  746. "restart after the button is clicked due of Windows\n"
  747. "security features. In this case the language will be\n"
  748. "applied at the next app start."))
  749. # Version Check CB
  750. self.version_check_label = QtWidgets.QLabel('%s:' % _('Version Check'))
  751. self.version_check_label.setToolTip(
  752. _("Check this box if you want to check\n"
  753. "for a new version automatically at startup.")
  754. )
  755. self.version_check_cb = FCCheckBox(label='')
  756. self.version_check_cb.setToolTip(
  757. _("Check this box if you want to check\n"
  758. "for a new version automatically at startup.")
  759. )
  760. # Send Stats CB
  761. self.send_stats_label = QtWidgets.QLabel('%s:' % _('Send Stats'))
  762. self.send_stats_label.setToolTip(
  763. _("Check this box if you agree to send anonymous\n"
  764. "stats automatically at startup, to help improve FlatCAM.")
  765. )
  766. self.send_stats_cb = FCCheckBox(label='')
  767. self.send_stats_cb.setToolTip(
  768. _("Check this box if you agree to send anonymous\n"
  769. "stats automatically at startup, to help improve FlatCAM.")
  770. )
  771. self.ois_version_check = OptionalInputSection(self.version_check_cb, [self.send_stats_cb])
  772. # Select mouse pan button
  773. self.panbuttonlabel = QtWidgets.QLabel('<b>%s:</b>' % _('Pan Button'))
  774. self.panbuttonlabel.setToolTip(_("Select the mouse button to use for panning:\n"
  775. "- MMB --> Middle Mouse Button\n"
  776. "- RMB --> Right Mouse Button"))
  777. self.pan_button_radio = RadioSet([{'label': _('MMB'), 'value': '3'},
  778. {'label': _('RMB'), 'value': '2'}])
  779. # Multiple Selection Modifier Key
  780. self.mselectlabel = QtWidgets.QLabel('<b>%s:</b>' % _('Multiple Sel'))
  781. self.mselectlabel.setToolTip(_("Select the key used for multiple selection."))
  782. self.mselect_radio = RadioSet([{'label': _('CTRL'), 'value': 'Control'},
  783. {'label': _('SHIFT'), 'value': 'Shift'}])
  784. # Worker Numbers
  785. self.worker_number_label = QtWidgets.QLabel('%s:' % _('Workers number'))
  786. self.worker_number_label.setToolTip(
  787. _("The number of Qthreads made available to the App.\n"
  788. "A bigger number may finish the jobs more quickly but\n"
  789. "depending on your computer speed, may make the App\n"
  790. "unresponsive. Can have a value between 2 and 16.\n"
  791. "Default value is 2.\n"
  792. "After change, it will be applied at next App start.")
  793. )
  794. self.worker_number_sb = FCSpinner()
  795. self.worker_number_sb.setToolTip(
  796. _("The number of Qthreads made available to the App.\n"
  797. "A bigger number may finish the jobs more quickly but\n"
  798. "depending on your computer speed, may make the App\n"
  799. "unresponsive. Can have a value between 2 and 16.\n"
  800. "Default value is 2.\n"
  801. "After change, it will be applied at next App start.")
  802. )
  803. self.worker_number_sb.set_range(2, 16)
  804. # Geometric tolerance
  805. tol_label = QtWidgets.QLabel('%s:' % _("Geo Tolerance"))
  806. tol_label.setToolTip(_(
  807. "This value can counter the effect of the Circle Steps\n"
  808. "parameter. Default value is 0.01.\n"
  809. "A lower value will increase the detail both in image\n"
  810. "and in Gcode for the circles, with a higher cost in\n"
  811. "performance. Higher value will provide more\n"
  812. "performance at the expense of level of detail."
  813. ))
  814. self.tol_entry = FCEntry()
  815. self.tol_entry.setToolTip(_(
  816. "This value can counter the effect of the Circle Steps\n"
  817. "parameter. Default value is 0.01.\n"
  818. "A lower value will increase the detail both in image\n"
  819. "and in Gcode for the circles, with a higher cost in\n"
  820. "performance. Higher value will provide more\n"
  821. "performance at the expense of level of detail."
  822. ))
  823. # Just to add empty rows
  824. self.spacelabel = QtWidgets.QLabel('')
  825. # Add (label - input field) pair to the QFormLayout
  826. self.form_box.addRow(self.unitslabel, self.units_radio)
  827. self.form_box.addRow(self.ge_label, self.ge_radio)
  828. self.form_box.addRow(QtWidgets.QLabel(''))
  829. self.form_box.addRow(self.app_level_label, self.app_level_radio)
  830. self.form_box.addRow(self.portability_label, self.portability_cb)
  831. self.form_box.addRow(QtWidgets.QLabel(''))
  832. self.form_box.addRow(self.languagelabel, self.language_cb)
  833. self.form_box.addRow(self.languagespace, self.language_apply_btn)
  834. self.form_box.addRow(self.spacelabel, self.spacelabel)
  835. self.form_box.addRow(self.version_check_label, self.version_check_cb)
  836. self.form_box.addRow(self.send_stats_label, self.send_stats_cb)
  837. self.form_box.addRow(self.panbuttonlabel, self.pan_button_radio)
  838. self.form_box.addRow(self.mselectlabel, self.mselect_radio)
  839. self.form_box.addRow(self.worker_number_label, self.worker_number_sb)
  840. self.form_box.addRow(tol_label, self.tol_entry)
  841. self.form_box.addRow(self.spacelabel, self.spacelabel)
  842. # Add the QFormLayout that holds the Application general defaults
  843. # to the main layout of this TAB
  844. self.layout.addLayout(self.form_box)
  845. # Open behavior
  846. self.open_style_cb = FCCheckBox('%s' % _('"Open" behavior'))
  847. self.open_style_cb.setToolTip(
  848. _("When checked the path for the last saved file is used when saving files,\n"
  849. "and the path for the last opened file is used when opening files.\n\n"
  850. "When unchecked the path for opening files is the one used last: either the\n"
  851. "path for saving files or the path for opening files.")
  852. )
  853. # self.advanced_cb.setLayoutDirection(QtCore.Qt.RightToLeft)
  854. self.layout.addWidget(self.open_style_cb)
  855. # Save compressed project CB
  856. self.save_type_cb = FCCheckBox(_('Save Compressed Project'))
  857. self.save_type_cb.setToolTip(
  858. _("Whether to save a compressed or uncompressed project.\n"
  859. "When checked it will save a compressed FlatCAM project.")
  860. )
  861. # self.advanced_cb.setLayoutDirection(QtCore.Qt.RightToLeft)
  862. self.layout.addWidget(self.save_type_cb)
  863. hlay1 = QtWidgets.QHBoxLayout()
  864. self.layout.addLayout(hlay1)
  865. # Project LZMA Comppression Level
  866. self.compress_combo = FCComboBox()
  867. self.compress_label = QtWidgets.QLabel('%s:' % _('Compression Level'))
  868. self.compress_label.setToolTip(
  869. _("The level of compression used when saving\n"
  870. "a FlatCAM project. Higher value means better compression\n"
  871. "but require more RAM usage and more processing time.")
  872. )
  873. # self.advanced_cb.setLayoutDirection(QtCore.Qt.RightToLeft)
  874. self.compress_combo.addItems([str(i) for i in range(10)])
  875. hlay1.addWidget(self.compress_label)
  876. hlay1.addWidget(self.compress_combo)
  877. self.proj_ois = OptionalInputSection(self.save_type_cb, [self.compress_label, self.compress_combo], True)
  878. self.form_box_2 = QtWidgets.QFormLayout()
  879. self.layout.addLayout(self.form_box_2)
  880. self.layout.addStretch()
  881. if sys.platform != 'win32':
  882. self.portability_label.hide()
  883. self.portability_cb.hide()
  884. class GerberGenPrefGroupUI(OptionsGroupUI):
  885. def __init__(self, parent=None):
  886. # OptionsGroupUI.__init__(self, "Gerber General Preferences", parent=parent)
  887. super(GerberGenPrefGroupUI, self).__init__(self)
  888. self.setTitle(str(_("Gerber General")))
  889. # ## Plot options
  890. self.plot_options_label = QtWidgets.QLabel("<b>%s:</b>" % _("Plot Options"))
  891. self.layout.addWidget(self.plot_options_label)
  892. grid0 = QtWidgets.QGridLayout()
  893. self.layout.addLayout(grid0)
  894. # Solid CB
  895. self.solid_cb = FCCheckBox(label='%s' % _('Solid'))
  896. self.solid_cb.setToolTip(
  897. _("Solid color polygons.")
  898. )
  899. grid0.addWidget(self.solid_cb, 0, 0)
  900. # Multicolored CB
  901. self.multicolored_cb = FCCheckBox(label='%s' % _('M-Color'))
  902. self.multicolored_cb.setToolTip(
  903. _("Draw polygons in different colors.")
  904. )
  905. grid0.addWidget(self.multicolored_cb, 0, 1)
  906. # Plot CB
  907. self.plot_cb = FCCheckBox(label='%s' % _('Plot'))
  908. self.plot_options_label.setToolTip(
  909. _("Plot (show) this object.")
  910. )
  911. grid0.addWidget(self.plot_cb, 0, 2)
  912. # Number of circle steps for circular aperture linear approximation
  913. self.circle_steps_label = QtWidgets.QLabel('%s:' % _("Circle Steps"))
  914. self.circle_steps_label.setToolTip(
  915. _("The number of circle steps for Gerber \n"
  916. "circular aperture linear approximation.")
  917. )
  918. self.circle_steps_entry = IntEntry()
  919. grid0.addWidget(self.circle_steps_label, 1, 0)
  920. grid0.addWidget(self.circle_steps_entry, 1, 1, 1, 2)
  921. grid0.addWidget(QtWidgets.QLabel(''), 2, 0, 1, 3)
  922. # Default format for Gerber
  923. self.gerber_default_label = QtWidgets.QLabel('<b>%s:</b>' % _('Default Values'))
  924. self.gerber_default_label.setToolTip(
  925. _("Those values will be used as fallback values\n"
  926. "in case that they are not found in the Gerber file.")
  927. )
  928. grid0.addWidget(self.gerber_default_label, 3, 0, 1, 3)
  929. # Gerber Units
  930. self.gerber_units_label = QtWidgets.QLabel('%s:' % _('Units'))
  931. self.gerber_units_label.setToolTip(
  932. _("The units used in the Gerber file.")
  933. )
  934. self.gerber_units_radio = RadioSet([{'label': _('INCH'), 'value': 'IN'},
  935. {'label': _('MM'), 'value': 'MM'}])
  936. self.gerber_units_radio.setToolTip(
  937. _("The units used in the Gerber file.")
  938. )
  939. grid0.addWidget(self.gerber_units_label, 4, 0)
  940. grid0.addWidget(self.gerber_units_radio, 4, 1, 1, 2)
  941. # Gerber Zeros
  942. self.gerber_zeros_label = QtWidgets.QLabel('%s:' % _('Zeros'))
  943. self.gerber_zeros_label.setAlignment(QtCore.Qt.AlignLeft)
  944. self.gerber_zeros_label.setToolTip(
  945. _("This sets the type of Gerber zeros.\n"
  946. "If LZ then Leading Zeros are removed and\n"
  947. "Trailing Zeros are kept.\n"
  948. "If TZ is checked then Trailing Zeros are removed\n"
  949. "and Leading Zeros are kept.")
  950. )
  951. self.gerber_zeros_radio = RadioSet([{'label': _('LZ'), 'value': 'L'},
  952. {'label': _('TZ'), 'value': 'T'}])
  953. self.gerber_zeros_radio.setToolTip(
  954. _("This sets the type of Gerber zeros.\n"
  955. "If LZ then Leading Zeros are removed and\n"
  956. "Trailing Zeros are kept.\n"
  957. "If TZ is checked then Trailing Zeros are removed\n"
  958. "and Leading Zeros are kept.")
  959. )
  960. grid0.addWidget(self.gerber_zeros_label, 5, 0)
  961. grid0.addWidget(self.gerber_zeros_radio, 5, 1, 1, 2)
  962. self.layout.addStretch()
  963. class GerberOptPrefGroupUI(OptionsGroupUI):
  964. def __init__(self, parent=None):
  965. # OptionsGroupUI.__init__(self, "Gerber Options Preferences", parent=parent)
  966. super(GerberOptPrefGroupUI, self).__init__(self)
  967. self.setTitle(str(_("Gerber Options")))
  968. # ## Isolation Routing
  969. self.isolation_routing_label = QtWidgets.QLabel("<b>%s:</b>" % _("Isolation Routing"))
  970. self.isolation_routing_label.setToolTip(
  971. _("Create a Geometry object with\n"
  972. "toolpaths to cut outside polygons.")
  973. )
  974. self.layout.addWidget(self.isolation_routing_label)
  975. # Cutting Tool Diameter
  976. grid0 = QtWidgets.QGridLayout()
  977. self.layout.addLayout(grid0)
  978. tdlabel = QtWidgets.QLabel('%s:' % _('Tool dia'))
  979. tdlabel.setToolTip(
  980. _("Diameter of the cutting tool.")
  981. )
  982. grid0.addWidget(tdlabel, 0, 0)
  983. self.iso_tool_dia_entry = LengthEntry()
  984. grid0.addWidget(self.iso_tool_dia_entry, 0, 1)
  985. # Nr of passes
  986. passlabel = QtWidgets.QLabel('%s:' % _('# Passes'))
  987. passlabel.setToolTip(
  988. _("Width of the isolation gap in\n"
  989. "number (integer) of tool widths.")
  990. )
  991. grid0.addWidget(passlabel, 1, 0)
  992. self.iso_width_entry = FCSpinner()
  993. self.iso_width_entry.setRange(1, 999)
  994. grid0.addWidget(self.iso_width_entry, 1, 1)
  995. # Pass overlap
  996. overlabel = QtWidgets.QLabel('%s:' % _('Pass overlap'))
  997. overlabel.setToolTip(
  998. _("How much (fraction) of the tool width to overlap each tool pass.\n"
  999. "Example:\n"
  1000. "A value here of 0.25 means an overlap of 25%% from the tool diameter found above.")
  1001. )
  1002. grid0.addWidget(overlabel, 2, 0)
  1003. self.iso_overlap_entry = FCDoubleSpinner()
  1004. self.iso_overlap_entry.set_precision(3)
  1005. self.iso_overlap_entry.setWrapping(True)
  1006. self.iso_overlap_entry.setRange(0.000, 0.999)
  1007. self.iso_overlap_entry.setSingleStep(0.1)
  1008. grid0.addWidget(self.iso_overlap_entry, 2, 1)
  1009. # Milling Type
  1010. milling_type_label = QtWidgets.QLabel('%s:' % _('Milling Type'))
  1011. milling_type_label.setToolTip(
  1012. _("Milling type:\n"
  1013. "- climb / best for precision milling and to reduce tool usage\n"
  1014. "- conventional / useful when there is no backlash compensation")
  1015. )
  1016. grid0.addWidget(milling_type_label, 3, 0)
  1017. self.milling_type_radio = RadioSet([{'label': _('Climb'), 'value': 'cl'},
  1018. {'label': _('Conv.'), 'value': 'cv'}])
  1019. grid0.addWidget(self.milling_type_radio, 3, 1)
  1020. # Combine passes
  1021. self.combine_passes_cb = FCCheckBox(label=_('Combine Passes'))
  1022. self.combine_passes_cb.setToolTip(
  1023. _("Combine all passes into one object")
  1024. )
  1025. grid0.addWidget(self.combine_passes_cb, 4, 0, 1, 2)
  1026. # ## Clear non-copper regions
  1027. self.clearcopper_label = QtWidgets.QLabel("<b>%s:</b>" % _("Non-copper regions"))
  1028. self.clearcopper_label.setToolTip(
  1029. _("Create polygons covering the\n"
  1030. "areas without copper on the PCB.\n"
  1031. "Equivalent to the inverse of this\n"
  1032. "object. Can be used to remove all\n"
  1033. "copper from a specified region.")
  1034. )
  1035. self.layout.addWidget(self.clearcopper_label)
  1036. grid1 = QtWidgets.QGridLayout()
  1037. self.layout.addLayout(grid1)
  1038. # Margin
  1039. bmlabel = QtWidgets.QLabel('%s:' % _('Boundary Margin'))
  1040. bmlabel.setToolTip(
  1041. _("Specify the edge of the PCB\n"
  1042. "by drawing a box around all\n"
  1043. "objects with this minimum\n"
  1044. "distance.")
  1045. )
  1046. grid1.addWidget(bmlabel, 0, 0)
  1047. self.noncopper_margin_entry = LengthEntry()
  1048. grid1.addWidget(self.noncopper_margin_entry, 0, 1)
  1049. # Rounded corners
  1050. self.noncopper_rounded_cb = FCCheckBox(label=_("Rounded Geo"))
  1051. self.noncopper_rounded_cb.setToolTip(
  1052. _("Resulting geometry will have rounded corners.")
  1053. )
  1054. grid1.addWidget(self.noncopper_rounded_cb, 1, 0, 1, 2)
  1055. # ## Bounding box
  1056. self.boundingbox_label = QtWidgets.QLabel('<b>%s:</b>' % _('Bounding Box'))
  1057. self.layout.addWidget(self.boundingbox_label)
  1058. grid2 = QtWidgets.QGridLayout()
  1059. self.layout.addLayout(grid2)
  1060. bbmargin = QtWidgets.QLabel('%s:' % _('Boundary Margin'))
  1061. bbmargin.setToolTip(
  1062. _("Distance of the edges of the box\n"
  1063. "to the nearest polygon.")
  1064. )
  1065. grid2.addWidget(bbmargin, 0, 0)
  1066. self.bbmargin_entry = LengthEntry()
  1067. grid2.addWidget(self.bbmargin_entry, 0, 1)
  1068. self.bbrounded_cb = FCCheckBox(label='%s' % _("Rounded Geo"))
  1069. self.bbrounded_cb.setToolTip(
  1070. _("If the bounding box is \n"
  1071. "to have rounded corners\n"
  1072. "their radius is equal to\n"
  1073. "the margin.")
  1074. )
  1075. grid2.addWidget(self.bbrounded_cb, 1, 0, 1, 2)
  1076. self.layout.addStretch()
  1077. class GerberAdvOptPrefGroupUI(OptionsGroupUI):
  1078. def __init__(self, parent=None):
  1079. # OptionsGroupUI.__init__(self, "Gerber Adv. Options Preferences", parent=parent)
  1080. super(GerberAdvOptPrefGroupUI, self).__init__(self)
  1081. self.setTitle(str(_("Gerber Adv. Options")))
  1082. # ## Advanced Gerber Parameters
  1083. self.adv_param_label = QtWidgets.QLabel('<b>%s:</b>' % _('Advanced Options'))
  1084. self.adv_param_label.setToolTip(
  1085. _("A list of Gerber advanced parameters.\n"
  1086. "Those parameters are available only for\n"
  1087. "Advanced App. Level.")
  1088. )
  1089. self.layout.addWidget(self.adv_param_label)
  1090. grid0 = QtWidgets.QGridLayout()
  1091. self.layout.addLayout(grid0)
  1092. # Follow Attribute
  1093. self.follow_cb = FCCheckBox(label=_('"Follow"'))
  1094. self.follow_cb.setToolTip(
  1095. _("Generate a 'Follow' geometry.\n"
  1096. "This means that it will cut through\n"
  1097. "the middle of the trace.")
  1098. )
  1099. grid0.addWidget(self.follow_cb, 0, 0, 1, 2)
  1100. # Aperture Table Visibility CB
  1101. self.aperture_table_visibility_cb = FCCheckBox(label=_('Table Show/Hide'))
  1102. self.aperture_table_visibility_cb.setToolTip(
  1103. _("Toggle the display of the Gerber Apertures Table.\n"
  1104. "Also, on hide, it will delete all mark shapes\n"
  1105. "that are drawn on canvas.")
  1106. )
  1107. grid0.addWidget(self.aperture_table_visibility_cb, 1, 0, 1, 2)
  1108. # Tool Type
  1109. self.tool_type_label = QtWidgets.QLabel('<b>%s</b>' % _('Tool Type'))
  1110. self.tool_type_label.setToolTip(
  1111. _("Choose what tool to use for Gerber isolation:\n"
  1112. "'Circular' or 'V-shape'.\n"
  1113. "When the 'V-shape' is selected then the tool\n"
  1114. "diameter will depend on the chosen cut depth.")
  1115. )
  1116. self.tool_type_radio = RadioSet([{'label': 'Circular', 'value': 'circular'},
  1117. {'label': 'V-Shape', 'value': 'v'}])
  1118. grid0.addWidget(self.tool_type_label, 2, 0)
  1119. grid0.addWidget(self.tool_type_radio, 2, 1, 1, 2)
  1120. # Tip Dia
  1121. self.tipdialabel = QtWidgets.QLabel('%s:' % _('V-Tip Dia'))
  1122. self.tipdialabel.setToolTip(
  1123. _("The tip diameter for V-Shape Tool")
  1124. )
  1125. self.tipdia_spinner = FCDoubleSpinner()
  1126. self.tipdia_spinner.set_range(-99.9999, 99.9999)
  1127. self.tipdia_spinner.setSingleStep(0.1)
  1128. self.tipdia_spinner.setWrapping(True)
  1129. grid0.addWidget(self.tipdialabel, 3, 0)
  1130. grid0.addWidget(self.tipdia_spinner, 3, 1, 1, 2)
  1131. # Tip Angle
  1132. self.tipanglelabel = QtWidgets.QLabel('%s:' % _('V-Tip Angle'))
  1133. self.tipanglelabel.setToolTip(
  1134. _("The tip angle for V-Shape Tool.\n"
  1135. "In degree.")
  1136. )
  1137. self.tipangle_spinner = FCSpinner()
  1138. self.tipangle_spinner.set_range(0, 180)
  1139. self.tipangle_spinner.setSingleStep(5)
  1140. self.tipangle_spinner.setWrapping(True)
  1141. grid0.addWidget(self.tipanglelabel, 4, 0)
  1142. grid0.addWidget(self.tipangle_spinner, 4, 1, 1, 2)
  1143. # Cut Z
  1144. self.cutzlabel = QtWidgets.QLabel('%s:' % _('Cut Z'))
  1145. self.cutzlabel.setToolTip(
  1146. _("Cutting depth (negative)\n"
  1147. "below the copper surface.")
  1148. )
  1149. self.cutz_spinner = FCDoubleSpinner()
  1150. self.cutz_spinner.set_range(-99.9999, -0.0001)
  1151. self.cutz_spinner.setSingleStep(0.1)
  1152. self.cutz_spinner.setWrapping(True)
  1153. grid0.addWidget(self.cutzlabel, 5, 0)
  1154. grid0.addWidget(self.cutz_spinner, 5, 1, 1, 2)
  1155. # Buffering Type
  1156. buffering_label = QtWidgets.QLabel('%s:' % _('Buffering'))
  1157. buffering_label.setToolTip(
  1158. _("Buffering type:\n"
  1159. "- None --> best performance, fast file loading but no so good display\n"
  1160. "- Full --> slow file loading but good visuals. This is the default.\n"
  1161. "<<WARNING>>: Don't change this unless you know what you are doing !!!")
  1162. )
  1163. self.buffering_radio = RadioSet([{'label': _('None'), 'value': 'no'},
  1164. {'label': _('Full'), 'value': 'full'}])
  1165. grid0.addWidget(buffering_label, 6, 0)
  1166. grid0.addWidget(self.buffering_radio, 6, 1)
  1167. # Simplification
  1168. self.simplify_cb = FCCheckBox(label=_('Simplify'))
  1169. self.simplify_cb.setToolTip(
  1170. _("When checked all the Gerber polygons will be\n"
  1171. "loaded with simplification having a set tolerance.\n"
  1172. "<<WARNING>>: Don't change this unless you know what you are doing !!!")
  1173. )
  1174. grid0.addWidget(self.simplify_cb, 7, 0, 1, 2)
  1175. # Simplification tolerance
  1176. self.simplification_tol_label = QtWidgets.QLabel(_('Tolerance'))
  1177. self.simplification_tol_label.setToolTip(_("Tolerance for polygon simplification."))
  1178. self.simplification_tol_spinner = FCDoubleSpinner()
  1179. self.simplification_tol_spinner.set_precision(5)
  1180. self.simplification_tol_spinner.setWrapping(True)
  1181. self.simplification_tol_spinner.setRange(0.00000, 0.01000)
  1182. self.simplification_tol_spinner.setSingleStep(0.0001)
  1183. grid0.addWidget(self.simplification_tol_label, 8, 0)
  1184. grid0.addWidget(self.simplification_tol_spinner, 8, 1)
  1185. self.ois_simplif = OptionalInputSection(self.simplify_cb,
  1186. [self.simplification_tol_label, self.simplification_tol_spinner],
  1187. logic=True)
  1188. self.layout.addStretch()
  1189. class GerberExpPrefGroupUI(OptionsGroupUI):
  1190. def __init__(self, parent=None):
  1191. super(GerberExpPrefGroupUI, self).__init__(self)
  1192. self.setTitle(str(_("Gerber Export")))
  1193. # Plot options
  1194. self.export_options_label = QtWidgets.QLabel("<b>%s:</b>" % _("Export Options"))
  1195. self.export_options_label.setToolTip(
  1196. _("The parameters set here are used in the file exported\n"
  1197. "when using the File -> Export -> Export Gerber menu entry.")
  1198. )
  1199. self.layout.addWidget(self.export_options_label)
  1200. form = QtWidgets.QFormLayout()
  1201. self.layout.addLayout(form)
  1202. # Gerber Units
  1203. self.gerber_units_label = QtWidgets.QLabel('<b>%s:</b>' % _('Units'))
  1204. self.gerber_units_label.setToolTip(
  1205. _("The units used in the Gerber file.")
  1206. )
  1207. self.gerber_units_radio = RadioSet([{'label': _('INCH'), 'value': 'IN'},
  1208. {'label': _('MM'), 'value': 'MM'}])
  1209. self.gerber_units_radio.setToolTip(
  1210. _("The units used in the Gerber file.")
  1211. )
  1212. form.addRow(self.gerber_units_label, self.gerber_units_radio)
  1213. # Gerber format
  1214. self.digits_label = QtWidgets.QLabel("<b>%s:</b>" % _("Int/Decimals"))
  1215. self.digits_label.setToolTip(
  1216. _("The number of digits in the whole part of the number\n"
  1217. "and in the fractional part of the number.")
  1218. )
  1219. hlay1 = QtWidgets.QHBoxLayout()
  1220. self.format_whole_entry = IntEntry()
  1221. self.format_whole_entry.setMaxLength(1)
  1222. self.format_whole_entry.setAlignment(QtCore.Qt.AlignRight)
  1223. self.format_whole_entry.setMinimumWidth(30)
  1224. self.format_whole_entry.setToolTip(
  1225. _("This numbers signify the number of digits in\n"
  1226. "the whole part of Gerber coordinates.")
  1227. )
  1228. hlay1.addWidget(self.format_whole_entry, QtCore.Qt.AlignLeft)
  1229. gerber_separator_label = QtWidgets.QLabel(':')
  1230. gerber_separator_label.setFixedWidth(5)
  1231. hlay1.addWidget(gerber_separator_label, QtCore.Qt.AlignLeft)
  1232. self.format_dec_entry = IntEntry()
  1233. self.format_dec_entry.setMaxLength(1)
  1234. self.format_dec_entry.setAlignment(QtCore.Qt.AlignRight)
  1235. self.format_dec_entry.setMinimumWidth(30)
  1236. self.format_dec_entry.setToolTip(
  1237. _("This numbers signify the number of digits in\n"
  1238. "the decimal part of Gerber coordinates.")
  1239. )
  1240. hlay1.addWidget(self.format_dec_entry, QtCore.Qt.AlignLeft)
  1241. hlay1.addStretch()
  1242. form.addRow(self.digits_label, hlay1)
  1243. # Gerber Zeros
  1244. self.zeros_label = QtWidgets.QLabel('<b>%s:</b>' % _('Zeros'))
  1245. self.zeros_label.setAlignment(QtCore.Qt.AlignLeft)
  1246. self.zeros_label.setToolTip(
  1247. _("This sets the type of Gerber zeros.\n"
  1248. "If LZ then Leading Zeros are removed and\n"
  1249. "Trailing Zeros are kept.\n"
  1250. "If TZ is checked then Trailing Zeros are removed\n"
  1251. "and Leading Zeros are kept.")
  1252. )
  1253. self.zeros_radio = RadioSet([{'label': _('LZ'), 'value': 'L'},
  1254. {'label': _('TZ'), 'value': 'T'}])
  1255. self.zeros_radio.setToolTip(
  1256. _("This sets the type of Gerber zeros.\n"
  1257. "If LZ then Leading Zeros are removed and\n"
  1258. "Trailing Zeros are kept.\n"
  1259. "If TZ is checked then Trailing Zeros are removed\n"
  1260. "and Leading Zeros are kept.")
  1261. )
  1262. form.addRow(self.zeros_label, self.zeros_radio)
  1263. self.layout.addStretch()
  1264. class GerberEditorPrefGroupUI(OptionsGroupUI):
  1265. def __init__(self, parent=None):
  1266. # OptionsGroupUI.__init__(self, "Gerber Adv. Options Preferences", parent=parent)
  1267. super(GerberEditorPrefGroupUI, self).__init__(self)
  1268. self.setTitle(str(_("Gerber Editor")))
  1269. # Advanced Gerber Parameters
  1270. self.param_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  1271. self.param_label.setToolTip(
  1272. _("A list of Gerber Editor parameters.")
  1273. )
  1274. self.layout.addWidget(self.param_label)
  1275. grid0 = QtWidgets.QGridLayout()
  1276. self.layout.addLayout(grid0)
  1277. # Selection Limit
  1278. self.sel_limit_label = QtWidgets.QLabel('%s:' % _("Selection limit"))
  1279. self.sel_limit_label.setToolTip(
  1280. _("Set the number of selected Gerber geometry\n"
  1281. "items above which the utility geometry\n"
  1282. "becomes just a selection rectangle.\n"
  1283. "Increases the performance when moving a\n"
  1284. "large number of geometric elements.")
  1285. )
  1286. self.sel_limit_entry = IntEntry()
  1287. grid0.addWidget(self.sel_limit_label, 0, 0)
  1288. grid0.addWidget(self.sel_limit_entry, 0, 1)
  1289. # New aperture code
  1290. self.addcode_entry_lbl = QtWidgets.QLabel('%s:' % _('New Aperture code'))
  1291. self.addcode_entry_lbl.setToolTip(
  1292. _("Code for the new aperture")
  1293. )
  1294. self.addcode_entry = FCEntry()
  1295. self.addcode_entry.setValidator(QtGui.QIntValidator(0, 99))
  1296. grid0.addWidget(self.addcode_entry_lbl, 1, 0)
  1297. grid0.addWidget(self.addcode_entry, 1, 1)
  1298. # New aperture size
  1299. self.addsize_entry_lbl = QtWidgets.QLabel('%s:' % _('New Aperture size'))
  1300. self.addsize_entry_lbl.setToolTip(
  1301. _("Size for the new aperture")
  1302. )
  1303. self.addsize_entry = FCEntry()
  1304. self.addsize_entry.setValidator(QtGui.QDoubleValidator(0.0001, 99.9999, 4))
  1305. grid0.addWidget(self.addsize_entry_lbl, 2, 0)
  1306. grid0.addWidget(self.addsize_entry, 2, 1)
  1307. # New aperture type
  1308. self.addtype_combo_lbl = QtWidgets.QLabel('%s:' % _('New Aperture type'))
  1309. self.addtype_combo_lbl.setToolTip(
  1310. _("Type for the new aperture.\n"
  1311. "Can be 'C', 'R' or 'O'.")
  1312. )
  1313. self.addtype_combo = FCComboBox()
  1314. self.addtype_combo.addItems(['C', 'R', 'O'])
  1315. grid0.addWidget(self.addtype_combo_lbl, 3, 0)
  1316. grid0.addWidget(self.addtype_combo, 3, 1)
  1317. # Number of pads in a pad array
  1318. self.grb_array_size_label = QtWidgets.QLabel('%s:' % _('Nr of pads'))
  1319. self.grb_array_size_label.setToolTip(
  1320. _("Specify how many pads to be in the array.")
  1321. )
  1322. self.grb_array_size_entry = LengthEntry()
  1323. grid0.addWidget(self.grb_array_size_label, 4, 0)
  1324. grid0.addWidget(self.grb_array_size_entry, 4, 1)
  1325. self.adddim_label = QtWidgets.QLabel('%s:' % _('Aperture Dimensions'))
  1326. self.adddim_label.setToolTip(
  1327. _("Diameters of the cutting tools, separated by ','")
  1328. )
  1329. grid0.addWidget(self.adddim_label, 5, 0)
  1330. self.adddim_entry = FCEntry()
  1331. grid0.addWidget(self.adddim_entry, 5, 1)
  1332. self.grb_array_linear_label = QtWidgets.QLabel('<b>%s:</b>' % _('Linear Pad Array'))
  1333. grid0.addWidget(self.grb_array_linear_label, 6, 0, 1, 2)
  1334. # Linear Pad Array direction
  1335. self.grb_axis_label = QtWidgets.QLabel('%s:' % _('Linear Dir.'))
  1336. self.grb_axis_label.setToolTip(
  1337. _("Direction on which the linear array is oriented:\n"
  1338. "- 'X' - horizontal axis \n"
  1339. "- 'Y' - vertical axis or \n"
  1340. "- 'Angle' - a custom angle for the array inclination")
  1341. )
  1342. self.grb_axis_radio = RadioSet([{'label': _('X'), 'value': 'X'},
  1343. {'label': _('Y'), 'value': 'Y'},
  1344. {'label': _('Angle'), 'value': 'A'}])
  1345. grid0.addWidget(self.grb_axis_label, 7, 0)
  1346. grid0.addWidget(self.grb_axis_radio, 7, 1)
  1347. # Linear Pad Array pitch distance
  1348. self.grb_pitch_label = QtWidgets.QLabel('%s:' % _('Pitch'))
  1349. self.grb_pitch_label.setToolTip(
  1350. _("Pitch = Distance between elements of the array.")
  1351. )
  1352. # self.drill_pitch_label.setMinimumWidth(100)
  1353. self.grb_pitch_entry = LengthEntry()
  1354. grid0.addWidget(self.grb_pitch_label, 8, 0)
  1355. grid0.addWidget(self.grb_pitch_entry, 8, 1)
  1356. # Linear Pad Array custom angle
  1357. self.grb_angle_label = QtWidgets.QLabel('%s:' % _('Angle'))
  1358. self.grb_angle_label.setToolTip(
  1359. _("Angle at which each element in circular array is placed.")
  1360. )
  1361. self.grb_angle_entry = LengthEntry()
  1362. grid0.addWidget(self.grb_angle_label, 9, 0)
  1363. grid0.addWidget(self.grb_angle_entry, 9, 1)
  1364. self.grb_array_circ_label = QtWidgets.QLabel('<b>%s:</b>' % _('Circular Pad Array'))
  1365. grid0.addWidget(self.grb_array_circ_label, 10, 0, 1, 2)
  1366. # Circular Pad Array direction
  1367. self.grb_circular_direction_label = QtWidgets.QLabel('%s:' % _('Circular Dir.'))
  1368. self.grb_circular_direction_label.setToolTip(
  1369. _("Direction for circular array.\n"
  1370. "Can be CW = clockwise or CCW = counter clockwise.")
  1371. )
  1372. self.grb_circular_dir_radio = RadioSet([{'label': _('CW'), 'value': 'CW'},
  1373. {'label': _('CCW'), 'value': 'CCW'}])
  1374. grid0.addWidget(self.grb_circular_direction_label, 11, 0)
  1375. grid0.addWidget(self.grb_circular_dir_radio, 11, 1)
  1376. # Circular Pad Array Angle
  1377. self.grb_circular_angle_label = QtWidgets.QLabel('%s:' % _('Circ. Angle'))
  1378. self.grb_circular_angle_label.setToolTip(
  1379. _("Angle at which each element in circular array is placed.")
  1380. )
  1381. self.grb_circular_angle_entry = LengthEntry()
  1382. grid0.addWidget(self.grb_circular_angle_label, 12, 0)
  1383. grid0.addWidget(self.grb_circular_angle_entry, 12, 1)
  1384. self.grb_array_tools_b_label = QtWidgets.QLabel('<b>%s:</b>' % _('Buffer Tool'))
  1385. grid0.addWidget(self.grb_array_tools_b_label, 13, 0, 1, 2)
  1386. # Buffer Distance
  1387. self.grb_buff_label = QtWidgets.QLabel('%s:' % _('Buffer distance'))
  1388. self.grb_buff_label.setToolTip(
  1389. _("Distance at which to buffer the Gerber element.")
  1390. )
  1391. self.grb_buff_entry = LengthEntry()
  1392. grid0.addWidget(self.grb_buff_label, 14, 0)
  1393. grid0.addWidget(self.grb_buff_entry, 14, 1)
  1394. self.grb_array_tools_s_label = QtWidgets.QLabel('<b>%s:</b>' % _('Scale Tool'))
  1395. grid0.addWidget(self.grb_array_tools_s_label, 15, 0, 1, 2)
  1396. # Scale Factor
  1397. self.grb_scale_label = QtWidgets.QLabel('%s:' % _('Scale factor'))
  1398. self.grb_scale_label.setToolTip(
  1399. _("Factor to scale the Gerber element.")
  1400. )
  1401. self.grb_scale_entry = LengthEntry()
  1402. grid0.addWidget(self.grb_scale_label, 16, 0)
  1403. grid0.addWidget(self.grb_scale_entry, 16, 1)
  1404. self.grb_array_tools_ma_label = QtWidgets.QLabel('<b>%s:</b>' % _('Mark Area Tool'))
  1405. grid0.addWidget(self.grb_array_tools_ma_label, 17, 0, 1, 2)
  1406. # Mark area Tool low threshold
  1407. self.grb_ma_low_label = QtWidgets.QLabel('%s:' % _('Threshold low'))
  1408. self.grb_ma_low_label.setToolTip(
  1409. _("Threshold value under which the apertures are not marked.")
  1410. )
  1411. self.grb_ma_low_entry = LengthEntry()
  1412. grid0.addWidget(self.grb_ma_low_label, 18, 0)
  1413. grid0.addWidget(self.grb_ma_low_entry, 18, 1)
  1414. # Mark area Tool high threshold
  1415. self.grb_ma_high_label = QtWidgets.QLabel('%s:' % _('Threshold high'))
  1416. self.grb_ma_high_label.setToolTip(
  1417. _("Threshold value over which the apertures are not marked.")
  1418. )
  1419. self.grb_ma_high_entry = LengthEntry()
  1420. grid0.addWidget(self.grb_ma_high_label, 19, 0)
  1421. grid0.addWidget(self.grb_ma_high_entry, 19, 1)
  1422. self.layout.addStretch()
  1423. class ExcellonGenPrefGroupUI(OptionsGroupUI):
  1424. def __init__(self, parent=None):
  1425. # OptionsGroupUI.__init__(self, "Excellon Options", parent=parent)
  1426. super(ExcellonGenPrefGroupUI, self).__init__(self)
  1427. self.setTitle(str(_("Excellon General")))
  1428. # Plot options
  1429. self.plot_options_label = QtWidgets.QLabel("<b>%s:</b>" % _("Plot Options"))
  1430. self.layout.addWidget(self.plot_options_label)
  1431. grid1 = QtWidgets.QGridLayout()
  1432. self.layout.addLayout(grid1)
  1433. self.plot_cb = FCCheckBox(label=_('Plot'))
  1434. self.plot_cb.setToolTip(
  1435. "Plot (show) this object."
  1436. )
  1437. grid1.addWidget(self.plot_cb, 0, 0)
  1438. self.solid_cb = FCCheckBox(label=_('Solid'))
  1439. self.solid_cb.setToolTip(
  1440. "Plot as solid circles."
  1441. )
  1442. grid1.addWidget(self.solid_cb, 0, 1)
  1443. # Excellon format
  1444. self.excellon_format_label = QtWidgets.QLabel("<b>%s:</b>" % _("Excellon Format"))
  1445. self.excellon_format_label.setToolTip(
  1446. _("The NC drill files, usually named Excellon files\n"
  1447. "are files that can be found in different formats.\n"
  1448. "Here we set the format used when the provided\n"
  1449. "coordinates are not using period.\n"
  1450. "\n"
  1451. "Possible presets:\n"
  1452. "\n"
  1453. "PROTEUS 3:3 MM LZ\n"
  1454. "DipTrace 5:2 MM TZ\n"
  1455. "DipTrace 4:3 MM LZ\n"
  1456. "\n"
  1457. "EAGLE 3:3 MM TZ\n"
  1458. "EAGLE 4:3 MM TZ\n"
  1459. "EAGLE 2:5 INCH TZ\n"
  1460. "EAGLE 3:5 INCH TZ\n"
  1461. "\n"
  1462. "ALTIUM 2:4 INCH LZ\n"
  1463. "Sprint Layout 2:4 INCH LZ"
  1464. "\n"
  1465. "KiCAD 3:5 INCH TZ")
  1466. )
  1467. self.layout.addWidget(self.excellon_format_label)
  1468. hlay1 = QtWidgets.QHBoxLayout()
  1469. self.layout.addLayout(hlay1)
  1470. self.excellon_format_in_label = QtWidgets.QLabel('%s:' % _("INCH"))
  1471. self.excellon_format_in_label.setAlignment(QtCore.Qt.AlignLeft)
  1472. self.excellon_format_in_label.setToolTip(
  1473. _("Default values for INCH are 2:4"))
  1474. hlay1.addWidget(self.excellon_format_in_label, QtCore.Qt.AlignLeft)
  1475. self.excellon_format_upper_in_entry = IntEntry()
  1476. self.excellon_format_upper_in_entry.setMaxLength(1)
  1477. self.excellon_format_upper_in_entry.setAlignment(QtCore.Qt.AlignRight)
  1478. self.excellon_format_upper_in_entry.setMinimumWidth(30)
  1479. self.excellon_format_upper_in_entry.setToolTip(
  1480. _("This numbers signify the number of digits in\n"
  1481. "the whole part of Excellon coordinates.")
  1482. )
  1483. hlay1.addWidget(self.excellon_format_upper_in_entry, QtCore.Qt.AlignLeft)
  1484. excellon_separator_in_label = QtWidgets.QLabel(':')
  1485. excellon_separator_in_label.setFixedWidth(5)
  1486. hlay1.addWidget(excellon_separator_in_label, QtCore.Qt.AlignLeft)
  1487. self.excellon_format_lower_in_entry = IntEntry()
  1488. self.excellon_format_lower_in_entry.setMaxLength(1)
  1489. self.excellon_format_lower_in_entry.setAlignment(QtCore.Qt.AlignRight)
  1490. self.excellon_format_lower_in_entry.setMinimumWidth(30)
  1491. self.excellon_format_lower_in_entry.setToolTip(
  1492. _("This numbers signify the number of digits in\n"
  1493. "the decimal part of Excellon coordinates.")
  1494. )
  1495. hlay1.addWidget(self.excellon_format_lower_in_entry, QtCore.Qt.AlignLeft)
  1496. hlay1.addStretch()
  1497. hlay2 = QtWidgets.QHBoxLayout()
  1498. self.layout.addLayout(hlay2)
  1499. self.excellon_format_mm_label = QtWidgets.QLabel('%s:' % _("METRIC"))
  1500. self.excellon_format_mm_label.setAlignment(QtCore.Qt.AlignLeft)
  1501. self.excellon_format_mm_label.setToolTip(
  1502. _("Default values for METRIC are 3:3"))
  1503. hlay2.addWidget(self.excellon_format_mm_label, QtCore.Qt.AlignLeft)
  1504. self.excellon_format_upper_mm_entry = IntEntry()
  1505. self.excellon_format_upper_mm_entry.setMaxLength(1)
  1506. self.excellon_format_upper_mm_entry.setAlignment(QtCore.Qt.AlignRight)
  1507. self.excellon_format_upper_mm_entry.setMinimumWidth(30)
  1508. self.excellon_format_upper_mm_entry.setToolTip(
  1509. _("This numbers signify the number of digits in\n"
  1510. "the whole part of Excellon coordinates.")
  1511. )
  1512. hlay2.addWidget(self.excellon_format_upper_mm_entry, QtCore.Qt.AlignLeft)
  1513. excellon_separator_mm_label = QtWidgets.QLabel(':')
  1514. excellon_separator_mm_label.setFixedWidth(5)
  1515. hlay2.addWidget(excellon_separator_mm_label, QtCore.Qt.AlignLeft)
  1516. self.excellon_format_lower_mm_entry = IntEntry()
  1517. self.excellon_format_lower_mm_entry.setMaxLength(1)
  1518. self.excellon_format_lower_mm_entry.setAlignment(QtCore.Qt.AlignRight)
  1519. self.excellon_format_lower_mm_entry.setMinimumWidth(30)
  1520. self.excellon_format_lower_mm_entry.setToolTip(
  1521. _("This numbers signify the number of digits in\n"
  1522. "the decimal part of Excellon coordinates.")
  1523. )
  1524. hlay2.addWidget(self.excellon_format_lower_mm_entry, QtCore.Qt.AlignLeft)
  1525. hlay2.addStretch()
  1526. grid2 = QtWidgets.QGridLayout()
  1527. self.layout.addLayout(grid2)
  1528. self.excellon_zeros_label = QtWidgets.QLabel('%s:' % _('Default <b>Zeros</b>'))
  1529. self.excellon_zeros_label.setAlignment(QtCore.Qt.AlignLeft)
  1530. self.excellon_zeros_label.setToolTip(
  1531. _("This sets the type of Excellon zeros.\n"
  1532. "If LZ then Leading Zeros are kept and\n"
  1533. "Trailing Zeros are removed.\n"
  1534. "If TZ is checked then Trailing Zeros are kept\n"
  1535. "and Leading Zeros are removed.")
  1536. )
  1537. grid2.addWidget(self.excellon_zeros_label, 0, 0)
  1538. self.excellon_zeros_radio = RadioSet([{'label': _('LZ'), 'value': 'L'},
  1539. {'label': _('TZ'), 'value': 'T'}])
  1540. self.excellon_zeros_radio.setToolTip(
  1541. _("This sets the default type of Excellon zeros.\n"
  1542. "If it is not detected in the parsed file the value here\n"
  1543. "will be used."
  1544. "If LZ then Leading Zeros are kept and\n"
  1545. "Trailing Zeros are removed.\n"
  1546. "If TZ is checked then Trailing Zeros are kept\n"
  1547. "and Leading Zeros are removed.")
  1548. )
  1549. grid2.addWidget(self.excellon_zeros_radio, 0, 1)
  1550. self.excellon_units_label = QtWidgets.QLabel('%s:' % _('Default <b>Units</b>'))
  1551. self.excellon_units_label.setAlignment(QtCore.Qt.AlignLeft)
  1552. self.excellon_units_label.setToolTip(
  1553. _("This sets the default units of Excellon files.\n"
  1554. "If it is not detected in the parsed file the value here\n"
  1555. "will be used."
  1556. "Some Excellon files don't have an header\n"
  1557. "therefore this parameter will be used.")
  1558. )
  1559. grid2.addWidget(self.excellon_units_label, 1, 0)
  1560. self.excellon_units_radio = RadioSet([{'label': _('INCH'), 'value': 'INCH'},
  1561. {'label': _('MM'), 'value': 'METRIC'}])
  1562. self.excellon_units_radio.setToolTip(
  1563. _("This sets the units of Excellon files.\n"
  1564. "Some Excellon files don't have an header\n"
  1565. "therefore this parameter will be used.")
  1566. )
  1567. grid2.addWidget(self.excellon_units_radio, 1, 1)
  1568. self.update_excellon_cb = FCCheckBox(label=_('Update Export settings'))
  1569. self.update_excellon_cb.setToolTip(
  1570. "If checked, the Excellon Export settings will be updated with the ones above."
  1571. )
  1572. grid2.addWidget(self.update_excellon_cb, 2, 0, 1, 2)
  1573. grid2.addWidget(QtWidgets.QLabel(""), 3, 0)
  1574. self.excellon_general_label = QtWidgets.QLabel("<b>%s:</b>" % _("Excellon Optimization"))
  1575. grid2.addWidget(self.excellon_general_label, 4, 0, 1, 2)
  1576. self.excellon_optimization_label = QtWidgets.QLabel(_('Algorithm:'))
  1577. self.excellon_optimization_label.setToolTip(
  1578. _("This sets the optimization type for the Excellon drill path.\n"
  1579. "If <<MetaHeuristic>> is checked then Google OR-Tools algorithm with\n"
  1580. "MetaHeuristic Guided Local Path is used. Default search time is 3sec.\n"
  1581. "If <<Basic>> is checked then Google OR-Tools Basic algorithm is used.\n"
  1582. "If <<TSA>> is checked then Travelling Salesman algorithm is used for\n"
  1583. "drill path optimization.\n"
  1584. "\n"
  1585. "If this control is disabled, then FlatCAM works in 32bit mode and it uses\n"
  1586. "Travelling Salesman algorithm for path optimization.")
  1587. )
  1588. grid2.addWidget(self.excellon_optimization_label, 5, 0)
  1589. self.excellon_optimization_radio = RadioSet([{'label': _('MetaHeuristic'), 'value': 'M'},
  1590. {'label': _('Basic'), 'value': 'B'},
  1591. {'label': _('TSA'), 'value': 'T'}],
  1592. orientation='vertical', stretch=False)
  1593. self.excellon_optimization_radio.setToolTip(
  1594. _("This sets the optimization type for the Excellon drill path.\n"
  1595. "If <<MetaHeuristic>> is checked then Google OR-Tools algorithm with\n"
  1596. "MetaHeuristic Guided Local Path is used. Default search time is 3sec.\n"
  1597. "If <<Basic>> is checked then Google OR-Tools Basic algorithm is used.\n"
  1598. "If <<TSA>> is checked then Travelling Salesman algorithm is used for\n"
  1599. "drill path optimization.\n"
  1600. "\n"
  1601. "If this control is disabled, then FlatCAM works in 32bit mode and it uses\n"
  1602. "Travelling Salesman algorithm for path optimization.")
  1603. )
  1604. grid2.addWidget(self.excellon_optimization_radio, 5, 1)
  1605. self.optimization_time_label = QtWidgets.QLabel('%s:' % _('Optimization Time'))
  1606. self.optimization_time_label.setAlignment(QtCore.Qt.AlignLeft)
  1607. self.optimization_time_label.setToolTip(
  1608. _("When OR-Tools Metaheuristic (MH) is enabled there is a\n"
  1609. "maximum threshold for how much time is spent doing the\n"
  1610. "path optimization. This max duration is set here.\n"
  1611. "In seconds.")
  1612. )
  1613. grid2.addWidget(self.optimization_time_label, 6, 0)
  1614. self.optimization_time_entry = IntEntry()
  1615. self.optimization_time_entry.setValidator(QtGui.QIntValidator(0, 999))
  1616. grid2.addWidget(self.optimization_time_entry, 6, 1)
  1617. current_platform = platform.architecture()[0]
  1618. if current_platform == '64bit':
  1619. self.excellon_optimization_label.setDisabled(False)
  1620. self.excellon_optimization_radio.setDisabled(False)
  1621. self.optimization_time_label.setDisabled(False)
  1622. self.optimization_time_entry.setDisabled(False)
  1623. self.excellon_optimization_radio.activated_custom.connect(self.optimization_selection)
  1624. else:
  1625. self.excellon_optimization_label.setDisabled(True)
  1626. self.excellon_optimization_radio.setDisabled(True)
  1627. self.optimization_time_label.setDisabled(True)
  1628. self.optimization_time_entry.setDisabled(True)
  1629. self.layout.addStretch()
  1630. def optimization_selection(self):
  1631. if self.excellon_optimization_radio.get_value() == 'M':
  1632. self.optimization_time_label.setDisabled(False)
  1633. self.optimization_time_entry.setDisabled(False)
  1634. else:
  1635. self.optimization_time_label.setDisabled(True)
  1636. self.optimization_time_entry.setDisabled(True)
  1637. class ExcellonOptPrefGroupUI(OptionsGroupUI):
  1638. def __init__(self, parent=None):
  1639. # OptionsGroupUI.__init__(self, "Excellon Options", parent=parent)
  1640. super(ExcellonOptPrefGroupUI, self).__init__(self)
  1641. self.setTitle(str(_("Excellon Options")))
  1642. # ## Create CNC Job
  1643. self.cncjob_label = QtWidgets.QLabel('<b>%s</b>' % _('Create CNC Job'))
  1644. self.cncjob_label.setToolTip(
  1645. _("Parameters used to create a CNC Job object\n"
  1646. "for this drill object.")
  1647. )
  1648. self.layout.addWidget(self.cncjob_label)
  1649. grid2 = QtWidgets.QGridLayout()
  1650. self.layout.addLayout(grid2)
  1651. # Cut Z
  1652. cutzlabel = QtWidgets.QLabel('%s:' % _('Cut Z'))
  1653. cutzlabel.setToolTip(
  1654. _("Drill depth (negative)\n"
  1655. "below the copper surface.")
  1656. )
  1657. grid2.addWidget(cutzlabel, 0, 0)
  1658. self.cutz_entry = LengthEntry()
  1659. grid2.addWidget(self.cutz_entry, 0, 1)
  1660. # Travel Z
  1661. travelzlabel = QtWidgets.QLabel('%s:' % _('Travel Z'))
  1662. travelzlabel.setToolTip(
  1663. _("Tool height when travelling\n"
  1664. "across the XY plane.")
  1665. )
  1666. grid2.addWidget(travelzlabel, 1, 0)
  1667. self.travelz_entry = LengthEntry()
  1668. grid2.addWidget(self.travelz_entry, 1, 1)
  1669. # Tool change:
  1670. toolchlabel = QtWidgets.QLabel('%s:' % _("Tool change"))
  1671. toolchlabel.setToolTip(
  1672. _("Include tool-change sequence\n"
  1673. "in G-Code (Pause for tool change).")
  1674. )
  1675. self.toolchange_cb = FCCheckBox()
  1676. grid2.addWidget(toolchlabel, 2, 0)
  1677. grid2.addWidget(self.toolchange_cb, 2, 1)
  1678. toolchangezlabel = QtWidgets.QLabel('%s:' % _('Toolchange Z'))
  1679. toolchangezlabel.setToolTip(
  1680. _("Z-axis position (height) for\n"
  1681. "tool change.")
  1682. )
  1683. grid2.addWidget(toolchangezlabel, 3, 0)
  1684. self.toolchangez_entry = LengthEntry()
  1685. grid2.addWidget(self.toolchangez_entry, 3, 1)
  1686. # End Move Z
  1687. endzlabel = QtWidgets.QLabel('%s:' % _('End move Z'))
  1688. endzlabel.setToolTip(
  1689. _("Height of the tool after\n"
  1690. "the last move at the end of the job.")
  1691. )
  1692. grid2.addWidget(endzlabel, 4, 0)
  1693. self.eendz_entry = LengthEntry()
  1694. grid2.addWidget(self.eendz_entry, 4, 1)
  1695. # Feedrate Z
  1696. frlabel = QtWidgets.QLabel('%s:' % _('Feedrate Z'))
  1697. frlabel.setToolTip(
  1698. _("Tool speed while drilling\n"
  1699. "(in units per minute).\n"
  1700. "So called 'Plunge' feedrate.\n"
  1701. "This is for linear move G01.")
  1702. )
  1703. grid2.addWidget(frlabel, 5, 0)
  1704. self.feedrate_entry = LengthEntry()
  1705. grid2.addWidget(self.feedrate_entry, 5, 1)
  1706. # Spindle speed
  1707. spdlabel = QtWidgets.QLabel('%s:' % _('Spindle Speed'))
  1708. spdlabel.setToolTip(
  1709. _("Speed of the spindle\n"
  1710. "in RPM (optional)")
  1711. )
  1712. grid2.addWidget(spdlabel, 6, 0)
  1713. self.spindlespeed_entry = IntEntry(allow_empty=True)
  1714. grid2.addWidget(self.spindlespeed_entry, 6, 1)
  1715. # Dwell
  1716. dwelllabel = QtWidgets.QLabel('%s:' % _('Dwell'))
  1717. dwelllabel.setToolTip(
  1718. _("Pause to allow the spindle to reach its\n"
  1719. "speed before cutting.")
  1720. )
  1721. dwelltime = QtWidgets.QLabel('%s:' % _('Duration'))
  1722. dwelltime.setToolTip(
  1723. _("Number of time units for spindle to dwell.")
  1724. )
  1725. self.dwell_cb = FCCheckBox()
  1726. self.dwelltime_entry = FCEntry()
  1727. grid2.addWidget(dwelllabel, 7, 0)
  1728. grid2.addWidget(self.dwell_cb, 7, 1)
  1729. grid2.addWidget(dwelltime, 8, 0)
  1730. grid2.addWidget(self.dwelltime_entry, 8, 1)
  1731. self.ois_dwell_exc = OptionalInputSection(self.dwell_cb, [self.dwelltime_entry])
  1732. # postprocessor selection
  1733. pp_excellon_label = QtWidgets.QLabel('%s:' % _("Postprocessor"))
  1734. pp_excellon_label.setToolTip(
  1735. _("The postprocessor JSON file that dictates\n"
  1736. "Gcode output.")
  1737. )
  1738. grid2.addWidget(pp_excellon_label, 9, 0)
  1739. self.pp_excellon_name_cb = FCComboBox()
  1740. self.pp_excellon_name_cb.setFocusPolicy(Qt.StrongFocus)
  1741. grid2.addWidget(self.pp_excellon_name_cb, 9, 1)
  1742. # ### Choose what to use for Gcode creation: Drills, Slots or Both
  1743. excellon_gcode_type_label = QtWidgets.QLabel('<b>%s</b>' % _('Gcode'))
  1744. excellon_gcode_type_label.setToolTip(
  1745. _("Choose what to use for GCode generation:\n"
  1746. "'Drills', 'Slots' or 'Both'.\n"
  1747. "When choosing 'Slots' or 'Both', slots will be\n"
  1748. "converted to drills.")
  1749. )
  1750. self.excellon_gcode_type_radio = RadioSet([{'label': 'Drills', 'value': 'drills'},
  1751. {'label': 'Slots', 'value': 'slots'},
  1752. {'label': 'Both', 'value': 'both'}])
  1753. grid2.addWidget(excellon_gcode_type_label, 10, 0)
  1754. grid2.addWidget(self.excellon_gcode_type_radio, 10, 1)
  1755. # until I decide to implement this feature those remain disabled
  1756. excellon_gcode_type_label.hide()
  1757. self.excellon_gcode_type_radio.setVisible(False)
  1758. # ### Milling Holes ## ##
  1759. self.mill_hole_label = QtWidgets.QLabel('<b>%s</b>' % _('Mill Holes'))
  1760. self.mill_hole_label.setToolTip(
  1761. _("Create Geometry for milling holes.")
  1762. )
  1763. grid2.addWidget(self.mill_hole_label, 11, 0, 1, 2)
  1764. tdlabel = QtWidgets.QLabel('%s:' % _('Drill Tool dia'))
  1765. tdlabel.setToolTip(
  1766. _("Diameter of the cutting tool.")
  1767. )
  1768. grid2.addWidget(tdlabel, 12, 0)
  1769. self.tooldia_entry = LengthEntry()
  1770. grid2.addWidget(self.tooldia_entry, 12, 1)
  1771. stdlabel = QtWidgets.QLabel('%s:' % _('Slot Tool dia'))
  1772. stdlabel.setToolTip(
  1773. _("Diameter of the cutting tool\n"
  1774. "when milling slots.")
  1775. )
  1776. grid2.addWidget(stdlabel, 13, 0)
  1777. self.slot_tooldia_entry = LengthEntry()
  1778. grid2.addWidget(self.slot_tooldia_entry, 13, 1)
  1779. grid4 = QtWidgets.QGridLayout()
  1780. self.layout.addLayout(grid4)
  1781. # Adding the Excellon Format Defaults Button
  1782. self.excellon_defaults_button = QtWidgets.QPushButton()
  1783. self.excellon_defaults_button.setText(str(_("Defaults")))
  1784. self.excellon_defaults_button.setMinimumWidth(80)
  1785. grid4.addWidget(self.excellon_defaults_button, 0, 0, QtCore.Qt.AlignRight)
  1786. self.layout.addStretch()
  1787. class ExcellonAdvOptPrefGroupUI(OptionsGroupUI):
  1788. def __init__(self, parent=None):
  1789. # OptionsGroupUI.__init__(self, "Excellon Advanced Options", parent=parent)
  1790. super(ExcellonAdvOptPrefGroupUI, self).__init__(self)
  1791. self.setTitle(str(_("Excellon Adv. Options")))
  1792. # #######################
  1793. # ## ADVANCED OPTIONS ###
  1794. # #######################
  1795. self.exc_label = QtWidgets.QLabel('<b>%s:</b>' % _('Advanced Options'))
  1796. self.exc_label.setToolTip(
  1797. _("A list of Excellon advanced parameters.\n"
  1798. "Those parameters are available only for\n"
  1799. "Advanced App. Level.")
  1800. )
  1801. self.layout.addWidget(self.exc_label)
  1802. grid1 = QtWidgets.QGridLayout()
  1803. self.layout.addLayout(grid1)
  1804. offsetlabel = QtWidgets.QLabel('%s:' % _('Offset Z'))
  1805. offsetlabel.setToolTip(
  1806. _("Some drill bits (the larger ones) need to drill deeper\n"
  1807. "to create the desired exit hole diameter due of the tip shape.\n"
  1808. "The value here can compensate the Cut Z parameter."))
  1809. grid1.addWidget(offsetlabel, 0, 0)
  1810. self.offset_entry = LengthEntry()
  1811. grid1.addWidget(self.offset_entry, 0, 1)
  1812. toolchange_xy_label = QtWidgets.QLabel('%s:' % _('Toolchange X,Y'))
  1813. toolchange_xy_label.setToolTip(
  1814. _("Toolchange X,Y position.")
  1815. )
  1816. grid1.addWidget(toolchange_xy_label, 1, 0)
  1817. self.toolchangexy_entry = FCEntry()
  1818. grid1.addWidget(self.toolchangexy_entry, 1, 1)
  1819. startzlabel = QtWidgets.QLabel('%s:' % _('Start move Z'))
  1820. startzlabel.setToolTip(
  1821. _("Height of the tool just after start.\n"
  1822. "Delete the value if you don't need this feature.")
  1823. )
  1824. grid1.addWidget(startzlabel, 2, 0)
  1825. self.estartz_entry = FloatEntry()
  1826. grid1.addWidget(self.estartz_entry, 2, 1)
  1827. # Feedrate Rapids
  1828. fr_rapid_label = QtWidgets.QLabel('%s:' % _('Feedrate Rapids'))
  1829. fr_rapid_label.setToolTip(
  1830. _("Tool speed while drilling\n"
  1831. "(in units per minute).\n"
  1832. "This is for the rapid move G00.\n"
  1833. "It is useful only for Marlin,\n"
  1834. "ignore for any other cases.")
  1835. )
  1836. grid1.addWidget(fr_rapid_label, 3, 0)
  1837. self.feedrate_rapid_entry = LengthEntry()
  1838. grid1.addWidget(self.feedrate_rapid_entry, 3, 1)
  1839. # Probe depth
  1840. self.pdepth_label = QtWidgets.QLabel('%s:' % _("Probe Z depth"))
  1841. self.pdepth_label.setToolTip(
  1842. _("The maximum depth that the probe is allowed\n"
  1843. "to probe. Negative value, in current units.")
  1844. )
  1845. grid1.addWidget(self.pdepth_label, 4, 0)
  1846. self.pdepth_entry = FCEntry()
  1847. grid1.addWidget(self.pdepth_entry, 4, 1)
  1848. # Probe feedrate
  1849. self.feedrate_probe_label = QtWidgets.QLabel('%s:' % _("Feedrate Probe"))
  1850. self.feedrate_probe_label.setToolTip(
  1851. _("The feedrate used while the probe is probing.")
  1852. )
  1853. grid1.addWidget(self.feedrate_probe_label, 5, 0)
  1854. self.feedrate_probe_entry = FCEntry()
  1855. grid1.addWidget(self.feedrate_probe_entry, 5, 1)
  1856. # Spindle direction
  1857. spindle_dir_label = QtWidgets.QLabel('%s:' % _('Spindle dir.'))
  1858. spindle_dir_label.setToolTip(
  1859. _("This sets the direction that the spindle is rotating.\n"
  1860. "It can be either:\n"
  1861. "- CW = clockwise or\n"
  1862. "- CCW = counter clockwise")
  1863. )
  1864. self.spindledir_radio = RadioSet([{'label': _('CW'), 'value': 'CW'},
  1865. {'label': _('CCW'), 'value': 'CCW'}])
  1866. grid1.addWidget(spindle_dir_label, 6, 0)
  1867. grid1.addWidget(self.spindledir_radio, 6, 1)
  1868. fplungelabel = QtWidgets.QLabel('%s:' % _('Fast Plunge'))
  1869. fplungelabel.setToolTip(
  1870. _("By checking this, the vertical move from\n"
  1871. "Z_Toolchange to Z_move is done with G0,\n"
  1872. "meaning the fastest speed available.\n"
  1873. "WARNING: the move is done at Toolchange X,Y coords.")
  1874. )
  1875. self.fplunge_cb = FCCheckBox()
  1876. grid1.addWidget(fplungelabel, 7, 0)
  1877. grid1.addWidget(self.fplunge_cb, 7, 1)
  1878. fretractlabel = QtWidgets.QLabel('%s:' % _('Fast Retract'))
  1879. fretractlabel.setToolTip(
  1880. _("Exit hole strategy.\n"
  1881. " - When uncheked, while exiting the drilled hole the drill bit\n"
  1882. "will travel slow, with set feedrate (G1), up to zero depth and then\n"
  1883. "travel as fast as possible (G0) to the Z Move (travel height).\n"
  1884. " - When checked the travel from Z cut (cut depth) to Z_move\n"
  1885. "(travel height) is done as fast as possible (G0) in one move.")
  1886. )
  1887. self.fretract_cb = FCCheckBox()
  1888. grid1.addWidget(fretractlabel, 8, 0)
  1889. grid1.addWidget(self.fretract_cb, 8, 1)
  1890. self.layout.addStretch()
  1891. class ExcellonExpPrefGroupUI(OptionsGroupUI):
  1892. def __init__(self, parent=None):
  1893. super(ExcellonExpPrefGroupUI, self).__init__(self)
  1894. self.setTitle(str(_("Excellon Export")))
  1895. # Plot options
  1896. self.export_options_label = QtWidgets.QLabel("<b>%s:</b>" % _("Export Options"))
  1897. self.export_options_label.setToolTip(
  1898. _("The parameters set here are used in the file exported\n"
  1899. "when using the File -> Export -> Export Excellon menu entry.")
  1900. )
  1901. self.layout.addWidget(self.export_options_label)
  1902. form = QtWidgets.QFormLayout()
  1903. self.layout.addLayout(form)
  1904. # Excellon Units
  1905. self.excellon_units_label = QtWidgets.QLabel('<b>%s:</b>' % _('Units'))
  1906. self.excellon_units_label.setToolTip(
  1907. _("The units used in the Excellon file.")
  1908. )
  1909. self.excellon_units_radio = RadioSet([{'label': _('INCH'), 'value': 'INCH'},
  1910. {'label': _('MM'), 'value': 'METRIC'}])
  1911. self.excellon_units_radio.setToolTip(
  1912. _("The units used in the Excellon file.")
  1913. )
  1914. form.addRow(self.excellon_units_label, self.excellon_units_radio)
  1915. # Excellon non-decimal format
  1916. self.digits_label = QtWidgets.QLabel("<b>%s:</b>" % _("Int/Decimals"))
  1917. self.digits_label.setToolTip(
  1918. _("The NC drill files, usually named Excellon files\n"
  1919. "are files that can be found in different formats.\n"
  1920. "Here we set the format used when the provided\n"
  1921. "coordinates are not using period.")
  1922. )
  1923. hlay1 = QtWidgets.QHBoxLayout()
  1924. self.format_whole_entry = IntEntry()
  1925. self.format_whole_entry.setMaxLength(1)
  1926. self.format_whole_entry.setAlignment(QtCore.Qt.AlignRight)
  1927. self.format_whole_entry.setMinimumWidth(30)
  1928. self.format_whole_entry.setToolTip(
  1929. _("This numbers signify the number of digits in\n"
  1930. "the whole part of Excellon coordinates.")
  1931. )
  1932. hlay1.addWidget(self.format_whole_entry, QtCore.Qt.AlignLeft)
  1933. excellon_separator_label = QtWidgets.QLabel(':')
  1934. excellon_separator_label.setFixedWidth(5)
  1935. hlay1.addWidget(excellon_separator_label, QtCore.Qt.AlignLeft)
  1936. self.format_dec_entry = IntEntry()
  1937. self.format_dec_entry.setMaxLength(1)
  1938. self.format_dec_entry.setAlignment(QtCore.Qt.AlignRight)
  1939. self.format_dec_entry.setMinimumWidth(30)
  1940. self.format_dec_entry.setToolTip(
  1941. _("This numbers signify the number of digits in\n"
  1942. "the decimal part of Excellon coordinates.")
  1943. )
  1944. hlay1.addWidget(self.format_dec_entry, QtCore.Qt.AlignLeft)
  1945. hlay1.addStretch()
  1946. form.addRow(self.digits_label, hlay1)
  1947. # Select the Excellon Format
  1948. self.format_label = QtWidgets.QLabel("<b>%s:</b>" % _("Format"))
  1949. self.format_label.setToolTip(
  1950. _("Select the kind of coordinates format used.\n"
  1951. "Coordinates can be saved with decimal point or without.\n"
  1952. "When there is no decimal point, it is required to specify\n"
  1953. "the number of digits for integer part and the number of decimals.\n"
  1954. "Also it will have to be specified if LZ = leading zeros are kept\n"
  1955. "or TZ = trailing zeros are kept.")
  1956. )
  1957. self.format_radio = RadioSet([{'label': _('Decimal'), 'value': 'dec'},
  1958. {'label': _('No-Decimal'), 'value': 'ndec'}])
  1959. self.format_radio.setToolTip(
  1960. _("Select the kind of coordinates format used.\n"
  1961. "Coordinates can be saved with decimal point or without.\n"
  1962. "When there is no decimal point, it is required to specify\n"
  1963. "the number of digits for integer part and the number of decimals.\n"
  1964. "Also it will have to be specified if LZ = leading zeros are kept\n"
  1965. "or TZ = trailing zeros are kept.")
  1966. )
  1967. form.addRow(self.format_label, self.format_radio)
  1968. # Excellon Zeros
  1969. self.zeros_label = QtWidgets.QLabel('<b>%s:</b>' % _('Zeros'))
  1970. self.zeros_label.setAlignment(QtCore.Qt.AlignLeft)
  1971. self.zeros_label.setToolTip(
  1972. _("This sets the type of Excellon zeros.\n"
  1973. "If LZ then Leading Zeros are kept and\n"
  1974. "Trailing Zeros are removed.\n"
  1975. "If TZ is checked then Trailing Zeros are kept\n"
  1976. "and Leading Zeros are removed.")
  1977. )
  1978. self.zeros_radio = RadioSet([{'label': _('LZ'), 'value': 'LZ'},
  1979. {'label': _('TZ'), 'value': 'TZ'}])
  1980. self.zeros_radio.setToolTip(
  1981. _("This sets the default type of Excellon zeros.\n"
  1982. "If LZ then Leading Zeros are kept and\n"
  1983. "Trailing Zeros are removed.\n"
  1984. "If TZ is checked then Trailing Zeros are kept\n"
  1985. "and Leading Zeros are removed.")
  1986. )
  1987. form.addRow(self.zeros_label, self.zeros_radio)
  1988. # Slot type
  1989. self.slot_type_label = QtWidgets.QLabel('<b>%s:</b>' % _('Slot type'))
  1990. self.slot_type_label.setAlignment(QtCore.Qt.AlignLeft)
  1991. self.slot_type_label.setToolTip(
  1992. _("This sets how the slots will be exported.\n"
  1993. "If ROUTED then the slots will be routed\n"
  1994. "using M15/M16 commands.\n"
  1995. "If DRILLED(G85) the slots will be exported\n"
  1996. "using the Drilled slot command (G85).")
  1997. )
  1998. self.slot_type_radio = RadioSet([{'label': _('Routed'), 'value': 'routing'},
  1999. {'label': _('Drilled(G85)'), 'value': 'drilling'}])
  2000. self.slot_type_radio.setToolTip(
  2001. _("This sets how the slots will be exported.\n"
  2002. "If ROUTED then the slots will be routed\n"
  2003. "using M15/M16 commands.\n"
  2004. "If DRILLED(G85) the slots will be exported\n"
  2005. "using the Drilled slot command (G85).")
  2006. )
  2007. form.addRow(self.slot_type_label, self.slot_type_radio)
  2008. self.layout.addStretch()
  2009. self.format_radio.activated_custom.connect(self.optimization_selection)
  2010. def optimization_selection(self):
  2011. if self.format_radio.get_value() == 'dec':
  2012. self.zeros_label.setDisabled(True)
  2013. self.zeros_radio.setDisabled(True)
  2014. else:
  2015. self.zeros_label.setDisabled(False)
  2016. self.zeros_radio.setDisabled(False)
  2017. class ExcellonEditorPrefGroupUI(OptionsGroupUI):
  2018. def __init__(self, parent=None):
  2019. super(ExcellonEditorPrefGroupUI, self).__init__(self)
  2020. self.setTitle(str(_("Excellon Editor")))
  2021. # Excellon Editor Parameters
  2022. self.param_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  2023. self.param_label.setToolTip(
  2024. _("A list of Excellon Editor parameters.")
  2025. )
  2026. self.layout.addWidget(self.param_label)
  2027. grid0 = QtWidgets.QGridLayout()
  2028. self.layout.addLayout(grid0)
  2029. # Selection Limit
  2030. self.sel_limit_label = QtWidgets.QLabel('%s:' % _("Selection limit"))
  2031. self.sel_limit_label.setToolTip(
  2032. _("Set the number of selected Excellon geometry\n"
  2033. "items above which the utility geometry\n"
  2034. "becomes just a selection rectangle.\n"
  2035. "Increases the performance when moving a\n"
  2036. "large number of geometric elements.")
  2037. )
  2038. self.sel_limit_entry = IntEntry()
  2039. grid0.addWidget(self.sel_limit_label, 0, 0)
  2040. grid0.addWidget(self.sel_limit_entry, 0, 1)
  2041. # New tool diameter
  2042. self.addtool_entry_lbl = QtWidgets.QLabel('%s:' % _('New Tool Dia'))
  2043. self.addtool_entry_lbl.setToolTip(
  2044. _("Diameter for the new tool")
  2045. )
  2046. self.addtool_entry = FCEntry()
  2047. self.addtool_entry.setValidator(QtGui.QDoubleValidator(0.0001, 99.9999, 4))
  2048. grid0.addWidget(self.addtool_entry_lbl, 1, 0)
  2049. grid0.addWidget(self.addtool_entry, 1, 1)
  2050. # Number of drill holes in a drill array
  2051. self.drill_array_size_label = QtWidgets.QLabel('%s:' % _('Nr of drills'))
  2052. self.drill_array_size_label.setToolTip(
  2053. _("Specify how many drills to be in the array.")
  2054. )
  2055. # self.drill_array_size_label.setMinimumWidth(100)
  2056. self.drill_array_size_entry = LengthEntry()
  2057. grid0.addWidget(self.drill_array_size_label, 2, 0)
  2058. grid0.addWidget(self.drill_array_size_entry, 2, 1)
  2059. self.drill_array_linear_label = QtWidgets.QLabel('<b>%s:</b>' % _('Linear Drill Array'))
  2060. grid0.addWidget(self.drill_array_linear_label, 3, 0, 1, 2)
  2061. # Linear Drill Array direction
  2062. self.drill_axis_label = QtWidgets.QLabel('%s:' % _('Linear Dir.'))
  2063. self.drill_axis_label.setToolTip(
  2064. _("Direction on which the linear array is oriented:\n"
  2065. "- 'X' - horizontal axis \n"
  2066. "- 'Y' - vertical axis or \n"
  2067. "- 'Angle' - a custom angle for the array inclination")
  2068. )
  2069. # self.drill_axis_label.setMinimumWidth(100)
  2070. self.drill_axis_radio = RadioSet([{'label': _('X'), 'value': 'X'},
  2071. {'label': _('Y'), 'value': 'Y'},
  2072. {'label': _('Angle'), 'value': 'A'}])
  2073. grid0.addWidget(self.drill_axis_label, 4, 0)
  2074. grid0.addWidget(self.drill_axis_radio, 4, 1)
  2075. # Linear Drill Array pitch distance
  2076. self.drill_pitch_label = QtWidgets.QLabel('%s:' % _('Pitch'))
  2077. self.drill_pitch_label.setToolTip(
  2078. _("Pitch = Distance between elements of the array.")
  2079. )
  2080. # self.drill_pitch_label.setMinimumWidth(100)
  2081. self.drill_pitch_entry = LengthEntry()
  2082. grid0.addWidget(self.drill_pitch_label, 5, 0)
  2083. grid0.addWidget(self.drill_pitch_entry, 5, 1)
  2084. # Linear Drill Array custom angle
  2085. self.drill_angle_label = QtWidgets.QLabel('%s:' % _('Angle'))
  2086. self.drill_angle_label.setToolTip(
  2087. _("Angle at which each element in circular array is placed.")
  2088. )
  2089. self.drill_angle_entry = LengthEntry()
  2090. grid0.addWidget(self.drill_angle_label, 6, 0)
  2091. grid0.addWidget(self.drill_angle_entry, 6, 1)
  2092. self.drill_array_circ_label = QtWidgets.QLabel('<b>%s:</b>' % _('Circular Drill Array'))
  2093. grid0.addWidget(self.drill_array_circ_label, 7, 0, 1, 2)
  2094. # Circular Drill Array direction
  2095. self.drill_circular_direction_label = QtWidgets.QLabel('%s:' % _('Circular Dir.'))
  2096. self.drill_circular_direction_label.setToolTip(
  2097. _("Direction for circular array.\n"
  2098. "Can be CW = clockwise or CCW = counter clockwise.")
  2099. )
  2100. self.drill_circular_dir_radio = RadioSet([{'label': _('CW'), 'value': 'CW'},
  2101. {'label': _('CCW'), 'value': 'CCW'}])
  2102. grid0.addWidget(self.drill_circular_direction_label, 8, 0)
  2103. grid0.addWidget(self.drill_circular_dir_radio, 8, 1)
  2104. # Circular Drill Array Angle
  2105. self.drill_circular_angle_label = QtWidgets.QLabel('%s:' % _('Circ. Angle'))
  2106. self.drill_circular_angle_label.setToolTip(
  2107. _("Angle at which each element in circular array is placed.")
  2108. )
  2109. self.drill_circular_angle_entry = LengthEntry()
  2110. grid0.addWidget(self.drill_circular_angle_label, 9, 0)
  2111. grid0.addWidget(self.drill_circular_angle_entry, 9, 1)
  2112. # ##### SLOTS #####
  2113. # #################
  2114. self.drill_array_circ_label = QtWidgets.QLabel('<b>%s:</b>' % _('Slots'))
  2115. grid0.addWidget(self.drill_array_circ_label, 10, 0, 1, 2)
  2116. # Slot length
  2117. self.slot_length_label = QtWidgets.QLabel('%s:' % _('Length'))
  2118. self.slot_length_label.setToolTip(
  2119. _("Length = The length of the slot.")
  2120. )
  2121. self.slot_length_label.setMinimumWidth(100)
  2122. self.slot_length_entry = LengthEntry()
  2123. grid0.addWidget(self.slot_length_label, 11, 0)
  2124. grid0.addWidget(self.slot_length_entry, 11, 1)
  2125. # Slot direction
  2126. self.slot_axis_label = QtWidgets.QLabel('%s:' % _('Direction'))
  2127. self.slot_axis_label.setToolTip(
  2128. _("Direction on which the slot is oriented:\n"
  2129. "- 'X' - horizontal axis \n"
  2130. "- 'Y' - vertical axis or \n"
  2131. "- 'Angle' - a custom angle for the slot inclination")
  2132. )
  2133. self.slot_axis_label.setMinimumWidth(100)
  2134. self.slot_axis_radio = RadioSet([{'label': _('X'), 'value': 'X'},
  2135. {'label': _('Y'), 'value': 'Y'},
  2136. {'label': _('Angle'), 'value': 'A'}])
  2137. grid0.addWidget(self.slot_axis_label, 12, 0)
  2138. grid0.addWidget(self.slot_axis_radio, 12, 1)
  2139. # Slot custom angle
  2140. self.slot_angle_label = QtWidgets.QLabel('%s:' % _('Angle'))
  2141. self.slot_angle_label.setToolTip(
  2142. _("Angle at which the slot is placed.\n"
  2143. "The precision is of max 2 decimals.\n"
  2144. "Min value is: -359.99 degrees.\n"
  2145. "Max value is: 360.00 degrees.")
  2146. )
  2147. self.slot_angle_label.setMinimumWidth(100)
  2148. self.slot_angle_spinner = FCDoubleSpinner()
  2149. self.slot_angle_spinner.set_precision(2)
  2150. self.slot_angle_spinner.setWrapping(True)
  2151. self.slot_angle_spinner.setRange(-359.99, 360.00)
  2152. self.slot_angle_spinner.setSingleStep(1.0)
  2153. grid0.addWidget(self.slot_angle_label, 13, 0)
  2154. grid0.addWidget(self.slot_angle_spinner, 13, 1)
  2155. # #### SLOTS ARRAY #######
  2156. # ########################
  2157. self.slot_array_linear_label = QtWidgets.QLabel('<b>%s:</b>' % _('Linear Slot Array'))
  2158. grid0.addWidget(self.slot_array_linear_label, 14, 0, 1, 2)
  2159. # Number of slot holes in a drill array
  2160. self.slot_array_size_label = QtWidgets.QLabel('%s:' % _('Nr of slots'))
  2161. self.drill_array_size_label.setToolTip(
  2162. _("Specify how many slots to be in the array.")
  2163. )
  2164. # self.slot_array_size_label.setMinimumWidth(100)
  2165. self.slot_array_size_entry = LengthEntry()
  2166. grid0.addWidget(self.slot_array_size_label, 15, 0)
  2167. grid0.addWidget(self.slot_array_size_entry, 15, 1)
  2168. # Linear Slot Array direction
  2169. self.slot_array_axis_label = QtWidgets.QLabel('%s:' % _('Linear Dir.'))
  2170. self.slot_array_axis_label.setToolTip(
  2171. _("Direction on which the linear array is oriented:\n"
  2172. "- 'X' - horizontal axis \n"
  2173. "- 'Y' - vertical axis or \n"
  2174. "- 'Angle' - a custom angle for the array inclination")
  2175. )
  2176. # self.slot_axis_label.setMinimumWidth(100)
  2177. self.slot_array_axis_radio = RadioSet([{'label': _('X'), 'value': 'X'},
  2178. {'label': _('Y'), 'value': 'Y'},
  2179. {'label': _('Angle'), 'value': 'A'}])
  2180. grid0.addWidget(self.slot_array_axis_label, 16, 0)
  2181. grid0.addWidget(self.slot_array_axis_radio, 16, 1)
  2182. # Linear Slot Array pitch distance
  2183. self.slot_array_pitch_label = QtWidgets.QLabel('%s:' % _('Pitch'))
  2184. self.slot_array_pitch_label.setToolTip(
  2185. _("Pitch = Distance between elements of the array.")
  2186. )
  2187. # self.drill_pitch_label.setMinimumWidth(100)
  2188. self.slot_array_pitch_entry = LengthEntry()
  2189. grid0.addWidget(self.slot_array_pitch_label, 17, 0)
  2190. grid0.addWidget(self.slot_array_pitch_entry, 17, 1)
  2191. # Linear Slot Array custom angle
  2192. self.slot_array_angle_label = QtWidgets.QLabel('%s:' % _('Angle'))
  2193. self.slot_array_angle_label.setToolTip(
  2194. _("Angle at which each element in circular array is placed.")
  2195. )
  2196. self.slot_array_angle_entry = LengthEntry()
  2197. grid0.addWidget(self.slot_array_angle_label, 18, 0)
  2198. grid0.addWidget(self.slot_array_angle_entry, 18, 1)
  2199. self.slot_array_circ_label = QtWidgets.QLabel('<b>%s:</b>' % _('Circular Slot Array'))
  2200. grid0.addWidget(self.slot_array_circ_label, 19, 0, 1, 2)
  2201. # Circular Slot Array direction
  2202. self.slot_array_circular_direction_label = QtWidgets.QLabel('%s:' % _('Circular Dir.'))
  2203. self.slot_array_circular_direction_label.setToolTip(
  2204. _("Direction for circular array.\n"
  2205. "Can be CW = clockwise or CCW = counter clockwise.")
  2206. )
  2207. self.slot_array_circular_dir_radio = RadioSet([{'label': _('CW'), 'value': 'CW'},
  2208. {'label': _('CCW'), 'value': 'CCW'}])
  2209. grid0.addWidget(self.slot_array_circular_direction_label, 20, 0)
  2210. grid0.addWidget(self.slot_array_circular_dir_radio, 20, 1)
  2211. # Circular Slot Array Angle
  2212. self.slot_array_circular_angle_label = QtWidgets.QLabel('%s:' % _('Circ. Angle'))
  2213. self.slot_array_circular_angle_label.setToolTip(
  2214. _("Angle at which each element in circular array is placed.")
  2215. )
  2216. self.slot_array_circular_angle_entry = LengthEntry()
  2217. grid0.addWidget(self.slot_array_circular_angle_label, 21, 0)
  2218. grid0.addWidget(self.slot_array_circular_angle_entry, 21, 1)
  2219. self.layout.addStretch()
  2220. class GeometryGenPrefGroupUI(OptionsGroupUI):
  2221. def __init__(self, parent=None):
  2222. # OptionsGroupUI.__init__(self, "Geometry General Preferences", parent=parent)
  2223. super(GeometryGenPrefGroupUI, self).__init__(self)
  2224. self.setTitle(str(_("Geometry General")))
  2225. # ## Plot options
  2226. self.plot_options_label = QtWidgets.QLabel("<b>%s:</b>" % _("Plot Options"))
  2227. self.layout.addWidget(self.plot_options_label)
  2228. # Plot CB
  2229. self.plot_cb = FCCheckBox(label=_('Plot'))
  2230. self.plot_cb.setToolTip(
  2231. _("Plot (show) this object.")
  2232. )
  2233. self.layout.addWidget(self.plot_cb)
  2234. grid0 = QtWidgets.QGridLayout()
  2235. self.layout.addLayout(grid0)
  2236. # Number of circle steps for circular aperture linear approximation
  2237. self.circle_steps_label = QtWidgets.QLabel('%s:' % _("Circle Steps"))
  2238. self.circle_steps_label.setToolTip(
  2239. _("The number of circle steps for <b>Geometry</b> \n"
  2240. "circle and arc shapes linear approximation.")
  2241. )
  2242. grid0.addWidget(self.circle_steps_label, 1, 0)
  2243. self.circle_steps_entry = IntEntry()
  2244. grid0.addWidget(self.circle_steps_entry, 1, 1)
  2245. # Tools
  2246. self.tools_label = QtWidgets.QLabel("<b>%s:</b>" % _("Tools"))
  2247. grid0.addWidget(self.tools_label, 2, 0, 1, 2)
  2248. # Tooldia
  2249. tdlabel = QtWidgets.QLabel('%s:' % _('Tool dia'))
  2250. tdlabel.setToolTip(
  2251. _("Diameters of the cutting tools, separated by ','")
  2252. )
  2253. grid0.addWidget(tdlabel, 3, 0)
  2254. self.cnctooldia_entry = FCEntry()
  2255. grid0.addWidget(self.cnctooldia_entry, 3, 1)
  2256. self.layout.addStretch()
  2257. class GeometryOptPrefGroupUI(OptionsGroupUI):
  2258. def __init__(self, parent=None):
  2259. # OptionsGroupUI.__init__(self, "Geometry Options Preferences", parent=parent)
  2260. super(GeometryOptPrefGroupUI, self).__init__(self)
  2261. self.setTitle(str(_("Geometry Options")))
  2262. # ------------------------------
  2263. # ## Create CNC Job
  2264. # ------------------------------
  2265. self.cncjob_label = QtWidgets.QLabel('<b>%s:</b>' % _('Create CNC Job'))
  2266. self.cncjob_label.setToolTip(
  2267. _("Create a CNC Job object\n"
  2268. "tracing the contours of this\n"
  2269. "Geometry object.")
  2270. )
  2271. self.layout.addWidget(self.cncjob_label)
  2272. grid1 = QtWidgets.QGridLayout()
  2273. self.layout.addLayout(grid1)
  2274. # Cut Z
  2275. cutzlabel = QtWidgets.QLabel('%s:' % _('Cut Z'))
  2276. cutzlabel.setToolTip(
  2277. _("Cutting depth (negative)\n"
  2278. "below the copper surface.")
  2279. )
  2280. grid1.addWidget(cutzlabel, 0, 0)
  2281. self.cutz_entry = LengthEntry()
  2282. grid1.addWidget(self.cutz_entry, 0, 1)
  2283. # Multidepth CheckBox
  2284. self.multidepth_cb = FCCheckBox(label=_('Multi-Depth'))
  2285. self.multidepth_cb.setToolTip(
  2286. _(
  2287. "Use multiple passes to limit\n"
  2288. "the cut depth in each pass. Will\n"
  2289. "cut multiple times until Cut Z is\n"
  2290. "reached."
  2291. )
  2292. )
  2293. grid1.addWidget(self.multidepth_cb, 1, 0)
  2294. # Depth/pass
  2295. dplabel = QtWidgets.QLabel('%s:' % _('Depth/Pass'))
  2296. dplabel.setToolTip(
  2297. _("The depth to cut on each pass,\n"
  2298. "when multidepth is enabled.\n"
  2299. "It has positive value although\n"
  2300. "it is a fraction from the depth\n"
  2301. "which has negative value.")
  2302. )
  2303. grid1.addWidget(dplabel, 2, 0)
  2304. self.depthperpass_entry = LengthEntry()
  2305. grid1.addWidget(self.depthperpass_entry, 2, 1)
  2306. self.ois_multidepth = OptionalInputSection(self.multidepth_cb, [self.depthperpass_entry])
  2307. # Travel Z
  2308. travelzlabel = QtWidgets.QLabel('%s:' % _('Travel Z'))
  2309. travelzlabel.setToolTip(
  2310. _("Height of the tool when\n"
  2311. "moving without cutting.")
  2312. )
  2313. grid1.addWidget(travelzlabel, 3, 0)
  2314. self.travelz_entry = LengthEntry()
  2315. grid1.addWidget(self.travelz_entry, 3, 1)
  2316. # Tool change:
  2317. toolchlabel = QtWidgets.QLabel('%s:' % _("Tool change"))
  2318. toolchlabel.setToolTip(
  2319. _(
  2320. "Include tool-change sequence\n"
  2321. "in the Machine Code (Pause for tool change)."
  2322. )
  2323. )
  2324. self.toolchange_cb = FCCheckBox()
  2325. grid1.addWidget(toolchlabel, 4, 0)
  2326. grid1.addWidget(self.toolchange_cb, 4, 1)
  2327. # Toolchange Z
  2328. toolchangezlabel = QtWidgets.QLabel('%s:' % _('Toolchange Z'))
  2329. toolchangezlabel.setToolTip(
  2330. _(
  2331. "Z-axis position (height) for\n"
  2332. "tool change."
  2333. )
  2334. )
  2335. grid1.addWidget(toolchangezlabel, 5, 0)
  2336. self.toolchangez_entry = LengthEntry()
  2337. grid1.addWidget(self.toolchangez_entry, 5, 1)
  2338. # End move Z
  2339. endzlabel = QtWidgets.QLabel('%s:' % _('End move Z'))
  2340. endzlabel.setToolTip(
  2341. _("Height of the tool after\n"
  2342. "the last move at the end of the job.")
  2343. )
  2344. grid1.addWidget(endzlabel, 6, 0)
  2345. self.gendz_entry = LengthEntry()
  2346. grid1.addWidget(self.gendz_entry, 6, 1)
  2347. # Feedrate X-Y
  2348. frlabel = QtWidgets.QLabel('%s:' % _('Feed Rate X-Y'))
  2349. frlabel.setToolTip(
  2350. _("Cutting speed in the XY\n"
  2351. "plane in units per minute")
  2352. )
  2353. grid1.addWidget(frlabel, 7, 0)
  2354. self.cncfeedrate_entry = LengthEntry()
  2355. grid1.addWidget(self.cncfeedrate_entry, 7, 1)
  2356. # Feedrate Z (Plunge)
  2357. frz_label = QtWidgets.QLabel('%s:' % _('Feed Rate Z'))
  2358. frz_label.setToolTip(
  2359. _("Cutting speed in the XY\n"
  2360. "plane in units per minute.\n"
  2361. "It is called also Plunge.")
  2362. )
  2363. grid1.addWidget(frz_label, 8, 0)
  2364. self.cncplunge_entry = LengthEntry()
  2365. grid1.addWidget(self.cncplunge_entry, 8, 1)
  2366. # Spindle Speed
  2367. spdlabel = QtWidgets.QLabel('%s:' % _('Spindle speed'))
  2368. spdlabel.setToolTip(
  2369. _(
  2370. "Speed of the spindle in RPM (optional).\n"
  2371. "If LASER postprocessor is used,\n"
  2372. "this value is the power of laser."
  2373. )
  2374. )
  2375. grid1.addWidget(spdlabel, 9, 0)
  2376. self.cncspindlespeed_entry = IntEntry(allow_empty=True)
  2377. grid1.addWidget(self.cncspindlespeed_entry, 9, 1)
  2378. # Dwell
  2379. self.dwell_cb = FCCheckBox(label='%s:' % _('Dwell'))
  2380. self.dwell_cb.setToolTip(
  2381. _("Pause to allow the spindle to reach its\n"
  2382. "speed before cutting.")
  2383. )
  2384. dwelltime = QtWidgets.QLabel('%s:' % _('Duration'))
  2385. dwelltime.setToolTip(
  2386. _("Number of time units for spindle to dwell.")
  2387. )
  2388. self.dwelltime_entry = FCEntry()
  2389. grid1.addWidget(self.dwell_cb, 10, 0)
  2390. grid1.addWidget(dwelltime, 11, 0)
  2391. grid1.addWidget(self.dwelltime_entry, 11, 1)
  2392. self.ois_dwell = OptionalInputSection(self.dwell_cb, [self.dwelltime_entry])
  2393. # postprocessor selection
  2394. pp_label = QtWidgets.QLabel('%s:' % _("Postprocessor"))
  2395. pp_label.setToolTip(
  2396. _("The Postprocessor file that dictates\n"
  2397. "the Machine Code (like GCode, RML, HPGL) output.")
  2398. )
  2399. grid1.addWidget(pp_label, 12, 0)
  2400. self.pp_geometry_name_cb = FCComboBox()
  2401. self.pp_geometry_name_cb.setFocusPolicy(Qt.StrongFocus)
  2402. grid1.addWidget(self.pp_geometry_name_cb, 12, 1)
  2403. self.layout.addStretch()
  2404. class GeometryAdvOptPrefGroupUI(OptionsGroupUI):
  2405. def __init__(self, parent=None):
  2406. # OptionsGroupUI.__init__(self, "Geometry Advanced Options Preferences", parent=parent)
  2407. super(GeometryAdvOptPrefGroupUI, self).__init__(self)
  2408. self.setTitle(str(_("Geometry Adv. Options")))
  2409. # ------------------------------
  2410. # ## Advanced Options
  2411. # ------------------------------
  2412. self.geo_label = QtWidgets.QLabel('<b>%s:</b>' % _('Advanced Options'))
  2413. self.geo_label.setToolTip(
  2414. _("A list of Geometry advanced parameters.\n"
  2415. "Those parameters are available only for\n"
  2416. "Advanced App. Level.")
  2417. )
  2418. self.layout.addWidget(self.geo_label)
  2419. grid1 = QtWidgets.QGridLayout()
  2420. self.layout.addLayout(grid1)
  2421. # Toolchange X,Y
  2422. toolchange_xy_label = QtWidgets.QLabel('%s:' % _('Toolchange X-Y'))
  2423. toolchange_xy_label.setToolTip(
  2424. _("Toolchange X,Y position.")
  2425. )
  2426. grid1.addWidget(toolchange_xy_label, 1, 0)
  2427. self.toolchangexy_entry = FCEntry()
  2428. grid1.addWidget(self.toolchangexy_entry, 1, 1)
  2429. # Start move Z
  2430. startzlabel = QtWidgets.QLabel('%s:' % _('Start move Z'))
  2431. startzlabel.setToolTip(
  2432. _("Height of the tool just after starting the work.\n"
  2433. "Delete the value if you don't need this feature.")
  2434. )
  2435. grid1.addWidget(startzlabel, 2, 0)
  2436. self.gstartz_entry = FloatEntry()
  2437. grid1.addWidget(self.gstartz_entry, 2, 1)
  2438. # Feedrate rapids
  2439. fr_rapid_label = QtWidgets.QLabel('%s:' % _('Feed Rate Rapids'))
  2440. fr_rapid_label.setToolTip(
  2441. _("Cutting speed in the XY plane\n"
  2442. "(in units per minute).\n"
  2443. "This is for the rapid move G00.\n"
  2444. "It is useful only for Marlin,\n"
  2445. "ignore for any other cases.")
  2446. )
  2447. grid1.addWidget(fr_rapid_label, 4, 0)
  2448. self.cncfeedrate_rapid_entry = LengthEntry()
  2449. grid1.addWidget(self.cncfeedrate_rapid_entry, 4, 1)
  2450. # End move extra cut
  2451. self.extracut_cb = FCCheckBox(label='%s' % _('Re-cut 1st pt.'))
  2452. self.extracut_cb.setToolTip(
  2453. _("In order to remove possible\n"
  2454. "copper leftovers where first cut\n"
  2455. "meet with last cut, we generate an\n"
  2456. "extended cut over the first cut section.")
  2457. )
  2458. grid1.addWidget(self.extracut_cb, 5, 0)
  2459. # Probe depth
  2460. self.pdepth_label = QtWidgets.QLabel('%s:' % _("Probe Z depth"))
  2461. self.pdepth_label.setToolTip(
  2462. _("The maximum depth that the probe is allowed\n"
  2463. "to probe. Negative value, in current units.")
  2464. )
  2465. grid1.addWidget(self.pdepth_label, 6, 0)
  2466. self.pdepth_entry = FCEntry()
  2467. grid1.addWidget(self.pdepth_entry, 6, 1)
  2468. # Probe feedrate
  2469. self.feedrate_probe_label = QtWidgets.QLabel('%s:' % _("Feedrate Probe"))
  2470. self.feedrate_probe_label.setToolTip(
  2471. _("The feedrate used while the probe is probing.")
  2472. )
  2473. grid1.addWidget(self.feedrate_probe_label, 7, 0)
  2474. self.feedrate_probe_entry = FCEntry()
  2475. grid1.addWidget(self.feedrate_probe_entry, 7, 1)
  2476. # Spindle direction
  2477. spindle_dir_label = QtWidgets.QLabel('%s:' % _('Spindle dir.'))
  2478. spindle_dir_label.setToolTip(
  2479. _("This sets the direction that the spindle is rotating.\n"
  2480. "It can be either:\n"
  2481. "- CW = clockwise or\n"
  2482. "- CCW = counter clockwise")
  2483. )
  2484. self.spindledir_radio = RadioSet([{'label': _('CW'), 'value': 'CW'},
  2485. {'label': _('CCW'), 'value': 'CCW'}])
  2486. grid1.addWidget(spindle_dir_label, 8, 0)
  2487. grid1.addWidget(self.spindledir_radio, 8, 1)
  2488. # Fast Move from Z Toolchange
  2489. fplungelabel = QtWidgets.QLabel('%s:' % _('Fast Plunge'))
  2490. fplungelabel.setToolTip(
  2491. _("By checking this, the vertical move from\n"
  2492. "Z_Toolchange to Z_move is done with G0,\n"
  2493. "meaning the fastest speed available.\n"
  2494. "WARNING: the move is done at Toolchange X,Y coords.")
  2495. )
  2496. self.fplunge_cb = FCCheckBox()
  2497. grid1.addWidget(fplungelabel, 9, 0)
  2498. grid1.addWidget(self.fplunge_cb, 9, 1)
  2499. # Size of trace segment on X axis
  2500. segx_label = QtWidgets.QLabel('%s:' % _("Seg. X size"))
  2501. segx_label.setToolTip(
  2502. _("The size of the trace segment on the X axis.\n"
  2503. "Useful for auto-leveling.\n"
  2504. "A value of 0 means no segmentation on the X axis.")
  2505. )
  2506. grid1.addWidget(segx_label, 10, 0)
  2507. self.segx_entry = FCEntry()
  2508. grid1.addWidget(self.segx_entry, 10, 1)
  2509. # Size of trace segment on Y axis
  2510. segy_label = QtWidgets.QLabel('%s:' % _("Seg. Y size"))
  2511. segy_label.setToolTip(
  2512. _("The size of the trace segment on the Y axis.\n"
  2513. "Useful for auto-leveling.\n"
  2514. "A value of 0 means no segmentation on the Y axis.")
  2515. )
  2516. grid1.addWidget(segy_label, 11, 0)
  2517. self.segy_entry = FCEntry()
  2518. grid1.addWidget(self.segy_entry, 11, 1)
  2519. self.layout.addStretch()
  2520. class GeometryEditorPrefGroupUI(OptionsGroupUI):
  2521. def __init__(self, parent=None):
  2522. # OptionsGroupUI.__init__(self, "Gerber Adv. Options Preferences", parent=parent)
  2523. super(GeometryEditorPrefGroupUI, self).__init__(self)
  2524. self.setTitle(str(_("Geometry Editor")))
  2525. # Advanced Geometry Parameters
  2526. self.param_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  2527. self.param_label.setToolTip(
  2528. _("A list of Geometry Editor parameters.")
  2529. )
  2530. self.layout.addWidget(self.param_label)
  2531. grid0 = QtWidgets.QGridLayout()
  2532. self.layout.addLayout(grid0)
  2533. # Selection Limit
  2534. self.sel_limit_label = QtWidgets.QLabel('%s:' % _("Selection limit"))
  2535. self.sel_limit_label.setToolTip(
  2536. _("Set the number of selected geometry\n"
  2537. "items above which the utility geometry\n"
  2538. "becomes just a selection rectangle.\n"
  2539. "Increases the performance when moving a\n"
  2540. "large number of geometric elements.")
  2541. )
  2542. self.sel_limit_entry = IntEntry()
  2543. grid0.addWidget(self.sel_limit_label, 0, 0)
  2544. grid0.addWidget(self.sel_limit_entry, 0, 1)
  2545. # Milling Type
  2546. milling_type_label = QtWidgets.QLabel('%s:' % _('Milling Type'))
  2547. milling_type_label.setToolTip(
  2548. _("Milling type:\n"
  2549. "- climb / best for precision milling and to reduce tool usage\n"
  2550. "- conventional / useful when there is no backlash compensation")
  2551. )
  2552. self.milling_type_radio = RadioSet([{'label': _('Climb'), 'value': 'cl'},
  2553. {'label': _('Conv.'), 'value': 'cv'}])
  2554. grid0.addWidget(milling_type_label, 1, 0)
  2555. grid0.addWidget(self.milling_type_radio, 1, 1)
  2556. self.layout.addStretch()
  2557. class CNCJobGenPrefGroupUI(OptionsGroupUI):
  2558. def __init__(self, parent=None):
  2559. # OptionsGroupUI.__init__(self, "CNC Job General Preferences", parent=None)
  2560. super(CNCJobGenPrefGroupUI, self).__init__(self)
  2561. self.setTitle(str(_("CNC Job General")))
  2562. # ## Plot options
  2563. self.plot_options_label = QtWidgets.QLabel("<b>%s:</b>" % _("Plot Options"))
  2564. self.layout.addWidget(self.plot_options_label)
  2565. grid0 = QtWidgets.QGridLayout()
  2566. self.layout.addLayout(grid0)
  2567. # grid0.setColumnStretch(1, 1)
  2568. # grid0.setColumnStretch(2, 1)
  2569. # Plot CB
  2570. # self.plot_cb = QtWidgets.QCheckBox('Plot')
  2571. self.plot_cb = FCCheckBox(_('Plot Object'))
  2572. self.plot_cb.setToolTip(_("Plot (show) this object."))
  2573. grid0.addWidget(self.plot_cb, 0, 0)
  2574. # Plot Kind
  2575. self.cncplot_method_label = QtWidgets.QLabel('%s:' % _("Plot kind"))
  2576. self.cncplot_method_label.setToolTip(
  2577. _("This selects the kind of geometries on the canvas to plot.\n"
  2578. "Those can be either of type 'Travel' which means the moves\n"
  2579. "above the work piece or it can be of type 'Cut',\n"
  2580. "which means the moves that cut into the material.")
  2581. )
  2582. self.cncplot_method_radio = RadioSet([
  2583. {"label": _("All"), "value": "all"},
  2584. {"label": _("Travel"), "value": "travel"},
  2585. {"label": _("Cut"), "value": "cut"}
  2586. ], stretch=False)
  2587. grid0.addWidget(self.cncplot_method_label, 1, 0)
  2588. grid0.addWidget(self.cncplot_method_radio, 1, 1)
  2589. grid0.addWidget(QtWidgets.QLabel(''), 1, 2)
  2590. # Display Annotation
  2591. self.annotation_label = QtWidgets.QLabel('%s:' % _("Display Annotation"))
  2592. self.annotation_label.setToolTip(
  2593. _("This selects if to display text annotation on the plot.\n"
  2594. "When checked it will display numbers in order for each end\n"
  2595. "of a travel line."
  2596. )
  2597. )
  2598. self.annotation_cb = FCCheckBox()
  2599. grid0.addWidget(self.annotation_label, 2, 0)
  2600. grid0.addWidget(self.annotation_cb, 2, 1)
  2601. grid0.addWidget(QtWidgets.QLabel(''), 2, 2)
  2602. # ###################################################################
  2603. # Number of circle steps for circular aperture linear approximation #
  2604. # ###################################################################
  2605. self.steps_per_circle_label = QtWidgets.QLabel('%s:' % _("Circle Steps"))
  2606. self.steps_per_circle_label.setToolTip(
  2607. _("The number of circle steps for <b>GCode</b> \n"
  2608. "circle and arc shapes linear approximation.")
  2609. )
  2610. grid0.addWidget(self.steps_per_circle_label, 3, 0)
  2611. self.steps_per_circle_entry = IntEntry()
  2612. grid0.addWidget(self.steps_per_circle_entry, 3, 1)
  2613. # Tool dia for plot
  2614. tdlabel = QtWidgets.QLabel('%s:' % _('Travel dia'))
  2615. tdlabel.setToolTip(
  2616. _("The width of the travel lines to be\n"
  2617. "rendered in the plot.")
  2618. )
  2619. self.tooldia_entry = LengthEntry()
  2620. grid0.addWidget(tdlabel, 4, 0)
  2621. grid0.addWidget(self.tooldia_entry, 4, 1)
  2622. # add a space
  2623. grid0.addWidget(QtWidgets.QLabel(''), 5, 0)
  2624. # Number of decimals to use in GCODE coordinates
  2625. cdeclabel = QtWidgets.QLabel('%s:' % _('Coordinates decimals'))
  2626. cdeclabel.setToolTip(
  2627. _("The number of decimals to be used for \n"
  2628. "the X, Y, Z coordinates in CNC code (GCODE, etc.)")
  2629. )
  2630. self.coords_dec_entry = IntEntry()
  2631. grid0.addWidget(cdeclabel, 6, 0)
  2632. grid0.addWidget(self.coords_dec_entry, 6, 1)
  2633. # Number of decimals to use in GCODE feedrate
  2634. frdeclabel = QtWidgets.QLabel('%s:' % _('Feedrate decimals'))
  2635. frdeclabel.setToolTip(
  2636. _("The number of decimals to be used for \n"
  2637. "the Feedrate parameter in CNC code (GCODE, etc.)")
  2638. )
  2639. self.fr_dec_entry = IntEntry()
  2640. grid0.addWidget(frdeclabel, 7, 0)
  2641. grid0.addWidget(self.fr_dec_entry, 7, 1)
  2642. # The type of coordinates used in the Gcode: Absolute or Incremental
  2643. coords_type_label = QtWidgets.QLabel('%s:' % _('Coordinates type'))
  2644. coords_type_label.setToolTip(
  2645. _("The type of coordinates to be used in Gcode.\n"
  2646. "Can be:\n"
  2647. "- Absolute G90 -> the reference is the origin x=0, y=0\n"
  2648. "- Incremental G91 -> the reference is the previous position")
  2649. )
  2650. self.coords_type_radio = RadioSet([
  2651. {"label": _("Absolute G90"), "value": "G90"},
  2652. {"label": _("Incremental G91"), "value": "G91"}
  2653. ], orientation='vertical', stretch=False)
  2654. grid0.addWidget(coords_type_label, 8, 0)
  2655. grid0.addWidget(self.coords_type_radio, 8, 1)
  2656. # hidden for the time being, until implemented
  2657. coords_type_label.hide()
  2658. self.coords_type_radio.hide()
  2659. self.layout.addStretch()
  2660. class CNCJobOptPrefGroupUI(OptionsGroupUI):
  2661. def __init__(self, parent=None):
  2662. # OptionsGroupUI.__init__(self, "CNC Job Options Preferences", parent=None)
  2663. super(CNCJobOptPrefGroupUI, self).__init__(self)
  2664. self.setTitle(str(_("CNC Job Options")))
  2665. # ## Export G-Code
  2666. self.export_gcode_label = QtWidgets.QLabel("<b>%s:</b>" % _("Export G-Code"))
  2667. self.export_gcode_label.setToolTip(
  2668. _("Export and save G-Code to\n"
  2669. "make this object to a file.")
  2670. )
  2671. self.layout.addWidget(self.export_gcode_label)
  2672. settings = QSettings("Open Source", "FlatCAM")
  2673. if settings.contains("textbox_font_size"):
  2674. tb_fsize = settings.value('textbox_font_size', type=int)
  2675. else:
  2676. tb_fsize = 10
  2677. font = QtGui.QFont()
  2678. font.setPointSize(tb_fsize)
  2679. # Prepend to G-Code
  2680. prependlabel = QtWidgets.QLabel('%s:' % _('Prepend to G-Code'))
  2681. prependlabel.setToolTip(
  2682. _("Type here any G-Code commands you would\n"
  2683. "like to add at the beginning of the G-Code file.")
  2684. )
  2685. self.layout.addWidget(prependlabel)
  2686. self.prepend_text = FCTextArea()
  2687. self.layout.addWidget(self.prepend_text)
  2688. self.prepend_text.setFont(font)
  2689. # Append text to G-Code
  2690. appendlabel = QtWidgets.QLabel('%s:' % _('Append to G-Code'))
  2691. appendlabel.setToolTip(
  2692. _("Type here any G-Code commands you would\n"
  2693. "like to append to the generated file.\n"
  2694. "I.e.: M2 (End of program)")
  2695. )
  2696. self.layout.addWidget(appendlabel)
  2697. self.append_text = FCTextArea()
  2698. self.layout.addWidget(self.append_text)
  2699. self.append_text.setFont(font)
  2700. self.layout.addStretch()
  2701. class CNCJobAdvOptPrefGroupUI(OptionsGroupUI):
  2702. def __init__(self, parent=None):
  2703. # OptionsGroupUI.__init__(self, "CNC Job Advanced Options Preferences", parent=None)
  2704. super(CNCJobAdvOptPrefGroupUI, self).__init__(self)
  2705. self.setTitle(str(_("CNC Job Adv. Options")))
  2706. # ## Export G-Code
  2707. self.export_gcode_label = QtWidgets.QLabel("<b>%s:</b>" % _("Export CNC Code"))
  2708. self.export_gcode_label.setToolTip(
  2709. _("Export and save G-Code to\n"
  2710. "make this object to a file.")
  2711. )
  2712. self.layout.addWidget(self.export_gcode_label)
  2713. # Prepend to G-Code
  2714. toolchangelabel = QtWidgets.QLabel('%s:' % _('Toolchange G-Code'))
  2715. toolchangelabel.setToolTip(
  2716. _(
  2717. "Type here any G-Code commands you would\n"
  2718. "like to be executed when Toolchange event is encountered.\n"
  2719. "This will constitute a Custom Toolchange GCode,\n"
  2720. "or a Toolchange Macro.\n"
  2721. "The FlatCAM variables are surrounded by '%' symbol.\n\n"
  2722. "WARNING: it can be used only with a postprocessor file\n"
  2723. "that has 'toolchange_custom' in it's name and this is built\n"
  2724. "having as template the 'Toolchange Custom' posprocessor file."
  2725. )
  2726. )
  2727. self.layout.addWidget(toolchangelabel)
  2728. settings = QSettings("Open Source", "FlatCAM")
  2729. if settings.contains("textbox_font_size"):
  2730. tb_fsize = settings.value('textbox_font_size', type=int)
  2731. else:
  2732. tb_fsize = 10
  2733. font = QtGui.QFont()
  2734. font.setPointSize(tb_fsize)
  2735. self.toolchange_text = FCTextArea()
  2736. self.layout.addWidget(self.toolchange_text)
  2737. self.toolchange_text.setFont(font)
  2738. hlay = QtWidgets.QHBoxLayout()
  2739. self.layout.addLayout(hlay)
  2740. # Toolchange Replacement GCode
  2741. self.toolchange_cb = FCCheckBox(label='%s' % _('Use Toolchange Macro'))
  2742. self.toolchange_cb.setToolTip(
  2743. _("Check this box if you want to use\n"
  2744. "a Custom Toolchange GCode (macro).")
  2745. )
  2746. hlay.addWidget(self.toolchange_cb)
  2747. hlay.addStretch()
  2748. hlay1 = QtWidgets.QHBoxLayout()
  2749. self.layout.addLayout(hlay1)
  2750. # Variable list
  2751. self.tc_variable_combo = FCComboBox()
  2752. self.tc_variable_combo.setToolTip(
  2753. _("A list of the FlatCAM variables that can be used\n"
  2754. "in the Toolchange event.\n"
  2755. "They have to be surrounded by the '%' symbol")
  2756. )
  2757. hlay1.addWidget(self.tc_variable_combo)
  2758. # Populate the Combo Box
  2759. variables = [_('Parameters'), 'tool', 'tooldia', 't_drills', 'x_toolchange', 'y_toolchange', 'z_toolchange',
  2760. 'z_cut', 'z_move', 'z_depthpercut', 'spindlespeed', 'dwelltime']
  2761. self.tc_variable_combo.addItems(variables)
  2762. self.tc_variable_combo.setItemData(0, _("FlatCAM CNC parameters"), Qt.ToolTipRole)
  2763. self.tc_variable_combo.setItemData(1, 'tool = %s' % _("tool number"), Qt.ToolTipRole)
  2764. self.tc_variable_combo.setItemData(2, 'tooldia = %s' % _("tool diameter"), Qt.ToolTipRole)
  2765. self.tc_variable_combo.setItemData(3, 't_drills = %s' % _("for Excellon, total number of drills"),
  2766. Qt.ToolTipRole)
  2767. self.tc_variable_combo.setItemData(4, 'x_toolchange = %s' % _("X coord for Toolchange"), Qt.ToolTipRole)
  2768. self.tc_variable_combo.setItemData(5, 'y_toolchange = %s' % _("y_toolchange = Y coord for Toolchange"),
  2769. Qt.ToolTipRole)
  2770. self.tc_variable_combo.setItemData(6, 'z_toolchange = %s' % _("Z coord for Toolchange"), Qt.ToolTipRole)
  2771. self.tc_variable_combo.setItemData(7, 'z_cut = %s' % _("Z depth for the cut"), Qt.ToolTipRole)
  2772. self.tc_variable_combo.setItemData(8, 'z_move = %s' % _("Z height for travel"), Qt.ToolTipRole)
  2773. self.tc_variable_combo.setItemData(9, 'z_depthpercut = %s' % _("the step value for multidepth cut"),
  2774. Qt.ToolTipRole)
  2775. self.tc_variable_combo.setItemData(10, 'spindlesspeed = %s' % _("the value for the spindle speed"),
  2776. Qt.ToolTipRole)
  2777. self.tc_variable_combo.setItemData(11,
  2778. _("dwelltime = time to dwell to allow the spindle to reach it's set RPM"),
  2779. Qt.ToolTipRole)
  2780. hlay1.addStretch()
  2781. # Insert Variable into the Toolchange G-Code Text Box
  2782. # self.tc_insert_buton = FCButton("Insert")
  2783. # self.tc_insert_buton.setToolTip(
  2784. # "Insert the variable in the GCode Box\n"
  2785. # "surrounded by the '%' symbol."
  2786. # )
  2787. # hlay1.addWidget(self.tc_insert_buton)
  2788. grid0 = QtWidgets.QGridLayout()
  2789. self.layout.addLayout(grid0)
  2790. grid0.addWidget(QtWidgets.QLabel(''), 1, 0, 1, 2)
  2791. # Annotation Font Size
  2792. self.annotation_fontsize_label = QtWidgets.QLabel('%s:' % _("Annotation Size"))
  2793. self.annotation_fontsize_label.setToolTip(
  2794. _("The font size of the annotation text. In pixels.")
  2795. )
  2796. grid0.addWidget(self.annotation_fontsize_label, 2, 0)
  2797. self.annotation_fontsize_sp = FCSpinner()
  2798. grid0.addWidget(self.annotation_fontsize_sp, 2, 1)
  2799. grid0.addWidget(QtWidgets.QLabel(''), 2, 2)
  2800. # Annotation Font Color
  2801. self.annotation_color_label = QtWidgets.QLabel('%s:' % _('Annotation Color'))
  2802. self.annotation_color_label.setToolTip(
  2803. _("Set the font color for the annotation texts.")
  2804. )
  2805. self.annotation_fontcolor_entry = FCEntry()
  2806. self.annotation_fontcolor_button = QtWidgets.QPushButton()
  2807. self.annotation_fontcolor_button.setFixedSize(15, 15)
  2808. self.form_box_child = QtWidgets.QHBoxLayout()
  2809. self.form_box_child.setContentsMargins(0, 0, 0, 0)
  2810. self.form_box_child.addWidget(self.annotation_fontcolor_entry)
  2811. self.form_box_child.addWidget(self.annotation_fontcolor_button, alignment=Qt.AlignRight)
  2812. self.form_box_child.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  2813. color_widget = QtWidgets.QWidget()
  2814. color_widget.setLayout(self.form_box_child)
  2815. grid0.addWidget(self.annotation_color_label, 3, 0)
  2816. grid0.addWidget(color_widget, 3, 1)
  2817. grid0.addWidget(QtWidgets.QLabel(''), 3, 2)
  2818. self.layout.addStretch()
  2819. class ToolsNCCPrefGroupUI(OptionsGroupUI):
  2820. def __init__(self, parent=None):
  2821. # OptionsGroupUI.__init__(self, "NCC Tool Options", parent=parent)
  2822. super(ToolsNCCPrefGroupUI, self).__init__(self)
  2823. self.setTitle(str(_("NCC Tool Options")))
  2824. # ## Clear non-copper regions
  2825. self.clearcopper_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  2826. self.clearcopper_label.setToolTip(
  2827. _("Create a Geometry object with\n"
  2828. "toolpaths to cut all non-copper regions.")
  2829. )
  2830. self.layout.addWidget(self.clearcopper_label)
  2831. grid0 = QtWidgets.QGridLayout()
  2832. self.layout.addLayout(grid0)
  2833. ncctdlabel = QtWidgets.QLabel('%s:' % _('Tools dia'))
  2834. ncctdlabel.setToolTip(
  2835. _("Diameters of the cutting tools, separated by ','")
  2836. )
  2837. grid0.addWidget(ncctdlabel, 0, 0)
  2838. self.ncc_tool_dia_entry = FCEntry()
  2839. grid0.addWidget(self.ncc_tool_dia_entry, 0, 1)
  2840. # Tool Type Radio Button
  2841. self.tool_type_label = QtWidgets.QLabel('%s:' % _('Tool Type'))
  2842. self.tool_type_label.setToolTip(
  2843. _("Default tool type:\n"
  2844. "- 'V-shape'\n"
  2845. "- Circular")
  2846. )
  2847. self.tool_type_radio = RadioSet([{'label': _('V-shape'), 'value': 'V'},
  2848. {'label': _('Circular'), 'value': 'C1'}])
  2849. self.tool_type_radio.setToolTip(
  2850. _("Default tool type:\n"
  2851. "- 'V-shape'\n"
  2852. "- Circular")
  2853. )
  2854. grid0.addWidget(self.tool_type_label, 1, 0)
  2855. grid0.addWidget(self.tool_type_radio, 1, 1)
  2856. # Tip Dia
  2857. self.tipdialabel = QtWidgets.QLabel('%s:' % _('V-Tip Dia'))
  2858. self.tipdialabel.setToolTip(
  2859. _("The tip diameter for V-Shape Tool"))
  2860. self.tipdia_entry = LengthEntry()
  2861. grid0.addWidget(self.tipdialabel, 2, 0)
  2862. grid0.addWidget(self.tipdia_entry, 2, 1)
  2863. # Tip Angle
  2864. self.tipanglelabel = QtWidgets.QLabel('%s:' % _('V-Tip Angle'))
  2865. self.tipanglelabel.setToolTip(
  2866. _("The tip angle for V-Shape Tool.\n"
  2867. "In degree."))
  2868. self.tipangle_entry = LengthEntry()
  2869. grid0.addWidget(self.tipanglelabel, 3, 0)
  2870. grid0.addWidget(self.tipangle_entry, 3, 1)
  2871. # Milling Type Radio Button
  2872. self.milling_type_label = QtWidgets.QLabel('%s:' % _('Milling Type'))
  2873. self.milling_type_label.setToolTip(
  2874. _("Milling type when the selected tool is of type: 'iso_op':\n"
  2875. "- climb / best for precision milling and to reduce tool usage\n"
  2876. "- conventional / useful when there is no backlash compensation")
  2877. )
  2878. self.milling_type_radio = RadioSet([{'label': _('Climb'), 'value': 'cl'},
  2879. {'label': _('Conv.'), 'value': 'cv'}])
  2880. self.milling_type_radio.setToolTip(
  2881. _("Milling type when the selected tool is of type: 'iso_op':\n"
  2882. "- climb / best for precision milling and to reduce tool usage\n"
  2883. "- conventional / useful when there is no backlash compensation")
  2884. )
  2885. grid0.addWidget(self.milling_type_label, 4, 0)
  2886. grid0.addWidget(self.milling_type_radio, 4, 1)
  2887. # Tool order Radio Button
  2888. self.ncc_order_label = QtWidgets.QLabel('%s:' % _('Tool order'))
  2889. self.ncc_order_label.setToolTip(_("This set the way that the tools in the tools table are used.\n"
  2890. "'No' --> means that the used order is the one in the tool table\n"
  2891. "'Forward' --> means that the tools will be ordered from small to big\n"
  2892. "'Reverse' --> menas that the tools will ordered from big to small\n\n"
  2893. "WARNING: using rest machining will automatically set the order\n"
  2894. "in reverse and disable this control."))
  2895. self.ncc_order_radio = RadioSet([{'label': _('No'), 'value': 'no'},
  2896. {'label': _('Forward'), 'value': 'fwd'},
  2897. {'label': _('Reverse'), 'value': 'rev'}])
  2898. self.ncc_order_radio.setToolTip(_("This set the way that the tools in the tools table are used.\n"
  2899. "'No' --> means that the used order is the one in the tool table\n"
  2900. "'Forward' --> means that the tools will be ordered from small to big\n"
  2901. "'Reverse' --> menas that the tools will ordered from big to small\n\n"
  2902. "WARNING: using rest machining will automatically set the order\n"
  2903. "in reverse and disable this control."))
  2904. grid0.addWidget(self.ncc_order_label, 5, 0)
  2905. grid0.addWidget(self.ncc_order_radio, 5, 1)
  2906. # Cut Z entry
  2907. cutzlabel = QtWidgets.QLabel('%s:' % _('Cut Z'))
  2908. cutzlabel.setToolTip(
  2909. _("Depth of cut into material. Negative value.\n"
  2910. "In FlatCAM units.")
  2911. )
  2912. self.cutz_entry = FloatEntry()
  2913. self.cutz_entry.setToolTip(
  2914. _("Depth of cut into material. Negative value.\n"
  2915. "In FlatCAM units.")
  2916. )
  2917. grid0.addWidget(cutzlabel, 6, 0)
  2918. grid0.addWidget(self.cutz_entry, 6, 1)
  2919. # Overlap Entry
  2920. nccoverlabel = QtWidgets.QLabel('%s:' % _('Overlap Rate'))
  2921. nccoverlabel.setToolTip(
  2922. _("How much (fraction) of the tool width to overlap each tool pass.\n"
  2923. "Example:\n"
  2924. "A value here of 0.25 means 25%% from the tool diameter found above.\n\n"
  2925. "Adjust the value starting with lower values\n"
  2926. "and increasing it if areas that should be cleared are still \n"
  2927. "not cleared.\n"
  2928. "Lower values = faster processing, faster execution on PCB.\n"
  2929. "Higher values = slow processing and slow execution on CNC\n"
  2930. "due of too many paths.")
  2931. )
  2932. self.ncc_overlap_entry = FCDoubleSpinner()
  2933. self.ncc_overlap_entry.set_precision(3)
  2934. self.ncc_overlap_entry.setWrapping(True)
  2935. self.ncc_overlap_entry.setRange(0.000, 0.999)
  2936. self.ncc_overlap_entry.setSingleStep(0.1)
  2937. grid0.addWidget(nccoverlabel, 7, 0)
  2938. grid0.addWidget(self.ncc_overlap_entry, 7, 1)
  2939. # Margin entry
  2940. nccmarginlabel = QtWidgets.QLabel('%s:' % _('Margin'))
  2941. nccmarginlabel.setToolTip(
  2942. _("Bounding box margin.")
  2943. )
  2944. grid0.addWidget(nccmarginlabel, 8, 0)
  2945. self.ncc_margin_entry = FloatEntry()
  2946. grid0.addWidget(self.ncc_margin_entry, 8, 1)
  2947. # Method
  2948. methodlabel = QtWidgets.QLabel('%s:' % _('Method'))
  2949. methodlabel.setToolTip(
  2950. _("Algorithm for non-copper clearing:<BR>"
  2951. "<B>Standard</B>: Fixed step inwards.<BR>"
  2952. "<B>Seed-based</B>: Outwards from seed.<BR>"
  2953. "<B>Line-based</B>: Parallel lines.")
  2954. )
  2955. grid0.addWidget(methodlabel, 9, 0)
  2956. self.ncc_method_radio = RadioSet([
  2957. {"label": _("Standard"), "value": "standard"},
  2958. {"label": _("Seed-based"), "value": "seed"},
  2959. {"label": _("Straight lines"), "value": "lines"}
  2960. ], orientation='vertical', stretch=False)
  2961. grid0.addWidget(self.ncc_method_radio, 9, 1)
  2962. # Connect lines
  2963. pathconnectlabel = QtWidgets.QLabel('%s:' % _("Connect"))
  2964. pathconnectlabel.setToolTip(
  2965. _("Draw lines between resulting\n"
  2966. "segments to minimize tool lifts.")
  2967. )
  2968. grid0.addWidget(pathconnectlabel, 10, 0)
  2969. self.ncc_connect_cb = FCCheckBox()
  2970. grid0.addWidget(self.ncc_connect_cb, 10, 1)
  2971. # Contour Checkbox
  2972. contourlabel = QtWidgets.QLabel('%s:' % _("Contour"))
  2973. contourlabel.setToolTip(
  2974. _("Cut around the perimeter of the polygon\n"
  2975. "to trim rough edges.")
  2976. )
  2977. grid0.addWidget(contourlabel, 11, 0)
  2978. self.ncc_contour_cb = FCCheckBox()
  2979. grid0.addWidget(self.ncc_contour_cb, 11, 1)
  2980. # Rest machining CheckBox
  2981. restlabel = QtWidgets.QLabel('%s:' % _("Rest M."))
  2982. restlabel.setToolTip(
  2983. _("If checked, use 'rest machining'.\n"
  2984. "Basically it will clear copper outside PCB features,\n"
  2985. "using the biggest tool and continue with the next tools,\n"
  2986. "from bigger to smaller, to clear areas of copper that\n"
  2987. "could not be cleared by previous tool, until there is\n"
  2988. "no more copper to clear or there are no more tools.\n"
  2989. "If not checked, use the standard algorithm.")
  2990. )
  2991. grid0.addWidget(restlabel, 12, 0)
  2992. self.ncc_rest_cb = FCCheckBox()
  2993. grid0.addWidget(self.ncc_rest_cb, 12, 1)
  2994. # ## NCC Offset choice
  2995. self.ncc_offset_choice_label = QtWidgets.QLabel('%s:' % _("Offset"))
  2996. self.ncc_offset_choice_label.setToolTip(
  2997. _("If used, it will add an offset to the copper features.\n"
  2998. "The copper clearing will finish to a distance\n"
  2999. "from the copper features.\n"
  3000. "The value can be between 0 and 10 FlatCAM units.")
  3001. )
  3002. grid0.addWidget(self.ncc_offset_choice_label, 13, 0)
  3003. self.ncc_choice_offset_cb = FCCheckBox()
  3004. grid0.addWidget(self.ncc_choice_offset_cb, 13, 1)
  3005. # ## NCC Offset value
  3006. self.ncc_offset_label = QtWidgets.QLabel('%s:' % _("Offset value"))
  3007. self.ncc_offset_label.setToolTip(
  3008. _("If used, it will add an offset to the copper features.\n"
  3009. "The copper clearing will finish to a distance\n"
  3010. "from the copper features.\n"
  3011. "The value can be between 0 and 10 FlatCAM units.")
  3012. )
  3013. grid0.addWidget(self.ncc_offset_label, 14, 0)
  3014. self.ncc_offset_spinner = FCDoubleSpinner()
  3015. self.ncc_offset_spinner.set_range(0.00, 10.00)
  3016. self.ncc_offset_spinner.set_precision(4)
  3017. self.ncc_offset_spinner.setWrapping(True)
  3018. self.ncc_offset_spinner.setSingleStep(0.1)
  3019. grid0.addWidget(self.ncc_offset_spinner, 14, 1)
  3020. # ## Reference
  3021. self.reference_radio = RadioSet([{'label': _('Itself'), 'value': 'itself'},
  3022. {"label": _("Area"), "value": "area"},
  3023. {'label': _('Ref'), 'value': 'box'}])
  3024. reference_label = QtWidgets.QLabel('%s:' % _("Reference"))
  3025. reference_label.setToolTip(
  3026. _("- 'Itself' - the non copper clearing extent\n"
  3027. "is based on the object that is copper cleared.\n "
  3028. "- 'Area Selection' - left mouse click to start selection of the area to be painted.\n"
  3029. "Keeping a modifier key pressed (CTRL or SHIFT) will allow to add multiple areas.\n"
  3030. "- 'Reference Object' - will do non copper clearing within the area\n"
  3031. "specified by another object.")
  3032. )
  3033. grid0.addWidget(reference_label, 15, 0)
  3034. grid0.addWidget(self.reference_radio, 15, 1)
  3035. # ## Plotting type
  3036. self.ncc_plotting_radio = RadioSet([{'label': _('Normal'), 'value': 'normal'},
  3037. {"label": _("Progressive"), "value": "progressive"}])
  3038. plotting_label = QtWidgets.QLabel('%s:' % _("NCC Plotting"))
  3039. plotting_label.setToolTip(
  3040. _("- 'Normal' - normal plotting, done at the end of the NCC job\n"
  3041. "- 'Progressive' - after each shape is generated it will be plotted.")
  3042. )
  3043. grid0.addWidget(plotting_label, 16, 0)
  3044. grid0.addWidget(self.ncc_plotting_radio, 16, 1)
  3045. self.layout.addStretch()
  3046. class ToolsCutoutPrefGroupUI(OptionsGroupUI):
  3047. def __init__(self, parent=None):
  3048. # OptionsGroupUI.__init__(self, "Cutout Tool Options", parent=parent)
  3049. super(ToolsCutoutPrefGroupUI, self).__init__(self)
  3050. self.setTitle(str(_("Cutout Tool Options")))
  3051. # ## Board cuttout
  3052. self.board_cutout_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  3053. self.board_cutout_label.setToolTip(
  3054. _("Create toolpaths to cut around\n"
  3055. "the PCB and separate it from\n"
  3056. "the original board.")
  3057. )
  3058. self.layout.addWidget(self.board_cutout_label)
  3059. grid0 = QtWidgets.QGridLayout()
  3060. self.layout.addLayout(grid0)
  3061. tdclabel = QtWidgets.QLabel('%s:' % _('Tool dia'))
  3062. tdclabel.setToolTip(
  3063. _("Diameter of the tool used to cutout\n"
  3064. "the PCB shape out of the surrounding material.")
  3065. )
  3066. grid0.addWidget(tdclabel, 0, 0)
  3067. self.cutout_tooldia_entry = LengthEntry()
  3068. grid0.addWidget(self.cutout_tooldia_entry, 0, 1)
  3069. # Object kind
  3070. kindlabel = QtWidgets.QLabel('%s:' % _('Obj kind'))
  3071. kindlabel.setToolTip(
  3072. _("Choice of what kind the object we want to cutout is.<BR>"
  3073. "- <B>Single</B>: contain a single PCB Gerber outline object.<BR>"
  3074. "- <B>Panel</B>: a panel PCB Gerber object, which is made\n"
  3075. "out of many individual PCB outlines.")
  3076. )
  3077. grid0.addWidget(kindlabel, 1, 0)
  3078. self.obj_kind_combo = RadioSet([
  3079. {"label": _("Single"), "value": "single"},
  3080. {"label": _("Panel"), "value": "panel"},
  3081. ])
  3082. grid0.addWidget(self.obj_kind_combo, 1, 1)
  3083. marginlabel = QtWidgets.QLabel('%s:' % _('Margin'))
  3084. marginlabel.setToolTip(
  3085. _("Margin over bounds. A positive value here\n"
  3086. "will make the cutout of the PCB further from\n"
  3087. "the actual PCB border")
  3088. )
  3089. grid0.addWidget(marginlabel, 2, 0)
  3090. self.cutout_margin_entry = LengthEntry()
  3091. grid0.addWidget(self.cutout_margin_entry, 2, 1)
  3092. gaplabel = QtWidgets.QLabel('%s:' % _('Gap size'))
  3093. gaplabel.setToolTip(
  3094. _("The size of the bridge gaps in the cutout\n"
  3095. "used to keep the board connected to\n"
  3096. "the surrounding material (the one \n"
  3097. "from which the PCB is cutout).")
  3098. )
  3099. grid0.addWidget(gaplabel, 3, 0)
  3100. self.cutout_gap_entry = LengthEntry()
  3101. grid0.addWidget(self.cutout_gap_entry, 3, 1)
  3102. gaps_label = QtWidgets.QLabel('%s:' % _('Gaps'))
  3103. gaps_label.setToolTip(
  3104. _("Number of gaps used for the cutout.\n"
  3105. "There can be maximum 8 bridges/gaps.\n"
  3106. "The choices are:\n"
  3107. "- None - no gaps\n"
  3108. "- lr - left + right\n"
  3109. "- tb - top + bottom\n"
  3110. "- 4 - left + right +top + bottom\n"
  3111. "- 2lr - 2*left + 2*right\n"
  3112. "- 2tb - 2*top + 2*bottom\n"
  3113. "- 8 - 2*left + 2*right +2*top + 2*bottom")
  3114. )
  3115. grid0.addWidget(gaps_label, 4, 0)
  3116. self.gaps_combo = FCComboBox()
  3117. grid0.addWidget(self.gaps_combo, 4, 1)
  3118. gaps_items = ['None', 'LR', 'TB', '4', '2LR', '2TB', '8']
  3119. for it in gaps_items:
  3120. self.gaps_combo.addItem(it)
  3121. self.gaps_combo.setStyleSheet('background-color: rgb(255,255,255)')
  3122. # Surrounding convex box shape
  3123. self.convex_box = FCCheckBox()
  3124. self.convex_box_label = QtWidgets.QLabel('%s:' % _("Convex Sh."))
  3125. self.convex_box_label.setToolTip(
  3126. _("Create a convex shape surrounding the entire PCB.\n"
  3127. "Used only if the source object type is Gerber.")
  3128. )
  3129. grid0.addWidget(self.convex_box_label, 5, 0)
  3130. grid0.addWidget(self.convex_box, 5, 1)
  3131. self.layout.addStretch()
  3132. class Tools2sidedPrefGroupUI(OptionsGroupUI):
  3133. def __init__(self, parent=None):
  3134. # OptionsGroupUI.__init__(self, "2sided Tool Options", parent=parent)
  3135. super(Tools2sidedPrefGroupUI, self).__init__(self)
  3136. self.setTitle(str(_("2Sided Tool Options")))
  3137. # ## Board cuttout
  3138. self.dblsided_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  3139. self.dblsided_label.setToolTip(
  3140. _("A tool to help in creating a double sided\n"
  3141. "PCB using alignment holes.")
  3142. )
  3143. self.layout.addWidget(self.dblsided_label)
  3144. grid0 = QtWidgets.QGridLayout()
  3145. self.layout.addLayout(grid0)
  3146. # ## Drill diameter for alignment holes
  3147. self.drill_dia_entry = LengthEntry()
  3148. self.dd_label = QtWidgets.QLabel('%s:' % _("Drill dia"))
  3149. self.dd_label.setToolTip(
  3150. _("Diameter of the drill for the "
  3151. "alignment holes.")
  3152. )
  3153. grid0.addWidget(self.dd_label, 0, 0)
  3154. grid0.addWidget(self.drill_dia_entry, 0, 1)
  3155. # ## Axis
  3156. self.mirror_axis_radio = RadioSet([{'label': 'X', 'value': 'X'},
  3157. {'label': 'Y', 'value': 'Y'}])
  3158. self.mirax_label = QtWidgets.QLabel(_("Mirror Axis:"))
  3159. self.mirax_label.setToolTip(
  3160. _("Mirror vertically (X) or horizontally (Y).")
  3161. )
  3162. # grid_lay.addRow("Mirror Axis:", self.mirror_axis)
  3163. self.empty_lb1 = QtWidgets.QLabel("")
  3164. grid0.addWidget(self.empty_lb1, 1, 0)
  3165. grid0.addWidget(self.mirax_label, 2, 0)
  3166. grid0.addWidget(self.mirror_axis_radio, 2, 1)
  3167. # ## Axis Location
  3168. self.axis_location_radio = RadioSet([{'label': _('Point'), 'value': 'point'},
  3169. {'label': _('Box'), 'value': 'box'}])
  3170. self.axloc_label = QtWidgets.QLabel('%s:' % _("Axis Ref"))
  3171. self.axloc_label.setToolTip(
  3172. _("The axis should pass through a <b>point</b> or cut\n "
  3173. "a specified <b>box</b> (in a FlatCAM object) through \n"
  3174. "the center.")
  3175. )
  3176. # grid_lay.addRow("Axis Location:", self.axis_location)
  3177. grid0.addWidget(self.axloc_label, 3, 0)
  3178. grid0.addWidget(self.axis_location_radio, 3, 1)
  3179. self.layout.addStretch()
  3180. class ToolsPaintPrefGroupUI(OptionsGroupUI):
  3181. def __init__(self, parent=None):
  3182. # OptionsGroupUI.__init__(self, "Paint Area Tool Options", parent=parent)
  3183. super(ToolsPaintPrefGroupUI, self).__init__(self)
  3184. self.setTitle(str(_("Paint Tool Options")))
  3185. # ------------------------------
  3186. # ## Paint area
  3187. # ------------------------------
  3188. self.paint_label = QtWidgets.QLabel(_('<b>Parameters:</b>'))
  3189. self.paint_label.setToolTip(
  3190. _("Creates tool paths to cover the\n"
  3191. "whole area of a polygon (remove\n"
  3192. "all copper). You will be asked\n"
  3193. "to click on the desired polygon.")
  3194. )
  3195. self.layout.addWidget(self.paint_label)
  3196. grid0 = QtWidgets.QGridLayout()
  3197. self.layout.addLayout(grid0)
  3198. # Tool dia
  3199. ptdlabel = QtWidgets.QLabel('%s:' % _('Tool dia'))
  3200. ptdlabel.setToolTip(
  3201. _("Diameter of the tool to\n"
  3202. "be used in the operation.")
  3203. )
  3204. grid0.addWidget(ptdlabel, 0, 0)
  3205. self.painttooldia_entry = LengthEntry()
  3206. grid0.addWidget(self.painttooldia_entry, 0, 1)
  3207. self.paint_order_label = QtWidgets.QLabel('<b>%s:</b>' % _('Tool order'))
  3208. self.paint_order_label.setToolTip(_("This set the way that the tools in the tools table are used.\n"
  3209. "'No' --> means that the used order is the one in the tool table\n"
  3210. "'Forward' --> means that the tools will be ordered from small to big\n"
  3211. "'Reverse' --> menas that the tools will ordered from big to small\n\n"
  3212. "WARNING: using rest machining will automatically set the order\n"
  3213. "in reverse and disable this control."))
  3214. self.paint_order_radio = RadioSet([{'label': _('No'), 'value': 'no'},
  3215. {'label': _('Forward'), 'value': 'fwd'},
  3216. {'label': _('Reverse'), 'value': 'rev'}])
  3217. self.paint_order_radio.setToolTip(_("This set the way that the tools in the tools table are used.\n"
  3218. "'No' --> means that the used order is the one in the tool table\n"
  3219. "'Forward' --> means that the tools will be ordered from small to big\n"
  3220. "'Reverse' --> menas that the tools will ordered from big to small\n\n"
  3221. "WARNING: using rest machining will automatically set the order\n"
  3222. "in reverse and disable this control."))
  3223. grid0.addWidget(self.paint_order_label, 1, 0)
  3224. grid0.addWidget(self.paint_order_radio, 1, 1)
  3225. # Overlap
  3226. ovlabel = QtWidgets.QLabel('%s:' % _('Overlap Rate'))
  3227. ovlabel.setToolTip(
  3228. _("How much (fraction) of the tool width to overlap each tool pass.\n"
  3229. "Example:\n"
  3230. "A value here of 0.25 means 25%% from the tool diameter found above.\n\n"
  3231. "Adjust the value starting with lower values\n"
  3232. "and increasing it if areas that should be painted are still \n"
  3233. "not painted.\n"
  3234. "Lower values = faster processing, faster execution on PCB.\n"
  3235. "Higher values = slow processing and slow execution on CNC\n"
  3236. "due of too many paths.")
  3237. )
  3238. self.paintoverlap_entry = FCDoubleSpinner()
  3239. self.paintoverlap_entry.set_precision(3)
  3240. self.paintoverlap_entry.setWrapping(True)
  3241. self.paintoverlap_entry.setRange(0.000, 0.999)
  3242. self.paintoverlap_entry.setSingleStep(0.1)
  3243. grid0.addWidget(ovlabel, 2, 0)
  3244. grid0.addWidget(self.paintoverlap_entry, 2, 1)
  3245. # Margin
  3246. marginlabel = QtWidgets.QLabel('%s:' % _('Margin'))
  3247. marginlabel.setToolTip(
  3248. _("Distance by which to avoid\n"
  3249. "the edges of the polygon to\n"
  3250. "be painted.")
  3251. )
  3252. grid0.addWidget(marginlabel, 3, 0)
  3253. self.paintmargin_entry = LengthEntry()
  3254. grid0.addWidget(self.paintmargin_entry, 3, 1)
  3255. # Method
  3256. methodlabel = QtWidgets.QLabel('%s:' % _('Method'))
  3257. methodlabel.setToolTip(
  3258. _("Algorithm for non-copper clearing:<BR>"
  3259. "<B>Standard</B>: Fixed step inwards.<BR>"
  3260. "<B>Seed-based</B>: Outwards from seed.<BR>"
  3261. "<B>Line-based</B>: Parallel lines.")
  3262. )
  3263. grid0.addWidget(methodlabel, 4, 0)
  3264. self.paintmethod_combo = RadioSet([
  3265. {"label": _("Standard"), "value": "standard"},
  3266. {"label": _("Seed-based"), "value": "seed"},
  3267. {"label": _("Straight lines"), "value": "lines"}
  3268. ], orientation='vertical', stretch=False)
  3269. grid0.addWidget(self.paintmethod_combo, 4, 1)
  3270. # Connect lines
  3271. pathconnectlabel = QtWidgets.QLabel('%s:' % _("Connect"))
  3272. pathconnectlabel.setToolTip(
  3273. _("Draw lines between resulting\n"
  3274. "segments to minimize tool lifts.")
  3275. )
  3276. grid0.addWidget(pathconnectlabel, 5, 0)
  3277. self.pathconnect_cb = FCCheckBox()
  3278. grid0.addWidget(self.pathconnect_cb, 5, 1)
  3279. # Paint contour
  3280. contourlabel = QtWidgets.QLabel('%s:' % _("Contour"))
  3281. contourlabel.setToolTip(
  3282. _("Cut around the perimeter of the polygon\n"
  3283. "to trim rough edges.")
  3284. )
  3285. grid0.addWidget(contourlabel, 6, 0)
  3286. self.contour_cb = FCCheckBox()
  3287. grid0.addWidget(self.contour_cb, 6, 1)
  3288. # Polygon selection
  3289. selectlabel = QtWidgets.QLabel('%s:' % _('Selection'))
  3290. selectlabel.setToolTip(
  3291. _("How to select Polygons to be painted.\n\n"
  3292. "- 'Area Selection' - left mouse click to start selection of the area to be painted.\n"
  3293. "Keeping a modifier key pressed (CTRL or SHIFT) will allow to add multiple areas.\n"
  3294. "- 'All Polygons' - the Paint will start after click.\n"
  3295. "- 'Reference Object' - will do non copper clearing within the area\n"
  3296. "specified by another object.")
  3297. )
  3298. self.selectmethod_combo = RadioSet([
  3299. {"label": _("Single"), "value": "single"},
  3300. {"label": _("Area"), "value": "area"},
  3301. {"label": _("All"), "value": "all"},
  3302. {"label": _("Ref."), "value": "ref"}
  3303. ])
  3304. grid0.addWidget(selectlabel, 7, 0)
  3305. grid0.addWidget(self.selectmethod_combo, 7, 1)
  3306. # ## Plotting type
  3307. self.paint_plotting_radio = RadioSet([{'label': _('Normal'), 'value': 'normal'},
  3308. {"label": _("Progressive"), "value": "progressive"}])
  3309. plotting_label = QtWidgets.QLabel('%s:' % _("Paint Plotting"))
  3310. plotting_label.setToolTip(
  3311. _("- 'Normal' - normal plotting, done at the end of the Paint job\n"
  3312. "- 'Progressive' - after each shape is generated it will be plotted.")
  3313. )
  3314. grid0.addWidget(plotting_label, 8, 0)
  3315. grid0.addWidget(self.paint_plotting_radio, 8, 1)
  3316. self.layout.addStretch()
  3317. class ToolsFilmPrefGroupUI(OptionsGroupUI):
  3318. def __init__(self, parent=None):
  3319. # OptionsGroupUI.__init__(self, "Cutout Tool Options", parent=parent)
  3320. super(ToolsFilmPrefGroupUI, self).__init__(self)
  3321. self.setTitle(str(_("Film Tool Options")))
  3322. # ## Board cuttout
  3323. self.film_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  3324. self.film_label.setToolTip(
  3325. _("Create a PCB film from a Gerber or Geometry\n"
  3326. "FlatCAM object.\n"
  3327. "The file is saved in SVG format.")
  3328. )
  3329. self.layout.addWidget(self.film_label)
  3330. grid0 = QtWidgets.QGridLayout()
  3331. self.layout.addLayout(grid0)
  3332. self.film_type_radio = RadioSet([{'label': 'Pos', 'value': 'pos'},
  3333. {'label': 'Neg', 'value': 'neg'}])
  3334. ftypelbl = QtWidgets.QLabel('%s:' % _('Film Type'))
  3335. ftypelbl.setToolTip(
  3336. _("Generate a Positive black film or a Negative film.\n"
  3337. "Positive means that it will print the features\n"
  3338. "with black on a white canvas.\n"
  3339. "Negative means that it will print the features\n"
  3340. "with white on a black canvas.\n"
  3341. "The Film format is SVG.")
  3342. )
  3343. grid0.addWidget(ftypelbl, 0, 0)
  3344. grid0.addWidget(self.film_type_radio, 0, 1)
  3345. # Film Color
  3346. self.film_color_label = QtWidgets.QLabel('%s:' % _('Film Color'))
  3347. self.film_color_label.setToolTip(
  3348. _("Set the film color when positive film is selected.")
  3349. )
  3350. self.film_color_entry = FCEntry()
  3351. self.film_color_button = QtWidgets.QPushButton()
  3352. self.film_color_button.setFixedSize(15, 15)
  3353. self.form_box_child = QtWidgets.QHBoxLayout()
  3354. self.form_box_child.setContentsMargins(0, 0, 0, 0)
  3355. self.form_box_child.addWidget(self.film_color_entry)
  3356. self.form_box_child.addWidget(self.film_color_button, alignment=Qt.AlignRight)
  3357. self.form_box_child.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  3358. film_color_widget = QtWidgets.QWidget()
  3359. film_color_widget.setLayout(self.form_box_child)
  3360. grid0.addWidget(self.film_color_label, 1, 0)
  3361. grid0.addWidget(film_color_widget, 1, 1)
  3362. self.film_boundary_entry = FCEntry()
  3363. self.film_boundary_label = QtWidgets.QLabel('%s:' % _("Border"))
  3364. self.film_boundary_label.setToolTip(
  3365. _("Specify a border around the object.\n"
  3366. "Only for negative film.\n"
  3367. "It helps if we use as a Box Object the same \n"
  3368. "object as in Film Object. It will create a thick\n"
  3369. "black bar around the actual print allowing for a\n"
  3370. "better delimitation of the outline features which are of\n"
  3371. "white color like the rest and which may confound with the\n"
  3372. "surroundings if not for this border.")
  3373. )
  3374. grid0.addWidget(self.film_boundary_label, 2, 0)
  3375. grid0.addWidget(self.film_boundary_entry, 2, 1)
  3376. self.film_scale_entry = FCEntry()
  3377. self.film_scale_label = QtWidgets.QLabel('%s:' % _("Scale Stroke"))
  3378. self.film_scale_label.setToolTip(
  3379. _("Scale the line stroke thickness of each feature in the SVG file.\n"
  3380. "It means that the line that envelope each SVG feature will be thicker or thinner,\n"
  3381. "therefore the fine features may be more affected by this parameter.")
  3382. )
  3383. grid0.addWidget(self.film_scale_label, 3, 0)
  3384. grid0.addWidget(self.film_scale_entry, 3, 1)
  3385. self.layout.addStretch()
  3386. class ToolsPanelizePrefGroupUI(OptionsGroupUI):
  3387. def __init__(self, parent=None):
  3388. # OptionsGroupUI.__init__(self, "Cutout Tool Options", parent=parent)
  3389. super(ToolsPanelizePrefGroupUI, self).__init__(self)
  3390. self.setTitle(str(_("Panelize Tool Options")))
  3391. # ## Board cuttout
  3392. self.panelize_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  3393. self.panelize_label.setToolTip(
  3394. _("Create an object that contains an array of (x, y) elements,\n"
  3395. "each element is a copy of the source object spaced\n"
  3396. "at a X distance, Y distance of each other.")
  3397. )
  3398. self.layout.addWidget(self.panelize_label)
  3399. grid0 = QtWidgets.QGridLayout()
  3400. self.layout.addLayout(grid0)
  3401. # ## Spacing Columns
  3402. self.pspacing_columns = FCEntry()
  3403. self.spacing_columns_label = QtWidgets.QLabel('%s:' % _("Spacing cols"))
  3404. self.spacing_columns_label.setToolTip(
  3405. _("Spacing between columns of the desired panel.\n"
  3406. "In current units.")
  3407. )
  3408. grid0.addWidget(self.spacing_columns_label, 0, 0)
  3409. grid0.addWidget(self.pspacing_columns, 0, 1)
  3410. # ## Spacing Rows
  3411. self.pspacing_rows = FCEntry()
  3412. self.spacing_rows_label = QtWidgets.QLabel('%s:' % _("Spacing rows"))
  3413. self.spacing_rows_label.setToolTip(
  3414. _("Spacing between rows of the desired panel.\n"
  3415. "In current units.")
  3416. )
  3417. grid0.addWidget(self.spacing_rows_label, 1, 0)
  3418. grid0.addWidget(self.pspacing_rows, 1, 1)
  3419. # ## Columns
  3420. self.pcolumns = FCEntry()
  3421. self.columns_label = QtWidgets.QLabel('%s:' % _("Columns"))
  3422. self.columns_label.setToolTip(
  3423. _("Number of columns of the desired panel")
  3424. )
  3425. grid0.addWidget(self.columns_label, 2, 0)
  3426. grid0.addWidget(self.pcolumns, 2, 1)
  3427. # ## Rows
  3428. self.prows = FCEntry()
  3429. self.rows_label = QtWidgets.QLabel('%s:' % _("Rows"))
  3430. self.rows_label.setToolTip(
  3431. _("Number of rows of the desired panel")
  3432. )
  3433. grid0.addWidget(self.rows_label, 3, 0)
  3434. grid0.addWidget(self.prows, 3, 1)
  3435. # ## Type of resulting Panel object
  3436. self.panel_type_radio = RadioSet([{'label': _('Gerber'), 'value': 'gerber'},
  3437. {'label': _('Geo'), 'value': 'geometry'}])
  3438. self.panel_type_label = QtWidgets.QLabel('%s:' % _("Panel Type"))
  3439. self.panel_type_label.setToolTip(
  3440. _("Choose the type of object for the panel object:\n"
  3441. "- Gerber\n"
  3442. "- Geometry")
  3443. )
  3444. grid0.addWidget(self.panel_type_label, 4, 0)
  3445. grid0.addWidget(self.panel_type_radio, 4, 1)
  3446. # ## Constrains
  3447. self.pconstrain_cb = FCCheckBox('%s:' % _("Constrain within"))
  3448. self.pconstrain_cb.setToolTip(
  3449. _("Area define by DX and DY within to constrain the panel.\n"
  3450. "DX and DY values are in current units.\n"
  3451. "Regardless of how many columns and rows are desired,\n"
  3452. "the final panel will have as many columns and rows as\n"
  3453. "they fit completely within selected area.")
  3454. )
  3455. grid0.addWidget(self.pconstrain_cb, 5, 0)
  3456. self.px_width_entry = FCEntry()
  3457. self.x_width_lbl = QtWidgets.QLabel('%s:' % _("Width (DX)"))
  3458. self.x_width_lbl.setToolTip(
  3459. _("The width (DX) within which the panel must fit.\n"
  3460. "In current units.")
  3461. )
  3462. grid0.addWidget(self.x_width_lbl, 6, 0)
  3463. grid0.addWidget(self.px_width_entry, 6, 1)
  3464. self.py_height_entry = FCEntry()
  3465. self.y_height_lbl = QtWidgets.QLabel('%s:' % _("Height (DY)"))
  3466. self.y_height_lbl.setToolTip(
  3467. _("The height (DY)within which the panel must fit.\n"
  3468. "In current units.")
  3469. )
  3470. grid0.addWidget(self.y_height_lbl, 7, 0)
  3471. grid0.addWidget(self.py_height_entry, 7, 1)
  3472. self.layout.addStretch()
  3473. class ToolsCalculatorsPrefGroupUI(OptionsGroupUI):
  3474. def __init__(self, parent=None):
  3475. # OptionsGroupUI.__init__(self, "Calculators Tool Options", parent=parent)
  3476. super(ToolsCalculatorsPrefGroupUI, self).__init__(self)
  3477. self.setTitle(str(_("Calculators Tool Options")))
  3478. # ## V-shape Calculator Tool
  3479. self.vshape_tool_label = QtWidgets.QLabel("<b>%s:</b>" % _("V-Shape Tool Calculator"))
  3480. self.vshape_tool_label.setToolTip(
  3481. _("Calculate the tool diameter for a given V-shape tool,\n"
  3482. "having the tip diameter, tip angle and\n"
  3483. "depth-of-cut as parameters.")
  3484. )
  3485. self.layout.addWidget(self.vshape_tool_label)
  3486. grid0 = QtWidgets.QGridLayout()
  3487. self.layout.addLayout(grid0)
  3488. # ## Tip Diameter
  3489. self.tip_dia_entry = FCEntry()
  3490. self.tip_dia_label = QtWidgets.QLabel('%s:' % _("Tip Diameter"))
  3491. self.tip_dia_label.setToolTip(
  3492. _("This is the tool tip diameter.\n"
  3493. "It is specified by manufacturer.")
  3494. )
  3495. grid0.addWidget(self.tip_dia_label, 0, 0)
  3496. grid0.addWidget(self.tip_dia_entry, 0, 1)
  3497. # ## Tip angle
  3498. self.tip_angle_entry = FCEntry()
  3499. self.tip_angle_label = QtWidgets.QLabel('%s:' % _("Tip Angle"))
  3500. self.tip_angle_label.setToolTip(
  3501. _("This is the angle on the tip of the tool.\n"
  3502. "It is specified by manufacturer.")
  3503. )
  3504. grid0.addWidget(self.tip_angle_label, 1, 0)
  3505. grid0.addWidget(self.tip_angle_entry, 1, 1)
  3506. # ## Depth-of-cut Cut Z
  3507. self.cut_z_entry = FCEntry()
  3508. self.cut_z_label = QtWidgets.QLabel('%s:' % _("Cut Z"))
  3509. self.cut_z_label.setToolTip(
  3510. _("This is depth to cut into material.\n"
  3511. "In the CNCJob object it is the CutZ parameter.")
  3512. )
  3513. grid0.addWidget(self.cut_z_label, 2, 0)
  3514. grid0.addWidget(self.cut_z_entry, 2, 1)
  3515. # ## Electroplating Calculator Tool
  3516. self.plate_title_label = QtWidgets.QLabel("<b>%s:</b>" % _("ElectroPlating Calculator"))
  3517. self.plate_title_label.setToolTip(
  3518. _("This calculator is useful for those who plate the via/pad/drill holes,\n"
  3519. "using a method like grahite ink or calcium hypophosphite ink or palladium chloride.")
  3520. )
  3521. self.layout.addWidget(self.plate_title_label)
  3522. grid1 = QtWidgets.QGridLayout()
  3523. self.layout.addLayout(grid1)
  3524. # ## PCB Length
  3525. self.pcblength_entry = FCEntry()
  3526. self.pcblengthlabel = QtWidgets.QLabel('%s:' % _("Board Length"))
  3527. self.pcblengthlabel.setToolTip(_('This is the board length. In centimeters.'))
  3528. grid1.addWidget(self.pcblengthlabel, 0, 0)
  3529. grid1.addWidget(self.pcblength_entry, 0, 1)
  3530. # ## PCB Width
  3531. self.pcbwidth_entry = FCEntry()
  3532. self.pcbwidthlabel = QtWidgets.QLabel('%s:' % _("Board Width"))
  3533. self.pcbwidthlabel.setToolTip(_('This is the board width.In centimeters.'))
  3534. grid1.addWidget(self.pcbwidthlabel, 1, 0)
  3535. grid1.addWidget(self.pcbwidth_entry, 1, 1)
  3536. # ## Current Density
  3537. self.cdensity_label = QtWidgets.QLabel('%s:' % _("Current Density"))
  3538. self.cdensity_entry = FCEntry()
  3539. self.cdensity_label.setToolTip(_("Current density to pass through the board. \n"
  3540. "In Amps per Square Feet ASF."))
  3541. grid1.addWidget(self.cdensity_label, 2, 0)
  3542. grid1.addWidget(self.cdensity_entry, 2, 1)
  3543. # ## PCB Copper Growth
  3544. self.growth_label = QtWidgets.QLabel('%s:' % _("Copper Growth"))
  3545. self.growth_entry = FCEntry()
  3546. self.growth_label.setToolTip(_("How thick the copper growth is intended to be.\n"
  3547. "In microns."))
  3548. grid1.addWidget(self.growth_label, 3, 0)
  3549. grid1.addWidget(self.growth_entry, 3, 1)
  3550. self.layout.addStretch()
  3551. class ToolsTransformPrefGroupUI(OptionsGroupUI):
  3552. def __init__(self, parent=None):
  3553. super(ToolsTransformPrefGroupUI, self).__init__(self)
  3554. self.setTitle(str(_("Transform Tool Options")))
  3555. # ## Transformations
  3556. self.transform_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  3557. self.transform_label.setToolTip(
  3558. _("Various transformations that can be applied\n"
  3559. "on a FlatCAM object.")
  3560. )
  3561. self.layout.addWidget(self.transform_label)
  3562. grid0 = QtWidgets.QGridLayout()
  3563. self.layout.addLayout(grid0)
  3564. # ## Rotate Angle
  3565. self.rotate_entry = FCEntry()
  3566. self.rotate_label = QtWidgets.QLabel('%s:' % _("Rotate Angle"))
  3567. self.rotate_label.setToolTip(
  3568. _("Angle for Rotation action, in degrees.\n"
  3569. "Float number between -360 and 359.\n"
  3570. "Positive numbers for CW motion.\n"
  3571. "Negative numbers for CCW motion.")
  3572. )
  3573. grid0.addWidget(self.rotate_label, 0, 0)
  3574. grid0.addWidget(self.rotate_entry, 0, 1)
  3575. # ## Skew/Shear Angle on X axis
  3576. self.skewx_entry = FCEntry()
  3577. self.skewx_label = QtWidgets.QLabel('%s:' % _("Skew_X angle"))
  3578. self.skewx_label.setToolTip(
  3579. _("Angle for Skew action, in degrees.\n"
  3580. "Float number between -360 and 359.")
  3581. )
  3582. grid0.addWidget(self.skewx_label, 1, 0)
  3583. grid0.addWidget(self.skewx_entry, 1, 1)
  3584. # ## Skew/Shear Angle on Y axis
  3585. self.skewy_entry = FCEntry()
  3586. self.skewy_label = QtWidgets.QLabel('%s:' % _("Skew_Y angle"))
  3587. self.skewy_label.setToolTip(
  3588. _("Angle for Skew action, in degrees.\n"
  3589. "Float number between -360 and 359.")
  3590. )
  3591. grid0.addWidget(self.skewy_label, 2, 0)
  3592. grid0.addWidget(self.skewy_entry, 2, 1)
  3593. # ## Scale factor on X axis
  3594. self.scalex_entry = FCEntry()
  3595. self.scalex_label = QtWidgets.QLabel('%s:' % _("Scale_X factor"))
  3596. self.scalex_label.setToolTip(
  3597. _("Factor for scaling on X axis.")
  3598. )
  3599. grid0.addWidget(self.scalex_label, 3, 0)
  3600. grid0.addWidget(self.scalex_entry, 3, 1)
  3601. # ## Scale factor on X axis
  3602. self.scaley_entry = FCEntry()
  3603. self.scaley_label = QtWidgets.QLabel('%s:' % _("Scale_Y factor"))
  3604. self.scaley_label.setToolTip(
  3605. _("Factor for scaling on Y axis.")
  3606. )
  3607. grid0.addWidget(self.scaley_label, 4, 0)
  3608. grid0.addWidget(self.scaley_entry, 4, 1)
  3609. # ## Link Scale factors
  3610. self.link_cb = FCCheckBox(_("Link"))
  3611. self.link_cb.setToolTip(
  3612. _("Scale the selected object(s)\n"
  3613. "using the Scale_X factor for both axis.")
  3614. )
  3615. grid0.addWidget(self.link_cb, 5, 0)
  3616. # ## Scale Reference
  3617. self.reference_cb = FCCheckBox('%s' % _("Scale Reference"))
  3618. self.reference_cb.setToolTip(
  3619. _("Scale the selected object(s)\n"
  3620. "using the origin reference when checked,\n"
  3621. "and the center of the biggest bounding box\n"
  3622. "of the selected objects when unchecked.")
  3623. )
  3624. grid0.addWidget(self.reference_cb, 5, 1)
  3625. # ## Offset distance on X axis
  3626. self.offx_entry = FCEntry()
  3627. self.offx_label = QtWidgets.QLabel('%s:' % _("Offset_X val"))
  3628. self.offx_label.setToolTip(
  3629. _("Distance to offset on X axis. In current units.")
  3630. )
  3631. grid0.addWidget(self.offx_label, 6, 0)
  3632. grid0.addWidget(self.offx_entry, 6, 1)
  3633. # ## Offset distance on Y axis
  3634. self.offy_entry = FCEntry()
  3635. self.offy_label = QtWidgets.QLabel('%s:' % _("Offset_Y val"))
  3636. self.offy_label.setToolTip(
  3637. _("Distance to offset on Y axis. In current units.")
  3638. )
  3639. grid0.addWidget(self.offy_label, 7, 0)
  3640. grid0.addWidget(self.offy_entry, 7, 1)
  3641. # ## Mirror (Flip) Reference Point
  3642. self.mirror_reference_cb = FCCheckBox('%s' % _("Mirror Reference"))
  3643. self.mirror_reference_cb.setToolTip(
  3644. _("Flip the selected object(s)\n"
  3645. "around the point in Point Entry Field.\n"
  3646. "\n"
  3647. "The point coordinates can be captured by\n"
  3648. "left click on canvas together with pressing\n"
  3649. "SHIFT key. \n"
  3650. "Then click Add button to insert coordinates.\n"
  3651. "Or enter the coords in format (x, y) in the\n"
  3652. "Point Entry field and click Flip on X(Y)"))
  3653. grid0.addWidget(self.mirror_reference_cb, 8, 1)
  3654. self.flip_ref_label = QtWidgets.QLabel('%s:' % _(" Mirror Ref. Point"))
  3655. self.flip_ref_label.setToolTip(
  3656. _("Coordinates in format (x, y) used as reference for mirroring.\n"
  3657. "The 'x' in (x, y) will be used when using Flip on X and\n"
  3658. "the 'y' in (x, y) will be used when using Flip on Y and")
  3659. )
  3660. self.flip_ref_entry = EvalEntry2("(0, 0)")
  3661. grid0.addWidget(self.flip_ref_label, 9, 0)
  3662. grid0.addWidget(self.flip_ref_entry, 9, 1)
  3663. self.layout.addStretch()
  3664. class ToolsSolderpastePrefGroupUI(OptionsGroupUI):
  3665. def __init__(self, parent=None):
  3666. super(ToolsSolderpastePrefGroupUI, self).__init__(self)
  3667. self.setTitle(str(_("SolderPaste Tool Options")))
  3668. # ## Solder Paste Dispensing
  3669. self.solderpastelabel = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  3670. self.solderpastelabel.setToolTip(
  3671. _("A tool to create GCode for dispensing\n"
  3672. "solder paste onto a PCB.")
  3673. )
  3674. self.layout.addWidget(self.solderpastelabel)
  3675. grid0 = QtWidgets.QGridLayout()
  3676. self.layout.addLayout(grid0)
  3677. # Nozzle Tool Diameters
  3678. nozzletdlabel = QtWidgets.QLabel('%s:' % _('Tools dia'))
  3679. nozzletdlabel.setToolTip(
  3680. _("Diameters of nozzle tools, separated by ','")
  3681. )
  3682. self.nozzle_tool_dia_entry = FCEntry()
  3683. grid0.addWidget(nozzletdlabel, 0, 0)
  3684. grid0.addWidget(self.nozzle_tool_dia_entry, 0, 1)
  3685. # New Nozzle Tool Dia
  3686. self.addtool_entry_lbl = QtWidgets.QLabel('<b>%s:</b>' % _('New Nozzle Dia'))
  3687. self.addtool_entry_lbl.setToolTip(
  3688. _("Diameter for the new Nozzle tool to add in the Tool Table")
  3689. )
  3690. self.addtool_entry = FCEntry()
  3691. grid0.addWidget(self.addtool_entry_lbl, 1, 0)
  3692. grid0.addWidget(self.addtool_entry, 1, 1)
  3693. # Z dispense start
  3694. self.z_start_entry = FCEntry()
  3695. self.z_start_label = QtWidgets.QLabel('%s:' % _("Z Dispense Start"))
  3696. self.z_start_label.setToolTip(
  3697. _("The height (Z) when solder paste dispensing starts.")
  3698. )
  3699. grid0.addWidget(self.z_start_label, 2, 0)
  3700. grid0.addWidget(self.z_start_entry, 2, 1)
  3701. # Z dispense
  3702. self.z_dispense_entry = FCEntry()
  3703. self.z_dispense_label = QtWidgets.QLabel('%s:' % _("Z Dispense"))
  3704. self.z_dispense_label.setToolTip(
  3705. _("The height (Z) when doing solder paste dispensing.")
  3706. )
  3707. grid0.addWidget(self.z_dispense_label, 3, 0)
  3708. grid0.addWidget(self.z_dispense_entry, 3, 1)
  3709. # Z dispense stop
  3710. self.z_stop_entry = FCEntry()
  3711. self.z_stop_label = QtWidgets.QLabel('%s:' % _("Z Dispense Stop"))
  3712. self.z_stop_label.setToolTip(
  3713. _("The height (Z) when solder paste dispensing stops.")
  3714. )
  3715. grid0.addWidget(self.z_stop_label, 4, 0)
  3716. grid0.addWidget(self.z_stop_entry, 4, 1)
  3717. # Z travel
  3718. self.z_travel_entry = FCEntry()
  3719. self.z_travel_label = QtWidgets.QLabel('%s:' % _("Z Travel"))
  3720. self.z_travel_label.setToolTip(
  3721. _("The height (Z) for travel between pads\n"
  3722. "(without dispensing solder paste).")
  3723. )
  3724. grid0.addWidget(self.z_travel_label, 5, 0)
  3725. grid0.addWidget(self.z_travel_entry, 5, 1)
  3726. # Z toolchange location
  3727. self.z_toolchange_entry = FCEntry()
  3728. self.z_toolchange_label = QtWidgets.QLabel('%s:' % _("Z Toolchange"))
  3729. self.z_toolchange_label.setToolTip(
  3730. _("The height (Z) for tool (nozzle) change.")
  3731. )
  3732. grid0.addWidget(self.z_toolchange_label, 6, 0)
  3733. grid0.addWidget(self.z_toolchange_entry, 6, 1)
  3734. # X,Y Toolchange location
  3735. self.xy_toolchange_entry = FCEntry()
  3736. self.xy_toolchange_label = QtWidgets.QLabel('%s:' % _("Toolchange X-Y"))
  3737. self.xy_toolchange_label.setToolTip(
  3738. _("The X,Y location for tool (nozzle) change.\n"
  3739. "The format is (x, y) where x and y are real numbers.")
  3740. )
  3741. grid0.addWidget(self.xy_toolchange_label, 7, 0)
  3742. grid0.addWidget(self.xy_toolchange_entry, 7, 1)
  3743. # Feedrate X-Y
  3744. self.frxy_entry = FCEntry()
  3745. self.frxy_label = QtWidgets.QLabel('%s:' % _("Feedrate X-Y"))
  3746. self.frxy_label.setToolTip(
  3747. _("Feedrate (speed) while moving on the X-Y plane.")
  3748. )
  3749. grid0.addWidget(self.frxy_label, 8, 0)
  3750. grid0.addWidget(self.frxy_entry, 8, 1)
  3751. # Feedrate Z
  3752. self.frz_entry = FCEntry()
  3753. self.frz_label = QtWidgets.QLabel('%s:' % _("Feedrate Z"))
  3754. self.frz_label.setToolTip(
  3755. _("Feedrate (speed) while moving vertically\n"
  3756. "(on Z plane).")
  3757. )
  3758. grid0.addWidget(self.frz_label, 9, 0)
  3759. grid0.addWidget(self.frz_entry, 9, 1)
  3760. # Feedrate Z Dispense
  3761. self.frz_dispense_entry = FCEntry()
  3762. self.frz_dispense_label = QtWidgets.QLabel('%s:' % _("Feedrate Z Dispense"))
  3763. self.frz_dispense_label.setToolTip(
  3764. _("Feedrate (speed) while moving up vertically\n"
  3765. "to Dispense position (on Z plane).")
  3766. )
  3767. grid0.addWidget(self.frz_dispense_label, 10, 0)
  3768. grid0.addWidget(self.frz_dispense_entry, 10, 1)
  3769. # Spindle Speed Forward
  3770. self.speedfwd_entry = FCEntry()
  3771. self.speedfwd_label = QtWidgets.QLabel('%s:' % _("Spindle Speed FWD"))
  3772. self.speedfwd_label.setToolTip(
  3773. _("The dispenser speed while pushing solder paste\n"
  3774. "through the dispenser nozzle.")
  3775. )
  3776. grid0.addWidget(self.speedfwd_label, 11, 0)
  3777. grid0.addWidget(self.speedfwd_entry, 11, 1)
  3778. # Dwell Forward
  3779. self.dwellfwd_entry = FCEntry()
  3780. self.dwellfwd_label = QtWidgets.QLabel('%s:' % _("Dwell FWD"))
  3781. self.dwellfwd_label.setToolTip(
  3782. _("Pause after solder dispensing.")
  3783. )
  3784. grid0.addWidget(self.dwellfwd_label, 12, 0)
  3785. grid0.addWidget(self.dwellfwd_entry, 12, 1)
  3786. # Spindle Speed Reverse
  3787. self.speedrev_entry = FCEntry()
  3788. self.speedrev_label = QtWidgets.QLabel('%s:' % _("Spindle Speed REV"))
  3789. self.speedrev_label.setToolTip(
  3790. _("The dispenser speed while retracting solder paste\n"
  3791. "through the dispenser nozzle.")
  3792. )
  3793. grid0.addWidget(self.speedrev_label, 13, 0)
  3794. grid0.addWidget(self.speedrev_entry, 13, 1)
  3795. # Dwell Reverse
  3796. self.dwellrev_entry = FCEntry()
  3797. self.dwellrev_label = QtWidgets.QLabel('%s:' % _("Dwell REV"))
  3798. self.dwellrev_label.setToolTip(
  3799. _("Pause after solder paste dispenser retracted,\n"
  3800. "to allow pressure equilibrium.")
  3801. )
  3802. grid0.addWidget(self.dwellrev_label, 14, 0)
  3803. grid0.addWidget(self.dwellrev_entry, 14, 1)
  3804. # Postprocessors
  3805. pp_label = QtWidgets.QLabel('%s:' % _('PostProcessor'))
  3806. pp_label.setToolTip(
  3807. _("Files that control the GCode generation.")
  3808. )
  3809. self.pp_combo = FCComboBox()
  3810. grid0.addWidget(pp_label, 15, 0)
  3811. grid0.addWidget(self.pp_combo, 15, 1)
  3812. self.layout.addStretch()
  3813. class ToolsSubPrefGroupUI(OptionsGroupUI):
  3814. def __init__(self, parent=None):
  3815. super(ToolsSubPrefGroupUI, self).__init__(self)
  3816. self.setTitle(str(_("Substractor Tool Options")))
  3817. # ## Solder Paste Dispensing
  3818. self.sublabel = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  3819. self.sublabel.setToolTip(
  3820. _("A tool to substract one Gerber or Geometry object\n"
  3821. "from another of the same type.")
  3822. )
  3823. self.layout.addWidget(self.sublabel)
  3824. self.close_paths_cb = FCCheckBox(_("Close paths"))
  3825. self.close_paths_cb.setToolTip(_("Checking this will close the paths cut by the Geometry substractor object."))
  3826. self.layout.addWidget(self.close_paths_cb)
  3827. self.layout.addStretch()
  3828. class FAExcPrefGroupUI(OptionsGroupUI):
  3829. def __init__(self, parent=None):
  3830. # OptionsGroupUI.__init__(self, "Excellon File associations Preferences", parent=None)
  3831. super().__init__(self)
  3832. self.setTitle(str(_("Excellon File associations")))
  3833. self.layout.setContentsMargins(2, 2, 2, 2)
  3834. self.vertical_lay = QtWidgets.QVBoxLayout()
  3835. scroll_widget = QtWidgets.QWidget()
  3836. scroll = VerticalScrollArea()
  3837. scroll.setWidget(scroll_widget)
  3838. scroll.setWidgetResizable(True)
  3839. scroll.setFrameShape(QtWidgets.QFrame.NoFrame)
  3840. self.restore_btn = FCButton(_("Restore"))
  3841. self.restore_btn.setToolTip(_("Restore the extension list to the default state."))
  3842. self.del_all_btn = FCButton(_("Delete All"))
  3843. self.del_all_btn.setToolTip(_("Delete all extensions from the list."))
  3844. hlay0 = QtWidgets.QHBoxLayout()
  3845. hlay0.addWidget(self.restore_btn)
  3846. hlay0.addWidget(self.del_all_btn)
  3847. self.vertical_lay.addLayout(hlay0)
  3848. # # ## Excellon associations
  3849. list_label = QtWidgets.QLabel("<b>%s:</b>" % _("Extensions list"))
  3850. list_label.setToolTip(
  3851. _("List of file extensions to be\n"
  3852. "associated with FlatCAM.")
  3853. )
  3854. self.vertical_lay.addWidget(list_label)
  3855. settings = QSettings("Open Source", "FlatCAM")
  3856. if settings.contains("textbox_font_size"):
  3857. tb_fsize = settings.value('textbox_font_size', type=int)
  3858. else:
  3859. tb_fsize = 10
  3860. self.exc_list_text = FCTextArea()
  3861. self.exc_list_text.setReadOnly(True)
  3862. # self.exc_list_text.sizeHint(custom_sizehint=150)
  3863. font = QtGui.QFont()
  3864. font.setPointSize(tb_fsize)
  3865. self.exc_list_text.setFont(font)
  3866. self.vertical_lay.addWidget(self.exc_list_text)
  3867. self.ext_label = QtWidgets.QLabel('%s:' % _("Extension"))
  3868. self.ext_label.setToolTip(_("A file extension to be added or deleted to the list."))
  3869. self.ext_entry = FCEntry()
  3870. hlay1 = QtWidgets.QHBoxLayout()
  3871. self.vertical_lay.addLayout(hlay1)
  3872. hlay1.addWidget(self.ext_label)
  3873. hlay1.addWidget(self.ext_entry)
  3874. self.add_btn = FCButton(_("Add Extension"))
  3875. self.add_btn.setToolTip(_("Add a file extension to the list"))
  3876. self.del_btn = FCButton(_("Delete Extension"))
  3877. self.del_btn.setToolTip(_("Delete a file extension from the list"))
  3878. hlay2 = QtWidgets.QHBoxLayout()
  3879. self.vertical_lay.addLayout(hlay2)
  3880. hlay2.addWidget(self.add_btn)
  3881. hlay2.addWidget(self.del_btn)
  3882. self.exc_list_btn = FCButton(_("Apply Association"))
  3883. self.exc_list_btn.setToolTip(_("Apply the file associations between\n"
  3884. "FlatCAM and the files with above extensions.\n"
  3885. "They will be active after next logon.\n"
  3886. "This work only in Windows."))
  3887. self.vertical_lay.addWidget(self.exc_list_btn)
  3888. scroll_widget.setLayout(self.vertical_lay)
  3889. self.layout.addWidget(scroll)
  3890. # self.vertical_lay.addStretch()
  3891. class FAGcoPrefGroupUI(OptionsGroupUI):
  3892. def __init__(self, parent=None):
  3893. # OptionsGroupUI.__init__(self, "Gcode File associations Preferences", parent=None)
  3894. super(FAGcoPrefGroupUI, self).__init__(self)
  3895. self.setTitle(str(_("GCode File associations")))
  3896. self.restore_btn = FCButton(_("Restore"))
  3897. self.restore_btn.setToolTip(_("Restore the extension list to the default state."))
  3898. self.del_all_btn = FCButton(_("Delete All"))
  3899. self.del_all_btn.setToolTip(_("Delete all extensions from the list."))
  3900. hlay0 = QtWidgets.QHBoxLayout()
  3901. self.layout.addLayout(hlay0)
  3902. hlay0.addWidget(self.restore_btn)
  3903. hlay0.addWidget(self.del_all_btn)
  3904. # ## G-Code associations
  3905. self.gco_list_label = QtWidgets.QLabel("<b>%s:</b>" % _("Extensions list"))
  3906. self.gco_list_label.setToolTip(
  3907. _("List of file extensions to be\n"
  3908. "associated with FlatCAM.")
  3909. )
  3910. self.layout.addWidget(self.gco_list_label)
  3911. settings = QSettings("Open Source", "FlatCAM")
  3912. if settings.contains("textbox_font_size"):
  3913. tb_fsize = settings.value('textbox_font_size', type=int)
  3914. else:
  3915. tb_fsize = 10
  3916. self.gco_list_text = FCTextArea()
  3917. self.gco_list_text.setReadOnly(True)
  3918. # self.gco_list_text.sizeHint(custom_sizehint=150)
  3919. font = QtGui.QFont()
  3920. font.setPointSize(tb_fsize)
  3921. self.gco_list_text.setFont(font)
  3922. self.layout.addWidget(self.gco_list_text)
  3923. self.ext_label = QtWidgets.QLabel('%s:' % _("Extension"))
  3924. self.ext_label.setToolTip(_("A file extension to be added or deleted to the list."))
  3925. self.ext_entry = FCEntry()
  3926. hlay1 = QtWidgets.QHBoxLayout()
  3927. self.layout.addLayout(hlay1)
  3928. hlay1.addWidget(self.ext_label)
  3929. hlay1.addWidget(self.ext_entry)
  3930. self.add_btn = FCButton(_("Add Extension"))
  3931. self.add_btn.setToolTip(_("Add a file extension to the list"))
  3932. self.del_btn = FCButton(_("Delete Extension"))
  3933. self.del_btn.setToolTip(_("Delete a file extension from the list"))
  3934. hlay2 = QtWidgets.QHBoxLayout()
  3935. self.layout.addLayout(hlay2)
  3936. hlay2.addWidget(self.add_btn)
  3937. hlay2.addWidget(self.del_btn)
  3938. self.gco_list_btn = FCButton(_("Apply Association"))
  3939. self.gco_list_btn.setToolTip(_("Apply the file associations between\n"
  3940. "FlatCAM and the files with above extensions.\n"
  3941. "They will be active after next logon.\n"
  3942. "This work only in Windows."))
  3943. self.layout.addWidget(self.gco_list_btn)
  3944. # self.layout.addStretch()
  3945. class FAGrbPrefGroupUI(OptionsGroupUI):
  3946. def __init__(self, parent=None):
  3947. # OptionsGroupUI.__init__(self, "Gerber File associations Preferences", parent=None)
  3948. super(FAGrbPrefGroupUI, self).__init__(self)
  3949. self.setTitle(str(_("Gerber File associations")))
  3950. self.restore_btn = FCButton(_("Restore"))
  3951. self.restore_btn.setToolTip(_("Restore the extension list to the default state."))
  3952. self.del_all_btn = FCButton(_("Delete All"))
  3953. self.del_all_btn.setToolTip(_("Delete all extensions from the list."))
  3954. hlay0 = QtWidgets.QHBoxLayout()
  3955. self.layout.addLayout(hlay0)
  3956. hlay0.addWidget(self.restore_btn)
  3957. hlay0.addWidget(self.del_all_btn)
  3958. # ## Gerber associations
  3959. self.grb_list_label = QtWidgets.QLabel("<b>%s:</b>" % _("Extensions list"))
  3960. self.grb_list_label.setToolTip(
  3961. _("List of file extensions to be\n"
  3962. "associated with FlatCAM.")
  3963. )
  3964. self.layout.addWidget(self.grb_list_label)
  3965. settings = QSettings("Open Source", "FlatCAM")
  3966. if settings.contains("textbox_font_size"):
  3967. tb_fsize = settings.value('textbox_font_size', type=int)
  3968. else:
  3969. tb_fsize = 10
  3970. self.grb_list_text = FCTextArea()
  3971. self.grb_list_text.setReadOnly(True)
  3972. # self.grb_list_text.sizeHint(custom_sizehint=150)
  3973. self.layout.addWidget(self.grb_list_text)
  3974. font = QtGui.QFont()
  3975. font.setPointSize(tb_fsize)
  3976. self.grb_list_text.setFont(font)
  3977. self.ext_label = QtWidgets.QLabel('%s:' % _("Extension"))
  3978. self.ext_label.setToolTip(_("A file extension to be added or deleted to the list."))
  3979. self.ext_entry = FCEntry()
  3980. hlay1 = QtWidgets.QHBoxLayout()
  3981. self.layout.addLayout(hlay1)
  3982. hlay1.addWidget(self.ext_label)
  3983. hlay1.addWidget(self.ext_entry)
  3984. self.add_btn = FCButton(_("Add Extension"))
  3985. self.add_btn.setToolTip(_("Add a file extension to the list"))
  3986. self.del_btn = FCButton(_("Delete Extension"))
  3987. self.del_btn.setToolTip(_("Delete a file extension from the list"))
  3988. hlay2 = QtWidgets.QHBoxLayout()
  3989. self.layout.addLayout(hlay2)
  3990. hlay2.addWidget(self.add_btn)
  3991. hlay2.addWidget(self.del_btn)
  3992. self.grb_list_btn = FCButton(_("Apply Association"))
  3993. self.grb_list_btn.setToolTip(_("Apply the file associations between\n"
  3994. "FlatCAM and the files with above extensions.\n"
  3995. "They will be active after next logon.\n"
  3996. "This work only in Windows."))
  3997. self.layout.addWidget(self.grb_list_btn)
  3998. # self.layout.addStretch()
  3999. class AutoCompletePrefGroupUI(OptionsGroupUI):
  4000. def __init__(self, parent=None):
  4001. # OptionsGroupUI.__init__(self, "Gerber File associations Preferences", parent=None)
  4002. super().__init__(self, parent=parent)
  4003. self.setTitle(str(_("Autocompleter Keywords")))
  4004. self.restore_btn = FCButton(_("Restore"))
  4005. self.restore_btn.setToolTip(_("Restore the autocompleter keywords list to the default state."))
  4006. self.del_all_btn = FCButton(_("Delete All"))
  4007. self.del_all_btn.setToolTip(_("Delete all autocompleter keywords from the list."))
  4008. hlay0 = QtWidgets.QHBoxLayout()
  4009. self.layout.addLayout(hlay0)
  4010. hlay0.addWidget(self.restore_btn)
  4011. hlay0.addWidget(self.del_all_btn)
  4012. # ## Gerber associations
  4013. self.grb_list_label = QtWidgets.QLabel("<b>%s:</b>" % _("Keywords list"))
  4014. self.grb_list_label.setToolTip(
  4015. _("List of keywords used by\n"
  4016. "the autocompleter in FlatCAM.\n"
  4017. "The autocompleter is installed\n"
  4018. "in the Code Editor and for the Tcl Shell.")
  4019. )
  4020. self.layout.addWidget(self.grb_list_label)
  4021. settings = QSettings("Open Source", "FlatCAM")
  4022. if settings.contains("textbox_font_size"):
  4023. tb_fsize = settings.value('textbox_font_size', type=int)
  4024. else:
  4025. tb_fsize = 10
  4026. self.kw_list_text = FCTextArea()
  4027. self.kw_list_text.setReadOnly(True)
  4028. # self.grb_list_text.sizeHint(custom_sizehint=150)
  4029. self.layout.addWidget(self.kw_list_text)
  4030. font = QtGui.QFont()
  4031. font.setPointSize(tb_fsize)
  4032. self.kw_list_text.setFont(font)
  4033. self.kw_label = QtWidgets.QLabel('%s:' % _("Extension"))
  4034. self.kw_label.setToolTip(_("A keyword to be added or deleted to the list."))
  4035. self.kw_entry = FCEntry()
  4036. hlay1 = QtWidgets.QHBoxLayout()
  4037. self.layout.addLayout(hlay1)
  4038. hlay1.addWidget(self.kw_label)
  4039. hlay1.addWidget(self.kw_entry)
  4040. self.add_btn = FCButton(_("Add keyword"))
  4041. self.add_btn.setToolTip(_("Add a keyword to the list"))
  4042. self.del_btn = FCButton(_("Delete keyword"))
  4043. self.del_btn.setToolTip(_("Delete a keyword from the list"))
  4044. hlay2 = QtWidgets.QHBoxLayout()
  4045. self.layout.addLayout(hlay2)
  4046. hlay2.addWidget(self.add_btn)
  4047. hlay2.addWidget(self.del_btn)
  4048. # self.layout.addStretch()