| 130 | self.imagesink.set_xwindow_id(self.window.xid) |
| 131 | |
| 132 | class TimeControl(gtk.HBox): |
| 133 | # all labels same size |
| 134 | sizegroup = gtk.SizeGroup(gtk.SIZE_GROUP_HORIZONTAL) |
| 135 | __gproperties__ = {'time': (gobject.TYPE_UINT64, 'Time', 'Time', |
| 136 | # not actually usable: see #335854 |
| 137 | # kept for .notify() usage |
| 138 | 0L, (1<<63)-1, 0L, |
| 139 | gobject.PARAM_READABLE)} |
| 140 | |
| 141 | def __init__(self, window, label): |
| 142 | gtk.HBox.__init__(self) |
| 143 | self.pwindow = window |
| 144 | self.label = label |
| 145 | self.create_ui() |
| 146 | |
| 147 | def get_property(self, param, pspec): |
| 148 | if param == 'time': |
| 149 | return self.get_time() |
| 150 | else: |
| 151 | assert param in self.__gproperties__, \ |
| 152 | 'Unknown property: %s' % param |
| 153 | |
| 154 | def create_ui(self): |
| 155 | label = gtk.Label(self.label + ": ") |
| 156 | label.show() |
| 157 | a = gtk.Alignment(1.0, 0.5) |
| 158 | a.add(label) |
| 159 | a.set_padding(0, 0, 12, 0) |
| 160 | a.show() |
| 161 | self.sizegroup.add_widget(a) |
| 162 | self.pack_start(a, True, False, 0) |
| 163 | |
| 164 | self.minutes = minutes = gtk.Entry(5) |
| 165 | minutes.set_width_chars(5) |
| 166 | minutes.set_alignment(1.0) |
| 167 | minutes.connect('changed', lambda *x: self.notify('time')) |
| 168 | minutes.connect_after('activate', lambda *x: self.activated()) |
| 169 | label2 = gtk.Label(":") |
| 170 | self.seconds = seconds = gtk.Entry(2) |
| 171 | seconds.set_width_chars(2) |
| 172 | seconds.set_alignment(1.0) |
| 173 | seconds.connect('changed', lambda *x: self.notify('time')) |
| 174 | seconds.connect_after('activate', lambda *x: self.activated()) |
| 175 | label3 = gtk.Label(".") |
| 176 | self.milliseconds = milliseconds = gtk.Entry(3) |
| 177 | milliseconds.set_width_chars(3) |
| 178 | milliseconds.set_alignment(0.0) |
| 179 | milliseconds.connect('changed', lambda *x: self.notify('time')) |
| 180 | milliseconds.connect_after('activate', lambda *x: self.activated()) |
| 181 | set = gtk.Button('Set') |
| 182 | goto = gtk.Button('Go') |
| 183 | goto.set_property('image', |
| 184 | gtk.image_new_from_stock(gtk.STOCK_JUMP_TO, |
| 185 | gtk.ICON_SIZE_BUTTON)) |
| 186 | for w in minutes, label2, seconds, label3, milliseconds: |
| 187 | w.show() |
| 188 | self.pack_start(w, False) |
| 189 | set.show() |