Browse Source

Add separators to the device list

Clara Hobbs 7 years ago
parent
commit
063a4cf924
1 changed files with 15 additions and 0 deletions
  1. 15
    0
      pd-buddy-gtk.py

+ 15
- 0
pd-buddy-gtk.py View File

@@ -65,6 +65,21 @@ class Handler:
65 65
             ss.set_visible_child(sf)
66 66
             sl.insert(SelectListRow(serport), -1)
67 67
 
68
+        def update_header_func(row, before, data):
69
+            """Add a separator header to all rows but the first one"""
70
+            if before is None:
71
+                row.set_header(None)
72
+                return
73
+
74
+            current = row.get_header()
75
+            if current is None:
76
+                current = Gtk.Separator.new(Gtk.Orientation.HORIZONTAL)
77
+                current.show()
78
+                row.set_header(current)
79
+
80
+        # Add separators to the list
81
+        sl.set_header_func(update_header_func, None)
82
+
68 83
     def on_pdb_window_delete_event(self, *args):
69 84
         Gtk.main_quit(*args)
70 85
 

Loading…
Cancel
Save