def on_execTool_clicked(self): self.execTool.setEnabled(False) self.textEdit.clear() self.progressBar.setValue(0) params = self.get_params() tool_hook = self.tool_name # look in all groups for the tool_name -- NOTE this requires the tool # to be uniquely named regardless of which group it's in or this code # will execute the wrong tool. tool_node = get_tool_node_by_name(self.tool_library_node, tool_hook) if tool_node is None: QMessageBox.warning(None, 'Invalid tool hook', 'Could not find a tool named %s' %tool_hook) return tool_path = self.optional_params['tool_path'] import_path = tool_path + '.' + self.module_name opus_tool = OpusTool(import_path, params) run_tool_thread = RunToolThread(opus_tool) QObject.connect(run_tool_thread, SIGNAL("toolFinished(PyQt_PyObject)"), self.toolFinishedFromThread) QObject.connect(run_tool_thread, SIGNAL("toolProgressPing(PyQt_PyObject)"), self.toolProgressPingFromThread) QObject.connect(run_tool_thread, SIGNAL("toolLogPing(PyQt_PyObject)"), self.toolLogPingFromThread) run_tool_thread.start()
def on_execTool_released(self): self.execTool.setEnabled(False) self.textEdit.clear() self.progressBar.setValue(0) # self.test_text contains the parameter name (stored as a QLabel instance) # self.test_line contains the editor (QLineEdit or QComboBox) for the parameter value # self.test_text_type contains the value for the type attribute (QLineEdit) params = {} for i in range(0, len(self.test_text)): param_name = str(self.test_text[i].text()) if type(self.test_line[i]) == QComboBox: param_value = str(self.test_line[i].currentText()) else: param_value = str(self.test_line[i].text()) type_value = self.test_text_type[i].text().remove( QRegExp("[\(\)]")) type_value = str(type_value) params[param_name] = param_value tool_hook = self.tool_name # look in all groups for the tool_name -- NOTE this requires the tool # to be uniquely named regardless of which group it's in or this code # will execute the wrong tool. tool_node = get_tool_node_by_name(self.tool_library_node, tool_hook) if tool_node is None: QMessageBox.warning(None, 'Invalid tool hook', 'Could not find a tool named %s' % tool_hook) return tool_path = self.optional_params['tool_path'] import_path = tool_path + '.' + self.module_name opus_tool = OpusTool(import_path, params) run_tool_thread = RunToolThread(opus_tool) QObject.connect(run_tool_thread, SIGNAL("toolFinished(PyQt_PyObject)"), self.toolFinishedFromThread) QObject.connect(run_tool_thread, SIGNAL("toolProgressPing(PyQt_PyObject)"), self.toolProgressPingFromThread) QObject.connect(run_tool_thread, SIGNAL("toolLogPing(PyQt_PyObject)"), self.toolLogPingFromThread) run_tool_thread.start()
def on_execTool_released(self): self.execTool.setEnabled(False) self.textEdit.clear() self.progressBar.setValue(0) # self.test_text contains the parameter name (stored as a QLabel instance) # self.test_line contains the editor (QLineEdit or QComboBox) for the parameter value # self.test_text_type contains the value for the type attribute (QLineEdit) params = {} for i in range(0, len(self.test_text)): param_name = str(self.test_text[i].text()) if type(self.test_line[i]) == QComboBox: param_value = str(self.test_line[i].currentText()) else: param_value = str(self.test_line[i].text()) type_value = self.test_text_type[i].text().remove(QRegExp("[\(\)]")) type_value = str(type_value) params[param_name] = param_value tool_hook = self.tool_name # look in all groups for the tool_name -- NOTE this requires the tool # to be uniquely named regardless of which group it's in or this code # will execute the wrong tool. tool_node = get_tool_node_by_name(self.tool_library_node, tool_hook) if tool_node is None: QMessageBox.warning(None, 'Invalid tool hook', 'Could not find a tool named %s' %tool_hook) return tool_path = self.optional_params['tool_path'] import_path = tool_path + '.' + self.module_name opus_tool = OpusTool(import_path, params) run_tool_thread = RunToolThread(opus_tool) QObject.connect(run_tool_thread, SIGNAL("toolFinished(PyQt_PyObject)"), self.toolFinishedFromThread) QObject.connect(run_tool_thread, SIGNAL("toolProgressPing(PyQt_PyObject)"), self.toolProgressPingFromThread) QObject.connect(run_tool_thread, SIGNAL("toolLogPing(PyQt_PyObject)"), self.toolLogPingFromThread) run_tool_thread.start()