Ejemplo n.º 1
0
Archivo: source.py Proyecto: sch17/wasp
 def get_preference_widgets(configurable):
     self = configurable
     sg = self.build_sizegroup()
     ser_port_cb = self.build_combo("serial_port", *libserial.get_ports())
     ser_speed_cb = self.build_combo("serial_speed", *libserial.get_speeds())
     items = [ser_port_cb, ser_speed_cb]
     frame = self.build_frame(None, [
         self.build_label("Serial Port", ser_port_cb, sg=sg),
         self.build_label("Serial Baud", ser_speed_cb, sg=sg),
     ])
     return "UAV Source", frame, items
Ejemplo n.º 2
0
    def get_preference_widgets(self):
        sg = self.build_sizegroup()
        ser_port_cb = self.build_combo("serial_port", *libserial.get_ports())
        ser_speed_cb = self.build_combo("serial_speed", *libserial.get_speeds())

        # all following items configuration is saved
        items = [ser_port_cb, ser_speed_cb]

        # the gui looks like
        frame = self.build_frame(
            None,
            [self.build_label("Serial Port", ser_port_cb, sg=sg), self.build_label("Serial Baud", ser_speed_cb, sg=sg)],
        )

        return "UAV Source", frame, items
Ejemplo n.º 3
0
    def __init__(self, echo, expander, enable_tooltips):
        gtk.VBox.__init__(self, spacing=4)
        self._watch = None        
        self.echo = echo

        self.set_border_width(4)

        self.serial = SerialSender.SerialSender()
        self.serial.connect("serial-connected", self._on_serial_connected)
        sc = SerialChooser.SerialChooser(
                            sender=self.serial,
                            ports=libserial.get_ports(),
                            speeds=libserial.get_speeds())
        self.pack_start(sc, expand=False, fill=False)

        self.terminal = vte.Terminal()
        self.terminal.connect("commit", self._on_text_entered_in_terminal)
        self.pack_start(self.terminal, expand=True, fill=True)

        #tell vte to not get in the way of backspace/delete
        #
        #python-vte bindings don't appear to support this constant, 
        #so the magic values are being assumed from the C enum :/
        if self.BACKSPACE:
            #backbind = vte.ERASE_ASCII_BACKSPACE
            backbind = 2
        else:
            #backbind = vte.ERASE_AUTO_BACKSPACE
            backbind = 1

        if self.DELETE:
            #delbind = vte.ERASE_DELETE_SEQUENCE
            delbind = 3
        else:
            #delbind = vte.ERASE_AUTO
            delbind = 0
        self.terminal.set_backspace_binding (backbind)
        self.terminal.set_delete_binding (delbind)

        hb = gtk.HBox(spacing=2)
        self.pack_start(hb, expand=False, fill=True)

        entry = RawEntry.MyEntry(enable_tooltips)
        entry.connect("activate", self._on_entry_activate)
        hb.pack_start(entry, expand=True, fill=True)

        lbl = gtk.Label("0B")
        lbl.set_width_chars(4)
        lbl.set_justify(gtk.JUSTIFY_RIGHT)
        hb.pack_start(lbl, expand=False, fill=False)

        if enable_tooltips:
            lbl.props.has_tooltip = True
            lbl.connect("query-tooltip", self._on_lbl_tooltip, entry)

        entry.connect("changed", self._on_entry_changed, lbl)

        #store the hex view in an expander
        #only create said viewwhen revealed the first time
        if expander:
            exp = gtk.expander_new_with_mnemonic("_Hex View")
            exp.connect("notify::expanded", self._expander_callback)
            self.pack_start(exp, expand=False, fill=False)
        self.hexview = None
        self._hexbuf = ""
Ejemplo n.º 4
0
    def __init__(self, echo, expander, enable_tooltips):
        gtk.VBox.__init__(self, spacing=4)
        self._watch = None
        self.echo = echo

        self.set_border_width(4)

        self.serial = SerialSender.SerialSender()
        self.serial.connect("serial-connected", self._on_serial_connected)
        sc = SerialChooser.SerialChooser(sender=self.serial,
                                         ports=libserial.get_ports(),
                                         speeds=libserial.get_speeds())
        self.pack_start(sc, expand=False, fill=False)

        self.terminal = vte.Terminal()
        self.terminal.connect("commit", self._on_text_entered_in_terminal)
        self.pack_start(self.terminal, expand=True, fill=True)

        #tell vte to not get in the way of backspace/delete
        #
        #python-vte bindings don't appear to support this constant,
        #so the magic values are being assumed from the C enum :/
        if self.BACKSPACE:
            #backbind = vte.ERASE_ASCII_BACKSPACE
            backbind = 2
        else:
            #backbind = vte.ERASE_AUTO_BACKSPACE
            backbind = 1

        if self.DELETE:
            #delbind = vte.ERASE_DELETE_SEQUENCE
            delbind = 3
        else:
            #delbind = vte.ERASE_AUTO
            delbind = 0
        self.terminal.set_backspace_binding(backbind)
        self.terminal.set_delete_binding(delbind)

        hb = gtk.HBox(spacing=2)
        self.pack_start(hb, expand=False, fill=True)

        entry = RawEntry.MyEntry(enable_tooltips)
        entry.connect("activate", self._on_entry_activate)
        hb.pack_start(entry, expand=True, fill=True)

        lbl = gtk.Label("0B")
        lbl.set_width_chars(4)
        lbl.set_justify(gtk.JUSTIFY_RIGHT)
        hb.pack_start(lbl, expand=False, fill=False)

        if enable_tooltips:
            lbl.props.has_tooltip = True
            lbl.connect("query-tooltip", self._on_lbl_tooltip, entry)

        entry.connect("changed", self._on_entry_changed, lbl)

        #store the hex view in an expander
        #only create said viewwhen revealed the first time
        if expander:
            exp = gtk.expander_new_with_mnemonic("_Hex View")
            exp.connect("notify::expanded", self._expander_callback)
            self.pack_start(exp, expand=False, fill=False)
        self.hexview = None
        self._hexbuf = ""