Selaa lähdekoodia

Add a warning icon to the capabilities dialog

If the short source capabilities shows a warning icon, surely the long
form dialog should show the same information.
Clara Hobbs 7 vuotta sitten
vanhempi
commit
8ce53a8a8f
2 muutettua tiedostoa jossa 35 lisäystä ja 5 poistoa
  1. 32
    5
      data/src-cap-dialog.ui
  2. 3
    0
      pd-buddy-gtk.py

+ 32
- 5
data/src-cap-dialog.ui Näytä tiedosto

@@ -90,7 +90,7 @@
90 90
                           </packing>
91 91
                         </child>
92 92
                         <child>
93
-                          <object class="GtkLabel" id="power-label">
93
+                          <object class="GtkLabel" id="info-label">
94 94
                             <property name="visible">True</property>
95 95
                             <property name="can_focus">False</property>
96 96
                             <property name="halign">start</property>
@@ -99,20 +99,47 @@
99 99
                           </object>
100 100
                           <packing>
101 101
                             <property name="left_attach">1</property>
102
-                            <property name="top_attach">0</property>
102
+                            <property name="top_attach">1</property>
103 103
                           </packing>
104 104
                         </child>
105 105
                         <child>
106
-                          <object class="GtkLabel" id="info-label">
106
+                          <object class="GtkBox">
107 107
                             <property name="visible">True</property>
108 108
                             <property name="can_focus">False</property>
109 109
                             <property name="halign">start</property>
110 110
                             <property name="valign">start</property>
111
-                            <property name="label" translatable="yes">label</property>
111
+                            <property name="spacing">6</property>
112
+                            <child>
113
+                              <object class="GtkLabel" id="power-label">
114
+                                <property name="visible">True</property>
115
+                                <property name="can_focus">False</property>
116
+                                <property name="halign">start</property>
117
+                                <property name="valign">start</property>
118
+                                <property name="label" translatable="yes">label</property>
119
+                              </object>
120
+                              <packing>
121
+                                <property name="expand">False</property>
122
+                                <property name="fill">True</property>
123
+                                <property name="position">0</property>
124
+                              </packing>
125
+                            </child>
126
+                            <child>
127
+                              <object class="GtkImage" id="source-cap-warning">
128
+                                <property name="can_focus">False</property>
129
+                                <property name="tooltip_text" translatable="yes">Source violates the USB PD Power Rules</property>
130
+                                <property name="halign">start</property>
131
+                                <property name="icon_name">dialog-warning-symbolic</property>
132
+                              </object>
133
+                              <packing>
134
+                                <property name="expand">False</property>
135
+                                <property name="fill">True</property>
136
+                                <property name="position">1</property>
137
+                              </packing>
138
+                            </child>
112 139
                           </object>
113 140
                           <packing>
114 141
                             <property name="left_attach">1</property>
115
-                            <property name="top_attach">1</property>
142
+                            <property name="top_attach">0</property>
116 143
                           </packing>
117 144
                         </child>
118 145
                       </object>

+ 3
- 0
pd-buddy-gtk.py Näytä tiedosto

@@ -443,6 +443,9 @@ class Handler:
443 443
         # Populate PD Power
444 444
         d_power = dialog_builder.get_object("power-label")
445 445
         d_power.set_text("{:g} W".format(pdbuddy.calculate_pdp(caps)))
446
+        # Warning icon
447
+        cap_warning = dialog_builder.get_object("source-cap-warning")
448
+        cap_warning.set_visible(not pdbuddy.follows_power_rules(caps))
446 449
 
447 450
         # Populate Information
448 451
         d_info_header = dialog_builder.get_object("info-header")

Loading…
Peruuta
Tallenna