示例#1
0
 def createWidget(self):
     if self.dialogType == DIALOG_STANDARD:
         if self.param.multiline:
             widget = QPlainTextEdit()
             if self.param.default:
                 widget.setPlainText(self.param.default)
         else:
             widget = StringInputPanel(self.param)
             if self.param.default:
                 widget.setValue(self.param.default)
     elif self.dialogType == DIALOG_BATCH:
         widget = QLineEdit()
         if self.param.default:
             widget.setText(self.param.default)
     else:
         strings = self.dialog.getAvailableValuesOfType(ParameterString, OutputString)
         options = [(self.dialog.resolveValueDescription(s), s) for s in strings]
         if self.param.multiline:
             widget = MultilineTextPanel(options)
             widget.setText(self.param.default or "")
         else:
             widget = QComboBox()
             widget.setEditable(True)
             for desc, val in options:
                 widget.addItem(desc, val)
             widget.setEditText(self.param.default or "")
     return widget
示例#2
0
 def createWidget(self):
     if self.dialogType == DIALOG_STANDARD:
         if self.param.multiline:
             widget = QPlainTextEdit()
             if self.param.default:
                 widget.setPlainText(self.param.default)
         else:
             widget = StringInputPanel(self.param)
             if self.param.default:
                 widget.setValue(self.param.default)
     elif self.dialogType == DIALOG_BATCH:
         widget = QLineEdit()
         if self.param.default:
             widget.setText(self.param.default)
     else:
         # strings, numbers, files and table fields are all allowed input types
         strings = self.dialog.getAvailableValuesOfType([
             ParameterString, ParameterNumber, ParameterFile,
             ParameterTableField, ParameterExpression
         ], OutputString)
         options = [(self.dialog.resolveValueDescription(s), s)
                    for s in strings]
         if self.param.multiline:
             widget = MultilineTextPanel(options)
             widget.setText(self.param.default or "")
         else:
             widget = QComboBox()
             widget.setEditable(True)
             for desc, val in options:
                 widget.addItem(desc, val)
             widget.setEditText(self.param.default or "")
     return widget