Beispiel #1
0
    def build_formprops(self):
        self.props = {}

        frame = gtk.Frame("Form Properties")

        path = mainapp.get_mainapp().config.get("settings", "form_logo_dir")
        logos = []
        for fn in glob.glob(os.path.join(path, "*.*")):
            logos.append(fn.replace(path, "")[1:])

        box = gtk.VBox(False, 2)
        for i in ["Title", "ID"]:
            f = self.make_field(i)
            box.pack_start(f, 0, 0, 0)
            f.show()

        f = self.make_field("Logo", logos)
        box.pack_start(f, 0, 0, 0)
        f.show()

        box.show()

        frame.add(box)
        frame.show()

        return frame
Beispiel #2
0
    def __init__(self):
        QSTEditWidget.__init__(self, False, 2)

        lab = gtk.Label(_("Choose a station whose position will be sent"))
        lab.show()
        self.pack_start(lab, 1, 1, 1)

        hbox = gtk.HBox(False, 10)

        # This is really ugly, but to fix it requires more work
        self.__sources = mainapp.get_mainapp().map.get_map_sources()
        sources = [x.get_name() for x in self.__sources]
        self.__group = miscwidgets.make_choice(sources,
                                               False,
                                               _("Stations"))
        self.__group.show()
        hbox.pack_start(self.__group, 0, 0, 0)

        self.__station = miscwidgets.make_choice([], False)
        self.__station.show()
        hbox.pack_start(self.__station, 0, 0, 0)

        self.__group.connect("changed", self.ev_group_sel, self.__station)
        self.ev_group_sel(self.__group, self.__station)

        hbox.show()
        self.pack_start(hbox, 0, 0, 0)
Beispiel #3
0
    def build_formprops(self):
        self.props = {}

        frame = gtk.Frame("Form Properties")

        path = mainapp.get_mainapp().config.get("settings", "form_logo_dir")
        logos = []
        for fn in glob.glob(os.path.join(path, "*.*")):
            logos.append(fn.replace(path, "")[1:])

        box = gtk.VBox(False, 2)
        for i in ["Title", "ID"]:
            f = self.make_field(i)
            box.pack_start(f, 0, 0, 0)
            f.show()

        f = self.make_field("Logo", logos)
        box.pack_start(f, 0, 0, 0)
        f.show()

        box.show()

        frame.add(box)
        frame.show()

        return frame
Beispiel #4
0
    def __init__(self, config, content):
        QSTText.__init__(self, config, content)

        self.prefix = ""
        self.raw = True
        self.mainapp = mainapp.get_mainapp()
        self.fix = None
Beispiel #5
0
    def __init__(self, *args, **kw):
        QSTText.__init__(self, *args, **kw)

        self.prefix = ""
        self.raw = True
        self.mainapp = mainapp.get_mainapp()
        self.fix = None
Beispiel #6
0
    def __init__(self):
        QSTEditWidget.__init__(self, False, 2)

        lab = gtk.Label(_("Choose a station whose position will be sent"))
        lab.show()
        self.pack_start(lab, 1, 1, 1)

        hbox = gtk.HBox(False, 10)

        # This is really ugly, but to fix it requires more work
        self.__sources = mainapp.get_mainapp().map.get_map_sources()
        sources = [x.get_name() for x in self.__sources]
        self.__group = miscwidgets.make_choice(sources,
                                               False,
                                               _("Stations"))
        self.__group.show()
        hbox.pack_start(self.__group, 0, 0, 0)

        self.__station = miscwidgets.make_choice([], False)
        self.__station.show()
        hbox.pack_start(self.__station, 0, 0, 0)

        self.__group.connect("changed", self.ev_group_sel, self.__station)
        self.ev_group_sel(self.__group, self.__station)

        hbox.show()
        self.pack_start(hbox, 0, 0, 0)
Beispiel #7
0
    def __init__(self, *args, **kw):
        QSTText.__init__(self, *args, **kw)

        self.prefix = ""
        self.raw = True
        self.mainapp = mainapp.get_mainapp()
        self.fix = None
Beispiel #8
0
    def __init__(self, config, content):
        QSTText.__init__(self, config, content)

        self.prefix = ""
        self.raw = True
        self.mainapp = mainapp.get_mainapp()
        self.fix = None
Beispiel #9
0
    def get_source(self, name):
        import mainapp
        app = mainapp.get_mainapp() # Hack for this difficult case
        sources = app.map.get_map_sources()

        for source in sources:
            if source.get_name() == name:
                return source

        return None
Beispiel #10
0
    def get_source(self, name):
        import mainapp
        app = mainapp.get_mainapp() # Hack for this difficult case
        sources = app.map.get_map_sources()

        for source in sources:
            if source.get_name() == name:
                return source

        return None
Beispiel #11
0
def do_dprs_calculator(initial=""):
    def ev_sym_changed(iconsel, oversel, icons):
        oversel.set_sensitive(icons[iconsel.get_active()][1][0] == "\\")

    d = inputdialog.FieldDialog(title=_("DPRS message"))
    msg = gtk.Entry(13)

    overlays = [chr(x) for x in range(ord(" "), ord("_"))]

    cur = initial
    if cur and cur[-3] == "*" and cur[3] == " ":
        msg.set_text(cur[4:-3])
        dsym = cur[:2]
        deficn = gps.DPRS_TO_APRS.get(dsym, "/#")
        defovr = cur[2]
        if defovr not in overlays:
            print "Overlay %s not in list" % defovr
            defovr = " "
    else:
        deficn = "/#"
        defovr = " "

    icons = []
    for sym in sorted(gps.DPRS_TO_APRS.values()):
        icon = get_icon(sym)
        if icon:
            icons.append((icon, sym))
    iconsel = miscwidgets.make_pixbuf_choice(icons, deficn)

    oversel = miscwidgets.make_choice(overlays, False, defovr)
    iconsel.connect("changed", ev_sym_changed, oversel, icons)
    ev_sym_changed(iconsel, oversel, icons)

    d.add_field(_("Message"), msg)
    d.add_field(_("Icon"), iconsel)
    d.add_field(_("Overlay"), oversel)

    r = d.run()
    aicon = icons[iconsel.get_active()][1]
    mstr = msg.get_text().upper()
    over = oversel.get_active_text()
    d.destroy()
    if r != gtk.RESPONSE_OK:
        return

    dicon = gps.APRS_TO_DPRS[aicon]

    callsign = mainapp.get_mainapp().config.get("user", "callsign")
    string = "%s%s %s" % (dicon, over, mstr)

    check = gps.DPRS_checksum(callsign, string)

    return string + check
Beispiel #12
0
def do_dprs_calculator(initial=""):
    def ev_sym_changed(iconsel, oversel, icons):
        oversel.set_sensitive(icons[iconsel.get_active()][1][0] == "\\")

    d = inputdialog.FieldDialog(title=_("DPRS message"))
    msg = gtk.Entry(13)

    overlays = [chr(x) for x in range(ord(" "), ord("_"))]

    cur = initial
    if cur and cur[-3] == "*" and cur[3] == " ":
        msg.set_text(cur[4:-3])
        dsym = cur[:2]
        deficn = gps.DPRS_TO_APRS.get(dsym, "/#")
        defovr = cur[2]
        if defovr not in overlays:
            print "Overlay %s not in list" % defovr
            defovr = " "
    else:
        deficn = "/#"
        defovr = " "

    icons = []
    for sym in sorted(gps.DPRS_TO_APRS.values()):
        icon = get_icon(sym)
        if icon:
            icons.append((icon, sym))
    iconsel = miscwidgets.make_pixbuf_choice(icons, deficn)

    oversel = miscwidgets.make_choice(overlays, False, defovr)
    iconsel.connect("changed", ev_sym_changed, oversel, icons)
    ev_sym_changed(iconsel, oversel, icons)

    d.add_field(_("Message"), msg)
    d.add_field(_("Icon"), iconsel)
    d.add_field(_("Overlay"), oversel)

    r = d.run()
    aicon = icons[iconsel.get_active()][1]
    mstr = msg.get_text().upper()
    over = oversel.get_active_text()
    d.destroy()
    if r != gtk.RESPONSE_OK:
        return

    dicon = gps.APRS_TO_DPRS[aicon]

    callsign = mainapp.get_mainapp().config.get("user", "callsign")
    string = "%s%s %s" % (dicon, over, mstr)

    check = gps.DPRS_checksum(callsign, string)

    return string + check
Beispiel #13
0
    def show_preview(self, widget, data=None):
        fd, n = tempfile.mkstemp()

        f = file(n, "w")
        f.write(self.get_form_xml())
        f.close()
        os.close(fd)

        d = FormDialog("Preview of form", n, parent=self)
        config = mainapp.get_mainapp().config
        d.configure(config)
        d.run()
        d.destroy()
        os.remove(n)
Beispiel #14
0
    def show_preview(self, widget, data=None):
        fd, n = tempfile.mkstemp()

        f = file(n, "w")
        f.write(self.get_form_xml())
        f.close()
        os.close(fd)

        d = FormDialog("Preview of form", n, parent=self)
        config = mainapp.get_mainapp().config
        d.configure(config)
        d.run()
        d.destroy()
        os.remove(n)
Beispiel #15
0
    def _route_via_wl2k(self, src, dst, msgfn):
        foo, addr = dst.split(":")
        msg = self._form_to_wl2k_em(addr, msgfn)

        def complete(thread, status, error):
            if status:
                self._emit("form-sent", -1, msgfn)
            else:
                print "Failed to send via WL2K: %s" % error

        mt = wl2k.wl2k_auto_thread(mainapp.get_mainapp(), src, send_msgs=[msg])
        mt.connect("mail-thread-complete", complete)
        mt.connect("event", self.__proxy_emit("event"))
        mt.connect("form-received", self.__proxy_emit("form-received"))
        mt.connect("form-sent", self.__proxy_emit("form-sent"))
        mt.start()

        return True
Beispiel #16
0
    def _route_via_wl2k(self, src, dst, msgfn):
        foo, addr = dst.split(":")
        msg = self._form_to_wl2k_em(addr, msgfn)

        def complete(thread, status, error):
            if status:
                self._emit("form-sent", -1, msgfn)
            else:
                print "Failed to send via WL2K: %s" % error

        mt = wl2k.wl2k_auto_thread(mainapp.get_mainapp(), src, send_msgs=[msg])
        mt.connect("mail-thread-complete", complete)
        mt.connect("event", self.__proxy_emit("event"))
        mt.connect("form-received", self.__proxy_emit("form-received"))
        mt.connect("form-sent", self.__proxy_emit("form-sent"))
        mt.start()

        return True