PreferencesUI.py 195 KB

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