[pitivi] elements: Get rid of more GTK warnings
- From: Alexandru Băluț <alexbalut src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] elements: Get rid of more GTK warnings
- Date: Wed, 9 Nov 2016 13:33:53 +0000 (UTC)
commit cdefea9824f321942a210a2bda1b2f4d8324ac6a
Author: Alexandru Băluț <alexandru balut gmail com>
Date: Sun Nov 6 02:52:56 2016 +0100
elements: Get rid of more GTK warnings
Fixes a lot of "<widget> is drawn without a current allocation. This
should not happen." warnings, shown for example when adding a clip to
the timeline.
The warnings were shown because the widgets location and size were
changed when drawing. The widgets location is already being done in
various places. Now this is done also in do_map, to cover the case when
the Clip is added to the Layer.
Reviewed-by: Thibault Saunier <tsaunier gnome org>
Differential Revision: https://phabricator.freedesktop.org/D1446
pitivi/timeline/elements.py | 8 +++++---
pitivi/timeline/layer.py | 2 +-
2 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/pitivi/timeline/elements.py b/pitivi/timeline/elements.py
index 0cd073e..6868fb6 100644
--- a/pitivi/timeline/elements.py
+++ b/pitivi/timeline/elements.py
@@ -944,7 +944,7 @@ class Clip(Gtk.EventBox, Zoomable, Loggable):
# might be lost if we ignore the start of the clip.
width = self.nsToPixel(start + duration) - x
- parent_height = layer.get_allocated_height()
+ parent_height = layer.props.height_request
y = 0
height = parent_height
has_video = self.ges_clip.find_track_elements(None, GES.TrackType.VIDEO, GObject.TYPE_NONE)
@@ -999,9 +999,9 @@ class Clip(Gtk.EventBox, Zoomable, Loggable):
for handle in self.handles:
handle.shrink()
- def do_draw(self, cr):
+ def do_map(self):
+ Gtk.EventBox.do_map(self)
self.updatePosition()
- Gtk.EventBox.do_draw(self, cr)
def _button_release_event_cb(self, unused_widget, event):
if self.timeline.got_dragged:
@@ -1117,6 +1117,7 @@ class Clip(Gtk.EventBox, Zoomable, Loggable):
self.__force_position_update = True
self._childAdded(clip, child)
self.__connectToChild(child)
+ self.updatePosition()
def _childRemoved(self, clip, child):
pass
@@ -1125,6 +1126,7 @@ class Clip(Gtk.EventBox, Zoomable, Loggable):
self.__force_position_update = True
self.__disconnectFromChild(child)
self._childRemoved(clip, child)
+ self.updatePosition()
class SourceClip(Clip):
diff --git a/pitivi/timeline/layer.py b/pitivi/timeline/layer.py
index 62bd633..fb14600 100644
--- a/pitivi/timeline/layer.py
+++ b/pitivi/timeline/layer.py
@@ -332,10 +332,10 @@ class Layer(Gtk.Layout, Zoomable, Loggable):
return
widget = ui_type(self, ges_clip)
-
self._children.append(widget)
self._children.sort(key=lambda clip: clip.z_order)
self.put(widget, self.nsToPixel(ges_clip.props.start), 0)
+ widget.updatePosition()
self._changed = True
widget.show_all()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]