SHARE
TWEET

rtlsdr-scanner patch for formats in python 2.6

a guest Feb 12th, 2013 88 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --- rtlsdr_scan_old.py  2013-02-12 08:39:40.330888192 -0600
  2. +++ rtlsdr_scan.py      2013-02-12 08:38:25.331047454 -0600
  3. @@ -338,7 +338,7 @@
  4.      def set_cal(self, cal):
  5.          self.cal = cal
  6.          self.enable_controls()
  7. -        self.textResult.SetLabel("Correction (ppm): {:.3f}".format(cal))
  8. +        self.textResult.SetLabel("Correction (ppm): {0:.3f}".format(cal))
  9.  
  10.      def get_cal(self):
  11.          return self.cal
  12. @@ -463,7 +463,7 @@
  13.                             size=(300, 125), style=wx.ICON_EXCLAMATION)
  14.  
  15.          prompt = ["scanning again", "opening a file", "exiting"][warnType]
  16. -        text = wx.StaticText(self, label="Save plot before {}?".format(prompt))
  17. +        text = wx.StaticText(self, label="Save plot before {0}?".format(prompt))
  18.          icon = wx.StaticBitmap(self, wx.ID_ANY,
  19.                                 wx.ArtProvider.GetBitmap(wx.ART_INFORMATION,
  20.                                                          wx.ART_MESSAGE_BOX))
  21. @@ -547,7 +547,7 @@
  22.              if len(spectrum) > 0:
  23.                  xpos = min(spectrum.keys(), key=lambda freq: abs(freq - xpos))
  24.                  ypos = spectrum[xpos]
  25. -                text = "f = {:.3f}MHz, p = {:.2f}dB".format(xpos, ypos)
  26. +                text = "f = {0:.3f}MHz, p = {1:.2f}dB".format(xpos, ypos)
  27.  
  28.          self.main.status.SetStatusText(text, 1)
  29.  
  30. @@ -785,7 +785,7 @@
  31.              handle = open(os.path.join(self.dirname, self.filename), 'wb')
  32.              handle.write("Frequency (MHz),Level (dB)\n")
  33.              for freq, pwr in self.spectrum.iteritems():
  34. -                handle.write("{},{}\n".format(freq, pwr))
  35. +                handle.write("{0},{1}\n".format(freq, pwr))
  36.              handle.close()
  37.              self.status.SetStatusText("Finished", 0)
  38.          dlg.Destroy()
  39. @@ -864,7 +864,7 @@
  40.                  self.auto_cal(CAL_DONE)
  41.          elif status == THREAD_STATUS_ERROR:
  42.              self.statusProgress.Hide()
  43. -            self.status.SetStatusText("Dongle error: {}".format(data), 0)
  44. +            self.status.SetStatusText("Dongle error: {0}".format(data), 0)
  45.              self.thread = None
  46.              self.set_controls(True)
  47.              if self.dlgCal is not None:
  48. @@ -887,7 +887,7 @@
  49.      def open(self, dirname, filename):
  50.          self.filename = filename
  51.          self.dirname = dirname
  52. -        self.status.SetStatusText("Opening: {}".format(filename), 0)
  53. +        self.status.SetStatusText("Opening: {0}".format(filename), 0)
  54.          try:
  55.              handle = open(os.path.join(dirname, filename), 'rb')
  56.              header = cPickle.load(handle)
  57. @@ -969,7 +969,7 @@
  58.              self.status.SetStatusText("", 1)
  59.              self.thread = ThreadScan(self, self.settings, self.devices,
  60.                                       samples, isCal)
  61. -            self.filename = "Scan {:.1f}-{:.1f}MHz".format(self.settings.start,
  62. +            self.filename = "Scan {0:.1f}-{1:.1f}MHz".format(self.settings.start,
  63.                                                              self.settings.stop)
  64.  
  65.              return True
  66. @@ -1012,7 +1012,7 @@
  67.              freqs.sort()
  68.              powers = map(self.spectrum.get, freqs)
  69.              axes.clear()
  70. -            axes.set_title("Frequency Scan\n{} - {} MHz".format(self.settings.start,
  71. +            axes.set_title("Frequency Scan\n{0} - {1} MHz".format(self.settings.start,
  72.                                                                  self.settings.stop))
  73.              axes.set_xlabel("Frequency (MHz)")
  74.              axes.set_ylabel('Level (dB)')
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top