Beispiel #1
0
    def __init__(self, name, type, data, stored=False, settings=None):
        """Initialize a source of data.

        Arguments:
        name -- file name (source file on disk)
        type -- type of the data (stype.Type)
        data -- physical data

        Keyword:
        stored -- flag informs that source is stored in a file
        settings -- a settings that was used by creating the source

        """
        EventSource.__init__(self)

        if name is not None:
            self._name = name
        else:
            self._name = "{0} ({1})".format(utils.get_timestamp_string(),
                                            utils.get_unique_id())

        self.type = type
        self.data = data
        self.stored = stored
        self.settings = settings
Beispiel #2
0
    def __init__(self, app):
        gtk.VBox.__init__(self)
        EventSource.__init__(self)

        self.operation = None
        self.app = app
        self.events = EventCallbacksList()
Beispiel #3
0
    def __init__(self, operation):
        gtk.Alignment.__init__(self, 0, 0, 1, 1)
        EventSource.__init__(self)

        self.operation = operation

        self.set_padding(5, 0, 5, 5)
        hbox = gtk.HBox(False)

        icon = drawing.StateIcon(self.operation.state)
        self.event = self.operation.set_callback("state-changed",
                                                 lambda s: icon.set_state(s))
        hbox.pack_start(icon, False, False)

        label = gtk.Label()
        label.set_alignment(0, 0.5)
        label.set_padding(2, 0)
        label.set_markup("<b>{0}</b>".format(operation.name))
        hbox.pack_start(label, True, True)

        button = gtk.Button("Select")
        button.connect(
            "clicked",
            lambda w: self.emit_event("operation-selected", self.operation))
        hbox.pack_start(button, False, False)

        frame = gtk.Frame()
        frame.set_shadow_type(gtk.SHADOW_OUT)

        frame.add(hbox)
        self.add(frame)
 def __init__(self):
     EventSource.__init__(self)
     self.random = random.Random()
     self.state = "ready" # states: ready / running / finished / error
     self.runinstance = None
     self.sequence = controlseq.ControlSequence()
     self.history_instances = []
Beispiel #5
0
    def __init__(self, name, type, data, stored=False, settings=None):
        """Initialize a source of data.

        Arguments:
        name -- file name (source file on disk)
        type -- type of the data (stype.Type)
        data -- physical data

        Keyword:
        stored -- flag informs that source is stored in a file
        settings -- a settings that was used by creating the source

        """
        EventSource.__init__(self)

        if name is not None:
            self._name = name
        else:
            self._name = "{0} ({1})".format(utils.get_timestamp_string(),
                                            utils.get_unique_id())

        self.type = type
        self.data = data
        self.stored = stored
        self.settings = settings
Beispiel #6
0
    def __init__(self, parameter):
        EventSource.__init__(self)

        self._parameter = parameter

        self._real_attached = 0
        self._sources = [None] * self._parameter.minimum
Beispiel #7
0
    def __init__(self, operation):
        gtk.Alignment.__init__(self, 0, 0, 1, 1)
        EventSource.__init__(self)

        self.operation = operation

        self.set_padding(5, 0, 5, 5)
        hbox = gtk.HBox(False)

        icon = drawing.StateIcon(self.operation.state)
        self.event = self.operation.set_callback(
            "state-changed", lambda s: icon.set_state(s))
        hbox.pack_start(icon, False, False)

        label = gtk.Label()
        label.set_alignment(0, 0.5)
        label.set_padding(2, 0)
        label.set_markup("<b>{0}</b>".format(operation.name))
        hbox.pack_start(label, True, True)

        button = gtk.Button("Select")
        button.connect(
            "clicked",
            lambda w : self.emit_event("operation-selected", self.operation))
        hbox.pack_start(button, False, False)

        frame = gtk.Frame()
        frame.set_shadow_type(gtk.SHADOW_OUT)

        frame.add(hbox)
        self.add(frame)
Beispiel #8
0
    def __init__(self, app):
        gtk.VBox.__init__(self)
        EventSource.__init__(self)

        self.operation = None
        self.app = app
        self.events = EventCallbacksList()
Beispiel #9
0
 def __init__(self):
     EventSource.__init__(self)
     self.random = random.Random()
     self.running = True
     self.runinstance = None
     self.sequence = controlseq.ControlSequence()
     self.history_instances = []
     self.current_index = 0
Beispiel #10
0
    def __init__(self, parameter):
        EventSource.__init__(self)

        self._parameter = parameter
        self._src_name_changed_events = EventCallbacksList()

        self._real_attached = 0
        self._sources = [None] * self._parameter.minimum
Beispiel #11
0
    def __init__(self, parameter):
        EventSource.__init__(self)

        self._parameter = parameter
        self._src_name_changed_events = EventCallbacksList()

        self._real_attached = 0
        self._sources = [None] * self._parameter.minimum
Beispiel #12
0
    def __init__(self):
        EventSource.__init__(self)

        self.events = EventCallbacksList()
        self.arguments = [Argument(param) for param in self.parameters]
        for argument in self.arguments:
            self.events.set_callback(argument, "argument-changed",
                                     self._cb_argument_changed)
            self.events.set_callback(argument, "select-argument",
                                     lambda p, i: self.select_argument(p, i),
                                     argument)

        self.selected_argument = (None, None)
        self._state = "ready" if self.all_sources_filled() else "incomplete"
Beispiel #13
0
    def __init__(self):
        EventSource.__init__(self)

        self.events = EventCallbacksList()
        self.arguments = [Argument(param) for param in self.parameters]
        for argument in self.arguments:
            self.events.set_callback(
                argument, "argument-changed", self._cb_argument_changed)
            self.events.set_callback(
                argument,
                "select-argument",
                lambda p, i: self.select_argument(p, i), argument)

        self.selected_argument = (None, None)
        self._state = "ready" if self.all_sources_filled() else "incomplete"
Beispiel #14
0
    def __init__(self, file_name):
        assert file_name is not None
        EventSource.__init__(self)
        self.id_counter = 100
        self.set_filename(file_name)
        self.nets = []
        self.parameters = []
        self.sequences = []
        self.simconfig = SimConfig()
        self.error_messages = {}
        self.generator = None # PTP generator
        self.build_net = None

        # Library options
        self.library_rpc = False
        self.library_octave = False
Beispiel #15
0
    def __init__(self, argument):
        gtk.Table.__init__(self, 1, 4, False)
        EventSource.__init__(self)
        self.entries = []

        self.set_border_width(2)

        self.argument = argument
        self.events = EventCallbacksList()
        self.events.set_callback(self.argument, "argument-changed",
                                 self._cb_argument_changed)
        self.events.set_callback(self.argument, "source-name-changed",
                                 self._cb_source_name_changed)

        # initialize view
        self._cb_argument_changed()
Beispiel #16
0
    def __init__(self, argument):
        gtk.Table.__init__(self, 1, 4, False)
        EventSource.__init__(self)
        self.entries = []

        self.set_border_width(2)

        self.argument = argument
        self.events = EventCallbacksList()
        self.events.set_callback(
            self.argument, "argument-changed", self._cb_argument_changed)
        self.events.set_callback(
            self.argument, "source-name-changed", self._cb_source_name_changed)

        # initialize view
        self._cb_argument_changed()
Beispiel #17
0
    def __init__(self, file_name):
        assert file_name is not None
        EventSource.__init__(self)
        self.id_counter = 100
        self.set_filename(file_name)
        self.nets = []
        self.parameters = []
        self.sequences = []
        self.simconfig = SimConfig()
        self.error_messages = {}
        self.generator = None  # PTP generator
        self.build_net = None

        # Library options
        self.library_rpc = False
        self.library_octave = False
Beispiel #18
0
    def __init__(self, repository, app):
        gtk.VBox.__init__(self)
        EventSource.__init__(self)

        self.repository = repository
        self.events = EventCallbacksList()
        self.events.set_callback(
            self.repository, "source-added", self._cb_source_added)
        self.events.set_callback(
            self.repository, "source-removed", self._cb_source_removed)
        self.app = app

        self.sources_views = {} # (source, source_view)

        sources = self.repository.get_sources()
        for source in sources:
            self._cb_source_added(source)
Beispiel #19
0
    def __init__(self, repository, app):
        gtk.VBox.__init__(self)
        EventSource.__init__(self)

        self.repository = repository
        self.events = EventCallbacksList()
        self.events.set_callback(self.repository, "source-added",
                                 self._cb_source_added)
        self.events.set_callback(self.repository, "source-removed",
                                 self._cb_source_removed)
        self.app = app

        self.sources_views = {}  # (source, source_view)

        sources = self.repository.get_sources()
        for source in sources:
            self._cb_source_added(source)
Beispiel #20
0
    def __init__(self):
        EventSource.__init__(self)

        self._repo = {} # (name: source)
Beispiel #21
0
 def __init__(self):
     threading.Thread.__init__(self)
     EventSource.__init__(self)
     self.daemon = True
     self.q = Queue.Queue()
     self.task_in_progress = None
Beispiel #22
0
 def __init__(self, page_name):
     EventSource.__init__(self)
     self.register_event("apply")
     self.register_event("restore")
     self.page_name = page_name
Beispiel #23
0
    def __init__(self, source, app):
        gtk.Alignment.__init__(self, 0, 0, 1, 1)
        EventSource.__init__(self)

        self.source = source
        self.source.set_callback(
            "source-name-changed",
            lambda old, new: self.entry_name.set_text(new))

        self.app = app  # reference to the main application
        self.tabview = None

        self.set_padding(5, 0, 10, 10)

        table = gtk.Table(2, 3, False)
        table.set_border_width(2)
        table.set_col_spacing(0, 10)
        table.set_col_spacing(1, 2)

        # name of source
        self.entry_name = gtk.Entry()
        self.entry_name.set_size_request(40, -1)
        self.entry_name.set_editable(False)
        self.entry_name.set_text(self.source.name)
        table.attach(self.entry_name, 0, 1, 0, 1)

        # name of data type
        label = gtk.Label()
        label.set_alignment(0, 0)
        label.set_markup("<i>{0}</i>".format(self.source.type.name))
        table.attach(label, 0, 1, 1, 2)

        self.btns_group1 = []
        self.btns_group2 = []
        # attach button
        button = gtk.Button("Attach")
        button.connect("clicked",
                       lambda w: self.emit_event("attach-source", self.source))
        table.attach(button, 1, 2, 0, 2, xoptions=gtk.FILL)
        self.btns_group1.append(button)

        button = gtk.Button("Show")
        button.connect("clicked", lambda w: self._cb_show())
        table.attach(button, 2, 3, 0, 2, xoptions=gtk.FILL)
        self.btns_group1.append(button)

        # source menu
        menu = gtk.Menu()

        item = gtk.MenuItem("Store")
        item.connect("activate", lambda w: self._cb_store())
        self.btns_group1.append(item)
        menu.append(item)
        self.item_reload = gtk.MenuItem("Reload")
        self.item_reload.connect("activate", lambda w: self._cb_load())
        self.item_reload.set_sensitive(self.source.stored)
        menu.append(self.item_reload)
        menu.append(gtk.SeparatorMenuItem())

        self.item_dispose = gtk.MenuItem("Dispose")
        self.item_dispose.connect("activate", lambda w: self._cb_dispose())
        self.item_dispose.set_sensitive(self.source.stored)
        self.btns_group1.append(self.item_dispose)
        menu.append(self.item_dispose)

        item = gtk.MenuItem("Delete")
        item.connect("activate", lambda w: self._cb_delete())
        menu.append(item)
        menu.show_all()

        menu_btn = gtk.Button(">")
        menu_btn.connect_object("event-after", self._menu_handler, menu)
        table.attach(menu_btn, 3, 4, 0, 2, xoptions=0)

        # source component
        frame = gtk.Frame()
        frame.set_shadow_type(gtk.SHADOW_OUT)
        frame.add(table)

        self.add(frame)
Beispiel #24
0
 def __init__(self):
     EventSource.__init__(self)
     self._sources = []
Beispiel #25
0
    def __init__(self, source, app):
        gtk.Alignment.__init__(self, 0, 0, 1, 1)
        EventSource.__init__(self)

        self.source = source
        self.source.set_callback("source-name-changed",
                                 lambda old, new: self.entry_name.set_text(new))

        self.app = app # reference to the main application
        self.tabview = None

        self.set_padding(5, 0, 10, 10)

        table = gtk.Table(2, 3, False)
        table.set_border_width(2)
        table.set_col_spacing(0, 10)
        table.set_col_spacing(1, 2)

        # name of source
        self.entry_name = gtk.Entry()
        self.entry_name.set_size_request(40, -1)
        self.entry_name.set_editable(False)
        self.entry_name.set_text(self.source.name)
        table.attach(self.entry_name, 0, 1, 0, 1)

        # name of data type
        label = gtk.Label()
        label.set_alignment(0, 0)
        label.set_markup("<i>{0}</i>".format(self.source.type.name))
        table.attach(label, 0, 1, 1, 2)

        self.btns_group1 = []
        self.btns_group2 = []
        # attach button
        button = gtk.Button("Attach")
        button.connect(
            "clicked", lambda w: self.emit_event("attach-source", self.source))
        table.attach(button, 1, 2, 0, 2, xoptions=gtk.FILL)
        self.btns_group1.append(button)

        button = gtk.Button("Show")
        button.connect(
            "clicked", lambda w: self._cb_show())
        table.attach(button, 2, 3, 0, 2, xoptions=gtk.FILL)
        self.btns_group1.append(button)

        # source menu
        menu = gtk.Menu()

        item = gtk.MenuItem("Store")
        item.connect("activate", lambda w: self._cb_store())
        self.btns_group1.append(item)
        menu.append(item)
        self.item_reload = gtk.MenuItem("Reload")
        self.item_reload.connect("activate", lambda w: self._cb_load())
        self.item_reload.set_sensitive(self.source.stored)
        menu.append(self.item_reload)
        menu.append(gtk.SeparatorMenuItem())

        self.item_dispose = gtk.MenuItem("Dispose")
        self.item_dispose.connect("activate", lambda w: self._cb_dispose())
        self.item_dispose.set_sensitive(self.source.stored)
        self.btns_group1.append(self.item_dispose)
        menu.append(self.item_dispose)

        item = gtk.MenuItem("Delete")
        item.connect("activate", lambda w: self._cb_delete())
        menu.append(item)
        menu.show_all()

        menu_btn = gtk.Button(">");
        menu_btn.connect_object("event-after", self._menu_handler, menu)
        table.attach(menu_btn, 3, 4, 0, 2, xoptions=0)

        # source component
        frame = gtk.Frame()
        frame.set_shadow_type(gtk.SHADOW_OUT)
        frame.add(table)

        self.add(frame)
Beispiel #26
0
 def __init__(self):
     EventSource.__init__(self)
     self._sources = []