Skip to content
This repository has been archived by the owner on Sep 10, 2021. It is now read-only.

Commit

Permalink
ENH: refs #990. Use new modular app, and use WAMP authentication feat…
Browse files Browse the repository at this point in the history
…ures
  • Loading branch information
zachmullen committed Apr 29, 2013
1 parent fe8b45f commit 21245a6
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 19 deletions.
45 changes: 28 additions & 17 deletions modules/pvw/apps/midas.py
Expand Up @@ -15,31 +15,20 @@
from autobahn.wamp import exportRpc

# import paraview modules.
from paraview import simple, web, servermanager, web_helper
from paraview import simple, web, servermanager, web_helper, paraviewweb_wamp, paraviewweb_protocols

# Setup global variables
timesteps = []
currentTimeIndex = 0
timekeeper = servermanager.ProxyManager().GetProxy("timekeeper", "TimeKeeper")
pipeline = web_helper.Pipeline('Kitware')
lutManager = web_helper.LookupTableManager()
view = None
dataPath = None

# Initialize the render window
def initView(width, height):
global view, lutManager

view = simple.GetRenderView()
simple.Render()
view.ViewSize = [width, height]
view.Background = [1, 1, 1]
view.OrientationAxesLabelColor = [0, 0, 0]
lutManager.setView(view)
print 'View created successfully (%dx%d)' % (width, height)
authKey = None
width = None
height = None

# This class defines the exposed RPC methods for the midas application
class MidasApp(web.ParaViewServerProtocol):
class MidasApp(paraviewweb_wamp.ServerProtocol):
DISTANCE_FACTOR = 2.0
CONTOUR_LINE_WIDTH = 2.0

Expand All @@ -59,6 +48,25 @@ class MidasApp(web.ParaViewServerProtocol):
meshSlice = None
surfaces = []

def initialize(self):
global view, lutManager, authKey, width, height
# Bring used components
self.registerParaViewWebProtocol(paraviewweb_protocols.ParaViewWebMouseHandler())
self.registerParaViewWebProtocol(paraviewweb_protocols.ParaViewWebViewPort())
self.registerParaViewWebProtocol(paraviewweb_protocols.ParaViewWebViewPortImageDelivery())
self.registerParaViewWebProtocol(paraviewweb_protocols.ParaViewWebViewPortGeometryDelivery())

view = simple.GetRenderView()
simple.Render()
view.ViewSize = [width, height]
view.Background = [1, 1, 1]
view.OrientationAxesLabelColor = [0, 0, 0]
lutManager.setView(view)
print 'View created successfully (%dx%d)' % (width, height)

# Update authentication key to use
self.updateSecret(authKey)

def _extractVolumeImageData(self):
if(self.srcObj.GetPointDataInformation().GetNumberOfArrays() == 0):
print 'Error: no data information arrays'
Expand Down Expand Up @@ -422,5 +430,8 @@ def extractSubgrid(self, bounds):
args = parser.parse_args()

dataPath = args.path
initView(width=args.width, height=args.height)
authKey = args.authKey
width = args.width
height = args.height

web.start_webserver(options=args, protocol=MidasApp)
2 changes: 1 addition & 1 deletion modules/pvw/controllers/components/ParaviewComponent.php
Expand Up @@ -80,7 +80,7 @@ public function createAndStartInstance($item, $meshItems, $appname, $progressDao
$cmdArray = array($pvpython, $application,
'--port', $port,
'--data', $dataPath,
//'--authkey', $instance->getSecret(),
'-a', $instance->getSecret(),
'--timeout', '900');

// Now start the instance
Expand Down
2 changes: 1 addition & 1 deletion modules/pvw/public/js/paraview/paraview.common.js
Expand Up @@ -52,7 +52,7 @@ midas.pvw._commonStart = function (text) {
sessionURL: 'ws://'+location.hostname+':'+midas.pvw.instance.port+'/ws',
id: midas.pvw.instance.instance_id,
sessionManagerURL: json.global.webroot + '/pvw/paraview/instance',
authKey: midas.pvw.instance.secret,
secret: midas.pvw.instance.secret,
interactiveQuality: 50
};
midas.pvw.start();
Expand Down

0 comments on commit 21245a6

Please sign in to comment.