[pitivi] GTK3 port: Changed api of get_state and modify_bg
- From: Jean-FranÃois Fortin Tam <jfft src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] GTK3 port: Changed api of get_state and modify_bg
- Date: Sun, 2 Sep 2012 03:59:44 +0000 (UTC)
commit 12367ad1eb3a2054c4d7d3889f6772429505d6c8
Author: Matas Brazdeikis <matas brazdeikis lt>
Date: Thu Aug 2 18:14:21 2012 +0100
GTK3 port: Changed api of get_state and modify_bg
pitivi/timeline/layer.py | 19 +++++++++++--------
pitivi/timeline/timeline.py | 12 ++++++------
pitivi/timeline/track.py | 12 ++++++------
pitivi/utils/timeline.py | 2 +-
pitivi/viewer.py | 2 +-
5 files changed, 25 insertions(+), 22 deletions(-)
---
diff --git a/pitivi/timeline/layer.py b/pitivi/timeline/layer.py
index 31f86f4..6c12624 100644
--- a/pitivi/timeline/layer.py
+++ b/pitivi/timeline/layer.py
@@ -47,11 +47,14 @@ class BaseLayerControl(gtk.VBox, Loggable):
self.layer = layer
self._selected = False
+ context = self.get_style_context()
+
# get the default color for the current theme
- self.UNSELECTED_COLOR = self.rc_get_style().bg[gtk.STATE_NORMAL]
+ self.UNSELECTED_COLOR = context.get_background_color(gtk.STATE_NORMAL)
# use base instead of bg colors so that we get the lighter color
# that is used for list items in TreeView.
- self.SELECTED_COLOR = self.rc_get_style().base[gtk.STATE_SELECTED]
+ #FIXME gtk.STATE_SELECTED fails
+ self.SELECTED_COLOR = context.get_background_color(gtk.STATE_NORMAL)
table = gtk.Table(rows=2, columns=2)
table.props.border_width = 2
@@ -204,11 +207,11 @@ class BaseLayerControl(gtk.VBox, Loggable):
Called when the selection state changes
"""
if self.selected:
- self.eventbox.modify_bg(gtk.STATE_NORMAL, self.SELECTED_COLOR)
- self.name_entry.modify_bg(gtk.STATE_NORMAL, self.SELECTED_COLOR)
+ self.eventbox.override_background_color(gtk.STATE_NORMAL, self.SELECTED_COLOR)
+ self.name_entry.override_background_color(gtk.STATE_NORMAL, self.SELECTED_COLOR)
else:
- self.eventbox.modify_bg(gtk.STATE_NORMAL, self.UNSELECTED_COLOR)
- self.name_entry.modify_bg(gtk.STATE_NORMAL, self.UNSELECTED_COLOR)
+ self.eventbox.override_background_color(gtk.STATE_NORMAL, self.UNSELECTED_COLOR)
+ self.name_entry.override_background_color(gtk.STATE_NORMAL, self.UNSELECTED_COLOR)
# continue GTK signal propagation
return True
@@ -276,9 +279,9 @@ class BaseLayerControl(gtk.VBox, Loggable):
Used for visual drag'n'drop feedback
"""
if highlighted:
- self.sep.modify_bg(gtk.STATE_NORMAL, self.SELECTED_COLOR)
+ self.sep.override_background_color(gtk.STATE_NORMAL, self.SELECTED_COLOR)
else:
- self.sep.modify_bg(gtk.STATE_NORMAL, self.UNSELECTED_COLOR)
+ self.sep.override_background_color(gtk.STATE_NORMAL, self.UNSELECTED_COLOR)
class VideoLayerControl(BaseLayerControl):
diff --git a/pitivi/timeline/timeline.py b/pitivi/timeline/timeline.py
index 2910c13..5374752 100644
--- a/pitivi/timeline/timeline.py
+++ b/pitivi/timeline/timeline.py
@@ -349,9 +349,9 @@ class TimelineCanvas(goocanvas.Canvas, Zoomable, Loggable):
elif self._timeline is not None:
self._got_motion_notify = False
mode = 0
- if event.get_state() & gtk.gdk.SHIFT_MASK:
+ if event.get_state()[1] & gtk.gdk.SHIFT_MASK:
mode = 1
- if event.get_state() & gtk.gdk.CONTROL_MASK:
+ if event.get_state()[1] & gtk.gdk.CONTROL_MASK:
mode = 2
selected = self._objectsUnderMarquee()
self._timeline.selection.setSelection(self._objectsUnderMarquee(), mode)
@@ -521,7 +521,7 @@ class TimelineControls(gtk.VBox, Loggable):
def _sizeAllocatedCb(self, widget, alloc):
if self.get_children():
- self.separator_height = self.children()[0].getSeparatorHeight()
+ self.separator_height = self.get_children()[0].getSeparatorHeight()
self.app.gui.timeline_ui._canvas.updateTracks()
## Timeline callbacks
@@ -591,11 +591,11 @@ class TimelineControls(gtk.VBox, Loggable):
self.reorder_child(child, middle + child.layer.get_priority())
def _hideLastSeparator(self):
- if self.children():
- for child in self.children():
+ if self.get_children():
+ for child in self.get_children():
child.setSeparatorVisibility(True)
- self.children()[-1].setSeparatorVisibility(False)
+ self.get_children()[-1].setSeparatorVisibility(False)
def _updatePopupMenus(self):
"""
diff --git a/pitivi/timeline/track.py b/pitivi/timeline/track.py
index 85caa48..aa15d1d 100644
--- a/pitivi/timeline/track.py
+++ b/pitivi/timeline/track.py
@@ -371,9 +371,9 @@ class TrackObject(View, goocanvas.Group, Zoomable, Loggable):
def click(self, pos):
timeline = self._view.timeline
element = self._view.element
- if self._last_event.get_state() & gtk.gdk.SHIFT_MASK:
+ if self._last_event.get_state()[1] & gtk.gdk.SHIFT_MASK:
timeline.selection.setToObj(element, SELECT_BETWEEN)
- elif self._last_event.get_state() & gtk.gdk.CONTROL_MASK:
+ elif self._last_event.get_state()[1] & gtk.gdk.CONTROL_MASK:
if element.selected:
mode = UNSELECT
else:
@@ -645,7 +645,7 @@ class TrackTransition(TrackObject):
def __init__(self, instance, element, track, timeline, utrack):
TrackObject.__init__(self, instance, element, track, timeline, utrack)
for thing in (self.bg, self._selec_indic, self.namebg, self.name):
- self.add_child(thing)
+ self.add_child(thing, -1)
if isinstance(element, ges.TrackVideoTransition):
element.connect("notify::transition-type", self._changeVideoTransitionCb)
self.movable = False
@@ -671,7 +671,7 @@ class TrackFileSource(TrackObject):
self.preview = Preview(self.app, element, self.height)
for thing in (self.bg, self.preview, self._selec_indic,
self.start_handle, self.end_handle, self.namebg, self.name):
- self.add_child(thing)
+ self.add_child(thing, -1)
def _setElement(self, element):
"""
@@ -756,7 +756,7 @@ class Track(goocanvas.Group, Zoomable, Loggable):
elif isinstance(track_object, ges.TrackSource):
w = TrackFileSource(self.app, track_object, self.track, self.timeline, self)
self.widgets[track_object] = w
- self.add_child(w)
+ self.add_child(w, -1)
def _objectRemovedCb(self, unused_timeline, track_object):
if not isinstance(track_object, ges.TrackEffect) and track_object in self.widgets:
@@ -768,7 +768,7 @@ class Track(goocanvas.Group, Zoomable, Loggable):
def _transitionAdded(self, transition):
w = TrackTransition(self.app, transition, self.track, self.timeline, self)
self.widgets[transition] = w
- self.add_child(w)
+ self.add_child(w, -1)
self.transitions.append(w)
w.raise_(None)
diff --git a/pitivi/utils/timeline.py b/pitivi/utils/timeline.py
index 2ce823d..92c0db6 100644
--- a/pitivi/utils/timeline.py
+++ b/pitivi/utils/timeline.py
@@ -397,7 +397,7 @@ class Controller(Loggable):
self._hadj = self._canvas.app.gui.timeline_ui.hadj
self._vadj = self._canvas.app.gui.timeline_ui.vadj
self._last_event = event
- s = event.get_state()
+ _, s = event.get_state()
self._shift_down = s & gtk.gdk.SHIFT_MASK
self._control_down = s & gtk.gdk.CONTROL_MASK
diff --git a/pitivi/viewer.py b/pitivi/viewer.py
index cc8f27b..0725e5f 100644
--- a/pitivi/viewer.py
+++ b/pitivi/viewer.py
@@ -836,7 +836,7 @@ class ViewerWidget(gtk.DrawingArea, Loggable):
When not playing, store a pixbuf of the current viewer image.
This will allow it to be restored for the transformation box.
"""
- colormap = self.window.get_colormap()
+ colormap = self.get_window().get_colormap()
if self.box and self.zoom != 1.0:
# The transformation box is active and dezoomed
# crop away 1 pixel border to avoid artefacts on the pixbuf
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]