PreferencesUI.py 208 KB

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