class StateDialog(QtHelper.EnhancedQDialog, Logger.ClassLogger):
    """
    State dialog
    """
    def __init__(self, parent=None):
        """
        Dialog to fill parameter description

        @param dataArgs: 
        @type dataArgs: 

        @param parent: 
        @type parent:
        """
        super(StateDialog, self).__init__(parent)
        # make a copy
        self.createDialog()
        self.createConnections()

    def createDialog(self):
        """
        Create qt dialog
        """
        mainLayout = QVBoxLayout()

        self.comboType = QComboBox()
        self.comboType.addItem("Writing")
        self.comboType.addItem("Executing")

        typeLayout = QHBoxLayout()
        typeLayout.addWidget(self.comboType)

        self.buttonBox = QDialogButtonBox(self)
        self.buttonBox.setStyleSheet("""QDialogButtonBox { 
            dialogbuttonbox-buttons-have-icons: 1;
            dialog-ok-icon: url(:/ok.png);
            dialog-cancel-icon: url(:/ko.png);
        }""")
        self.buttonBox.setStandardButtons(QDialogButtonBox.Ok)

        mainLayout.addLayout(typeLayout)
        mainLayout.addWidget(self.buttonBox)

        self.setLayout(mainLayout)

        self.setWindowTitle("Test Description > State")
        self.setFixedWidth(350)
        self.center()

    def createConnections(self):
        """
        Create qt connections
        """
        self.buttonBox.accepted.connect(self.accept)

    def getSelectedState(self):
        """
        Returns selected state
        """
        return q(self.comboType.currentText())
class WExportStatistics(QtHelper.EnhancedQDialog, Logger.ClassLogger):
    """
    Export statistics dialog
    """
    def __init__(self, parent, dataXml):
        """
        Constructs export statistics dialog

        @param parent: 
        @type parent:
        """
        super(WExportStatistics, self).__init__(parent)

        self.__dataXml = dataXml

        self.createWidgets()
        self.createConnections()

    def createWidgets(self):
        """
        QtWidgets creation
        """
        self.setWindowFlags(self.windowFlags() | Qt.WindowSystemMenuHint
                            | Qt.WindowMinMaxButtonsHint)

        self.buttonBox = QDialogButtonBox(self)
        self.buttonBox.setStyleSheet("""QDialogButtonBox { 
            dialogbuttonbox-buttons-have-icons: 1;
            dialog-ok-icon: url(:/ok.png);
            dialog-cancel-icon: url(:/ko.png);
        }""")
        self.buttonBox.setStandardButtons(QDialogButtonBox.Ok)

        self.xmlWidget = RawView(self,
                                 self.__dataXml,
                                 toCsv=False,
                                 toHtml=False,
                                 toXml=True,
                                 toPrinter=True,
                                 toTxt=False,
                                 toPdf=True)

        layout = QVBoxLayout()
        self.mainTab = QTabWidget()
        self.mainTab.addTab(self.xmlWidget, 'Xml')

        layout.addWidget(self.mainTab)
        layout.addWidget(self.buttonBox)

        self.setWindowTitle("Export Test Statistics")
        self.setLayout(layout)

    def createConnections(self):
        """
        Qt connections
        """
        self.buttonBox.accepted.connect(self.accept)
Beispiel #3
0
class DefaultArgs(QtHelper.EnhancedQDialog, Logger.ClassLogger):
    """
    Default args
    """
    def __init__(self, dataArgs, parent=None):
        """
        Dialog to fill arguments for default probe

        @param dataArgs: 
        @type dataArgs: 

        @param parent: 
        @type parent:
        """
        super(DefaultArgs, self).__init__(parent)
        self.dataArgs = dataArgs
        self.createDialog()
        self.createConnections()

    def createDialog(self):
        """
        Create qt dialog
        """
        argsLabel = QLabel("Arguments:")
        self.argsEdit = QTextEdit()
        self.argsEdit.setPlainText(self.dataArgs)

        self.buttonBox = QDialogButtonBox(self)
        self.buttonBox.setStyleSheet("""QDialogButtonBox { 
            dialogbuttonbox-buttons-have-icons: 1;
            dialog-ok-icon: url(:/ok.png);
            dialog-cancel-icon: url(:/test-close-black.png);
        }""")
        self.buttonBox.setStandardButtons(QDialogButtonBox.Ok
                                          | QDialogButtonBox.Cancel)

        mainLayout = QVBoxLayout()
        mainLayout.addWidget(argsLabel)
        mainLayout.addWidget(self.argsEdit)
        mainLayout.addWidget(self.buttonBox)
        self.setLayout(mainLayout)

        self.setWindowTitle("Default Probe > Arguments")

    def createConnections(self):
        """
        Create qt connections
        """
        self.buttonBox.accepted.connect(self.accept)
        self.buttonBox.rejected.connect(self.reject)

    def getArgs(self):
        """
        Returns arguments
        """
        return self.argsEdit.toPlainText()
Beispiel #4
0
class DescriptionDialog(QtHelper.EnhancedQDialog, Logger.ClassLogger):
    """
    Description dialog
    """
    def __init__(self, dataDescr, parent=None):
        """
        Dialog to fill parameter description

        @param dataArgs: 
        @type dataArgs: 

        @param parent: 
        @type parent:
        """
        super(DescriptionDialog, self).__init__(parent)
        self.dataDescr = dataDescr
        self.createDialog()
        self.createConnections()

    def createDialog(self):
        """
        Create qt dialog
        """
        self.descrEdit = QTextEdit()
        self.descrEdit.setPlainText(self.dataDescr)

        self.buttonBox = QDialogButtonBox(self)
        self.buttonBox.setStyleSheet("""QDialogButtonBox { 
            dialogbuttonbox-buttons-have-icons: 1;
            dialog-ok-icon: url(:/ok.png);
            dialog-cancel-icon: url(:/test-close-black.png);
        }""")
        self.buttonBox.setStandardButtons(QDialogButtonBox.Ok
                                          | QDialogButtonBox.Cancel)

        mainLayout = QVBoxLayout()
        mainLayout.addWidget(self.descrEdit)
        mainLayout.addWidget(self.buttonBox)
        self.setLayout(mainLayout)

        self.setWindowTitle("Test Config > Agent description")
        self.resize(350, 250)
        self.center()

    def createConnections(self):
        """
        Create qt connections
        """
        self.buttonBox.accepted.connect(self.accept)
        self.buttonBox.rejected.connect(self.reject)

    def getDescr(self):
        """
        Returns description
        """
        return self.descrEdit.toPlainText()
Beispiel #5
0
class _QueuedMessageWidget(QWidget):
    
    cleared = pyqtSignal()
    finished = pyqtSignal()
    shown = pyqtSignal()
    closed = pyqtSignal()
    linkActivated = pyqtSignal(unicode)
    linkHovered= pyqtSignal(unicode)
    buttonClicked = pyqtSignal(QAbstractButton)
    
    def __init__(self, *args):
        QWidget.__init__(self, *args)
        self._messages = []
        self._defaultTimeout = 0
        self._defaultPixmap = QPixmap(":/enkiicons/infos.png" )
        self._defaultBackground = QBrush( QColor( 250, 230, 147 ) )
        self._defaultForeground = QBrush( QColor( 0, 0, 0 ) )
        
        # pixmap
        self.lPixmap = QLabel( self )
        self.lPixmap.setAlignment( Qt.AlignCenter )
        self.lPixmap.setSizePolicy( QSizePolicy( QSizePolicy.Maximum, QSizePolicy.Preferred ) )
        
        # message
        self.lMessage = QLabel( self )
        self.lMessage.setAlignment( Qt.AlignVCenter | Qt.AlignLeft )
        self.lMessage.setSizePolicy( QSizePolicy( QSizePolicy.Expanding, QSizePolicy.Preferred ) )
        self.lMessage.setWordWrap( True )
        self.lMessage.setOpenExternalLinks( True )
        self.lMessage.setTextInteractionFlags( Qt.TextBrowserInteraction )
        
        # button
        self.dbbButtons = QDialogButtonBox( self )
        
        # if false - buttons don't have neither text nor icons
        self.dbbButtons.setStyleSheet("dialogbuttonbox-buttons-have-icons: true;")

        self.dbbButtons.setSizePolicy( QSizePolicy( QSizePolicy.Maximum, QSizePolicy.Preferred ) )
        
        self.setSizePolicy( QSizePolicy( QSizePolicy.Expanding, QSizePolicy.Maximum ) )
        
        # layout
        self.hbl = QHBoxLayout( self )
        self.hbl.setMargin( 0 )
        self.hbl.addWidget( self.lPixmap, 0, Qt.AlignCenter )
        self.hbl.addWidget( self.lMessage )
        self.hbl.addWidget( self.dbbButtons, 0, Qt.AlignCenter )
        
        # connections
        self.lMessage.linkActivated.connect(self.linkActivated)
        self.lMessage.linkHovered.connect(self.linkHovered)
        self.dbbButtons.clicked.connect(self.buttonClicked)

    def sizeHint(self):
        return QWidget.minimumSizeHint(self)

    def openExternalLinks(self):
        return self.lMessage.openExternalLinks()

    def defaultTimeout(self):
        return self._defaultTimeout

    def defaultPixmap(self):
        return self._defaultPixmap

    def defaultBackground(self):
        return self._defaultBackground

    def defaultForeground(self):
        return self._defaultForeground

    def currentMessageInformations(self):
        return self.currentMessagePixmap(), self.currentMessageBackground(), self.currentMessageForeground()

    def pendingMessageCount(self):
        return len(self._messages)

    def currentMessage(self):
        return self._messages[0]

    def append(self, message, milliSeconds ):
        msg = _QueuedMessage()
        msg.message = message
        if milliSeconds == -1:
            msg.milliSeconds = self._defaultTimeout
        else:
           msg.milliSeconds = milliSeconds
        msg.pixmap = self._defaultPixmap
        msg.background = self._defaultBackground
        msg.foreground = self._defaultForeground
        
        self._messages.append(msg)
            
        if  len(self._messages) == 1 :
            QTimer.singleShot( 0, self.showMessage)

    def setOpenExternalLinks(self, open ):
        self.lMessage.setOpenExternalLinks( open )

    def setDefaultTimeout(self, timeout ):
        self._defaultTimeout = timeout

    def setDefaultPixmap(self, pixmap ):
        self._defaultPixmap = pixmap

    def setDefaultBackground(self, brush ):
        self._defaultBackground = brush

    def setDefaultForeground(self, brush ):
        self._defaultForeground = brush

    def remove(self, message ):
        raise NotImplemented()  # incorrect port from cpp fresh
        if not self._messages or self._messages.first() == message:
            return

        self._messages.removeOne( message )

    def clear(self):
        self._messages.clear()
        self.lPixmap.clear()
        self.lMessage.clear()
        self.dbbButtons.clear()
        self.cleared.emit()

    def currentMessagePixmap(self):
        msg = self.currentMessage()
        if msg.pixmap.isNull():
            return self._defaultPixmap
        else:
            return msg.pixmap

    def currentMessageBackground(self):
        msg = self.currentMessage()
        if msg.background == QBrush( Qt.NoBrush ):
            return self._defaultBackground
        else:
            return msg.background

    def currentMessageForeground(self):
        msg = self.currentMessage()
        if msg.foreground == QBrush( Qt.NoBrush ):
            return self._defaultForeground
        else:
            return msg.foreground

    def paintEvent(self, event ):
        if  self.pendingMessageCount() == 0 :
            QWidget.paintEvent(self, event )
            return
        
        painter = QPainter( self )
        painter.setPen( Qt.NoPen )
        painter.setBrush( self.currentMessageBackground() )
        painter.drawRect( self.contentsRect() )

    def buttonClicked(self, button ):
        msg = self.currentMessage()
        standardButton = self.dbbButtons.standardButton( button )
        
        if msg.slot is not None:
            msg.slot(standardButton, msg)
        
        self.closeMessage()

    def showMessage(self):
        # get message
        msg = self.currentMessage()
        
        # update palette
        pal = self.lMessage.palette()
        pal.setBrush( self.lMessage.foregroundRole(), self.currentMessageForeground() )
        self.lMessage.setPalette( pal )
        
        # format widget
        self.lPixmap.setPixmap( self.currentMessagePixmap() )
        self.lMessage.setText( msg.message )
        self.lMessage.setToolTip( msg.message )
        self.lMessage.setWhatsThis( msg.message )
        
        # set buttons
        if not msg.buttons:
            msg.buttons[ QDialogButtonBox.Close ] = None

        self.dbbButtons.clear()
        
        for button in msg.buttons.keys():
            pb = self.dbbButtons.addButton( button )
            
            if button in msg.buttons:
                pb.setText( msg.buttons[ button ] )
        
        # auto close if needed
        if msg.milliSeconds == -1:
            timeout = self._defaultTimeout
        else:
            timeout =  msg.milliSeconds
        
        if  timeout > 0:
            QTimer.singleShot( timeout, self.closeMessage )
        
        # signal.emit
        self.shown.emit()

    def closeMessage(self):
        # message.emit
        self.closed.emit()
        
        # remove remove current message from hash
        self._messages = self._messages[1:]
        
        # process next if possible, clear gui
        if self._messages:
            QTimer.singleShot( 0, self.showMessage)
        else:
            QTimer.singleShot( 0, self.clearMessage)
        
        # finished.emit message if needed
        if not self._messages:
            self.finished.emit()

    def clearMessage(self):
        self.lPixmap.clear()
        self.lMessage.clear()
        self.dbbButtons.clear()
Beispiel #6
0
class AddAgentDialog(QtHelper.EnhancedQDialog, Logger.ClassLogger):
    """
    Add agent dialog
    """
    def __init__(self, parent, agentName='AGENT', datasetView=False):
        """
        Constructor

        @param parent: parent window
        @type parent: instance

        @param agentName: 
        @type agentName: string

        @param datasetView: 
        @type datasetView: boolean
        """
        super(AddAgentDialog, self).__init__(parent)
        self.agentName=agentName
        self.parent__ = parent
        self.datasetView__ = datasetView
        self.createDialog()
        self.createConnections()

        self.initComboType()
    def createDialog (self):
        """
        Create dialog
        """
        self.labelName = QLabel("Agent Name:") 
        self.nameEdit = QLineEdit(self.agentName)
        nameLayout = QHBoxLayout()
        nameLayout.addWidget( self.labelName )
        nameLayout.addWidget( self.nameEdit )

        self.labelDescr = QLabel("Description:") 
        self.descrEdit = QTextEdit()

        self.labelValue= QLabel("Value:") 
        self.comboValue = QComboBox()

        typeLayout = QHBoxLayout()
        typeLayout.addWidget( self.labelValue )
        typeLayout.addWidget( self.comboValue )

        self.labelType = QLabel("Type:") 
        self.typeEdit = QLineEdit()
        self.typeEdit.setEnabled(False)
        type2Layout = QHBoxLayout()
        type2Layout.addWidget( self.labelType )
        type2Layout.addWidget( self.typeEdit )

        self.buttonBox = QDialogButtonBox(self)
        self.buttonBox.setStyleSheet( """QDialogButtonBox { 
            dialogbuttonbox-buttons-have-icons: 1;
            dialog-ok-icon: url(:/ok.png);
            dialog-cancel-icon: url(:/test-close-black.png);
        }""")
        self.buttonBox.setStandardButtons(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)

        mainLayout = QVBoxLayout()
        mainLayout.addLayout(nameLayout)
        if not self.datasetView__:
            mainLayout.addLayout(typeLayout)
            mainLayout.addLayout(type2Layout)
        mainLayout.addWidget(self.labelDescr)
        mainLayout.addWidget(self.descrEdit)
        mainLayout.addWidget(self.buttonBox)
        self.setLayout(mainLayout)

        self.setWindowTitle("Test Config > Add agent")
        self.resize(350, 250)
        self.center()

    def initComboType(self):
        """
        Initialize the combobox type with running agents
        """
        TYPES_PARAM = ServerAgents.instance().getRunningAgentsComplete()
        for i in xrange(len(TYPES_PARAM)):
            if len(TYPES_PARAM[i]) == 0:
                self.comboValue.insertSeparator(i + 2)
            else:
                self.comboValue.addItem (TYPES_PARAM[i]['name'])

        #self.onAgentChanged(id=0)

    def createConnections (self):
        """
        Create qt connections
        """
        self.buttonBox.accepted.connect(self.onAdd)
        self.buttonBox.rejected.connect(self.reject)
        self.comboValue.currentIndexChanged.connect(self.onAgentChanged)

    def onAgentChanged(self, id):
        """
        Called on agent changed on combobox
        """
        currentAgent = self.comboValue.currentText()
        currentAgent = unicode(currentAgent)

        currentAgentType = ''
        for agt in ServerAgents.instance().getRunningAgentsComplete():
            if unicode(agt['name']) == currentAgent:
                currentAgentType = unicode(agt['type'].lower())
                break
        
        self.typeEdit.setText(currentAgentType)

    def onAdd(self):
        """
        Called on add
        """
        if sys.version_info > (3,): # python3 support
            if unicode(self.nameEdit.text().upper()):
                self.accept()
        else:
            if unicode(self.nameEdit.text().toUpper()):
                self.accept()

    def getParameterValue(self):
        """
        Returns parameter value
        """
        qvalue = self.comboValue.currentText()
        if sys.version_info > (3,): # python3 support
            nameUpper = unicode(self.nameEdit.text().upper())
        else:
            nameUpper = unicode(self.nameEdit.text().toUpper())
        r = { 'name': nameUpper, 'description': unicode(self.descrEdit.toPlainText()),
                'value': unicode(qvalue), 'type': unicode(self.typeEdit.text()) }
        return r
Beispiel #7
0
class OptionsDialog(QtHelper.EnhancedQDialog, Logger.ClassLogger):
    """
    Update locations dialog
    """
    def __init__(self, parent=None):
        """
        Dialog to rename file or folder

        @param currentName: 
        @type currentName: 

        @param folder: 
        @type folder:

        @param parent: 
        @type parent: 
        """
        super(OptionsDialog, self).__init__(parent)

        self.createDialog()
        self.createConnections()

    def createDialog (self):
        """
        Create qt dialog
        """
                
        self.TIMEOUT_ACTION = Settings.instance().readValue( key = 'TestGenerator/timeout-framework-action' )

        self.timeoutLine = QLineEdit()
        self.timeoutLine.setText(str(self.TIMEOUT_ACTION))
        validatorTimeout = QDoubleValidator(self)
        validatorTimeout.setNotation(QDoubleValidator.StandardNotation)
        self.timeoutLine.setValidator(validatorTimeout)
        self.timeoutLine.installEventFilter(self)

        optionLayout = QHBoxLayout()
        optionLayout.addWidget(QLabel( self.tr("Max time to run action (in seconds):") ) )
        optionLayout.addWidget(self.timeoutLine)

        self.buttonBox = QDialogButtonBox(self)
        self.buttonBox.setStyleSheet( """QDialogButtonBox { 
            dialogbuttonbox-buttons-have-icons: 1;
            dialog-ok-icon: url(:/ok.png);
            dialog-cancel-icon: url(:/ko.png);
        }""")
        self.buttonBox.setStandardButtons(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)

        mainLayout = QVBoxLayout()
        mainLayout.addLayout(optionLayout)
        mainLayout.addWidget(self.buttonBox)
        self.setLayout(mainLayout)

        self.setWindowTitle(self.tr("Framework Options"))

    def createConnections (self):
        """
        Create qt connections
        """
        self.buttonBox.accepted.connect(self.accept)
        self.buttonBox.rejected.connect(self.reject)
Beispiel #8
0
class StepDialog(QtHelper.EnhancedQDialog, Logger.ClassLogger):
    """
    Step dialog 
    """
    def __init__(self, stepData, parent=None, stepId=0):
        """
        Dialog to fill parameter description

        @param dataArgs: 
        @type dataArgs: 

        @param parent: 
        @type parent:
        """
        super(StepDialog, self).__init__(parent)
        self.stepData = stepData
        self.stepId = stepId

        self.createDialog()
        self.createConnections()

    def createDialog (self):
        """
        Create qt dialog
        """
        self.buttonBox = QDialogButtonBox(self)
        self.buttonBox.setStyleSheet( """QDialogButtonBox { 
            dialogbuttonbox-buttons-have-icons: 1;
            dialog-ok-icon: url(:/ok.png);
            dialog-cancel-icon: url(:/test-close-black.png);
        }""")
        self.buttonBox.setStandardButtons(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)

        self.stepIdLabel = QLabel("%s" % self.stepId)
        stepTitleLayout = QGridLayout()

        # mandatory args
        self.argsLayout = QGridLayout()
        for i in xrange(len(self.stepData['obj'])):
            self.argsLayout.addWidget(QLabel( self.stepData['obj'][i]['name']), i, 0)
            typeParam  = QRadioButton( self.stepData['obj'][i]['type'])
            typeParam.setEnabled(False)
            self.argsLayout.addWidget(typeParam, i, 1)
            if self.stepData['obj'][i]['type'] == 'string':
                typeParam.setChecked(True)
                self.argsLayout.addWidget(QTextEdit( ), i, 2)
            if self.stepData['obj'][i]['type'] == "boolean":
                boolCombo = QComboBox( )
                valBool = [ "True", "False" ]
                boolCombo.addItems(valBool)
                boolCombo.setEnabled(False) # feature not yet available in abstract mode
                typeParam.setChecked(True)
                self.argsLayout.addWidget(boolCombo, i, 2)

        mainLayout = QVBoxLayout()
        mainLayout.addLayout(stepTitleLayout)
        mainLayout.addLayout(self.argsLayout)
        mainLayout.addWidget(self.buttonBox)
        self.setLayout(mainLayout)

        self.setWindowTitle(self.tr("Step configuration"))
        self.resize(450, 250)
        self.center()

    def createConnections (self):
        """
        Create qt connections
        """
        self.buttonBox.accepted.connect(self.accept)
        self.buttonBox.rejected.connect(self.reject)

    def setCurrentData(self, currentData):
        """
        Set current data
        """
        self.stepId = currentData['id']
        self.stepIdLabel.setText( "%s" % currentData['id'])

        for key, val in currentData.items():
            if isinstance(val, dict):
                for i in xrange(len(self.stepData['obj'])):
                    widgetKey = self.argsLayout.itemAtPosition(i, 0).widget()
                    widgetKeyName = unicode(widgetKey.text())
                    if  widgetKeyName == key:
                        widgetVal = self.argsLayout.itemAtPosition(i, 2)
                        if widgetVal is not None:
                            widgetVal = widgetVal.widget()
                            if val['type'] == 'string' and isinstance(widgetVal, QTextEdit):
                                widgetVal.setText(val['value'])
                            if val['type'] == 'boolean' and isinstance(widgetVal, QComboBox):
                                if val['value'] == "True": 
                                    widgetVal.setCurrentIndex(0)
                                else:
                                    widgetVal.setCurrentIndex(1)
    def getValues(self):
        """
        Get values
        """
        ret = { }
        for i in xrange(len(self.stepData['obj'])):
            widgetKey = self.argsLayout.itemAtPosition(i, 0).widget()
            widgetKeyName = unicode(widgetKey.text())
            if  widgetKeyName not in ret:
                ret[widgetKeyName] = {}

            widgetVal = self.argsLayout.itemAtPosition(i, 2)
            if widgetVal is not None:
                widgetVal = widgetVal.widget()
                if isinstance(widgetVal, QTextEdit):
                    ret[widgetKeyName]['type'] = self.stepData['obj'][i]['type']
                    ret[widgetKeyName]['value'] = unicode( widgetVal.toPlainText() )
                if isinstance(widgetVal, QComboBox):
                    ret[widgetKeyName]['type'] = "boolean"
                    ret[widgetKeyName]['value'] = str(widgetVal.currentText())
        return ret
class WExportReport(QtHelper.EnhancedQDialog, Logger.ClassLogger):
    """
    Export report widget
    """
    def __init__(self, parent, data, dataXml):
        """
        Constructs export report dialog

        @param parent: 
        @type parent:
        """
        super(WExportReport, self).__init__(parent)

        self.__data = data
        self.__dataXml = dataXml

        self.createWidgets()
        self.createConnections()

    def pluginDataAccessor(self):
        """
        Return data to plugins
        """
        frame = self.rawWidget.txtEdit.page().mainFrame()

        return {
            'report-html': frame.toHtml(),
            'report-xml': self.xmlWidget.txtEdit.text()
        }

    def addPlugin(self, pluginAct):
        """
        Register plugin in widgets
        """
        self.rawWidget.registerPlugin(pluginAct)
        self.xmlWidget.registerPlugin(pluginAct)

    def createWidgets(self):
        """
        QtWidgets creation
        """
        self.setWindowFlags(self.windowFlags() | Qt.WindowSystemMenuHint
                            | Qt.WindowMinMaxButtonsHint)

        self.buttonBox = QDialogButtonBox(self)
        self.buttonBox.setStyleSheet("""QDialogButtonBox { 
            dialogbuttonbox-buttons-have-icons: 1;
            dialog-ok-icon: url(:/ok.png);
            dialog-cancel-icon: url(:/ko.png);
        }""")
        self.buttonBox.setStandardButtons(QDialogButtonBox.Ok)

        layout = QVBoxLayout()

        self.rawWidget = RawView(self,
                                 self.__data,
                                 toCsv=True,
                                 toHtml=True,
                                 toXml=False,
                                 toPrinter=True,
                                 toTxt=True,
                                 toPdf=True)
        self.xmlWidget = RawView(self,
                                 self.__dataXml,
                                 toCsv=False,
                                 toHtml=False,
                                 toXml=True,
                                 toPrinter=True,
                                 toTxt=False,
                                 toPdf=True)

        self.mainTab = QTabWidget()
        self.mainTab.addTab(self.rawWidget, 'Raw')
        self.mainTab.addTab(self.xmlWidget, 'Xml')

        layout.addWidget(self.mainTab)
        layout.addWidget(self.buttonBox)

        self.setWindowTitle("Export Test Report")
        self.setLayout(layout)

    def createConnections(self):
        """
        Qt connections
        """
        self.buttonBox.accepted.connect(self.accept)
class OptionsDialog(QtHelper.EnhancedQDialog, Logger.ClassLogger):
    """
    Update locations dialog
    """
    def __init__(self, parent=None):
        """
        Dialog to rename file or folder

        @param currentName: 
        @type currentName: 

        @param folder: 
        @type folder:

        @param parent: 
        @type parent: 
        """
        super(OptionsDialog, self).__init__(parent)

        self.createDialog()
        self.createConnections()

    def createDialog (self):
        """
        Create qt dialog
        """
        
        self.TIMEOUT_ANDROID_ACTION = Settings.instance().readValue( key = 'TestGenerator/timeout-android-action' )

        self.timeoutAndroidLine = QLineEdit()
        self.timeoutAndroidLine.setText(str(self.TIMEOUT_ANDROID_ACTION))
        validatorAndroid = QDoubleValidator(self)
        validatorAndroid.setNotation(QDoubleValidator.StandardNotation)
        self.timeoutAndroidLine.setValidator(validatorAndroid)
        self.timeoutAndroidLine.installEventFilter(self)

        self.agentNameLineAndroid = QLineEdit("AGENT_ANDROID")

        self.agentsAndroidList = QComboBox()
        self.agentsAndroidList.setMinimumWidth(300)
        
        optionAndroidLayout = QGridLayout()
        optionAndroidLayout.addWidget(QLabel( self.tr("Max time to run action:") ), 1, 0)
        optionAndroidLayout.addWidget(self.timeoutAndroidLine, 1, 1)

        optionAndroidLayout.addWidget(QLabel( self.tr("Agent Key Name:") ), 3, 0)
        optionAndroidLayout.addWidget(self.agentNameLineAndroid, 3, 1)

        optionAndroidLayout.addWidget(QLabel( self.tr("Agent:") ), 4, 0)
        optionAndroidLayout.addWidget(self.agentsAndroidList, 4, 1)

        self.buttonBox = QDialogButtonBox(self)
        self.buttonBox.setStyleSheet( """QDialogButtonBox { 
            dialogbuttonbox-buttons-have-icons: 1;
            dialog-ok-icon: url(:/ok.png);
            dialog-cancel-icon: url(:/ko.png);
        }""")
        self.buttonBox.setStandardButtons(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)

        mainLayout = QVBoxLayout()
        mainLayout.addLayout(optionAndroidLayout)
        mainLayout.addWidget(self.buttonBox)
        self.setLayout(mainLayout)

        self.setWindowTitle(self.tr("Android Options"))

    def createConnections (self):
        """
        Create qt connections
        """
        self.buttonBox.accepted.connect(self.accept)
        self.buttonBox.rejected.connect(self.reject)
Beispiel #11
0
class DictValueDialog(QtHelper.EnhancedQDialog, Logger.ClassLogger):
    """
    Dict dialog 
    """
    def __init__(self, parent, testParams, variables, advancedMode=False ):
        """
        Operator to fill parameter description

        @param dataArgs: 
        @type dataArgs: 

        @param parent: 
        @type parent:
        """
        super(DictValueDialog, self).__init__(parent)
        self.advancedMode = advancedMode
        self.testParams = testParams
        self.variables = variables

        self.createDialog()
        self.createConnections()
        self.createActions()
        
    def createDialog (self):
        """
        Create qt dialog
        """
        self.buttonBox = QDialogButtonBox(self)
        self.buttonBox.setStyleSheet( """QDialogButtonBox { 
            dialogbuttonbox-buttons-have-icons: 1;
            dialog-ok-icon: url(:/ok.png);
            dialog-cancel-icon: url(:/test-close-black.png);
        }""")
        self.buttonBox.setStandardButtons(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)

        mainLayout = QVBoxLayout()
        
        self.dictTable = QTableView(self)
        self.model = DictTableModel(self, advancedMode=self.advancedMode)
        self.dictTable.setModel(self.model)
        self.dictTable.setFrameShape(QFrame.StyledPanel)
        self.dictTable.setShowGrid(True)
        self.dictTable.setGridStyle (Qt.DotLine)

        self.dictTable.setSelectionMode(QAbstractItemView.ExtendedSelection)
        self.dictTable.setSelectionBehavior(QAbstractItemView.SelectRows)
        self.dictTable.setContextMenuPolicy(Qt.CustomContextMenu)
        self.dictTable.verticalHeader().setVisible(False)
        self.dictTable.horizontalHeader().setHighlightSections(False)
        self.dictTable.setHorizontalScrollMode(QAbstractItemView.ScrollPerPixel)
        self.dictTable.horizontalHeader().setStretchLastSection(True)
        self.dictTable.setColumnWidth(COL_KEY, 200)

        # delegate item on advanced mode
        if self.advancedMode:
            self.dictTable.setItemDelegateForColumn( COL_KEY, ItemComboDelegate(self, COL_KEY) )
            self.dictTable.setItemDelegateForColumn( COL_VALUE, ItemComboDelegate(self, COL_VALUE) )


        mainLayout.addWidget(self.dictTable)
        mainLayout.addWidget(self.buttonBox)
        self.setLayout(mainLayout)

        self.setWindowTitle(self.tr("Dict configuration"))

        self.setMinimumWidth(500)
        self.center()


    def getInputs(self):
        """
        Get test inputs 
        """
        return self.testParams.parameters.table().model.getData()

    def getOutputs(self):
        """
        Get test outputs 
        """
        return self.testParams.parametersOutput.table().model.getData()


    def createConnections (self):
        """
        Create qt connections
        """
        self.buttonBox.accepted.connect(self.accept)
        self.buttonBox.rejected.connect(self.reject)

        self.dictTable.customContextMenuRequested.connect(self.onPopupMenu)
        
    def getValue(self):
        """
        Return value
        """
        return self.model.getData()

    def createActions (self):
        """
        Actions defined:
         * add 
         * del
        """
        self.addAction = QtHelper.createAction(self, self.tr("&Add"), self.addKey, icon = QIcon(":/test-parameter-add.png"),
                                tip = self.tr('Add a new key') )
        self.delAction = QtHelper.createAction(self, self.tr("&Delete"), self.delKey, icon = QIcon(":/test-parameter-del.png"), 
                                tip = self.tr('Delete the selected key') )
        self.delAllAction = QtHelper.createAction(self, self.tr("&Delete All"), self.delKeys, icon = QIcon(":/test-parameter-del.png"),
                                tip = self.tr('Delete the selected key') )
    
    
    def addKey(self):
        """
        Add key
        """
        self.delAllAction.setEnabled(True)
        
        index = self.dictTable.currentIndex()
        if not index.isValid():
            row = self.model.rowCount()
        else:
            row = index.row()

        data = self.model.getData()
        
        if self.advancedMode:
            tpl =   { 'key': { 'operator': '', 'value': '', 'type': '' }, 'value': { 'operator': '', 'value': '', 'type': '' } }
        else:
            tpl =   { 'key': 'my key', 'value': 'my value' }
                
        # add data to model
        data.insert(row + 1, tpl)
        self.model.reset()

    def clear (self):
        """
        clear contents
        """
        self.model.setDataModel( [] )
    
    def delKey(self):
        """
        Delete key
        """
        # get selected proxy indexes
        indexes = self.dictTable.selectedIndexes()
        if not indexes:
            return
         
        if indexes:
            answer = QMessageBox.question(self,  self.tr("Remove"),  self.tr("Do you want to remove selected key?"), 
                    QMessageBox.Yes | QMessageBox.No)
            if answer == QMessageBox.Yes:
                self.removeValues(indexes)

    def removeValues(self, indexes):
        """
        Remove values from data

        @param indexes: 
        @type indexes:
        """
        if not indexes:
            return
        
        # extract name, name are unique
        datas = self.model.getData()
        allNames = []

        # remove duplicate index
        cleanIndexes = {}
        for index in indexes:
            if index.row() not in cleanIndexes:
                cleanIndexes[index.row()] = index
                
        #for cleanIndex in cleanIndexes.keys():
        for cleanIndex in list(cleanIndexes.keys()): # for python3 support
            allNames.append( datas[cleanIndex]['key'] )

        self.trace('Key to remove: %s' % allNames)
        for paramName in allNames:
            self.removeValue( paramName=paramName )

    def removeValue(self, paramName):
        """
        Remove one parameter according to the name passed on argument
        """
        datas = self.model.getData()
        i = None
        for i in xrange(len(datas)):
            if datas[i]['key'] == paramName:
                break
        if i is not None:
            param = datas.pop( i )
            del param
        self.model.reset()
        
    def delKeys(self):
        """
        Clear all keys
        """
        reply = QMessageBox.question(self, 
                        self.tr("Clear all keys"), self.tr("Are you sure ?"),
                        QMessageBox.Yes | QMessageBox.No 
                )
        if reply == QMessageBox.Yes:
            data = self.model.getData()
            try:
                for i in xrange(len(data)):
                    data.pop()
            except Exception as e:
                pass
            self.model.reset()
            self.delAllAction.setEnabled(False)

            
    def onPopupMenu(self, pos):
        """
        Display menu on right click

        @param pos: 
        @type pos:
        """
        self.menu = QMenu(self.dictTable)
        index = self.dictTable.currentIndex()
        indexes = self.dictTable.selectedIndexes()
        if not indexes:
            self.menu.addAction( self.delAction )
            self.menu.addAction( self.addAction )
            self.menu.addSeparator()
            self.menu.addAction( self.delAllAction )
            self.menu.addSeparator()
        else:
            self.menu.addAction( self.delAction )
            self.menu.addAction( self.addAction )
            self.menu.addSeparator()
            self.menu.addAction( self.delAllAction )
            self.menu.addSeparator()

        self.menu.popup( self.mapToGlobal(pos) )

    def loadData(self, data):
        """
        Load data
        """
        if isinstance(data, dict):
            data = [data]
        self.model.setDataModel( data )
class CommentsDialog(QtHelper.EnhancedQDialog, Logger.ClassLogger):
    """
    Comments dialog
    """
    def __init__(self, dataComments, parent=None):
        """
        Dialog to fill parameter description

        @param dataArgs: 
        @type dataArgs: 

        @param parent: 
        @type parent:
        """
        super(CommentsDialog, self).__init__(parent)

        # dataComments has been reseted, reconstruct the right form
        if isinstance(dataComments, str) or isinstance(dataComments, unicode):
            dataComments = {'comments': {'comment': []}}
        # make a copy
        self.dataComments = copy.deepcopy(dataComments)
        if isinstance(self.dataComments['comments'], str):
            self.comments = self.dataComments['comments']
            self.comments = []
        else:
            self.comments = self.dataComments['comments']['comment']
        self.createDialog()
        self.createActions()
        self.createToolbar()
        self.createConnections()
        self.loadComments()

    def createActions(self):
        """
        Create qt actions
        """
        self.addCommentAction = QtHelper.createAction(
            self,
            "&Add",
            self.addComment,
            tip='Add comment',
            icon=QIcon(":/add_post.png"))
        self.clearAction = QtHelper.createAction(self,
                                                 "&Clear",
                                                 self.clearText,
                                                 tip='Clear fields',
                                                 icon=QIcon(":/clear.png"))
        self.delCommentsAction = QtHelper.createAction(
            self,
            "&Delete all",
            self.delComments,
            tip='Delete all comments',
            icon=QIcon(":/del-posts.png"))
        self.setDefaultActionsValues()

    def setDefaultActionsValues(self):
        """
        Set default values for qt actions
        """
        self.addCommentAction.setEnabled(False)
        self.delCommentsAction.setEnabled(True)
        self.clearAction.setEnabled(False)

    def createDialog(self):
        """
        Create qt dialog
        """
        mainLayout = QVBoxLayout()

        self.dockToolbarComments = QToolBar(self)

        self.commentTextarea = QTextEdit()
        self.commentTextarea.setFixedHeight(150)

        self.commentsTextarea = QTextEdit()
        self.commentsTextarea.setReadOnly(True)
        self.commentsTextarea.setStyleSheet("""background-color: #EAEAEA; """)

        self.buttonBox = QDialogButtonBox(self)
        self.buttonBox.setStyleSheet("""QDialogButtonBox { 
            dialogbuttonbox-buttons-have-icons: 1;
            dialog-ok-icon: url(:/ok.png);
            dialog-cancel-icon: url(:/test-close-black.png);
        }""")
        self.buttonBox.setStandardButtons(QDialogButtonBox.Ok
                                          | QDialogButtonBox.Cancel)

        mainLayout.addWidget(self.dockToolbarComments)
        mainLayout.addWidget(self.commentTextarea)
        mainLayout.addWidget(self.commentsTextarea)
        mainLayout.addWidget(self.buttonBox)

        self.setLayout(mainLayout)

        self.setWindowTitle("Test Description > Comments")
        self.setFixedWidth(450)
        self.center()

    def createConnections(self):
        """
        Create qt connections
        """
        self.commentTextarea.textChanged.connect(self.onTextChanged)
        self.buttonBox.accepted.connect(self.accept)
        self.buttonBox.rejected.connect(self.reject)

    def createToolbar(self):
        """
        Toolbar creation
            
        ||-------||
        || Empty ||
        ||-------||
        """
        self.dockToolbarComments.setObjectName("Archives comments toolbar")
        self.dockToolbarComments.addAction(self.delCommentsAction)
        self.dockToolbarComments.addSeparator()
        self.dockToolbarComments.addAction(self.addCommentAction)
        self.dockToolbarComments.addAction(self.clearAction)
        self.dockToolbarComments.addSeparator()
        self.dockToolbarComments.setIconSize(QSize(16, 16))

    def onTextChanged(self):
        """
        On text changed
        """
        newPost = self.commentTextarea.toPlainText()
        if len(newPost):
            self.addCommentAction.setEnabled(True)
            self.clearAction.setEnabled(True)
        else:
            self.addCommentAction.setEnabled(False)
            self.clearAction.setEnabled(False)

    def loadComments(self):
        """
        Load all comments
        """
        commentsParsed = []

        # When there is just one comment, the container is not a list but a dict
        if isinstance(self.comments, dict):
            self.comments = [self.comments]

        for tPost in self.comments:
            dt = time.strftime( "%Y-%m-%d %H:%M:%S", time.localtime( float(tPost['datetime'])) )  + \
                    ".%3.3d" % int(( float(tPost['datetime']) * 1000) % 1000 )
            post_decoded = base64.b64decode(tPost['post'])
            post_decoded = post_decoded.decode('utf8').replace('\n', '<br />')
            commentsParsed.append(
                'By <b>%s</b>, %s<p style="margin-left:20px">%s</p>' %
                (tPost['author'], dt, post_decoded))
        commentsParsed.reverse()
        self.commentsTextarea.setHtml("<br />".join(commentsParsed))

    def delComments(self):
        """
        Delete all comments
        """
        reply = QMessageBox.question(self, "Delete all comments",
                                     "Are you really sure ?",
                                     QMessageBox.Yes | QMessageBox.No)
        if reply == QMessageBox.Yes:
            self.comments = []
            self.loadComments()

    def addComment(self):
        """
        Add comment
        """
        tPost = self.commentTextarea.toPlainText()
        if sys.version_info > (3, ):  # python 3 support
            postEncoded = base64.b64encode(bytes(tPost, 'utf8'))
            postEncoded = str(postEncoded, 'utf8')
        else:
            postEncoded = base64.b64encode(tPost.toUtf8())
        self.comments.append({
            'author': UCI.instance().getLogin(),
            'datetime': str(time.time()),
            'post': postEncoded
        })
        self.clearText()
        self.loadComments()

    def clearText(self):
        """
        Clear the comment text area
        """
        self.commentTextarea.setText('')

    def getComments(self):
        """
        Returns all comments
        """
        tpl = {}
        tpl['comments'] = {}
        tpl['comments']['comment'] = self.comments
        return tpl
class ActionDialog(QtHelper.EnhancedQDialog, Logger.ClassLogger):
    """
    Action dialog 
    """
    def __init__(self,
                 parent,
                 helper,
                 actionData,
                 owner,
                 variables,
                 testParams,
                 adapterMode=False,
                 noCancel=False):
        """
        Dialog to fill parameter description

        @param dataArgs: 
        @type dataArgs: 

        @param parent: 
        @type parent:
        """
        super(ActionDialog, self).__init__(parent)
        self.actionData = actionData
        self.testParams = testParams
        self.owner = owner
        self.variables = variables
        self.adapterMode = adapterMode
        self.noCancel = noCancel

        self.createDialog()
        self.createConnections()

    def createDialog(self):
        """
        Create qt dialog
        """
        self.buttonBox = QDialogButtonBox(self)
        self.buttonBox.setStyleSheet("""QDialogButtonBox { 
            dialogbuttonbox-buttons-have-icons: 1;
            dialog-ok-icon: url(:/ok.png);
            dialog-cancel-icon: url(:/test-close-black.png);
        }""")
        if self.noCancel:
            self.buttonBox.setStandardButtons(QDialogButtonBox.Ok)
        else:
            self.buttonBox.setStandardButtons(QDialogButtonBox.Ok
                                              | QDialogButtonBox.Cancel)

        self.argsWidget = BasicWidget(self.actionData,
                                      self.owner,
                                      self.variables,
                                      parent=self,
                                      testParams=self.testParams,
                                      adapterMode=self.adapterMode)

        # input
        mainLayout = QVBoxLayout()
        inputText = ""
        if "action-descr" in self.actionData['data']:
            inputText = self.actionData['data']["action-descr"]
        finalTitle = "%s" % self.actionData['data']['function']
        if len(inputText):
            finalTitle += " - %s" % inputText.lower()
        titleLabel = QLabel(finalTitle)
        font = QFont()
        font.setBold(True)
        titleLabel.setFont(font)

        # output
        outputText = "nothing"
        if self.actionData['data']['return-value'] == 'True':
            outputText = self.actionData['data']['return-descr']
        outputLabel = QLabel("Output: %s" % outputText)
        font = QFont()
        font.setItalic(True)
        outputLabel.setFont(font)

        mainLayout.addWidget(titleLabel)
        mainLayout.addWidget(outputLabel)
        mainLayout.addWidget(self.argsWidget)
        mainLayout.addWidget(self.buttonBox)
        self.setLayout(mainLayout)

        self.setWindowTitle(self.tr("Configuration action"))

        self.resize(self.minimumSizeHint())
        self.resize(750, self.height())

        self.center()

    def createConnections(self):
        """
        Create qt connections
        """
        self.buttonBox.accepted.connect(self.accept)
        self.buttonBox.rejected.connect(self.reject)

    def getValues(self):
        """
        Get values
        """
        self.argsWidget.setValues()
        return self.actionData['data']['obj']
class OperatorValueDialog(QtHelper.EnhancedQDialog):
    """
    Operator dialog 
    """
    def __init__(self, parent, currentOperator={}, liteMode=False):
        """
        Operator to fill parameter description

        @param dataArgs: 
        @type dataArgs: 

        @param parent: 
        @type parent:
        """
        super(OperatorValueDialog, self).__init__(parent)
        self.parentWidget = parent
        self.liteMode = liteMode
        self.currentOperator = currentOperator

        self.createDialog()
        self.createConnections()

    def createDialog(self):
        """
        Create qt dialog
        """
        self.buttonBox = QDialogButtonBox(self)
        self.buttonBox.setStyleSheet("""QDialogButtonBox { 
            dialogbuttonbox-buttons-have-icons: 1;
            dialog-ok-icon: url(:/ok.png);
            dialog-cancel-icon: url(:/test-close-black.png);
        }""")
        self.buttonBox.setStandardButtons(QDialogButtonBox.Ok
                                          | QDialogButtonBox.Cancel)

        mainLayout = QHBoxLayout()
        main2Layout = QHBoxLayout()

        titleLabel = QLabel(self.currentOperator['operator'])
        font = QFont()
        font.setBold(True)
        titleLabel.setFont(font)

        self.opType = QComboBox()
        if not self.liteMode:
            for i in xrange(len(LIST_CONDITIONS)):
                self.opType.addItem(LIST_CONDITIONS[i].title())
                if self.currentOperator['operator'] == LIST_CONDITIONS[
                        i].title():
                    self.opType.setCurrentIndex(i)
        else:
            for i in xrange(len(LIST_CONDITIONS_LITE)):
                self.opType.addItem(LIST_CONDITIONS_LITE[i].title())
                if self.currentOperator['operator'] == LIST_CONDITIONS_LITE[
                        i].title():
                    self.opType.setCurrentIndex(i)

        main2Layout.addWidget(titleLabel)
        main2Layout.addWidget(self.opType)

        if not self.liteMode:
            self.textValue = QTextEdit()
            self.textValue.setFixedHeight(HEIGHT_TEXT_AREA)
            self.textValue.setMinimumWidth(WIDTH_TEXT_AREA)

            radioGroup = QButtonGroup(self)
            self.strRadioButton = QRadioButton("string")
            self.strRadioButton.setChecked(True)
            self.inRadioButton = QRadioButton("inputs")
            self.outRadioButton = QRadioButton("outputs")
            self.varRadioButton = QRadioButton("variables")

            radioGroup.addButton(self.strRadioButton)
            radioGroup.addButton(self.inRadioButton)
            radioGroup.addButton(self.outRadioButton)
            radioGroup.addButton(self.varRadioButton)

            self.inputsCombo = QComboBox()
            for inpt in self.parentWidget.getInputs():
                self.inputsCombo.addItem(inpt['name'])

            self.outputsCombo = QComboBox()
            for inpt in self.parentWidget.getOutputs():
                self.outputsCombo.addItem(inpt['name'])

            self.variablesCombo = QComboBox()
            self.variablesCombo.addItems(self.parentWidget.variables)

            if self.currentOperator['type'] == 'string':
                self.strRadioButton.setChecked(True)
                self.textValue.setText(self.currentOperator['value'])

            if self.currentOperator['type'] == 'inputs':
                self.inRadioButton.setChecked(True)
                for x in xrange(self.inputsCombo.count()):
                    if self.inputsCombo.itemText(
                            x) == self.currentOperator['value']:
                        self.inputsCombo.setCurrentIndex(x)

            if self.currentOperator['type'] == 'outputs':
                self.outRadioButton.setChecked(True)
                for x in xrange(self.outputsCombo.count()):
                    if self.outputsCombo.itemText(
                            x) == self.currentOperator['value']:
                        self.outputsCombo.setCurrentIndex(x)

            if self.currentOperator['type'] == 'variables':
                self.varRadioButton.setChecked(True)
                for x in xrange(self.variablesCombo.count()):
                    if self.variablesCombo.itemText(
                            x) == self.currentOperator['value']:
                        self.variablesCombo.setCurrentIndex(x)

            mainLayout.addWidget(self.strRadioButton)
            mainLayout.addWidget(self.textValue)

            mainLayout.addWidget(self.inRadioButton)
            mainLayout.addWidget(self.inputsCombo)

            mainLayout.addWidget(self.outRadioButton)
            mainLayout.addWidget(self.outputsCombo)

            mainLayout.addWidget(self.varRadioButton)
            mainLayout.addWidget(self.variablesCombo)

        finalLayout = QVBoxLayout()
        finalLayout.addLayout(main2Layout)
        finalLayout.addLayout(mainLayout)
        finalLayout.addWidget(self.buttonBox)

        self.setLayout(finalLayout)

        self.setWindowTitle(self.tr("Operators configuration"))

        self.setMinimumWidth(500)
        self.center()

    def createConnections(self):
        """
        Create qt connections
        """
        self.buttonBox.accepted.connect(self.accept)
        self.buttonBox.rejected.connect(self.reject)

    def getValue(self):
        """
        Return value
        """
        self.currentOperator['operator'] = unicode(self.opType.currentText())

        if not self.liteMode:

            if self.currentOperator['operator'].lower() == OP_ANY:
                self.currentOperator['type'] = 'string'
                self.currentOperator['value'] = ''
            else:
                if self.strRadioButton.isChecked():
                    self.currentOperator['type'] = 'string'
                    self.currentOperator['value'] = unicode(
                        self.textValue.toPlainText())

                if self.inRadioButton.isChecked():
                    self.currentOperator['type'] = 'inputs'
                    self.currentOperator['value'] = unicode(
                        self.inputsCombo.currentText())

                if self.outRadioButton.isChecked():
                    self.currentOperator['type'] = 'outputs'
                    self.currentOperator['value'] = unicode(
                        self.outputsCombo.currentText())

                if self.varRadioButton.isChecked():
                    self.currentOperator['type'] = 'variables'
                    self.currentOperator['value'] = unicode(
                        self.variablesCombo.currentText())

        return self.currentOperator