Browse Source

Added a mockup of the Source Capabilities dialog

It's not functional yet, but it opens when the Source Capabilities list
item is clicked on the Sink page.  It looks about right, so that's a
start!
Clara Hobbs 7 years ago
parent
commit
b29c0fac60
2 changed files with 357 additions and 8 deletions
  1. 347
    0
      data/src-cap-dialog.ui
  2. 10
    8
      pd-buddy-gtk.py

+ 347
- 0
data/src-cap-dialog.ui View File

@@ -0,0 +1,347 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!-- Generated with glade 3.20.0 -->
3
+<interface>
4
+  <requires lib="gtk+" version="3.20"/>
5
+  <object class="GtkDialog" id="src-cap-dialog">
6
+    <property name="can_focus">False</property>
7
+    <property name="title" translatable="yes">Source Capabilities</property>
8
+    <property name="modal">True</property>
9
+    <property name="type_hint">dialog</property>
10
+    <child internal-child="vbox">
11
+      <object class="GtkBox">
12
+        <property name="can_focus">False</property>
13
+        <property name="orientation">vertical</property>
14
+        <child internal-child="action_area">
15
+          <object class="GtkButtonBox">
16
+            <property name="can_focus">False</property>
17
+            <property name="layout_style">end</property>
18
+            <child>
19
+              <placeholder/>
20
+            </child>
21
+            <child>
22
+              <placeholder/>
23
+            </child>
24
+          </object>
25
+          <packing>
26
+            <property name="expand">False</property>
27
+            <property name="fill">False</property>
28
+            <property name="position">0</property>
29
+          </packing>
30
+        </child>
31
+        <child>
32
+          <object class="GtkScrolledWindow">
33
+            <property name="visible">True</property>
34
+            <property name="can_focus">True</property>
35
+            <property name="hscrollbar_policy">never</property>
36
+            <property name="min_content_height">250</property>
37
+            <property name="propagate_natural_width">True</property>
38
+            <child>
39
+              <object class="GtkViewport">
40
+                <property name="visible">True</property>
41
+                <property name="can_focus">False</property>
42
+                <child>
43
+                  <object class="GtkBox">
44
+                    <property name="visible">True</property>
45
+                    <property name="can_focus">False</property>
46
+                    <property name="valign">start</property>
47
+                    <property name="margin_left">50</property>
48
+                    <property name="margin_right">50</property>
49
+                    <property name="margin_top">22</property>
50
+                    <property name="margin_bottom">22</property>
51
+                    <property name="hexpand">True</property>
52
+                    <property name="vexpand">False</property>
53
+                    <property name="orientation">vertical</property>
54
+                    <property name="spacing">18</property>
55
+                    <child>
56
+                      <object class="GtkGrid">
57
+                        <property name="visible">True</property>
58
+                        <property name="can_focus">False</property>
59
+                        <property name="halign">center</property>
60
+                        <property name="row_spacing">6</property>
61
+                        <property name="column_spacing">12</property>
62
+                        <child>
63
+                          <object class="GtkLabel">
64
+                            <property name="visible">True</property>
65
+                            <property name="can_focus">False</property>
66
+                            <property name="halign">end</property>
67
+                            <property name="label" translatable="yes">PDO Power</property>
68
+                            <style>
69
+                              <class name="dim-label"/>
70
+                            </style>
71
+                          </object>
72
+                          <packing>
73
+                            <property name="left_attach">0</property>
74
+                            <property name="top_attach">0</property>
75
+                          </packing>
76
+                        </child>
77
+                        <child>
78
+                          <object class="GtkLabel">
79
+                            <property name="visible">True</property>
80
+                            <property name="can_focus">False</property>
81
+                            <property name="halign">end</property>
82
+                            <property name="valign">start</property>
83
+                            <property name="label" translatable="yes">Information</property>
84
+                            <style>
85
+                              <class name="dim-label"/>
86
+                            </style>
87
+                          </object>
88
+                          <packing>
89
+                            <property name="left_attach">0</property>
90
+                            <property name="top_attach">1</property>
91
+                          </packing>
92
+                        </child>
93
+                        <child>
94
+                          <object class="GtkLabel" id="power-label">
95
+                            <property name="visible">True</property>
96
+                            <property name="can_focus">False</property>
97
+                            <property name="halign">start</property>
98
+                            <property name="valign">center</property>
99
+                            <property name="label" translatable="yes">label</property>
100
+                          </object>
101
+                          <packing>
102
+                            <property name="left_attach">1</property>
103
+                            <property name="top_attach">0</property>
104
+                          </packing>
105
+                        </child>
106
+                        <child>
107
+                          <object class="GtkLabel" id="info-label">
108
+                            <property name="visible">True</property>
109
+                            <property name="can_focus">False</property>
110
+                            <property name="label" translatable="yes">label
111
+test
112
+asdf</property>
113
+                          </object>
114
+                          <packing>
115
+                            <property name="left_attach">1</property>
116
+                            <property name="top_attach">1</property>
117
+                          </packing>
118
+                        </child>
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="GtkFrame">
128
+                        <property name="visible">True</property>
129
+                        <property name="can_focus">False</property>
130
+                        <property name="label_xalign">0</property>
131
+                        <property name="shadow_type">in</property>
132
+                        <child>
133
+                          <object class="GtkAlignment">
134
+                            <property name="visible">True</property>
135
+                            <property name="can_focus">False</property>
136
+                            <child>
137
+                              <object class="GtkListBox" id="src-cap-list">
138
+                                <property name="width_request">300</property>
139
+                                <property name="visible">True</property>
140
+                                <property name="can_focus">False</property>
141
+                                <property name="selection_mode">none</property>
142
+                                <property name="activate_on_single_click">False</property>
143
+                                <child>
144
+                                  <object class="GtkListBoxRow">
145
+                                    <property name="visible">True</property>
146
+                                    <property name="can_focus">False</property>
147
+                                    <property name="activatable">False</property>
148
+                                    <property name="selectable">False</property>
149
+                                    <child>
150
+                                      <object class="GtkBox">
151
+                                        <property name="visible">True</property>
152
+                                        <property name="can_focus">False</property>
153
+                                        <property name="margin_left">12</property>
154
+                                        <property name="margin_right">12</property>
155
+                                        <property name="margin_top">6</property>
156
+                                        <property name="margin_bottom">6</property>
157
+                                        <property name="spacing">12</property>
158
+                                        <property name="homogeneous">True</property>
159
+                                        <child>
160
+                                          <object class="GtkLabel" id="pdo-type">
161
+                                            <property name="visible">True</property>
162
+                                            <property name="can_focus">False</property>
163
+                                            <property name="halign">start</property>
164
+                                            <property name="label" translatable="yes">Fixed</property>
165
+                                          </object>
166
+                                          <packing>
167
+                                            <property name="expand">True</property>
168
+                                            <property name="fill">True</property>
169
+                                            <property name="position">0</property>
170
+                                          </packing>
171
+                                        </child>
172
+                                        <child>
173
+                                          <object class="GtkLabel" id="pdo-center">
174
+                                            <property name="visible">True</property>
175
+                                            <property name="can_focus">False</property>
176
+                                            <property name="halign">end</property>
177
+                                            <property name="label" translatable="yes">5 V</property>
178
+                                          </object>
179
+                                          <packing>
180
+                                            <property name="expand">True</property>
181
+                                            <property name="fill">True</property>
182
+                                            <property name="position">1</property>
183
+                                          </packing>
184
+                                        </child>
185
+                                        <child>
186
+                                          <object class="GtkBox">
187
+                                            <property name="visible">True</property>
188
+                                            <property name="can_focus">False</property>
189
+                                            <property name="halign">end</property>
190
+                                            <property name="spacing">6</property>
191
+                                            <child>
192
+                                              <object class="GtkLabel" id="pdo-right">
193
+                                                <property name="visible">True</property>
194
+                                                <property name="can_focus">False</property>
195
+                                                <property name="label" translatable="yes">3 A</property>
196
+                                              </object>
197
+                                              <packing>
198
+                                                <property name="expand">False</property>
199
+                                                <property name="fill">True</property>
200
+                                                <property name="pack_type">end</property>
201
+                                                <property name="position">0</property>
202
+                                              </packing>
203
+                                            </child>
204
+                                            <child>
205
+                                              <object class="GtkImage" id="pdo-icon">
206
+                                                <property name="visible">True</property>
207
+                                                <property name="can_focus">False</property>
208
+                                                <property name="tooltip_text" translatable="yes">Something something peak current
209
+another line about peak current</property>
210
+                                                <property name="icon_name">dialog-information-symbolic</property>
211
+                                              </object>
212
+                                              <packing>
213
+                                                <property name="expand">False</property>
214
+                                                <property name="fill">True</property>
215
+                                                <property name="pack_type">end</property>
216
+                                                <property name="position">1</property>
217
+                                              </packing>
218
+                                            </child>
219
+                                          </object>
220
+                                          <packing>
221
+                                            <property name="expand">True</property>
222
+                                            <property name="fill">True</property>
223
+                                            <property name="pack_type">end</property>
224
+                                            <property name="position">2</property>
225
+                                          </packing>
226
+                                        </child>
227
+                                      </object>
228
+                                    </child>
229
+                                  </object>
230
+                                </child>
231
+                                <child>
232
+                                  <object class="GtkListBoxRow">
233
+                                    <property name="visible">True</property>
234
+                                    <property name="can_focus">False</property>
235
+                                    <property name="activatable">False</property>
236
+                                    <property name="selectable">False</property>
237
+                                    <child>
238
+                                      <object class="GtkBox">
239
+                                        <property name="visible">True</property>
240
+                                        <property name="can_focus">False</property>
241
+                                        <property name="margin_left">12</property>
242
+                                        <property name="margin_right">12</property>
243
+                                        <property name="margin_top">6</property>
244
+                                        <property name="margin_bottom">6</property>
245
+                                        <property name="spacing">12</property>
246
+                                        <property name="homogeneous">True</property>
247
+                                        <child>
248
+                                          <object class="GtkLabel" id="pdo-type1">
249
+                                            <property name="visible">True</property>
250
+                                            <property name="can_focus">False</property>
251
+                                            <property name="halign">start</property>
252
+                                            <property name="label" translatable="yes">Battery</property>
253
+                                          </object>
254
+                                          <packing>
255
+                                            <property name="expand">True</property>
256
+                                            <property name="fill">True</property>
257
+                                            <property name="position">0</property>
258
+                                          </packing>
259
+                                        </child>
260
+                                        <child>
261
+                                          <object class="GtkLabel" id="pdo-center1">
262
+                                            <property name="visible">True</property>
263
+                                            <property name="can_focus">False</property>
264
+                                            <property name="halign">end</property>
265
+                                            <property name="label" translatable="yes">6–8.4 V</property>
266
+                                          </object>
267
+                                          <packing>
268
+                                            <property name="expand">True</property>
269
+                                            <property name="fill">True</property>
270
+                                            <property name="position">1</property>
271
+                                          </packing>
272
+                                        </child>
273
+                                        <child>
274
+                                          <object class="GtkBox">
275
+                                            <property name="visible">True</property>
276
+                                            <property name="can_focus">False</property>
277
+                                            <property name="halign">end</property>
278
+                                            <property name="spacing">6</property>
279
+                                            <child>
280
+                                              <object class="GtkLabel" id="pdo-right1">
281
+                                                <property name="visible">True</property>
282
+                                                <property name="can_focus">False</property>
283
+                                                <property name="label" translatable="yes">18 W</property>
284
+                                              </object>
285
+                                              <packing>
286
+                                                <property name="expand">False</property>
287
+                                                <property name="fill">True</property>
288
+                                                <property name="pack_type">end</property>
289
+                                                <property name="position">0</property>
290
+                                              </packing>
291
+                                            </child>
292
+                                            <child>
293
+                                              <object class="GtkImage" id="pdo-icon1">
294
+                                                <property name="can_focus">False</property>
295
+                                                <property name="icon_name">dialog-information-symbolic</property>
296
+                                              </object>
297
+                                              <packing>
298
+                                                <property name="expand">False</property>
299
+                                                <property name="fill">True</property>
300
+                                                <property name="pack_type">end</property>
301
+                                                <property name="position">1</property>
302
+                                              </packing>
303
+                                            </child>
304
+                                          </object>
305
+                                          <packing>
306
+                                            <property name="expand">True</property>
307
+                                            <property name="fill">True</property>
308
+                                            <property name="pack_type">end</property>
309
+                                            <property name="position">2</property>
310
+                                          </packing>
311
+                                        </child>
312
+                                      </object>
313
+                                    </child>
314
+                                  </object>
315
+                                </child>
316
+                              </object>
317
+                            </child>
318
+                          </object>
319
+                        </child>
320
+                        <child type="label_item">
321
+                          <placeholder/>
322
+                        </child>
323
+                      </object>
324
+                      <packing>
325
+                        <property name="expand">False</property>
326
+                        <property name="fill">False</property>
327
+                        <property name="position">1</property>
328
+                      </packing>
329
+                    </child>
330
+                  </object>
331
+                </child>
332
+              </object>
333
+            </child>
334
+          </object>
335
+          <packing>
336
+            <property name="expand">True</property>
337
+            <property name="fill">True</property>
338
+            <property name="position">1</property>
339
+          </packing>
340
+        </child>
341
+      </object>
342
+    </child>
343
+    <child>
344
+      <placeholder/>
345
+    </child>
346
+  </object>
347
+</interface>

+ 10
- 8
pd-buddy-gtk.py View File

@@ -351,12 +351,15 @@ class Handler:
351 351
                 s = "No Source_Capabilities"
352 352
             flags = Gtk.DialogFlags.DESTROY_WITH_PARENT;
353 353
             window = self.builder.get_object("pdb-window")
354
-            dialog = Gtk.MessageDialog(window,
355
-                             flags,
356
-                             Gtk.MessageType.INFO,
357
-                             Gtk.ButtonsType.CLOSE,
358
-                             None)
359
-            dialog.set_markup("<span font_family='monospace'>{}</span>".format(s))
354
+            dialog_builder = Gtk.Builder.new_from_file("data/src-cap-dialog.ui")
355
+            dialog = dialog_builder.get_object("src-cap-dialog")
356
+            dialog.set_transient_for(window)
357
+            #dialog = Gtk.MessageDialog(window,
358
+            #                 flags,
359
+            #                 Gtk.MessageType.INFO,
360
+            #                 Gtk.ButtonsType.CLOSE,
361
+            #                 None)
362
+            #dialog.set_markup("<span font_family='monospace'>{}</span>".format(s))
360 363
             dialog.run()
361 364
             dialog.destroy()
362 365
 
@@ -371,8 +374,7 @@ class Application(Gtk.Application):
371 374
     def do_startup(self):
372 375
         Gtk.Application.do_startup(self)
373 376
 
374
-        self.builder = Gtk.Builder()
375
-        self.builder.add_from_file("data/pd-buddy-gtk.ui")
377
+        self.builder = Gtk.Builder.new_from_file("data/pd-buddy-gtk.ui")
376 378
         self.builder.connect_signals(Handler(self.builder))
377 379
 
378 380
     def do_activate(self):

Loading…
Cancel
Save