From f6bf5028c084e1c57732ec2374ebaa82881161aa Mon Sep 17 00:00:00 2001 From: markjfine Date: Wed, 31 Mar 2021 10:44:30 -0400 Subject: [PATCH] Cleaned up interface a little 1. Changed ID3 data in Track Info to labels vice entry boxes. 2. Made all labels uniform with titles right-justified and ending with a colon, data labels left-justified. 3. Added a hand cursor to the stream info in the Station Info tab to signify they may be clicked. --- mainForm.glade | 110 +++++++++++++++++++++++++++---------------------- nrsc5-dui.py | 78 +++++++++++++++-------------------- 2 files changed, 94 insertions(+), 94 deletions(-) diff --git a/mainForm.glade b/mainForm.glade index 234eb0c..230afdf 100644 --- a/mainForm.glade +++ b/mainForm.glade @@ -428,7 +428,7 @@ False 5 Name: - 0 + 1 GTK_FILL @@ -455,7 +455,7 @@ False 5 Slogan: - 0 + 1 1 @@ -488,7 +488,7 @@ False 5 Message: - 0 + 1 2 @@ -521,7 +521,7 @@ False 5 Alert: - 0 + 1 3 @@ -554,7 +554,7 @@ False 5 Bit Rate: - 0 + 1 4 @@ -586,7 +586,7 @@ False 5 Streams: - 0 + 1 5 @@ -737,7 +737,7 @@ False 5 Data Svcs: - 0 + 1 7 @@ -899,7 +899,7 @@ False 5 MER: - 0 + 1 10 @@ -944,7 +944,7 @@ False 5 BER: - 0 + 1 11 @@ -1077,8 +1077,8 @@ True False 10 - Gain - 0 + Gain: + 1 GTK_FILL @@ -1130,8 +1130,8 @@ True False 10 - PPM Error - 0 + PPM Error: + 1 1 @@ -1184,8 +1184,8 @@ True False 10 - RTL Device - 0 + RTL Device: + 1 2 @@ -1252,9 +1252,9 @@ True False - 0 + 1 10 - Log to File + Log to File: 3 @@ -1458,8 +1458,8 @@ True False 10 - Title - 0 + Title: + 1 GTK_FILL @@ -1471,8 +1471,8 @@ True False 10 - Artist - 0 + Artist: + 1 1 @@ -1486,8 +1486,8 @@ True False 10 - Album - 0 + Album: + 1 2 @@ -1501,8 +1501,8 @@ True False 10 - Genre - 0 + Genre: + 1 3 @@ -1512,13 +1512,16 @@ - + True - True - False - - False - False + False + + + + + 10 + 10 + 0 1 @@ -1527,13 +1530,16 @@ - + True - True - False - - False - False + False + + + + + 10 + 10 + 0 1 @@ -1544,13 +1550,16 @@ - + True - True - False - - False - False + False + + + + + 10 + 10 + 0 1 @@ -1561,13 +1570,16 @@ - + True - True - False - - False - False + False + + + + + 10 + 10 + 0 1 diff --git a/nrsc5-dui.py b/nrsc5-dui.py index 3ccbdb9..7e6acb6 100644 --- a/nrsc5-dui.py +++ b/nrsc5-dui.py @@ -178,51 +178,24 @@ class NRSC5_DUI(object): 76 : "Special Reading Services" } + self.pointer_cursor = Gdk.Cursor(Gdk.CursorType.LEFT_PTR) + self.hand_cursor = Gdk.Cursor(Gdk.CursorType.HAND2) + # set events on info labels - self.btnAudioPrgs0.set_property("name","btn_prg0") - self.btnAudioPrgs0.set_events(Gdk.EventMask.BUTTON_PRESS_MASK) - self.btnAudioPrgs0.connect("button-press-event", self.on_program_select) - self.btnAudioPrgs1.set_property("name","btn_prg1") - self.btnAudioPrgs1.set_events(Gdk.EventMask.BUTTON_PRESS_MASK) - self.btnAudioPrgs1.connect("button-press-event", self.on_program_select) - self.btnAudioPrgs2.set_property("name","btn_prg2") - self.btnAudioPrgs2.set_events(Gdk.EventMask.BUTTON_PRESS_MASK) - self.btnAudioPrgs2.connect("button-press-event", self.on_program_select) - self.btnAudioPrgs3.set_property("name","btn_prg3") - self.btnAudioPrgs3.set_events(Gdk.EventMask.BUTTON_PRESS_MASK) - self.btnAudioPrgs3.connect("button-press-event", self.on_program_select) - self.lblAudioPrgs0.set_property("name","prg0") - self.lblAudioPrgs0.set_has_window(True) - self.lblAudioPrgs0.set_events(Gdk.EventMask.BUTTON_PRESS_MASK) - self.lblAudioPrgs0.connect("button-press-event", self.on_program_select) - self.lblAudioPrgs1.set_property("name","prg1") - self.lblAudioPrgs1.set_has_window(True) - self.lblAudioPrgs1.set_events(Gdk.EventMask.BUTTON_PRESS_MASK) - self.lblAudioPrgs1.connect("button-press-event", self.on_program_select) - self.lblAudioPrgs2.set_property("name","prg2") - self.lblAudioPrgs2.set_has_window(True) - self.lblAudioPrgs2.set_events(Gdk.EventMask.BUTTON_PRESS_MASK) - self.lblAudioPrgs2.connect("button-press-event", self.on_program_select) - self.lblAudioPrgs3.set_property("name","prg3") - self.lblAudioPrgs3.set_has_window(True) - self.lblAudioPrgs3.set_events(Gdk.EventMask.BUTTON_PRESS_MASK) - self.lblAudioPrgs3.connect("button-press-event", self.on_program_select) - self.lblAudioSvcs0.set_property("name","svc0") - self.lblAudioSvcs0.set_has_window(True) - self.lblAudioSvcs0.set_events(Gdk.EventMask.BUTTON_PRESS_MASK) - self.lblAudioSvcs0.connect("button-press-event", self.on_program_select) - self.lblAudioSvcs1.set_property("name","svc1") - self.lblAudioSvcs1.set_has_window(True) - self.lblAudioSvcs1.set_events(Gdk.EventMask.BUTTON_PRESS_MASK) - self.lblAudioSvcs1.connect("button-press-event", self.on_program_select) - self.lblAudioSvcs2.set_property("name","svc2") - self.lblAudioSvcs2.set_has_window(True) - self.lblAudioSvcs2.set_events(Gdk.EventMask.BUTTON_PRESS_MASK) - self.lblAudioSvcs2.connect("button-press-event", self.on_program_select) - self.lblAudioSvcs3.set_property("name","svc3") - self.lblAudioSvcs3.set_has_window(True) - self.lblAudioSvcs3.set_events(Gdk.EventMask.BUTTON_PRESS_MASK) - self.lblAudioSvcs3.connect("button-press-event", self.on_program_select) + self.set_tuning_actions(self.btnAudioPrgs0, "btn_prg0", False, False) + self.set_tuning_actions(self.btnAudioPrgs1, "btn_prg1", False, False) + self.set_tuning_actions(self.btnAudioPrgs2, "btn_prg2", False, False) + self.set_tuning_actions(self.btnAudioPrgs3, "btn_prg3", False, False) + + self.set_tuning_actions(self.lblAudioPrgs0, "prg0", True, True) + self.set_tuning_actions(self.lblAudioPrgs1, "prg1", True, True) + self.set_tuning_actions(self.lblAudioPrgs2, "prg2", True, True) + self.set_tuning_actions(self.lblAudioPrgs3, "prg3", True, True) + + self.set_tuning_actions(self.lblAudioSvcs0, "svc0", True, True) + self.set_tuning_actions(self.lblAudioSvcs1, "svc1", True, True) + self.set_tuning_actions(self.lblAudioSvcs2, "svc2", True, True) + self.set_tuning_actions(self.lblAudioSvcs3, "svc3", True, True) # setup bookmarks listview nameRenderer = Gtk.CellRendererText() @@ -288,6 +261,20 @@ class NRSC5_DUI(object): # set up pty self.nrsc5master,self.nrsc5slave = pty.openpty() + def set_tuning_actions(self, widget, name, has_win, set_curs): + widget.set_property("name",name) + if has_win: + widget.set_has_window(True) + widget.set_events(Gdk.EventMask.BUTTON_PRESS_MASK) + widget.connect("button-press-event", self.on_program_select) + if set_curs: + widget.add_events(Gdk.EventMask.ENTER_NOTIFY_MASK) + widget.connect("enter-notify-event", self.on_enter_set_cursor) + + def on_enter_set_cursor(self, widget, event): + if (widget.get_label() != ""): + widget.get_window().set_cursor(self.hand_cursor) + def img_to_pixbuf(self,img): """convert PIL.Image to GdkPixbuf.Pixbuf""" data = GLib.Bytes.new(img.tobytes()) @@ -604,7 +591,8 @@ class NRSC5_DUI(object): def on_program_select(self, _label, evt): stream_num = int(_label.get_property("name")[-1]) - self.update_btns = not (_label.get_property("name")[0] == "b") + is_lbl = _label.get_property("name")[0] != "b" + self.update_btns = is_lbl self.streamNum = stream_num self.on_stream_changed()