PreferencesUI.py 209 KB

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