Skip to content

Commit

Permalink
Enable commandline based selection of server host address
Browse files Browse the repository at this point in the history
  • Loading branch information
mwaskom committed Feb 28, 2017
1 parent f6b625e commit 2ea26a5
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
4 changes: 3 additions & 1 deletion scripts/visigoth-remote
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ if __name__ == "__main__":

print("Could not import study-specific remote methods")

host = "localhost" if args.localhost else args.host

# Start the PyQT GUI Application
app = QApplication([])
win = RemoteApp()
win = RemoteApp(host)
win.show()
app.exec_()
4 changes: 2 additions & 2 deletions visigoth/clientserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def __init__(self, remote):
self.cmd_q = remote.cmd_q

self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.socket.connect(("localhost", 50001))
self.socket.connect((remote.host, 50001))
self.socket.settimeout(.01)

def run(self):
Expand Down Expand Up @@ -153,7 +153,7 @@ def __init__(self, exp):

self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
self.socket.bind(("localhost", 50001))
self.socket.bind(("0.0.0.0", 50001))
self.socket.listen(2)

self.daemon = True
Expand Down
2 changes: 2 additions & 0 deletions visigoth/commandline.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,7 @@ def define_remote_parser():
parser = argparse.ArgumentParser()

parser.add_argument("study_dir", default=".", nargs="?")
parser.add_argument("--host", default="192.168.100.1")
parser.add_argument("--localhost", action="store_true")

return parser
6 changes: 4 additions & 2 deletions visigoth/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@

class RemoteApp(QMainWindow):

def __init__(self, parent=None):
def __init__(self, host):

QMainWindow.__init__(self, parent)
QMainWindow.__init__(self, None)
self.setWindowTitle("Visigoth Remote")

self.screen_q = queue.Queue()
Expand All @@ -30,6 +30,8 @@ def __init__(self, parent=None):
self.cmd_q = queue.Queue()

self.poll_dur = 20

self.host = host
self.client = None

# Intialize the parameters and eyeopts
Expand Down

0 comments on commit 2ea26a5

Please sign in to comment.