ToolDblSided.py 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544
  1. from FlatCAMTool import FlatCAMTool
  2. from FlatCAMObj import *
  3. from shapely.geometry import Point
  4. from shapely import affinity
  5. from PyQt5 import QtCore
  6. import gettext
  7. import FlatCAMTranslation as fcTranslate
  8. fcTranslate.apply_language('ToolDblSided')
  9. import builtins
  10. if '_' not in builtins.__dict__:
  11. _ = gettext.gettext
  12. class DblSidedTool(FlatCAMTool):
  13. toolName = _("2-Sided PCB")
  14. def __init__(self, app):
  15. FlatCAMTool.__init__(self, app)
  16. ## Title
  17. title_label = QtWidgets.QLabel("%s" % self.toolName)
  18. title_label.setStyleSheet("""
  19. QLabel
  20. {
  21. font-size: 16px;
  22. font-weight: bold;
  23. }
  24. """)
  25. self.layout.addWidget(title_label)
  26. self.empty_lb = QtWidgets.QLabel("")
  27. self.layout.addWidget(self.empty_lb)
  28. ## Grid Layout
  29. grid_lay = QtWidgets.QGridLayout()
  30. self.layout.addLayout(grid_lay)
  31. ## Gerber Object to mirror
  32. self.gerber_object_combo = QtWidgets.QComboBox()
  33. self.gerber_object_combo.setModel(self.app.collection)
  34. self.gerber_object_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
  35. self.gerber_object_combo.setCurrentIndex(1)
  36. self.botlay_label = QtWidgets.QLabel("<b>GERBER:</b>")
  37. self.botlay_label.setToolTip(
  38. "Gerber to be mirrored."
  39. )
  40. self.mirror_gerber_button = QtWidgets.QPushButton(_("Mirror"))
  41. self.mirror_gerber_button.setToolTip(
  42. _("Mirrors (flips) the specified object around \n"
  43. "the specified axis. Does not create a new \n"
  44. "object, but modifies it.")
  45. )
  46. self.mirror_gerber_button.setFixedWidth(40)
  47. # grid_lay.addRow("Bottom Layer:", self.object_combo)
  48. grid_lay.addWidget(self.botlay_label, 0, 0)
  49. grid_lay.addWidget(self.gerber_object_combo, 1, 0, 1, 2)
  50. grid_lay.addWidget(self.mirror_gerber_button, 1, 3)
  51. ## Excellon Object to mirror
  52. self.exc_object_combo = QtWidgets.QComboBox()
  53. self.exc_object_combo.setModel(self.app.collection)
  54. self.exc_object_combo.setRootModelIndex(self.app.collection.index(1, 0, QtCore.QModelIndex()))
  55. self.exc_object_combo.setCurrentIndex(1)
  56. self.excobj_label = QtWidgets.QLabel("<b>EXCELLON:</b>")
  57. self.excobj_label.setToolTip(
  58. _("Excellon Object to be mirrored.")
  59. )
  60. self.mirror_exc_button = QtWidgets.QPushButton(_("Mirror"))
  61. self.mirror_exc_button.setToolTip(
  62. _("Mirrors (flips) the specified object around \n"
  63. "the specified axis. Does not create a new \n"
  64. "object, but modifies it.")
  65. )
  66. self.mirror_exc_button.setFixedWidth(40)
  67. # grid_lay.addRow("Bottom Layer:", self.object_combo)
  68. grid_lay.addWidget(self.excobj_label, 2, 0)
  69. grid_lay.addWidget(self.exc_object_combo, 3, 0, 1, 2)
  70. grid_lay.addWidget(self.mirror_exc_button, 3, 3)
  71. ## Geometry Object to mirror
  72. self.geo_object_combo = QtWidgets.QComboBox()
  73. self.geo_object_combo.setModel(self.app.collection)
  74. self.geo_object_combo.setRootModelIndex(self.app.collection.index(2, 0, QtCore.QModelIndex()))
  75. self.geo_object_combo.setCurrentIndex(1)
  76. self.geoobj_label = QtWidgets.QLabel("<b>GEOMETRY</b>:")
  77. self.geoobj_label.setToolTip(
  78. _("Geometry Obj to be mirrored.")
  79. )
  80. self.mirror_geo_button = QtWidgets.QPushButton(_("Mirror"))
  81. self.mirror_geo_button.setToolTip(
  82. _("Mirrors (flips) the specified object around \n"
  83. "the specified axis. Does not create a new \n"
  84. "object, but modifies it.")
  85. )
  86. self.mirror_geo_button.setFixedWidth(40)
  87. # grid_lay.addRow("Bottom Layer:", self.object_combo)
  88. grid_lay.addWidget(self.geoobj_label, 4, 0)
  89. grid_lay.addWidget(self.geo_object_combo, 5, 0, 1, 2)
  90. grid_lay.addWidget(self.mirror_geo_button, 5, 3)
  91. ## Axis
  92. self.mirror_axis = RadioSet([{'label': 'X', 'value': 'X'},
  93. {'label': 'Y', 'value': 'Y'}])
  94. self.mirax_label = QtWidgets.QLabel(_("Mirror Axis:"))
  95. self.mirax_label.setToolTip(
  96. _("Mirror vertically (X) or horizontally (Y).")
  97. )
  98. # grid_lay.addRow("Mirror Axis:", self.mirror_axis)
  99. self.empty_lb1 = QtWidgets.QLabel("")
  100. grid_lay.addWidget(self.empty_lb1, 6, 0)
  101. grid_lay.addWidget(self.mirax_label, 7, 0)
  102. grid_lay.addWidget(self.mirror_axis, 7, 1)
  103. ## Axis Location
  104. self.axis_location = RadioSet([{'label': 'Point', 'value': 'point'},
  105. {'label': 'Box', 'value': 'box'}])
  106. self.axloc_label = QtWidgets.QLabel(_("Axis Ref:"))
  107. self.axloc_label.setToolTip(
  108. _("The axis should pass through a <b>point</b> or cut\n "
  109. "a specified <b>box</b> (in a FlatCAM object) through \n"
  110. "the center.")
  111. )
  112. # grid_lay.addRow("Axis Location:", self.axis_location)
  113. grid_lay.addWidget(self.axloc_label, 8, 0)
  114. grid_lay.addWidget(self.axis_location, 8, 1)
  115. self.empty_lb2 = QtWidgets.QLabel("")
  116. grid_lay.addWidget(self.empty_lb2, 9, 0)
  117. ## Point/Box
  118. self.point_box_container = QtWidgets.QVBoxLayout()
  119. self.pb_label = QtWidgets.QLabel("<b>%s</b>" % _('Point/Box Reference:'))
  120. self.pb_label.setToolTip(
  121. _("If 'Point' is selected above it store the coordinates (x, y) through which\n"
  122. "the mirroring axis passes.\n"
  123. "If 'Box' is selected above, select here a FlatCAM object (Gerber, Exc or Geo).\n"
  124. "Through the center of this object pass the mirroring axis selected above.")
  125. )
  126. self.add_point_button = QtWidgets.QPushButton(_("Add"))
  127. self.add_point_button.setToolTip(
  128. _("Add the coordinates in format <b>(x, y)</b> through which the mirroring axis \n "
  129. "selected in 'MIRROR AXIS' pass.\n"
  130. "The (x, y) coordinates are captured by pressing SHIFT key\n"
  131. "and left mouse button click on canvas or you can enter the coords manually.")
  132. )
  133. self.add_point_button.setFixedWidth(40)
  134. grid_lay.addWidget(self.pb_label, 10, 0)
  135. grid_lay.addLayout(self.point_box_container, 11, 0, 1, 3)
  136. grid_lay.addWidget(self.add_point_button, 11, 3)
  137. self.point_entry = EvalEntry()
  138. self.point_box_container.addWidget(self.point_entry)
  139. self.box_combo = QtWidgets.QComboBox()
  140. self.box_combo.setModel(self.app.collection)
  141. self.box_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
  142. self.box_combo.setCurrentIndex(1)
  143. self.box_combo_type = QtWidgets.QComboBox()
  144. self.box_combo_type.addItem(_("Gerber Reference Box Object"))
  145. self.box_combo_type.addItem(_("Excellon Reference Box Object"))
  146. self.box_combo_type.addItem(_("Geometry Reference Box Object"))
  147. self.point_box_container.addWidget(self.box_combo_type)
  148. self.point_box_container.addWidget(self.box_combo)
  149. self.box_combo.hide()
  150. self.box_combo_type.hide()
  151. ## Alignment holes
  152. self.ah_label = QtWidgets.QLabel("<b%s</b>" % _('>Alignment Drill Coordinates:'))
  153. self.ah_label.setToolTip(
  154. _( "Alignment holes (x1, y1), (x2, y2), ... "
  155. "on one side of the mirror axis. For each set of (x, y) coordinates\n"
  156. "entered here, a pair of drills will be created:\n\n"
  157. "- one drill at the coordinates from the field\n"
  158. "- one drill in mirror position over the axis selected above in the 'Mirror Axis'.")
  159. )
  160. self.layout.addWidget(self.ah_label)
  161. grid_lay1 = QtWidgets.QGridLayout()
  162. self.layout.addLayout(grid_lay1)
  163. self.alignment_holes = EvalEntry()
  164. self.add_drill_point_button = QtWidgets.QPushButton(_("Add"))
  165. self.add_drill_point_button.setToolTip(
  166. _("Add alignment drill holes coords in the format: (x1, y1), (x2, y2), ... \n"
  167. "on one side of the mirror axis.\n\n"
  168. "The coordinates set can be obtained:\n"
  169. "- press SHIFT key and left mouse clicking on canvas. Then click Add.\n"
  170. "- press SHIFT key and left mouse clicking on canvas. Then CTRL+V in the field.\n"
  171. "- press SHIFT key and left mouse clicking on canvas. Then RMB click in the field and click Paste.\n"
  172. "- by entering the coords manually in the format: (x1, y1), (x2, y2), ...")
  173. )
  174. self.add_drill_point_button.setFixedWidth(40)
  175. grid_lay1.addWidget(self.alignment_holes, 0, 0, 1, 2)
  176. grid_lay1.addWidget(self.add_drill_point_button, 0, 3)
  177. ## Drill diameter for alignment holes
  178. self.dt_label = QtWidgets.QLabel("<b>%s</b>:" % _('Alignment Drill Diameter'))
  179. self.dt_label.setToolTip(
  180. _("Diameter of the drill for the "
  181. "alignment holes.")
  182. )
  183. self.layout.addWidget(self.dt_label)
  184. grid_lay2 = QtWidgets.QGridLayout()
  185. self.layout.addLayout(grid_lay2)
  186. self.drill_dia = FCEntry()
  187. self.dd_label = QtWidgets.QLabel(_("Drill diam.:"))
  188. self.dd_label.setToolTip(
  189. _("Diameter of the drill for the "
  190. "alignment holes.")
  191. )
  192. grid_lay2.addWidget(self.dd_label, 0, 0)
  193. grid_lay2.addWidget(self.drill_dia, 0, 1)
  194. ## Buttons
  195. self.create_alignment_hole_button = QtWidgets.QPushButton(_("Create Excellon Object"))
  196. self.create_alignment_hole_button.setToolTip(
  197. _("Creates an Excellon Object containing the\n"
  198. "specified alignment holes and their mirror\n"
  199. "images.")
  200. )
  201. # self.create_alignment_hole_button.setFixedWidth(40)
  202. grid_lay2.addWidget(self.create_alignment_hole_button, 1,0, 1, 2)
  203. self.reset_button = QtWidgets.QPushButton(_("Reset"))
  204. self.reset_button.setToolTip(
  205. _("Resets all the fields.")
  206. )
  207. self.reset_button.setFixedWidth(40)
  208. grid_lay2.addWidget(self.reset_button, 1, 2)
  209. self.layout.addStretch()
  210. ## Signals
  211. self.create_alignment_hole_button.clicked.connect(self.on_create_alignment_holes)
  212. self.mirror_gerber_button.clicked.connect(self.on_mirror_gerber)
  213. self.mirror_exc_button.clicked.connect(self.on_mirror_exc)
  214. self.mirror_geo_button.clicked.connect(self.on_mirror_geo)
  215. self.add_point_button.clicked.connect(self.on_point_add)
  216. self.add_drill_point_button.clicked.connect(self.on_drill_add)
  217. self.reset_button.clicked.connect(self.reset_fields)
  218. self.box_combo_type.currentIndexChanged.connect(self.on_combo_box_type)
  219. self.axis_location.group_toggle_fn = self.on_toggle_pointbox
  220. self.drill_values = ""
  221. def install(self, icon=None, separator=None, **kwargs):
  222. FlatCAMTool.install(self, icon, separator, shortcut='ALT+D', **kwargs)
  223. def run(self, toggle=True):
  224. self.app.report_usage("Tool2Sided()")
  225. if toggle:
  226. # if the splitter is hidden, display it, else hide it but only if the current widget is the same
  227. if self.app.ui.splitter.sizes()[0] == 0:
  228. self.app.ui.splitter.setSizes([1, 1])
  229. else:
  230. if self.app.ui.tool_scroll_area.widget().objectName() == self.toolName:
  231. self.app.ui.splitter.setSizes([0, 1])
  232. FlatCAMTool.run(self)
  233. self.set_tool_ui()
  234. self.app.ui.notebook.setTabText(2, _("2-Sided Tool"))
  235. def set_tool_ui(self):
  236. self.reset_fields()
  237. self.point_entry.set_value("")
  238. self.alignment_holes.set_value("")
  239. self.mirror_axis.set_value(self.app.defaults["tools_2sided_mirror_axis"])
  240. self.axis_location.set_value(self.app.defaults["tools_2sided_axis_loc"])
  241. self.drill_dia.set_value(self.app.defaults["tools_2sided_drilldia"])
  242. def on_combo_box_type(self):
  243. obj_type = self.box_combo_type.currentIndex()
  244. self.box_combo.setRootModelIndex(self.app.collection.index(obj_type, 0, QtCore.QModelIndex()))
  245. self.box_combo.setCurrentIndex(0)
  246. def on_create_alignment_holes(self):
  247. axis = self.mirror_axis.get_value()
  248. mode = self.axis_location.get_value()
  249. if mode == "point":
  250. try:
  251. px, py = self.point_entry.get_value()
  252. except TypeError:
  253. self.app.inform.emit(_("[WARNING_NOTCL] 'Point' reference is selected and 'Point' coordinates "
  254. "are missing. Add them and retry."))
  255. return
  256. else:
  257. selection_index = self.box_combo.currentIndex()
  258. model_index = self.app.collection.index(selection_index, 0, self.gerber_object_combo.rootModelIndex())
  259. try:
  260. bb_obj = model_index.internalPointer().obj
  261. except AttributeError:
  262. model_index = self.app.collection.index(selection_index, 0, self.exc_object_combo.rootModelIndex())
  263. try:
  264. bb_obj = model_index.internalPointer().obj
  265. except AttributeError:
  266. model_index = self.app.collection.index(selection_index, 0,
  267. self.geo_object_combo.rootModelIndex())
  268. try:
  269. bb_obj = model_index.internalPointer().obj
  270. except AttributeError:
  271. self.app.inform.emit(
  272. _("[WARNING_NOTCL] There is no Box reference object loaded. Load one and retry."))
  273. return
  274. xmin, ymin, xmax, ymax = bb_obj.bounds()
  275. px = 0.5 * (xmin + xmax)
  276. py = 0.5 * (ymin + ymax)
  277. xscale, yscale = {"X": (1.0, -1.0), "Y": (-1.0, 1.0)}[axis]
  278. try:
  279. dia = float(self.drill_dia.get_value())
  280. except ValueError:
  281. # try to convert comma to decimal point. if it's still not working error message and return
  282. try:
  283. dia = float(self.drill_dia.get_value().replace(',', '.'))
  284. self.drill_dia.set_value(dia)
  285. except ValueError:
  286. self.app.inform.emit(_("[WARNING_NOTCL] Tool diameter value is missing or wrong format. "
  287. "Add it and retry."))
  288. return
  289. if dia is '':
  290. self.app.inform.emit(_("[WARNING_NOTCL]No value or wrong format in Drill Dia entry. Add it and retry."))
  291. return
  292. tools = {"1": {"C": dia}}
  293. # holes = self.alignment_holes.get_value()
  294. holes = eval('[{}]'.format(self.alignment_holes.text()))
  295. if not holes:
  296. self.app.inform.emit(_("[WARNING_NOTCL] There are no Alignment Drill Coordinates to use. Add them and retry."))
  297. return
  298. drills = []
  299. for hole in holes:
  300. point = Point(hole)
  301. point_mirror = affinity.scale(point, xscale, yscale, origin=(px, py))
  302. drills.append({"point": point, "tool": "1"})
  303. drills.append({"point": point_mirror, "tool": "1"})
  304. if 'solid_geometry' not in tools:
  305. tools["1"]['solid_geometry'] = []
  306. else:
  307. tools["1"]['solid_geometry'].append(point_mirror)
  308. def obj_init(obj_inst, app_inst):
  309. obj_inst.tools = tools
  310. obj_inst.drills = drills
  311. obj_inst.create_geometry()
  312. self.app.new_object("excellon", "Alignment Drills", obj_init)
  313. self.drill_values = ''
  314. self.app.inform.emit(_("[success] Excellon object with alignment drills created..."))
  315. def on_mirror_gerber(self):
  316. selection_index = self.gerber_object_combo.currentIndex()
  317. # fcobj = self.app.collection.object_list[selection_index]
  318. model_index = self.app.collection.index(selection_index, 0, self.gerber_object_combo.rootModelIndex())
  319. try:
  320. fcobj = model_index.internalPointer().obj
  321. except Exception as e:
  322. self.app.inform.emit(_("[WARNING_NOTCL] There is no Gerber object loaded ..."))
  323. return
  324. if not isinstance(fcobj, FlatCAMGerber):
  325. self.app.inform.emit(_("[ERROR_NOTCL] Only Gerber, Excellon and Geometry objects can be mirrored."))
  326. return
  327. axis = self.mirror_axis.get_value()
  328. mode = self.axis_location.get_value()
  329. if mode == "point":
  330. try:
  331. px, py = self.point_entry.get_value()
  332. except TypeError:
  333. self.app.inform.emit(_("[WARNING_NOTCL] 'Point' coordinates missing. "
  334. "Using Origin (0, 0) as mirroring reference."))
  335. px, py = (0, 0)
  336. else:
  337. selection_index_box = self.box_combo.currentIndex()
  338. model_index_box = self.app.collection.index(selection_index_box, 0, self.box_combo.rootModelIndex())
  339. try:
  340. bb_obj = model_index_box.internalPointer().obj
  341. except Exception as e:
  342. self.app.inform.emit(_("[WARNING_NOTCL] There is no Box object loaded ..."))
  343. return
  344. xmin, ymin, xmax, ymax = bb_obj.bounds()
  345. px = 0.5 * (xmin + xmax)
  346. py = 0.5 * (ymin + ymax)
  347. fcobj.mirror(axis, [px, py])
  348. self.app.object_changed.emit(fcobj)
  349. fcobj.plot()
  350. self.app.inform.emit(_("[success] Gerber %s was mirrored...") % str(fcobj.options['name']))
  351. def on_mirror_exc(self):
  352. selection_index = self.exc_object_combo.currentIndex()
  353. # fcobj = self.app.collection.object_list[selection_index]
  354. model_index = self.app.collection.index(selection_index, 0, self.exc_object_combo.rootModelIndex())
  355. try:
  356. fcobj = model_index.internalPointer().obj
  357. except Exception as e:
  358. self.app.inform.emit(_("[WARNING_NOTCL] There is no Excellon object loaded ..."))
  359. return
  360. if not isinstance(fcobj, FlatCAMExcellon):
  361. self.app.inform.emit(_("[ERROR_NOTCL] Only Gerber, Excellon and Geometry objects can be mirrored."))
  362. return
  363. axis = self.mirror_axis.get_value()
  364. mode = self.axis_location.get_value()
  365. if mode == "point":
  366. try:
  367. px, py = self.point_entry.get_value()
  368. except Exception as e:
  369. log.debug("DblSidedTool.on_mirror_geo() --> %s" % str(e))
  370. self.app.inform.emit(_("[WARNING_NOTCL] There are no Point coordinates in the Point field. "
  371. "Add coords and try again ..."))
  372. return
  373. else:
  374. selection_index_box = self.box_combo.currentIndex()
  375. model_index_box = self.app.collection.index(selection_index_box, 0, self.box_combo.rootModelIndex())
  376. try:
  377. bb_obj = model_index_box.internalPointer().obj
  378. except Exception as e:
  379. log.debug("DblSidedTool.on_mirror_geo() --> %s" % str(e))
  380. self.app.inform.emit(_("[WARNING_NOTCL] There is no Box object loaded ..."))
  381. return
  382. xmin, ymin, xmax, ymax = bb_obj.bounds()
  383. px = 0.5 * (xmin + xmax)
  384. py = 0.5 * (ymin + ymax)
  385. fcobj.mirror(axis, [px, py])
  386. self.app.object_changed.emit(fcobj)
  387. fcobj.plot()
  388. self.app.inform.emit(_("[success] Excellon %s was mirrored...") % str(fcobj.options['name']))
  389. def on_mirror_geo(self):
  390. selection_index = self.geo_object_combo.currentIndex()
  391. # fcobj = self.app.collection.object_list[selection_index]
  392. model_index = self.app.collection.index(selection_index, 0, self.geo_object_combo.rootModelIndex())
  393. try:
  394. fcobj = model_index.internalPointer().obj
  395. except Exception as e:
  396. self.app.inform.emit(_("[WARNING_NOTCL] There is no Geometry object loaded ..."))
  397. return
  398. if not isinstance(fcobj, FlatCAMGeometry):
  399. self.app.inform.emit(_("[ERROR_NOTCL] Only Gerber, Excellon and Geometry objects can be mirrored."))
  400. return
  401. axis = self.mirror_axis.get_value()
  402. mode = self.axis_location.get_value()
  403. if mode == "point":
  404. px, py = self.point_entry.get_value()
  405. else:
  406. selection_index_box = self.box_combo.currentIndex()
  407. model_index_box = self.app.collection.index(selection_index_box, 0, self.box_combo.rootModelIndex())
  408. try:
  409. bb_obj = model_index_box.internalPointer().obj
  410. except Exception as e:
  411. self.app.inform.emit(_("[WARNING_NOTCL] There is no Box object loaded ..."))
  412. return
  413. xmin, ymin, xmax, ymax = bb_obj.bounds()
  414. px = 0.5 * (xmin + xmax)
  415. py = 0.5 * (ymin + ymax)
  416. fcobj.mirror(axis, [px, py])
  417. self.app.object_changed.emit(fcobj)
  418. fcobj.plot()
  419. self.app.inform.emit(_("[success] Geometry %s was mirrored...") % str(fcobj.options['name']))
  420. def on_point_add(self):
  421. val = self.app.defaults["global_point_clipboard_format"] % (self.app.pos[0], self.app.pos[1])
  422. self.point_entry.set_value(val)
  423. def on_drill_add(self):
  424. self.drill_values += (self.app.defaults["global_point_clipboard_format"] %
  425. (self.app.pos[0], self.app.pos[1])) + ','
  426. self.alignment_holes.set_value(self.drill_values)
  427. def on_toggle_pointbox(self):
  428. if self.axis_location.get_value() == "point":
  429. self.point_entry.show()
  430. self.box_combo.hide()
  431. self.box_combo_type.hide()
  432. self.add_point_button.setDisabled(False)
  433. else:
  434. self.point_entry.hide()
  435. self.box_combo.show()
  436. self.box_combo_type.show()
  437. self.add_point_button.setDisabled(True)
  438. def reset_fields(self):
  439. self.gerber_object_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
  440. self.exc_object_combo.setRootModelIndex(self.app.collection.index(1, 0, QtCore.QModelIndex()))
  441. self.geo_object_combo.setRootModelIndex(self.app.collection.index(2, 0, QtCore.QModelIndex()))
  442. self.box_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
  443. self.gerber_object_combo.setCurrentIndex(0)
  444. self.exc_object_combo.setCurrentIndex(0)
  445. self.geo_object_combo.setCurrentIndex(0)
  446. self.box_combo.setCurrentIndex(0)
  447. self.box_combo_type.setCurrentIndex(0)
  448. self.drill_values = ""