[pitivi] Make the code compliant with PEP8 1.3
- From: Jean-FranÃois Fortin Tam <jfft src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] Make the code compliant with PEP8 1.3
- Date: Mon, 22 Oct 2012 16:20:46 +0000 (UTC)
commit 6bc2427aeac61c442e314e848997298d2c931669
Author: Jean-FranÃois Fortin Tam <nekohayo gmail com>
Date: Mon Oct 22 11:29:11 2012 -0400
Make the code compliant with PEP8 1.3
Fixes bug #681922
pitivi/application.py | 2 +-
pitivi/autoaligner.py | 11 +--
pitivi/clipproperties.py | 17 ++---
pitivi/dialogs/clipmediaprops.py | 8 +-
pitivi/dialogs/prefs.py | 13 ++---
pitivi/effects.py | 125 ++++++++++++++++++++------------------
pitivi/mainwindow.py | 79 ++++++++++++------------
pitivi/mediafilespreviewer.py | 23 ++++---
pitivi/medialibrary.py | 11 ++--
pitivi/preset.py | 16 ++---
pitivi/project.py | 29 ++++-----
pitivi/render.py | 70 +++++++++++-----------
pitivi/settings.py | 14 ++--
pitivi/tabsmanager.py | 2 +-
pitivi/timeline/curve.py | 12 ++--
pitivi/timeline/layer.py | 7 +--
pitivi/timeline/ruler.py | 10 ++--
pitivi/timeline/thumbnailer.py | 13 ++--
pitivi/timeline/timeline.py | 18 ++---
pitivi/timeline/track.py | 22 ++++---
pitivi/titleeditor.py | 21 +++---
pitivi/undo/effect.py | 29 ++++-----
pitivi/undo/undo.py | 3 +-
pitivi/utils/loggable.py | 17 +++---
pitivi/utils/misc.py | 6 +-
pitivi/utils/pipeline.py | 7 +-
pitivi/utils/receiver.py | 2 +-
pitivi/utils/signal.py | 5 +-
pitivi/utils/system.py | 18 +++---
pitivi/utils/timeline.py | 15 ++---
pitivi/utils/widgets.py | 53 +++++++---------
pitivi/viewer.py | 24 ++++----
tests/common.py | 2 +-
tests/test_common.py | 16 +++---
tests/test_integration.py | 15 ++---
tests/test_signallable.py | 6 +-
tests/test_system_gnome.py | 4 +-
tests/test_undo.py | 2 +-
38 files changed, 355 insertions(+), 392 deletions(-)
---
diff --git a/pitivi/application.py b/pitivi/application.py
index 0c09b09..37f0a70 100644
--- a/pitivi/application.py
+++ b/pitivi/application.py
@@ -431,7 +431,7 @@ class StartupWizardGuiPitivi(FullGuiPitivi):
def _parse_options(argv):
parser = OptionParser(
- usage=_("""
+ usage=_("""
%prog [PROJECT_FILE] # Start the video editor.
%prog -i [-a] [MEDIA_FILE1 ...] # Start the editor and create a project."""))
diff --git a/pitivi/autoaligner.py b/pitivi/autoaligner.py
index b5afb1d..9e31612 100644
--- a/pitivi/autoaligner.py
+++ b/pitivi/autoaligner.py
@@ -218,8 +218,7 @@ def affinealign(reference, targets, max_drift=0.02):
dtype=numpy.complex)
for i in xrange(num_blocks):
fxcorr_blocks[:, i] = ft * freference_blocks[:, i]
- fxcorr_blocks[:, i] /= numpy.sqrt(numpy.sum(
- fxcorr_blocks[:, i] ** 2))
+ fxcorr_blocks[:, i] /= numpy.sqrt(numpy.sum(fxcorr_blocks[:, i] ** 2))
del ft
# At this point xcorr_blocks would show a distinct bright line, nearly
# orthogonal to time, indicating where each of these blocks found their
@@ -254,8 +253,7 @@ def affinealign(reference, targets, max_drift=0.02):
halfautocorr[-1:2, -1:2] = 0 # NEEDS TUNING
# Normalize each column (appears to be necessary)
for i in xrange(2 * num_blocks):
- halfautocorr[:, i] /= numpy.sqrt(numpy.sum(
- halfautocorr[:, i] ** 2))
+ halfautocorr[:, i] /= numpy.sqrt(numpy.sum(halfautocorr[:, i] ** 2))
#from matplotlib.pyplot import imshow,show
#imshow(halfautocorr,interpolation='nearest',aspect='auto');show()
drift = _findslope(halfautocorr) / bspace
@@ -459,7 +457,7 @@ class EnvelopeExtractee(Extractee, Loggable):
len(samples_to_process), len(self._blocks))
newblocks = len(samples_to_process) // self._blocksize
samples_abs = numpy.abs(
- samples_to_process).reshape((newblocks, self._blocksize))
+ samples_to_process).reshape((newblocks, self._blocksize))
self._blocks.resize((len(self._blocks) + newblocks,))
# This numpy.sum() call relies on samples_abs being a
# floating-point type. If samples_abs.dtype is int16
@@ -587,8 +585,7 @@ class AutoAligner(Loggable):
# the percent completion.
numsamples = ((audiotrack.duration / Gst.SECOND) *
audiotrack.stream.rate)
- extractee.addWatcher(
- progress_aggregator.getPortionCB(numsamples))
+ extractee.addWatcher(progress_aggregator.getPortionCB(numsamples))
self._extraction_stack.append((audiotrack, extractee))
# After we return, start the extraction cycle.
# This GObject.idle_add call should not be necessary;
diff --git a/pitivi/clipproperties.py b/pitivi/clipproperties.py
index 2215d82..f5b5db6 100644
--- a/pitivi/clipproperties.py
+++ b/pitivi/clipproperties.py
@@ -58,11 +58,11 @@ class ClipPropertiesError(Exception):
def compare_type(track, effect_type):
- if track.get_property("track_type") == GES.TrackType.AUDIO and \
- effect_type == AUDIO_EFFECT:
+ if (track.get_property("track_type") == GES.TrackType.AUDIO
+ and effect_type == AUDIO_EFFECT):
return True
- elif track.get_property("track_type") == GES.TrackType.VIDEO and \
- effect_type == VIDEO_EFFECT:
+ elif (track.get_property("track_type") == GES.TrackType.VIDEO
+ and effect_type == VIDEO_EFFECT):
return True
return False
@@ -402,7 +402,7 @@ class EffectProperties(Gtk.Expander):
for track_effect in obj.get_top_effects():
if not track_effect.props.bin_description in HIDDEN_EFFECTS:
material = self.app.effects.getFactoryFromName(
- track_effect.props.bin_description)
+ track_effect.props.bin_description)
to_append = [track_effect.props.active]
track = track_effect.get_track()
if track.get_property("track_type") == GES.TrackType.AUDIO:
@@ -419,8 +419,7 @@ class EffectProperties(Gtk.Expander):
def _showInfoBar(self):
if self._info_bar is None:
self._info_bar = self.clip_properties.addInfoBar(
- _("Select a clip on the timeline "
- "to configure its associated effects"))
+ _("Select a clip on the timeline to configure its associated effects"))
self._info_bar.show_all()
def _setEffectDragable(self):
@@ -456,9 +455,7 @@ class EffectProperties(Gtk.Expander):
self._effect_config_ui = ui
if self._effect_config_ui:
- self._vcontent.pack2(self._effect_config_ui,
- resize=False,
- shrink=False)
+ self._vcontent.pack2(self._effect_config_ui, resize=False, shrink=False)
self._vcontent.set_position(int(self._config_ui_h_pos))
self._effect_config_ui.show_all()
self.selected_on_treeview = track_effect
diff --git a/pitivi/dialogs/clipmediaprops.py b/pitivi/dialogs/clipmediaprops.py
index 77fd690..5846e49 100644
--- a/pitivi/dialogs/clipmediaprops.py
+++ b/pitivi/dialogs/clipmediaprops.py
@@ -66,12 +66,12 @@ class clipmediapropsDialog():
if not self.is_image:
self.frame_rate.set_text(
get_value_from_model(frame_rates, Gst.Fraction(
- stream.get_framerate_num(),
- stream.get_framerate_denom())))
+ stream.get_framerate_num(),
+ stream.get_framerate_denom())))
self.aspect_ratio.set_text(
get_value_from_model(pixel_aspect_ratios, Gst.Fraction(
- stream.get_par_num(),
- stream.get_par_denom())))
+ stream.get_par_num(),
+ stream.get_par_denom())))
self.has_video = True
break
diff --git a/pitivi/dialogs/prefs.py b/pitivi/dialogs/prefs.py
index 513263c..ba80b39 100644
--- a/pitivi/dialogs/prefs.py
+++ b/pitivi/dialogs/prefs.py
@@ -86,7 +86,7 @@ class PreferencesDialog():
@classmethod
def addPreference(cls, attrname, label, description, section=None,
- widget_klass=None, **args):
+ widget_klass=None, **args):
"""
Add a user preference. The preferences dialog will try
to guess the appropriate widget to use based on the type of the
@@ -129,7 +129,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 an horizontal Gtk.Scale, depending whether both the
@@ -152,8 +152,7 @@ class PreferencesDialog():
ptvWidgets.NumericWidget, upper=upper, lower=lower)
@classmethod
- def addTextPreference(cls, attrname, label, description, section=None,
- matches=None):
+ def addTextPreference(cls, attrname, label, description, section=None, matches=None):
"""
Add an auto-generated user preference that will show up as either a
Gtk.SpinButton or an horizontal Gtk.Scale, depending on the upper and
@@ -172,8 +171,7 @@ class PreferencesDialog():
ptvWidgets.TextWidget, matches=matches)
@classmethod
- def addChoicePreference(cls, attrname, label, description, choices,
- section=None):
+ def addChoicePreference(cls, attrname, label, description, choices, section=None):
"""
Add an auto-generated user preference that will show up as either a
Gtk.ComboBox or a group of radio buttons, depending on the number of
@@ -212,8 +210,7 @@ class PreferencesDialog():
ptvWidgets.ToggleWidget)
@classmethod
- def addColorPreference(cls, attrname, label, description, section=None,
- value_type=int):
+ def addColorPreference(cls, attrname, label, description, section=None, value_type=int):
"""
Add an auto-generated user preference for specifying colors. The
colors can be returned as either int, a string colorspec, or a
diff --git a/pitivi/effects.py b/pitivi/effects.py
index 7d22c69..dd3b4db 100644
--- a/pitivi/effects.py
+++ b/pitivi/effects.py
@@ -75,7 +75,7 @@ class Effect():
Factories that applies an effect on a stream
"""
def __init__(self, effect, media_type, categories=[_("Uncategorized")],
- human_name="", description="", icon=None):
+ human_name="", description="", icon=None):
self.effectname = effect
self.media_type = media_type
self.categories = categories
@@ -103,50 +103,55 @@ class EffectsHandler(object):
self._audio_categories_effects = ((_("All effects"), ("")),)
self._video_categories_effects = (
(_("All effects"), ("")),
- (_("Colors"), ("cogcolorspace", "alphacolor", "videobalance",
- "gamma", "alpha", "frei0r-filter-color-distance",
- "frei0r-filter-contrast0r", "frei0r-filter-invert0r",
- "frei0r-filter-saturat0r", "frei0r-filter-r",
- "frei0r-filter-white-balance", "frei0r-filter-brightness",
- "frei0r-filter-b", "frei0r-filter-gamma",
- "frei0r-filter-hueshift0r", "frei0r-filter-transparency",
- "frei0r-filter-equaliz0r", "frei0r-filter-glow",
- "frei0r-filter-g", "frei0r-filter-bw0r", "burn", "dodge",
- "coloreffects", "chromium", "exclusion", "glfiltersobel",
- "Solarize", "frei0r-filter-threshold0r",
- "frei0r-filter-twolay0r",
- )
- ),
- (_("Noise"), ("videorate", "frei0r-filter-edgeglow",
- "gaussianblur", "diffuse", "dilate", "marble", )),
- (_("Analysis"), ("videoanalyse", "videodetect", "videomark",
- "revtv", "navigationtest", "frei0r-filter-rgb-parade",
- "frei0r-filter-vectorscope", "frei0r-filter-luminance",
- )),
- (_("Blur"), ("frei0r-filter-squareblur", "gaussianblur", "diffuse",
- "dilate", "marble", )),
- (_("Geometry"), ("cogscale", "aspectratiocrop", "cogdownsample",
- "videocrop", "videoflip", "videobox", "gdkpixbufscale",
- "frei0r-filter-letterb0xed",
- "frei0r-filter-k-means-clustering",
- "videoscale", "frei0r-filter-lens-correction",
- "frei0r-filter-perspective",
- "frei0r-filter-scale0tilt", "frei0r-filter-pixeliz0r",
- "frei0r-filter-flippo", "frei0r-filter-3dflippo",
- "frei0r-filter-letterb0xed", "bulge", "circle", "fisheye",
- "kaleidoscope", "mirror", "pinch", "sphere", "square",
- "stretch", "twirl", "waterriple",
- )
- ),
- (_("Fancy"), ("rippletv", "streaktv", "radioactv", "optv",
- "quarktv", "vertigotv", "shagadelictv", "warptv", "dicetv",
- "agingtv", "edgetv", "frei0r-filter-cartoon",
- "frei0r-filter-water", "frei0r-filter-nosync0r",
- "frei0r-filter-k-means-clustering", "frei0r-filter-delay0r",
- "bulge", "circle", "fisheye", "kaleidoscope", "mirror",
- "pinch", "sphere", "square", "stretch", "twirl", "waterriple",
- )
- ),
+ (_("Colors"), (
+ "cogcolorspace", "alphacolor", "videobalance",
+ "gamma", "alpha", "frei0r-filter-color-distance",
+ "frei0r-filter-contrast0r", "frei0r-filter-invert0r",
+ "frei0r-filter-saturat0r", "frei0r-filter-r",
+ "frei0r-filter-white-balance", "frei0r-filter-brightness",
+ "frei0r-filter-b", "frei0r-filter-gamma",
+ "frei0r-filter-hueshift0r", "frei0r-filter-transparency",
+ "frei0r-filter-equaliz0r", "frei0r-filter-glow",
+ "frei0r-filter-g", "frei0r-filter-bw0r", "burn", "dodge",
+ "coloreffects", "chromium", "exclusion", "glfiltersobel",
+ "Solarize", "frei0r-filter-threshold0r",
+ "frei0r-filter-twolay0r",
+ )),
+ (_("Noise"), (
+ "videorate", "frei0r-filter-edgeglow",
+ "gaussianblur", "diffuse", "dilate", "marble",
+ )),
+ (_("Analysis"), (
+ "videoanalyse", "videodetect", "videomark",
+ "revtv", "navigationtest", "frei0r-filter-rgb-parade",
+ "frei0r-filter-vectorscope", "frei0r-filter-luminance",
+ )),
+ (_("Blur"), (
+ "frei0r-filter-squareblur", "gaussianblur", "diffuse",
+ "dilate", "marble",
+ )),
+ (_("Geometry"), (
+ "cogscale", "aspectratiocrop", "cogdownsample",
+ "videocrop", "videoflip", "videobox", "gdkpixbufscale",
+ "frei0r-filter-letterb0xed",
+ "frei0r-filter-k-means-clustering",
+ "videoscale", "frei0r-filter-lens-correction",
+ "frei0r-filter-perspective",
+ "frei0r-filter-scale0tilt", "frei0r-filter-pixeliz0r",
+ "frei0r-filter-flippo", "frei0r-filter-3dflippo",
+ "frei0r-filter-letterb0xed", "bulge", "circle", "fisheye",
+ "kaleidoscope", "mirror", "pinch", "sphere", "square",
+ "stretch", "twirl", "waterriple",
+ )),
+ (_("Fancy"), (
+ "rippletv", "streaktv", "radioactv", "optv",
+ "quarktv", "vertigotv", "shagadelictv", "warptv", "dicetv",
+ "agingtv", "edgetv", "frei0r-filter-cartoon",
+ "frei0r-filter-water", "frei0r-filter-nosync0r",
+ "frei0r-filter-k-means-clustering", "frei0r-filter-delay0r",
+ "bulge", "circle", "fisheye", "kaleidoscope", "mirror",
+ "pinch", "sphere", "square", "stretch", "twirl", "waterriple",
+ )),
(_("Time"), ("frei0r-filter-delay0r",)),
(_("Uncategorized"), ("",))
)
@@ -162,23 +167,25 @@ class EffectsHandler(object):
go trough the list of element factories and
add them to the correct list filtering if necessary
"""
- factlist = Gst.Registry.get().get_feature_list(
- Gst.ElementFactory)
+ factlist = Gst.Registry.get().get_feature_list(Gst.ElementFactory)
for element_factory in factlist:
klass = element_factory.get_klass()
name = element_factory.get_name()
- if "Effect" in klass and name not in BLACKLISTED_EFFECTS and not\
- [bplug for bplug in BLACKLISTED_PLUGINS if bplug in name]:
- if 'Audio' in klass:
+
+ if ("Effect" in klass and name not in BLACKLISTED_EFFECTS
+ and not [bplug for bplug in BLACKLISTED_PLUGINS if bplug in name]):
+
+ if "Audio" in klass:
self.audio_effects.append(element_factory)
media_type = AUDIO_EFFECT
- elif 'Video' in klass:
+ elif "Video" in klass:
self.video_effects.append(element_factory)
media_type = VIDEO_EFFECT
+
effect = Effect(name, media_type,
- self._getEffectCategories(name),
- self._getEffectName(element_factory),
- self._getEffectDescripton(element_factory))
+ self._getEffectCategories(name),
+ self._getEffectName(element_factory),
+ self._getEffectDescripton(element_factory))
self._addEffectToDic(name, effect)
def getAllAudioEffects(self):
@@ -441,10 +448,10 @@ class EffectListWidget(Gtk.VBox, Loggable):
if name not in HIDDEN_EFFECTS:
effect = self.app.effects.getFactoryFromName(name)
self.storemodel.append([effect.getHumanName(),
- effect.getDescription(), effectType,
- effect.getCategories(),
- effect, name,
- self.app.effects.getEffectIcon(name)])
+ effect.getDescription(), effectType,
+ effect.getCategories(),
+ effect, name,
+ self.app.effects.getEffectIcon(name)])
self.storemodel.set_sort_column_id(COL_NAME_TEXT, Gtk.SortType.ASCENDING)
def populate_categories_widget(self):
@@ -558,7 +565,7 @@ class EffectListWidget(Gtk.VBox, Loggable):
if self.categoriesWidget.get_active_text() in model.get_value(iter, COL_EFFECT_CATEGORIES):
text = self.searchEntry.get_text().lower()
return text in model.get_value(iter, COL_DESC_TEXT).lower() or\
- text in model.get_value(iter, COL_NAME_TEXT).lower()
+ text in model.get_value(iter, COL_NAME_TEXT).lower()
else:
return False
else:
diff --git a/pitivi/mainwindow.py b/pitivi/mainwindow.py
index 22edc63..fc22658 100644
--- a/pitivi/mainwindow.py
+++ b/pitivi/mainwindow.py
@@ -39,24 +39,22 @@ from gi.repository import GObject
from gi.repository import GdkPixbuf
from gi.repository.GstPbutils import InstallPluginsContext, install_plugins_async
-from pitivi.utils.loggable import Loggable
-from pitivi.utils.misc import in_devel
-from pitivi.settings import GlobalSettings
+from pitivi.clipproperties import ClipProperties
+from pitivi.configure import pitivi_version, APPNAME, APPURL, get_pixmap_dir, get_ui_dir
from pitivi.effects import EffectListWidget
-from pitivi.transitions import TransitionsListWidget
+from pitivi.mediafilespreviewer import PreviewWidget
from pitivi.medialibrary import MediaLibraryWidget, MediaLibraryError
-from pitivi.titleeditor import TitleEditor
-from pitivi.utils.misc import show_user_manual, path_from_uri
-from pitivi.utils.ui import info_name, beautify_time_delta, SPACING,\
- FILESOURCE_TARGET_ENTRY, URI_TARGET_ENTRY, TYPE_URI_LIST, \
- TYPE_PITIVI_FILESOURCE
+from pitivi.settings import GlobalSettings
+from pitivi.tabsmanager import BaseTabs
from pitivi.timeline.timeline import Timeline
+from pitivi.titleeditor import TitleEditor
+from pitivi.transitions import TransitionsListWidget
+from pitivi.utils.loggable import Loggable
+from pitivi.utils.misc import in_devel, show_user_manual, path_from_uri
+from pitivi.utils.ui import info_name, beautify_time_delta, SPACING, \
+ FILESOURCE_TARGET_ENTRY, URI_TARGET_ENTRY, \
+ TYPE_URI_LIST, TYPE_PITIVI_FILESOURCE
from pitivi.viewer import PitiviViewer
-from pitivi.tabsmanager import BaseTabs
-from pitivi.mediafilespreviewer import PreviewWidget
-from pitivi.clipproperties import ClipProperties
-from pitivi.configure import pitivi_version, APPNAME, APPURL, \
- get_pixmap_dir, get_ui_dir
GlobalSettings.addConfigOption("fileSupportEnabled",
@@ -95,10 +93,10 @@ GlobalSettings.addConfigOption('lastProjectFolder',
default=os.path.expanduser("~"))
GlobalSettings.addConfigSection('export')
GlobalSettings.addConfigOption('lastExportFolder',
- section='export',
- key="last-export-folder",
- environment="PITIVI_EXPORT_FOLDER",
- default=os.path.expanduser("~"))
+ section='export',
+ key="last-export-folder",
+ environment="PITIVI_EXPORT_FOLDER",
+ default=os.path.expanduser("~"))
GlobalSettings.addConfigOption('elementSettingsDialogWidth',
section='export',
key='element-settings-dialog-width',
@@ -133,14 +131,14 @@ Gtk.stock_add = lambda items: None
def create_stock_icons():
""" Creates the pitivi-only stock icons """
Gtk.stock_add([
- ('pitivi-render', _('Render'), 0, 0, 'pitivi'),
- ('pitivi-split', _('Split'), 0, 0, 'pitivi'),
- ('pitivi-keyframe', _('Keyframe'), 0, 0, 'pitivi'),
- ('pitivi-ungroup', _('Ungroup'), 0, 0, 'pitivi'),
- # Translators: This is an action, the title of a button
- ('pitivi-group', _('Group'), 0, 0, 'pitivi'),
- ('pitivi-align', _('Align'), 0, 0, 'pitivi'),
- ])
+ ('pitivi-render', _('Render'), 0, 0, 'pitivi'),
+ ('pitivi-split', _('Split'), 0, 0, 'pitivi'),
+ ('pitivi-keyframe', _('Keyframe'), 0, 0, 'pitivi'),
+ ('pitivi-ungroup', _('Ungroup'), 0, 0, 'pitivi'),
+ # Translators: This is an action, the title of a button
+ ('pitivi-group', _('Group'), 0, 0, 'pitivi'),
+ ('pitivi-align', _('Align'), 0, 0, 'pitivi'),
+ ])
pixmaps = {
"pitivi-render": "pitivi-render-24.png",
"pitivi-split": "pitivi-split-24.svg",
@@ -332,7 +330,8 @@ class PitiviMainWindow(Gtk.Window, Loggable):
"File", "Edit", "View", "Help",
"UserManual", "About", "Quit", "ImportSourcesFolder",
"Preferences", "Project", "ProjectSettings",
- "Library", "Timeline", "Viewer", "WindowizeViewer"]:
+ "Library", "Timeline", "Viewer", "WindowizeViewer"
+ ]: # One of the remaining known actions we expect to be sensitive
action.set_sensitive(True)
else:
action.set_sensitive(False)
@@ -426,8 +425,8 @@ class PitiviMainWindow(Gtk.Window, Loggable):
# Viewer
self.viewer = PitiviViewer(instance, undock_action=self.undock_action)
self.viewer.drag_dest_set(Gtk.DestDefaults.DROP | Gtk.DestDefaults.MOTION,
- [FILESOURCE_TARGET_ENTRY, URI_TARGET_ENTRY],
- Gdk.DragAction.COPY)
+ [FILESOURCE_TARGET_ENTRY, URI_TARGET_ENTRY],
+ Gdk.DragAction.COPY)
self.viewer.connect("drag_data_received", self._viewerDndDataReceivedCb)
self.mainhpaned.pack2(self.viewer, resize=False, shrink=False)
@@ -619,7 +618,7 @@ class PitiviMainWindow(Gtk.Window, Loggable):
self.timeline_ui.purgeObject(uri)
def _selectedLayerChangedCb(self, widget, layer):
- self.main_actions.get_action("RemoveLayer").set_sensitive(layer != None)
+ self.main_actions.get_action("RemoveLayer").set_sensitive(layer is not None)
## Toolbar/Menu actions callback
@@ -692,8 +691,8 @@ class PitiviMainWindow(Gtk.Window, Loggable):
abt.set_website(APPURL)
ges_version_str = "GES %i.%i.%i.%i" % (GES.version())
gst_version_str = "GStreamer %i.%i.%i.%i" % (Gst.version())
- if self.app.version_information and \
- self.app.version_information["status"] != "CURRENT":
+ if (self.app.version_information and
+ self.app.version_information["status"] != "CURRENT"):
version_str = _("PiTiVi %s is available." %
(self.app.version_information["current"]))
@@ -718,7 +717,7 @@ class PitiviMainWindow(Gtk.Window, Loggable):
"Out of respect for our contributors, we point you instead to:\n"),
# Translators: keep the %s at the end of the 1st line
_("The list of contributors on Ohloh %s\n" +
- "Or you can run: git shortlog -s -n")\
+ "Or you can run: git shortlog -s -n")
% "http://ohloh.net/p/pitivi/contributors", ]
abt.set_authors(authors)
translators = _("translator-credits")
@@ -850,8 +849,8 @@ class PitiviMainWindow(Gtk.Window, Loggable):
dialog = Gtk.Dialog("",
self, Gtk.DialogFlags.MODAL,
(_("Close without saving"), Gtk.ResponseType.REJECT,
- Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
- save, Gtk.ResponseType.YES))
+ Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
+ save, Gtk.ResponseType.YES))
dialog.set_icon_name("pitivi")
dialog.set_resizable(False)
dialog.set_default_response(Gtk.ResponseType.YES)
@@ -1056,8 +1055,8 @@ class PitiviMainWindow(Gtk.Window, Loggable):
# TODO: bugs #661059, 609136
attempted_uri = self.app.current.uri
reason = _('No replacement file was provided for "<i>%s</i>".\n\n'
- 'PiTiVi does not currently support partial projects.'
- % info_name(tfs))
+ 'PiTiVi does not currently support partial projects.'
+ % info_name(tfs))
# Put an end to the async signals spamming us with dialogs:
self.app.projectManager.disconnect_by_func(self._projectManagerMissingUriCb)
# Don't overlap the file chooser with our error dialog
@@ -1145,8 +1144,7 @@ class PitiviMainWindow(Gtk.Window, Loggable):
# project = self.app.current,
# old is never used, and the new is equal to self.app.current.settings
self.viewer.setDisplayAspectRatio(
- float(new.videopar.num / new.videopar.denom * new.videowidth) /\
- float(new.videoheight))
+ float(new.videopar.num / new.videopar.denom * new.videowidth) / float(new.videoheight))
def _sourceListMissingPluginsCb(self, project, uri, factory,
details, descriptions, missingPluginsCallback):
@@ -1295,8 +1293,7 @@ class PitiviMainWindow(Gtk.Window, Loggable):
mainwindow_width, mainwindow_height = self.get_size()
max_width = 0.85 * mainwindow_width
max_height = 0.85 * mainwindow_height
- if img_width < max_width \
- and (img_height + controls_height) < max_height:
+ if img_width < max_width and (img_height + controls_height) < max_height:
# The video is small enough, keep it 1:1
preview_window.resize(img_width, img_height + controls_height)
else:
diff --git a/pitivi/mediafilespreviewer.py b/pitivi/mediafilespreviewer.py
index 2bfa906..0c00c55 100644
--- a/pitivi/mediafilespreviewer.py
+++ b/pitivi/mediafilespreviewer.py
@@ -39,16 +39,17 @@ GlobalSettings.addConfigOption('FCpreviewHeight',
key='video-preview-height',
default=PREVIEW_HEIGHT)
-acceptable_tags = [Gst.TAG_ALBUM_ARTIST,
- Gst.TAG_ARTIST,
- Gst.TAG_TITLE,
- Gst.TAG_ALBUM,
- Gst.TAG_BITRATE,
- Gst.TAG_COMPOSER,
- Gst.TAG_GENRE,
- Gst.TAG_PERFORMER,
- Gst.TAG_DATE,
- Gst.TAG_COPYRIGHT]
+acceptable_tags = [
+ Gst.TAG_ALBUM_ARTIST,
+ Gst.TAG_ARTIST,
+ Gst.TAG_TITLE,
+ Gst.TAG_ALBUM,
+ Gst.TAG_BITRATE,
+ Gst.TAG_COMPOSER,
+ Gst.TAG_GENRE,
+ Gst.TAG_PERFORMER,
+ Gst.TAG_DATE,
+ Gst.TAG_COPYRIGHT]
class PreviewWidget(Gtk.VBox, Loggable):
@@ -233,7 +234,7 @@ class PreviewWidget(Gtk.VBox, Loggable):
self.b_zoom_out.show()
self.description = _("<b>Resolution</b>: %dÃ%d") % \
((video.get_par_num() / video.get_par_denom()) * video.get_width(), video.get_height()) +\
- "\n" + _("<b>Duration</b>: %s") % pretty_duration + "\n"
+ "\n" + _("<b>Duration</b>: %s") % pretty_duration + "\n"
else:
self.current_preview_type = 'audio'
self.preview_video.hide()
diff --git a/pitivi/medialibrary.py b/pitivi/medialibrary.py
index 73df9f5..aa0d44e 100644
--- a/pitivi/medialibrary.py
+++ b/pitivi/medialibrary.py
@@ -140,7 +140,7 @@ class MediaLibrary(Signallable, Loggable):
"nothing-to-import": [],
"ready": [],
"starting": [],
- }
+ }
def __init__(self):
Loggable.__init__(self)
@@ -649,8 +649,7 @@ class MediaLibraryWidget(Gtk.VBox, Loggable):
# The code below tries to read existing thumbnails from the freedesktop
# thumbnails directory (~/.thumbnails). The filenames are simply
# the file URI hashed with md5, so we can retrieve them easily.
- if [i for i in info.get_stream_list() if\
- isinstance(i, DiscovererVideoInfo)]:
+ if [i for i in info.get_stream_list() if isinstance(i, DiscovererVideoInfo)]:
thumbnail_hash = md5(info.get_uri()).hexdigest()
thumb_dir = os.path.expanduser("~/.thumbnails/")
thumb_path_normal = thumb_dir + "normal/" + thumbnail_hash + ".png"
@@ -661,7 +660,7 @@ class MediaLibraryWidget(Gtk.VBox, Loggable):
thumbnail = GdkPixbuf.Pixbuf.new_from_file(thumb_path_normal)
thumbnail_large = thumbnail
thumbnail_height = int(thumbnail.get_height() / 2)
- thumbnail = thumbnail.scale_simple(64, thumbnail_height, \
+ thumbnail = thumbnail.scale_simple(64, thumbnail_height,
GdkPixbuf.InterpType.BILINEAR)
except:
# TODO gst discoverer should create missing thumbnails.
@@ -793,7 +792,7 @@ class MediaLibraryWidget(Gtk.VBox, Loggable):
"""
model = self.treeview.get_model()
paths = self.getSelectedPaths()
- if paths == None or paths < 1:
+ if paths is None or paths < 1:
return
# use row references so we don't have to care if a path has been removed
rows = []
@@ -1090,7 +1089,7 @@ class MediaLibraryWidget(Gtk.VBox, Loggable):
if len(directories):
# Recursively import from folders that were dragged into the library
self.app.threads.addThread(PathWalker, directories,
- self.app.current.medialibrary.addUris)
+ self.app.current.medialibrary.addUris)
if len(remote_files):
#TODO waiting for remote files downloader support to be implemented
pass
diff --git a/pitivi/preset.py b/pitivi/preset.py
index c843fc4..c7be805 100644
--- a/pitivi/preset.py
+++ b/pitivi/preset.py
@@ -27,12 +27,10 @@ import json
from gettext import gettext as _
-from pitivi.render import available_muxers, available_video_encoders, \
- available_audio_encoders
+from pitivi.render import available_muxers, available_video_encoders, available_audio_encoders
from pitivi.settings import xdg_data_home
from pitivi.utils.misc import isWritable
-from pitivi.configure import get_renderpresets_dir, \
- get_audiopresets_dir, get_videopresets_dir
+from pitivi.configure import get_renderpresets_dir, get_audiopresets_dir, get_videopresets_dir
class DuplicatePresetNameException(Exception):
@@ -149,8 +147,7 @@ class PresetManager(object):
if old_name == new_name:
# Nothing to do.
return
- if (not old_name.lower() == new_name.lower() and
- self.hasPreset(new_name)):
+ if old_name.lower() != new_name.lower() and self.hasPreset(new_name):
raise DuplicatePresetNameException()
self.ordered[path][0] = new_name
self.presets[new_name] = self.presets[old_name]
@@ -393,10 +390,9 @@ class RenderPresetManager(PresetManager):
acodec = parser["acodec"]
vcodec = parser["vcodec"]
- if (acodec not in [fact.get_name() for fact in available_audio_encoders()] or
- vcodec not in [fact.get_name() for fact in available_video_encoders()] or
- container not in [fact.get_name() for fact in available_muxers()]):
-
+ if (acodec not in [fact.get_name() for fact in available_audio_encoders()]
+ or vcodec not in [fact.get_name() for fact in available_video_encoders()]
+ or container not in [fact.get_name() for fact in available_muxers()]):
return
try:
diff --git a/pitivi/project.py b/pitivi/project.py
index de351e2..4b1bae0 100644
--- a/pitivi/project.py
+++ b/pitivi/project.py
@@ -404,15 +404,14 @@ class ProjectManager(Signallable, Loggable):
return True
def revertToSavedProject(self):
- """ discard all unsaved changes and reload current open project """
- #no running project or
- #project has not been modified
- if self.current.uri is None \
- or not self.current.hasUnsavedModifications():
+ """
+ Discard all unsaved changes and reload current open project
+ """
+ if self.current.uri is None or not self.current.hasUnsavedModifications():
return True
-
if not self.emit("reverting-to-saved", self.current):
return False
+
uri = self.current.uri
self.current.setModificationState(False)
self.closeRunningProject()
@@ -514,7 +513,7 @@ class Project(Signallable, Loggable):
__signals__ = {
"settings-changed": ['old', 'new'],
"project-changed": [],
- }
+ }
def __init__(self, name="", uri=None, **kwargs):
"""
@@ -704,17 +703,17 @@ class ProjectSettingsDialog():
self.video_presets.loadAll()
self._fillPresetsTreeview(
- self.audio_preset_treeview, self.audio_presets,
- self._updateAudioPresetButtons)
+ self.audio_preset_treeview, self.audio_presets,
+ self._updateAudioPresetButtons)
self._fillPresetsTreeview(
- self.video_preset_treeview, self.video_presets,
- self._updateVideoPresetButtons)
+ self.video_preset_treeview, self.video_presets,
+ self._updateVideoPresetButtons)
# A map which tells which infobar should be used when displaying
# an error for a preset manager.
self._infobarForPresetManager = {
- self.audio_presets: self.audio_preset_infobar,
- self.video_presets: self.video_preset_infobar}
+ self.audio_presets: self.audio_preset_infobar,
+ self.video_presets: self.video_preset_infobar}
# Bind the widgets in the Video tab to the Video Presets Manager.
self.bindSpinbutton(self.video_presets, "width", self.width_spinbutton)
@@ -793,7 +792,7 @@ class ProjectSettingsDialog():
renderer.connect("edited", self._presetNameEditedCb, mgr)
renderer.connect("editing-started", self._presetNameEditingStartedCb, mgr)
treeview.get_selection().connect("changed", self._presetChangedCb, mgr,
- update_buttons_func)
+ update_buttons_func)
treeview.connect("focus-out-event", self._treeviewDefocusedCb, mgr)
def createAudioNoPreset(self, mgr):
@@ -805,7 +804,7 @@ class ProjectSettingsDialog():
def createVideoNoPreset(self, mgr):
mgr.prependPreset(_("No preset"), {
"par": Gst.Fraction(int(get_combo_value(self.par_combo).num),
- int(get_combo_value(self.par_combo).denom)),
+ int(get_combo_value(self.par_combo).denom)),
"frame-rate": Gst.Fraction(int(get_combo_value(self.frame_rate_combo).num),
int(get_combo_value(self.frame_rate_combo).denom)),
"height": int(self.height_spinbutton.get_value()),
diff --git a/pitivi/render.py b/pitivi/render.py
index fbe655e..033cb64 100644
--- a/pitivi/render.py
+++ b/pitivi/render.py
@@ -53,7 +53,7 @@ def get_compatible_sink_pad(factoryname, caps):
compatible with the given caps.
"""
factory = Gst.Registry.get().lookup_feature(factoryname)
- if factory == None:
+ if factory is None:
log.warning("render", "%s is not a valid factoryname", factoryname)
return None
@@ -78,7 +78,7 @@ def get_compatible_sink_caps(factoryname, caps):
"""
log.log("render", "factoryname : %s , caps : %s", factoryname, caps.to_string())
factory = Gst.Registry.get().lookup_feature(factoryname)
- if factory == None:
+ if factory is None:
log.warning("render", "%s is not a valid factoryname", factoryname)
return None
@@ -261,9 +261,9 @@ def beautify_factoryname(factory):
# only replace lowercase versions of "format", "video", "audio"
# otherwise they might be part of a trademark name
words_to_remove = ["Muxer", "muxer", "Encoder", "encoder",
- "format", "video", "audio", "instead",
- "Flash Video (FLV) /", # Incorrect naming for Sorenson Spark
- ]
+ "format", "video", "audio", "instead",
+ # Incorrect naming for Sorenson Spark:
+ "Flash Video (FLV) /", ]
words_to_replace = [["version ", "v"], ["Microsoft", "MS"], ]
name = factory.get_longname()
for word in words_to_remove:
@@ -390,7 +390,7 @@ class RenderDialog(Loggable):
self.app = app
self.project = project
self.system = app.system
- if pipeline != None:
+ if pipeline is not None:
self._pipeline = pipeline
else:
self._pipeline = self.project.pipeline
@@ -444,8 +444,7 @@ class RenderDialog(Loggable):
self.wg = RippleUpdateGroup()
self.wg.addVertex(self.frame_rate_combo, signal="changed")
- self.wg.addVertex(self.save_render_preset_button,
- update_func=self._updateRenderSaveButton)
+ self.wg.addVertex(self.save_render_preset_button, update_func=self._updateRenderSaveButton)
self.wg.addVertex(self.channels_combo, signal="changed")
self.wg.addVertex(self.sample_rate_combo, signal="changed")
self.wg.addVertex(self.sample_depth_combo, signal="changed")
@@ -456,8 +455,9 @@ class RenderDialog(Loggable):
self.render_presets.loadAll()
self._fillPresetsTreeview(
- self.render_preset_treeview, self.render_presets,
- self._updateRenderPresetButtons)
+ self.render_preset_treeview,
+ self.render_presets,
+ self._updateRenderPresetButtons)
self.wg.addEdge(self.frame_rate_combo, self.save_render_preset_button)
self.wg.addEdge(self.audio_encoder_combo, self.save_render_preset_button)
@@ -467,8 +467,7 @@ class RenderDialog(Loggable):
self.wg.addEdge(self.sample_rate_combo, self.save_render_preset_button)
self.wg.addEdge(self.sample_depth_combo, self.save_render_preset_button)
- self._infobarForPresetManager = {
- self.render_presets: self.render_preset_infobar}
+ self._infobarForPresetManager = {self.render_presets: self.render_preset_infobar}
# Bind widgets to RenderPresetsManager
self.bindCombo(self.render_presets, "channels", self.channels_combo)
@@ -491,8 +490,9 @@ class RenderDialog(Loggable):
"acodec": get_combo_value(self.audio_encoder_combo).get_name(),
"vcodec": get_combo_value(self.video_encoder_combo).get_name(),
"container": get_combo_value(self.muxercombobox).get_name(),
- "frame-rate": Gst.Fraction(int(get_combo_value(self.frame_rate_combo).num),
- int(get_combo_value(self.frame_rate_combo).denom)),
+ "frame-rate": Gst.Fraction(
+ int(get_combo_value(self.frame_rate_combo).num),
+ int(get_combo_value(self.frame_rate_combo).denom)),
"height": self.getDimension("height"),
"width": self.getDimension("width")})
@@ -579,13 +579,13 @@ class RenderDialog(Loggable):
def bindHeight(self, mgr):
mgr.bindWidget("height",
- lambda x: self.settings.setVideoProperties(height=x),
- lambda: 0)
+ lambda x: self.settings.setVideoProperties(height=x),
+ lambda: 0)
def bindWidth(self, mgr):
mgr.bindWidget("width",
- lambda x: self.settings.setVideoProperties(width=x),
- lambda: 0)
+ lambda x: self.settings.setVideoProperties(width=x),
+ lambda: 0)
def getDimension(self, dimension):
value = self.settings.getVideoWidthAndHeight()
@@ -691,7 +691,7 @@ class RenderDialog(Loggable):
"vcodec": get_combo_value(self.video_encoder_combo).get_name(),
"container": get_combo_value(self.muxercombobox).get_name(),
"frame-rate": Gst.Fraction(int(get_combo_value(self.frame_rate_combo).num),
- int(get_combo_value(self.frame_rate_combo).denom)),
+ int(get_combo_value(self.frame_rate_combo).denom)),
"height": 0,
"width": 0})
@@ -826,10 +826,8 @@ class RenderDialog(Loggable):
audio_encoder_model = factorylist(audio_encoders)
self.audio_encoder_combo.set_model(audio_encoder_model)
- self._updateEncoderCombo(
- self.video_encoder_combo, self.preferred_vencoder)
- self._updateEncoderCombo(
- self.audio_encoder_combo, self.preferred_aencoder)
+ self._updateEncoderCombo(self.video_encoder_combo, self.preferred_vencoder)
+ self._updateEncoderCombo(self.audio_encoder_combo, self.preferred_aencoder)
def _updateEncoderCombo(self, encoder_combo, preferred_encoder):
"""Select the specified encoder for the specified encoder combo."""
@@ -854,7 +852,7 @@ class RenderDialog(Loggable):
"""
properties = getattr(self.settings, settings_attr)
self.dialog = GstElementSettingsDialog(factory, properties=properties,
- parent_window=self.window)
+ parent_window=self.window)
self.dialog.ok_btn.connect("clicked", self._okButtonClickedCb, settings_attr)
def startAction(self):
@@ -897,15 +895,16 @@ class RenderDialog(Loggable):
"""
settings = self.project.getSettings()
if (settings.muxer == self.settings.muxer
- and settings.aencoder == self.settings.aencoder
- and settings.vencoder == self.settings.vencoder
- and settings.containersettings == self.settings.containersettings
- and settings.acodecsettings == self.settings.acodecsettings
- and settings.vcodecsettings == self.settings.vcodecsettings
- and settings.render_scale == self.settings.render_scale):
+ and settings.aencoder == self.settings.aencoder
+ and settings.vencoder == self.settings.vencoder
+ and settings.containersettings == self.settings.containersettings
+ and settings.acodecsettings == self.settings.acodecsettings
+ and settings.vcodecsettings == self.settings.vcodecsettings
+ and settings.render_scale == self.settings.render_scale):
# No setting which can be changed in the Render dialog
# and which we want to save have been changed.
return
+
settings.setEncoders(muxer=self.settings.muxer,
aencoder=self.settings.aencoder,
vencoder=self.settings.vencoder)
@@ -939,17 +938,18 @@ class RenderDialog(Loggable):
# FIXME GES: Handle presets here!
self.containerprofile = EncodingContainerProfile.new(None, None,
- Gst.caps_from_string(self.muxertype), None)
+ Gst.caps_from_string(self.muxertype), None)
if self.video_output_checkbutton.get_active():
self.videoprofile = EncodingVideoProfile.new(
- Gst.caps_from_string(self.videotype), None,
- self.settings.getVideoCaps(True), 0)
+ Gst.caps_from_string(self.videotype), None,
+ self.settings.getVideoCaps(True), 0)
self.containerprofile.add_profile(self.videoprofile)
+
if self.audio_output_checkbutton.get_active():
self.audioprofile = EncodingAudioProfile.new(
- Gst.caps_from_string(self.audiotype), None,
- self.settings.getAudioCaps(), 0)
+ Gst.caps_from_string(self.audiotype), None,
+ self.settings.getAudioCaps(), 0)
self.containerprofile.add_profile(self.audioprofile)
self._pipeline.set_render_settings(self.outfile, self.containerprofile)
diff --git a/pitivi/settings.py b/pitivi/settings.py
index f6196f2..27c07d1 100644
--- a/pitivi/settings.py
+++ b/pitivi/settings.py
@@ -237,7 +237,7 @@ class GlobalSettings(Signallable):
@classmethod
def addConfigOption(cls, attrname, type_=None, section=None, key=None,
- environment=None, default=None, notify=False,):
+ environment=None, default=None, notify=False,):
"""
Add a configuration option.
@@ -272,7 +272,7 @@ class GlobalSettings(Signallable):
if environment and environment in cls.environment:
raise ConfigError("Settings environment varaible \"%s\" is"
"already in use.")
- if not type_ and default == None:
+ if not type_ and default is None:
raise ConfigError("Settings attribute \"%s\" has must have a"
" type or a default." % attrname)
if not type_:
@@ -316,7 +316,7 @@ class MultimediaSettings(Signallable, Loggable):
__signals__ = {
"settings-changed": None,
"encoders-changed": None,
- }
+ }
# Audio/Video settings for processing/export
@@ -378,7 +378,7 @@ class MultimediaSettings(Signallable, Loggable):
if self.vcodecsettings:
msg += "\n\t\tCodec settings: " + str(self.vcodecsettings)
msg += "\n\tAudio: " + str(self.audiochannels) + " channels, " +\
- str(self.audiorate) + " Hz, " + str(self.audiodepth) + " bits"
+ str(self.audiorate) + " Hz, " + str(self.audiodepth) + " bits"
msg += "\n\t\tEncoder: " + str(self.aencoder)
if self.acodecsettings:
msg += "\n\t\tCodec settings: " + str(self.acodecsettings)
@@ -404,9 +404,9 @@ class MultimediaSettings(Signallable, Loggable):
""" Returns the GstCaps corresponding to the video settings """
videowidth, videoheight = self.getVideoWidthAndHeight(render=render)
vstr = "width=%d,height=%d,pixel-aspect-ratio=%d/%d,framerate=%d/%d" % (
- videowidth, videoheight,
- self.videopar.num, self.videopar.denom,
- self.videorate.num, self.videorate.denom)
+ videowidth, videoheight,
+ self.videopar.num, self.videopar.denom,
+ self.videorate.num, self.videorate.denom)
caps_str = "video/x-raw,%s" % (vstr)
video_caps = Gst.caps_from_string(caps_str)
if self.vencoder:
diff --git a/pitivi/tabsmanager.py b/pitivi/tabsmanager.py
index 2770141..6d4b7c8 100644
--- a/pitivi/tabsmanager.py
+++ b/pitivi/tabsmanager.py
@@ -66,7 +66,7 @@ class BaseTabs(Gtk.Notebook):
window.set_title(label.get_text())
window.set_default_size(600, 400)
window.connect("destroy", self._detachedWindowDestroyCb,
- page, original_position, label)
+ page, original_position, label)
notebook = Gtk.Notebook()
notebook.props.show_tabs = False
window.add(notebook)
diff --git a/pitivi/timeline/curve.py b/pitivi/timeline/curve.py
index 0043395..a9a5461 100644
--- a/pitivi/timeline/curve.py
+++ b/pitivi/timeline/curve.py
@@ -130,8 +130,7 @@ class Curve(GooCanvas.CanvasItemSimple, GooCanvas.CanvasItem, View, Zoomable):
def leave(self, item, target):
self._view.normal()
- def __init__(self, instance, element, interpolator, height=LAYER_HEIGHT_EXPANDED,
- **kwargs):
+ def __init__(self, instance, element, interpolator, height=LAYER_HEIGHT_EXPANDED, **kwargs):
super(Curve, self).__init__(**kwargs)
View.__init__(self)
Zoomable.__init__(self)
@@ -290,9 +289,8 @@ class Curve(GooCanvas.CanvasItemSimple, GooCanvas.CanvasItem, View, Zoomable):
self._controlPoint(cr, kf)
def do_simple_is_item_at(self, x, y, cr, pointer_event):
- if (between(0, x, self.visible_width) and
- between(KW_LABEL_Y_OVERFLOW, y, self.height +
- KW_LABEL_Y_OVERFLOW)):
+ if between(0, x, self.visible_width) and
+ between(KW_LABEL_Y_OVERFLOW, y, self.height + KW_LABEL_Y_OVERFLOW):
x += self.bounds.x1
y += self.bounds.y1
cr.new_path()
@@ -322,8 +320,8 @@ class Curve(GooCanvas.CanvasItemSimple, GooCanvas.CanvasItem, View, Zoomable):
x, y = pos
for keyframe, value in self.keyframes.iteritems():
kx, ky = value
- if (between(kx - KW_MOUSE_WIDTH, x, kx + KW_MOUSE_WIDTH) and
- between(ky - KW_MOUSE_HEIGHT, y, ky + KW_MOUSE_HEIGHT)):
+ if between(kx - KW_MOUSE_WIDTH, x, kx + KW_MOUSE_WIDTH) and
+ between(ky - KW_MOUSE_HEIGHT, y, ky + KW_MOUSE_HEIGHT):
return keyframe
return None
diff --git a/pitivi/timeline/layer.py b/pitivi/timeline/layer.py
index fe2e31b..965b4d1 100644
--- a/pitivi/timeline/layer.py
+++ b/pitivi/timeline/layer.py
@@ -341,11 +341,8 @@ class TwoStateButton(Gtk.Button):
"""
__gsignals__ = {
- "changed-state": (
- GObject.SignalFlags.RUN_LAST,
- None,
- (GObject.TYPE_PYOBJECT,),)
- }
+ "changed-state": (GObject.SignalFlags.RUN_LAST, None, (GObject.TYPE_PYOBJECT,),)
+ }
def __init__(self, state1="", state2=""):
Gtk.Button.__init__(self)
diff --git a/pitivi/timeline/ruler.py b/pitivi/timeline/ruler.py
index 42d355a..f607778 100644
--- a/pitivi/timeline/ruler.py
+++ b/pitivi/timeline/ruler.py
@@ -50,7 +50,7 @@ class ScaleRuler(Gtk.DrawingArea, Zoomable, Loggable):
"scroll-event": "override",
"seek": (GObject.SignalFlags.RUN_LAST, None,
[GObject.TYPE_UINT64])
- }
+ }
border = 0
min_tick_spacing = 3
@@ -179,11 +179,11 @@ class ScaleRuler(Gtk.DrawingArea, Zoomable, Loggable):
self.app.gui.timeline_ui.zoomed_fitted = False
else:
# No modifier key held down, just scroll
- if event.scroll.direction == Gdk.ScrollDirection.UP or\
- event.scroll.direction == Gdk.ScrollDirection.LEFT:
+ if (event.scroll.direction == Gdk.ScrollDirection.UP
+ or event.scroll.direction == Gdk.ScrollDirection.LEFT):
self.app.gui.timeline_ui.scroll_left()
- elif event.scroll.direction == Gdk.ScrollDirection.DOWN or\
- event.scroll.direction == Gdk.ScrollDirection.RIGHT:
+ elif (event.scroll.direction == Gdk.ScrollDirection.DOWN
+ or event.scroll.direction == Gdk.ScrollDirection.RIGHT):
self.app.gui.timeline_ui.scroll_right()
def setProjectFrameRate(self, rate):
diff --git a/pitivi/timeline/thumbnailer.py b/pitivi/timeline/thumbnailer.py
index ccbed17..e2861ca 100644
--- a/pitivi/timeline/thumbnailer.py
+++ b/pitivi/timeline/thumbnailer.py
@@ -407,8 +407,7 @@ class RandomAccessPreviewer(Previewer):
def _requestThumbnail(self, segment):
"""Queue a thumbnail request for the given segment"""
- if (segment not in self._queue) and (len(self._queue) <=
- self.max_requests):
+ if segment not in self._queue and len(self._queue) <= self.max_requests:
if self._queue:
self._queue.append(segment)
else:
@@ -714,9 +713,9 @@ class CairoSurfaceThumbnailSink(GstBase.BaseSink):
__gsignals__ = {
"thumbnail": (GObject.SignalFlags.RUN_LAST,
- None,
- (GObject.TYPE_PYOBJECT, GObject.TYPE_UINT64))
- }
+ None,
+ (GObject.TYPE_PYOBJECT, GObject.TYPE_UINT64))
+ }
__gsttemplates__ = (
Gst.PadTemplate.new("sink",
@@ -736,7 +735,7 @@ class CairoSurfaceThumbnailSink(GstBase.BaseSink):
big_to_cairo_red_mask,
big_to_cairo_green_mask,
big_to_cairo_blue_mask)))
- )
+ )
def __init__(self):
GstBase.BaseSink.__init__(self)
@@ -839,7 +838,7 @@ class Preview(GooCanvas.CanvasItemSimple, GooCanvas.CanvasItem, Zoomable):
def _update_preview(self, previewer, segment):
# if segment is none we are not just drawing a new thumbnail, so we
# should update bounds
- if segment == None:
+ if segment is None:
self.changed(True)
else:
self.changed(False)
diff --git a/pitivi/timeline/timeline.py b/pitivi/timeline/timeline.py
index 8d6ecd6..8af9260 100644
--- a/pitivi/timeline/timeline.py
+++ b/pitivi/timeline/timeline.py
@@ -97,7 +97,7 @@ PLAYHEAD_CURSOR = Gdk.Cursor.new(Gdk.CursorType.SB_H_DOUBLE_ARROW)
# Drag and drop constants/tuples
# FIXME, rethink the way we handle that as it is quite 'hacky'
-DND_EFFECT_LIST = [[VIDEO_EFFECT_TARGET_ENTRY.target, EFFECT_TARGET_ENTRY.target],\
+DND_EFFECT_LIST = [[VIDEO_EFFECT_TARGET_ENTRY.target, EFFECT_TARGET_ENTRY.target],
[AUDIO_EFFECT_TARGET_ENTRY.target, EFFECT_TARGET_ENTRY.target]]
VIDEO_EFFECT_LIST = [VIDEO_EFFECT_TARGET_ENTRY.target, EFFECT_TARGET_ENTRY.target],
AUDIO_EFFECT_LIST = [AUDIO_EFFECT_TARGET_ENTRY.target, EFFECT_TARGET_ENTRY.target],
@@ -486,11 +486,8 @@ class TimelineControls(Gtk.VBox, Loggable):
"""
__gsignals__ = {
- "selection-changed": (
- GObject.SignalFlags.RUN_LAST,
- None,
- (GObject.TYPE_PYOBJECT,),)
- }
+ "selection-changed": (GObject.SignalFlags.RUN_LAST, None, (GObject.TYPE_PYOBJECT,),)
+ }
def __init__(self, instance):
Gtk.VBox.__init__(self)
@@ -512,7 +509,7 @@ class TimelineControls(Gtk.VBox, Loggable):
self.connect("drag_motion", self._dragMotionCb)
self.connect("drag_leave", self._dragLeaveCb)
self.drag_dest_set(Gtk.DestDefaults.ALL,
- [LAYER_CONTROL_TARGET_ENTRY], Gdk.DragAction.MOVE)
+ [LAYER_CONTROL_TARGET_ENTRY], Gdk.DragAction.MOVE)
def _sizeAllocatedCb(self, widget, alloc):
if self.get_children():
@@ -636,8 +633,7 @@ class TimelineControls(Gtk.VBox, Loggable):
def getYOfLayer(self, track_type, layer):
y = 0
for child in self.get_children():
- if layer == child.layer and \
- isinstance(child, self.type_map[track_type]):
+ if layer == child.layer and isinstance(child, self.type_map[track_type]):
return y
y += child.getHeight()
@@ -1183,7 +1179,7 @@ class Timeline(Gtk.Table, Loggable, Zoomable):
# Let some time for TrackObject-s to be created
if self._temp_objects and not self._creating_tckobjs_sigid:
focus = self._temp_objects[0]
- if self._move_context is None:
+ if self._move_context is None:
self._move_context = EditingContext(focus,
self.timeline, GES.EditMode.EDIT_NORMAL, GES.Edge.EDGE_NONE,
set(self._temp_objects[1:]), self.app.settings)
@@ -1812,7 +1808,7 @@ class Timeline(Gtk.Table, Loggable, Zoomable):
self.app.action_log.begin("remove volume point")
interpolator.removeKeyframe(kf)
self.app.action_log.commit()
- if keyframe_exists == False:
+ if keyframe_exists is False:
self.app.action_log.begin("add volume point")
interpolator.newKeyframe(position_in_obj)
self.app.action_log.commit()
diff --git a/pitivi/timeline/track.py b/pitivi/timeline/track.py
index a2863c5..967413a 100644
--- a/pitivi/timeline/track.py
+++ b/pitivi/timeline/track.py
@@ -193,7 +193,7 @@ class TrackObjectController(Controller):
if not self._view.element.selected:
self._view.timeline.selection.setToObj(self._view.element, SELECT)
- if self.previous_x != None:
+ if self.previous_x is not None:
ratio = float(self.ref / Zoomable.pixelToNs(10000000000))
self.previous_x = self.previous_x * ratio
@@ -221,7 +221,7 @@ class TrackObjectController(Controller):
position = Zoomable.pixelToNs(x)
priority = self.app.gui.timeline_ui.controls.getPriorityForY(
- y - self._y_offset + self._vadj.get_value())
+ y - self._y_offset + self._vadj.get_value())
self._context.setMode(self._getMode())
self.debug("Setting position")
@@ -285,9 +285,9 @@ class TrimHandle(View, GooCanvas.CanvasImage, Loggable, Zoomable):
def _scalePixbuf(self):
self.props.pixbuf = self.current_pixbuf.scale_simple(
- self.current_pixbuf.get_width(),
- self.height,
- GdkPixbuf.InterpType.BILINEAR)
+ self.current_pixbuf.get_width(),
+ self.height,
+ GdkPixbuf.InterpType.BILINEAR)
class StartHandle(TrimHandle):
@@ -724,8 +724,10 @@ class TrackTitleSource(TrackObject):
def __init__(self, instance, element, track, timeline, utrack):
TrackObject.__init__(self, instance, element, track, timeline, utrack)
#self.preview = Preview(self.app, element)
- for thing in (self.bg, self._selec_indic,
- self.start_handle, self.end_handle, self.namebg, self.name):
+ object_thingies = (self.bg, self._selec_indic,
+ self.start_handle, self.end_handle,
+ self.namebg, self.name)
+ for thing in object_thingies:
self.add_child(thing, -1)
def _getColor(self):
@@ -750,8 +752,10 @@ class TrackFileSource(TrackObject):
def __init__(self, instance, element, track, timeline, utrack):
TrackObject.__init__(self, instance, element, track, timeline, utrack)
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):
+ object_thingies = (self.bg, self.preview, self._selec_indic,
+ self.start_handle, self.end_handle,
+ self.namebg, self.name)
+ for thing in object_thingies:
self.add_child(thing, -1)
def _setElement(self, element):
diff --git a/pitivi/titleeditor.py b/pitivi/titleeditor.py
index 5c7e1cd..c6e8738 100644
--- a/pitivi/titleeditor.py
+++ b/pitivi/titleeditor.py
@@ -70,8 +70,7 @@ class AttrIterator():
except:
pass
- while len(self.attributes) != 0 and \
- self.attributes[0].start_index == self.start_index:
+ while len(self.attributes) != 0 and self.attributes[0].start_index == self.start_index:
if self.attributes[0].end_index > self.start_index:
self.attribute_stack.append(self.attributes[0])
self.end_index = min(self.end_index, self.attributes[0].end_index)
@@ -332,14 +331,14 @@ class PangoBuffer(Gtk.TextBuffer):
if interval[0] < split_interval[0]:
if interval[1] == split_interval[1]:
return [(interval[0], split_interval[0] - 1),
- (split_interval[0], interval[1])]
+ (split_interval[0], interval[1])]
elif interval[1] < split_interval[1]:
return [(interval[0], split_interval[0] - 1),
- (split_interval[0], interval[1])]
+ (split_interval[0], interval[1])]
else: # interval[1] > split_interval[1]
return [(interval[0], split_interval[0] - 1),
- (split_interval[0], split_interval[1]),
- (split_interval[1] + 1, interval[1])]
+ (split_interval[0], split_interval[1]),
+ (split_interval[1] + 1, interval[1])]
if interval[0] > split_interval[0]:
if interval[1] == split_interval[1]:
@@ -726,9 +725,9 @@ class TitleEditor(Loggable):
self.bt["back_color"].set_visible(True)
color = self.source.get_background()
color = Gdk.RGBA(color / 256 ** 2 % 256 / 255.,
- color / 256 ** 1 % 256 / 255.,
- color / 256 ** 0 % 256 / 255.,
- color / 256 ** 3 % 256 / 255.)
+ color / 256 ** 1 % 256 / 255.,
+ color / 256 ** 0 % 256 / 255.,
+ color / 256 ** 3 % 256 / 255.)
self.bt["back_color"].set_rgba(color)
else:
self.bt["back_color"].set_visible(False)
@@ -792,8 +791,8 @@ class TitleEditor(Loggable):
self._deactivate()
else:
assert isinstance(source, GES.TrackTextOverlay) or \
- isinstance(source, GES.TrackTitleSource) or \
- isinstance(source, GES.TimelineTitleSource)
+ isinstance(source, GES.TrackTitleSource) or \
+ isinstance(source, GES.TimelineTitleSource)
self._updateFromSource()
self._activate()
diff --git a/pitivi/undo/effect.py b/pitivi/undo/effect.py
index aaf9db4..da6a28c 100644
--- a/pitivi/undo/effect.py
+++ b/pitivi/undo/effect.py
@@ -76,15 +76,13 @@ class EffectGstElementPropertyChangeTracker:
for undo_stack in self.action_log.undo_stacks:
for done_prop_change in undo_stack.done_actions:
if isinstance(done_prop_change, EffectPropertyChanged):
- if done_prop_change.gst_element is\
- track_effect.getElement():
+ if done_prop_change.gst_element is track_effect.getElement():
prop_changed.append(done_prop_change)
for redo_stack in self.action_log.redo_stacks:
for done_prop_change in redo_stack.done_actions:
if isinstance(done_prop_change, EffectPropertyChanged):
- if done_prop_change.gst_element is\
- track_effect.getElement():
+ if done_prop_change.gst_element is track_effect.getElement():
prop_changed.append(done_prop_change)
return prop_changed
@@ -92,8 +90,7 @@ class EffectGstElementPropertyChangeTracker:
def _propertyChangedCb(self, gst_element, pspec, unused):
old_value = self._tracked_effects[gst_element][pspec.name]
new_value = gst_element.get_property(pspec.name)
- action = EffectPropertyChanged(gst_element, pspec.name, old_value,
- new_value)
+ action = EffectPropertyChanged(gst_element, pspec.name, old_value, new_value)
self._tracked_effects[gst_element][pspec.name] = new_value
self.action_log.push(action)
@@ -136,14 +133,14 @@ class TrackEffectAdded(UndoableAction):
element = self.track_object.getElement()
props = GObject.list_properties(element)
self.effect_props = [(prop.name, element.get_property(prop.name))
- for prop in props
- if prop.flags & GObject.PARAM_WRITABLE
- and prop.name not in PROPS_TO_IGNORE]
+ for prop in props
+ if prop.flags & GObject.PARAM_WRITABLE
+ and prop.name not in PROPS_TO_IGNORE]
gnl_props = GObject.list_properties(self.track_object.gnl_object)
gnl_obj = self.track_object.gnl_object
self.gnl_obj_props = [(prop.name, gnl_obj.get_property(prop.name))
- for prop in gnl_props
- if prop.flags & GObject.PARAM_WRITABLE]
+ for prop in gnl_props
+ if prop.flags & GObject.PARAM_WRITABLE]
self.timeline_object.removeTrackObject(self.track_object)
self.track_object.track.removeTrackObject(self.track_object)
@@ -169,15 +166,15 @@ class TrackEffectRemoved(UndoableAction):
element = self.track_object.getElement()
props = GObject.list_properties(element)
self.effect_props = [(prop.name, element.get_property(prop.name))
- for prop in props
- if prop.flags & GObject.PARAM_WRITABLE
- and prop.name not in PROPS_TO_IGNORE]
+ for prop in props
+ if prop.flags & GObject.PARAM_WRITABLE
+ and prop.name not in PROPS_TO_IGNORE]
gnl_props = GObject.list_properties(self.track_object.gnl_object)
gnl_obj = self.track_object.gnl_object
self.gnl_obj_props = [(prop.name, gnl_obj.get_property(prop.name))
- for prop in gnl_props
- if prop.flags & GObject.PARAM_WRITABLE]
+ for prop in gnl_props
+ if prop.flags & GObject.PARAM_WRITABLE]
self.timeline_object.removeTrackObject(self.track_object)
self.track_object.track.removeTrackObject(self.track_object)
diff --git a/pitivi/undo/undo.py b/pitivi/undo/undo.py
index 38c77b2..6c538d8 100644
--- a/pitivi/undo/undo.py
+++ b/pitivi/undo/undo.py
@@ -294,8 +294,7 @@ class PropertyChangeTracker(Signallable):
def _takeCurrentSnapshot(self, obj):
properties = {}
for property_name in self.property_names:
- properties[property_name] = \
- obj.get_property(property_name.replace("-", "_"))
+ properties[property_name] = obj.get_property(property_name.replace("-", "_"))
return properties
diff --git a/pitivi/utils/loggable.py b/pitivi/utils/loggable.py
index 7671156..54fe7a6 100644
--- a/pitivi/utils/loggable.py
+++ b/pitivi/utils/loggable.py
@@ -279,7 +279,7 @@ def getLevelName(level):
@rtype: str
"""
assert isinstance(level, int) and level > 0 and level < 6, \
- TypeError("Bad debug level")
+ TypeError("Bad debug level")
return getLevelNames()[level - 1]
@@ -307,7 +307,7 @@ def getLevelInt(levelName):
def getFormattedLevelName(level):
assert isinstance(level, int) and level > 0 and level < 6, \
- TypeError("Bad debug level")
+ TypeError("Bad debug level")
return _FORMATTED_LEVELS[level - 1]
@@ -486,15 +486,14 @@ def getFormatArgs(startFormat, startArgs, endFormat, endArgs, args, kwargs):
debugArgs.extend(items)
debugArgs.extend(endArgs)
format = startFormat \
- + ', '.join(('%s', ) * len(args)) \
- + (kwargs and ', ' or '') \
- + ', '.join(('%s=%r', ) * len(kwargs)) \
- + endFormat
+ + ', '.join(('%s', ) * len(args)) \
+ + (kwargs and ', ' or '') \
+ + ', '.join(('%s=%r', ) * len(kwargs)) \
+ + endFormat
return format, debugArgs
-def doLog(level, object, category, format, args, where=-1,
- filePath=None, line=None):
+def doLog(level, object, category, format, args, where=-1, filePath=None, line=None):
"""
@param where: what to log file and line number for;
-1 for one frame above log.py; -2 and down for higher up;
@@ -1003,7 +1002,7 @@ class BaseLoggable(object):
return {}
args = self.logFunction(*args)
return doLog(level, self.logObjectName(), self.logCategory,
- format, args, where=where, **kwargs)
+ format, args, where=where, **kwargs)
def warningFailure(self, failure, swallow=True):
"""
diff --git a/pitivi/utils/misc.py b/pitivi/utils/misc.py
index ddb050b..c22bc29 100644
--- a/pitivi/utils/misc.py
+++ b/pitivi/utils/misc.py
@@ -67,9 +67,9 @@ def print_ns(time):
return "CLOCK_TIME_NONE"
return str(time / (Gst.SECOND * 60 * 60)) + ':' + \
- str((time / (Gst.SECOND * 60)) % 60) + ':' + \
- str((time / Gst.SECOND) % 60) + ':' + \
- str(time % Gst.SECOND)
+ str((time / (Gst.SECOND * 60)) % 60) + ':' + \
+ str((time / Gst.SECOND) % 60) + ':' + \
+ str(time % Gst.SECOND)
def call_false(function, *args, **kwargs):
diff --git a/pitivi/utils/pipeline.py b/pitivi/utils/pipeline.py
index 3c3359c..c45f903 100644
--- a/pitivi/utils/pipeline.py
+++ b/pitivi/utils/pipeline.py
@@ -111,7 +111,7 @@ class Seeker(Signallable, Loggable):
return False
self._time = None
- elif self.position != None and self.format != None:
+ elif self.position is not None and self.format is not None:
position, self.position = self.position, None
format, self.format = self.format, None
try:
@@ -465,10 +465,9 @@ class Pipeline(GES.TimelinePipeline, SimplePipeline):
(GObject.TYPE_UINT64,)),
"duration-changed": (GObject.SignalFlags.RUN_LAST, None,
(GObject.TYPE_UINT64,)),
- "eos": (GObject.SignalFlags.RUN_LAST, None,
- ()),
+ "eos": (GObject.SignalFlags.RUN_LAST, None, ()),
"error": (GObject.SignalFlags.RUN_LAST, None,
- (GObject.TYPE_STRING, GObject.TYPE_STRING)),
+ (GObject.TYPE_STRING, GObject.TYPE_STRING)),
"window-handle-message": (GObject.SignalFlags.RUN_LAST, None,
(GObject.TYPE_PYOBJECT,))}
diff --git a/pitivi/utils/receiver.py b/pitivi/utils/receiver.py
index 0ed42f2..d051e4b 100644
--- a/pitivi/utils/receiver.py
+++ b/pitivi/utils/receiver.py
@@ -37,7 +37,7 @@ class receiver(object):
# False truth value. We don't want to forget to disconnect any signals,
# and at the same time we don't want to fail to connect a valid
# instance of, say, an empty container.
- if rd.sender != None:
+ if rd.sender is not None:
for sid in rd.sigids.itervalues():
instance._receiver_data[self].sender.disconnect(sid)
rd.sender = None
diff --git a/pitivi/utils/signal.py b/pitivi/utils/signal.py
index 5c921af..cc95533 100644
--- a/pitivi/utils/signal.py
+++ b/pitivi/utils/signal.py
@@ -88,7 +88,7 @@ class SignalGroup:
"""
Disconnects all signal in the group connect on the given object
"""
- assert obj != None
+ assert obj is not None
objids = [sid for sid in self.signal_handler_ids.keys() if self.signal_handler_ids[sid][0] == obj]
for sid in objids:
old_object, handler_id = self.signal_handler_ids.pop(id)
@@ -225,8 +225,7 @@ class Signallable(object):
if not hasattr(self, "_signal_group"):
self._signal_group = self.SignalGroup(self)
- return self._signal_group.connect(signame,
- cb, args, kwargs)
+ return self._signal_group.connect(signame, cb, args, kwargs)
def disconnect(self, sigid):
"""
diff --git a/pitivi/utils/system.py b/pitivi/utils/system.py
index d7fa2b0..ae1abea 100644
--- a/pitivi/utils/system.py
+++ b/pitivi/utils/system.py
@@ -47,7 +47,7 @@ class System(Signallable, Loggable):
#generic functions
def _inhibit(self, list_, key):
- if key == None or (not isinstance(key, str)):
+ if key is None or (not isinstance(key, str)):
assert False
if not key in list_:
@@ -56,7 +56,7 @@ class System(Signallable, Loggable):
self.emit('update-power-inhibition')
def _uninhibit(self, list_, key):
- if key == None:
+ if key is None:
if self._isInhibited(list_):
list_ = []
self.log("emitting 'update-power-inhibition'")
@@ -80,7 +80,7 @@ class System(Signallable, Loggable):
return keys
def _isInhibited(self, list_, key=None):
- if key == None:
+ if key is None:
if len(list_) > 0:
return True
elif key in list_:
@@ -186,7 +186,7 @@ class FreedesktopOrgSystem(System):
# FIXME Notifications disabled for the time being
#notification = Notify.Notification(title, message)
- #if icon != None and isinstance(icon, GdkPixbuf.Pixbuf):
+ #if icon is not None and isinstance(icon, GdkPixbuf.Pixbuf):
#notification.set_icon_from_pixbuf(icon)
#notification.show()
@@ -237,7 +237,7 @@ class GnomeSystem(FreedesktopOrgSystem):
if self.cookie_type != COOKIE_SLEEP:
new_cookie = self.session_iface.Inhibit(APPNAME, toplevel_id,
self.getSleepInhibitors(), INHIBIT_SUSPEND | INHIBIT_LOGOUT)
- if self.cookie != None:
+ if self.cookie is not None:
self.session_iface.Uninhibit(self.cookie)
self.cookie = new_cookie
self.cookie_type = COOKIE_SLEEP
@@ -249,7 +249,7 @@ class GnomeSystem(FreedesktopOrgSystem):
if self.cookie_type != COOKIE_SCREENSAVER:
new_cookie = self.session_iface.Inhibit(APPNAME, toplevel_id,
self.getScreensaverInhibitors(), INHIBIT_SESSION_IDLE)
- if self.cookie != None:
+ if self.cookie is not None:
self.session_iface.Uninhibit(self.cookie)
self.cookie = new_cookie
self.cookie_type = COOKIE_SCREENSAVER
@@ -281,7 +281,7 @@ if os.name == 'posix':
except:
pass
- if system_ == None:
+ if system_ is None:
try:
# FIXME Disable notifications for the time being as it causes
# various errors and the implementation is not done yet
@@ -297,10 +297,10 @@ elif os.name == 'mac':
def getSystem():
system = None
- if system_ != None:
+ if system_ is not None:
system = system_()
- if system == None:
+ if system is None:
system = System()
return system
diff --git a/pitivi/utils/timeline.py b/pitivi/utils/timeline.py
index 9ed402c..c2ed12f 100644
--- a/pitivi/utils/timeline.py
+++ b/pitivi/utils/timeline.py
@@ -336,8 +336,7 @@ class Controller(Loggable):
self._event_common(item, target, event)
if not self._canvas:
self._canvas = item.get_canvas()
- self._mousedown = self.pos(item) - self.transform(self.from_item_event(
- item, event))
+ self._mousedown = self.pos(item) - self.transform(self.from_item_event(item, event))
self._dragging = target
self._initial = self.pos(target)
self._pending_drag_start = (item, target, event)
@@ -348,14 +347,12 @@ class Controller(Loggable):
self._event_common(item, target, event)
if self._dragging:
if self._pending_drag_start is not None:
- pending_drag_start, self._pending_drag_start = \
- self._pending_drag_start, None
+ pending_drag_start, self._pending_drag_start = self._pending_drag_start, None
self._pending_drag_end = True
self._drag_start(*pending_drag_start)
self.set_pos(self._dragging,
- self.transform(self._mousedown + self.from_item_event(item,
- event)))
+ self.transform(self._mousedown + self.from_item_event(item, event)))
return self._handle_motion_notify
else:
self.hover(item, target, event)
@@ -572,8 +569,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_steps)
+ cls.zoom_range) ** (1.0 / 3.0)) * cls.zoom_steps)
@classmethod
def pixelToNs(cls, pixel):
@@ -596,8 +592,7 @@ class Zoomable(object):
set zoom ratio
"""
## DIE YOU CUNTMUNCH CLOCK_TIME_NONE UBER STUPIDITY OF CRACK BINDINGS !!!!!!
- if duration == 18446744073709551615 or \
- long(duration) == long(Gst.CLOCK_TIME_NONE):
+ if duration == Gst.CLOCK_TIME_NONE:
return 0
return int((float(duration) / Gst.SECOND) * cls.zoomratio)
diff --git a/pitivi/utils/widgets.py b/pitivi/utils/widgets.py
index 23f4de8..3ae184c 100644
--- a/pitivi/utils/widgets.py
+++ b/pitivi/utils/widgets.py
@@ -200,8 +200,7 @@ class NumericWidget(Gtk.HBox, DynamicWidget):
self.upper = upper
self.lower = lower
self._type = None
- if (upper != None) and (lower != None) and\
- (upper < 5000) and (lower > -5000):
+ if (lower is not None and upper is not None) and (lower > -5000 and upper < 5000):
self.slider = Gtk.Scale.new(Gtk.Orientation.HORIZONTAL, self.adjustment)
self.pack_start(self.slider, fill=True, expand=True, padding=0)
self.slider.show()
@@ -706,18 +705,17 @@ if __name__ == '__main__':
("pear", "pear")),)),
(ColorWidget, 0x336699FF, (int,)),
(FontWidget, "Sans 9", ()),
- (FractionWidget, "30M",
- (Gst.FractionRange(Gst.Fraction(1, 1),
- Gst.Fraction(30000, 1001)),)),
- (FractionWidget, Gst.Fraction(25000, 1001),
- (
- Gst.FractionRange(
- Gst.Fraction(1, 1),
- Gst.Fraction(30000, 1001)
- ),
- ("25:1", Gst.Fraction(30, 1), "30M", ),
- )
- ),
+ (FractionWidget, "30M", (
+ Gst.FractionRange(Gst.Fraction(1, 1),
+ Gst.Fraction(30000, 1001)),
+ )),
+ (FractionWidget, Gst.Fraction(25000, 1001), (
+ Gst.FractionRange(
+ Gst.Fraction(1, 1),
+ Gst.Fraction(30000, 1001)
+ ),
+ ("25:1", Gst.Fraction(30, 1), "30M", ),
+ )),
)
W = Gtk.Window()
@@ -745,33 +743,30 @@ def make_property_widget(unused_element, prop, value=None):
# FIXME : implement the case for flags
type_name = GObject.type_name(prop.value_type.fundamental)
- if value == None:
+ if value is None:
value = prop.default_value
if type_name == "gchararray":
widget = TextWidget(default=prop.default_value)
- elif (type_name in ['guint64', 'gint64', 'guint', 'gint', 'gfloat',
- 'gulong', 'gdouble']):
-
+ elif type_name in ['guint64', 'gint64', 'guint', 'gint', 'gfloat', 'gulong', 'gdouble']:
maximum, minimum = None, None
if hasattr(prop, "minimum"):
minimum = prop.minimum
if hasattr(prop, "maximum"):
maximum = prop.maximum
- widget = NumericWidget(default=prop.default_value,
- upper=maximum, lower=minimum)
- elif (type_name == 'gboolean'):
+ widget = NumericWidget(default=prop.default_value, upper=maximum, lower=minimum)
+ elif type_name == "gboolean":
widget = ToggleWidget(default=prop.default_value)
- elif (type_name == 'GEnum'):
+ elif type_name == "GEnum":
choices = []
for key, val in prop.enum_class.__enum_values__.iteritems():
choices.append([val.value_name, int(val)])
widget = ChoiceWidget(choices, default=prop.default_value)
- elif type_name == 'GstFraction':
+ elif type_name == "GstFraction":
widget = FractionWidget(None, presets=["0:1"], default=prop.default_value)
else:
widget = DefaultWidget(type_name)
- if value is not None and type_name != 'GFlags':
+ if value is not None and type_name != "GFlags":
widget.setWidgetValue(value)
return widget
@@ -836,8 +831,8 @@ class GstElementSettingsWidget(Gtk.VBox, Loggable):
y = 0
for prop in props:
- if not prop.flags & GObject.PARAM_WRITABLE\
- or not prop.flags & GObject.PARAM_READABLE:
+ if (not prop.flags & GObject.PARAM_WRITABLE
+ or not prop.flags & GObject.PARAM_READABLE):
continue
if is_effect:
@@ -896,11 +891,11 @@ class GstElementSettingsWidget(Gtk.VBox, Loggable):
"""
d = {}
for prop, widget in self.properties.iteritems():
- if not prop.flags & GObject.PARAM_WRITABLE\
- or isinstance(widget, DefaultWidget):
+ if (not prop.flags & GObject.PARAM_WRITABLE
+ or isinstance(widget, DefaultWidget)):
continue
value = widget.getWidgetValue()
- if value != None and (value != prop.default_value or with_default):
+ if value is not None and (value != prop.default_value or with_default):
d[prop.name] = value
return d
diff --git a/pitivi/viewer.py b/pitivi/viewer.py
index ae77027..e83598a 100644
--- a/pitivi/viewer.py
+++ b/pitivi/viewer.py
@@ -309,8 +309,8 @@ class PitiviViewer(Gtk.VBox, Loggable):
width = int(float(maxSize.width) * zoom)
height = int(float(maxSize.height) * zoom)
area = ((maxSize.width - width) / 2,
- (maxSize.height - height) / 2,
- width, height)
+ (maxSize.height - height) / 2,
+ width, height)
self.sink.set_render_rectangle(*area)
self.target.box.update_size(area)
self.target.zoom = zoom
@@ -507,25 +507,25 @@ class Point():
def draw(self, cr):
linear = cairo.LinearGradient(self.x, self.y - self.radius,
- self.x, self.y + self.radius)
+ self.x, self.y + self.radius)
linear.add_color_stop_rgba(0.00, .6, .6, .6, 1)
linear.add_color_stop_rgba(0.50, .4, .4, .4, .1)
linear.add_color_stop_rgba(0.60, .4, .4, .4, .1)
linear.add_color_stop_rgba(1.00, .6, .6, .6, 1)
radial = cairo.RadialGradient(self.x + self.radius / 2,
- self.y - self.radius / 2, 1,
- self.x, self.y,
- self.radius)
+ self.y - self.radius / 2, 1,
+ self.x, self.y,
+ self.radius)
if self.clicked:
radial.add_color_stop_rgb(0, *self.clickedColor)
else:
radial.add_color_stop_rgb(0, *self.color)
radial.add_color_stop_rgb(1, 0.1, 0.1, 0.1)
radial_glow = cairo.RadialGradient(self.x, self.y,
- self.radius * .9,
- self.x, self.y,
- self.radius * 1.2)
+ self.radius * .9,
+ self.x, self.y,
+ self.radius * 1.2)
radial_glow.add_color_stop_rgba(0, 0.9, 0.9, 0.9, 1)
radial_glow.add_color_stop_rgba(1, 0.9, 0.9, 0.9, 0)
@@ -917,8 +917,8 @@ class ViewerWidget(Gtk.DrawingArea, Loggable):
width = int(float(self.area.width) * self.zoom)
height = int(float(self.area.height) * self.zoom)
area = ((self.area.width - width) / 2,
- (self.area.height - height) / 2,
- width, height)
+ (self.area.height - height) / 2,
+ width, height)
self.sink.set_render_rectangle(*area)
else:
area = self.area
@@ -969,7 +969,7 @@ class PlayPauseButton(Gtk.Button, Loggable):
"""
__gsignals__ = {
"play": (GObject.SignalFlags.RUN_LAST, None, (GObject.TYPE_BOOLEAN,))
- }
+ }
def __init__(self):
Gtk.Button.__init__(self)
diff --git a/tests/common.py b/tests/common.py
index 0c3274c..ae5e5ef 100644
--- a/tests/common.py
+++ b/tests/common.py
@@ -62,7 +62,7 @@ class TestCase(unittest.TestCase):
# don't barf gc info all over the console if we have already failed a
# test case
if (self._num_failures < len(getattr(self._result, 'failures', []))
- or self._num_errors < len(getattr(self._result, 'failures', []))):
+ or self._num_errors < len(getattr(self._result, 'failures', []))):
return
if detect_leaks:
self.gccollect()
diff --git a/tests/test_common.py b/tests/test_common.py
index 9d20a1c..393f93b 100644
--- a/tests/test_common.py
+++ b/tests/test_common.py
@@ -28,23 +28,23 @@ class TestColors(common.TestCase):
def test_pack_color_32(self):
self.assertEquals(
- 0x01020408,
- ui_common.pack_color_32(0x01FF, 0x02FF, 0x04FF, 0x08FF))
+ 0x01020408,
+ ui_common.pack_color_32(0x01FF, 0x02FF, 0x04FF, 0x08FF))
def test_pack_color_64(self):
self.assertEquals(
- 0x01FF02FF04FF08FF,
- ui_common.pack_color_64(0x01FF, 0x02FF, 0x04FF, 0x08FF))
+ 0x01FF02FF04FF08FF,
+ ui_common.pack_color_64(0x01FF, 0x02FF, 0x04FF, 0x08FF))
def test_unpack_color_32(self):
self.assertEquals(
- (0x0100, 0x0200, 0x0400, 0x0800),
- ui_common.unpack_color_32(0x01020408))
+ (0x0100, 0x0200, 0x0400, 0x0800),
+ ui_common.unpack_color_32(0x01020408))
def test_unpack_color_64(self):
self.assertEquals(
- (0x01FF, 0x02FF, 0x04FF, 0x08FF),
- ui_common.unpack_color_64(0x01FF02FF04FF08FF))
+ (0x01FF, 0x02FF, 0x04FF, 0x08FF),
+ ui_common.unpack_color_64(0x01FF02FF04FF08FF))
if __name__ == "__main__":
main()
diff --git a/tests/test_integration.py b/tests/test_integration.py
index 8d4824e..6c024fc 100644
--- a/tests/test_integration.py
+++ b/tests/test_integration.py
@@ -396,8 +396,8 @@ class Base(TestCase):
self.assertFalse(self.runner.watchdog.activated)
# make sure the instance has been unset
will_fail = False
- if ((self._num_errors == self._result.errors) and
- (self._num_failures == self._result.failures)):
+ if (self._num_errors == self._result.errors
+ and self._num_failures == self._result.failures):
will_fail = not (pitivi.instance.PiTiVi is None)
pitivi.instance.PiTiVi = None
@@ -709,13 +709,13 @@ class TestRippleExtensive(Base):
if j < i:
final.addSource('clip%d' % j, test1,
{'start': Gst.SECOND * j,
- 'duration': Gst.SECOND,
- 'priority': j % 2})
+ 'duration': Gst.SECOND,
+ 'priority': j % 2})
else:
final.addSource('clip%d' % j, test1,
{'start': Gst.SECOND * (j + 10),
- 'duration': Gst.SECOND,
- 'priority': (j % 2) + 1})
+ 'duration': Gst.SECOND,
+ 'priority': (j % 2) + 1})
self.finals.append(final)
Base.__init__(self, unknown)
@@ -1069,8 +1069,7 @@ class TestTransitions(Base):
if trans:
expected = set([(getattr(self.runner.video1, a),
- getattr(self.runner.video1, b)) for a, b in
- trans])
+ getattr(self.runner.video1, b)) for a, b in trans])
self.failUnlessEqual(set(self.runner.video1.transitions.keys()),
expected)
diff --git a/tests/test_signallable.py b/tests/test_signallable.py
index 1c1c505..9ab6e8f 100644
--- a/tests/test_signallable.py
+++ b/tests/test_signallable.py
@@ -228,8 +228,7 @@ class TestSignalisation(unittest.TestCase):
def test04_emit03(self):
# signal: named argument
# connect: no arguments
- oneargsigid = self.object.connect("signal-oneargs",
- self._cb_oneargs)
+ oneargsigid = self.object.connect("signal-oneargs", self._cb_oneargs)
self.assert_(oneargsigid)
self.object.emit_signal_one_args(firstarg="yep")
self.assertEquals(self.s_oneargs_triggered, 1)
@@ -241,8 +240,7 @@ class TestSignalisation(unittest.TestCase):
def test04_emit04(self):
# signal: named argument
# connect: extra arguments
- oneargsigid = self.object.connect("signal-oneargs",
- self._cb_oneargs,
+ oneargsigid = self.object.connect("signal-oneargs", self._cb_oneargs,
1, 2, 3, myvalue=42)
self.assert_(oneargsigid)
self.object.emit_signal_one_args(firstarg="yep")
diff --git a/tests/test_system_gnome.py b/tests/test_system_gnome.py
index 2b0bd46..a1c5712 100644
--- a/tests/test_system_gnome.py
+++ b/tests/test_system_gnome.py
@@ -1,7 +1,7 @@
from unittest import TestCase
from pitivi.utils.system import getSystem, GnomeSystem, \
- INHIBIT_LOGOUT, INHIBIT_SUSPEND, INHIBIT_SESSION_IDLE, \
- INHIBIT_USER_SWITCHING
+ INHIBIT_LOGOUT, INHIBIT_SUSPEND, INHIBIT_SESSION_IDLE, \
+ INHIBIT_USER_SWITCHING
class TestGnomeSystem(TestCase):
diff --git a/tests/test_undo.py b/tests/test_undo.py
index c4aca20..90fdede 100644
--- a/tests/test_undo.py
+++ b/tests/test_undo.py
@@ -22,7 +22,7 @@
from unittest import TestCase
from pitivi.undo.undo import UndoError, UndoWrongStateError, UndoableAction, \
- UndoableActionStack, UndoableActionLog
+ UndoableActionStack, UndoableActionLog
class DummyUndoableAction(UndoableAction):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]