Visualizer: toggle between different output options (#122)

* added dynamic setting options based on graph outputs

* added functionality to view different types of outputs

* fixed first value set to nothing

* moved try except in smaller scope
This commit is contained in:
evonneng authored and GitHub committed 2022-07-12 18:52:04 -07:00
1 parent 437606e614
commit 25a1f91dee
5 files changed
+135 -12

No files matched your search

+20 -1
View File
@@ -22,7 +22,15 @@ import numpy as np
import umsgpack
import zmq
from pyrad.viewer.server.commands import Delete, GetObject, SetObject, SetProperty, SetTransform
from pyrad.viewer.server.commands import (
Delete,
GetObject,
SetObject,
SetOutputOptions,
SetOutputType,
SetProperty,
SetTransform,
)
from pyrad.viewer.server.path import Path
@@ -144,6 +152,17 @@ class Viewer(object):
def set_property(self, key, value):
return self.window.send(SetProperty(key, value, self.path))
def set_output_options(self, options):
return self.window.send(SetOutputOptions(options, self.path))
def set_output_type(self, type):
data = self.window.send(SetOutputType(type, self.path))
data = umsgpack.unpackb(data)
if isinstance(data, str) and data.find("error") == 0:
# some error meaning that the object does not exist
return None
return data
def delete(self):
return self.window.send(Delete(self.path))