ToolsPanelizePrefGroupUI.py 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. from PyQt5 import QtWidgets
  2. from flatcamGUI.GUIElements import FCDoubleSpinner, FCSpinner, RadioSet, FCCheckBox
  3. from flatcamGUI.preferences.OptionsGroupUI import OptionsGroupUI
  4. class ToolsPanelizePrefGroupUI(OptionsGroupUI):
  5. def __init__(self, decimals=4, parent=None):
  6. # OptionsGroupUI.__init__(self, "Cutout Tool Options", parent=parent)
  7. super(ToolsPanelizePrefGroupUI, self).__init__(self)
  8. self.setTitle(str(_("Panelize Tool Options")))
  9. self.decimals = decimals
  10. # ## Board cuttout
  11. self.panelize_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  12. self.panelize_label.setToolTip(
  13. _("Create an object that contains an array of (x, y) elements,\n"
  14. "each element is a copy of the source object spaced\n"
  15. "at a X distance, Y distance of each other.")
  16. )
  17. self.layout.addWidget(self.panelize_label)
  18. grid0 = QtWidgets.QGridLayout()
  19. self.layout.addLayout(grid0)
  20. grid0.setColumnStretch(0, 0)
  21. grid0.setColumnStretch(1, 1)
  22. # ## Spacing Columns
  23. self.pspacing_columns = FCDoubleSpinner()
  24. self.pspacing_columns.set_range(0.000001, 9999.9999)
  25. self.pspacing_columns.set_precision(self.decimals)
  26. self.pspacing_columns.setSingleStep(0.1)
  27. self.spacing_columns_label = QtWidgets.QLabel('%s:' % _("Spacing cols"))
  28. self.spacing_columns_label.setToolTip(
  29. _("Spacing between columns of the desired panel.\n"
  30. "In current units.")
  31. )
  32. grid0.addWidget(self.spacing_columns_label, 0, 0)
  33. grid0.addWidget(self.pspacing_columns, 0, 1)
  34. # ## Spacing Rows
  35. self.pspacing_rows = FCDoubleSpinner()
  36. self.pspacing_rows.set_range(0.000001, 9999.9999)
  37. self.pspacing_rows.set_precision(self.decimals)
  38. self.pspacing_rows.setSingleStep(0.1)
  39. self.spacing_rows_label = QtWidgets.QLabel('%s:' % _("Spacing rows"))
  40. self.spacing_rows_label.setToolTip(
  41. _("Spacing between rows of the desired panel.\n"
  42. "In current units.")
  43. )
  44. grid0.addWidget(self.spacing_rows_label, 1, 0)
  45. grid0.addWidget(self.pspacing_rows, 1, 1)
  46. # ## Columns
  47. self.pcolumns = FCSpinner()
  48. self.pcolumns.set_range(1, 1000)
  49. self.pcolumns.set_step(1)
  50. self.columns_label = QtWidgets.QLabel('%s:' % _("Columns"))
  51. self.columns_label.setToolTip(
  52. _("Number of columns of the desired panel")
  53. )
  54. grid0.addWidget(self.columns_label, 2, 0)
  55. grid0.addWidget(self.pcolumns, 2, 1)
  56. # ## Rows
  57. self.prows = FCSpinner()
  58. self.prows.set_range(1, 1000)
  59. self.prows.set_step(1)
  60. self.rows_label = QtWidgets.QLabel('%s:' % _("Rows"))
  61. self.rows_label.setToolTip(
  62. _("Number of rows of the desired panel")
  63. )
  64. grid0.addWidget(self.rows_label, 3, 0)
  65. grid0.addWidget(self.prows, 3, 1)
  66. # ## Type of resulting Panel object
  67. self.panel_type_radio = RadioSet([{'label': _('Gerber'), 'value': 'gerber'},
  68. {'label': _('Geo'), 'value': 'geometry'}])
  69. self.panel_type_label = QtWidgets.QLabel('%s:' % _("Panel Type"))
  70. self.panel_type_label.setToolTip(
  71. _("Choose the type of object for the panel object:\n"
  72. "- Gerber\n"
  73. "- Geometry")
  74. )
  75. grid0.addWidget(self.panel_type_label, 4, 0)
  76. grid0.addWidget(self.panel_type_radio, 4, 1)
  77. # ## Constrains
  78. self.pconstrain_cb = FCCheckBox('%s:' % _("Constrain within"))
  79. self.pconstrain_cb.setToolTip(
  80. _("Area define by DX and DY within to constrain the panel.\n"
  81. "DX and DY values are in current units.\n"
  82. "Regardless of how many columns and rows are desired,\n"
  83. "the final panel will have as many columns and rows as\n"
  84. "they fit completely within selected area.")
  85. )
  86. grid0.addWidget(self.pconstrain_cb, 5, 0, 1, 2)
  87. self.px_width_entry = FCDoubleSpinner()
  88. self.px_width_entry.set_range(0.000001, 9999.9999)
  89. self.px_width_entry.set_precision(self.decimals)
  90. self.px_width_entry.setSingleStep(0.1)
  91. self.x_width_lbl = QtWidgets.QLabel('%s:' % _("Width (DX)"))
  92. self.x_width_lbl.setToolTip(
  93. _("The width (DX) within which the panel must fit.\n"
  94. "In current units.")
  95. )
  96. grid0.addWidget(self.x_width_lbl, 6, 0)
  97. grid0.addWidget(self.px_width_entry, 6, 1)
  98. self.py_height_entry = FCDoubleSpinner()
  99. self.py_height_entry.set_range(0.000001, 9999.9999)
  100. self.py_height_entry.set_precision(self.decimals)
  101. self.py_height_entry.setSingleStep(0.1)
  102. self.y_height_lbl = QtWidgets.QLabel('%s:' % _("Height (DY)"))
  103. self.y_height_lbl.setToolTip(
  104. _("The height (DY)within which the panel must fit.\n"
  105. "In current units.")
  106. )
  107. grid0.addWidget(self.y_height_lbl, 7, 0)
  108. grid0.addWidget(self.py_height_entry, 7, 1)
  109. self.layout.addStretch()