Browse Source

Update for pd-buddy-python 0.5.0

With the new API changes in pd-buddy-python 0.5.0, a few fixes were
necessary to make the GUI work without errors again.  Among these were
creating a SinkConfig object with the new attributes, and adding list
rows for PPS APDOs.  Coming up next: voltage range support!
Clara Hobbs 6 years ago
parent
commit
6f1d180bea
2 changed files with 12 additions and 5 deletions
  1. 1
    1
      README.md
  2. 11
    4
      pd-buddy-gtk.py

+ 1
- 1
README.md View File

10
 * GTK+ 3.22
10
 * GTK+ 3.22
11
 * Python 3.6
11
 * Python 3.6
12
 * python-gobject 3.22
12
 * python-gobject 3.22
13
-* pd-buddy-python 0.4.2
13
+* pd-buddy-python 0.5.0
14
 
14
 
15
 ## Usage
15
 ## Usage
16
 
16
 

+ 11
- 4
pd-buddy-gtk.py View File

196
         # Type label
196
         # Type label
197
         if model.pdo.pdo_type == "fixed":
197
         if model.pdo.pdo_type == "fixed":
198
             type_text = "Fixed"
198
             type_text = "Fixed"
199
+        elif model.pdo.pdo_type == "pps":
200
+            type_text = "Programmable"
199
         elif model.pdo.pdo_type == "unknown":
201
         elif model.pdo.pdo_type == "unknown":
200
             type_text = "Unknown"
202
             type_text = "Unknown"
201
         elif model.pdo.pdo_type == "typec_virtual":
203
         elif model.pdo.pdo_type == "typec_virtual":
205
         box.pack_start(type_label, True, True, 0)
207
         box.pack_start(type_label, True, True, 0)
206
 
208
 
207
         # Voltage label
209
         # Voltage label
208
-        if (model.pdo.pdo_type != "unknown"
209
-                and model.pdo.pdo_type != "typec_virtual"):
210
+        if model.pdo.pdo_type == "fixed":
210
             voltage_label = Gtk.Label("{:g} V".format(model.pdo.v / 1000.0))
211
             voltage_label = Gtk.Label("{:g} V".format(model.pdo.v / 1000.0))
211
             voltage_label.set_halign(Gtk.Align.END)
212
             voltage_label.set_halign(Gtk.Align.END)
212
             box.pack_start(voltage_label, True, True, 0)
213
             box.pack_start(voltage_label, True, True, 0)
214
+        elif model.pdo.pdo_type == "pps":
215
+            voltage_label = Gtk.Label("{:g}\u2013{:g} V".format(
216
+                    model.pdo.vmin / 1000.0, model.pdo.vmax / 1000.0))
217
+            voltage_label.set_halign(Gtk.Align.END)
218
+            box.pack_start(voltage_label, True, True, 0)
213
 
219
 
214
         # Right box
220
         # Right box
215
         right_box = Gtk.Box(Gtk.Orientation.HORIZONTAL, 6)
221
         right_box = Gtk.Box(Gtk.Orientation.HORIZONTAL, 6)
229
                             PDOListRow.oc_tooltips[model.pdo.peak_i])
235
                             PDOListRow.oc_tooltips[model.pdo.peak_i])
230
                     right_box.pack_end(oc_image, True, False, 0)
236
                     right_box.pack_end(oc_image, True, False, 0)
231
             except AttributeError:
237
             except AttributeError:
232
-                # If this is a typec_virtual PDO, there's no peak_i attribute.
238
+                # If this isn't a fixed PDO, there's no peak_i attribute.
233
                 # Not a problem, so just ignore the error.
239
                 # Not a problem, so just ignore the error.
234
                 pass
240
                 pass
235
         else:
241
         else:
300
                     # do want to display no configuration though
306
                     # do want to display no configuration though
301
                     self.cfg = pdbuddy.SinkConfig(
307
                     self.cfg = pdbuddy.SinkConfig(
302
                             status=pdbuddy.SinkStatus.VALID,
308
                             status=pdbuddy.SinkStatus.VALID,
303
-                            flags=pdbuddy.SinkFlags.NONE, v=0, i=0)
309
+                            flags=pdbuddy.SinkFlags.NONE, v=0, vmin=0, vmax=0,
310
+                            i=0, idim=pdbuddy.SinkDimension.CURRENT)
304
                 else:
311
                 else:
305
                     self.cfg = pdbs.get_tmpcfg()
312
                     self.cfg = pdbs.get_tmpcfg()
306
         except OSError as e:
313
         except OSError as e:

Loading…
Cancel
Save