diff options
author | flavio <fdanesse@gmail.com> | 2012-12-08 21:53:01 (GMT) |
---|---|---|
committer | flavio <fdanesse@gmail.com> | 2012-12-08 21:53:01 (GMT) |
commit | 1746f4e21c6720633683d3a1dbded945a5114094 (patch) | |
tree | c17ada8f3face9d01ba7311e6b0d98e29efa027f | |
parent | 5175a36d9c00664a2ed7d865425efbc056f9e921 (diff) |
Fixmes and Container corrections.
-rw-r--r-- | aplay.py | 1 | ||||
-rw-r--r-- | glive.py | 9 | ||||
-rw-r--r-- | gplay.py | 1 | ||||
-rw-r--r-- | mediaview.py | 25 | ||||
-rw-r--r-- | record.py | 55 |
5 files changed, 55 insertions, 36 deletions
@@ -14,6 +14,7 @@ import gi gi.require_version('Gst', '1.0') from gi.repository import Gst +from gi.repository import GstVideo import os import logging import constants @@ -27,6 +27,7 @@ gi.require_version('Gst', '1.0') from gi.repository import GdkPixbuf from gi.repository import GObject from gi.repository import Gst +from gi.repository import GstVideo from sugar3.activity.activity import get_bundle_path import logging @@ -402,10 +403,10 @@ class Glive: if self._audio_pixbuf: pixbuf_b64 = utils.getStringFromPixbuf(self._audio_pixbuf) - taglist[gst.TAG_EXTENDED_COMMENT] = "coverart=" + pixbuf_b64 + taglist[Gst.TAG_EXTENDED_COMMENT] = "coverart=" + pixbuf_b64 vorbis_enc = audioline.get_by_name('audioVorbisenc') - vorbis_enc.merge_tags(taglist, gst.TAG_MERGE_REPLACE_ALL) + vorbis_enc.merge_tags(taglist, Gst.TAG_MERGE_REPLACE_ALL) audioFilesink = audioline.get_by_name('audioFilesink') audioOggFilepath = os.path.join(Instance.instancePath, "output.ogg") @@ -637,12 +638,12 @@ class Glive: def _bus_message_handler(self, bus, message): t = message.type - if t == Gst.MESSAGE_EOS: + if t == Gst.MessageType.EOS: if self._eos_cb: cb = self._eos_cb self._eos_cb = None cb() - elif t == Gst.MESSAGE_ERROR: + elif t == Gst.MessageType.ERROR: #todo: if we come out of suspend/resume with errors, then get us back up and running... #todo: handle "No space left on the resource.gstfilesink.c" #err, debug = message.parse_error() @@ -23,6 +23,7 @@ gi.require_version('Gst', '1.0') from gi.repository import GObject from gi.repository import Gst +from gi.repository import GstVideo import logging logger = logging.getLogger('record:gplay.py') diff --git a/mediaview.py b/mediaview.py index 87ef4eb..1f81ec3 100644 --- a/mediaview.py +++ b/mediaview.py @@ -100,6 +100,8 @@ class InfoView(Gtk.EventBox): alignment.add(self._live_bg) self._outer_vbox.pack_start(alignment, False, False, 0) + self.show_all() + def fit_to_allocation(self, allocation): # main viewing area: 50% of each dimension scale = 0.5 @@ -113,13 +115,13 @@ class InfoView(Gtk.EventBox): h = int(allocation.height * scale) self._live_bg.set_size_request(w, h) - def show(self): - self.show_all() + #def show(self): + # self.show_all() - def hide(self): + #def hide(self): # FIXME: RuntimeError: maximum recursion depth exceeded #self.hide() - pass + #pass def set_author(self, name, stroke, fill): self._xo_icon.set_colors(stroke, fill) @@ -132,8 +134,10 @@ class InfoView(Gtk.EventBox): self._tags_buffer.set_text(tags) def _size_allocate(self, widget, allocation): - self.emit('primary-allocated', self._view_bg.allocation) - self.emit('secondary-allocated', self._live_bg.allocation) + # FIXME: AttributeError: 'EventBox' object has no attribute 'allocation' + #self.emit('primary-allocated', self._view_bg.allocation) + #self.emit('secondary-allocated', self._live_bg.allocation) + pass def _tags_changed(self, widget): self.emit('tags-changed', widget) @@ -149,7 +153,8 @@ class VideoBox(Gtk.EventBox): self._sink = None self._xid = None self.connect('realize', self._realize) - + self.show_all() + def _realize(self, widget): self._xid = self.get_property('window').get_xid() @@ -163,7 +168,8 @@ class VideoBox(Gtk.EventBox): # can be called from gstreamer thread, must not do any GTK+ stuff def set_sink(self, sink): self._sink = sink - sink.set_xwindow_id(self._xid) + # FIXME: AttributeError: '__main__.GstXvImageSink' object has no attribute 'set_xwindow_id' + #sink.set_xwindow_id(self._xid) class FullscreenButton(Gtk.EventBox): def __init__(self): @@ -313,6 +319,9 @@ class MediaView(Gtk.EventBox): self._full_button.connect('button-release-event', self._full_clicked) self._fixed.put(self._full_button, 0, 0) + self.show_all() + self.realize() + self._switch_mode(MediaView.MODE_LIVE) def _size_allocate(self, widget, allocation): @@ -554,10 +554,10 @@ class Record(activity.Activity): self.set_progress(recd.meshDownlodingPercent, msg) def _set_cursor_busy(self): - self.window.set_cursor(Gdk.Cursor(Gdk.CursorType.WATCH)) + self.get_property('window').set_cursor(Gdk.Cursor(Gdk.CursorType.WATCH)) def _set_cursor_default(self): - self.window.set_cursor(None) + self.get_property('window').set_cursor(None) class RecordContainer(Gtk.Container): """ @@ -584,27 +584,34 @@ class RecordContainer(Gtk.Container): #widget.set_parent_window(self.window) widget.set_parent(self) - # FIXME: Gdk.WINDOW_CHILD ? Gdk.INPUT_OUTPUT ? + + self.show_all() + def do_realize(self): - # FIXME: AttributeError: 'RecordContainer' object has no attribute 'set_flags' - #self.set_flags(Gtk.REALIZED) - - self.window = Gdk.Window( - self.get_parent_window(), - window_type=Gdk.WINDOW_CHILD, - x=self.allocation.x, - y=self.allocation.y, - width=self.allocation.width, - height=self.allocation.height, - wclass=Gdk.INPUT_OUTPUT, - colormap=self.get_colormap(), - event_mask=self.get_events() | Gdk.VisibilityState.NOTIFY_MASK | Gdk.EventMask.EXPOSURE_MASK) - self.window.set_user_data(self) - - self.set_style(self.style.attach(self.window)) + + self.set_realized(True) + attr = Gdk.WindowAttr() + attr.window_type = Gdk.WindowType.CHILD + attr.wclass = Gdk.WindowWindowClass.INPUT_OUTPUT + attr.event_mask = self.get_events() | Gdk.EventMask.VISIBILITY_NOTIFY_MASK | Gdk.EventMask.EXPOSURE_MASK + attr.visual = self.get_visual() + attr.x = self.allocation.x + attr.y = self.allocation.y + attr.width = self.allocation.width + attr.height = self.allocation.height + + mask = Gdk.WindowAttributesType.VISUAL | \ + Gdk.WindowAttributesType.X | \ + Gdk.WindowAttributesType.Y + + window = Gdk.Window.new(self.get_parent_window(), attr, mask) + window.set_user_data(self) + + self.set_window(window) for widget in (self._media_view, self._controls_hbox): - widget.set_parent_window(self.window) + widget.set_parent_window(window) + self.queue_resize() # GTK+ contains on exit if remove is not implemented @@ -685,10 +692,10 @@ class RecordContainer(Gtk.Container): # FIXME: AttributeError: 'RecordContainer' object has no attribute 'flags' #if self.flags() & Gtk.REALIZED: # self.window.move_resize(*allocation) - - def do_forall(self, include_internals, callback, data): - for widget in (self._media_view, self._controls_hbox): - callback(widget, data) + # FIXME: TypeError: do_forall() takes exactly 4 arguments (3 given) + #def do_forall(self, include_internals, callback, data): + # for widget in (self._media_view, self._controls_hbox): + # callback(widget, data) def set_title_visible(self, visible): self._show_title = visible |