def _connect_client(self): client = samp.SAMPIntegratedClient( metadata={ "samp.name": "ginga", "samp.description.text": "Ginga viewer", "ginga.version": version }) client.connect() # TODO: need to handle some administrative messages # client.bindReceiveNotification("samp.app.*", self.samp_placeholder) # client.bindReceiveCall("samp.app.*", self.samp_placeholder) # Loads a 2-dimensional FITS image. # Arguments: # url (string): URL of the FITS image to load # image-id (string) optional: Identifier which may be used # to refer to the loaded image in subsequent messages # name (string) optional: name which may be used to label the # loaded image in the application GUI # Return Values: none client.bind_receive_call("image.load.fits", self.samp_call_load_fits) client.bind_receive_notification("image.load.fits", self.samp_notify_load_fits) # Not yet implemented. Not sure if/how these are different # from the image.load.fits variants client.bind_receive_call("table.load.fits", self.samp_placeholder) client.bind_receive_notification("table.load.fits", self.samp_placeholder) # Directs attention (e.g. by moving a cursor or shifting the field # of view) to a given point on the celestial sphere. # Arguments: # ra (SAMP float): right ascension in degrees # dec (SAMP float): declination in degrees # Return Values: none client.bind_receive_call("coord.pointAt.sky", self.samp_placeholder) client.bind_receive_notification("coord.pointAt.sky", self.samp_placeholder) # Loads a table in VOTable format. This is the usual way to # exchange table data between SAMP clients. # Arguments: # url (string): URL of the VOTable document to load # table-id (string) optional: identifier which may be used to # refer to the loaded table in subsequent messages # name (string) optional: name which may be used to label the # loaded table in the application GUI # Return Values: none client.bind_receive_call("table.load.votable", self.samp_placeholder) client.bind_receive_notification("table.load.votable", self.samp_placeholder) return client
def _setup(): global sampcl try: icon = 'file:///' + '/'.join( [resourceDirectory, 'icons', 'veusz_16.png']) sampcl = samp.SAMPIntegratedClient(metadata={ 'samp.name': 'Veusz', 'samp.icon.url': icon }) sampcl.connect() atexit.register(close) try: sampcl.bindReceiveCall('table.load.votable', load_votable) except AttributeError: sampcl.bind_receive_call('table.load.votable', load_votable) except samp.SAMPHubError: print('SAMP: could not connect to hub')