[pitivi: 19/27] viewer: Disconnect ui/timeline when timecode_entry is focused



commit d22c5b1bd2ab49443ebcbdbc48a50106862f9bcb
Author: Thibault Saunier <thibault saunier collabora co uk>
Date:   Wed Jan 19 09:17:51 2011 +0100

    viewer: Disconnect ui/timeline when timecode_entry is focused

 pitivi/ui/dynamic.py |   12 +++++++++++-
 pitivi/ui/viewer.py  |    9 +++++++++
 2 files changed, 20 insertions(+), 1 deletions(-)
---
diff --git a/pitivi/ui/dynamic.py b/pitivi/ui/dynamic.py
index 7c8d9f0..11b7807 100644
--- a/pitivi/ui/dynamic.py
+++ b/pitivi/ui/dynamic.py
@@ -29,6 +29,7 @@ import re
 import sys
 import gst
 from gettext import gettext as _
+from pitivi.utils import time_to_string
 from pitivi.ui.common import unpack_color, pack_color_32, pack_color_64
 import pango
 from pitivi.ui.common import PADDING, SPACING
@@ -224,7 +225,7 @@ class NumericWidget(gtk.HBox, DynamicWidget):
         self.spinner.set_adjustment(self.adjustment)
 
 class TimeWidget(TextWidget, DynamicWidget):
-    """ A widget that contains a time """
+    """ A widget that contains a time in nanosconds"""
 
     regex = re.compile("^([0-9][0-9]:[0-5][0-9]:[0-5][0-9])\.[0-9][0-9][0-9]$")
     __gtype_name__ = 'TimeWidget'
@@ -248,6 +249,15 @@ class TimeWidget(TextWidget, DynamicWidget):
 
       return nanosecs
 
+    def setWidgetValue(self, value):
+      TextWidget.setWidgetValue(self, time_to_string(value))
+
+    def connectFocusEvents (self, focusInCb, focusOutCb):
+        fIn = self.text.connect ("button-press-event", focusInCb)
+        fOut = self.text.connect ("focus-out-event", focusOutCb)
+
+        return [fIn, fOut]
+
 
 class FractionWidget(TextWidget, DynamicWidget):
 
diff --git a/pitivi/ui/viewer.py b/pitivi/ui/viewer.py
index 21d97fd..8494f8d 100644
--- a/pitivi/ui/viewer.py
+++ b/pitivi/ui/viewer.py
@@ -331,6 +331,7 @@ class PitiviViewer(gtk.VBox, Loggable):
         self.timecode_entry = TimeWidget()
         self.timecode_entry.setWidgetValue("00:00:00.000")
         self.timecode_entry.connect("value-changed", self._jumpToTimecodeCb)
+        self.timecode_entry.connectFocusEvents(self._entryFocusInCb, self._entryFocusOutCb)
         bbox.pack_start(self.timecode_entry, expand=False, padding=10)
         self._haveUI = True
 
@@ -391,6 +392,14 @@ class PitiviViewer(gtk.VBox, Loggable):
 
     ## gtk.HScale callbacks for self.slider
 
+    def _entryFocusInCb(self, entry, event):
+        sensitive_actions = self.app.gui.sensitive_actions
+        self.app.gui.setActionsSensitive(sensitive_actions, False)
+
+    def _entryFocusOutCb(self, entry, event):
+        sensitive_actions = self.app.gui.sensitive_actions
+        self.app.gui.setActionsSensitive(sensitive_actions, True)
+
     def _sliderButtonPressCb(self, slider, event):
         # borrow totem hack for seek-on-click behavior
         event.button = 2



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]