[chirp_devel] [PATCH 1 of 1] Add import support for Kenwood *.hmk files. Feature #102

Dan Smith
Wed Apr 4 19:13:02 PDT 2012


> +tx_freq = None
> +def set_tx_freq(val):
> +    global tx_freq
> +    tx_freq = chirp_common.parse_freq(val)
> +    return None

This makes it non-reentrant, and we can't have that.

> +            if len(header) > len(line):
> +                print "Line %i has %i columns, expected %i" % (lineno,
> +                                                               len(line),
> +                                                               len(header))
> +                self.errors.append("Column number mismatch on line %i" % lineno)
> +                continue

Right here, do this:

      tx_freq = None
      def set_tx_freq(val):
          tx_freq = chirp_common.parse_freq(val)
          return None
      self.ATTR_MAP["Tx Freq."] = (set_tx_freq, "txfreq")

so that it's in place before we do this:

> +            try:
> +                mem = self._parse_csv_data_line(header, [i.replace(',','.') for i in line])
> +                if mem.duplex == "split":
> +                    mem.offset = tx_freq
> +                if mem.number is None:
> +                    raise Exception("Invalid Location field" % lineno)

Then make sure to avoid modifying the global ATTR_MAP definition:

      def __init__(self, *args):
          self.ATTR_MAP = dict(self.ATTR_MAP)
          generic_csv.CSVRadio.__init__(self, *args)

Sound okay?

-- 
Dan Smith
www.danplanet.com
KK7DS

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: OpenPGP digital signature
Url : http://intrepid.danplanet.com/pipermail/chirp_devel/attachments/20120404/9f9d3150/attachment-0001.bin 


More information about the chirp_devel mailing list