ToolPanelize.py 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599
  1. from FlatCAMTool import FlatCAMTool
  2. from copy import copy, deepcopy
  3. from ObjectCollection import *
  4. import time
  5. class Panelize(FlatCAMTool):
  6. toolName = "Panelize PCB"
  7. def __init__(self, app):
  8. super(Panelize, self).__init__(self)
  9. self.app = app
  10. ## Title
  11. title_label = QtWidgets.QLabel("%s" % self.toolName)
  12. title_label.setStyleSheet("""
  13. QLabel
  14. {
  15. font-size: 16px;
  16. font-weight: bold;
  17. }
  18. """)
  19. self.layout.addWidget(title_label)
  20. ## Form Layout
  21. form_layout = QtWidgets.QFormLayout()
  22. self.layout.addLayout(form_layout)
  23. ## Type of object to be panelized
  24. self.type_obj_combo = QtWidgets.QComboBox()
  25. self.type_obj_combo.addItem("Gerber")
  26. self.type_obj_combo.addItem("Excellon")
  27. self.type_obj_combo.addItem("Geometry")
  28. self.type_obj_combo.setItemIcon(0, QtGui.QIcon("share/flatcam_icon16.png"))
  29. self.type_obj_combo.setItemIcon(1, QtGui.QIcon("share/drill16.png"))
  30. self.type_obj_combo.setItemIcon(2, QtGui.QIcon("share/geometry16.png"))
  31. self.type_obj_combo_label = QtWidgets.QLabel("Object Type:")
  32. self.type_obj_combo_label.setToolTip(
  33. "Specify the type of object to be panelized\n"
  34. "It can be of type: Gerber, Excellon or Geometry.\n"
  35. "The selection here decide the type of objects that will be\n"
  36. "in the Object combobox."
  37. )
  38. form_layout.addRow(self.type_obj_combo_label, self.type_obj_combo)
  39. ## Object to be panelized
  40. self.object_combo = QtWidgets.QComboBox()
  41. self.object_combo.setModel(self.app.collection)
  42. self.object_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
  43. self.object_combo.setCurrentIndex(1)
  44. self.object_label = QtWidgets.QLabel("Object:")
  45. self.object_label.setToolTip(
  46. "Object to be panelized. This means that it will\n"
  47. "be duplicated in an array of rows and columns."
  48. )
  49. form_layout.addRow(self.object_label, self.object_combo)
  50. ## Type of Box Object to be used as an envelope for panelization
  51. self.type_box_combo = QtWidgets.QComboBox()
  52. self.type_box_combo.addItem("Gerber")
  53. self.type_box_combo.addItem("Excellon")
  54. self.type_box_combo.addItem("Geometry")
  55. # we get rid of item1 ("Excellon") as it is not suitable for use as a "box" for panelizing
  56. self.type_box_combo.view().setRowHidden(1, True)
  57. self.type_box_combo.setItemIcon(0, QtGui.QIcon("share/flatcam_icon16.png"))
  58. self.type_box_combo.setItemIcon(2, QtGui.QIcon("share/geometry16.png"))
  59. self.type_box_combo_label = QtWidgets.QLabel("Box Type:")
  60. self.type_box_combo_label.setToolTip(
  61. "Specify the type of object to be used as an container for\n"
  62. "panelization. It can be: Gerber or Geometry type.\n"
  63. "The selection here decide the type of objects that will be\n"
  64. "in the Box Object combobox."
  65. )
  66. form_layout.addRow(self.type_box_combo_label, self.type_box_combo)
  67. ## Box
  68. self.box_combo = QtWidgets.QComboBox()
  69. self.box_combo.setModel(self.app.collection)
  70. self.box_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
  71. self.box_combo.setCurrentIndex(1)
  72. self.box_combo_label = QtWidgets.QLabel("Box Object:")
  73. self.box_combo_label.setToolTip(
  74. "The actual object that is used a container for the\n "
  75. "selected object that is to be panelized."
  76. )
  77. form_layout.addRow(self.box_combo_label, self.box_combo)
  78. ## Spacing Columns
  79. self.spacing_columns = FCEntry()
  80. self.spacing_columns_label = QtWidgets.QLabel("Spacing cols:")
  81. self.spacing_columns_label.setToolTip(
  82. "Spacing between columns of the desired panel.\n"
  83. "In current units."
  84. )
  85. form_layout.addRow(self.spacing_columns_label, self.spacing_columns)
  86. ## Spacing Rows
  87. self.spacing_rows = FCEntry()
  88. self.spacing_rows_label = QtWidgets.QLabel("Spacing rows:")
  89. self.spacing_rows_label.setToolTip(
  90. "Spacing between rows of the desired panel.\n"
  91. "In current units."
  92. )
  93. form_layout.addRow(self.spacing_rows_label, self.spacing_rows)
  94. ## Columns
  95. self.columns = FCEntry()
  96. self.columns_label = QtWidgets.QLabel("Columns:")
  97. self.columns_label.setToolTip(
  98. "Number of columns of the desired panel"
  99. )
  100. form_layout.addRow(self.columns_label, self.columns)
  101. ## Rows
  102. self.rows = FCEntry()
  103. self.rows_label = QtWidgets.QLabel("Rows:")
  104. self.rows_label.setToolTip(
  105. "Number of rows of the desired panel"
  106. )
  107. form_layout.addRow(self.rows_label, self.rows)
  108. ## Type of resulting Panel object
  109. self.panel_type_radio = RadioSet([{'label': 'Gerber', 'value': 'gerber'},
  110. {'label': 'Geometry', 'value': 'geometry'}])
  111. self.panel_type_label = QtWidgets.QLabel("Panel Type:")
  112. self.panel_type_label.setToolTip(
  113. "Choose the type of object for the panel object:\n"
  114. "- Geometry\n"
  115. "- Gerber"
  116. )
  117. form_layout.addRow(self.panel_type_label)
  118. form_layout.addRow(self.panel_type_radio)
  119. ## Constrains
  120. self.constrain_cb = FCCheckBox("Constrain panel within:")
  121. self.constrain_cb.setToolTip(
  122. "Area define by DX and DY within to constrain the panel.\n"
  123. "DX and DY values are in current units.\n"
  124. "Regardless of how many columns and rows are desired,\n"
  125. "the final panel will have as many columns and rows as\n"
  126. "they fit completely within selected area."
  127. )
  128. form_layout.addRow(self.constrain_cb)
  129. self.x_width_entry = FCEntry()
  130. self.x_width_lbl = QtWidgets.QLabel("Width (DX):")
  131. self.x_width_lbl.setToolTip(
  132. "The width (DX) within which the panel must fit.\n"
  133. "In current units."
  134. )
  135. form_layout.addRow(self.x_width_lbl, self.x_width_entry)
  136. self.y_height_entry = FCEntry()
  137. self.y_height_lbl = QtWidgets.QLabel("Height (DY):")
  138. self.y_height_lbl.setToolTip(
  139. "The height (DY)within which the panel must fit.\n"
  140. "In current units."
  141. )
  142. form_layout.addRow(self.y_height_lbl, self.y_height_entry)
  143. self.constrain_sel = OptionalInputSection(
  144. self.constrain_cb, [self.x_width_lbl, self.x_width_entry, self.y_height_lbl, self.y_height_entry])
  145. ## Buttons
  146. hlay_2 = QtWidgets.QHBoxLayout()
  147. self.layout.addLayout(hlay_2)
  148. hlay_2.addStretch()
  149. self.panelize_object_button = QtWidgets.QPushButton("Panelize Object")
  150. self.panelize_object_button.setToolTip(
  151. "Panelize the specified object around the specified box.\n"
  152. "In other words it creates multiple copies of the source object,\n"
  153. "arranged in a 2D array of rows and columns."
  154. )
  155. hlay_2.addWidget(self.panelize_object_button)
  156. self.layout.addStretch()
  157. ## Signals
  158. self.panelize_object_button.clicked.connect(self.on_panelize)
  159. self.type_obj_combo.currentIndexChanged.connect(self.on_type_obj_index_changed)
  160. self.type_box_combo.currentIndexChanged.connect(self.on_type_box_index_changed)
  161. # list to hold the temporary objects
  162. self.objs = []
  163. # final name for the panel object
  164. self.outname = ""
  165. # flag to signal the constrain was activated
  166. self.constrain_flag = False
  167. def run(self):
  168. self.app.report_usage("ToolPanelize()")
  169. # if the splitter is hidden, display it, else hide it but only if the current widget is the same
  170. if self.app.ui.splitter.sizes()[0] == 0:
  171. self.app.ui.splitter.setSizes([1, 1])
  172. else:
  173. if self.app.ui.tool_scroll_area.widget().objectName() == self.toolName:
  174. self.app.ui.splitter.setSizes([0, 1])
  175. FlatCAMTool.run(self)
  176. self.set_tool_ui()
  177. self.app.ui.notebook.setTabText(2, "Panel. Tool")
  178. def install(self, icon=None, separator=None, **kwargs):
  179. FlatCAMTool.install(self, icon, separator, shortcut='ALT+Z', **kwargs)
  180. def set_tool_ui(self):
  181. self.reset_fields()
  182. sp_c = self.app.defaults["tools_panelize_spacing_columns"] if \
  183. self.app.defaults["tools_panelize_spacing_columns"] else 0.0
  184. self.spacing_columns.set_value(float(sp_c))
  185. sp_r = self.app.defaults["tools_panelize_spacing_rows"] if \
  186. self.app.defaults["tools_panelize_spacing_rows"] else 0.0
  187. self.spacing_rows.set_value(float(sp_r))
  188. rr = self.app.defaults["tools_panelize_rows"] if \
  189. self.app.defaults["tools_panelize_rows"] else 0.0
  190. self.rows.set_value(int(rr))
  191. cc = self.app.defaults["tools_panelize_columns"] if \
  192. self.app.defaults["tools_panelize_columns"] else 0.0
  193. self.columns.set_value(int(cc))
  194. c_cb = self.app.defaults["tools_panelize_constrain"] if \
  195. self.app.defaults["tools_panelize_constrain"] else False
  196. self.constrain_cb.set_value(c_cb)
  197. x_w = self.app.defaults["tools_panelize_constrainx"] if \
  198. self.app.defaults["tools_panelize_constrainx"] else 0.0
  199. self.x_width_entry.set_value(float(x_w))
  200. y_w = self.app.defaults["tools_panelize_constrainy"] if \
  201. self.app.defaults["tools_panelize_constrainy"] else 0.0
  202. self.y_height_entry.set_value(float(y_w))
  203. panel_type = self.app.defaults["tools_panelize_panel_type"] if \
  204. self.app.defaults["tools_panelize_panel_type"] else 'gerber'
  205. self.panel_type_radio.set_value(panel_type)
  206. def on_type_obj_index_changed(self):
  207. obj_type = self.type_obj_combo.currentIndex()
  208. self.object_combo.setRootModelIndex(self.app.collection.index(obj_type, 0, QtCore.QModelIndex()))
  209. self.object_combo.setCurrentIndex(0)
  210. def on_type_box_index_changed(self):
  211. obj_type = self.type_box_combo.currentIndex()
  212. self.box_combo.setRootModelIndex(self.app.collection.index(obj_type, 0, QtCore.QModelIndex()))
  213. self.box_combo.setCurrentIndex(0)
  214. def on_panelize(self):
  215. name = self.object_combo.currentText()
  216. # Get source object.
  217. try:
  218. obj = self.app.collection.get_by_name(str(name))
  219. except:
  220. self.app.inform.emit("[ERROR_NOTCL]Could not retrieve object: %s" % name)
  221. return "Could not retrieve object: %s" % name
  222. panel_obj = obj
  223. if panel_obj is None:
  224. self.app.inform.emit("[ERROR_NOTCL]Object not found: %s" % panel_obj)
  225. return "Object not found: %s" % panel_obj
  226. boxname = self.box_combo.currentText()
  227. try:
  228. box = self.app.collection.get_by_name(boxname)
  229. except:
  230. self.app.inform.emit("[ERROR_NOTCL]Could not retrieve object: %s" % boxname)
  231. return "Could not retrieve object: %s" % boxname
  232. if box is None:
  233. self.app.inform.emit("[WARNING]No object Box. Using instead %s" % panel_obj)
  234. box = panel_obj
  235. self.outname = name + '_panelized'
  236. try:
  237. spacing_columns = float(self.spacing_columns.get_value())
  238. except ValueError:
  239. # try to convert comma to decimal point. if it's still not working error message and return
  240. try:
  241. spacing_columns = float(self.spacing_columns.get_value().replace(',', '.'))
  242. except ValueError:
  243. self.app.inform.emit("[ERROR_NOTCL]Wrong value format entered, "
  244. "use a number.")
  245. return
  246. spacing_columns = spacing_columns if spacing_columns is not None else 0
  247. try:
  248. spacing_rows = float(self.spacing_rows.get_value())
  249. except ValueError:
  250. # try to convert comma to decimal point. if it's still not working error message and return
  251. try:
  252. spacing_rows = float(self.spacing_rows.get_value().replace(',', '.'))
  253. except ValueError:
  254. self.app.inform.emit("[ERROR_NOTCL]Wrong value format entered, "
  255. "use a number.")
  256. return
  257. spacing_rows = spacing_rows if spacing_rows is not None else 0
  258. try:
  259. rows = int(self.rows.get_value())
  260. except ValueError:
  261. # try to convert comma to decimal point. if it's still not working error message and return
  262. try:
  263. rows = float(self.rows.get_value().replace(',', '.'))
  264. rows = int(rows)
  265. except ValueError:
  266. self.app.inform.emit("[ERROR_NOTCL]Wrong value format entered, "
  267. "use a number.")
  268. return
  269. rows = rows if rows is not None else 1
  270. try:
  271. columns = int(self.columns.get_value())
  272. except ValueError:
  273. # try to convert comma to decimal point. if it's still not working error message and return
  274. try:
  275. columns = float(self.columns.get_value().replace(',', '.'))
  276. columns = int(columns)
  277. except ValueError:
  278. self.app.inform.emit("[ERROR_NOTCL]Wrong value format entered, "
  279. "use a number.")
  280. return
  281. columns = columns if columns is not None else 1
  282. try:
  283. constrain_dx = float(self.x_width_entry.get_value())
  284. except ValueError:
  285. # try to convert comma to decimal point. if it's still not working error message and return
  286. try:
  287. constrain_dx = float(self.x_width_entry.get_value().replace(',', '.'))
  288. except ValueError:
  289. self.app.inform.emit("[ERROR_NOTCL]Wrong value format entered, "
  290. "use a number.")
  291. return
  292. try:
  293. constrain_dy = float(self.y_height_entry.get_value())
  294. except ValueError:
  295. # try to convert comma to decimal point. if it's still not working error message and return
  296. try:
  297. constrain_dy = float(self.y_height_entry.get_value().replace(',', '.'))
  298. except ValueError:
  299. self.app.inform.emit("[ERROR_NOTCL]Wrong value format entered, "
  300. "use a number.")
  301. return
  302. panel_type = str(self.panel_type_radio.get_value())
  303. if 0 in {columns, rows}:
  304. self.app.inform.emit("[ERROR_NOTCL]Columns or Rows are zero value. Change them to a positive integer.")
  305. return "Columns or Rows are zero value. Change them to a positive integer."
  306. xmin, ymin, xmax, ymax = box.bounds()
  307. lenghtx = xmax - xmin + spacing_columns
  308. lenghty = ymax - ymin + spacing_rows
  309. # check if constrain within an area is desired
  310. if self.constrain_cb.isChecked():
  311. panel_lengthx = ((xmax - xmin) * columns) + (spacing_columns * (columns - 1))
  312. panel_lengthy = ((ymax - ymin) * rows) + (spacing_rows * (rows - 1))
  313. # adjust the number of columns and/or rows so the panel will fit within the panel constraint area
  314. if (panel_lengthx > constrain_dx) or (panel_lengthy > constrain_dy):
  315. self.constrain_flag = True
  316. while panel_lengthx > constrain_dx:
  317. columns -= 1
  318. panel_lengthx = ((xmax - xmin) * columns) + (spacing_columns * (columns - 1))
  319. while panel_lengthy > constrain_dy:
  320. rows -= 1
  321. panel_lengthy = ((ymax - ymin) * rows) + (spacing_rows * (rows - 1))
  322. # def clean_temp():
  323. # # deselect all to avoid delete selected object when run delete from shell
  324. # self.app.collection.set_all_inactive()
  325. #
  326. # for del_obj in self.objs:
  327. # self.app.collection.set_active(del_obj.options['name'])
  328. # self.app.on_delete()
  329. #
  330. # self.objs[:] = []
  331. # def panelize():
  332. # if panel_obj is not None:
  333. # self.app.inform.emit("Generating panel ... Please wait.")
  334. #
  335. # self.app.progress.emit(10)
  336. #
  337. # if isinstance(panel_obj, FlatCAMExcellon):
  338. # currenty = 0.0
  339. # self.app.progress.emit(0)
  340. #
  341. # def initialize_local_excellon(obj_init, app):
  342. # obj_init.tools = panel_obj.tools
  343. # # drills are offset, so they need to be deep copied
  344. # obj_init.drills = deepcopy(panel_obj.drills)
  345. # obj_init.offset([float(currentx), float(currenty)])
  346. # obj_init.create_geometry()
  347. # self.objs.append(obj_init)
  348. #
  349. # self.app.progress.emit(0)
  350. # for row in range(rows):
  351. # currentx = 0.0
  352. # for col in range(columns):
  353. # local_outname = self.outname + ".tmp." + str(col) + "." + str(row)
  354. # self.app.new_object("excellon", local_outname, initialize_local_excellon, plot=False,
  355. # autoselected=False)
  356. # currentx += lenghtx
  357. # currenty += lenghty
  358. # else:
  359. # currenty = 0
  360. # self.app.progress.emit(0)
  361. #
  362. # def initialize_local_geometry(obj_init, app):
  363. # obj_init.solid_geometry = panel_obj.solid_geometry
  364. # obj_init.offset([float(currentx), float(currenty)])
  365. # self.objs.append(obj_init)
  366. #
  367. # self.app.progress.emit(0)
  368. # for row in range(rows):
  369. # currentx = 0
  370. #
  371. # for col in range(columns):
  372. # local_outname = self.outname + ".tmp." + str(col) + "." + str(row)
  373. # self.app.new_object("geometry", local_outname, initialize_local_geometry, plot=False,
  374. # autoselected=False)
  375. # currentx += lenghtx
  376. # currenty += lenghty
  377. #
  378. # def job_init_geometry(obj_fin, app_obj):
  379. # FlatCAMGeometry.merge(self.objs, obj_fin)
  380. #
  381. # def job_init_excellon(obj_fin, app_obj):
  382. # # merge expects tools to exist in the target object
  383. # obj_fin.tools = panel_obj.tools.copy()
  384. # FlatCAMExcellon.merge(self.objs, obj_fin)
  385. #
  386. # if isinstance(panel_obj, FlatCAMExcellon):
  387. # self.app.progress.emit(50)
  388. # self.app.new_object("excellon", self.outname, job_init_excellon, plot=True, autoselected=True)
  389. # else:
  390. # self.app.progress.emit(50)
  391. # self.app.new_object("geometry", self.outname, job_init_geometry, plot=True, autoselected=True)
  392. #
  393. # else:
  394. # self.app.inform.emit("[ERROR_NOTCL] Obj is None")
  395. # return "ERROR: Obj is None"
  396. # panelize()
  397. # clean_temp()
  398. def panelize_2():
  399. if panel_obj is not None:
  400. self.app.inform.emit("Generating panel ... Please wait.")
  401. self.app.progress.emit(0)
  402. def job_init_excellon(obj_fin, app_obj):
  403. currenty = 0.0
  404. self.app.progress.emit(10)
  405. obj_fin.tools = panel_obj.tools.copy()
  406. obj_fin.drills = []
  407. obj_fin.slots = []
  408. obj_fin.solid_geometry = []
  409. for option in panel_obj.options:
  410. if option is not 'name':
  411. try:
  412. obj_fin.options[option] = panel_obj.options[option]
  413. except:
  414. log.warning("Failed to copy option.", option)
  415. for row in range(rows):
  416. currentx = 0.0
  417. for col in range(columns):
  418. if panel_obj.drills:
  419. for tool_dict in panel_obj.drills:
  420. point_offseted = affinity.translate(tool_dict['point'], currentx, currenty)
  421. obj_fin.drills.append(
  422. {
  423. "point": point_offseted,
  424. "tool": tool_dict['tool']
  425. }
  426. )
  427. if panel_obj.slots:
  428. for tool_dict in panel_obj.slots:
  429. start_offseted = affinity.translate(tool_dict['start'], currentx, currenty)
  430. stop_offseted = affinity.translate(tool_dict['stop'], currentx, currenty)
  431. obj_fin.slots.append(
  432. {
  433. "start": start_offseted,
  434. "stop": stop_offseted,
  435. "tool": tool_dict['tool']
  436. }
  437. )
  438. currentx += lenghtx
  439. currenty += lenghty
  440. obj_fin.create_geometry()
  441. obj_fin.zeros = panel_obj.zeros
  442. obj_fin.units = panel_obj.units
  443. def job_init_geometry(obj_fin, app_obj):
  444. currentx = 0.0
  445. currenty = 0.0
  446. def translate_recursion(geom):
  447. if type(geom) == list:
  448. geoms = list()
  449. for local_geom in geom:
  450. geoms.append(translate_recursion(local_geom))
  451. return geoms
  452. else:
  453. return affinity.translate(geom, xoff=currentx, yoff=currenty)
  454. obj_fin.solid_geometry = []
  455. if isinstance(panel_obj, FlatCAMGeometry):
  456. obj_fin.multigeo = panel_obj.multigeo
  457. obj_fin.tools = deepcopy(panel_obj.tools)
  458. if panel_obj.multigeo is True:
  459. for tool in panel_obj.tools:
  460. obj_fin.tools[tool]['solid_geometry'][:] = []
  461. self.app.progress.emit(0)
  462. for row in range(rows):
  463. currentx = 0.0
  464. for col in range(columns):
  465. if isinstance(panel_obj, FlatCAMGeometry):
  466. if panel_obj.multigeo is True:
  467. for tool in panel_obj.tools:
  468. obj_fin.tools[tool]['solid_geometry'].append(translate_recursion(
  469. panel_obj.tools[tool]['solid_geometry'])
  470. )
  471. else:
  472. obj_fin.solid_geometry.append(
  473. translate_recursion(panel_obj.solid_geometry)
  474. )
  475. else:
  476. obj_fin.solid_geometry.append(
  477. translate_recursion(panel_obj.solid_geometry)
  478. )
  479. currentx += lenghtx
  480. currenty += lenghty
  481. if isinstance(panel_obj, FlatCAMExcellon):
  482. self.app.progress.emit(50)
  483. self.app.new_object("excellon", self.outname, job_init_excellon, plot=True, autoselected=True)
  484. else:
  485. self.app.progress.emit(50)
  486. self.app.new_object(panel_type, self.outname, job_init_geometry,
  487. plot=True, autoselected=True)
  488. if self.constrain_flag is False:
  489. self.app.inform.emit("[success]Panel done...")
  490. else:
  491. self.constrain_flag = False
  492. self.app.inform.emit("[WARNING] Too big for the constrain area. Final panel has %s columns and %s rows" %
  493. (columns, rows))
  494. proc = self.app.proc_container.new("Generating panel ... Please wait.")
  495. def job_thread(app_obj):
  496. try:
  497. panelize_2()
  498. self.app.inform.emit("[success]Panel created successfully.")
  499. except Exception as e:
  500. proc.done()
  501. log.debug(str(e))
  502. return
  503. proc.done()
  504. self.app.collection.promise(self.outname)
  505. self.app.worker_task.emit({'fcn': job_thread, 'params': [self.app]})
  506. def reset_fields(self):
  507. self.object_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
  508. self.box_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))