示例#1
0
    def __init__(self):
        self.result = Source.new(False)
        self.result.set_name("result")
        self.result.set_varname("%d_result"%(id(self),))
        self.add_source(self.result)

        self.inp = GFlow.SimpleSink.new(False)
        self.inp.set_name("input")
        self.add_sink(self.inp)

        self.set_name("NOT")
示例#2
0
    def __init__(self, raspi_context):
        raspi_context.register_node(self)
        self.context = raspi_context

        self.sources = {}
        self.switches = {}

        for pin in self.context.get_pins().keys():
            self.sources[pin] = Source.new(False)
            self.sources[pin].set_name("GPIO %02d"%pin)
            self.sources[pin].set_varname("%d_%d"%(id(self),pin))
            self.sources[pin].connect("linked", self.validate_connection, pin)
            self.add_source(self.sources[pin])
            self.switches[pin] = Gtk.Switch.new()
            self.switches[pin].set_name("switch_%d"%(pin,))
            self.switches[pin].connect("notify::active", self.on_pin_switched, pin)
示例#3
0
    def __init__(self):
        self.inputs = []
    
        self.result = Source.new(False)
        self.result.set_name("result")
        self.result.set_varname("%d_result"%(id(self),))
        self.add_source(self.result)

        self.add_button = Gtk.Button.new_with_mnemonic("Add")
        self.remove_button = Gtk.Button.new_with_mnemonic("Rem")
        self.childwidget = Gtk.Box.new(Gtk.Orientation.HORIZONTAL,0)
        self.childwidget.add(self.add_button)
        self.childwidget.add(self.remove_button)
        self.add_button.connect("clicked", self.add_summand)
        self.remove_button.connect("clicked", self.remove_summand)

        self.set_name("AND")
示例#4
0
    def __init__(self):
        self.res_u = Source.new(False)
        self.res_u.set_name("upper")
        self.res_u.set_varname("%d_res_u"%(id(self),))
        self.add_source(self.res_u)
        self.res_ul = Source.new(False)
        self.res_ul.set_name("upper left")
        self.res_ul.set_varname("%d_res_ul"%(id(self),))
        self.add_source(self.res_ul)
        self.res_ur = Source.new(False)
        self.res_ur.set_name("upper right")
        self.res_ur.set_varname("%d_res_ur"%(id(self),))
        self.add_source(self.res_ur)
        self.res_m = Source.new(False)
        self.res_m.set_name("middle")
        self.res_m.set_varname("%d_res_m"%(id(self),))
        self.add_source(self.res_m)
        self.res_ll = Source.new(False)
        self.res_ll.set_name("lower left")
        self.res_ll.set_varname("%d_res_ll"%(id(self),))
        self.add_source(self.res_ll)
        self.res_lr = Source.new(False)
        self.res_lr.set_name("lower right")
        self.res_lr.set_varname("%d_res_lr"%(id(self),))
        self.add_source(self.res_lr)
        self.res_l  = Source.new(False)
        self.res_l.set_name("lower")
        self.res_l.set_varname("%d_res_l"%(id(self),))
        self.add_source(self.res_l)

        self.in_1 = GFlow.SimpleSink.new(False)
        self.in_1.set_name("1")
        self.add_sink(self.in_1)
        self.in_2 = GFlow.SimpleSink.new(False)
        self.in_2.set_name("2")
        self.add_sink(self.in_2)
        self.in_4 = GFlow.SimpleSink.new(False)
        self.in_4.set_name("4")
        self.add_sink(self.in_4)
        self.in_8 = GFlow.SimpleSink.new(False)
        self.in_8.set_name("8")
        self.add_sink(self.in_8)

        self.childwidget = None

        self.set_name("7SEG Encoder")