MainGUI.py 230 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954
  1. # ##########################################################
  2. # FlatCAM: 2D Post-processing for Manufacturing #
  3. # http://flatcam.org #
  4. # Author: Juan Pablo Caram (c) #
  5. # Date: 2/5/2014 #
  6. # MIT Licence #
  7. # ##########################################################
  8. # ##########################################################
  9. # File Modified (major mod): Marius Adrian Stanciu #
  10. # Date: 3/10/2019 #
  11. # ##########################################################
  12. import platform
  13. from appGUI.GUIElements import *
  14. from appGUI.preferences import settings
  15. from appGUI.preferences.cncjob.CNCJobPreferencesUI import CNCJobPreferencesUI
  16. from appGUI.preferences.excellon.ExcellonPreferencesUI import ExcellonPreferencesUI
  17. from appGUI.preferences.general.GeneralPreferencesUI import GeneralPreferencesUI
  18. from appGUI.preferences.geometry.GeometryPreferencesUI import GeometryPreferencesUI
  19. from appGUI.preferences.gerber.GerberPreferencesUI import GerberPreferencesUI
  20. from appEditors.AppGeoEditor import FCShapeTool
  21. from matplotlib.backend_bases import KeyEvent as mpl_key_event
  22. import webbrowser
  23. from appGUI.preferences.tools.Tools2PreferencesUI import Tools2PreferencesUI
  24. from appGUI.preferences.tools.ToolsPreferencesUI import ToolsPreferencesUI
  25. from appGUI.preferences.utilities.UtilPreferencesUI import UtilPreferencesUI
  26. from appObjects.ObjectCollection import KeySensitiveListView
  27. import subprocess
  28. import os
  29. import sys
  30. import gettext
  31. import appTranslation as fcTranslate
  32. import builtins
  33. fcTranslate.apply_language('strings')
  34. if '_' not in builtins.__dict__:
  35. _ = gettext.gettext
  36. class MainGUI(QtWidgets.QMainWindow):
  37. # Emitted when persistent window geometry needs to be retained
  38. geom_update = QtCore.pyqtSignal(int, int, int, int, int, name='geomUpdate')
  39. final_save = QtCore.pyqtSignal(name='saveBeforeExit')
  40. def __init__(self, app):
  41. super(MainGUI, self).__init__()
  42. self.app = app
  43. self.decimals = self.app.decimals
  44. # Divine icon pack by Ipapun @ finicons.com
  45. # #######################################################################
  46. # ############ BUILDING THE GUI IS EXECUTED HERE ########################
  47. # #######################################################################
  48. # #######################################################################
  49. # ###################### Menu BUILDING ##################################
  50. # #######################################################################
  51. self.menu = self.menuBar()
  52. self.menu_toggle_nb = QtWidgets.QAction(
  53. QtGui.QIcon(self.app.resource_location + '/notebook32.png'), _("Toggle Panel"))
  54. self.menu_toggle_nb.setToolTip(
  55. _("Toggle Panel")
  56. )
  57. # self.menu_toggle_nb = QtWidgets.QAction("NB")
  58. self.menu_toggle_nb.setCheckable(True)
  59. self.menu.addAction(self.menu_toggle_nb)
  60. # ########################################################################
  61. # ########################## File # ######################################
  62. # ########################################################################
  63. self.menufile = self.menu.addMenu(_('File'))
  64. self.menufile.setToolTipsVisible(True)
  65. # New Project
  66. self.menufilenewproject = QtWidgets.QAction(QtGui.QIcon(self.app.resource_location + '/file16.png'),
  67. '%s...\t%s' % (_('New Project'), _("Ctrl+N")), self)
  68. self.menufilenewproject.setToolTip(
  69. _("Will create a new, blank project")
  70. )
  71. self.menufile.addAction(self.menufilenewproject)
  72. # New Category (Excellon, Geometry)
  73. self.menufilenew = self.menufile.addMenu(QtGui.QIcon(self.app.resource_location + '/file16.png'), _('New'))
  74. self.menufilenew.setToolTipsVisible(True)
  75. self.menufilenewgeo = self.menufilenew.addAction(
  76. QtGui.QIcon(self.app.resource_location + '/new_file_geo16.png'), '%s\t%s' % (_('Geometry'), _('N')))
  77. self.menufilenewgeo.setToolTip(
  78. _("Will create a new, empty Geometry Object.")
  79. )
  80. self.menufilenewgrb = self.menufilenew.addAction(
  81. QtGui.QIcon(self.app.resource_location + '/new_file_grb16.png'), '%s\t%s' % (_('Gerber'), _('B')))
  82. self.menufilenewgrb.setToolTip(
  83. _("Will create a new, empty Gerber Object.")
  84. )
  85. self.menufilenewexc = self.menufilenew.addAction(
  86. QtGui.QIcon(self.app.resource_location + '/new_file_exc16.png'), '%s\t%s' % (_('Excellon'), _('L')))
  87. self.menufilenewexc.setToolTip(
  88. _("Will create a new, empty Excellon Object.")
  89. )
  90. self.menufilenew.addSeparator()
  91. self.menufilenewdoc = self.menufilenew.addAction(
  92. QtGui.QIcon(self.app.resource_location + '/notes16_1.png'), '%s\t%s' % (_('Document'), _('D')))
  93. self.menufilenewdoc.setToolTip(
  94. _("Will create a new, empty Document Object.")
  95. )
  96. self.menufile_open = self.menufile.addMenu(
  97. QtGui.QIcon(self.app.resource_location + '/folder32_bis.png'), '%s' % _('Open'))
  98. self.menufile_open.setToolTipsVisible(True)
  99. # Open Project ...
  100. self.menufileopenproject = QtWidgets.QAction(
  101. QtGui.QIcon(self.app.resource_location + '/folder16.png'), '%s...\t%s' % (_('Open Project'), _('Ctrl+O')),
  102. self)
  103. self.menufile_open.addAction(self.menufileopenproject)
  104. self.menufile_open.addSeparator()
  105. # Open Gerber ...
  106. self.menufileopengerber = QtWidgets.QAction(QtGui.QIcon(self.app.resource_location + '/flatcam_icon24.png'),
  107. '%s...\t%s' % (_('Open Gerber'), _('Ctrl+G')), self)
  108. self.menufile_open.addAction(self.menufileopengerber)
  109. # Open Excellon ...
  110. self.menufileopenexcellon = QtWidgets.QAction(QtGui.QIcon(self.app.resource_location + '/open_excellon32.png'),
  111. '%s...\t%s' % (_('Open Excellon'), _('Ctrl+E')), self)
  112. self.menufile_open.addAction(self.menufileopenexcellon)
  113. # Open G-Code ...
  114. self.menufileopengcode = QtWidgets.QAction(
  115. QtGui.QIcon(self.app.resource_location + '/code.png'), '%s...\t%s' % (_('Open G-Code'), ''), self)
  116. self.menufile_open.addAction(self.menufileopengcode)
  117. self.menufile_open.addSeparator()
  118. # Open Config File...
  119. self.menufileopenconfig = QtWidgets.QAction(
  120. QtGui.QIcon(self.app.resource_location + '/folder16.png'), '%s...\t%s' % (_('Open Config'), ''), self)
  121. self.menufile_open.addAction(self.menufileopenconfig)
  122. # Recent
  123. self.recent_projects = self.menufile.addMenu(
  124. QtGui.QIcon(self.app.resource_location + '/recent_files.png'), _("Recent projects"))
  125. self.recent = self.menufile.addMenu(
  126. QtGui.QIcon(self.app.resource_location + '/recent_files.png'), _("Recent files"))
  127. # SAVE category
  128. self.menufile_save = self.menufile.addMenu(QtGui.QIcon(self.app.resource_location + '/save_as.png'), _('Save'))
  129. # Save Project
  130. self.menufilesaveproject = QtWidgets.QAction(
  131. QtGui.QIcon(self.app.resource_location + '/floppy16.png'), '%s...\t%s' % (_('Save Project'), _('Ctrl+S')),
  132. self)
  133. self.menufile_save.addAction(self.menufilesaveproject)
  134. # Save Project As ...
  135. self.menufilesaveprojectas = QtWidgets.QAction(QtGui.QIcon(self.app.resource_location + '/floppy16.png'),
  136. '%s...\t%s' % (_('Save Project As'), _('Ctrl+Shift+S')), self)
  137. self.menufile_save.addAction(self.menufilesaveprojectas)
  138. # Save Project Copy ...
  139. # self.menufilesaveprojectcopy = QtWidgets.QAction(
  140. # QtGui.QIcon(self.app.resource_location + '/floppy16.png'), _('Save Project Copy ...'), self)
  141. # self.menufile_save.addAction(self.menufilesaveprojectcopy)
  142. self.menufile_save.addSeparator()
  143. # Separator
  144. self.menufile.addSeparator()
  145. # Scripting
  146. self.menufile_scripting = self.menufile.addMenu(
  147. QtGui.QIcon(self.app.resource_location + '/script16.png'), _('Scripting'))
  148. self.menufile_scripting.setToolTipsVisible(True)
  149. self.menufilenewscript = QtWidgets.QAction(QtGui.QIcon(self.app.resource_location + '/script_new16.png'),
  150. '%s...\t%s' % (_('New Script'), ''), self)
  151. self.menufileopenscript = QtWidgets.QAction(QtGui.QIcon(self.app.resource_location + '/open_script32.png'),
  152. '%s...\t%s' % (_('Open Script'), ''), self)
  153. self.menufileopenscriptexample = QtWidgets.QAction(
  154. QtGui.QIcon(self.app.resource_location + '/open_script32.png'),
  155. '%s...\t%s' % (_('Open Example'), ''), self)
  156. self.menufilerunscript = QtWidgets.QAction(
  157. QtGui.QIcon(self.app.resource_location + '/script16.png'),
  158. '%s...\t%s' % (_('Run Script'), _('Shift+S')), self)
  159. self.menufilerunscript.setToolTip(
  160. _("Will run the opened Tcl Script thus\n"
  161. "enabling the automation of certain\n"
  162. "functions of FlatCAM.")
  163. )
  164. self.menufile_scripting.addAction(self.menufilenewscript)
  165. self.menufile_scripting.addAction(self.menufileopenscript)
  166. self.menufile_scripting.addAction(self.menufileopenscriptexample)
  167. self.menufile_scripting.addSeparator()
  168. self.menufile_scripting.addAction(self.menufilerunscript)
  169. # Separator
  170. self.menufile.addSeparator()
  171. # Import ...
  172. self.menufileimport = self.menufile.addMenu(
  173. QtGui.QIcon(self.app.resource_location + '/import.png'), _('Import'))
  174. self.menufileimportsvg = QtWidgets.QAction(
  175. QtGui.QIcon(self.app.resource_location + '/svg16.png'),
  176. '%s...\t%s' % (_('SVG as Geometry Object'), ''), self)
  177. self.menufileimport.addAction(self.menufileimportsvg)
  178. self.menufileimportsvg_as_gerber = QtWidgets.QAction(
  179. QtGui.QIcon(self.app.resource_location + '/svg16.png'),
  180. '%s...\t%s' % (_('SVG as Gerber Object'), ''), self)
  181. self.menufileimport.addAction(self.menufileimportsvg_as_gerber)
  182. self.menufileimport.addSeparator()
  183. self.menufileimportdxf = QtWidgets.QAction(
  184. QtGui.QIcon(self.app.resource_location + '/dxf16.png'),
  185. '%s...\t%s' % (_('DXF as Geometry Object'), ''), self)
  186. self.menufileimport.addAction(self.menufileimportdxf)
  187. self.menufileimportdxf_as_gerber = QtWidgets.QAction(
  188. QtGui.QIcon(self.app.resource_location + '/dxf16.png'),
  189. '%s...\t%s' % (_('DXF as Gerber Object'), ''), self)
  190. self.menufileimport.addAction(self.menufileimportdxf_as_gerber)
  191. self.menufileimport.addSeparator()
  192. self.menufileimport_hpgl2_as_geo = QtWidgets.QAction(
  193. QtGui.QIcon(self.app.resource_location + '/dxf16.png'),
  194. '%s...\t%s' % (_('HPGL2 as Geometry Object'), ''), self)
  195. self.menufileimport.addAction(self.menufileimport_hpgl2_as_geo)
  196. self.menufileimport.addSeparator()
  197. # Export ...
  198. self.menufileexport = self.menufile.addMenu(
  199. QtGui.QIcon(self.app.resource_location + '/export.png'), _('Export'))
  200. self.menufileexport.setToolTipsVisible(True)
  201. self.menufileexportsvg = QtWidgets.QAction(
  202. QtGui.QIcon(self.app.resource_location + '/export.png'),
  203. '%s...\t%s' % (_('Export SVG'), ''), self)
  204. self.menufileexport.addAction(self.menufileexportsvg)
  205. self.menufileexportdxf = QtWidgets.QAction(
  206. QtGui.QIcon(self.app.resource_location + '/export.png'),
  207. '%s...\t%s' % (_('Export DXF'), ''), self)
  208. self.menufileexport.addAction(self.menufileexportdxf)
  209. self.menufileexport.addSeparator()
  210. self.menufileexportpng = QtWidgets.QAction(
  211. QtGui.QIcon(self.app.resource_location + '/export_png32.png'),
  212. '%s...\t%s' % (_('Export PNG'), ''), self)
  213. self.menufileexportpng.setToolTip(
  214. _("Will export an image in PNG format,\n"
  215. "the saved image will contain the visual \n"
  216. "information currently in FlatCAM Plot Area.")
  217. )
  218. self.menufileexport.addAction(self.menufileexportpng)
  219. self.menufileexport.addSeparator()
  220. self.menufileexportexcellon = QtWidgets.QAction(
  221. QtGui.QIcon(self.app.resource_location + '/drill32.png'),
  222. '%s...\t%s' % (_('Export Excellon'), ''), self)
  223. self.menufileexportexcellon.setToolTip(
  224. _("Will export an Excellon Object as Excellon file,\n"
  225. "the coordinates format, the file units and zeros\n"
  226. "are set in Preferences -> Excellon Export.")
  227. )
  228. self.menufileexport.addAction(self.menufileexportexcellon)
  229. self.menufileexportgerber = QtWidgets.QAction(
  230. QtGui.QIcon(self.app.resource_location + '/flatcam_icon32.png'),
  231. '%s...\t%s' % (_('Export Gerber'), ''), self)
  232. self.menufileexportgerber.setToolTip(
  233. _("Will export an Gerber Object as Gerber file,\n"
  234. "the coordinates format, the file units and zeros\n"
  235. "are set in Preferences -> Gerber Export.")
  236. )
  237. self.menufileexport.addAction(self.menufileexportgerber)
  238. # Separator
  239. self.menufile.addSeparator()
  240. self.menufile_backup = self.menufile.addMenu(
  241. QtGui.QIcon(self.app.resource_location + '/backup24.png'), _('Backup'))
  242. # Import Preferences
  243. self.menufileimportpref = QtWidgets.QAction(
  244. QtGui.QIcon(self.app.resource_location + '/backup_import24.png'),
  245. '%s...\t%s' % (_('Import Preferences from file'), ''), self
  246. )
  247. self.menufile_backup.addAction(self.menufileimportpref)
  248. # Export Preferences
  249. self.menufileexportpref = QtWidgets.QAction(
  250. QtGui.QIcon(self.app.resource_location + '/backup_export24.png'),
  251. '%s...\t%s' % (_('Export Preferences to file'), ''), self)
  252. self.menufile_backup.addAction(self.menufileexportpref)
  253. # Separator
  254. self.menufile_backup.addSeparator()
  255. # Save Defaults
  256. self.menufilesavedefaults = QtWidgets.QAction(
  257. QtGui.QIcon(self.app.resource_location + '/defaults.png'),
  258. '%s\t%s' % (_('Save Preferences'), ''), self)
  259. self.menufile_backup.addAction(self.menufilesavedefaults)
  260. # Separator
  261. self.menufile.addSeparator()
  262. self.menufile_print = QtWidgets.QAction(
  263. QtGui.QIcon(self.app.resource_location + '/printer32.png'),
  264. '%s\t%s' % (_('Print (PDF)'), _('Ctrl+P')))
  265. self.menufile.addAction(self.menufile_print)
  266. # Separator
  267. self.menufile.addSeparator()
  268. # Quit
  269. self.menufile_exit = QtWidgets.QAction(
  270. QtGui.QIcon(self.app.resource_location + '/power16.png'),
  271. '%s\t%s' % (_('Exit'), ''), self)
  272. # exitAction.setShortcut('Ctrl+Q')
  273. # exitAction.setStatusTip('Exit application')
  274. self.menufile.addAction(self.menufile_exit)
  275. # ########################################################################
  276. # ########################## Edit # ######################################
  277. # ########################################################################
  278. self.menuedit = self.menu.addMenu(_('Edit'))
  279. # Separator
  280. self.menuedit.addSeparator()
  281. self.menueditedit = self.menuedit.addAction(
  282. QtGui.QIcon(self.app.resource_location + '/edit16.png'),
  283. '%s\t%s' % (_('Edit Object'), _('E')))
  284. self.menueditok = self.menuedit.addAction(
  285. QtGui.QIcon(self.app.resource_location + '/edit_ok16.png'),
  286. '%s\t%s' % (_('Close Editor'), _('Ctrl+S')))
  287. # adjust the initial state of the menu entries related to the editor
  288. self.menueditedit.setDisabled(False)
  289. self.menueditok.setDisabled(True)
  290. # ############################ EDIT -> CONVERSION ######################################################
  291. # Separator
  292. self.menuedit.addSeparator()
  293. self.menuedit_convert = self.menuedit.addMenu(
  294. QtGui.QIcon(self.app.resource_location + '/convert24.png'), _('Conversion'))
  295. self.menuedit_convert_sg2mg = self.menuedit_convert.addAction(
  296. QtGui.QIcon(self.app.resource_location + '/convert24.png'),
  297. '%s\t%s' % (_('Convert Single to MultiGeo'), ''))
  298. self.menuedit_convert_sg2mg.setToolTip(
  299. _("Will convert a Geometry object from single_geometry type\n"
  300. "to a multi_geometry type.")
  301. )
  302. self.menuedit_convert_mg2sg = self.menuedit_convert.addAction(
  303. QtGui.QIcon(self.app.resource_location + '/convert24.png'),
  304. '%s\t%s' % (_('Convert Multi to SingleGeo'), ''))
  305. self.menuedit_convert_mg2sg.setToolTip(
  306. _("Will convert a Geometry object from multi_geometry type\n"
  307. "to a single_geometry type.")
  308. )
  309. # Separator
  310. self.menuedit_convert.addSeparator()
  311. self.menueditconvert_any2geo = self.menuedit_convert.addAction(
  312. QtGui.QIcon(self.app.resource_location + '/copy_geo.png'),
  313. '%s\t%s' % (_('Convert Any to Geo'), ''))
  314. self.menueditconvert_any2gerber = self.menuedit_convert.addAction(
  315. QtGui.QIcon(self.app.resource_location + '/copy_geo.png'),
  316. '%s\t%s' % (_('Convert Any to Gerber'), ''))
  317. self.menueditconvert_any2excellon = self.menuedit_convert.addAction(
  318. QtGui.QIcon(self.app.resource_location + '/copy_geo.png'),
  319. '%s\t%s' % (_('Convert Any to Excellon'), ''))
  320. self.menuedit_convert.setToolTipsVisible(True)
  321. # ############################ EDIT -> JOIN ######################################################
  322. self.menuedit_join = self.menuedit.addMenu(
  323. QtGui.QIcon(self.app.resource_location + '/join16.png'), _('Join Objects'))
  324. self.menuedit_join2geo = self.menuedit_join.addAction(
  325. QtGui.QIcon(self.app.resource_location + '/join16.png'),
  326. '%s\t%s' % (_('Join Geo/Gerber/Exc -> Geo'), ''))
  327. self.menuedit_join2geo.setToolTip(
  328. _("Merge a selection of objects, which can be of type:\n"
  329. "- Gerber\n"
  330. "- Excellon\n"
  331. "- Geometry\n"
  332. "into a new combo Geometry object.")
  333. )
  334. self.menuedit_join_exc2exc = self.menuedit_join.addAction(
  335. QtGui.QIcon(self.app.resource_location + '/join16.png'),
  336. '%s\t%s' % (_('Join Excellon(s) -> Excellon'), ''))
  337. self.menuedit_join_exc2exc.setToolTip(
  338. _("Merge a selection of Excellon objects into a new combo Excellon object.")
  339. )
  340. self.menuedit_join_grb2grb = self.menuedit_join.addAction(
  341. QtGui.QIcon(self.app.resource_location + '/join16.png'),
  342. '%s\t%s' % (_('Join Gerber(s) -> Gerber'), ''))
  343. self.menuedit_join_grb2grb.setToolTip(
  344. _("Merge a selection of Gerber objects into a new combo Gerber object.")
  345. )
  346. self.menuedit_join.setToolTipsVisible(True)
  347. # ############################ EDIT -> COPY ######################################################
  348. # Separator
  349. self.menuedit.addSeparator()
  350. self.menueditcopyobject = self.menuedit.addAction(
  351. QtGui.QIcon(self.app.resource_location + '/copy.png'),
  352. '%s\t%s' % (_('Copy'), _('Ctrl+C')))
  353. # Separator
  354. self.menuedit.addSeparator()
  355. self.menueditdelete = self.menuedit.addAction(
  356. QtGui.QIcon(self.app.resource_location + '/trash16.png'),
  357. '%s\t%s' % (_('Delete'), _('DEL')))
  358. # Separator
  359. self.menuedit.addSeparator()
  360. self.menueditorigin = self.menuedit.addAction(
  361. QtGui.QIcon(self.app.resource_location + '/origin16.png'),
  362. '%s\t%s' % (_('Set Origin'), _('O')))
  363. self.menuedit_move2origin = self.menuedit.addAction(
  364. QtGui.QIcon(self.app.resource_location + '/origin2_16.png'),
  365. '%s\t%s' % (_('Move to Origin'), _('Shift+O')))
  366. self.menueditjump = self.menuedit.addAction(
  367. QtGui.QIcon(self.app.resource_location + '/jump_to16.png'),
  368. '%s\t%s' % (_('Jump to Location'), _('J')))
  369. self.menueditlocate = self.menuedit.addAction(
  370. QtGui.QIcon(self.app.resource_location + '/locate16.png'),
  371. '%s\t%s' % (_('Locate in Object'), _('Shift+J')))
  372. # Separator
  373. self.menuedit.addSeparator()
  374. self.menuedittoggleunits = self.menuedit.addAction(
  375. QtGui.QIcon(self.app.resource_location + '/toggle_units16.png'),
  376. '%s\t%s' % (_('Toggle Units'), _('Q')))
  377. self.menueditselectall = self.menuedit.addAction(
  378. QtGui.QIcon(self.app.resource_location + '/select_all.png'),
  379. '%s\t%s' % (_('Select All'), _('Ctrl+A')))
  380. # Separator
  381. self.menuedit.addSeparator()
  382. self.menueditpreferences = self.menuedit.addAction(
  383. QtGui.QIcon(self.app.resource_location + '/pref.png'),
  384. '%s\t%s' % (_('Preferences'), _('Shift+P')))
  385. # ########################################################################
  386. # ########################## OPTIONS # ###################################
  387. # ########################################################################
  388. self.menuoptions = self.menu.addMenu(_('Options'))
  389. self.menuoptions_transform_rotate = self.menuoptions.addAction(
  390. QtGui.QIcon(self.app.resource_location + '/rotate.png'),
  391. '%s\t%s' % (_("Rotate Selection"), _('Shift+(R)')))
  392. # Separator
  393. self.menuoptions.addSeparator()
  394. self.menuoptions_transform_skewx = self.menuoptions.addAction(
  395. QtGui.QIcon(self.app.resource_location + '/skewX.png'),
  396. '%s\t%s' % (_("Skew on X axis"), _('Shift+X')))
  397. self.menuoptions_transform_skewy = self.menuoptions.addAction(
  398. QtGui.QIcon(self.app.resource_location + '/skewY.png'),
  399. '%s\t%s' % (_("Skew on Y axis"), _('Shift+Y')))
  400. # Separator
  401. self.menuoptions.addSeparator()
  402. self.menuoptions_transform_flipx = self.menuoptions.addAction(
  403. QtGui.QIcon(self.app.resource_location + '/flipx.png'),
  404. '%s\t%s' % (_("Flip on X axis"), _('X')))
  405. self.menuoptions_transform_flipy = self.menuoptions.addAction(
  406. QtGui.QIcon(self.app.resource_location + '/flipy.png'),
  407. '%s\t%s' % (_("Flip on Y axis"), _('Y')))
  408. # Separator
  409. self.menuoptions.addSeparator()
  410. self.menuoptions_view_source = self.menuoptions.addAction(
  411. QtGui.QIcon(self.app.resource_location + '/source32.png'),
  412. '%s\t%s' % (_("View source"), _('Alt+S')))
  413. self.menuoptions_tools_db = self.menuoptions.addAction(
  414. QtGui.QIcon(self.app.resource_location + '/database32.png'),
  415. '%s\t%s' % (_("Tools Database"), _('Ctrl+D')))
  416. # Separator
  417. self.menuoptions.addSeparator()
  418. # ########################################################################
  419. # ########################## View # ######################################
  420. # ########################################################################
  421. self.menuview = self.menu.addMenu(_('View'))
  422. self.menuviewenable = self.menuview.addAction(
  423. QtGui.QIcon(self.app.resource_location + '/replot16.png'),
  424. '%s\t%s' % (_('Enable all'), _('Alt+1')))
  425. self.menuviewdisableall = self.menuview.addAction(
  426. QtGui.QIcon(self.app.resource_location + '/clear_plot16.png'),
  427. '%s\t%s' % (_('Disable all'), _('Alt+2')))
  428. self.menuviewenableother = self.menuview.addAction(
  429. QtGui.QIcon(self.app.resource_location + '/replot16.png'),
  430. '%s\t%s' % (_('Enable non-selected'), _('Alt+3')))
  431. self.menuviewdisableother = self.menuview.addAction(
  432. QtGui.QIcon(self.app.resource_location + '/clear_plot16.png'),
  433. '%s\t%s' % (_('Disable non-selected'), _('Alt+4')))
  434. # Separator
  435. self.menuview.addSeparator()
  436. self.menuview_zoom_fit = self.menuview.addAction(
  437. QtGui.QIcon(self.app.resource_location + '/zoom_fit32.png'),
  438. '%s\t%s' % (_("Zoom Fit"), _('V')))
  439. self.menuview_zoom_in = self.menuview.addAction(
  440. QtGui.QIcon(self.app.resource_location + '/zoom_in32.png'),
  441. '%s\t%s' % (_("Zoom In"), _('=')))
  442. self.menuview_zoom_out = self.menuview.addAction(
  443. QtGui.QIcon(self.app.resource_location + '/zoom_out32.png'),
  444. '%s\t%s' % (_("Zoom Out"), _('-')))
  445. self.menuview.addSeparator()
  446. # Replot all
  447. self.menuview_replot = self.menuview.addAction(
  448. QtGui.QIcon(self.app.resource_location + '/replot32.png'),
  449. '%s\t%s' % (_("Redraw All"), _('F5')))
  450. self.menuview.addSeparator()
  451. self.menuview_toggle_code_editor = self.menuview.addAction(
  452. QtGui.QIcon(self.app.resource_location + '/code_editor32.png'),
  453. '%s\t%s' % (_('Toggle Code Editor'), _('Shift+E')))
  454. self.menuview.addSeparator()
  455. self.menuview_toggle_fscreen = self.menuview.addAction(
  456. QtGui.QIcon(self.app.resource_location + '/fscreen32.png'),
  457. '%s\t%s' % (_("Toggle FullScreen"), _('Alt+F10')))
  458. self.menuview_toggle_parea = self.menuview.addAction(
  459. QtGui.QIcon(self.app.resource_location + '/plot32.png'),
  460. '%s\t%s' % (_("Toggle Plot Area"), _('Ctrl+F10')))
  461. self.menuview_toggle_notebook = self.menuview.addAction(
  462. QtGui.QIcon(self.app.resource_location + '/notebook32.png'),
  463. '%s\t%s' % (_("Toggle Project/Properties/Tool"), _('`')))
  464. self.menuview.addSeparator()
  465. self.menuview_toggle_grid = self.menuview.addAction(
  466. QtGui.QIcon(self.app.resource_location + '/grid32.png'),
  467. '%s\t%s' % (_("Toggle Grid Snap"), _('G')))
  468. self.menuview_toggle_grid_lines = self.menuview.addAction(
  469. QtGui.QIcon(self.app.resource_location + '/grid_lines32.png'),
  470. '%s\t%s' % (_("Toggle Grid Lines"), _('Shift+G')))
  471. self.menuview_toggle_axis = self.menuview.addAction(
  472. QtGui.QIcon(self.app.resource_location + '/axis32.png'),
  473. '%s\t%s' % (_("Toggle Axis"), _('Shift+A')))
  474. self.menuview_toggle_workspace = self.menuview.addAction(
  475. QtGui.QIcon(self.app.resource_location + '/workspace24.png'),
  476. '%s\t%s' % (_("Toggle Workspace"), _('Shift+W')))
  477. self.menuview_toggle_hud = self.menuview.addAction(
  478. QtGui.QIcon(self.app.resource_location + '/hud_32.png'),
  479. '%s\t%s' % (_("Toggle HUD"), _('Shift+H')))
  480. # ########################################################################
  481. # ########################## Objects # ###################################
  482. # ########################################################################
  483. self.menuobjects = self.menu.addMenu(_('Objects'))
  484. self.menuobjects.addSeparator()
  485. self.menuobjects_selall = self.menuobjects.addAction(
  486. QtGui.QIcon(self.app.resource_location + '/select_all.png'),
  487. '%s\t%s' % (_('Select All'), ''))
  488. self.menuobjects_unselall = self.menuobjects.addAction(
  489. QtGui.QIcon(self.app.resource_location + '/deselect_all32.png'),
  490. '%s\t%s' % (_('Deselect All'), ''))
  491. # ########################################################################
  492. # ########################## Tool # ######################################
  493. # ########################################################################
  494. self.menutool = QtWidgets.QMenu(_('Tool'))
  495. self.menutoolaction = self.menu.addMenu(self.menutool)
  496. self.menutoolshell = self.menutool.addAction(
  497. QtGui.QIcon(self.app.resource_location + '/shell16.png'),
  498. '%s\t%s' % (_('Command Line'), _('S')))
  499. # ########################################################################
  500. # ########################## Help # ######################################
  501. # ########################################################################
  502. self.menuhelp = self.menu.addMenu(_('Help'))
  503. self.menuhelp_manual = self.menuhelp.addAction(
  504. QtGui.QIcon(self.app.resource_location + '/globe16.png'),
  505. '%s\t%s' % (_('Online Help'), _('F1')))
  506. self.menuhelp_bookmarks = self.menuhelp.addMenu(
  507. QtGui.QIcon(self.app.resource_location + '/bookmarks16.png'), _('Bookmarks'))
  508. self.menuhelp_bookmarks.addSeparator()
  509. self.menuhelp_bookmarks_manager = self.menuhelp_bookmarks.addAction(
  510. QtGui.QIcon(self.app.resource_location + '/bookmarks16.png'),
  511. '%s\t%s' % (_('Bookmarks Manager'), ''))
  512. self.menuhelp.addSeparator()
  513. self.menuhelp_report_bug = self.menuhelp.addAction(
  514. QtGui.QIcon(self.app.resource_location + '/bug16.png'),
  515. '%s\t%s' % (_('Report a bug'), ''))
  516. self.menuhelp.addSeparator()
  517. self.menuhelp_exc_spec = self.menuhelp.addAction(
  518. QtGui.QIcon(self.app.resource_location + '/pdf_link16.png'),
  519. '%s\t%s' % (_('Excellon Specification'), ''))
  520. self.menuhelp_gerber_spec = self.menuhelp.addAction(
  521. QtGui.QIcon(self.app.resource_location + '/pdf_link16.png'),
  522. '%s\t%s' % (_('Gerber Specification'), ''))
  523. self.menuhelp.addSeparator()
  524. self.menuhelp_shortcut_list = self.menuhelp.addAction(
  525. QtGui.QIcon(self.app.resource_location + '/shortcuts24.png'),
  526. '%s\t%s' % (_('Shortcuts List'), _('F3')))
  527. self.menuhelp_videohelp = self.menuhelp.addAction(
  528. QtGui.QIcon(self.app.resource_location + '/youtube32.png'),
  529. '%s\t%s' % (_('YouTube Channel'), _('F4')))
  530. self.menuhelp.addSeparator()
  531. self.menuhelp_readme = self.menuhelp.addAction(
  532. QtGui.QIcon(self.app.resource_location + '/warning.png'),
  533. '%s\t%s' % (_("How To"), ''))
  534. self.menuhelp_about = self.menuhelp.addAction(
  535. QtGui.QIcon(self.app.resource_location + '/about32.png'),
  536. '%s\t%s' % (_('About'), ''))
  537. # ########################################################################
  538. # ########################## GEOMETRY EDITOR # ###########################
  539. # ########################################################################
  540. self.geo_editor_menu = QtWidgets.QMenu('>%s<' % _('Geo Editor'))
  541. self.menu.addMenu(self.geo_editor_menu)
  542. self.geo_add_circle_menuitem = self.geo_editor_menu.addAction(
  543. QtGui.QIcon(self.app.resource_location + '/circle32.png'),
  544. '%s\t%s' % (_('Add Circle'), _('O'))
  545. )
  546. self.geo_add_arc_menuitem = self.geo_editor_menu.addAction(
  547. QtGui.QIcon(self.app.resource_location + '/arc16.png'),
  548. '%s\t%s' % (_('Add Arc'), _('A')))
  549. self.geo_editor_menu.addSeparator()
  550. self.geo_add_rectangle_menuitem = self.geo_editor_menu.addAction(
  551. QtGui.QIcon(self.app.resource_location + '/rectangle32.png'),
  552. '%s\t%s' % (_('Add Rectangle'), _('R'))
  553. )
  554. self.geo_add_polygon_menuitem = self.geo_editor_menu.addAction(
  555. QtGui.QIcon(self.app.resource_location + '/polygon32.png'),
  556. '%s\t%s' % (_('Add Polygon'), _('N'))
  557. )
  558. self.geo_add_path_menuitem = self.geo_editor_menu.addAction(
  559. QtGui.QIcon(self.app.resource_location + '/path32.png'),
  560. '%s\t%s' % (_('Add Path'), _('P')))
  561. self.geo_editor_menu.addSeparator()
  562. self.geo_add_text_menuitem = self.geo_editor_menu.addAction(
  563. QtGui.QIcon(self.app.resource_location + '/text32.png'),
  564. '%s\t%s' % (_('Add Text'), _('T')))
  565. self.geo_editor_menu.addSeparator()
  566. self.geo_union_menuitem = self.geo_editor_menu.addAction(
  567. QtGui.QIcon(self.app.resource_location + '/union16.png'),
  568. '%s\t%s' % (_('Polygon Union'), _('U')))
  569. self.geo_intersection_menuitem = self.geo_editor_menu.addAction(
  570. QtGui.QIcon(self.app.resource_location + '/intersection16.png'),
  571. '%s\t%s' % (_('Polygon Intersection'), _('E')))
  572. self.geo_subtract_menuitem = self.geo_editor_menu.addAction(
  573. QtGui.QIcon(self.app.resource_location + '/subtract16.png'),
  574. '%s\t%s' % (_('Polygon Subtraction'), _('S'))
  575. )
  576. self.geo_editor_menu.addSeparator()
  577. self.geo_cutpath_menuitem = self.geo_editor_menu.addAction(
  578. QtGui.QIcon(self.app.resource_location + '/cutpath16.png'),
  579. '%s\t%s' % (_('Cut Path'), _('X')))
  580. # self.move_menuitem = self.menu.addAction(
  581. # QtGui.QIcon(self.app.resource_location + '/move16.png'), "Move Objects 'm'")
  582. self.geo_copy_menuitem = self.geo_editor_menu.addAction(
  583. QtGui.QIcon(self.app.resource_location + '/copy16.png'),
  584. '%s\t%s' % (_("Copy Geom"), _('C')))
  585. self.geo_delete_menuitem = self.geo_editor_menu.addAction(
  586. QtGui.QIcon(self.app.resource_location + '/deleteshape16.png'),
  587. '%s\t%s' % (_("Delete Shape"), _('DEL'))
  588. )
  589. self.geo_editor_menu.addSeparator()
  590. self.geo_move_menuitem = self.geo_editor_menu.addAction(
  591. QtGui.QIcon(self.app.resource_location + '/move32.png'),
  592. '%s\t%s' % (_("Move"), _('M')))
  593. self.geo_buffer_menuitem = self.geo_editor_menu.addAction(
  594. QtGui.QIcon(self.app.resource_location + '/buffer16.png'),
  595. '%s\t%s' % (_("Buffer Tool"), _('B'))
  596. )
  597. self.geo_paint_menuitem = self.geo_editor_menu.addAction(
  598. QtGui.QIcon(self.app.resource_location + '/paint16.png'),
  599. '%s\t%s' % (_("Paint Tool"), _('I'))
  600. )
  601. self.geo_transform_menuitem = self.geo_editor_menu.addAction(
  602. QtGui.QIcon(self.app.resource_location + '/transform.png'),
  603. '%s\t%s' % (_("Transform Tool"), _('Alt+R'))
  604. )
  605. self.geo_editor_menu.addSeparator()
  606. self.geo_cornersnap_menuitem = self.geo_editor_menu.addAction(
  607. QtGui.QIcon(self.app.resource_location + '/corner32.png'),
  608. '%s\t%s' % (_("Toggle Corner Snap"), _('K'))
  609. )
  610. # ########################################################################
  611. # ########################## EXCELLON Editor # ###########################
  612. # ########################################################################
  613. self.exc_editor_menu = QtWidgets.QMenu('>%s<' % _('Excellon Editor'))
  614. self.menu.addMenu(self.exc_editor_menu)
  615. self.exc_add_array_drill_menuitem = self.exc_editor_menu.addAction(
  616. QtGui.QIcon(self.app.resource_location + '/rectangle32.png'),
  617. '%s\t%s' % (_('Add Drill Array'), _('A')))
  618. self.exc_add_drill_menuitem = self.exc_editor_menu.addAction(
  619. QtGui.QIcon(self.app.resource_location + '/plus16.png'),
  620. '%s\t%s' % (_('Add Drill'), _('D')))
  621. self.exc_editor_menu.addSeparator()
  622. self.exc_add_array_slot_menuitem = self.exc_editor_menu.addAction(
  623. QtGui.QIcon(self.app.resource_location + '/slot_array26.png'),
  624. '%s\t%s' % (_('Add Slot Array'), _('Q')))
  625. self.exc_add_slot_menuitem = self.exc_editor_menu.addAction(
  626. QtGui.QIcon(self.app.resource_location + '/slot26.png'),
  627. '%s\t%s' % (_('Add Slot'), _('W')))
  628. self.exc_editor_menu.addSeparator()
  629. self.exc_resize_drill_menuitem = self.exc_editor_menu.addAction(
  630. QtGui.QIcon(self.app.resource_location + '/resize16.png'),
  631. '%s\t%s' % (_('Resize Drill(S)'), _('R'))
  632. )
  633. self.exc_copy_drill_menuitem = self.exc_editor_menu.addAction(
  634. QtGui.QIcon(self.app.resource_location + '/copy32.png'),
  635. '%s\t%s' % (_('Copy'), _('C')))
  636. self.exc_delete_drill_menuitem = self.exc_editor_menu.addAction(
  637. QtGui.QIcon(self.app.resource_location + '/deleteshape32.png'),
  638. '%s\t%s' % (_('Delete'), _('DEL'))
  639. )
  640. self.exc_editor_menu.addSeparator()
  641. self.exc_move_drill_menuitem = self.exc_editor_menu.addAction(
  642. QtGui.QIcon(self.app.resource_location + '/move32.png'),
  643. '%s\t%s' % (_('Move Drill(s)'), _('M')))
  644. # ########################################################################
  645. # ########################## GERBER Editor # #############################
  646. # ########################################################################
  647. self.grb_editor_menu = QtWidgets.QMenu('>%s<' % _('Gerber Editor'))
  648. self.menu.addMenu(self.grb_editor_menu)
  649. self.grb_add_pad_menuitem = self.grb_editor_menu.addAction(
  650. QtGui.QIcon(self.app.resource_location + '/aperture16.png'),
  651. '%s\t%s' % (_('Add Pad'), _('P')))
  652. self.grb_add_pad_array_menuitem = self.grb_editor_menu.addAction(
  653. QtGui.QIcon(self.app.resource_location + '/padarray32.png'),
  654. '%s\t%s' % (_('Add Pad Array'), _('A')))
  655. self.grb_add_track_menuitem = self.grb_editor_menu.addAction(
  656. QtGui.QIcon(self.app.resource_location + '/track32.png'),
  657. '%s\t%s' % (_('Add Track'), _('T')))
  658. self.grb_add_region_menuitem = self.grb_editor_menu.addAction(
  659. QtGui.QIcon(self.app.resource_location + '/rectangle32.png'),
  660. '%s\t%s' % (_('Add Region'), _('N')))
  661. self.grb_editor_menu.addSeparator()
  662. self.grb_convert_poly_menuitem = self.grb_editor_menu.addAction(
  663. QtGui.QIcon(self.app.resource_location + '/poligonize32.png'),
  664. '%s\t%s' % (_("Poligonize"), _('Alt+N')))
  665. self.grb_add_semidisc_menuitem = self.grb_editor_menu.addAction(
  666. QtGui.QIcon(self.app.resource_location + '/semidisc32.png'),
  667. '%s\t%s' % (_("Add SemiDisc"), _('E')))
  668. self.grb_add_disc_menuitem = self.grb_editor_menu.addAction(
  669. QtGui.QIcon(self.app.resource_location + '/disc32.png'),
  670. '%s\t%s' % (_("Add Disc"), _('D')))
  671. self.grb_add_buffer_menuitem = self.grb_editor_menu.addAction(
  672. QtGui.QIcon(self.app.resource_location + '/buffer16-2.png'),
  673. '%s\t%s' % (_('Buffer'), _('B')))
  674. self.grb_add_scale_menuitem = self.grb_editor_menu.addAction(
  675. QtGui.QIcon(self.app.resource_location + '/scale32.png'),
  676. '%s\t%s' % (_('Scale'), _('S')))
  677. self.grb_add_markarea_menuitem = self.grb_editor_menu.addAction(
  678. QtGui.QIcon(self.app.resource_location + '/markarea32.png'),
  679. '%s\t%s' % (_('Mark Area'), _('Alt+A')))
  680. self.grb_add_eraser_menuitem = self.grb_editor_menu.addAction(
  681. QtGui.QIcon(self.app.resource_location + '/eraser26.png'),
  682. '%s\t%s' % (_('Eraser'), _('Ctrl+E')))
  683. self.grb_transform_menuitem = self.grb_editor_menu.addAction(
  684. QtGui.QIcon(self.app.resource_location + '/transform.png'),
  685. '%s\t%s' % (_("Transform"), _('Alt+R')))
  686. self.grb_editor_menu.addSeparator()
  687. self.grb_copy_menuitem = self.grb_editor_menu.addAction(
  688. QtGui.QIcon(self.app.resource_location + '/copy32.png'),
  689. '%s\t%s' % (_('Copy'), _('C')))
  690. self.grb_delete_menuitem = self.grb_editor_menu.addAction(
  691. QtGui.QIcon(self.app.resource_location + '/deleteshape32.png'),
  692. '%s\t%s' % (_('Delete'), _('DEL')))
  693. self.grb_editor_menu.addSeparator()
  694. self.grb_move_menuitem = self.grb_editor_menu.addAction(
  695. QtGui.QIcon(self.app.resource_location + '/move32.png'),
  696. '%s\t%s' % (_('Move'), _('M')))
  697. self.grb_editor_menu.menuAction().setVisible(False)
  698. self.grb_editor_menu.setDisabled(True)
  699. self.geo_editor_menu.menuAction().setVisible(False)
  700. self.geo_editor_menu.setDisabled(True)
  701. self.exc_editor_menu.menuAction().setVisible(False)
  702. self.exc_editor_menu.setDisabled(True)
  703. # ########################################################################
  704. # ########################## Project Tab Context Menu # ##################
  705. # ########################################################################
  706. self.menuproject = QtWidgets.QMenu()
  707. self.menuprojectenable = self.menuproject.addAction(
  708. QtGui.QIcon(self.app.resource_location + '/replot32.png'), _('Enable Plot'))
  709. self.menuprojectdisable = self.menuproject.addAction(
  710. QtGui.QIcon(self.app.resource_location + '/clear_plot32.png'), _('Disable Plot'))
  711. self.menuproject.addSeparator()
  712. self.menuprojectcolor = self.menuproject.addMenu(
  713. QtGui.QIcon(self.app.resource_location + '/set_color32.png'), _('Set Color'))
  714. self.menuproject_red = self.menuprojectcolor.addAction(
  715. QtGui.QIcon(self.app.resource_location + '/red32.png'), _('Red'))
  716. self.menuproject_blue = self.menuprojectcolor.addAction(
  717. QtGui.QIcon(self.app.resource_location + '/blue32.png'), _('Blue'))
  718. self.menuproject_yellow = self.menuprojectcolor.addAction(
  719. QtGui.QIcon(self.app.resource_location + '/yellow32.png'), _('Yellow'))
  720. self.menuproject_green = self.menuprojectcolor.addAction(
  721. QtGui.QIcon(self.app.resource_location + '/green32.png'), _('Green'))
  722. self.menuproject_purple = self.menuprojectcolor.addAction(
  723. QtGui.QIcon(self.app.resource_location + '/violet32.png'), _('Purple'))
  724. self.menuproject_brown = self.menuprojectcolor.addAction(
  725. QtGui.QIcon(self.app.resource_location + '/brown32.png'), _('Brown'))
  726. self.menuproject_brown = self.menuprojectcolor.addAction(
  727. QtGui.QIcon(self.app.resource_location + '/white32.png'), _('White'))
  728. self.menuproject_brown = self.menuprojectcolor.addAction(
  729. QtGui.QIcon(self.app.resource_location + '/black32.png'), _('Black'))
  730. self.menuprojectcolor.addSeparator()
  731. self.menuproject_custom = self.menuprojectcolor.addAction(
  732. QtGui.QIcon(self.app.resource_location + '/set_color32.png'), _('Custom'))
  733. self.menuprojectcolor.addSeparator()
  734. self.menuproject_custom = self.menuprojectcolor.addAction(
  735. QtGui.QIcon(self.app.resource_location + '/set_color32.png'), _('Opacity'))
  736. self.menuproject_custom = self.menuprojectcolor.addAction(
  737. QtGui.QIcon(self.app.resource_location + '/set_color32.png'), _('Default'))
  738. self.menuproject.addSeparator()
  739. self.menuprojectgeneratecnc = self.menuproject.addAction(
  740. QtGui.QIcon(self.app.resource_location + '/cnc32.png'), _('Generate CNC'))
  741. self.menuprojectviewsource = self.menuproject.addAction(
  742. QtGui.QIcon(self.app.resource_location + '/source32.png'), _('View Source'))
  743. self.menuprojectedit = self.menuproject.addAction(
  744. QtGui.QIcon(self.app.resource_location + '/edit_ok32.png'), _('Edit'))
  745. self.menuprojectcopy = self.menuproject.addAction(
  746. QtGui.QIcon(self.app.resource_location + '/copy32.png'), _('Copy'))
  747. self.menuprojectdelete = self.menuproject.addAction(
  748. QtGui.QIcon(self.app.resource_location + '/delete32.png'), _('Delete'))
  749. self.menuprojectsave = self.menuproject.addAction(
  750. QtGui.QIcon(self.app.resource_location + '/save_as.png'), _('Save'))
  751. self.menuproject.addSeparator()
  752. self.menuprojectproperties = self.menuproject.addAction(
  753. QtGui.QIcon(self.app.resource_location + '/properties32.png'), _('Properties'))
  754. # ########################################################################
  755. # ####################### Central Widget -> Splitter # ##################
  756. # ########################################################################
  757. # IMPORTANT #
  758. # The order: SPLITTER -> NOTEBOOK -> SNAP TOOLBAR is important and without it the GUI will not be initialized as
  759. # desired.
  760. self.splitter = QtWidgets.QSplitter()
  761. self.setCentralWidget(self.splitter)
  762. # self.notebook = QtWidgets.QTabWidget()
  763. self.notebook = FCDetachableTab(protect=True, parent=self)
  764. self.notebook.setTabsClosable(False)
  765. self.notebook.useOldIndex(True)
  766. self.splitter.addWidget(self.notebook)
  767. self.splitter_left = QtWidgets.QSplitter(Qt.Vertical)
  768. self.splitter.addWidget(self.splitter_left)
  769. self.splitter_left.addWidget(self.notebook)
  770. self.splitter_left.setHandleWidth(0)
  771. # ########################################################################
  772. # ########################## ToolBAR # ###################################
  773. # ########################################################################
  774. # ## TOOLBAR INSTALLATION ###
  775. self.toolbarfile = QtWidgets.QToolBar(_('File Toolbar'))
  776. self.toolbarfile.setObjectName('File_TB')
  777. self.addToolBar(self.toolbarfile)
  778. self.toolbaredit = QtWidgets.QToolBar(_('Edit Toolbar'))
  779. self.toolbaredit.setObjectName('Edit_TB')
  780. self.addToolBar(self.toolbaredit)
  781. self.toolbarview = QtWidgets.QToolBar(_('View Toolbar'))
  782. self.toolbarview.setObjectName('View_TB')
  783. self.addToolBar(self.toolbarview)
  784. self.toolbarshell = QtWidgets.QToolBar(_('Shell Toolbar'))
  785. self.toolbarshell.setObjectName('Shell_TB')
  786. self.addToolBar(self.toolbarshell)
  787. self.toolbartools = QtWidgets.QToolBar(_('Tools Toolbar'))
  788. self.toolbartools.setObjectName('Tools_TB')
  789. self.addToolBar(self.toolbartools)
  790. self.exc_edit_toolbar = QtWidgets.QToolBar(_('Excellon Editor Toolbar'))
  791. self.exc_edit_toolbar.setObjectName('ExcEditor_TB')
  792. self.addToolBar(self.exc_edit_toolbar)
  793. self.addToolBarBreak()
  794. self.geo_edit_toolbar = QtWidgets.QToolBar(_('Geometry Editor Toolbar'))
  795. self.geo_edit_toolbar.setObjectName('GeoEditor_TB')
  796. self.addToolBar(self.geo_edit_toolbar)
  797. self.grb_edit_toolbar = QtWidgets.QToolBar(_('Gerber Editor Toolbar'))
  798. self.grb_edit_toolbar.setObjectName('GrbEditor_TB')
  799. self.addToolBar(self.grb_edit_toolbar)
  800. # ### INFOBAR TOOLBARS ###################################################
  801. self.delta_coords_toolbar = QtWidgets.QToolBar(_('Delta Coordinates Toolbar'))
  802. self.delta_coords_toolbar.setObjectName('Delta_Coords_TB')
  803. self.coords_toolbar = QtWidgets.QToolBar(_('Coordinates Toolbar'))
  804. self.coords_toolbar.setObjectName('Coords_TB')
  805. self.grid_toolbar = QtWidgets.QToolBar(_('Grid Toolbar'))
  806. self.grid_toolbar.setObjectName('Snap_TB')
  807. self.grid_toolbar.setStyleSheet(
  808. """
  809. QToolBar { padding: 0; }
  810. QToolBar QToolButton { padding: -2; margin: -2; }
  811. """
  812. )
  813. self.status_toolbar = QtWidgets.QToolBar(_('Status Toolbar'))
  814. self.status_toolbar.setStyleSheet(
  815. """
  816. QToolBar { padding: 0; }
  817. QToolBar QToolButton { padding: -2; margin: -2; }
  818. """
  819. )
  820. # ########################################################################
  821. # ########################## File Toolbar# ###############################
  822. # ########################################################################
  823. self.file_open_gerber_btn = self.toolbarfile.addAction(
  824. QtGui.QIcon(self.app.resource_location + '/flatcam_icon32.png'), _("Open Gerber"))
  825. self.file_open_excellon_btn = self.toolbarfile.addAction(
  826. QtGui.QIcon(self.app.resource_location + '/drill32.png'), _("Open Excellon"))
  827. self.toolbarfile.addSeparator()
  828. self.file_open_btn = self.toolbarfile.addAction(
  829. QtGui.QIcon(self.app.resource_location + '/folder32.png'), _("Open project"))
  830. self.file_save_btn = self.toolbarfile.addAction(
  831. QtGui.QIcon(self.app.resource_location + '/project_save32.png'), _("Save project"))
  832. # ########################################################################
  833. # ########################## Edit Toolbar# ###############################
  834. # ########################################################################
  835. self.editgeo_btn = self.toolbaredit.addAction(
  836. QtGui.QIcon(self.app.resource_location + '/edit_file32.png'), _("Editor"))
  837. self.update_obj_btn = self.toolbaredit.addAction(
  838. QtGui.QIcon(self.app.resource_location + '/close_edit_file32.png'), _("Save Object and close the Editor")
  839. )
  840. self.toolbaredit.addSeparator()
  841. self.copy_btn = self.toolbaredit.addAction(
  842. QtGui.QIcon(self.app.resource_location + '/copy_file32.png'), _("Copy"))
  843. self.delete_btn = self.toolbaredit.addAction(
  844. QtGui.QIcon(self.app.resource_location + '/trash32.png'), _("Delete"))
  845. self.toolbaredit.addSeparator()
  846. self.distance_btn = self.toolbaredit.addAction(
  847. QtGui.QIcon(self.app.resource_location + '/distance32.png'), _("Distance Tool"))
  848. self.distance_min_btn = self.toolbaredit.addAction(
  849. QtGui.QIcon(self.app.resource_location + '/distance_min32.png'), _("Distance Min Tool"))
  850. self.origin_btn = self.toolbaredit.addAction(
  851. QtGui.QIcon(self.app.resource_location + '/origin32.png'), _('Set Origin'))
  852. self.move2origin_btn = self.toolbaredit.addAction(
  853. QtGui.QIcon(self.app.resource_location + '/origin2_32.png'), _('Move to Origin'))
  854. self.jmp_btn = self.toolbaredit.addAction(
  855. QtGui.QIcon(self.app.resource_location + '/jump_to16.png'), _('Jump to Location'))
  856. self.locate_btn = self.toolbaredit.addAction(
  857. QtGui.QIcon(self.app.resource_location + '/locate32.png'), _('Locate in Object'))
  858. # ########################################################################
  859. # ########################## View Toolbar# ###############################
  860. # ########################################################################
  861. self.replot_btn = self.toolbarview.addAction(
  862. QtGui.QIcon(self.app.resource_location + '/replot32.png'), _("Replot"))
  863. self.clear_plot_btn = self.toolbarview.addAction(
  864. QtGui.QIcon(self.app.resource_location + '/clear_plot32.png'), _("Clear plot"))
  865. self.zoom_in_btn = self.toolbarview.addAction(
  866. QtGui.QIcon(self.app.resource_location + '/zoom_in32.png'), _("Zoom In"))
  867. self.zoom_out_btn = self.toolbarview.addAction(
  868. QtGui.QIcon(self.app.resource_location + '/zoom_out32.png'), _("Zoom Out"))
  869. self.zoom_fit_btn = self.toolbarview.addAction(
  870. QtGui.QIcon(self.app.resource_location + '/zoom_fit32.png'), _("Zoom Fit"))
  871. # self.toolbarview.setVisible(False)
  872. # ########################################################################
  873. # ########################## Shell Toolbar# ##############################
  874. # ########################################################################
  875. self.shell_btn = self.toolbarshell.addAction(
  876. QtGui.QIcon(self.app.resource_location + '/shell32.png'), _("Command Line"))
  877. self.new_script_btn = self.toolbarshell.addAction(
  878. QtGui.QIcon(self.app.resource_location + '/script_new24.png'), _('New Script ...'))
  879. self.open_script_btn = self.toolbarshell.addAction(
  880. QtGui.QIcon(self.app.resource_location + '/open_script32.png'), _('Open Script ...'))
  881. self.run_script_btn = self.toolbarshell.addAction(
  882. QtGui.QIcon(self.app.resource_location + '/script16.png'), _('Run Script ...'))
  883. # ########################################################################
  884. # ########################## Tools Toolbar# ##############################
  885. # ########################################################################
  886. self.dblsided_btn = self.toolbartools.addAction(
  887. QtGui.QIcon(self.app.resource_location + '/doubleside32.png'), _("2Sided Tool"))
  888. self.align_btn = self.toolbartools.addAction(
  889. QtGui.QIcon(self.app.resource_location + '/align32.png'), _("Align Objects Tool"))
  890. self.extract_btn = self.toolbartools.addAction(
  891. QtGui.QIcon(self.app.resource_location + '/extract_drill32.png'), _("Extract Drills Tool"))
  892. self.cutout_btn = self.toolbartools.addAction(
  893. QtGui.QIcon(self.app.resource_location + '/cut16_bis.png'), _("Cutout Tool"))
  894. self.ncc_btn = self.toolbartools.addAction(
  895. QtGui.QIcon(self.app.resource_location + '/ncc16.png'), _("NCC Tool"))
  896. self.paint_btn = self.toolbartools.addAction(
  897. QtGui.QIcon(self.app.resource_location + '/paint20_1.png'), _("Paint Tool"))
  898. self.isolation_btn = self.toolbartools.addAction(
  899. QtGui.QIcon(self.app.resource_location + '/iso_16.png'), _("Isolation Tool"))
  900. self.drill_btn = self.toolbartools.addAction(
  901. QtGui.QIcon(self.app.resource_location + '/drilling_tool32.png'), _("Drilling Tool"))
  902. self.toolbartools.addSeparator()
  903. self.panelize_btn = self.toolbartools.addAction(
  904. QtGui.QIcon(self.app.resource_location + '/panelize32.png'), _("Panel Tool"))
  905. self.film_btn = self.toolbartools.addAction(
  906. QtGui.QIcon(self.app.resource_location + '/film16.png'), _("Film Tool"))
  907. self.solder_btn = self.toolbartools.addAction(
  908. QtGui.QIcon(self.app.resource_location + '/solderpastebis32.png'), _("SolderPaste Tool"))
  909. self.sub_btn = self.toolbartools.addAction(
  910. QtGui.QIcon(self.app.resource_location + '/sub32.png'), _("Subtract Tool"))
  911. self.rules_btn = self.toolbartools.addAction(
  912. QtGui.QIcon(self.app.resource_location + '/rules32.png'), _("Rules Tool"))
  913. self.optimal_btn = self.toolbartools.addAction(
  914. QtGui.QIcon(self.app.resource_location + '/open_excellon32.png'), _("Optimal Tool"))
  915. self.toolbartools.addSeparator()
  916. self.calculators_btn = self.toolbartools.addAction(
  917. QtGui.QIcon(self.app.resource_location + '/calculator24.png'), _("Calculators Tool"))
  918. self.transform_btn = self.toolbartools.addAction(
  919. QtGui.QIcon(self.app.resource_location + '/transform.png'), _("Transform Tool"))
  920. self.qrcode_btn = self.toolbartools.addAction(
  921. QtGui.QIcon(self.app.resource_location + '/qrcode32.png'), _("QRCode Tool"))
  922. self.copperfill_btn = self.toolbartools.addAction(
  923. QtGui.QIcon(self.app.resource_location + '/copperfill32.png'), _("Copper Thieving Tool"))
  924. self.fiducials_btn = self.toolbartools.addAction(
  925. QtGui.QIcon(self.app.resource_location + '/fiducials_32.png'), _("Fiducials Tool"))
  926. self.cal_btn = self.toolbartools.addAction(
  927. QtGui.QIcon(self.app.resource_location + '/calibrate_32.png'), _("Calibration Tool"))
  928. self.punch_btn = self.toolbartools.addAction(
  929. QtGui.QIcon(self.app.resource_location + '/punch32.png'), _("Punch Gerber Tool"))
  930. self.invert_btn = self.toolbartools.addAction(
  931. QtGui.QIcon(self.app.resource_location + '/invert32.png'), _("Invert Gerber Tool"))
  932. self.corners_tool_btn = self.toolbartools.addAction(
  933. QtGui.QIcon(self.app.resource_location + '/corners_32.png'), _("Corner Markers Tool"))
  934. self.etch_btn = self.toolbartools.addAction(
  935. QtGui.QIcon(self.app.resource_location + '/etch_32.png'), _("Etch Compensation Tool"))
  936. # ########################################################################
  937. # ########################## Excellon Editor Toolbar# ####################
  938. # ########################################################################
  939. self.select_drill_btn = self.exc_edit_toolbar.addAction(
  940. QtGui.QIcon(self.app.resource_location + '/pointer32.png'), _("Select"))
  941. self.add_drill_btn = self.exc_edit_toolbar.addAction(
  942. QtGui.QIcon(self.app.resource_location + '/plus16.png'), _('Add Drill Hole'))
  943. self.add_drill_array_btn = self.exc_edit_toolbar.addAction(
  944. QtGui.QIcon(self.app.resource_location + '/addarray16.png'), _('Add Drill Hole Array'))
  945. self.add_slot_btn = self.exc_edit_toolbar.addAction(
  946. QtGui.QIcon(self.app.resource_location + '/slot26.png'), _('Add Slot'))
  947. self.add_slot_array_btn = self.exc_edit_toolbar.addAction(
  948. QtGui.QIcon(self.app.resource_location + '/slot_array26.png'), _('Add Slot Array'))
  949. self.resize_drill_btn = self.exc_edit_toolbar.addAction(
  950. QtGui.QIcon(self.app.resource_location + '/resize16.png'), _('Resize Drill'))
  951. self.exc_edit_toolbar.addSeparator()
  952. self.copy_drill_btn = self.exc_edit_toolbar.addAction(
  953. QtGui.QIcon(self.app.resource_location + '/copy32.png'), _('Copy Drill'))
  954. self.delete_drill_btn = self.exc_edit_toolbar.addAction(
  955. QtGui.QIcon(self.app.resource_location + '/trash32.png'), _("Delete Drill"))
  956. self.exc_edit_toolbar.addSeparator()
  957. self.move_drill_btn = self.exc_edit_toolbar.addAction(
  958. QtGui.QIcon(self.app.resource_location + '/move32.png'), _("Move Drill"))
  959. # ########################################################################
  960. # ########################## Geometry Editor Toolbar# ####################
  961. # ########################################################################
  962. self.geo_select_btn = self.geo_edit_toolbar.addAction(
  963. QtGui.QIcon(self.app.resource_location + '/pointer32.png'), _("Select"))
  964. self.geo_add_circle_btn = self.geo_edit_toolbar.addAction(
  965. QtGui.QIcon(self.app.resource_location + '/circle32.png'), _('Add Circle'))
  966. self.geo_add_arc_btn = self.geo_edit_toolbar.addAction(
  967. QtGui.QIcon(self.app.resource_location + '/arc32.png'), _('Add Arc'))
  968. self.geo_add_rectangle_btn = self.geo_edit_toolbar.addAction(
  969. QtGui.QIcon(self.app.resource_location + '/rectangle32.png'), _('Add Rectangle'))
  970. self.geo_edit_toolbar.addSeparator()
  971. self.geo_add_path_btn = self.geo_edit_toolbar.addAction(
  972. QtGui.QIcon(self.app.resource_location + '/path32.png'), _('Add Path'))
  973. self.geo_add_polygon_btn = self.geo_edit_toolbar.addAction(
  974. QtGui.QIcon(self.app.resource_location + '/polygon32.png'), _('Add Polygon'))
  975. self.geo_edit_toolbar.addSeparator()
  976. self.geo_add_text_btn = self.geo_edit_toolbar.addAction(
  977. QtGui.QIcon(self.app.resource_location + '/text32.png'), _('Add Text'))
  978. self.geo_add_buffer_btn = self.geo_edit_toolbar.addAction(
  979. QtGui.QIcon(self.app.resource_location + '/buffer16-2.png'), _('Add Buffer'))
  980. self.geo_add_paint_btn = self.geo_edit_toolbar.addAction(
  981. QtGui.QIcon(self.app.resource_location + '/paint20_1.png'), _('Paint Shape'))
  982. self.geo_eraser_btn = self.geo_edit_toolbar.addAction(
  983. QtGui.QIcon(self.app.resource_location + '/eraser26.png'), _('Eraser'))
  984. self.geo_edit_toolbar.addSeparator()
  985. self.geo_union_btn = self.geo_edit_toolbar.addAction(
  986. QtGui.QIcon(self.app.resource_location + '/union32.png'), _('Polygon Union'))
  987. self.geo_explode_btn = self.geo_edit_toolbar.addAction(
  988. QtGui.QIcon(self.app.resource_location + '/explode32.png'), _('Polygon Explode'))
  989. self.geo_intersection_btn = self.geo_edit_toolbar.addAction(
  990. QtGui.QIcon(self.app.resource_location + '/intersection32.png'), _('Polygon Intersection'))
  991. self.geo_subtract_btn = self.geo_edit_toolbar.addAction(
  992. QtGui.QIcon(self.app.resource_location + '/subtract32.png'), _('Polygon Subtraction'))
  993. self.geo_edit_toolbar.addSeparator()
  994. self.geo_cutpath_btn = self.geo_edit_toolbar.addAction(
  995. QtGui.QIcon(self.app.resource_location + '/cutpath32.png'), _('Cut Path'))
  996. self.geo_copy_btn = self.geo_edit_toolbar.addAction(
  997. QtGui.QIcon(self.app.resource_location + '/copy32.png'), _("Copy Shape(s)"))
  998. self.geo_delete_btn = self.geo_edit_toolbar.addAction(
  999. QtGui.QIcon(self.app.resource_location + '/trash32.png'), _("Delete Shape '-'"))
  1000. self.geo_transform_btn = self.geo_edit_toolbar.addAction(
  1001. QtGui.QIcon(self.app.resource_location + '/transform.png'), _("Transformations"))
  1002. self.geo_edit_toolbar.addSeparator()
  1003. self.geo_move_btn = self.geo_edit_toolbar.addAction(
  1004. QtGui.QIcon(self.app.resource_location + '/move32.png'), _("Move Objects "))
  1005. # ########################################################################
  1006. # ########################## Gerber Editor Toolbar# ######################
  1007. # ########################################################################
  1008. self.grb_select_btn = self.grb_edit_toolbar.addAction(
  1009. QtGui.QIcon(self.app.resource_location + '/pointer32.png'), _("Select"))
  1010. self.grb_add_pad_btn = self.grb_edit_toolbar.addAction(
  1011. QtGui.QIcon(self.app.resource_location + '/aperture32.png'), _("Add Pad"))
  1012. self.add_pad_ar_btn = self.grb_edit_toolbar.addAction(
  1013. QtGui.QIcon(self.app.resource_location + '/padarray32.png'), _('Add Pad Array'))
  1014. self.grb_add_track_btn = self.grb_edit_toolbar.addAction(
  1015. QtGui.QIcon(self.app.resource_location + '/track32.png'), _("Add Track"))
  1016. self.grb_add_region_btn = self.grb_edit_toolbar.addAction(
  1017. QtGui.QIcon(self.app.resource_location + '/polygon32.png'), _("Add Region"))
  1018. self.grb_convert_poly_btn = self.grb_edit_toolbar.addAction(
  1019. QtGui.QIcon(self.app.resource_location + '/poligonize32.png'), _("Poligonize"))
  1020. self.grb_add_semidisc_btn = self.grb_edit_toolbar.addAction(
  1021. QtGui.QIcon(self.app.resource_location + '/semidisc32.png'), _("SemiDisc"))
  1022. self.grb_add_disc_btn = self.grb_edit_toolbar.addAction(
  1023. QtGui.QIcon(self.app.resource_location + '/disc32.png'), _("Disc"))
  1024. self.grb_edit_toolbar.addSeparator()
  1025. self.aperture_buffer_btn = self.grb_edit_toolbar.addAction(
  1026. QtGui.QIcon(self.app.resource_location + '/buffer16-2.png'), _('Buffer'))
  1027. self.aperture_scale_btn = self.grb_edit_toolbar.addAction(
  1028. QtGui.QIcon(self.app.resource_location + '/scale32.png'), _('Scale'))
  1029. self.aperture_markarea_btn = self.grb_edit_toolbar.addAction(
  1030. QtGui.QIcon(self.app.resource_location + '/markarea32.png'), _('Mark Area'))
  1031. self.aperture_eraser_btn = self.grb_edit_toolbar.addAction(
  1032. QtGui.QIcon(self.app.resource_location + '/eraser26.png'), _('Eraser'))
  1033. self.grb_edit_toolbar.addSeparator()
  1034. self.aperture_copy_btn = self.grb_edit_toolbar.addAction(
  1035. QtGui.QIcon(self.app.resource_location + '/copy32.png'), _("Copy"))
  1036. self.aperture_delete_btn = self.grb_edit_toolbar.addAction(
  1037. QtGui.QIcon(self.app.resource_location + '/trash32.png'), _("Delete"))
  1038. self.grb_transform_btn = self.grb_edit_toolbar.addAction(
  1039. QtGui.QIcon(self.app.resource_location + '/transform.png'), _("Transformations"))
  1040. self.grb_edit_toolbar.addSeparator()
  1041. self.aperture_move_btn = self.grb_edit_toolbar.addAction(
  1042. QtGui.QIcon(self.app.resource_location + '/move32.png'), _("Move"))
  1043. # ########################################################################
  1044. # ########################## GRID Toolbar# ###############################
  1045. # ########################################################################
  1046. # Snap GRID toolbar is always active to facilitate usage of measurements done on GRID
  1047. self.grid_snap_btn = self.grid_toolbar.addAction(
  1048. QtGui.QIcon(self.app.resource_location + '/grid32.png'), _('Snap to grid'))
  1049. self.grid_gap_x_entry = FCEntry2()
  1050. self.grid_gap_x_entry.setMaximumWidth(70)
  1051. self.grid_gap_x_entry.setToolTip(_("Grid X snapping distance"))
  1052. self.grid_toolbar.addWidget(self.grid_gap_x_entry)
  1053. self.grid_toolbar.addWidget(QtWidgets.QLabel(" "))
  1054. self.grid_gap_link_cb = FCCheckBox()
  1055. self.grid_gap_link_cb.setToolTip(_("When active, value on Grid_X\n"
  1056. "is copied to the Grid_Y value."))
  1057. self.grid_toolbar.addWidget(self.grid_gap_link_cb)
  1058. self.grid_toolbar.addWidget(QtWidgets.QLabel(" "))
  1059. self.grid_gap_y_entry = FCEntry2()
  1060. self.grid_gap_y_entry.setMaximumWidth(70)
  1061. self.grid_gap_y_entry.setToolTip(_("Grid Y snapping distance"))
  1062. self.grid_toolbar.addWidget(self.grid_gap_y_entry)
  1063. self.grid_toolbar.addWidget(QtWidgets.QLabel(" "))
  1064. self.ois_grid = OptionalInputSection(self.grid_gap_link_cb, [self.grid_gap_y_entry], logic=False)
  1065. self.corner_snap_btn = self.grid_toolbar.addAction(
  1066. QtGui.QIcon(self.app.resource_location + '/corner32.png'), _('Snap to corner'))
  1067. self.snap_max_dist_entry = FCEntry()
  1068. self.snap_max_dist_entry.setMaximumWidth(70)
  1069. self.snap_max_dist_entry.setToolTip(_("Max. magnet distance"))
  1070. self.snap_magnet = self.grid_toolbar.addWidget(self.snap_max_dist_entry)
  1071. self.corner_snap_btn.setVisible(False)
  1072. self.snap_magnet.setVisible(False)
  1073. # ########################################################################
  1074. # ########################## Status Toolbar ##############################
  1075. # ########################################################################
  1076. self.axis_status_label = FCLabel()
  1077. self.axis_status_label.setToolTip(_("Toggle the display of axis on canvas"))
  1078. self.axis_status_label.setPixmap(QtGui.QPixmap(self.app.resource_location + '/axis16.png'))
  1079. self.status_toolbar.addWidget(self.axis_status_label)
  1080. self.status_toolbar.addWidget(QtWidgets.QLabel(" "))
  1081. self.pref_status_label = FCLabel()
  1082. self.pref_status_label.setToolTip(_("Preferences"))
  1083. self.pref_status_label.setPixmap(QtGui.QPixmap(self.app.resource_location + '/settings18.png'))
  1084. self.status_toolbar.addWidget(self.pref_status_label)
  1085. self.status_toolbar.addWidget(QtWidgets.QLabel(" "))
  1086. self.shell_status_label = FCLabel()
  1087. self.shell_status_label.setToolTip(_("Command Line"))
  1088. self.shell_status_label.setPixmap(QtGui.QPixmap(self.app.resource_location + '/shell20.png'))
  1089. self.status_toolbar.addWidget(self.shell_status_label)
  1090. self.status_toolbar.addWidget(QtWidgets.QLabel(" "))
  1091. self.hud_label = FCLabel()
  1092. self.hud_label.setToolTip(_("HUD (Heads up display)"))
  1093. self.hud_label.setPixmap(QtGui.QPixmap(self.app.resource_location + '/hud16.png'))
  1094. self.status_toolbar.addWidget(self.hud_label)
  1095. self.status_toolbar.addWidget(QtWidgets.QLabel(" "))
  1096. self.wplace_label = FCLabel("A4")
  1097. self.wplace_label.setToolTip(_("Draw a delimiting rectangle on canvas.\n"
  1098. "The purpose is to illustrate the limits for our work.")
  1099. )
  1100. self.wplace_label.setMargin(2)
  1101. self.status_toolbar.addWidget(self.wplace_label)
  1102. self.status_toolbar.addWidget(QtWidgets.QLabel(" "))
  1103. # #######################################################################
  1104. # ####################### Delta Coordinates TOOLBAR #####################
  1105. # #######################################################################
  1106. self.rel_position_label = QtWidgets.QLabel(
  1107. "<b>Dx</b>: 0.0000&nbsp;&nbsp; <b>Dy</b>: 0.0000&nbsp;&nbsp;&nbsp;&nbsp;")
  1108. self.rel_position_label.setMinimumWidth(110)
  1109. self.rel_position_label.setToolTip(_("Relative measurement.\nReference is last click position"))
  1110. self.delta_coords_toolbar.addWidget(self.rel_position_label)
  1111. # #######################################################################
  1112. # ####################### Coordinates TOOLBAR ###########################
  1113. # #######################################################################
  1114. self.position_label = QtWidgets.QLabel("&nbsp;<b>X</b>: 0.0000&nbsp;&nbsp; <b>Y</b>: 0.0000&nbsp;")
  1115. self.position_label.setMinimumWidth(110)
  1116. self.position_label.setToolTip(_("Absolute measurement.\n"
  1117. "Reference is (X=0, Y= 0) position"))
  1118. self.coords_toolbar.addWidget(self.position_label)
  1119. # #######################################################################
  1120. # ####################### TCL Shell DOCK ################################
  1121. # #######################################################################
  1122. self.shell_dock = FCDock(_("TCL Shell"), close_callback=self.toggle_shell_ui)
  1123. self.shell_dock.setObjectName('Shell_DockWidget')
  1124. self.shell_dock.setAllowedAreas(QtCore.Qt.AllDockWidgetAreas)
  1125. self.shell_dock.setFeatures(QtWidgets.QDockWidget.DockWidgetMovable |
  1126. QtWidgets.QDockWidget.DockWidgetFloatable |
  1127. QtWidgets.QDockWidget.DockWidgetClosable)
  1128. self.addDockWidget(QtCore.Qt.BottomDockWidgetArea, self.shell_dock)
  1129. # ########################################################################
  1130. # ########################## Notebook # ##################################
  1131. # ########################################################################
  1132. # ########################################################################
  1133. # ########################## PROJECT Tab # ###############################
  1134. # ########################################################################
  1135. self.project_tab = QtWidgets.QWidget()
  1136. self.project_tab.setObjectName("project_tab")
  1137. self.project_frame_lay = QtWidgets.QVBoxLayout(self.project_tab)
  1138. self.project_frame_lay.setContentsMargins(0, 0, 0, 0)
  1139. self.project_frame = QtWidgets.QFrame()
  1140. self.project_frame.setContentsMargins(0, 0, 0, 0)
  1141. self.project_frame_lay.addWidget(self.project_frame)
  1142. self.project_tab_layout = QtWidgets.QVBoxLayout(self.project_frame)
  1143. self.project_tab_layout.setContentsMargins(2, 2, 2, 2)
  1144. self.notebook.addTab(self.project_tab, _("Project"))
  1145. self.project_frame.setDisabled(False)
  1146. # ########################################################################
  1147. # ########################## SELECTED Tab # ##############################
  1148. # ########################################################################
  1149. self.properties_tab = QtWidgets.QWidget()
  1150. # self.properties_tab.setMinimumWidth(270)
  1151. self.properties_tab.setObjectName("properties_tab")
  1152. self.properties_tab_layout = QtWidgets.QVBoxLayout(self.properties_tab)
  1153. self.properties_tab_layout.setContentsMargins(2, 2, 2, 2)
  1154. self.properties_scroll_area = VerticalScrollArea()
  1155. # self.properties_scroll_area.setSizeAdjustPolicy(QtWidgets.QAbstractScrollArea.AdjustToContents)
  1156. self.properties_tab_layout.addWidget(self.properties_scroll_area)
  1157. self.notebook.addTab(self.properties_tab, _("Properties"))
  1158. # ########################################################################
  1159. # ########################## TOOL Tab # ##################################
  1160. # ########################################################################
  1161. self.tool_tab = QtWidgets.QWidget()
  1162. self.tool_tab.setObjectName("tool_tab")
  1163. self.tool_tab_layout = QtWidgets.QVBoxLayout(self.tool_tab)
  1164. self.tool_tab_layout.setContentsMargins(2, 2, 2, 2)
  1165. self.notebook.addTab(self.tool_tab, _("Tool"))
  1166. self.tool_scroll_area = VerticalScrollArea()
  1167. # self.tool_scroll_area.setSizeAdjustPolicy(QtWidgets.QAbstractScrollArea.AdjustToContents)
  1168. self.tool_tab_layout.addWidget(self.tool_scroll_area)
  1169. # ########################################################################
  1170. # ########################## RIGHT Widget # ##############################
  1171. # ########################################################################
  1172. self.right_widget = QtWidgets.QWidget()
  1173. self.right_widget.setSizePolicy(QtWidgets.QSizePolicy.Ignored, QtWidgets.QSizePolicy.Ignored)
  1174. self.splitter.addWidget(self.right_widget)
  1175. self.right_lay = QtWidgets.QVBoxLayout()
  1176. self.right_lay.setContentsMargins(0, 0, 0, 0)
  1177. self.right_widget.setLayout(self.right_lay)
  1178. # ########################################################################
  1179. # ########################## PLOT AREA Tab # #############################
  1180. # ########################################################################
  1181. self.plot_tab_area = FCDetachableTab2(protect=False, protect_by_name=[_('Plot Area')], parent=self)
  1182. self.plot_tab_area.useOldIndex(True)
  1183. self.right_lay.addWidget(self.plot_tab_area)
  1184. self.plot_tab_area.setTabsClosable(True)
  1185. self.plot_tab = QtWidgets.QWidget()
  1186. self.plot_tab.setObjectName("plotarea_tab")
  1187. self.plot_tab_area.addTab(self.plot_tab, _("Plot Area"))
  1188. self.right_layout = QtWidgets.QVBoxLayout()
  1189. self.right_layout.setObjectName("right_layout")
  1190. self.right_layout.setContentsMargins(2, 2, 2, 2)
  1191. self.plot_tab.setLayout(self.right_layout)
  1192. # remove the close button from the Plot Area tab (first tab index = 0) as this one will always be ON
  1193. self.plot_tab_area.protectTab(0)
  1194. # ########################################################################
  1195. # ########################## PREFERENCES AREA Tab # ######################
  1196. # ########################################################################
  1197. self.preferences_tab = QtWidgets.QWidget()
  1198. self.preferences_tab.setObjectName("preferences_tab")
  1199. self.pref_tab_layout = QtWidgets.QVBoxLayout(self.preferences_tab)
  1200. self.pref_tab_layout.setContentsMargins(2, 2, 2, 2)
  1201. self.pref_tab_area = FCTab()
  1202. self.pref_tab_area.setTabsClosable(False)
  1203. self.pref_tab_area_tabBar = self.pref_tab_area.tabBar()
  1204. self.pref_tab_area_tabBar.setStyleSheet("QTabBar::tab{min-width:90px;}")
  1205. self.pref_tab_area_tabBar.setExpanding(True)
  1206. self.pref_tab_layout.addWidget(self.pref_tab_area)
  1207. self.general_tab = QtWidgets.QWidget()
  1208. self.general_tab.setObjectName("general_tab")
  1209. self.pref_tab_area.addTab(self.general_tab, _("General"))
  1210. self.general_tab_lay = QtWidgets.QVBoxLayout()
  1211. self.general_tab_lay.setContentsMargins(2, 2, 2, 2)
  1212. self.general_tab.setLayout(self.general_tab_lay)
  1213. self.hlay1 = QtWidgets.QHBoxLayout()
  1214. self.general_tab_lay.addLayout(self.hlay1)
  1215. self.hlay1.addStretch()
  1216. self.general_scroll_area = QtWidgets.QScrollArea()
  1217. self.general_tab_lay.addWidget(self.general_scroll_area)
  1218. self.gerber_tab = QtWidgets.QWidget()
  1219. self.gerber_tab.setObjectName("gerber_tab")
  1220. self.pref_tab_area.addTab(self.gerber_tab, _("GERBER"))
  1221. self.gerber_tab_lay = QtWidgets.QVBoxLayout()
  1222. self.gerber_tab_lay.setContentsMargins(2, 2, 2, 2)
  1223. self.gerber_tab.setLayout(self.gerber_tab_lay)
  1224. self.gerber_scroll_area = QtWidgets.QScrollArea()
  1225. self.gerber_tab_lay.addWidget(self.gerber_scroll_area)
  1226. self.excellon_tab = QtWidgets.QWidget()
  1227. self.excellon_tab.setObjectName("excellon_tab")
  1228. self.pref_tab_area.addTab(self.excellon_tab, _("EXCELLON"))
  1229. self.excellon_tab_lay = QtWidgets.QVBoxLayout()
  1230. self.excellon_tab_lay.setContentsMargins(2, 2, 2, 2)
  1231. self.excellon_tab.setLayout(self.excellon_tab_lay)
  1232. self.excellon_scroll_area = QtWidgets.QScrollArea()
  1233. self.excellon_tab_lay.addWidget(self.excellon_scroll_area)
  1234. self.geometry_tab = QtWidgets.QWidget()
  1235. self.geometry_tab.setObjectName("geometry_tab")
  1236. self.pref_tab_area.addTab(self.geometry_tab, _("GEOMETRY"))
  1237. self.geometry_tab_lay = QtWidgets.QVBoxLayout()
  1238. self.geometry_tab_lay.setContentsMargins(2, 2, 2, 2)
  1239. self.geometry_tab.setLayout(self.geometry_tab_lay)
  1240. self.geometry_scroll_area = QtWidgets.QScrollArea()
  1241. self.geometry_tab_lay.addWidget(self.geometry_scroll_area)
  1242. self.text_editor_tab = QtWidgets.QWidget()
  1243. self.text_editor_tab.setObjectName("text_editor_tab")
  1244. self.pref_tab_area.addTab(self.text_editor_tab, _("CNC-JOB"))
  1245. self.cncjob_tab_lay = QtWidgets.QVBoxLayout()
  1246. self.cncjob_tab_lay.setContentsMargins(2, 2, 2, 2)
  1247. self.text_editor_tab.setLayout(self.cncjob_tab_lay)
  1248. self.cncjob_scroll_area = QtWidgets.QScrollArea()
  1249. self.cncjob_tab_lay.addWidget(self.cncjob_scroll_area)
  1250. self.tools_tab = QtWidgets.QWidget()
  1251. self.pref_tab_area.addTab(self.tools_tab, _("TOOLS"))
  1252. self.tools_tab_lay = QtWidgets.QVBoxLayout()
  1253. self.tools_tab_lay.setContentsMargins(2, 2, 2, 2)
  1254. self.tools_tab.setLayout(self.tools_tab_lay)
  1255. self.tools_scroll_area = QtWidgets.QScrollArea()
  1256. self.tools_tab_lay.addWidget(self.tools_scroll_area)
  1257. self.tools2_tab = QtWidgets.QWidget()
  1258. self.pref_tab_area.addTab(self.tools2_tab, _("TOOLS 2"))
  1259. self.tools2_tab_lay = QtWidgets.QVBoxLayout()
  1260. self.tools2_tab_lay.setContentsMargins(2, 2, 2, 2)
  1261. self.tools2_tab.setLayout(self.tools2_tab_lay)
  1262. self.tools2_scroll_area = QtWidgets.QScrollArea()
  1263. self.tools2_tab_lay.addWidget(self.tools2_scroll_area)
  1264. self.fa_tab = QtWidgets.QWidget()
  1265. self.fa_tab.setObjectName("fa_tab")
  1266. self.pref_tab_area.addTab(self.fa_tab, _("UTILITIES"))
  1267. self.fa_tab_lay = QtWidgets.QVBoxLayout()
  1268. self.fa_tab_lay.setContentsMargins(2, 2, 2, 2)
  1269. self.fa_tab.setLayout(self.fa_tab_lay)
  1270. self.fa_scroll_area = QtWidgets.QScrollArea()
  1271. self.fa_tab_lay.addWidget(self.fa_scroll_area)
  1272. self.pref_tab_bottom_layout = QtWidgets.QHBoxLayout()
  1273. self.pref_tab_bottom_layout.setAlignment(QtCore.Qt.AlignVCenter)
  1274. self.pref_tab_layout.addLayout(self.pref_tab_bottom_layout)
  1275. self.pref_tab_bottom_layout_1 = QtWidgets.QHBoxLayout()
  1276. self.pref_tab_bottom_layout_1.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  1277. self.pref_tab_bottom_layout.addLayout(self.pref_tab_bottom_layout_1)
  1278. self.pref_defaults_button = FCButton(_("Restore Defaults"))
  1279. self.pref_defaults_button.setIcon(QtGui.QIcon(self.app.resource_location + '/restore32.png'))
  1280. self.pref_defaults_button.setMinimumWidth(130)
  1281. self.pref_defaults_button.setToolTip(
  1282. _("Restore the entire set of default values\n"
  1283. "to the initial values loaded after first launch."))
  1284. self.pref_tab_bottom_layout_1.addWidget(self.pref_defaults_button)
  1285. self.pref_open_button = QtWidgets.QPushButton()
  1286. self.pref_open_button.setText(_("Open Pref Folder"))
  1287. self.pref_open_button.setIcon(QtGui.QIcon(self.app.resource_location + '/pref.png'))
  1288. self.pref_open_button.setMinimumWidth(130)
  1289. self.pref_open_button.setToolTip(
  1290. _("Open the folder where FlatCAM save the preferences files."))
  1291. self.pref_tab_bottom_layout_1.addWidget(self.pref_open_button)
  1292. # Clear Settings
  1293. self.clear_btn = FCButton('%s' % _('Clear GUI Settings'))
  1294. self.clear_btn.setIcon(QtGui.QIcon(self.app.resource_location + '/trash32.png'))
  1295. self.clear_btn.setMinimumWidth(130)
  1296. self.clear_btn.setToolTip(
  1297. _("Clear the GUI settings for FlatCAM,\n"
  1298. "such as: layout, gui state, style, hdpi support etc.")
  1299. )
  1300. self.pref_tab_bottom_layout_1.addWidget(self.clear_btn)
  1301. self.pref_tab_bottom_layout_2 = QtWidgets.QHBoxLayout()
  1302. self.pref_tab_bottom_layout_2.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
  1303. self.pref_tab_bottom_layout.addLayout(self.pref_tab_bottom_layout_2)
  1304. self.pref_apply_button = FCButton()
  1305. self.pref_apply_button.setIcon(QtGui.QIcon(self.app.resource_location + '/apply32.png'))
  1306. self.pref_apply_button.setText(_("Apply"))
  1307. self.pref_apply_button.setMinimumWidth(130)
  1308. self.pref_apply_button.setToolTip(
  1309. _("Apply the current preferences without saving to a file."))
  1310. self.pref_tab_bottom_layout_2.addWidget(self.pref_apply_button)
  1311. self.pref_save_button = QtWidgets.QPushButton()
  1312. self.pref_save_button.setIcon(QtGui.QIcon(self.app.resource_location + '/save_as.png'))
  1313. self.pref_save_button.setText(_("Save"))
  1314. self.pref_save_button.setMinimumWidth(130)
  1315. self.pref_save_button.setToolTip(
  1316. _("Save the current settings in the 'current_defaults' file\n"
  1317. "which is the file storing the working default preferences."))
  1318. self.pref_tab_bottom_layout_2.addWidget(self.pref_save_button)
  1319. self.pref_close_button = QtWidgets.QPushButton()
  1320. self.pref_close_button.setText(_("Cancel"))
  1321. self.pref_close_button.setMinimumWidth(130)
  1322. self.pref_close_button.setToolTip(
  1323. _("Will not save the changes and will close the preferences window."))
  1324. self.pref_tab_bottom_layout_2.addWidget(self.pref_close_button)
  1325. # ########################################################################
  1326. # #################### SHORTCUT LIST AREA Tab # ##########################
  1327. # ########################################################################
  1328. self.shortcuts_tab = ShortcutsTab()
  1329. # ########################################################################
  1330. # ########################## PLOT AREA CONTEXT MENU # ###################
  1331. # ########################################################################
  1332. self.popMenu = FCMenu()
  1333. self.popmenu_disable = self.popMenu.addAction(
  1334. QtGui.QIcon(self.app.resource_location + '/disable32.png'), _("Toggle Visibility"))
  1335. self.popmenu_panel_toggle = self.popMenu.addAction(
  1336. QtGui.QIcon(self.app.resource_location + '/notebook16.png'), _("Toggle Panel"))
  1337. self.popMenu.addSeparator()
  1338. self.cmenu_newmenu = self.popMenu.addMenu(
  1339. QtGui.QIcon(self.app.resource_location + '/file32.png'), _("New"))
  1340. self.popmenu_new_geo = self.cmenu_newmenu.addAction(
  1341. QtGui.QIcon(self.app.resource_location + '/new_file_geo16.png'), _("Geometry"))
  1342. self.popmenu_new_grb = self.cmenu_newmenu.addAction(
  1343. QtGui.QIcon(self.app.resource_location + '/new_file_grb16.png'), "Gerber")
  1344. self.popmenu_new_exc = self.cmenu_newmenu.addAction(
  1345. QtGui.QIcon(self.app.resource_location + '/new_file_exc16.png'), _("Excellon"))
  1346. self.cmenu_newmenu.addSeparator()
  1347. self.popmenu_new_prj = self.cmenu_newmenu.addAction(
  1348. QtGui.QIcon(self.app.resource_location + '/file16.png'), _("Project"))
  1349. self.popMenu.addSeparator()
  1350. self.cmenu_gridmenu = self.popMenu.addMenu(
  1351. QtGui.QIcon(self.app.resource_location + '/grid32_menu.png'), _("Grids"))
  1352. self.cmenu_viewmenu = self.popMenu.addMenu(
  1353. QtGui.QIcon(self.app.resource_location + '/view64.png'), _("View"))
  1354. self.zoomfit = self.cmenu_viewmenu.addAction(
  1355. QtGui.QIcon(self.app.resource_location + '/zoom_fit32.png'), _("Zoom Fit"))
  1356. self.clearplot = self.cmenu_viewmenu.addAction(
  1357. QtGui.QIcon(self.app.resource_location + '/clear_plot32.png'), _("Clear Plot"))
  1358. self.replot = self.cmenu_viewmenu.addAction(
  1359. QtGui.QIcon(self.app.resource_location + '/replot32.png'), _("Replot"))
  1360. self.popMenu.addSeparator()
  1361. self.g_editor_cmenu = self.popMenu.addMenu(
  1362. QtGui.QIcon(self.app.resource_location + '/draw32.png'), _("Geo Editor"))
  1363. self.draw_line = self.g_editor_cmenu.addAction(
  1364. QtGui.QIcon(self.app.resource_location + '/path32.png'), _("Path"))
  1365. self.draw_rect = self.g_editor_cmenu.addAction(
  1366. QtGui.QIcon(self.app.resource_location + '/rectangle32.png'), _("Rectangle"))
  1367. self.g_editor_cmenu.addSeparator()
  1368. self.draw_circle = self.g_editor_cmenu.addAction(
  1369. QtGui.QIcon(self.app.resource_location + '/circle32.png'), _("Circle"))
  1370. self.draw_poly = self.g_editor_cmenu.addAction(
  1371. QtGui.QIcon(self.app.resource_location + '/polygon32.png'), _("Polygon"))
  1372. self.draw_arc = self.g_editor_cmenu.addAction(
  1373. QtGui.QIcon(self.app.resource_location + '/arc32.png'), _("Arc"))
  1374. self.g_editor_cmenu.addSeparator()
  1375. self.draw_text = self.g_editor_cmenu.addAction(
  1376. QtGui.QIcon(self.app.resource_location + '/text32.png'), _("Text"))
  1377. self.draw_buffer = self.g_editor_cmenu.addAction(
  1378. QtGui.QIcon(self.app.resource_location + '/buffer16-2.png'), _("Buffer"))
  1379. self.draw_paint = self.g_editor_cmenu.addAction(
  1380. QtGui.QIcon(self.app.resource_location + '/paint20_1.png'), _("Paint"))
  1381. self.draw_eraser = self.g_editor_cmenu.addAction(
  1382. QtGui.QIcon(self.app.resource_location + '/eraser26.png'), _("Eraser"))
  1383. self.g_editor_cmenu.addSeparator()
  1384. self.draw_union = self.g_editor_cmenu.addAction(
  1385. QtGui.QIcon(self.app.resource_location + '/union32.png'), _("Union"))
  1386. self.draw_intersect = self.g_editor_cmenu.addAction(
  1387. QtGui.QIcon(self.app.resource_location + '/intersection32.png'), _("Intersection"))
  1388. self.draw_substract = self.g_editor_cmenu.addAction(
  1389. QtGui.QIcon(self.app.resource_location + '/subtract32.png'), _("Subtraction"))
  1390. self.draw_cut = self.g_editor_cmenu.addAction(
  1391. QtGui.QIcon(self.app.resource_location + '/cutpath32.png'), _("Cut"))
  1392. self.draw_transform = self.g_editor_cmenu.addAction(
  1393. QtGui.QIcon(self.app.resource_location + '/transform.png'), _("Transformations"))
  1394. self.g_editor_cmenu.addSeparator()
  1395. self.draw_move = self.g_editor_cmenu.addAction(
  1396. QtGui.QIcon(self.app.resource_location + '/move32.png'), _("Move"))
  1397. self.grb_editor_cmenu = self.popMenu.addMenu(
  1398. QtGui.QIcon(self.app.resource_location + '/draw32.png'), _("Gerber Editor"))
  1399. self.grb_draw_pad = self.grb_editor_cmenu.addAction(
  1400. QtGui.QIcon(self.app.resource_location + '/aperture32.png'), _("Pad"))
  1401. self.grb_draw_pad_array = self.grb_editor_cmenu.addAction(
  1402. QtGui.QIcon(self.app.resource_location + '/padarray32.png'), _("Pad Array"))
  1403. self.grb_editor_cmenu.addSeparator()
  1404. self.grb_draw_track = self.grb_editor_cmenu.addAction(
  1405. QtGui.QIcon(self.app.resource_location + '/track32.png'), _("Track"))
  1406. self.grb_draw_region = self.grb_editor_cmenu.addAction(
  1407. QtGui.QIcon(self.app.resource_location + '/polygon32.png'), _("Region"))
  1408. self.grb_draw_poligonize = self.grb_editor_cmenu.addAction(
  1409. QtGui.QIcon(self.app.resource_location + '/poligonize32.png'), _("Poligonize"))
  1410. self.grb_draw_semidisc = self.grb_editor_cmenu.addAction(
  1411. QtGui.QIcon(self.app.resource_location + '/semidisc32.png'), _("SemiDisc"))
  1412. self.grb_draw_disc = self.grb_editor_cmenu.addAction(
  1413. QtGui.QIcon(self.app.resource_location + '/disc32.png'), _("Disc"))
  1414. self.grb_editor_cmenu.addSeparator()
  1415. self.grb_draw_buffer = self.grb_editor_cmenu.addAction(
  1416. QtGui.QIcon(self.app.resource_location + '/buffer16-2.png'), _("Buffer"))
  1417. self.grb_draw_scale = self.grb_editor_cmenu.addAction(
  1418. QtGui.QIcon(self.app.resource_location + '/scale32.png'), _("Scale"))
  1419. self.grb_draw_markarea = self.grb_editor_cmenu.addAction(
  1420. QtGui.QIcon(self.app.resource_location + '/markarea32.png'), _("Mark Area"))
  1421. self.grb_draw_eraser = self.grb_editor_cmenu.addAction(
  1422. QtGui.QIcon(self.app.resource_location + '/eraser26.png'), _("Eraser"))
  1423. self.grb_editor_cmenu.addSeparator()
  1424. self.grb_draw_transformations = self.grb_editor_cmenu.addAction(
  1425. QtGui.QIcon(self.app.resource_location + '/transform.png'), _("Transformations"))
  1426. self.e_editor_cmenu = self.popMenu.addMenu(
  1427. QtGui.QIcon(self.app.resource_location + '/drill32.png'), _("Exc Editor"))
  1428. self.drill = self.e_editor_cmenu.addAction(
  1429. QtGui.QIcon(self.app.resource_location + '/drill32.png'), _("Add Drill"))
  1430. self.drill_array = self.e_editor_cmenu.addAction(
  1431. QtGui.QIcon(self.app.resource_location + '/addarray32.png'), _("Add Drill Array"))
  1432. self.e_editor_cmenu.addSeparator()
  1433. self.slot = self.e_editor_cmenu.addAction(
  1434. QtGui.QIcon(self.app.resource_location + '/slot26.png'), _("Add Slot"))
  1435. self.slot_array = self.e_editor_cmenu.addAction(
  1436. QtGui.QIcon(self.app.resource_location + '/slot_array26.png'), _("Add Slot Array"))
  1437. self.e_editor_cmenu.addSeparator()
  1438. self.drill_resize = self.e_editor_cmenu.addAction(
  1439. QtGui.QIcon(self.app.resource_location + '/resize16.png'), _("Resize Drill"))
  1440. self.popMenu.addSeparator()
  1441. self.popmenu_copy = self.popMenu.addAction(QtGui.QIcon(self.app.resource_location + '/copy32.png'), _("Copy"))
  1442. self.popmenu_delete = self.popMenu.addAction(
  1443. QtGui.QIcon(self.app.resource_location + '/delete32.png'), _("Delete"))
  1444. self.popmenu_edit = self.popMenu.addAction(
  1445. QtGui.QIcon(self.app.resource_location + '/edit32.png'), _("Edit"))
  1446. self.popmenu_save = self.popMenu.addAction(
  1447. QtGui.QIcon(self.app.resource_location + '/floppy32.png'), _("Close Editor"))
  1448. self.popmenu_save.setVisible(False)
  1449. self.popMenu.addSeparator()
  1450. self.popmenu_move = self.popMenu.addAction(
  1451. QtGui.QIcon(self.app.resource_location + '/move32.png'), _("Move"))
  1452. self.popmenu_properties = self.popMenu.addAction(
  1453. QtGui.QIcon(self.app.resource_location + '/properties32.png'), _("Properties"))
  1454. # ########################################################################
  1455. # ########################## INFO BAR # ##################################
  1456. # ########################################################################
  1457. self.infobar = self.statusBar()
  1458. self.fcinfo = FlatCAMInfoBar(app=self.app)
  1459. self.infobar.addWidget(self.fcinfo, stretch=1)
  1460. self.infobar.addWidget(self.delta_coords_toolbar)
  1461. self.delta_coords_toolbar.setVisible(self.app.defaults["global_delta_coordsbar_show"])
  1462. self.infobar.addWidget(self.coords_toolbar)
  1463. self.coords_toolbar.setVisible(self.app.defaults["global_coordsbar_show"])
  1464. self.grid_toolbar.setMaximumHeight(24)
  1465. self.infobar.addWidget(self.grid_toolbar)
  1466. self.grid_toolbar.setVisible(self.app.defaults["global_gridbar_show"])
  1467. self.status_toolbar.setMaximumHeight(24)
  1468. self.infobar.addWidget(self.status_toolbar)
  1469. self.status_toolbar.setVisible(self.app.defaults["global_statusbar_show"])
  1470. self.units_label = QtWidgets.QLabel("[mm]")
  1471. self.units_label.setToolTip(_("Application units"))
  1472. self.units_label.setMargin(2)
  1473. self.infobar.addWidget(self.units_label)
  1474. # this used to be done in the APP.__init__()
  1475. self.activity_view = FlatCAMActivityView(app=self.app)
  1476. self.infobar.addWidget(self.activity_view)
  1477. # disabled
  1478. # self.progress_bar = QtWidgets.QProgressBar()
  1479. # self.progress_bar.setMinimum(0)
  1480. # self.progress_bar.setMaximum(100)
  1481. # infobar.addWidget(self.progress_bar)
  1482. # ########################################################################
  1483. # ########################## SET GUI Elements # ##########################
  1484. # ########################################################################
  1485. self.app_icon = QtGui.QIcon()
  1486. self.app_icon.addFile(self.app.resource_location + '/flatcam_icon16.png', QtCore.QSize(16, 16))
  1487. self.app_icon.addFile(self.app.resource_location + '/flatcam_icon24.png', QtCore.QSize(24, 24))
  1488. self.app_icon.addFile(self.app.resource_location + '/flatcam_icon32.png', QtCore.QSize(32, 32))
  1489. self.app_icon.addFile(self.app.resource_location + '/flatcam_icon48.png', QtCore.QSize(48, 48))
  1490. self.app_icon.addFile(self.app.resource_location + '/flatcam_icon128.png', QtCore.QSize(128, 128))
  1491. self.app_icon.addFile(self.app.resource_location + '/flatcam_icon256.png', QtCore.QSize(256, 256))
  1492. self.setWindowIcon(self.app_icon)
  1493. self.setGeometry(100, 100, 1024, 650)
  1494. self.setWindowTitle('FlatCAM %s %s - %s' %
  1495. (self.app.version,
  1496. ('BETA' if self.app.beta else ''),
  1497. platform.architecture()[0])
  1498. )
  1499. self.filename = ""
  1500. self.units = ""
  1501. self.setAcceptDrops(True)
  1502. # ########################################################################
  1503. # ########################## Build GUI # #################################
  1504. # ########################################################################
  1505. self.grid_snap_btn.setCheckable(True)
  1506. self.corner_snap_btn.setCheckable(True)
  1507. self.update_obj_btn.setEnabled(False)
  1508. # start with GRID activated
  1509. self.grid_snap_btn.trigger()
  1510. self.g_editor_cmenu.menuAction().setVisible(False)
  1511. self.grb_editor_cmenu.menuAction().setVisible(False)
  1512. self.e_editor_cmenu.menuAction().setVisible(False)
  1513. # ########################################################################
  1514. # ######################## BUILD PREFERENCES #############################
  1515. # ########################################################################
  1516. self.general_defaults_form = GeneralPreferencesUI(decimals=self.decimals)
  1517. self.gerber_defaults_form = GerberPreferencesUI(decimals=self.decimals)
  1518. self.excellon_defaults_form = ExcellonPreferencesUI(decimals=self.decimals)
  1519. self.geometry_defaults_form = GeometryPreferencesUI(decimals=self.decimals)
  1520. self.cncjob_defaults_form = CNCJobPreferencesUI(decimals=self.decimals)
  1521. self.tools_defaults_form = ToolsPreferencesUI(decimals=self.decimals)
  1522. self.tools2_defaults_form = Tools2PreferencesUI(decimals=self.decimals)
  1523. self.util_defaults_form = UtilPreferencesUI(decimals=self.decimals)
  1524. QtWidgets.qApp.installEventFilter(self)
  1525. # ########################################################################
  1526. # ################## RESTORE THE TOOLBAR STATE from file #################
  1527. # ########################################################################
  1528. flat_settings = QSettings("Open Source", "FlatCAM")
  1529. if flat_settings.contains("saved_gui_state"):
  1530. saved_gui_state = flat_settings.value('saved_gui_state')
  1531. self.restoreState(saved_gui_state)
  1532. log.debug("MainGUI.__init__() --> UI state restored from QSettings.")
  1533. self.corner_snap_btn.setVisible(False)
  1534. self.snap_magnet.setVisible(False)
  1535. if flat_settings.contains("layout"):
  1536. layout = flat_settings.value('layout', type=str)
  1537. self.exc_edit_toolbar.setDisabled(True)
  1538. self.geo_edit_toolbar.setDisabled(True)
  1539. self.grb_edit_toolbar.setDisabled(True)
  1540. log.debug("MainGUI.__init__() --> UI layout restored from QSettings. Layout = %s" % str(layout))
  1541. else:
  1542. self.exc_edit_toolbar.setDisabled(True)
  1543. self.geo_edit_toolbar.setDisabled(True)
  1544. self.grb_edit_toolbar.setDisabled(True)
  1545. flat_settings.setValue('layout', "standard")
  1546. # This will write the setting to the platform specific storage.
  1547. del flat_settings
  1548. log.debug("MainGUI.__init__() --> UI layout restored from defaults. QSettings set to 'standard'")
  1549. # construct the Toolbar Lock menu entry to the context menu of the QMainWindow
  1550. self.lock_action = QtWidgets.QAction()
  1551. self.lock_action.setText(_("Lock Toolbars"))
  1552. self.lock_action.setCheckable(True)
  1553. qsettings = QSettings("Open Source", "FlatCAM")
  1554. if qsettings.contains("toolbar_lock"):
  1555. lock_val = settings.value('toolbar_lock')
  1556. if lock_val == 'true':
  1557. lock_state = True
  1558. self.lock_action.setChecked(True)
  1559. else:
  1560. lock_state = False
  1561. self.lock_action.setChecked(False)
  1562. else:
  1563. lock_state = False
  1564. qsettings.setValue('toolbar_lock', lock_state)
  1565. # This will write the setting to the platform specific storage.
  1566. del qsettings
  1567. self.lock_toolbar(lock=lock_state)
  1568. self.lock_action.triggered[bool].connect(self.lock_toolbar)
  1569. self.pref_open_button.clicked.connect(self.on_preferences_open_folder)
  1570. self.clear_btn.clicked.connect(self.on_gui_clear)
  1571. self.wplace_label.clicked.connect(self.app.on_workspace_toggle)
  1572. self.shell_status_label.clicked.connect(self.toggle_shell_ui)
  1573. # to be used in the future
  1574. # self.plot_tab_area.tab_attached.connect(lambda x: print(x))
  1575. # self.plot_tab_area.tab_detached.connect(lambda x: print(x))
  1576. # restore the toolbar view
  1577. self.restore_toolbar_view()
  1578. # restore the GUI geometry
  1579. self.restore_main_win_geom()
  1580. # %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1581. # %%%%%%%%%%%%%%%%% GUI Building FINISHED %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1582. # %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1583. # Variable to store the status of the fullscreen event
  1584. self.toggle_fscreen = False
  1585. self.x_pos = None
  1586. self.y_pos = None
  1587. self.width = None
  1588. self.height = None
  1589. self.titlebar_height = None
  1590. self.geom_update[int, int, int, int, int].connect(self.save_geometry)
  1591. self.final_save.connect(self.app.final_save)
  1592. self.shell_dock.visibilityChanged.connect(self.on_shelldock_toggled)
  1593. # Notebook and Plot Tab Area signals
  1594. # make the right click on the notebook tab and plot tab area tab raise a menu
  1595. self.notebook.tabBar.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
  1596. self.plot_tab_area.tabBar.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
  1597. self.on_tab_setup_context_menu()
  1598. # activate initial state
  1599. self.on_detachable_tab_rmb_click(self.app.defaults["global_tabs_detachable"])
  1600. # status bar activation/deactivation
  1601. self.infobar.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
  1602. self.build_infobar_context_menu()
  1603. def set_ui_title(self, name):
  1604. """
  1605. Sets the title of the main window.
  1606. :param name: String that store the project path and project name
  1607. :return: None
  1608. """
  1609. title = 'FlatCAM %s %s - %s - [%s] %s' % (
  1610. self.app.version, ('BETA' if self.app.beta else ''), platform.architecture()[0], self.app.engine, name)
  1611. self.setWindowTitle(title)
  1612. def save_geometry(self, x, y, width, height, notebook_width):
  1613. """
  1614. Will save the application geometry and positions in the defaults dicitionary to be restored at the next
  1615. launch of the application.
  1616. :param x: X position of the main window
  1617. :param y: Y position of the main window
  1618. :param width: width of the main window
  1619. :param height: height of the main window
  1620. :param notebook_width: the notebook width is adjustable so it get saved here, too.
  1621. :return: None
  1622. """
  1623. self.app.defaults["global_def_win_x"] = x
  1624. self.app.defaults["global_def_win_y"] = y
  1625. self.app.defaults["global_def_win_w"] = width
  1626. self.app.defaults["global_def_win_h"] = height
  1627. self.app.defaults["global_def_notebook_width"] = notebook_width
  1628. self.app.preferencesUiManager.save_defaults()
  1629. def restore_main_win_geom(self):
  1630. try:
  1631. self.setGeometry(self.app.defaults["global_def_win_x"],
  1632. self.app.defaults["global_def_win_y"],
  1633. self.app.defaults["global_def_win_w"],
  1634. self.app.defaults["global_def_win_h"])
  1635. self.splitter.setSizes([self.app.defaults["global_def_notebook_width"], 0])
  1636. except KeyError as e:
  1637. log.debug("appGUI.MainGUI.restore_main_win_geom() --> %s" % str(e))
  1638. def restore_toolbar_view(self):
  1639. """
  1640. Some toolbars may be hidden by user and here we restore the state of the toolbars visibility that
  1641. was saved in the defaults dictionary.
  1642. :return: None
  1643. """
  1644. tb = self.app.defaults["global_toolbar_view"]
  1645. if tb & 1:
  1646. self.toolbarfile.setVisible(True)
  1647. else:
  1648. self.toolbarfile.setVisible(False)
  1649. if tb & 2:
  1650. self.toolbaredit.setVisible(True)
  1651. else:
  1652. self.toolbaredit.setVisible(False)
  1653. if tb & 4:
  1654. self.toolbarview.setVisible(True)
  1655. else:
  1656. self.toolbarview.setVisible(False)
  1657. if tb & 8:
  1658. self.toolbartools.setVisible(True)
  1659. else:
  1660. self.toolbartools.setVisible(False)
  1661. if tb & 16:
  1662. self.exc_edit_toolbar.setVisible(True)
  1663. else:
  1664. self.exc_edit_toolbar.setVisible(False)
  1665. if tb & 32:
  1666. self.geo_edit_toolbar.setVisible(True)
  1667. else:
  1668. self.geo_edit_toolbar.setVisible(False)
  1669. if tb & 64:
  1670. self.grb_edit_toolbar.setVisible(True)
  1671. else:
  1672. self.grb_edit_toolbar.setVisible(False)
  1673. # if tb & 128:
  1674. # self.ui.grid_toolbar.setVisible(True)
  1675. # else:
  1676. # self.ui.grid_toolbar.setVisible(False)
  1677. # Grid Toolbar is controlled by its own setting
  1678. if tb & 256:
  1679. self.toolbarshell.setVisible(True)
  1680. else:
  1681. self.toolbarshell.setVisible(False)
  1682. def on_tab_setup_context_menu(self):
  1683. initial_checked = self.app.defaults["global_tabs_detachable"]
  1684. action_name = str(_("Detachable Tabs"))
  1685. action = QtWidgets.QAction(self)
  1686. action.setCheckable(True)
  1687. action.setText(action_name)
  1688. action.setChecked(initial_checked)
  1689. self.notebook.tabBar.addAction(action)
  1690. self.plot_tab_area.tabBar.addAction(action)
  1691. try:
  1692. action.triggered.disconnect()
  1693. except TypeError:
  1694. pass
  1695. action.triggered.connect(self.on_detachable_tab_rmb_click)
  1696. def on_detachable_tab_rmb_click(self, checked):
  1697. self.notebook.set_detachable(val=checked)
  1698. self.app.defaults["global_tabs_detachable"] = checked
  1699. self.plot_tab_area.set_detachable(val=checked)
  1700. self.app.defaults["global_tabs_detachable"] = checked
  1701. def build_infobar_context_menu(self):
  1702. delta_coords_action_name = str(_("Delta Coordinates Toolbar"))
  1703. delta_coords_action = QtWidgets.QAction(self)
  1704. delta_coords_action.setCheckable(True)
  1705. delta_coords_action.setText(delta_coords_action_name)
  1706. delta_coords_action.setChecked(self.app.defaults["global_delta_coordsbar_show"])
  1707. self.infobar.addAction(delta_coords_action)
  1708. delta_coords_action.triggered.connect(self.toggle_delta_coords)
  1709. coords_action_name = str(_("Coordinates Toolbar"))
  1710. coords_action = QtWidgets.QAction(self)
  1711. coords_action.setCheckable(True)
  1712. coords_action.setText(coords_action_name)
  1713. coords_action.setChecked(self.app.defaults["global_coordsbar_show"])
  1714. self.infobar.addAction(coords_action)
  1715. coords_action.triggered.connect(self.toggle_coords)
  1716. grid_action_name = str(_("Grid Toolbar"))
  1717. grid_action = QtWidgets.QAction(self)
  1718. grid_action.setCheckable(True)
  1719. grid_action.setText(grid_action_name)
  1720. grid_action.setChecked(self.app.defaults["global_gridbar_show"])
  1721. self.infobar.addAction(grid_action)
  1722. grid_action.triggered.connect(self.toggle_gridbar)
  1723. status_action_name = str(_("Status Toolbar"))
  1724. status_action = QtWidgets.QAction(self)
  1725. status_action.setCheckable(True)
  1726. status_action.setText(status_action_name)
  1727. status_action.setChecked(self.app.defaults["global_statusbar_show"])
  1728. self.infobar.addAction(status_action)
  1729. status_action.triggered.connect(self.toggle_statusbar)
  1730. def toggle_coords(self, checked):
  1731. self.app.defaults["global_coordsbar_show"] = checked
  1732. self.coords_toolbar.setVisible(checked)
  1733. def toggle_delta_coords(self, checked):
  1734. self.app.defaults["global_delta_coordsbar_show"] = checked
  1735. self.delta_coords_toolbar.setVisible(checked)
  1736. def toggle_gridbar(self, checked):
  1737. self.app.defaults["global_gridbar_show"] = checked
  1738. self.grid_toolbar.setVisible(checked)
  1739. def toggle_statusbar(self, checked):
  1740. self.app.defaults["global_statusbar_show"] = checked
  1741. self.status_toolbar.setVisible(checked)
  1742. def eventFilter(self, obj, event):
  1743. """
  1744. Filter the ToolTips display based on a Preferences setting
  1745. :param obj:
  1746. :param event: QT event to filter
  1747. :return:
  1748. """
  1749. if self.app.defaults["global_toggle_tooltips"] is False:
  1750. if event.type() == QtCore.QEvent.ToolTip:
  1751. return True
  1752. else:
  1753. return False
  1754. return False
  1755. def on_preferences_open_folder(self):
  1756. """
  1757. Will open an Explorer window set to the folder path where the FlatCAM preferences files are usually saved.
  1758. :return: None
  1759. """
  1760. if sys.platform == 'win32':
  1761. subprocess.Popen('explorer %s' % self.app.data_path)
  1762. elif sys.platform == 'darwin':
  1763. os.system('open "%s"' % self.app.data_path)
  1764. else:
  1765. subprocess.Popen(['xdg-open', self.app.data_path])
  1766. self.app.inform.emit('[success] %s' % _("FlatCAM Preferences Folder opened."))
  1767. def on_gui_clear(self, signal=None, forced_clear=False):
  1768. """
  1769. Will clear the settings that are stored in QSettings.
  1770. """
  1771. log.debug("Clearing the settings in QSettings. GUI settings cleared.")
  1772. theme_settings = QtCore.QSettings("Open Source", "FlatCAM")
  1773. theme_settings.setValue('theme', 'white')
  1774. del theme_settings
  1775. resource_loc = self.app.resource_location
  1776. response = None
  1777. bt_yes = None
  1778. if forced_clear is False:
  1779. msgbox = QtWidgets.QMessageBox()
  1780. msgbox.setText(_("Are you sure you want to delete the GUI Settings? \n"))
  1781. msgbox.setWindowTitle(_("Clear GUI Settings"))
  1782. msgbox.setWindowIcon(QtGui.QIcon(resource_loc + '/trash32.png'))
  1783. msgbox.setIcon(QtWidgets.QMessageBox.Question)
  1784. bt_yes = msgbox.addButton(_('Yes'), QtWidgets.QMessageBox.YesRole)
  1785. bt_no = msgbox.addButton(_('No'), QtWidgets.QMessageBox.NoRole)
  1786. msgbox.setDefaultButton(bt_no)
  1787. msgbox.exec_()
  1788. response = msgbox.clickedButton()
  1789. if forced_clear is True or response == bt_yes:
  1790. qsettings = QSettings("Open Source", "FlatCAM")
  1791. for key in qsettings.allKeys():
  1792. qsettings.remove(key)
  1793. # This will write the setting to the platform specific storage.
  1794. del qsettings
  1795. def populate_toolbars(self):
  1796. """
  1797. Will populate the App Toolbars with their actions
  1798. :return: None
  1799. """
  1800. self.app.log.debug(" -> Add actions to new Toolbars")
  1801. # ########################################################################
  1802. # ##################### File Toolbar #####################################
  1803. # ########################################################################
  1804. self.file_open_gerber_btn = self.toolbarfile.addAction(
  1805. QtGui.QIcon(self.app.resource_location + '/flatcam_icon32.png'), _("Open Gerber"))
  1806. self.file_open_excellon_btn = self.toolbarfile.addAction(
  1807. QtGui.QIcon(self.app.resource_location + '/drill32.png'), _("Open Excellon"))
  1808. self.toolbarfile.addSeparator()
  1809. self.file_open_btn = self.toolbarfile.addAction(
  1810. QtGui.QIcon(self.app.resource_location + '/folder32.png'), _("Open project"))
  1811. self.file_save_btn = self.toolbarfile.addAction(
  1812. QtGui.QIcon(self.app.resource_location + '/project_save32.png'), _("Save project"))
  1813. # ########################################################################
  1814. # ######################### Edit Toolbar #################################
  1815. # ########################################################################
  1816. self.editgeo_btn = self.toolbaredit.addAction(
  1817. QtGui.QIcon(self.app.resource_location + '/edit32.png'), _("Editor"))
  1818. self.update_obj_btn = self.toolbaredit.addAction(
  1819. QtGui.QIcon(self.app.resource_location + '/close_edit_file32.png'),
  1820. _("Save Object and close the Editor")
  1821. )
  1822. self.toolbaredit.addSeparator()
  1823. self.copy_btn = self.toolbaredit.addAction(
  1824. QtGui.QIcon(self.app.resource_location + '/copy_file32.png'), _("Copy"))
  1825. self.delete_btn = self.toolbaredit.addAction(
  1826. QtGui.QIcon(self.app.resource_location + '/trash32.png'), _("Delete"))
  1827. self.toolbaredit.addSeparator()
  1828. self.distance_btn = self.toolbaredit.addAction(
  1829. QtGui.QIcon(self.app.resource_location + '/distance32.png'), _("Distance Tool"))
  1830. self.distance_min_btn = self.toolbaredit.addAction(
  1831. QtGui.QIcon(self.app.resource_location + '/distance_min32.png'), _("Distance Min Tool"))
  1832. self.origin_btn = self.toolbaredit.addAction(
  1833. QtGui.QIcon(self.app.resource_location + '/origin32.png'), _('Set Origin'))
  1834. self.move2origin_btn = self.toolbaredit.addAction(
  1835. QtGui.QIcon(self.app.resource_location + '/origin2_32.png'), _('Move to Origin'))
  1836. self.jmp_btn = self.toolbaredit.addAction(
  1837. QtGui.QIcon(self.app.resource_location + '/jump_to16.png'), _('Jump to Location'))
  1838. self.locate_btn = self.toolbaredit.addAction(
  1839. QtGui.QIcon(self.app.resource_location + '/locate32.png'), _('Locate in Object'))
  1840. # ########################################################################
  1841. # ########################## View Toolbar# ###############################
  1842. # ########################################################################
  1843. self.replot_btn = self.toolbarview.addAction(
  1844. QtGui.QIcon(self.app.resource_location + '/replot32.png'), _("Replot"))
  1845. self.clear_plot_btn = self.toolbarview.addAction(
  1846. QtGui.QIcon(self.app.resource_location + '/clear_plot32.png'), _("Clear plot"))
  1847. self.zoom_in_btn = self.toolbarview.addAction(
  1848. QtGui.QIcon(self.app.resource_location + '/zoom_in32.png'), _("Zoom In"))
  1849. self.zoom_out_btn = self.toolbarview.addAction(
  1850. QtGui.QIcon(self.app.resource_location + '/zoom_out32.png'), _("Zoom Out"))
  1851. self.zoom_fit_btn = self.toolbarview.addAction(
  1852. QtGui.QIcon(self.app.resource_location + '/zoom_fit32.png'), _("Zoom Fit"))
  1853. # ########################################################################
  1854. # ########################## Shell Toolbar# ##############################
  1855. # ########################################################################
  1856. self.shell_btn = self.toolbarshell.addAction(
  1857. QtGui.QIcon(self.app.resource_location + '/shell32.png'), _("Command Line"))
  1858. self.new_script_btn = self.toolbarshell.addAction(
  1859. QtGui.QIcon(self.app.resource_location + '/script_new24.png'), _('New Script ...'))
  1860. self.open_script_btn = self.toolbarshell.addAction(
  1861. QtGui.QIcon(self.app.resource_location + '/open_script32.png'), _('Open Script ...'))
  1862. self.run_script_btn = self.toolbarshell.addAction(
  1863. QtGui.QIcon(self.app.resource_location + '/script16.png'), _('Run Script ...'))
  1864. # #########################################################################
  1865. # ######################### Tools Toolbar #################################
  1866. # #########################################################################
  1867. self.dblsided_btn = self.toolbartools.addAction(
  1868. QtGui.QIcon(self.app.resource_location + '/doubleside32.png'), _("2Sided Tool"))
  1869. self.align_btn = self.toolbartools.addAction(
  1870. QtGui.QIcon(self.app.resource_location + '/align32.png'), _("Align Objects Tool"))
  1871. self.extract_btn = self.toolbartools.addAction(
  1872. QtGui.QIcon(self.app.resource_location + '/extract_drill32.png'), _("Extract Drills Tool"))
  1873. self.cutout_btn = self.toolbartools.addAction(
  1874. QtGui.QIcon(self.app.resource_location + '/cut16_bis.png'), _("Cutout Tool"))
  1875. self.ncc_btn = self.toolbartools.addAction(
  1876. QtGui.QIcon(self.app.resource_location + '/ncc16.png'), _("NCC Tool"))
  1877. self.paint_btn = self.toolbartools.addAction(
  1878. QtGui.QIcon(self.app.resource_location + '/paint20_1.png'), _("Paint Tool"))
  1879. self.isolation_btn = self.toolbartools.addAction(
  1880. QtGui.QIcon(self.app.resource_location + '/iso_16.png'), _("Isolation Tool"))
  1881. self.drill_btn = self.toolbartools.addAction(
  1882. QtGui.QIcon(self.app.resource_location + '/drilling_tool32.png'), _("Drilling Tool"))
  1883. self.toolbartools.addSeparator()
  1884. self.panelize_btn = self.toolbartools.addAction(
  1885. QtGui.QIcon(self.app.resource_location + '/panelize32.png'), _("Panel Tool"))
  1886. self.film_btn = self.toolbartools.addAction(
  1887. QtGui.QIcon(self.app.resource_location + '/film16.png'), _("Film Tool"))
  1888. self.solder_btn = self.toolbartools.addAction(
  1889. QtGui.QIcon(self.app.resource_location + '/solderpastebis32.png'), _("SolderPaste Tool"))
  1890. self.sub_btn = self.toolbartools.addAction(
  1891. QtGui.QIcon(self.app.resource_location + '/sub32.png'), _("Subtract Tool"))
  1892. self.rules_btn = self.toolbartools.addAction(
  1893. QtGui.QIcon(self.app.resource_location + '/rules32.png'), _("Rules Tool"))
  1894. self.optimal_btn = self.toolbartools.addAction(
  1895. QtGui.QIcon(self.app.resource_location + '/open_excellon32.png'), _("Optimal Tool"))
  1896. self.toolbartools.addSeparator()
  1897. self.calculators_btn = self.toolbartools.addAction(
  1898. QtGui.QIcon(self.app.resource_location + '/calculator24.png'), _("Calculators Tool"))
  1899. self.transform_btn = self.toolbartools.addAction(
  1900. QtGui.QIcon(self.app.resource_location + '/transform.png'), _("Transform Tool"))
  1901. self.qrcode_btn = self.toolbartools.addAction(
  1902. QtGui.QIcon(self.app.resource_location + '/qrcode32.png'), _("QRCode Tool"))
  1903. self.copperfill_btn = self.toolbartools.addAction(
  1904. QtGui.QIcon(self.app.resource_location + '/copperfill32.png'), _("Copper Thieving Tool"))
  1905. self.fiducials_btn = self.toolbartools.addAction(
  1906. QtGui.QIcon(self.app.resource_location + '/fiducials_32.png'), _("Fiducials Tool"))
  1907. self.cal_btn = self.toolbartools.addAction(
  1908. QtGui.QIcon(self.app.resource_location + '/calibrate_32.png'), _("Calibration Tool"))
  1909. self.punch_btn = self.toolbartools.addAction(
  1910. QtGui.QIcon(self.app.resource_location + '/punch32.png'), _("Punch Gerber Tool"))
  1911. self.invert_btn = self.toolbartools.addAction(
  1912. QtGui.QIcon(self.app.resource_location + '/invert32.png'), _("Invert Gerber Tool"))
  1913. self.corners_tool_btn = self.toolbartools.addAction(
  1914. QtGui.QIcon(self.app.resource_location + '/corners_32.png'), _("Corner Markers Tool"))
  1915. self.etch_btn = self.toolbartools.addAction(
  1916. QtGui.QIcon(self.app.resource_location + '/etch_32.png'), _("Etch Compensation Tool"))
  1917. # ########################################################################
  1918. # ################### Excellon Editor Toolbar ############################
  1919. # ########################################################################
  1920. self.select_drill_btn = self.exc_edit_toolbar.addAction(
  1921. QtGui.QIcon(self.app.resource_location + '/pointer32.png'), _("Select"))
  1922. self.add_drill_btn = self.exc_edit_toolbar.addAction(
  1923. QtGui.QIcon(self.app.resource_location + '/plus16.png'), _('Add Drill Hole'))
  1924. self.add_drill_array_btn = self.exc_edit_toolbar.addAction(
  1925. QtGui.QIcon(self.app.resource_location + '/addarray16.png'), _('Add Drill Hole Array'))
  1926. self.resize_drill_btn = self.exc_edit_toolbar.addAction(
  1927. QtGui.QIcon(self.app.resource_location + '/resize16.png'), _('Resize Drill'))
  1928. self.add_slot_btn = self.exc_edit_toolbar.addAction(
  1929. QtGui.QIcon(self.app.resource_location + '/slot26.png'), _('Add Slot'))
  1930. self.add_slot_array_btn = self.exc_edit_toolbar.addAction(
  1931. QtGui.QIcon(self.app.resource_location + '/slot_array26.png'), _('Add Slot Array'))
  1932. self.exc_edit_toolbar.addSeparator()
  1933. self.copy_drill_btn = self.exc_edit_toolbar.addAction(
  1934. QtGui.QIcon(self.app.resource_location + '/copy32.png'), _('Copy Drill'))
  1935. self.delete_drill_btn = self.exc_edit_toolbar.addAction(
  1936. QtGui.QIcon(self.app.resource_location + '/trash32.png'), _("Delete Drill"))
  1937. self.exc_edit_toolbar.addSeparator()
  1938. self.move_drill_btn = self.exc_edit_toolbar.addAction(
  1939. QtGui.QIcon(self.app.resource_location + '/move32.png'), _("Move Drill"))
  1940. # ########################################################################
  1941. # ################### Geometry Editor Toolbar ############################
  1942. # ########################################################################
  1943. self.geo_select_btn = self.geo_edit_toolbar.addAction(
  1944. QtGui.QIcon(self.app.resource_location + '/pointer32.png'), _("Select 'Esc'"))
  1945. self.geo_add_circle_btn = self.geo_edit_toolbar.addAction(
  1946. QtGui.QIcon(self.app.resource_location + '/circle32.png'), _('Add Circle'))
  1947. self.geo_add_arc_btn = self.geo_edit_toolbar.addAction(
  1948. QtGui.QIcon(self.app.resource_location + '/arc32.png'), _('Add Arc'))
  1949. self.geo_add_rectangle_btn = self.geo_edit_toolbar.addAction(
  1950. QtGui.QIcon(self.app.resource_location + '/rectangle32.png'), _('Add Rectangle'))
  1951. self.geo_edit_toolbar.addSeparator()
  1952. self.geo_add_path_btn = self.geo_edit_toolbar.addAction(
  1953. QtGui.QIcon(self.app.resource_location + '/path32.png'), _('Add Path'))
  1954. self.geo_add_polygon_btn = self.geo_edit_toolbar.addAction(
  1955. QtGui.QIcon(self.app.resource_location + '/polygon32.png'), _('Add Polygon'))
  1956. self.geo_edit_toolbar.addSeparator()
  1957. self.geo_add_text_btn = self.geo_edit_toolbar.addAction(
  1958. QtGui.QIcon(self.app.resource_location + '/text32.png'), _('Add Text'))
  1959. self.geo_add_buffer_btn = self.geo_edit_toolbar.addAction(
  1960. QtGui.QIcon(self.app.resource_location + '/buffer16-2.png'), _('Add Buffer'))
  1961. self.geo_add_paint_btn = self.geo_edit_toolbar.addAction(
  1962. QtGui.QIcon(self.app.resource_location + '/paint20_1.png'), _('Paint Shape'))
  1963. self.geo_eraser_btn = self.geo_edit_toolbar.addAction(
  1964. QtGui.QIcon(self.app.resource_location + '/eraser26.png'), _('Eraser'))
  1965. self.geo_edit_toolbar.addSeparator()
  1966. self.geo_union_btn = self.geo_edit_toolbar.addAction(
  1967. QtGui.QIcon(self.app.resource_location + '/union32.png'), _('Polygon Union'))
  1968. self.geo_explode_btn = self.geo_edit_toolbar.addAction(
  1969. QtGui.QIcon(self.app.resource_location + '/explode32.png'), _('Polygon Explode'))
  1970. self.geo_intersection_btn = self.geo_edit_toolbar.addAction(
  1971. QtGui.QIcon(self.app.resource_location + '/intersection32.png'), _('Polygon Intersection'))
  1972. self.geo_subtract_btn = self.geo_edit_toolbar.addAction(
  1973. QtGui.QIcon(self.app.resource_location + '/subtract32.png'), _('Polygon Subtraction'))
  1974. self.geo_edit_toolbar.addSeparator()
  1975. self.geo_cutpath_btn = self.geo_edit_toolbar.addAction(
  1976. QtGui.QIcon(self.app.resource_location + '/cutpath32.png'), _('Cut Path'))
  1977. self.geo_copy_btn = self.geo_edit_toolbar.addAction(
  1978. QtGui.QIcon(self.app.resource_location + '/copy32.png'), _("Copy Objects"))
  1979. self.geo_delete_btn = self.geo_edit_toolbar.addAction(
  1980. QtGui.QIcon(self.app.resource_location + '/trash32.png'), _("Delete Shape"))
  1981. self.geo_transform_btn = self.geo_edit_toolbar.addAction(
  1982. QtGui.QIcon(self.app.resource_location + '/transform.png'), _("Transformations"))
  1983. self.geo_edit_toolbar.addSeparator()
  1984. self.geo_move_btn = self.geo_edit_toolbar.addAction(
  1985. QtGui.QIcon(self.app.resource_location + '/move32.png'), _("Move Objects"))
  1986. # ########################################################################
  1987. # ################### Gerber Editor Toolbar ##############################
  1988. # ########################################################################
  1989. self.grb_select_btn = self.grb_edit_toolbar.addAction(
  1990. QtGui.QIcon(self.app.resource_location + '/pointer32.png'), _("Select"))
  1991. self.grb_add_pad_btn = self.grb_edit_toolbar.addAction(
  1992. QtGui.QIcon(self.app.resource_location + '/aperture32.png'), _("Add Pad"))
  1993. self.add_pad_ar_btn = self.grb_edit_toolbar.addAction(
  1994. QtGui.QIcon(self.app.resource_location + '/padarray32.png'), _('Add Pad Array'))
  1995. self.grb_add_track_btn = self.grb_edit_toolbar.addAction(
  1996. QtGui.QIcon(self.app.resource_location + '/track32.png'), _("Add Track"))
  1997. self.grb_add_region_btn = self.grb_edit_toolbar.addAction(
  1998. QtGui.QIcon(self.app.resource_location + '/polygon32.png'), _("Add Region"))
  1999. self.grb_convert_poly_btn = self.grb_edit_toolbar.addAction(
  2000. QtGui.QIcon(self.app.resource_location + '/poligonize32.png'), _("Poligonize"))
  2001. self.grb_add_semidisc_btn = self.grb_edit_toolbar.addAction(
  2002. QtGui.QIcon(self.app.resource_location + '/semidisc32.png'), _("SemiDisc"))
  2003. self.grb_add_disc_btn = self.grb_edit_toolbar.addAction(
  2004. QtGui.QIcon(self.app.resource_location + '/disc32.png'), _("Disc"))
  2005. self.grb_edit_toolbar.addSeparator()
  2006. self.aperture_buffer_btn = self.grb_edit_toolbar.addAction(
  2007. QtGui.QIcon(self.app.resource_location + '/buffer16-2.png'), _('Buffer'))
  2008. self.aperture_scale_btn = self.grb_edit_toolbar.addAction(
  2009. QtGui.QIcon(self.app.resource_location + '/scale32.png'), _('Scale'))
  2010. self.aperture_markarea_btn = self.grb_edit_toolbar.addAction(
  2011. QtGui.QIcon(self.app.resource_location + '/markarea32.png'), _('Mark Area'))
  2012. self.aperture_eraser_btn = self.grb_edit_toolbar.addAction(
  2013. QtGui.QIcon(self.app.resource_location + '/eraser26.png'), _('Eraser'))
  2014. self.grb_edit_toolbar.addSeparator()
  2015. self.aperture_copy_btn = self.grb_edit_toolbar.addAction(
  2016. QtGui.QIcon(self.app.resource_location + '/copy32.png'), _("Copy"))
  2017. self.aperture_delete_btn = self.grb_edit_toolbar.addAction(
  2018. QtGui.QIcon(self.app.resource_location + '/trash32.png'), _("Delete"))
  2019. self.grb_transform_btn = self.grb_edit_toolbar.addAction(
  2020. QtGui.QIcon(self.app.resource_location + '/transform.png'), _("Transformations"))
  2021. self.grb_edit_toolbar.addSeparator()
  2022. self.aperture_move_btn = self.grb_edit_toolbar.addAction(
  2023. QtGui.QIcon(self.app.resource_location + '/move32.png'), _("Move"))
  2024. self.corner_snap_btn.setVisible(False)
  2025. self.snap_magnet.setVisible(False)
  2026. qsettings = QSettings("Open Source", "FlatCAM")
  2027. if qsettings.contains("layout"):
  2028. layout = qsettings.value('layout', type=str)
  2029. # on 'minimal' layout only some toolbars are active
  2030. if layout != 'minimal':
  2031. self.exc_edit_toolbar.setVisible(True)
  2032. self.exc_edit_toolbar.setDisabled(True)
  2033. self.geo_edit_toolbar.setVisible(True)
  2034. self.geo_edit_toolbar.setDisabled(True)
  2035. self.grb_edit_toolbar.setVisible(True)
  2036. self.grb_edit_toolbar.setDisabled(True)
  2037. def keyPressEvent(self, event):
  2038. """
  2039. Key event handler for the entire app.
  2040. Some of the key events are also treated locally in the FlatCAM editors
  2041. :param event: QT event
  2042. :return:
  2043. """
  2044. modifiers = QtWidgets.QApplication.keyboardModifiers()
  2045. active = self.app.collection.get_active()
  2046. selected = self.app.collection.get_selected()
  2047. names_list = self.app.collection.get_names()
  2048. matplotlib_key_flag = False
  2049. # events out of the self.app.collection view (it's about Project Tab) are of type int
  2050. if type(event) is int:
  2051. key = event
  2052. # events from the GUI are of type QKeyEvent
  2053. elif type(event) == QtGui.QKeyEvent:
  2054. key = event.key()
  2055. elif isinstance(event, mpl_key_event): # MatPlotLib key events are trickier to interpret than the rest
  2056. matplotlib_key_flag = True
  2057. key = event.key
  2058. key = QtGui.QKeySequence(key)
  2059. # check for modifiers
  2060. key_string = key.toString().lower()
  2061. if '+' in key_string:
  2062. mod, __, key_text = key_string.rpartition('+')
  2063. if mod.lower() == 'ctrl':
  2064. modifiers = QtCore.Qt.ControlModifier
  2065. elif mod.lower() == 'alt':
  2066. modifiers = QtCore.Qt.AltModifier
  2067. elif mod.lower() == 'shift':
  2068. modifiers = QtCore.Qt.ShiftModifier
  2069. else:
  2070. modifiers = QtCore.Qt.NoModifier
  2071. key = QtGui.QKeySequence(key_text)
  2072. # events from Vispy are of type KeyEvent
  2073. else:
  2074. key = event.key
  2075. if self.app.call_source == 'app':
  2076. # CTRL + ALT
  2077. if modifiers == QtCore.Qt.ControlModifier | QtCore.Qt.AltModifier:
  2078. if key == QtCore.Qt.Key_X:
  2079. self.app.abort_all_tasks()
  2080. return
  2081. # CTRL + SHIFT
  2082. if modifiers == QtCore.Qt.ControlModifier | QtCore.Qt.ShiftModifier:
  2083. if key == QtCore.Qt.Key_S:
  2084. self.app.f_handlers.on_file_saveprojectas()
  2085. return
  2086. # CTRL
  2087. elif modifiers == QtCore.Qt.ControlModifier:
  2088. # Select All
  2089. if key == QtCore.Qt.Key_A:
  2090. self.app.on_selectall()
  2091. # Copy an FlatCAM object
  2092. if key == QtCore.Qt.Key_C:
  2093. widget_name = self.plot_tab_area.currentWidget().objectName()
  2094. if widget_name == 'database_tab':
  2095. # Tools DB saved, update flag
  2096. self.app.tools_db_changed_flag = True
  2097. self.app.tools_db_tab.on_tool_copy()
  2098. return
  2099. self.app.on_copy_command()
  2100. # Copy an FlatCAM object
  2101. if key == QtCore.Qt.Key_D:
  2102. self.app.on_tools_database()
  2103. # Open Excellon file
  2104. if key == QtCore.Qt.Key_E:
  2105. self.app.f_handlers.on_fileopenexcellon(signal=None)
  2106. # Open Gerber file
  2107. if key == QtCore.Qt.Key_G:
  2108. widget_name = self.plot_tab_area.currentWidget().objectName()
  2109. if 'editor' in widget_name.lower():
  2110. self.app.goto_text_line()
  2111. else:
  2112. self.app.f_handlers.on_fileopengerber(signal=None)
  2113. # Distance Tool
  2114. if key == QtCore.Qt.Key_M:
  2115. self.app.distance_tool.run()
  2116. # Create New Project
  2117. if key == QtCore.Qt.Key_N:
  2118. self.app.f_handlers.on_file_new_click()
  2119. # Open Project
  2120. if key == QtCore.Qt.Key_O:
  2121. self.app.f_handlers.on_file_openproject(signal=None)
  2122. # Open Project
  2123. if key == QtCore.Qt.Key_P:
  2124. self.app.f_handlers.on_file_save_objects_pdf(use_thread=True)
  2125. # PDF Import
  2126. if key == QtCore.Qt.Key_Q:
  2127. self.app.pdf_tool.run()
  2128. # Save Project
  2129. if key == QtCore.Qt.Key_S:
  2130. widget_name = self.plot_tab_area.currentWidget().objectName()
  2131. if widget_name == 'preferences_tab':
  2132. self.app.preferencesUiManager.on_save_button(save_to_file=False)
  2133. return
  2134. if widget_name == 'database_tab':
  2135. # Tools DB saved, update flag
  2136. self.app.tools_db_changed_flag = False
  2137. self.app.tools_db_tab.on_save_tools_db()
  2138. return
  2139. self.app.f_handlers.on_file_saveproject()
  2140. # Toggle Plot Area
  2141. if key == QtCore.Qt.Key_F10 or key == 'F10':
  2142. self.on_toggle_plotarea()
  2143. return
  2144. # SHIFT
  2145. elif modifiers == QtCore.Qt.ShiftModifier:
  2146. # Toggle axis
  2147. if key == QtCore.Qt.Key_A:
  2148. self.app.plotcanvas.on_toggle_axis()
  2149. # Copy Object Name
  2150. if key == QtCore.Qt.Key_C:
  2151. self.app.on_copy_name()
  2152. # Toggle Code Editor
  2153. if key == QtCore.Qt.Key_E:
  2154. self.app.on_toggle_code_editor()
  2155. # Toggle Grid lines
  2156. if key == QtCore.Qt.Key_G:
  2157. self.app.plotcanvas.on_toggle_grid_lines()
  2158. return
  2159. # Toggle HUD (Heads-Up Display)
  2160. if key == QtCore.Qt.Key_H:
  2161. self.app.plotcanvas.on_toggle_hud()
  2162. # Locate in Object
  2163. if key == QtCore.Qt.Key_J:
  2164. self.app.on_locate(obj=self.app.collection.get_active())
  2165. # Run Distance Minimum Tool
  2166. if key == QtCore.Qt.Key_M:
  2167. self.app.distance_min_tool.run()
  2168. return
  2169. # Open Preferences Window
  2170. if key == QtCore.Qt.Key_P:
  2171. self.app.on_preferences()
  2172. return
  2173. # Rotate Object by 90 degree CCW
  2174. if key == QtCore.Qt.Key_R:
  2175. self.app.on_rotate(silent=True, preset=-float(self.app.defaults['tools_transform_rotate']))
  2176. return
  2177. # Run a Script
  2178. if key == QtCore.Qt.Key_S:
  2179. self.app.f_handlers.on_filerunscript()
  2180. return
  2181. # Toggle Workspace
  2182. if key == QtCore.Qt.Key_W:
  2183. self.app.on_workspace_toggle()
  2184. return
  2185. # Skew on X axis
  2186. if key == QtCore.Qt.Key_X:
  2187. self.app.on_skewx()
  2188. return
  2189. # Skew on Y axis
  2190. if key == QtCore.Qt.Key_Y:
  2191. self.app.on_skewy()
  2192. return
  2193. # ALT
  2194. elif modifiers == QtCore.Qt.AltModifier:
  2195. # Eanble all plots
  2196. if key == Qt.Key_1:
  2197. self.app.enable_all_plots()
  2198. # Disable all plots
  2199. if key == Qt.Key_2:
  2200. self.app.disable_all_plots()
  2201. # Disable all other plots
  2202. if key == Qt.Key_3:
  2203. self.app.enable_other_plots()
  2204. # Disable all other plots
  2205. if key == Qt.Key_4:
  2206. self.app.disable_other_plots()
  2207. # Align in Object Tool
  2208. if key == QtCore.Qt.Key_A:
  2209. self.app.align_objects_tool.run(toggle=True)
  2210. # Calculator Tool
  2211. if key == QtCore.Qt.Key_C:
  2212. self.app.calculator_tool.run(toggle=True)
  2213. # 2-Sided PCB Tool
  2214. if key == QtCore.Qt.Key_D:
  2215. self.app.dblsidedtool.run(toggle=True)
  2216. return
  2217. # Extract Drills Tool
  2218. if key == QtCore.Qt.Key_E:
  2219. # self.app.cal_exc_tool.run(toggle=True)
  2220. self.app.edrills_tool.run(toggle=True)
  2221. return
  2222. # Fiducials Tool
  2223. if key == QtCore.Qt.Key_F:
  2224. self.app.fiducial_tool.run(toggle=True)
  2225. return
  2226. # Punch Gerber Tool
  2227. if key == QtCore.Qt.Key_G:
  2228. self.app.invert_tool.run(toggle=True)
  2229. # Punch Gerber Tool
  2230. if key == QtCore.Qt.Key_H:
  2231. self.app.punch_tool.run(toggle=True)
  2232. # Isolation Tool
  2233. if key == QtCore.Qt.Key_I:
  2234. self.app.isolation_tool.run(toggle=True)
  2235. # Copper Thieving Tool
  2236. if key == QtCore.Qt.Key_J:
  2237. self.app.copper_thieving_tool.run(toggle=True)
  2238. return
  2239. # Solder Paste Dispensing Tool
  2240. if key == QtCore.Qt.Key_K:
  2241. self.app.paste_tool.run(toggle=True)
  2242. return
  2243. # Film Tool
  2244. if key == QtCore.Qt.Key_L:
  2245. self.app.film_tool.run(toggle=True)
  2246. return
  2247. # Corner Markers Tool
  2248. if key == QtCore.Qt.Key_M:
  2249. self.app.corners_tool.run(toggle=True)
  2250. return
  2251. # Non-Copper Clear Tool
  2252. if key == QtCore.Qt.Key_N:
  2253. self.app.ncclear_tool.run(toggle=True)
  2254. return
  2255. # Optimal Tool
  2256. if key == QtCore.Qt.Key_O:
  2257. self.app.optimal_tool.run(toggle=True)
  2258. return
  2259. # Paint Tool
  2260. if key == QtCore.Qt.Key_P:
  2261. self.app.paint_tool.run(toggle=True)
  2262. return
  2263. # QRCode Tool
  2264. if key == QtCore.Qt.Key_Q:
  2265. self.app.qrcode_tool.run()
  2266. return
  2267. # Rules Tool
  2268. if key == QtCore.Qt.Key_R:
  2269. self.app.rules_tool.run(toggle=True)
  2270. return
  2271. # View Source Object Content
  2272. if key == QtCore.Qt.Key_S:
  2273. self.app.on_view_source()
  2274. return
  2275. # Transformation Tool
  2276. if key == QtCore.Qt.Key_T:
  2277. self.app.transform_tool.run(toggle=True)
  2278. return
  2279. # Substract Tool
  2280. if key == QtCore.Qt.Key_W:
  2281. self.app.sub_tool.run(toggle=True)
  2282. return
  2283. # Cutout Tool
  2284. if key == QtCore.Qt.Key_X:
  2285. self.app.cutout_tool.run(toggle=True)
  2286. return
  2287. # Panelize Tool
  2288. if key == QtCore.Qt.Key_Z:
  2289. self.app.panelize_tool.run(toggle=True)
  2290. return
  2291. # Toggle Fullscreen
  2292. if key == QtCore.Qt.Key_F10 or key == 'F10':
  2293. self.on_fullscreen()
  2294. return
  2295. # NO MODIFIER
  2296. elif modifiers == QtCore.Qt.NoModifier:
  2297. # Open Manual
  2298. if key == QtCore.Qt.Key_F1 or key == 'F1':
  2299. webbrowser.open(self.app.manual_url)
  2300. # Show shortcut list
  2301. if key == QtCore.Qt.Key_F3 or key == 'F3':
  2302. self.app.on_shortcut_list()
  2303. # Open Video Help
  2304. if key == QtCore.Qt.Key_F4 or key == 'F4':
  2305. webbrowser.open(self.app.video_url)
  2306. # Open Video Help
  2307. if key == QtCore.Qt.Key_F5 or key == 'F5':
  2308. self.app.plot_all()
  2309. # Switch to Project Tab
  2310. if key == QtCore.Qt.Key_1:
  2311. self.app.on_select_tab('project')
  2312. # Switch to Selected Tab
  2313. if key == QtCore.Qt.Key_2:
  2314. self.app.on_select_tab('properties')
  2315. # Switch to Tool Tab
  2316. if key == QtCore.Qt.Key_3:
  2317. self.app.on_select_tab('tool')
  2318. # Delete from PyQt
  2319. # It's meant to make a difference between delete objects and delete tools in
  2320. # Geometry Selected tool table
  2321. if key == QtCore.Qt.Key_Delete and matplotlib_key_flag is False:
  2322. widget_name = self.plot_tab_area.currentWidget().objectName()
  2323. if widget_name == 'database_tab':
  2324. # Tools DB saved, update flag
  2325. self.app.tools_db_changed_flag = True
  2326. self.app.tools_db_tab.on_tool_delete()
  2327. return
  2328. self.app.on_delete_keypress()
  2329. # Delete from canvas
  2330. if key == 'Delete':
  2331. # Delete via the application to
  2332. # ensure cleanup of the appGUI
  2333. if active:
  2334. active.app.on_delete()
  2335. # Escape = Deselect All
  2336. if key == QtCore.Qt.Key_Escape or key == 'Escape':
  2337. self.app.on_deselect_all()
  2338. # if in full screen, exit to normal view
  2339. if self.toggle_fscreen is True:
  2340. self.on_fullscreen(disable=True)
  2341. # try to disconnect the slot from Set Origin
  2342. try:
  2343. self.app.plotcanvas.graph_event_disconnect('mouse_press', self.app.on_set_zero_click)
  2344. except TypeError:
  2345. pass
  2346. self.app.inform.emit("")
  2347. # Space = Toggle Active/Inactive
  2348. if key == QtCore.Qt.Key_Space:
  2349. for select in selected:
  2350. select.ui.plot_cb.toggle()
  2351. QtWidgets.QApplication.processEvents()
  2352. self.app.collection.update_view()
  2353. self.app.delete_selection_shape()
  2354. # Select the object in the Tree above the current one
  2355. if key == QtCore.Qt.Key_Up:
  2356. # make sure it works only for the Project Tab who is an instance of KeySensitiveListView
  2357. focused_wdg = QtWidgets.QApplication.focusWidget()
  2358. if isinstance(focused_wdg, KeySensitiveListView):
  2359. self.app.collection.set_all_inactive()
  2360. if active is None:
  2361. return
  2362. active_name = active.options['name']
  2363. active_index = names_list.index(active_name)
  2364. if active_index == 0:
  2365. self.app.collection.set_active(names_list[-1])
  2366. else:
  2367. self.app.collection.set_active(names_list[active_index - 1])
  2368. # Select the object in the Tree below the current one
  2369. if key == QtCore.Qt.Key_Down:
  2370. # make sure it works only for the Project Tab who is an instance of KeySensitiveListView
  2371. focused_wdg = QtWidgets.QApplication.focusWidget()
  2372. if isinstance(focused_wdg, KeySensitiveListView):
  2373. self.app.collection.set_all_inactive()
  2374. if active is None:
  2375. return
  2376. active_name = active.options['name']
  2377. active_index = names_list.index(active_name)
  2378. if active_index == len(names_list) - 1:
  2379. self.app.collection.set_active(names_list[0])
  2380. else:
  2381. self.app.collection.set_active(names_list[active_index + 1])
  2382. # New Geometry
  2383. if key == QtCore.Qt.Key_B:
  2384. self.app.app_obj.new_gerber_object()
  2385. # New Document Object
  2386. if key == QtCore.Qt.Key_D:
  2387. self.app.app_obj.new_document_object()
  2388. # Copy Object Name
  2389. if key == QtCore.Qt.Key_E:
  2390. self.app.object2editor()
  2391. # Grid toggle
  2392. if key == QtCore.Qt.Key_G:
  2393. self.app.ui.grid_snap_btn.trigger()
  2394. # Jump to coords
  2395. if key == QtCore.Qt.Key_J:
  2396. self.app.on_jump_to()
  2397. # New Excellon
  2398. if key == QtCore.Qt.Key_L:
  2399. self.app.app_obj.new_excellon_object()
  2400. # Move tool toggle
  2401. if key == QtCore.Qt.Key_M:
  2402. self.app.move_tool.toggle()
  2403. # New Geometry
  2404. if key == QtCore.Qt.Key_N:
  2405. self.app.app_obj.new_geometry_object()
  2406. # Set Origin
  2407. if key == QtCore.Qt.Key_O:
  2408. self.app.on_set_origin()
  2409. return
  2410. # Properties Tool
  2411. if key == QtCore.Qt.Key_P:
  2412. self.app.properties_tool.run()
  2413. return
  2414. # Change Units
  2415. if key == QtCore.Qt.Key_Q:
  2416. # if self.app.defaults["units"] == 'MM':
  2417. # self.app.ui.general_defaults_form.general_app_group.units_radio.set_value("IN")
  2418. # else:
  2419. # self.app.ui.general_defaults_form.general_app_group.units_radio.set_value("MM")
  2420. # self.app.on_toggle_units(no_pref=True)
  2421. self.app.on_toggle_units_click()
  2422. # Rotate Object by 90 degree CW
  2423. if key == QtCore.Qt.Key_R:
  2424. self.app.on_rotate(silent=True, preset=self.app.defaults['tools_transform_rotate'])
  2425. # Shell toggle
  2426. if key == QtCore.Qt.Key_S:
  2427. self.toggle_shell_ui()
  2428. # Add a Tool from shortcut
  2429. if key == QtCore.Qt.Key_T:
  2430. widget_name = self.plot_tab_area.currentWidget().objectName()
  2431. if widget_name == 'database_tab':
  2432. # Tools DB saved, update flag
  2433. self.app.tools_db_changed_flag = True
  2434. self.app.tools_db_tab.on_tool_add()
  2435. return
  2436. self.app.on_tool_add_keypress()
  2437. # Zoom Fit
  2438. if key == QtCore.Qt.Key_V:
  2439. self.app.on_zoom_fit()
  2440. # Mirror on X the selected object(s)
  2441. if key == QtCore.Qt.Key_X:
  2442. self.app.on_flipx()
  2443. # Mirror on Y the selected object(s)
  2444. if key == QtCore.Qt.Key_Y:
  2445. self.app.on_flipy()
  2446. # Zoom In
  2447. if key == QtCore.Qt.Key_Equal:
  2448. self.app.plotcanvas.zoom(1 / self.app.defaults['global_zoom_ratio'], self.app.mouse)
  2449. # Zoom Out
  2450. if key == QtCore.Qt.Key_Minus:
  2451. self.app.plotcanvas.zoom(self.app.defaults['global_zoom_ratio'], self.app.mouse)
  2452. # toggle display of Notebook area
  2453. if key == QtCore.Qt.Key_QuoteLeft:
  2454. self.on_toggle_notebook()
  2455. return
  2456. elif self.app.call_source == 'geo_editor':
  2457. # CTRL
  2458. if modifiers == QtCore.Qt.ControlModifier:
  2459. # save (update) the current geometry and return to the App
  2460. if key == QtCore.Qt.Key_S or key == 'S':
  2461. self.app.editor2object()
  2462. return
  2463. # toggle the measurement tool
  2464. if key == QtCore.Qt.Key_M or key == 'M':
  2465. self.app.distance_tool.run()
  2466. return
  2467. # Cut Action Tool
  2468. if key == QtCore.Qt.Key_X or key == 'X':
  2469. if self.app.geo_editor.get_selected() is not None:
  2470. self.app.geo_editor.cutpath()
  2471. else:
  2472. msg = _('Please first select a geometry item to be cutted\n'
  2473. 'then select the geometry item that will be cutted\n'
  2474. 'out of the first item. In the end press ~X~ key or\n'
  2475. 'the toolbar button.')
  2476. messagebox = QtWidgets.QMessageBox()
  2477. messagebox.setText(msg)
  2478. messagebox.setWindowTitle(_("Warning"))
  2479. messagebox.setWindowIcon(QtGui.QIcon(self.app.resource_location + '/warning.png'))
  2480. messagebox.setIcon(QtWidgets.QMessageBox.Question)
  2481. messagebox.setStandardButtons(QtWidgets.QMessageBox.Ok)
  2482. messagebox.setDefaultButton(QtWidgets.QMessageBox.Ok)
  2483. messagebox.exec_()
  2484. return
  2485. # SHIFT
  2486. elif modifiers == QtCore.Qt.ShiftModifier:
  2487. # Run Distance Minimum Tool
  2488. if key == QtCore.Qt.Key_M or key == 'M':
  2489. self.app.distance_min_tool.run()
  2490. return
  2491. # Skew on X axis
  2492. if key == QtCore.Qt.Key_X or key == 'X':
  2493. self.app.geo_editor.transform_tool.on_skewx_key()
  2494. return
  2495. # Skew on Y axis
  2496. if key == QtCore.Qt.Key_Y or key == 'Y':
  2497. self.app.geo_editor.transform_tool.on_skewy_key()
  2498. return
  2499. # ALT
  2500. elif modifiers == QtCore.Qt.AltModifier:
  2501. # Transformation Tool
  2502. if key == QtCore.Qt.Key_R or key == 'R':
  2503. self.app.geo_editor.select_tool('transform')
  2504. return
  2505. # Offset on X axis
  2506. if key == QtCore.Qt.Key_X or key == 'X':
  2507. self.app.geo_editor.transform_tool.on_offx_key()
  2508. return
  2509. # Offset on Y axis
  2510. if key == QtCore.Qt.Key_Y or key == 'Y':
  2511. self.app.geo_editor.transform_tool.on_offy_key()
  2512. return
  2513. # NO MODIFIER
  2514. elif modifiers == QtCore.Qt.NoModifier:
  2515. # toggle display of Notebook area
  2516. if key == QtCore.Qt.Key_QuoteLeft or key == '`':
  2517. self.on_toggle_notebook()
  2518. # Finish the current action. Use with tools that do not
  2519. # complete automatically, like a polygon or path.
  2520. if key == QtCore.Qt.Key_Enter or key == 'Enter':
  2521. if isinstance(self.app.geo_editor.active_tool, FCShapeTool):
  2522. if self.app.geo_editor.active_tool.name == 'rotate':
  2523. self.app.geo_editor.active_tool.make()
  2524. if self.app.geo_editor.active_tool.complete:
  2525. self.app.geo_editor.on_shape_complete()
  2526. self.app.inform.emit('[success] %s' % _("Done."))
  2527. # automatically make the selection tool active after completing current action
  2528. self.app.geo_editor.select_tool('select')
  2529. return
  2530. else:
  2531. self.app.geo_editor.active_tool.click(
  2532. self.app.geo_editor.snap(self.app.geo_editor.x, self.app.geo_editor.y))
  2533. self.app.geo_editor.active_tool.make()
  2534. if self.app.geo_editor.active_tool.complete:
  2535. self.app.geo_editor.on_shape_complete()
  2536. self.app.inform.emit('[success] %s' % _("Done."))
  2537. # automatically make the selection tool active after completing current action
  2538. self.app.geo_editor.select_tool('select')
  2539. # Abort the current action
  2540. if key == QtCore.Qt.Key_Escape or key == 'Escape':
  2541. # self.on_tool_select("select")
  2542. self.app.inform.emit('[WARNING_NOTCL] %s' % _("Cancelled."))
  2543. self.app.geo_editor.delete_utility_geometry()
  2544. self.app.geo_editor.active_tool.clean_up()
  2545. self.app.geo_editor.select_tool('select')
  2546. # hide the notebook
  2547. self.app.ui.splitter.setSizes([0, 1])
  2548. return
  2549. # Delete selected object
  2550. if key == QtCore.Qt.Key_Delete or key == 'Delete':
  2551. self.app.geo_editor.delete_selected()
  2552. self.app.geo_editor.replot()
  2553. # Rotate
  2554. if key == QtCore.Qt.Key_Space or key == 'Space':
  2555. self.app.geo_editor.transform_tool.on_rotate_key()
  2556. # Zoom Out
  2557. if key == QtCore.Qt.Key_Minus or key == '-':
  2558. self.app.plotcanvas.zoom(1 / self.app.defaults['global_zoom_ratio'],
  2559. [self.app.geo_editor.snap_x, self.app.geo_editor.snap_y])
  2560. # Zoom In
  2561. if key == QtCore.Qt.Key_Equal or key == '=':
  2562. self.app.plotcanvas.zoom(self.app.defaults['global_zoom_ratio'],
  2563. [self.app.geo_editor.snap_x, self.app.geo_editor.snap_y])
  2564. # Switch to Project Tab
  2565. if key == QtCore.Qt.Key_1 or key == '1':
  2566. self.app.on_select_tab('project')
  2567. # Switch to Selected Tab
  2568. if key == QtCore.Qt.Key_2 or key == '2':
  2569. self.app.on_select_tab('selected')
  2570. # Switch to Tool Tab
  2571. if key == QtCore.Qt.Key_3 or key == '3':
  2572. self.app.on_select_tab('tool')
  2573. # Grid Snap
  2574. if key == QtCore.Qt.Key_G or key == 'G':
  2575. self.app.ui.grid_snap_btn.trigger()
  2576. # make sure that the cursor shape is enabled/disabled, too
  2577. if self.app.geo_editor.options['grid_snap'] is True:
  2578. self.app.app_cursor.enabled = True
  2579. else:
  2580. self.app.app_cursor.enabled = False
  2581. # Corner Snap
  2582. if key == QtCore.Qt.Key_K or key == 'K':
  2583. self.app.geo_editor.on_corner_snap()
  2584. if key == QtCore.Qt.Key_V or key == 'V':
  2585. self.app.on_zoom_fit()
  2586. # we do this so we can reuse the following keys while inside a Tool
  2587. # the above keys are general enough so were left outside
  2588. if self.app.geo_editor.active_tool is not None and self.geo_select_btn.isChecked() is False:
  2589. response = self.app.geo_editor.active_tool.on_key(key=key)
  2590. if response is not None:
  2591. self.app.inform.emit(response)
  2592. else:
  2593. # Arc Tool
  2594. if key == QtCore.Qt.Key_A or key == 'A':
  2595. self.app.geo_editor.select_tool('arc')
  2596. # Buffer
  2597. if key == QtCore.Qt.Key_B or key == 'B':
  2598. self.app.geo_editor.select_tool('buffer')
  2599. # Copy
  2600. if key == QtCore.Qt.Key_C or key == 'C':
  2601. self.app.geo_editor.on_copy_click()
  2602. # Substract Tool
  2603. if key == QtCore.Qt.Key_E or key == 'E':
  2604. if self.app.geo_editor.get_selected() is not None:
  2605. self.app.geo_editor.intersection()
  2606. else:
  2607. msg = _("Please select geometry items \n"
  2608. "on which to perform Intersection Tool.")
  2609. messagebox = QtWidgets.QMessageBox()
  2610. messagebox.setText(msg)
  2611. messagebox.setWindowTitle(_("Warning"))
  2612. messagebox.setWindowIcon(QtGui.QIcon(self.app.resource_location + '/warning.png'))
  2613. messagebox.setIcon(QtWidgets.QMessageBox.Warning)
  2614. messagebox.setStandardButtons(QtWidgets.QMessageBox.Ok)
  2615. messagebox.setDefaultButton(QtWidgets.QMessageBox.Ok)
  2616. messagebox.exec_()
  2617. # Paint
  2618. if key == QtCore.Qt.Key_I or key == 'I':
  2619. self.app.geo_editor.select_tool('paint')
  2620. # Jump to coords
  2621. if key == QtCore.Qt.Key_J or key == 'J':
  2622. self.app.on_jump_to()
  2623. # Move
  2624. if key == QtCore.Qt.Key_M or key == 'M':
  2625. self.app.geo_editor.on_move_click()
  2626. # Polygon Tool
  2627. if key == QtCore.Qt.Key_N or key == 'N':
  2628. self.app.geo_editor.select_tool('polygon')
  2629. # Circle Tool
  2630. if key == QtCore.Qt.Key_O or key == 'O':
  2631. self.app.geo_editor.select_tool('circle')
  2632. # Path Tool
  2633. if key == QtCore.Qt.Key_P or key == 'P':
  2634. self.app.geo_editor.select_tool('path')
  2635. # Rectangle Tool
  2636. if key == QtCore.Qt.Key_R or key == 'R':
  2637. self.app.geo_editor.select_tool('rectangle')
  2638. # Substract Tool
  2639. if key == QtCore.Qt.Key_S or key == 'S':
  2640. if self.app.geo_editor.get_selected() is not None:
  2641. self.app.geo_editor.subtract()
  2642. else:
  2643. msg = _(
  2644. "Please select geometry items \n"
  2645. "on which to perform Substraction Tool.")
  2646. messagebox = QtWidgets.QMessageBox()
  2647. messagebox.setText(msg)
  2648. messagebox.setWindowTitle(_("Warning"))
  2649. messagebox.setWindowIcon(QtGui.QIcon(self.app.resource_location + '/warning.png'))
  2650. messagebox.setIcon(QtWidgets.QMessageBox.Warning)
  2651. messagebox.setStandardButtons(QtWidgets.QMessageBox.Ok)
  2652. messagebox.setDefaultButton(QtWidgets.QMessageBox.Ok)
  2653. messagebox.exec_()
  2654. # Add Text Tool
  2655. if key == QtCore.Qt.Key_T or key == 'T':
  2656. self.app.geo_editor.select_tool('text')
  2657. # Substract Tool
  2658. if key == QtCore.Qt.Key_U or key == 'U':
  2659. if self.app.geo_editor.get_selected() is not None:
  2660. self.app.geo_editor.union()
  2661. else:
  2662. msg = _("Please select geometry items \n"
  2663. "on which to perform union.")
  2664. messagebox = QtWidgets.QMessageBox()
  2665. messagebox.setText(msg)
  2666. messagebox.setWindowTitle(_("Warning"))
  2667. messagebox.setWindowIcon(QtGui.QIcon(self.app.resource_location + '/warning.png'))
  2668. messagebox.setIcon(QtWidgets.QMessageBox.Warning)
  2669. messagebox.setStandardButtons(QtWidgets.QMessageBox.Ok)
  2670. messagebox.setDefaultButton(QtWidgets.QMessageBox.Ok)
  2671. messagebox.exec_()
  2672. # Flip on X axis
  2673. if key == QtCore.Qt.Key_X or key == 'X':
  2674. self.app.geo_editor.transform_tool.on_flipx()
  2675. return
  2676. # Flip on Y axis
  2677. if key == QtCore.Qt.Key_Y or key == 'Y':
  2678. self.app.geo_editor.transform_tool.on_flipy()
  2679. return
  2680. # Show Shortcut list
  2681. if key == 'F3':
  2682. self.app.on_shortcut_list()
  2683. elif self.app.call_source == 'grb_editor':
  2684. # CTRL
  2685. if modifiers == QtCore.Qt.ControlModifier:
  2686. # Eraser Tool
  2687. if key == QtCore.Qt.Key_E or key == 'E':
  2688. self.app.grb_editor.on_eraser()
  2689. return
  2690. # save (update) the current geometry and return to the App
  2691. if key == QtCore.Qt.Key_S or key == 'S':
  2692. self.app.editor2object()
  2693. return
  2694. # toggle the measurement tool
  2695. if key == QtCore.Qt.Key_M or key == 'M':
  2696. self.app.distance_tool.run()
  2697. return
  2698. # SHIFT
  2699. elif modifiers == QtCore.Qt.ShiftModifier:
  2700. # Run Distance Minimum Tool
  2701. if key == QtCore.Qt.Key_M or key == 'M':
  2702. self.app.distance_min_tool.run()
  2703. return
  2704. # ALT
  2705. elif modifiers == QtCore.Qt.AltModifier:
  2706. # Mark Area Tool
  2707. if key == QtCore.Qt.Key_A or key == 'A':
  2708. self.app.grb_editor.on_markarea()
  2709. return
  2710. # Poligonize Tool
  2711. if key == QtCore.Qt.Key_N or key == 'N':
  2712. self.app.grb_editor.on_poligonize()
  2713. return
  2714. # Transformation Tool
  2715. if key == QtCore.Qt.Key_R or key == 'R':
  2716. self.app.grb_editor.on_transform()
  2717. return
  2718. # NO MODIFIER
  2719. elif modifiers == QtCore.Qt.NoModifier:
  2720. # Abort the current action
  2721. if key == QtCore.Qt.Key_Escape or key == 'Escape':
  2722. # self.on_tool_select("select")
  2723. self.app.inform.emit('[WARNING_NOTCL] %s' % _("Cancelled."))
  2724. self.app.grb_editor.delete_utility_geometry()
  2725. # self.app.grb_editor.plot_all()
  2726. self.app.grb_editor.active_tool.clean_up()
  2727. self.app.grb_editor.select_tool('select')
  2728. return
  2729. # Delete selected object if delete key event comes out of canvas
  2730. if key == 'Delete':
  2731. self.app.grb_editor.launched_from_shortcuts = True
  2732. if self.app.grb_editor.selected:
  2733. self.app.grb_editor.delete_selected()
  2734. self.app.grb_editor.plot_all()
  2735. else:
  2736. self.app.inform.emit('[WARNING_NOTCL] %s' % _("Cancelled. Nothing selected to delete."))
  2737. return
  2738. # Delete aperture in apertures table if delete key event comes from the Selected Tab
  2739. if key == QtCore.Qt.Key_Delete:
  2740. self.app.grb_editor.launched_from_shortcuts = True
  2741. self.app.grb_editor.on_aperture_delete()
  2742. return
  2743. if key == QtCore.Qt.Key_Minus or key == '-':
  2744. self.app.grb_editor.launched_from_shortcuts = True
  2745. self.app.plotcanvas.zoom(1 / self.app.defaults['global_zoom_ratio'],
  2746. [self.app.grb_editor.snap_x, self.app.grb_editor.snap_y])
  2747. return
  2748. if key == QtCore.Qt.Key_Equal or key == '=':
  2749. self.app.grb_editor.launched_from_shortcuts = True
  2750. self.app.plotcanvas.zoom(self.app.defaults['global_zoom_ratio'],
  2751. [self.app.grb_editor.snap_x, self.app.grb_editor.snap_y])
  2752. return
  2753. # toggle display of Notebook area
  2754. if key == QtCore.Qt.Key_QuoteLeft or key == '`':
  2755. self.app.grb_editor.launched_from_shortcuts = True
  2756. self.on_toggle_notebook()
  2757. return
  2758. # Rotate
  2759. if key == QtCore.Qt.Key_Space or key == 'Space':
  2760. self.app.grb_editor.transform_tool.on_rotate_key()
  2761. # Switch to Project Tab
  2762. if key == QtCore.Qt.Key_1 or key == '1':
  2763. self.app.grb_editor.launched_from_shortcuts = True
  2764. self.app.on_select_tab('project')
  2765. return
  2766. # Switch to Selected Tab
  2767. if key == QtCore.Qt.Key_2 or key == '2':
  2768. self.app.grb_editor.launched_from_shortcuts = True
  2769. self.app.on_select_tab('selected')
  2770. return
  2771. # Switch to Tool Tab
  2772. if key == QtCore.Qt.Key_3 or key == '3':
  2773. self.app.grb_editor.launched_from_shortcuts = True
  2774. self.app.on_select_tab('tool')
  2775. return
  2776. # we do this so we can reuse the following keys while inside a Tool
  2777. # the above keys are general enough so were left outside
  2778. if self.app.grb_editor.active_tool is not None and self.grb_select_btn.isChecked() is False:
  2779. response = self.app.grb_editor.active_tool.on_key(key=key)
  2780. if response is not None:
  2781. self.app.inform.emit(response)
  2782. else:
  2783. # Add Array of pads
  2784. if key == QtCore.Qt.Key_A or key == 'A':
  2785. self.app.grb_editor.launched_from_shortcuts = True
  2786. self.app.inform.emit("Click on target point.")
  2787. self.app.ui.add_pad_ar_btn.setChecked(True)
  2788. self.app.grb_editor.x = self.app.mouse[0]
  2789. self.app.grb_editor.y = self.app.mouse[1]
  2790. self.app.grb_editor.select_tool('array')
  2791. return
  2792. # Scale Tool
  2793. if key == QtCore.Qt.Key_B or key == 'B':
  2794. self.app.grb_editor.launched_from_shortcuts = True
  2795. self.app.grb_editor.select_tool('buffer')
  2796. return
  2797. # Copy
  2798. if key == QtCore.Qt.Key_C or key == 'C':
  2799. self.app.grb_editor.launched_from_shortcuts = True
  2800. if self.app.grb_editor.selected:
  2801. self.app.inform.emit(_("Click on target point."))
  2802. self.app.ui.aperture_copy_btn.setChecked(True)
  2803. self.app.grb_editor.on_tool_select('copy')
  2804. self.app.grb_editor.active_tool.set_origin(
  2805. (self.app.grb_editor.snap_x, self.app.grb_editor.snap_y))
  2806. else:
  2807. self.app.inform.emit('[WARNING_NOTCL] %s' % _("Cancelled. Nothing selected to copy."))
  2808. return
  2809. # Add Disc Tool
  2810. if key == QtCore.Qt.Key_D or key == 'D':
  2811. self.app.grb_editor.launched_from_shortcuts = True
  2812. self.app.grb_editor.select_tool('disc')
  2813. return
  2814. # Add SemiDisc Tool
  2815. if key == QtCore.Qt.Key_E or key == 'E':
  2816. self.app.grb_editor.launched_from_shortcuts = True
  2817. self.app.grb_editor.select_tool('semidisc')
  2818. return
  2819. # Grid Snap
  2820. if key == QtCore.Qt.Key_G or key == 'G':
  2821. self.app.grb_editor.launched_from_shortcuts = True
  2822. # make sure that the cursor shape is enabled/disabled, too
  2823. if self.app.grb_editor.options['grid_snap'] is True:
  2824. self.app.app_cursor.enabled = False
  2825. else:
  2826. self.app.app_cursor.enabled = True
  2827. self.app.ui.grid_snap_btn.trigger()
  2828. return
  2829. # Jump to coords
  2830. if key == QtCore.Qt.Key_J or key == 'J':
  2831. self.app.on_jump_to()
  2832. # Corner Snap
  2833. if key == QtCore.Qt.Key_K or key == 'K':
  2834. self.app.grb_editor.launched_from_shortcuts = True
  2835. self.app.ui.corner_snap_btn.trigger()
  2836. return
  2837. # Move
  2838. if key == QtCore.Qt.Key_M or key == 'M':
  2839. self.app.grb_editor.launched_from_shortcuts = True
  2840. if self.app.grb_editor.selected:
  2841. self.app.inform.emit(_("Click on target point."))
  2842. self.app.ui.aperture_move_btn.setChecked(True)
  2843. self.app.grb_editor.on_tool_select('move')
  2844. self.app.grb_editor.active_tool.set_origin(
  2845. (self.app.grb_editor.snap_x, self.app.grb_editor.snap_y))
  2846. else:
  2847. self.app.inform.emit('[WARNING_NOTCL] %s' % _("Cancelled. Nothing selected to move."))
  2848. return
  2849. # Add Region Tool
  2850. if key == QtCore.Qt.Key_N or key == 'N':
  2851. self.app.grb_editor.launched_from_shortcuts = True
  2852. self.app.grb_editor.select_tool('region')
  2853. return
  2854. # Add Pad Tool
  2855. if key == QtCore.Qt.Key_P or key == 'P':
  2856. self.app.grb_editor.launched_from_shortcuts = True
  2857. self.app.inform.emit(_("Click on target point."))
  2858. self.app.ui.add_pad_ar_btn.setChecked(True)
  2859. self.app.grb_editor.x = self.app.mouse[0]
  2860. self.app.grb_editor.y = self.app.mouse[1]
  2861. self.app.grb_editor.select_tool('pad')
  2862. return
  2863. # Scale Tool
  2864. if key == QtCore.Qt.Key_S or key == 'S':
  2865. self.app.grb_editor.launched_from_shortcuts = True
  2866. self.app.grb_editor.select_tool('scale')
  2867. return
  2868. # Add Track
  2869. if key == QtCore.Qt.Key_T or key == 'T':
  2870. self.app.grb_editor.launched_from_shortcuts = True
  2871. # ## Current application units in Upper Case
  2872. self.app.grb_editor.select_tool('track')
  2873. return
  2874. # Zoom fit
  2875. if key == QtCore.Qt.Key_V or key == 'V':
  2876. self.app.grb_editor.launched_from_shortcuts = True
  2877. self.app.grb_editor.on_zoom_fit()
  2878. return
  2879. # Show Shortcut list
  2880. if key == QtCore.Qt.Key_F3 or key == 'F3':
  2881. self.app.on_shortcut_list()
  2882. return
  2883. elif self.app.call_source == 'exc_editor':
  2884. # CTRL
  2885. if modifiers == QtCore.Qt.ControlModifier:
  2886. # save (update) the current geometry and return to the App
  2887. if key == QtCore.Qt.Key_S or key == 'S':
  2888. self.app.editor2object()
  2889. return
  2890. # toggle the measurement tool
  2891. if key == QtCore.Qt.Key_M or key == 'M':
  2892. self.app.distance_tool.run()
  2893. return
  2894. # SHIFT
  2895. elif modifiers == QtCore.Qt.ShiftModifier:
  2896. # Run Distance Minimum Tool
  2897. if key == QtCore.Qt.Key_M or key == 'M':
  2898. self.app.distance_min_tool.run()
  2899. return
  2900. # ALT
  2901. elif modifiers == QtCore.Qt.AltModifier:
  2902. pass
  2903. # NO MODIFIER
  2904. elif modifiers == QtCore.Qt.NoModifier:
  2905. # Abort the current action
  2906. if key == QtCore.Qt.Key_Escape or key == 'Escape':
  2907. self.app.inform.emit('[WARNING_NOTCL] %s' % _("Cancelled."))
  2908. self.app.exc_editor.delete_utility_geometry()
  2909. self.app.exc_editor.active_tool.clean_up()
  2910. self.app.exc_editor.select_tool('drill_select')
  2911. return
  2912. # Delete selected object if delete key event comes out of canvas
  2913. if key == 'Delete':
  2914. self.app.exc_editor.launched_from_shortcuts = True
  2915. if self.app.exc_editor.selected:
  2916. self.app.exc_editor.delete_selected()
  2917. self.app.exc_editor.replot()
  2918. else:
  2919. self.app.inform.emit('[WARNING_NOTCL] %s' % _("Cancelled. Nothing selected to delete."))
  2920. return
  2921. # Delete tools in tools table if delete key event comes from the Selected Tab
  2922. if key == QtCore.Qt.Key_Delete:
  2923. self.app.exc_editor.launched_from_shortcuts = True
  2924. self.app.exc_editor.on_tool_delete()
  2925. return
  2926. if key == QtCore.Qt.Key_Minus or key == '-':
  2927. self.app.exc_editor.launched_from_shortcuts = True
  2928. self.app.plotcanvas.zoom(1 / self.app.defaults['global_zoom_ratio'],
  2929. [self.app.exc_editor.snap_x, self.app.exc_editor.snap_y])
  2930. return
  2931. if key == QtCore.Qt.Key_Equal or key == '=':
  2932. self.app.exc_editor.launched_from_shortcuts = True
  2933. self.app.plotcanvas.zoom(self.app.defaults['global_zoom_ratio'],
  2934. [self.app.exc_editor.snap_x, self.app.exc_editor.snap_y])
  2935. return
  2936. # toggle display of Notebook area
  2937. if key == QtCore.Qt.Key_QuoteLeft or key == '`':
  2938. self.app.exc_editor.launched_from_shortcuts = True
  2939. self.on_toggle_notebook()
  2940. return
  2941. # Switch to Project Tab
  2942. if key == QtCore.Qt.Key_1 or key == '1':
  2943. self.app.exc_editor.launched_from_shortcuts = True
  2944. self.app.on_select_tab('project')
  2945. return
  2946. # Switch to Selected Tab
  2947. if key == QtCore.Qt.Key_2 or key == '2':
  2948. self.app.exc_editor.launched_from_shortcuts = True
  2949. self.app.on_select_tab('selected')
  2950. return
  2951. # Switch to Tool Tab
  2952. if key == QtCore.Qt.Key_3 or key == '3':
  2953. self.app.exc_editor.launched_from_shortcuts = True
  2954. self.app.on_select_tab('tool')
  2955. return
  2956. # Grid Snap
  2957. if key == QtCore.Qt.Key_G or key == 'G':
  2958. self.app.exc_editor.launched_from_shortcuts = True
  2959. # make sure that the cursor shape is enabled/disabled, too
  2960. if self.app.exc_editor.options['grid_snap'] is True:
  2961. self.app.app_cursor.enabled = False
  2962. else:
  2963. self.app.app_cursor.enabled = True
  2964. self.app.ui.grid_snap_btn.trigger()
  2965. return
  2966. # Corner Snap
  2967. if key == QtCore.Qt.Key_K or key == 'K':
  2968. self.app.exc_editor.launched_from_shortcuts = True
  2969. self.app.ui.corner_snap_btn.trigger()
  2970. return
  2971. # Zoom Fit
  2972. if key == QtCore.Qt.Key_V or key == 'V':
  2973. self.app.exc_editor.launched_from_shortcuts = True
  2974. self.app.on_zoom_fit()
  2975. return
  2976. # Add Slot Hole Tool
  2977. if key == QtCore.Qt.Key_W or key == 'W':
  2978. self.app.exc_editor.launched_from_shortcuts = True
  2979. self.app.inform.emit(_("Click on target point."))
  2980. self.app.ui.add_slot_btn.setChecked(True)
  2981. self.app.exc_editor.x = self.app.mouse[0]
  2982. self.app.exc_editor.y = self.app.mouse[1]
  2983. self.app.exc_editor.select_tool('slot_add')
  2984. return
  2985. # Propagate to tool
  2986. # Show Shortcut list
  2987. if key == QtCore.Qt.Key_F3 or key == 'F3':
  2988. self.app.on_shortcut_list()
  2989. return
  2990. # we do this so we can reuse the following keys while inside a Tool
  2991. # the above keys are general enough so were left outside
  2992. if self.app.exc_editor.active_tool is not None and self.select_drill_btn.isChecked() is False:
  2993. response = self.app.exc_editor.active_tool.on_key(key=key)
  2994. if response is not None:
  2995. self.app.inform.emit(response)
  2996. else:
  2997. # Add Array of Drill Hole Tool
  2998. if key == QtCore.Qt.Key_A or key == 'A':
  2999. self.app.exc_editor.launched_from_shortcuts = True
  3000. self.app.inform.emit("Click on target point.")
  3001. self.app.ui.add_drill_array_btn.setChecked(True)
  3002. self.app.exc_editor.x = self.app.mouse[0]
  3003. self.app.exc_editor.y = self.app.mouse[1]
  3004. self.app.exc_editor.select_tool('drill_array')
  3005. return
  3006. # Copy
  3007. if key == QtCore.Qt.Key_C or key == 'C':
  3008. self.app.exc_editor.launched_from_shortcuts = True
  3009. if self.app.exc_editor.selected:
  3010. self.app.inform.emit(_("Click on target point."))
  3011. self.app.ui.copy_drill_btn.setChecked(True)
  3012. self.app.exc_editor.on_tool_select('drill_copy')
  3013. self.app.exc_editor.active_tool.set_origin(
  3014. (self.app.exc_editor.snap_x, self.app.exc_editor.snap_y))
  3015. else:
  3016. self.app.inform.emit('[WARNING_NOTCL] %s' % _("Cancelled. Nothing selected to copy."))
  3017. return
  3018. # Add Drill Hole Tool
  3019. if key == QtCore.Qt.Key_D or key == 'D':
  3020. self.app.exc_editor.launched_from_shortcuts = True
  3021. self.app.inform.emit(_("Click on target point."))
  3022. self.app.ui.add_drill_btn.setChecked(True)
  3023. self.app.exc_editor.x = self.app.mouse[0]
  3024. self.app.exc_editor.y = self.app.mouse[1]
  3025. self.app.exc_editor.select_tool('drill_add')
  3026. return
  3027. # Jump to coords
  3028. if key == QtCore.Qt.Key_J or key == 'J':
  3029. self.app.on_jump_to()
  3030. # Move
  3031. if key == QtCore.Qt.Key_M or key == 'M':
  3032. self.app.exc_editor.launched_from_shortcuts = True
  3033. if self.app.exc_editor.selected:
  3034. self.app.inform.emit(_("Click on target point."))
  3035. self.app.ui.move_drill_btn.setChecked(True)
  3036. self.app.exc_editor.on_tool_select('drill_move')
  3037. self.app.exc_editor.active_tool.set_origin(
  3038. (self.app.exc_editor.snap_x, self.app.exc_editor.snap_y))
  3039. else:
  3040. self.app.inform.emit('[WARNING_NOTCL] %s' % _("Cancelled. Nothing selected to move."))
  3041. return
  3042. # Add Array of Slots Hole Tool
  3043. if key == QtCore.Qt.Key_Q or key == 'Q':
  3044. self.app.exc_editor.launched_from_shortcuts = True
  3045. self.app.inform.emit("Click on target point.")
  3046. self.app.ui.add_slot_array_btn.setChecked(True)
  3047. self.app.exc_editor.x = self.app.mouse[0]
  3048. self.app.exc_editor.y = self.app.mouse[1]
  3049. self.app.exc_editor.select_tool('slot_array')
  3050. return
  3051. # Resize Tool
  3052. if key == QtCore.Qt.Key_R or key == 'R':
  3053. self.app.exc_editor.launched_from_shortcuts = True
  3054. self.app.exc_editor.select_tool('drill_resize')
  3055. return
  3056. # Add Tool
  3057. if key == QtCore.Qt.Key_T or key == 'T':
  3058. self.app.exc_editor.launched_from_shortcuts = True
  3059. # ## Current application units in Upper Case
  3060. self.units = self.general_defaults_form.general_app_group.units_radio.get_value().upper()
  3061. tool_add_popup = FCInputDialog(title=_("New Tool ..."),
  3062. text='%s:' % _('Enter a Tool Diameter'),
  3063. min=0.0000, max=99.9999, decimals=4)
  3064. tool_add_popup.setWindowIcon(QtGui.QIcon(self.app.resource_location + '/letter_t_32.png'))
  3065. val, ok = tool_add_popup.get_value()
  3066. if ok:
  3067. self.app.exc_editor.on_tool_add(tooldia=val)
  3068. formated_val = '%.*f' % (self.decimals, float(val))
  3069. self.app.inform.emit(
  3070. '[success] %s: %s %s' % (_("Added new tool with dia"), formated_val, str(self.units))
  3071. )
  3072. else:
  3073. self.app.inform.emit('[WARNING_NOTCL] %s' % _("Adding Tool cancelled ..."))
  3074. return
  3075. elif self.app.call_source == 'gcode_editor':
  3076. # CTRL
  3077. if modifiers == QtCore.Qt.ControlModifier:
  3078. # save (update) the current geometry and return to the App
  3079. if key == QtCore.Qt.Key_S or key == 'S':
  3080. self.app.editor2object()
  3081. return
  3082. # SHIFT
  3083. elif modifiers == QtCore.Qt.ShiftModifier:
  3084. pass
  3085. # ALT
  3086. elif modifiers == QtCore.Qt.AltModifier:
  3087. pass
  3088. # NO MODIFIER
  3089. elif modifiers == QtCore.Qt.NoModifier:
  3090. pass
  3091. elif self.app.call_source == 'measurement':
  3092. if modifiers == QtCore.Qt.ControlModifier:
  3093. pass
  3094. elif modifiers == QtCore.Qt.AltModifier:
  3095. pass
  3096. elif modifiers == QtCore.Qt.ShiftModifier:
  3097. pass
  3098. # NO MODIFIER
  3099. elif modifiers == QtCore.Qt.NoModifier:
  3100. if key == QtCore.Qt.Key_Escape or key == 'Escape':
  3101. # abort the measurement action
  3102. self.app.distance_tool.deactivate_measure_tool()
  3103. self.app.inform.emit(_("Distance Tool exit..."))
  3104. return
  3105. if key == QtCore.Qt.Key_G or key == 'G':
  3106. self.app.ui.grid_snap_btn.trigger()
  3107. return
  3108. # Jump to coords
  3109. if key == QtCore.Qt.Key_J or key == 'J':
  3110. self.app.on_jump_to()
  3111. elif self.app.call_source == 'qrcode_tool':
  3112. # CTRL + ALT
  3113. if modifiers == QtCore.Qt.ControlModifier | QtCore.Qt.AltModifier:
  3114. if key == QtCore.Qt.Key_X:
  3115. self.app.abort_all_tasks()
  3116. return
  3117. elif modifiers == QtCore.Qt.ControlModifier:
  3118. pass
  3119. elif modifiers == QtCore.Qt.ShiftModifier:
  3120. pass
  3121. elif modifiers == QtCore.Qt.AltModifier:
  3122. pass
  3123. # NO MODIFIER
  3124. elif modifiers == QtCore.Qt.NoModifier:
  3125. # Escape = Deselect All
  3126. if key == QtCore.Qt.Key_Escape or key == 'Escape':
  3127. self.app.qrcode_tool.on_exit()
  3128. # Grid toggle
  3129. if key == QtCore.Qt.Key_G:
  3130. self.app.ui.grid_snap_btn.trigger()
  3131. # Jump to coords
  3132. if key == QtCore.Qt.Key_J:
  3133. self.app.on_jump_to()
  3134. elif self.app.call_source == 'copper_thieving_tool':
  3135. # CTRL + ALT
  3136. if modifiers == QtCore.Qt.ControlModifier | QtCore.Qt.AltModifier:
  3137. if key == QtCore.Qt.Key_X:
  3138. self.app.abort_all_tasks()
  3139. return
  3140. elif modifiers == QtCore.Qt.ControlModifier:
  3141. pass
  3142. elif modifiers == QtCore.Qt.ShiftModifier:
  3143. pass
  3144. elif modifiers == QtCore.Qt.AltModifier:
  3145. pass
  3146. # NO MODIFIER
  3147. elif modifiers == QtCore.Qt.NoModifier:
  3148. # Escape = Deselect All
  3149. if key == QtCore.Qt.Key_Escape or key == 'Escape':
  3150. self.app.copperfill_tool.on_exit()
  3151. # Grid toggle
  3152. if key == QtCore.Qt.Key_G:
  3153. self.app.ui.grid_snap_btn.trigger()
  3154. # Jump to coords
  3155. if key == QtCore.Qt.Key_J:
  3156. self.app.on_jump_to()
  3157. elif self.app.call_source == 'geometry':
  3158. if modifiers == QtCore.Qt.ControlModifier:
  3159. pass
  3160. elif modifiers == QtCore.Qt.AltModifier:
  3161. pass
  3162. elif modifiers == QtCore.Qt.ShiftModifier:
  3163. pass
  3164. # NO MODIFIER
  3165. elif modifiers == QtCore.Qt.NoModifier:
  3166. if key == QtCore.Qt.Key_Escape or key == 'Escape':
  3167. sel_obj = self.app.collection.get_active()
  3168. assert sel_obj.kind == 'geometry' or sel_obj.kind == 'excellon', \
  3169. "Expected a Geometry or Excellon Object, got %s" % type(sel_obj)
  3170. sel_obj.area_disconnect()
  3171. return
  3172. if key == QtCore.Qt.Key_G or key == 'G':
  3173. self.app.ui.grid_snap_btn.trigger()
  3174. return
  3175. # Jump to coords
  3176. if key == QtCore.Qt.Key_J or key == 'J':
  3177. self.app.on_jump_to()
  3178. def createPopupMenu(self):
  3179. menu = super().createPopupMenu()
  3180. menu.addSeparator()
  3181. menu.addAction(self.lock_action)
  3182. return menu
  3183. def lock_toolbar(self, lock=False):
  3184. """
  3185. Used to (un)lock the toolbars of the app.
  3186. :param lock: boolean, will lock all toolbars in place when set True
  3187. :return: None
  3188. """
  3189. if lock:
  3190. for widget in self.children():
  3191. if isinstance(widget, QtWidgets.QToolBar):
  3192. widget.setMovable(False)
  3193. else:
  3194. for widget in self.children():
  3195. if isinstance(widget, QtWidgets.QToolBar):
  3196. widget.setMovable(True)
  3197. def dragEnterEvent(self, event):
  3198. if event.mimeData().hasUrls:
  3199. event.accept()
  3200. else:
  3201. event.ignore()
  3202. def dragMoveEvent(self, event):
  3203. if event.mimeData().hasUrls:
  3204. event.accept()
  3205. else:
  3206. event.ignore()
  3207. def dropEvent(self, event):
  3208. if event.mimeData().hasUrls:
  3209. event.setDropAction(QtCore.Qt.CopyAction)
  3210. event.accept()
  3211. for url in event.mimeData().urls():
  3212. self.filename = str(url.toLocalFile())
  3213. if self.filename == "":
  3214. self.app.inform.emit("Cancelled.")
  3215. else:
  3216. extension = self.filename.lower().rpartition('.')[-1]
  3217. if extension in self.app.grb_list:
  3218. self.app.worker_task.emit({'fcn': self.app.f_handlers.open_gerber,
  3219. 'params': [self.filename]})
  3220. else:
  3221. event.ignore()
  3222. if extension in self.app.exc_list:
  3223. self.app.worker_task.emit({'fcn': self.app.f_handlers.open_excellon,
  3224. 'params': [self.filename]})
  3225. else:
  3226. event.ignore()
  3227. if extension in self.app.gcode_list:
  3228. self.app.worker_task.emit({'fcn': self.app.f_handlers.open_gcode,
  3229. 'params': [self.filename]})
  3230. else:
  3231. event.ignore()
  3232. if extension in self.app.svg_list:
  3233. object_type = 'geometry'
  3234. self.app.worker_task.emit({'fcn': self.app.f_handlers.import_svg,
  3235. 'params': [self.filename, object_type, None]})
  3236. if extension in self.app.dxf_list:
  3237. object_type = 'geometry'
  3238. self.app.worker_task.emit({'fcn': self.app.f_handlers.import_dxf,
  3239. 'params': [self.filename, object_type, None]})
  3240. if extension in self.app.pdf_list:
  3241. self.app.pdf_tool.periodic_check(1000)
  3242. self.app.worker_task.emit({'fcn': self.app.pdf_tool.open_pdf,
  3243. 'params': [self.filename]})
  3244. if extension in self.app.prj_list:
  3245. # self.app.open_project() is not Thread Safe
  3246. self.app.f_handlers.open_project(self.filename)
  3247. if extension in self.app.conf_list:
  3248. self.app.f_handlers.open_config_file(self.filename)
  3249. else:
  3250. event.ignore()
  3251. else:
  3252. event.ignore()
  3253. def closeEvent(self, event):
  3254. if self.app.save_in_progress:
  3255. self.app.inform.emit('[WARNING_NOTCL] %s' % _("Application is saving the project. Please wait ..."))
  3256. else:
  3257. grect = self.geometry()
  3258. # self.splitter.sizes()[0] is actually the size of the "notebook"
  3259. if not self.isMaximized():
  3260. self.geom_update.emit(grect.x(), grect.y(), grect.width(), grect.height(), self.splitter.sizes()[0])
  3261. self.final_save.emit()
  3262. event.ignore()
  3263. def on_fullscreen(self, disable=False):
  3264. """
  3265. :param disable:
  3266. :return:
  3267. """
  3268. flags = self.windowFlags()
  3269. if self.toggle_fscreen is False and disable is False:
  3270. # self.ui.showFullScreen()
  3271. self.setWindowFlags(flags | Qt.FramelessWindowHint)
  3272. a = self.geometry()
  3273. self.x_pos = a.x()
  3274. self.y_pos = a.y()
  3275. self.width = a.width()
  3276. self.height = a.height()
  3277. self.titlebar_height = self.app.qapp.style().pixelMetric(QtWidgets.QStyle.PM_TitleBarHeight)
  3278. # set new geometry to full desktop rect
  3279. # Subtracting and adding the pixels below it's hack to bypass a bug in Qt5 and OpenGL that made that a
  3280. # window drawn with OpenGL in fullscreen will not show any other windows on top which means that menus and
  3281. # everything else will not work without this hack. This happen in Windows.
  3282. # https://bugreports.qt.io/browse/QTBUG-41309
  3283. desktop = self.app.qapp.desktop()
  3284. screen = desktop.screenNumber(QtGui.QCursor.pos())
  3285. rec = desktop.screenGeometry(screen)
  3286. x = rec.x() - 1
  3287. y = rec.y() - 1
  3288. h = rec.height() + 2
  3289. w = rec.width() + 2
  3290. self.setGeometry(x, y, w, h)
  3291. self.show()
  3292. # hide all Toolbars
  3293. for tb in self.findChildren(QtWidgets.QToolBar):
  3294. tb.setVisible(False)
  3295. self.coords_toolbar.setVisible(self.app.defaults["global_coordsbar_show"])
  3296. self.delta_coords_toolbar.setVisible(self.app.defaults["global_delta_coordsbar_show"])
  3297. self.grid_toolbar.setVisible(self.app.defaults["global_gridbar_show"])
  3298. self.status_toolbar.setVisible(self.app.defaults["global_statusbar_show"])
  3299. self.splitter.setSizes([0, 1])
  3300. self.toggle_fscreen = True
  3301. elif self.toggle_fscreen is True or disable is True:
  3302. self.setWindowFlags(flags & ~Qt.FramelessWindowHint)
  3303. # the additions are made to account for the pixels we subtracted/added above in the (x, y, h, w)
  3304. self.setGeometry(self.x_pos+1, self.y_pos+self.titlebar_height+4, self.width, self.height)
  3305. self.showNormal()
  3306. self.restore_toolbar_view()
  3307. self.toggle_fscreen = False
  3308. def on_toggle_plotarea(self):
  3309. """
  3310. :return:
  3311. """
  3312. try:
  3313. name = self.plot_tab_area.widget(0).objectName()
  3314. except AttributeError:
  3315. self.plot_tab_area.addTab(self.plot_tab, _("Plot Area"))
  3316. # remove the close button from the Plot Area tab (first tab index = 0) as this one will always be ON
  3317. self.plot_tab_area.protectTab(0)
  3318. return
  3319. if name != 'plotarea_tab':
  3320. self.plot_tab_area.insertTab(0, self.plot_tab, _("Plot Area"))
  3321. # remove the close button from the Plot Area tab (first tab index = 0) as this one will always be ON
  3322. self.plot_tab_area.protectTab(0)
  3323. else:
  3324. self.plot_tab_area.closeTab(0)
  3325. def on_toggle_notebook(self):
  3326. """
  3327. :return:
  3328. """
  3329. if self.splitter.sizes()[0] == 0:
  3330. self.splitter.setSizes([1, 1])
  3331. self.menu_toggle_nb.setChecked(True)
  3332. else:
  3333. self.splitter.setSizes([0, 1])
  3334. self.menu_toggle_nb.setChecked(False)
  3335. def on_toggle_grid(self):
  3336. """
  3337. :return:
  3338. """
  3339. self.grid_snap_btn.trigger()
  3340. def toggle_shell_ui(self):
  3341. """
  3342. Toggle shell dock: if is visible close it, if it is closed then open it
  3343. :return: None
  3344. """
  3345. if self.shell_dock.isVisible():
  3346. self.shell_dock.hide()
  3347. self.app.plotcanvas.native.setFocus()
  3348. else:
  3349. self.shell_dock.show()
  3350. # I want to take the focus and give it to the Tcl Shell when the Tcl Shell is run
  3351. # self.shell._edit.setFocus()
  3352. QtCore.QTimer.singleShot(0, lambda: self.shell_dock.widget()._edit.setFocus())
  3353. # HACK - simulate a mouse click - alternative
  3354. # no_km = QtCore.Qt.KeyboardModifier(QtCore.Qt.NoModifier) # no KB modifier
  3355. # pos = QtCore.QPoint((self.shell._edit.width() - 40), (self.shell._edit.height() - 2))
  3356. # e = QtGui.QMouseEvent(QtCore.QEvent.MouseButtonPress, pos, QtCore.Qt.LeftButton, QtCore.Qt.LeftButton,
  3357. # no_km)
  3358. # QtWidgets.qApp.sendEvent(self.shell._edit, e)
  3359. # f = QtGui.QMouseEvent(QtCore.QEvent.MouseButtonRelease, pos, QtCore.Qt.LeftButton, QtCore.Qt.LeftButton,
  3360. # no_km)
  3361. # QtWidgets.qApp.sendEvent(self.shell._edit, f)
  3362. def on_shelldock_toggled(self, visibility):
  3363. if visibility is True:
  3364. self.shell_status_label.setStyleSheet("""
  3365. QLabel
  3366. {
  3367. color: black;
  3368. background-color: lightcoral;
  3369. }
  3370. """)
  3371. self.app.inform[str, bool].emit(_("Shell enabled."), False)
  3372. else:
  3373. self.shell_status_label.setStyleSheet("")
  3374. self.app.inform[str, bool].emit(_("Shell disabled."), False)
  3375. class ShortcutsTab(QtWidgets.QWidget):
  3376. def __init__(self):
  3377. super(ShortcutsTab, self).__init__()
  3378. self.sh_tab_layout = QtWidgets.QVBoxLayout()
  3379. self.sh_tab_layout.setContentsMargins(2, 2, 2, 2)
  3380. self.setLayout(self.sh_tab_layout)
  3381. self.sh_hlay = QtWidgets.QHBoxLayout()
  3382. self.sh_title = QtWidgets.QTextEdit(_('<b>Shortcut Key List</b>'))
  3383. self.sh_title.setTextInteractionFlags(QtCore.Qt.NoTextInteraction)
  3384. self.sh_title.setFrameStyle(QtWidgets.QFrame.NoFrame)
  3385. self.sh_title.setMaximumHeight(30)
  3386. font = self.sh_title.font()
  3387. font.setPointSize(12)
  3388. self.sh_title.setFont(font)
  3389. self.sh_tab_layout.addWidget(self.sh_title)
  3390. self.sh_tab_layout.addLayout(self.sh_hlay)
  3391. self.app_sh_msg = (
  3392. '''<b>%s</b><br>
  3393. <table border="0" cellpadding="0" cellspacing="0" style="width:283px">
  3394. <tbody>
  3395. <tr height="20">
  3396. <td height="20" width="89"><strong>%s</strong></td>
  3397. <td width="194"><span style="color:#006400"><strong>&nbsp;%s</strong></span></td>
  3398. </tr>
  3399. <tr height="20">
  3400. <td height="20">&nbsp;</td>
  3401. <td>&nbsp;</td>
  3402. </tr>
  3403. <tr height="20">
  3404. <td height="20"><strong>%s</strong></td>
  3405. <td>&nbsp;%s</td>
  3406. </tr>
  3407. <tr height="20">
  3408. <td height="20"><strong>%s</strong></td>
  3409. <td>&nbsp;%s</td>
  3410. </tr>
  3411. <tr height="20">
  3412. <td height="20"><strong>%s</strong></td>
  3413. <td>&nbsp;%s</td>
  3414. </tr>
  3415. <tr height="20">
  3416. <td height="20">&nbsp;</td>
  3417. <td>&nbsp;</td>
  3418. </tr>
  3419. <tr height="20">
  3420. <td height="20"><strong>%s</strong></td>
  3421. <td>&nbsp;%s</td>
  3422. </tr>
  3423. <tr height="20">
  3424. <td height="20"><strong>%s</strong></td>
  3425. <td>&nbsp;%s</td>
  3426. </tr>
  3427. <tr height="20">
  3428. <td height="20"><strong>%s</strong></td>
  3429. <td>&nbsp;%s</td>
  3430. </tr>
  3431. <tr height="20">
  3432. <td height="20"><strong>%s</strong></td>
  3433. <td>&nbsp;%s</td>
  3434. </tr>
  3435. <tr height="20">
  3436. <td height="20"><strong>%s</strong></td>
  3437. <td>&nbsp;%s</td>
  3438. </tr>
  3439. <tr height="20">
  3440. <td height="20"><strong>%s</strong></td>
  3441. <td>&nbsp;%s</td>
  3442. </tr>
  3443. <tr height="20">
  3444. <td height="20"><strong>%s</strong></td>
  3445. <td>&nbsp;%s</td>
  3446. </tr>
  3447. <tr height="20">
  3448. <td height="20"><strong>%s</strong></td>
  3449. <td>&nbsp;%s</td>
  3450. </tr>
  3451. <tr height="20">
  3452. <td height="20"><strong>%s</strong></td>
  3453. <td>&nbsp;%s</td>
  3454. </tr>
  3455. <tr height="20">
  3456. <td height="20"><strong>%s</strong></td>
  3457. <td>&nbsp;%s</td>
  3458. </tr>
  3459. <tr height="20">
  3460. <td height="20"><strong>%s</strong></td>
  3461. <td>&nbsp;%s</td>
  3462. </tr>
  3463. <tr height="20">
  3464. <td height="20"><strong>%s</strong></td>
  3465. <td>&nbsp;%s</td>
  3466. </tr>
  3467. <tr height="20">
  3468. <td height="20"><strong%s>T</strong></td>
  3469. <td>&nbsp;%s</td>
  3470. </tr>
  3471. <tr height="20">
  3472. <td height="20"><strong>%s</strong></td>
  3473. <td>&nbsp;%s</td>
  3474. </tr>
  3475. <tr height="20">
  3476. <td height="20"><strong>%s</strong></td>
  3477. <td>&nbsp;%s</td>
  3478. </tr>
  3479. <tr height="20">
  3480. <td height="20"><strong>%s</strong></td>
  3481. <td>&nbsp;%s</td>
  3482. </tr>
  3483. <tr height="20">
  3484. <td height="20"><strong>&#39;%s&#39;</strong></td>
  3485. <td>&nbsp;%s</td>
  3486. </tr>
  3487. <tr height="20">
  3488. <td height="20"><strong>&#39;%s&#39;</strong></td>
  3489. <td>&nbsp;%s</td>
  3490. </tr>
  3491. <tr height="20">
  3492. <td height="20">&nbsp;</td>
  3493. <td>&nbsp;</td>
  3494. </tr>
  3495. <tr height="20">
  3496. <td height="20"><strong>%s</strong></td>
  3497. <td>&nbsp;%s</td>
  3498. </tr>
  3499. <tr height="20">
  3500. <td height="20"><strong>%s</strong></td>
  3501. <td>&nbsp;%s</td>
  3502. </tr>
  3503. <tr height="20">
  3504. <td height="20"><strong>%s</strong></td>
  3505. <td>&nbsp;%s</td>
  3506. </tr>
  3507. <tr height="20">
  3508. <td height="20"><strong>%s</strong></td>
  3509. <td>&nbsp;%s</td>
  3510. </tr>
  3511. <tr height="20">
  3512. <td height="20"><strong>%s</strong></td>
  3513. <td>&nbsp;%s</td>
  3514. </tr>
  3515. <tr height="20">
  3516. <td height="20"><strong>%s</strong></td>
  3517. <td>&nbsp;%s</td>
  3518. </tr>
  3519. <tr height="20">
  3520. <td height="20"><strong>%s</strong></td>
  3521. <td>&nbsp;%s</td>
  3522. </tr>
  3523. <tr height="20">
  3524. <td height="20"><strong>%s</strong></td>
  3525. <td>&nbsp;%s</td>
  3526. </tr>
  3527. <tr height="20">
  3528. <td height="20"><strong>%s</strong></td>
  3529. <td>&nbsp;%s</td>
  3530. </tr>
  3531. <tr height="20">
  3532. <td height="20"><strong>%s</strong></td>
  3533. <td>&nbsp;%s</td>
  3534. </tr>
  3535. <tr height="20">
  3536. <td height="20"><strong>%s</strong></td>
  3537. <td>&nbsp;%s</td>
  3538. </tr>
  3539. <tr height="20">
  3540. <td height="20"><strong>%s</strong></td>
  3541. <td>&nbsp;%s</td>
  3542. </tr>
  3543. <tr height="20">
  3544. <td height="20">&nbsp;</td>
  3545. <td>&nbsp;</td>
  3546. </tr>
  3547. <tr height="20">
  3548. <td height="20"><strong>%s</strong></td>
  3549. <td>&nbsp;%s</td>
  3550. </tr>
  3551. <tr height="20">
  3552. <td height="20"><strong>%s</strong></td>
  3553. <td>&nbsp;%s</td>
  3554. </tr>
  3555. <tr height="20">
  3556. <td height="20"><strong>%s</strong></td>
  3557. <td>&nbsp;%s</td>
  3558. </tr>
  3559. <tr height="20">
  3560. <td height="20"><strong>%s</strong></td>
  3561. <td>&nbsp;%s</td>
  3562. </tr>
  3563. <tr height="20">
  3564. <td height="20"><strong>%s</strong></td>
  3565. <td>&nbsp;%s</td>
  3566. </tr>
  3567. <tr height="20">
  3568. <td height="20"><strong>%s</strong></td>
  3569. <td>&nbsp;%s</td>
  3570. </tr>
  3571. <tr height="20">
  3572. <td height="20"><strong>%s</strong></td>
  3573. <td>&nbsp;%s</td>
  3574. </tr>
  3575. <tr height="20">
  3576. <td height="20"><strong>%s</strong></td>
  3577. <td>&nbsp;%s</td>
  3578. </tr>
  3579. <tr height="20">
  3580. <td height="20"><strong>%s</strong></td>
  3581. <td>&nbsp;%s</td>
  3582. </tr>
  3583. <tr height="20">
  3584. <td height="20"><strong>%s</strong></td>
  3585. <td>&nbsp;%s</td>
  3586. </tr>
  3587. <tr height="20">
  3588. <td height="20"><strong>%s</strong></td>
  3589. <td>&nbsp;%s</td>
  3590. </tr>
  3591. <tr height="20">
  3592. <td height="20"><strong>%s</strong></td>
  3593. <td>&nbsp;%s</td>
  3594. </tr>
  3595. <tr height="20">
  3596. <td height="20"><strong>%s</strong></td>
  3597. <td>&nbsp;%s</td>
  3598. </tr>
  3599. <tr height="20">
  3600. <td height="20">&nbsp;</td>
  3601. <td>&nbsp;</td>
  3602. </tr>
  3603. <tr height="20">
  3604. <td height="20"><strong>%s</strong></td>
  3605. <td>&nbsp;%s</td>
  3606. </tr>
  3607. <tr height="20">
  3608. <td height="20"><strong>%s</strong></td>
  3609. <td>&nbsp;%s</td>
  3610. </tr>
  3611. <tr height="20">
  3612. <td height="20"><strong>%s</strong></td>
  3613. <td>&nbsp;%s</td>
  3614. </tr>
  3615. <tr height="20">
  3616. <td height="20"><strong>%s</strong></td>
  3617. <td>&nbsp;%s</td>
  3618. </tr>
  3619. </tr>
  3620. <tr height="20">
  3621. <td height="20"><strong>%s</strong></td>
  3622. <td>&nbsp;%s</td>
  3623. </tr>
  3624. </tr>
  3625. <tr height="20">
  3626. <td height="20"><strong>%s</strong></td>
  3627. <td>&nbsp;%s</td>
  3628. </tr>
  3629. <tr height="20">
  3630. <td height="20"><strong>%s</strong></td>
  3631. <td>&nbsp;%s</td>
  3632. </tr>
  3633. <tr height="20">
  3634. <td height="20"><strong>%s</strong></td>
  3635. <td>&nbsp;%s</td>
  3636. </tr>
  3637. <tr height="20">
  3638. <td height="20"><strong>%s</strong></td>
  3639. <td>&nbsp;%s</td>
  3640. </tr>
  3641. <tr height="20">
  3642. <td height="20"><strong>%s</strong></td>
  3643. <td>&nbsp;%s</td>
  3644. </tr>
  3645. <tr height="20">
  3646. <td height="20"><strong>%s</strong></td>
  3647. <td>&nbsp;%s</td>
  3648. </tr>
  3649. <tr height="20">
  3650. <td height="20"><strong>%s</strong></td>
  3651. <td>&nbsp;%s</td>
  3652. </tr>
  3653. <tr height="20">
  3654. <td height="20"><strong>%s</strong></td>
  3655. <td>&nbsp;%s</td>
  3656. </tr>
  3657. <tr height="20">
  3658. <td height="20"><strong>%s</strong></td>
  3659. <td>&nbsp;%s</td>
  3660. </tr>
  3661. <tr height="20">
  3662. <td height="20"><strong>%s</strong></td>
  3663. <td>&nbsp;%s</td>
  3664. </tr>
  3665. <tr height="20">
  3666. <td height="20"><strong>%s</strong></td>
  3667. <td>&nbsp;%s</td>
  3668. </tr>
  3669. <tr height="20">
  3670. <td height="20"><strong>%s</strong></td>
  3671. <td>&nbsp;%s</td>
  3672. </tr>
  3673. <tr height="20">
  3674. <td height="20"><strong>%s</strong></td>
  3675. <td>&nbsp;%s</td>
  3676. </tr>
  3677. <tr height="20">
  3678. <td height="20"><strong>%s</strong></td>
  3679. <td>&nbsp;%s</td>
  3680. </tr>
  3681. <tr height="20">
  3682. <td height="20"><strong>%s</strong></td>
  3683. <td>&nbsp;%s</td>
  3684. </tr>
  3685. <tr height="20">
  3686. <td height="20"><strong>%s</strong></td>
  3687. <td>&nbsp;%s</td>
  3688. </tr>
  3689. <tr height="20">
  3690. <td height="20"><strong>%s</strong></td>
  3691. <td>&nbsp;%s</td>
  3692. </tr>
  3693. <tr height="20">
  3694. <td height="20"><strong>%s</strong></td>
  3695. <td>&nbsp;%s</td>
  3696. </tr>
  3697. <tr height="20">
  3698. <td height="20"><strong>%s</strong></td>
  3699. <td>&nbsp;%s</td>
  3700. </tr>
  3701. <tr height="20">
  3702. <td height="20"><strong%s</strong></td>
  3703. <td>&nbsp;%s</td>
  3704. </tr>
  3705. <tr height="20">
  3706. <td height="20"><strong>%s</strong></td>
  3707. <td>&nbsp;%s</td>
  3708. </tr>
  3709. <tr height="20">
  3710. <td height="20"><strong>%s</strong></td>
  3711. <td>&nbsp;%s</td>
  3712. </tr>
  3713. <tr height="20">
  3714. <td height="20">&nbsp;</td>
  3715. <td>&nbsp;</td>
  3716. </tr>
  3717. <tr height="20">
  3718. <td height="20"><strong>%s</strong></td>
  3719. <td>&nbsp;%s</td>
  3720. </tr>
  3721. <tr height="20">
  3722. <td height="20">&nbsp;</td>
  3723. <td>&nbsp;</td>
  3724. </tr>
  3725. <tr height="20">
  3726. <td height="20"><strong>%s</strong></td>
  3727. <td>&nbsp;%s</td>
  3728. </tr>
  3729. </tr>
  3730. <tr height="20">
  3731. <td height="20"><strong>%s</strong></td>
  3732. <td>&nbsp;%s</td>
  3733. </tr>
  3734. <tr height="20">
  3735. <td height="20">&nbsp;</td>
  3736. <td>&nbsp;</td>
  3737. </tr>
  3738. <tr height="20">
  3739. <td height="20"><strong>%s</strong></td>
  3740. <td>&nbsp;%s</td>
  3741. </tr>
  3742. <tr height="20">
  3743. <td height="20"><strong>%s</strong></td>
  3744. <td>&nbsp;%s</td>
  3745. </tr>
  3746. <tr height="20">
  3747. <td height="20"><strong>%s</strong></td>
  3748. <td>&nbsp;%s</td>
  3749. </tr>
  3750. <tr height="20">
  3751. <td height="20"><strong>%s</strong></td>
  3752. <td>&nbsp;%s</td>
  3753. </tr>
  3754. <tr height="20">
  3755. <td height="20"><strong>%s</strong></td>
  3756. <td>&nbsp;%s</td>
  3757. </tr>
  3758. <tr height="20">
  3759. <td height="20"><strong>'%s'</strong></td>
  3760. <td>&nbsp;%s</td>
  3761. </tr>
  3762. <tr height="20">
  3763. <td height="20"><strong>%s</strong></td>
  3764. <td>&nbsp;%s</td>
  3765. </tr>
  3766. <tr height="20">
  3767. <td height="20"><strong>%s</strong></td>
  3768. <td>&nbsp;%s</td>
  3769. </tr>
  3770. </tbody>
  3771. </table>
  3772. ''' %
  3773. (
  3774. _("General Shortcut list"),
  3775. _('F3'), _("SHOW SHORTCUT LIST"),
  3776. _('1'), _("Switch to Project Tab"),
  3777. _('2'), _("Switch to Selected Tab"),
  3778. _('3'), _("Switch to Tool Tab"),
  3779. _('B'), _("New Gerber"),
  3780. _('E'), _("Edit Object (if selected)"),
  3781. _('G'), _("Grid On/Off"),
  3782. _('J'), _("Jump to Coordinates"),
  3783. _('L'), _("New Excellon"),
  3784. _('M'), _("Move Obj"),
  3785. _('N'), _("New Geometry"),
  3786. _('O'), _("Set Origin"),
  3787. _('Q'), _("Change Units"),
  3788. _('P'), _("Open Properties Tool"),
  3789. _('R'), _("Rotate by 90 degree CW"),
  3790. _('S'), _("Shell Toggle"),
  3791. _('T'), _("Add a Tool (when in Geometry Selected Tab or in Tools NCC or Tools Paint)"),
  3792. _('V'), _("Zoom Fit"),
  3793. _('X'), _("Flip on X_axis"),
  3794. _('Y'), _("Flip on Y_axis"),
  3795. _('-'), _("Zoom Out"),
  3796. _('='), _("Zoom In"),
  3797. # CTRL section
  3798. _('Ctrl+A'), _("Select All"),
  3799. _('Ctrl+C'), _("Copy Obj"),
  3800. _('Ctrl+D'), _("Open Tools Database"),
  3801. _('Ctrl+E'), _("Open Excellon File"),
  3802. _('Ctrl+G'), _("Open Gerber File"),
  3803. _('Ctrl+M'), _("Distance Tool"),
  3804. _('Ctrl+N'), _("New Project"),
  3805. _('Ctrl+O'), _("Open Project"),
  3806. _('Ctrl+P'), _("Print (PDF)"),
  3807. _('Ctrl+Q'), _("PDF Import Tool"),
  3808. _('Ctrl+S'), _("Save Project"),
  3809. _('Ctrl+F10'), _("Toggle Plot Area"),
  3810. # SHIFT section
  3811. _('Shift+A'), _("Toggle the axis"),
  3812. _('Shift+C'), _("Copy Obj_Name"),
  3813. _('Shift+E'), _("Toggle Code Editor"),
  3814. _('Shift+G'), _("Toggle Grid Lines"),
  3815. _('Shift+H'), _("Toggle HUD"),
  3816. _('Shift+J'), _("Locate in Object"),
  3817. _('Shift+M'), _("Distance Minimum Tool"),
  3818. _('Shift+P'), _("Open Preferences Window"),
  3819. _('Shift+R'), _("Rotate by 90 degree CCW"),
  3820. _('Shift+S'), _("Run a Script"),
  3821. _('Shift+W'), _("Toggle the workspace"),
  3822. _('Shift+X'), _("Skew on X axis"),
  3823. _('Shift+Y'), _("Skew on Y axis"),
  3824. # ALT section
  3825. _('Alt+A'), _("Align Objects Tool"),
  3826. _('Alt+C'), _("Calculators Tool"),
  3827. _('Alt+D'), _("2-Sided PCB Tool"),
  3828. _('Alt+E'), _("Extract Drills Tool"),
  3829. _('Alt+F'), _("Fiducials Tool"),
  3830. _('Alt+G'), _("Invert Gerber Tool"),
  3831. _('Alt+H'), _("Punch Gerber Tool"),
  3832. _('Alt+I'), _("Isolation Tool"),
  3833. _('Alt+J'), _("Copper Thieving Tool"),
  3834. _('Alt+K'), _("Solder Paste Dispensing Tool"),
  3835. _('Alt+L'), _("Film PCB Tool"),
  3836. _('Alt+M'), _("Corner Markers Tool"),
  3837. _('Alt+N'), _("Non-Copper Clearing Tool"),
  3838. _('Alt+O'), _("Optimal Tool"),
  3839. _('Alt+P'), _("Paint Area Tool"),
  3840. _('Alt+Q'), _("QRCode Tool"),
  3841. _('Alt+R'), _("Rules Check Tool"),
  3842. _('Alt+S'), _("View File Source"),
  3843. _('Alt+T'), _("Transformations Tool"),
  3844. _('Alt+W'), _("Subtract Tool"),
  3845. _('Alt+X'), _("Cutout PCB Tool"),
  3846. _('Alt+Z'), _("Panelize PCB"),
  3847. _('Alt+1'), _("Enable all"),
  3848. _('Alt+2'), _("Disable all"),
  3849. _('Alt+3'), _("Enable Non-selected Objects"),
  3850. _('Alt+4'), _("Disable Non-selected Objects"),
  3851. _('Alt+F10'), _("Toggle Full Screen"),
  3852. # CTRL + ALT section
  3853. _('Ctrl+Alt+X'), _("Abort current task (gracefully)"),
  3854. # CTRL + SHIFT section
  3855. _('Ctrl+Shift+S'), _("Save Project As"),
  3856. _('Ctrl+Shift+V'), _("Paste Special. "
  3857. "Will convert a Windows path style to the one required in Tcl Shell"),
  3858. # F keys section
  3859. _('F1'), _("Open Online Manual"),
  3860. _('F4'), _("Open Online Tutorials"),
  3861. _('F5'), _("Refresh Plots"),
  3862. _('Del'), _("Delete Object"),
  3863. _('Del'), _("Alternate: Delete Tool"),
  3864. _('`'), _("(left to Key_1)Toggle Notebook Area (Left Side)"),
  3865. _('SPACE'), _("En(Dis)able Obj Plot"),
  3866. _('ESC'), _("Deselects all objects")
  3867. )
  3868. )
  3869. self.sh_app = QtWidgets.QTextEdit()
  3870. self.sh_app.setTextInteractionFlags(QtCore.Qt.NoTextInteraction)
  3871. self.sh_app.setText(self.app_sh_msg)
  3872. self.sh_app.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
  3873. self.sh_hlay.addWidget(self.sh_app)
  3874. editor_title = """
  3875. <b>%s</b><br>
  3876. <br>
  3877. """ % _("Editor Shortcut list")
  3878. # GEOMETRY EDITOR SHORTCUT LIST
  3879. geo_sh_messages = """
  3880. <strong><span style="color:#0000ff">%s</span></strong><br>
  3881. <table border="0" cellpadding="0" cellspacing="0" style="width:283px">
  3882. <tbody>
  3883. <tr height="20">
  3884. <td height="20" width="89"><strong>%s</strong></td>
  3885. <td width="194">&nbsp;%s</td>
  3886. </tr>
  3887. <tr height="20">
  3888. <td height="20"><strong>%s</strong></td>
  3889. <td>&nbsp;%s</td>
  3890. </tr>
  3891. <tr height="20">
  3892. <td height="20"><strong>%s</strong></td>
  3893. <td>&nbsp;%s</td>
  3894. </tr>
  3895. <tr height="20">
  3896. <td height="20"><strong>%s</strong></td>
  3897. <td>&nbsp;%s</td>
  3898. </tr>
  3899. <tr height="20">
  3900. <td height="20"><strong>%s</strong></td>
  3901. <td>&nbsp;%s</td>
  3902. </tr>
  3903. <tr height="20">
  3904. <td height="20"><strong>%s</strong></td>
  3905. <td>&nbsp;%s</td>
  3906. </tr>
  3907. <tr height="20">
  3908. <td height="20"><strong>%s</strong></td>
  3909. <td>&nbsp;%s</td>
  3910. </tr>
  3911. <tr height="20">
  3912. <td height="20"><strong>%s</strong></td>
  3913. <td>&nbsp;%s</td>
  3914. </tr>
  3915. <tr height="20">
  3916. <td height="20"><strong>%s</strong></td>
  3917. <td>&nbsp;%s</td>
  3918. </tr>
  3919. <tr height="20">
  3920. <td height="20"><strong>%s</strong></td>
  3921. <td>&nbsp;%s</td>
  3922. </tr>
  3923. <tr height="20">
  3924. <td height="20"><strong>%s</strong></td>
  3925. <td>&nbsp;%s</td>
  3926. </tr>
  3927. <tr height="20">
  3928. <td height="20"><strong>%s</strong></td>
  3929. <td>&nbsp;%s</td>
  3930. </tr>
  3931. <tr height="20">
  3932. <td height="20"><strong>%s</strong></td>
  3933. <td>&nbsp;%s</td>
  3934. </tr>
  3935. <tr height="20">
  3936. <td height="20"><strong>%s</strong></td>
  3937. <td>&nbsp;%s</td>
  3938. </tr>
  3939. <tr height="20">
  3940. <td height="20"><strong>%s</strong></td>
  3941. <td>&nbsp;%s</td>
  3942. </tr>
  3943. <tr height="20">
  3944. <td height="20"><strong>%s</strong></td>
  3945. <td>&nbsp;%s</td>
  3946. </tr>
  3947. <tr height="20">
  3948. <td height="20"><strong>%s</strong></td>
  3949. <td>&nbsp;%s</td>
  3950. </tr>
  3951. <tr height="20">
  3952. <td height="20"><strong>%s</strong></td>
  3953. <td>&nbsp;%s</td>
  3954. </tr>
  3955. <tr height="20">
  3956. <td height="20"><strong>%s</strong></td>
  3957. <td>&nbsp;%s</td>
  3958. </tr>
  3959. <tr height="20">
  3960. <td height="20">&nbsp;</td>
  3961. <td>&nbsp;</td>
  3962. </tr>
  3963. <tr height="20">
  3964. <td height="20"><strong>%s</strong></td>
  3965. <td>&nbsp;%s</td>
  3966. </tr>
  3967. <tr height="20">
  3968. <td height="20"><strong>%s</strong></td>
  3969. <td>&nbsp;%s</td>
  3970. </tr>
  3971. <tr height="20">
  3972. <td height="20"><strong>%s</strong></td>
  3973. <td>&nbsp;%s</td>
  3974. </tr>
  3975. <tr height="20">
  3976. <td height="20">&nbsp;</td>
  3977. <td>&nbsp;</td>
  3978. </tr>
  3979. <tr height="20">
  3980. <td height="20"><strong>%s</strong></td>
  3981. <td>&nbsp;%s</td>
  3982. </tr>
  3983. <tr height="20">
  3984. <td height="20"><strong>%s</strong></td>
  3985. <td>&nbsp;%s</td>
  3986. </tr>
  3987. <tr height="20">
  3988. <td height="20"><strong>%s</strong></td>
  3989. <td>&nbsp;%s</td>
  3990. </tr>
  3991. <tr height="20">
  3992. <td height="20">&nbsp;</td>
  3993. <td>&nbsp;</td>
  3994. </tr>
  3995. <tr height="20">
  3996. <td height="20"><strong>%s</strong></td>
  3997. <td>&nbsp;%s</td>
  3998. </tr>
  3999. <tr height="20">
  4000. <td height="20"><strong>%s</strong></td>
  4001. <td>&nbsp;%s</td>
  4002. </tr>
  4003. <tr height="20">
  4004. <td height="20"><strong>%s</strong></td>
  4005. <td>&nbsp;%s</td>
  4006. </tr>
  4007. <tr height="20">
  4008. <td height="20">&nbsp;</td>
  4009. <td>&nbsp;</td>
  4010. </tr>
  4011. <tr height="20">
  4012. <td height="20"><strong>%s</strong></td>
  4013. <td>&nbsp;%s</td>
  4014. </tr>
  4015. <tr height="20">
  4016. <td height="20"><strong>%s</strong></td>
  4017. <td>&nbsp;%s</td>
  4018. </tr>
  4019. <tr height="20">
  4020. <td height="20"><strong>%s</strong></td>
  4021. <td>&nbsp;%s</td>
  4022. </tr>
  4023. <tr height="20">
  4024. <td height="20"><strong>%s</strong></td>
  4025. <td>&nbsp;%s</td>
  4026. </tr>
  4027. </tbody>
  4028. </table>
  4029. <br>
  4030. """ % (
  4031. _("GEOMETRY EDITOR"),
  4032. _('A'), _("Draw an Arc"),
  4033. _('B'), _("Buffer Tool"),
  4034. _('C'), _("Copy Geo Item"),
  4035. _('D'), _("Within Add Arc will toogle the ARC direction: CW or CCW"),
  4036. _('E'), _("Polygon Intersection Tool"),
  4037. _('I'), _("Geo Paint Tool"),
  4038. _('J'), _("Jump to Location (x, y)"),
  4039. _('K'), _("Toggle Corner Snap"),
  4040. _('M'), _("Move Geo Item"),
  4041. _('M'), _("Within Add Arc will cycle through the ARC modes"),
  4042. _('N'), _("Draw a Polygon"),
  4043. _('O'), _("Draw a Circle"),
  4044. _('P'), _("Draw a Path"),
  4045. _('R'), _("Draw Rectangle"),
  4046. _('S'), _("Polygon Subtraction Tool"),
  4047. _('T'), _("Add Text Tool"),
  4048. _('U'), _("Polygon Union Tool"),
  4049. _('X'), _("Flip shape on X axis"),
  4050. _('Y'), _("Flip shape on Y axis"),
  4051. _('Shift+M'), _("Distance Minimum Tool"),
  4052. _('Shift+X'), _("Skew shape on X axis"),
  4053. _('Shift+Y'), _("Skew shape on Y axis"),
  4054. _('Alt+R'), _("Editor Transformation Tool"),
  4055. _('Alt+X'), _("Offset shape on X axis"),
  4056. _('Alt+Y'), _("Offset shape on Y axis"),
  4057. _('Ctrl+M'), _("Distance Tool"),
  4058. _('Ctrl+S'), _("Save Object and Exit Editor"),
  4059. _('Ctrl+X'), _("Polygon Cut Tool"),
  4060. _('Space'), _("Rotate Geometry"),
  4061. _('ENTER'), _("Finish drawing for certain tools"),
  4062. _('ESC'), _("Abort and return to Select"),
  4063. _('Del'), _("Delete Shape")
  4064. )
  4065. # EXCELLON EDITOR SHORTCUT LIST
  4066. exc_sh_messages = """
  4067. <br>
  4068. <strong><span style="color:#ff0000">%s</span></strong><br>
  4069. <table border="0" cellpadding="0" cellspacing="0" style="width:283px">
  4070. <tbody>
  4071. <tr height="20">
  4072. <td height="20" width="89"><strong>%s</strong></td>
  4073. <td width="194">&nbsp;%s</td>
  4074. </tr>
  4075. <tr height="20">
  4076. <td height="20"><strong>%s</strong></td>
  4077. <td>&nbsp;%s</td>
  4078. </tr>
  4079. <tr height="20">
  4080. <td height="20"><strong>%s</strong></td>
  4081. <td>&nbsp;%s</td>
  4082. </tr>
  4083. <tr height="20">
  4084. <td height="20"><strong>%s</strong></td>
  4085. <td>&nbsp;%s</td>
  4086. </tr>
  4087. <tr height="20">
  4088. <td height="20"><strong>%s</strong></td>
  4089. <td>&nbsp;%s</td>
  4090. </tr>
  4091. <tr height="20">
  4092. <td height="20" width="89"><strong>%s</strong></td>
  4093. <td width="194">&nbsp;%s</td>
  4094. </tr>
  4095. <tr height="20">
  4096. <td height="20"><strong>%s</strong></td>
  4097. <td>&nbsp;%s</td>
  4098. </tr>
  4099. <tr height="20">
  4100. <td height="20"><strong>%s</strong></td>
  4101. <td>&nbsp;%s</td>
  4102. </tr>
  4103. <tr height="20">
  4104. <td height="20" width="89"><strong>%s</strong></td>
  4105. <td width="194">&nbsp;%s</td>
  4106. </tr>
  4107. <tr height="20">
  4108. <td height="20">&nbsp;</td>
  4109. <td>&nbsp;</td>
  4110. </tr>
  4111. <tr height="20">
  4112. <td height="20"><strong>%s</strong></td>
  4113. <td>&nbsp;%s</td>
  4114. </tr>
  4115. <tr height="20">
  4116. <td height="20">&nbsp;</td>
  4117. <td>&nbsp;</td>
  4118. </tr>
  4119. <tr height="20">
  4120. <td height="20"><strong>%s</strong></td>
  4121. <td>&nbsp;%s</td>
  4122. </tr>
  4123. <tr height="20">
  4124. <td height="20"><strong>%s</strong></td>
  4125. <td>&nbsp;%s</td>
  4126. </tr>
  4127. <tr height="20">
  4128. <td height="20">&nbsp;</td>
  4129. <td>&nbsp;</td>
  4130. </tr>
  4131. <tr height="20">
  4132. <td height="20"><strong>%s</strong></td>
  4133. <td>&nbsp;%s</td>
  4134. </tr>
  4135. <tr height="20">
  4136. <td height="20"><strong>%s</strong></td>
  4137. <td>&nbsp;%s</td>
  4138. </tr>
  4139. </tbody>
  4140. </table>
  4141. <br>
  4142. """ % (
  4143. _("EXCELLON EDITOR"),
  4144. _('A'), _("Add Drill Array"),
  4145. _('C'), _("Copy Drill(s)"),
  4146. _('D'), _("Add Drill"),
  4147. _('J'), _("Jump to Location (x, y)"),
  4148. _('M'), _("Move Drill(s)"),
  4149. _('Q'), _("Add Slot Array"),
  4150. _('R'), _("Resize Drill(s)"),
  4151. _('T'), _("Add a new Tool"),
  4152. _('W'), _("Add Slot"),
  4153. _('Shift+M'), _("Distance Minimum Tool"),
  4154. _('Del'), _("Delete Drill(s)"),
  4155. _('Del'), _("Alternate: Delete Tool(s)"),
  4156. _('Esc'), _("Abort and return to Select"),
  4157. _('Ctrl+S'), _("Save Object and Exit Editor")
  4158. )
  4159. # GERBER EDITOR SHORTCUT LIST
  4160. grb_sh_messages = """
  4161. <br>
  4162. <strong><span style="color:#00ff00">%s</span></strong><br>
  4163. <table border="0" cellpadding="0" cellspacing="0" style="width:283px">
  4164. <tbody>
  4165. <tr height="20">
  4166. <td height="20" width="89"><strong>%s</strong></td>
  4167. <td width="194">&nbsp;%s</td>
  4168. </tr>
  4169. <tr height="20">
  4170. <td height="20"><strong>%s</strong></td>
  4171. <td>&nbsp;%s</td>
  4172. </tr>
  4173. <tr height="20">
  4174. <td height="20"><strong>%s</strong></td>
  4175. <td>&nbsp;%s</td>
  4176. </tr>
  4177. <tr height="20">
  4178. <td height="20"><strong>%s</strong></td>
  4179. <td>&nbsp;%s</td>
  4180. </tr>
  4181. <tr height="20">
  4182. <td height="20"><strong>%s</strong></td>
  4183. <td>&nbsp;%s</td>
  4184. </tr>
  4185. <tr height="20">
  4186. <td height="20"><strong>%s</strong></td>
  4187. <td>&nbsp;%s</td>
  4188. </tr>
  4189. <tr height="20">
  4190. <td height="20"><strong>%s</strong></td>
  4191. <td>&nbsp;%s</td>
  4192. </tr>
  4193. <tr height="20">
  4194. <td height="20"><strong>%s</strong></td>
  4195. <td>&nbsp;%s</td>
  4196. </tr>
  4197. <tr height="20">
  4198. <td height="20"><strong>%s</strong></td>
  4199. <td>&nbsp;%s</td>
  4200. </tr>
  4201. <tr height="20">
  4202. <td height="20"><strong>%s</strong></td>
  4203. <td>&nbsp;%s</td>
  4204. </tr>
  4205. <tr height="20">
  4206. <td height="20"><strong>%s</strong></td>
  4207. <td>&nbsp;%s</td>
  4208. </tr>
  4209. <tr height="20">
  4210. <td height="20"><strong>%s</strong></td>
  4211. <td>&nbsp;%s</td>
  4212. </tr>
  4213. <tr height="20">
  4214. <td height="20"><strong>%s</strong></td>
  4215. <td>&nbsp;%s</td>
  4216. </tr>
  4217. <tr height="20">
  4218. <td height="20">&nbsp;</td>
  4219. <td>&nbsp;</td>
  4220. </tr>
  4221. <tr height="20">
  4222. <td height="20"><strong>%s</strong></td>
  4223. <td>&nbsp;%s</td>
  4224. </tr>
  4225. <tr height="20">
  4226. <td height="20"><strong>%s</strong></td>
  4227. <td>&nbsp;%s</td>
  4228. </tr>
  4229. <tr height="20">
  4230. <td height="20"><strong>%s</strong></td>
  4231. <td>&nbsp;%s</td>
  4232. </tr>
  4233. <tr height="20">
  4234. <td height="20">&nbsp;</td>
  4235. <td>&nbsp;</td>
  4236. </tr>
  4237. <tr height="20">
  4238. <td height="20"><strong>%s</strong></td>
  4239. <td>&nbsp;%s</td>
  4240. </tr>
  4241. <tr height="20">
  4242. <td height="20">&nbsp;</td>
  4243. <td>&nbsp;</td>
  4244. </tr>
  4245. <tr height="20">
  4246. <td height="20"><strong>%s</strong></td>
  4247. <td>&nbsp;%s</td>
  4248. </tr>
  4249. <tr height="20">
  4250. <td height="20"><strong>%s</strong></td>
  4251. <td>&nbsp;%s</td>
  4252. </tr>
  4253. <tr height="20">
  4254. <td height="20">&nbsp;</td>
  4255. <td>&nbsp;</td>
  4256. </tr>
  4257. <tr height="20">
  4258. <td height="20"><strong>%s</strong></td>
  4259. <td>&nbsp;%s</td>
  4260. </tr>
  4261. <tr height="20">
  4262. <td height="20"><strong>%s</strong></td>
  4263. <td>&nbsp;%s</td>
  4264. </tr>
  4265. <tr height="20">
  4266. <td height="20"><strong>%s</strong></td>
  4267. <td>&nbsp;%s</td>
  4268. </tr>
  4269. </tbody>
  4270. </table>
  4271. <br>
  4272. """ % (
  4273. _("GERBER EDITOR"),
  4274. _('A'), _("Add Pad Array"),
  4275. _('B'), _("Buffer"),
  4276. _('C'), _("Copy"),
  4277. _('D'), _("Add Disc"),
  4278. _('E'), _("Add SemiDisc"),
  4279. _('J'), _("Jump to Location (x, y)"),
  4280. _('M'), _("Move"),
  4281. _('N'), _("Add Region"),
  4282. _('P'), _("Add Pad"),
  4283. _('R'), _("Within Track & Region Tools will cycle in REVERSE the bend modes"),
  4284. _('S'), _("Scale"),
  4285. _('T'), _("Add Track"),
  4286. _('T'), _("Within Track & Region Tools will cycle FORWARD the bend modes"),
  4287. _('Del'), _("Delete"),
  4288. _('Del'), _("Alternate: Delete Apertures"),
  4289. _('ESC'), _("Abort and return to Select"),
  4290. _('Shift+M'), _("Distance Minimum Tool"),
  4291. _('Ctrl+E'), _("Eraser Tool"),
  4292. _('Ctrl+S'), _("Save Object and Exit Editor"),
  4293. _('Alt+A'), _("Mark Area Tool"),
  4294. _('Alt+N'), _("Poligonize Tool"),
  4295. _('Alt+R'), _("Transformation Tool")
  4296. )
  4297. self.editor_sh_msg = editor_title + geo_sh_messages + grb_sh_messages + exc_sh_messages
  4298. self.sh_editor = QtWidgets.QTextEdit()
  4299. self.sh_editor.setTextInteractionFlags(QtCore.Qt.NoTextInteraction)
  4300. self.sh_editor.setText(self.editor_sh_msg)
  4301. self.sh_editor.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
  4302. self.sh_hlay.addWidget(self.sh_editor)
  4303. # end of file