Stefan Schuermans commited on 2013-11-14 20:34:28
Showing 3 changed files, with 333 additions and 0 deletions.
| ... | ... |
@@ -0,0 +1,270 @@ |
| 1 |
+<?xml version="1.0" encoding="UTF-8"?> |
|
| 2 |
+<interface> |
|
| 3 |
+ <!-- interface-requires gtk+ 3.0 --> |
|
| 4 |
+ <object class="GtkWindow" id="MainWindow"> |
|
| 5 |
+ <property name="visible">True</property> |
|
| 6 |
+ <property name="can_focus">False</property> |
|
| 7 |
+ <property name="title" translatable="yes">BlinkenArea Sync GUI</property> |
|
| 8 |
+ <signal name="destroy" handler="onDestroy" swapped="no"/> |
|
| 9 |
+ <child> |
|
| 10 |
+ <object class="GtkBox" id="MainVbox"> |
|
| 11 |
+ <property name="visible">True</property> |
|
| 12 |
+ <property name="can_focus">False</property> |
|
| 13 |
+ <property name="orientation">vertical</property> |
|
| 14 |
+ <child> |
|
| 15 |
+ <object class="GtkScrolledWindow" id="PlaylistScroll"> |
|
| 16 |
+ <property name="width_request">100</property> |
|
| 17 |
+ <property name="height_request">100</property> |
|
| 18 |
+ <property name="visible">True</property> |
|
| 19 |
+ <property name="can_focus">True</property> |
|
| 20 |
+ <property name="border_width">3</property> |
|
| 21 |
+ <property name="shadow_type">in</property> |
|
| 22 |
+ <child> |
|
| 23 |
+ <object class="GtkTreeView" id="PlaylistView"> |
|
| 24 |
+ <property name="visible">True</property> |
|
| 25 |
+ <property name="can_focus">True</property> |
|
| 26 |
+ <property name="model">Playlist</property> |
|
| 27 |
+ <child internal-child="selection"> |
|
| 28 |
+ <object class="GtkTreeSelection" id="treeview-selection2"/> |
|
| 29 |
+ </child> |
|
| 30 |
+ </object> |
|
| 31 |
+ </child> |
|
| 32 |
+ </object> |
|
| 33 |
+ <packing> |
|
| 34 |
+ <property name="expand">True</property> |
|
| 35 |
+ <property name="fill">True</property> |
|
| 36 |
+ <property name="position">0</property> |
|
| 37 |
+ </packing> |
|
| 38 |
+ </child> |
|
| 39 |
+ <child> |
|
| 40 |
+ <object class="GtkScale" id="PositionScale"> |
|
| 41 |
+ <property name="visible">True</property> |
|
| 42 |
+ <property name="can_focus">True</property> |
|
| 43 |
+ <property name="margin_left">3</property> |
|
| 44 |
+ <property name="margin_right">3</property> |
|
| 45 |
+ <property name="adjustment">Position</property> |
|
| 46 |
+ <property name="restrict_to_fill_level">False</property> |
|
| 47 |
+ <property name="fill_level">100</property> |
|
| 48 |
+ <property name="round_digits">2</property> |
|
| 49 |
+ <property name="digits">2</property> |
|
| 50 |
+ <property name="value_pos">bottom</property> |
|
| 51 |
+ </object> |
|
| 52 |
+ <packing> |
|
| 53 |
+ <property name="expand">False</property> |
|
| 54 |
+ <property name="fill">True</property> |
|
| 55 |
+ <property name="position">1</property> |
|
| 56 |
+ </packing> |
|
| 57 |
+ </child> |
|
| 58 |
+ <child> |
|
| 59 |
+ <object class="GtkBox" id="LogoBox"> |
|
| 60 |
+ <property name="visible">True</property> |
|
| 61 |
+ <property name="can_focus">False</property> |
|
| 62 |
+ <property name="border_width">3</property> |
|
| 63 |
+ <child> |
|
| 64 |
+ <object class="GtkBox" id="ButtonBox"> |
|
| 65 |
+ <property name="visible">True</property> |
|
| 66 |
+ <property name="can_focus">False</property> |
|
| 67 |
+ <property name="homogeneous">True</property> |
|
| 68 |
+ <child> |
|
| 69 |
+ <object class="GtkButton" id="Previous"> |
|
| 70 |
+ <property name="label">gtk-media-previous</property> |
|
| 71 |
+ <property name="use_action_appearance">False</property> |
|
| 72 |
+ <property name="visible">True</property> |
|
| 73 |
+ <property name="can_focus">True</property> |
|
| 74 |
+ <property name="receives_default">True</property> |
|
| 75 |
+ <property name="margin_right">3</property> |
|
| 76 |
+ <property name="use_action_appearance">False</property> |
|
| 77 |
+ <property name="use_stock">True</property> |
|
| 78 |
+ <property name="image_position">top</property> |
|
| 79 |
+ <signal name="clicked" handler="onPrevious" swapped="no"/> |
|
| 80 |
+ </object> |
|
| 81 |
+ <packing> |
|
| 82 |
+ <property name="expand">True</property> |
|
| 83 |
+ <property name="fill">True</property> |
|
| 84 |
+ <property name="position">0</property> |
|
| 85 |
+ </packing> |
|
| 86 |
+ </child> |
|
| 87 |
+ <child> |
|
| 88 |
+ <object class="GtkButton" id="Backward"> |
|
| 89 |
+ <property name="label">gtk-media-rewind</property> |
|
| 90 |
+ <property name="use_action_appearance">False</property> |
|
| 91 |
+ <property name="visible">True</property> |
|
| 92 |
+ <property name="can_focus">True</property> |
|
| 93 |
+ <property name="receives_default">True</property> |
|
| 94 |
+ <property name="margin_right">3</property> |
|
| 95 |
+ <property name="use_action_appearance">False</property> |
|
| 96 |
+ <property name="use_stock">True</property> |
|
| 97 |
+ <property name="image_position">top</property> |
|
| 98 |
+ <signal name="clicked" handler="onBackward" swapped="no"/> |
|
| 99 |
+ </object> |
|
| 100 |
+ <packing> |
|
| 101 |
+ <property name="expand">True</property> |
|
| 102 |
+ <property name="fill">True</property> |
|
| 103 |
+ <property name="position">1</property> |
|
| 104 |
+ </packing> |
|
| 105 |
+ </child> |
|
| 106 |
+ <child> |
|
| 107 |
+ <object class="GtkButton" id="Stop"> |
|
| 108 |
+ <property name="label">gtk-media-stop</property> |
|
| 109 |
+ <property name="use_action_appearance">False</property> |
|
| 110 |
+ <property name="visible">True</property> |
|
| 111 |
+ <property name="can_focus">True</property> |
|
| 112 |
+ <property name="receives_default">True</property> |
|
| 113 |
+ <property name="margin_right">3</property> |
|
| 114 |
+ <property name="use_action_appearance">False</property> |
|
| 115 |
+ <property name="use_stock">True</property> |
|
| 116 |
+ <property name="image_position">top</property> |
|
| 117 |
+ <signal name="clicked" handler="onStop" swapped="no"/> |
|
| 118 |
+ </object> |
|
| 119 |
+ <packing> |
|
| 120 |
+ <property name="expand">True</property> |
|
| 121 |
+ <property name="fill">True</property> |
|
| 122 |
+ <property name="position">2</property> |
|
| 123 |
+ </packing> |
|
| 124 |
+ </child> |
|
| 125 |
+ <child> |
|
| 126 |
+ <object class="GtkButton" id="Pause"> |
|
| 127 |
+ <property name="label">gtk-media-pause</property> |
|
| 128 |
+ <property name="use_action_appearance">False</property> |
|
| 129 |
+ <property name="can_focus">True</property> |
|
| 130 |
+ <property name="receives_default">True</property> |
|
| 131 |
+ <property name="margin_right">3</property> |
|
| 132 |
+ <property name="use_action_appearance">False</property> |
|
| 133 |
+ <property name="use_stock">True</property> |
|
| 134 |
+ <property name="image_position">top</property> |
|
| 135 |
+ <signal name="clicked" handler="onPause" swapped="no"/> |
|
| 136 |
+ </object> |
|
| 137 |
+ <packing> |
|
| 138 |
+ <property name="expand">True</property> |
|
| 139 |
+ <property name="fill">True</property> |
|
| 140 |
+ <property name="position">3</property> |
|
| 141 |
+ </packing> |
|
| 142 |
+ </child> |
|
| 143 |
+ <child> |
|
| 144 |
+ <object class="GtkButton" id="Play"> |
|
| 145 |
+ <property name="label">gtk-media-play</property> |
|
| 146 |
+ <property name="use_action_appearance">False</property> |
|
| 147 |
+ <property name="visible">True</property> |
|
| 148 |
+ <property name="can_focus">True</property> |
|
| 149 |
+ <property name="receives_default">True</property> |
|
| 150 |
+ <property name="margin_right">3</property> |
|
| 151 |
+ <property name="use_action_appearance">False</property> |
|
| 152 |
+ <property name="use_stock">True</property> |
|
| 153 |
+ <property name="image_position">top</property> |
|
| 154 |
+ <signal name="clicked" handler="onPlay" swapped="no"/> |
|
| 155 |
+ </object> |
|
| 156 |
+ <packing> |
|
| 157 |
+ <property name="expand">True</property> |
|
| 158 |
+ <property name="fill">True</property> |
|
| 159 |
+ <property name="position">4</property> |
|
| 160 |
+ </packing> |
|
| 161 |
+ </child> |
|
| 162 |
+ <child> |
|
| 163 |
+ <object class="GtkButton" id="Forward"> |
|
| 164 |
+ <property name="label">gtk-media-forward</property> |
|
| 165 |
+ <property name="use_action_appearance">False</property> |
|
| 166 |
+ <property name="visible">True</property> |
|
| 167 |
+ <property name="can_focus">True</property> |
|
| 168 |
+ <property name="receives_default">True</property> |
|
| 169 |
+ <property name="margin_right">3</property> |
|
| 170 |
+ <property name="use_action_appearance">False</property> |
|
| 171 |
+ <property name="use_stock">True</property> |
|
| 172 |
+ <property name="image_position">top</property> |
|
| 173 |
+ <signal name="clicked" handler="onForward" swapped="no"/> |
|
| 174 |
+ </object> |
|
| 175 |
+ <packing> |
|
| 176 |
+ <property name="expand">True</property> |
|
| 177 |
+ <property name="fill">True</property> |
|
| 178 |
+ <property name="position">5</property> |
|
| 179 |
+ </packing> |
|
| 180 |
+ </child> |
|
| 181 |
+ <child> |
|
| 182 |
+ <object class="GtkButton" id="Next"> |
|
| 183 |
+ <property name="label">gtk-media-next</property> |
|
| 184 |
+ <property name="use_action_appearance">False</property> |
|
| 185 |
+ <property name="visible">True</property> |
|
| 186 |
+ <property name="can_focus">True</property> |
|
| 187 |
+ <property name="receives_default">True</property> |
|
| 188 |
+ <property name="margin_right">3</property> |
|
| 189 |
+ <property name="use_action_appearance">False</property> |
|
| 190 |
+ <property name="use_stock">True</property> |
|
| 191 |
+ <property name="image_position">top</property> |
|
| 192 |
+ <signal name="clicked" handler="onNext" swapped="no"/> |
|
| 193 |
+ </object> |
|
| 194 |
+ <packing> |
|
| 195 |
+ <property name="expand">True</property> |
|
| 196 |
+ <property name="fill">True</property> |
|
| 197 |
+ <property name="position">6</property> |
|
| 198 |
+ </packing> |
|
| 199 |
+ </child> |
|
| 200 |
+ </object> |
|
| 201 |
+ <packing> |
|
| 202 |
+ <property name="expand">False</property> |
|
| 203 |
+ <property name="fill">True</property> |
|
| 204 |
+ <property name="position">0</property> |
|
| 205 |
+ </packing> |
|
| 206 |
+ </child> |
|
| 207 |
+ <child> |
|
| 208 |
+ <object class="GtkImage" id="Logo"> |
|
| 209 |
+ <property name="visible">True</property> |
|
| 210 |
+ <property name="can_focus">False</property> |
|
| 211 |
+ <property name="pixbuf">logo.png</property> |
|
| 212 |
+ </object> |
|
| 213 |
+ <packing> |
|
| 214 |
+ <property name="expand">False</property> |
|
| 215 |
+ <property name="fill">False</property> |
|
| 216 |
+ <property name="position">1</property> |
|
| 217 |
+ </packing> |
|
| 218 |
+ </child> |
|
| 219 |
+ </object> |
|
| 220 |
+ <packing> |
|
| 221 |
+ <property name="expand">False</property> |
|
| 222 |
+ <property name="fill">True</property> |
|
| 223 |
+ <property name="position">2</property> |
|
| 224 |
+ </packing> |
|
| 225 |
+ </child> |
|
| 226 |
+ <child> |
|
| 227 |
+ <object class="GtkStatusbar" id="Status"> |
|
| 228 |
+ <property name="visible">True</property> |
|
| 229 |
+ <property name="can_focus">False</property> |
|
| 230 |
+ <property name="orientation">vertical</property> |
|
| 231 |
+ <property name="spacing">2</property> |
|
| 232 |
+ </object> |
|
| 233 |
+ <packing> |
|
| 234 |
+ <property name="expand">False</property> |
|
| 235 |
+ <property name="fill">True</property> |
|
| 236 |
+ <property name="position">3</property> |
|
| 237 |
+ </packing> |
|
| 238 |
+ </child> |
|
| 239 |
+ </object> |
|
| 240 |
+ </child> |
|
| 241 |
+ </object> |
|
| 242 |
+ <object class="GtkListStore" id="Playlist"> |
|
| 243 |
+ <columns> |
|
| 244 |
+ <!-- column-name Name --> |
|
| 245 |
+ <column type="gchararray"/> |
|
| 246 |
+ <!-- column-name Dauer --> |
|
| 247 |
+ <column type="gfloat"/> |
|
| 248 |
+ </columns> |
|
| 249 |
+ <data> |
|
| 250 |
+ <row> |
|
| 251 |
+ <col id="0" translatable="yes">Erster Akt</col> |
|
| 252 |
+ <col id="1">1</col> |
|
| 253 |
+ </row> |
|
| 254 |
+ <row> |
|
| 255 |
+ <col id="0" translatable="yes">Zweiter Akt</col> |
|
| 256 |
+ <col id="1">2</col> |
|
| 257 |
+ </row> |
|
| 258 |
+ <row> |
|
| 259 |
+ <col id="0" translatable="yes">Weltuntergang</col> |
|
| 260 |
+ <col id="1">99</col> |
|
| 261 |
+ </row> |
|
| 262 |
+ </data> |
|
| 263 |
+ </object> |
|
| 264 |
+ <object class="GtkAdjustment" id="Position"> |
|
| 265 |
+ <property name="upper">100</property> |
|
| 266 |
+ <property name="value">50</property> |
|
| 267 |
+ <property name="step_increment">1</property> |
|
| 268 |
+ <property name="page_increment">10</property> |
|
| 269 |
+ </object> |
|
| 270 |
+</interface> |
| ... | ... |
@@ -0,0 +1,63 @@ |
| 1 |
+#! /usr/bin/env python |
|
| 2 |
+ |
|
| 3 |
+import os |
|
| 4 |
+ |
|
| 5 |
+from gi.repository import Gtk |
|
| 6 |
+ |
|
| 7 |
+scriptdir = os.path.dirname(os.path.abspath(__file__)) |
|
| 8 |
+ |
|
| 9 |
+class SyncGui: |
|
| 10 |
+ def __init__(self): |
|
| 11 |
+ self.builder = Gtk.Builder() |
|
| 12 |
+ self.builder.add_from_file(scriptdir + "/sync_gui.glade") |
|
| 13 |
+ self.position = self.builder.get_object("Position")
|
|
| 14 |
+ self.btnPause = self.builder.get_object("Pause")
|
|
| 15 |
+ self.btnPlay = self.builder.get_object("Play")
|
|
| 16 |
+ self.status = self.builder.get_object("Status")
|
|
| 17 |
+ handlers = {
|
|
| 18 |
+ "onDestroy": self.onDestroy, |
|
| 19 |
+ "onPrevious": self.onPrevious, |
|
| 20 |
+ "onBackward": self.onBackward, |
|
| 21 |
+ "onStop": self.onStop, |
|
| 22 |
+ "onPause": self.onPause, |
|
| 23 |
+ "onPlay": self.onPlay, |
|
| 24 |
+ "onForward": self.onForward, |
|
| 25 |
+ "onNext": self.onNext, |
|
| 26 |
+ } |
|
| 27 |
+ self.builder.connect_signals(handlers) |
|
| 28 |
+ self.status.push(0, "TODO...") |
|
| 29 |
+ |
|
| 30 |
+ def onDestroy(self, widget): |
|
| 31 |
+ Gtk.main_quit() |
|
| 32 |
+ |
|
| 33 |
+ def onPrevious(self, widget): |
|
| 34 |
+ print("previous")
|
|
| 35 |
+ |
|
| 36 |
+ def onBackward(self, widget): |
|
| 37 |
+ print("backward")
|
|
| 38 |
+ |
|
| 39 |
+ def onStop(self, widget): |
|
| 40 |
+ print("stop")
|
|
| 41 |
+ self.btnPause.set_visible(False) |
|
| 42 |
+ self.btnPlay.set_visible(True) |
|
| 43 |
+ |
|
| 44 |
+ def onPause(self, widget): |
|
| 45 |
+ print("pause")
|
|
| 46 |
+ self.btnPause.set_visible(False) |
|
| 47 |
+ self.btnPlay.set_visible(True) |
|
| 48 |
+ |
|
| 49 |
+ def onPlay(self, widget): |
|
| 50 |
+ print("play")
|
|
| 51 |
+ self.btnPause.set_visible(True) |
|
| 52 |
+ self.btnPlay.set_visible(False) |
|
| 53 |
+ |
|
| 54 |
+ def onForward(self, widget): |
|
| 55 |
+ print("forward")
|
|
| 56 |
+ |
|
| 57 |
+ def onNext(self, widget): |
|
| 58 |
+ print("next")
|
|
| 59 |
+ |
|
| 60 |
+if __name__ == "__main__": |
|
| 61 |
+ app = SyncGui() |
|
| 62 |
+ Gtk.main() |
|
| 63 |
+ |
|
| 0 | 64 |