ObjectUI.py 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644
  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."
  250. )
  251. grid2.addWidget(methodlabel, 3, 0)
  252. self.paintmethod_combo = RadioSet([
  253. {"label": "Standard", "value": "standard"},
  254. {"label": "Seed-based", "value": "seed"}
  255. ])
  256. grid2.addWidget(self.paintmethod_combo, 3, 1)
  257. # GO Button
  258. self.generate_paint_button = QtGui.QPushButton('Generate')
  259. self.generate_paint_button.setToolTip(
  260. "After clicking here, click inside\n"
  261. "the polygon you wish to be painted.\n"
  262. "A new Geometry object with the tool\n"
  263. "paths will be created."
  264. )
  265. self.custom_box.addWidget(self.generate_paint_button)
  266. class ExcellonObjectUI(ObjectUI):
  267. """
  268. User interface for Excellon objects.
  269. """
  270. def __init__(self, parent=None):
  271. ObjectUI.__init__(self, title='Excellon Object', icon_file='share/drill32.png', parent=parent)
  272. ## Plot options
  273. self.plot_options_label = QtGui.QLabel("<b>Plot Options:</b>")
  274. self.custom_box.addWidget(self.plot_options_label)
  275. grid0 = QtGui.QGridLayout()
  276. self.custom_box.addLayout(grid0)
  277. self.plot_cb = FCCheckBox(label='Plot')
  278. self.plot_cb.setToolTip(
  279. "Plot (show) this object."
  280. )
  281. grid0.addWidget(self.plot_cb, 0, 0)
  282. self.solid_cb = FCCheckBox(label='Solid')
  283. self.solid_cb.setToolTip(
  284. "Solid circles."
  285. )
  286. grid0.addWidget(self.solid_cb, 0, 1)
  287. ## Tools
  288. self.tools_table_label = QtGui.QLabel('<b>Tools</b>')
  289. self.tools_table_label.setToolTip(
  290. "Tools in this Excellon object."
  291. )
  292. self.custom_box.addWidget(self.tools_table_label)
  293. self.tools_table = QtGui.QTableWidget()
  294. self.tools_table.setFixedHeight(100)
  295. self.custom_box.addWidget(self.tools_table)
  296. ## Create CNC Job
  297. self.cncjob_label = QtGui.QLabel('<b>Create CNC Job</b>')
  298. self.cncjob_label.setToolTip(
  299. "Create a CNC Job object\n"
  300. "for this drill object."
  301. )
  302. self.custom_box.addWidget(self.cncjob_label)
  303. grid1 = QtGui.QGridLayout()
  304. self.custom_box.addLayout(grid1)
  305. cutzlabel = QtGui.QLabel('Cut Z:')
  306. cutzlabel.setToolTip(
  307. "Drill depth (negative)\n"
  308. "below the copper surface."
  309. )
  310. grid1.addWidget(cutzlabel, 0, 0)
  311. self.cutz_entry = LengthEntry()
  312. grid1.addWidget(self.cutz_entry, 0, 1)
  313. travelzlabel = QtGui.QLabel('Travel Z:')
  314. travelzlabel.setToolTip(
  315. "Tool height when travelling\n"
  316. "across the XY plane."
  317. )
  318. grid1.addWidget(travelzlabel, 1, 0)
  319. self.travelz_entry = LengthEntry()
  320. grid1.addWidget(self.travelz_entry, 1, 1)
  321. frlabel = QtGui.QLabel('Feed rate:')
  322. frlabel.setToolTip(
  323. "Tool speed while drilling\n"
  324. "(in units per minute)."
  325. )
  326. grid1.addWidget(frlabel, 2, 0)
  327. self.feedrate_entry = LengthEntry()
  328. grid1.addWidget(self.feedrate_entry, 2, 1)
  329. choose_tools_label = QtGui.QLabel(
  330. "Select from the tools section above\n"
  331. "the tools you want to include."
  332. )
  333. self.custom_box.addWidget(choose_tools_label)
  334. self.generate_cnc_button = QtGui.QPushButton('Generate')
  335. self.generate_cnc_button.setToolTip(
  336. "Generate the CNC Job."
  337. )
  338. self.custom_box.addWidget(self.generate_cnc_button)
  339. ## Milling Holes
  340. self.mill_hole_label = QtGui.QLabel('<b>Mill Holes</b>')
  341. self.mill_hole_label.setToolTip(
  342. "Create Geometry for milling holes."
  343. )
  344. self.custom_box.addWidget(self.mill_hole_label)
  345. grid1 = QtGui.QGridLayout()
  346. self.custom_box.addLayout(grid1)
  347. tdlabel = QtGui.QLabel('Tool dia:')
  348. tdlabel.setToolTip(
  349. "Diameter of the cutting tool."
  350. )
  351. grid1.addWidget(tdlabel, 0, 0)
  352. self.tooldia_entry = LengthEntry()
  353. grid1.addWidget(self.tooldia_entry, 0, 1)
  354. choose_tools_label2 = QtGui.QLabel(
  355. "Select from the tools section above\n"
  356. "the tools you want to include."
  357. )
  358. self.custom_box.addWidget(choose_tools_label2)
  359. self.generate_milling_button = QtGui.QPushButton('Generate Geometry')
  360. self.generate_milling_button.setToolTip(
  361. "Create the Geometry Object\n"
  362. "for milling toolpaths."
  363. )
  364. self.custom_box.addWidget(self.generate_milling_button)
  365. class GerberObjectUI(ObjectUI):
  366. """
  367. User interface for Gerber objects.
  368. """
  369. def __init__(self, parent=None):
  370. ObjectUI.__init__(self, title='Gerber Object', parent=parent)
  371. ## Plot options
  372. self.plot_options_label = QtGui.QLabel("<b>Plot Options:</b>")
  373. self.custom_box.addWidget(self.plot_options_label)
  374. grid0 = QtGui.QGridLayout()
  375. self.custom_box.addLayout(grid0)
  376. # Plot CB
  377. self.plot_cb = FCCheckBox(label='Plot')
  378. self.plot_options_label.setToolTip(
  379. "Plot (show) this object."
  380. )
  381. grid0.addWidget(self.plot_cb, 0, 0)
  382. # Solid CB
  383. self.solid_cb = FCCheckBox(label='Solid')
  384. self.solid_cb.setToolTip(
  385. "Solid color polygons."
  386. )
  387. grid0.addWidget(self.solid_cb, 0, 1)
  388. # Multicolored CB
  389. self.multicolored_cb = FCCheckBox(label='Multicolored')
  390. self.multicolored_cb.setToolTip(
  391. "Draw polygons in different colors."
  392. )
  393. grid0.addWidget(self.multicolored_cb, 0, 2)
  394. ## Isolation Routing
  395. self.isolation_routing_label = QtGui.QLabel("<b>Isolation Routing:</b>")
  396. self.isolation_routing_label.setToolTip(
  397. "Create a Geometry object with\n"
  398. "toolpaths to cut outside polygons."
  399. )
  400. self.custom_box.addWidget(self.isolation_routing_label)
  401. grid1 = QtGui.QGridLayout()
  402. self.custom_box.addLayout(grid1)
  403. tdlabel = QtGui.QLabel('Tool dia:')
  404. tdlabel.setToolTip(
  405. "Diameter of the cutting tool."
  406. )
  407. grid1.addWidget(tdlabel, 0, 0)
  408. self.iso_tool_dia_entry = LengthEntry()
  409. grid1.addWidget(self.iso_tool_dia_entry, 0, 1)
  410. passlabel = QtGui.QLabel('Width (# passes):')
  411. passlabel.setToolTip(
  412. "Width of the isolation gap in\n"
  413. "number (integer) of tool widths."
  414. )
  415. grid1.addWidget(passlabel, 1, 0)
  416. self.iso_width_entry = IntEntry()
  417. grid1.addWidget(self.iso_width_entry, 1, 1)
  418. overlabel = QtGui.QLabel('Pass overlap:')
  419. overlabel.setToolTip(
  420. "How much (fraction of tool width)\n"
  421. "to overlap each pass."
  422. )
  423. grid1.addWidget(overlabel, 2, 0)
  424. self.iso_overlap_entry = FloatEntry()
  425. grid1.addWidget(self.iso_overlap_entry, 2, 1)
  426. self.generate_iso_button = QtGui.QPushButton('Generate Geometry')
  427. self.generate_iso_button.setToolTip(
  428. "Create the Geometry Object\n"
  429. "for isolation routing."
  430. )
  431. self.custom_box.addWidget(self.generate_iso_button)
  432. ## Board cuttout
  433. self.board_cutout_label = QtGui.QLabel("<b>Board cutout:</b>")
  434. self.board_cutout_label.setToolTip(
  435. "Create toolpaths to cut around\n"
  436. "the PCB and separate it from\n"
  437. "the original board."
  438. )
  439. self.custom_box.addWidget(self.board_cutout_label)
  440. grid2 = QtGui.QGridLayout()
  441. self.custom_box.addLayout(grid2)
  442. tdclabel = QtGui.QLabel('Tool dia:')
  443. tdclabel.setToolTip(
  444. "Diameter of the cutting tool."
  445. )
  446. grid2.addWidget(tdclabel, 0, 0)
  447. self.cutout_tooldia_entry = LengthEntry()
  448. grid2.addWidget(self.cutout_tooldia_entry, 0, 1)
  449. marginlabel = QtGui.QLabel('Margin:')
  450. marginlabel.setToolTip(
  451. "Distance from objects at which\n"
  452. "to draw the cutout."
  453. )
  454. grid2.addWidget(marginlabel, 1, 0)
  455. self.cutout_margin_entry = LengthEntry()
  456. grid2.addWidget(self.cutout_margin_entry, 1, 1)
  457. gaplabel = QtGui.QLabel('Gap size:')
  458. gaplabel.setToolTip(
  459. "Size of the gaps in the toolpath\n"
  460. "that will remain to hold the\n"
  461. "board in place."
  462. )
  463. grid2.addWidget(gaplabel, 2, 0)
  464. self.cutout_gap_entry = LengthEntry()
  465. grid2.addWidget(self.cutout_gap_entry, 2, 1)
  466. gapslabel = QtGui.QLabel('Gaps:')
  467. gapslabel.setToolTip(
  468. "Where to place the gaps, Top/Bottom\n"
  469. "Left/Rigt, or on all 4 sides."
  470. )
  471. grid2.addWidget(gapslabel, 3, 0)
  472. self.gaps_radio = RadioSet([{'label': '2 (T/B)', 'value': 'tb'},
  473. {'label': '2 (L/R)', 'value': 'lr'},
  474. {'label': '4', 'value': '4'}])
  475. grid2.addWidget(self.gaps_radio, 3, 1)
  476. self.generate_cutout_button = QtGui.QPushButton('Generate Geometry')
  477. self.generate_cutout_button.setToolTip(
  478. "Generate the geometry for\n"
  479. "the board cutout."
  480. )
  481. self.custom_box.addWidget(self.generate_cutout_button)
  482. ## Non-copper regions
  483. self.noncopper_label = QtGui.QLabel("<b>Non-copper regions:</b>")
  484. self.noncopper_label.setToolTip(
  485. "Create polygons covering the\n"
  486. "areas without copper on the PCB.\n"
  487. "Equivalent to the inverse of this\n"
  488. "object. Can be used to remove all\n"
  489. "copper from a specified region."
  490. )
  491. self.custom_box.addWidget(self.noncopper_label)
  492. grid3 = QtGui.QGridLayout()
  493. self.custom_box.addLayout(grid3)
  494. # Margin
  495. bmlabel = QtGui.QLabel('Boundary Margin:')
  496. bmlabel.setToolTip(
  497. "Specify the edge of the PCB\n"
  498. "by drawing a box around all\n"
  499. "objects with this minimum\n"
  500. "distance."
  501. )
  502. grid3.addWidget(bmlabel, 0, 0)
  503. self.noncopper_margin_entry = LengthEntry()
  504. grid3.addWidget(self.noncopper_margin_entry, 0, 1)
  505. # Rounded corners
  506. self.noncopper_rounded_cb = FCCheckBox(label="Rounded corners")
  507. self.noncopper_rounded_cb.setToolTip(
  508. "Creates a Geometry objects with polygons\n"
  509. "covering the copper-free areas of the PCB."
  510. )
  511. grid3.addWidget(self.noncopper_rounded_cb, 1, 0, 1, 2)
  512. self.generate_noncopper_button = QtGui.QPushButton('Generate Geometry')
  513. self.custom_box.addWidget(self.generate_noncopper_button)
  514. ## Bounding box
  515. self.boundingbox_label = QtGui.QLabel('<b>Bounding Box:</b>')
  516. self.custom_box.addWidget(self.boundingbox_label)
  517. grid4 = QtGui.QGridLayout()
  518. self.custom_box.addLayout(grid4)
  519. bbmargin = QtGui.QLabel('Boundary Margin:')
  520. bbmargin.setToolTip(
  521. "Distance of the edges of the box\n"
  522. "to the nearest polygon."
  523. )
  524. grid4.addWidget(bbmargin, 0, 0)
  525. self.bbmargin_entry = LengthEntry()
  526. grid4.addWidget(self.bbmargin_entry, 0, 1)
  527. self.bbrounded_cb = FCCheckBox(label="Rounded corners")
  528. self.bbrounded_cb.setToolTip(
  529. "If the bounding box is \n"
  530. "to have rounded corners\n"
  531. "their radius is equal to\n"
  532. "the margin."
  533. )
  534. grid4.addWidget(self.bbrounded_cb, 1, 0, 1, 2)
  535. self.generate_bb_button = QtGui.QPushButton('Generate Geometry')
  536. self.generate_bb_button.setToolTip(
  537. "Genrate the Geometry object."
  538. )
  539. self.custom_box.addWidget(self.generate_bb_button)
  540. # def main():
  541. #
  542. # app = QtGui.QApplication(sys.argv)
  543. # fc = GerberObjectUI()
  544. # sys.exit(app.exec_())
  545. #
  546. #
  547. # if __name__ == '__main__':
  548. # main()