def pingTest(): from pyaid.string.StringUtils import StringUtils import nimble nimble.changeKeepAlive(keepAlive) conn = nimble.getConnection() #----------------------------------------------------------------------------------------------- # PING # An empty call that tests that the Nimble connection is able to complete a request and # response loop and prints the response object when complete. for i in range(iterations): result = conn.ping() if not runSilent: print(u'PING:', result.echo(True, True)) #----------------------------------------------------------------------------------------------- # ECHO # A basic call that sends an echo message, which the remote Nimble server returns in the # response. Confirms that data can be set, read, and returned through the Nimble # connection. smallMessage = 'This is a test' for i in range(iterations): result = conn.echo(smallMessage) if not runSilent: print(u'ECHO:', result.echo(True, True)) #----------------------------------------------------------------------------------------------- # LONG ECHO # A repeat of the echo test, but with a very long echo message that tests the ability for # the Nimble socket protocols to chunk and stream large messages without losing data. The # test is also repeated numerous times to confirm that the nimble socket connection # survives through high-intensity multi-stage communication. largeMessage = StringUtils.getRandomString(64000) for i in range(iterations): result = conn.echo(largeMessage) if not runSilent: print(u'LARGE ECHO[#%s]:' % i, result.echo(True, True)) print(u'\nTests Complete')
# rando-terrain by Mike Knowles # Base project by Scott Ernst from PySide import QtGui from pyglass.widgets.PyGlassWidget import PyGlassWidget from randoterrain.enum.UserConfigEnum import UserConfigEnum from randoterrain.views.home.NimbleStatusElement import NimbleStatusElement from random import randint from nimble import cmds from nimble.error import MayaCommandException import nimble nimble.changeKeepAlive(True) class RandoTerrainHomeWidget(PyGlassWidget): def __init__(self, parent, **kwargs): super(RandoTerrainHomeWidget, self).__init__(parent, **kwargs) self._firstView = True self._statusBox, statusLayout = self._createElementWidget( self, QtGui.QVBoxLayout, True) statusLayout.addStretch() self._nimbleStatus = NimbleStatusElement( self._statusBox, disabled=self.mainWindow.appConfig.get( UserConfigEnum.NIMBLE_TEST_STATUS, True)) statusLayout.addWidget(self._nimbleStatus) self.magnitudeValLabel.setText('1') self.magnitude = 1 self.sizeDial.setRange(1, 10) self.magnitudeDial.setRange(1, 100)
# rando-terrain by Mike Knowles # Base project by Scott Ernst from PySide import QtGui from pyglass.widgets.PyGlassWidget import PyGlassWidget from randoterrain.enum.UserConfigEnum import UserConfigEnum from randoterrain.views.home.NimbleStatusElement import NimbleStatusElement from random import randint from nimble import cmds from nimble.error import MayaCommandException import nimble nimble.changeKeepAlive(True) class RandoTerrainHomeWidget(PyGlassWidget): def __init__(self, parent, **kwargs): super(RandoTerrainHomeWidget, self).__init__(parent, **kwargs) self._firstView = True self._statusBox, statusLayout = self._createElementWidget(self, QtGui.QVBoxLayout, True) statusLayout.addStretch() self._nimbleStatus = NimbleStatusElement( self._statusBox, disabled=self.mainWindow.appConfig.get(UserConfigEnum.NIMBLE_TEST_STATUS, True)) statusLayout.addWidget(self._nimbleStatus) self.magnitudeValLabel.setText('1') self.magnitude = 1 self.sizeDial.setRange(1, 10) self.magnitudeDial.setRange(1, 100) self.sizeDial.valueChanged.connect(self._sizeChanged) self.magnitudeDial.valueChanged.connect(self._magnitudeChanged)