ToolPanelize.py 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596
  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. FlatCAMTool.run(self)
  170. self.set_tool_ui()
  171. # if the splitter us hidden, display it
  172. if self.app.ui.splitter.sizes()[0] == 0:
  173. self.app.ui.splitter.setSizes([1, 1])
  174. self.app.ui.notebook.setTabText(2, "Panel. Tool")
  175. def install(self, icon=None, separator=None, **kwargs):
  176. FlatCAMTool.install(self, icon, separator, shortcut='ALT+Z', **kwargs)
  177. def set_tool_ui(self):
  178. self.reset_fields()
  179. sp_c = self.app.defaults["tools_panelize_spacing_columns"] if \
  180. self.app.defaults["tools_panelize_spacing_columns"] else 0.0
  181. self.spacing_columns.set_value(float(sp_c))
  182. sp_r = self.app.defaults["tools_panelize_spacing_rows"] if \
  183. self.app.defaults["tools_panelize_spacing_rows"] else 0.0
  184. self.spacing_rows.set_value(float(sp_r))
  185. rr = self.app.defaults["tools_panelize_rows"] if \
  186. self.app.defaults["tools_panelize_rows"] else 0.0
  187. self.rows.set_value(int(rr))
  188. cc = self.app.defaults["tools_panelize_columns"] if \
  189. self.app.defaults["tools_panelize_columns"] else 0.0
  190. self.columns.set_value(int(cc))
  191. c_cb = self.app.defaults["tools_panelize_constrain"] if \
  192. self.app.defaults["tools_panelize_constrain"] else False
  193. self.constrain_cb.set_value(c_cb)
  194. x_w = self.app.defaults["tools_panelize_constrainx"] if \
  195. self.app.defaults["tools_panelize_constrainx"] else 0.0
  196. self.x_width_entry.set_value(float(x_w))
  197. y_w = self.app.defaults["tools_panelize_constrainy"] if \
  198. self.app.defaults["tools_panelize_constrainy"] else 0.0
  199. self.y_height_entry.set_value(float(y_w))
  200. panel_type = self.app.defaults["tools_panelize_panel_type"] if \
  201. self.app.defaults["tools_panelize_panel_type"] else 'gerber'
  202. self.panel_type_radio.set_value(panel_type)
  203. def on_type_obj_index_changed(self):
  204. obj_type = self.type_obj_combo.currentIndex()
  205. self.object_combo.setRootModelIndex(self.app.collection.index(obj_type, 0, QtCore.QModelIndex()))
  206. self.object_combo.setCurrentIndex(0)
  207. def on_type_box_index_changed(self):
  208. obj_type = self.type_box_combo.currentIndex()
  209. self.box_combo.setRootModelIndex(self.app.collection.index(obj_type, 0, QtCore.QModelIndex()))
  210. self.box_combo.setCurrentIndex(0)
  211. def on_panelize(self):
  212. name = self.object_combo.currentText()
  213. # Get source object.
  214. try:
  215. obj = self.app.collection.get_by_name(str(name))
  216. except:
  217. self.app.inform.emit("[ERROR_NOTCL]Could not retrieve object: %s" % name)
  218. return "Could not retrieve object: %s" % name
  219. panel_obj = obj
  220. if panel_obj is None:
  221. self.app.inform.emit("[ERROR_NOTCL]Object not found: %s" % panel_obj)
  222. return "Object not found: %s" % panel_obj
  223. boxname = self.box_combo.currentText()
  224. try:
  225. box = self.app.collection.get_by_name(boxname)
  226. except:
  227. self.app.inform.emit("[ERROR_NOTCL]Could not retrieve object: %s" % boxname)
  228. return "Could not retrieve object: %s" % boxname
  229. if box is None:
  230. self.app.inform.emit("[WARNING]No object Box. Using instead %s" % panel_obj)
  231. box = panel_obj
  232. self.outname = name + '_panelized'
  233. try:
  234. spacing_columns = float(self.spacing_columns.get_value())
  235. except ValueError:
  236. # try to convert comma to decimal point. if it's still not working error message and return
  237. try:
  238. spacing_columns = float(self.spacing_columns.get_value().replace(',', '.'))
  239. except ValueError:
  240. self.app.inform.emit("[ERROR_NOTCL]Wrong value format entered, "
  241. "use a number.")
  242. return
  243. spacing_columns = spacing_columns if spacing_columns is not None else 0
  244. try:
  245. spacing_rows = float(self.spacing_rows.get_value())
  246. except ValueError:
  247. # try to convert comma to decimal point. if it's still not working error message and return
  248. try:
  249. spacing_rows = float(self.spacing_rows.get_value().replace(',', '.'))
  250. except ValueError:
  251. self.app.inform.emit("[ERROR_NOTCL]Wrong value format entered, "
  252. "use a number.")
  253. return
  254. spacing_rows = spacing_rows if spacing_rows is not None else 0
  255. try:
  256. rows = int(self.rows.get_value())
  257. except ValueError:
  258. # try to convert comma to decimal point. if it's still not working error message and return
  259. try:
  260. rows = float(self.rows.get_value().replace(',', '.'))
  261. rows = int(rows)
  262. except ValueError:
  263. self.app.inform.emit("[ERROR_NOTCL]Wrong value format entered, "
  264. "use a number.")
  265. return
  266. rows = rows if rows is not None else 1
  267. try:
  268. columns = int(self.columns.get_value())
  269. except ValueError:
  270. # try to convert comma to decimal point. if it's still not working error message and return
  271. try:
  272. columns = float(self.columns.get_value().replace(',', '.'))
  273. columns = int(columns)
  274. except ValueError:
  275. self.app.inform.emit("[ERROR_NOTCL]Wrong value format entered, "
  276. "use a number.")
  277. return
  278. columns = columns if columns is not None else 1
  279. try:
  280. constrain_dx = float(self.x_width_entry.get_value())
  281. except ValueError:
  282. # try to convert comma to decimal point. if it's still not working error message and return
  283. try:
  284. constrain_dx = float(self.x_width_entry.get_value().replace(',', '.'))
  285. except ValueError:
  286. self.app.inform.emit("[ERROR_NOTCL]Wrong value format entered, "
  287. "use a number.")
  288. return
  289. try:
  290. constrain_dy = float(self.y_height_entry.get_value())
  291. except ValueError:
  292. # try to convert comma to decimal point. if it's still not working error message and return
  293. try:
  294. constrain_dy = float(self.y_height_entry.get_value().replace(',', '.'))
  295. except ValueError:
  296. self.app.inform.emit("[ERROR_NOTCL]Wrong value format entered, "
  297. "use a number.")
  298. return
  299. panel_type = str(self.panel_type_radio.get_value())
  300. if 0 in {columns, rows}:
  301. self.app.inform.emit("[ERROR_NOTCL]Columns or Rows are zero value. Change them to a positive integer.")
  302. return "Columns or Rows are zero value. Change them to a positive integer."
  303. xmin, ymin, xmax, ymax = box.bounds()
  304. lenghtx = xmax - xmin + spacing_columns
  305. lenghty = ymax - ymin + spacing_rows
  306. # check if constrain within an area is desired
  307. if self.constrain_cb.isChecked():
  308. panel_lengthx = ((xmax - xmin) * columns) + (spacing_columns * (columns - 1))
  309. panel_lengthy = ((ymax - ymin) * rows) + (spacing_rows * (rows - 1))
  310. # adjust the number of columns and/or rows so the panel will fit within the panel constraint area
  311. if (panel_lengthx > constrain_dx) or (panel_lengthy > constrain_dy):
  312. self.constrain_flag = True
  313. while panel_lengthx > constrain_dx:
  314. columns -= 1
  315. panel_lengthx = ((xmax - xmin) * columns) + (spacing_columns * (columns - 1))
  316. while panel_lengthy > constrain_dy:
  317. rows -= 1
  318. panel_lengthy = ((ymax - ymin) * rows) + (spacing_rows * (rows - 1))
  319. # def clean_temp():
  320. # # deselect all to avoid delete selected object when run delete from shell
  321. # self.app.collection.set_all_inactive()
  322. #
  323. # for del_obj in self.objs:
  324. # self.app.collection.set_active(del_obj.options['name'])
  325. # self.app.on_delete()
  326. #
  327. # self.objs[:] = []
  328. # def panelize():
  329. # if panel_obj is not None:
  330. # self.app.inform.emit("Generating panel ... Please wait.")
  331. #
  332. # self.app.progress.emit(10)
  333. #
  334. # if isinstance(panel_obj, FlatCAMExcellon):
  335. # currenty = 0.0
  336. # self.app.progress.emit(0)
  337. #
  338. # def initialize_local_excellon(obj_init, app):
  339. # obj_init.tools = panel_obj.tools
  340. # # drills are offset, so they need to be deep copied
  341. # obj_init.drills = deepcopy(panel_obj.drills)
  342. # obj_init.offset([float(currentx), float(currenty)])
  343. # obj_init.create_geometry()
  344. # self.objs.append(obj_init)
  345. #
  346. # self.app.progress.emit(0)
  347. # for row in range(rows):
  348. # currentx = 0.0
  349. # for col in range(columns):
  350. # local_outname = self.outname + ".tmp." + str(col) + "." + str(row)
  351. # self.app.new_object("excellon", local_outname, initialize_local_excellon, plot=False,
  352. # autoselected=False)
  353. # currentx += lenghtx
  354. # currenty += lenghty
  355. # else:
  356. # currenty = 0
  357. # self.app.progress.emit(0)
  358. #
  359. # def initialize_local_geometry(obj_init, app):
  360. # obj_init.solid_geometry = panel_obj.solid_geometry
  361. # obj_init.offset([float(currentx), float(currenty)])
  362. # self.objs.append(obj_init)
  363. #
  364. # self.app.progress.emit(0)
  365. # for row in range(rows):
  366. # currentx = 0
  367. #
  368. # for col in range(columns):
  369. # local_outname = self.outname + ".tmp." + str(col) + "." + str(row)
  370. # self.app.new_object("geometry", local_outname, initialize_local_geometry, plot=False,
  371. # autoselected=False)
  372. # currentx += lenghtx
  373. # currenty += lenghty
  374. #
  375. # def job_init_geometry(obj_fin, app_obj):
  376. # FlatCAMGeometry.merge(self.objs, obj_fin)
  377. #
  378. # def job_init_excellon(obj_fin, app_obj):
  379. # # merge expects tools to exist in the target object
  380. # obj_fin.tools = panel_obj.tools.copy()
  381. # FlatCAMExcellon.merge(self.objs, obj_fin)
  382. #
  383. # if isinstance(panel_obj, FlatCAMExcellon):
  384. # self.app.progress.emit(50)
  385. # self.app.new_object("excellon", self.outname, job_init_excellon, plot=True, autoselected=True)
  386. # else:
  387. # self.app.progress.emit(50)
  388. # self.app.new_object("geometry", self.outname, job_init_geometry, plot=True, autoselected=True)
  389. #
  390. # else:
  391. # self.app.inform.emit("[ERROR_NOTCL] Obj is None")
  392. # return "ERROR: Obj is None"
  393. # panelize()
  394. # clean_temp()
  395. def panelize_2():
  396. if panel_obj is not None:
  397. self.app.inform.emit("Generating panel ... Please wait.")
  398. self.app.progress.emit(0)
  399. def job_init_excellon(obj_fin, app_obj):
  400. currenty = 0.0
  401. self.app.progress.emit(10)
  402. obj_fin.tools = panel_obj.tools.copy()
  403. obj_fin.drills = []
  404. obj_fin.slots = []
  405. obj_fin.solid_geometry = []
  406. for option in panel_obj.options:
  407. if option is not 'name':
  408. try:
  409. obj_fin.options[option] = panel_obj.options[option]
  410. except:
  411. log.warning("Failed to copy option.", option)
  412. for row in range(rows):
  413. currentx = 0.0
  414. for col in range(columns):
  415. if panel_obj.drills:
  416. for tool_dict in panel_obj.drills:
  417. point_offseted = affinity.translate(tool_dict['point'], currentx, currenty)
  418. obj_fin.drills.append(
  419. {
  420. "point": point_offseted,
  421. "tool": tool_dict['tool']
  422. }
  423. )
  424. if panel_obj.slots:
  425. for tool_dict in panel_obj.slots:
  426. start_offseted = affinity.translate(tool_dict['start'], currentx, currenty)
  427. stop_offseted = affinity.translate(tool_dict['stop'], currentx, currenty)
  428. obj_fin.slots.append(
  429. {
  430. "start": start_offseted,
  431. "stop": stop_offseted,
  432. "tool": tool_dict['tool']
  433. }
  434. )
  435. currentx += lenghtx
  436. currenty += lenghty
  437. obj_fin.create_geometry()
  438. obj_fin.zeros = panel_obj.zeros
  439. obj_fin.units = panel_obj.units
  440. def job_init_geometry(obj_fin, app_obj):
  441. currentx = 0.0
  442. currenty = 0.0
  443. def translate_recursion(geom):
  444. if type(geom) == list:
  445. geoms = list()
  446. for local_geom in geom:
  447. geoms.append(translate_recursion(local_geom))
  448. return geoms
  449. else:
  450. return affinity.translate(geom, xoff=currentx, yoff=currenty)
  451. obj_fin.solid_geometry = []
  452. if isinstance(panel_obj, FlatCAMGeometry):
  453. obj_fin.multigeo = panel_obj.multigeo
  454. obj_fin.tools = deepcopy(panel_obj.tools)
  455. if panel_obj.multigeo is True:
  456. for tool in panel_obj.tools:
  457. obj_fin.tools[tool]['solid_geometry'][:] = []
  458. self.app.progress.emit(0)
  459. for row in range(rows):
  460. currentx = 0.0
  461. for col in range(columns):
  462. if isinstance(panel_obj, FlatCAMGeometry):
  463. if panel_obj.multigeo is True:
  464. for tool in panel_obj.tools:
  465. obj_fin.tools[tool]['solid_geometry'].append(translate_recursion(
  466. panel_obj.tools[tool]['solid_geometry'])
  467. )
  468. else:
  469. obj_fin.solid_geometry.append(
  470. translate_recursion(panel_obj.solid_geometry)
  471. )
  472. else:
  473. obj_fin.solid_geometry.append(
  474. translate_recursion(panel_obj.solid_geometry)
  475. )
  476. currentx += lenghtx
  477. currenty += lenghty
  478. if isinstance(panel_obj, FlatCAMExcellon):
  479. self.app.progress.emit(50)
  480. self.app.new_object("excellon", self.outname, job_init_excellon, plot=True, autoselected=True)
  481. else:
  482. self.app.progress.emit(50)
  483. self.app.new_object(panel_type, self.outname, job_init_geometry,
  484. plot=True, autoselected=True)
  485. if self.constrain_flag is False:
  486. self.app.inform.emit("[success]Panel done...")
  487. else:
  488. self.constrain_flag = False
  489. self.app.inform.emit("[WARNING] Too big for the constrain area. Final panel has %s columns and %s rows" %
  490. (columns, rows))
  491. proc = self.app.proc_container.new("Generating panel ... Please wait.")
  492. def job_thread(app_obj):
  493. try:
  494. panelize_2()
  495. self.app.inform.emit("[success]Panel created successfully.")
  496. except Exception as e:
  497. proc.done()
  498. log.debug(str(e))
  499. return
  500. proc.done()
  501. self.app.collection.promise(self.outname)
  502. self.app.worker_task.emit({'fcn': job_thread, 'params': [self.app]})
  503. def reset_fields(self):
  504. self.object_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
  505. self.box_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))