From edf0b93b97aa5769f7ce8876b69f7aadd01474b9 Mon Sep 17 00:00:00 2001 From: "Mark J. Fine" Date: Wed, 7 Dec 2022 11:07:37 -0500 Subject: [PATCH] interface cleanup, fixed int bug in gain setting, updated LANCZOS to Resampling.LANCZOS --- nrsc5-dui.py | 22 ++--- res/mainForm.glade | 210 ++++++++++++++++++++++++++++++++++----------- 2 files changed, 173 insertions(+), 59 deletions(-) diff --git a/nrsc5-dui.py b/nrsc5-dui.py index 13fadbb..cdd58ba 100644 --- a/nrsc5-dui.py +++ b/nrsc5-dui.py @@ -322,13 +322,13 @@ class NRSC5_DUI(object): if (self.mapData["mapMode"] == 0): map_file = os.path.join(mapDir, "TrafficMap.png") if os.path.isfile(map_file): - map_img = Image.open(map_file).resize((img_size, img_size), Image.LANCZOS) + map_img = Image.open(map_file).resize((img_size, img_size), Image.Resampling.LANCZOS) self.imgMap.set_from_pixbuf(self.img_to_pixbuf(map_img)) else: self.imgMap.set_from_icon_name("MISSING_IMAGE", Gtk.IconSize.DIALOG) elif (self.mapData["mapMode"] == 1): if os.path.isfile(self.mapData["weatherNow"]): - map_img = Image.open(self.mapData["weatherNow"]).resize((img_size, img_size), Image.LANCZOS) + map_img = Image.open(self.mapData["weatherNow"]).resize((img_size, img_size), Image.Resampling.LANCZOS) self.imgMap.set_from_pixbuf(self.img_to_pixbuf(map_img)) else: self.imgMap.set_from_icon_name("MISSING_IMAGE", Gtk.IconSize.DIALOG) @@ -579,7 +579,7 @@ class NRSC5_DUI(object): if (not self.cbAutoGain.get_active()): self.streamInfo["Gain"] = self.spinGain.get_value() self.nrsc5Args.append("-g") - self.nrsc5Args.append(str(int(self.streamInfo["Gain"]))) + self.nrsc5Args.append(str(self.streamInfo["Gain"])) # set ppm error if not zero if (self.spinPPM.get_value() != 0): @@ -883,7 +883,7 @@ class NRSC5_DUI(object): self.mapData["mapMode"] = 0 mapFile = os.path.join(mapDir, "TrafficMap.png") if (os.path.isfile(mapFile)): # check if map exists - mapImg = Image.open(mapFile).resize((img_size, img_size), Image.LANCZOS) # scale map to fit window + mapImg = Image.open(mapFile).resize((img_size, img_size), Image.Resampling.LANCZOS) # scale map to fit window self.imgMap.set_from_pixbuf(imgToPixbuf(mapImg)) # convert image to pixbuf and display else: self.imgMap.set_from_icon_name("MISSING_IMAGE", Gtk.IconSize.DIALOG) # display missing image if file is not found @@ -891,7 +891,7 @@ class NRSC5_DUI(object): elif (btn == self.radMapWeather): self.mapData["mapMode"] = 1 if (os.path.isfile(self.mapData["weatherNow"])): - mapImg = Image.open(self.mapData["weatherNow"]).resize((img_size, img_size), Image.LANCZOS) # scale map to fit window + mapImg = Image.open(self.mapData["weatherNow"]).resize((img_size, img_size), Image.Resampling.LANCZOS) # scale map to fit window self.imgMap.set_from_pixbuf(imgToPixbuf(mapImg)) # convert image to pixbuf and display else: self.imgMap.set_from_icon_name("MISSING_IMAGE", Gtk.IconSize.DIALOG) # display missing image if file is not found @@ -1147,7 +1147,7 @@ class NRSC5_DUI(object): imgBig = (981,981) # size of a weather map posTS = (imgBig[0]-235, imgBig[1]-29) # calculate position to put timestamp (bottom right) imgTS = self.mkTimestamp(t, imgBig, posTS) # create timestamp for a weather map - imgTS = imgTS.resize((imgMap.size[0], imgMap.size[1]), Image.LANCZOS) # resize it so it's proportional to the size of a traffic map (981 -> 600) + imgTS = imgTS.resize((imgMap.size[0], imgMap.size[1]), Image.Resampling.LANCZOS) # resize it so it's proportional to the size of a traffic map (981 -> 600) imgMap = Image.alpha_composite(imgMap, imgTS) # overlay timestamp on traffic map imgMap.save(os.path.join(mapDir, "TrafficMap.png")) # save traffic map @@ -1155,7 +1155,7 @@ class NRSC5_DUI(object): # display on map page if (self.radMapTraffic.get_active()): img_size = min(self.alignmentMap.get_allocated_height(), self.alignmentMap.get_allocated_width()) - 12 - imgMap = imgMap.resize((img_size, img_size), Image.LANCZOS) # scale map to fit window + imgMap = imgMap.resize((img_size, img_size), Image.Resampling.LANCZOS) # scale map to fit window self.imgMap.set_from_pixbuf(imgToPixbuf(imgMap)) # convert image to pixbuf and display if (self.mapViewer is not None): self.mapViewer.updated(0) # notify map viwerer if it's open @@ -1210,7 +1210,7 @@ class NRSC5_DUI(object): posTS = (imgMap.size[0]-235, imgMap.size[1]-29) # calculate position to put timestamp (bottom right) imgTS = self.mkTimestamp(t, imgMap.size, posTS) # create timestamp imgRadar = Image.open(wxOlPath).convert("RGBA") # open radar overlay - imgRadar = imgRadar.resize(imgMap.size, Image.LANCZOS) # resize radar overlay to fit the map + imgRadar = imgRadar.resize(imgMap.size, Image.Resampling.LANCZOS) # resize radar overlay to fit the map imgMap = Image.alpha_composite(imgMap, imgRadar) # overlay radar image on map imgMap = Image.alpha_composite(imgMap, imgTS) # overlay timestamp imgMap.save(wxMapPath) # save weather map @@ -1220,7 +1220,7 @@ class NRSC5_DUI(object): # display on map page if (self.radMapWeather.get_active()): img_size = min(self.alignmentMap.get_allocated_height(), self.alignmentMap.get_allocated_width()) - 12 - imgMap = imgMap.resize((img_size, img_size), Image.LANCZOS) # scale map to fit window + imgMap = imgMap.resize((img_size, img_size), Image.Resampling.LANCZOS) # scale map to fit window self.imgMap.set_from_pixbuf(imgToPixbuf(imgMap)) # convert image to pixbuf and display self.proccessWeatherMaps() # get rid of old maps and add new ones to the list @@ -2025,7 +2025,7 @@ class NRSC5_Map(object): self.animateBusy = True # set busy to true if (self.config["scale"]): - mapImg = imgToPixbuf(Image.open(fileName).resize((600,600), Image.LANCZOS)) # open weather map, resize to 600x600, and convert to pixbuf + mapImg = imgToPixbuf(Image.open(fileName).resize((600,600), Image.Resampling.LANCZOS)) # open weather map, resize to 600x600, and convert to pixbuf else: mapImg = imgToPixbuf(Image.open(fileName)) # open weather map and convert to pixbuf @@ -2050,7 +2050,7 @@ class NRSC5_Map(object): def showImage(self, fileName, scale): if (os.path.isfile(fileName)): if (scale): - mapImg = Image.open(fileName).resize((600,600), Image.LANCZOS) # open and scale map to fit window + mapImg = Image.open(fileName).resize((600,600), Image.Resampling.LANCZOS) # open and scale map to fit window else: mapImg = Image.open(fileName) # open map diff --git a/res/mainForm.glade b/res/mainForm.glade index c000817..f7463da 100644 --- a/res/mainForm.glade +++ b/res/mainForm.glade @@ -1,17 +1,17 @@ - + - 88.099999999999994 - 107.90000000000001 - 88.099999999999994 - 0.20000000000000001 + 88.10 + 107.90 + 88.10 + 0.20 1 - 49.600000000000001 - 0.10000000000000001 + 49.60 + 0.10 1 @@ -25,7 +25,7 @@ 1 16 - + 1 4 1 @@ -196,6 +196,8 @@ False 10 Frequency + center + True 0 @@ -232,6 +234,7 @@ True False 10 + True 0 @@ -259,16 +262,16 @@ True False - True 4 1 3 + True True True + False True - False True @@ -287,8 +290,8 @@ True True + False True - False True @@ -307,8 +310,8 @@ True True + False True - False True @@ -327,8 +330,8 @@ True True + False True - False True @@ -377,8 +380,8 @@ GTK_ALIGN_FILL - - + + True @@ -394,6 +397,7 @@ True False Album Art + center False @@ -425,6 +429,8 @@ False 5 Name: + right + True 1 @@ -438,6 +444,7 @@ False 5 5 + True 0 @@ -452,6 +459,8 @@ False 5 Slogan: + right + True 1 @@ -468,6 +477,7 @@ 5 5 end + True 0 @@ -485,6 +495,8 @@ False 5 Message: + right + True 1 @@ -501,6 +513,7 @@ 5 5 end + True 0 @@ -518,6 +531,8 @@ False 5 Alert: + right + True 1 @@ -534,6 +549,7 @@ 5 5 end + True 0 @@ -551,6 +567,8 @@ False 5 Bit Rate: + right + True 1 @@ -567,6 +585,7 @@ Audio Bit Rate 5 5 + True 0 @@ -583,6 +602,8 @@ False 5 Streams: + right + True 1 @@ -599,6 +620,7 @@ 5 5 end + True 0 @@ -616,6 +638,7 @@ 5 5 end + True 0 @@ -633,6 +656,7 @@ 5 5 end + True 0 @@ -650,6 +674,7 @@ 5 5 end + True 0 @@ -667,6 +692,7 @@ 5 5 end + True 0 @@ -684,6 +710,7 @@ 5 5 end + True 0 @@ -701,6 +728,7 @@ 5 5 end + True 0 @@ -718,6 +746,7 @@ 5 5 end + True 0 @@ -734,6 +763,8 @@ False 5 Data Svcs: + right + True 1 @@ -750,6 +781,7 @@ 5 5 end + True 0 @@ -767,6 +799,7 @@ 5 5 end + True 0 @@ -784,6 +817,7 @@ 5 5 end + True 0 @@ -801,6 +835,7 @@ 5 5 end + True 0 @@ -818,6 +853,7 @@ 5 5 end + True 0 @@ -835,6 +871,7 @@ 5 5 end + True 0 @@ -852,6 +889,7 @@ 5 5 end + True 0 @@ -869,6 +907,7 @@ 5 5 end + True 0 @@ -896,6 +935,8 @@ False 5 MER: + right + True 1 @@ -911,6 +952,7 @@ False Modulation Error Ratio (Lower) 5 + True 1 @@ -926,6 +968,7 @@ False Modulation Error Ratio (Upper) 5 + True 3 @@ -941,6 +984,8 @@ False 5 BER: + right + True 1 @@ -956,6 +1001,7 @@ False Bit Error Rate 5 + True 1 @@ -971,6 +1017,7 @@ False Bit Error Rate (Average) 5 + True 3 @@ -986,6 +1033,7 @@ False Bit Error Rate (Minimum) 5 + True 1 @@ -1001,6 +1049,7 @@ False Bit Error Rate (Maximum) 5 + True 3 @@ -1020,6 +1069,7 @@ False <b>Station Info</b> True + True @@ -1032,6 +1082,8 @@ True False Info + center + True 1 @@ -1075,6 +1127,8 @@ False 10 Gain: + right + True 1 @@ -1128,6 +1182,8 @@ False 10 PPM Error: + right + True 1 @@ -1165,6 +1221,7 @@ False 10 PPM + True 0 @@ -1182,6 +1239,8 @@ False 10 RTL Device: + right + True 1 @@ -1213,13 +1272,29 @@ GTK_FILL - + + True + False + True + + + 2 + 3 + 2 + 3 + GTK_FILL + GTK_FILL + + + True False 10 RTL_TCP IP: + right + True 1 @@ -1234,6 +1309,7 @@ True True RTL-TCP listening address + 16 16 @@ -1253,7 +1329,6 @@ True False Use rtl_tcp - False True @@ -1265,15 +1340,16 @@ GTK_FILL - True + False False 10 - SDRPlay #: + SDRPlay Ser#: + right + True 1 - False 4 @@ -1285,10 +1361,11 @@ True + False False SDRPlay Serial Number - 16 - False + 10 + 10 1 @@ -1307,7 +1384,6 @@ True False Use SDRPlay - False True @@ -1320,15 +1396,16 @@ GTK_FILL - True + False False - 1 10 SDRPlay Ant: - False + right + True + 1 5 @@ -1340,10 +1417,11 @@ True + False False SDRPlay antenna + 1 1 - False 1 @@ -1358,6 +1436,7 @@ True False + True 2 @@ -1368,14 +1447,15 @@ GTK_FILL - True False - 1 10 Log to File: + right + True + 1 6 @@ -1387,11 +1467,11 @@ Enable + False True True False Enable Logging of NRSC5 to Disk - False True @@ -1406,6 +1486,7 @@ True False + True 2 @@ -1420,9 +1501,11 @@ True False - 1 10 Download Album Art: + right + True + 1 7 @@ -1434,11 +1517,11 @@ Enable + False True True False Enable Automated Downloading of Album Art - False True @@ -1454,6 +1537,7 @@ True False + True 2 @@ -1467,11 +1551,13 @@ True + False False - 1 10 Include Station Art: - False + right + True + 1 8 @@ -1483,13 +1569,13 @@ Enable + False True + False True False Include Station-Generated Album Art - False True - False 1 @@ -1503,6 +1589,7 @@ True False + True 2 @@ -1516,11 +1603,13 @@ True + False False - 1 10 Extended Queries: - False + right + True + 1 9 @@ -1532,14 +1621,13 @@ Enable + False True + False True False Use Extended MusicBrainz Queries (may be slow) - False True - False - False 1 @@ -1553,6 +1641,7 @@ True False + True 2 @@ -1573,6 +1662,7 @@ False <b>Settings</b> True + True @@ -1585,6 +1675,8 @@ True False Settings + center + True 2 @@ -1615,6 +1707,7 @@ True False Bookmarks + center 3 @@ -1706,6 +1799,7 @@ False <b>Traffic &amp; Weather Maps</b> True + True @@ -1718,6 +1812,8 @@ True False Maps + center + True 4 @@ -1757,6 +1853,8 @@ False 10 Title: + right + True 1 @@ -1770,6 +1868,8 @@ False 10 Artist: + right + True 1 @@ -1785,6 +1885,8 @@ False 10 Album: + right + True 1 @@ -1800,6 +1902,8 @@ False 10 Genre: + right + True 1 @@ -1815,8 +1919,9 @@ False 10 10 - 0 end + True + 0 1 @@ -1830,8 +1935,9 @@ False 10 10 - 0 end + True + 0 1 @@ -1847,8 +1953,9 @@ False 10 10 - 0 end + True + 0 1 @@ -1864,8 +1971,9 @@ False 10 10 - 0 end + True + 0 1 @@ -1885,6 +1993,7 @@ False <b>Track Info</b> True + True @@ -1907,24 +2016,24 @@ True False - GTK_ALIGN_START Synchronization + GTK_ALIGN_START False False - GTK_ALIGN_START Synchronization + GTK_ALIGN_START False False - GTK_ALIGN_START Device failure + GTK_ALIGN_START @@ -1939,6 +2048,7 @@ False Current Bitrate 8 + True 1 @@ -1952,7 +2062,9 @@ True False Current Error Rate + right 9 + True 1 @@ -1967,7 +2079,9 @@ True False Automatic Gain + center 8 + True 2