ObjectUI.py 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646
  1. import sys
  2. from PyQt4 import QtGui, QtCore
  3. from GUIElements import *
  4. class ObjectUI(QtGui.QWidget):
  5. """
  6. Base class for the UI of FlatCAM objects. Deriving classes should
  7. put UI elements in ObjectUI.custom_box (QtGui.QLayout).
  8. """
  9. def __init__(self, icon_file='share/flatcam_icon32.png', title='FlatCAM Object', parent=None):
  10. QtGui.QWidget.__init__(self, parent=parent)
  11. layout = QtGui.QVBoxLayout()
  12. self.setLayout(layout)
  13. ## Page Title box (spacing between children)
  14. self.title_box = QtGui.QHBoxLayout()
  15. layout.addLayout(self.title_box)
  16. ## Page Title icon
  17. pixmap = QtGui.QPixmap(icon_file)
  18. self.icon = QtGui.QLabel()
  19. self.icon.setPixmap(pixmap)
  20. self.title_box.addWidget(self.icon, stretch=0)
  21. ## Title label
  22. self.title_label = QtGui.QLabel("<font size=5><b>" + title + "</b></font>")
  23. self.title_label.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
  24. self.title_box.addWidget(self.title_label, stretch=1)
  25. ## Object name
  26. self.name_box = QtGui.QHBoxLayout()
  27. layout.addLayout(self.name_box)
  28. name_label = QtGui.QLabel("Name:")
  29. self.name_box.addWidget(name_label)
  30. self.name_entry = FCEntry()
  31. self.name_box.addWidget(self.name_entry)
  32. ## Box box for custom widgets
  33. self.custom_box = QtGui.QVBoxLayout()
  34. layout.addLayout(self.custom_box)
  35. ## Common to all objects
  36. ## Scale
  37. self.scale_label = QtGui.QLabel('<b>Scale:</b>')
  38. self.scale_label.setToolTip(
  39. "Change the size of the object."
  40. )
  41. layout.addWidget(self.scale_label)
  42. grid1 = QtGui.QGridLayout()
  43. layout.addLayout(grid1)
  44. # Factor
  45. faclabel = QtGui.QLabel('Factor:')
  46. faclabel.setToolTip(
  47. "Factor by which to multiply\n"
  48. "geometric features of this object."
  49. )
  50. grid1.addWidget(faclabel, 0, 0)
  51. self.scale_entry = FloatEntry()
  52. self.scale_entry.set_value(1.0)
  53. grid1.addWidget(self.scale_entry, 0, 1)
  54. # GO Button
  55. self.scale_button = QtGui.QPushButton('Scale')
  56. self.scale_button.setToolTip(
  57. "Perform scaling operation."
  58. )
  59. layout.addWidget(self.scale_button)
  60. ## Offset
  61. self.offset_label = QtGui.QLabel('<b>Offset:</b>')
  62. self.offset_label.setToolTip(
  63. "Change the position of this object."
  64. )
  65. layout.addWidget(self.offset_label)
  66. grid2 = QtGui.QGridLayout()
  67. layout.addLayout(grid2)
  68. self.offset_label = QtGui.QLabel('Vector:')
  69. self.offset_label.setToolTip(
  70. "Amount by which to move the object\n"
  71. "in the x and y axes in (x, y) format."
  72. )
  73. grid2.addWidget(self.offset_label, 0, 0)
  74. self.offsetvector_entry = EvalEntry()
  75. self.offsetvector_entry.setText("(0.0, 0.0)")
  76. grid2.addWidget(self.offsetvector_entry, 0, 1)
  77. self.offset_button = QtGui.QPushButton('Offset')
  78. self.offset_button.setToolTip(
  79. "Perform the offset operation."
  80. )
  81. layout.addWidget(self.offset_button)
  82. layout.addStretch()
  83. class CNCObjectUI(ObjectUI):
  84. """
  85. User interface for CNCJob objects.
  86. """
  87. def __init__(self, parent=None):
  88. ObjectUI.__init__(self, title='CNC Job Object', icon_file='share/cnc32.png', parent=parent)
  89. ## Plot options
  90. self.plot_options_label = QtGui.QLabel("<b>Plot Options:</b>")
  91. self.custom_box.addWidget(self.plot_options_label)
  92. grid0 = QtGui.QGridLayout()
  93. self.custom_box.addLayout(grid0)
  94. # Plot CB
  95. # self.plot_cb = QtGui.QCheckBox('Plot')
  96. self.plot_cb = FCCheckBox('Plot')
  97. self.plot_cb.setToolTip(
  98. "Plot (show) this object."
  99. )
  100. grid0.addWidget(self.plot_cb, 0, 0)
  101. # Tool dia for plot
  102. tdlabel = QtGui.QLabel('Tool dia:')
  103. tdlabel.setToolTip(
  104. "Diameter of the tool to be\n"
  105. "rendered in the plot."
  106. )
  107. grid0.addWidget(tdlabel, 1, 0)
  108. self.tooldia_entry = LengthEntry()
  109. grid0.addWidget(self.tooldia_entry, 1, 1)
  110. # Update plot button
  111. self.updateplot_button = QtGui.QPushButton('Update Plot')
  112. self.updateplot_button.setToolTip(
  113. "Update the plot."
  114. )
  115. self.custom_box.addWidget(self.updateplot_button)
  116. ## Export G-Code
  117. self.export_gcode_label = QtGui.QLabel("<b>Export G-Code:</b>")
  118. self.export_gcode_label.setToolTip(
  119. "Export and save G-Code to\n"
  120. "make this object to a file."
  121. )
  122. self.custom_box.addWidget(self.export_gcode_label)
  123. # Append text to Gerber
  124. appendlabel = QtGui.QLabel('Append to G-Code:')
  125. appendlabel.setToolTip(
  126. "Type here any G-Code commands you would\n"
  127. "like to append to the generated file.\n"
  128. "I.e.: M2 (End of program)"
  129. )
  130. self.custom_box.addWidget(appendlabel)
  131. self.append_text = FCTextArea()
  132. self.custom_box.addWidget(self.append_text)
  133. # GO Button
  134. self.export_gcode_button = QtGui.QPushButton('Export G-Code')
  135. self.export_gcode_button.setToolTip(
  136. "Opens dialog to save G-Code\n"
  137. "file."
  138. )
  139. self.custom_box.addWidget(self.export_gcode_button)
  140. class GeometryObjectUI(ObjectUI):
  141. """
  142. User interface for Geometry objects.
  143. """
  144. def __init__(self, parent=None):
  145. super(GeometryObjectUI, self).__init__(title='Geometry Object', icon_file='share/geometry32.png', parent=parent)
  146. ## Plot options
  147. self.plot_options_label = QtGui.QLabel("<b>Plot Options:</b>")
  148. self.custom_box.addWidget(self.plot_options_label)
  149. # Plot CB
  150. self.plot_cb = FCCheckBox(label='Plot')
  151. self.plot_cb.setToolTip(
  152. "Plot (show) this object."
  153. )
  154. self.custom_box.addWidget(self.plot_cb)
  155. ## Create CNC Job
  156. self.cncjob_label = QtGui.QLabel('<b>Create CNC Job:</b>')
  157. self.cncjob_label.setToolTip(
  158. "Create a CNC Job object\n"
  159. "tracing the contours of this\n"
  160. "Geometry object."
  161. )
  162. self.custom_box.addWidget(self.cncjob_label)
  163. grid1 = QtGui.QGridLayout()
  164. self.custom_box.addLayout(grid1)
  165. cutzlabel = QtGui.QLabel('Cut Z:')
  166. cutzlabel.setToolTip(
  167. "Cutting depth (negative)\n"
  168. "below the copper surface."
  169. )
  170. grid1.addWidget(cutzlabel, 0, 0)
  171. self.cutz_entry = LengthEntry()
  172. grid1.addWidget(self.cutz_entry, 0, 1)
  173. # Travel Z
  174. travelzlabel = QtGui.QLabel('Travel Z:')
  175. travelzlabel.setToolTip(
  176. "Height of the tool when\n"
  177. "moving without cutting."
  178. )
  179. grid1.addWidget(travelzlabel, 1, 0)
  180. self.travelz_entry = LengthEntry()
  181. grid1.addWidget(self.travelz_entry, 1, 1)
  182. # Feedrate
  183. frlabel = QtGui.QLabel('Feed Rate:')
  184. frlabel.setToolTip(
  185. "Cutting speed in the XY\n"
  186. "plane in units per minute"
  187. )
  188. grid1.addWidget(frlabel, 2, 0)
  189. self.cncfeedrate_entry = LengthEntry()
  190. grid1.addWidget(self.cncfeedrate_entry, 2, 1)
  191. # Tooldia
  192. tdlabel = QtGui.QLabel('Tool dia:')
  193. tdlabel.setToolTip(
  194. "The diameter of the cutting\n"
  195. "tool (just for display)."
  196. )
  197. grid1.addWidget(tdlabel, 3, 0)
  198. self.cnctooldia_entry = LengthEntry()
  199. grid1.addWidget(self.cnctooldia_entry, 3, 1)
  200. self.generate_cnc_button = QtGui.QPushButton('Generate')
  201. self.generate_cnc_button.setToolTip(
  202. "Generate the CNC Job object."
  203. )
  204. self.custom_box.addWidget(self.generate_cnc_button)
  205. ################
  206. ## Paint area ##
  207. ################
  208. self.paint_label = QtGui.QLabel('<b>Paint Area:</b>')
  209. self.paint_label.setToolTip(
  210. "Creates tool paths to cover the\n"
  211. "whole area of a polygon (remove\n"
  212. "all copper). You will be asked\n"
  213. "to click on the desired polygon."
  214. )
  215. self.custom_box.addWidget(self.paint_label)
  216. grid2 = QtGui.QGridLayout()
  217. self.custom_box.addLayout(grid2)
  218. # Tool dia
  219. ptdlabel = QtGui.QLabel('Tool dia:')
  220. ptdlabel.setToolTip(
  221. "Diameter of the tool to\n"
  222. "be used in the operation."
  223. )
  224. grid2.addWidget(ptdlabel, 0, 0)
  225. self.painttooldia_entry = LengthEntry()
  226. grid2.addWidget(self.painttooldia_entry, 0, 1)
  227. # Overlap
  228. ovlabel = QtGui.QLabel('Overlap:')
  229. ovlabel.setToolTip(
  230. "How much (fraction) of the tool\n"
  231. "width to overlap each tool pass."
  232. )
  233. grid2.addWidget(ovlabel, 1, 0)
  234. self.paintoverlap_entry = LengthEntry()
  235. grid2.addWidget(self.paintoverlap_entry, 1, 1)
  236. # Margin
  237. marginlabel = QtGui.QLabel('Margin:')
  238. marginlabel.setToolTip(
  239. "Distance by which to avoid\n"
  240. "the edges of the polygon to\n"
  241. "be painted."
  242. )
  243. grid2.addWidget(marginlabel, 2, 0)
  244. self.paintmargin_entry = LengthEntry()
  245. grid2.addWidget(self.paintmargin_entry, 2, 1)
  246. # Method
  247. methodlabel = QtGui.QLabel('Method:')
  248. methodlabel.setToolTip(
  249. "Algorithm to paint the polygon:<BR>"
  250. "<B>Standard</B>: Fixed step inwards.<BR>"
  251. "<B>Seed-based</B>: Outwards from seed."
  252. )
  253. grid2.addWidget(methodlabel, 3, 0)
  254. self.paintmethod_combo = RadioSet([
  255. {"label": "Standard", "value": "standard"},
  256. {"label": "Seed-based", "value": "seed"}
  257. ])
  258. grid2.addWidget(self.paintmethod_combo, 3, 1)
  259. # GO Button
  260. self.generate_paint_button = QtGui.QPushButton('Generate')
  261. self.generate_paint_button.setToolTip(
  262. "After clicking here, click inside\n"
  263. "the polygon you wish to be painted.\n"
  264. "A new Geometry object with the tool\n"
  265. "paths will be created."
  266. )
  267. self.custom_box.addWidget(self.generate_paint_button)
  268. class ExcellonObjectUI(ObjectUI):
  269. """
  270. User interface for Excellon objects.
  271. """
  272. def __init__(self, parent=None):
  273. ObjectUI.__init__(self, title='Excellon Object', icon_file='share/drill32.png', parent=parent)
  274. ## Plot options
  275. self.plot_options_label = QtGui.QLabel("<b>Plot Options:</b>")
  276. self.custom_box.addWidget(self.plot_options_label)
  277. grid0 = QtGui.QGridLayout()
  278. self.custom_box.addLayout(grid0)
  279. self.plot_cb = FCCheckBox(label='Plot')
  280. self.plot_cb.setToolTip(
  281. "Plot (show) this object."
  282. )
  283. grid0.addWidget(self.plot_cb, 0, 0)
  284. self.solid_cb = FCCheckBox(label='Solid')
  285. self.solid_cb.setToolTip(
  286. "Solid circles."
  287. )
  288. grid0.addWidget(self.solid_cb, 0, 1)
  289. ## Tools
  290. self.tools_table_label = QtGui.QLabel('<b>Tools</b>')
  291. self.tools_table_label.setToolTip(
  292. "Tools in this Excellon object."
  293. )
  294. self.custom_box.addWidget(self.tools_table_label)
  295. self.tools_table = QtGui.QTableWidget()
  296. self.tools_table.setFixedHeight(100)
  297. self.custom_box.addWidget(self.tools_table)
  298. ## Create CNC Job
  299. self.cncjob_label = QtGui.QLabel('<b>Create CNC Job</b>')
  300. self.cncjob_label.setToolTip(
  301. "Create a CNC Job object\n"
  302. "for this drill object."
  303. )
  304. self.custom_box.addWidget(self.cncjob_label)
  305. grid1 = QtGui.QGridLayout()
  306. self.custom_box.addLayout(grid1)
  307. cutzlabel = QtGui.QLabel('Cut Z:')
  308. cutzlabel.setToolTip(
  309. "Drill depth (negative)\n"
  310. "below the copper surface."
  311. )
  312. grid1.addWidget(cutzlabel, 0, 0)
  313. self.cutz_entry = LengthEntry()
  314. grid1.addWidget(self.cutz_entry, 0, 1)
  315. travelzlabel = QtGui.QLabel('Travel Z:')
  316. travelzlabel.setToolTip(
  317. "Tool height when travelling\n"
  318. "across the XY plane."
  319. )
  320. grid1.addWidget(travelzlabel, 1, 0)
  321. self.travelz_entry = LengthEntry()
  322. grid1.addWidget(self.travelz_entry, 1, 1)
  323. frlabel = QtGui.QLabel('Feed rate:')
  324. frlabel.setToolTip(
  325. "Tool speed while drilling\n"
  326. "(in units per minute)."
  327. )
  328. grid1.addWidget(frlabel, 2, 0)
  329. self.feedrate_entry = LengthEntry()
  330. grid1.addWidget(self.feedrate_entry, 2, 1)
  331. choose_tools_label = QtGui.QLabel(
  332. "Select from the tools section above\n"
  333. "the tools you want to include."
  334. )
  335. self.custom_box.addWidget(choose_tools_label)
  336. self.generate_cnc_button = QtGui.QPushButton('Generate')
  337. self.generate_cnc_button.setToolTip(
  338. "Generate the CNC Job."
  339. )
  340. self.custom_box.addWidget(self.generate_cnc_button)
  341. ## Milling Holes
  342. self.mill_hole_label = QtGui.QLabel('<b>Mill Holes</b>')
  343. self.mill_hole_label.setToolTip(
  344. "Create Geometry for milling holes."
  345. )
  346. self.custom_box.addWidget(self.mill_hole_label)
  347. grid1 = QtGui.QGridLayout()
  348. self.custom_box.addLayout(grid1)
  349. tdlabel = QtGui.QLabel('Tool dia:')
  350. tdlabel.setToolTip(
  351. "Diameter of the cutting tool."
  352. )
  353. grid1.addWidget(tdlabel, 0, 0)
  354. self.tooldia_entry = LengthEntry()
  355. grid1.addWidget(self.tooldia_entry, 0, 1)
  356. choose_tools_label2 = QtGui.QLabel(
  357. "Select from the tools section above\n"
  358. "the tools you want to include."
  359. )
  360. self.custom_box.addWidget(choose_tools_label2)
  361. self.generate_milling_button = QtGui.QPushButton('Generate Geometry')
  362. self.generate_milling_button.setToolTip(
  363. "Create the Geometry Object\n"
  364. "for milling toolpaths."
  365. )
  366. self.custom_box.addWidget(self.generate_milling_button)
  367. class GerberObjectUI(ObjectUI):
  368. """
  369. User interface for Gerber objects.
  370. """
  371. def __init__(self, parent=None):
  372. ObjectUI.__init__(self, title='Gerber Object', parent=parent)
  373. ## Plot options
  374. self.plot_options_label = QtGui.QLabel("<b>Plot Options:</b>")
  375. self.custom_box.addWidget(self.plot_options_label)
  376. grid0 = QtGui.QGridLayout()
  377. self.custom_box.addLayout(grid0)
  378. # Plot CB
  379. self.plot_cb = FCCheckBox(label='Plot')
  380. self.plot_options_label.setToolTip(
  381. "Plot (show) this object."
  382. )
  383. grid0.addWidget(self.plot_cb, 0, 0)
  384. # Solid CB
  385. self.solid_cb = FCCheckBox(label='Solid')
  386. self.solid_cb.setToolTip(
  387. "Solid color polygons."
  388. )
  389. grid0.addWidget(self.solid_cb, 0, 1)
  390. # Multicolored CB
  391. self.multicolored_cb = FCCheckBox(label='Multicolored')
  392. self.multicolored_cb.setToolTip(
  393. "Draw polygons in different colors."
  394. )
  395. grid0.addWidget(self.multicolored_cb, 0, 2)
  396. ## Isolation Routing
  397. self.isolation_routing_label = QtGui.QLabel("<b>Isolation Routing:</b>")
  398. self.isolation_routing_label.setToolTip(
  399. "Create a Geometry object with\n"
  400. "toolpaths to cut outside polygons."
  401. )
  402. self.custom_box.addWidget(self.isolation_routing_label)
  403. grid1 = QtGui.QGridLayout()
  404. self.custom_box.addLayout(grid1)
  405. tdlabel = QtGui.QLabel('Tool dia:')
  406. tdlabel.setToolTip(
  407. "Diameter of the cutting tool."
  408. )
  409. grid1.addWidget(tdlabel, 0, 0)
  410. self.iso_tool_dia_entry = LengthEntry()
  411. grid1.addWidget(self.iso_tool_dia_entry, 0, 1)
  412. passlabel = QtGui.QLabel('Width (# passes):')
  413. passlabel.setToolTip(
  414. "Width of the isolation gap in\n"
  415. "number (integer) of tool widths."
  416. )
  417. grid1.addWidget(passlabel, 1, 0)
  418. self.iso_width_entry = IntEntry()
  419. grid1.addWidget(self.iso_width_entry, 1, 1)
  420. overlabel = QtGui.QLabel('Pass overlap:')
  421. overlabel.setToolTip(
  422. "How much (fraction of tool width)\n"
  423. "to overlap each pass."
  424. )
  425. grid1.addWidget(overlabel, 2, 0)
  426. self.iso_overlap_entry = FloatEntry()
  427. grid1.addWidget(self.iso_overlap_entry, 2, 1)
  428. self.generate_iso_button = QtGui.QPushButton('Generate Geometry')
  429. self.generate_iso_button.setToolTip(
  430. "Create the Geometry Object\n"
  431. "for isolation routing."
  432. )
  433. self.custom_box.addWidget(self.generate_iso_button)
  434. ## Board cuttout
  435. self.board_cutout_label = QtGui.QLabel("<b>Board cutout:</b>")
  436. self.board_cutout_label.setToolTip(
  437. "Create toolpaths to cut around\n"
  438. "the PCB and separate it from\n"
  439. "the original board."
  440. )
  441. self.custom_box.addWidget(self.board_cutout_label)
  442. grid2 = QtGui.QGridLayout()
  443. self.custom_box.addLayout(grid2)
  444. tdclabel = QtGui.QLabel('Tool dia:')
  445. tdclabel.setToolTip(
  446. "Diameter of the cutting tool."
  447. )
  448. grid2.addWidget(tdclabel, 0, 0)
  449. self.cutout_tooldia_entry = LengthEntry()
  450. grid2.addWidget(self.cutout_tooldia_entry, 0, 1)
  451. marginlabel = QtGui.QLabel('Margin:')
  452. marginlabel.setToolTip(
  453. "Distance from objects at which\n"
  454. "to draw the cutout."
  455. )
  456. grid2.addWidget(marginlabel, 1, 0)
  457. self.cutout_margin_entry = LengthEntry()
  458. grid2.addWidget(self.cutout_margin_entry, 1, 1)
  459. gaplabel = QtGui.QLabel('Gap size:')
  460. gaplabel.setToolTip(
  461. "Size of the gaps in the toolpath\n"
  462. "that will remain to hold the\n"
  463. "board in place."
  464. )
  465. grid2.addWidget(gaplabel, 2, 0)
  466. self.cutout_gap_entry = LengthEntry()
  467. grid2.addWidget(self.cutout_gap_entry, 2, 1)
  468. gapslabel = QtGui.QLabel('Gaps:')
  469. gapslabel.setToolTip(
  470. "Where to place the gaps, Top/Bottom\n"
  471. "Left/Rigt, or on all 4 sides."
  472. )
  473. grid2.addWidget(gapslabel, 3, 0)
  474. self.gaps_radio = RadioSet([{'label': '2 (T/B)', 'value': 'tb'},
  475. {'label': '2 (L/R)', 'value': 'lr'},
  476. {'label': '4', 'value': '4'}])
  477. grid2.addWidget(self.gaps_radio, 3, 1)
  478. self.generate_cutout_button = QtGui.QPushButton('Generate Geometry')
  479. self.generate_cutout_button.setToolTip(
  480. "Generate the geometry for\n"
  481. "the board cutout."
  482. )
  483. self.custom_box.addWidget(self.generate_cutout_button)
  484. ## Non-copper regions
  485. self.noncopper_label = QtGui.QLabel("<b>Non-copper regions:</b>")
  486. self.noncopper_label.setToolTip(
  487. "Create polygons covering the\n"
  488. "areas without copper on the PCB.\n"
  489. "Equivalent to the inverse of this\n"
  490. "object. Can be used to remove all\n"
  491. "copper from a specified region."
  492. )
  493. self.custom_box.addWidget(self.noncopper_label)
  494. grid3 = QtGui.QGridLayout()
  495. self.custom_box.addLayout(grid3)
  496. # Margin
  497. bmlabel = QtGui.QLabel('Boundary Margin:')
  498. bmlabel.setToolTip(
  499. "Specify the edge of the PCB\n"
  500. "by drawing a box around all\n"
  501. "objects with this minimum\n"
  502. "distance."
  503. )
  504. grid3.addWidget(bmlabel, 0, 0)
  505. self.noncopper_margin_entry = LengthEntry()
  506. grid3.addWidget(self.noncopper_margin_entry, 0, 1)
  507. # Rounded corners
  508. self.noncopper_rounded_cb = FCCheckBox(label="Rounded corners")
  509. self.noncopper_rounded_cb.setToolTip(
  510. "Creates a Geometry objects with polygons\n"
  511. "covering the copper-free areas of the PCB."
  512. )
  513. grid3.addWidget(self.noncopper_rounded_cb, 1, 0, 1, 2)
  514. self.generate_noncopper_button = QtGui.QPushButton('Generate Geometry')
  515. self.custom_box.addWidget(self.generate_noncopper_button)
  516. ## Bounding box
  517. self.boundingbox_label = QtGui.QLabel('<b>Bounding Box:</b>')
  518. self.custom_box.addWidget(self.boundingbox_label)
  519. grid4 = QtGui.QGridLayout()
  520. self.custom_box.addLayout(grid4)
  521. bbmargin = QtGui.QLabel('Boundary Margin:')
  522. bbmargin.setToolTip(
  523. "Distance of the edges of the box\n"
  524. "to the nearest polygon."
  525. )
  526. grid4.addWidget(bbmargin, 0, 0)
  527. self.bbmargin_entry = LengthEntry()
  528. grid4.addWidget(self.bbmargin_entry, 0, 1)
  529. self.bbrounded_cb = FCCheckBox(label="Rounded corners")
  530. self.bbrounded_cb.setToolTip(
  531. "If the bounding box is \n"
  532. "to have rounded corners\n"
  533. "their radius is equal to\n"
  534. "the margin."
  535. )
  536. grid4.addWidget(self.bbrounded_cb, 1, 0, 1, 2)
  537. self.generate_bb_button = QtGui.QPushButton('Generate Geometry')
  538. self.generate_bb_button.setToolTip(
  539. "Genrate the Geometry object."
  540. )
  541. self.custom_box.addWidget(self.generate_bb_button)
  542. # def main():
  543. #
  544. # app = QtGui.QApplication(sys.argv)
  545. # fc = GerberObjectUI()
  546. # sys.exit(app.exec_())
  547. #
  548. #
  549. # if __name__ == '__main__':
  550. # main()