ToolDblSided.py 23 KB

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