[pitivi: 14/65] pitivi: All pep8 compliant
- From: Thibault Saunier <tsaunier src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi: 14/65] pitivi: All pep8 compliant
- Date: Mon, 4 Jul 2011 01:20:24 +0000 (UTC)
commit 3a3d2ab5599950b48aac2c76d55bdd5d31968a2e
Author: Thibault Saunier <thibault saunier collabora com>
Date: Wed Jun 22 00:53:31 2011 -0400
pitivi: All pep8 compliant
pitivi/factories/base.py | 4 +-
pitivi/reflect.py | 6 +-
pitivi/settings.py | 1 -
pitivi/ui/basetabs.py | 9 ++--
pitivi/ui/clipproperties.py | 11 +++--
pitivi/ui/common.py | 50 +++++++++++++-------
pitivi/ui/controller.py | 1 +
pitivi/ui/curve.py | 7 ++-
pitivi/ui/dynamic.py | 48 +++++++++++---------
pitivi/ui/effectlist.py | 19 ++++----
pitivi/ui/effectsconfiguration.py | 5 +-
pitivi/ui/encodingdialog.py | 14 +++---
pitivi/ui/encodingprogress.py | 1 +
pitivi/ui/filechooserpreview.py | 8 ++--
pitivi/ui/filelisterrordialog.py | 2 +-
pitivi/ui/gstwidget.py | 19 ++++----
pitivi/ui/mainwindow.py | 42 ++++++++---------
pitivi/ui/pathwalker.py | 2 +
pitivi/ui/point.py | 1 +
pitivi/ui/prefs.py | 88 +++++++++++++++++------------------
pitivi/ui/preset.py | 3 +
pitivi/ui/preview.py | 6 ++-
pitivi/ui/previewer.py | 61 +++++++++++++-----------
pitivi/ui/projectsettings.py | 11 +++--
pitivi/ui/ripple_update_group.py | 8 ++--
pitivi/ui/ruler.py | 13 +++---
pitivi/ui/sourcelist.py | 18 +++-----
pitivi/ui/startupwizard.py | 4 +-
pitivi/ui/timeline.py | 27 +++++-------
pitivi/ui/timelinecontrols.py | 3 +
pitivi/ui/track.py | 3 +-
pitivi/ui/trackobject.py | 90 ++++++++++++++++++++-----------------
pitivi/ui/view.py | 1 +
pitivi/ui/viewer.py | 22 +++++-----
pitivi/ui/zoominterface.py | 4 +-
35 files changed, 328 insertions(+), 284 deletions(-)
---
diff --git a/pitivi/factories/base.py b/pitivi/factories/base.py
index 80348c7..26e72b2 100644
--- a/pitivi/factories/base.py
+++ b/pitivi/factories/base.py
@@ -447,10 +447,10 @@ class SourceFactory(ObjectFactory):
caps_copy = gst.Caps(caps)
for structure in caps_copy:
# remove framerate as we don't adjust framerate here
- if structure.has_key("framerate"):
+ if structure.has_field("framerate"):
del structure["framerate"]
# remove format as we will have converted to AYUV/ARGB
- if structure.has_key("format"):
+ if structure.has_field("format"):
del structure["format"]
if b is None:
for bin in self.bins:
diff --git a/pitivi/reflect.py b/pitivi/reflect.py
index fe5b3aa..b0b9bf7 100644
--- a/pitivi/reflect.py
+++ b/pitivi/reflect.py
@@ -74,9 +74,9 @@ def _importAndCheckStack(importName):
excType, excValue, excTraceback = sys.exc_info()
while excTraceback:
execName = excTraceback.tb_frame.f_globals["__name__"]
- if (execName is None or # python 2.4+, post-cleanup
- execName == importName): # python 2.3, no cleanup
- raise excType, excValue, excTraceback
+ if (execName is None or
+ execName == importName):
+ raise _NoModuleFound()
excTraceback = excTraceback.tb_next
raise _NoModuleFound()
except:
diff --git a/pitivi/settings.py b/pitivi/settings.py
index 0965ae9..3960728 100644
--- a/pitivi/settings.py
+++ b/pitivi/settings.py
@@ -448,7 +448,6 @@ class ExportSettings(Signallable, Loggable):
# TODO : Add PAR/DAR for video
# TODO : switch to using GstFraction internally where appliable
-
muxers, aencoders, vencoders = available_combinations()
def __init__(self, **unused_kw):
diff --git a/pitivi/ui/basetabs.py b/pitivi/ui/basetabs.py
index 9acdd35..c2b1bbe 100644
--- a/pitivi/ui/basetabs.py
+++ b/pitivi/ui/basetabs.py
@@ -22,6 +22,7 @@
import gtk
from pitivi.ui.common import SPACING
+
class BaseTabs(gtk.Notebook):
def __init__(self, app, hide_hpaned=False):
""" initialize """
@@ -91,14 +92,14 @@ class BaseTabs(gtk.Notebook):
self.app.gui.mainhpaned.remove(self.app.gui.secondhpaned)
self.app.gui.secondhpaned.remove(self.app.gui.projecttabs)
self.app.gui.secondhpaned.remove(self.app.gui.propertiestabs)
- self.app.gui.mainhpaned.pack1(self.app.gui.projecttabs, resize= True,
+ self.app.gui.mainhpaned.pack1(self.app.gui.projecttabs, resize=True,
shrink=False)
def _showSecondHpanedInMainWindow(self):
self.app.gui.mainhpaned.remove(self.app.gui.projecttabs)
self.app.gui.secondhpaned.pack1(self.app.gui.projecttabs,
- resize= True, shrink=False)
+ resize=True, shrink=False)
self.app.gui.secondhpaned.pack2(self.app.gui.propertiestabs,
- resize= True, shrink=False)
+ resize=True, shrink=False)
self.app.gui.mainhpaned.pack1(self.app.gui.secondhpaned,
- resize= True, shrink=False)
+ resize=True, shrink=False)
diff --git a/pitivi/ui/clipproperties.py b/pitivi/ui/clipproperties.py
index ccd7348..e66801b 100644
--- a/pitivi/ui/clipproperties.py
+++ b/pitivi/ui/clipproperties.py
@@ -43,10 +43,12 @@ from pitivi.ui import dynamic
COL_DESC_TEXT,
COL_TRACK_EFFECT) = range(5)
+
class ClipPropertiesError(Exception):
"""Base Exception for errors happening in L{ClipProperties}s or L{EffectProperties}s"""
pass
+
class ClipProperties(gtk.VBox, Loggable):
"""
Widget for configuring clips properties
@@ -98,6 +100,7 @@ class ClipProperties(gtk.VBox, Loggable):
return label, info_bar
+
class EffectProperties(gtk.HBox):
"""
Widget for viewing and configuring effects
@@ -118,7 +121,7 @@ class EffectProperties(gtk.HBox):
self.pipeline = None
self.effect_props_handling = effect_properties_handling
self.clip_properties = clip_properties
- self._info_bar = None
+ self._info_bar = None
self._config_ui_h_pos = None
self._timeline = None
@@ -158,8 +161,8 @@ class EffectProperties(gtk.HBox):
activatedcol = self.treeview.insert_column_with_attributes(-1,
_("Activated"),
activatedcell,
- active = COL_ACTIVATED)
- activatedcell.connect("toggled", self._effectActiveToggleCb)
+ active=COL_ACTIVATED)
+ activatedcell.connect("toggled", self._effectActiveToggleCb)
typecol = gtk.TreeViewColumn(_("Type"))
typecol.set_sort_column_id(COL_TYPE)
@@ -399,7 +402,7 @@ class EffectProperties(gtk.HBox):
self._config_ui_h_pos =\
self.app.gui.settings.effectVPanedPosition
if self._config_ui_h_pos is None:
- self._config_ui_h_pos=\
+ self._config_ui_h_pos =\
self.app.gui.settings.mainWindowHeight // 3
if self.selection.get_selected()[1]:
track_effect = self.storemodel.get_value(self.selection.get_selected()[1],
diff --git a/pitivi/ui/common.py b/pitivi/ui/common.py
index a149613..7bf24a1 100644
--- a/pitivi/ui/common.py
+++ b/pitivi/ui/common.py
@@ -18,6 +18,7 @@ TRACK_SPACING = 8
SPACING = 6
PADDING = 6
+
def pack_color_32(red, green, blue, alpha=0xFFFF):
"""Packs the specified 16bit color values in a 32bit RGBA value."""
red = red >> 8
@@ -26,10 +27,12 @@ def pack_color_32(red, green, blue, alpha=0xFFFF):
alpha = alpha >> 8
return (red << 24 | green << 16 | blue << 8 | alpha)
+
def pack_color_64(red, green, blue, alpha=0xFFFF):
"""Packs the specified 16bit color values in a 64bit RGBA value."""
return (red << 48 | green << 32 | blue << 16 | alpha)
+
def unpack_color(value):
"""Unpacks the specified RGBA value into four 16bit color values.
@@ -41,6 +44,7 @@ def unpack_color(value):
else:
return unpack_color_64(value)
+
def unpack_color_32(value):
"""Unpacks the specified 32bit RGBA value into four 16bit color values."""
red = (value >> 24) << 8
@@ -49,6 +53,7 @@ def unpack_color_32(value):
alpha = (value & 0xFF) << 8
return red, green, blue, alpha
+
def unpack_color_64(value):
"""Unpacks the specified 64bit RGBA value into four 16bit color values."""
red = (value >> 48) & 0xFFFF
@@ -57,6 +62,7 @@ def unpack_color_64(value):
alpha = value & 0xFFFF
return red, green, blue, alpha
+
def unpack_cairo_pattern(value):
"""Transforms the specified RGBA value into a SolidPattern object."""
red, green, blue, alpha = unpack_color(value)
@@ -66,6 +72,7 @@ def unpack_cairo_pattern(value):
blue / 65535.0,
alpha / 65535.0)
+
def unpack_cairo_gradient(value):
"""Creates a LinearGradient object out of the specified RGBA value."""
red, green, blue, alpha = unpack_color(value)
@@ -84,8 +91,10 @@ def unpack_cairo_gradient(value):
alpha / 65535.0)
return gradient
+
def beautify_factory(factory):
ranks = {VideoStream: 0, AudioStream: 1, TextStream: 2, MultimediaStream: 3}
+
def stream_sort_key(stream):
return ranks[type(stream)]
@@ -94,6 +103,7 @@ def beautify_factory(factory):
return ("<b>" + escape(unquote(factory.name)) + "</b>\n" +
"\n".join((beautify_stream(stream) for stream in streams)))
+
def factory_name(factory):
return escape(unquote(factory.name))
@@ -113,7 +123,7 @@ def beautify_stream(stream):
if stream.raw:
if stream.framerate.num:
templ = _("<b>Video:</b> %d x %d <i>pixels</i> at %.2f<i>fps</i>")
- templ = templ % (stream.par * stream.width , stream.height,
+ templ = templ % (stream.par * stream.width, stream.height,
float(stream.framerate))
else:
templ = _("<b>Image:</b> %d x %d <i>pixels</i>")
@@ -126,8 +136,9 @@ def beautify_stream(stream):
raise NotImplementedError
+
# from http://cairographics.org/cookbook/roundedrectangles/
-def roundedrec(context,x,y,w,h,r = 10):
+def roundedrec(context, x, y, w, h, r=10):
"Draw a rounded rectangle"
# A****BQ
# H C
@@ -135,17 +146,20 @@ def roundedrec(context,x,y,w,h,r = 10):
# G D
# F****E
- context.move_to(x+r,y) # Move to A
- context.line_to(x+w-r,y) # Straight line to B
- context.curve_to(x+w,y,x+w,y,x+w,y+r) # Curve to C, Control points are both at Q
- context.line_to(x+w,y+h-r) # Move to D
- context.curve_to(x+w,y+h,x+w,y+h,x+w-r,y+h) # Curve to E
- context.line_to(x+r,y+h) # Line to F
- context.curve_to(x,y+h,x,y+h,x,y+h-r) # Curve to G
- context.line_to(x,y+r) # Line to H
- context.curve_to(x,y,x,y,x+r,y) # Curve to A
+ context.move_to(x + r, y) # Move to A
+ context.line_to(x + w - r, y) # Straight line to B
+
+ # Curve to C, Control points are both at Q
+ context.curve_to(x + w, y, x + w, y, x + w, y + r)
+ context.line_to(x + w, y + h - r) # Move to D
+ context.curve_to(x + w, y + h, x + w, y + h, x + w - r, y + h) # Curve to E
+ context.line_to(x + r, y + h) # Line to F
+ context.curve_to(x, y + h, x, y + h, x, y + h - r) # Curve to G
+ context.line_to(x, y + r) # Line to H
+ context.curve_to(x, y, x, y, x + r, y) # Curve to A
return
+
def model(columns, data):
ret = gtk.ListStore(*columns)
for datum in data:
@@ -168,16 +182,16 @@ frame_rates = model((str, object), (
))
audio_rates = model((str, int), (
- (_("8 KHz"), 8000),
- (_("11 KHz"), 11025),
- (_("22 KHz"), 22050),
+ (_("8 KHz"), 8000),
+ (_("11 KHz"), 11025),
+ (_("22 KHz"), 22050),
(_("44.1 KHz"), 44100),
- (_("48 KHz"), 48000),
- (_("96 KHz"), 96000)
+ (_("48 KHz"), 48000),
+ (_("96 KHz"), 96000)
))
audio_depths = model((str, int), (
- (_("8 bit"), 8),
+ (_("8 bit"), 8),
(_("16 bit"), 16),
(_("24 bit"), 24),
(_("32 bit"), 32)
@@ -190,6 +204,7 @@ audio_channels = model((str, int), (
(_("Mono"), 1)
))
+
def set_combo_value(combo, value, default_index=-1):
model = combo.props.model
for i, row in enumerate(model):
@@ -198,6 +213,7 @@ def set_combo_value(combo, value, default_index=-1):
return
combo.set_active(default_index)
+
def get_combo_value(combo):
active = combo.get_active()
return combo.props.model[active][1]
diff --git a/pitivi/ui/controller.py b/pitivi/ui/controller.py
index 8092bbd..1b0dbdf 100644
--- a/pitivi/ui/controller.py
+++ b/pitivi/ui/controller.py
@@ -32,6 +32,7 @@ from pitivi.ui.point import Point
ARROW = gtk.gdk.Cursor(gtk.gdk.ARROW)
+
class Controller(object):
"""A controller which implements drag-and-drop bahavior on connected view
diff --git a/pitivi/ui/curve.py b/pitivi/ui/curve.py
index bb62a5b..5304208 100644
--- a/pitivi/ui/curve.py
+++ b/pitivi/ui/curve.py
@@ -35,6 +35,7 @@ from pitivi.ui.common import LAYER_HEIGHT_EXPANDED, roundedrec
import pitivi.ui.point as point
from pitivi.utils import between
+
def intersect(b1, b2):
return goocanvas.Bounds(max(b1.x1, b2.x1), max(b1.y1, b2.y1),
min(b1.x2, b2.x2), min(b1.y2, b2.y2))
@@ -56,6 +57,7 @@ KW_LABEL_VPAD2 = KW_LABEL_VPAD / 2
CURVE_STROKE_WIDTH = 2.0
HAND = gtk.gdk.Cursor(gtk.gdk.HAND2)
+
class Curve(goocanvas.ItemSimple, goocanvas.Item, View, Zoomable):
__gtype_name__ = 'Curve'
@@ -123,7 +125,7 @@ class Curve(goocanvas.ItemSimple, goocanvas.Item, View, Zoomable):
interpolator.range) + interpolator.lower
return time, value
- def enter(self, item ,target):
+ def enter(self, item, target):
coords = self.from_item_event(item, self._last_event)
self._kf = self._view.findKeyframe(coords)
self._view.setFocusedKf(self._kf)
@@ -151,7 +153,8 @@ class Curve(goocanvas.ItemSimple, goocanvas.Item, View, Zoomable):
def _get_height(self):
return self._height
- def _set_height (self, value):
+
+ def _set_height(self, value):
self._height = value
self._min = CURVE_STROKE_WIDTH / 2
self._max = value - (CURVE_STROKE_WIDTH / 2)
diff --git a/pitivi/ui/dynamic.py b/pitivi/ui/dynamic.py
index d593e29..78cc479 100644
--- a/pitivi/ui/dynamic.py
+++ b/pitivi/ui/dynamic.py
@@ -34,6 +34,7 @@ from pitivi.ui.common import unpack_color, pack_color_32, pack_color_64
import pango
from pitivi.ui.common import PADDING, SPACING
+
class DynamicWidget(object):
"""An interface which provides a uniform way to get, set, and observe
@@ -60,15 +61,15 @@ class DynamicWidget(object):
if self.default is not None:
self.setWidgetValue(self.default)
+
class DefaultWidget(gtk.Label, DynamicWidget):
"""When all hope fails...."""
- def __init__(self, default = None, *unused, **kw_unused):
+ def __init__(self, default=None, *unused, **kw_unused):
gtk.Label.__init__(self, _("Implement Me"))
DynamicWidget.__init__(self, default)
-
def connectValueChanged(self, callback, *args):
pass
@@ -87,7 +88,7 @@ class TextWidget(gtk.HBox, DynamicWidget):
__gtype_name__ = 'TextWidget'
__gsignals__ = {
- "value-changed" : (
+ "value-changed": (
gobject.SIGNAL_RUN_LAST,
gobject.TYPE_NONE,
(),)
@@ -96,7 +97,7 @@ class TextWidget(gtk.HBox, DynamicWidget):
__INVALID__ = gtk.gdk.Color(0xFFFF, 0, 0)
__NORMAL__ = gtk.gdk.Color(0, 0, 0)
- def __init__(self, matches = None, choices = None, default = None):
+ def __init__(self, matches=None, choices=None, default=None):
gtk.HBox.__init__(self)
DynamicWidget.__init__(self, default)
@@ -128,7 +129,7 @@ class TextWidget(gtk.HBox, DynamicWidget):
def connectValueChanged(self, callback, *args):
return self.connect("value-changed", callback, *args)
- def setWidgetValue(self, value, send_signal = True):
+ def setWidgetValue(self, value, send_signal=True):
self.send_signal = send_signal
self.text.set_text(value)
@@ -177,7 +178,7 @@ class NumericWidget(gtk.HBox, DynamicWidget):
SpinButton is always displayed, while the HScale only appears if both
lower and upper bounds are defined"""
- def __init__(self, upper = None, lower = None, default=None):
+ def __init__(self, upper=None, lower=None, default=None):
gtk.HBox.__init__(self)
DynamicWidget.__init__(self, default)
@@ -234,6 +235,7 @@ class NumericWidget(gtk.HBox, DynamicWidget):
self.adjustment.set_all(value, minimum, maximum, step, page, 0)
self.spinner.set_adjustment(self.adjustment)
+
class TimeWidget(TextWidget, DynamicWidget):
""" A widget that contains a time in nanosconds"""
@@ -255,13 +257,13 @@ class TimeWidget(TextWidget, DynamicWidget):
+ int(ss) * 10e9 \
+ int(xxx) * 10e6
- nanosecs = nanosecs / 10 # Compensate the 10 factor of e notation
+ nanosecs = nanosecs / 10 # Compensate the 10 factor of e notation
return nanosecs
- def setWidgetValue(self, value, send_signal = True):
+ def setWidgetValue(self, value, send_signal=True):
TextWidget.setWidgetValue(self, time_to_string(value),
- send_signal = send_signal)
+ send_signal=send_signal)
def connectFocusEvents(self, focusInCb, focusOutCb):
fIn = self.text.connect("button-press-event", focusInCb)
@@ -355,6 +357,7 @@ class FractionWidget(TextWidget, DynamicWidget):
denom = float(groups[2][1:])
return gst.Fraction(num, denom)
+
class ToggleWidget(gtk.CheckButton, DynamicWidget):
"""A gtk.CheckButton which supports the DynamicWidget interface."""
@@ -372,6 +375,7 @@ class ToggleWidget(gtk.CheckButton, DynamicWidget):
def getWidgetValue(self):
return self.get_active()
+
class ChoiceWidget(gtk.HBox, DynamicWidget):
"""Abstractly, represents a choice between a list of named values. The
@@ -414,6 +418,7 @@ class ChoiceWidget(gtk.HBox, DynamicWidget):
else:
self.contents.set_sensitive(True)
+
class PresetChoiceWidget(gtk.HBox, DynamicWidget):
"""A popup which manages preset settings on a group of widgets supporting
@@ -547,17 +552,17 @@ class PathWidget(gtk.FileChooserButton, DynamicWidget):
__gtype_name__ = 'PathWidget'
__gsignals__ = {
- "value-changed" : (gobject.SIGNAL_RUN_LAST,
+ "value-changed": (gobject.SIGNAL_RUN_LAST,
gobject.TYPE_NONE,
()),
}
- def __init__(self, action = gtk.FILE_CHOOSER_ACTION_OPEN, default=None):
+ def __init__(self, action=gtk.FILE_CHOOSER_ACTION_OPEN, default=None):
DynamicWidget.__init__(self, default)
self.dialog = gtk.FileChooserDialog(
- action = action,
- buttons = (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_CLOSE,
- gtk.RESPONSE_CLOSE))
+ action=action,
+ buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_CLOSE,
+ gtk.RESPONSE_CLOSE))
self.dialog.set_default_response(gtk.RESPONSE_OK)
gtk.FileChooserButton.__init__(self, self.dialog)
self.set_title(_("Choose..."))
@@ -580,9 +585,10 @@ class PathWidget(gtk.FileChooserButton, DynamicWidget):
self.emit("value-changed")
self.dialog.hide()
+
class ColorWidget(gtk.ColorButton, DynamicWidget):
- def __init__(self, value_type=str, default= None):
+ def __init__(self, value_type=str, default=None):
gtk.ColorButton.__init__(self)
DynamicWidget.__init__(self, default)
self.value_type = value_type
@@ -619,9 +625,10 @@ class ColorWidget(gtk.ColorButton, DynamicWidget):
return color
return color.to_string()
+
class FontWidget(gtk.FontButton, DynamicWidget):
- def __init__(self, default = None):
+ def __init__(self, default=None):
gtk.FontButton.__init__(self)
DynamicWidget.__init__(self, default)
self.set_use_font(True)
@@ -635,9 +642,10 @@ class FontWidget(gtk.FontButton, DynamicWidget):
def getWidgetValue(self):
return self.get_font_name()
+
class ResolutionWidget(gtk.HBox, DynamicWidget):
- def __init__(self, default = None):
+ def __init__(self, default=None):
gtk.HBox.__init__(self)
DynamicWidget.__init__(self, default)
self.props.spacing = 6
@@ -695,11 +703,7 @@ if __name__ == '__main__':
gst.Fraction(1, 1),
gst.Fraction(30000, 1001)
),
- (
- "25:1",
- gst.Fraction(30,1),
- "30M",
- ),
+ ("25:1", gst.Fraction(30, 1), "30M", ),
)
),
)
diff --git a/pitivi/ui/effectlist.py b/pitivi/ui/effectlist.py
index 308d759..5fa4e0f 100644
--- a/pitivi/ui/effectlist.py
+++ b/pitivi/ui/effectlist.py
@@ -57,6 +57,7 @@ GlobalSettings.addConfigOption('lastEffectView',
INVISIBLE = gtk.gdk.pixbuf_new_from_file(os.path.join(get_pixmap_dir(),
"invisible.png"))
+
class EffectList(gtk.VBox, Loggable):
""" Widget for listing effects """
@@ -77,7 +78,6 @@ class EffectList(gtk.VBox, Loggable):
self._current_effect_name = None
self._current_tooltip_icon = None
-
#Searchbox and combobox
hfilters = gtk.HBox()
hfilters.set_spacing(SPACING)
@@ -88,7 +88,6 @@ class EffectList(gtk.VBox, Loggable):
self.effectCategory = gtk.combo_box_new_text()
self.effectType.set_active(VIDEO_EFFECT)
-
hfilters.pack_start(self.effectType, expand=True)
hfilters.pack_end(self.effectCategory, expand=True)
@@ -169,14 +168,14 @@ class EffectList(gtk.VBox, Loggable):
self.treeview.connect("motion-notify-event", self._motionNotifyEventCb)
self.treeview.connect("query-tooltip", self._queryTooltipCb)
self.treeview.connect("button-release-event", self._buttonReleaseCb)
- self.treeview.drag_source_set(0,[], gtk.gdk.ACTION_COPY)
+ self.treeview.drag_source_set(0, [], gtk.gdk.ACTION_COPY)
self.treeview.connect("drag_begin", self._dndDragBeginCb)
self.treeview.connect("drag_data_get", self._dndDataGetCb)
self.iconview.connect("button-press-event", self._buttonPressEventCb)
self.iconview.connect("activate-cursor-item", self._enterPressEventCb)
self.iconview.connect("query-tooltip", self._queryTooltipCb)
- self.iconview.drag_source_set(0,[], gtk.gdk.ACTION_COPY)
+ self.iconview.drag_source_set(0, [], gtk.gdk.ACTION_COPY)
self.iconview.connect("motion-notify-event", self._motionNotifyEventCb)
self.iconview.connect("button-release-event", self._buttonReleaseCb)
self.iconview.connect("drag_begin", self._dndDragBeginCb)
@@ -231,9 +230,9 @@ class EffectList(gtk.VBox, Loggable):
def _addFactories(self, elements, effectType):
for element in elements:
- name =element.get_name()
+ name = element.get_name()
effect = self.app.effects.getFactoryFromName(name)
- self.storemodel.append([ effect.getHumanName(),
+ self.storemodel.append([effect.getHumanName(),
effect.getDescription(), effectType,
effect.getCategories(),
effect, name,
@@ -297,7 +296,7 @@ class EffectList(gtk.VBox, Loggable):
return view.path_is_selected(path) and len(selection)
return False
- def _enterPressEventCb(self, view, event = None):
+ def _enterPressEventCb(self, view, event=None):
factory_name = self.getSelectedItems()
self.app.gui.clipconfig.effect_expander.addEffectToCurrentSelection(factory_name)
@@ -395,7 +394,7 @@ class EffectList(gtk.VBox, Loggable):
txt = "<b>%s:</b>\n%s" % (longname, description)
if self.effect_view == SHOW_ICONVIEW:
tooltip.set_icon(None)
- else :
+ else:
tooltip.set_icon(self._current_tooltip_icon)
tooltip.set_markup(txt)
@@ -434,10 +433,10 @@ class EffectList(gtk.VBox, Loggable):
def _effectCategoryChangedCb(self, combobox):
self.modelFilter.refilter()
- def searchEntryChangedCb (self, entry):
+ def searchEntryChangedCb(self, entry):
self.modelFilter.refilter()
- def searchEntryIconClickedCb (self, entry, unused, unsed1):
+ def searchEntryIconClickedCb(self, entry, unused, unsed1):
entry.set_text("")
def searchEntryDesactvateCb(self, entry, event):
diff --git a/pitivi/ui/effectsconfiguration.py b/pitivi/ui/effectsconfiguration.py
index aa69e04..0e92871 100644
--- a/pitivi/ui/effectsconfiguration.py
+++ b/pitivi/ui/effectsconfiguration.py
@@ -27,6 +27,7 @@ from pitivi.ui.dynamic import FractionWidget
PROPS_TO_IGNORE = ['name', 'qos', 'silent', 'message']
+
class EffectsPropertiesHandling:
def __init__(self, action_log):
self.cache_dict = {}
@@ -65,7 +66,7 @@ class EffectsPropertiesHandling:
return self.cache_dict[effect]
def cleanCache(self, effect):
- if self.cache_dict.has_key(effect):
+ if effect in self.cache_dict:
conf_ui = self.cache_dict.get(effect)
self.cache_dict.pop(effect)
return conf_ui
@@ -97,7 +98,7 @@ class EffectsPropertiesHandling:
#FIXME Workaround in order to make aspectratiocrop working
if isinstance(value, gst.Fraction):
- value = gst.Fraction(int(value.num),int(value.denom))
+ value = gst.Fraction(int(value.num), int(value.denom))
if value != self._current_element_values.get(prop.name):
self.action_log.begin("Effect property change")
diff --git a/pitivi/ui/encodingdialog.py b/pitivi/ui/encodingdialog.py
index e3212f0..3cdcd03 100644
--- a/pitivi/ui/encodingdialog.py
+++ b/pitivi/ui/encodingdialog.py
@@ -61,7 +61,7 @@ def extension_for_muxer(muxer):
"""Returns the file extension appropriate for the specified muxer."""
exts = {
"asfmux": "asf",
- "avimux" : "avi",
+ "avimux": "avi",
"ffmux_3g2": "3g2",
"ffmux_avm2": "avm2",
"ffmux_dvd": "vob",
@@ -77,15 +77,15 @@ def extension_for_muxer(muxer):
"ffmux_vob": "vob",
"flvmux": "flv",
"gppmux": "3gp",
- "matroskamux" : "mkv",
+ "matroskamux": "mkv",
"mj2mux": "mj2",
"mp4mux": "mp4",
"mpegpsmux": "mpeg",
"mpegtsmux": "mpeg",
"mvemux": "mve",
- "mxfmux" : "mxf",
- "oggmux" : "ogv",
- "qtmux" : "mov",
+ "mxfmux": "mxf",
+ "oggmux": "ogv",
+ "qtmux": "mov",
"webmmux": "webm"}
return exts.get(muxer)
@@ -93,7 +93,7 @@ def extension_for_muxer(muxer):
def factorylist(factories):
"""Create a gtk.ListStore() of sorted, beautified factory names.
- @param factories: The factories available for creating the list.
+ @param factories: The factories available for creating the list.
@type factories: A sequence of gst.ElementFactory instances.
"""
columns = (str, object)
@@ -371,7 +371,7 @@ class EncodingDialog(Renderer, Loggable):
self.outfile = os.path.join(self.filebutton.get_uri(),
self.fileentry.get_text())
self.progress = EncodingProgressDialog(self.app, self)
- self.window.hide() # Hide the rendering settings dialog while rendering
+ self.window.hide() # Hide the rendering settings dialog while rendering
self.progress.window.show()
self.startAction()
self.progress.connect("cancel", self._cancelRender)
diff --git a/pitivi/ui/encodingprogress.py b/pitivi/ui/encodingprogress.py
index f33003b..8ad8462 100644
--- a/pitivi/ui/encodingprogress.py
+++ b/pitivi/ui/encodingprogress.py
@@ -31,6 +31,7 @@ from gettext import gettext as _
import gobject
from pitivi.signalinterface import Signallable
+
class EncodingProgressDialog(Signallable):
__signals__ = {
"pause": [],
diff --git a/pitivi/ui/filechooserpreview.py b/pitivi/ui/filechooserpreview.py
index c9aca5b..b9d5492 100644
--- a/pitivi/ui/filechooserpreview.py
+++ b/pitivi/ui/filechooserpreview.py
@@ -146,7 +146,7 @@ class PreviewWidget(gtk.VBox, Loggable):
self.log("Preview request for " + uri)
self.clear_preview()
self.current_selected_uri = uri
- if uri in self.preview_cache: # Already discovered
+ if uri in self.preview_cache: # Already discovered
self.log(uri + " already in cache")
self.show_preview(uri)
elif uri in self.preview_cache_errors:
@@ -208,7 +208,7 @@ class PreviewWidget(gtk.VBox, Loggable):
self.player.set_state(gst.STATE_PAUSED)
self.clip_duration = factory.duration
self.pos_adj.upper = self.clip_duration
- w, h = self.__get_best_size(video.par*video.width, video.height)
+ w, h = self.__get_best_size(video.par * video.width, video.height)
self.preview_video.set_size_request(w, h)
self.preview_video.show()
self.bbox.show()
@@ -216,8 +216,8 @@ class PreviewWidget(gtk.VBox, Loggable):
self.seeker.show()
self.b_zoom_in.show()
self.b_zoom_out.show()
- self.description = _("<b>Resolution</b>: %dx%d") % (video.par*video.width, video.height) + "\n" + \
- _("<b>Duration</b>: %s") % (duration) + "\n"
+ self.description = _("<b>Resolution</b>: %dx%d") % (video.par * video.width,
+ video.height) + "\n" + _("<b>Duration</b>: %s") % (duration) + "\n"
else:
self.current_preview_type = 'audio'
self.preview_video.hide()
diff --git a/pitivi/ui/filelisterrordialog.py b/pitivi/ui/filelisterrordialog.py
index caeb9c4..8536615 100644
--- a/pitivi/ui/filelisterrordialog.py
+++ b/pitivi/ui/filelisterrordialog.py
@@ -34,6 +34,7 @@ from pitivi.configure import get_ui_dir
from pitivi.signalinterface import Signallable
from pitivi.log.loggable import Loggable
+
class FileListErrorDialog(Signallable, Loggable):
""" Dialog box for showing errors in a list of files """
__signals__ = {
@@ -78,7 +79,6 @@ class FileListErrorDialog(Signallable, Loggable):
else:
exp = gtk.Expander(reason)
-
textbuffer = gtk.TextBuffer()
table = textbuffer.get_tag_table()
boldtag = gtk.TextTag()
diff --git a/pitivi/ui/gstwidget.py b/pitivi/ui/gstwidget.py
index 2a4aa6f..76d0b1d 100644
--- a/pitivi/ui/gstwidget.py
+++ b/pitivi/ui/gstwidget.py
@@ -33,6 +33,7 @@ from pitivi.log.loggable import Loggable
from pitivi.configure import get_ui_dir
import pitivi.ui.dynamic as dynamic
+
def make_property_widget(unused_element, prop, value=None):
""" Creates a Widget for the given element property """
# FIXME : implement the case for flags
@@ -45,7 +46,7 @@ def make_property_widget(unused_element, prop, value=None):
elif (type_name in ['guint64', 'gint64', 'guint', 'gint', 'gfloat',
'gulong', 'gdouble']):
- maximum , minimum = None, None
+ maximum, minimum = None, None
if hasattr(prop, "minimum"):
minimum = prop.minimum
if hasattr(prop, "maximum"):
@@ -70,6 +71,7 @@ def make_property_widget(unused_element, prop, value=None):
return widget
+
class GstElementSettingsWidget(gtk.VBox, Loggable):
"""
Widget to view/modify properties of a gst.Element
@@ -84,7 +86,7 @@ class GstElementSettingsWidget(gtk.VBox, Loggable):
self.buttons = {}
def setElement(self, element, properties={}, ignore=['name'],
- default_btn = False, use_element_props=False):
+ default_btn=False, use_element_props=False):
""" Set given element on Widget, with optional properties """
self.info("element:%s, use properties:%s", element, properties)
self.element = element
@@ -116,23 +118,23 @@ class GstElementSettingsWidget(gtk.VBox, Loggable):
or not prop.flags & gobject.PARAM_READABLE:
continue
- label = gtk.Label(prop.nick+":")
+ label = gtk.Label(prop.nick + ":")
label.set_alignment(0.0, 0.5)
- table.attach(label, 0, 1, y, y+1, xoptions=gtk.FILL, yoptions=gtk.FILL)
+ table.attach(label, 0, 1, y, y + 1, xoptions=gtk.FILL, yoptions=gtk.FILL)
if use_element_props:
- prop_value = self.element.get_property(prop.name)
+ prop_value = self.element.get_property(prop.name)
else:
prop_value = properties.get(prop.name)
widget = make_property_widget(self.element, prop, prop_value)
- if hasattr(prop, 'description'): #TODO: check that
+ if hasattr(prop, 'description'): # TODO: check that
widget.set_tooltip_text(prop.description)
- table.attach(widget, 1, 2, y, y+1, yoptions=gtk.FILL)
+ table.attach(widget, 1, 2, y, y + 1, yoptions=gtk.FILL)
self.properties[prop] = widget
if default_btn:
button = self._getResetToDefaultValueButton(prop, widget)
- table.attach(button, 2, 3, y, y+1, xoptions=gtk.FILL, yoptions=gtk.FILL)
+ table.attach(button, 2, 3, y, y + 1, xoptions=gtk.FILL, yoptions=gtk.FILL)
self.buttons[button] = widget
self.element.connect('notify::' + prop.name,
self._propertyChangedCb,
@@ -173,7 +175,6 @@ class GstElementSettingsWidget(gtk.VBox, Loggable):
return d
-
class GstElementSettingsDialog(Loggable):
"""
Dialog window for viewing/modifying properties of a gst.Element
diff --git a/pitivi/ui/mainwindow.py b/pitivi/ui/mainwindow.py
index beef18a..47fa12c 100644
--- a/pitivi/ui/mainwindow.py
+++ b/pitivi/ui/mainwindow.py
@@ -122,20 +122,22 @@ GlobalSettings.addConfigOption('lastExportFolder',
GlobalSettings.addConfigOption('elementSettingsDialogWidth',
section='export',
key='element-settings-dialog-width',
- default = 620)
+ default=620)
GlobalSettings.addConfigOption('elementSettingsDialogHeight',
section='export',
key='element-settings-dialog-height',
- default = 460)
+ default=460)
GlobalSettings.addConfigSection("effect-configuration")
GlobalSettings.addConfigOption('effectVPanedPosition',
section='effect-configuration',
key='effect-vpaned-position',
type_=int)
+
def supported(info):
return formatter.can_handle_location(info[1])
+
def create_stock_icons():
""" Creates the pitivi-only stock icons """
gtk.stock_add([
@@ -150,13 +152,13 @@ def create_stock_icons():
('pitivi-group', _('Group'), 0, 0, 'pitivi'),
])
pixmaps = {
- "pitivi-render" : "pitivi-render-24.png",
- "pitivi-split" : "pitivi-split-24.svg",
- "pitivi-keyframe" : "pitivi-keyframe-24.svg",
- "pitivi-unlink" : "pitivi-unlink-24.svg",
- "pitivi-link" : "pitivi-relink-24.svg",
- "pitivi-ungroup" : "pitivi-ungroup-24.svg",
- "pitivi-group" : "pitivi-group-24.svg",
+ "pitivi-render": "pitivi-render-24.png",
+ "pitivi-split": "pitivi-split-24.svg",
+ "pitivi-keyframe": "pitivi-keyframe-24.svg",
+ "pitivi-unlink": "pitivi-unlink-24.svg",
+ "pitivi-link": "pitivi-relink-24.svg",
+ "pitivi-ungroup": "pitivi-ungroup-24.svg",
+ "pitivi-group": "pitivi-group-24.svg",
}
factory = gtk.IconFactory()
pmdir = get_pixmap_dir()
@@ -176,8 +178,6 @@ class PitiviMainWindow(gtk.Window, Loggable):
@cvar project: The current project
@type project: L{Project}
"""
-
-
def __init__(self, instance):
""" initialize with the Pitivi object """
gtk.Window.__init__(self)
@@ -266,7 +266,7 @@ class PitiviMainWindow(gtk.Window, Loggable):
None, _("Reload the current project"), self._revertToSavedProjectCb),
("ProjectSettings", gtk.STOCK_PROPERTIES, _("Project Settings"),
None, _("Edit the project settings"), self._projectSettingsCb),
- ("RenderProject", 'pitivi-render' , _("_Render project"),
+ ("RenderProject", 'pitivi-render', _("_Render project"),
None, _("Render project..."), self._recordCb),
("Undo", gtk.STOCK_UNDO,
_("_Undo"),
@@ -424,7 +424,7 @@ class PitiviMainWindow(gtk.Window, Loggable):
gtk.Label(_("Effects configurations")))
self.clipconfig.show()
- self.secondhpaned.pack2(self.propertiestabs, resize= True, shrink=False)
+ self.secondhpaned.pack2(self.propertiestabs, resize=True, shrink=False)
self.propertiestabs.show()
# Viewer
@@ -558,7 +558,6 @@ class PitiviMainWindow(gtk.Window, Loggable):
self.settings.mainWindowShowMainToolbar = mtb.props.active
self.settings.mainWindowShowTimelineToolbar = ttb.props.active
-
def _sourceListPlayCb(self, sourcelist, factory):
self._viewFactory(factory)
@@ -749,7 +748,7 @@ class PitiviMainWindow(gtk.Window, Loggable):
Zoomable.setZoomLevel(nearest_zoom_level)
def _projectManagerNewProjectLoadingCb(self, projectManager, uri):
- if uri != None :
+ if uri != None:
self.manager.add_item(uri)
self.log("A NEW project is being loaded, deactivate UI")
@@ -800,14 +799,14 @@ class PitiviMainWindow(gtk.Window, Loggable):
"changes will be lost")
# put the text in a vbox
- vbox = gtk.VBox(False, SPACING*2)
+ vbox = gtk.VBox(False, SPACING * 2)
vbox.pack_start(primary, expand=True, fill=True)
vbox.pack_start(secondary, expand=True, fill=True)
# make the [[image] text] hbox
image = gtk.image_new_from_stock(gtk.STOCK_DIALOG_WARNING,
gtk.ICON_SIZE_DIALOG)
- hbox = gtk.HBox(False, SPACING*2)
+ hbox = gtk.HBox(False, SPACING * 2)
hbox.pack_start(image, expand=False)
hbox.pack_start(vbox, expand=True, fill=True)
action_area = dialog.get_action_area()
@@ -816,7 +815,7 @@ class PitiviMainWindow(gtk.Window, Loggable):
# stuff the hbox in the dialog
content_area = dialog.get_content_area()
content_area.pack_start(hbox, expand=True, fill=True)
- content_area.set_spacing(SPACING*2)
+ content_area.set_spacing(SPACING * 2)
hbox.show_all()
response = dialog.run()
@@ -861,11 +860,10 @@ class PitiviMainWindow(gtk.Window, Loggable):
dialog.set_transient_for(self)
response = dialog.run()
dialog.destroy()
- if response <> gtk.RESPONSE_YES:
+ if response != gtk.RESPONSE_YES:
return False
return True
-
def _projectManagerNewProjectFailedCb(self, projectManager, uri, exception):
project_filename = unquote(uri.split("/")[-1])
dialog = gtk.MessageDialog(self,
@@ -888,7 +886,7 @@ class PitiviMainWindow(gtk.Window, Loggable):
buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
gtk.STOCK_OPEN, gtk.RESPONSE_OK))
dialog.set_icon_name("pitivi")
- dialog.set_border_width(SPACING*2)
+ dialog.set_border_width(SPACING * 2)
dialog.get_content_area().set_spacing(SPACING)
dialog.set_transient_for(self)
@@ -1126,7 +1124,7 @@ class PitiviMainWindow(gtk.Window, Loggable):
self.viewer.play()
def _timelineSeekCb(self, ruler, position, format):
- self.debug("position:%s", gst.TIME_ARGS (position))
+ self.debug("position:%s", gst.TIME_ARGS(position))
if self.viewer.action != self.project.view_action:
self.viewer.setPipeline(None)
self.viewer.hideSlider()
diff --git a/pitivi/ui/pathwalker.py b/pitivi/ui/pathwalker.py
index 9de61a2..25fbc60 100644
--- a/pitivi/ui/pathwalker.py
+++ b/pitivi/ui/pathwalker.py
@@ -25,12 +25,14 @@ from urllib import quote, unquote
from urlparse import urlsplit, urlunsplit
from pitivi.threads import Thread
+
def quote_uri(uri):
parts = list(urlsplit(uri, allow_fragments=False))
parts[2] = quote(parts[2])
uri = urlunsplit(parts)
return uri
+
class PathWalker(Thread):
"""
Thread for recursively searching in a list of directories
diff --git a/pitivi/ui/point.py b/pitivi/ui/point.py
index 1b55bf5..3782a75 100644
--- a/pitivi/ui/point.py
+++ b/pitivi/ui/point.py
@@ -1,5 +1,6 @@
from itertools import izip
+
class Point(tuple):
def __new__(cls, x, y):
diff --git a/pitivi/ui/prefs.py b/pitivi/ui/prefs.py
index 98a66b5..15f6292 100644
--- a/pitivi/ui/prefs.py
+++ b/pitivi/ui/prefs.py
@@ -34,14 +34,15 @@ from pitivi.ui.common import SPACING
from gettext import gettext as _
GlobalSettings.addConfigOption('prefsDialogWidth',
- section = "user-interface",
- key = "prefs-dialog-width",
- default = 600)
+ section="user-interface",
+ key="prefs-dialog-width",
+ default=600)
GlobalSettings.addConfigOption('prefsDialogHeight',
- section = "user-interface",
- key = "prefs-dialog-height",
- default = 400)
+ section="user-interface",
+ key="prefs-dialog-height",
+ default=400)
+
class PreferencesDialog():
@@ -124,7 +125,7 @@ class PreferencesDialog():
@classmethod
def addNumericPreference(cls, attrname, label, description, section=None,
- upper = None, lower = None):
+ upper=None, lower=None):
"""
Add an auto-generated user preference that will show up as either a
gtk.SpinButton or a gtk.HScale, depending whether both the upper and lower
@@ -148,7 +149,7 @@ class PreferencesDialog():
@classmethod
def addTextPreference(cls, attrname, label, description, section=None,
- matches = None):
+ matches=None):
"""
Add an auto-generated user preference that will show up as either a
gtk.SpinButton or a gtk.HScale, depending on the upper and lower
@@ -245,9 +246,7 @@ class PreferencesDialog():
cls.addPreference(attrname, label, description, section,
dynamic.FontWidget)
-
## Implementation
-
def _fillContents(self):
self.sections = {}
for section in sorted(self.prefs):
@@ -270,7 +269,7 @@ class PreferencesDialog():
self.widgets[attrname] = widget
revert = gtk.Button(_("Reset"))
revert.set_sensitive(not self.settings.isDefault(attrname))
- revert.connect("clicked", self._resetOptionCb, attrname)
+ revert.connect("clicked", self._resetOptionCb, attrname)
self.resets[attrname] = revert
prefs[label] = (label_widget, widget, revert)
@@ -382,54 +381,53 @@ if False:
## Numeric
PreferencesDialog.addNumericPreference('numericPreference1',
- label = "Open Range",
- section = "Test",
- description = "This option has no upper bound",
- lower = -10)
+ label="Open Range",
+ section="Test",
+ description="This option has no upper bound",
+ lower=-10)
PreferencesDialog.addNumericPreference('numericPreference2',
- label = "Closed Range",
- section = "Test",
- description = "This option has both upper and lower bounds",
- lower = -10,
- upper = 10000)
+ label="Closed Range",
+ section="Test",
+ description="This option has both upper and lower bounds",
+ lower=-10,
+ upper=10000)
## Text
PreferencesDialog.addTextPreference('textPreference1',
- label = "Unfiltered",
- section = "Test",
- description = "Anything can go in this box")
+ label="Unfiltered",
+ section="Test",
+ description="Anything can go in this box")
PreferencesDialog.addTextPreference('textPreference2',
- label = "Numbers only",
- section = "Test",
- description = "This input validates its input with a regex",
- matches = "^-?\d+(\.\d+)?$")
+ label="Numbers only",
+ section="Test",
+ description="This input validates its input with a regex",
+ matches="^-?\d+(\.\d+)?$")
## other
-
PreferencesDialog.addPathPreference('aPathPreference',
- label = "Test Path",
- section = "Test",
- description = "Test the path widget")
+ label="Test Path",
+ section="Test",
+ description="Test the path widget")
PreferencesDialog.addChoicePreference('aChoicePreference',
- label = "Swallow Velocity",
- section = "Test",
- description = "What is the velocity of an african swollow laden " \
+ label="Swallow Velocity",
+ section="Test",
+ description="What is the velocity of an african swollow laden " \
"a coconut?",
- choices = (
+ choices=(
("42 Knots", 32),
("9 furlongs per fortnight", 42),
("I don't know that!", None)))
PreferencesDialog.addChoicePreference('aLongChoicePreference',
- label = "Favorite Color",
- section = "Test",
- description = "What is the velocity of an african swollow laden " \
+ label="Favorite Color",
+ section="Test",
+ description="What is the velocity of an african swollow laden " \
"a coconut?",
- choices = (
+ choices=(
("Mauve", "Mauve"),
("Chartreuse", "Chartreuse"),
("Magenta", "Magenta"),
@@ -438,11 +436,11 @@ if False:
("Yellow Ochre", "Yellow Ochre")))
PreferencesDialog.addTogglePreference('aTogglePreference',
- label = "Test Toggle",
- section = "Test",
- description = "Test the toggle widget")
+ label="Test Toggle",
+ section="Test",
+ description="Test the toggle widget")
PreferencesDialog.addFontPreference('aFontPreference',
- label = "Foo Font",
- section = "Test",
- description = "Test the font widget")
+ label="Foo Font",
+ section="Test",
+ description="Test the font widget")
diff --git a/pitivi/ui/preset.py b/pitivi/ui/preset.py
index 52520b7..e85773c 100644
--- a/pitivi/ui/preset.py
+++ b/pitivi/ui/preset.py
@@ -27,6 +27,7 @@ import os.path
import gtk
import gst
+
class PresetManager(object):
def __init__(self):
@@ -123,6 +124,7 @@ class PresetManager(object):
return any((values[field] != getter() for field, (setter, getter)
in self.widget_map.iteritems()))
+
class VideoPresetManager(PresetManager):
filename = "video_presets"
@@ -160,6 +162,7 @@ class VideoPresetManager(PresetManager):
parser.set(section, "par-denom",
str(int(values["par"].denom)))
+
class AudioPresetManager(PresetManager):
filename = "audio_presets"
diff --git a/pitivi/ui/preview.py b/pitivi/ui/preview.py
index 23d1348..c9fc636 100644
--- a/pitivi/ui/preview.py
+++ b/pitivi/ui/preview.py
@@ -31,13 +31,16 @@ from pitivi.receiver import receiver, handler
from pitivi.ui.zoominterface import Zoomable
import pitivi.ui.previewer as previewer
+
def between(a, b, c):
return (a <= b) and (b <= c)
+
def intersect(b1, b2):
return goocanvas.Bounds(max(b1.x1, b2.x1), max(b1.y1, b2.y1),
min(b1.x2, b2.x2), min(b1.y2, b2.y2))
+
class Preview(goocanvas.ItemSimple, goocanvas.Item, Zoomable):
__gtype_name__ = 'Preview'
@@ -56,7 +59,8 @@ class Preview(goocanvas.ItemSimple, goocanvas.Item, Zoomable):
def _get_height(self):
return self._height
- def _set_height (self, value):
+
+ def _set_height(self, value):
self._height = value
self.changed(True)
height = gobject.property(_get_height, _set_height, type=float)
diff --git a/pitivi/ui/previewer.py b/pitivi/ui/previewer.py
index d0ce1f0..012c2fd 100644
--- a/pitivi/ui/previewer.py
+++ b/pitivi/ui/previewer.py
@@ -70,29 +70,29 @@ GlobalSettings.addConfigOption("thumbnailCacheSize",
GlobalSettings.addConfigOption("thumbnailMaxRequests",
section="thumbnailing",
key="max-requests",
- default = 10)
+ default=10)
GlobalSettings.addConfigOption('showThumbnails',
- section = 'user-interface',
- key = 'show-thumbnails',
- default = True,
- notify = True)
+ section='user-interface',
+ key='show-thumbnails',
+ default=True,
+ notify=True)
PreferencesDialog.addTogglePreference('showThumbnails',
- section = _("Appearance"),
- label = _("Show Thumbnails (Video)"),
- description = _("Show Thumbnails on Video Clips"))
+ section=_("Appearance"),
+ label=_("Show Thumbnails (Video)"),
+ description=_("Show Thumbnails on Video Clips"))
GlobalSettings.addConfigOption('showWaveforms',
- section = 'user-interface',
- key = 'show-waveforms',
- default = True,
- notify = True)
+ section='user-interface',
+ key='show-waveforms',
+ default=True,
+ notify=True)
PreferencesDialog.addTogglePreference('showWaveforms',
- section = _("Appearance"),
- label = _("Show Waveforms (Audio)"),
- description = _("Show Waveforms on Audio Clips"))
+ section=_("Appearance"),
+ label=_("Show Waveforms (Audio)"),
+ description=_("Show Waveforms on Audio Clips"))
# Previewer -- abstract base class with public interface for UI
# |_DefaultPreviewer -- draws a default thumbnail for UI
@@ -106,6 +106,7 @@ PreferencesDialog.addTogglePreference('showWaveforms',
previewers = {}
+
def get_preview_for_object(instance, trackobject):
factory = trackobject.factory
stream_ = trackobject.stream
@@ -127,10 +128,11 @@ def get_preview_for_object(instance, trackobject):
previewers[key] = DefaultPreviewer(instance, factory, stream_)
return previewers[key]
+
class Previewer(Signallable, Loggable):
__signals__ = {
- "update" : ("segment",),
+ "update": ("segment",),
}
# TODO: parameterize height, instead of assuming self.theight pixels.
@@ -157,14 +159,15 @@ class Previewer(Signallable, Loggable):
def _connectSettings(self, settings):
self._settings = settings
+
class DefaultPreviewer(Previewer):
def render_cairo(self, cr, bounds, element, hscroll_pos, y1):
# TODO: draw a single thumbnail
pass
-class RandomAccessPreviewer(Previewer):
+class RandomAccessPreviewer(Previewer):
""" Handles loading, caching, and drawing preview data for segments of
random-access streams. There is one Previewer per stream per
ObjectFactory. Preview data is read from an instance of an
@@ -222,7 +225,7 @@ class RandomAccessPreviewer(Previewer):
# tdur = duration in ns of thumbnail
# sof = start of file in pixel coordinates
- x1 = bounds.x1;
+ x1 = bounds.x1
sof = Zoomable.nsToPixel(element.start - element.in_point) +\
hscroll_pos
@@ -337,6 +340,7 @@ class RandomAccessPreviewer(Previewer):
self.spacing = settings.thumbnailSpacingHint
self.emit("update", None)
+
class RandomAccessVideoPreviewer(RandomAccessPreviewer):
@property
@@ -366,11 +370,11 @@ class RandomAccessVideoPreviewer(RandomAccessPreviewer):
(self.theight, self.twidth + 2))
filter_ = utils.filter_(caps)
self.videopipeline = utils.pipeline({
- sbin : csp,
- csp : scale,
- scale : filter_,
- filter_ : sink,
- sink : None
+ sbin: csp,
+ csp: scale,
+ scale: filter_,
+ filter_: sink,
+ sink: None
})
sink.connect('thumbnail', self._thumbnailCb)
self.videopipeline.set_state(gst.STATE_PAUSED)
@@ -398,11 +402,12 @@ class RandomAccessVideoPreviewer(RandomAccessPreviewer):
self._view = settings.showThumbnails
self.emit("update", None)
-class StillImagePreviewer(RandomAccessVideoPreviewer):
+class StillImagePreviewer(RandomAccessVideoPreviewer):
def _thumbForTime(self, cr, time, x, y):
return RandomAccessVideoPreviewer._thumbForTime(self, cr, 0L, x, y)
+
class RandomAccessAudioPreviewer(RandomAccessPreviewer):
def __init__(self, instance, factory, stream_):
@@ -420,9 +425,9 @@ class RandomAccessAudioPreviewer(RandomAccessPreviewer):
self.audioSink = ArraySink()
conv = gst.element_factory_make("audioconvert")
self.audioPipeline = utils.pipeline({
- sbin : conv,
- conv : self.audioSink,
- self.audioSink : None})
+ sbin: conv,
+ conv: self.audioSink,
+ self.audioSink: None})
bus = self.audioPipeline.get_bus()
bus.add_signal_watch()
bus.connect("message::segment-done", self._busMessageSegmentDoneCb)
@@ -475,7 +480,7 @@ class RandomAccessAudioPreviewer(RandomAccessPreviewer):
width, self.theight)
cr = cairo.Context(scaled)
matrix = cairo.Matrix()
- matrix.scale(self.base_width/width, 1.0)
+ matrix.scale(self.base_width / width, 1.0)
cr.set_source_surface(surface)
cr.get_source().set_matrix(matrix)
cr.rectangle(0, 0, width, self.theight)
diff --git a/pitivi/ui/projectsettings.py b/pitivi/ui/projectsettings.py
index e76a439..72f7560 100644
--- a/pitivi/ui/projectsettings.py
+++ b/pitivi/ui/projectsettings.py
@@ -70,6 +70,7 @@ display_aspect_ratios = model((str, object), (
(_("Anamorphic (2.4)"), gst.Fraction(24, 10)),
))
+
class ProjectSettingsDialog():
def __init__(self, parent, project):
@@ -237,12 +238,12 @@ class ProjectSettingsDialog():
def bindCombo(self, mgr, name, widget):
mgr.bindWidget(name,
lambda x: set_combo_value(widget, x),
- lambda : get_combo_value(widget))
+ lambda: get_combo_value(widget))
def bindSpinbutton(self, mgr, name, widget):
mgr.bindWidget(name,
lambda x: widget.set_value(float(x)),
- lambda : int(widget.get_value()))
+ lambda: int(widget.get_value()))
def presetNameEditedCb(self, renderer, path, new_text, mgr):
mgr.renamePreset(path, new_text)
@@ -342,9 +343,9 @@ class ProjectSettingsDialog():
def _addAudioPresetButtonClickedCb(self, button):
self.audio_presets.addPreset(_("New Preset"), {
- "channels" : get_combo_value(self.channels_combo),
- "sample-rate" : get_combo_value(self.sample_rate_combo),
- "depth" : get_combo_value(self.sample_depth_combo)
+ "channels": get_combo_value(self.channels_combo),
+ "sample-rate": get_combo_value(self.sample_rate_combo),
+ "depth": get_combo_value(self.sample_depth_combo)
})
def _removeAudioPresetButtonClickedCb(self, button):
diff --git a/pitivi/ui/ripple_update_group.py b/pitivi/ui/ripple_update_group.py
index fc07424..e11e1f7 100644
--- a/pitivi/ui/ripple_update_group.py
+++ b/pitivi/ui/ripple_update_group.py
@@ -79,12 +79,12 @@ class RippleUpdateGroup(object):
self.update_funcs[widget] = (update_func, args)
self.arcs[widget] = []
- def add_edge(self, a, b, predicate = None,
- edge_func = None):
+ def add_edge(self, a, b, predicate=None,
+ edge_func=None):
self.arcs[a].append((b, predicate, edge_func))
- def add_bi_edge(self, a, b, predicate = None,
- edge_func = None):
+ def add_bi_edge(self, a, b, predicate=None,
+ edge_func=None):
self.add_edge(a, b, predicate, edge_func)
self.add_edge(b, a, predicate, edge_func)
diff --git a/pitivi/ui/ruler.py b/pitivi/ui/ruler.py
index 488f5a5..19c958b 100644
--- a/pitivi/ui/ruler.py
+++ b/pitivi/ui/ruler.py
@@ -31,14 +31,15 @@ from pitivi.ui.zoominterface import Zoomable
from pitivi.log.loggable import Loggable
from pitivi.utils import time_to_string
+
class ScaleRuler(gtk.DrawingArea, Zoomable, Loggable):
__gsignals__ = {
- "expose-event":"override",
- "button-press-event":"override",
- "button-release-event":"override",
- "motion-notify-event":"override",
- "scroll-event" : "override",
+ "expose-event": "override",
+ "button-press-event": "override",
+ "button-release-event": "override",
+ "motion-notify-event": "override",
+ "scroll-event": "override",
"seek": (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE,
[gobject.TYPE_UINT64])
}
@@ -75,7 +76,7 @@ class ScaleRuler(gtk.DrawingArea, Zoomable, Loggable):
self.max_duration = gst.CLOCK_TIME_NONE
self.min_frame_spacing = 5.0
self.frame_height = 5.0
- self.frame_rate = gst.Fraction(1/1)
+ self.frame_rate = gst.Fraction(1 / 1)
self.app = instance
self.need_update = True
diff --git a/pitivi/ui/sourcelist.py b/pitivi/ui/sourcelist.py
index 16855f2..8c24ca7 100644
--- a/pitivi/ui/sourcelist.py
+++ b/pitivi/ui/sourcelist.py
@@ -102,6 +102,7 @@ ui = '''
INVISIBLE = gtk.gdk.pixbuf_new_from_file(os.path.join(get_pixmap_dir(),
"invisible.png"))
+
class SourceList(gtk.VBox, Loggable):
""" Widget for listing sources """
@@ -285,7 +286,7 @@ class SourceList(gtk.VBox, Loggable):
gtk.gdk.ACTION_COPY)
self.connect("drag_data_received", self._dndDataReceivedCb)
- self.treeview.drag_source_set(0,[], gtk.gdk.ACTION_COPY)
+ self.treeview.drag_source_set(0, [], gtk.gdk.ACTION_COPY)
self.treeview.connect("motion-notify-event",
self._treeViewMotionNotifyEventCb)
self.treeview.connect("button-release-event",
@@ -293,7 +294,7 @@ class SourceList(gtk.VBox, Loggable):
self.treeview.connect("drag_begin", self._dndDragBeginCb)
self.treeview.connect("drag_data_get", self._dndDataGetCb)
- self.iconview.drag_source_set(0,[], gtk.gdk.ACTION_COPY)
+ self.iconview.drag_source_set(0, [], gtk.gdk.ACTION_COPY)
self.iconview.connect("motion-notify-event",
self._iconViewMotionNotifyEventCb)
self.iconview.connect("button-release-event",
@@ -397,10 +398,10 @@ class SourceList(gtk.VBox, Loggable):
start += source.duration
self.app.action_log.commit()
- def searchEntryChangedCb (self, entry):
+ def searchEntryChangedCb(self, entry):
self.modelFilter.refilter()
- def searchEntryIconClickedCb (self, entry, unused, unsed1):
+ def searchEntryIconClickedCb(self, entry, unused, unsed1):
entry.set_text("")
def searchEntryDeactivateCb(self, entry, event):
@@ -416,7 +417,7 @@ class SourceList(gtk.VBox, Loggable):
"""
text = data.get_text().lower()
if text == "":
- return True # Avoid silly warnings
+ return True # Avoid silly warnings
else:
return text in model.get_value(iter, COL_INFOTEXT).lower()
@@ -453,8 +454,6 @@ class SourceList(gtk.VBox, Loggable):
self.project_signals.connect(
project.sources, "starting", None, self._sourcesStartedImportingCb)
-
-
def _setClipView(self, show):
""" Set which clip view to use when sourcelist is showing clips. If
none is given, the current one is used. Show: one of SHOW_TREEVIEW or
@@ -984,9 +983,7 @@ class SourceList(gtk.VBox, Loggable):
self.storemodel.clear()
self.project_signals.disconnectAll()
-
## Drag and Drop
-
def _dndDataReceivedCb(self, unused_widget, unused_context, unused_x,
unused_y, selection, targettype, unused_time):
def get_file_type(path):
@@ -994,11 +991,10 @@ class SourceList(gtk.VBox, Loggable):
if os.path.isfile(path[7:]):
return LOCAL_FILE
return LOCAL_DIR
- elif "://" in path: #we concider it is a remote file
+ elif "://" in path: # we concider it is a remote file
return REMOTE_FILE
return NOT_A_FILE
-
self.debug("targettype:%d, selection.data:%r", targettype, selection.data)
directories = []
if targettype == dnd.TYPE_URI_LIST:
diff --git a/pitivi/ui/startupwizard.py b/pitivi/ui/startupwizard.py
index d89c262..cb3b0f3 100644
--- a/pitivi/ui/startupwizard.py
+++ b/pitivi/ui/startupwizard.py
@@ -4,12 +4,12 @@ import os
import gtk
import webbrowser
-from pitivi.configure import LIBDIR, get_ui_dir
-from projectsettings import ProjectSettingsDialog
+from pitivi.configure import get_ui_dir
from pitivi.configure import APPMANUALURL
from urllib import unquote
+
class StartUpWizard(object):
"""A Wizard displaying recent projects and allowing the user to either:
diff --git a/pitivi/ui/timeline.py b/pitivi/ui/timeline.py
index c75ccf0..1fdcf07 100644
--- a/pitivi/ui/timeline.py
+++ b/pitivi/ui/timeline.py
@@ -57,8 +57,8 @@ SPLIT = _("Split clip at playhead position")
KEYFRAME = _("Add a keyframe")
PREVFRAME = _("Move to the previous keyframe")
NEXTFRAME = _("Move to the next keyframe")
-ZOOM_IN = _("Zoom In")
-ZOOM_OUT = _("Zoom Out")
+ZOOM_IN = _("Zoom In")
+ZOOM_OUT = _("Zoom Out")
ZOOM_FIT = _("Zoom Fit")
UNLINK = _("Break links between clips")
LINK = _("Link together arbitrary clips")
@@ -132,6 +132,7 @@ ui = '''
# |
# +--Status Bar ??
+
class InfoStub(gtk.HBox, Loggable):
"""
Box used to display information on the current state of the timeline
@@ -153,7 +154,6 @@ class InfoStub(gtk.HBox, Loggable):
self.pack_start(self.erroricon, expand=False)
-
self.infolabel = gtk.Label(self._errorsmessage)
self.infolabel.set_alignment(0, 0.5)
@@ -200,6 +200,7 @@ class InfoStub(gtk.HBox, Loggable):
gtk.VBox.hide(self)
self.showing = False
+
class Timeline(gtk.Table, Loggable, Zoomable):
# the screen width of the current unit
@@ -224,7 +225,7 @@ class Timeline(gtk.Table, Loggable, Zoomable):
self._state = gst.STATE_NULL
self._createUI()
self._prev_duration = 0
- self.rate = gst.Fraction(1,1)
+ self.rate = gst.Fraction(1, 1)
def _createUI(self):
self.leftSizeGroup = gtk.SizeGroup(gtk.SIZE_GROUP_HORIZONTAL)
@@ -252,7 +253,7 @@ class Timeline(gtk.Table, Loggable, Zoomable):
zoomslider.props.draw_value = False
zoomslider.set_tooltip_text(_("Zoom Timeline"))
zoomslider.connect("scroll-event", self._zoomSliderScrollCb)
- zoomslider.set_size_request(100, 0) # At least 100px wide for precision
+ zoomslider.set_size_request(100, 0) # At least 100px wide for precision
zoom_controls_hbox.pack_start(zoomslider)
self.attach(zoom_controls_hbox, 0, 1, 0, 1, yoptions=0, xoptions=gtk.FILL)
@@ -371,9 +372,7 @@ class Timeline(gtk.Table, Loggable, Zoomable):
self._canvas.connect("key-press-event", self._keyPressEventCb)
self._canvas.connect("scroll-event", self._scrollEventCb)
-
## Event callbacks
-
def _keyPressEventCb(self, unused_widget, event):
kv = event.keyval
self.debug("kv:%r", kv)
@@ -389,14 +388,14 @@ class Timeline(gtk.Table, Loggable, Zoomable):
if mod & gtk.gdk.SHIFT_MASK:
self._seekRelative(-gst.SECOND)
elif mod & gtk.gdk.CONTROL_MASK:
- self._seeker.seek(ltime+1)
+ self._seeker.seek(ltime + 1)
else:
self._seekRelative(-long(self.rate * gst.SECOND))
elif kv == gtk.keysyms.Right:
if mod & gtk.gdk.SHIFT_MASK:
self._seekRelative(gst.SECOND)
elif mod & gtk.gdk.CONTROL_MASK:
- self._seeker.seek(rtime+1)
+ self._seeker.seek(rtime + 1)
else:
self._seekRelative(long(self.rate * gst.SECOND))
finally:
@@ -472,7 +471,7 @@ class Timeline(gtk.Table, Loggable, Zoomable):
if timeline_objs:
self.app.action_log.begin("add effect")
self.timeline.addEffectFactoryOnObject(factory,
- timeline_objects = timeline_objs)
+ timeline_objects=timeline_objs)
self.app.action_log.commit()
self._factories = None
self.app.current.seeker.seek(self._position)
@@ -513,7 +512,7 @@ class Timeline(gtk.Table, Loggable, Zoomable):
def _getTimelineObjectUnderMouse(self, x, y, stream):
timeline_objs = []
- items_in_area = self._canvas.getItemsInArea(x, y-15, x+1, y-30)
+ items_in_area = self._canvas.getItemsInArea(x, y - 15, x + 1, y - 30)
tracks = [obj for obj in items_in_area[0]]
track_objects = [obj for obj in items_in_area[1]]
for track_object in track_objects:
@@ -613,7 +612,6 @@ class Timeline(gtk.Table, Loggable, Zoomable):
self.hadj.props.value
new_pos = Zoomable.nsToPixel(self._position) - cur_playhead_offset
-
self._updateScrollAdjustments()
self._scrollToPosition(new_pos)
self.ruler.queue_resize()
@@ -703,12 +701,11 @@ class Timeline(gtk.Table, Loggable, Zoomable):
a = self.get_allocation()
size = Zoomable.nsToPixel(self.timeline.duration)
self.hadj.props.lower = 0
- self.hadj.props.upper = size + 200 # why is this necessary???
+ self.hadj.props.upper = size + 200 # why is this necessary???
self.hadj.props.page_size = a.width
self.hadj.props.page_increment = size * 0.9
self.hadj.props.step_increment = size * 0.1
-
@handler(timeline, "selection-changed")
def _timelineSelectionChanged(self, timeline):
delete = False
@@ -754,9 +751,7 @@ class Timeline(gtk.Table, Loggable, Zoomable):
self.split_action.set_sensitive(split)
self.keyframe_action.set_sensitive(keyframe)
-
## ToolBar callbacks
-
def hide(self):
self.actiongroup.set_visible(False)
gtk.Vbox.hide(self)
diff --git a/pitivi/ui/timelinecontrols.py b/pitivi/ui/timelinecontrols.py
index 90ac15c..18304be 100644
--- a/pitivi/ui/timelinecontrols.py
+++ b/pitivi/ui/timelinecontrols.py
@@ -7,6 +7,7 @@ from common import LAYER_HEIGHT_EXPANDED, LAYER_HEIGHT_COLLAPSED, LAYER_SPACING
TRACK_CONTROL_WIDTH = 75
+
def track_name(track):
stream_type = type(track.stream)
if stream_type == stream.AudioStream:
@@ -16,6 +17,7 @@ def track_name(track):
elif stream_type == stream.TextStream:
return _("<b>Text:</b>")
+
class TrackControls(gtk.Label):
__gtype_name__ = 'TrackControls'
@@ -38,6 +40,7 @@ class TrackControls(gtk.Label):
max_priority) * (LAYER_HEIGHT_EXPANDED +
LAYER_SPACING))
+
class TimelineControls(gtk.VBox):
def __init__(self):
gtk.VBox.__init__(self)
diff --git a/pitivi/ui/track.py b/pitivi/ui/track.py
index 833c5fc..caf21e8 100644
--- a/pitivi/ui/track.py
+++ b/pitivi/ui/track.py
@@ -5,6 +5,7 @@ from pitivi.receiver import receiver, handler
from pitivi.ui.common import LAYER_HEIGHT_EXPANDED, LAYER_HEIGHT_COLLAPSED, LAYER_SPACING
import goocanvas
+
class Transition(goocanvas.Rect, Zoomable):
def __init__(self, transition):
@@ -108,7 +109,7 @@ class Track(goocanvas.Group, Zoomable):
@handler(track, "track-object-removed")
def _objectRemoved(self, unused_timeline, track_object):
- if not isinstance (track_object, TrackEffect):
+ if not isinstance(track_object, TrackEffect):
w = self.widgets[track_object]
self.remove_child(w)
del self.widgets[track_object]
diff --git a/pitivi/ui/trackobject.py b/pitivi/ui/trackobject.py
index 083d7cc..b5ca62e 100644
--- a/pitivi/ui/trackobject.py
+++ b/pitivi/ui/trackobject.py
@@ -39,60 +39,62 @@ NAME_PADDING2X = 2 * NAME_PADDING
import gst
GlobalSettings.addConfigOption('videoClipBg',
- section = 'user-interface',
- key = 'videoclip-background',
- default = 0x000000A0,
- notify = True)
+ section='user-interface',
+ key='videoclip-background',
+ default=0x000000A0,
+ notify=True)
PreferencesDialog.addColorPreference('videoClipBg',
- section = _("Appearance"),
- label = _("Clip Background (Video)"),
- description = _("The background color for clips in video tracks."))
+ section=_("Appearance"),
+ label=_("Clip Background (Video)"),
+ description=_("The background color for clips in video tracks."))
GlobalSettings.addConfigOption('audioClipBg',
- section = 'user-interface',
- key = 'audioclip-background',
- default = 0x4E9A06C0,
- notify = True)
+ section='user-interface',
+ key='audioclip-background',
+ default=0x4E9A06C0,
+ notify=True)
PreferencesDialog.addColorPreference('audioClipBg',
- section = _("Appearance"),
- label = _("Clip Background (Audio)"),
- description = _("The background color for clips in audio tracks."))
+ section=_("Appearance"),
+ label=_("Clip Background (Audio)"),
+ description=_("The background color for clips in audio tracks."))
GlobalSettings.addConfigOption('selectedColor',
- section = 'user-interface',
- key = 'selected-color',
- default = 0x00000077,
- notify = True)
+ section='user-interface',
+ key='selected-color',
+ default=0x00000077,
+ notify=True)
PreferencesDialog.addColorPreference('selectedColor',
- section = _("Appearance"),
- label = _("Selection Color"),
- description = _("Selected clips will be tinted with this color."))
+ section=_("Appearance"),
+ label=_("Selection Color"),
+ description=_("Selected clips will be tinted with this color."))
GlobalSettings.addConfigOption('clipFontDesc',
- section = 'user-interface',
- key = 'clip-font-name',
- default = "Sans 9",
- notify = True)
+ section='user-interface',
+ key='clip-font-name',
+ default="Sans 9",
+ notify=True)
PreferencesDialog.addFontPreference('clipFontDesc',
- section = _('Appearance'),
- label = _("Clip Font"),
- description = _("The font to use for clip titles"))
+ section=_('Appearance'),
+ label=_("Clip Font"),
+ description=_("The font to use for clip titles"))
GlobalSettings.addConfigOption('clipFontColor',
- section = 'user-interface',
- key = 'clip-font-color',
- default = 0xFFFFFFAA,
- notify = True)
+ section='user-interface',
+ key='clip-font-color',
+ default=0xFFFFFFAA,
+ notify=True)
+
def text_size(text):
ink, logical = text.get_natural_extents()
x1, y1, x2, y2 = [pango.PIXELS(x) for x in logical]
return x2 - x1, y2 - y1
+
class TimelineController(controller.Controller):
_cursor = ARROW
@@ -142,6 +144,7 @@ class TimelineController(controller.Controller):
if self._context:
self._context.setMode(self._getMode())
+
class TrimHandle(View, goocanvas.Image, Zoomable):
"""A component of a TrackObject which manage's the source's edit
@@ -154,7 +157,7 @@ class TrimHandle(View, goocanvas.Image, Zoomable):
self.element = element
self.timeline = timeline
goocanvas.Image.__init__(self,
- pixbuf = TRIMBAR_PIXBUF,
+ pixbuf=TRIMBAR_PIXBUF,
line_width=0,
pointer_events=goocanvas.EVENTS_FILL,
**kwargs
@@ -168,6 +171,7 @@ class TrimHandle(View, goocanvas.Image, Zoomable):
def unfocus(self):
self.props.pixbuf = TRIMBAR_PIXBUF
+
class StartHandle(TrimHandle):
"""Subclass of TrimHandle wich sets the object's start time"""
@@ -183,6 +187,7 @@ class StartHandle(TrimHandle):
self._view.timeline.selection.getSelectedTrackObjs())
self._view.app.action_log.begin("trim object")
+
class EndHandle(TrimHandle):
"""Subclass of TrimHandle which sets the objects's end time"""
@@ -198,6 +203,7 @@ class EndHandle(TrimHandle):
self._view.timeline.selection.getSelectedTrackObjs())
self._view.app.action_log.begin("trim object")
+
class TrackObject(View, goocanvas.Group, Zoomable):
class Controller(TimelineController):
@@ -251,16 +257,16 @@ class TrackObject(View, goocanvas.Group, Zoomable):
self.content = Preview(self.app, element)
self.name = goocanvas.Text(
- x= NAME_HOFFSET + NAME_PADDING,
- y= NAME_VOFFSET + NAME_PADDING,
- operator = cairo.OPERATOR_ADD,
+ x=NAME_HOFFSET + NAME_PADDING,
+ y=NAME_VOFFSET + NAME_PADDING,
+ operator=cairo.OPERATOR_ADD,
alignment=pango.ALIGN_LEFT)
self.namebg = goocanvas.Rect(
- radius_x = 2,
- radius_y = 2,
- x = NAME_HOFFSET,
- y = NAME_VOFFSET,
- line_width = 0)
+ radius_x=2,
+ radius_y=2,
+ x=NAME_HOFFSET,
+ y=NAME_VOFFSET,
+ line_width=0)
self.start_handle = StartHandle(self.app, element, timeline,
height=self.height)
@@ -269,7 +275,7 @@ class TrackObject(View, goocanvas.Group, Zoomable):
self.selection_indicator = goocanvas.Rect(
visibility=goocanvas.ITEM_INVISIBLE,
- line_width = 0.0,
+ line_width=0.0,
height=self.height)
for thing in (self.bg, self.content, self.selection_indicator,
diff --git a/pitivi/ui/view.py b/pitivi/ui/view.py
index 2b4eac4..2814e8b 100644
--- a/pitivi/ui/view.py
+++ b/pitivi/ui/view.py
@@ -1,6 +1,7 @@
from pitivi.receiver import receiver, handler
import controller
+
class View(object):
Controller = controller.Controller
diff --git a/pitivi/ui/viewer.py b/pitivi/ui/viewer.py
index 0fc19a8..e35e0e5 100644
--- a/pitivi/ui/viewer.py
+++ b/pitivi/ui/viewer.py
@@ -59,16 +59,17 @@ GlobalSettings.addConfigOption("viewerY",
key="y-pos",
default=0)
+
class ViewerError(Exception):
pass
-# TODO : Switch to using Pipeline and Action
+# TODO : Switch to using Pipeline and Action
class PitiviViewer(gtk.VBox, Loggable):
__gtype_name__ = 'PitiviViewer'
__gsignals__ = {
- "activate-playback-controls" : (gobject.SIGNAL_RUN_LAST,
+ "activate-playback-controls": (gobject.SIGNAL_RUN_LAST,
gobject.TYPE_NONE, (gobject.TYPE_BOOLEAN,)),
}
@@ -214,7 +215,7 @@ class PitiviViewer(gtk.VBox, Loggable):
self.action = action
# FIXME: fix this properly?
self.internal.action = action
- dar = float(4/3)
+ dar = float(4 / 3)
try:
producer = action.producers[0]
self.debug("producer:%r", producer)
@@ -226,7 +227,7 @@ class PitiviViewer(gtk.VBox, Loggable):
dar = stream.dar
continue
except:
- dar = float(4/3)
+ dar = float(4 / 3)
self.setDisplayAspectRatio(dar)
self.showControls()
@@ -260,7 +261,7 @@ class PitiviViewer(gtk.VBox, Loggable):
def _createUi(self):
""" Creates the Viewer GUI """
# drawing area
- self.aframe = gtk.AspectFrame(xalign=0.5, yalign=0.5, ratio=4.0/3.0,
+ self.aframe = gtk.AspectFrame(xalign=0.5, yalign=0.5, ratio=4.0 / 3.0,
obey_child=False)
self.pack_start(self.aframe, expand=True)
self.internal = ViewerWidget(self.action)
@@ -343,7 +344,7 @@ class PitiviViewer(gtk.VBox, Loggable):
width, height = bbox.size_request()
width += 110
height = int(width / self.aframe.props.ratio)
- self.aframe.set_size_request(width , height)
+ self.aframe.set_size_request(width, height)
self.show_all()
self.buttons = boxalign
@@ -460,9 +461,7 @@ class PitiviViewer(gtk.VBox, Loggable):
self.posadjust.set_value(float(value))
return False
-
## active Timeline calllbacks
-
def _durationChangedCb(self, unused_pipeline, duration):
self.debug("duration : %s", gst.TIME_ARGS(duration))
position = self.posadjust.get_value()
@@ -620,7 +619,7 @@ class ViewerWidget(gtk.DrawingArea, Loggable):
def __init__(self, action=None):
gtk.DrawingArea.__init__(self)
Loggable.__init__(self)
- self.action = action # FIXME : Check if it's a view action
+ self.action = action # FIXME : Check if it's a view action
self.unset_flags(gtk.SENSITIVE)
for state in range(gtk.STATE_INSENSITIVE + 1):
self.modify_bg(state, self.style.black)
@@ -630,13 +629,14 @@ class ViewerWidget(gtk.DrawingArea, Loggable):
if platform.system() == 'Windows':
self.window_xid = self.window.handle
else:
- self.window_xid = self.window.xid
+ self.window_xid = self.window.xid
+
class PlayPauseButton(gtk.Button, Loggable):
""" Double state gtk.Button which displays play/pause """
__gsignals__ = {
- "play" : (gobject.SIGNAL_RUN_LAST,
+ "play": (gobject.SIGNAL_RUN_LAST,
gobject.TYPE_NONE,
(gobject.TYPE_BOOLEAN,))
}
diff --git a/pitivi/ui/zoominterface.py b/pitivi/ui/zoominterface.py
index 74c2327..e8e35b9 100644
--- a/pitivi/ui/zoominterface.py
+++ b/pitivi/ui/zoominterface.py
@@ -46,6 +46,7 @@ import gst
# Instance Methods
# . zoomChanged()
+
class Zoomable(object):
sigid = None
@@ -110,7 +111,7 @@ class Zoomable(object):
def computeZoomLevel(cls, ratio):
return int((
(max(0, ratio - cls.min_zoom) /
- cls.zoom_range) ** (1.0/3.0)) *
+ cls.zoom_range) ** (1.0 / 3.0)) *
cls.zoom_steps)
@classmethod
@@ -127,7 +128,6 @@ class Zoomable(object):
"""
return long(pixel * gst.SECOND / ratio)
-
@classmethod
def nsToPixel(cls, duration):
"""
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]