[pitivi: 24/27] Limit the timecode widget's width to prevent the window from overflowing
- From: Thibault Saunier <tsaunier src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi: 24/27] Limit the timecode widget's width to prevent the window from overflowing
- Date: Wed, 11 May 2011 14:07:12 +0000 (UTC)
commit ee82c79486a40760d9b9bc57b0de02a789cacfd1
Author: Jean-François Fortin Tam <nekohayo gmail com>
Date: Mon May 9 16:15:44 2011 -0400
Limit the timecode widget's width to prevent the window from overflowing
Remove a digit from the hours in the time_to_string function to save some screen space
and avoid the display to bug when using the cantarell fonts
pitivi/ui/dynamic.py | 8 +++++++-
pitivi/utils.py | 2 +-
2 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/pitivi/ui/dynamic.py b/pitivi/ui/dynamic.py
index 4b72a44..f848bd6 100644
--- a/pitivi/ui/dynamic.py
+++ b/pitivi/ui/dynamic.py
@@ -166,6 +166,11 @@ class TextWidget(gtk.HBox, DynamicWidget):
return True
return False
+ def set_width_chars(self, width):
+ """Allows setting the width of the text entry widget for compactness."""
+ self.text.set_width_chars(width)
+
+
class NumericWidget(gtk.HBox, DynamicWidget):
"""A gtk.HScale and a gtk.SpinButton which share an adjustment. The
@@ -232,12 +237,13 @@ class NumericWidget(gtk.HBox, DynamicWidget):
class TimeWidget(TextWidget, DynamicWidget):
""" 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]$")
+ regex = re.compile("^([0-9]:[0-5][0-9]:[0-5][0-9])\.[0-9][0-9][0-9]$")
__gtype_name__ = 'TimeWidget'
def __init__(self, default=None):
DynamicWidget.__init__(self, default)
TextWidget.__init__(self, self.regex)
+ TextWidget.set_width_chars(self, 10)
def getWidgetValue(self):
timecode = TextWidget.getWidgetValue(self)
diff --git a/pitivi/utils.py b/pitivi/utils.py
index f0309ad..e94b2ef 100644
--- a/pitivi/utils.py
+++ b/pitivi/utils.py
@@ -56,7 +56,7 @@ def time_to_string(value):
sec = sec % 60
hours = mins / 60
mins = mins % 60
- return "%02d:%02d:%02d.%03d" % (hours, mins, sec, ms)
+ return "%01d:%02d:%02d.%03d" % (hours, mins, sec, ms)
def beautify_length(length):
"""
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]