# title: Start SAMP Hub and Listener # label: Start SAMP Hub and Listener from java.util import Random from org.astrogrid.samp.hub import Hub from org.astrogrid.samp.client import DefaultClientProfile clientProfile = DefaultClientProfile.getProfile() if ( not clientProfile.isHubRunning() ): try: print 'starting SAMP hub...' Hub.runMain([]) print 'HUB started.' except: from javax.swing import JOptionPane JOptionPane.showMessageDialog( getApplication(), 'hub is running already, pretty sure...', 'Error when starting hub', JOptionPane.OK_CANCEL_OPTION ) else: print 'Client is already running.' from org.autoplot import AddSampListener AddSampListener.addSampListener(getViewWindow().getDataSetSelector())