コード例 #1
0
def test_message_widget_runs():

    hub = Hub()

    widget = MessageWidget()
    widget.register_to_hub(hub)
    widget.show()

    message = Message('test_message_widget_runs', tag='1234')

    hub.broadcast(message)
コード例 #2
0
ファイル: test_message_widget.py プロジェクト: PennyQ/glue
def test_message_widget_runs():

    hub = Hub()

    widget = MessageWidget()
    widget.register_to_hub(hub)
    widget.show()

    message = Message('test_message_widget_runs', tag='1234')

    hub.broadcast(message)
コード例 #3
0
def main():

    app = QApplication(sys.argv)
    win = QMainWindow()

    data = example_data.simple_image()
    dc = DataCollection([data])
    histo_client = HistogramWidget(dc)

    hub = Hub(dc, histo_client)
    win.setCentralWidget(histo_client)
    win.show()
    sys.exit(app.exec_())
コード例 #4
0
ファイル: data_collection.py プロジェクト: robintw/glue
    def __init__(self, data=None):
        """
        :param data: :class:`~glue.core.data.Data` object, or list of such objects
        """
        super(DataCollection, self).__init__()
        self._link_manager = LinkManager()
        self._data = []

        self.hub = None

        self._subset_groups = []
        self.register_to_hub(Hub())
        self.extend(as_list(data or []))
        self._sg_count = 0
コード例 #5
0
    def __init__(self, data=None):
        super(DataCollection, self).__init__()

        self._link_manager = LinkManager(self)
        self._data = []

        self.hub = None

        self._disable_sync_link_manager = 0
        self._subset_groups = []
        self.register_to_hub(Hub())
        self.extend(as_list(data or []))
        self._sg_count = 0

        self._link_manager.register_to_hub(self.hub)
コード例 #6
0
ファイル: simple_glue.py プロジェクト: drphilmarshall/glue
class MyClient(HubListener):
    def register_to_hub(self, hub):
        """ Sign up to receive DataMessages from the hub """
        hub.subscribe(self,                     # subscribing object
                      DataMessage, # message type to subscribe to
                      handler = self.receive_message) # method to call


    def receive_message(self, message):
        """ Receives each DataMessage relay """
        print "    MyClient received a message \n"


# create objects
hub = Hub()
client = MyClient()
data = Data()
subset = data.new_subset()
data_collection = DataCollection()

# connect them to each other
data_collection.append(data)
data_collection.register_to_hub(hub)
client.register_to_hub(hub)

# manually send a DataMessage. Relayed to MyClient
print 'Manually sending DataMessage'
message = DataMessage(data)
hub.broadcast(message)