def createActions(self): """ Qt actions """ self.addAction = QtHelper.createAction(self, self.tr("&Add"), self.addStep, icon=QIcon(":/step-add.png"), tip=self.tr('Add a new step')) self.delAction = QtHelper.createAction( self, self.tr("&Delete"), self.deleteAction, icon=QIcon(":/step-del.png"), tip=self.tr('Delete the selected step')) self.delAllAction = QtHelper.createAction( self, self.tr("&Delete All"), self.clearItems, icon=QIcon(":/test-parameter-clear.png"), tip=self.tr('Delete all steps')) # set default actions self.delAction.setEnabled(False) self.delAllAction.setEnabled(False)
def createWidgets(self): """ Create qt widgets """ self.toolbar = QToolBar(self) self.toolbar.setToolButtonStyle(Qt.ToolButtonTextBesideIcon) layout = QVBoxLayout() if self.toXml: self.txtEdit = QtHelper.RawXmlEditor(parent=self) self.txtEdit.setFolding(QsciScintilla.BoxedTreeFoldStyle) self.txtEdit.setLexer(QsciLexerXML()) self.txtEdit.setText(self.__data) self.txtEdit.setUtf8(True) self.txtEdit.setFont(QFont("Courier", 9)) else: self.txtEdit = QtHelper.RawEditor(parent=self) self.txtEdit.setTabStopWidth(10) self.txtEdit.setText(self.__data) self.txtEdit.setFont(QFont("Courier", 9)) self.txtEdit.setMinimumWidth(650) self.txtEdit.setMinimumHeight(400) layout.addWidget(self.toolbar) layout.addWidget(self.txtEdit) self.setLayout(layout)
def createActions(self): """ Qt Actions """ self.saveTxtAction = QtHelper.createAction( self, "&To TXT", self.saveTxt, tip='Save to TXT file', icon=QIcon(":/file-txt.png")) self.saveHtmlAction = QtHelper.createAction(self, "&To HTML", self.saveHtml, tip='Save to HTML file', icon=QIcon(":/web.png")) self.savePdfAction = QtHelper.createAction(self, "&To PDF", self.savePdf, tip='Save to PDF file', icon=QIcon(":/to_pdf.png")) self.saveXmlAction = QtHelper.createAction(self, "&To XML", self.saveXml, tip='Save to XML file', icon=QIcon(":/xml.png")) self.toPrinterAction = QtHelper.createAction( self, "&To Printer", self.savePrinter, tip='Print', icon=QIcon(":/printer.png"))
def createActions(self): """ Create qt actions """ self.clearAction = QtHelper.createAction( self, "Clear all parameters", self.clearItems, icon=QIcon(":/test-parameter-clear.png"), tip='Clear all parameters') self.setDefaultsAction = QtHelper.createAction( self, "Set default adapters and libraries", self.setDefaults, icon=QIcon(":/refresh-test.png"), tip='Set default adapters and libraries') self.writingAction = QtHelper.createAction( self, "Set writing state", self.stateWritingTest, icon=QIcon(":/writing-state.png"), tip='Set writing state') self.executingAction = QtHelper.createAction( self, "Set executing state", self.stateExecutingTest, icon=QIcon(":/state_right.png"), tip='Set executing state') self.defaultActions()
def createActions (self): """ Create qt actions """ self.startHttpAction = QtHelper.createAction(self.parent, "&Read Http", self.startHttp, icon=None, tip = 'Start the http capture') self.startTcpAction = QtHelper.createAction(self.parent, "&Read Tcp", self.startTcp, icon=None, tip = 'Start the tcp capture') self.startUdpAction = QtHelper.createAction(self.parent, "&Read Udp", self.startUdp, icon=None, tip = 'Start the udp capture') self.startGuiAction = QtHelper.createAction(Gui.instance(), "&New Test...", self.startGui, icon=None, tip = 'Start the capture of the desktop') self.restartGuiAction = QtHelper.createAction(Gui.instance(), "&Update Test...", self.restartGui, icon=None, tip = 'Update the current test for the desktop') self.stopGuiAction = QtHelper.createAction(Gui.instance(), "&Stop", self.stopGui, icon=None, tip = 'Stop the capture of the desktop') self.startWebAction = QtHelper.createAction(Gui.instance(), "&New Test...", self.startWeb, icon=None, tip = 'Start the capture of the web interface') self.startMobileAction = QtHelper.createAction(Gui.instance(), "&New Test...", self.startMobile, icon=None, tip = 'Start mobile assistant') self.startBasicAction = QtHelper.createAction(Gui.instance(), "&New Test...", self.startBasic, icon=None, tip = 'Start basic assistant') self.startSysAction = QtHelper.createAction(Gui.instance(), "&New Test...", self.startSys, icon=None, tip = 'Start system assistant')
def createActions(self): """ Actions defined: * add * del * clear """ self.addAction = QtHelper.createAction(self, "&Add", self.insertItem, icon=QIcon(":/tc-add.png"), tip='Add a new probe') self.delAction = QtHelper.createAction(self, "&Delete", self.removeItem, icon=QIcon(":/tc-del.png"), tip='Delete the selected probe') self.clearAction = QtHelper.createAction( self, "Clear", self.clearItems, icon=QIcon(":/param-delete.png"), tip='Clear all probes') self.defaultActions()
def createActions(self): """ Create qt actions """ self.refreshAction = QtHelper.createAction(self, self.tr("&Refresh"), self.refreshScreen, icon = None ) self.refreshAction.setEnabled(False) self.copyAction = QtHelper.createAction(self, self.tr("&Copy"), self.copyItem, icon = None )
def moreCreateActions(self): """ More creation qt actions """ self.createSamplesAction = QtHelper.createAction(self, "&Generate samples", self.generateSamples, icon = None, tip = 'Generate samples' ) self.setTestsDefaultAction = QtHelper.createAction(self, "&Set default versions", self.setDefaultVersionForAllTests, icon = None, tip = 'Set default version adapters and libraries for all tests' )
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 moreCreateActions(self): """ On more create qt actions """ self.addLibrariesAction = QtHelper.createAction(self, "&Add Libraries", self.addLibraries, icon = QIcon(":/libraries.png"), tip = 'Create a new set of library' ) self.addLibraryAction = QtHelper.createAction(self, "&Add Library", self.addLibrary, icon = QIcon(":/libraries.png"), tip = 'Create new library' ) self.checkLibrariesAction = QtHelper.createAction(self, "&Check", self.checkSyntaxLibraries, icon = QIcon(":/libraries-check.png"), tip = 'Check syntax of all libraries' ) self.setAsDefaultAction = QtHelper.createAction(self, "&Set as Extra", self.setLibraryAsDefault, icon = None, tip = 'Set library as Extra' ) self.setAsGenericAction = QtHelper.createAction(self, "&Set as Generic", self.setLibraryAsGeneric, icon = None, tip = 'Set library as Generic' )
def createActions(self): """ Create qt actions """ self.addAction = QPushButton(QIcon(":/add_black.png"), '&Add Action', self) self.addAction.setMinimumHeight(40) self.addAction.setMaximumWidth(200) self.cancelAction = QtHelper.createAction(self, "&Cancel", self.cancelStep, icon=QIcon(":/undo.png"), tip = 'Cancel update') self.cancelAction.setEnabled(False) self.optionsAction = QtHelper.createAction(self, "&", self.openOptions, icon=QIcon(":/recorder-basic-small.png"), tip = 'Framework options')
def __init__(self, parent = None, clientVersion=None): """ Qt Class User Client Interface Signals: * Connected * Disconnected * Notify * RefreshRepo * refreshStatsRepo * getFileRepo * addDirRepo * testKilled * testCancelled @param parent: @type parent: """ QObject.__init__(self, parent) NetLayerLib.ClientAgent.__init__(self, typeAgent = NetLayerLib.TYPE_AGENT_USER, keepAliveInterval=int(Settings.instance().readValue( key = 'Network/keepalive-interval' )), inactivityTimeout=int(Settings.instance().readValue( key = 'Network/inactivity-timeout' )), timeoutTcpConnect=int(Settings.instance().readValue( key = 'Network/tcp-connect-timeout' )), responseTimeout=int(Settings.instance().readValue( key = 'Network/response-timeout' )), selectTimeout=float(Settings.instance().readValue( key = 'Network/select-timeout' )), sslSupport=QtHelper.str2bool(Settings.instance().readValue( key = 'Server/data-ssl' )), wsSupport=QtHelper.str2bool(Settings.instance().readValue( key = 'Server/data-websocket' )), pickleVer=int(Settings.instance().readValue( key = 'Network/pickle-version' )), tcpKeepAlive=QtHelper.str2bool(Settings.instance().readValue( key = 'Network/tcp-keepalive' )), tcpKeepIdle=int(Settings.instance().readValue( key = 'Network/tcp-keepidle' )), tcpKeepCnt=int(Settings.instance().readValue( key = 'Network/tcp-keepcnt' )), tcpKeepIntvl=int(Settings.instance().readValue( key = 'Network/tcp-keepintvl' )) ) self.parent = parent self.password = "" self.login = "" self.channelId = None self.clientVersion = clientVersion self.appName = Settings.instance().readValue( key = 'Common/name' ) self.address = "" self.addressResolved = "" self.portWs = 0 self.addressProxyHttp = "" self.addressProxyHttpResolved = "" self.proxyActivated = False self.portData = Settings.instance().readValue( key = 'Server/port-data' ) self.loaderDialog = QtHelper.MessageBoxDialog(dialogName = self.tr("Loading")) self.parent.DataProgress.connect(self.updateDataReadProgress)
def createActions(self): """ Create qt actions """ self.addAndroidAction = QPushButton(QIcon(":/add_black.png"), '&Add Action', self) self.addAndroidAction.setMinimumHeight(40) self.addAndroidAction.setMaximumWidth(150) self.cancelAndroidAction = QtHelper.createAction(self, "&Cancel", self.cancelStep, icon=None, tip = 'Cancel update') self.cancelAndroidAction.setEnabled(False) self.optionsAction = QtHelper.createAction(self, "&", self.openOptions, icon=QIcon(":/recorder-mobile-small.png"), tip = 'Android options')
def moreCreateActions(self): """ On more create qt actions """ self.addAdaptersAction = QtHelper.createAction(self, "&Add Adapters", self.addAdapters, icon = QIcon(":/adapters.png"), tip = 'Create a new set of adapters' ) self.addAdapterAction = QtHelper.createAction(self, "&Add Adapter", self.addAdapter, icon = QIcon(":/adapters.png"), tip = 'Create new adapter' ) self.checkAdaptersAction = QtHelper.createAction(self, "&Check", self.checkSyntaxAdapters, icon = QIcon(":/adapters-check.png"), tip = 'Check syntax of all adapters' ) self.setAsDefaultAction = QtHelper.createAction(self, "&Set as Extra", self.setAdapterAsDefault, icon = None, tip = 'Set adapter as Extra' ) self.setAsGenericAction = QtHelper.createAction(self, "&Set as Generic", self.setAdapterAsGeneric, icon = None, tip = 'Set adapter as Generic' )
def createActions (self): """ Create qt actions """ self.refreshAction = QtHelper.createAction(self, "&Refresh", self.refreshAll, icon = QIcon(":/refresh.png"), tip = 'Refresh local repository content' ) self.addDirAction = QtHelper.createAction(self, "&Add", self.createItem, icon = QIcon(":/folder_add.png"), tip = 'Create new folder' ) self.delFileAction = QtHelper.createAction(self, "&Delete File", self.deleteItem, icon = QIcon(":/delete_file.png"), shortcut=QKeySequence.Delete, tip = 'Delete file' ) self.delDirAction = QtHelper.createAction(self, "&Delete Folder", self.deleteItem, icon = QIcon(":/folder_delete.png"), shortcut=QKeySequence.Delete, tip = 'Delete folder' ) self.renameAction = QtHelper.createAction(self, "&Rename", self.renameItem, icon = QIcon(":/rename.png"), tip = 'Rename' ) self.expandSubtreeAction = QtHelper.createAction(self, "&Expand folder...", self.expandSubFolder, icon = None, tip = 'Expand folder' ) self.expandAllAction = QtHelper.createAction(self, "&Expand All", self.expandAllFolders, icon = None, tip = 'Expand all folders' ) self.collapseAllAction = QtHelper.createAction(self, "&Collapse All", self.collapseAllFolders, icon = None, tip = 'Collapse all folder' ) self.defaultActions()
def createActions (self): """ Qt actions """ self.delAction = QtHelper.createAction(self, self.tr("&Delete"), self.deleteAction, icon = QIcon(":/adapters-del.png"), tip = self.tr('Delete the selected adapter')) self.delAllAction = QtHelper.createAction(self, self.tr("&Delete All"), self.clearItems, icon = QIcon(":/test-parameter-clear.png"), tip = self.tr('Delete all adapters')) # set default actions self.delAction.setEnabled(False) self.delAllAction.setEnabled(False)
def onShowPropertiesTab(self): """ On show properties tabulation """ if QtHelper.str2bool( Settings.instance().readValue(key='View/tab-left')): self.leftTab.setCurrentIndex(TAB_PROPERTIES)
def __init__(self, probe, parent = None, root = False): """ Constructs ProbeItem widget item @param probe: @type probe: dict @param parent: @type parent: @param root: @type root: boolean """ QTreeWidgetItem.__init__(self, parent) self.dataProbe = probe self.setText( COL_RUNNING_PROBEID , str(probe['id']) ) if 'publicip' in probe: self.setText( COL_RUNNING_ADDRESS , str(probe['publicip']) ) else: self.setText( COL_RUNNING_ADDRESS , str(probe['address'][0]) ) self.setText( COL_RUNNING_START_AT , QtHelper.formatTimestamp( probe['start-at'] ) ) self.setText( COL_RUNNING_TYPE , str(probe['type']) ) self.setText( COL_RUNNING_AUTO_STARTUP , str(probe['auto-startup']) ) self.setText( COL_RUNNING_DESCRIPTION , str(probe['description']) ) if not root: self.setIcon(COL_RUNNING_PROBEID, QIcon(":/probe.png") ) self.setFlags(Qt.ItemIsEnabled | Qt.ItemIsSelectable)
def addResult(self, wTestResult): """ Add a result to the tab manager """ self.secondTab.addTab(wTestResult, QIcon(":/trx.png"), wTestResult.name) button = QToolButton() button.setIcon(QIcon(":/test-close.png")) button.setToolTip(self.tr("Close")) button.setIconSize(QSize(15, 15)) button.setStyleSheet(""" QToolButton { border: none; padding-right: 1px; } QToolButton:hover { border: 1px solid #8f8f91; } """) button.released.connect(wTestResult.closeTest) self.secondTab.tabBar().setTabButton(self.secondTab.count() - 1, QTabBar.RightSide, button) if QtHelper.str2bool( Settings.instance().readValue(key='TestRun/auto-focus')): self.secondTab.setCurrentWidget(wTestResult)
def setModelData(self, editor, model, index): """ Accessor to set data in model @param editor: @type editor: @param model: @type model: @param index: @type index: """ qvalue = editor.currentText() value = QtHelper.displayToValue( q(qvalue) ) self.setValue(index, value) datas = self.parent.model.getData() currentData = datas[index.row()] currentAgentType = 'alias' for agt in ServerAgents.instance().getRunningAgentsComplete(): if unicode(agt['name']) == unicode(value): currentAgentType = unicode(agt['type'].lower()) break datas[index.row()]['type'] = currentAgentType self.parent.adjustColumns()
def onConnectionSuccessful(self, instance): """ On connection successful """ websocketSupport = QtHelper.str2bool( Settings.instance().readValue(key='Server/data-websocket')) websocketSsl = QtHelper.str2bool( Settings.instance().readValue(key='Server/data-ssl')) if websocketSupport: self.trace('Websocket initialization...') wspath = Settings.instance().readValue(key='Server/websocket-path') if websocketSsl: wspath = Settings.instance().readValue( key='Server/websocket-secure-path') instance.handshakeWebSocket(resource=wspath, hostport=UCI.instance().address)
def paint(self, painter, option, index): """ Paint @param value: @type value: @param value: @type value: @param index: @type index: """ # Get item data if sys.version_info > (3, ): # python 3 support value = index.data(Qt.DisplayRole) if isinstance(value, str): value = QtHelper.str2bool(value) else: value = index.data(Qt.DisplayRole).toBool() # fill style options with item data style = QApplication.style() opt = QStyleOptionButton() opt.state |= QStyle.State_On if value else QStyle.State_Off opt.state |= QStyle.State_Enabled opt.text = "" opt.rect = option.rect # draw item data as CheckBox style.drawControl(QStyle.CE_CheckBox, opt, painter)
def createWidgets(self): """ QtWidgets creation _______________________ | | | PyEditor | |_______________________| |________QSplitter______| | | | PyEditor | |_______________________| """ self.srcWidget = EditorWidget( self.TEST_UNIT_EDITOR, "Test Definition:", self, wrappingText=QtHelper.str2bool( Settings.instance().readValue(key='Editor/code-wrapping'))) self.srcEditor = self.srcWidget.editor layout = QVBoxLayout() layout.addWidget(self.srcWidget) layout.setContentsMargins(2, 0, 0, 0) self.setLayout(layout)
def onProxyConnectionSuccess(self): """ On proxy connection with success """ try: websocketSupport = QtHelper.str2bool(Settings.instance().readValue( key = 'Server/data-websocket' )) websocketSsl = QtHelper.str2bool(Settings.instance().readValue( key = 'Server/data-ssl' )) if websocketSupport: self.trace('Websocket initialization through proxy...') wspath = Settings.instance().readValue( key = 'Server/websocket-path' ) if websocketSsl: wspath = Settings.instance().readValue( key = 'Server/websocket-secure-path' ) self.handshakeWebSocket(resource=wspath, hostport=self.address) except Exception as e: self.closeConnection() ServerExplorer.instance().stopWorking() self.emitCriticalMsg( self.tr("Channel handshake through proxy") , str(e) )
def createActions(self): """ Create qt actions """ self.zoomInAct = QtHelper.createAction(self, "&Zoom &In (25%.", self.zoomIn, icon=QIcon(":/zoom-in.png")) self.zoomOutAct = QtHelper.createAction(self, "Zoom &Out (25%.", self.zoomOut, icon=QIcon(":/zoom-out.png")) self.normalSizeAct = QtHelper.createAction( self, "&Normal Size", self.normalSize, icon=QIcon(":/zoom-normal.png"))
def createActions(self): """ Create actions """ self.toTestUnitAction = QtHelper.createAction(self, self.tr("&Convert\nTest Unit"), self.toTestUnit, icon = QIcon(":/tux.png") )
def createActions (self): """ Create qt actions """ self.openAction = QtHelper.createAction(self, "&Open", self.importTrace, icon=QIcon(":/folder_add.png"), tip = 'Open network trace.') self.exportTUAction = QtHelper.createAction(self, "&Test Unit", self.exportToTU, icon=QIcon(":/%s.png" % WWorkspace.TestUnit.TYPE), tip = 'Export to Test Unit') self.exportTSAction = QtHelper.createAction(self, "&Test Suite", self.exportToTS, icon=QIcon(":/%s.png" % WWorkspace.TestSuite.TYPE), tip = 'Export to Test Suite') self.cancelAction = QtHelper.createAction(self, "&Cancel", self.reject, tip = 'Cancel') menu = QMenu(self) menu.addAction( self.exportTUAction ) menu.addAction( self.exportTSAction ) self.exportToAction = QtHelper.createAction(self, "&Export to", self.exportToTU, icon=QIcon(":/%s.png" % WWorkspace.TestUnit.TYPE), tip = 'Export to tests' ) self.exportToAction.setMenu(menu) self.exportToAction.setEnabled(False)
def createWidgets(self): """ QtWidgets creation _______________________ | | | PyEditor | |_______________________| |________QSplitter______| | | | PyEditor | |_______________________| """ self.srcWidget = EditorWidget( self.TEST_DEF_EDITOR, "Test Definition:", self, wrappingText=QtHelper.str2bool( Settings.instance().readValue(key='Editor/code-wrapping'))) self.execWidget = EditorWidget( self.TEST_EXEC_EDITOR, "Test Execution:", self, wrappingText=QtHelper.str2bool( Settings.instance().readValue(key='Editor/code-wrapping')), toolbar=False) self.srcEditor = self.srcWidget.editor self.execEditor = self.execWidget.editor layout = QVBoxLayout() hSplitter = QSplitter(self) hSplitter.setOrientation(Qt.Vertical) hSplitter.addWidget(self.srcWidget) hSplitter.addWidget(self.execWidget) hSplitter.setContentsMargins(0, 0, 0, 0) hSplitter.setStretchFactor(0, 1) layout.addWidget(hSplitter) layout.setContentsMargins(2, 0, 0, 0) self.setLayout(layout)
def createActions(self): """ Create qt actions """ self.resetAction = QtHelper.createAction( self, "&Reset Statistics", self.resetStats, tip='Reset all statistics', icon=QIcon(":/reset-counter.png"))
def createActions(self): """ Create qt actions """ self.loadWebPageAction = QtHelper.createAction( self, "&Go to...", self.onChangeWebLocation, icon=QIcon(":/act-half-refresh.png"), tip='Load Webpage')