Skip to content

Commit

Permalink
Issue #110 - Changed AIT gui kwargs to attributes
Browse files Browse the repository at this point in the history
Instead of passing in the values to the GUIs self.init method,
the init method will see if the plugin has the port and host items
defined as attributes.
  • Loading branch information
Robert Schneider committed Aug 13, 2019
1 parent 39d0e4b commit d7c57f2
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions ait/gui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,7 @@ def __init__(self, inputs, outputs, zmq_args=None, **kwargs):

bottle.TEMPLATE_PATH.append(HTMLRoot.User)

port = 8080
if 'port' in kwargs:
port = int(kwargs['port'])

gevent.spawn(self.init, port=port)
gevent.spawn(self.init)

def process(self, input_data, topic=None):
# msg is going to be a tuple from the ait_packet_handler
Expand Down Expand Up @@ -220,7 +216,7 @@ def process_log_msg(self, msg):
def getBrowserName(self, browser):
return getattr(browser, 'name', getattr(browser, '_name', '(none)'))

def init(self, host=None, port=8080):
def init(self):

# The /cmd endpoint requires access to the AITGUIPlugin object so it
# can publish commands via the Plugin interface. It's defined here with
Expand Down Expand Up @@ -259,7 +255,14 @@ def handle(pathname):
def handle(pathname):
return bottle.static_file(pathname, root=HTMLRoot.User)

if host is None:
if hasattr(self, 'port'):
port = int(self.port)
else:
port = 8080

if hasattr(self, 'host'):
host = self.host
else:
host = 'localhost'

streams = ait.config.get('gui.telemetry')
Expand Down

0 comments on commit d7c57f2

Please sign in to comment.