[pitivi] Rename methods to snake_case
- From: Thibault Saunier <tsaunier src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] Rename methods to snake_case
- Date: Mon, 11 Nov 2019 22:08:41 +0000 (UTC)
commit 61fe64b89584cfe646cac10021d3394c425fc5ff
Author: Alexandru Băluț <alexandru balut gmail com>
Date: Mon Nov 4 02:18:28 2019 +0100
Rename methods to snake_case
data/ui/effectslibrary.ui | 4 +-
data/ui/elementsettingsdialog.ui | 2 +-
data/ui/filelisterrordialog.ui | 4 +-
data/ui/medialibrary.ui | 6 +-
data/ui/preferences.ui | 6 +-
data/ui/projectsettings.ui | 4 +-
data/ui/renderingdialog.ui | 30 +--
data/ui/renderingprogress.ui | 10 +-
data/ui/titleeditor.ui | 8 +-
pitivi/application.py | 48 ++--
pitivi/clipproperties.py | 126 +++++------
pitivi/dialogs/about.py | 4 +-
pitivi/dialogs/clipmediaprops.py | 4 +-
pitivi/dialogs/filelisterrordialog.py | 12 +-
pitivi/dialogs/prefs.py | 88 ++++----
pitivi/editorperspective.py | 202 ++++++++---------
pitivi/effects.py | 94 ++++----
pitivi/greeterperspective.py | 6 +-
pitivi/mainwindow.py | 58 ++---
pitivi/mediafilespreviewer.py | 40 ++--
pitivi/medialibrary.py | 372 +++++++++++++++---------------
pitivi/pluginmanager.py | 8 +-
pitivi/preset.py | 186 +++++++--------
pitivi/project.py | 414 +++++++++++++++++-----------------
pitivi/render.py | 222 +++++++++---------
pitivi/settings.py | 44 ++--
pitivi/tabsmanager.py | 42 ++--
pitivi/timeline/elements.py | 204 ++++++++---------
pitivi/timeline/layer.py | 98 ++++----
pitivi/timeline/markers.py | 12 +-
pitivi/timeline/previewers.py | 62 ++---
pitivi/timeline/ruler.py | 64 +++---
pitivi/timeline/timeline.py | 360 ++++++++++++++---------------
pitivi/titleeditor.py | 80 +++----
pitivi/transitions.py | 58 ++---
pitivi/undo/markers.py | 6 +-
pitivi/undo/project.py | 12 +-
pitivi/undo/timeline.py | 84 +++----
pitivi/undo/undo.py | 10 +-
pitivi/utils/custom_effect_widgets.py | 36 +--
pitivi/utils/loggable.py | 46 ++--
pitivi/utils/pipeline.py | 116 +++++-----
pitivi/utils/proxy.py | 160 ++++++-------
pitivi/utils/ripple_update_group.py | 18 +-
pitivi/utils/system.py | 12 +-
pitivi/utils/threads.py | 6 +-
pitivi/utils/timeline.py | 69 +++---
pitivi/utils/validate.py | 18 +-
pitivi/utils/widgets.py | 188 +++++++--------
pitivi/viewer/move_scale_overlay.py | 2 +-
pitivi/viewer/overlay.py | 2 +-
pitivi/viewer/viewer.py | 176 +++++++--------
plugins/console/console.py | 86 +++----
pylint.rc | 4 +-
tests/common.py | 6 +-
tests/test_application.py | 28 +--
tests/test_check.py | 2 +-
tests/test_clipproperties.py | 48 ++--
tests/test_editorperspective.py | 12 +-
tests/test_effects.py | 22 +-
tests/test_log.py | 36 +--
tests/test_medialibrary.py | 48 ++--
tests/test_pipeline.py | 12 +-
tests/test_prefs.py | 108 ++++-----
tests/test_preset.py | 142 ++++++------
tests/test_previewers.py | 2 +-
tests/test_project.py | 78 +++----
tests/test_proxy.py | 44 ++--
tests/test_render.py | 28 +--
tests/test_settings.py | 62 ++---
tests/test_system.py | 16 +-
tests/test_timeline_elements.py | 20 +-
tests/test_timeline_layer.py | 16 +-
tests/test_timeline_markers.py | 10 +-
tests/test_timeline_timeline.py | 122 +++++-----
tests/test_titleeditor.py | 8 +-
tests/test_undo.py | 34 +--
tests/test_undo_markers.py | 6 +-
tests/test_undo_project.py | 8 +-
tests/test_undo_timeline.py | 78 +++----
tests/test_utils.py | 2 +-
tests/test_utils_timeline.py | 54 ++---
tests/test_widgets.py | 28 +--
83 files changed, 2554 insertions(+), 2559 deletions(-)
---
diff --git a/data/ui/effectslibrary.ui b/data/ui/effectslibrary.ui
index be646e7d..99310fa3 100644
--- a/data/ui/effectslibrary.ui
+++ b/data/ui/effectslibrary.ui
@@ -15,7 +15,7 @@
<property name="use_underline">True</property>
<property name="icon_name">video-x-generic</property>
<property name="active">True</property>
- <signal name="toggled" handler="_toggleViewTypeCb" swapped="no"/>
+ <signal name="toggled" handler="_toggle_view_type_cb" swapped="no"/>
<child internal-child="accessible">
<object class="AtkObject" id="video_togglebutton-atkobject">
<property name="AtkObject::accessible-name">effects library video togglebutton</property>
@@ -34,7 +34,7 @@
<property name="tooltip_text" translatable="yes">Show audio effects</property>
<property name="use_underline">True</property>
<property name="icon_name">audio-x-generic</property>
- <signal name="toggled" handler="_toggleViewTypeCb" swapped="no"/>
+ <signal name="toggled" handler="_toggle_view_type_cb" swapped="no"/>
<child internal-child="accessible">
<object class="AtkObject" id="audio_togglebutton-atkobject">
<property name="AtkObject::accessible-name">effects library audio togglebutton</property>
diff --git a/data/ui/elementsettingsdialog.ui b/data/ui/elementsettingsdialog.ui
index caa5d1ee..6e7a7e2d 100644
--- a/data/ui/elementsettingsdialog.ui
+++ b/data/ui/elementsettingsdialog.ui
@@ -26,7 +26,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
- <signal name="clicked" handler="_resetValuesClickedCb" swapped="no"/>
+ <signal name="clicked" handler="_reset_values_clicked_cb" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
diff --git a/data/ui/filelisterrordialog.ui b/data/ui/filelisterrordialog.ui
index 61789497..37c7e20b 100644
--- a/data/ui/filelisterrordialog.ui
+++ b/data/ui/filelisterrordialog.ui
@@ -7,8 +7,8 @@
<property name="can_focus">False</property>
<property name="border_width">12</property>
<property name="type_hint">dialog</property>
- <signal name="close" handler="_closeCb" swapped="no"/>
- <signal name="response" handler="_responseCb" swapped="no"/>
+ <signal name="close" handler="_close_cb" swapped="no"/>
+ <signal name="response" handler="_response_cb" swapped="no"/>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
<property name="visible">True</property>
diff --git a/data/ui/medialibrary.ui b/data/ui/medialibrary.ui
index b1981c4c..27940eaf 100644
--- a/data/ui/medialibrary.ui
+++ b/data/ui/medialibrary.ui
@@ -16,7 +16,7 @@
<property name="label" translatable="yes">Import</property>
<property name="use_underline">True</property>
<property name="icon_name">list-add-symbolic</property>
- <signal name="clicked" handler="_importSourcesCb" swapped="no"/>
+ <signal name="clicked" handler="_import_sources_cb" swapped="no"/>
<child internal-child="accessible">
<object class="AtkObject" id="media_import_button-atkobject">
<property name="AtkObject::accessible-name">media_import_button</property>
@@ -55,7 +55,7 @@
<property name="tooltip_text" translatable="yes">Clip properties...</property>
<property name="use_underline">True</property>
<property name="icon_name">document-properties-symbolic</property>
- <signal name="clicked" handler="_clipPropertiesCb" swapped="no"/>
+ <signal name="clicked" handler="_clip_properties_cb" swapped="no"/>
<child internal-child="accessible">
<object class="AtkObject" id="media_props_button-atkobject">
<property name="AtkObject::accessible-name">media_props_button</property>
@@ -94,7 +94,7 @@
<property name="tooltip_markup" translatable="yes">Show clips as a detailed list</property>
<property name="use_underline">True</property>
<property name="icon_name">view-list-symbolic</property>
- <signal name="toggled" handler="_toggleViewTypeCb" swapped="no"/>
+ <signal name="toggled" handler="_toggle_view_type_cb" swapped="no"/>
<child internal-child="accessible">
<object class="AtkObject" id="media_listview_button-atkobject">
<property name="AtkObject::accessible-name">media_listview_button</property>
diff --git a/data/ui/preferences.ui b/data/ui/preferences.ui
index a96e5775..2aabe343 100644
--- a/data/ui/preferences.ui
+++ b/data/ui/preferences.ui
@@ -7,7 +7,7 @@
<property name="title" translatable="yes">Preferences</property>
<property name="resizable">False</property>
<property name="type_hint">dialog</property>
- <signal name="configure-event" handler="_configureCb" swapped="no"/>
+ <signal name="configure-event" handler="_configure_cb" swapped="no"/>
<signal name="response" handler="_response_cb" swapped="no"/>
<child type="titlebar">
<placeholder/>
@@ -30,7 +30,7 @@
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="tooltip_text" translatable="yes">Reset all settings to their default
values</property>
- <signal name="clicked" handler="_factorySettingsButtonCb" swapped="no"/>
+ <signal name="clicked" handler="_factory_settings_button_cb" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
@@ -48,7 +48,7 @@
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="tooltip_text" translatable="yes">Revert all settings to the previous values
(before you opened the preferences dialog)</property>
- <signal name="clicked" handler="_revertButtonCb" swapped="no"/>
+ <signal name="clicked" handler="_revert_button_cb" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
diff --git a/data/ui/projectsettings.ui b/data/ui/projectsettings.ui
index 5d36665b..5475adbf 100644
--- a/data/ui/projectsettings.ui
+++ b/data/ui/projectsettings.ui
@@ -41,7 +41,7 @@
<property name="title" translatable="yes">Project Settings</property>
<property name="window_position">center-on-parent</property>
<property name="type_hint">dialog</property>
- <signal name="response" handler="_responseCb" swapped="no"/>
+ <signal name="response" handler="_response_cb" swapped="no"/>
<child type="titlebar">
<placeholder/>
</child>
@@ -281,7 +281,7 @@
<property name="halign">start</property>
<property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
- <signal name="toggled" handler="_constrainSarButtonToggledCb"
swapped="no"/>
+ <signal name="toggled" handler="_constrain_sar_button_toggled_cb"
swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
diff --git a/data/ui/renderingdialog.ui b/data/ui/renderingdialog.ui
index 1359aa24..38d4f38b 100644
--- a/data/ui/renderingdialog.ui
+++ b/data/ui/renderingdialog.ui
@@ -42,7 +42,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
- <signal name="clicked" handler="_closeButtonClickedCb" swapped="no"/>
+ <signal name="clicked" handler="_close_button_clicked_cb" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
@@ -59,7 +59,7 @@
<property name="has_default">True</property>
<property name="receives_default">True</property>
<property name="use_underline">True</property>
- <signal name="clicked" handler="_renderButtonClickedCb" swapped="no"/>
+ <signal name="clicked" handler="_render_button_clicked_cb" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
@@ -165,7 +165,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
- <signal name="changed" handler="_muxerComboChangedCb" swapped="no"/>
+ <signal name="changed" handler="_muxer_combo_changed_cb" swapped="no"/>
<child>
<object class="GtkCellRendererText" id="renderer1"/>
<attributes>
@@ -187,7 +187,7 @@
<property name="image">help_icon</property>
<property name="relief">none</property>
<property name="always_show_image">True</property>
- <signal name="clicked" handler="_containerContextHelpClickedCb" swapped="no"/>
+ <signal name="clicked" handler="_container_context_help_clicked_cb" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
@@ -310,7 +310,7 @@
<property name="digits">1</property>
<property name="numeric">True</property>
<property name="value">1</property>
- <signal name="value-changed" handler="_scaleSpinbuttonChangedCb"
swapped="no"/>
+ <signal name="value-changed" handler="_scale_spinbutton_changed_cb"
swapped="no"/>
<child internal-child="accessible">
<object class="AtkObject" id="scale_spinbutton-atkobject">
<property name="AtkObject::accessible-name"
translatable="yes">Scale</property>
@@ -357,7 +357,7 @@
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="halign">end</property>
- <signal name="clicked" handler="_projectSettingsButtonClickedCb" swapped="no"/>
+ <signal name="clicked" handler="_project_settings_button_clicked_cb"
swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
@@ -372,7 +372,7 @@
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="halign">end</property>
- <signal name="clicked" handler="_videoSettingsButtonClickedCb" swapped="no"/>
+ <signal name="clicked" handler="_video_settings_button_clicked_cb" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
@@ -386,7 +386,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
- <signal name="changed" handler="_videoEncoderComboChangedCb" swapped="no"/>
+ <signal name="changed" handler="_video_encoder_combo_changed_cb" swapped="no"/>
<child>
<object class="GtkCellRendererText" id="renderer2"/>
<attributes>
@@ -423,7 +423,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
- <signal name="changed" handler="_frameRateComboChangedCb" swapped="no"/>
+ <signal name="changed" handler="_frame_rate_combo_changed_cb" swapped="no"/>
<child>
<object class="GtkCellRendererText" id="renderer3"/>
<attributes>
@@ -474,7 +474,7 @@
<property name="xalign">0</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
- <signal name="toggled" handler="_videoOutputCheckbuttonToggledCb" swapped="no"/>
+ <signal name="toggled" handler="_video_output_checkbutton_toggled_cb" swapped="no"/>
</object>
</child>
</object>
@@ -521,7 +521,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
- <signal name="changed" handler="_channelsComboChangedCb" swapped="no"/>
+ <signal name="changed" handler="_channels_combo_changed_cb" swapped="no"/>
<child>
<object class="GtkCellRendererText" id="renderer5"/>
<attributes>
@@ -543,7 +543,7 @@
<property name="receives_default">True</property>
<property name="halign">end</property>
<property name="xalign">1</property>
- <signal name="clicked" handler="_audioSettingsButtonClickedCb" swapped="no"/>
+ <signal name="clicked" handler="_audio_settings_button_clicked_cb" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
@@ -557,7 +557,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
- <signal name="changed" handler="_audioEncoderChangedComboCb" swapped="no"/>
+ <signal name="changed" handler="_audio_encoder_changed_combo_cb" swapped="no"/>
<child>
<object class="GtkCellRendererText" id="renderer4"/>
<attributes>
@@ -594,7 +594,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
- <signal name="changed" handler="_sampleRateComboChangedCb" swapped="no"/>
+ <signal name="changed" handler="_sample_rate_combo_changed_cb" swapped="no"/>
<child>
<object class="GtkCellRendererText" id="renderer6"/>
<attributes>
@@ -640,7 +640,7 @@
<property name="xalign">0</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
- <signal name="toggled" handler="_audioOutputCheckbuttonToggledCb" swapped="no"/>
+ <signal name="toggled" handler="_audio_output_checkbutton_toggled_cb" swapped="no"/>
</object>
</child>
</object>
diff --git a/data/ui/renderingprogress.ui b/data/ui/renderingprogress.ui
index dc2c6730..50de7120 100644
--- a/data/ui/renderingprogress.ui
+++ b/data/ui/renderingprogress.ui
@@ -10,7 +10,7 @@
<property name="window_position">center-on-parent</property>
<property name="default_width">400</property>
<property name="type_hint">dialog</property>
- <signal name="delete-event" handler="_deleteEventCb" swapped="no"/>
+ <signal name="delete-event" handler="_delete_event_cb" swapped="no"/>
<child internal-child="vbox">
<object class="GtkBox" id="vbox">
<property name="visible">True</property>
@@ -28,7 +28,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
- <signal name="toggled" handler="_pauseButtonClickedCb" swapped="no"/>
+ <signal name="toggled" handler="_pause_button_clicked_cb" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
@@ -42,7 +42,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
- <signal name="clicked" handler="_cancelButtonClickedCb" swapped="no"/>
+ <signal name="clicked" handler="_cancel_button_clicked_cb" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
@@ -56,7 +56,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
- <signal name="clicked" handler="_playRenderedFileButtonClickedCb" swapped="no"/>
+ <signal name="clicked" handler="_play_rendered_file_button_clicked_cb" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
@@ -86,7 +86,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
- <signal name="clicked" handler="_closeButtonClickedCb" swapped="no"/>
+ <signal name="clicked" handler="_close_button_clicked_cb" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
diff --git a/data/ui/titleeditor.ui b/data/ui/titleeditor.ui
index e732ee24..694f20eb 100644
--- a/data/ui/titleeditor.ui
+++ b/data/ui/titleeditor.ui
@@ -38,7 +38,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
- <signal name="clicked" handler="_createCb" swapped="no"/>
+ <signal name="clicked" handler="_create_cb" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
@@ -137,7 +137,7 @@
<property name="preview_text"/>
<property name="show_preview_entry">False</property>
<property name="title" translatable="yes">Choose a font</property>
- <signal name="font-set" handler="_fontButtonCb" swapped="no"/>
+ <signal name="font-set" handler="_font_button_cb" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
@@ -155,7 +155,7 @@
<property name="use_alpha">True</property>
<property name="title" translatable="yes">Pick a text color</property>
<property name="rgba">rgb(239,41,41)</property>
- <signal name="color-set" handler="_frontTextColorButtonCb" swapped="no"/>
+ <signal name="color-set" handler="_front_text_color_button_cb" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
@@ -190,7 +190,7 @@
<property name="use_alpha">True</property>
<property name="title" translatable="yes">Pick a background color</property>
<property name="rgba">rgb(255,255,255)</property>
- <signal name="color-set" handler="_backgroundColorButtonCb" swapped="no"/>
+ <signal name="color-set" handler="_background_color_button_cb" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
diff --git a/pitivi/application.py b/pitivi/application.py
index d08d1e52..7142d751 100644
--- a/pitivi/application.py
+++ b/pitivi/application.py
@@ -140,7 +140,7 @@ class Pitivi(Gtk.Application, Loggable):
self.info('starting up')
self._setup()
- self._checkVersion()
+ self._check_version()
def _setup(self):
# pylint: disable=attribute-defined-outside-init
@@ -156,26 +156,26 @@ class Pitivi(Gtk.Application, Loggable):
self.project_manager.connect("project-saved", self.__project_saved_cb)
self._create_actions()
- self._syncDoUndo()
+ self._sync_do_undo()
def _create_actions(self):
self.shortcuts.register_group("app", _("General"), position=10)
# pylint: disable=attribute-defined-outside-init
self.undo_action = Gio.SimpleAction.new("undo", None)
- self.undo_action.connect("activate", self._undoCb)
+ self.undo_action.connect("activate", self._undo_cb)
self.add_action(self.undo_action)
self.shortcuts.add("app.undo", ["<Primary>z"],
_("Undo the most recent action"))
self.redo_action = Gio.SimpleAction.new("redo", None)
- self.redo_action.connect("activate", self._redoCb)
+ self.redo_action.connect("activate", self._redo_cb)
self.add_action(self.redo_action)
self.shortcuts.add("app.redo", ["<Primary><Shift>z"],
_("Redo the most recent action"))
self.quit_action = Gio.SimpleAction.new("quit", None)
- self.quit_action.connect("activate", self._quitCb)
+ self.quit_action.connect("activate", self._quit_cb)
self.add_action(self.quit_action)
self.shortcuts.add("app.quit", ["<Primary>q"], _("Quit"))
@@ -230,18 +230,18 @@ class Pitivi(Gtk.Application, Loggable):
"""
self.debug("shutting down")
# Refuse to close if we are not done with the current project.
- if not self.project_manager.closeRunningProject():
+ if not self.project_manager.close_running_project():
self.warning(
"Not closing since running project doesn't want to close")
return False
if self.gui:
self.gui.destroy()
self.threads.wait_all_threads()
- self.settings.storeSettings()
+ self.settings.store_settings()
self.quit()
return True
- def _setScenarioFile(self, uri):
+ def _set_scenario_file(self, uri):
if uri:
project_path = path_from_uri(uri)
else:
@@ -281,11 +281,11 @@ class Pitivi(Gtk.Application, Loggable):
self.action_log = UndoableActionLog()
self.action_log.connect("pre-push", self._action_log_pre_push_cb)
- self.action_log.connect("commit", self._actionLogCommit)
+ self.action_log.connect("commit", self._action_log_commit)
self.action_log.connect("move", self._action_log_move_cb)
self.project_observer = ProjectObserver(project, self.action_log)
- self._setScenarioFile(project.get_uri())
+ self._set_scenario_file(project.get_uri())
def __project_saved_cb(self, unused_project_manager, unused_project, uri):
if uri:
@@ -294,14 +294,14 @@ class Pitivi(Gtk.Application, Loggable):
def _project_closed_cb(self, unused_project_manager, project):
if project.loaded:
self.action_log = None
- self._syncDoUndo()
+ self._sync_do_undo()
if self._scenario_file:
self.write_action("stop")
self._scenario_file.close()
self._scenario_file = None
- def _checkVersion(self):
+ def _check_version(self):
"""Checks online for new versions of the app."""
self.info("Requesting version information async")
giofile = Gio.File.new_for_uri(RELEASES_URL)
@@ -346,41 +346,41 @@ class Pitivi(Gtk.Application, Loggable):
except Exception as e:
self.warning("Version info could not be read: %s", e)
- def isLatest(self):
+ def is_latest(self):
"""Whether the app's version is the latest as far as we know."""
status = self._version_information.get("status")
return status is None or status.upper() == "CURRENT"
- def getLatest(self):
+ def get_latest(self):
"""Get the latest version of the app or None."""
return self._version_information.get("current")
- def _quitCb(self, unused_action, unused_param):
+ def _quit_cb(self, unused_action, unused_param):
self.shutdown()
- def _undoCb(self, unused_action, unused_param):
+ def _undo_cb(self, unused_action, unused_param):
self.action_log.undo()
- def _redoCb(self, unused_action, unused_param):
+ def _redo_cb(self, unused_action, unused_param):
self.action_log.redo()
def _show_shortcuts_cb(self, unused_action, unused_param):
show_shortcuts(self)
def _action_log_pre_push_cb(self, unused_action_log, action):
- scenario_action = action.asScenarioAction()
+ scenario_action = action.as_scenario_action()
if scenario_action:
self.write_action(scenario_action)
- def _actionLogCommit(self, action_log, unused_stack):
+ def _action_log_commit(self, action_log, unused_stack):
if action_log.is_in_transaction():
return
- self._syncDoUndo()
+ self._sync_do_undo()
def _action_log_move_cb(self, action_log, unused_stack):
- self._syncDoUndo()
+ self._sync_do_undo()
- def _syncDoUndo(self):
+ def _sync_do_undo(self):
can_undo = self.action_log and bool(self.action_log.undo_stacks)
self.undo_action.set_enabled(bool(can_undo))
@@ -391,10 +391,10 @@ class Pitivi(Gtk.Application, Loggable):
return
dirty = self.action_log and self.action_log.dirty()
- self.project_manager.current_project.setModificationState(dirty)
+ self.project_manager.current_project.set_modification_state(dirty)
# In the tests we do not want to create any gui
if self.gui is not None:
- self.gui.editor.showProjectStatus()
+ self.gui.editor.show_project_status()
def simple_inhibit(self, reason, flags):
"""Informs the session manager about actions to be inhibited.
diff --git a/pitivi/clipproperties.py b/pitivi/clipproperties.py
index 57a9a55d..6a32fddd 100644
--- a/pitivi/clipproperties.py
+++ b/pitivi/clipproperties.py
@@ -86,7 +86,7 @@ class ClipProperties(Gtk.ScrolledWindow, Loggable):
self.effect_expander.set_vexpand(False)
vbox.pack_start(self.effect_expander, False, False, 0)
- def createInfoBar(self, text):
+ def create_info_bar(self, text):
"""Creates an infobar to be displayed at the top."""
label = Gtk.Label(label=text)
label.set_line_wrap(True)
@@ -176,7 +176,7 @@ class EffectProperties(Gtk.Expander, Loggable):
activated_cell = Gtk.CellRendererToggle()
activated_cell.props.xalign = 0
activated_cell.props.xpad = 0
- activated_cell.connect("toggled", self._effectActiveToggleCb)
+ activated_cell.connect("toggled", self._effect_active_toggle_cb)
self.treeview.insert_column_with_attributes(-1,
_("Active"), activated_cell,
active=COL_ACTIVATED)
@@ -217,7 +217,7 @@ class EffectProperties(Gtk.Expander, Loggable):
self.treeview_selection = self.treeview.get_selection()
self.treeview_selection.set_mode(Gtk.SelectionMode.SINGLE)
- self._infobar = clip_properties.createInfoBar(
+ self._infobar = clip_properties.create_info_bar(
_("Select a clip on the timeline to configure its associated effects"))
self._infobar.show_all()
@@ -244,7 +244,7 @@ class EffectProperties(Gtk.Expander, Loggable):
self.app.shortcuts.register_group("clipproperties-effects", _("Clip Effects"), position=60)
self.remove_effect_action = Gio.SimpleAction.new("remove-effect", None)
- self.remove_effect_action.connect("activate", self._removeEffectCb)
+ self.remove_effect_action.connect("activate", self._remove_effect_cb)
effects_actions_group.add_action(self.remove_effect_action)
self.app.shortcuts.add("clipproperties-effects.remove-effect", ["Delete"],
_("Remove the selected effect"))
@@ -252,32 +252,32 @@ class EffectProperties(Gtk.Expander, Loggable):
remove_effect_button.set_action_name("clipproperties-effects.remove-effect")
# Connect all the widget signals
- self.treeview_selection.connect("changed", self._treeviewSelectionChangedCb)
+ self.treeview_selection.connect("changed", self._treeview_selection_changed_cb)
self.connect("drag-motion", self._drag_motion_cb)
self.connect("drag-leave", self._drag_leave_cb)
self.connect("drag-data-received", self._drag_data_received_cb)
self.treeview.connect("drag-motion", self._drag_motion_cb)
self.treeview.connect("drag-leave", self._drag_leave_cb)
self.treeview.connect("drag-data-received", self._drag_data_received_cb)
- self.treeview.connect("query-tooltip", self._treeViewQueryTooltipCb)
+ self.treeview.connect("query-tooltip", self._tree_view_query_tooltip_cb)
self.app.project_manager.connect_after(
- "new-project-loaded", self._newProjectLoadedCb)
- self.connect('notify::expanded', self._expandedCb)
+ "new-project-loaded", self._new_project_loaded_cb)
+ self.connect('notify::expanded', self._expanded_cb)
- def _newProjectLoadedCb(self, unused_app, project):
+ def _new_project_loaded_cb(self, unused_app, project):
if self._selection is not None:
- self._selection.disconnect_by_func(self._selectionChangedCb)
+ self._selection.disconnect_by_func(self._selection_changed_cb)
self._selection = None
self._project = project
if project:
self._selection = project.ges_timeline.ui.selection
- self._selection.connect('selection-changed', self._selectionChangedCb)
- self.__updateAll()
+ self._selection.connect('selection-changed', self._selection_changed_cb)
+ self.__update_all()
- def _selectionChangedCb(self, selection):
+ def _selection_changed_cb(self, selection):
if self.clip:
- self.clip.disconnect_by_func(self._trackElementAddedCb)
- self.clip.disconnect_by_func(self._trackElementRemovedCb)
+ self.clip.disconnect_by_func(self._track_element_added_cb)
+ self.clip.disconnect_by_func(self._track_element_removed_cb)
for track_element in self.clip.get_children(recursive=True):
if isinstance(track_element, GES.BaseEffect):
self._disconnect_from_track_element(track_element)
@@ -285,17 +285,17 @@ class EffectProperties(Gtk.Expander, Loggable):
clips = list(selection.selected)
self.clip = clips[0] if len(clips) == 1 else None
if self.clip:
- self.clip.connect("child-added", self._trackElementAddedCb)
- self.clip.connect("child-removed", self._trackElementRemovedCb)
+ self.clip.connect("child-added", self._track_element_added_cb)
+ self.clip.connect("child-removed", self._track_element_removed_cb)
for track_element in self.clip.get_children(recursive=True):
if isinstance(track_element, GES.BaseEffect):
self._connect_to_track_element(track_element)
- self.__updateAll()
+ self.__update_all()
- def _trackElementAddedCb(self, unused_clip, track_element):
+ def _track_element_added_cb(self, unused_clip, track_element):
if isinstance(track_element, GES.BaseEffect):
self._connect_to_track_element(track_element)
- self.__updateAll()
+ self.__update_all()
for path, row in enumerate(self.storemodel):
if row[COL_TRACK_EFFECT] == track_element:
self.treeview_selection.select_path(path)
@@ -310,17 +310,17 @@ class EffectProperties(Gtk.Expander, Loggable):
track_element.disconnect_by_func(self._notify_priority_cb)
def _notify_active_cb(self, unused_track_element, unused_param_spec):
- self._updateTreeview()
+ self._update_treeview()
def _notify_priority_cb(self, unused_track_element, unused_param_spec):
- self._updateTreeview()
+ self._update_treeview()
- def _trackElementRemovedCb(self, unused_clip, track_element):
+ def _track_element_removed_cb(self, unused_clip, track_element):
if isinstance(track_element, GES.BaseEffect):
self._disconnect_from_track_element(track_element)
- self.__updateAll()
+ self.__update_all()
- def _removeEffectCb(self, unused_action, unused_param):
+ def _remove_effect_cb(self, unused_action, unused_param):
selected = self.treeview_selection.get_selected()
if not selected[1]:
# Cannot remove nothing,
@@ -332,17 +332,17 @@ class EffectProperties(Gtk.Expander, Loggable):
effect_count = self.storemodel.iter_n_children()
if effect_count - 1 == next_selection_index:
next_selection_index -= 1
- self._removeEffect(effect)
+ self._remove_effect(effect)
if next_selection_index >= 0:
self.treeview_selection.select_path(next_selection_index)
- def _removeEffect(self, effect):
+ def _remove_effect(self, effect):
pipeline = self._project.pipeline
with self.app.action_log.started("remove effect",
finalizing_action=CommitTimelineFinalizingAction(pipeline),
toplevel=True):
self.__remove_configuration_widget()
- self.effects_properties_manager.cleanCache(effect)
+ self.effects_properties_manager.clean_cache(effect)
effect.get_parent().remove(effect)
def _drag_motion_cb(self, unused_widget, unused_drag_context, unused_x, unused_y, unused_timestamp):
@@ -376,7 +376,7 @@ class EffectProperties(Gtk.Expander, Loggable):
else:
drop_index = len(self.storemodel)
self.debug("Effect dragged at position %s", drop_index)
- effect_info = self.app.effects.getInfo(factory_name)
+ effect_info = self.app.effects.get_info(factory_name)
pipeline = self._project.pipeline
with self.app.action_log.started("add effect",
finalizing_action=CommitTimelineFinalizingAction(pipeline),
@@ -415,7 +415,7 @@ class EffectProperties(Gtk.Expander, Loggable):
if dest_row:
drop_path, drop_pos = dest_row
drop_index = drop_path.get_indices()[0]
- drop_index = self.calculateEffectPriority(
+ drop_index = self.calculate_effect_priority(
source_index, drop_index, drop_pos)
else:
# This should happen when dragging after the last row.
@@ -438,10 +438,10 @@ class EffectProperties(Gtk.Expander, Loggable):
new_path = Gtk.TreePath.new()
new_path.append_index(drop_index)
- self.__updateAll(path=new_path)
+ self.__update_all(path=new_path)
@staticmethod
- def calculateEffectPriority(source_index, drop_index, drop_pos):
+ def calculate_effect_priority(source_index, drop_index, drop_pos):
"""Calculates where the effect from source_index will end up."""
if drop_pos in (Gtk.TreeViewDropPosition.INTO_OR_BEFORE, Gtk.TreeViewDropPosition.INTO_OR_AFTER):
return drop_index
@@ -453,7 +453,7 @@ class EffectProperties(Gtk.Expander, Loggable):
return drop_index + 1
return drop_index
- def _effectActiveToggleCb(self, cellrenderertoggle, path):
+ def _effect_active_toggle_cb(self, cellrenderertoggle, path):
_iter = self.storemodel.get_iter(path)
effect = self.storemodel.get_value(_iter, COL_TRACK_EFFECT)
pipeline = self._project.ges_timeline.get_parent()
@@ -465,10 +465,10 @@ class EffectProperties(Gtk.Expander, Loggable):
# the UI reflects the current status.
cellrenderertoggle.set_active(effect.is_active())
- def _expandedCb(self, unused_expander, unused_params):
- self.__updateAll()
+ def _expanded_cb(self, unused_expander, unused_params):
+ self.__update_all()
- def _treeViewQueryTooltipCb(self, view, x, y, keyboard_mode, tooltip):
+ def _tree_view_query_tooltip_cb(self, view, x, y, keyboard_mode, tooltip):
is_row, x, y, unused_model, path, tree_iter = view.get_tooltip_context(
x, y, keyboard_mode)
if not is_row:
@@ -481,11 +481,11 @@ class EffectProperties(Gtk.Expander, Loggable):
tooltip.set_text("%s\n%s" % (bin_description, description))
return True
- def __updateAll(self, path=None):
+ def __update_all(self, path=None):
if self.clip:
self.show()
self._infobar.hide()
- self._updateTreeview()
+ self._update_treeview()
if path:
self.treeview_selection.select_path(path)
else:
@@ -494,12 +494,12 @@ class EffectProperties(Gtk.Expander, Loggable):
self.storemodel.clear()
self._infobar.show()
- def _updateTreeview(self):
+ def _update_treeview(self):
self.storemodel.clear()
for effect in self.clip.get_top_effects():
if effect.props.bin_description in HIDDEN_EFFECTS:
continue
- effect_info = self.app.effects.getInfo(effect.props.bin_description)
+ effect_info = self.app.effects.get_info(effect.props.bin_description)
to_append = [effect.props.active]
track_type = effect.get_track_type()
if track_type == GES.TrackType.AUDIO:
@@ -515,17 +515,17 @@ class EffectProperties(Gtk.Expander, Loggable):
self.no_effect_infobar.set_visible(not has_effects)
self._vbox.set_visible(has_effects)
- def _treeviewSelectionChangedCb(self, unused_treeview):
+ def _treeview_selection_changed_cb(self, unused_treeview):
selection_is_emtpy = self.treeview_selection.count_selected_rows() == 0
self.remove_effect_action.set_enabled(not selection_is_emtpy)
- self._updateEffectConfigUi()
+ self._update_effect_config_ui()
- def _updateEffectConfigUi(self):
+ def _update_effect_config_ui(self):
model, tree_iter = self.treeview_selection.get_selected()
if tree_iter:
effect = model.get_value(tree_iter, COL_TRACK_EFFECT)
- self._showEffectConfigurationWidget(effect)
+ self._show_effect_configuration_widget(effect)
else:
self.__remove_configuration_widget()
@@ -538,9 +538,9 @@ class EffectProperties(Gtk.Expander, Loggable):
self._vbox.remove(self._effect_config_ui)
self._effect_config_ui = None
- def _showEffectConfigurationWidget(self, effect):
+ def _show_effect_configuration_widget(self, effect):
self.__remove_configuration_widget()
- self._effect_config_ui = self.effects_properties_manager.getEffectConfigurationUI(
+ self._effect_config_ui = self.effects_properties_manager.get_effect_configuration_ui(
effect)
if not self._effect_config_ui:
return
@@ -575,18 +575,18 @@ class TransformationProperties(Gtk.Expander, Loggable):
# when bindings are changed from this class
self.__own_bindings_change = False
self.add(self.builder.get_object("transform_box"))
- self._initButtons()
+ self._init_buttons()
self.show_all()
self.hide()
self.app.project_manager.connect_after(
- "new-project-loaded", self._newProjectLoadedCb)
+ "new-project-loaded", self._new_project_loaded_cb)
self.app.project_manager.connect_after(
"project-closed", self.__project_closed_cb)
- def _newProjectLoadedCb(self, unused_app, project):
+ def _new_project_loaded_cb(self, unused_app, project):
if self._selection is not None:
- self._selection.disconnect_by_func(self._selectionChangedCb)
+ self._selection.disconnect_by_func(self._selection_changed_cb)
self._selection = None
if self._project:
self._project.pipeline.disconnect_by_func(self._position_cb)
@@ -594,15 +594,15 @@ class TransformationProperties(Gtk.Expander, Loggable):
self._project = project
if project:
self._selection = project.ges_timeline.ui.selection
- self._selection.connect('selection-changed', self._selectionChangedCb)
+ self._selection.connect('selection-changed', self._selection_changed_cb)
self._project.pipeline.connect("position", self._position_cb)
def __project_closed_cb(self, unused_project_manager, unused_project):
self._project = None
- def _initButtons(self):
+ def _init_buttons(self):
clear_button = self.builder.get_object("clear_button")
- clear_button.connect("clicked", self._defaultValuesCb)
+ clear_button.connect("clicked", self._default_values_cb)
self._activate_keyframes_btn = self.builder.get_object("activate_keyframes_button")
self._activate_keyframes_btn.connect("toggled", self.__show_keyframes_toggled_cb)
@@ -634,7 +634,7 @@ class TransformationProperties(Gtk.Expander, Loggable):
start = self.source.props.start
in_point = self.source.props.in_point
pipeline = self._project.pipeline
- position = pipeline.getPosition() - start + in_point
+ position = pipeline.get_position() - start + in_point
keyframes_ts = self.__get_keyframes_timestamps()
if next_keyframe:
i = bisect.bisect_right(keyframes_ts, position)
@@ -663,12 +663,12 @@ class TransformationProperties(Gtk.Expander, Loggable):
self._activate_keyframes_btn.set_tooltip_text(_("Show keyframes"))
else:
self._activate_keyframes_btn.set_tooltip_text(_("Activate keyframes"))
- self.source.ui_element.showDefaultKeyframes()
+ self.source.ui_element.show_default_keyframes()
else:
self._prev_keyframe_btn.set_sensitive(True)
self._next_keyframe_btn.set_sensitive(True)
self._activate_keyframes_btn.set_tooltip_text(_("Hide keyframes"))
- self.source.ui_element.showMultipleKeyframes(
+ self.source.ui_element.show_multiple_keyframes(
list(self.__control_bindings.values()))
def __update_control_bindings(self):
@@ -731,7 +731,7 @@ class TransformationProperties(Gtk.Expander, Loggable):
control_source.set(self.source.props.in_point, val)
control_source.set(self.source.props.in_point + self.source.props.duration, val)
- def _defaultValuesCb(self, unused_widget):
+ def _default_values_cb(self, unused_widget):
with self.app.action_log.started("Transformation properties reset default",
finalizing_action=CommitTimelineFinalizingAction(self._project.pipeline),
toplevel=True):
@@ -746,7 +746,7 @@ class TransformationProperties(Gtk.Expander, Loggable):
def __get_source_property(self, prop):
if self.__source_uses_keyframes():
try:
- position = self._project.pipeline.getPosition()
+ position = self._project.pipeline.get_position()
start = self.source.props.start
in_point = self.source.props.in_point
duration = self.source.props.duration
@@ -785,7 +785,7 @@ class TransformationProperties(Gtk.Expander, Loggable):
res, value = self.__get_source_property(prop)
assert res
if spin.get_value() != value:
- # Make sure self._onValueChangedCb doesn't get called here. If that
+ # Make sure self._on_value_changed_cb doesn't get called here. If that
# happens, we might have unintended keyframes added.
with spin.handler_block(spin_handler_id):
spin.set_value(value)
@@ -803,7 +803,7 @@ class TransformationProperties(Gtk.Expander, Loggable):
if self.__source_uses_keyframes():
try:
- position = self._project.pipeline.getPosition()
+ position = self._project.pipeline.get_position()
start = self.source.props.start
in_point = self.source.props.in_point
duration = self.source.props.duration
@@ -828,12 +828,12 @@ class TransformationProperties(Gtk.Expander, Loggable):
def __setup_spin_button(self, widget_name, property_name):
"""Creates a SpinButton for editing a property value."""
spinbtn = self.builder.get_object(widget_name)
- handler_id = spinbtn.connect("value-changed", self._onValueChangedCb, property_name)
+ handler_id = spinbtn.connect("value-changed", self._on_value_changed_cb, property_name)
disable_scroll(spinbtn)
self.spin_buttons[property_name] = spinbtn
self.spin_buttons_handler_ids[property_name] = handler_id
- def _onValueChangedCb(self, spinbtn, prop):
+ def _on_value_changed_cb(self, spinbtn, prop):
if not self.source:
return
@@ -864,7 +864,7 @@ class TransformationProperties(Gtk.Expander, Loggable):
self.source.connect("control-binding-added", self._control_bindings_changed)
self.source.connect("control-binding-removed", self._control_bindings_changed)
- def _selectionChangedCb(self, unused_timeline):
+ def _selection_changed_cb(self, unused_timeline):
if len(self._selection) == 1:
clip = list(self._selection)[0]
source = clip.find_track_element(None, GES.VideoSource)
diff --git a/pitivi/dialogs/about.py b/pitivi/dialogs/about.py
index 7848ca5c..84f00dcb 100644
--- a/pitivi/dialogs/about.py
+++ b/pitivi/dialogs/about.py
@@ -47,10 +47,10 @@ class AboutDialog(Gtk.AboutDialog):
if in_devel():
version_str = _("Development version: %s") % GITVERSION
- elif not app.isLatest():
+ elif not app.is_latest():
version_str = _("Version %(cur_ver)s — %(new_ver)s is available") % \
{"cur_ver": GITVERSION,
- "new_ver": app.getLatest()}
+ "new_ver": app.get_latest()}
elif GITVERSION:
version_str = _("Version %s") % GITVERSION
else:
diff --git a/pitivi/dialogs/clipmediaprops.py b/pitivi/dialogs/clipmediaprops.py
index afa55068..b2e9b413 100644
--- a/pitivi/dialogs/clipmediaprops.py
+++ b/pitivi/dialogs/clipmediaprops.py
@@ -127,7 +127,7 @@ class ClipMediaPropsDialog:
self.framerate_checkbutton.hide()
self.video_header_label.set_markup("<b>" + _("Image:") + "</b>")
- self.dialog.connect("key-press-event", self._keyPressCb)
+ self.dialog.connect("key-press-event", self._key_press_cb)
self.dialog.connect("response", self.__response_cb)
self.dialog.run()
@@ -155,7 +155,7 @@ class ClipMediaPropsDialog:
self._apply()
self.dialog.destroy()
- def _keyPressCb(self, unused_widget, event):
+ def _key_press_cb(self, unused_widget, event):
if event.keyval in (Gdk.KEY_Escape, Gdk.KEY_Q, Gdk.KEY_q):
self.dialog.destroy()
return True
diff --git a/pitivi/dialogs/filelisterrordialog.py b/pitivi/dialogs/filelisterrordialog.py
index ab18e77f..ee1f90c5 100644
--- a/pitivi/dialogs/filelisterrordialog.py
+++ b/pitivi/dialogs/filelisterrordialog.py
@@ -51,7 +51,7 @@ class FileListErrorDialog(GObject.Object, Loggable):
self.builder.get_object("headline").set_text(headline)
self.errorvbox = self.builder.get_object("errorvbox")
- def addFailedFile(self, uri, reason=_("Unknown reason"), extra=None):
+ def add_failed_file(self, uri, reason=_("Unknown reason"), extra=None):
"""Adds the specified URI to the list of failures.
Args:
@@ -59,14 +59,14 @@ class FileListErrorDialog(GObject.Object, Loggable):
reason (Optional[str]): The reason of the file discovery failure.
"""
self.debug("Uri: %s, reason: %s, extra: %s", uri, reason, extra)
- exp = self.__createFileExpander(uri, reason, extra)
+ exp = self.__create_file_expander(uri, reason, extra)
self.errorvbox.pack_start(exp, False, False, 0)
if len(self.errorvbox.get_children()) < 3:
exp.set_expanded(True) # Let's save the user some clicks
exp.show_all()
@staticmethod
- def __createFileExpander(uri, reason, extra=None):
+ def __create_file_expander(uri, reason, extra=None):
if uri:
if uri.startswith("file://"):
uri = uri[7:]
@@ -103,7 +103,7 @@ class FileListErrorDialog(GObject.Object, Loggable):
return exp
- def isVisible(self):
+ def is_visible(self):
"""Returns True if the dialog is currently shown."""
return self.window.get_property("visible")
@@ -113,10 +113,10 @@ class FileListErrorDialog(GObject.Object, Loggable):
# Callbacks from glade
- def _closeCb(self, unused_dialog):
+ def _close_cb(self, unused_dialog):
"""Emits the `close` signal."""
self.emit('close')
- def _responseCb(self, unused_dialog, response):
+ def _response_cb(self, unused_dialog, response):
"""Emits the `response` signal."""
self.emit('response', response)
diff --git a/pitivi/dialogs/prefs.py b/pitivi/dialogs/prefs.py
index bfd5b4e9..21ad3e30 100644
--- a/pitivi/dialogs/prefs.py
+++ b/pitivi/dialogs/prefs.py
@@ -40,17 +40,17 @@ from pitivi.utils.ui import PREFERENCES_CSS
from pitivi.utils.ui import SPACING
-GlobalSettings.addConfigSection("user-interface")
+GlobalSettings.add_config_section("user-interface")
-GlobalSettings.addConfigOption('prefsDialogWidth',
- section="user-interface",
- key="prefs-dialog-width",
- default=600)
+GlobalSettings.add_config_option('prefsDialogWidth',
+ section="user-interface",
+ key="prefs-dialog-width",
+ default=600)
-GlobalSettings.addConfigOption('prefsDialogHeight',
- section="user-interface",
- key="prefs-dialog-height",
- default=400)
+GlobalSettings.add_config_option('prefsDialogHeight',
+ section="user-interface",
+ key="prefs-dialog-height",
+ default=400)
class PreferencesDialog(Loggable):
@@ -89,7 +89,7 @@ class PreferencesDialog(Loggable):
self.factory_settings = builder.get_object("resetButton")
self.restart_warning = builder.get_object("restartWarning")
- self.factory_settings.set_sensitive(self._canReset())
+ self.factory_settings.set_sensitive(self._can_reset())
self.add_settings_page('timeline')
self.__add_proxies_section()
@@ -161,14 +161,14 @@ class PreferencesDialog(Loggable):
cls._instance.add_settings_page(section)
@classmethod
- def addPathPreference(cls, attrname, label, description, section=None):
+ def add_path_preference(cls, attrname, label, description, section=None):
"""Adds a user preference for a file path."""
cls._add_preference(attrname, label, description, section,
widgets.PathWidget)
@classmethod
- def addNumericPreference(cls, attrname, label, description, section=None,
- upper=None, lower=None):
+ def add_numeric_preference(cls, attrname, label, description, section=None,
+ upper=None, lower=None):
"""Adds a user preference for a number.
Show up as either a Gtk.SpinButton or a horizontal Gtk.Scale, depending
@@ -178,31 +178,31 @@ class PreferencesDialog(Loggable):
widgets.NumericWidget, upper=upper, lower=lower)
@classmethod
- def addTextPreference(cls, attrname, label, description, section=None, matches=None):
+ def add_text_preference(cls, attrname, label, description, section=None, matches=None):
"""Adds a user preference for text."""
cls._add_preference(attrname, label, description, section,
widgets.TextWidget, matches=matches)
@classmethod
- def addChoicePreference(cls, attrname, label, description, choices, section=None):
+ def add_choice_preference(cls, attrname, label, description, choices, section=None):
"""Adds a user preference for text options."""
cls._add_preference(attrname, label, description, section,
widgets.ChoiceWidget, choices=choices)
@classmethod
- def addTogglePreference(cls, attrname, label, description, section=None):
+ def add_toggle_preference(cls, attrname, label, description, section=None):
"""Adds a user preference for an on/off option."""
cls._add_preference(attrname, label, description, section,
widgets.ToggleWidget)
@classmethod
- def addColorPreference(cls, attrname, label, description, section=None):
+ def add_color_preference(cls, attrname, label, description, section=None):
"""Adds a user preference for a color."""
cls._add_preference(attrname, label, description, section,
widgets.ColorWidget)
@classmethod
- def addFontPreference(cls, attrname, label, description, section=None):
+ def add_font_preference(cls, attrname, label, description, section=None):
"""Adds a user preference for a font."""
cls._add_preference(attrname, label, description, section,
widgets.FontWidget)
@@ -292,13 +292,13 @@ class PreferencesDialog(Loggable):
for attrname in options:
label, description, widget_class, args = options[attrname]
widget = widget_class(**args)
- widget.setWidgetValue(getattr(self.settings, attrname))
- widget.connectValueChanged(self._valueChangedCb, widget, attrname)
+ widget.set_widget_value(getattr(self.settings, attrname))
+ widget.connect_value_changed(self._value_changed_cb, widget, attrname)
widget.set_tooltip_text(description)
self.widgets[attrname] = widget
revert = self._create_revert_button()
- revert.set_sensitive(not self.settings.isDefault(attrname))
+ revert.set_sensitive(not self.settings.is_default(attrname))
revert.connect("clicked", self.__reset_option_cb, attrname)
self.resets[attrname] = revert
@@ -319,10 +319,10 @@ class PreferencesDialog(Loggable):
prefs = self._prepare_prefs_widgets(self.prefs["_proxies"])
self.proxy_width_widget = widgets.NumericWidget(lower=1, width_chars=4)
- self.proxy_width_widget.setWidgetValue(self.app.settings.default_scaled_proxy_width)
+ self.proxy_width_widget.set_widget_value(self.app.settings.default_scaled_proxy_width)
self.widgets["default_scaled_proxy_width"] = self.proxy_width_widget
self.proxy_height_widget = widgets.NumericWidget(lower=1, width_chars=4)
- self.proxy_height_widget.setWidgetValue(self.app.settings.default_scaled_proxy_height)
+ self.proxy_height_widget.set_widget_value(self.app.settings.default_scaled_proxy_height)
self.widgets["default_scaled_proxy_height"] = self.proxy_height_widget
size_box = Gtk.Box(spacing=SPACING)
size_box.pack_start(self.proxy_width_widget, False, False, 0)
@@ -352,19 +352,19 @@ class PreferencesDialog(Loggable):
self.__update_scaled_proxies_infobar()
self.__update_proxy_size_revert_button()
- self.proxy_width_widget.connectValueChanged(self.__scaled_proxy_size_change_cb)
- self.proxy_height_widget.connectValueChanged(self.__scaled_proxy_size_change_cb)
+ self.proxy_width_widget.connect_value_changed(self.__scaled_proxy_size_change_cb)
+ self.proxy_height_widget.connect_value_changed(self.__scaled_proxy_size_change_cb)
self.scaled_proxy_size_revert_button.connect("clicked", self.__reset_option_cb,
"default_scaled_proxy_width", "default_scaled_proxy_height")
self.proxy_infobar.connect("response", self.__proxy_infobar_cb)
def __scaled_proxy_size_change_cb(self, unused_widget):
- self.app.settings.default_scaled_proxy_width = self.proxy_width_widget.getWidgetValue()
- self.app.settings.default_scaled_proxy_height = self.proxy_height_widget.getWidgetValue()
+ self.app.settings.default_scaled_proxy_width = self.proxy_width_widget.get_widget_value()
+ self.app.settings.default_scaled_proxy_height = self.proxy_height_widget.get_widget_value()
self.__update_scaled_proxies_infobar()
self.__update_proxy_size_revert_button()
def __update_proxy_size_revert_button(self):
- default = all([self.settings.isDefault(setting)
+ default = all([self.settings.is_default(setting)
for setting in ("default_scaled_proxy_width", "default_scaled_proxy_height")])
self.scaled_proxy_size_revert_button.set_sensitive(not default)
@@ -380,7 +380,7 @@ class PreferencesDialog(Loggable):
(project.scaled_proxy_width, project.scaled_proxy_height))
def __proxy_infobar_cb(self, unused_infobar, unused_response_id):
- self.app.gui.editor.showProjectSettingsDialog()
+ self.app.gui.editor.show_project_settings_dialog()
self.__update_scaled_proxies_infobar()
def __add_shortcuts_section(self):
@@ -518,21 +518,21 @@ class PreferencesDialog(Loggable):
count = self.list_store.get_n_items()
self.list_store.emit("items-changed", index, count, count)
- def _factorySettingsButtonCb(self, unused_button):
+ def _factory_settings_button_cb(self, unused_button):
"""Resets all settings to the defaults."""
for section in self.prefs.values():
for attrname in section:
self.__reset_option(self.resets[attrname], attrname)
self.app.shortcuts.reset_accels()
- def _revertButtonCb(self, unused_button):
+ def _revert_button_cb(self, unused_button):
"""Resets all settings to the values when the dialog was opened."""
for attrname, value in self.original_values.items():
- self.widgets[attrname].setWidgetValue(value)
+ self.widgets[attrname].set_widget_value(value)
setattr(self.settings, attrname, value)
self.original_values = {}
self.revert_button.set_sensitive(False)
- self.factory_settings.set_sensitive(self._canReset())
+ self.factory_settings.set_sensitive(self._can_reset())
def __reset_option_cb(self, button, *attrnames):
for attrname in attrnames:
@@ -540,39 +540,39 @@ class PreferencesDialog(Loggable):
def __reset_option(self, button, attrname):
"""Resets a particular setting to the factory default."""
- if not self.settings.isDefault(attrname):
- self.settings.setDefault(attrname)
- self.widgets[attrname].setWidgetValue(getattr(self.settings, attrname))
+ if not self.settings.is_default(attrname):
+ self.settings.set_default(attrname)
+ self.widgets[attrname].set_widget_value(getattr(self.settings, attrname))
button.set_sensitive(False)
- self.factory_settings.set_sensitive(self._canReset())
+ self.factory_settings.set_sensitive(self._can_reset())
def _response_cb(self, unused_button, unused_response_id):
self.dialog.destroy()
- def _valueChangedCb(self, unused_fake_widget, real_widget, attrname):
+ def _value_changed_cb(self, unused_fake_widget, real_widget, attrname):
value = getattr(self.settings, attrname)
if attrname not in self.original_values:
self.original_values[attrname] = value
- if not GlobalSettings.notifiesConfigOption(attrname):
+ if not GlobalSettings.notifies_config_option(attrname):
self.restart_warning.show()
self.revert_button.set_sensitive(True)
- value = real_widget.getWidgetValue()
+ value = real_widget.get_widget_value()
setattr(self.settings, attrname, value)
# adjust controls as appropriate
self.resets[attrname].set_sensitive(
- not self.settings.isDefault(attrname))
+ not self.settings.is_default(attrname))
self.factory_settings.set_sensitive(True)
- def _configureCb(self, unused_widget, event):
+ def _configure_cb(self, unused_widget, event):
self.settings.prefsDialogWidth = event.width
self.settings.prefsDialogHeight = event.height
- def _canReset(self):
+ def _can_reset(self):
for section in self.prefs.values():
for attrname in section:
- if not self.settings.isDefault(attrname):
+ if not self.settings.is_default(attrname):
return True
return False
diff --git a/pitivi/editorperspective.py b/pitivi/editorperspective.py
index 84261c2c..f48a2fe9 100644
--- a/pitivi/editorperspective.py
+++ b/pitivi/editorperspective.py
@@ -49,24 +49,24 @@ from pitivi.utils.ui import info_name
from pitivi.viewer.viewer import ViewerContainer
-GlobalSettings.addConfigSection("main-window")
-GlobalSettings.addConfigOption('mainWindowHPanePosition',
- section="main-window",
- key="hpane-position",
- type_=int)
-GlobalSettings.addConfigOption('mainWindowMainHPanePosition',
- section="main-window",
- key="main-hpane-position",
- type_=int)
-GlobalSettings.addConfigOption('mainWindowVPanePosition',
- section="main-window",
- key="vpane-position",
- type_=int)
-GlobalSettings.addConfigOption('lastProjectFolder',
- section="main-window",
- key="last-folder",
- environment="PITIVI_PROJECT_FOLDER",
- default=os.path.expanduser("~"))
+GlobalSettings.add_config_section("main-window")
+GlobalSettings.add_config_option('mainWindowHPanePosition',
+ section="main-window",
+ key="hpane-position",
+ type_=int)
+GlobalSettings.add_config_option('mainWindowMainHPanePosition',
+ section="main-window",
+ key="main-hpane-position",
+ type_=int)
+GlobalSettings.add_config_option('mainWindowVPanePosition',
+ section="main-window",
+ key="vpane-position",
+ type_=int)
+GlobalSettings.add_config_option('lastProjectFolder',
+ section="main-window",
+ key="last-folder",
+ environment="PITIVI_PROJECT_FOLDER",
+ default=os.path.expanduser("~"))
class EditorPerspective(Perspective, Loggable):
@@ -87,31 +87,31 @@ class EditorPerspective(Perspective, Loggable):
pm = self.app.project_manager
pm.connect("new-project-loaded",
- self._projectManagerNewProjectLoadedCb)
+ self._project_manager_new_project_loaded_cb)
pm.connect("save-project-failed",
- self._projectManagerSaveProjectFailedCb)
- pm.connect("project-saved", self._projectManagerProjectSavedCb)
- pm.connect("closing-project", self._projectManagerClosingProjectCb)
+ self._project_manager_save_project_failed_cb)
+ pm.connect("project-saved", self._project_manager_project_saved_cb)
+ pm.connect("closing-project", self._project_manager_closing_project_cb)
pm.connect("reverting-to-saved",
- self._projectManagerRevertingToSavedCb)
- pm.connect("project-closed", self._projectManagerProjectClosedCb)
- pm.connect("missing-uri", self._projectManagerMissingUriCb)
+ self._project_manager_reverting_to_saved_cb)
+ pm.connect("project-closed", self._project_manager_project_closed_cb)
+ pm.connect("missing-uri", self._project_manager_missing_uri_cb)
def setup_ui(self):
"""Sets up the UI."""
self.__setup_css()
self._create_ui()
self.app.gui.connect("focus-in-event", self.__focus_in_event_cb)
- self.app.gui.connect("destroy", self._destroyedCb)
+ self.app.gui.connect("destroy", self._destroyed_cb)
def activate_compact_mode(self):
"""Shrinks widgets to suit better a small screen."""
- self.medialibrary.activateCompactMode()
- self.viewer.activateCompactMode()
+ self.medialibrary.activate_compact_mode()
+ self.viewer.activate_compact_mode()
def refresh(self):
"""Refreshes the perspective."""
- self.focusTimeline()
+ self.focus_timeline()
def __setup_css(self):
css_provider = Gtk.CssProvider()
@@ -143,20 +143,20 @@ class EditorPerspective(Perspective, Loggable):
if ges_clip.ui.video_widget:
ges_clip.ui.video_widget.update_previewer()
- def _destroyedCb(self, unused_main_window):
+ def _destroyed_cb(self, unused_main_window):
"""Cleanup before destroying this window."""
pm = self.app.project_manager
- pm.disconnect_by_func(self._projectManagerNewProjectLoadedCb)
- pm.disconnect_by_func(self._projectManagerSaveProjectFailedCb)
- pm.disconnect_by_func(self._projectManagerProjectSavedCb)
- pm.disconnect_by_func(self._projectManagerClosingProjectCb)
- pm.disconnect_by_func(self._projectManagerRevertingToSavedCb)
- pm.disconnect_by_func(self._projectManagerProjectClosedCb)
- pm.disconnect_by_func(self._projectManagerMissingUriCb)
+ pm.disconnect_by_func(self._project_manager_new_project_loaded_cb)
+ pm.disconnect_by_func(self._project_manager_save_project_failed_cb)
+ pm.disconnect_by_func(self._project_manager_project_saved_cb)
+ pm.disconnect_by_func(self._project_manager_closing_project_cb)
+ pm.disconnect_by_func(self._project_manager_reverting_to_saved_cb)
+ pm.disconnect_by_func(self._project_manager_project_closed_cb)
+ pm.disconnect_by_func(self._project_manager_missing_uri_cb)
self.toplevel_widget.remove(self.timeline_ui)
self.timeline_ui.destroy()
- def _renderCb(self, unused_button):
+ def _render_cb(self, unused_button):
"""Shows the RenderDialog for the current project."""
from pitivi.render import RenderDialog
@@ -201,7 +201,7 @@ class EditorPerspective(Perspective, Loggable):
self.medialibrary, Gtk.Label(label=_("Media Library")))
self.main_tabs.append_page("Effect Library",
self.effectlist, Gtk.Label(label=_("Effect Library")))
- self.medialibrary.connect('play', self._mediaLibraryPlayCb)
+ self.medialibrary.connect('play', self._media_library_play_cb)
self.medialibrary.show()
self.effectlist.show()
@@ -251,12 +251,12 @@ class EditorPerspective(Perspective, Loggable):
# Restore settings for position and visibility.
if self.settings.mainWindowHPanePosition is None:
- self._setDefaultPositions()
+ self._set_default_positions()
self.secondhpaned.set_position(self.settings.mainWindowHPanePosition)
self.mainhpaned.set_position(self.settings.mainWindowMainHPanePosition)
self.toplevel_widget.set_position(self.settings.mainWindowVPanePosition)
- def _setDefaultPositions(self):
+ def _set_default_positions(self):
window_width = self.app.gui.get_size()[0]
if self.settings.mainWindowHPanePosition is None:
self.settings.mainWindowHPanePosition = window_width / 3
@@ -273,7 +273,7 @@ class EditorPerspective(Perspective, Loggable):
value = req.height / 2
self.settings.mainWindowVPanePosition = value
- def switchContextTab(self, ges_clip):
+ def switch_context_tab(self, ges_clip):
"""Activates the appropriate tab on the second set of tabs.
Args:
@@ -290,7 +290,7 @@ class EditorPerspective(Perspective, Loggable):
return
self.context_tabs.set_current_page(page)
- def focusTimeline(self):
+ def focus_timeline(self):
layers_representation = self.timeline_ui.timeline.layout
# Check whether it has focus already, grab_focus always emits an event.
if not layers_representation.props.is_focus:
@@ -324,7 +324,7 @@ class EditorPerspective(Perspective, Loggable):
self.render_button.set_tooltip_text(
_("Export your project as a finished movie"))
self.render_button.set_sensitive(False) # The only one we have to set.
- self.render_button.connect("clicked", self._renderCb)
+ self.render_button.connect("clicked", self._render_cb)
undo_redo_box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=0)
undo_redo_box.get_style_context().add_class("linked")
@@ -388,16 +388,16 @@ class EditorPerspective(Perspective, Loggable):
def __import_asset_cb(self, unused_action, unused_param):
self.medialibrary.show_import_assets_dialog()
- def showProjectStatus(self):
+ def show_project_status(self):
project = self.app.project_manager.current_project
- dirty = project.hasUnsavedModifications()
+ dirty = project.has_unsaved_modifications()
self.save_action.set_enabled(dirty)
self.revert_to_saved_action.set_enabled(bool(project.uri) and dirty)
- self.updateTitle()
+ self.update_title()
# UI Callbacks
- def _mediaLibraryPlayCb(self, unused_medialibrary, asset):
+ def _media_library_play_cb(self, unused_medialibrary, asset):
"""Previews the specified asset.
If the media library item to preview is an image, show it in the user's
@@ -412,32 +412,32 @@ class EditorPerspective(Perspective, Loggable):
preview_window = PreviewAssetWindow(asset, self.app)
preview_window.preview()
- def _projectChangedCb(self, unused_project):
+ def _project_changed_cb(self, unused_project):
self.save_action.set_enabled(True)
- self.updateTitle()
+ self.update_title()
# Toolbar/Menu actions callback
def __save_project_cb(self, unused_action, unused_param):
- self.saveProject()
+ self.save_project()
def __save_project_as_cb(self, unused_action, unused_param):
- self.saveProjectAs()
+ self.save_project_as()
- def saveProject(self):
+ def save_project(self):
if not self.app.project_manager.current_project.uri or self.app.project_manager.disable_save:
- self.saveProjectAs()
+ self.save_project_as()
else:
- self.app.project_manager.saveProject()
+ self.app.project_manager.save_project()
def __revert_to_saved_cb(self, unused_action, unused_param):
- self.app.project_manager.revertToSavedProject()
+ self.app.project_manager.revert_to_saved_project()
def __export_project_cb(self, unused_action, unused_param):
- uri = self._showExportDialog(self.app.project_manager.current_project)
+ uri = self._show_export_dialog(self.app.project_manager.current_project)
result = None
if uri:
- result = self.app.project_manager.exportProject(
+ result = self.app.project_manager.export_project(
self.app.project_manager.current_project, uri)
if not result:
@@ -445,17 +445,17 @@ class EditorPerspective(Perspective, Loggable):
return result
def __project_settings_cb(self, unused_action, unused_param):
- self.showProjectSettingsDialog()
+ self.show_project_settings_dialog()
- def showProjectSettingsDialog(self):
+ def show_project_settings_dialog(self):
project = self.app.project_manager.current_project
dialog = ProjectSettingsDialog(self.app.gui, project, self.app)
dialog.window.run()
- self.updateTitle()
+ self.update_title()
# Project management callbacks
- def _projectManagerNewProjectLoadedCb(self, project_manager, project):
+ def _project_manager_new_project_loaded_cb(self, project_manager, project):
"""Connects the UI to the specified project.
Args:
@@ -464,19 +464,19 @@ class EditorPerspective(Perspective, Loggable):
"""
self.log("A new project has been loaded")
- self._connectToProject(project)
- project.pipeline.activatePositionListener()
+ self._connect_to_project(project)
+ project.pipeline.activate_position_listener()
self.clipconfig.project = project
- self.timeline_ui.setProject(project)
+ self.timeline_ui.set_project(project)
# When creating a blank project there's no project URI yet.
if project.uri:
folder_path = os.path.dirname(path_from_uri(project.uri))
self.settings.lastProjectFolder = folder_path
- self.updateTitle()
+ self.update_title()
if project_manager.disable_save is True:
# Special case: we enforce "Save as", but the normal "Save" button
@@ -486,7 +486,7 @@ class EditorPerspective(Perspective, Loggable):
if project.ges_timeline.props.duration != 0:
self.render_button.set_sensitive(True)
- def _projectManagerSaveProjectFailedCb(self, unused_project_manager, uri, exception=None):
+ def _project_manager_save_project_failed_cb(self, unused_project_manager, uri, exception=None):
project_filename = unquote(uri.split("/")[-1])
dialog = Gtk.MessageDialog(transient_for=self.app.gui,
modal=True,
@@ -501,11 +501,11 @@ class EditorPerspective(Perspective, Loggable):
dialog.destroy()
self.error("failed to save project")
- def _projectManagerProjectSavedCb(self, unused_project_manager, unused_project, unused_uri):
- self.updateTitle()
+ def _project_manager_project_saved_cb(self, unused_project_manager, unused_project, unused_uri):
+ self.update_title()
self.save_action.set_enabled(False)
- def _projectManagerClosingProjectCb(self, project_manager, project):
+ def _project_manager_closing_project_cb(self, project_manager, project):
"""Investigates whether it's possible to close the specified project.
Args:
@@ -516,7 +516,7 @@ class EditorPerspective(Perspective, Loggable):
bool: True when it's OK to close it, False when the user chooses
to cancel the closing operation.
"""
- if not project.hasUnsavedModifications():
+ if not project.has_unsaved_modifications():
return True
if project.uri and not project_manager.disable_save:
@@ -557,9 +557,9 @@ class EditorPerspective(Perspective, Loggable):
if response == Gtk.ResponseType.YES:
if project.uri is not None and project_manager.disable_save is False:
- res = self.app.project_manager.saveProject()
+ res = self.app.project_manager.save_project()
else:
- res = self.saveProjectAs()
+ res = self.save_project_as()
elif response == Gtk.ResponseType.REJECT:
res = True
else:
@@ -567,7 +567,7 @@ class EditorPerspective(Perspective, Loggable):
return res
- def _projectManagerProjectClosedCb(self, unused_project_manager, project):
+ def _project_manager_project_closed_cb(self, unused_project_manager, project):
"""Starts disconnecting the UI from the specified project.
This happens when the user closes the app or asks to load another
@@ -580,17 +580,17 @@ class EditorPerspective(Perspective, Loggable):
"""
# We must disconnect from the project pipeline before it is released:
if project.pipeline is not None:
- project.pipeline.deactivatePositionListener()
+ project.pipeline.deactivate_position_listener()
self.info("Project closed")
if project.loaded:
- self._disconnectFromProject(project)
- self.timeline_ui.setProject(None)
+ self._disconnect_from_project(project)
+ self.timeline_ui.set_project(None)
self.render_button.set_sensitive(False)
return False
- def _projectManagerRevertingToSavedCb(self, unused_project_manager, unused_project):
- if self.app.project_manager.current_project.hasUnsavedModifications():
+ def _project_manager_reverting_to_saved_cb(self, unused_project_manager, unused_project):
+ if self.app.project_manager.current_project.has_unsaved_modifications():
dialog = Gtk.MessageDialog(transient_for=self.app.gui,
modal=True,
message_type=Gtk.MessageType.WARNING,
@@ -609,14 +609,14 @@ class EditorPerspective(Perspective, Loggable):
return False
return True
- def _projectManagerMissingUriCb(self, project_manager, project, unused_error, asset):
+ def _project_manager_missing_uri_cb(self, project_manager, project, unused_error, asset):
if project.at_least_one_asset_missing:
# One asset is already missing so no point in spamming the user
# with more file-missing dialogs, as we need all of them.
return None
if self.app.proxy_manager.is_proxy_asset(asset):
- uri = self.app.proxy_manager.getTargetUri(asset)
+ uri = self.app.proxy_manager.get_target_uri(asset)
else:
uri = asset.get_id()
@@ -625,9 +625,9 @@ class EditorPerspective(Perspective, Loggable):
if not new_uri:
dialog.hide()
- if not self.app.proxy_manager.checkProxyLoadingSucceeded(asset):
+ if not self.app.proxy_manager.check_proxy_loading_succeeded(asset):
# Reset the project manager and disconnect all the signals.
- project_manager.closeRunningProject()
+ project_manager.close_running_project()
# Signal the project loading failure.
# You have to do this *after* successfully creating a blank project,
# or the startupwizard will still be connected to that signal too.
@@ -639,16 +639,16 @@ class EditorPerspective(Perspective, Loggable):
dialog.destroy()
return new_uri
- def _connectToProject(self, project):
- project.connect("project-changed", self._projectChangedCb)
+ def _connect_to_project(self, project):
+ project.connect("project-changed", self._project_changed_cb)
project.ges_timeline.connect("notify::duration",
- self._timelineDurationChangedCb)
+ self._timeline_duration_changed_cb)
- def _disconnectFromProject(self, project):
- project.disconnect_by_func(self._projectChangedCb)
- project.ges_timeline.disconnect_by_func(self._timelineDurationChangedCb)
+ def _disconnect_from_project(self, project):
+ project.disconnect_by_func(self._project_changed_cb)
+ project.ges_timeline.disconnect_by_func(self._timeline_duration_changed_cb)
- def _timelineDurationChangedCb(self, timeline, unused_duration):
+ def _timeline_duration_changed_cb(self, timeline, unused_duration):
"""Updates the render button.
This covers the case when a clip is inserted into a blank timeline.
@@ -658,7 +658,7 @@ class EditorPerspective(Perspective, Loggable):
self.debug("Timeline duration changed to %s", duration)
self.render_button.set_sensitive(duration > 0)
- def _showExportDialog(self, project):
+ def _show_export_dialog(self, project):
self.log("Export requested")
chooser = Gtk.FileChooserDialog(title=_("Export To..."),
transient_for=self.app.gui,
@@ -700,13 +700,13 @@ class EditorPerspective(Perspective, Loggable):
chooser.destroy()
return ret
- def saveProjectAs(self):
- uri = self._showSaveAsDialog()
+ def save_project_as(self):
+ uri = self._show_save_as_dialog()
if uri is None:
return False
- return self.app.project_manager.saveProject(uri)
+ return self.app.project_manager.save_project(uri)
- def _showSaveAsDialog(self):
+ def _show_save_as_dialog(self):
self.log("Save URI requested")
chooser = Gtk.FileChooserDialog(title=_("Save As..."),
transient_for=self.app.gui,
@@ -750,13 +750,13 @@ class EditorPerspective(Perspective, Loggable):
def __save_frame_cb(self, unused_action, unused_param):
"""Exports a snapshot of the current frame as an image file."""
- res = self._showSaveScreenshotDialog()
+ res = self._show_save_screenshot_dialog()
if res:
path, mime = res[0], res[1]
self.app.project_manager.current_project.pipeline.save_thumbnail(
-1, -1, mime, path)
- def _showSaveScreenshotDialog(self):
+ def _show_save_screenshot_dialog(self):
"""Asks the user where to save the current frame.
Returns:
@@ -790,10 +790,10 @@ class EditorPerspective(Perspective, Loggable):
chooser.destroy()
return ret
- def updateTitle(self):
+ def update_title(self):
project = self.app.project_manager.current_project
unsaved_mark = ""
- if project.hasUnsavedModifications():
+ if project.has_unsaved_modifications():
unsaved_mark = "*"
title = "%s%s — %s" % (unsaved_mark, project.name, APPNAME)
self.headerbar.set_title(title)
@@ -825,7 +825,7 @@ class PreviewAssetWindow(Gtk.Window):
def preview(self):
"""Shows the window and starts the playback."""
- width, height = self._calculatePreviewWindowSize()
+ width, height = self._calculate_preview_window_size()
self.resize(width, height)
# Setting the position of the window only works if it's currently hidden
# otherwise, after the resize the position will not be readjusted
@@ -837,7 +837,7 @@ class PreviewAssetWindow(Gtk.Window):
# focused
self.present()
- def _calculatePreviewWindowSize(self):
+ def _calculate_preview_window_size(self):
info = self._asset.get_info()
video_streams = info.get_video_streams()
if not video_streams:
diff --git a/pitivi/effects.py b/pitivi/effects.py
index 46a472f8..1c11b1d7 100644
--- a/pitivi/effects.py
+++ b/pitivi/effects.py
@@ -147,7 +147,7 @@ HIDDEN_EFFECTS = [
# Overlaying an image onto a video stream can already be done.
"gdkpixbufoverlay"]
-GlobalSettings.addConfigSection('effect-library')
+GlobalSettings.add_config_section('effect-library')
(COL_NAME_TEXT,
COL_DESC_TEXT,
@@ -277,7 +277,7 @@ class EffectsManager(Loggable):
human_name = useless_re.sub("", longname).title()
effect = EffectInfo(name,
media_type,
- categories=self._getEffectCategories(name),
+ categories=self._get_effect_categories(name),
human_name=human_name,
description=factory.get_description())
self._effects[name] = effect
@@ -303,7 +303,7 @@ class EffectsManager(Loggable):
self.error("Can not use GL effects: %s", e)
HIDDEN_EFFECTS.extend(self.gl_effects)
- def getInfo(self, bin_description):
+ def get_info(self, bin_description):
"""Gets the info for an effect which can be applied.
Args:
@@ -315,7 +315,7 @@ class EffectsManager(Loggable):
name = EffectInfo.name_from_bin_description(bin_description)
return self._effects.get(name)
- def _getEffectCategories(self, effect_name):
+ def _get_effect_categories(self, effect_name):
"""Gets the categories to which the specified effect belongs.
Args:
@@ -339,15 +339,15 @@ class EffectsManager(Loggable):
@property
def video_categories(self):
"""Gets all video effect categories names."""
- return EffectsManager._getCategoriesNames(VIDEO_EFFECTS_CATEGORIES)
+ return EffectsManager._get_categories_names(VIDEO_EFFECTS_CATEGORIES)
@property
def audio_categories(self):
"""Gets all audio effect categories names."""
- return EffectsManager._getCategoriesNames(AUDIO_EFFECTS_CATEGORIES)
+ return EffectsManager._get_categories_names(AUDIO_EFFECTS_CATEGORIES)
@staticmethod
- def _getCategoriesNames(categories):
+ def _get_categories_names(categories):
ret = [category_name for category_name, unused_effects in categories]
ret.sort()
ret.insert(0, _("All effects"))
@@ -416,21 +416,21 @@ class EffectListWidget(Gtk.Box, Loggable):
text_cell.set_property("ellipsize", Pango.EllipsizeMode.END)
text_col.pack_start(text_cell, True)
text_col.set_cell_data_func(
- text_cell, self.viewDescriptionCellDataFunc, None)
+ text_cell, self.view_description_cell_data_func, None)
self.view.append_column(icon_col)
self.view.append_column(text_col)
- self.view.connect("query-tooltip", self._treeViewQueryTooltipCb)
+ self.view.connect("query-tooltip", self._tree_view_query_tooltip_cb)
self.view.props.has_tooltip = True
# Make the treeview a drag source which provides effects.
self.view.enable_model_drag_source(
Gdk.ModifierType.BUTTON1_MASK, [EFFECT_TARGET_ENTRY], Gdk.DragAction.COPY)
- self.view.connect("button-press-event", self._buttonPressEventCb)
- self.view.connect("select-cursor-row", self._enterPressEventCb)
- self.view.connect("drag-data-get", self._dndDragDataGetCb)
+ self.view.connect("button-press-event", self._button_press_event_cb)
+ self.view.connect("select-cursor-row", self._enter_press_event_cb)
+ self.view.connect("drag-data-get", self._dnd_drag_data_get_cb)
scrollwin = Gtk.ScrolledWindow()
scrollwin.props.hscrollbar_policy = Gtk.PolicyType.NEVER
@@ -442,7 +442,7 @@ class EffectListWidget(Gtk.Box, Loggable):
# Delay the loading of the available effects so the application
# starts faster.
- GLib.idle_add(self._loadAvailableEffectsCb)
+ GLib.idle_add(self._load_available_effects_cb)
self.populate_categories_widget()
# Individually show the tab's widgets.
@@ -450,35 +450,35 @@ class EffectListWidget(Gtk.Box, Loggable):
scrollwin.show_all()
toolbar.show_all()
- def _treeViewQueryTooltipCb(self, view, x, y, keyboard_mode, tooltip):
+ def _tree_view_query_tooltip_cb(self, view, x, y, keyboard_mode, tooltip):
is_row, x, y, model, path, tree_iter = view.get_tooltip_context(
x, y, keyboard_mode)
if not is_row:
return False
view.set_tooltip_row(tooltip, path)
- tooltip.set_markup(self.formatDescription(model, tree_iter))
+ tooltip.set_markup(self.format_description(model, tree_iter))
return True
- def viewDescriptionCellDataFunc(self, unused_column, cell, model, iter_, unused_data):
- cell.props.markup = self.formatDescription(model, iter_)
+ def view_description_cell_data_func(self, unused_column, cell, model, iter_, unused_data):
+ cell.props.markup = self.format_description(model, iter_)
- def formatDescription(self, model, iter_):
+ def format_description(self, model, iter_):
name, desc = model.get(iter_, COL_NAME_TEXT, COL_DESC_TEXT)
escape = GLib.markup_escape_text
return "<b>%s</b>\n%s" % (escape(name), escape(desc))
- def _loadAvailableEffectsCb(self):
- self._addFactories(self.app.effects.video_effects, VIDEO_EFFECT)
- self._addFactories(self.app.effects.audio_effects, AUDIO_EFFECT)
+ def _load_available_effects_cb(self):
+ self._add_factories(self.app.effects.video_effects, VIDEO_EFFECT)
+ self._add_factories(self.app.effects.audio_effects, AUDIO_EFFECT)
return False
- def _addFactories(self, elements, effect_type):
+ def _add_factories(self, elements, effect_type):
for element in elements:
name = element.get_name()
if name in HIDDEN_EFFECTS:
continue
- effect_info = self.app.effects.getInfo(name)
+ effect_info = self.app.effects.get_info(name)
self.storemodel.append([effect_info.human_name,
effect_info.description,
effect_type,
@@ -501,11 +501,11 @@ class EffectListWidget(Gtk.Box, Loggable):
self.categories_widget.set_active(0)
- def _dndDragDataGetCb(self, unused_view, drag_context, selection_data, unused_info, unused_timestamp):
- data = bytes(self.getSelectedEffect(), "UTF-8")
+ def _dnd_drag_data_get_cb(self, unused_view, drag_context, selection_data, unused_info,
unused_timestamp):
+ data = bytes(self.get_selected_effect(), "UTF-8")
selection_data.set(drag_context.list_targets()[0], 0, data)
- def _rowUnderMouseSelected(self, view, event):
+ def _row_under_mouse_selected(self, view, event):
result = view.get_path_at_pos(int(event.x), int(event.y))
if result:
path = result[0]
@@ -514,35 +514,35 @@ class EffectListWidget(Gtk.Box, Loggable):
selection.count_selected_rows() > 0
return False
- def _enterPressEventCb(self, unused_view, unused_event=None):
- self._addSelectedEffect()
+ def _enter_press_event_cb(self, unused_view, unused_event=None):
+ self._add_selected_effect()
- def _buttonPressEventCb(self, view, event):
+ def _button_press_event_cb(self, view, event):
chain_up = True
if event.button == 3:
chain_up = False
elif event.type == getattr(Gdk.EventType, '2BUTTON_PRESS'):
- self._addSelectedEffect()
+ self._add_selected_effect()
else:
- chain_up = not self._rowUnderMouseSelected(view, event)
+ chain_up = not self._row_under_mouse_selected(view, event)
if chain_up:
self._dragged_items = None
else:
- self._dragged_items = self.getSelectedEffect()
+ self._dragged_items = self.get_selected_effect()
Gtk.TreeView.do_button_press_event(view, event)
return True
- def _addSelectedEffect(self):
+ def _add_selected_effect(self):
"""Adds the selected effect to the single selected clip, if any."""
- effect = self.getSelectedEffect()
- effect_info = self.app.effects.getInfo(effect)
+ effect = self.get_selected_effect()
+ effect_info = self.app.effects.get_info(effect)
if not effect_info:
return
timeline = self.app.gui.editor.timeline_ui.timeline
- clip = timeline.selection.getSingleClip()
+ clip = timeline.selection.get_single_clip()
if not clip:
return
pipeline = timeline.ges_timeline.get_parent()
@@ -552,14 +552,14 @@ class EffectListWidget(Gtk.Box, Loggable):
toplevel=True):
clip.ui.add_effect(effect_info)
- def getSelectedEffect(self):
+ def get_selected_effect(self):
if self._dragged_items:
return self._dragged_items
unused_model, rows = self.view.get_selection().get_selected_rows()
path = self.model_filter.convert_path_to_child_path(rows[0])
return self.storemodel[path][COL_ELEMENT_NAME]
- def _toggleViewTypeCb(self, widget):
+ def _toggle_view_type_cb(self, widget):
"""Switches the view mode between video and audio.
This makes the two togglebuttons behave like a group of radiobuttons.
@@ -628,7 +628,7 @@ class EffectsPropertiesManager(GObject.Object, Loggable):
effect_name = effect.get_property("bin-description")
self.log('UI is being auto-generated for "%s"', effect_name)
effect_widget.add_widgets(create_property_widget=self.create_property_widget, with_reset_button=True)
- self._postConfiguration(effect, effect_widget)
+ self._post_configuration(effect, effect_widget)
def do_create_property_widget(self, effect_widget, effect, prop, prop_value):
"""Creates a widget if the `create_property_widget` handlers did not."""
@@ -641,7 +641,7 @@ class EffectsPropertiesManager(GObject.Object, Loggable):
self.cache_dict = {}
self.app = app
- def getEffectConfigurationUI(self, effect):
+ def get_effect_configuration_ui(self, effect):
"""Gets a configuration UI element for the effect.
Args:
@@ -658,28 +658,28 @@ class EffectsPropertiesManager(GObject.Object, Loggable):
if widget is not None:
effect_widget.show_widget(widget)
self.cache_dict[effect] = effect_widget
- self._connectAllWidgetCallbacks(effect_widget, effect)
+ self._connect_all_widget_callbacks(effect_widget, effect)
return self.cache_dict[effect]
- def cleanCache(self, effect):
+ def clean_cache(self, effect):
if effect in self.cache_dict:
self.cache_dict.pop(effect)
- def _postConfiguration(self, effect, effect_set_ui):
+ def _post_configuration(self, effect, effect_set_ui):
effect_name = effect.get_property("bin-description")
if 'aspectratiocrop' in effect.get_property("bin-description"):
for widget in effect_set_ui.get_children()[0].get_children():
if isinstance(widget, FractionWidget):
- widget.addPresets(["4:3", "5:4", "9:3", "16:9", "16:10"])
+ widget.add_presets(["4:3", "5:4", "9:3", "16:9", "16:10"])
else:
self.log('No additional set-up required for "%s"', effect_name)
return
self.debug('Additional properties successfully set for "%s"', effect_name)
- def _connectAllWidgetCallbacks(self, effect_widget, effect):
+ def _connect_all_widget_callbacks(self, effect_widget, effect):
for prop, widget in effect_widget.properties.items():
- widget.connectValueChanged(self._on_widget_value_changed_cb, widget, prop, effect, effect_widget)
+ widget.connect_value_changed(self._on_widget_value_changed_cb, widget, prop, effect,
effect_widget)
def _on_widget_value_changed_cb(self, unused_widget, prop_widget, prop, effect, effect_widget):
if effect_widget.updating_property:
@@ -689,7 +689,7 @@ class EffectsPropertiesManager(GObject.Object, Loggable):
effect_widget.updating_property = True
try:
- value = prop_widget.getWidgetValue()
+ value = prop_widget.get_widget_value()
# FIXME Workaround in order to make aspectratiocrop working
if isinstance(value, Gst.Fraction):
diff --git a/pitivi/greeterperspective.py b/pitivi/greeterperspective.py
index 8d06d612..275a0269 100644
--- a/pitivi/greeterperspective.py
+++ b/pitivi/greeterperspective.py
@@ -110,7 +110,7 @@ class GreeterPerspective(Perspective):
# Projects selected for removal.
self.__selected_projects = []
- if app.getLatest():
+ if app.get_latest():
self.__show_newer_available_version()
else:
app.connect("version-info-received", self.__app_version_info_received_cb)
@@ -332,13 +332,13 @@ class GreeterPerspective(Perspective):
def __app_version_info_received_cb(self, app, unused_version_information):
"""Handles new version info."""
- if app.isLatest():
+ if app.is_latest():
# current version, don't show message
return
self.__show_newer_available_version()
def __show_newer_available_version(self):
- latest_version = self.app.getLatest()
+ latest_version = self.app.get_latest()
if self.app.settings.lastCurrentVersion != latest_version:
# new latest version, reset counter
diff --git a/pitivi/mainwindow.py b/pitivi/mainwindow.py
index f933647b..37bb29fe 100644
--- a/pitivi/mainwindow.py
+++ b/pitivi/mainwindow.py
@@ -35,35 +35,35 @@ from pitivi.utils.loggable import Loggable
from pitivi.utils.misc import show_user_manual
-GlobalSettings.addConfigOption('mainWindowX',
- section="main-window",
- key="X", default=0, type_=int)
-GlobalSettings.addConfigOption('mainWindowY',
- section="main-window",
- key="Y", default=0, type_=int)
-GlobalSettings.addConfigOption('mainWindowWidth',
- section="main-window",
- key="width", default=-1, type_=int)
-GlobalSettings.addConfigOption('mainWindowHeight',
- section="main-window",
- key="height", default=-1, type_=int)
-
-GlobalSettings.addConfigSection('export')
-GlobalSettings.addConfigOption('lastExportFolder',
- section='export',
- key="last-export-folder",
- environment="PITIVI_EXPORT_FOLDER",
- default=os.path.expanduser("~"))
-
-GlobalSettings.addConfigSection("version")
-GlobalSettings.addConfigOption('displayCounter',
- section='version',
- key='info-displayed-counter',
- default=0)
-GlobalSettings.addConfigOption('lastCurrentVersion',
- section='version',
- key='last-current-version',
- default='')
+GlobalSettings.add_config_option('mainWindowX',
+ section="main-window",
+ key="X", default=0, type_=int)
+GlobalSettings.add_config_option('mainWindowY',
+ section="main-window",
+ key="Y", default=0, type_=int)
+GlobalSettings.add_config_option('mainWindowWidth',
+ section="main-window",
+ key="width", default=-1, type_=int)
+GlobalSettings.add_config_option('mainWindowHeight',
+ section="main-window",
+ key="height", default=-1, type_=int)
+
+GlobalSettings.add_config_section('export')
+GlobalSettings.add_config_option('lastExportFolder',
+ section='export',
+ key="last-export-folder",
+ environment="PITIVI_EXPORT_FOLDER",
+ default=os.path.expanduser("~"))
+
+GlobalSettings.add_config_section("version")
+GlobalSettings.add_config_option('displayCounter',
+ section='version',
+ key='info-displayed-counter',
+ default=0)
+GlobalSettings.add_config_option('lastCurrentVersion',
+ section='version',
+ key='last-current-version',
+ default='')
class MainWindow(Gtk.ApplicationWindow, Loggable):
diff --git a/pitivi/mediafilespreviewer.py b/pitivi/mediafilespreviewer.py
index 2fd25899..2d41d91e 100644
--- a/pitivi/mediafilespreviewer.py
+++ b/pitivi/mediafilespreviewer.py
@@ -41,19 +41,19 @@ from pitivi.viewer.viewer import ViewerWidget
PREVIEW_WIDTH = 250
PREVIEW_HEIGHT = 100
-GlobalSettings.addConfigSection('filechooser-preview')
-GlobalSettings.addConfigOption('FCEnablePreview',
- section='filechooser-preview',
- key='do-preview-on-clip-import',
- default=True)
-GlobalSettings.addConfigOption('FCpreviewWidth',
- section='filechooser-preview',
- key='video-preview-width',
- default=PREVIEW_WIDTH)
-GlobalSettings.addConfigOption('FCpreviewHeight',
- section='filechooser-preview',
- key='video-preview-height',
- default=PREVIEW_HEIGHT)
+GlobalSettings.add_config_section('filechooser-preview')
+GlobalSettings.add_config_option('FCEnablePreview',
+ section='filechooser-preview',
+ key='do-preview-on-clip-import',
+ default=True)
+GlobalSettings.add_config_option('FCpreviewWidth',
+ section='filechooser-preview',
+ key='video-preview-width',
+ default=PREVIEW_WIDTH)
+GlobalSettings.add_config_option('FCpreviewHeight',
+ section='filechooser-preview',
+ key='video-preview-height',
+ default=PREVIEW_HEIGHT)
ACCEPTABLE_TAGS = [
Gst.TAG_ALBUM_ARTIST,
@@ -85,8 +85,8 @@ class PreviewWidget(Gtk.Grid, Loggable):
# playbin for play pics
self.player = AssetPipeline(name="preview-player")
- self.player.connect('eos', self._pipelineEosCb)
- self.player.connect('error', self._pipelineErrorCb)
+ self.player.connect('eos', self._pipeline_eos_cb)
+ self.player.connect('error', self._pipeline_error_cb)
self.player._bus.connect('message::tag', self._tag_found_cb)
# some global variables for preview handling
@@ -324,7 +324,7 @@ class PreviewWidget(Gtk.Grid, Loggable):
self.play_button.set_icon_name("media-playback-start")
self.log("Preview paused")
- def togglePlayback(self):
+ def toggle_playback(self):
if self.is_playing:
self.pause()
else:
@@ -366,24 +366,24 @@ class PreviewWidget(Gtk.Grid, Loggable):
self.player.simple_seek(value)
self.at_eos = False
- def _pipelineEosCb(self, unused_pipeline):
+ def _pipeline_eos_cb(self, unused_pipeline):
self._update_position()
self.pause()
# The pipeline is at the end. Leave it like that so the last frame
# is displayed.
self.at_eos = True
- def _pipelineErrorCb(self, unused_pipeline, unused_message, unused_detail):
+ def _pipeline_error_cb(self, unused_pipeline, unused_message, unused_detail):
self.pause(state=Gst.State.NULL)
def _update_position(self, *unused_args):
if self.is_playing and not self.slider_being_used:
- curr_pos = self.player.getPosition()
+ curr_pos = self.player.get_position()
self.pos_adj.set_value(int(curr_pos))
return self.is_playing
def _on_start_stop_clicked_cb(self, button):
- self.togglePlayback()
+ self.toggle_playback()
def _on_zoom_clicked_cb(self, button, increment):
if self.current_preview_type == 'video':
diff --git a/pitivi/medialibrary.py b/pitivi/medialibrary.py
index 29fd2acc..15b5d6df 100644
--- a/pitivi/medialibrary.py
+++ b/pitivi/medialibrary.py
@@ -69,21 +69,21 @@ from pitivi.utils.ui import URI_TARGET_ENTRY
SHOW_TREEVIEW = 1
SHOW_ICONVIEW = 2
-GlobalSettings.addConfigSection('clip-library')
-GlobalSettings.addConfigOption('lastImportFolder',
- section='clip-library',
- key='last-folder',
- environment='PITIVI_IMPORT_FOLDER',
- default=os.path.expanduser("~"))
-GlobalSettings.addConfigOption('closeImportDialog',
- section='clip-library',
- key='close-import-dialog-after-import',
- default=True)
-GlobalSettings.addConfigOption('last_clip_view',
- section='clip-library',
- key='last-clip-view',
- type_=int,
- default=SHOW_ICONVIEW)
+GlobalSettings.add_config_section('clip-library')
+GlobalSettings.add_config_option('lastImportFolder',
+ section='clip-library',
+ key='last-folder',
+ environment='PITIVI_IMPORT_FOLDER',
+ default=os.path.expanduser("~"))
+GlobalSettings.add_config_option('closeImportDialog',
+ section='clip-library',
+ key='close-import-dialog-after-import',
+ default=True)
+GlobalSettings.add_config_option('last_clip_view',
+ section='clip-library',
+ key='last-clip-view',
+ type_=int,
+ default=SHOW_ICONVIEW)
STORE_MODEL_STRUCTURE = (
GdkPixbuf.Pixbuf, GdkPixbuf.Pixbuf,
@@ -213,7 +213,7 @@ class FileChooserExtraWidget(Gtk.Box, Loggable):
self.hq_proxy_check.set_active(True)
def _target_res_cb(self, label_widget, unused_uri):
- self.app.gui.editor.showProjectSettingsDialog()
+ self.app.gui.editor.show_project_settings_dialog()
self.__update_scaled_proxy_check()
def __update_scaled_proxy_check(self):
@@ -221,7 +221,7 @@ class FileChooserExtraWidget(Gtk.Box, Loggable):
target_height = self.app.project_manager.current_project.scaled_proxy_height
self.scaled_proxy_check.set_label(_("Scale assets larger than %s×%s px.") % (target_width,
target_height))
- def saveValues(self):
+ def save_values(self):
self.app.settings.closeImportDialog = not self.__keep_open_check.get_active()
if self.hq_proxy_check.get_active():
@@ -431,7 +431,7 @@ class AssetThumbnail(GObject.Object, Loggable):
self.state = self.ASSET_PROXYING_ERROR
elif self.proxy_manager.is_asset_queued(asset):
self.state = self.IN_PROGRESS
- elif not asset.is_image() and not self.proxy_manager.isAssetFormatWellSupported(asset):
+ elif not asset.is_image() and not self.proxy_manager.is_asset_format_well_supported(asset):
self.state = self.UNSUPPORTED
else:
self.state = self.NO_PROXY
@@ -511,7 +511,7 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
self._project_settings_infobar.set_message_type(Gtk.MessageType.OTHER)
self._project_settings_infobar.set_show_close_button(True)
self._project_settings_infobar.add_button(_("Project Settings"), Gtk.ResponseType.OK)
- self._project_settings_infobar.connect("response", self.__projectSettingsSetInfobarCb)
+ self._project_settings_infobar.connect("response", self.__project_settings_set_infobar_cb)
self._project_settings_label = Gtk.Label()
self._project_settings_label.set_line_wrap(True)
self._project_settings_label.show()
@@ -522,7 +522,7 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
self._import_warning_infobar = builder.get_object("warning_infobar")
fix_infobar(self._import_warning_infobar)
self._import_warning_infobar.hide()
- self._import_warning_infobar.connect("response", self.__warningInfobarCb)
+ self._import_warning_infobar.connect("response", self.__warning_infobar_cb)
self._warning_label = builder.get_object("warning_label")
self._view_error_button = builder.get_object("view_error_button")
toolbar = builder.get_object("medialibrary_toolbar")
@@ -539,8 +539,8 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
# Prefer to sort the media library elements by URI
# rather than show them randomly.
self.storemodel.set_sort_column_id(COL_URI, Gtk.SortType.ASCENDING)
- self.storemodel.connect("row-deleted", self.__updateViewCb)
- self.storemodel.connect("row-inserted", self.__updateViewCb)
+ self.storemodel.connect("row-deleted", self.__update_view_cb)
+ self.storemodel.connect("row-inserted", self.__update_view_cb)
# Scrolled Windows
self.treeview_scrollwin = Gtk.ScrolledWindow()
@@ -568,9 +568,9 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
self.treeview = Gtk.TreeView(model=self.model_filter)
self.treeview_scrollwin.add(self.treeview)
self.treeview.connect(
- "button-press-event", self._treeViewButtonPressEventCb)
+ "button-press-event", self._tree_view_button_press_event_cb)
self.treeview.connect(
- "button-release-event", self._treeViewButtonReleaseEventCb)
+ "button-release-event", self._tree_view_button_release_event_cb)
self.treeview.connect("row-activated", self._iconview_item_or_row_activated_cb)
self.treeview.set_headers_visible(False)
self.treeview.set_property("search_column", COL_SEARCH_TEXT)
@@ -653,34 +653,34 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
self.drag_dest_add_uri_targets()
self.connect("drag_data_received", self._drag_data_received_cb)
- self._setupViewAsDragAndDropSource(self.treeview)
- self._setupViewAsDragAndDropSource(self.iconview)
+ self._setup_view_as_drag_and_drop_source(self.treeview)
+ self._setup_view_as_drag_and_drop_source(self.iconview)
# Hack so that the views have the same method as self
- self.treeview.getSelectedItems = self.getSelectedItems
+ self.treeview.get_selected_items = self.get_selected_items
actions_group = Gio.SimpleActionGroup()
self.insert_action_group("medialibrary", actions_group)
self.app.shortcuts.register_group("medialibrary", _("Media Library"), position=50)
self.remove_assets_action = Gio.SimpleAction.new("remove-assets", None)
- self.remove_assets_action.connect("activate", self._removeAssetsCb)
+ self.remove_assets_action.connect("activate", self._remove_assets_cb)
actions_group.add_action(self.remove_assets_action)
self.app.shortcuts.add("medialibrary.remove-assets", ["<Primary>Delete"],
_("Remove the selected assets"))
self.insert_at_end_action = Gio.SimpleAction.new("insert-assets-at-end", None)
- self.insert_at_end_action.connect("activate", self._insertEndCb)
+ self.insert_at_end_action.connect("activate", self._insert_end_cb)
actions_group.add_action(self.insert_at_end_action)
self.app.shortcuts.add("medialibrary.insert-assets-at-end", ["Insert"],
_("Insert selected assets at the end of the timeline"))
- self._updateActions()
+ self._update_actions()
# Set the state of the view mode toggle button.
self._listview_button.set_active(self.clip_view == SHOW_TREEVIEW)
# Make sure the proper view is displayed.
- self._displayClipView()
+ self._display_clip_view()
# Add all the child widgets.
self.pack_start(toolbar, False, False, 0)
@@ -704,10 +704,10 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
return
for asset in self._project.list_assets(GES.Extractable):
- disconnect_all_by_func(asset, self.__assetProxiedCb)
- disconnect_all_by_func(asset, self.__assetProxyingCb)
+ disconnect_all_by_func(asset, self.__asset_proxied_cb)
+ disconnect_all_by_func(asset, self.__asset_proxying_cb)
- self.__disconnectFromProject()
+ self.__disconnect_from_project()
@staticmethod
def compare_basename(model, iter1, iter2, unused_user_data):
@@ -728,7 +728,7 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
return -1
return 1
- def getAssetForUri(self, uri):
+ def get_asset_for_uri(self, uri):
for path in self.model_filter:
asset = path[COL_ASSET]
info = asset.get_info()
@@ -740,7 +740,7 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
self.warning("Did not find any asset for uri: %s", uri)
return None
- def _setupViewAsDragAndDropSource(self, view):
+ def _setup_view_as_drag_and_drop_source(self, view):
view.drag_source_set(0, [], Gdk.DragAction.COPY)
view.enable_model_drag_source(
Gdk.ModifierType.BUTTON1_MASK, [URI_TARGET_ENTRY], Gdk.DragAction.COPY)
@@ -749,19 +749,19 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
view.connect_after("drag-begin", self._dnd_drag_begin_cb)
view.connect("drag-end", self._dnd_drag_end_cb)
- def __updateViewCb(self, unused_model, unused_path, unused_iter=None):
+ def __update_view_cb(self, unused_model, unused_path, unused_iter=None):
if len(self.storemodel) == 0:
self._welcome_infobar.show_all()
else:
self._welcome_infobar.hide()
- def _importSourcesCb(self, unused_action):
+ def _import_sources_cb(self, unused_action):
self.show_import_assets_dialog()
- def _removeAssetsCb(self, unused_action, unused_parameter):
+ def _remove_assets_cb(self, unused_action, unused_parameter):
"""Removes the selected assets from the project."""
model = self.treeview.get_model()
- paths = self.getSelectedPaths()
+ paths = self.get_selected_paths()
if not paths:
return
# use row references so we don't have to care if a path has been
@@ -774,18 +774,18 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
asset = model[row.get_path()][COL_ASSET]
target = asset.get_proxy_target()
self._project.remove_asset(asset)
- self.app.gui.editor.timeline_ui.purgeAsset(asset.props.id)
+ self.app.gui.editor.timeline_ui.purge_asset(asset.props.id)
if target:
self._project.remove_asset(target)
- self.app.gui.editor.timeline_ui.purgeAsset(target.props.id)
+ self.app.gui.editor.timeline_ui.purge_asset(target.props.id)
# The treeview can make some of the remaining items selected, so
# make sure none are selected.
- self._unselectAll()
+ self._unselect_all()
- def _insertEndCb(self, unused_action, unused_parameter):
- self.app.gui.editor.timeline_ui.insertAssets(self.getSelectedAssets(), -1)
+ def _insert_end_cb(self, unused_action, unused_parameter):
+ self.app.gui.editor.timeline_ui.insert_assets(self.get_selected_assets(), -1)
def _search_entry_changed_cb(self, entry):
# With many hundred clips in an iconview with dynamic columns and
@@ -799,7 +799,7 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
if icon_pos == Gtk.EntryIconPosition.SECONDARY:
entry.set_text("")
elif icon_pos == Gtk.EntryIconPosition.PRIMARY:
- self._selectUnusedSources()
+ self._select_unused_sources()
# Focus the container so the user can use Ctrl+Delete, for example.
if self.clip_view == SHOW_TREEVIEW:
self.treeview.grab_focus()
@@ -816,16 +816,16 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
text = GLib.markup_escape_text(text)
return text in model.get_value(model_iter, COL_INFOTEXT).lower()
- def _connectToProject(self, project):
+ def _connect_to_project(self, project):
"""Connects signal handlers to the specified project."""
- project.connect("asset-added", self._assetAddedCb)
- project.connect("asset-loading-progress", self._assetLoadingProgressCb)
- project.connect("asset-removed", self._assetRemovedCb)
- project.connect("error-loading-asset", self._errorCreatingAssetCb)
- project.connect("proxying-error", self._proxyingErrorCb)
- project.connect("settings-set-from-imported-asset", self.__projectSettingsSetFromImportedAssetCb)
-
- def _setClipView(self, view_type):
+ project.connect("asset-added", self._asset_added_cb)
+ project.connect("asset-loading-progress", self._asset_loading_progress_cb)
+ project.connect("asset-removed", self._asset_removed_cb)
+ project.connect("error-loading-asset", self._error_creating_asset_cb)
+ project.connect("proxying-error", self._proxying_error_cb)
+ project.connect("settings-set-from-imported-asset",
self.__project_settings_set_from_imported_asset_cb)
+
+ def _set_clip_view(self, view_type):
"""Sets which clip view to use when medialibrary is showing clips.
Args:
@@ -833,15 +833,15 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
"""
self.app.settings.last_clip_view = view_type
# Gather some info before switching views
- paths = self.getSelectedPaths()
- self._viewUnselectAll()
+ paths = self.get_selected_paths()
+ self._view_unselect_all()
# Now that we've got all the info, we can actually change the view type
self.clip_view = view_type
- self._displayClipView()
+ self._display_clip_view()
for path in paths:
- self._viewSelectPath(path)
+ self._view_select_path(path)
- def _displayClipView(self):
+ def _display_clip_view(self):
if self.clip_view == SHOW_TREEVIEW:
self.iconview_scrollwin.hide()
self.treeview_scrollwin.show_all()
@@ -873,7 +873,7 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
dialog.set_modal(True)
dialog.set_transient_for(self.app.gui)
dialog.set_current_folder(self.app.settings.lastImportFolder)
- dialog.connect('response', self._importDialogBoxResponseCb)
+ dialog.connect('response', self._import_dialog_box_response_cb)
previewer = PreviewWidget(self.app.settings)
dialog.set_preview_widget(previewer)
dialog.set_use_preview_label(False)
@@ -904,7 +904,7 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
dialog.show()
- def _addAsset(self, asset):
+ def _add_asset(self, asset):
if self.app.proxy_manager.is_proxy_asset(asset) and \
not asset.props.proxy_target:
self.info("%s is a proxy asset but has no target, "
@@ -916,14 +916,14 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
self._pending_assets.append(asset)
if self._project.loaded:
- self._flushPendingAssets()
+ self._flush_pending_assets()
def update_asset_thumbs(self, asset_uris):
for row in self.storemodel:
if row[COL_ASSET].props.id in asset_uris:
row[COL_THUMB_DECORATOR].disregard_previewer()
- def _flushPendingAssets(self):
+ def _flush_pending_assets(self):
self.debug("Flushing %d pending model rows", len(self._pending_assets))
for asset in self._pending_assets:
thumbs_decorator = AssetThumbnail(asset, self.app.proxy_manager)
@@ -961,7 +961,7 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
# medialibrary callbacks
- def _assetLoadingProgressCb(self, project, progress, estimated_time):
+ def _asset_loading_progress_cb(self, project, progress, estimated_time):
self._progressbar.set_fraction(progress / 100)
proxying_files = []
@@ -978,7 +978,7 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
row[COL_ICON_128] = asset_previewer.large_thumb
if progress == 0:
- self._startImporting()
+ self._start_importing()
return
if project.loaded:
@@ -1001,9 +1001,9 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
self._progressbar.set_text(progress_message)
if progress == 100:
- self._doneImporting()
+ self._done_importing()
- def __assetProxyingCb(self, proxy, unused_pspec):
+ def __asset_proxying_cb(self, proxy, unused_pspec):
if not self.app.proxy_manager.is_proxy_asset(proxy):
self.info("Proxy is not a proxy in our terms (handling deleted proxy"
" files while loading a project?) - ignore it")
@@ -1012,23 +1012,23 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
self.debug("Proxy is %s - %s", proxy.props.id,
proxy.get_proxy_target())
- self.__removeAsset(proxy)
+ self.__remove_asset(proxy)
if proxy.get_proxy_target() is not None:
# Re add the proxy so its emblem icon is updated.
- self._addAsset(proxy)
+ self._add_asset(proxy)
- def __assetProxiedCb(self, asset, unused_pspec):
+ def __asset_proxied_cb(self, asset, unused_pspec):
self.debug("Asset proxied: %s -- %s", asset, asset.props.id)
proxy = asset.props.proxy
- self.__removeAsset(asset)
+ self.__remove_asset(asset)
if not proxy:
- self._addAsset(asset)
+ self._add_asset(asset)
if self._project.loaded:
self.app.gui.editor.timeline_ui.update_clips_asset(asset, proxy)
- def _assetAddedCb(self, unused_project, asset):
+ def _asset_added_cb(self, unused_project, asset):
"""Checks whether the asset added to the project should be shown."""
self._last_imported_uris.add(asset.props.id)
@@ -1038,24 +1038,24 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
if isinstance(asset, GES.UriClipAsset) and not asset.error:
self.debug("Asset %s added: %s", asset, asset.props.id)
- asset.connect("notify::proxy", self.__assetProxiedCb)
- asset.connect("notify::proxy-target", self.__assetProxyingCb)
+ asset.connect("notify::proxy", self.__asset_proxied_cb)
+ asset.connect("notify::proxy-target", self.__asset_proxying_cb)
if asset.get_proxy():
self.debug("Not adding asset %s, its proxy is used instead: %s",
asset.props.id,
asset.get_proxy().props.id)
return
- self._addAsset(asset)
+ self._add_asset(asset)
- def _assetRemovedCb(self, unused_project, asset):
+ def _asset_removed_cb(self, unused_project, asset):
if isinstance(asset, GES.UriClipAsset):
self.debug("Disconnecting %s - %s", asset, asset.props.id)
- asset.disconnect_by_func(self.__assetProxiedCb)
- asset.disconnect_by_func(self.__assetProxyingCb)
- self.__removeAsset(asset)
+ asset.disconnect_by_func(self.__asset_proxied_cb)
+ asset.disconnect_by_func(self.__asset_proxying_cb)
+ self.__remove_asset(asset)
- def __removeAsset(self, asset):
+ def __remove_asset(self, asset):
"""Removes the specified asset."""
uri = asset.get_id()
# Find the corresponding line in the storemodel and remove it.
@@ -1070,11 +1070,11 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
self.info("Failed to remove %s as it was not found"
"in the liststore", uri)
- def _proxyingErrorCb(self, unused_project, asset):
- self.__removeAsset(asset)
- self._addAsset(asset)
+ def _proxying_error_cb(self, unused_project, asset):
+ self.__remove_asset(asset)
+ self._add_asset(asset)
- def _errorCreatingAssetCb(self, unused_project, error, asset_id, extractable_type):
+ def _error_creating_asset_cb(self, unused_project, error, asset_id, extractable_type):
"""Gathers asset loading errors."""
if GObject.type_is_a(extractable_type, GES.UriClip):
if self.app.proxy_manager.is_proxy_asset(asset_id):
@@ -1084,16 +1084,16 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
self._errors.append((asset_id, str(error.domain), error))
- def _startImporting(self):
+ def _start_importing(self):
self.__last_proxying_estimate_time = _("Unknown")
self.import_start_time = time.time()
self._welcome_infobar.hide()
self._progressbar.show()
- def _doneImporting(self):
+ def _done_importing(self):
self.debug("Importing took %.3f seconds",
time.time() - self.import_start_time)
- self._flushPendingAssets()
+ self._flush_pending_assets()
self._progressbar.hide()
if self._errors:
errors_amount = len(self._errors)
@@ -1110,32 +1110,32 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
self._warning_label.set_text(text)
self._import_warning_infobar.show_all()
- self._selectLastImportedUris()
+ self._select_last_imported_uris()
- def __projectSettingsSetFromImportedAssetCb(self, unused_project, asset):
+ def __project_settings_set_from_imported_asset_cb(self, unused_project, asset):
asset_path = path_from_uri(asset.get_id())
file_name = os.path.basename(asset_path)
message = _("The project settings have been set to match file '%s'") % file_name
self._project_settings_label.set_text(message)
self._project_settings_infobar.show()
- def _selectLastImportedUris(self):
+ def _select_last_imported_uris(self):
if not self._last_imported_uris:
return
- self._selectSources(self._last_imported_uris)
+ self._select_sources(self._last_imported_uris)
self._last_imported_uris = set()
# Error Dialog Box callbacks
- def _errorDialogBoxCloseCb(self, dialog):
+ def _error_dialog_box_close_cb(self, dialog):
dialog.destroy()
- def _errorDialogBoxResponseCb(self, dialog, unused_response):
+ def _error_dialog_box_response_cb(self, dialog, unused_response):
dialog.destroy()
# Import Sources Dialog Box callbacks
- def _importDialogBoxResponseCb(self, dialogbox, response):
+ def _import_dialog_box_response_cb(self, dialogbox, response):
self.debug("response: %r", response)
if response == Gtk.ResponseType.OK:
lastfolder = dialogbox.get_current_folder()
@@ -1143,15 +1143,15 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
if not lastfolder:
lastfolder = GLib.path_get_dirname(dialogbox.get_filename())
self.app.settings.lastImportFolder = lastfolder
- dialogbox.props.extra_widget.saveValues()
+ dialogbox.props.extra_widget.save_values()
filenames = dialogbox.get_uris()
- self._project.addUris(filenames)
+ self._project.add_uris(filenames)
if self.app.settings.closeImportDialog:
dialogbox.destroy()
else:
dialogbox.destroy()
- def _sourceIsUsed(self, asset):
+ def _source_is_used(self, asset):
"""Checks whether the specified asset is present in the timeline."""
layers = self._project.ges_timeline.get_layers()
for layer in layers:
@@ -1160,15 +1160,15 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
return True
return False
- def _selectUnusedSources(self):
+ def _select_unused_sources(self):
"""Selects the assets not used by any clip in the project's timeline."""
unused_sources_uris = []
for asset in self._project.list_assets(GES.UriClip):
- if not self._sourceIsUsed(asset):
+ if not self._source_is_used(asset):
unused_sources_uris.append(asset.get_id())
- self._selectSources(unused_sources_uris)
+ self._select_sources(unused_sources_uris)
- def _selectSources(self, sources_uris):
+ def _select_sources(self, sources_uris):
# Hack around the fact that making selections (in a treeview/iconview)
# deselects what was previously selected
if self.clip_view == SHOW_TREEVIEW:
@@ -1185,7 +1185,7 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
elif self.clip_view == SHOW_ICONVIEW:
self.iconview.unselect_path(row.path)
- def _unselectAll(self):
+ def _unselect_all(self):
if self.clip_view == SHOW_TREEVIEW:
self.treeview.get_selection().unselect_all()
elif self.clip_view == SHOW_ICONVIEW:
@@ -1193,17 +1193,17 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
# UI callbacks
- def __projectSettingsSetInfobarCb(self, infobar, response_id):
+ def __project_settings_set_infobar_cb(self, infobar, response_id):
if response_id == Gtk.ResponseType.OK:
- self.app.gui.editor.showProjectSettingsDialog()
+ self.app.gui.editor.show_project_settings_dialog()
infobar.hide()
- def _clipPropertiesCb(self, unused_widget):
+ def _clip_properties_cb(self, unused_widget):
"""Shows the clip properties in a dialog.
Allows selecting and applying them as the new project settings.
"""
- paths = self.getSelectedPaths()
+ paths = self.get_selected_paths()
if not paths:
self.debug("No item selected")
return
@@ -1214,13 +1214,13 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
dialog.dialog.set_transient_for(self.app.gui)
dialog.run()
- def __warningInfobarCb(self, infobar, response_id):
+ def __warning_infobar_cb(self, infobar, response_id):
if response_id == Gtk.ResponseType.OK:
self.__show_errors()
- self._resetErrorList()
+ self._reset_error_list()
infobar.hide()
- def _resetErrorList(self):
+ def _reset_error_list(self):
self._errors = []
self._import_warning_infobar.hide()
@@ -1233,19 +1233,19 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
"The following files can not be used with Pitivi.",
len(self._errors))
error_dialogbox = FileListErrorDialog(title, headline)
- error_dialogbox.connect("close", self._errorDialogBoxCloseCb)
- error_dialogbox.connect("response", self._errorDialogBoxResponseCb)
+ error_dialogbox.connect("close", self._error_dialog_box_close_cb)
+ error_dialogbox.connect("response", self._error_dialog_box_response_cb)
for uri, reason, extra in self._errors:
- error_dialogbox.addFailedFile(uri, reason, extra)
+ error_dialogbox.add_failed_file(uri, reason, extra)
error_dialogbox.window.set_transient_for(self.app.gui)
error_dialogbox.window.show()
- def _toggleViewTypeCb(self, widget):
+ def _toggle_view_type_cb(self, widget):
if widget.get_active():
- self._setClipView(SHOW_TREEVIEW)
+ self._set_clip_view(SHOW_TREEVIEW)
else:
- self._setClipView(SHOW_ICONVIEW)
+ self._set_clip_view(SHOW_ICONVIEW)
def __get_path_under_mouse(self, view, event):
"""Gets the path of the item under the mouse cursor.
@@ -1264,7 +1264,7 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
else:
raise RuntimeError("Unknown view type: %s" % type(view))
- def _rowUnderMouseSelected(self, view, event):
+ def _row_under_mouse_selected(self, view, event):
path = self.__get_path_under_mouse(view, event)
if not path:
return False
@@ -1276,15 +1276,15 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
else:
raise RuntimeError("Unknown view type: %s" % type(view))
- def _viewGetFirstSelected(self):
- paths = self.getSelectedPaths()
+ def _view_get_first_selected(self):
+ paths = self.get_selected_paths()
return paths[0]
- def _viewHasSelection(self):
- paths = self.getSelectedPaths()
+ def _view_has_selection(self):
+ paths = self.get_selected_paths()
return bool(len(paths))
- def _viewGetPathAtPos(self, event):
+ def _view_get_path_at_pos(self, event):
if self.clip_view == SHOW_TREEVIEW:
pathinfo = self.treeview.get_path_at_pos(
int(event.x), int(event.y))
@@ -1293,58 +1293,58 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
return self.iconview.get_path_at_pos(int(event.x), int(event.y))
raise RuntimeError("Unknown view: %s" % self.clip_view)
- def _viewSelectPath(self, path):
+ def _view_select_path(self, path):
if self.clip_view == SHOW_TREEVIEW:
selection = self.treeview.get_selection()
selection.select_path(path)
elif self.clip_view == SHOW_ICONVIEW:
self.iconview.select_path(path)
- def _viewUnselectAll(self):
+ def _view_unselect_all(self):
if self.clip_view == SHOW_TREEVIEW:
selection = self.treeview.get_selection()
selection.unselect_all()
elif self.clip_view == SHOW_ICONVIEW:
self.iconview.unselect_all()
- def __stopUsingProxyCb(self, unused_action, unused_parameter):
+ def __stop_using_proxy_cb(self, unused_action, unused_parameter):
prefer_original = self.app.settings.proxying_strategy == ProxyingStrategy.NOTHING
- self._project.disable_proxies_for_assets(self.getSelectedAssets(),
+ self._project.disable_proxies_for_assets(self.get_selected_assets(),
hq_proxy=not prefer_original)
- def __useProxiesCb(self, unused_action, unused_parameter):
- self._project.use_proxies_for_assets(self.getSelectedAssets())
+ def __use_proxies_cb(self, unused_action, unused_parameter):
+ self._project.use_proxies_for_assets(self.get_selected_assets())
def __use_scaled_proxies_cb(self, unused_action, unused_parameter):
- self._project.use_proxies_for_assets(self.getSelectedAssets(),
+ self._project.use_proxies_for_assets(self.get_selected_assets(),
scaled=True)
- def __deleteProxiesCb(self, unused_action, unused_parameter):
+ def __delete_proxies_cb(self, unused_action, unused_parameter):
prefer_original = self.app.settings.proxying_strategy == ProxyingStrategy.NOTHING
- self._project.disable_proxies_for_assets(self.getSelectedAssets(),
+ self._project.disable_proxies_for_assets(self.get_selected_assets(),
delete_proxy_file=True,
hq_proxy=not prefer_original)
def __open_containing_folder_cb(self, unused_action, unused_parameter):
- assets = self.getSelectedAssets()
+ assets = self.get_selected_assets()
if len(assets) != 1:
return
parent_path = os.path.dirname(path_from_uri(assets[0].get_id()))
Gio.AppInfo.launch_default_for_uri(Gst.filename_to_uri(parent_path), None)
def __edit_nested_clip_cb(self, unused_action, unused_parameter):
- assets = self.getSelectedAssets()
+ assets = self.get_selected_assets()
if len(assets) != 1:
return
path = os.path.abspath(path_from_uri(assets[0].get_id()))
subprocess.Popen([sys.argv[0], path])
- def __createMenuModel(self):
+ def __create_menu_model(self):
if self.app.proxy_manager.proxyingUnsupported:
return None, None
- assets = self.getSelectedAssets()
+ assets = self.get_selected_assets()
if not assets:
return None, None
@@ -1382,7 +1382,7 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
if hq_proxies:
action = Gio.SimpleAction.new("unproxy-asset", None)
- action.connect("activate", self.__stopUsingProxyCb)
+ action.connect("activate", self.__stop_using_proxy_cb)
action_group.insert(action)
text = ngettext("Do not use Optimised Proxy for selected asset",
"Do not use Optimised Proxies for selected assets",
@@ -1392,7 +1392,7 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
action.get_name().replace(" ", "."))
action = Gio.SimpleAction.new("delete-proxies", None)
- action.connect("activate", self.__deleteProxiesCb)
+ action.connect("activate", self.__delete_proxies_cb)
action_group.insert(action)
text = ngettext("Delete corresponding proxy file",
@@ -1404,7 +1404,7 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
if in_progress:
action = Gio.SimpleAction.new("unproxy-asset", None)
- action.connect("activate", self.__stopUsingProxyCb)
+ action.connect("activate", self.__stop_using_proxy_cb)
action_group.insert(action)
text = ngettext("Do not use Proxy for selected asset",
"Do not use Proxies for selected assets",
@@ -1414,7 +1414,7 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
action.get_name().replace(" ", "."))
action = Gio.SimpleAction.new("delete-proxies", None)
- action.connect("activate", self.__deleteProxiesCb)
+ action.connect("activate", self.__delete_proxies_cb)
action_group.insert(action)
text = ngettext("Delete corresponding proxy file",
@@ -1426,7 +1426,7 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
if scaled_proxies:
action = Gio.SimpleAction.new("unproxy-asset", None)
- action.connect("activate", self.__stopUsingProxyCb)
+ action.connect("activate", self.__stop_using_proxy_cb)
action_group.insert(action)
text = ngettext("Do not use Scaled Proxy for selected asset",
"Do not use Scaled Proxies for selected assets",
@@ -1436,7 +1436,7 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
action.get_name().replace(" ", "."))
action = Gio.SimpleAction.new("delete-proxies", None)
- action.connect("activate", self.__deleteProxiesCb)
+ action.connect("activate", self.__delete_proxies_cb)
action_group.insert(action)
text = ngettext("Delete corresponding proxy file",
@@ -1448,7 +1448,7 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
if len(proxies) != len(assets) and len(in_progress) != len(assets):
action = Gio.SimpleAction.new("use-proxies", None)
- action.connect("activate", self.__useProxiesCb)
+ action.connect("activate", self.__use_proxies_cb)
action_group.insert(action)
text = ngettext("Use Optimised Proxy for selected asset",
"Use Optimised Proxies for selected assets", len(assets))
@@ -1467,12 +1467,12 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
return menu_model, action_group
- def __maybeShowPopoverMenu(self, view, event):
+ def __maybe_show_popover_menu(self, view, event):
res, button = event.get_button()
if not res or button != 3:
return False
- if not self._rowUnderMouseSelected(view, event):
+ if not self._row_under_mouse_selected(view, event):
path = self.__get_path_under_mouse(view, event)
if path:
if isinstance(view, Gtk.IconView):
@@ -1483,7 +1483,7 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
selection.unselect_all()
selection.select_path(path)
- model, action_group = self.__createMenuModel()
+ model, action_group = self.__create_menu_model()
if not model or not model.get_n_items():
return True
@@ -1506,8 +1506,8 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
return True
- def _treeViewButtonPressEventCb(self, treeview, event):
- self._updateDraggedPaths(treeview, event)
+ def _tree_view_button_press_event_cb(self, treeview, event):
+ self._update_dragged_paths(treeview, event)
Gtk.TreeView.do_button_press_event(treeview, event)
@@ -1518,32 +1518,32 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
return True
- def _updateDraggedPaths(self, view, event):
+ def _update_dragged_paths(self, view, event):
if event.type == getattr(Gdk.EventType, '2BUTTON_PRESS'):
# It is possible to double-click outside of clips:
- if self.getSelectedPaths():
+ if self.get_selected_paths():
# Here we used to emit "play", but
# this is now handled by _itemOrRowActivatedCb instead.
pass
chain_up = False
elif not event.get_state() & (Gdk.ModifierType.CONTROL_MASK | Gdk.ModifierType.SHIFT_MASK):
- chain_up = not self._rowUnderMouseSelected(view, event)
+ chain_up = not self._row_under_mouse_selected(view, event)
else:
chain_up = True
if not chain_up:
- self._dragged_paths = self.getSelectedPaths()
+ self._dragged_paths = self.get_selected_paths()
else:
self._dragged_paths = None
- def _treeViewButtonReleaseEventCb(self, treeview, event):
+ def _tree_view_button_release_event_cb(self, treeview, event):
self._dragged_paths = None
selection = self.treeview.get_selection()
state = event.get_state() & (
Gdk.ModifierType.CONTROL_MASK | Gdk.ModifierType.SHIFT_MASK)
path = self.treeview.get_path_at_pos(event.x, event.y)
- if self.__maybeShowPopoverMenu(treeview, event):
+ if self.__maybe_show_popover_menu(treeview, event):
self.debug("Returning after showing popup menu")
return
@@ -1553,10 +1553,10 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
selection.select_path(path[0])
def _iconview_selection_changed_cb(self, unused):
- self._updateActions()
+ self._update_actions()
- def _updateActions(self):
- selected_count = len(self.getSelectedPaths())
+ def _update_actions(self):
+ selected_count = len(self.get_selected_paths())
self.remove_assets_action.set_enabled(selected_count)
self.insert_at_end_action.set_enabled(selected_count)
# Some actions can only be done on a single item at a time:
@@ -1573,7 +1573,7 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
self.emit('play', asset)
def _iconview_button_press_event_cb(self, iconview, event):
- self._updateDraggedPaths(iconview, event)
+ self._update_dragged_paths(iconview, event)
Gtk.IconView.do_button_press_event(iconview, event)
@@ -1593,7 +1593,7 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
shift_mask = event.get_state() & Gdk.ModifierType.SHIFT_MASK
modifier_active = control_mask or shift_mask
- if self.__maybeShowPopoverMenu(iconview, event):
+ if self.__maybe_show_popover_menu(iconview, event):
self.debug("Returning after showing popup menu")
return
@@ -1606,33 +1606,33 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
iconview.unselect_all()
iconview.select_path(current_cursor_pos)
- def __disconnectFromProject(self):
- self._project.disconnect_by_func(self._assetAddedCb)
- self._project.disconnect_by_func(self._assetLoadingProgressCb)
- self._project.disconnect_by_func(self._assetRemovedCb)
- self._project.disconnect_by_func(self._proxyingErrorCb)
- self._project.disconnect_by_func(self._errorCreatingAssetCb)
- self._project.disconnect_by_func(self.__projectSettingsSetFromImportedAssetCb)
+ def __disconnect_from_project(self):
+ self._project.disconnect_by_func(self._asset_added_cb)
+ self._project.disconnect_by_func(self._asset_loading_progress_cb)
+ self._project.disconnect_by_func(self._asset_removed_cb)
+ self._project.disconnect_by_func(self._proxying_error_cb)
+ self._project.disconnect_by_func(self._error_creating_asset_cb)
+ self._project.disconnect_by_func(self.__project_settings_set_from_imported_asset_cb)
def _new_project_loading_cb(self, project_manager, project):
assert not self._project
self._project = project
- self._resetErrorList()
+ self._reset_error_list()
self.storemodel.clear()
self._welcome_infobar.show_all()
- self._connectToProject(project)
+ self._connect_to_project(project)
def _new_project_loaded_cb(self, project_manager, project):
# Make sure that the sources added to the project are added
- self._flushPendingAssets()
+ self._flush_pending_assets()
def _new_project_failed_cb(self, project_manager, uri, reason):
self.storemodel.clear()
self._project = None
def _project_closed_cb(self, project_manager, project):
- self.__disconnectFromProject()
+ self.__disconnect_from_project()
self._project_settings_infobar.hide()
self.storemodel.clear()
self._project = None
@@ -1647,13 +1647,13 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
# At the end of the import operation, these will be selected.
self._last_imported_uris = set(uris)
- assets = self._project.assetsForUris(uris)
+ assets = self._project.assets_for_uris(uris)
if assets:
# All the files have already been added.
# This is the only chance we have to select them.
- self._selectLastImportedUris()
+ self._select_last_imported_uris()
else:
- self._project.addUris(uris)
+ self._project.add_uris(uris)
def _drag_data_received_cb(self, widget, context, x, y,
selection, targettype, time_):
@@ -1663,18 +1663,18 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
uris = selection.get_uris()
# Scan in the background what was dragged and
# import whatever can be imported.
- self.app.threads.addThread(PathWalker, uris, self.__paths_walked_cb)
+ self.app.threads.add_thread(PathWalker, uris, self.__paths_walked_cb)
# Used with TreeView and IconView
def _dnd_drag_data_get_cb(self, view, context, data, info, timestamp):
- paths = self.getSelectedPaths()
+ paths = self.get_selected_paths()
uris = [self.model_filter[path][COL_URI] for path in paths]
data.set_uris(uris)
def _dnd_drag_begin_cb(self, view, context):
self.info("Drag operation begun")
self.dragged = True
- paths = self.getSelectedPaths()
+ paths = self.get_selected_paths()
if not paths:
context.drag_abort(int(time.time()))
@@ -1700,42 +1700,42 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
self.info("Drag operation ended")
self.dragged = False
- def getSelectedPaths(self):
+ def get_selected_paths(self):
"""Gets which treeview or iconview items are selected.
Returns:
List[Gtk.TreePath]: The paths identifying the items.
"""
if self.clip_view == SHOW_TREEVIEW:
- return self._getSelectedPathsTreeView()
+ return self._get_selected_paths_tree_view()
elif self.clip_view == SHOW_ICONVIEW:
- return self._getSelectedPathsIconView()
+ return self._get_selected_paths_icon_view()
raise RuntimeError("Unknown view: %s" % self.clip_view)
- def _getSelectedPathsTreeView(self):
+ def _get_selected_paths_tree_view(self):
unused_model, rows = self.treeview.get_selection().get_selected_rows()
return rows
- def _getSelectedPathsIconView(self):
+ def _get_selected_paths_icon_view(self):
paths = self.iconview.get_selected_items()
paths.reverse()
return paths
- def getSelectedItems(self):
+ def get_selected_items(self):
"""Gets the URIs of the selected items."""
if self._dragged_paths:
return [self.model_filter[path][COL_URI]
for path in self._dragged_paths]
return [self.model_filter[path][COL_URI]
- for path in self.getSelectedPaths()]
+ for path in self.get_selected_paths()]
- def getSelectedAssets(self):
+ def get_selected_assets(self):
"""Gets the selected assets."""
if self._dragged_paths:
return [self.model_filter[path][COL_ASSET]
for path in self._dragged_paths]
return [self.model_filter[path][COL_ASSET]
- for path in self.getSelectedPaths()]
+ for path in self.get_selected_paths()]
- def activateCompactMode(self):
+ def activate_compact_mode(self):
self._import_button.set_is_important(False)
diff --git a/pitivi/pluginmanager.py b/pitivi/pluginmanager.py
index 481d8775..caab3ac4 100644
--- a/pitivi/pluginmanager.py
+++ b/pitivi/pluginmanager.py
@@ -29,10 +29,10 @@ from pitivi.settings import GlobalSettings
from pitivi.utils.loggable import Loggable
-GlobalSettings.addConfigSection("plugins")
-GlobalSettings.addConfigOption("ActivePlugins",
- section="plugins", key="active-plugins",
- default=[])
+GlobalSettings.add_config_section("plugins")
+GlobalSettings.add_config_option("ActivePlugins",
+ section="plugins", key="active-plugins",
+ default=[])
class API(GObject.GObject):
diff --git a/pitivi/preset.py b/pitivi/preset.py
index 9a1e7cd1..8947abbd 100644
--- a/pitivi/preset.py
+++ b/pitivi/preset.py
@@ -78,11 +78,11 @@ class PresetManager(GObject.Object, Loggable):
self.ordered.set_sort_func(0, sortme)
self.ordered.set_sort_column_id(0, Gtk.SortType.ASCENDING)
self.cur_preset = None
- # Whether to ignore the updateValue calls.
+ # Whether to ignore the update_value calls.
self.ignore_update_requests = False
self.system = system
- def setupUi(self, combo, button):
+ def setup_ui(self, combo, button):
# pylint: disable=attribute-defined-outside-init
self.combo = combo
self.button = button
@@ -90,7 +90,7 @@ class PresetManager(GObject.Object, Loggable):
combo.set_model(self.ordered)
combo.set_id_column(0)
combo.set_entry_text_column(0)
- combo.connect("changed", self._presetChangedCb)
+ combo.connect("changed", self._preset_changed_cb)
entry = combo.get_child()
alter_style_class("GtkEntry.unsaved", entry, "font-style:italic;")
@@ -99,19 +99,19 @@ class PresetManager(GObject.Object, Loggable):
menu_model = Gio.Menu()
action = Gio.SimpleAction.new("new", None)
- action.connect("activate", self._addPresetCb)
+ action.connect("activate", self._add_preset_cb)
action_group.add_action(action)
menu_model.append(_("New"), "preset.%s" % action.get_name())
self.action_new = action
action = Gio.SimpleAction.new("remove", None)
- action.connect("activate", self._removePresetCb)
+ action.connect("activate", self._remove_preset_cb)
action_group.add_action(action)
menu_model.append(_("Remove"), "preset.%s" % action.get_name())
self.action_remove = action
action = Gio.SimpleAction.new("save", None)
- action.connect("activate", self._savePresetCb)
+ action.connect("activate", self._save_preset_cb)
action_group.add_action(action)
menu_model.append(_("Save"), "preset.%s" % action.get_name())
self.action_save = action
@@ -120,63 +120,63 @@ class PresetManager(GObject.Object, Loggable):
menu.insert_action_group("preset", action_group)
button.set_popup(menu)
- def _presetChangedCb(self, combo):
+ def _preset_changed_cb(self, combo):
"""Handles the selection of a preset."""
# Check whether the user selected a preset or editing the preset name.
self.select_preset(combo)
- self.updateMenuActions()
+ self.update_menu_actions()
def select_preset(self, combo):
preset_name = combo.get_active_id()
if preset_name:
# The user selected a preset.
- self.restorePreset(preset_name)
+ self.restore_preset(preset_name)
self.emit("preset-loaded")
- def _addPresetCb(self, unused_action, unused_param):
- preset_name = self.getNewPresetName()
- self.createPreset(preset_name)
+ def _add_preset_cb(self, unused_action, unused_param):
+ preset_name = self.get_new_preset_name()
+ self.create_preset(preset_name)
self.combo.set_active_id(preset_name)
- self.updateMenuActions()
+ self.update_menu_actions()
- def _removePresetCb(self, unused_action, unused_param):
- self.removeCurrentPreset()
+ def _remove_preset_cb(self, unused_action, unused_param):
+ self.remove_current_preset()
entry = self.combo.get_child()
entry.set_text("")
- self.updateMenuActions()
+ self.update_menu_actions()
- def _savePresetCb(self, unused_action, unused_param):
+ def _save_preset_cb(self, unused_action, unused_param):
entry = self.combo.get_child()
preset_name = entry.get_text()
- self.saveCurrentPreset(preset_name)
+ self.save_current_preset(preset_name)
# Useful when a new preset has just been created.
self.combo.set_active_id(preset_name)
- self.updateMenuActions()
+ self.update_menu_actions()
- def updateMenuActions(self):
+ def update_menu_actions(self):
entry = self.combo.get_child()
preset_name = entry.get_text()
- can_save = self.isSaveButtonSensitive(preset_name)
+ can_save = self.is_save_button_sensitive(preset_name)
self.action_save.set_enabled(can_save)
if can_save:
entry.get_style_context().add_class("unsaved")
else:
entry.get_style_context().remove_class("unsaved")
- can_remove = self.isRemoveButtonSensitive()
+ can_remove = self.is_remove_button_sensitive()
self.action_remove.set_enabled(can_remove)
- can_create_new = self.isNewButtonSensitive()
+ can_create_new = self.is_new_button_sensitive()
self.action_new.set_enabled(can_create_new)
- def loadAll(self):
- self._loadFromDir(self.default_path, extra={"readonly": True})
+ def load_all(self):
+ self._load_from_dir(self.default_path, extra={"readonly": True})
if os.path.isfile(self.user_path):
# We used to save presets as a single file instead of a directory
os.rename(self.user_path, "%s.old" % self.user_path)
- self._loadFromDir(self.user_path)
+ self._load_from_dir(self.user_path)
- def _loadFromDir(self, presets_dir, extra=None):
+ def _load_from_dir(self, presets_dir, extra=None):
try:
files = os.listdir(presets_dir)
except FileNotFoundError:
@@ -189,10 +189,10 @@ class PresetManager(GObject.Object, Loggable):
parser = json.loads(section.read())
name = parser["name"]
if parser.get("removed"):
- self._forgetPreset(name)
+ self._forget_preset(name)
continue
try:
- preset = self._deserializePreset(parser)
+ preset = self._deserialize_preset(parser)
except DeserializeException as e:
self.debug("Failed to load preset %s: %s", filepath, e)
continue
@@ -200,42 +200,42 @@ class PresetManager(GObject.Object, Loggable):
if extra:
for key, value in extra.items():
preset[key] = value
- self._addPreset(name, preset)
+ self._add_preset(name, preset)
- def saveAll(self):
+ def save_all(self):
"""Writes changes to disk for all presets."""
for preset_name, unused_values in self.ordered:
- self._savePreset(preset_name)
+ self._save_preset(preset_name)
- def _savePreset(self, preset_name):
+ def _save_preset(self, preset_name):
if not os.path.exists(self.user_path):
os.makedirs(self.user_path)
try:
file_path = self.presets[preset_name]["filepath"]
except KeyError:
- file_path = self._buildFilePath(preset_name)
+ file_path = self._build_file_path(preset_name)
self.presets[preset_name]["filepath"] = file_path
with open(file_path, "w") as fout:
values = self.presets[preset_name]
- raw = self._serializePreset(values)
+ raw = self._serialize_preset(values)
raw["name"] = preset_name
serialized = json.dumps(raw, indent=4)
fout.write(serialized)
- def _buildFilePath(self, preset_name):
- file_name = self.system.getUniqueFilename(preset_name + ".json")
+ def _build_file_path(self, preset_name):
+ file_name = self.system.get_unique_filename(preset_name + ".json")
return os.path.join(self.user_path, file_name)
- def getNewPresetName(self):
+ def get_new_preset_name(self):
"""Gets a unique name for a new preset."""
name = _("New preset")
i = 1
- while self.hasPreset(name):
+ while self.has_preset(name):
name = _("New preset %d") % i
i += 1
return name
- def createPreset(self, name, values=None):
+ def create_preset(self, name, values=None):
"""Creates a preset, overwriting the preset with the same name if any.
Args:
@@ -244,24 +244,24 @@ class PresetManager(GObject.Object, Loggable):
"""
if not values:
values = {}
- self._updatePresetValues(values)
- self._addPreset(name, values)
+ self._update_preset_values(values)
+ self._add_preset(name, values)
self.cur_preset = name
- def _addPreset(self, name, values):
- self._forgetPreset(name)
+ def _add_preset(self, name, values):
+ self._forget_preset(name)
self.presets[name] = values
# Note: This generates a "row-inserted" signal in the model.
self.ordered.append((name, values))
- def _renameCurrentPreset(self, new_name):
+ def _rename_current_preset(self, new_name):
"""Changes the name of the current preset."""
old_name = self.cur_preset
if old_name == new_name:
# Nothing to do.
return
# If there is one already with this name, make way for this one.
- self._forgetPreset(new_name)
+ self._forget_preset(new_name)
for row in self.ordered:
if row[0] == old_name:
row[0] = new_name
@@ -270,37 +270,37 @@ class PresetManager(GObject.Object, Loggable):
if "filepath" in self.presets[old_name]:
# If the previous preset had already been saved,
# delete the file and pop it from the list
- self.removeCurrentPreset()
+ self.remove_current_preset()
else:
# We're renaming an unsaved preset, so just pop it from the list
self.presets.pop(old_name)
- new_filepath = self._createUserPresetPath(new_name)
+ new_filepath = self._create_user_preset_path(new_name)
self.presets[new_name]["filepath"] = new_filepath
self.cur_preset = new_name
- def _createUserPresetPath(self, preset_name):
+ def _create_user_preset_path(self, preset_name):
return os.path.join(self.user_path, preset_name + ".json")
- def hasPreset(self, name):
+ def has_preset(self, name):
name = name.lower()
- return any(name == preset.lower() for preset in self.getPresetNames())
+ return any(name == preset.lower() for preset in self.get_preset_names())
- def getPresetNames(self):
+ def get_preset_names(self):
return (row[0] for row in self.ordered)
- def updateValue(self, name, value):
+ def update_value(self, name, value):
"""Updates a value in the current preset, if any."""
if self.ignore_update_requests:
- # This is caused by restorePreset, nothing to do.
+ # This is caused by restore_preset, nothing to do.
return
if self.cur_preset:
self.presets[self.cur_preset][name] = value
- def bindWidget(self, propname, setter_func, getter_func):
+ def bind_widget(self, propname, setter_func, getter_func):
"""Links the specified functions to the specified preset property."""
self.widget_map[propname] = (setter_func, getter_func)
- def restorePreset(self, preset):
+ def restore_preset(self, preset):
"""Selects a preset and copies its values to the widgets.
Args:
@@ -320,22 +320,22 @@ class PresetManager(GObject.Object, Loggable):
finally:
self.ignore_update_requests = False
- def saveCurrentPreset(self, new_name=None):
+ def save_current_preset(self, new_name=None):
"""Updates the current preset values from the widgets and saves it."""
if not self.cur_preset:
- self.createPreset(new_name)
+ self.create_preset(new_name)
if new_name:
- self._renameCurrentPreset(new_name)
+ self._rename_current_preset(new_name)
values = self.presets[self.cur_preset]
- self._updatePresetValues(values)
- self._savePreset(self.cur_preset)
+ self._update_preset_values(values)
+ self._save_preset(self.cur_preset)
- def _updatePresetValues(self, values):
+ def _update_preset_values(self, values):
"""Copies the values from the widgets to the specified values dict."""
for field, (unused_setter, getter) in self.widget_map.items():
values[field] = getter()
- def _isCurrentPresetChanged(self, name):
+ def _is_current_preset_changed(self, name):
"""Returns whether the widgets values differ from the preset values."""
if not self.cur_preset:
# There is no preset selected, nothing to do.
@@ -347,20 +347,20 @@ class PresetManager(GObject.Object, Loggable):
return any((values[field] != getter()
for field, (setter, getter) in self.widget_map.items()))
- def removeCurrentPreset(self):
+ def remove_current_preset(self):
name = self.cur_preset
preset = self.presets[name]
filepath = preset.get("filepath")
if filepath:
if "readonly" in preset:
- self._markRemoved(name)
+ self._mark_removed(name)
else:
os.remove(filepath)
self.cur_preset = None
- self._forgetPreset(name)
+ self._forget_preset(name)
- def _forgetPreset(self, name):
+ def _forget_preset(self, name):
try:
self.presets.pop(name)
except KeyError:
@@ -371,25 +371,25 @@ class PresetManager(GObject.Object, Loggable):
del self.ordered[i]
break
- def _markRemoved(self, name):
+ def _mark_removed(self, name):
data = json.dumps({"name": name, "removed": True}, indent=4)
- filepath = self._createUserPresetPath(name)
+ filepath = self._create_user_preset_path(name)
with open(filepath, "w") as fout:
fout.write(data)
- def prependPreset(self, name, values):
+ def prepend_preset(self, name, values):
self.presets[name] = values
# Note: This generates a "row-inserted" signal in the model.
self.ordered.prepend((name, values))
- def isSaveButtonSensitive(self, name):
+ def is_save_button_sensitive(self, name):
"""Checks whether the Save button should be enabled.
Args:
name (str): The new preset name.
"""
if self.cur_preset:
- return self._isCurrentPresetChanged(name)
+ return self._is_current_preset_changed(name)
if name:
# Can be saved as new preset.
@@ -397,21 +397,21 @@ class PresetManager(GObject.Object, Loggable):
return False
- def isRemoveButtonSensitive(self):
+ def is_remove_button_sensitive(self):
"""Checks whether the Remove button should be enabled."""
if not self.cur_preset:
return False
return True
- def isNewButtonSensitive(self):
+ def is_new_button_sensitive(self):
"""Checks whether the New button should be enabled."""
return bool(self.cur_preset)
- def _projectToPreset(self, project):
+ def _project_to_preset(self, project):
raise NotImplementedError()
- def matchingPreset(self, project):
- query = self._projectToPreset(project)
+ def matching_preset(self, project):
+ query = self._project_to_preset(project)
for name, preset in self.presets.items():
matches = True
for key, value in query.items():
@@ -430,7 +430,7 @@ class VideoPresetManager(PresetManager):
user_path = os.path.join(xdg_data_home(), 'video_presets')
PresetManager.__init__(self, default_path, user_path, system)
- def _deserializePreset(self, parser):
+ def _deserialize_preset(self, parser):
width = parser["width"]
height = parser["height"]
@@ -444,7 +444,7 @@ class VideoPresetManager(PresetManager):
"frame-rate": framerate,
}
- def _serializePreset(self, preset):
+ def _serialize_preset(self, preset):
return {
"width": int(preset["width"]),
"height": int(preset["height"]),
@@ -452,7 +452,7 @@ class VideoPresetManager(PresetManager):
"framerate-denom": preset["frame-rate"].denom,
}
- def _projectToPreset(self, project):
+ def _project_to_preset(self, project):
return {
"width": project.videowidth,
"height": project.videoheight,
@@ -466,7 +466,7 @@ class AudioPresetManager(PresetManager):
user_path = os.path.join(xdg_data_home(), 'audio_presets')
PresetManager.__init__(self, default_path, user_path, system)
- def _deserializePreset(self, parser):
+ def _deserialize_preset(self, parser):
channels = parser["channels"]
sample_rate = parser["sample-rate"]
@@ -475,13 +475,13 @@ class AudioPresetManager(PresetManager):
"sample-rate": sample_rate,
}
- def _serializePreset(self, preset):
+ def _serialize_preset(self, preset):
return {
"channels": preset["channels"],
"sample-rate": int(preset["sample-rate"]),
}
- def _projectToPreset(self, project):
+ def _project_to_preset(self, project):
return {
"channels": project.audiochannels,
"sample-rate": project.audiorate}
@@ -522,9 +522,9 @@ class EncodingTargetManager(PresetManager):
continue
self.presets[name] = profile
- self._addPreset(name, profile)
+ self._add_preset(name, profile)
- def loadAll(self):
+ def load_all(self):
"""Loads profiles from GstEncodingTarget and add them to self.combo.
Override from PresetManager
@@ -533,21 +533,21 @@ class EncodingTargetManager(PresetManager):
if target.get_category() != GstPbutils.ENCODING_CATEGORY_FILE_EXTENSION:
self._add_target(target)
- def createPreset(self, name, values=None):
- self.saveCurrentPreset(name, validate_name=False)
+ def create_preset(self, name, values=None):
+ self.save_current_preset(name, validate_name=False)
- def getNewPresetName(self):
+ def get_new_preset_name(self):
"""Gets a unique name for a new preset."""
# Translators: This must contain exclusively low case alphanum and '-'
name = _("new-profile")
i = 1
- while self.hasPreset(name):
+ while self.has_preset(name):
# Translators: This must contain exclusively low case alphanum and '-'
name = _("new-profile-%d") % i
i += 1
return name
- def saveCurrentPreset(self, new_name, validate_name=True):
+ def save_current_preset(self, new_name, validate_name=True):
"""Saves currently selected profile on disk.
Override from PresetManager
@@ -591,13 +591,13 @@ class EncodingTargetManager(PresetManager):
with open(self._removed_file_list, 'w') as removed:
json.dump(self._removed_profiles, removed)
- def removeCurrentPreset(self):
+ def remove_current_preset(self):
self._removed_profiles.append(self.cur_preset)
self._save_removed_profiles()
- self._forgetPreset(self.cur_preset)
+ self._forget_preset(self.cur_preset)
self.cur_preset = None
- def restorePreset(self, values):
+ def restore_preset(self, values):
"""Raises NotImplemented as it does not make sense for that class.
Override from PresetManager
diff --git a/pitivi/project.py b/pitivi/project.py
index 2cb9d77b..723c7ee8 100644
--- a/pitivi/project.py
+++ b/pitivi/project.py
@@ -135,8 +135,8 @@ class ProjectManager(GObject.Object, Loggable):
self.__start_loading_time = 0
self.time_loaded = 0
- def _tryUsingBackupFile(self, uri):
- backup_path = self._makeBackupURI(path_from_uri(uri))
+ def _try_using_backup_file(self, uri):
+ backup_path = self._make_backup_uri(path_from_uri(uri))
use_backup = False
try:
path = path_from_uri(uri)
@@ -149,10 +149,10 @@ class ProjectManager(GObject.Object, Loggable):
unicode_error_dialog()
else:
if time_diff > 0:
- use_backup = self._restoreFromBackupDialog(time_diff)
+ use_backup = self._restore_from_backup_dialog(time_diff)
if use_backup:
- uri = self._makeBackupURI(uri)
+ uri = self._make_backup_uri(uri)
self.debug('Loading project from backup: %s', uri)
# For backup files and legacy formats, force the user to use "Save as"
@@ -164,7 +164,7 @@ class ProjectManager(GObject.Object, Loggable):
return uri
- def _isValidateScenario(self, uri):
+ def _is_validate_scenario(self, uri):
if uri.endswith(".scenario") and has_validate is True:
# Let's just normally fail if we do not have Validate
# installed on the system
@@ -172,7 +172,7 @@ class ProjectManager(GObject.Object, Loggable):
return False
- def _projectPipelineDiedCb(self, unused_pipeline):
+ def _project_pipeline_died_cb(self, unused_pipeline):
"""Shows an dialog telling the user that everything went kaboom."""
# GTK does not allow an empty string as the dialog title, so we use the
# same translatable one as render.py's pipeline error message dialog:
@@ -232,9 +232,9 @@ class ProjectManager(GObject.Object, Loggable):
dialog.destroy()
if response == 1:
- self.app.gui.editor.saveProjectAs()
+ self.app.gui.editor.save_project_as()
elif response == 2:
- self.app.gui.editor.saveProject()
+ self.app.gui.editor.save_project()
self.app.shutdown()
@@ -246,9 +246,9 @@ class ProjectManager(GObject.Object, Loggable):
"""
assert self.current_project is None
- is_validate_scenario = self._isValidateScenario(uri)
+ is_validate_scenario = self._is_validate_scenario(uri)
if not is_validate_scenario:
- uri = self._tryUsingBackupFile(uri)
+ uri = self._try_using_backup_file(uri)
scenario = None
else:
scenario = path_from_uri(uri)
@@ -259,10 +259,10 @@ class ProjectManager(GObject.Object, Loggable):
project = Project(self.app, uri=uri, scenario=scenario)
self.emit("new-project-loading", project)
- project.connect_after("missing-uri", self._missingURICb)
- project.connect("loaded", self._projectLoadedCb)
+ project.connect_after("missing-uri", self._missing_uri_cb)
+ project.connect("loaded", self._project_loaded_cb)
- if not project.createTimeline():
+ if not project.create_timeline():
self.emit("new-project-failed", uri,
_('This might be due to a bug or an unsupported project file format. '
'If you were trying to add a media file to your project, '
@@ -271,15 +271,15 @@ class ProjectManager(GObject.Object, Loggable):
self.current_project = project
self.emit("new-project-created", project)
- self.current_project.connect("project-changed", self._projectChangedCb)
- self.current_project.pipeline.connect("died", self._projectPipelineDiedCb)
+ self.current_project.connect("project-changed", self._project_changed_cb)
+ self.current_project.pipeline.connect("died", self._project_pipeline_died_cb)
if is_validate_scenario:
- self.current_project.setupValidateScenario()
+ self.current_project.setup_validate_scenario()
return project
- def _restoreFromBackupDialog(self, time_diff):
+ def _restore_from_backup_dialog(self, time_diff):
"""Asks if we need to load the autosaved project backup.
Args:
@@ -333,7 +333,7 @@ class ProjectManager(GObject.Object, Loggable):
dialog.destroy()
return response == Gtk.ResponseType.YES
- def saveProject(self, uri=None, formatter_type=None, backup=False):
+ def save_project(self, uri=None, formatter_type=None, backup=False):
"""Saves the current project.
Args:
@@ -358,7 +358,7 @@ class ProjectManager(GObject.Object, Loggable):
if backup:
if self.current_project is not None and self.current_project.uri is not None:
# Ignore whatever URI that is passed on to us. It's a trap.
- uri = self._makeBackupURI(self.current_project.uri)
+ uri = self._make_backup_uri(self.current_project.uri)
else:
# Do not try to save backup files for blank projects.
# It is possible that self.current_project.uri == None when the backup
@@ -382,7 +382,7 @@ class ProjectManager(GObject.Object, Loggable):
try:
# "overwrite" is always True: our GTK filechooser save dialogs are
# set to always ask the user on our behalf about overwriting, so
- # if saveProject is actually called, that means overwriting is OK.
+ # if save_project is actually called, that means overwriting is OK.
saved = self.current_project.save(
self.current_project.ges_timeline, uri,
formatter_type, overwrite=True)
@@ -393,7 +393,7 @@ class ProjectManager(GObject.Object, Loggable):
if saved:
if not backup:
# Do not emit the signal when autosaving a backup file
- self.current_project.setModificationState(False)
+ self.current_project.set_modification_state(False)
self.debug('Saved project: %s', uri)
# Update the project instance's uri,
# otherwise, subsequent saves will be to the old uri.
@@ -406,7 +406,7 @@ class ProjectManager(GObject.Object, Loggable):
return saved
- def exportProject(self, project, uri):
+ def export_project(self, project, uri):
"""Exports a project and all its media files to a *.tar archive."""
# Save the project to a temporary file.
project_name = project.name if project.name else _("project")
@@ -416,9 +416,9 @@ class ProjectManager(GObject.Object, Loggable):
directory = os.path.dirname(uri)
tmp_uri = os.path.join(directory, tmp_name)
- # saveProject updates the project URI... so we better back it up:
+ # save_project updates the project URI... so we better back it up:
_old_uri = self.current_project.uri
- self.saveProject(tmp_uri)
+ self.save_project(tmp_uri)
self.current_project.uri = _old_uri
# create tar file
@@ -430,8 +430,8 @@ class ProjectManager(GObject.Object, Loggable):
tar.add(path_from_uri(tmp_uri), os.path.join(top, tmp_name))
# get common path
- sources = project.listSources()
- if self._allSourcesInHomedir(sources):
+ sources = project.list_sources()
+ if self._all_sources_in_homedir(sources):
common = os.path.expanduser("~")
else:
common = "/"
@@ -466,7 +466,7 @@ class ProjectManager(GObject.Object, Loggable):
return everything_ok
- def _allSourcesInHomedir(self, sources):
+ def _all_sources_in_homedir(self, sources):
"""Checks if all sources are located in the user's home directory."""
homedir = os.path.expanduser("~")
@@ -476,7 +476,7 @@ class ProjectManager(GObject.Object, Loggable):
return True
- def closeRunningProject(self):
+ def close_running_project(self):
"""Closes the current project."""
if self.current_project is None:
self.warning(
@@ -496,9 +496,9 @@ class ProjectManager(GObject.Object, Loggable):
self.current_project = None
project.create_thumb()
self.emit("project-closed", project)
- disconnect_all_by_func(project, self._projectChangedCb)
- disconnect_all_by_func(project.pipeline, self._projectPipelineDiedCb)
- self._cleanBackup(project.uri)
+ disconnect_all_by_func(project, self._project_changed_cb)
+ disconnect_all_by_func(project.pipeline, self._project_pipeline_died_cb)
+ self._clean_backup(project.uri)
self.exitcode = project.release()
return True
@@ -520,35 +520,35 @@ class ProjectManager(GObject.Object, Loggable):
# setting default values for project metadata
project.author = pwd.getpwuid(os.getuid()).pw_gecos.split(",")[0]
- project.createTimeline()
- project._ensureTracks() # pylint: disable=protected-access
+ project.create_timeline()
+ project._ensure_tracks() # pylint: disable=protected-access
project.update_restriction_caps()
self.current_project = project
self.emit("new-project-created", project)
- project.connect("project-changed", self._projectChangedCb)
- project.pipeline.connect("died", self._projectPipelineDiedCb)
- project.setModificationState(False)
+ project.connect("project-changed", self._project_changed_cb)
+ project.pipeline.connect("died", self._project_pipeline_died_cb)
+ project.set_modification_state(False)
self.emit("new-project-loaded", self.current_project)
project.loaded = True
self.time_loaded = time.time()
return project
- def revertToSavedProject(self):
+ def revert_to_saved_project(self):
"""Discards all unsaved changes and reloads the current open project."""
- if self.current_project.uri is None or not self.current_project.hasUnsavedModifications():
+ if self.current_project.uri is None or not self.current_project.has_unsaved_modifications():
return True
if not self.emit("reverting-to-saved", self.current_project):
return False
uri = self.current_project.uri
- self.current_project.setModificationState(False)
- self.closeRunningProject()
+ self.current_project.set_modification_state(False)
+ self.close_running_project()
self.load_project(uri)
return True
- def _projectChangedCb(self, project):
+ def _project_changed_cb(self, project):
# _backup_lock is a timer, when a change in the project is done it is
# set to 10 seconds. If before those 10 secs pass another change occurs,
# 5 secs are added to the timeout callback instead of saving the backup
@@ -560,29 +560,29 @@ class ProjectManager(GObject.Object, Loggable):
if self._backup_lock == 0:
self._backup_lock = 10
GLib.timeout_add_seconds(
- self._backup_lock, self._saveBackupCb, project, uri)
+ self._backup_lock, self._save_backup_cb, project, uri)
else:
if self._backup_lock < 60:
self._backup_lock += 5
- def _saveBackupCb(self, unused_project, unused_uri):
+ def _save_backup_cb(self, unused_project, unused_uri):
if self._backup_lock > 10:
self._backup_lock -= 5
return True
else:
- self.saveProject(backup=True)
+ self.save_project(backup=True)
self._backup_lock = 0
return False
- def _cleanBackup(self, uri):
+ def _clean_backup(self, uri):
if uri is None:
return
- path = path_from_uri(self._makeBackupURI(uri))
+ path = path_from_uri(self._make_backup_uri(uri))
if os.path.exists(path):
os.remove(path)
self.debug('Removed backup file: %s', path)
- def _makeBackupURI(self, uri):
+ def _make_backup_uri(self, uri):
"""Generates a corresponding backup URI or path.
This does not guarantee that the backup file actually exists or that
@@ -597,16 +597,16 @@ class ProjectManager(GObject.Object, Loggable):
name, ext = os.path.splitext(uri)
return name + ext + "~"
- def _missingURICb(self, project, error, asset):
+ def _missing_uri_cb(self, project, error, asset):
new_uri = self.emit("missing-uri", project, error, asset)
if not new_uri:
project.at_least_one_asset_missing = True
else:
project.relocated_assets[asset.props.id] = new_uri
- project.setModificationState(True)
+ project.set_modification_state(True)
return new_uri
- def _projectLoadedCb(self, project, unused_timeline):
+ def _project_loaded_cb(self, project, unused_timeline):
self.debug("Project loaded %s", project.props.uri)
if not self.current_project == project:
self.debug("Project is obsolete %s", project.props.uri)
@@ -667,11 +667,11 @@ class Project(Loggable, GES.Project):
self.relocated_assets = {}
self.app.proxy_manager.connect("progress", self.__asset_transcoding_progress_cb)
self.app.proxy_manager.connect("error-preparing-asset",
- self.__proxyErrorCb)
+ self.__proxy_error_cb)
self.app.proxy_manager.connect("asset-preparing-cancelled",
- self.__assetTranscodingCancelledCb)
+ self.__asset_transcoding_cancelled_cb)
self.app.proxy_manager.connect("proxy-ready",
- self.__proxyReadyCb)
+ self.__proxy_ready_cb)
# GstValidate
self.scenario = scenario
@@ -723,8 +723,8 @@ class Project(Loggable, GES.Project):
self.muxer = Encoders().default_muxer
self.vencoder = Encoders().default_video_encoder
self.aencoder = Encoders().default_audio_encoder
- self._ensureAudioRestrictions()
- self._ensureVideoRestrictions()
+ self._ensure_audio_restrictions()
+ self._ensure_video_restrictions()
self._has_default_audio_settings = has_default_settings
self._has_default_video_settings = has_default_settings
@@ -740,9 +740,9 @@ class Project(Loggable, GES.Project):
def _scenario_done_cb(self, scenario):
if self.pipeline is not None:
- self.pipeline.setForcePositionListener(False)
+ self.pipeline.set_force_position_listener(False)
- def setupValidateScenario(self):
+ def setup_validate_scenario(self):
from gi.repository import GstValidate
self.info("Setting up validate scenario")
@@ -752,7 +752,7 @@ class Project(Loggable, GES.Project):
self.pipeline, self.runner, None)
self._scenario = GstValidate.Scenario.factory_create(
self.runner, self.pipeline, self.scenario)
- self.pipeline.setForcePositionListener(True)
+ self.pipeline.set_force_position_listener(True)
self._scenario.connect("done", self._scenario_done_cb)
self._scenario.props.execute_on_idle = True
@@ -807,7 +807,7 @@ class Project(Loggable, GES.Project):
if scaled_proxy_height == self.get_meta("scaled_proxy_height"):
return
self.set_meta("scaled_proxy_height", scaled_proxy_height)
- self.setModificationState(True)
+ self.set_modification_state(True)
@property
def scaled_proxy_width(self):
@@ -818,7 +818,7 @@ class Project(Loggable, GES.Project):
if scaled_proxy_width == self.get_meta("scaled_proxy_width"):
return
self.set_meta("scaled_proxy_width", scaled_proxy_width)
- self.setModificationState(True)
+ self.set_modification_state(True)
def has_scaled_proxy_size(self):
"""Returns whether the proxy size has been set."""
@@ -890,7 +890,7 @@ class Project(Loggable, GES.Project):
# the assets in the current project, the one with maximum file size
# will be our project thumbnail - http://bit.ly/thumbnail-generation
- assets = self.listSources()
+ assets = self.list_sources()
assets_uri = [asset.props.id for asset in assets]
if not assets_uri:
@@ -948,8 +948,8 @@ class Project(Loggable, GES.Project):
def set_rendering(self, rendering):
"""Sets the a/v restrictions for rendering or for editing."""
- self._ensureAudioRestrictions()
- self._ensureVideoRestrictions()
+ self._ensure_audio_restrictions()
+ self._ensure_video_restrictions()
video_restrictions = self.video_profile.get_restriction().copy_nth(0)
@@ -1124,7 +1124,7 @@ class Project(Loggable, GES.Project):
# ------------------------------#
def __asset_transcoding_progress_cb(self, proxy_manager, asset,
creation_progress, estimated_time):
- self.__updateAssetLoadingProgress(estimated_time)
+ self.__update_asset_loading_progress(estimated_time)
def __get_loading_project_progress(self):
"""Computes current advancement of asset loading during project loading.
@@ -1143,8 +1143,8 @@ class Project(Loggable, GES.Project):
all_ready = False
else:
# Check that we are not recreating deleted proxy
- proxy_uri = self.app.proxy_manager.getProxyUri(asset)
- scaled_proxy_uri = self.app.proxy_manager.getProxyUri(asset, scaled=True)
+ proxy_uri = self.app.proxy_manager.get_proxy_uri(asset)
+ scaled_proxy_uri = self.app.proxy_manager.get_proxy_uri(asset, scaled=True)
no_hq_proxy = False
no_scaled_proxy = False
@@ -1190,7 +1190,7 @@ class Project(Loggable, GES.Project):
if asset.creation_progress < 100:
all_ready = False
elif not asset.ready:
- self.setModificationState(True)
+ self.set_modification_state(True)
asset.ready = True
if all_ready:
@@ -1198,7 +1198,7 @@ class Project(Loggable, GES.Project):
return asset_loading_progress
- def __updateAssetLoadingProgress(self, estimated_time=0):
+ def __update_asset_loading_progress(self, estimated_time=0):
if not self.loading_assets:
self.emit("asset-loading-progress", 100, estimated_time)
return
@@ -1214,13 +1214,13 @@ class Project(Loggable, GES.Project):
self.info("No more loading assets")
self.loading_assets = set()
- def __assetTranscodingCancelledCb(self, unused_proxy_manager, asset):
- self.__setProxy(asset, None)
- self.__updateAssetLoadingProgress()
+ def __asset_transcoding_cancelled_cb(self, unused_proxy_manager, asset):
+ self.__set_proxy(asset, None)
+ self.__update_asset_loading_progress()
- def __proxyErrorCb(self, unused_proxy_manager, asset, proxy, error):
+ def __proxy_error_cb(self, unused_proxy_manager, asset, proxy, error):
if asset is None:
- asset_id = self.app.proxy_manager.getTargetUri(proxy)
+ asset_id = self.app.proxy_manager.get_target_uri(proxy)
if asset_id:
asset = GES.Asset.request(proxy.get_extractable_type(),
asset_id)
@@ -1244,17 +1244,17 @@ class Project(Loggable, GES.Project):
asset.creation_progress = 100
self.emit("proxying-error", asset)
- self.__updateAssetLoadingProgress()
+ self.__update_asset_loading_progress()
- def __proxyReadyCb(self, unused_proxy_manager, asset, proxy):
+ def __proxy_ready_cb(self, unused_proxy_manager, asset, proxy):
if proxy and proxy.props.id in self.__deleted_proxy_files:
self.info("Recreated proxy is now ready, stop having"
" its target as a proxy.")
proxy.unproxy(asset)
- self.__setProxy(asset, proxy)
+ self.__set_proxy(asset, proxy)
- def __setProxy(self, asset, proxy):
+ def __set_proxy(self, asset, proxy):
asset.creation_progress = 100
asset.ready = True
if proxy:
@@ -1270,7 +1270,7 @@ class Project(Loggable, GES.Project):
self.add_asset(proxy)
self.loading_assets.add(proxy)
- self.__updateAssetLoadingProgress()
+ self.__update_asset_loading_progress()
def finalize_proxy(self, proxy):
proxy.ready = False
@@ -1293,12 +1293,12 @@ class Project(Loggable, GES.Project):
self._prepare_asset_processing(asset)
asset.force_proxying = True
self.app.proxy_manager.add_job(asset, scaled=scaled)
- self.__updateAssetLoadingProgress()
+ self.__update_asset_loading_progress()
def do_missing_uri(self, error, asset):
if self.app.proxy_manager.is_proxy_asset(asset):
self.debug("Missing proxy file: %s", asset.props.id)
- target_uri = self.app.proxy_manager.getTargetUri(asset)
+ target_uri = self.app.proxy_manager.get_target_uri(asset)
# Take asset relocation into account.:
target_uri = self.relocated_assets.get(target_uri, target_uri)
@@ -1341,7 +1341,7 @@ class Project(Loggable, GES.Project):
def do_asset_added(self, asset):
"""Handles `GES.Project::asset-added` emitted by self."""
- self._maybeInitSettingsFromAsset(asset)
+ self._maybe_init_settings_from_asset(asset)
if asset and not GObject.type_is_a(asset.get_extractable_type(),
GES.UriClip):
# Ignore for example the assets producing GES.TitleClips.
@@ -1367,7 +1367,7 @@ class Project(Loggable, GES.Project):
self.debug("Project still loading, not using proxies: %s",
asset.props.id)
asset.creation_progress = 100
- self.__updateAssetLoadingProgress()
+ self.__update_asset_loading_progress()
def do_loading_error(self, error, asset_id, unused_type):
"""Handles `GES.Project::error-loading-asset` emitted by self."""
@@ -1381,16 +1381,16 @@ class Project(Loggable, GES.Project):
asset.creation_progress = 100
if self.loaded:
self.loading_assets.remove(asset)
- self.__updateAssetLoadingProgress()
+ self.__update_asset_loading_progress()
def do_loaded(self, unused_timeline):
"""Handles `GES.Project::loaded` emitted by self."""
if not self.ges_timeline:
return
- self._ensureTracks()
+ self._ensure_tracks()
self.ges_timeline.props.auto_transition = True
- self._ensureLayer()
+ self._ensure_layer()
if self.uri:
self.loading_assets = {asset for asset in self.loading_assets
@@ -1400,7 +1400,7 @@ class Project(Loggable, GES.Project):
self.debug("The following assets are still being transcoded: %s."
" (They must be proxied assets with missing/deleted"
" proxy files).", self.loading_assets)
- self.__updateAssetLoadingProgress()
+ self.__update_asset_loading_progress()
if self.scenario is not None:
return
@@ -1421,7 +1421,7 @@ class Project(Loggable, GES.Project):
if container_profile == self.container_profile:
return False
- muxer = self._getElementFactoryName(
+ muxer = self._get_element_factory_name(
Encoders().muxers, container_profile)
if muxer is None:
muxer = Encoders().default_muxer
@@ -1434,8 +1434,8 @@ class Project(Loggable, GES.Project):
if profile.get_restriction() is None:
profile.set_restriction(Gst.Caps("video/x-raw"))
- self._ensureVideoRestrictions(profile)
- vencoder = self._getElementFactoryName(Encoders().vencoders, profile)
+ self._ensure_video_restrictions(profile)
+ vencoder = self._get_element_factory_name(Encoders().vencoders, profile)
if vencoder:
profile.set_preset_name(vencoder)
elif isinstance(profile, GstPbutils.EncodingAudioProfile):
@@ -1443,8 +1443,8 @@ class Project(Loggable, GES.Project):
if profile.get_restriction() is None:
profile.set_restriction(Gst.Caps("audio/x-raw"))
- self._ensureAudioRestrictions(profile)
- aencoder = self._getElementFactoryName(Encoders().aencoders, profile)
+ self._ensure_audio_restrictions(profile)
+ aencoder = self._get_element_factory_name(Encoders().aencoders, profile)
if aencoder:
profile.set_preset_name(aencoder)
else:
@@ -1510,9 +1510,9 @@ class Project(Loggable, GES.Project):
if self._scenario:
self._scenario.disconnect_by_func(self._scenario_done_cb)
self.app.proxy_manager.disconnect_by_func(self.__asset_transcoding_progress_cb)
- self.app.proxy_manager.disconnect_by_func(self.__proxyErrorCb)
- self.app.proxy_manager.disconnect_by_func(self.__assetTranscodingCancelledCb)
- self.app.proxy_manager.disconnect_by_func(self.__proxyReadyCb)
+ self.app.proxy_manager.disconnect_by_func(self.__proxy_error_cb)
+ self.app.proxy_manager.disconnect_by_func(self.__asset_transcoding_cancelled_cb)
+ self.app.proxy_manager.disconnect_by_func(self.__proxy_ready_cb)
def save(self, ges_timeline, uri, formatter_asset, overwrite):
for container_profile in self.list_encoding_profiles():
@@ -1558,7 +1558,7 @@ class Project(Loggable, GES.Project):
for asset in assets:
if proxy_manager.asset_can_be_proxied(asset, scaled):
target = asset.get_proxy_target()
- uri = proxy_manager.getProxyUri(asset, scaled=scaled)
+ uri = proxy_manager.get_proxy_uri(asset, scaled=scaled)
if target and target.props.id == uri:
self.info("Missing proxy needs to be recreated after cancelling"
" its recreation")
@@ -1584,7 +1584,7 @@ class Project(Loggable, GES.Project):
self.debug("Stop proxying %s", proxy_target.props.id)
proxy_target.set_proxy(None)
if proxy_manager.is_scaled_proxy(asset) \
- and not proxy_manager.isAssetFormatWellSupported(proxy_target) \
+ and not proxy_manager.is_asset_format_well_supported(proxy_target) \
and hq_proxy:
# The original asset is unsupported, and the user prefers
# to edit with HQ proxies instead of scaled proxies.
@@ -1620,7 +1620,7 @@ class Project(Loggable, GES.Project):
self.app.write_action("commit")
GES.Timeline.commit(self.ges_timeline)
- def createTimeline(self):
+ def create_timeline(self):
"""Loads the project's timeline."""
try:
# The project is loaded from the file in this call.
@@ -1645,7 +1645,7 @@ class Project(Loggable, GES.Project):
def update_restriction_caps(self):
# Get the height/width without rendering settings applied
- width, height = self.getVideoWidthAndHeight()
+ width, height = self.get_video_width_and_height()
videocaps = Gst.Caps.new_empty_simple("video/x-raw")
videocaps.set_value("width", width)
@@ -1676,7 +1676,7 @@ class Project(Loggable, GES.Project):
self.pipeline.commit_timeline()
- def addUris(self, uris):
+ def add_uris(self, uris):
"""Adds assets asynchronously.
Args:
@@ -1689,7 +1689,7 @@ class Project(Loggable, GES.Project):
action = AssetAddedIntention(self, uri)
self.app.action_log.push(action)
- def assetsForUris(self, uris):
+ def assets_for_uris(self, uris):
assets = []
for uri in uris:
asset = self.get_asset(uri, GES.UriClip)
@@ -1698,7 +1698,7 @@ class Project(Loggable, GES.Project):
assets.append(asset)
return assets
- def listSources(self):
+ def list_sources(self):
return self.list_assets(GES.UriClip)
def release(self):
@@ -1719,7 +1719,7 @@ class Project(Loggable, GES.Project):
return res
- def setModificationState(self, state):
+ def set_modification_state(self, state):
if not self.loaded:
return
@@ -1727,13 +1727,13 @@ class Project(Loggable, GES.Project):
if state:
self.emit('project-changed')
- def hasUnsavedModifications(self):
+ def has_unsaved_modifications(self):
return self._dirty
- def getDAR(self):
+ def get_dar(self):
return Gst.Fraction(self.videowidth, self.videoheight)
- def getVideoWidthAndHeight(self, render=False):
+ def get_video_width_and_height(self, render=False):
"""Returns the video width and height as a tuple.
Args:
@@ -1753,13 +1753,13 @@ class Project(Loggable, GES.Project):
return self.videowidth, self.videoheight
- def getVideoCaps(self, render=False):
+ def get_video_caps(self, render=False):
"""Gets the caps corresponding to the video settings.
Returns:
Gst.Caps: The video settings caps.
"""
- videowidth, videoheight = self.getVideoWidthAndHeight(render=render)
+ videowidth, videoheight = self.get_video_width_and_height(render=render)
vstr = "width=%d,height=%d,pixel-aspect-ratio=1/1,framerate=%d/%d" % (
videowidth, videoheight,
self.videorate.num, self.videorate.denom)
@@ -1767,7 +1767,7 @@ class Project(Loggable, GES.Project):
video_caps = Gst.caps_from_string(caps_str)
return video_caps
- def getAudioCaps(self):
+ def get_audio_caps(self):
"""Gets the caps corresponding to the audio settings.
Returns:
@@ -1778,7 +1778,7 @@ class Project(Loggable, GES.Project):
audio_caps = Gst.caps_from_string(caps_str)
return audio_caps
- def setAudioProperties(self, nbchanns=-1, rate=-1):
+ def set_audio_properties(self, nbchanns=-1, rate=-1):
"""Sets the number of audio channels and the rate."""
# pylint: disable=consider-using-in
self.info("%d x %dHz %dbits", nbchanns, rate)
@@ -1787,7 +1787,7 @@ class Project(Loggable, GES.Project):
if rate != -1 and rate != self.audiorate:
self.audiorate = rate
- def setEncoders(self, muxer="", vencoder="", aencoder=""):
+ def set_encoders(self, muxer="", vencoder="", aencoder=""):
"""Sets the video and audio encoders and the muxer."""
# pylint: disable=consider-using-in
if muxer != "" and muxer != self.muxer:
@@ -1831,7 +1831,7 @@ class Project(Loggable, GES.Project):
# Private methods #
# ------------------------------------------ #
- def _ensureTracks(self):
+ def _ensure_tracks(self):
if self.ges_timeline is None:
self.warning("Can't ensure tracks if no timeline set")
return
@@ -1844,15 +1844,15 @@ class Project(Loggable, GES.Project):
if GES.TrackType.AUDIO not in track_types:
self.ges_timeline.add_track(GES.AudioTrack.new())
- def _ensureLayer(self):
+ def _ensure_layer(self):
if self.ges_timeline is None:
self.warning("Can't ensure tracks if no timeline set")
return
if not self.ges_timeline.get_layers():
self.ges_timeline.append_layer()
- def _ensureRestrictions(self, profile, defaults, ref_restrictions=None,
- prev_vals=None):
+ def _ensure_restrictions(self, profile, defaults, ref_restrictions=None,
+ prev_vals=None):
"""Make sure restriction values defined in @defaults are set on @profile.
Attributes:
@@ -1890,7 +1890,7 @@ class Project(Loggable, GES.Project):
self.info("Fully set restriction: %s", profile.get_restriction().to_string())
- def _ensureVideoRestrictions(self, profile=None):
+ def _ensure_video_restrictions(self, profile=None):
defaults = {
"width": 720,
"height": 576,
@@ -1908,10 +1908,10 @@ class Project(Loggable, GES.Project):
else:
ref_restrictions = profile.get_restriction()
- self._ensureRestrictions(profile, defaults, ref_restrictions,
- prev_vals)
+ self._ensure_restrictions(profile, defaults, ref_restrictions,
+ prev_vals)
- def _ensureAudioRestrictions(self, profile=None):
+ def _ensure_audio_restrictions(self, profile=None):
ref_restrictions = None
if not profile:
profile = self.audio_profile
@@ -1924,10 +1924,10 @@ class Project(Loggable, GES.Project):
if self.audio_profile:
prev_vals = self.audio_profile.get_restriction().copy()
- return self._ensureRestrictions(profile, defaults, ref_restrictions,
- prev_vals)
+ return self._ensure_restrictions(profile, defaults, ref_restrictions,
+ prev_vals)
- def _maybeInitSettingsFromAsset(self, asset):
+ def _maybe_init_settings_from_asset(self, asset):
"""Updates the project settings to match the specified asset.
Args:
@@ -1967,9 +1967,9 @@ class Project(Loggable, GES.Project):
def _emit_change(self, key):
self.emit("rendering-settings-changed", key)
- self.setModificationState(True)
+ self.set_modification_state(True)
- def _getElementFactoryName(self, elements, profile):
+ def _get_element_factory_name(self, elements, profile):
if profile.get_preset_name():
return profile.get_preset_name()
@@ -2018,8 +2018,8 @@ class ProjectSettingsDialog:
self._create_ui()
self.window.set_transient_for(parent_window)
- self._setupUiConstraints()
- self.updateUI()
+ self._setup_ui_constraints()
+ self.update_ui()
def _create_ui(self):
"""Initializes the static parts of the UI."""
@@ -2043,18 +2043,18 @@ class ProjectSettingsDialog:
self.year_spinbutton = self.builder.get_object("year_spinbutton")
self.video_preset_menubutton = self.builder.get_object("video_preset_menubutton")
- self.video_presets.setupUi(self.video_presets_combo,
- self.video_preset_menubutton)
- self.video_presets.connect("preset-loaded", self.__videoPresetLoadedCb)
+ self.video_presets.setup_ui(self.video_presets_combo,
+ self.video_preset_menubutton)
+ self.video_presets.connect("preset-loaded", self.__video_preset_loaded_cb)
self.audio_preset_menubutton = self.builder.get_object("audio_preset_menubutton")
- self.audio_presets.setupUi(self.audio_presets_combo,
- self.audio_preset_menubutton)
+ self.audio_presets.setup_ui(self.audio_presets_combo,
+ self.audio_preset_menubutton)
self.scaled_proxy_width_spin = self.builder.get_object("scaled_proxy_width")
self.scaled_proxy_height_spin = self.builder.get_object("scaled_proxy_height")
self.proxy_res_linked_check = self.builder.get_object("proxy_res_linked")
- def _setupUiConstraints(self):
+ def _setup_ui_constraints(self):
"""Creates the dynamic widgets and connects other widgets."""
# Add custom framerate fraction widget.
frame_rate_box = self.builder.get_object("frame_rate_box")
@@ -2069,119 +2069,119 @@ class ProjectSettingsDialog:
# Behavior.
self.widgets_group = RippleUpdateGroup()
- self.widgets_group.addVertex(self.frame_rate_combo,
- signal="changed",
- update_func=self._update_combo_func,
- update_func_args=(self.frame_rate_fraction_widget,))
- self.widgets_group.addVertex(self.frame_rate_fraction_widget,
- signal="value-changed",
- update_func=self._update_fraction_func,
- update_func_args=(self.frame_rate_combo,))
- self.widgets_group.addVertex(self.width_spinbutton, signal="value-changed")
- self.widgets_group.addVertex(self.height_spinbutton, signal="value-changed")
- self.widgets_group.addVertex(self.audio_preset_menubutton,
- update_func=self._update_preset_menu_button_func,
- update_func_args=(self.audio_presets,))
- self.widgets_group.addVertex(self.video_preset_menubutton,
- update_func=self._update_preset_menu_button_func,
- update_func_args=(self.video_presets,))
- self.widgets_group.addVertex(self.channels_combo, signal="changed")
- self.widgets_group.addVertex(self.sample_rate_combo, signal="changed")
- self.widgets_group.addVertex(self.scaled_proxy_width_spin, signal="value-changed")
- self.widgets_group.addVertex(self.scaled_proxy_height_spin, signal="value-changed")
+ self.widgets_group.add_vertex(self.frame_rate_combo,
+ signal="changed",
+ update_func=self._update_combo_func,
+ update_func_args=(self.frame_rate_fraction_widget,))
+ self.widgets_group.add_vertex(self.frame_rate_fraction_widget,
+ signal="value-changed",
+ update_func=self._update_fraction_func,
+ update_func_args=(self.frame_rate_combo,))
+ self.widgets_group.add_vertex(self.width_spinbutton, signal="value-changed")
+ self.widgets_group.add_vertex(self.height_spinbutton, signal="value-changed")
+ self.widgets_group.add_vertex(self.audio_preset_menubutton,
+ update_func=self._update_preset_menu_button_func,
+ update_func_args=(self.audio_presets,))
+ self.widgets_group.add_vertex(self.video_preset_menubutton,
+ update_func=self._update_preset_menu_button_func,
+ update_func_args=(self.video_presets,))
+ self.widgets_group.add_vertex(self.channels_combo, signal="changed")
+ self.widgets_group.add_vertex(self.sample_rate_combo, signal="changed")
+ self.widgets_group.add_vertex(self.scaled_proxy_width_spin, signal="value-changed")
+ self.widgets_group.add_vertex(self.scaled_proxy_height_spin, signal="value-changed")
# Constrain width and height IFF the Constrain checkbox is checked.
# Video
- self.widgets_group.addEdge(self.width_spinbutton, self.height_spinbutton,
- predicate=self.widthHeightLinked,
- edge_func=self.updateHeight)
- self.widgets_group.addEdge(self.height_spinbutton, self.width_spinbutton,
- predicate=self.widthHeightLinked,
- edge_func=self.updateWidth)
+ self.widgets_group.add_edge(self.width_spinbutton, self.height_spinbutton,
+ predicate=self.width_height_linked,
+ edge_func=self.update_height)
+ self.widgets_group.add_edge(self.height_spinbutton, self.width_spinbutton,
+ predicate=self.width_height_linked,
+ edge_func=self.update_width)
# Proxy
- self.widgets_group.addEdge(self.scaled_proxy_width_spin,
- self.scaled_proxy_height_spin,
- predicate=self.proxy_res_linked,
- edge_func=self.update_scaled_proxy_height)
- self.widgets_group.addEdge(self.scaled_proxy_height_spin,
- self.scaled_proxy_width_spin,
- predicate=self.proxy_res_linked,
- edge_func=self.update_scaled_proxy_width)
+ self.widgets_group.add_edge(self.scaled_proxy_width_spin,
+ self.scaled_proxy_height_spin,
+ predicate=self.proxy_res_linked,
+ edge_func=self.update_scaled_proxy_height)
+ self.widgets_group.add_edge(self.scaled_proxy_height_spin,
+ self.scaled_proxy_width_spin,
+ predicate=self.proxy_res_linked,
+ edge_func=self.update_scaled_proxy_width)
# Keep the framerate combo and fraction widgets in sync.
- self.widgets_group.addBiEdge(
+ self.widgets_group.add_bi_edge(
self.frame_rate_combo, self.frame_rate_fraction_widget)
# Presets.
- self.audio_presets.loadAll()
- self.video_presets.loadAll()
+ self.audio_presets.load_all()
+ self.video_presets.load_all()
# Bind the widgets in the Video tab to the Video Presets Manager.
- self.bindSpinbutton(self.video_presets, "width", self.width_spinbutton)
- self.bindSpinbutton(
+ self.bind_spinbutton(self.video_presets, "width", self.width_spinbutton)
+ self.bind_spinbutton(
self.video_presets, "height", self.height_spinbutton)
- self.bindFractionWidget(
+ self.bind_fraction_widget(
self.video_presets, "frame-rate", self.frame_rate_fraction_widget)
# Bind the widgets in the Audio tab to the Audio Presets Manager.
- self.bindCombo(self.audio_presets, "channels", self.channels_combo)
- self.bindCombo(
+ self.bind_combo(self.audio_presets, "channels", self.channels_combo)
+ self.bind_combo(
self.audio_presets, "sample-rate", self.sample_rate_combo)
- self.widgets_group.addEdge(
+ self.widgets_group.add_edge(
self.frame_rate_fraction_widget, self.video_preset_menubutton)
- self.widgets_group.addEdge(self.width_spinbutton, self.video_preset_menubutton)
- self.widgets_group.addEdge(self.height_spinbutton, self.video_preset_menubutton)
+ self.widgets_group.add_edge(self.width_spinbutton, self.video_preset_menubutton)
+ self.widgets_group.add_edge(self.height_spinbutton, self.video_preset_menubutton)
- self.widgets_group.addEdge(self.channels_combo, self.audio_preset_menubutton)
- self.widgets_group.addEdge(self.sample_rate_combo, self.audio_preset_menubutton)
+ self.widgets_group.add_edge(self.channels_combo, self.audio_preset_menubutton)
+ self.widgets_group.add_edge(self.sample_rate_combo, self.audio_preset_menubutton)
- def bindFractionWidget(self, mgr, name, widget):
- mgr.bindWidget(name, widget.setWidgetValue, widget.getWidgetValue)
+ def bind_fraction_widget(self, mgr, name, widget):
+ mgr.bind_widget(name, widget.set_widget_value, widget.get_widget_value)
- def bindCombo(self, mgr, name, widget):
- mgr.bindWidget(name,
- lambda x: set_combo_value(widget, x),
- lambda: get_combo_value(widget))
+ def bind_combo(self, mgr, name, widget):
+ mgr.bind_widget(name,
+ lambda x: set_combo_value(widget, x),
+ 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()))
+ def bind_spinbutton(self, mgr, name, widget):
+ mgr.bind_widget(name,
+ lambda x: widget.set_value(float(x)),
+ lambda: int(widget.get_value()))
- def widthHeightLinked(self):
+ def width_height_linked(self):
return self.constrain_sar_button.props.active and not self.video_presets.ignore_update_requests
def proxy_res_linked(self):
return self.proxy_res_linked_check.props.active
def _update_fraction_func(self, unused, fraction, combo):
- fraction.setWidgetValue(get_combo_value(combo))
+ fraction.set_widget_value(get_combo_value(combo))
def _update_combo_func(self, unused, combo, fraction):
- set_combo_value(combo, fraction.getWidgetValue())
+ set_combo_value(combo, fraction.get_widget_value())
- def __videoPresetLoadedCb(self, unused_mgr):
- self.sar = self.getSAR()
+ def __video_preset_loaded_cb(self, unused_mgr):
+ self.sar = self.get_sar()
- def getSAR(self):
+ def get_sar(self):
width = int(self.width_spinbutton.get_value())
height = int(self.height_spinbutton.get_value())
return Gst.Fraction(width, height)
- def _constrainSarButtonToggledCb(self, unused_button):
- self.sar = self.getSAR()
+ def _constrain_sar_button_toggled_cb(self, unused_button):
+ self.sar = self.get_sar()
def _update_preset_menu_button_func(self, unused_source, unused_target, mgr):
- mgr.updateMenuActions()
+ mgr.update_menu_actions()
- def updateWidth(self):
+ def update_width(self):
height = int(self.height_spinbutton.get_value())
fraction = height * self.sar
width = int(fraction.num / fraction.denom)
self.width_spinbutton.set_value(width)
- def updateHeight(self):
+ def update_height(self):
width = int(self.width_spinbutton.get_value())
fraction = width / self.sar
height = int(fraction.num / fraction.denom)
@@ -2204,13 +2204,13 @@ class ProjectSettingsDialog:
height = int(fraction.num / fraction.denom)
self.scaled_proxy_height_spin.set_value(height)
- def updateUI(self):
+ def update_ui(self):
# Video
self.width_spinbutton.set_value(self.project.videowidth)
self.height_spinbutton.set_value(self.project.videoheight)
- self.frame_rate_fraction_widget.setWidgetValue(self.project.videorate)
+ self.frame_rate_fraction_widget.set_widget_value(self.project.videorate)
- matching_video_preset = self.video_presets.matchingPreset(self.project)
+ matching_video_preset = self.video_presets.matching_preset(self.project)
if matching_video_preset:
self.video_presets_combo.set_active_id(matching_video_preset)
@@ -2218,7 +2218,7 @@ class ProjectSettingsDialog:
set_combo_value(self.channels_combo, self.project.audiochannels)
set_combo_value(self.sample_rate_combo, self.project.audiorate)
- matching_audio_preset = self.audio_presets.matchingPreset(self.project)
+ matching_audio_preset = self.audio_presets.matching_preset(self.project)
if matching_audio_preset:
self.audio_presets_combo.set_active_id(matching_audio_preset)
@@ -2233,7 +2233,7 @@ class ProjectSettingsDialog:
self.scaled_proxy_width_spin.set_value(self.project.scaled_proxy_width)
self.scaled_proxy_height_spin.set_value(self.project.scaled_proxy_height)
- def updateProject(self):
+ def update_project(self):
with self.app.action_log.started("change project settings",
toplevel=True):
self.project.author = self.author_entry.get_text()
@@ -2241,7 +2241,7 @@ class ProjectSettingsDialog:
self.project.videowidth = int(self.width_spinbutton.get_value())
self.project.videoheight = int(self.height_spinbutton.get_value())
- self.project.videorate = self.frame_rate_fraction_widget.getWidgetValue()
+ self.project.videorate = self.frame_rate_fraction_widget.get_widget_value()
self.project.audiochannels = get_combo_value(self.channels_combo)
self.project.audiorate = get_combo_value(self.sample_rate_combo)
@@ -2257,8 +2257,8 @@ class ProjectSettingsDialog:
self.project.regenerate_scaled_proxies()
- def _responseCb(self, unused_widget, response):
+ def _response_cb(self, unused_widget, response):
"""Handles the dialog being closed."""
if response == Gtk.ResponseType.OK:
- self.updateProject()
+ self.update_project()
self.window.destroy()
diff --git a/pitivi/render.py b/pitivi/render.py
index a91cdaf2..271c741f 100644
--- a/pitivi/render.py
+++ b/pitivi/render.py
@@ -334,12 +334,12 @@ class RenderingProgressDialog(GObject.Object):
self.close_button.hide()
self.show_in_file_manager_button.hide()
- def updatePosition(self, fraction):
+ def update_position(self, fraction):
self.progressbar.set_fraction(fraction)
self.window.set_title(
_("Rendering — %d%% complete") % int(100 * fraction))
- def updateProgressbarETA(self, time_estimation):
+ def update_progressbar_eta(self, time_estimation):
# Translators: this string indicates the estimated time
# remaining until an action (such as rendering) completes.
# The "%s" is an already-localized human-readable duration,
@@ -348,7 +348,7 @@ class RenderingProgressDialog(GObject.Object):
# "There remains approximatively %s" (to handle gender and plurals).
self.progressbar.set_text(_("About %s left") % time_estimation)
- def setFilesizeEstimate(self, estimated_filesize=None):
+ def set_filesize_estimate(self, estimated_filesize=None):
if not estimated_filesize:
self._filesize_est_label.hide()
self._filesize_est_value_label.hide()
@@ -357,24 +357,24 @@ class RenderingProgressDialog(GObject.Object):
self._filesize_est_label.show()
self._filesize_est_value_label.show()
- def _deleteEventCb(self, unused_dialog_widget, unused_event):
+ def _delete_event_cb(self, unused_dialog_widget, unused_event):
"""Stops the rendering."""
# The user closed the window by pressing Escape.
self.emit("cancel")
- def _cancelButtonClickedCb(self, unused_button):
+ def _cancel_button_clicked_cb(self, unused_button):
self.emit("cancel")
- def _pauseButtonClickedCb(self, unused_button):
+ def _pause_button_clicked_cb(self, unused_button):
self.emit("pause")
- def _closeButtonClickedCb(self, unused_button):
+ def _close_button_clicked_cb(self, unused_button):
self.window.destroy()
if self.main_render_dialog.notification is not None:
self.main_render_dialog.notification.close()
self.main_render_dialog.window.show()
- def _playRenderedFileButtonClickedCb(self, unused_button):
+ def _play_rendered_file_button_clicked_cb(self, unused_button):
Gio.AppInfo.launch_default_for_uri(self.main_render_dialog.outfile, None)
def _show_in_file_manager_button_clicked_cb(self, unused_button):
@@ -435,9 +435,9 @@ class RenderDialog(Loggable):
# Directory and Filename
self.filebutton.set_current_folder(self.app.settings.lastExportFolder)
if not self.project.name:
- self.updateFilename(_("Untitled"))
+ self.update_filename(_("Untitled"))
else:
- self.updateFilename(self.project.name)
+ self.update_filename(self.project.name)
# Add a shortcut for the project folder (if saved)
if self.project.uri:
@@ -457,31 +457,31 @@ class RenderDialog(Loggable):
self.channels_combo.set_model(AUDIO_CHANNELS)
self.sample_rate_combo.set_model(AUDIO_RATES)
self.__initialize_muxers_model()
- self._displaySettings()
- self._displayRenderSettings()
+ self._display_settings()
+ self._display_render_settings()
- self.window.connect("delete-event", self._deleteEventCb)
+ self.window.connect("delete-event", self._delete_event_cb)
self.project.connect("rendering-settings-changed",
self._rendering_settings_changed_cb)
# Monitor changes
self.widgets_group = RippleUpdateGroup()
- self.widgets_group.addVertex(self.frame_rate_combo, signal="changed")
- self.widgets_group.addVertex(self.channels_combo, signal="changed")
- self.widgets_group.addVertex(self.sample_rate_combo, signal="changed")
- self.widgets_group.addVertex(self.muxer_combo, signal="changed")
- self.widgets_group.addVertex(self.audio_encoder_combo, signal="changed")
- self.widgets_group.addVertex(self.video_encoder_combo, signal="changed")
- self.widgets_group.addVertex(self.preset_menubutton,
- update_func=self._updatePresetMenuButton)
-
- self.widgets_group.addEdge(self.frame_rate_combo, self.preset_menubutton)
- self.widgets_group.addEdge(self.audio_encoder_combo, self.preset_menubutton)
- self.widgets_group.addEdge(self.video_encoder_combo, self.preset_menubutton)
- self.widgets_group.addEdge(self.muxer_combo, self.preset_menubutton)
- self.widgets_group.addEdge(self.channels_combo, self.preset_menubutton)
- self.widgets_group.addEdge(self.sample_rate_combo, self.preset_menubutton)
+ self.widgets_group.add_vertex(self.frame_rate_combo, signal="changed")
+ self.widgets_group.add_vertex(self.channels_combo, signal="changed")
+ self.widgets_group.add_vertex(self.sample_rate_combo, signal="changed")
+ self.widgets_group.add_vertex(self.muxer_combo, signal="changed")
+ self.widgets_group.add_vertex(self.audio_encoder_combo, signal="changed")
+ self.widgets_group.add_vertex(self.video_encoder_combo, signal="changed")
+ self.widgets_group.add_vertex(self.preset_menubutton,
+ update_func=self._update_preset_menu_button)
+
+ self.widgets_group.add_edge(self.frame_rate_combo, self.preset_menubutton)
+ self.widgets_group.add_edge(self.audio_encoder_combo, self.preset_menubutton)
+ self.widgets_group.add_edge(self.video_encoder_combo, self.preset_menubutton)
+ self.widgets_group.add_edge(self.muxer_combo, self.preset_menubutton)
+ self.widgets_group.add_edge(self.channels_combo, self.preset_menubutton)
+ self.widgets_group.add_edge(self.sample_rate_combo, self.preset_menubutton)
def _encoding_profile_selected_cb(self, unused_target, encoding_profile):
self._set_encoding_profile(encoding_profile)
@@ -505,7 +505,7 @@ class RenderDialog(Loggable):
rollback()
return
- self.updateAvailableEncoders()
+ self.update_available_encoders()
self._update_valid_audio_restrictions(Gst.ElementFactory.find(self.project.aencoder))
self._update_valid_video_restrictions(Gst.ElementFactory.find(self.project.vencoder))
for i, (combo, name, value) in enumerate([
@@ -526,23 +526,23 @@ class RenderDialog(Loggable):
rollback()
return
- self.updateResolution()
+ self.update_resolution()
self.project.add_encoding_profile(self.project.container_profile)
self._setting_encoding_profile = False
- def _updatePresetMenuButton(self, unused_source, unused_target):
- self.render_presets.updateMenuActions()
+ def _update_preset_menu_button(self, unused_source, unused_target):
+ self.render_presets.update_menu_actions()
def muxer_setter(self, widget, muxer_name):
set_combo_value(widget, Encoders().factories_by_name.get(muxer_name))
- self.project.setEncoders(muxer=muxer_name)
+ self.project.set_encoders(muxer=muxer_name)
# Update the extension of the filename.
basename = os.path.splitext(self.fileentry.get_text())[0]
- self.updateFilename(basename)
+ self.update_filename(basename)
# Update muxer-dependent widgets.
- self.updateAvailableEncoders()
+ self.update_available_encoders()
def acodec_setter(self, widget, aencoder_name):
set_combo_value(widget, Encoders().factories_by_name.get(aencoder_name))
@@ -553,7 +553,7 @@ class RenderDialog(Loggable):
def vcodec_setter(self, widget, vencoder_name):
set_combo_value(widget, Encoders().factories_by_name.get(vencoder_name))
- self.project.setEncoders(vencoder=vencoder_name)
+ self.project.set_encoders(vencoder=vencoder_name)
if not self.muxer_combo_changing:
# The user directly changed the video encoder combo.
self.preferred_vencoder = vencoder_name
@@ -615,8 +615,8 @@ class RenderDialog(Loggable):
self.__never_use_proxies = builder.get_object("never_use_proxies")
self.__never_use_proxies.props.group = self.__automatically_use_proxies
- self.render_presets.setupUi(self.presets_combo, self.preset_menubutton)
- self.render_presets.loadAll()
+ self.render_presets.setup_ui(self.presets_combo, self.preset_menubutton)
+ self.render_presets.load_all()
self.window.set_icon_name("system-run-symbolic")
self.window.set_transient_for(self.app.gui)
@@ -631,7 +631,7 @@ class RenderDialog(Loggable):
def _rendering_settings_changed_cb(self, unused_project, unused_item):
"""Handles Project metadata changes."""
- self.updateResolution()
+ self.update_resolution()
def __initialize_muxers_model(self):
# By default show only supported muxers and encoders.
@@ -674,7 +674,7 @@ class RenderDialog(Loggable):
return model
- def _displaySettings(self):
+ def _display_settings(self):
"""Displays the settings also in the ProjectSettingsDialog."""
# Video settings
set_combo_value(self.frame_rate_combo, self.project.videorate)
@@ -689,7 +689,7 @@ class RenderDialog(Loggable):
self.audio_encoder_combo.set_sensitive(active)
self.audio_settings_button.set_sensitive(active)
self.project.audio_profile.set_enabled(active)
- self.__updateRenderButtonSensitivity()
+ self.__update_render_button_sensitivity()
def _update_video_widgets_sensitivity(self):
active = self.video_output_checkbutton.get_active()
@@ -698,9 +698,9 @@ class RenderDialog(Loggable):
self.video_encoder_combo.set_sensitive(active)
self.video_settings_button.set_sensitive(active)
self.project.video_profile.set_enabled(active)
- self.__updateRenderButtonSensitivity()
+ self.__update_render_button_sensitivity()
- def _displayRenderSettings(self):
+ def _display_render_settings(self):
"""Displays the settings available only in the RenderDialog."""
# Video settings
# This will trigger an update of the video resolution label.
@@ -741,9 +741,9 @@ class RenderDialog(Loggable):
self.fileentry.set_icon_from_icon_name(1, warning_icon)
self.fileentry.set_icon_tooltip_text(1, tooltip_text)
- self.__updateRenderButtonSensitivity()
+ self.__update_render_button_sensitivity()
- def _getFilesizeEstimate(self):
+ def _get_filesize_estimate(self):
"""Estimates the final file size.
Estimates in megabytes (over 30 MB) are rounded to the nearest 10 MB
@@ -771,7 +771,7 @@ class RenderDialog(Loggable):
megabytes = int(round(megabytes, -1)) # -1 means round to 10
return _("%d MB") % megabytes
- def updateFilename(self, basename):
+ def update_filename(self, basename):
"""Updates the filename UI element to show the specified file name."""
extension = extension_for_muxer(self.project.muxer)
if extension:
@@ -836,7 +836,7 @@ class RenderDialog(Loggable):
self.project.videorate,
caps_template_expander=fraction_expander_func)
- def updateAvailableEncoders(self):
+ def update_available_encoders(self):
"""Updates the encoder comboboxes to show the available encoders."""
self.muxer_combo_changing = True
try:
@@ -877,7 +877,7 @@ class RenderDialog(Loggable):
second = encoder_combo.props.model.iter_nth_child(first, 0)
encoder_combo.set_active_iter(second)
- def _elementSettingsDialog(self, factory, media_type):
+ def _element_settings_dialog(self, factory, media_type):
"""Opens a dialog to edit the properties for the specified factory.
Args:
@@ -891,7 +891,7 @@ class RenderDialog(Loggable):
caps=getattr(self.project, media_type +
'_profile').get_format(),
parent_window=self.window)
self.dialog.ok_btn.connect(
- "clicked", self._okButtonClickedCb, media_type)
+ "clicked", self._ok_button_clicked_cb, media_type)
def __additional_debug_info(self):
if self.project.vencoder == 'x264enc':
@@ -901,7 +901,7 @@ class RenderDialog(Loggable):
return ""
- def _showRenderErrorDialog(self, error, unused_details):
+ def _show_render_error_dialog(self, error, unused_details):
primary_message = _("Sorry, something didn’t work right.")
secondary_message = "".join([
_("An error occurred while trying to render your project."),
@@ -919,7 +919,7 @@ class RenderDialog(Loggable):
dialog.run()
dialog.destroy()
- def startAction(self):
+ def start_action(self):
"""Starts the render process."""
self._pipeline.set_state(Gst.State.NULL)
self._pipeline.set_mode(GES.PipelineFlags.RENDER)
@@ -932,12 +932,12 @@ class RenderDialog(Loggable):
self._is_rendering = True
self._time_started = time.time()
- def _cancelRender(self, *unused_args):
+ def _cancel_render(self, *unused_args):
self.debug("Aborting render")
- self._shutDown()
- self._destroyProgressWindow()
+ self._shut_down()
+ self._destroy_progress_window()
- def _shutDown(self):
+ def _shut_down(self):
"""Shuts down the pipeline and disconnects from its signals."""
self._is_rendering = False
self._rendering_is_paused = False
@@ -945,11 +945,11 @@ class RenderDialog(Loggable):
self._pipeline.set_state(Gst.State.NULL)
self.project.set_rendering(False)
self._use_proxy_assets()
- self._disconnectFromGst()
+ self._disconnect_from_gst()
self._pipeline.set_mode(GES.PipelineFlags.FULL_PREVIEW)
self._pipeline.set_state(Gst.State.PAUSED)
- def _pauseRender(self, unused_progress):
+ def _pause_render(self, unused_progress):
self._rendering_is_paused = self.progress.play_pause_button.get_active()
if self._rendering_is_paused:
self._last_timestamp_when_pausing = time.time()
@@ -957,20 +957,20 @@ class RenderDialog(Loggable):
self._time_spent_paused += time.time() - self._last_timestamp_when_pausing
self.debug(
"Resuming render after %d seconds in pause", self._time_spent_paused)
- self.project.pipeline.togglePlayback()
+ self.project.pipeline.toggle_playback()
- def _destroyProgressWindow(self):
+ def _destroy_progress_window(self):
"""Handles the completion or the cancellation of the render process."""
self.progress.window.destroy()
self.progress = None
self.window.show() # Show the rendering dialog again
- def _disconnectFromGst(self):
+ def _disconnect_from_gst(self):
for obj, handler_id in self._gst_signal_handlers_ids.items():
obj.disconnect(handler_id)
self._gst_signal_handlers_ids = {}
try:
- self.project.pipeline.disconnect_by_func(self._updatePositionCb)
+ self.project.pipeline.disconnect_by_func(self._update_position_cb)
except TypeError:
# The render was successful, so this was already disconnected
pass
@@ -1006,7 +1006,7 @@ class RenderDialog(Loggable):
# Use HQ Proxy (or equivalent) only for unsupported assets
if self.__automatically_use_proxies.get_active():
- if self.app.proxy_manager.isAssetFormatWellSupported(
+ if self.app.proxy_manager.is_asset_format_well_supported(
asset_target):
return asset_target
else:
@@ -1018,7 +1018,7 @@ class RenderDialog(Loggable):
return None
if self.app.proxy_manager.is_scaled_proxy(asset):
- width, height = self.project.getVideoWidthAndHeight(render=True)
+ width, height = self.project.get_video_width_and_height(render=True)
stream = asset.get_info().get_video_streams()[0]
asset_res = [stream.get_width(), stream.get_height()]
@@ -1029,7 +1029,7 @@ class RenderDialog(Loggable):
return None
hq_proxy = GES.Asset.request(GES.UriClip,
- self.app.proxy_manager.getProxyUri(asset_target))
+ self.app.proxy_manager.get_proxy_uri(asset_target))
return hq_proxy
return None
@@ -1050,16 +1050,16 @@ class RenderDialog(Loggable):
# ------------------- Callbacks ------------------------------------------ #
# -- UI callbacks
- def _okButtonClickedCb(self, unused_button, media_type):
+ def _ok_button_clicked_cb(self, unused_button, media_type):
assert media_type in ("audio", "video")
- setattr(self.project, media_type[0] + 'codecsettings', self.dialog.getSettings())
+ setattr(self.project, media_type[0] + 'codecsettings', self.dialog.get_settings())
caps = self.dialog.get_caps()
if caps:
getattr(self.project, media_type + '_profile').set_format(caps)
self.dialog.window.destroy()
- def _renderButtonClickedCb(self, unused_button):
+ def _render_button_clicked_cb(self, unused_button):
"""Starts the rendering process."""
self.__replace_proxies()
self.outfile = os.path.join(self.filebutton.get_uri(),
@@ -1072,30 +1072,30 @@ class RenderDialog(Loggable):
self.project.set_rendering(True)
self._pipeline.set_render_settings(
self.outfile, self.project.container_profile)
- self.startAction()
+ self.start_action()
self.progress.window.show()
- self.progress.connect("cancel", self._cancelRender)
- self.progress.connect("pause", self._pauseRender)
+ self.progress.connect("cancel", self._cancel_render)
+ self.progress.connect("pause", self._pause_render)
bus = self._pipeline.get_bus()
bus.add_signal_watch()
- self._gst_signal_handlers_ids[bus] = bus.connect('message', self._busMessageCb)
- self.project.pipeline.connect("position", self._updatePositionCb)
+ self._gst_signal_handlers_ids[bus] = bus.connect('message', self._bus_message_cb)
+ self.project.pipeline.connect("position", self._update_position_cb)
# Force writing the config now, or the path will be reset
# if the user opens the rendering dialog again
self.app.settings.lastExportFolder = self.filebutton.get_current_folder(
)
- self.app.settings.storeSettings()
+ self.app.settings.store_settings()
- def _closeButtonClickedCb(self, unused_button):
+ def _close_button_clicked_cb(self, unused_button):
self.debug("Render dialog's Close button clicked")
self.project.disconnect_by_func(self._rendering_settings_changed_cb)
self.destroy()
- def _deleteEventCb(self, unused_window, unused_event):
+ def _delete_event_cb(self, unused_window, unused_event):
self.debug("Render dialog is being deleted")
self.destroy()
- def _containerContextHelpClickedCb(self, unused_button):
+ def _container_context_help_clicked_cb(self, unused_button):
show_user_manual("codecscontainers")
def _current_folder_changed_cb(self, *unused_args):
@@ -1105,7 +1105,7 @@ class RenderDialog(Loggable):
self._check_filename()
# Periodic (timer) callbacks
- def _updateTimeEstimateCb(self):
+ def _update_time_estimate_cb(self):
if self._rendering_is_paused:
# Do nothing until we resume rendering
return True
@@ -1117,20 +1117,20 @@ class RenderDialog(Loggable):
remaining_time = estimated_time - timediff
estimate = beautify_eta(int(remaining_time * Gst.SECOND))
if estimate:
- self.progress.updateProgressbarETA(estimate)
+ self.progress.update_progressbar_eta(estimate)
return True
else:
self._time_estimate_timer = None
self.debug("Stopping the ETA timer")
return False
- def _updateFilesizeEstimateCb(self):
+ def _update_filesize_estimate_cb(self):
if self._rendering_is_paused:
return True # Do nothing until we resume rendering
elif self._is_rendering:
- est_filesize = self._getFilesizeEstimate()
+ est_filesize = self._get_filesize_estimate()
if est_filesize:
- self.progress.setFilesizeEstimate(est_filesize)
+ self.progress.set_filesize_estimate(est_filesize)
return True
else:
self.debug("Stopping the filesize estimation timer")
@@ -1138,18 +1138,18 @@ class RenderDialog(Loggable):
return False # Stop the timer
# GStreamer callbacks
- def _busMessageCb(self, unused_bus, message):
+ def _bus_message_cb(self, unused_bus, message):
if message.type == Gst.MessageType.EOS: # Render complete
self.debug("got EOS message, render complete")
- self._shutDown()
+ self._shut_down()
self.progress.progressbar.set_fraction(1.0)
self.progress.progressbar.set_text(_("Render complete"))
self.progress.window.set_title(_("Render complete"))
- self.progress.setFilesizeEstimate(None)
+ self.progress.set_filesize_estimate(None)
if not self.progress.window.is_active():
notification = _(
'"%s" has finished rendering.') % self.fileentry.get_text()
- self.notification = self.app.system.desktopMessage(
+ self.notification = self.app.system.desktop_message(
_("Render complete"), notification, "pitivi")
self._maybe_play_finished_sound()
self.progress.play_rendered_file_button.show()
@@ -1162,8 +1162,8 @@ class RenderDialog(Loggable):
# Errors in a GStreamer pipeline are fatal. If we encounter one,
# we should abort and show the error instead of sitting around.
error, details = message.parse_error()
- self._cancelRender()
- self._showRenderErrorDialog(error, details)
+ self._cancel_render()
+ self._show_render_error_dialog(error, details)
elif message.type == Gst.MessageType.STATE_CHANGED and self.progress:
if message.src == self._pipeline:
@@ -1177,7 +1177,7 @@ class RenderDialog(Loggable):
else:
self.app.simple_uninhibit(RenderDialog.INHIBIT_REASON)
- def _updatePositionCb(self, unused_pipeline, position):
+ def _update_position_cb(self, unused_pipeline, position):
"""Updates the progress bar and triggers the update of the file size.
This one occurs every time the pipeline emits a position changed signal,
@@ -1189,7 +1189,7 @@ class RenderDialog(Loggable):
length = self.project.ges_timeline.props.duration
fraction = float(min(position, length)) / float(length)
- self.progress.updatePosition(fraction)
+ self.progress.update_position(fraction)
# In order to have enough averaging, only display the ETA after 5s
timediff = time.time() - self._time_started
@@ -1198,12 +1198,12 @@ class RenderDialog(Loggable):
self.progress.progressbar.set_text(_("Estimating..."))
else:
self._time_estimate_timer = GLib.timeout_add_seconds(
- 3, self._updateTimeEstimateCb)
+ 3, self._update_time_estimate_cb)
# Filesize is trickier and needs more time to be meaningful.
if not self._filesize_estimate_timer and (fraction > 0.33 or timediff > 180):
self._filesize_estimate_timer = GLib.timeout_add_seconds(
- 5, self._updateFilesizeEstimateCb)
+ 5, self._update_filesize_estimate_cb)
def __element_added_cb(self, unused_bin, gst_element):
self.__set_properties(gst_element)
@@ -1222,39 +1222,39 @@ class RenderDialog(Loggable):
self.debug("Setting %s to %s", propname, value)
# Settings changed callbacks
- def _scaleSpinbuttonChangedCb(self, unused_button):
+ def _scale_spinbutton_changed_cb(self, unused_button):
render_scale = self.scale_spinbutton.get_value()
self.project.render_scale = render_scale
- self.updateResolution()
+ self.update_resolution()
- def updateResolution(self):
- width, height = self.project.getVideoWidthAndHeight(render=True)
+ def update_resolution(self):
+ width, height = self.project.get_video_width_and_height(render=True)
self.resolution_label.set_text("%d×%d" % (width, height))
- def _projectSettingsButtonClickedCb(self, unused_button):
+ def _project_settings_button_clicked_cb(self, unused_button):
from pitivi.project import ProjectSettingsDialog
dialog = ProjectSettingsDialog(self.window, self.project, self.app)
dialog.window.run()
- def _audioOutputCheckbuttonToggledCb(self, unused_audio):
+ def _audio_output_checkbutton_toggled_cb(self, unused_audio):
self._update_audio_widgets_sensitivity()
- def _videoOutputCheckbuttonToggledCb(self, unused_video):
+ def _video_output_checkbutton_toggled_cb(self, unused_video):
self._update_video_widgets_sensitivity()
- def __updateRenderButtonSensitivity(self):
+ def __update_render_button_sensitivity(self):
video_enabled = self.video_output_checkbutton.get_active()
audio_enabled = self.audio_output_checkbutton.get_active()
self.render_button.set_sensitive(self._is_filename_valid and
(video_enabled or audio_enabled))
- def _frameRateComboChangedCb(self, combo):
+ def _frame_rate_combo_changed_cb(self, combo):
if self._setting_encoding_profile:
return
framerate = get_combo_value(combo)
self.project.videorate = framerate
- def _videoEncoderComboChangedCb(self, combo):
+ def _video_encoder_combo_changed_cb(self, combo):
if self._setting_encoding_profile:
return
factory = get_combo_value(combo)
@@ -1266,23 +1266,23 @@ class RenderDialog(Loggable):
self.preferred_vencoder = name
self._update_valid_video_restrictions(factory)
- def _videoSettingsButtonClickedCb(self, unused_button):
+ def _video_settings_button_clicked_cb(self, unused_button):
if self._setting_encoding_profile:
return
factory = get_combo_value(self.video_encoder_combo)
- self._elementSettingsDialog(factory, 'video')
+ self._element_settings_dialog(factory, 'video')
- def _channelsComboChangedCb(self, combo):
+ def _channels_combo_changed_cb(self, combo):
if self._setting_encoding_profile:
return
self.project.audiochannels = get_combo_value(combo)
- def _sampleRateComboChangedCb(self, combo):
+ def _sample_rate_combo_changed_cb(self, combo):
if self._setting_encoding_profile:
return
self.project.audiorate = get_combo_value(combo)
- def _audioEncoderChangedComboCb(self, combo):
+ def _audio_encoder_changed_combo_cb(self, combo):
if self._setting_encoding_profile:
return
factory = get_combo_value(combo)
@@ -1294,11 +1294,11 @@ class RenderDialog(Loggable):
self.preferred_aencoder = name
self._update_valid_audio_restrictions(factory)
- def _audioSettingsButtonClickedCb(self, unused_button):
+ def _audio_settings_button_clicked_cb(self, unused_button):
factory = get_combo_value(self.audio_encoder_combo)
- self._elementSettingsDialog(factory, 'audio')
+ self._element_settings_dialog(factory, 'audio')
- def _muxerComboChangedCb(self, combo):
+ def _muxer_combo_changed_cb(self, combo):
"""Handles the changing of the container format combobox."""
if self._setting_encoding_profile:
return
@@ -1307,7 +1307,7 @@ class RenderDialog(Loggable):
# Update the extension of the filename.
basename = os.path.splitext(self.fileentry.get_text())[0]
- self.updateFilename(basename)
+ self.update_filename(basename)
# Update muxer-dependent widgets.
- self.updateAvailableEncoders()
+ self.update_available_encoders()
diff --git a/pitivi/settings.py b/pitivi/settings.py
index f972d2b9..dc559648 100644
--- a/pitivi/settings.py
+++ b/pitivi/settings.py
@@ -96,10 +96,10 @@ class Notification:
def __init__(self, attrname):
self.attrname = "_" + attrname
- self.signame = self.signalName(attrname)
+ self.signame = self.signal_name(attrname)
@staticmethod
- def signalName(attrname):
+ def signal_name(attrname):
return attrname + "Changed"
def __get__(self, instance, unused):
@@ -118,7 +118,7 @@ class GlobalSettings(GObject.Object, Loggable):
- environment variables.
Modules declare which settings they wish to access by calling the
- addConfigOption() class method during initialization.
+ add_config_option() class method during initialization.
Attributes:
options (dict): The available settings.
@@ -135,8 +135,8 @@ class GlobalSettings(GObject.Object, Loggable):
self.conf_file_path = os.path.join(xdg_config_home(), "pitivi.conf")
self._config = configparser.ConfigParser()
- self._readSettingsFromConfigurationFile()
- self._readSettingsFromEnvironmentVariables()
+ self._read_settings_from_configuration_file()
+ self._read_settings_from_environment_variables()
def reload_attribute_from_file(self, section, attrname):
"""Reads and sets an attribute from the configuration file.
@@ -185,7 +185,7 @@ class GlobalSettings(GObject.Object, Loggable):
else:
self._config.set(section, key, str(value))
- def _readSettingsFromConfigurationFile(self):
+ def _read_settings_from_configuration_file(self):
"""Reads the settings from the user configuration file."""
try:
self._config.read(self.conf_file_path)
@@ -197,7 +197,7 @@ class GlobalSettings(GObject.Object, Loggable):
self.error("Failed to parse %s: %s", self.conf_file_path, e)
return
- for (section, attrname, typ, key, unused_env, value) in self.iterAllOptions():
+ for (section, attrname, typ, key, unused_env, value) in self.iter_all_options():
if not self._config.has_section(section):
continue
if key and self._config.has_option(section, key):
@@ -229,9 +229,9 @@ class GlobalSettings(GObject.Object, Loggable):
setattr(self, section + option, value)
- def _readSettingsFromEnvironmentVariables(self):
+ def _read_settings_from_environment_variables(self):
"""Reads settings from their registered environment variables."""
- for unused_section, attrname, typ, unused_key, env, unused_value in self.iterAllOptions():
+ for unused_section, attrname, typ, unused_key, env, unused_value in self.iter_all_options():
if not env:
# This option does not have an environment variable name.
continue
@@ -239,8 +239,8 @@ class GlobalSettings(GObject.Object, Loggable):
if var is not None:
setattr(self, attrname, var)
- def _writeSettingsToConfigurationFile(self):
- for section, unused_attrname, unused_typ, key, unused_env_var, value in self.iterAllOptions():
+ def _write_settings_to_configuration_file(self):
+ for section, unused_attrname, unused_typ, key, unused_env_var, value in self.iter_all_options():
if not self._config.has_section(section):
self._config.add_section(section)
if key:
@@ -254,24 +254,24 @@ class GlobalSettings(GObject.Object, Loggable):
except (IOError, OSError) as e:
self.error("Failed to write to %s: %s", self.conf_file_path, e)
- def storeSettings(self):
+ def store_settings(self):
"""Writes settings to the user's local configuration file.
Only those settings which were added with a section and a key value are
stored.
"""
- self._writeSettingsToConfigurationFile()
+ self._write_settings_to_configuration_file()
- def iterAllOptions(self):
+ def iter_all_options(self):
"""Iterates over all registered options."""
for section, options in list(self.options.items()):
for attrname, (typ, key, environment) in list(options.items()):
yield section, attrname, typ, key, environment, getattr(self, attrname)
- def isDefault(self, attrname):
+ def is_default(self, attrname):
return getattr(self, attrname) == self.defaults[attrname]
- def setDefault(self, attrname):
+ def set_default(self, attrname):
"""Resets the specified setting to its default value."""
setattr(self, attrname, self.defaults[attrname])
@@ -303,8 +303,8 @@ class GlobalSettings(GObject.Object, Loggable):
self._config.set(section, option, value)
@classmethod
- def addConfigOption(cls, attrname, type_=None, section=None, key=None,
- environment=None, default=None, notify=False,):
+ def add_config_option(cls, attrname, type_=None, section=None, key=None,
+ environment=None, default=None, notify=False,):
"""Adds a configuration option.
This function should be called during module initialization, before
@@ -321,7 +321,7 @@ class GlobalSettings(GObject.Object, Loggable):
`default` value is specified.
section (Optional[str]): The section of the config file under which
this option is saved. This section must have been added with
- addConfigSection(). Not necessary if `key` is not given.
+ add_config_section(). Not necessary if `key` is not given.
key (Optional[str]): The key under which this option is to be saved.
By default the option will not be saved.
notify (Optional[bool]): Whether this attribute should emit
@@ -360,7 +360,7 @@ class GlobalSettings(GObject.Object, Loggable):
cls.defaults[attrname] = default
@classmethod
- def addConfigSection(cls, section):
+ def add_config_section(cls, section):
"""Adds a section to the local config file.
Args:
@@ -371,7 +371,7 @@ class GlobalSettings(GObject.Object, Loggable):
cls.options[section] = {}
@classmethod
- def notifiesConfigOption(cls, attrname):
+ def notifies_config_option(cls, attrname):
"""Checks whether a signal is emitted when the setting is changed.
Args:
@@ -381,5 +381,5 @@ class GlobalSettings(GObject.Object, Loggable):
bool: True when the setting emits a signal when changed,
False otherwise.
"""
- signal_name = Notification.signalName(attrname)
+ signal_name = Notification.signal_name(attrname)
return bool(GObject.signal_lookup(signal_name, cls))
diff --git a/pitivi/tabsmanager.py b/pitivi/tabsmanager.py
index 1ef0366b..e08723c1 100644
--- a/pitivi/tabsmanager.py
+++ b/pitivi/tabsmanager.py
@@ -132,30 +132,30 @@ class BaseTabs(Gtk.Notebook, Loggable):
def _create_default_config(self, child_name):
"""Creates default settings to save the state of a detachable widget."""
try:
- GlobalSettings.addConfigSection(child_name)
+ GlobalSettings.add_config_section(child_name)
except ConfigError:
self.info("Section %s already exists", child_name)
return
- GlobalSettings.addConfigOption(child_name + "docked",
- section=child_name,
- key="docked",
- default=True)
- GlobalSettings.addConfigOption(child_name + "width",
- section=child_name,
- key="width",
- default=320)
- GlobalSettings.addConfigOption(child_name + "height",
- section=child_name,
- key="height",
- default=400)
- GlobalSettings.addConfigOption(child_name + "x",
- section=child_name,
- key="x",
- default=0)
- GlobalSettings.addConfigOption(child_name + "y",
- section=child_name,
- key="y",
- default=0)
+ GlobalSettings.add_config_option(child_name + "docked",
+ section=child_name,
+ key="docked",
+ default=True)
+ GlobalSettings.add_config_option(child_name + "width",
+ section=child_name,
+ key="width",
+ default=320)
+ GlobalSettings.add_config_option(child_name + "height",
+ section=child_name,
+ key="height",
+ default=400)
+ GlobalSettings.add_config_option(child_name + "x",
+ section=child_name,
+ key="x",
+ default=0)
+ GlobalSettings.add_config_option(child_name + "y",
+ section=child_name,
+ key="y",
+ default=0)
self.settings.read_setting_section_from_file(child_name)
diff --git a/pitivi/timeline/elements.py b/pitivi/timeline/elements.py
index b53f803d..45b57fad 100644
--- a/pitivi/timeline/elements.py
+++ b/pitivi/timeline/elements.py
@@ -154,23 +154,23 @@ class KeyframeCurve(FigureCanvas, Loggable):
self.__hovered = False
- self.connect("motion-notify-event", self.__gtkMotionEventCb)
- self.connect("event", self._eventCb)
- self.connect("notify::height-request", self.__heightRequestCb)
+ self.connect("motion-notify-event", self.__gtk_motion_event_cb)
+ self.connect("event", self._event_cb)
+ self.connect("notify::height-request", self.__height_request_cb)
self.mpl_connect('button_press_event', self._mpl_button_press_event_cb)
self.mpl_connect('button_release_event', self._mpl_button_release_event_cb)
self.mpl_connect('motion_notify_event', self._mpl_motion_event_cb)
def release(self):
- disconnect_all_by_func(self, self.__heightRequestCb)
- disconnect_all_by_func(self, self.__gtkMotionEventCb)
- disconnect_all_by_func(self, self._controlSourceChangedCb)
+ disconnect_all_by_func(self, self.__height_request_cb)
+ disconnect_all_by_func(self, self.__gtk_motion_event_cb)
+ disconnect_all_by_func(self, self._control_source_changed_cb)
def _connect_sources(self):
- self.__source.connect("value-added", self._controlSourceChangedCb)
- self.__source.connect("value-removed", self._controlSourceChangedCb)
- self.__source.connect("value-changed", self._controlSourceChangedCb)
+ self.__source.connect("value-added", self._control_source_changed_cb)
+ self.__source.connect("value-removed", self._control_source_changed_cb)
+ self.__source.connect("value-changed", self._control_source_changed_cb)
def _update_plots(self):
values = self.__source.get_all()
@@ -188,7 +188,7 @@ class KeyframeCurve(FigureCanvas, Loggable):
def _populate_lines(self):
self._ax.set_xlim(self._line_xs[0], self._line_xs[-1])
- self.__computeYlim()
+ self.__compute_ylim()
arr = numpy.array((self._line_xs, self._line_ys))
arr = arr.transpose()
@@ -198,7 +198,7 @@ class KeyframeCurve(FigureCanvas, Loggable):
self.queue_draw()
# Private methods
- def __computeYlim(self):
+ def __compute_ylim(self):
height = self.props.height_request
if height <= 0:
@@ -208,10 +208,10 @@ class KeyframeCurve(FigureCanvas, Loggable):
ylim_max = (self.__ylim_max * height) / (height - KEYFRAME_LINE_HEIGHT)
self._ax.set_ylim(ylim_min, ylim_max)
- def __heightRequestCb(self, unused_self, unused_pspec):
- self.__computeYlim()
+ def __height_request_cb(self, unused_self, unused_pspec):
+ self.__compute_ylim()
- def __maybeCreateKeyframe(self, event):
+ def __maybe_create_keyframe(self, event):
line_contains = self.__line.contains(event)[0]
keyframe_existed = self._keyframes.contains(event)[0]
if line_contains and not keyframe_existed:
@@ -255,18 +255,18 @@ class KeyframeCurve(FigureCanvas, Loggable):
self.__source.set(offset, value)
# Callbacks
- def _controlSourceChangedCb(self, unused_control_source, unused_timed_value):
+ def _control_source_changed_cb(self, unused_control_source, unused_timed_value):
self._update_plots()
self._timeline.ges_timeline.get_parent().commit_timeline()
- def __gtkMotionEventCb(self, unused_widget, unused_event):
+ def __gtk_motion_event_cb(self, unused_widget, unused_event):
# We need to do this here, because Matplotlib's callbacks can't stop
# signal propagation.
if self.handling_motion:
return True
return False
- def _eventCb(self, unused_element, event):
+ def _event_cb(self, unused_element, event):
if event.type == Gdk.EventType.LEAVE_NOTIFY:
cursor = NORMAL_CURSOR
self._timeline.get_window().set_cursor(cursor)
@@ -327,7 +327,7 @@ class KeyframeCurve(FigureCanvas, Loggable):
# The mouse event is in the figure boundaries.
if self._offset is not None:
self._dragged = True
- keyframe_ts = self.__computeKeyframeNewTimestamp(event)
+ keyframe_ts = self.__compute_keyframe_new_timestamp(event)
ydata = max(self.__ylim_min, min(event.ydata, self.__ylim_max))
self._move_keyframe(int(self._offset), keyframe_ts, ydata)
@@ -369,8 +369,8 @@ class KeyframeCurve(FigureCanvas, Loggable):
event_widget = Gtk.get_event_widget(event.guiEvent)
x, unused_y = event_widget.translate_coordinates(self._timeline.layout.layers_vbox,
event.x, event.y)
- ges_clip = self._timeline.selection.getSingleClip(GES.Clip)
- event.xdata = Zoomable.pixelToNs(x) - ges_clip.props.start + ges_clip.props.in_point
+ ges_clip = self._timeline.selection.get_single_clip(GES.Clip)
+ event.xdata = Zoomable.pixel_to_ns(x) - ges_clip.props.start + ges_clip.props.in_point
if self._offset is not None:
# If dragging a keyframe, make sure the keyframe ends up exactly
@@ -378,7 +378,7 @@ class KeyframeCurve(FigureCanvas, Loggable):
# seek exactly on the keyframe.
if self._dragged:
if event.ydata is not None:
- keyframe_ts = self.__computeKeyframeNewTimestamp(event)
+ keyframe_ts = self.__compute_keyframe_new_timestamp(event)
ydata = max(self.__ylim_min, min(event.ydata, self.__ylim_max))
self._move_keyframe(int(self._offset), keyframe_ts, ydata)
self.debug("Keyframe released")
@@ -390,7 +390,7 @@ class KeyframeCurve(FigureCanvas, Loggable):
if not self._dragged:
# The keyframe line was clicked, but not dragged
assert event.guiEvent.type == Gdk.EventType.BUTTON_RELEASE
- self.__maybeCreateKeyframe(event)
+ self.__maybe_create_keyframe(event)
self.handling_motion = False
self._offset = None
@@ -421,7 +421,7 @@ class KeyframeCurve(FigureCanvas, Loggable):
"{:.3f}".format(value))
self.set_tooltip_markup(markup)
- def __computeKeyframeNewTimestamp(self, event):
+ def __compute_keyframe_new_timestamp(self, event):
# The user can not change the timestamp of the first
# and last keyframes.
values = self.__source.get_all()
@@ -471,9 +471,9 @@ class MultipleKeyframeCurve(KeyframeCurve):
def _connect_sources(self):
for binding in self.__bindings:
source = binding.props.control_source
- source.connect("value-added", self._controlSourceChangedCb)
- source.connect("value-removed", self._controlSourceChangedCb)
- source.connect("value-changed", self._controlSourceChangedCb)
+ source.connect("value-added", self._control_source_changed_cb)
+ source.connect("value-removed", self._control_source_changed_cb)
+ source.connect("value-changed", self._control_source_changed_cb)
def _update_plots(self):
timestamps = []
@@ -523,7 +523,7 @@ class MultipleKeyframeCurve(KeyframeCurve):
if self._offset is not None and not self._dragged:
# A keyframe was clicked but not dragged, so we
# should select it by seeking to its position.
- source = self._timeline.selection.getSingleClip()
+ source = self._timeline.selection.get_single_clip()
assert source
position = int(self._offset) - source.props.in_point + source.props.start
@@ -556,8 +556,8 @@ class MultipleKeyframeCurve(KeyframeCurve):
keyframe.set_visible(False)
self.queue_draw()
- def _controlSourceChangedCb(self, control_source, timed_value):
- super()._controlSourceChangedCb(control_source, timed_value)
+ def _control_source_changed_cb(self, control_source, timed_value):
+ super()._control_source_changed_cb(control_source, timed_value)
self.__update_selected_keyframe()
self.__hide_special_keyframe(self.__hovered_keyframe)
@@ -566,12 +566,12 @@ class MultipleKeyframeCurve(KeyframeCurve):
def __update_selected_keyframe(self):
try:
- position = self._project.pipeline.getPosition()
+ position = self._project.pipeline.get_position()
except PipelineError:
self.warning("Could not get pipeline position")
return
- source = self._timeline.selection.getSingleClip()
+ source = self._timeline.selection.get_single_clip()
if source is None:
return
source_position = position - source.props.start + source.props.in_point
@@ -613,7 +613,7 @@ class TimelineElement(Gtk.Layout, Zoomable, Loggable):
self._ges_elem = element
self._ges_elem.selected = Selected()
self._ges_elem.selected.connect(
- "selected-changed", self.__selectedChangedCb)
+ "selected-changed", self.__selected_changed_cb)
self.__width = 0
self.__height = 0
@@ -623,11 +623,11 @@ class TimelineElement(Gtk.Layout, Zoomable, Loggable):
self.props.vexpand = True
- self.__previewer = self._getPreviewer()
+ self.__previewer = self._get_previewer()
if self.__previewer:
self.add(self.__previewer)
- self.__background = self._getBackground()
+ self.__background = self._get_background()
if self.__background:
self.add(self.__background)
@@ -638,7 +638,7 @@ class TimelineElement(Gtk.Layout, Zoomable, Loggable):
# We set up the default mixing property right here, if a binding was
# already set (when loading a project), it will be added later
# and override that one.
- self.showDefaultKeyframes(lazy_render=True)
+ self.show_default_keyframes(lazy_render=True)
def update_previewer(self):
"""Refreshes the previewer widget."""
@@ -650,7 +650,7 @@ class TimelineElement(Gtk.Layout, Zoomable, Loggable):
self.__previewer.release()
# Public API
- def setSize(self, width, height):
+ def set_size(self, width, height):
width = max(0, width)
self.set_size_request(width, height)
@@ -666,39 +666,39 @@ class TimelineElement(Gtk.Layout, Zoomable, Loggable):
self.__width = width
self.__height = height
- def showKeyframes(self, ges_elem, prop):
- self.__setKeyframes(ges_elem, prop)
+ def show_keyframes(self, ges_elem, prop):
+ self.__set_keyframes(ges_elem, prop)
binding = ges_elem.get_control_binding(prop.name)
self.__create_keyframe_curve([binding])
- def showDefaultKeyframes(self, lazy_render=False):
- self.__setKeyframes(self._ges_elem, self._getDefaultMixingProperty())
+ def show_default_keyframes(self, lazy_render=False):
+ self.__set_keyframes(self._ges_elem, self._get_default_mixing_property())
if not lazy_render:
self.__create_keyframe_curve()
- def showMultipleKeyframes(self, bindings):
+ def show_multiple_keyframes(self, bindings):
self.__controlled_property = None
self.__create_keyframe_curve(bindings)
- def __setKeyframes(self, ges_elem, prop):
- self.__removeKeyframes()
+ def __set_keyframes(self, ges_elem, prop):
+ self.__remove_keyframes()
self.__controlled_property = prop
if self.__controlled_property:
- self.__createControlBinding(ges_elem)
+ self.__create_control_binding(ges_elem)
- def __curveEnterCb(self, unused_keyframe_curve):
+ def __curve_enter_cb(self, unused_keyframe_curve):
self.emit("curve-enter")
- def __curveLeaveCb(self, unused_keyframe_curve):
+ def __curve_leave_cb(self, unused_keyframe_curve):
self.emit("curve-leave")
- def __removeKeyframes(self):
+ def __remove_keyframes(self):
if not self.keyframe_curve:
# Nothing to remove.
return
- self.keyframe_curve.disconnect_by_func(self.__curveEnterCb)
- self.keyframe_curve.disconnect_by_func(self.__curveLeaveCb)
+ self.keyframe_curve.disconnect_by_func(self.__curve_enter_cb)
+ self.keyframe_curve.disconnect_by_func(self.__curve_leave_cb)
self.remove(self.keyframe_curve)
self.keyframe_curve.release()
@@ -723,7 +723,7 @@ class TimelineElement(Gtk.Layout, Zoomable, Loggable):
def __create_keyframe_curve(self, bindings=None):
"""Creates required keyframe curve."""
- self.__removeKeyframes()
+ self.__remove_keyframes()
if not bindings:
bindings = [self._ges_elem.get_control_binding(self.__controlled_property.name)]
@@ -732,17 +732,17 @@ class TimelineElement(Gtk.Layout, Zoomable, Loggable):
else:
self.keyframe_curve = MultipleKeyframeCurve(self.timeline, bindings)
- self.keyframe_curve.connect("enter", self.__curveEnterCb)
- self.keyframe_curve.connect("leave", self.__curveLeaveCb)
+ self.keyframe_curve.connect("enter", self.__curve_enter_cb)
+ self.keyframe_curve.connect("leave", self.__curve_leave_cb)
self.keyframe_curve.set_size_request(self.__width, self.__height)
self.keyframe_curve.show()
self.__update_keyframe_curve_visibility()
- def __createControlBinding(self, element):
+ def __create_control_binding(self, element):
"""Creates the required ControlBinding and keyframes."""
if self.__controlled_property:
element.connect("control-binding-added",
- self.__controlBindingAddedCb)
+ self.__control_binding_added_cb)
binding = \
element.get_control_binding(self.__controlled_property.name)
@@ -756,7 +756,7 @@ class TimelineElement(Gtk.Layout, Zoomable, Loggable):
element.set_control_source(source,
self.__controlled_property.name, "direct")
- def __controlBindingAddedCb(self, unused_ges_elem, binding):
+ def __control_binding_added_cb(self, unused_ges_elem, binding):
if binding.props.name == self.__controlled_property.name:
self.__ensure_keyframes(binding)
@@ -772,7 +772,7 @@ class TimelineElement(Gtk.Layout, Zoomable, Loggable):
self.propagate_draw(self.keyframe_curve, cr)
# Callbacks
- def __selectedChangedCb(self, unused_selected, selected):
+ def __selected_changed_cb(self, unused_selected, selected):
if not self.keyframe_curve and self.__controlled_property and \
selected and len(self.timeline.selection) == 1:
self.__create_keyframe_curve()
@@ -792,7 +792,7 @@ class TimelineElement(Gtk.Layout, Zoomable, Loggable):
self.remove(self.keyframe_curve)
# Virtual methods
- def _getPreviewer(self):
+ def _get_previewer(self):
"""Gets a Gtk.Widget to be used as previewer.
This previewer will be automatically scaled to the width and
@@ -803,7 +803,7 @@ class TimelineElement(Gtk.Layout, Zoomable, Loggable):
"""
return None
- def _getBackground(self):
+ def _get_background(self):
"""Gets a Gtk.Widget to be used as background.
Returns:
@@ -811,7 +811,7 @@ class TimelineElement(Gtk.Layout, Zoomable, Loggable):
"""
return None
- def _getDefaultMixingProperty(self):
+ def _get_default_mixing_property(self):
"""Gets the property controlled by default by the keyframes.
Returns:
@@ -953,7 +953,7 @@ class VideoSource(TimelineElement):
unused_pspec):
self.__apply_new_size_if_needed()
- def _getBackground(self):
+ def _get_background(self):
return VideoBackground()
@@ -961,7 +961,7 @@ class TitleSource(VideoSource):
__gtype_name__ = "PitiviTitleSource"
- def _getDefaultMixingProperty(self):
+ def _get_default_mixing_property(self):
for spec in self._ges_elem.list_children_properties():
if spec.name == "alpha":
return spec
@@ -982,7 +982,7 @@ class VideoUriSource(VideoSource):
VideoSource.__init__(self, element, timeline)
self.get_style_context().add_class("VideoUriSource")
- def _getPreviewer(self):
+ def _get_previewer(self):
if isinstance(self._ges_elem, GES.ImageSource):
previewer = ImagePreviewer(self._ges_elem, self.timeline.app.settings.previewers_max_cpu)
else:
@@ -991,7 +991,7 @@ class VideoUriSource(VideoSource):
return previewer
- def _getDefaultMixingProperty(self):
+ def _get_default_mixing_property(self):
for spec in self._ges_elem.list_children_properties():
if spec.name == "alpha":
return spec
@@ -1012,16 +1012,16 @@ class AudioUriSource(TimelineElement):
TimelineElement.__init__(self, element, timeline)
self.get_style_context().add_class("AudioUriSource")
- def _getPreviewer(self):
+ def _get_previewer(self):
previewer = AudioPreviewer(self._ges_elem, self.timeline.app.settings.previewers_max_cpu)
previewer.get_style_context().add_class("AudioUriSource")
return previewer
- def _getBackground(self):
+ def _get_background(self):
return AudioBackground()
- def _getDefaultMixingProperty(self):
+ def _get_default_mixing_property(self):
for spec in self._ges_elem.list_children_properties():
if spec.name == "volume":
return spec
@@ -1103,7 +1103,7 @@ class Clip(Gtk.EventBox, Zoomable, Loggable):
self.audio_widget = None
self.video_widget = None
- self._setupWidget()
+ self._setup_widget()
self.__force_position_update = True
for ges_timeline_element in self.ges_clip.get_children(False):
@@ -1141,16 +1141,16 @@ class Clip(Gtk.EventBox, Zoomable, Loggable):
if target.name() == EFFECT_TARGET_ENTRY.target:
self.info("Adding effect %s", self.timeline.drop_data)
- self.timeline.selection.setSelection([self.ges_clip], SELECT)
- self.app.gui.editor.switchContextTab(self.ges_clip)
+ self.timeline.selection.set_selection([self.ges_clip], SELECT)
+ self.app.gui.editor.switch_context_tab(self.ges_clip)
- effect_info = self.app.effects.getInfo(self.timeline.drop_data)
+ effect_info = self.app.effects.get_info(self.timeline.drop_data)
pipeline = self.timeline.ges_timeline.get_parent()
with self.app.action_log.started("add effect",
finalizing_action=CommitTimelineFinalizingAction(pipeline),
toplevel=True):
self.add_effect(effect_info)
- self.timeline.cleanDropData()
+ self.timeline.clean_drop_data()
success = True
Gtk.drag_finish(context, success, False, timestamp)
@@ -1182,7 +1182,7 @@ class Clip(Gtk.EventBox, Zoomable, Loggable):
return effect
return None
- def updatePosition(self):
+ def update_position(self):
layer = self.layer
if not layer or layer != self.get_parent():
# Things are not settled yet.
@@ -1190,11 +1190,11 @@ class Clip(Gtk.EventBox, Zoomable, Loggable):
start = self.ges_clip.props.start
duration = self.ges_clip.props.duration
- x = self.nsToPixel(start)
+ x = self.ns_to_pixel(start)
# The calculation of the width assumes that the start is always
# int(pixels_float). In that case, the rounding can add up and a pixel
# might be lost if we ignore the start of the clip.
- width = self.nsToPixel(start + duration) - x
+ width = self.ns_to_pixel(start + duration) - x
parent_height = layer.props.height_request
y = 0
@@ -1219,7 +1219,7 @@ class Clip(Gtk.EventBox, Zoomable, Loggable):
elements = self._elements_container.get_children()
for child in elements:
- child.setSize(width, height / len(elements))
+ child.set_size(width, height / len(elements))
self.__force_position_update = False
# pylint: disable=attribute-defined-outside-init
@@ -1229,10 +1229,10 @@ class Clip(Gtk.EventBox, Zoomable, Loggable):
self._current_parent_height = parent_height
self._current_parent = layer
- def _setupWidget(self):
+ def _setup_widget(self):
pass
- def _addTrimHandles(self):
+ def _add_trim_handles(self):
overlay = Gtk.Overlay()
self.add(overlay)
@@ -1248,13 +1248,13 @@ class Clip(Gtk.EventBox, Zoomable, Loggable):
self.handles.append(self.left_handle)
self.handles.append(self.right_handle)
- def shrinkTrimHandles(self):
+ def shrink_trim_handles(self):
for handle in self.handles:
handle.shrink()
def do_map(self):
Gtk.EventBox.do_map(self)
- self.updatePosition()
+ self.update_position()
def _button_release_event_cb(self, unused_widget, event):
if self.timeline.got_dragged:
@@ -1277,7 +1277,7 @@ class Clip(Gtk.EventBox, Zoomable, Loggable):
clicked_layer, click_pos = self.timeline.get_clicked_layer_and_pos(event)
self.timeline.set_selection_meta_info(clicked_layer, click_pos, mode)
else:
- self.app.gui.editor.switchContextTab(self.ges_clip)
+ self.app.gui.editor.switch_context_tab(self.ges_clip)
parent = self.ges_clip.get_toplevel_parent()
if parent is self.ges_clip:
@@ -1285,13 +1285,13 @@ class Clip(Gtk.EventBox, Zoomable, Loggable):
else:
selection = [elem for elem in parent.get_children(True)
if isinstance(elem, (GES.SourceClip, GES.TransitionClip))]
- self.timeline.selection.setSelection(selection, mode)
+ self.timeline.selection.set_selection(selection, mode)
return False
def release(self):
for child in self.ges_clip.get_children(True):
- self.__disconnectFromChild(child)
+ self.__disconnect_from_child(child)
disconnect_all_by_func(self.ges_clip, self._start_changed_cb)
disconnect_all_by_func(self.ges_clip, self._duration_changed_cb)
@@ -1299,11 +1299,11 @@ class Clip(Gtk.EventBox, Zoomable, Loggable):
disconnect_all_by_func(self.ges_clip, self._child_added_cb)
disconnect_all_by_func(self.ges_clip, self._child_removed_cb)
- def __showHandles(self):
+ def __show_handles(self):
for handle in self.handles:
handle.show()
- def __hideHandles(self):
+ def __hide_handles(self):
for handle in self.handles:
handle.hide()
@@ -1323,28 +1323,28 @@ class Clip(Gtk.EventBox, Zoomable, Loggable):
return False
def _start_changed_cb(self, clip, pspec):
- self.updatePosition()
+ self.update_position()
def _duration_changed_cb(self, clip, pspec):
- self.updatePosition()
+ self.update_position()
def _layer_changed_cb(self, ges_clip, pspec):
- self.updatePosition()
+ self.update_position()
- def __disconnectFromChild(self, child):
+ def __disconnect_from_child(self, child):
if child.ui:
child.ui.release()
def __connect_to_child(self, child):
if child.ui:
- child.ui.connect("curve-enter", self.__curveEnterCb)
- child.ui.connect("curve-leave", self.__curveLeaveCb)
+ child.ui.connect("curve-enter", self.__curve_enter_cb)
+ child.ui.connect("curve-leave", self.__curve_leave_cb)
- def __curveEnterCb(self, unused_keyframe_curve):
- self.__hideHandles()
+ def __curve_enter_cb(self, unused_keyframe_curve):
+ self.__hide_handles()
- def __curveLeaveCb(self, unused_keyframe_curve):
- self.__showHandles()
+ def __curve_leave_cb(self, unused_keyframe_curve):
+ self.__show_handles()
def _add_child(self, ges_timeline_element):
ges_timeline_element.selected = Selected()
@@ -1354,16 +1354,16 @@ class Clip(Gtk.EventBox, Zoomable, Loggable):
self.__force_position_update = True
self._add_child(ges_timeline_element)
self.__connect_to_child(ges_timeline_element)
- self.updatePosition()
+ self.update_position()
def _remove_child(self, ges_timeline_element):
pass
def _child_removed_cb(self, unused_ges_clip, ges_timeline_element):
self.__force_position_update = True
- self.__disconnectFromChild(ges_timeline_element)
+ self.__disconnect_from_child(ges_timeline_element)
self._remove_child(ges_timeline_element)
- self.updatePosition()
+ self.update_position()
class SourceClip(Clip):
@@ -1372,8 +1372,8 @@ class SourceClip(Clip):
def __init__(self, layer, ges_clip):
Clip.__init__(self, layer, ges_clip)
- def _setupWidget(self):
- self._addTrimHandles()
+ def _setup_widget(self):
+ self._add_trim_handles()
self.get_style_context().add_class("Clip")
@@ -1447,7 +1447,7 @@ class TransitionClip(Clip):
self.get_style_context().add_class("TransitionClip")
# In the case of TransitionClips, we are the only container
- self._addTrimHandles()
+ self._add_trim_handles()
self.props.has_tooltip = True
@@ -1469,9 +1469,9 @@ class TransitionClip(Clip):
self.z_order = 1
self.set_sensitive(True)
self.__has_video = True
- ges_timeline_element.selected.connect("selected-changed", self._selectedChangedCb,
ges_timeline_element)
+ ges_timeline_element.selected.connect("selected-changed", self._selected_changed_cb,
ges_timeline_element)
- def _selectedChangedCb(self, unused_selected, selected, ges_timeline_element):
+ def _selected_changed_cb(self, unused_selected, selected, ges_timeline_element):
if selected:
self.app.gui.editor.trans_list.activate(ges_timeline_element)
else:
diff --git a/pitivi/timeline/layer.py b/pitivi/timeline/layer.py
index f8ebc4b0..d765acca 100644
--- a/pitivi/timeline/layer.py
+++ b/pitivi/timeline/layer.py
@@ -82,13 +82,13 @@ class LayerControls(Gtk.EventBox, Loggable):
self.name_entry.props.valign = Gtk.Align.CENTER
self.name_entry.connect("focus-out-event", self.__name_focus_out_cb)
self.ges_layer.connect("notify-meta", self.__layer_rename_cb)
- self.__updateName()
+ self.__update_name()
name_row.pack_start(self.name_entry, True, True, 0)
self.menubutton = Gtk.MenuButton.new()
self.menubutton.props.valign = Gtk.Align.CENTER
self.menubutton.props.relief = Gtk.ReliefStyle.NONE
- model, action_group = self.__createMenuModel()
+ model, action_group = self.__create_menu_model()
popover = Gtk.Popover.new_from_model(self.menubutton, model)
popover.insert_action_group("layer", action_group)
popover.props.position = Gtk.PositionType.LEFT
@@ -99,51 +99,51 @@ class LayerControls(Gtk.EventBox, Loggable):
space.props.vexpand = True
vbox.pack_start(space, False, False, 0)
- self.ges_layer.connect("notify::priority", self.__layerPriorityChangedCb)
- self.ges_timeline.connect("layer-added", self.__timelineLayerAddedCb)
- self.ges_timeline.connect("layer-removed", self.__timelineLayerRemovedCb)
- self.__updateActions()
+ self.ges_layer.connect("notify::priority", self.__layer_priority_changed_cb)
+ self.ges_timeline.connect("layer-added", self.__timeline_layer_added_cb)
+ self.ges_timeline.connect("layer-removed", self.__timeline_layer_removed_cb)
+ self.__update_actions()
# When the window property is set, specify the mouse cursor.
- self.connect("notify::window", self.__windowSetCb)
+ self.connect("notify::window", self.__window_set_cb)
- def __windowSetCb(self, unused_window, unused_pspec):
+ def __window_set_cb(self, unused_window, unused_pspec):
self.props.window.set_cursor(Gdk.Cursor.new(Gdk.CursorType.HAND1))
def __del__(self):
self.name_entry.disconnect_by_func(self.__name_focus_out_cb)
self.ges_layer.disconnect_by_func(self.__layer_rename_cb)
- self.ges_layer.disconnect_by_func(self.__layerPriorityChangedCb)
- self.ges_timeline.disconnect_by_func(self.__timelineLayerAddedCb)
- self.ges_timeline.disconnect_by_func(self.__timelineLayerRemovedCb)
+ self.ges_layer.disconnect_by_func(self.__layer_priority_changed_cb)
+ self.ges_timeline.disconnect_by_func(self.__timeline_layer_added_cb)
+ self.ges_timeline.disconnect_by_func(self.__timeline_layer_removed_cb)
super().__del__()
def __layer_rename_cb(self, unused_ges_layer, item, value):
if not item == "video::name":
return
- self.__updateName()
+ self.__update_name()
def __name_focus_out_cb(self, unused_widget, unused_event):
- current_name = self.ges_layer.ui.getName()
+ current_name = self.ges_layer.ui.get_name()
name = self.name_entry.get_text()
if name == current_name:
return
with self.app.action_log.started("change layer name",
toplevel=True):
- self.ges_layer.ui.setName(name)
+ self.ges_layer.ui.set_name(name)
- def __layerPriorityChangedCb(self, unused_ges_layer, unused_pspec):
- self.__updateActions()
- self.__updateName()
+ def __layer_priority_changed_cb(self, unused_ges_layer, unused_pspec):
+ self.__update_actions()
+ self.__update_name()
- def __timelineLayerAddedCb(self, unused_timeline, unused_ges_layer):
- self.__updateActions()
+ def __timeline_layer_added_cb(self, unused_timeline, unused_ges_layer):
+ self.__update_actions()
- def __timelineLayerRemovedCb(self, unused_timeline, unused_ges_layer):
- self.__updateActions()
+ def __timeline_layer_removed_cb(self, unused_timeline, unused_ges_layer):
+ self.__update_actions()
- def __updateActions(self):
+ def __update_actions(self):
priority = self.ges_layer.get_priority()
first = priority == 0
self.__move_layer_up_action.props.enabled = not first
@@ -154,10 +154,10 @@ class LayerControls(Gtk.EventBox, Loggable):
self.__move_layer_bottom_action.props.enabled = not last
self.delete_layer_action.props.enabled = layers_count > 1
- def __updateName(self):
- self.name_entry.set_text(self.ges_layer.ui.getName())
+ def __update_name(self):
+ self.name_entry.set_text(self.ges_layer.ui.get_name())
- def __createMenuModel(self):
+ def __create_menu_model(self):
action_group = Gio.SimpleActionGroup()
menu_model = Gio.Menu()
@@ -212,7 +212,7 @@ class LayerControls(Gtk.EventBox, Loggable):
index = 0
else:
index = len(self.ges_timeline.get_layers()) - 1
- self.ges_timeline.ui.moveLayer(self.ges_layer, index)
+ self.ges_timeline.ui.move_layer(self.ges_layer, index)
self.app.project_manager.current_project.pipeline.commit_timeline()
def update(self, media_types):
@@ -249,8 +249,8 @@ class Layer(Gtk.Layout, Zoomable, Loggable):
self._children = []
self._changed = False
- self.ges_layer.connect("clip-added", self._clipAddedCb)
- self.ges_layer.connect("clip-removed", self._clipRemovedCb)
+ self.ges_layer.connect("clip-added", self._clip_added_cb)
+ self.ges_layer.connect("clip-removed", self._clip_removed_cb)
# The layer is always the width of the Timeline which contains it.
self.props.hexpand = True
@@ -259,27 +259,27 @@ class Layer(Gtk.Layout, Zoomable, Loggable):
self.media_types = GES.TrackType(0)
for ges_clip in ges_layer.get_clips():
self._add_clip(ges_clip)
- self.checkMediaTypes()
+ self.check_media_types()
- def setName(self, name):
+ def set_name(self, name):
self.ges_layer.set_meta("video::name", name)
- def _nameIfSet(self):
+ def _name_if_set(self):
name = self.ges_layer.get_meta("video::name")
if not name:
name = self.ges_layer.get_meta("audio::name")
return name
- def __nameIfMeaningful(self):
- name = self._nameIfSet()
+ def __name_if_meaningful(self):
+ name = self._name_if_set()
if name:
for pattern in ("video [0-9]+$", "audio [0-9]+$", "Layer [0-9]+$"):
if re.match(pattern, name):
return None
return name
- def getName(self):
- name = self.__nameIfMeaningful()
+ def get_name(self):
+ name = self.__name_if_meaningful()
if not name:
name = _('Layer %d') % self.ges_layer.get_priority()
return name
@@ -287,10 +287,10 @@ class Layer(Gtk.Layout, Zoomable, Loggable):
def release(self):
for ges_clip in self.ges_layer.get_clips():
self._remove_clip(ges_clip)
- self.ges_layer.disconnect_by_func(self._clipAddedCb)
- self.ges_layer.disconnect_by_func(self._clipRemovedCb)
+ self.ges_layer.disconnect_by_func(self._clip_added_cb)
+ self.ges_layer.disconnect_by_func(self._clip_removed_cb)
- def checkMediaTypes(self):
+ def check_media_types(self):
if self.timeline.editing_context:
self.info("Not updating media types as"
" we are editing the timeline")
@@ -318,17 +318,17 @@ class Layer(Gtk.Layout, Zoomable, Loggable):
self.ges_layer.control_ui.update(self.media_types)
if old_media_types != self.media_types:
- self.updatePosition()
+ self.update_position()
def _clip_child_added_cb(self, ges_clip, child):
- self.checkMediaTypes()
+ self.check_media_types()
def _clip_child_removed_cb(self, ges_clip, child):
- self.checkMediaTypes()
+ self.check_media_types()
- def _clipAddedCb(self, unused_ges_layer, ges_clip):
+ def _clip_added_cb(self, unused_ges_layer, ges_clip):
self._add_clip(ges_clip)
- self.checkMediaTypes()
+ self.check_media_types()
def _add_clip(self, ges_clip):
ui_type = elements.GES_TYPE_UI_TYPE.get(ges_clip.__gtype__, None)
@@ -339,17 +339,17 @@ class Layer(Gtk.Layout, Zoomable, Loggable):
widget = ui_type(self, ges_clip)
self._children.append(widget)
self._children.sort(key=lambda clip: clip.z_order)
- self.put(widget, self.nsToPixel(ges_clip.props.start), 0)
- widget.updatePosition()
+ self.put(widget, self.ns_to_pixel(ges_clip.props.start), 0)
+ widget.update_position()
self._changed = True
widget.show_all()
ges_clip.connect_after("child-added", self._clip_child_added_cb)
ges_clip.connect_after("child-removed", self._clip_child_removed_cb)
- def _clipRemovedCb(self, unused_ges_layer, ges_clip):
+ def _clip_removed_cb(self, unused_ges_layer, ges_clip):
self._remove_clip(ges_clip)
- self.checkMediaTypes()
+ self.check_media_types()
def _remove_clip(self, ges_clip):
if not ges_clip.ui:
@@ -369,10 +369,10 @@ class Layer(Gtk.Layout, Zoomable, Loggable):
ges_clip.disconnect_by_func(self._clip_child_added_cb)
ges_clip.disconnect_by_func(self._clip_child_removed_cb)
- def updatePosition(self):
+ def update_position(self):
for ges_clip in self.ges_layer.get_clips():
if hasattr(ges_clip, "ui"):
- ges_clip.ui.updatePosition()
+ ges_clip.ui.update_position()
def do_draw(self, cr):
if self._changed:
diff --git a/pitivi/timeline/markers.py b/pitivi/timeline/markers.py
index 2b6eb83f..a3b6550c 100644
--- a/pitivi/timeline/markers.py
+++ b/pitivi/timeline/markers.py
@@ -156,12 +156,12 @@ class MarkersBox(Gtk.EventBox, Zoomable, Loggable):
self.offset = hadj.get_value()
self._update_position()
- def zoomChanged(self):
+ def zoom_changed(self):
self._update_position()
def _update_position(self):
for marker in self.layout.get_children():
- position = self.nsToPixel(marker.position) - self.offset - MARKER_WIDTH / 2
+ position = self.ns_to_pixel(marker.position) - self.offset - MARKER_WIDTH / 2
self.layout.move(marker, position, 0)
# pylint: disable=arguments-differ
@@ -182,7 +182,7 @@ class MarkersBox(Gtk.EventBox, Zoomable, Loggable):
marker_popover.popup()
else:
- position = self.pixelToNs(event.x + self.offset)
+ position = self.pixel_to_ns(event.x + self.offset)
with self.app.action_log.started("Added marker", toplevel=True):
self.__markers_container.add(position)
self.marker_new.selected = True
@@ -208,7 +208,7 @@ class MarkersBox(Gtk.EventBox, Zoomable, Loggable):
if event_widget is self.marker_moving:
event_x, unused_y = event_widget.translate_coordinates(self, event.x, event.y)
event_x = max(0, event_x)
- position_ns = self.pixelToNs(event_x + self.offset)
+ position_ns = self.pixel_to_ns(event_x + self.offset)
self.__markers_container.move(self.marker_moving.ges_marker, position_ns)
def _marker_added_cb(self, unused_markers, position, ges_marker):
@@ -216,7 +216,7 @@ class MarkersBox(Gtk.EventBox, Zoomable, Loggable):
def _add_marker(self, position, ges_marker):
marker = Marker(ges_marker)
- x = self.nsToPixel(position) - self.offset - MARKER_WIDTH / 2
+ x = self.ns_to_pixel(position) - self.offset - MARKER_WIDTH / 2
self.layout.put(marker, x, 0)
marker.show()
self.marker_new = marker
@@ -236,7 +236,7 @@ class MarkersBox(Gtk.EventBox, Zoomable, Loggable):
self._move_marker(position, ges_marker)
def _move_marker(self, position, ges_marker):
- x = self.nsToPixel(position) - self.offset - MARKER_WIDTH / 2
+ x = self.ns_to_pixel(position) - self.offset - MARKER_WIDTH / 2
self.layout.move(ges_marker.ui, x, 0)
diff --git a/pitivi/timeline/previewers.py b/pitivi/timeline/previewers.py
index 2d88980a..81edd2fb 100644
--- a/pitivi/timeline/previewers.py
+++ b/pitivi/timeline/previewers.py
@@ -70,12 +70,12 @@ PREVIEW_GENERATOR_SIGNALS = {
"error": (GObject.SignalFlags.RUN_LAST, None, ()),
}
-GlobalSettings.addConfigSection("previewers")
+GlobalSettings.add_config_section("previewers")
-GlobalSettings.addConfigOption("previewers_max_cpu",
- section="previewers",
- key="max-cpu-usage",
- default=90)
+GlobalSettings.add_config_option("previewers_max_cpu",
+ section="previewers",
+ key="max-cpu-usage",
+ default=90)
class PreviewerBin(Gst.Bin, Loggable):
@@ -120,7 +120,7 @@ class TeedThumbnailBin(PreviewerBin):
self.thumb_cache = None
self.gdkpixbufsink = self.internal_bin.get_by_name("gdkpixbufsink")
- def __addThumbnail(self, message):
+ def __add_thumbnail(self, message):
struct = message.get_structure()
struct_name = struct.get_name()
if struct_name == "pixbuf":
@@ -134,7 +134,7 @@ class TeedThumbnailBin(PreviewerBin):
def do_post_message(self, message):
if message.type == Gst.MessageType.ELEMENT and \
message.src == self.gdkpixbufsink:
- GLib.idle_add(self.__addThumbnail, message)
+ GLib.idle_add(self.__add_thumbnail, message)
return Gst.Bin.do_post_message(self, message)
@@ -392,7 +392,7 @@ class Previewer(GObject.Object):
Returns:
int: a duration in nanos, multiple of THUMB_PERIOD.
"""
- interval = Zoomable.pixelToNs(thumb_width + THUMB_MARGIN_PX)
+ interval = Zoomable.pixel_to_ns(thumb_width + THUMB_MARGIN_PX)
# Make sure the thumb interval is a multiple of THUMB_PERIOD.
quantized = quantize(interval, THUMB_PERIOD)
# Make sure the quantized thumb interval fits
@@ -465,7 +465,7 @@ class ImagePreviewer(Gtk.Layout, Previewer, Zoomable, Loggable):
element_right = self.ges_elem.props.in_point + self.ges_elem.props.duration
y = (self.props.height_request - self.thumb_height) / 2
for position in range(element_left, element_right, interval):
- x = Zoomable.nsToPixel(position) - self.nsToPixel(self.ges_elem.props.in_point)
+ x = Zoomable.ns_to_pixel(position) - self.ns_to_pixel(self.ges_elem.props.in_point)
try:
thumb = self.thumbs.pop(position)
self.move(thumb, x, y)
@@ -481,7 +481,7 @@ class ImagePreviewer(Gtk.Layout, Previewer, Zoomable, Loggable):
self.remove(thumb)
self.thumbs = thumbs
- def zoomChanged(self):
+ def zoom_changed(self):
self._update_thumbnails()
def _height_changed_cb(self, unused_widget, unused_param_spec):
@@ -848,7 +848,7 @@ class VideoPreviewer(Gtk.Layout, AssetPreviewer, Zoomable):
element_right = self.ges_elem.props.in_point + self.ges_elem.props.duration
y = (self.props.height_request - self.thumb_height) / 2
for position in range(element_left, element_right, interval):
- x = Zoomable.nsToPixel(position) - self.nsToPixel(self.ges_elem.props.in_point)
+ x = Zoomable.ns_to_pixel(position) - self.ns_to_pixel(self.ges_elem.props.in_point)
try:
thumb = self.thumbs.pop(position)
self.move(thumb, x, y)
@@ -897,7 +897,7 @@ class VideoPreviewer(Gtk.Layout, AssetPreviewer, Zoomable):
"""Handles the changing of the duration of the clip."""
self._update_thumbnails()
- def zoomChanged(self):
+ def zoom_changed(self):
self._update_thumbnails()
@@ -982,7 +982,7 @@ class ThumbnailCache(Loggable):
raise ValueError("Unhandled type: %s" % type(obj))
if ProxyManager.is_proxy_asset(uri):
- uri = ProxyManager.getTargetUri(uri)
+ uri = ProxyManager.get_target_uri(uri)
if uri not in cls.caches_by_uri:
cls.caches_by_uri[uri] = ThumbnailCache(uri)
@@ -1076,7 +1076,7 @@ class ThumbnailCache(Loggable):
def get_wavefile_location_for_uri(uri):
"""Computes the URI where the wave.npy file should be stored."""
if ProxyManager.is_proxy_asset(uri):
- uri = ProxyManager.getTargetUri(uri)
+ uri = ProxyManager.get_target_uri(uri)
filename = hash_file(Gst.uri_get_location(uri)) + ".wave.npy"
cache_dir = get_dir(os.path.join(xdg_cache_home(), "waves"))
@@ -1125,7 +1125,7 @@ class AudioPreviewer(Gtk.Layout, Previewer, Zoomable, Loggable):
self.become_controlled()
- def _startLevelsDiscovery(self):
+ def _start_levels_discovery(self):
filename = get_wavefile_location_for_uri(self._uri)
if os.path.exists(filename):
with open(filename, "rb") as samples:
@@ -1133,7 +1133,7 @@ class AudioPreviewer(Gtk.Layout, Previewer, Zoomable, Loggable):
self.queue_draw()
else:
self.wavefile = filename
- self._launchPipeline()
+ self._launch_pipeline()
@staticmethod
def _scale_samples(samples):
@@ -1150,7 +1150,7 @@ class AudioPreviewer(Gtk.Layout, Previewer, Zoomable, Loggable):
return list(samples)
- def _launchPipeline(self):
+ def _launch_pipeline(self):
self.debug(
"Now generating waveforms for: %s", path_from_uri(self._uri))
self.pipeline = Gst.parse_launch("uridecodebin name=decode uri=" +
@@ -1172,15 +1172,15 @@ class AudioPreviewer(Gtk.Layout, Previewer, Zoomable, Loggable):
decode.connect("autoplug-select", self._autoplug_select_cb)
bus = self.pipeline.get_bus()
bus.add_signal_watch()
- bus.connect("message", self._busMessageCb)
+ bus.connect("message", self._bus_message_cb)
- def _prepareSamples(self):
+ def _prepare_samples(self):
self._wavebin.finalize()
self.samples = self._scale_samples(self._wavebin.samples)
- def _busMessageCb(self, bus, message):
+ def _bus_message_cb(self, bus, message):
if message.type == Gst.MessageType.EOS:
- self._prepareSamples()
+ self._prepare_samples()
self.queue_draw()
self.stop_generation()
@@ -1193,8 +1193,8 @@ class AudioPreviewer(Gtk.Layout, Previewer, Zoomable, Loggable):
" for the %ith time, trying again with no rate "
" modulation", message.parse_error(),
self._num_failures)
- bus.disconnect_by_func(self._busMessageCb)
- self._launchPipeline()
+ bus.disconnect_by_func(self._bus_message_cb)
+ self._launch_pipeline()
self.become_controlled()
else:
if self.pipeline:
@@ -1221,10 +1221,10 @@ class AudioPreviewer(Gtk.Layout, Previewer, Zoomable, Loggable):
rect = Gdk.cairo_get_clip_rectangle(context)[1]
inpoint = self.ges_elem.props.in_point
max_duration = self.ges_elem.get_asset().get_filesource_asset().get_duration()
- start_ns = min(max(0, self.pixelToNs(rect.x) + inpoint), max_duration)
- end_ns = min(max(0, self.pixelToNs(rect.x + rect.width) + inpoint), max_duration)
+ start_ns = min(max(0, self.pixel_to_ns(rect.x) + inpoint), max_duration)
+ end_ns = min(max(0, self.pixel_to_ns(rect.x + rect.width) + inpoint), max_duration)
- zoom = self.getCurrentZoomLevel()
+ zoom = self.get_current_zoom_level()
height = self.get_allocation().height
if not self.surface or \
height != self.surface.get_height() or \
@@ -1237,14 +1237,14 @@ class AudioPreviewer(Gtk.Layout, Previewer, Zoomable, Loggable):
self._surface_zoom_level = zoom
# The generated waveform is for an extended range if possible,
# so if the user scrolls we don't rebuild the waveform every time.
- extra = self.pixelToNs(WAVEFORM_SURFACE_EXTRA_PX)
+ extra = self.pixel_to_ns(WAVEFORM_SURFACE_EXTRA_PX)
self._surface_start_ns = max(0, start_ns - extra)
self._surface_end_ns = min(end_ns + extra, max_duration)
range_start = min(max(0, int(self._surface_start_ns / SAMPLE_DURATION)), len(self.samples))
range_end = min(max(0, int(self._surface_end_ns / SAMPLE_DURATION)), len(self.samples))
samples = self.samples[range_start:range_end]
- surface_width = self.nsToPixel(self._surface_end_ns - self._surface_start_ns)
+ surface_width = self.ns_to_pixel(self._surface_end_ns - self._surface_start_ns)
self.surface = renderer.fill_surface(samples, surface_width, height)
# Paint the surface, ignoring the clipped rect.
@@ -1253,7 +1253,7 @@ class AudioPreviewer(Gtk.Layout, Previewer, Zoomable, Loggable):
# the surface in context, if the entire asset would be drawn.
# 2. - inpoint, because we're drawing a clip, not the entire asset.
context.set_operator(cairo.OPERATOR_OVER)
- offset = self.nsToPixel(self._surface_start_ns - inpoint)
+ offset = self.ns_to_pixel(self._surface_start_ns - inpoint)
context.set_source_surface(self.surface, offset, 0)
context.paint()
@@ -1266,7 +1266,7 @@ class AudioPreviewer(Gtk.Layout, Previewer, Zoomable, Loggable):
def start_generation(self):
if not self.pipeline:
- self._startLevelsDiscovery()
+ self._start_levels_discovery()
else:
self.pipeline.set_state(Gst.State.PLAYING)
@@ -1280,7 +1280,7 @@ class AudioPreviewer(Gtk.Layout, Previewer, Zoomable, Loggable):
def stop_generation(self):
if self.pipeline:
self.pipeline.set_state(Gst.State.NULL)
- self.pipeline.get_bus().disconnect_by_func(self._busMessageCb)
+ self.pipeline.get_bus().disconnect_by_func(self._bus_message_cb)
self.pipeline = None
self.emit("done")
diff --git a/pitivi/timeline/ruler.py b/pitivi/timeline/ruler.py
index f7ff9bce..09e2e4e7 100644
--- a/pitivi/timeline/ruler.py
+++ b/pitivi/timeline/ruler.py
@@ -127,16 +127,16 @@ class ScaleRuler(Gtk.DrawingArea, Zoomable, Loggable):
# Zoomable interface override
- def zoomChanged(self):
+ def zoom_changed(self):
self.queue_draw()
# Timeline position changed method
- def setPipeline(self, pipeline):
+ def set_pipeline(self, pipeline):
self._pipeline = pipeline
- self._pipeline.connect('position', self.timelinePositionCb)
+ self._pipeline.connect('position', self.timeline_position_cb)
- def timelinePositionCb(self, unused_pipeline, position):
+ def timeline_position_cb(self, unused_pipeline, position):
self.position = position
self.queue_draw()
@@ -186,9 +186,9 @@ class ScaleRuler(Gtk.DrawingArea, Zoomable, Loggable):
# Draw on a temporary context and then copy everything.
drawing_context = cairo.Context(pixbuf)
- self.drawBackground(drawing_context)
- self.drawRuler(drawing_context)
- self.drawPosition(drawing_context)
+ self.draw_background(drawing_context)
+ self.draw_ruler(drawing_context)
+ self.draw_position(drawing_context)
pixbuf.flush()
context.set_source_surface(self.pixbuf, 0.0, 0.0)
@@ -203,7 +203,7 @@ class ScaleRuler(Gtk.DrawingArea, Zoomable, Loggable):
button = event.button
if button == 3 or (button == 1 and self.app.settings.leftClickAlsoSeeks):
self.debug("button pressed at x:%d", event.x)
- position = self.pixelToNs(event.x + self.pixbuf_offset)
+ position = self.pixel_to_ns(event.x + self.pixbuf_offset)
self._pipeline.simple_seek(position)
self.__set_tooltip_text(position, True)
return False
@@ -212,8 +212,8 @@ class ScaleRuler(Gtk.DrawingArea, Zoomable, Loggable):
button = event.button
if button == 3 or (button == 1 and self.app.settings.leftClickAlsoSeeks):
self.debug("button released at x:%d", event.x)
- self.app.gui.editor.focusTimeline()
- position = self.pixelToNs(event.x + self.pixbuf_offset)
+ self.app.gui.editor.focus_timeline()
+ position = self.pixel_to_ns(event.x + self.pixbuf_offset)
self.__set_tooltip_text(position)
return False
@@ -221,7 +221,7 @@ class ScaleRuler(Gtk.DrawingArea, Zoomable, Loggable):
if not self._pipeline:
return False
- position = self.pixelToNs(event.x + self.pixbuf_offset)
+ position = self.pixel_to_ns(event.x + self.pixbuf_offset)
seek_mask = Gdk.ModifierType.BUTTON3_MASK
if self.app.settings.leftClickAlsoSeeks:
@@ -238,7 +238,7 @@ class ScaleRuler(Gtk.DrawingArea, Zoomable, Loggable):
def do_scroll_event(self, event):
self.timeline.timeline.do_scroll_event(event)
- def setProjectFrameRate(self, rate):
+ def set_project_frame_rate(self, rate):
"""Sets the lowest scale based on the specified project framerate."""
self.frame_rate = rate
self.ns_per_frame = float(Gst.SECOND / self.frame_rate)
@@ -256,23 +256,23 @@ class ScaleRuler(Gtk.DrawingArea, Zoomable, Loggable):
# Drawing methods
- def drawBackground(self, context):
+ def draw_background(self, context):
width = context.get_target().get_width()
height = context.get_target().get_height()
style_context = self.app.gui.get_style_context()
Gtk.render_background(style_context, context, 0, 0, width, height)
- def drawRuler(self, context):
+ def draw_ruler(self, context):
context.set_font_face(NORMAL_FONT)
context.set_font_size(NORMAL_FONT_SIZE)
- spacing, interval_seconds, ticks = self._getSpacing(context)
+ spacing, interval_seconds, ticks = self._get_spacing(context)
offset = self.pixbuf_offset % spacing
- self.drawFrameBoundaries(context)
- self.drawTicks(context, offset, spacing, interval_seconds, ticks)
- self.drawTimes(context, offset, spacing, interval_seconds)
+ self.draw_frame_boundaries(context)
+ self.draw_ticks(context, offset, spacing, interval_seconds, ticks)
+ self.draw_times(context, offset, spacing, interval_seconds)
- def _getSpacing(self, context):
+ def _get_spacing(self, context):
# The longest timestamp we display is 0:00:00 because
# when we display millis, they are displayed by themselves.
min_interval_width = context.text_extents("0:00:00")[2] * 1.3
@@ -285,7 +285,7 @@ class ScaleRuler(Gtk.DrawingArea, Zoomable, Loggable):
"Failed to find an interval size for textwidth:%s, zoomratio:%s" %
(min_interval_width, Zoomable.zoomratio))
- def drawTicks(self, context, offset, spacing, interval_seconds, ticks):
+ def draw_ticks(self, context, offset, spacing, interval_seconds, ticks):
for tick_interval, height_ratio in reversed(ticks):
count_per_interval = interval_seconds / tick_interval
space = spacing / count_per_interval
@@ -298,10 +298,10 @@ class ScaleRuler(Gtk.DrawingArea, Zoomable, Loggable):
set_cairo_color(context, color)
while paintpos < context.get_target().get_width():
- self._drawTick(context, paintpos, height_ratio)
+ self._draw_tick(context, paintpos, height_ratio)
paintpos += space
- def _drawTick(self, context, paintpos, height_ratio):
+ def _draw_tick(self, context, paintpos, height_ratio):
# We need to use 0.5 pixel offsets to get a sharp 1 px line in cairo
paintpos = int(paintpos - 0.5) + 0.5
target_height = context.get_target().get_height()
@@ -312,10 +312,10 @@ class ScaleRuler(Gtk.DrawingArea, Zoomable, Loggable):
context.close_path()
context.stroke()
- def drawTimes(self, context, offset, spacing, interval_seconds):
+ def draw_times(self, context, offset, spacing, interval_seconds):
# figure out what the optimal offset is
interval = int(Gst.SECOND * interval_seconds)
- current_time = self.pixelToNs(self.pixbuf_offset)
+ current_time = self.pixel_to_ns(self.pixbuf_offset)
paintpos = TIMES_LEFT_MARGIN_PIXELS
if offset > 0:
current_time = current_time - (current_time % interval) + interval
@@ -336,12 +336,12 @@ class ScaleRuler(Gtk.DrawingArea, Zoomable, Loggable):
context.move_to(int(paintpos), 1 - y_bearing)
current = split(time_to_string(int(current_time)))
millis = current_time % Gst.SECOND > 0
- self._drawTime(context, current, previous, millis)
+ self._draw_time(context, current, previous, millis)
previous = current
paintpos += spacing
current_time += interval
- def _drawTime(self, context, current, previous, millis):
+ def _draw_time(self, context, current, previous, millis):
hour = int(current[0])
for index, (element, previous_element) in enumerate(zip(current, previous)):
if index <= 1 and not hour:
@@ -368,7 +368,7 @@ class ScaleRuler(Gtk.DrawingArea, Zoomable, Loggable):
if small:
context.set_font_size(NORMAL_FONT_SIZE)
- def drawFrameBoundaries(self, context):
+ def draw_frame_boundaries(self, context):
"""Draws the alternating rectangles that represent the project frames.
These are drawn only at high zoom levels.
@@ -376,7 +376,7 @@ class ScaleRuler(Gtk.DrawingArea, Zoomable, Loggable):
These are based on the project's framerate settings, not the actual
frames on the assets.
"""
- frame_width = self.nsToPixel(self.ns_per_frame)
+ frame_width = self.ns_to_pixel(self.ns_per_frame)
if not frame_width >= FRAME_MIN_WIDTH_PIXELS:
return
@@ -385,11 +385,11 @@ class ScaleRuler(Gtk.DrawingArea, Zoomable, Loggable):
y = int(height - FRAME_HEIGHT_PIXELS)
frame_num = int(
- self.pixelToNs(self.pixbuf_offset) * float(self.frame_rate) / Gst.SECOND)
+ self.pixel_to_ns(self.pixbuf_offset) * float(self.frame_rate) / Gst.SECOND)
paintpos = self.pixbuf_offset - offset
max_pos = context.get_target().get_width() + self.pixbuf_offset
while paintpos < max_pos:
- paintpos = self.nsToPixel(
+ paintpos = self.ns_to_pixel(
1 / float(self.frame_rate) * Gst.SECOND * frame_num)
if frame_num % 2:
set_cairo_color(context, self._color_frame)
@@ -398,7 +398,7 @@ class ScaleRuler(Gtk.DrawingArea, Zoomable, Loggable):
context.fill()
frame_num += 1
- def drawPosition(self, context):
+ def draw_position(self, context):
"""Draws the top part of the playhead.
This should be in sync with the playhead drawn by the timeline.
@@ -412,7 +412,7 @@ class ScaleRuler(Gtk.DrawingArea, Zoomable, Loggable):
# Add 0.5 so that the line center is at the middle of the pixel,
# without this the line appears blurry.
- xpos = self.nsToPixel(self.position) - self.pixbuf_offset + 0.5
+ xpos = self.ns_to_pixel(self.position) - self.pixbuf_offset + 0.5
set_cairo_color(context, PLAYHEAD_COLOR)
context.set_line_width(PLAYHEAD_WIDTH)
diff --git a/pitivi/timeline/timeline.py b/pitivi/timeline/timeline.py
index 09a87e16..a4bc2f30 100644
--- a/pitivi/timeline/timeline.py
+++ b/pitivi/timeline/timeline.py
@@ -70,48 +70,48 @@ from pitivi.utils.widgets import ZoomBox
SEPARATOR_ACCEPTING_DROP_INTERVAL_MS = 1000
-GlobalSettings.addConfigOption('edgeSnapDeadband',
- section="user-interface",
- key="edge-snap-deadband",
- default=5,
- notify=True)
-
-PreferencesDialog.addNumericPreference('edgeSnapDeadband',
- section="timeline",
- label=_("Snap distance"),
- description=_("Threshold (in pixels) at which two clips will snap
together "
- "when dragging or trimming."),
- lower=0)
-
-GlobalSettings.addConfigOption('imageClipLength',
- section="user-interface",
- key="image-clip-length",
- default=1000,
- notify=True)
-
-PreferencesDialog.addNumericPreference('imageClipLength',
- section="timeline",
- label=_("Image clip duration"),
- description=_(
- "Default clip length (in milliseconds) of images when inserting
on the timeline."),
- lower=1)
-
-GlobalSettings.addConfigOption('leftClickAlsoSeeks',
- section="user-interface",
- key="left-click-to-select",
- default=True,
- notify=True)
-
-PreferencesDialog.addTogglePreference('leftClickAlsoSeeks',
- section="timeline",
- label=_("Left click also seeks"),
- description=_(
- "Whether left-clicking also seeks besides selecting and editing
clips."))
-
-GlobalSettings.addConfigOption("timelineAutoRipple",
- section="user-interface",
- key="timeline-autoripple",
- default=False)
+GlobalSettings.add_config_option('edgeSnapDeadband',
+ section="user-interface",
+ key="edge-snap-deadband",
+ default=5,
+ notify=True)
+
+PreferencesDialog.add_numeric_preference('edgeSnapDeadband',
+ section="timeline",
+ label=_("Snap distance"),
+ description=_("Threshold (in pixels) at which two clips will snap
together "
+ "when dragging or trimming."),
+ lower=0)
+
+GlobalSettings.add_config_option('imageClipLength',
+ section="user-interface",
+ key="image-clip-length",
+ default=1000,
+ notify=True)
+
+PreferencesDialog.add_numeric_preference('imageClipLength',
+ section="timeline",
+ label=_("Image clip duration"),
+ description=_(
+ "Default clip length (in milliseconds) of images when inserting
on the timeline."),
+ lower=1)
+
+GlobalSettings.add_config_option('leftClickAlsoSeeks',
+ section="user-interface",
+ key="left-click-to-select",
+ default=True,
+ notify=True)
+
+PreferencesDialog.add_toggle_preference('leftClickAlsoSeeks',
+ section="timeline",
+ label=_("Left click also seeks"),
+ description=_(
+ "Whether left-clicking also seeks besides selecting and editing
clips."))
+
+GlobalSettings.add_config_option("timelineAutoRipple",
+ section="user-interface",
+ key="timeline-autoripple",
+ default=False)
class Marquee(Gtk.Box, Loggable):
@@ -181,8 +181,8 @@ class Marquee(Gtk.Box, Loggable):
"""
start_layer = self._timeline.get_layer_at(self.start_y)[0]
end_layer = self._timeline.get_layer_at(self.end_y)[0]
- start_pos = max(0, self._timeline.pixelToNs(self.start_x))
- end_pos = max(0, self._timeline.pixelToNs(self.end_x))
+ start_pos = max(0, self._timeline.pixel_to_ns(self.start_x))
+ end_pos = max(0, self._timeline.pixel_to_ns(self.end_x))
return self._timeline.get_clips_in_between(start_layer, end_layer,
start_pos, end_pos)
@@ -221,7 +221,7 @@ class LayersLayout(Gtk.Layout, Zoomable, Loggable):
self.layers_vbox.connect("size-allocate", self.__size_allocate_cb)
- def zoomChanged(self):
+ def zoom_changed(self):
# The width of the area/workspace changes when the zoom level changes.
self.update_width()
# Required so the playhead is redrawn.
@@ -238,13 +238,13 @@ class LayersLayout(Gtk.Layout, Zoomable, Loggable):
"""Draws the playhead line."""
offset = self.get_hadjustment().get_value()
position = max(0, self.playhead_position)
- x = self.nsToPixel(position) - offset
+ x = self.ns_to_pixel(position) - offset
self.__draw_vertical_bar(cr, x, PLAYHEAD_WIDTH, PLAYHEAD_COLOR)
def __draw_snap_indicator(self, cr):
"""Draws a snapping indicator line."""
offset = self.get_hadjustment().get_value()
- x = self.nsToPixel(self.snap_position) - offset
+ x = self.ns_to_pixel(self.snap_position) - offset
if x <= 0:
return
@@ -269,7 +269,7 @@ class LayersLayout(Gtk.Layout, Zoomable, Loggable):
view_width = self.get_allocated_width()
space_at_the_end = view_width * 2 / 3
duration = 0 if not ges_timeline else ges_timeline.props.duration
- width = self.nsToPixel(duration) + space_at_the_end
+ width = self.ns_to_pixel(duration) + space_at_the_end
width = max(view_width, width)
self.log("Updating the width_request of the layers_vbox: %s", width)
@@ -425,7 +425,7 @@ class Timeline(Gtk.EventBox, Zoomable, Loggable):
def __size_allocate_cb(self, unused_widget, unused_allocation):
"""Handles the layers vbox size allocations."""
if self.delayed_scroll:
- self.scrollToPlayhead(**self.delayed_scroll)
+ self.scroll_to_playhead(**self.delayed_scroll)
@property
def media_types(self):
@@ -445,7 +445,7 @@ class Timeline(Gtk.EventBox, Zoomable, Loggable):
return media_types
- def setProject(self, project):
+ def set_project(self, project):
"""Connects to the GES.Timeline holding the project."""
if self.ges_timeline is not None:
self.disconnect_by_func(self._button_press_event_cb)
@@ -464,11 +464,11 @@ class Timeline(Gtk.EventBox, Zoomable, Loggable):
self.ges_timeline = None
if self._project:
- self._project.pipeline.disconnect_by_func(self._positionCb)
+ self._project.pipeline.disconnect_by_func(self._position_cb)
self._project = project
if self._project:
- self._project.pipeline.connect('position', self._positionCb)
+ self._project.pipeline.connect('position', self._position_cb)
self.ges_timeline = self._project.ges_timeline
if self.ges_timeline is None:
@@ -495,7 +495,7 @@ class Timeline(Gtk.EventBox, Zoomable, Loggable):
def _duration_changed_cb(self, ges_timeline, pspec):
self.layout.update_width()
- def scrollToPlayhead(self, align=None, when_not_in_view=False, delayed=False):
+ def scroll_to_playhead(self, align=None, when_not_in_view=False, delayed=False):
"""Scrolls so that the playhead is in view.
Args:
@@ -516,7 +516,7 @@ class Timeline(Gtk.EventBox, Zoomable, Loggable):
layout_width = self.layout.get_allocation().width
if when_not_in_view:
- x = self.nsToPixel(self.__last_position) - self.hadj.get_value()
+ x = self.ns_to_pixel(self.__last_position) - self.hadj.get_value()
if 0 <= x <= layout_width:
return
@@ -528,9 +528,9 @@ class Timeline(Gtk.EventBox, Zoomable, Loggable):
else:
# Center.
delta = layout_width / 2
- self.hadj.set_value(self.nsToPixel(self.__last_position) - delta)
+ self.hadj.set_value(self.ns_to_pixel(self.__last_position) - delta)
- def _positionCb(self, pipeline, position):
+ def _position_cb(self, pipeline, position):
if self.__last_position == position:
return
@@ -538,9 +538,9 @@ class Timeline(Gtk.EventBox, Zoomable, Loggable):
self.layout.playhead_position = position
self.layout.queue_draw()
layout_width = self.layout.get_allocation().width
- x = self.nsToPixel(self.__last_position) - self.hadj.get_value()
+ x = self.ns_to_pixel(self.__last_position) - self.hadj.get_value()
if pipeline.playing() and x > layout_width - 100:
- self.scrollToPlayhead(Gtk.Align.START)
+ self.scroll_to_playhead(Gtk.Align.START)
if not pipeline.playing():
self.update_visible_overlays()
@@ -560,7 +560,7 @@ class Timeline(Gtk.EventBox, Zoomable, Loggable):
def update_snapping_distance(self):
"""Updates the snapping distance of self.ges_timeline."""
self.ges_timeline.set_snapping_distance(
- Zoomable.pixelToNs(self.app.settings.edgeSnapDeadband))
+ Zoomable.pixel_to_ns(self.app.settings.edgeSnapDeadband))
def __snap_distance_changed_cb(self, unused_settings):
"""Handles the change of the snapping distance by the user."""
@@ -582,7 +582,7 @@ class Timeline(Gtk.EventBox, Zoomable, Loggable):
# util methods #
# ------------- #
- def _getParentOfType(self, widget, _type):
+ def _get_parent_of_type(self, widget, _type):
"""Gets a clip from a child widget.
Args:
@@ -626,17 +626,17 @@ class Timeline(Gtk.EventBox, Zoomable, Loggable):
# Figure out first where to scroll at the end.
if event.get_state() & Gdk.ModifierType.CONTROL_MASK:
# The time at the mouse cursor.
- position = self.pixelToNs(x)
+ position = self.pixel_to_ns(x)
else:
# The time at the playhead.
position = self.__last_position
if delta_y > 0:
- Zoomable.zoomOut()
+ Zoomable.zoom_out()
else:
- Zoomable.zoomIn()
+ Zoomable.zoom_in()
# Scroll so position remains in place.
x, unused_y = event_widget.translate_coordinates(self.layout, event.x, event.y)
- self.hadj.set_value(self.nsToPixel(position) - x)
+ self.hadj.set_value(self.ns_to_pixel(position) - x)
return False
device = event.get_source_device() or event.device
@@ -701,13 +701,13 @@ class Timeline(Gtk.EventBox, Zoomable, Loggable):
def _button_press_event_cb(self, unused_widget, event):
"""Handles a mouse button press event."""
self.debug("PRESSED %s", event)
- self.app.gui.editor.focusTimeline()
+ self.app.gui.editor.focus_timeline()
event_widget = Gtk.get_event_widget(event)
res, button = event.get_button()
if res and button == 1:
- self.dragging_element = self._getParentOfType(event_widget, Clip)
+ self.dragging_element = self._get_parent_of_type(event_widget, Clip)
if isinstance(event_widget, TrimHandle):
self.__clicked_handle = event_widget
self.debug("Dragging element is %s", self.dragging_element)
@@ -717,7 +717,7 @@ class Timeline(Gtk.EventBox, Zoomable, Loggable):
self._on_layer = self.dragging_element.layer.ges_layer
self.dragging_group = self.selection.group()
else:
- layer_controls = self._getParentOfType(event_widget, LayerControls)
+ layer_controls = self._get_parent_of_type(event_widget, LayerControls)
if layer_controls:
self.__moving_layer = layer_controls.ges_layer
self.app.action_log.begin("move layer",
@@ -729,9 +729,9 @@ class Timeline(Gtk.EventBox, Zoomable, Loggable):
self.scrubbing = res and button == 3
if self.scrubbing:
self._seek(event)
- clip = self._getParentOfType(event_widget, Clip)
+ clip = self._get_parent_of_type(event_widget, Clip)
if clip:
- clip.shrinkTrimHandles()
+ clip.shrink_trim_handles()
self._scrolling = res and button == 2
if self._scrolling:
@@ -744,12 +744,12 @@ class Timeline(Gtk.EventBox, Zoomable, Loggable):
res, button = event.get_button()
if self.dragging_element:
- self.dragEnd()
+ self.drag_end()
elif self.__moving_layer:
- self.__endMovingLayer()
+ self.__end_moving_layer()
return False
elif res and button == 1:
- self._selectUnderMarquee()
+ self._select_under_marquee()
self.scrubbing = False
@@ -762,7 +762,7 @@ class Timeline(Gtk.EventBox, Zoomable, Loggable):
self.__next_seek_position = None
else:
event_widget = Gtk.get_event_widget(event)
- if self._getParentOfType(event_widget, LayerControls) is None:
+ if self._get_parent_of_type(event_widget, LayerControls) is None:
self._seek(event)
# Allowing group clips selection by shift+clicking anywhere on the timeline.
@@ -776,7 +776,7 @@ class Timeline(Gtk.EventBox, Zoomable, Loggable):
cur_clicked_layer, cur_click_pos = self.get_clicked_layer_and_pos(event)
clips = self.get_clips_in_between(
last_clicked_layer, cur_clicked_layer, last_click_pos, cur_click_pos)
- self.selection.setSelection(clips, SELECT)
+ self.selection.set_selection(clips, SELECT)
elif not self.get_parent().control_mask:
clicked_layer, click_pos = self.get_clicked_layer_and_pos(event)
self.set_selection_meta_info(clicked_layer, click_pos, SELECT)
@@ -799,7 +799,7 @@ class Timeline(Gtk.EventBox, Zoomable, Loggable):
event_widget = Gtk.get_event_widget(event)
x, y = event_widget.translate_coordinates(self.layout.layers_vbox, event.x, event.y)
clicked_layer = self.get_layer_at(y)[0]
- click_pos = max(0, self.pixelToNs(x))
+ click_pos = max(0, self.pixel_to_ns(x))
return clicked_layer, click_pos
def get_clips_in_between(self, layer1, layer2, pos1, pos2):
@@ -848,7 +848,7 @@ class Timeline(Gtk.EventBox, Zoomable, Loggable):
if isinstance(state, tuple):
state = state[1]
if not state & Gdk.ModifierType.BUTTON1_MASK:
- self.dragEnd()
+ self.drag_end()
return False
if self.got_dragged or self.__past_threshold(event):
@@ -864,7 +864,7 @@ class Timeline(Gtk.EventBox, Zoomable, Loggable):
past_middle_when_adjacent=True)
if layer != self.__moving_layer:
priority = layer.get_priority()
- self.moveLayer(self.__moving_layer, priority)
+ self.move_layer(self.__moving_layer, priority)
elif self.layout.marquee.start_x:
self.layout.marquee.move(event)
elif self.scrubbing:
@@ -893,7 +893,7 @@ class Timeline(Gtk.EventBox, Zoomable, Loggable):
def _seek(self, event):
event_widget = Gtk.get_event_widget(event)
x, unused_y = event_widget.translate_coordinates(self.layout.layers_vbox, event.x, event.y)
- position = max(0, self.pixelToNs(x))
+ position = max(0, self.pixel_to_ns(x))
self._project.pipeline.simple_seek(position)
def __scroll(self, event):
@@ -903,18 +903,18 @@ class Timeline(Gtk.EventBox, Zoomable, Loggable):
y_diff = self._scroll_start_y - event.y
self.vadj.set_value(self.vadj.get_value() + y_diff)
- def _selectUnderMarquee(self):
+ def _select_under_marquee(self):
if self.layout.marquee.props.width_request > 0:
clips = self.layout.marquee.find_clips()
else:
clips = []
- self.selection.setSelection(clips, SELECT)
+ self.selection.set_selection(clips, SELECT)
self.layout.marquee.hide()
- def updatePosition(self):
+ def update_position(self):
for ges_layer in self.ges_timeline.get_layers():
- ges_layer.ui.updatePosition()
+ ges_layer.ui.update_position()
def __create_clips(self, x, y):
"""Creates the clips for an asset drag operation.
@@ -926,9 +926,9 @@ class Timeline(Gtk.EventBox, Zoomable, Loggable):
placement = 0
self.dragging_element = None
- assets = self._project.assetsForUris(self.drop_data)
+ assets = self._project.assets_for_uris(self.drop_data)
if not assets:
- self._project.addUris(self.drop_data)
+ self._project.add_uris(self.drop_data)
return False
ges_clips = []
@@ -941,7 +941,7 @@ class Timeline(Gtk.EventBox, Zoomable, Loggable):
ges_layer, unused_on_sep = self.get_layer_at(y)
if not placement:
- placement = self.pixelToNs(x)
+ placement = self.pixel_to_ns(x)
placement = max(0, placement)
self.debug("Creating %s at %s", asset.props.id, Gst.TIME_ARGS(placement))
@@ -963,7 +963,7 @@ class Timeline(Gtk.EventBox, Zoomable, Loggable):
self._on_layer = ges_layer
self.dropping_clips = True
- self.selection.setSelection(ges_clips, SELECT)
+ self.selection.set_selection(ges_clips, SELECT)
self.dragging_group = self.selection.group()
@@ -991,7 +991,7 @@ class Timeline(Gtk.EventBox, Zoomable, Loggable):
def _drag_leave_cb(self, unused_widget, context, unused_timestamp):
# De-highlight the separators. We still need to remember them.
# See how __on_separators is used in __dragDropCb for details
- self._setSeparatorsPrelight(False)
+ self._set_separators_prelight(False)
target = self.drag_dest_find_target(context, None)
if self.dragging_element:
@@ -999,7 +999,7 @@ class Timeline(Gtk.EventBox, Zoomable, Loggable):
for clip in self.dragging_group.get_children(False)]
self.drop_data_ready = False
if self.dropping_clips:
- self.selection.setSelection([], SELECT)
+ self.selection.set_selection([], SELECT)
for clip in self.dragging_group.get_children(False):
clip.get_layer().remove_clip(clip)
self._project.pipeline.commit_timeline()
@@ -1010,9 +1010,9 @@ class Timeline(Gtk.EventBox, Zoomable, Loggable):
self.dragging_group.ungroup(recursive=False)
self.dragging_group = None
elif target == URI_TARGET_ENTRY.target:
- self.cleanDropData()
+ self.clean_drop_data()
- def cleanDropData(self):
+ def clean_drop_data(self):
self.drop_data_ready = False
self.drop_data = None
self.dropping_clips = False
@@ -1024,7 +1024,7 @@ class Timeline(Gtk.EventBox, Zoomable, Loggable):
target = self.drag_dest_find_target(context, None).name()
success = True
- self.cleanDropData()
+ self.clean_drop_data()
if target == URI_TARGET_ENTRY.target:
if self.__last_clips_on_leave:
pipeline = self._project.pipeline
@@ -1045,7 +1045,7 @@ class Timeline(Gtk.EventBox, Zoomable, Loggable):
if zoom_was_fitted:
self.set_best_zoom_ratio()
- self.dragEnd()
+ self.drag_end()
else:
success = False
@@ -1071,7 +1071,7 @@ class Timeline(Gtk.EventBox, Zoomable, Loggable):
self._add_layer(ges_layer)
self.__update_layers()
- def moveLayer(self, ges_layer, index):
+ def move_layer(self, ges_layer, index):
self.debug("Moving layer %s to %s", ges_layer.props.priority, index)
ges_layers = self.ges_timeline.get_layers()
ges_layers.remove(ges_layer)
@@ -1094,7 +1094,7 @@ class Timeline(Gtk.EventBox, Zoomable, Loggable):
self._layers_controls_vbox.pack_start(control, False, False, 0)
ges_layer.control_ui = control
# Check the media types so the controls are set up properly.
- layer.checkMediaTypes()
+ layer.check_media_types()
self.layout.layers_vbox.pack_start(layer, False, False, 0)
layer.show()
@@ -1178,7 +1178,7 @@ class Timeline(Gtk.EventBox, Zoomable, Loggable):
return int(position / 2)
# Interface Zoomable
- def zoomChanged(self):
+ def zoom_changed(self):
if not self.ges_timeline:
# Probably the app starts and there is no project/timeline yet.
return
@@ -1186,7 +1186,7 @@ class Timeline(Gtk.EventBox, Zoomable, Loggable):
self.update_snapping_distance()
self.zoomed_fitted = False
- self.updatePosition()
+ self.update_position()
def set_best_zoom_ratio(self, allow_zoom_in=False):
"""Sets the zoom level so that the entire timeline is in view."""
@@ -1202,8 +1202,8 @@ class Timeline(Gtk.EventBox, Zoomable, Loggable):
timeline_duration_s)
zoom_ratio = self.layout.get_allocation().width / timeline_duration_s
- nearest_zoom_level = Zoomable.computeZoomLevel(zoom_ratio)
- if nearest_zoom_level >= Zoomable.getCurrentZoomLevel() and not allow_zoom_in:
+ nearest_zoom_level = Zoomable.compute_zoom_level(zoom_ratio)
+ if nearest_zoom_level >= Zoomable.get_current_zoom_level() and not allow_zoom_in:
# This means if we continue we'll zoom in.
if not allow_zoom_in:
# For example when the user zoomed out and is adding clips
@@ -1211,7 +1211,7 @@ class Timeline(Gtk.EventBox, Zoomable, Loggable):
self.log("The entire timeline is already visible")
return
- Zoomable.setZoomLevel(nearest_zoom_level)
+ Zoomable.set_zoom_level(nearest_zoom_level)
self.update_snapping_distance()
# Only do this at the very end, after updating the other widgets.
@@ -1220,7 +1220,7 @@ class Timeline(Gtk.EventBox, Zoomable, Loggable):
self.hadj.set_value(0)
- def __getEditingMode(self):
+ def __get_editing_mode(self):
if not self.editing_context:
is_handle = False
else:
@@ -1293,7 +1293,7 @@ class Timeline(Gtk.EventBox, Zoomable, Loggable):
return None
- def _setSeparatorsPrelight(self, light):
+ def _set_separators_prelight(self, light):
for sep in self.__on_separators:
if light:
set_children_state_recurse(sep, Gtk.StateFlags.PRELIGHT)
@@ -1326,15 +1326,15 @@ class Timeline(Gtk.EventBox, Zoomable, Loggable):
self.app,
not self.dropping_clips)
- mode = self.__getEditingMode()
- self.editing_context.setMode(mode)
+ mode = self.__get_editing_mode()
+ self.editing_context.set_mode(mode)
if self.editing_context.edge is GES.Edge.EDGE_END:
- position = self.pixelToNs(x)
+ position = self.pixel_to_ns(x)
else:
- position = self.pixelToNs(x - self.__drag_start_x)
+ position = self.pixel_to_ns(x - self.__drag_start_x)
- self._setSeparatorsPrelight(False)
+ self._set_separators_prelight(False)
res = self.get_layer_at(y, prefer_ges_layer=self._on_layer)
self._on_layer, self.__on_separators = res
if (mode != GES.EditMode.EDIT_NORMAL or
@@ -1355,7 +1355,7 @@ class Timeline(Gtk.EventBox, Zoomable, Loggable):
def _separator_accepting_drop_timeout_cb(self):
self._separator_accepting_drop_id = 0
- self._setSeparatorsPrelight(True)
+ self._set_separators_prelight(True)
self._separator_accepting_drop = True
def create_layer(self, priority):
@@ -1374,7 +1374,7 @@ class Timeline(Gtk.EventBox, Zoomable, Loggable):
return new_ges_layer
- def dragEnd(self):
+ def drag_end(self):
if self.editing_context:
self.__end_snap()
@@ -1395,12 +1395,12 @@ class Timeline(Gtk.EventBox, Zoomable, Loggable):
self.editing_context = None
for ges_layer in self.ges_timeline.get_layers():
- ges_layer.ui.checkMediaTypes()
+ ges_layer.ui.check_media_types()
- self._setSeparatorsPrelight(False)
+ self._set_separators_prelight(False)
self.__on_separators = []
- def __endMovingLayer(self):
+ def __end_moving_layer(self):
self.app.action_log.commit("move layer")
self.__moving_layer = None
@@ -1446,10 +1446,10 @@ class TimelineContainer(Gtk.Grid, Zoomable, Loggable):
clip.set_asset(replacement_asset)
self._project.pipeline.commit_timeline()
- def insertAssets(self, assets, position=None):
+ def insert_assets(self, assets, position=None):
"""Creates clips out of the specified assets on the longest layer."""
- layer = self._getLongestLayer()
- self._insertClipsAndAssets(assets, position, layer)
+ layer = self._get_longest_layer()
+ self._insert_clips_and_assets(assets, position, layer)
def insert_clips_on_first_layer(self, clips, position=None):
"""Adds clips to the timeline on the first layer."""
@@ -1457,14 +1457,14 @@ class TimelineContainer(Gtk.Grid, Zoomable, Loggable):
finalizing_action=CommitTimelineFinalizingAction(self._project.pipeline)):
layers = self.ges_timeline.get_layers()
first_layer = layers[0]
- start = self.__getInsertPosition(position)
+ start = self.__get_insert_position(position)
end = start + sum([clip.get_duration() for clip in clips])
intersecting_clips = first_layer.get_clips_in_interval(start, end)
if intersecting_clips:
first_layer = self.timeline.create_layer(0)
- self._insertClipsAndAssets(clips, start, first_layer)
+ self._insert_clips_and_assets(clips, start, first_layer)
- def _insertClipsAndAssets(self, objs, position, layer):
+ def _insert_clips_and_assets(self, objs, position, layer):
if self.ges_timeline is None:
raise TimelineError("No ges_timeline set, this is a bug")
@@ -1473,7 +1473,7 @@ class TimelineContainer(Gtk.Grid, Zoomable, Loggable):
# the value of zoomed_fitted as clips get progressively inserted.
zoom_was_fitted = self.timeline.zoomed_fitted
- initial_position = self.__getInsertPosition(position)
+ initial_position = self.__get_insert_position(position)
clip_position = initial_position
with self.app.action_log.started("add asset",
@@ -1498,21 +1498,21 @@ class TimelineContainer(Gtk.Grid, Zoomable, Loggable):
else:
raise TimelineError("Cannot insert: %s" % type(obj))
clip_position += duration
- self.app.gui.editor.focusTimeline()
+ self.app.gui.editor.focus_timeline()
if zoom_was_fitted:
self.timeline.set_best_zoom_ratio()
else:
- self.scrollToPixel(Zoomable.nsToPixel(initial_position))
+ self.scroll_to_pixel(Zoomable.ns_to_pixel(initial_position))
- def __getInsertPosition(self, position):
+ def __get_insert_position(self, position):
if position is None:
- return self._project.pipeline.getPosition()
+ return self._project.pipeline.get_position()
if position < 0:
return self.ges_timeline.props.duration
return position
- def purgeAsset(self, asset_id):
+ def purge_asset(self, asset_id):
"""Removes all instances of an asset from the timeline."""
layers = self.ges_timeline.get_layers()
for layer in layers:
@@ -1521,14 +1521,14 @@ class TimelineContainer(Gtk.Grid, Zoomable, Loggable):
layer.remove_clip(clip)
self._project.pipeline.commit_timeline()
- def scrollToPixel(self, x):
+ def scroll_to_pixel(self, x):
if x > self.timeline.hadj.props.upper:
# We can't scroll yet, because the canvas needs to be updated
- GLib.idle_add(self._scrollToPixel, x)
+ GLib.idle_add(self._scroll_to_pixel, x)
else:
- self._scrollToPixel(x)
+ self._scroll_to_pixel(x)
- def setProject(self, project):
+ def set_project(self, project):
"""Connects to the project's timeline and pipeline."""
if self._project:
self._project.disconnect_by_func(self._rendering_settings_changed_cb)
@@ -1543,18 +1543,18 @@ class TimelineContainer(Gtk.Grid, Zoomable, Loggable):
else:
self.ges_timeline = None
- self.timeline.setProject(project)
+ self.timeline.set_project(project)
if project:
- self.ruler.setPipeline(project.pipeline)
- self.ruler.zoomChanged()
- self.ruler.setProjectFrameRate(project.videorate)
+ self.ruler.set_pipeline(project.pipeline)
+ self.ruler.zoom_changed()
+ self.ruler.set_project_frame_rate(project.videorate)
self.timeline.set_best_zoom_ratio(allow_zoom_in=True)
self.timeline.update_snapping_distance()
self.markers.markers_container = project.ges_timeline.get_marker_list("markers")
- def updateActions(self):
+ def update_actions(self):
selection = self.timeline.selection
selection_non_empty = bool(selection)
self.delete_action.set_enabled(selection_non_empty)
@@ -1591,7 +1591,7 @@ class TimelineContainer(Gtk.Grid, Zoomable, Loggable):
self.ruler = ScaleRuler(self)
self.ruler.props.hexpand = True
- self.ruler.setProjectFrameRate(24.)
+ self.ruler.set_project_frame_rate(24.)
builder = Gtk.Builder()
builder.add_from_file(os.path.join(get_ui_dir(), "timelinetoolbar.ui"))
@@ -1621,7 +1621,7 @@ class TimelineContainer(Gtk.Grid, Zoomable, Loggable):
self.timeline.selection.connect(
"selection-changed", self.__selection_changed_cb)
- def _getLongestLayer(self):
+ def _get_longest_layer(self):
"""Returns the longest layer."""
layers = self.ges_timeline.get_layers()
if len(layers) == 1:
@@ -1650,7 +1650,7 @@ class TimelineContainer(Gtk.Grid, Zoomable, Loggable):
# Clips actions.
self.delete_action = Gio.SimpleAction.new("delete-selected-clips", None)
- self.delete_action.connect("activate", self._deleteSelected)
+ self.delete_action.connect("activate", self._delete_selected)
group.add_action(self.delete_action)
self.app.shortcuts.add("timeline.delete-selected-clips", ["Delete"],
_("Delete selected clips"))
@@ -1674,13 +1674,13 @@ class TimelineContainer(Gtk.Grid, Zoomable, Loggable):
_("Ungroup selected clips"))
self.copy_action = Gio.SimpleAction.new("copy-selected-clips", None)
- self.copy_action.connect("activate", self.__copyClipsCb)
+ self.copy_action.connect("activate", self.__copy_clips_cb)
group.add_action(self.copy_action)
self.app.shortcuts.add("timeline.copy-selected-clips", ["<Primary>c"],
_("Copy selected clips"))
self.paste_action = Gio.SimpleAction.new("paste-clips", None)
- self.paste_action.connect("activate", self.__pasteClipsCb)
+ self.paste_action.connect("activate", self.__paste_clips_cb)
group.add_action(self.paste_action)
self.app.shortcuts.add("timeline.paste-clips", ["<Primary>v"],
_("Paste selected clips"))
@@ -1710,7 +1710,7 @@ class TimelineContainer(Gtk.Grid, Zoomable, Loggable):
# Playhead actions.
self.split_action = Gio.SimpleAction.new("split-clips", None)
- self.split_action.connect("activate", self._splitCb)
+ self.split_action.connect("activate", self._split_cb)
group.add_action(self.split_action)
self.split_action.set_enabled(True)
self.app.shortcuts.add("timeline.split-clips", ["s"],
@@ -1747,7 +1747,7 @@ class TimelineContainer(Gtk.Grid, Zoomable, Loggable):
_("Adjust zoom to fit the project to the window"))
self.play_action = Gio.SimpleAction.new("play", None)
- self.play_action.connect("activate", self._playPauseCb)
+ self.play_action.connect("activate", self._play_pause_cb)
navigation_group.add_action(self.play_action)
self.app.shortcuts.add("navigation.play", ["space"], _("Play"))
@@ -1777,9 +1777,9 @@ class TimelineContainer(Gtk.Grid, Zoomable, Loggable):
["<Shift>Right"],
_("Seek forward one second"))
- self.updateActions()
+ self.update_actions()
- def _scrollToPixel(self, x):
+ def _scroll_to_pixel(self, x):
hadj = self.timeline.hadj
self.log("Scroll to: %s %s %s", x, hadj.props.lower, hadj.props.upper)
if x > hadj.props.upper:
@@ -1793,10 +1793,10 @@ class TimelineContainer(Gtk.Grid, Zoomable, Loggable):
hadj.set_value(x)
- self.timeline.updatePosition()
+ self.timeline.update_position()
return False
- def _deleteSelected(self, unused_action, unused_parameter):
+ def _delete_selected(self, unused_action, unused_parameter):
if self.ges_timeline:
with Previewer.manager.paused():
with self.app.action_log.started("delete clip",
@@ -1808,7 +1808,7 @@ class TimelineContainer(Gtk.Grid, Zoomable, Loggable):
layer = clip.get_layer()
layer.remove_clip(clip)
- self.timeline.selection.setSelection([], SELECT)
+ self.timeline.selection.set_selection([], SELECT)
def _delete_selected_and_shift(self, unused_action, unused_parameter):
if self.ges_timeline:
@@ -1850,7 +1850,7 @@ class TimelineContainer(Gtk.Grid, Zoomable, Loggable):
if clip.start >= end:
clip.set_start(clip.start - shift_by)
- self.timeline.selection.setSelection([], SELECT)
+ self.timeline.selection.set_selection([], SELECT)
def _ungroup_selected_cb(self, unused_action, unused_parameter):
if not self.ges_timeline:
@@ -1865,7 +1865,7 @@ class TimelineContainer(Gtk.Grid, Zoomable, Loggable):
if isinstance(toplevel, GES.Group) or len(toplevels) == 1:
toplevel.ungroup(recursive=False)
- self.timeline.selection.setSelection([], SELECT)
+ self.timeline.selection.set_selection([], SELECT)
def _group_selected_cb(self, unused_action, unused_parameter):
if not self.ges_timeline:
@@ -1882,23 +1882,23 @@ class TimelineContainer(Gtk.Grid, Zoomable, Loggable):
# timeline.selection doesn't change during grouping,
# we need to manually update group actions.
self.timeline.selection.set_can_group_ungroup()
- self.updateActions()
+ self.update_actions()
- def __copyClipsCb(self, unused_action, unused_parameter):
+ def __copy_clips_cb(self, unused_action, unused_parameter):
group = self.timeline.selection.group()
try:
self.__copied_group = group.copy(deep=True)
self.__copied_group.props.serialize = False
finally:
group.ungroup(recursive=False)
- self.updateActions()
+ self.update_actions()
- def __pasteClipsCb(self, unused_action, unused_parameter):
+ def __paste_clips_cb(self, unused_action, unused_parameter):
if not self.__copied_group:
self.info("Nothing to paste.")
return
- position = self._project.pipeline.getPosition()
+ position = self._project.pipeline.get_position()
with self.app.action_log.started("paste",
finalizing_action=CommitTimelineFinalizingAction(self._project.pipeline),
toplevel=True):
@@ -1950,23 +1950,23 @@ class TimelineContainer(Gtk.Grid, Zoomable, Loggable):
def _seek_forward_clip_cb(self, unused_action, unused_parameter):
"""Seeks to the first clip edge at the right of the playhead."""
- position = self.first_clip_edge(after=self._project.pipeline.getPosition())
+ position = self.first_clip_edge(after=self._project.pipeline.get_position())
if position is None:
return
self._project.pipeline.simple_seek(position)
- self.timeline.scrollToPlayhead(align=Gtk.Align.CENTER, when_not_in_view=True)
+ self.timeline.scroll_to_playhead(align=Gtk.Align.CENTER, when_not_in_view=True)
def _seek_backward_clip_cb(self, unused_action, unused_parameter):
"""Seeks to the first clip edge at the left of the playhead."""
- position = self.first_clip_edge(before=self._project.pipeline.getPosition())
+ position = self.first_clip_edge(before=self._project.pipeline.get_position())
if position is None:
return
self._project.pipeline.simple_seek(position)
- self.timeline.scrollToPlayhead(align=Gtk.Align.CENTER, when_not_in_view=True)
+ self.timeline.scroll_to_playhead(align=Gtk.Align.CENTER, when_not_in_view=True)
- def _alignSelectedCb(self, unused_action, unused_parameter):
+ def _align_selected_cb(self, unused_action, unused_parameter):
if not self.ges_timeline:
return
@@ -1981,9 +1981,9 @@ class TimelineContainer(Gtk.Grid, Zoomable, Loggable):
auto_aligner = AutoAligner(self.timeline.selection, aligned_cb)
progress_meter = auto_aligner.start()
- progress_meter.addWatcher(progress_dialog.updatePosition)
+ progress_meter.add_watcher(progress_dialog.update_position)
- def _splitCb(self, unused_action, unused_parameter):
+ def _split_cb(self, unused_action, unused_parameter):
"""Splits clips.
If clips are selected, split them at the current playhead position.
@@ -1991,16 +1991,16 @@ class TimelineContainer(Gtk.Grid, Zoomable, Loggable):
"""
with self.app.action_log.started("split clip", toplevel=True,
finalizing_action=CommitTimelineFinalizingAction(self._project.pipeline)):
- self._splitElements(self.timeline.selection.selected)
+ self._split_elements(self.timeline.selection.selected)
- def _splitElements(self, clips=None):
+ def _split_elements(self, clips=None):
splitting_selection = clips is not None
if clips is None:
clips = []
for layer in self.timeline.ges_timeline.get_layers():
clips.extend(layer.get_clips())
- position = self._project.pipeline.getPosition()
+ position = self._project.pipeline.get_position()
splitted = False
with self._project.pipeline.commit_timeline_after():
@@ -2021,18 +2021,18 @@ class TimelineContainer(Gtk.Grid, Zoomable, Loggable):
layer.splitting_object = False
if not splitted and splitting_selection:
- self._splitElements()
+ self._split_elements()
def _keyframe_cb(self, unused_action, unused_parameter):
"""Toggles a keyframe on the selected clip."""
- ges_clip = self.timeline.selection.getSingleClip(GES.Clip)
+ ges_clip = self.timeline.selection.get_single_clip(GES.Clip)
if ges_clip is None:
return
ges_track_elements = ges_clip.find_track_elements(None, GES.TrackType.VIDEO, GES.Source)
ges_track_elements += ges_clip.find_track_elements(None, GES.TrackType.AUDIO, GES.Source)
- offset = self._project.pipeline.getPosition() - ges_clip.props.start
+ offset = self._project.pipeline.get_position() - ges_clip.props.start
if offset <= 0 or offset >= ges_clip.props.duration:
return
offset += ges_clip.props.in_point
@@ -2042,8 +2042,8 @@ class TimelineContainer(Gtk.Grid, Zoomable, Loggable):
keyframe_curve = ges_track_element.ui.keyframe_curve
keyframe_curve.toggle_keyframe(offset)
- def _playPauseCb(self, unused_action, unused_parameter):
- self._project.pipeline.togglePlayback()
+ def _play_pause_cb(self, unused_action, unused_parameter):
+ self._project.pipeline.toggle_playback()
# Gtk widget virtual methods
@@ -2062,44 +2062,44 @@ class TimelineContainer(Gtk.Grid, Zoomable, Loggable):
self.control_mask = False
def _seek_backward_one_second_cb(self, unused_action, unused_parameter):
- self._project.pipeline.seekRelative(0 - Gst.SECOND)
- self.timeline.scrollToPlayhead(align=Gtk.Align.CENTER, when_not_in_view=True)
+ self._project.pipeline.seek_relative(0 - Gst.SECOND)
+ self.timeline.scroll_to_playhead(align=Gtk.Align.CENTER, when_not_in_view=True)
def _seek_forward_one_second_cb(self, unused_action, unused_parameter):
- self._project.pipeline.seekRelative(Gst.SECOND)
- self.timeline.scrollToPlayhead(align=Gtk.Align.CENTER, when_not_in_view=True)
+ self._project.pipeline.seek_relative(Gst.SECOND)
+ self.timeline.scroll_to_playhead(align=Gtk.Align.CENTER, when_not_in_view=True)
def _seek_backward_one_frame_cb(self, unused_action, unused_parameter):
- self._project.pipeline.stepFrame(self._project.videorate, -1)
- self.timeline.scrollToPlayhead(align=Gtk.Align.CENTER, when_not_in_view=True)
+ self._project.pipeline.step_frame(self._project.videorate, -1)
+ self.timeline.scroll_to_playhead(align=Gtk.Align.CENTER, when_not_in_view=True)
def _seek_forward_one_frame_cb(self, unused_action, unused_parameter):
- self._project.pipeline.stepFrame(self._project.videorate, 1)
- self.timeline.scrollToPlayhead(align=Gtk.Align.CENTER, when_not_in_view=True)
+ self._project.pipeline.step_frame(self._project.videorate, 1)
+ self.timeline.scroll_to_playhead(align=Gtk.Align.CENTER, when_not_in_view=True)
def do_focus_in_event(self, unused_event):
self.log("Timeline has grabbed focus")
- self.updateActions()
+ self.update_actions()
def do_focus_out_event(self, unused_event):
self.log("Timeline has lost focus")
- self.updateActions()
+ self.update_actions()
def _rendering_settings_changed_cb(self, project, item):
"""Handles Project metadata changes."""
if item == "videorate" or item is None:
- self.ruler.setProjectFrameRate(project.videorate)
+ self.ruler.set_project_frame_rate(project.videorate)
def __timeline_size_allocate_cb(self, unused_widget, allocation):
fits = self.timeline.layout.props.height <= allocation.height
self.vscrollbar.set_opacity(0 if fits else 1)
def _zoom_in_cb(self, unused_action, unused_parameter):
- Zoomable.zoomIn()
+ Zoomable.zoom_in()
def _zoom_out_cb(self, unused_action, unused_parameter):
- Zoomable.zoomOut()
+ Zoomable.zoom_out()
def _zoom_fit_cb(self, unused_action, unused_parameter):
self.app.write_action("zoom-fit", optional_action_type=True)
@@ -2108,7 +2108,7 @@ class TimelineContainer(Gtk.Grid, Zoomable, Loggable):
def __selection_changed_cb(self, unused_selection):
"""Handles selection changing."""
- self.updateActions()
+ self.update_actions()
def _gaplessmode_toggled_cb(self, unused_action, unused_parameter):
self._settings.timelineAutoRipple = self.gapless_button.get_active()
diff --git a/pitivi/titleeditor.py b/pitivi/titleeditor.py
index 779fc488..07c284f4 100644
--- a/pitivi/titleeditor.py
+++ b/pitivi/titleeditor.py
@@ -34,18 +34,18 @@ from pitivi.utils.ui import fix_infobar
from pitivi.utils.ui import gdk_rgba_to_argb
from pitivi.utils.widgets import ColorPickerButton
-GlobalSettings.addConfigOption('titleClipLength',
- section="user-interface",
- key="title-clip-length",
- default=5000,
- notify=True)
-
-PreferencesDialog.addNumericPreference('titleClipLength',
- section="timeline",
- label=_("Title clip duration"),
- description=_(
- "Default clip length (in milliseconds) of titles when inserting
on the timeline."),
- lower=1)
+GlobalSettings.add_config_option('titleClipLength',
+ section="user-interface",
+ key="title-clip-length",
+ default=5000,
+ notify=True)
+
+PreferencesDialog.add_numeric_preference('titleClipLength',
+ section="timeline",
+ label=_("Title clip duration"),
+ description=_(
+ "Default clip length (in milliseconds) of titles when inserting
on the timeline."),
+ lower=1)
FOREGROUND_DEFAULT_COLOR = 0xFFFFFFFF # White
BACKGROUND_DEFAULT_COLOR = 0x00000000 # Transparent
@@ -73,14 +73,14 @@ class TitleEditor(Loggable):
self._setting_props = False
self._children_props_handler = None
- self._createUI()
+ self._create_ui()
# Updates the UI.
self.set_source(None)
self.app.project_manager.connect_after(
- "new-project-loaded", self._newProjectLoadedCb)
+ "new-project-loaded", self._new_project_loaded_cb)
- def _createUI(self):
+ def _create_ui(self):
builder = Gtk.Builder()
builder.add_from_file(os.path.join(get_ui_dir(), "titleeditor.ui"))
builder.connect_signals(self)
@@ -92,7 +92,7 @@ class TitleEditor(Loggable):
self.textarea = builder.get_object("textview")
self.textbuffer = self.textarea.props.buffer
- self.textbuffer.connect("changed", self._textChangedCb)
+ self.textbuffer.connect("changed", self._text_changed_cb)
self.font_button = builder.get_object("fontbutton1")
self.foreground_color_button = builder.get_object("fore_text_color")
@@ -126,7 +126,7 @@ class TitleEditor(Loggable):
("right", _("Right"))):
self.settings["halignment"].append(value_id, text)
- def _setChildProperty(self, name, value):
+ def _set_child_property(self, name, value):
with self.app.action_log.started("Title change property",
toplevel=True):
self._setting_props = True
@@ -143,28 +143,28 @@ class TitleEditor(Loggable):
argb += float(widget.color_g) * 256 ** 1
argb += float(widget.color_b) * 256 ** 0
self.debug("Setting text %s to %x", color_layer, argb)
- self._setChildProperty(color_layer, argb)
+ self._set_child_property(color_layer, argb)
rgba = argb_to_gdk_rgba(argb)
color_button.set_rgba(rgba)
- def _backgroundColorButtonCb(self, widget):
+ def _background_color_button_cb(self, widget):
color = gdk_rgba_to_argb(widget.get_rgba())
self.debug("Setting title background color to %x", color)
- self._setChildProperty("foreground-color", color)
+ self._set_child_property("foreground-color", color)
- def _frontTextColorButtonCb(self, widget):
+ def _front_text_color_button_cb(self, widget):
color = gdk_rgba_to_argb(widget.get_rgba())
self.debug("Setting title foreground color to %x", color)
# TODO: Use set_text_color when we work with TitleSources instead of
# TitleClips
- self._setChildProperty("color", color)
+ self._set_child_property("color", color)
- def _fontButtonCb(self, widget):
+ def _font_button_cb(self, widget):
font_desc = widget.get_font_desc().to_string()
self.debug("Setting font desc to %s", font_desc)
- self._setChildProperty("font-desc", font_desc)
+ self._set_child_property("font-desc", font_desc)
- def _updateFromSource(self, source):
+ def _update_from_source(self, source):
self.textbuffer.set_text(source.get_child_property("text")[1] or "")
self.settings['x-absolute'].set_value(source.get_child_property("x-absolute")[1])
self.settings['y-absolute'].set_value(source.get_child_property("y-absolute")[1])
@@ -172,7 +172,7 @@ class TitleEditor(Loggable):
source.get_child_property("valignment")[1].value_name)
self.settings['halignment'].set_active_id(
source.get_child_property("halignment")[1].value_name)
- self._updateWidgetsVisibility()
+ self._update_widgets_visibility()
font_desc = Pango.FontDescription.from_string(
source.get_child_property("font-desc")[1])
@@ -184,14 +184,14 @@ class TitleEditor(Loggable):
color = argb_to_gdk_rgba(source.get_child_property("foreground-color")[1])
self.background_color_button.set_rgba(color)
- def _textChangedCb(self, unused_updated_obj):
+ def _text_changed_cb(self, unused_updated_obj):
if not self.source:
# Nothing to update.
return
text = self.textbuffer.props.text
self.log("Source text updated to %s", text)
- self._setChildProperty("text", text)
+ self._set_child_property("text", text)
def _update_source_cb(self, updated_obj):
"""Handles changes in the advanced property widgets at the bottom."""
@@ -203,16 +203,16 @@ class TitleEditor(Loggable):
if obj == updated_obj:
if name == "valignment":
value = obj.get_active_id()
- self._updateWidgetsVisibility()
+ self._update_widgets_visibility()
elif name == "halignment":
value = obj.get_active_id()
- self._updateWidgetsVisibility()
+ self._update_widgets_visibility()
else:
value = obj.get_value()
- self._setChildProperty(name, value)
+ self._set_child_property(name, value)
return
- def _updateWidgetsVisibility(self):
+ def _update_widgets_visibility(self):
visible = self.settings["valignment"].get_active_id() == "absolute"
self.settings["y-absolute"].set_visible(visible)
visible = self.settings["halignment"].get_active_id() == "absolute"
@@ -231,7 +231,7 @@ class TitleEditor(Loggable):
self.source = None
if source:
assert isinstance(source, (GES.TextOverlay, GES.TitleSource))
- self._updateFromSource(source)
+ self._update_from_source(source)
self.source = source
self.infobar.hide()
self.editing_box.show()
@@ -241,7 +241,7 @@ class TitleEditor(Loggable):
self.infobar.show()
self.editing_box.hide()
- def _createCb(self, unused_button):
+ def _create_cb(self, unused_button):
title_clip = GES.TitleClip()
duration = self.app.settings.titleClipLength * Gst.MSECOND
title_clip.set_duration(duration)
@@ -259,7 +259,7 @@ class TitleEditor(Loggable):
for prop, value in properties.items():
res = source.set_child_property(prop, value)
assert res, prop
- self._selection.setSelection([title_clip], SELECT)
+ self._selection.set_selection([title_clip], SELECT)
def _source_deep_notify_cb(self, source, unused_gstelement, pspec):
"""Handles updates in the TitleSource backing the current TitleClip."""
@@ -316,17 +316,17 @@ class TitleEditor(Loggable):
self._project.pipeline.commit_timeline()
- def _newProjectLoadedCb(self, unused_project_manager, project):
+ def _new_project_loaded_cb(self, unused_project_manager, project):
if self._selection is not None:
- self._selection.disconnect_by_func(self._selectionChangedCb)
+ self._selection.disconnect_by_func(self._selection_changed_cb)
self._selection = None
if project:
self._selection = project.ges_timeline.ui.selection
- self._selection.connect('selection-changed', self._selectionChangedCb)
+ self._selection.connect('selection-changed', self._selection_changed_cb)
self._project = project
- def _selectionChangedCb(self, selection):
- selected_clip = selection.getSingleClip(GES.TitleClip)
+ def _selection_changed_cb(self, selection):
+ selected_clip = selection.get_single_clip(GES.TitleClip)
source = None
if selected_clip:
for child in selected_clip.get_children(False):
diff --git a/pitivi/transitions.py b/pitivi/transitions.py
index 4c15d55d..f1d2c61b 100644
--- a/pitivi/transitions.py
+++ b/pitivi/transitions.py
@@ -98,7 +98,7 @@ class TransitionsListWidget(Gtk.Box, Loggable):
self.props_widgets.attach(self.invert_checkbox, 1, 2, 1, 1)
# Set the default values
- self.__updateBorderScale()
+ self.__update_border_scale()
self.infobar = Gtk.InfoBar()
fix_infobar(self.infobar)
@@ -163,12 +163,12 @@ class TransitionsListWidget(Gtk.Box, Loggable):
self.container_focused = False
action_log.commit("Change transaction")
- def __connectUi(self):
- self.iconview.connect("selection-changed", self._transitionSelectedCb)
- self.border_scale.connect("value-changed", self._borderScaleCb)
- self.invert_checkbox.connect("toggled", self._invertCheckboxCb)
- self.border_mode_normal.connect("released", self._borderTypeChangedCb)
- self.border_mode_loop.connect("released", self._borderTypeChangedCb)
+ def __connect_ui(self):
+ self.iconview.connect("selection-changed", self._transition_selected_cb)
+ self.border_scale.connect("value-changed", self._border_scale_cb)
+ self.invert_checkbox.connect("toggled", self._invert_checkbox_cb)
+ self.border_mode_normal.connect("released", self._border_type_changed_cb)
+ self.border_mode_loop.connect("released", self._border_type_changed_cb)
self.element.connect("notify::border", self.__updated_cb)
self.element.connect("notify::invert", self.__updated_cb)
self.element.connect("notify::transition-type", self.__updated_cb)
@@ -176,18 +176,18 @@ class TransitionsListWidget(Gtk.Box, Loggable):
def __updated_cb(self, element, unused_param):
self._update_ui()
- def __disconnectUi(self):
- self.iconview.disconnect_by_func(self._transitionSelectedCb)
- self.border_scale.disconnect_by_func(self._borderScaleCb)
- self.invert_checkbox.disconnect_by_func(self._invertCheckboxCb)
- self.border_mode_normal.disconnect_by_func(self._borderTypeChangedCb)
- self.border_mode_loop.disconnect_by_func(self._borderTypeChangedCb)
+ def __disconnect_ui(self):
+ self.iconview.disconnect_by_func(self._transition_selected_cb)
+ self.border_scale.disconnect_by_func(self._border_scale_cb)
+ self.invert_checkbox.disconnect_by_func(self._invert_checkbox_cb)
+ self.border_mode_normal.disconnect_by_func(self._border_type_changed_cb)
+ self.border_mode_loop.disconnect_by_func(self._border_type_changed_cb)
disconnect_all_by_func(self.element, self.__updated_cb)
# UI callbacks
- def _transitionSelectedCb(self, unused_widget):
- transition_asset = self.getSelectedItem()
+ def _transition_selected_cb(self, unused_widget):
+ transition_asset = self.get_selected_item()
if not transition_asset:
# The user clicked between icons
return False
@@ -203,26 +203,26 @@ class TransitionsListWidget(Gtk.Box, Loggable):
self.app.write_action("element-set-asset",
asset_id=transition_asset.get_id(),
element_name=self.element.get_name())
- self.app.project_manager.current_project.pipeline.flushSeek()
+ self.app.project_manager.current_project.pipeline.flush_seek()
return True
- def _borderScaleCb(self, widget):
+ def _border_scale_cb(self, widget):
value = widget.get_value()
self.debug("User changed the border property to %s", value)
self.element.set_border(int(value))
- self.app.project_manager.current_project.pipeline.flushSeek()
+ self.app.project_manager.current_project.pipeline.flush_seek()
- def _invertCheckboxCb(self, widget):
+ def _invert_checkbox_cb(self, widget):
value = widget.get_active()
self.debug("User changed the invert property to %s", value)
self.element.set_inverted(value)
- self.app.project_manager.current_project.pipeline.flushSeek()
+ self.app.project_manager.current_project.pipeline.flush_seek()
- def _borderTypeChangedCb(self, widget):
- self.__updateBorderScale(widget == self.border_mode_loop)
+ def _border_type_changed_cb(self, widget):
+ self.__update_border_scale(widget == self.border_mode_loop)
- def __updateBorderScale(self, loop=False, border=None):
+ def __update_border_scale(self, loop=False, border=None):
# The "border" property in gstreamer is unlimited, but if you go over
# 25 thousand it "loops" the transition instead of smoothing it.
if border is not None:
@@ -254,7 +254,7 @@ class TransitionsListWidget(Gtk.Box, Loggable):
def _load_available_transitions_cb(self):
"""Loads the transitions types and icons into the storemodel."""
for trans_asset in GES.list_assets(GES.TransitionClip):
- trans_asset.icon = self._getIcon(trans_asset.get_id())
+ trans_asset.icon = self._get_icon(trans_asset.get_id())
self.storemodel.append([trans_asset,
str(trans_asset.get_id()),
str(trans_asset.get_meta(
@@ -276,7 +276,7 @@ class TransitionsListWidget(Gtk.Box, Loggable):
self.iconview.show_all()
self.props_widgets.show_all()
self.searchbar.show_all()
- self.__connectUi()
+ self.__connect_ui()
# We REALLY want the infobar to be hidden as space is really constrained
# and yet GTK 3.10 seems to be racy in showing/hiding infobars, so
# this must happen *after* the tab has been made visible/switched to:
@@ -288,7 +288,7 @@ class TransitionsListWidget(Gtk.Box, Loggable):
transition_type != GES.VideoStandardTransitionType.CROSSFADE)
self.__select_transition(transition_type)
border = self.element.get_border()
- self.__updateBorderScale(border=border)
+ self.__update_border_scale(border=border)
self.border_scale.set_value(border)
self.invert_checkbox.set_active(self.element.is_inverted())
loop = border >= BORDER_LOOP_THRESHOLD
@@ -309,14 +309,14 @@ class TransitionsListWidget(Gtk.Box, Loggable):
def deactivate(self):
"""Shows the infobar and hides the transitions UI."""
- self.__disconnectUi()
+ self.__disconnect_ui()
self.iconview.unselect_all()
self.iconview.hide()
self.props_widgets.hide()
self.searchbar.hide()
self.infobar.show()
- def _getIcon(self, transition_nick):
+ def _get_icon(self, transition_nick):
"""Gets an icon pixbuf for the specified transition nickname."""
name = transition_nick + ".png"
try:
@@ -347,7 +347,7 @@ class TransitionsListWidget(Gtk.Box, Loggable):
tooltip.set_markup(txt)
return True
- def getSelectedItem(self):
+ def get_selected_item(self):
path = self.iconview.get_selected_items()
if path == []:
return None
diff --git a/pitivi/undo/markers.py b/pitivi/undo/markers.py
index 4867c64e..f8d5cc85 100644
--- a/pitivi/undo/markers.py
+++ b/pitivi/undo/markers.py
@@ -101,7 +101,7 @@ class MarkerAdded(MarkerAction):
def undo(self):
self.remove()
- def asScenarioAction(self):
+ def as_scenario_action(self):
st = Gst.Structure.new_empty("add-marker")
return st
@@ -115,7 +115,7 @@ class MarkerRemoved(MarkerAction):
def undo(self):
self.add()
- def asScenarioAction(self):
+ def as_scenario_action(self):
st = Gst.Structure.new_empty("remove-marker")
return st
@@ -135,7 +135,7 @@ class MarkerMoved(UndoableAutomaticObjectAction):
def undo(self):
self.ges_marker_list.move(self.auto_object, self.old_position)
- def asScenarioAction(self):
+ def as_scenario_action(self):
st = Gst.Structure.new_empty("move-marker")
return st
diff --git a/pitivi/undo/project.py b/pitivi/undo/project.py
index 56fb652e..22c8b410 100644
--- a/pitivi/undo/project.py
+++ b/pitivi/undo/project.py
@@ -67,7 +67,7 @@ class AssetAddedAction(Action):
Action.__init__(self)
self.asset = asset
- def asScenarioAction(self):
+ def as_scenario_action(self):
st = Gst.Structure.new_empty("add-asset")
st.set_value("id", self.asset.get_id())
type_string = GObject.type_name(self.asset.get_extractable_type())
@@ -89,7 +89,7 @@ class AssetRemovedAction(UndoableAction):
def do(self):
self.project.remove_asset(self.asset)
- def asScenarioAction(self):
+ def as_scenario_action(self):
st = Gst.Structure.new_empty("remove-asset")
st.set_value("id", self.asset.get_id())
type_string = GObject.type_name(self.asset.get_extractable_type())
@@ -133,18 +133,18 @@ class ProjectObserver(MetaContainerObserver):
def __init__(self, project, action_log):
MetaContainerObserver.__init__(self, project, action_log)
- project.connect("asset-added", self._assetAddedCb)
- project.connect("asset-removed", self._assetRemovedCb)
+ project.connect("asset-added", self._asset_added_cb)
+ project.connect("asset-removed", self._asset_removed_cb)
self.timeline_observer = TimelineObserver(project.ges_timeline,
action_log)
- def _assetAddedCb(self, unused_project, asset):
+ def _asset_added_cb(self, unused_project, asset):
if not isinstance(asset, GES.UriClipAsset):
return
action = AssetAddedAction(asset)
self.action_log.push(action)
- def _assetRemovedCb(self, project, asset):
+ def _asset_removed_cb(self, project, asset):
if not isinstance(asset, GES.UriClipAsset):
return
action = AssetRemovedAction(project, asset)
diff --git a/pitivi/undo/timeline.py b/pitivi/undo/timeline.py
index 464a164d..9d41f9e8 100644
--- a/pitivi/undo/timeline.py
+++ b/pitivi/undo/timeline.py
@@ -67,7 +67,7 @@ class TrackElementPropertyChanged(UndoableAction):
self.track_element.set_child_property(
self.property_name, self.old_value)
- def asScenarioAction(self):
+ def as_scenario_action(self):
st = Gst.Structure.new_empty("set-child-property")
st['element-name'] = self.track_element.get_name()
st['property'] = self.property_name
@@ -192,7 +192,7 @@ class TrackElementAdded(TrackElementAction):
def undo(self):
self.remove()
- def asScenarioAction(self):
+ def as_scenario_action(self):
st = Gst.Structure.new_empty("container-add-child")
st["container-name"] = self.clip.get_name()
st["asset-id"] = self.track_element.get_id()
@@ -217,7 +217,7 @@ class TrackElementRemoved(TrackElementAction):
self.add()
self.track_element.props.priority = priority
- def asScenarioAction(self):
+ def as_scenario_action(self):
st = Gst.Structure.new_empty("container-remove-child")
st["container-name"] = self.clip.get_name()
st["child-name"] = self.track_element.get_name()
@@ -315,7 +315,7 @@ class ClipAdded(ClipAction):
def undo(self):
self.remove()
- def asScenarioAction(self):
+ def as_scenario_action(self):
timeline = self.layer.get_timeline()
if hasattr(self.layer, "splitting_object") and \
self.layer.splitting_object is True:
@@ -358,7 +358,7 @@ class ClipRemoved(ClipAction):
for action in self.transition_removed_actions:
action.undo()
- def asScenarioAction(self):
+ def as_scenario_action(self):
timeline = self.layer.get_timeline()
if hasattr(timeline, "ui") and timeline.ui\
and timeline.ui.editing_context is not None:
@@ -475,7 +475,7 @@ class LayerAdded(UndoableAction):
self.ges_timeline.remove_layer(self.ges_layer)
self.ges_timeline.get_asset().pipeline.commit_timeline()
- def asScenarioAction(self):
+ def as_scenario_action(self):
st = Gst.Structure.new_empty("add-layer")
st.set_value("priority", self.ges_layer.props.priority)
st.set_value("auto-transition", self.ges_layer.props.auto_transition)
@@ -499,7 +499,7 @@ class LayerRemoved(UndoableAction):
def undo(self):
self.ges_timeline.add_layer(self.ges_layer)
- def asScenarioAction(self):
+ def as_scenario_action(self):
st = Gst.Structure.new_empty("remove-layer")
st.set_value("priority", self.ges_layer.props.priority)
return st
@@ -524,7 +524,7 @@ class LayerMoved(UndoableAction):
def undo(self):
self.ges_layer.props.priority = self.old_priority
- def asScenarioAction(self):
+ def as_scenario_action(self):
st = Gst.Structure.new_empty("move-layer")
st.set_value("priority", self.ges_layer.props.priority)
return st
@@ -544,7 +544,7 @@ class KeyframeAddedAction(UndoableAction):
def undo(self):
self.control_source.unset(self.keyframe.timestamp)
- def asScenarioAction(self):
+ def as_scenario_action(self):
st = Gst.Structure.new_empty("add-keyframe")
for key, value in self.action_info.items():
st.set_value(key, value)
@@ -567,7 +567,7 @@ class KeyframeRemovedAction(UndoableAction):
def undo(self):
self.control_source.set(self.keyframe.timestamp, self.keyframe.value)
- def asScenarioAction(self):
+ def as_scenario_action(self):
st = Gst.Structure.new_empty("remove-keyframe")
for key, value in self.action_info.items():
st.set_value(key, value)
@@ -585,12 +585,12 @@ class KeyframeChangedAction(UndoableAction):
self.new_snapshot = new_snapshot
def do(self):
- self._applySnapshot(self.new_snapshot)
+ self._apply_snapshot(self.new_snapshot)
def undo(self):
- self._applySnapshot(self.old_snapshot)
+ self._apply_snapshot(self.old_snapshot)
- def _applySnapshot(self, snapshot):
+ def _apply_snapshot(self, snapshot):
time, value = snapshot
self.control_source.set(time, value)
@@ -612,7 +612,7 @@ class ControlSourceSetAction(UndoableAction):
res = self.track_element.remove_control_binding(self.property_name)
assert res
- def asScenarioAction(self):
+ def as_scenario_action(self):
st = Gst.Structure.new_empty("set-control-source")
st.set_value("element-name", self.track_element.get_name())
st.set_value("property-name", self.property_name)
@@ -639,7 +639,7 @@ class ControlSourceRemoveAction(UndoableAction):
self.track_element.set_control_source(self.control_source,
self.property_name, self.binding_type)
- def asScenarioAction(self):
+ def as_scenario_action(self):
st = Gst.Structure.new_empty("remove-control-source")
st.set_value("element-name", self.track_element.get_name())
st.set_value("property-name", self.property_name)
@@ -665,20 +665,20 @@ class LayerObserver(MetaContainerObserver, Loggable):
self.keyframe_observers = {}
self.track_element_observers = {}
- ges_layer.connect("clip-added", self._clipAddedCb)
- ges_layer.connect("clip-removed", self._clipRemovedCb)
+ ges_layer.connect("clip-added", self._clip_added_cb)
+ ges_layer.connect("clip-removed", self._clip_removed_cb)
ges_layer.connect("notify::priority", self.__layer_moved_cb)
self.clip_observers = {}
for ges_clip in ges_layer.get_clips():
- self._connectToClip(ges_clip)
+ self._connect_to_clip(ges_clip)
- def _connectToClip(self, ges_clip):
- ges_clip.connect("child-added", self._clipTrackElementAddedCb)
- ges_clip.connect("child-removed", self._clipTrackElementRemovedCb)
+ def _connect_to_clip(self, ges_clip):
+ ges_clip.connect("child-added", self._clip_track_element_added_cb)
+ ges_clip.connect("child-removed", self._clip_track_element_removed_cb)
for track_element in ges_clip.get_children(recursive=True):
- self._connectToTrackElement(track_element)
+ self._connect_to_track_element(track_element)
if isinstance(ges_clip, GES.TransitionClip):
return
@@ -687,12 +687,12 @@ class LayerObserver(MetaContainerObserver, Loggable):
clip_observer = GObjectObserver(ges_clip, props, self.action_log)
self.clip_observers[ges_clip] = clip_observer
- def _disconnectFromClip(self, ges_clip):
- ges_clip.disconnect_by_func(self._clipTrackElementAddedCb)
- ges_clip.disconnect_by_func(self._clipTrackElementRemovedCb)
+ def _disconnect_from_clip(self, ges_clip):
+ ges_clip.disconnect_by_func(self._clip_track_element_added_cb)
+ ges_clip.disconnect_by_func(self._clip_track_element_removed_cb)
for child in ges_clip.get_children(recursive=True):
- self._disconnectFromTrackElement(child)
+ self._disconnect_from_track_element(child)
if isinstance(ges_clip, GES.TransitionClip):
return
@@ -701,16 +701,16 @@ class LayerObserver(MetaContainerObserver, Loggable):
clip_observer.release()
def _control_binding_added_cb(self, track_element, binding):
- self._connectToControlSource(track_element, binding)
+ self._connect_to_control_source(track_element, binding)
action = ControlSourceSetAction(track_element, binding)
self.action_log.push(action)
def _control_binding_removed_cb(self, track_element, binding):
- self._disconnectFromControlSource(binding)
+ self._disconnect_from_control_source(binding)
action = ControlSourceRemoveAction(track_element, binding)
self.action_log.push(action)
- def _connectToTrackElement(self, track_element):
+ def _connect_to_track_element(self, track_element):
if isinstance(track_element, GES.VideoTransition):
ges_clip = track_element.get_toplevel_parent()
ges_layer = ges_clip.props.layer
@@ -724,7 +724,7 @@ class LayerObserver(MetaContainerObserver, Loggable):
return
for unused_prop, binding in track_element.get_all_control_bindings().items():
- self._connectToControlSource(track_element, binding)
+ self._connect_to_control_source(track_element, binding)
track_element.connect("control-binding-added",
self._control_binding_added_cb)
track_element.connect("control-binding-removed",
@@ -733,18 +733,18 @@ class LayerObserver(MetaContainerObserver, Loggable):
observer = TrackElementObserver(track_element, self.action_log)
self.track_element_observers[track_element] = observer
- def _disconnectFromTrackElement(self, track_element):
+ def _disconnect_from_track_element(self, track_element):
if not isinstance(track_element, GES.VideoTransition):
track_element.disconnect_by_func(self._control_binding_added_cb)
track_element.disconnect_by_func(self._control_binding_removed_cb)
for unused_prop, binding in track_element.get_all_control_bindings().items():
- self._disconnectFromControlSource(binding)
+ self._disconnect_from_control_source(binding)
observer = self.track_element_observers.pop(track_element, None)
# We only keep track of some track_elements.
if observer:
observer.release()
- def _connectToControlSource(self, track_element, binding):
+ def _connect_to_control_source(self, track_element, binding):
control_source = binding.props.control_source
action_info = {"element-name": track_element.get_name(),
"property-name": binding.props.name}
@@ -753,20 +753,20 @@ class LayerObserver(MetaContainerObserver, Loggable):
action_info)
self.keyframe_observers[control_source] = observer
- def _disconnectFromControlSource(self, binding):
+ def _disconnect_from_control_source(self, binding):
control_source = binding.props.control_source
observer = self.keyframe_observers.pop(control_source)
observer.release()
- def _clipAddedCb(self, layer, clip):
- self._connectToClip(clip)
+ def _clip_added_cb(self, layer, clip):
+ self._connect_to_clip(clip)
if isinstance(clip, GES.TransitionClip):
return
action = ClipAdded(layer, clip)
self.action_log.push(action)
- def _clipRemovedCb(self, layer, clip):
- self._disconnectFromClip(clip)
+ def _clip_removed_cb(self, layer, clip):
+ self._disconnect_from_clip(clip)
if isinstance(clip, GES.TransitionClip):
action = TransitionClipRemovedAction.new(layer, clip)
if action:
@@ -775,14 +775,14 @@ class LayerObserver(MetaContainerObserver, Loggable):
action = ClipRemoved(layer, clip)
self.action_log.push(action)
- def _clipTrackElementAddedCb(self, clip, ges_track_element):
- self._connectToTrackElement(ges_track_element)
+ def _clip_track_element_added_cb(self, clip, ges_track_element):
+ self._connect_to_track_element(ges_track_element)
action = TrackElementAdded(clip, ges_track_element)
self.action_log.push(action)
- def _clipTrackElementRemovedCb(self, clip, ges_track_element):
+ def _clip_track_element_removed_cb(self, clip, ges_track_element):
self.debug("%s REMOVED from %s", ges_track_element, clip)
- self._disconnectFromTrackElement(ges_track_element)
+ self._disconnect_from_track_element(ges_track_element)
action = TrackElementRemoved(clip, ges_track_element)
self.action_log.push(action)
diff --git a/pitivi/undo/undo.py b/pitivi/undo/undo.py
index 4d77411d..aae6fa19 100644
--- a/pitivi/undo/undo.py
+++ b/pitivi/undo/undo.py
@@ -40,7 +40,7 @@ class Action(GObject.Object, Loggable):
GObject.Object.__init__(self)
Loggable.__init__(self)
- def asScenarioAction(self):
+ def as_scenario_action(self):
"""Converts the action to a Gst.Structure for a `.scenario` file."""
return None
@@ -185,7 +185,7 @@ class UndoableActionLog(GObject.Object, Loggable):
self.redo_stacks = []
self.stacks = []
self.running = False
- self._checkpoint = self._takeSnapshot()
+ self._checkpoint = self._take_snapshot()
@contextlib.contextmanager
def started(self, action_group_name, **kwargs):
@@ -326,17 +326,17 @@ class UndoableActionLog(GObject.Object, Loggable):
self.undo_stacks.append(stack)
self.emit("move", stack)
- def _takeSnapshot(self):
+ def _take_snapshot(self):
return list(self.undo_stacks)
def checkpoint(self):
if self.stacks:
raise UndoWrongStateError("Recording a transaction", self.stacks)
- self._checkpoint = self._takeSnapshot()
+ self._checkpoint = self._take_snapshot()
def dirty(self):
- current_snapshot = self._takeSnapshot()
+ current_snapshot = self._take_snapshot()
return current_snapshot != self._checkpoint
def _run(self, operation):
diff --git a/pitivi/utils/custom_effect_widgets.py b/pitivi/utils/custom_effect_widgets.py
index 4e731544..cab8ff01 100644
--- a/pitivi/utils/custom_effect_widgets.py
+++ b/pitivi/utils/custom_effect_widgets.py
@@ -45,7 +45,7 @@ def setup_from_ui_file(element_setting_widget, path):
builder = Gtk.Builder()
builder.add_from_file(path)
# Link ui widgets to the corresponding properties of the effect
- element_setting_widget.mapBuilder(builder)
+ element_setting_widget.map_builder(builder)
return builder
@@ -166,11 +166,11 @@ def create_alpha_widget(effect_prop_manager, element_setting_widget, element):
color_button.set_rgba(get_current_rgba())
widget.block_signals()
try:
- widget.setWidgetValue(value)
+ widget.set_widget_value(value)
finally:
widget.unblock_signals()
else:
- widget.setWidgetValue(value)
+ widget.set_widget_value(value)
element.connect("deep-notify", property_changed_cb)
@@ -188,7 +188,7 @@ def create_3point_color_balance_widget(effect_prop_manager, element_setting_widg
"""Creates a widget for the `frei0r-filter-3-point-color-balance` effect."""
ui_path = os.path.join(CUSTOM_WIDGETS_DIR, "frei0r-filter-3-point-color-balance.ui")
builder = setup_from_ui_file(element_setting_widget, ui_path)
- element_setting_widget.mapBuilder(builder)
+ element_setting_widget.map_builder(builder)
color_balance_grid = builder.get_object("base_table")
shadows_wheel = Gtk.HSV()
@@ -236,17 +236,17 @@ def create_3point_color_balance_widget(effect_prop_manager, element_setting_widg
"""Gets the color value for the GES element property."""
return self.adjustment.get_value() / 255
- black_r.getWidgetValue = MethodType(get_widget_scaled_value, black_r)
- black_g.getWidgetValue = MethodType(get_widget_scaled_value, black_g)
- black_b.getWidgetValue = MethodType(get_widget_scaled_value, black_b)
+ black_r.get_widget_value = MethodType(get_widget_scaled_value, black_r)
+ black_g.get_widget_value = MethodType(get_widget_scaled_value, black_g)
+ black_b.get_widget_value = MethodType(get_widget_scaled_value, black_b)
- gray_r.getWidgetValue = MethodType(get_widget_scaled_value, gray_r)
- gray_g.getWidgetValue = MethodType(get_widget_scaled_value, gray_g)
- gray_b.getWidgetValue = MethodType(get_widget_scaled_value, gray_b)
+ gray_r.get_widget_value = MethodType(get_widget_scaled_value, gray_r)
+ gray_g.get_widget_value = MethodType(get_widget_scaled_value, gray_g)
+ gray_b.get_widget_value = MethodType(get_widget_scaled_value, gray_b)
- white_r.getWidgetValue = MethodType(get_widget_scaled_value, white_r)
- white_b.getWidgetValue = MethodType(get_widget_scaled_value, white_b)
- white_g.getWidgetValue = MethodType(get_widget_scaled_value, white_g)
+ white_r.get_widget_value = MethodType(get_widget_scaled_value, white_r)
+ white_b.get_widget_value = MethodType(get_widget_scaled_value, white_b)
+ white_g.get_widget_value = MethodType(get_widget_scaled_value, white_g)
# Update underlying GObject color properties when the color widgets change.
@@ -300,7 +300,7 @@ def create_3point_color_balance_widget(effect_prop_manager, element_setting_widg
wheel.set_color(*new_hsv)
numeric_widget.block_signals()
try:
- numeric_widget.setWidgetValue(round(value * 255))
+ numeric_widget.set_widget_value(round(value * 255))
finally:
numeric_widget.unblock_signals()
@@ -324,7 +324,7 @@ def create_3point_color_balance_widget(effect_prop_manager, element_setting_widg
elif pspec.name in ("white-color-r", "white-color-g", "white-color-b"):
update_wheel("white-color-r", "white-color-g", "white-color-b", highlights_wheel, widget, value)
else:
- widget.setWidgetValue(value)
+ widget.set_widget_value(value)
element.connect("deep-notify", property_changed_cb)
@@ -451,18 +451,18 @@ def create_alphaspot_widget(effect_prop_manager, element_setting_widget, element
shape_picker.set_active(get_current_shape())
widget.block_signals()
try:
- widget.setWidgetValue(value)
+ widget.set_widget_value(value)
finally:
widget.unblock_signals()
elif pspec.name in ("operation",):
op_picker.set_active(get_current_op())
widget.block_signals()
try:
- widget.setWidgetValue(value)
+ widget.set_widget_value(value)
finally:
widget.unblock_signals()
else:
- widget.setWidgetValue(value)
+ widget.set_widget_value(value)
element.connect("deep-notify", property_changed_cb)
diff --git a/pitivi/utils/loggable.py b/pitivi/utils/loggable.py
index a1ef6c94..f9606144 100644
--- a/pitivi/utils/loggable.py
+++ b/pitivi/utils/loggable.py
@@ -834,8 +834,8 @@ class BaseLoggable:
"""
if _can_shortcut_logging(self.log_category, ERROR):
return
- error_object(self.logObjectName(),
- self.log_category, *self.logFunction(*args))
+ error_object(self.log_object_name(),
+ self.log_category, *self.log_function(*args))
def warning(self, *args):
"""Logs a warning.
@@ -845,7 +845,7 @@ class BaseLoggable:
if _can_shortcut_logging(self.log_category, WARN):
return
warning_object(
- self.logObjectName(), self.log_category, *self.logFunction(*args))
+ self.log_object_name(), self.log_category, *self.log_function(*args))
def fixme(self, *args):
"""Logs a fixme.
@@ -854,8 +854,8 @@ class BaseLoggable:
"""
if _can_shortcut_logging(self.log_category, FIXME):
return
- fixme_object(self.logObjectName(),
- self.log_category, *self.logFunction(*args))
+ fixme_object(self.log_object_name(),
+ self.log_category, *self.log_function(*args))
def info(self, *args):
"""Logs an informational message.
@@ -864,8 +864,8 @@ class BaseLoggable:
"""
if _can_shortcut_logging(self.log_category, INFO):
return
- info_object(self.logObjectName(),
- self.log_category, *self.logFunction(*args))
+ info_object(self.log_object_name(),
+ self.log_category, *self.log_function(*args))
def debug(self, *args):
"""Logs a debug message.
@@ -874,8 +874,8 @@ class BaseLoggable:
"""
if _can_shortcut_logging(self.log_category, DEBUG):
return
- debug_object(self.logObjectName(),
- self.log_category, *self.logFunction(*args))
+ debug_object(self.log_object_name(),
+ self.log_category, *self.log_function(*args))
def log(self, *args):
"""Logs a log message.
@@ -884,10 +884,10 @@ class BaseLoggable:
"""
if _can_shortcut_logging(self.log_category, LOG):
return
- log_object(self.logObjectName(),
- self.log_category, *self.logFunction(*args))
+ log_object(self.log_object_name(),
+ self.log_category, *self.log_function(*args))
- def doLog(self, level, where, fmt, *args, **kwargs):
+ def do_log(self, level, where, fmt, *args, **kwargs):
"""Logs a message at the specified level.
Args:
@@ -898,26 +898,26 @@ class BaseLoggable:
fmt (str): The string template for the message.
*args: The arguments used when converting the `fmt`
string template to the message.
- **kwargs: The pre-calculated values from a previous doLog call.
+ **kwargs: The pre-calculated values from a previous do_log call.
Returns:
dict: The calculated variables, to be reused in a
- call to doLog that should show the same location.
+ call to do_log that should show the same location.
"""
if _can_shortcut_logging(self.log_category, level):
return {}
- args = self.logFunction(*args)
- return do_log(level, self.logObjectName(), self.log_category,
+ args = self.log_function(*args)
+ return do_log(level, self.log_object_name(), self.log_category,
fmt, args, where=where, **kwargs)
- def logFunction(self, *args):
+ def log_function(self, *args):
"""Processes the arguments applied to the message template.
Default just returns the arguments unchanged.
"""
return args
- def logObjectName(self):
+ def log_object_name(self):
"""Gets the name of this object."""
for name in ['logName', 'name']:
if hasattr(self, name):
@@ -925,7 +925,7 @@ class BaseLoggable:
return None
- def handleException(self, exc):
+ def handle_exception(self, exc):
self.warning(get_exception_message(exc))
@@ -937,8 +937,8 @@ class Loggable(BaseLoggable):
elif not hasattr(self, 'log_category'):
self.log_category = self.__class__.__name__.lower()
- def logObjectName(self):
- res = BaseLoggable.logObjectName(self)
+ def log_object_name(self):
+ res = BaseLoggable.log_object_name(self)
if not res:
return "<%s at 0x%x>" % (self.__class__.__name__, id(self))
return res
@@ -946,5 +946,5 @@ class Loggable(BaseLoggable):
def error(self, fmt, *args):
if _can_shortcut_logging(self.log_category, ERROR):
return
- do_log(ERROR, self.logObjectName(), self.log_category,
- fmt, self.logFunction(*args), where=-2)
+ do_log(ERROR, self.log_object_name(), self.log_category,
+ fmt, self.log_function(*args), where=-2)
diff --git a/pitivi/utils/pipeline.py b/pitivi/utils/pipeline.py
index 16eba321..2842d4b9 100644
--- a/pitivi/utils/pipeline.py
+++ b/pitivi/utils/pipeline.py
@@ -87,7 +87,7 @@ class SimplePipeline(GObject.Object, Loggable):
self._pipeline = pipeline
self._bus = self._pipeline.get_bus()
self._bus.add_signal_watch()
- self._bus.connect("message", self._busMessageCb)
+ self._bus.connect("message", self._bus_message_cb)
self._listening = False # for the position handler
self._listening_interval = DEFAULT_POSITION_LISTENNING_INTERVAL
self._listening_sig_id = 0
@@ -122,7 +122,7 @@ class SimplePipeline(GObject.Object, Loggable):
return video_sink, widget
- def setForcePositionListener(self, force):
+ def set_force_position_listener(self, force):
self._force_position_listener = force
def release(self):
@@ -133,21 +133,21 @@ class SimplePipeline(GObject.Object, Loggable):
The instance will no longer be usable.
"""
- self._removeWaitingForAsyncDoneTimeout()
- self.deactivatePositionListener()
- self._bus.disconnect_by_func(self._busMessageCb)
+ self._remove_waiting_for_async_done_timeout()
+ self.deactivate_position_listener()
+ self._bus.disconnect_by_func(self._bus_message_cb)
self._bus.remove_signal_watch()
self._pipeline.set_state(Gst.State.NULL)
self._bus = None
- def flushSeek(self):
+ def flush_seek(self):
if self.get_simple_state() == Gst.State.PLAYING:
self.debug("Playing, no need to flush here!")
return
try:
- self.simple_seek(self.getPosition())
+ self.simple_seek(self.get_position())
except PipelineError as e:
self.warning("Could not flush because: %s", e)
@@ -168,9 +168,9 @@ class SimplePipeline(GObject.Object, Loggable):
else:
timeout = MAX_SET_STATE_DURATION
- self._addWaitingForAsyncDoneTimeout(timeout)
+ self._add_waiting_for_async_done_timeout(timeout)
else:
- self._removeWaitingForAsyncDoneTimeout()
+ self._remove_waiting_for_async_done_timeout()
res = self._pipeline.set_state(state)
if res == Gst.StateChangeReturn.FAILURE:
@@ -208,7 +208,7 @@ class SimplePipeline(GObject.Object, Loggable):
def playing(self):
return self.get_simple_state() == Gst.State.PLAYING
- def togglePlayback(self):
+ def toggle_playback(self):
if self.playing():
self.pause()
else:
@@ -216,7 +216,7 @@ class SimplePipeline(GObject.Object, Loggable):
# Position and Seeking methods
- def getPosition(self, fails=True):
+ def get_position(self, fails=True):
"""Gets the current position of the low-level pipeline.
Returns:
@@ -228,7 +228,7 @@ class SimplePipeline(GObject.Object, Loggable):
try:
res, cur = self._pipeline.query_position(Gst.Format.TIME)
except Exception as e:
- self.handleException(e)
+ self.handle_exception(e)
raise PipelineError("Couldn't get position")
if res:
@@ -242,16 +242,16 @@ class SimplePipeline(GObject.Object, Loggable):
self.log("Got position %s", format_ns(cur))
return cur
- def getDuration(self):
+ def get_duration(self):
"""Gets the duration of the low-level pipeline."""
- dur = self._getDuration()
+ dur = self._get_duration()
self.log("Got duration %s", format_ns(dur))
if self._duration != dur:
self.emit("duration-changed", dur)
self._duration = dur
return dur
- def activatePositionListener(self, interval=DEFAULT_POSITION_LISTENNING_INTERVAL):
+ def activate_position_listener(self, interval=DEFAULT_POSITION_LISTENNING_INTERVAL):
"""Activates the position listener.
When activated, the instance will emit the `position` signal at the
@@ -268,18 +268,18 @@ class SimplePipeline(GObject.Object, Loggable):
self._listening = True
self._listening_interval = interval
# if we're in playing, switch it on
- self._listenToPosition(self.get_simple_state() == Gst.State.PLAYING)
+ self._listen_to_position(self.get_simple_state() == Gst.State.PLAYING)
return True
- def deactivatePositionListener(self):
+ def deactivate_position_listener(self):
"""De-activates the position listener."""
- self._listenToPosition(False)
+ self._listen_to_position(False)
self._listening = False
- def _positionListenerCb(self):
+ def _position_listener_cb(self):
try:
try:
- position = self.getPosition()
+ position = self.get_position()
except PipelineError as e:
self.warning("Could not get position because: %s", e)
else:
@@ -289,32 +289,32 @@ class SimplePipeline(GObject.Object, Loggable):
# Call me again.
return True # pylint: disable=lost-exception
- def _listenToPosition(self, listen=True):
+ def _listen_to_position(self, listen=True):
# stupid and dumm method, not many checks done
# i.e. it does NOT check for current state
if listen:
if self._listening and self._listening_sig_id == 0:
self._listening_sig_id = GLib.timeout_add(
self._listening_interval,
- self._positionListenerCb)
+ self._position_listener_cb)
elif self._listening_sig_id != 0:
GLib.source_remove(self._listening_sig_id)
self._listening_sig_id = 0
def _async_done_not_received_cb(self):
self.error("we didn't get async done, this is a bug")
- self._removeWaitingForAsyncDoneTimeout()
+ self._remove_waiting_for_async_done_timeout()
self._recover()
return False
- def _removeWaitingForAsyncDoneTimeout(self):
+ def _remove_waiting_for_async_done_timeout(self):
if not self._busy_async:
return
GLib.source_remove(self._timeout_async_id)
self._timeout_async_id = 0
- def _addWaitingForAsyncDoneTimeout(self, timeout=WATCHDOG_TIMEOUT):
- self._removeWaitingForAsyncDoneTimeout()
+ def _add_waiting_for_async_done_timeout(self, timeout=WATCHDOG_TIMEOUT):
+ self._remove_waiting_for_async_done_timeout()
self._timeout_async_id = GLib.timeout_add_seconds(timeout,
self._async_done_not_received_cb)
@@ -354,7 +354,7 @@ class SimplePipeline(GObject.Object, Loggable):
self._next_seek = None
# clamp between [0, duration]
- position = max(0, min(position, self.getDuration()))
+ position = max(0, min(position, self.get_duration()))
self.debug("Seeking to position: %s", format_ns(position))
res = self._pipeline.seek(1.0,
Gst.Format.TIME,
@@ -366,21 +366,21 @@ class SimplePipeline(GObject.Object, Loggable):
if not res:
raise PipelineError(self.get_name() + " seek failed: " + str(position))
- self._addWaitingForAsyncDoneTimeout()
+ self._add_waiting_for_async_done_timeout()
self.emit('position', position)
- def seekRelative(self, time_delta):
+ def seek_relative(self, time_delta):
try:
- self.simple_seek(self.getPosition() + int(time_delta))
+ self.simple_seek(self.get_position() + int(time_delta))
except PipelineError:
self.error("Error while seeking %s relative", time_delta)
# Private methods
- def _busMessageCb(self, unused_bus, message):
+ def _bus_message_cb(self, unused_bus, message):
if message.type == Gst.MessageType.EOS:
- self.__emitPosition()
+ self.__emit_position()
self.pause()
self.emit('eos')
elif message.type == Gst.MessageType.STATE_CHANGED:
@@ -393,7 +393,7 @@ class SimplePipeline(GObject.Object, Loggable):
if prev == Gst.State.READY and new == Gst.State.PAUSED:
# trigger duration-changed
try:
- self.getDuration()
+ self.get_duration()
except PipelineError as e:
self.warning("Could not get duration because: %s", e)
# no sinks??
@@ -411,48 +411,48 @@ class SimplePipeline(GObject.Object, Loggable):
if self._next_seek is not None:
position = self._next_seek
self.simple_seek(position)
- self._listenToPosition(self._force_position_listener)
+ self._listen_to_position(self._force_position_listener)
elif prev == Gst.State.PAUSED and new == Gst.State.PLAYING:
- self._listenToPosition(True)
+ self._listen_to_position(True)
elif prev == Gst.State.PLAYING and new == Gst.State.PAUSED:
- self._listenToPosition(self._force_position_listener)
+ self._listen_to_position(self._force_position_listener)
if emit_state_change:
self.emit('state-change', new, prev)
elif message.type == Gst.MessageType.ERROR:
error, detail = message.parse_error()
- self._handleErrorMessage(error, detail, message.src)
+ self._handle_error_message(error, detail, message.src)
Gst.debug_bin_to_dot_file_with_ts(self._pipeline,
Gst.DebugGraphDetails.ALL,
"pitivi.error")
if not self._rendering():
- self._removeWaitingForAsyncDoneTimeout()
+ self._remove_waiting_for_async_done_timeout()
self._recover()
elif message.type == Gst.MessageType.DURATION_CHANGED:
self.debug("Querying duration async, because it changed")
- GLib.idle_add(self._queryDurationAsync)
+ GLib.idle_add(self._query_duration_async)
elif message.type == Gst.MessageType.ASYNC_DONE:
self.debug("Async done, ready for action")
self.emit("async-done")
- self._removeWaitingForAsyncDoneTimeout()
+ self._remove_waiting_for_async_done_timeout()
if self._recovery_state == self.RecoveryState.SEEKED_AFTER_RECOVERING:
self._recovery_state = self.RecoveryState.NOT_RECOVERING
self._attempted_recoveries = 0
- self.__emitPosition()
+ self.__emit_position()
if self._next_seek is not None:
self.info("Performing seek after ASYNC_DONE")
self.simple_seek(self._next_seek)
else:
self.log("%s [%r]", message.type, message.src)
- def __emitPosition(self):
+ def __emit_position(self):
# When the pipeline has been paused we need to update the
# timeline/playhead position, as the 'position' signal
# is only emitted every DEFAULT_POSITION_LISTENNING_INTERVAL
# ms and the playhead jumps during the playback.
try:
- position = self.getPosition()
+ position = self.get_position()
except PipelineError as e:
self.warning("Getting the position failed: %s", e)
return None
@@ -478,22 +478,22 @@ class SimplePipeline(GObject.Object, Loggable):
self._recovery_state = self.RecoveryState.STARTED_RECOVERING
self.pause()
- def _queryDurationAsync(self, *unused_args, **unused_kwargs):
+ def _query_duration_async(self, *unused_args, **unused_kwargs):
try:
- self.getDuration()
+ self.get_duration()
except PipelineError as e:
self.warning("Could not get duration because: %s", e)
return False
- def _handleErrorMessage(self, error, detail, source):
+ def _handle_error_message(self, error, detail, source):
self.error("error from %s: %s (%s)", source, error, detail)
self.emit('error', error.message, detail)
- def _getDuration(self):
+ def _get_duration(self):
try:
res, dur = self._pipeline.query_duration(Gst.Format.TIME)
except Exception as e:
- self.handleException(e)
+ self.handle_exception(e)
raise PipelineError("Couldn't get duration: %s" % e)
if not res:
@@ -570,16 +570,16 @@ class Pipeline(GES.Pipeline, SimplePipeline):
self._next_seek = None
return GES.Pipeline.set_mode(self, mode)
- def _getDuration(self):
+ def _get_duration(self):
return self.props.timeline.get_duration()
def do_change_state(self, state):
if state == Gst.StateChange.PAUSED_TO_READY:
- self._removeWaitingForAsyncDoneTimeout()
+ self._remove_waiting_for_async_done_timeout()
return GES.Pipeline.do_change_state(self, state)
- def stepFrame(self, framerate, frames_offset):
+ def step_frame(self, framerate, frames_offset):
"""Seeks backwards or forwards the specified amount of frames.
This clamps the playhead to the project frames.
@@ -589,7 +589,7 @@ class Pipeline(GES.Pipeline, SimplePipeline):
for stepping backwards.
"""
try:
- position = self.getPosition()
+ position = self.get_position()
except PipelineError:
self.warning(
"Couldn't get position (you're framestepping too quickly), ignoring this request")
@@ -618,7 +618,7 @@ class Pipeline(GES.Pipeline, SimplePipeline):
st = Gst.Structure.new_empty("seek")
if self.get_simple_state() == Gst.State.PLAYING:
st.set_value("playback_time", float(
- self.getPosition()) / Gst.SECOND)
+ self.get_position()) / Gst.SECOND)
st.set_value("start", float(position / Gst.SECOND))
st.set_value("flags", "accurate+flush")
self.app.write_action(st)
@@ -629,18 +629,18 @@ class Pipeline(GES.Pipeline, SimplePipeline):
self.error("Error while seeking to position: %s, reason: %s",
format_ns(position), e)
- def _busMessageCb(self, bus, message):
+ def _bus_message_cb(self, bus, message):
if message.type == Gst.MessageType.ASYNC_DONE:
self.app.gui.editor.timeline_ui.timeline.update_visible_overlays()
if message.type == Gst.MessageType.ASYNC_DONE and\
self._commit_wanted:
self.debug("Committing now that ASYNC is DONE")
- self._addWaitingForAsyncDoneTimeout()
+ self._add_waiting_for_async_done_timeout()
self.props.timeline.commit()
self._commit_wanted = False
else:
- SimplePipeline._busMessageCb(self, bus, message)
+ SimplePipeline._bus_message_cb(self, bus, message)
@contextlib.contextmanager
def commit_timeline_after(self):
@@ -663,7 +663,7 @@ class Pipeline(GES.Pipeline, SimplePipeline):
self._was_empty = False
self.log("commit wanted")
else:
- self._addWaitingForAsyncDoneTimeout()
+ self._add_waiting_for_async_done_timeout()
self.props.timeline.commit()
self.debug("Committing right now")
self._was_empty = is_empty
@@ -673,7 +673,7 @@ class Pipeline(GES.Pipeline, SimplePipeline):
if state >= Gst.State.PAUSED and self.props.timeline.is_empty():
self.debug("No ASYNC_DONE will be emitted on empty timelines")
self._was_empty = True
- self._removeWaitingForAsyncDoneTimeout()
+ self._remove_waiting_for_async_done_timeout()
def _rendering(self):
mask = GES.PipelineFlags.RENDER | GES.PipelineFlags.SMART_RENDER
diff --git a/pitivi/utils/proxy.py b/pitivi/utils/proxy.py
index 1a010e87..a2f92448 100644
--- a/pitivi/utils/proxy.py
+++ b/pitivi/utils/proxy.py
@@ -44,51 +44,51 @@ class ProxyingStrategy:
NOTHING = "nothing"
-GlobalSettings.addConfigSection("proxy")
-GlobalSettings.addConfigOption('proxying_strategy',
- section='proxy',
- key='proxying-strategy',
- default=ProxyingStrategy.AUTOMATIC)
-
-GlobalSettings.addConfigOption('num_transcoding_jobs',
- section='proxy',
- key='num-proxying-jobs',
- default=4,
- notify=True)
-PreferencesDialog.addNumericPreference('num_transcoding_jobs',
- description="",
- section="_proxies",
- label=_("Max number of parallel transcoding jobs"),
- lower=1)
-
-GlobalSettings.addConfigOption("max_cpu_usage",
- section="proxy",
- key="max-cpu-usage",
- default=10,
- notify=True)
-PreferencesDialog.addNumericPreference('max_cpu_usage',
- description="",
- section="_proxies",
- label=_("Max CPU usage dedicated to transcoding"),
- lower=1,
- upper=100)
-
-
-GlobalSettings.addConfigOption("auto_scaling_enabled",
- section="proxy",
- key="s-proxy-enabled",
- default=False,
- notify=True)
-GlobalSettings.addConfigOption("default_scaled_proxy_width",
- section="proxy",
- key="s-proxy-width",
- default=1920,
- notify=True)
-GlobalSettings.addConfigOption("default_scaled_proxy_height",
- section="proxy",
- key="s-proxy-height",
- default=1080,
- notify=True)
+GlobalSettings.add_config_section("proxy")
+GlobalSettings.add_config_option('proxying_strategy',
+ section='proxy',
+ key='proxying-strategy',
+ default=ProxyingStrategy.AUTOMATIC)
+
+GlobalSettings.add_config_option('num_transcoding_jobs',
+ section='proxy',
+ key='num-proxying-jobs',
+ default=4,
+ notify=True)
+PreferencesDialog.add_numeric_preference('num_transcoding_jobs',
+ description="",
+ section="_proxies",
+ label=_("Max number of parallel transcoding jobs"),
+ lower=1)
+
+GlobalSettings.add_config_option("max_cpu_usage",
+ section="proxy",
+ key="max-cpu-usage",
+ default=10,
+ notify=True)
+PreferencesDialog.add_numeric_preference('max_cpu_usage',
+ description="",
+ section="_proxies",
+ label=_("Max CPU usage dedicated to transcoding"),
+ lower=1,
+ upper=100)
+
+
+GlobalSettings.add_config_option("auto_scaling_enabled",
+ section="proxy",
+ key="s-proxy-enabled",
+ default=False,
+ notify=True)
+GlobalSettings.add_config_option("default_scaled_proxy_width",
+ section="proxy",
+ key="s-proxy-width",
+ default=1920,
+ notify=True)
+GlobalSettings.add_config_option("default_scaled_proxy_height",
+ section="proxy",
+ key="s-proxy-height",
+ default=1080,
+ notify=True)
ENCODING_FORMAT_PRORES = "prores-raw-in-matroska.gep"
ENCODING_FORMAT_JPEG = "jpeg-raw-in-matroska.gep"
@@ -163,7 +163,7 @@ class ProxyManager(GObject.Object, Loggable):
self.__encoding_target_file = None
self.proxying_unsupported = False
for encoding_format in [ENCODING_FORMAT_JPEG, ENCODING_FORMAT_PRORES]:
- self.__encoding_profile = self.__getEncodingProfile(encoding_format)
+ self.__encoding_profile = self.__get_encoding_profile(encoding_format)
if self.__encoding_profile:
self.__encoding_target_file = encoding_format
self.info("Using %s as proxying format", encoding_format)
@@ -231,8 +231,8 @@ class ProxyManager(GObject.Object, Loggable):
return False
return True
- def __getEncodingProfile(self, encoding_target_file, asset=None, width=None,
- height=None):
+ def __get_encoding_profile(self, encoding_target_file, asset=None, width=None,
+ height=None):
encoding_target = GstPbutils.EncodingTarget.load_from_file(
os.path.join(get_gstpresets_dir(), encoding_target_file))
encoding_profile = encoding_target.get_profile("default")
@@ -304,7 +304,7 @@ class ProxyManager(GObject.Object, Loggable):
return uri.endswith("." + cls.hq_proxy_extension)
- def checkProxyLoadingSucceeded(self, proxy):
+ def check_proxy_loading_succeeded(self, proxy):
if self.is_proxy_asset(proxy):
return True
@@ -312,7 +312,7 @@ class ProxyManager(GObject.Object, Loggable):
return False
@classmethod
- def getTargetUri(cls, obj):
+ def get_target_uri(cls, obj):
if isinstance(obj, GES.Asset):
uri = obj.props.id
else:
@@ -323,7 +323,7 @@ class ProxyManager(GObject.Object, Loggable):
return ".".join(uri.split(".")[:-3])
- def getProxyUri(self, asset, scaled=False):
+ def get_proxy_uri(self, asset, scaled=False):
"""Gets the URI of the corresponding proxy file for the specified asset.
The name looks like:
@@ -357,7 +357,7 @@ class ProxyManager(GObject.Object, Loggable):
return "%s.%s.%s" % (asset.get_id(), file_size,
self.hq_proxy_extension)
- def isAssetFormatWellSupported(self, asset):
+ def is_asset_format_well_supported(self, asset):
for encoding_format in self.WHITELIST_FORMATS:
if self._asset_matches_encoding_format(asset, encoding_format):
self.info("Automatically not proxying")
@@ -376,7 +376,7 @@ class ProxyManager(GObject.Object, Loggable):
return asset_res == target_res
- def __assetNeedsTranscoding(self, asset, scaled=False):
+ def __asset_needs_transcoding(self, asset, scaled=False):
if self.proxying_unsupported:
self.info("No proxying supported")
return False
@@ -395,7 +395,7 @@ class ProxyManager(GObject.Object, Loggable):
if self.app.settings.proxying_strategy == ProxyingStrategy.AUTOMATIC \
and not scaled and not self.is_hq_proxy(asset) and \
- self.isAssetFormatWellSupported(asset):
+ self.is_asset_format_well_supported(asset):
return False
if not self._asset_matches_encoding_format(asset, self.__encoding_profile):
@@ -418,15 +418,15 @@ class ProxyManager(GObject.Object, Loggable):
else:
return not self.is_hq_proxy(asset)
- def __startTranscoder(self, transcoder):
+ def __start_transcoder(self, transcoder):
self.debug("Starting %s", transcoder.props.src_uri)
if self._start_proxying_time == 0:
self._start_proxying_time = time.time()
transcoder.run_async()
self.__running_transcoders.append(transcoder)
- def __assetsMatch(self, asset, proxy):
- if self.__assetNeedsTranscoding(proxy):
+ def __assets_match(self, asset, proxy):
+ if self.__asset_needs_transcoding(proxy):
return False
info = asset.get_info()
@@ -435,7 +435,7 @@ class ProxyManager(GObject.Object, Loggable):
return True
- def __assetLoadedCb(self, proxy, res, asset, transcoder):
+ def __asset_loaded_cb(self, proxy, res, asset, transcoder):
try:
GES.Asset.request_finish(res)
except GLib.Error as e:
@@ -443,15 +443,15 @@ class ProxyManager(GObject.Object, Loggable):
self.emit("error-preparing-asset", asset, proxy, e)
del transcoder
else:
- self.__createTranscoder(asset)
+ self.__create_transcoder(asset)
return
shadow = transcoder and self._is_shadow_transcoder(transcoder)
if not transcoder:
- if not self.__assetsMatch(asset, proxy):
- self.__createTranscoder(asset)
+ if not self.__assets_match(asset, proxy):
+ self.__create_transcoder(asset)
return
else:
transcoder.props.pipeline.props.video_filter.finalize()
@@ -473,7 +473,7 @@ class ProxyManager(GObject.Object, Loggable):
self.app.project_manager.current_project.finalize_proxy(proxy)
else:
self.emit("proxy-ready", asset, proxy)
- self.__emitProgress(proxy, 100)
+ self.__emit_progress(proxy, 100)
def __transcoder_error_cb(self, transcoder, error, unused_details, asset):
self.emit("error-preparing-asset", asset, None, error)
@@ -502,7 +502,7 @@ class ProxyManager(GObject.Object, Loggable):
# be reloaded in the GES cache.
GES.Asset.needs_reload(GES.UriClip, proxy_uri)
GES.Asset.request_async(GES.UriClip, proxy_uri, None,
- self.__assetLoadedCb, asset, transcoder)
+ self.__asset_loaded_cb, asset, transcoder)
if shadow:
# Finish deferred loading for waiting scaled proxy transcoder.
@@ -512,20 +512,20 @@ class ProxyManager(GObject.Object, Loggable):
proxy_uri = waiting_transcoder.props.dest_uri.rstrip(ProxyManager.part_suffix)
GES.Asset.needs_reload(GES.UriClip, proxy_uri)
GES.Asset.request_async(GES.UriClip, proxy_uri, None,
- self.__assetLoadedCb, waiting_asset, waiting_transcoder)
+ self.__asset_loaded_cb, waiting_asset, waiting_transcoder)
self.__waiting_transcoders.remove(pair)
break
try:
- self.__startTranscoder(self.__pending_transcoders.pop())
+ self.__start_transcoder(self.__pending_transcoders.pop())
except IndexError:
if not self.__running_transcoders:
self._transcoded_durations = {}
self._total_time_to_transcode = 0
self._start_proxying_time = 0
- def __emitProgress(self, asset, creation_progress):
+ def __emit_progress(self, asset, creation_progress):
"""Handles the transcoding progress of the specified asset."""
if self._transcoded_durations:
time_spent = time.time() - self._start_proxying_time
@@ -558,7 +558,7 @@ class ProxyManager(GObject.Object, Loggable):
asset.creation_progress = max(0, min(creation_progress, 99))
- self.__emitProgress(asset, asset.creation_progress)
+ self.__emit_progress(asset, asset.creation_progress)
def _get_second_transcoder(self, transcoder):
"""Gets the shadow of a scaled proxy or the other way around."""
@@ -608,19 +608,19 @@ class ProxyManager(GObject.Object, Loggable):
return is_queued
- def __createTranscoder(self, asset, width=None, height=None, shadow=False):
+ def __create_transcoder(self, asset, width=None, height=None, shadow=False):
self._total_time_to_transcode += asset.get_duration() / Gst.SECOND
asset_uri = asset.get_id()
if width and height:
- proxy_uri = self.getProxyUri(asset, scaled=True)
+ proxy_uri = self.get_proxy_uri(asset, scaled=True)
else:
- proxy_uri = self.getProxyUri(asset)
+ proxy_uri = self.get_proxy_uri(asset)
dispatcher = GstTranscoder.TranscoderGMainContextSignalDispatcher.new()
- enc_profile = self.__getEncodingProfile(self.__encoding_target_file,
- asset, width, height)
+ enc_profile = self.__get_encoding_profile(self.__encoding_target_file,
+ asset, width, height)
transcoder = GstTranscoder.Transcoder.new_full(
asset_uri, proxy_uri + ProxyManager.part_suffix, enc_profile,
@@ -651,7 +651,7 @@ class ProxyManager(GObject.Object, Loggable):
transcoder.connect("error", self.__transcoder_error_cb, asset)
if len(self.__running_transcoders) < self.app.settings.num_transcoding_jobs:
- self.__startTranscoder(transcoder)
+ self.__start_transcoder(transcoder)
else:
self.__pending_transcoders.append(transcoder)
@@ -695,10 +695,10 @@ class ProxyManager(GObject.Object, Loggable):
scaled = True
# Create shadow proxies for unsupported assets
- if not self.isAssetFormatWellSupported(asset) and not \
+ if not self.is_asset_format_well_supported(asset) and not \
self.app.settings.proxying_strategy == ProxyingStrategy.NOTHING \
and not shadow:
- hq_uri = self.app.proxy_manager.getProxyUri(asset)
+ hq_uri = self.app.proxy_manager.get_proxy_uri(asset)
if not Gio.File.new_for_uri(hq_uri).query_exists(None):
self.add_job(asset, shadow=True)
@@ -713,19 +713,19 @@ class ProxyManager(GObject.Object, Loggable):
return
if not force_proxying:
- if not self.__assetNeedsTranscoding(asset, scaled):
+ if not self.__asset_needs_transcoding(asset, scaled):
self.debug("Not proxying asset (proxying disabled: %s)",
self.proxying_unsupported)
# Make sure to notify we do not need a proxy for that asset.
self.emit("proxy-ready", asset, None)
return
- proxy_uri = self.getProxyUri(asset, scaled)
+ proxy_uri = self.get_proxy_uri(asset, scaled)
if Gio.File.new_for_uri(proxy_uri).query_exists(None):
self.debug("Using proxy already generated: %s", proxy_uri)
GES.Asset.request_async(GES.UriClip,
proxy_uri, None,
- self.__assetLoadedCb, asset,
+ self.__asset_loaded_cb, asset,
None)
return
@@ -740,9 +740,9 @@ class ProxyManager(GObject.Object, Loggable):
project.scaled_proxy_width = w
project.scaled_proxy_height = h
t_width, t_height = self._scale_asset_resolution(asset, w, h)
- self.__createTranscoder(asset, width=t_width, height=t_height, shadow=shadow)
+ self.__create_transcoder(asset, width=t_width, height=t_height, shadow=shadow)
else:
- self.__createTranscoder(asset, shadow=shadow)
+ self.__create_transcoder(asset, shadow=shadow)
def get_proxy_target(obj):
diff --git a/pitivi/utils/ripple_update_group.py b/pitivi/utils/ripple_update_group.py
index d954ed67..2318aed3 100644
--- a/pitivi/utils/ripple_update_group.py
+++ b/pitivi/utils/ripple_update_group.py
@@ -75,8 +75,8 @@ class RippleUpdateGroup:
self.update_funcs = {}
self.ignore_new_signals = False
- def addVertex(self, widget, signal=None, update_func=None,
- update_func_args=()):
+ def add_vertex(self, widget, signal=None, update_func=None,
+ update_func_args=()):
"""Adds a widget to the list of vertices.
Args:
@@ -92,7 +92,7 @@ class RippleUpdateGroup:
self.update_funcs[widget] = (update_func, update_func_args)
self.arcs[widget] = []
- def addEdge(self, widget_a, widget_b, predicate=None, edge_func=None):
+ def add_edge(self, widget_a, widget_b, predicate=None, edge_func=None):
"""Adds a directional edge from widget_a to widget_b.
Args:
@@ -105,14 +105,14 @@ class RippleUpdateGroup:
"""
self.arcs[widget_a].append((widget_b, predicate, edge_func))
- def addBiEdge(self, widget_a, widget_b, predicate=None, edge_func=None):
+ def add_bi_edge(self, widget_a, widget_b, predicate=None, edge_func=None):
"""Adds a bidirectional edge between the specified vertices.
- See `addEdge`.
+ See `add_edge`.
"""
- self.addEdge(widget_a, widget_b, predicate, edge_func)
+ self.add_edge(widget_a, widget_b, predicate, edge_func)
# pylint: disable=arguments-out-of-order
- self.addEdge(widget_b, widget_a, predicate, edge_func)
+ self.add_edge(widget_b, widget_a, predicate, edge_func)
def _widget_value_changed_cb(self, widget, *unused):
"""Handles an event generated by the specified widget."""
@@ -121,11 +121,11 @@ class RippleUpdateGroup:
self.ignore_new_signals = True
try:
- self._updateValues(widget)
+ self._update_values(widget)
finally:
self.ignore_new_signals = False
- def _updateValues(self, widget):
+ def _update_values(self, widget):
"""Traverses the graph starting from the specified vertex."""
# Initialize the list of (source_widget, arc) to be traversed.
queue = [(widget, arc) for arc in self.arcs[widget]]
diff --git a/pitivi/utils/system.py b/pitivi/utils/system.py
index 83591c7a..aa72140b 100644
--- a/pitivi/utils/system.py
+++ b/pitivi/utils/system.py
@@ -47,7 +47,7 @@ class System(GObject.Object, Loggable):
def has_x11(self):
return self._x11
- def desktopMessage(self, title, message, unused_icon=None):
+ def desktop_message(self, title, message, unused_icon=None):
"""Sends a message to the desktop to be displayed to the user.
Args:
@@ -55,9 +55,9 @@ class System(GObject.Object, Loggable):
message (str): The body of the message.
icon (str): The icon to be shown with the message
"""
- self.debug("desktopMessage(): %s, %s", title, message)
+ self.debug("desktop_message(): %s, %s", title, message)
- def getUniqueFilename(self, string):
+ def get_unique_filename(self, string):
"""Gets a filename which can only be obtained from the specified string.
Args:
@@ -78,9 +78,9 @@ class FreedesktopOrgSystem(System):
from gi.repository import Notify
Notify.init(APPNAME)
- def desktopMessage(self, title, message, icon="pitivi"):
+ def desktop_message(self, title, message, icon="pitivi"):
# call super method for consistent logging
- System.desktopMessage(self, title, message, icon)
+ System.desktop_message(self, title, message, icon)
if "Notify" not in MISSING_SOFT_DEPS:
from gi.repository import Notify
@@ -92,7 +92,7 @@ class FreedesktopOrgSystem(System):
# See for example
# https://bugzilla.gnome.org/show_bug.cgi?id=719627.
self.error(
- "desktopMessage: Failed displaying notification: %s", e.message)
+ "desktop_message: Failed displaying notification: %s", e.message)
return None
return notification
return None
diff --git a/pitivi/utils/threads.py b/pitivi/utils/threads.py
index 6c7f1e53..2f618c31 100644
--- a/pitivi/utils/threads.py
+++ b/pitivi/utils/threads.py
@@ -71,18 +71,18 @@ class ThreadMaster(Loggable):
Loggable.__init__(self)
self.threads = []
- def addThread(self, threadclass, *args):
+ def add_thread(self, threadclass, *args):
"""Instantiates the specified Thread class and starts it."""
assert issubclass(threadclass, Thread)
self.log("Adding thread of type %r", threadclass)
thread = threadclass(*args)
- thread.connect("done", self._threadDoneCb)
+ thread.connect("done", self._thread_done_cb)
self.threads.append(thread)
self.log("starting it...")
thread.start()
self.log("started !")
- def _threadDoneCb(self, thread):
+ def _thread_done_cb(self, thread):
self.log("thread %r is done", thread)
self.threads.remove(thread)
diff --git a/pitivi/utils/timeline.py b/pitivi/utils/timeline.py
index 8e033ce6..8daf545a 100644
--- a/pitivi/utils/timeline.py
+++ b/pitivi/utils/timeline.py
@@ -90,7 +90,7 @@ class Selection(GObject.Object, Loggable):
self.can_group = False
self.can_ungroup = False
- def setSelection(self, objs, mode):
+ def set_selection(self, objs, mode):
"""Updates the current selection.
Args:
@@ -162,12 +162,12 @@ class Selection(GObject.Object, Loggable):
yield obj, True
def select(self, objs):
- self.setSelection(objs, SELECT)
+ self.set_selection(objs, SELECT)
def unselect(self, objs):
- self.setSelection(objs, UNSELECT)
+ self.set_selection(objs, UNSELECT)
- def getSelectedTrackElements(self):
+ def get_selected_track_elements(self):
"""Returns the list of elements contained in this selection.
Returns:
@@ -179,7 +179,7 @@ class Selection(GObject.Object, Loggable):
return set(objects)
- def getSingleClip(self, clip_type=GES.SourceClip):
+ def get_single_clip(self, clip_type=GES.SourceClip):
"""Returns the single-selected clip, if any.
Args:
@@ -295,9 +295,9 @@ class EditingContext(GObject.Object, Loggable):
if self.__log_actions:
self.app.action_log.commit("move-clip")
self.timeline.get_asset().pipeline.commit_timeline()
- self.timeline.ui.app.gui.editor.viewer.clipTrimPreviewFinished()
+ self.timeline.ui.app.gui.editor.viewer.clip_trim_preview_finished()
- def setMode(self, mode):
+ def set_mode(self, mode):
"""Sets the current editing mode.
Args:
@@ -332,10 +332,10 @@ class EditingContext(GObject.Object, Loggable):
if res and self.mode == GES.EditMode.EDIT_TRIM and self.with_video:
if self.edge == GES.Edge.EDGE_START:
- self.timeline.ui.app.gui.editor.viewer.clipTrimPreview(
+ self.timeline.ui.app.gui.editor.viewer.clip_trim_preview(
self.focus, self.focus.props.in_point)
elif self.edge == GES.Edge.EDGE_END:
- self.timeline.ui.app.gui.editor.viewer.clipTrimPreview(
+ self.timeline.ui.app.gui.editor.viewer.clip_trim_preview(
self.focus, self.focus.props.duration + self.focus.props.in_point)
@@ -357,11 +357,11 @@ class Zoomable:
ex : 0.1 = 1 pixel for 10 seconds
ex : 1.0 = 1 pixel for a second
Class Methods
- . pixelToNs(pixels)
- . nsToPixels(time)
- . setZoomRatio
+ . pixel_to_ns(pixels)
+ . ns_to_pixels(time)
+ . set_zoom_ratio
Instance Methods
- . zoomChanged()
+ . zoom_changed()
"""
sigid = None
@@ -377,9 +377,9 @@ class Zoomable:
def __init__(self):
# FIXME: ideally we should deprecate this
- Zoomable.addInstance(self)
+ Zoomable.add_instance(self)
if Zoomable.zoomratio is None:
- Zoomable.zoomratio = self.computeZoomRatio(self._cur_zoom)
+ Zoomable.zoomratio = self.compute_zoom_ratio(self._cur_zoom)
def __del__(self):
if self in Zoomable._instances:
@@ -387,65 +387,60 @@ class Zoomable:
self._instances.remove(self)
@classmethod
- def addInstance(cls, instance):
+ def add_instance(cls, instance):
cls._instances.append(instance)
@classmethod
- def removeInstance(cls, instance):
+ def remove_instance(cls, instance):
cls._instances.remove(instance)
@classmethod
- def setZoomRatio(cls, ratio):
+ def set_zoom_ratio(cls, ratio):
ratio = min(max(cls.min_zoom, ratio), cls.max_zoom)
if cls.zoomratio != ratio:
cls.zoomratio = ratio
for inst in cls._instances:
- inst.zoomChanged()
+ inst.zoom_changed()
@classmethod
- def setZoomLevel(cls, level):
+ def set_zoom_level(cls, level):
level = int(max(0, min(level, cls.zoom_steps)))
if level != cls._cur_zoom:
cls._cur_zoom = level
- cls.setZoomRatio(cls.computeZoomRatio(level))
+ cls.set_zoom_ratio(cls.compute_zoom_ratio(level))
@classmethod
- def getCurrentZoomLevel(cls):
+ def get_current_zoom_level(cls):
return cls._cur_zoom
@classmethod
- def zoomIn(cls):
- cls.setZoomLevel(cls._cur_zoom + 1)
+ def zoom_in(cls):
+ cls.set_zoom_level(cls._cur_zoom + 1)
cls.app.write_action("zoom-in", optional_action_type=True)
@classmethod
- def zoomOut(cls):
- cls.setZoomLevel(cls._cur_zoom - 1)
+ def zoom_out(cls):
+ cls.set_zoom_level(cls._cur_zoom - 1)
cls.app.write_action("zoom-out", optional_action_type=True)
@classmethod
- def computeZoomRatio(cls, x):
+ def compute_zoom_ratio(cls, x):
return ((((float(x) / cls.zoom_steps) ** 3) * cls.zoom_range) +
cls.min_zoom)
@classmethod
- def computeZoomLevel(cls, ratio):
+ def compute_zoom_level(cls, ratio):
return int((
(max(0, ratio - cls.min_zoom) /
cls.zoom_range) ** (1.0 / 3.0)) * cls.zoom_steps)
@classmethod
- def pixelToNs(cls, pixel):
+ def pixel_to_ns(cls, pixel):
"""Returns the duration equivalent of the specified pixel."""
return int(pixel * Gst.SECOND / cls.zoomratio)
@classmethod
- def pixelToNsAt(cls, pixel, ratio):
- """Returns the duration equivalent of the specified pixel."""
- return int(pixel * Gst.SECOND / ratio)
-
- @classmethod
- def nsToPixel(cls, duration):
+ def ns_to_pixel(cls, duration):
"""Returns the pixel equivalent of the specified duration."""
# Here, a long time ago (206f3a05), a pissed programmer said:
# DIE YOU CUNTMUNCH CLOCK_TIME_NONE UBER STUPIDITY OF CRACK BINDINGS !!
@@ -454,7 +449,7 @@ class Zoomable:
return int((float(duration) / Gst.SECOND) * cls.zoomratio)
@classmethod
- def nsToPixelAccurate(cls, duration):
+ def ns_to_pixel_accurate(cls, duration):
"""Returns the pixel equivalent of the specified duration."""
# Here, a long time ago (206f3a05), a pissed programmer said:
# DIE YOU CUNTMUNCH CLOCK_TIME_NONE UBER STUPIDITY OF CRACK BINDINGS !!
@@ -462,5 +457,5 @@ class Zoomable:
return 0
return (float(duration) / Gst.SECOND) * cls.zoomratio
- def zoomChanged(self):
+ def zoom_changed(self):
pass
diff --git a/pitivi/utils/validate.py b/pitivi/utils/validate.py
index d9ddade2..2182c4e8 100644
--- a/pitivi/utils/validate.py
+++ b/pitivi/utils/validate.py
@@ -89,7 +89,7 @@ if GstValidate:
"New window created by the sink,"
" that should not happen")
- def checkWrongWindow(self):
+ def check_wrong_window(self):
try:
windows = subprocess.check_output(["xwininfo", "-tree",
"-root"]).decode(locale.getdefaultlocale()[1])
for w in windows.split('\n'):
@@ -116,7 +116,7 @@ def stop_func(scenario, action):
global monitor
if monitor:
- monitor.checkWrongWindow()
+ monitor.check_wrong_window()
if action.structure.get_boolean("force")[0]:
GstValidate.execute_action(GstValidate.get_action_type(action.type).overriden_type,
@@ -126,7 +126,7 @@ def stop_func(scenario, action):
project = timeline.get_asset()
if project:
- project.setModificationState(False)
+ project.set_modification_state(False)
GstValidate.print_action(action, "Force quitting, ignoring any"
" changes in the project\n")
@@ -221,7 +221,7 @@ def _release_button_if_needed(scenario, timeline, container, layer_prio,
if next_action is None or need_release:
scenario.dragging = False
- x = Zoomable.nsToPixelAccurate(position)
+ x = Zoomable.ns_to_pixel_accurate(position)
event = create_event(Gdk.EventType.BUTTON_RELEASE, button=1, x=x, y=y)
with mock.patch.object(Gtk, "get_event_widget") as get_event_widget:
get_event_widget.return_value = container.ui
@@ -345,7 +345,7 @@ def edit_container_func(scenario, action):
get_event_widget.return_value = event_widget
timeline.ui._button_press_event_cb(event_widget, event)
- x = Zoomable.nsToPixelAccurate(position) -
container_ui.translate_coordinates(timeline.ui.layout.layers_vbox, 0, 0)[0]
+ x = Zoomable.ns_to_pixel_accurate(position) -
container_ui.translate_coordinates(timeline.ui.layout.layers_vbox, 0, 0)[0]
event = create_event(Gdk.EventType.MOTION_NOTIFY, button=1,
x=x, y=y, state=Gdk.ModifierType.BUTTON1_MASK)
with mock.patch.object(Gtk, "get_event_widget") as get_event_widget:
@@ -369,7 +369,7 @@ def edit_container_func(scenario, action):
def split_clip_func(scenario, action):
timeline = scenario.get_pipeline().props.timeline.ui
- timeline.get_parent()._splitCb(None, None)
+ timeline.get_parent()._split_cb(None, None)
return True
@@ -380,14 +380,14 @@ def zoom_func(scenario, action):
GstValidate.print_action(action, action.type.replace('-', ' ') + "\n")
{"zoom-fit": timeline.ui.set_best_zoom_ratio,
- "zoom-out": Zoomable.zoomOut,
- "zoom-in": Zoomable.zoomIn}[action.type]()
+ "zoom-out": Zoomable.zoom_out,
+ "zoom-in": Zoomable.zoom_in}[action.type]()
return True
def set_zoom_level_func(scenario, action):
- Zoomable.setZoomLevel(action.structure["level"])
+ Zoomable.set_zoom_level(action.structure["level"])
return True
diff --git a/pitivi/utils/widgets.py b/pitivi/utils/widgets.py
index ed2a02c8..4e29432d 100644
--- a/pitivi/utils/widgets.py
+++ b/pitivi/utils/widgets.py
@@ -52,21 +52,21 @@ class DynamicWidget(Loggable):
super().__init__()
self.default = default
- def connectValueChanged(self, callback, *args):
+ def connect_value_changed(self, callback, *args):
raise NotImplementedError
- def setWidgetValue(self, value):
+ def set_widget_value(self, value):
raise NotImplementedError
- def getWidgetValue(self):
+ def get_widget_value(self):
raise NotImplementedError
- def getWidgetDefault(self):
+ def get_widget_default(self):
return self.default
- def setWidgetToDefault(self):
+ def set_widget_to_default(self):
if self.default is not None:
- self.setWidgetValue(self.default)
+ self.set_widget_value(self.default)
class DefaultWidget(Gtk.Label):
@@ -76,16 +76,16 @@ class DefaultWidget(Gtk.Label):
Gtk.Label.__init__(self, _("Implement Me"))
self.props.halign = Gtk.Align.START
- def connectValueChanged(self, callback, *args):
+ def connect_value_changed(self, callback, *args):
pass
- def setWidgetValue(self, value):
+ def set_widget_value(self, value):
pass
- def getWidgetValue(self):
+ def get_widget_value(self):
pass
- def setWidgetToDefault(self):
+ def set_widget_to_default(self):
pass
@@ -152,19 +152,19 @@ class TextWidget(Gtk.Box, DynamicWidget):
self.matches = matches
self.__text_changed_cb(None)
- def connectValueChanged(self, callback, *args):
+ def connect_value_changed(self, callback, *args):
return self.connect("value-changed", callback, *args)
- def setWidgetValue(self, value, send_signal=True):
+ def set_widget_value(self, value, send_signal=True):
self.send_signal = send_signal
self.text.set_text(value)
- def getWidgetValue(self):
+ def get_widget_value(self):
if self.matches:
return self.last_valid
return self.text.get_text()
- def addChoices(self, choices):
+ def add_choices(self, choices):
for choice in choices:
self.combo.append_text(choice)
@@ -269,16 +269,16 @@ class NumericWidget(Gtk.Box, DynamicWidget):
if self.handler_id:
self.adjustment.handler_unblock(self.handler_id)
- def connectValueChanged(self, callback, *args):
+ def connect_value_changed(self, callback, *args):
self.handler_id = self.adjustment.connect("value-changed", callback, *args)
- def getWidgetValue(self):
+ def get_widget_value(self):
if self._type:
return self._type(self.adjustment.get_value())
return self.adjustment.get_value()
- def setWidgetValue(self, value):
+ def set_widget_value(self, value):
type_ = type(value)
if self._type is None:
self._type = type_
@@ -319,8 +319,8 @@ class TimeWidget(TextWidget, DynamicWidget):
self._framerate = None
self.text.connect("focus-out-event", self._focus_out_cb)
- def getWidgetValue(self):
- timecode = TextWidget.getWidgetValue(self)
+ def get_widget_value(self):
+ timecode = TextWidget.get_widget_value(self)
if ":" in timecode:
parts = timecode.split(":")
@@ -341,27 +341,27 @@ class TimeWidget(TextWidget, DynamicWidget):
nanosecs = frame_no / float(self._framerate) * Gst.SECOND
return int(nanosecs)
- def setWidgetValue(self, timeNanos, send_signal=True):
+ def set_widget_value(self, timeNanos, send_signal=True):
self.default = timeNanos
timecode = time_to_string(timeNanos)
if timecode.startswith("0:"):
timecode = timecode[2:]
- TextWidget.setWidgetValue(self, timecode, send_signal=send_signal)
+ TextWidget.set_widget_value(self, timecode, send_signal=send_signal)
def _focus_out_cb(self, widget, event):
"""Reset the text to display the current position of the playhead."""
if self.default is not None:
- self.setWidgetValue(self.default)
+ self.set_widget_value(self.default)
- def connectActivateEvent(self, activate_cb):
+ def connect_activate_event(self, activate_cb):
return self.connect("activate", activate_cb)
- def connectFocusEvents(self, focus_in_cb, focus_out_cb):
+ def connect_focus_events(self, focus_in_cb, focus_out_cb):
focus_in_handler_id = self.text.connect("focus-in-event", focus_in_cb)
focus_out_handler_id = self.text.connect("focus-out-event", focus_out_cb)
return [focus_in_handler_id, focus_out_handler_id]
- def setFramerate(self, framerate):
+ def set_framerate(self, framerate):
self._framerate = framerate
@@ -382,7 +382,7 @@ class FractionWidget(TextWidget, DynamicWidget):
for preset in presets:
if isinstance(preset, str):
strval = preset
- preset = self._parseText(preset)
+ preset = self._parse_text(preset)
else:
strval = "%g:%g" % (preset.num, preset.denom)
if flow <= float(preset) <= fhigh:
@@ -393,27 +393,27 @@ class FractionWidget(TextWidget, DynamicWidget):
def _filter(self, text):
if TextWidget._filter(self, text):
- value = self._parseText(text)
+ value = self._parse_text(text)
if self.low <= float(value) and float(value) <= self.high:
return True
return False
- def addPresets(self, presets):
+ def add_presets(self, presets):
choices = []
for preset in presets:
if isinstance(preset, str):
strval = preset
- preset = self._parseText(preset)
+ preset = self._parse_text(preset)
else:
strval = "%g:%g" % (preset.num, preset.denom)
if self.low <= float(preset) <= self.high:
choices.append(strval)
- self.addChoices(choices)
+ self.add_choices(choices)
- def setWidgetValue(self, value):
+ def set_widget_value(self, value):
if isinstance(value, str):
- value = self._parseText(value)
+ value = self._parse_text(value)
elif not hasattr(value, "denom"):
value = Gst.Fraction(value)
if value.denom == 1001:
@@ -423,13 +423,13 @@ class FractionWidget(TextWidget, DynamicWidget):
self.text.set_text(text)
- def getWidgetValue(self):
+ def get_widget_value(self):
if self.last_valid:
- return self._parseText(self.last_valid)
+ return self._parse_text(self.last_valid)
return Gst.Fraction(1, 1)
@classmethod
- def _parseText(cls, text):
+ def _parse_text(cls, text):
match = cls.fraction_regex.match(text)
groups = match.groups()
num = 1.0
@@ -457,18 +457,18 @@ class ToggleWidget(Gtk.Box, DynamicWidget):
self.switch_button.show()
else:
self.switch_button = switch_button
- self.setWidgetToDefault()
+ self.set_widget_to_default()
- def connectValueChanged(self, callback, *args):
+ def connect_value_changed(self, callback, *args):
def callback_wrapper(switch_button, unused_state):
callback(switch_button, *args)
self.switch_button.connect("state-set", callback_wrapper)
- def setWidgetValue(self, value):
+ def set_widget_value(self, value):
self.switch_button.set_active(value)
- def getWidgetValue(self):
+ def get_widget_value(self):
return self.switch_button.get_active()
@@ -483,25 +483,25 @@ class ChoiceWidget(Gtk.Box, DynamicWidget):
self.set_orientation(Gtk.Orientation.HORIZONTAL)
self.contents = Gtk.ComboBoxText()
self.pack_start(self.contents, expand=False, fill=False, padding=0)
- self.setChoices(choices)
+ self.set_choices(choices)
self.contents.show()
disable_scroll(self.contents)
cell = self.contents.get_cells()[0]
cell.props.ellipsize = Pango.EllipsizeMode.END
- def connectValueChanged(self, callback, *args):
+ def connect_value_changed(self, callback, *args):
return self.contents.connect("changed", callback, *args)
- def setWidgetValue(self, value):
+ def set_widget_value(self, value):
try:
self.contents.set_active(self.values.index(value))
except ValueError:
raise ValueError("%r not in %r" % (value, self.values))
- def getWidgetValue(self):
+ def get_widget_value(self):
return self.values[self.contents.get_active()]
- def setChoices(self, choices):
+ def set_choices(self, choices):
self.choices = [choice[0] for choice in choices]
self.values = [choice[1] for choice in choices]
model = Gtk.ListStore(str)
@@ -530,20 +530,20 @@ class PathWidget(Gtk.FileChooserButton, DynamicWidget):
Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, Gtk.STOCK_CLOSE, Gtk.ResponseType.CLOSE)
self.dialog.set_default_response(Gtk.ResponseType.OK)
Gtk.FileChooserButton.__init__(self, dialog=self.dialog)
- self.dialog.connect("response", self._responseCb)
+ self.dialog.connect("response", self._response_cb)
self.uri = ""
- def connectValueChanged(self, callback, *args):
+ def connect_value_changed(self, callback, *args):
return self.connect("value-changed", callback, *args)
- def setWidgetValue(self, value):
+ def set_widget_value(self, value):
self.set_uri(value)
self.uri = value
- def getWidgetValue(self):
+ def get_widget_value(self):
return self.uri
- def _responseCb(self, unused_dialog, response):
+ def _response_cb(self, unused_dialog, response):
if response == Gtk.ResponseType.CLOSE:
self.uri = self.get_uri()
self.emit("value-changed")
@@ -556,13 +556,13 @@ class ColorWidget(Gtk.ColorButton, DynamicWidget):
Gtk.ColorButton.__init__(self)
DynamicWidget.__init__(self, default)
- def connectValueChanged(self, callback, *args):
+ def connect_value_changed(self, callback, *args):
self.connect("color-set", callback, *args)
- def setWidgetValue(self, value):
+ def set_widget_value(self, value):
self.set_rgba(value)
- def getWidgetValue(self):
+ def get_widget_value(self):
return self.get_rgba()
@@ -573,13 +573,13 @@ class FontWidget(Gtk.FontButton, DynamicWidget):
DynamicWidget.__init__(self, default)
self.set_use_font(True)
- def connectValueChanged(self, callback, *args):
+ def connect_value_changed(self, callback, *args):
self.connect("font-set", callback, *args)
- def setWidgetValue(self, font_name):
+ def set_widget_value(self, font_name):
self.set_font_name(font_name)
- def getWidgetValue(self):
+ def get_widget_value(self):
return self.get_font_name()
@@ -607,22 +607,22 @@ class InputValidationWidget(Gtk.Box, DynamicWidget):
self.pack_start(self._warning_sign, expand=False, fill=False, padding=SPACING)
self._warning_sign.set_no_show_all(True)
- self._widget.connectValueChanged(self._widget_value_changed_cb)
+ self._widget.connect_value_changed(self._widget_value_changed_cb)
- def connectValueChanged(self, callback, *args):
- return self._widget.connectValueChanged(callback, args)
+ def connect_value_changed(self, callback, *args):
+ return self._widget.connect_value_changed(callback, args)
- def setWidgetValue(self, value):
- self._widget.setWidgetValue(value)
+ def set_widget_value(self, value):
+ self._widget.set_widget_value(value)
- def getWidgetValue(self):
- value = self._widget.getWidgetValue()
+ def get_widget_value(self):
+ value = self._widget.get_widget_value()
if self._validation_function(value):
return value
- return self.getWidgetDefault()
+ return self.get_widget_default()
def _widget_value_changed_cb(self, unused_widget):
- value = self._widget.getWidgetValue()
+ value = self._widget.get_widget_value()
if self._validation_function(value):
self._warning_sign.hide()
else:
@@ -705,7 +705,7 @@ class GstElementSettingsWidget(Gtk.Box, Loggable):
self.pack_start(widget, True, True, 0)
self.show_all()
- def mapBuilder(self, builder):
+ def map_builder(self, builder):
"""Maps the GStreamer element's properties to corresponding widgets in @builder.
Prop control widgets should be named "element_name::prop_name", where:
@@ -719,7 +719,7 @@ class GstElementSettingsWidget(Gtk.Box, Loggable):
can be used whose name is to be "element_name::prop_name::keyframe".
"""
reset_all_button = builder.get_object("reset_all_button")
- for prop in self._getProperties():
+ for prop in self._get_properties():
widget_name = prop.owner_type.name + "::" + prop.name
widget = builder.get_object(widget_name)
if widget is None:
@@ -734,14 +734,14 @@ class GstElementSettingsWidget(Gtk.Box, Loggable):
reset_widget = reset_all_button
keyframe_name = widget_name + "::" + "keyframe"
keyframe_widget = builder.get_object(keyframe_name)
- self.addPropertyWidget(prop, widget, reset_widget, keyframe_widget)
+ self.add_property_widget(prop, widget, reset_widget, keyframe_widget)
- def addPropertyWidget(self, prop, widget, to_default_btn=None, keyframe_btn=None):
+ def add_property_widget(self, prop, widget, to_default_btn=None, keyframe_btn=None):
"""Connects an element property to a GTK Widget.
Optionally, a reset button widget can also be provided.
Unless you want to connect each widget individually, you should be using
- the "mapBuilder" method instead.
+ the "map_builder" method instead.
"""
if isinstance(widget, DynamicWidget):
# if the widget is already a DynamicWidget we use it as is
@@ -790,7 +790,7 @@ class GstElementSettingsWidget(Gtk.Box, Loggable):
if hasattr(prop, "blurb"):
widget.set_tooltip_text(prop.blurb)
- def _getProperties(self):
+ def _get_properties(self):
if isinstance(self.element, GES.BaseEffect):
props = self.element.list_children_properties()
else:
@@ -863,7 +863,7 @@ class GstElementSettingsWidget(Gtk.Box, Loggable):
widget = self._make_widget_from_gvalue(gvalue, prefered_value)
if caps_values.get(field):
- widget.setWidgetValue(caps_values[field])
+ widget.set_widget_value(caps_values[field])
self.__add_widget_to_grid(grid, field.capitalize(), widget, y)
y += 1
@@ -940,7 +940,7 @@ class GstElementSettingsWidget(Gtk.Box, Loggable):
for val in gvalue:
choices.append([val, val])
widget = ChoiceWidget(choices, default=default[0])
- widget.setWidgetValue(default[0])
+ widget.set_widget_value(default[0])
else:
# TODO: implement widgets for other types.
self.fixme("Unsupported value type: %s", type(gvalue))
@@ -956,7 +956,7 @@ class GstElementSettingsWidget(Gtk.Box, Loggable):
widget = self.properties[pspec]
res, value = self.element.get_child_property(pspec.name)
assert res
- widget.setWidgetValue(value)
+ widget.set_widget_value(value)
def __create_keyframe_toggle_button(self, prop, widget):
keyframe_button = Gtk.ToggleButton()
@@ -1022,11 +1022,11 @@ class GstElementSettingsWidget(Gtk.Box, Loggable):
return
if active:
- track_element.ui_element.showKeyframes(self.element, prop)
+ track_element.ui_element.show_keyframes(self.element, prop)
binding = self.element.get_control_binding(prop.name)
self.__bindings_by_keyframe_button[keyframe_button] = binding
else:
- track_element.ui_element.showDefaultKeyframes()
+ track_element.ui_element.show_default_keyframes()
def __reset_to_default_clicked_cb(self, unused_button, widget,
keyframe_button=None):
@@ -1040,11 +1040,11 @@ class GstElementSettingsWidget(Gtk.Box, Loggable):
track_element = self.__get_track_element_of_same_type(
self.element)
if track_element:
- track_element.ui_element.showDefaultKeyframes()
+ track_element.ui_element.show_default_keyframes()
self.__set_keyframe_active(keyframe_button, False)
self.__display_controlled(keyframe_button, False)
- widget.setWidgetToDefault()
+ widget.set_widget_to_default()
def __get_track_element_of_same_type(self, effect):
track_type = effect.get_track_type()
@@ -1055,13 +1055,13 @@ class GstElementSettingsWidget(Gtk.Box, Loggable):
self.warning("Failed to find track element of type %s", track_type)
return None
- def getSettings(self, with_default=False):
+ def get_settings(self, with_default=False):
"""Gets a name/value dict with the properties."""
values = {}
for prop, widget in self.properties.items():
if not prop.flags & GObject.ParamFlags.WRITABLE:
continue
- value = widget.getWidgetValue()
+ value = widget.get_widget_value()
if value is not None and (value != prop.default_value or with_default):
values[prop.name] = value
return values
@@ -1069,7 +1069,7 @@ class GstElementSettingsWidget(Gtk.Box, Loggable):
def get_caps_values(self):
values = {}
for field, widget in self.caps_widgets.items():
- value = widget.getWidgetValue()
+ value = widget.get_widget_value()
if value is not None:
values[field] = value
@@ -1106,7 +1106,7 @@ class GstElementSettingsWidget(Gtk.Box, Loggable):
if value is None:
value = prop.default_value
if value is not None:
- widget.setWidgetValue(value)
+ widget.set_widget_value(value)
return widget
@@ -1184,13 +1184,13 @@ class GstElementSettingsDialog(Loggable):
self.window.set_transient_for(parent_window)
self.window.show()
- def getSettings(self):
+ def get_settings(self):
"""Gets the settings of the `element`.
Returns:
dict: A property name to value map.
"""
- return self.elementsettings.getSettings()
+ return self.elementsettings.get_settings()
def get_caps(self):
values = self.elementsettings.get_caps_values()
@@ -1203,12 +1203,12 @@ class GstElementSettingsDialog(Loggable):
return caps
return None
- def _resetValuesClickedCb(self, unused_button):
- self.resetAll()
+ def _reset_values_clicked_cb(self, unused_button):
+ self.reset_all()
- def resetAll(self):
+ def reset_all(self):
for unused_prop, widget in self.elementsettings.properties.items():
- widget.setWidgetToDefault()
+ widget.set_widget_to_default()
class ZoomBox(Gtk.Grid, Zoomable):
@@ -1247,7 +1247,7 @@ class ZoomBox(Gtk.Grid, Zoomable):
Gtk.Orientation.HORIZONTAL, adjustment=self._zoom_adjustment)
# Setting _zoom_adjustment's value must be done after we create the
# zoom slider, otherwise the slider remains at the leftmost position.
- self._zoom_adjustment.set_value(Zoomable.getCurrentZoomLevel())
+ self._zoom_adjustment.set_value(Zoomable.get_current_zoom_level())
zoomslider.props.draw_value = False
zoomslider.connect("scroll-event", self._zoom_slider_scroll_cb)
zoomslider.connect("value-changed", self._zoom_slider_changed_cb)
@@ -1266,13 +1266,13 @@ class ZoomBox(Gtk.Grid, Zoomable):
self.show_all()
def _zoom_slider_changed_cb(self, adjustment):
- Zoomable.setZoomLevel(adjustment.get_value())
+ Zoomable.set_zoom_level(adjustment.get_value())
self.timeline.app.write_action("set-zoom-level",
level=adjustment.get_value(),
optional_action_type=True)
if not self._manual_set:
- self.timeline.timeline.scrollToPlayhead(delayed=True)
+ self.timeline.timeline.scroll_to_playhead(delayed=True)
def _zoom_fit_cb(self, button):
self.timeline.timeline.set_best_zoom_ratio(allow_zoom_in=True)
@@ -1290,10 +1290,10 @@ class ZoomBox(Gtk.Grid, Zoomable):
elif delta_y:
delta = math.copysign(1, -delta_y)
if delta:
- Zoomable.setZoomLevel(Zoomable.getCurrentZoomLevel() + delta)
+ Zoomable.set_zoom_level(Zoomable.get_current_zoom_level() + delta)
- def zoomChanged(self):
- zoom_level = self.getCurrentZoomLevel()
+ def zoom_changed(self):
+ zoom_level = self.get_current_zoom_level()
if int(self._zoom_adjustment.get_value()) != zoom_level:
self._manual_set = True
try:
@@ -1305,7 +1305,7 @@ class ZoomBox(Gtk.Grid, Zoomable):
# We assume the width of the ruler is exactly the width of the
# timeline.
width_px = self.timeline.ruler.get_allocated_width()
- timeline_width_ns = Zoomable.pixelToNs(width_px)
+ timeline_width_ns = Zoomable.pixel_to_ns(width_px)
if timeline_width_ns >= Gst.SECOND:
# Translators: %s represents a duration, for example "10 minutes"
tip = _("%s displayed") % beautify_length(timeline_width_ns)
diff --git a/pitivi/viewer/move_scale_overlay.py b/pitivi/viewer/move_scale_overlay.py
index 3c94aa01..890dc785 100644
--- a/pitivi/viewer/move_scale_overlay.py
+++ b/pitivi/viewer/move_scale_overlay.py
@@ -363,7 +363,7 @@ class MoveScaleOverlay(Overlay):
if project:
pipeline = project.pipeline
try:
- position = pipeline.getPosition()
+ position = pipeline.get_position()
return True, position
except PipelineError:
pass
diff --git a/pitivi/viewer/overlay.py b/pitivi/viewer/overlay.py
index 74fa5d2c..096b5dd1 100644
--- a/pitivi/viewer/overlay.py
+++ b/pitivi/viewer/overlay.py
@@ -55,7 +55,7 @@ class Overlay(Gtk.DrawingArea, Loggable):
def _select(self):
self.stack.selected_overlay = self
- self.stack.app.gui.editor.timeline_ui.timeline.selection.setSelection([self._source], SELECT)
+ self.stack.app.gui.editor.timeline_ui.timeline.selection.set_selection([self._source], SELECT)
if isinstance(self._source, GES.TitleSource):
page = 2
elif isinstance(self._source, GES.VideoUriSource):
diff --git a/pitivi/viewer/viewer.py b/pitivi/viewer/viewer.py
index acea8484..d018c5a6 100644
--- a/pitivi/viewer/viewer.py
+++ b/pitivi/viewer/viewer.py
@@ -33,31 +33,31 @@ from pitivi.utils.ui import SPACING
from pitivi.utils.widgets import TimeWidget
from pitivi.viewer.overlay_stack import OverlayStack
-GlobalSettings.addConfigSection("viewer")
-GlobalSettings.addConfigOption("viewerDocked", section="viewer",
- key="docked",
- default=True)
-GlobalSettings.addConfigOption("viewerWidth", section="viewer",
- key="width",
- default=320)
-GlobalSettings.addConfigOption("viewerHeight", section="viewer",
- key="height",
- default=240)
-GlobalSettings.addConfigOption("viewerX", section="viewer",
- key="x-pos",
- default=0)
-GlobalSettings.addConfigOption("viewerY", section="viewer",
- key="y-pos",
- default=0)
-GlobalSettings.addConfigOption("pointSize", section="viewer",
- key="point-size",
- default=25)
-GlobalSettings.addConfigOption("clickedPointColor", section="viewer",
- key="clicked-point-color",
- default='ffa854')
-GlobalSettings.addConfigOption("pointColor", section="viewer",
- key="point-color",
- default='49a0e0')
+GlobalSettings.add_config_section("viewer")
+GlobalSettings.add_config_option("viewerDocked", section="viewer",
+ key="docked",
+ default=True)
+GlobalSettings.add_config_option("viewerWidth", section="viewer",
+ key="width",
+ default=320)
+GlobalSettings.add_config_option("viewerHeight", section="viewer",
+ key="height",
+ default=240)
+GlobalSettings.add_config_option("viewerX", section="viewer",
+ key="x-pos",
+ default=0)
+GlobalSettings.add_config_option("viewerY", section="viewer",
+ key="y-pos",
+ default=0)
+GlobalSettings.add_config_option("pointSize", section="viewer",
+ key="point-size",
+ default=25)
+GlobalSettings.add_config_option("clickedPointColor", section="viewer",
+ key="clicked-point-color",
+ default='ffa854')
+GlobalSettings.add_config_option("pointColor", section="viewer",
+ key="point-color",
+ default='49a0e0')
class ViewerContainer(Gtk.Box, Loggable):
@@ -100,14 +100,14 @@ class ViewerContainer(Gtk.Box, Loggable):
pm = self.app.project_manager
pm.connect("new-project-loaded", self._project_manager_new_project_loaded_cb)
- pm.connect("project-closed", self._projectManagerProjectClosedCb)
+ pm.connect("project-closed", self._project_manager_project_closed_cb)
def _project_manager_new_project_loaded_cb(self, unused_project_manager, project):
project.connect("rendering-settings-changed",
self._project_rendering_settings_changed_cb)
self.set_project(project)
- def _projectManagerProjectClosedCb(self, unused_project_manager, project):
+ def _project_manager_project_closed_cb(self, unused_project_manager, project):
if self.project == project:
project.disconnect_by_func(self._project_rendering_settings_changed_cb)
self.project = None
@@ -119,7 +119,7 @@ class ViewerContainer(Gtk.Box, Loggable):
def _reset_viewer_aspect_ratio(self, project):
"""Resets the viewer aspect ratio."""
self.target.update_aspect_ratio(project)
- self.timecode_entry.setFramerate(project.videorate)
+ self.timecode_entry.set_framerate(project.videorate)
def set_project(self, project):
"""Sets the displayed project.
@@ -128,26 +128,26 @@ class ViewerContainer(Gtk.Box, Loggable):
project (Project): The Project to switch to.
"""
self.debug("Setting project: %r", project)
- self._disconnectFromPipeline()
+ self._disconnect_from_pipeline()
if self.target:
parent = self.target.get_parent()
if parent:
parent.remove(self.target)
- project.pipeline.connect("state-change", self._pipelineStateChangedCb)
- project.pipeline.connect("position", self._positionCb)
- project.pipeline.connect("duration-changed", self._durationChangedCb)
+ project.pipeline.connect("state-change", self._pipeline_state_changed_cb)
+ project.pipeline.connect("position", self._position_cb)
+ project.pipeline.connect("duration-changed", self._duration_changed_cb)
self.project = project
- self.__createNewViewer()
- self._setUiActive()
+ self.__create_new_viewer()
+ self._set_ui_active()
# This must be done at the end, otherwise the created sink widget
# appears in a separate window.
project.pipeline.pause()
- def __createNewViewer(self):
+ def __create_new_viewer(self):
_, sink_widget = self.project.pipeline.create_sink()
self.overlay_stack = OverlayStack(self.app, sink_widget)
@@ -166,17 +166,17 @@ class ViewerContainer(Gtk.Box, Loggable):
# and then we can mark the resize status as showable.
GLib.timeout_add(1000, self.__viewer_realization_done_cb, None)
- def _disconnectFromPipeline(self):
+ def _disconnect_from_pipeline(self):
if self.project is None:
return
pipeline = self.project.pipeline
self.debug("Disconnecting from: %r", pipeline)
- pipeline.disconnect_by_func(self._pipelineStateChangedCb)
- pipeline.disconnect_by_func(self._positionCb)
- pipeline.disconnect_by_func(self._durationChangedCb)
+ pipeline.disconnect_by_func(self._pipeline_state_changed_cb)
+ pipeline.disconnect_by_func(self._position_cb)
+ pipeline.disconnect_by_func(self._duration_changed_cb)
- def _setUiActive(self, active=True):
+ def _set_ui_active(self, active=True):
self.debug("active %r", active)
for item in [self.start_button, self.back_button,
self.playpause_button, self.forward_button,
@@ -185,11 +185,11 @@ class ViewerContainer(Gtk.Box, Loggable):
if active:
self.emit("activate-playback-controls", True)
- def _externalWindowDeleteCb(self, unused_window, unused_event):
+ def _external_window_delete_cb(self, unused_window, unused_event):
self.dock()
return True
- def _externalWindowConfigureCb(self, unused_window, event):
+ def _external_window_configure_cb(self, unused_window, event):
self.settings.viewerWidth = event.width
self.settings.viewerHeight = event.height
self.settings.viewerX = event.x
@@ -205,9 +205,9 @@ class ViewerContainer(Gtk.Box, Loggable):
vbox.set_spacing(SPACING)
self.external_window.add(vbox)
self.external_window.connect(
- "delete-event", self._externalWindowDeleteCb)
+ "delete-event", self._external_window_delete_cb)
self.external_window.connect(
- "configure-event", self._externalWindowConfigureCb)
+ "configure-event", self._external_window_configure_cb)
self.external_vbox = vbox
# Corner marker.
@@ -257,20 +257,20 @@ class ViewerContainer(Gtk.Box, Loggable):
Gtk.IconSize.BUTTON)
self.back_button.set_relief(Gtk.ReliefStyle.NONE)
- self.back_button.connect("clicked", self._backCb)
+ self.back_button.connect("clicked", self._back_cb)
self.back_button.set_tooltip_text(_("Go back one second"))
self.back_button.set_sensitive(False)
bbox.pack_start(self.back_button, False, False, 0)
self.playpause_button = PlayPauseButton()
- self.playpause_button.connect("play", self._playButtonCb)
+ self.playpause_button.connect("play", self._play_button_cb)
bbox.pack_start(self.playpause_button, False, False, 0)
self.playpause_button.set_sensitive(False)
self.forward_button = Gtk.Button.new_from_icon_name("media-seek-forward-symbolic",
Gtk.IconSize.BUTTON)
self.forward_button.set_relief(Gtk.ReliefStyle.NONE)
- self.forward_button.connect("clicked", self._forwardCb)
+ self.forward_button.connect("clicked", self._forward_cb)
self.forward_button.set_tooltip_text(_("Go forward one second"))
self.forward_button.set_sensitive(False)
bbox.pack_start(self.forward_button, False, False, 0)
@@ -285,10 +285,10 @@ class ViewerContainer(Gtk.Box, Loggable):
bbox.pack_start(self.end_button, False, False, 0)
self.timecode_entry = TimeWidget()
- self.timecode_entry.setWidgetValue(0)
+ self.timecode_entry.set_widget_value(0)
self.timecode_entry.set_tooltip_text(
_('Enter a timecode or frame number\nand press "Enter" to go to that position'))
- self.timecode_entry.connectActivateEvent(self._entryActivateCb)
+ self.timecode_entry.connect_activate_event(self._entry_activate_cb)
self.timecode_entry.connect("key_press_event", self._entry_key_press_event_cb)
bbox.pack_start(self.timecode_entry, False, False, 15)
@@ -360,54 +360,54 @@ class ViewerContainer(Gtk.Box, Loggable):
hpane.set_position(event.x_root - self.__translation[0])
vpane.set_position(event.y_root - self.__translation[1])
- def activateCompactMode(self):
+ def activate_compact_mode(self):
self.back_button.hide()
self.forward_button.hide()
- def _entryActivateCb(self, unused_entry):
- nanoseconds = self.timecode_entry.getWidgetValue()
+ def _entry_activate_cb(self, unused_entry):
+ nanoseconds = self.timecode_entry.get_widget_value()
self.app.project_manager.current_project.pipeline.simple_seek(nanoseconds)
- self.app.gui.editor.timeline_ui.timeline.scrollToPlayhead(
+ self.app.gui.editor.timeline_ui.timeline.scroll_to_playhead(
align=Gtk.Align.CENTER, when_not_in_view=True)
def _entry_key_press_event_cb(self, widget, event):
"""Handles the key press events in the timecode_entry widget."""
if event.keyval == Gdk.KEY_Escape:
- self.app.gui.editor.focusTimeline()
+ self.app.gui.editor.focus_timeline()
# Active Timeline calllbacks
- def _durationChangedCb(self, unused_pipeline, duration):
- self._setUiActive(duration > 0)
+ def _duration_changed_cb(self, unused_pipeline, duration):
+ self._set_ui_active(duration > 0)
- def _playButtonCb(self, unused_button, unused_playing):
- self.app.project_manager.current_project.pipeline.togglePlayback()
- self.app.gui.editor.focusTimeline()
+ def _play_button_cb(self, unused_button, unused_playing):
+ self.app.project_manager.current_project.pipeline.toggle_playback()
+ self.app.gui.editor.focus_timeline()
def _start_button_clicked_cb(self, unused_button):
self.app.project_manager.current_project.pipeline.simple_seek(0)
- self.app.gui.editor.focusTimeline()
- self.app.gui.editor.timeline_ui.timeline.scrollToPlayhead(
+ self.app.gui.editor.focus_timeline()
+ self.app.gui.editor.timeline_ui.timeline.scroll_to_playhead(
align=Gtk.Align.START, when_not_in_view=True)
- def _backCb(self, unused_button):
+ def _back_cb(self, unused_button):
# Seek backwards one second
- self.app.project_manager.current_project.pipeline.seekRelative(0 - Gst.SECOND)
- self.app.gui.editor.focusTimeline()
- self.app.gui.editor.timeline_ui.timeline.scrollToPlayhead(
+ self.app.project_manager.current_project.pipeline.seek_relative(0 - Gst.SECOND)
+ self.app.gui.editor.focus_timeline()
+ self.app.gui.editor.timeline_ui.timeline.scroll_to_playhead(
align=Gtk.Align.END, when_not_in_view=True)
- def _forwardCb(self, unused_button):
+ def _forward_cb(self, unused_button):
# Seek forward one second
- self.app.project_manager.current_project.pipeline.seekRelative(Gst.SECOND)
- self.app.gui.editor.focusTimeline()
- self.app.gui.editor.timeline_ui.timeline.scrollToPlayhead(
+ self.app.project_manager.current_project.pipeline.seek_relative(Gst.SECOND)
+ self.app.gui.editor.focus_timeline()
+ self.app.gui.editor.timeline_ui.timeline.scroll_to_playhead(
align=Gtk.Align.START, when_not_in_view=True)
def _end_button_clicked_cb(self, unused_button):
- end = self.app.project_manager.current_project.pipeline.getDuration()
+ end = self.app.project_manager.current_project.pipeline.get_duration()
self.app.project_manager.current_project.pipeline.simple_seek(end)
- self.app.gui.editor.focusTimeline()
- self.app.gui.editor.timeline_ui.timeline.scrollToPlayhead(
+ self.app.gui.editor.focus_timeline()
+ self.app.gui.editor.timeline_ui.timeline.scroll_to_playhead(
align=Gtk.Align.CENTER, when_not_in_view=True)
def undock_cb(self, unused_widget):
@@ -426,10 +426,10 @@ class ViewerContainer(Gtk.Box, Loggable):
position = None
if self.project:
self.overlay_stack.enable_resize_status(False)
- position = self.project.pipeline.getPosition()
+ position = self.project.pipeline.get_position()
self.project.pipeline.set_simple_state(Gst.State.NULL)
self.remove(self.target)
- self.__createNewViewer()
+ self.__create_new_viewer()
self.buttons_container.set_margin_bottom(SPACING)
self.external_vbox.pack_end(self.buttons_container, False, False, 0)
@@ -470,10 +470,10 @@ class ViewerContainer(Gtk.Box, Loggable):
position = None
if self.project:
self.overlay_stack.enable_resize_status(False)
- position = self.project.pipeline.getPosition()
+ position = self.project.pipeline.get_position()
self.project.pipeline.set_simple_state(Gst.State.NULL)
self.external_vbox.remove(self.target)
- self.__createNewViewer()
+ self.__create_new_viewer()
self.undock_button.show()
self.fullscreen_button.destroy()
@@ -502,15 +502,15 @@ class ViewerContainer(Gtk.Box, Loggable):
self.external_window.set_type_hint(Gdk.WindowTypeHint.UTILITY)
self.external_window.show()
- def _positionCb(self, unused_pipeline, position):
+ def _position_cb(self, unused_pipeline, position):
"""Updates the viewer UI widgets if the timeline position changed.
This is meant to be called either by the gobject timer when playing,
or by mainwindow's _timelineSeekCb when the timer is disabled.
"""
- self.timecode_entry.setWidgetValue(position, False)
+ self.timecode_entry.set_widget_value(position, False)
- def clipTrimPreview(self, clip, position):
+ def clip_trim_preview(self, clip, position):
"""Shows a live preview of a clip being trimmed."""
if not hasattr(clip, "get_uri") or isinstance(clip, GES.TitleClip) or clip.props.is_image:
self.log("Not previewing trim for image or title clip: %s", clip)
@@ -574,19 +574,19 @@ class ViewerContainer(Gtk.Box, Loggable):
self.target.switch_widget(sink_widget)
trim_pipeline.disconnect_by_func(self._state_change_cb)
- def clipTrimPreviewFinished(self):
+ def clip_trim_preview_finished(self):
"""Switches back to the project pipeline following a clip trimming."""
if not self.trim_pipeline:
return
self.target.switch_widget(self.overlay_stack)
self.trim_pipeline = None
- def _pipelineStateChangedCb(self, pipeline, state, old_state):
+ def _pipeline_state_changed_cb(self, pipeline, state, old_state):
"""Updates the widgets when the playback starts or stops."""
if state == Gst.State.PLAYING:
st = Gst.Structure.new_empty("play")
self.app.write_action(st)
- self.playpause_button.setPause()
+ self.playpause_button.set_pause()
self.app.simple_inhibit(ViewerContainer.INHIBIT_REASON,
Gtk.ApplicationInhibitFlags.IDLE)
self.overlay_stack.hide_overlays()
@@ -595,11 +595,11 @@ class ViewerContainer(Gtk.Box, Loggable):
if old_state != Gst.State.PAUSED:
st = Gst.Structure.new_empty("pause")
if old_state == Gst.State.PLAYING:
- position_seconds = pipeline.getPosition() / Gst.SECOND
+ position_seconds = pipeline.get_position() / Gst.SECOND
st.set_value("playback_time", position_seconds)
self.app.write_action(st)
- self.playpause_button.setPlay()
+ self.playpause_button.set_play()
self.overlay_stack.show_overlays()
self.app.simple_uninhibit(ViewerContainer.INHIBIT_REASON)
@@ -642,7 +642,7 @@ class ViewerWidget(Gtk.AspectFrame, Loggable):
def update_aspect_ratio(self, project):
"""Forces the DAR of the project on the child widget."""
- ratio_fraction = project.getDAR()
+ ratio_fraction = project.get_dar()
self.debug("Updating aspect ratio to %r", ratio_fraction)
self.props.ratio = float(ratio_fraction)
@@ -712,7 +712,7 @@ class PlayPauseButton(Gtk.Button, Loggable):
self.add(self.image)
self.set_relief(Gtk.ReliefStyle.NONE)
self.playing = False
- self.setPlay()
+ self.set_play()
def set_sensitive(self, value):
Gtk.Button.set_sensitive(self, value)
@@ -722,7 +722,7 @@ class PlayPauseButton(Gtk.Button, Loggable):
self.playing = not self.playing
self.emit("play", self.playing)
- def setPlay(self):
+ def set_play(self):
self.log("Displaying the play image")
self.playing = True
self.set_image(Gtk.Image.new_from_icon_name(
@@ -730,7 +730,7 @@ class PlayPauseButton(Gtk.Button, Loggable):
self.set_tooltip_text(_("Play"))
self.playing = False
- def setPause(self):
+ def set_pause(self):
self.log("Displaying the pause image")
self.playing = False
self.set_image(Gtk.Image.new_from_icon_name(
diff --git a/plugins/console/console.py b/plugins/console/console.py
index d7891694..587aa7c2 100644
--- a/plugins/console/console.py
+++ b/plugins/console/console.py
@@ -89,31 +89,31 @@ class Console(GObject.GObject, Peas.Activatable):
def do_activate(self):
api = self.object
self.app = api.app
- self.app.settings.addConfigSection("console")
-
- self.app.settings.addConfigOption(attrname="consoleColor",
- section="console",
- key="console-color",
- notify=True,
- default=Console.DEFAULT_COLOR)
-
- self.app.settings.addConfigOption(attrname="consoleErrorColor",
- section="console",
- key="console-error-color",
- notify=True,
- default=Console.DEFAULT_STDERR_COLOR)
-
- self.app.settings.addConfigOption(attrname="consoleOutputColor",
- section="console",
- key="console-output-color",
- notify=True,
- default=Console.DEFAULT_STDOUT_COLOR)
-
- self.app.settings.addConfigOption(attrname="consoleFont",
- section="console",
- key="console-font",
- notify=True,
- default=Console.DEFAULT_FONT.to_string())
+ self.app.settings.add_config_section("console")
+
+ self.app.settings.add_config_option(attrname="consoleColor",
+ section="console",
+ key="console-color",
+ notify=True,
+ default=Console.DEFAULT_COLOR)
+
+ self.app.settings.add_config_option(attrname="consoleErrorColor",
+ section="console",
+ key="console-error-color",
+ notify=True,
+ default=Console.DEFAULT_STDERR_COLOR)
+
+ self.app.settings.add_config_option(attrname="consoleOutputColor",
+ section="console",
+ key="console-output-color",
+ notify=True,
+ default=Console.DEFAULT_STDOUT_COLOR)
+
+ self.app.settings.add_config_option(attrname="consoleFont",
+ section="console",
+ key="console-font",
+ notify=True,
+ default=Console.DEFAULT_FONT.to_string())
self.app.settings.reload_attribute_from_file("console", "consoleColor")
self.app.settings.reload_attribute_from_file("console",
@@ -123,24 +123,24 @@ class Console(GObject.GObject, Peas.Activatable):
self.app.settings.reload_attribute_from_file("console", "consoleFont")
PreferencesDialog.add_section("console", _("Console"))
- PreferencesDialog.addColorPreference(attrname="consoleColor",
- label=_("Color"),
- description=None,
- section="console")
- PreferencesDialog.addColorPreference(attrname="consoleErrorColor",
- # Translators: The color of the content from stderr.
- label=_("Standard error color"),
- description=None,
- section="console")
- PreferencesDialog.addColorPreference(attrname="consoleOutputColor",
- # Translators: The color of the content from stdout.
- label=_("Standard output color"),
- description=None,
- section="console")
- PreferencesDialog.addFontPreference(attrname="consoleFont",
- label=_("Font"),
- description=None,
- section="console")
+ PreferencesDialog.add_color_preference(attrname="consoleColor",
+ label=_("Color"),
+ description=None,
+ section="console")
+ PreferencesDialog.add_color_preference(attrname="consoleErrorColor",
+ # Translators: The color of the content from stderr.
+ label=_("Standard error color"),
+ description=None,
+ section="console")
+ PreferencesDialog.add_color_preference(attrname="consoleOutputColor",
+ # Translators: The color of the content from stdout.
+ label=_("Standard output color"),
+ description=None,
+ section="console")
+ PreferencesDialog.add_font_preference(attrname="consoleFont",
+ label=_("Font"),
+ description=None,
+ section="console")
open_action = Gio.SimpleAction.new("open_console", None)
open_action.connect("activate", self.__menu_item_activate_cb)
diff --git a/pylint.rc b/pylint.rc
index 77e872c5..70685b87 100644
--- a/pylint.rc
+++ b/pylint.rc
@@ -134,10 +134,10 @@ class-rgx=[A-Z_][a-zA-Z0-9]+$
function-rgx=[a-z_][a-z0-9_]{2,30}$
# Regular expression which should only match correct method names
-method-rgx=[a-z_][a-zA-Z0-9_]{2,50}$|__[a-z_]{2,100}|test_[a-z_]{2,100}$|do$
+method-rgx=[a-z_][a-z0-9_]{2,50}$|__[a-z_]{2,100}|test_[a-z_]{2,100}$|do$
# Naming hint for method names
-method-name-hint=[a-z_][a-zA-Z0-9_]{2,30}$
+method-name-hint=[a-z_][a-z0-9_]{2,30}$
# Regular expression which should only match correct instance attribute names
attr-rgx=[a-z_][a-z0-9_]{2,30}$
diff --git a/tests/common.py b/tests/common.py
index e17ba02e..4fce00e9 100644
--- a/tests/common.py
+++ b/tests/common.py
@@ -119,7 +119,7 @@ def create_timeline_container(**settings):
project = app.project_manager.new_blank_project()
timeline_container = TimelineContainer(app)
- timeline_container.setProject(project)
+ timeline_container.set_project(project)
timeline = timeline_container.timeline
timeline.get_parent = mock.MagicMock(return_value=timeline_container)
@@ -232,7 +232,7 @@ class TestCase(unittest.TestCase, Loggable):
if detect_leaks:
self.gctrack()
- self.__zoom_level = Zoomable.getCurrentZoomLevel()
+ self.__zoom_level = Zoomable.get_current_zoom_level()
# TODO: Get rid of Previewer.manager.
assert hasattr(Previewer, "manager")
@@ -247,7 +247,7 @@ class TestCase(unittest.TestCase, Loggable):
if detect_leaks:
self.gccollect()
self.gcverify()
- Zoomable.setZoomLevel(self.__zoom_level)
+ Zoomable.set_zoom_level(self.__zoom_level)
# override run() to save a reference to the test result object
def run(self, result=None):
diff --git a/tests/test_application.py b/tests/test_application.py
index aac34782..6713fba5 100644
--- a/tests/test_application.py
+++ b/tests/test_application.py
@@ -39,37 +39,37 @@ class TestPitivi(common.TestCase):
def test_version_info(self):
app = application.Pitivi()
- self.assertTrue(app.isLatest())
+ self.assertTrue(app.is_latest())
app = self.call_version_info_received("invalid")
- self.assertTrue(app.isLatest())
+ self.assertTrue(app.is_latest())
app = self.call_version_info_received(
"%s=CURRENT" % configure.VERSION)
- self.assertTrue(app.isLatest())
- self.assertEqual(configure.VERSION, app.getLatest())
+ self.assertTrue(app.is_latest())
+ self.assertEqual(configure.VERSION, app.get_latest())
app = self.call_version_info_received(
"%s=current\n0=supported" % configure.VERSION)
- self.assertTrue(app.isLatest())
- self.assertEqual(configure.VERSION, app.getLatest())
+ self.assertTrue(app.is_latest())
+ self.assertEqual(configure.VERSION, app.get_latest())
app = self.call_version_info_received("999.0=CURRENT")
- self.assertFalse(app.isLatest())
- self.assertEqual("999.0", app.getLatest())
+ self.assertFalse(app.is_latest())
+ self.assertEqual("999.0", app.get_latest())
app = self.call_version_info_received(
"999.0=CURRENT\n%s=SUPPORTED" % configure.VERSION)
- self.assertFalse(app.isLatest())
- self.assertEqual("999.0", app.getLatest())
+ self.assertFalse(app.is_latest())
+ self.assertEqual("999.0", app.get_latest())
app = self.call_version_info_received("0.91=current")
- self.assertTrue(app.isLatest())
- self.assertEqual("0.91", app.getLatest())
+ self.assertTrue(app.is_latest())
+ self.assertEqual("0.91", app.get_latest())
app = self.call_version_info_received("9999.00000000=current")
- self.assertFalse(app.isLatest())
- self.assertEqual("9999.00000000", app.getLatest())
+ self.assertFalse(app.is_latest())
+ self.assertEqual("9999.00000000", app.get_latest())
def test_inhibition(self):
app = application.Pitivi()
diff --git a/tests/test_check.py b/tests/test_check.py
index 315862a5..2231fdb9 100644
--- a/tests/test_check.py
+++ b/tests/test_check.py
@@ -24,7 +24,7 @@ from tests import common
class TestDependency(common.TestCase):
- def testBoolEvaluation(self):
+ def test_bool_evaluation(self):
dependency = Dependency(
modulename="module1", version_required=None)
self.assertFalse(dependency)
diff --git a/tests/test_clipproperties.py b/tests/test_clipproperties.py
index c638c9b7..9c971fc4 100644
--- a/tests/test_clipproperties.py
+++ b/tests/test_clipproperties.py
@@ -34,37 +34,37 @@ class EffectPropertiesTest(common.TestCase):
def test_calculate_effect_priority(self):
"""Checks the effect priority calculation."""
# Dragging 1 onto itself and nearby.
- self.assertEqual(1, EffectProperties.calculateEffectPriority(
+ self.assertEqual(1, EffectProperties.calculate_effect_priority(
1, 0, Gtk.TreeViewDropPosition.AFTER))
- self.assertEqual(1, EffectProperties.calculateEffectPriority(
+ self.assertEqual(1, EffectProperties.calculate_effect_priority(
1, 1, Gtk.TreeViewDropPosition.BEFORE))
- self.assertEqual(1, EffectProperties.calculateEffectPriority(
+ self.assertEqual(1, EffectProperties.calculate_effect_priority(
1, 1, Gtk.TreeViewDropPosition.INTO_OR_BEFORE))
- self.assertEqual(1, EffectProperties.calculateEffectPriority(
+ self.assertEqual(1, EffectProperties.calculate_effect_priority(
1, 1, Gtk.TreeViewDropPosition.INTO_OR_AFTER))
- self.assertEqual(1, EffectProperties.calculateEffectPriority(
+ self.assertEqual(1, EffectProperties.calculate_effect_priority(
1, 1, Gtk.TreeViewDropPosition.AFTER))
- self.assertEqual(1, EffectProperties.calculateEffectPriority(
+ self.assertEqual(1, EffectProperties.calculate_effect_priority(
1, 2, Gtk.TreeViewDropPosition.BEFORE))
# Dragging 0 and 3 between rows 1 and 2.
- self.assertEqual(1, EffectProperties.calculateEffectPriority(
+ self.assertEqual(1, EffectProperties.calculate_effect_priority(
0, 1, Gtk.TreeViewDropPosition.AFTER))
- self.assertEqual(1, EffectProperties.calculateEffectPriority(
+ self.assertEqual(1, EffectProperties.calculate_effect_priority(
0, 2, Gtk.TreeViewDropPosition.BEFORE))
- self.assertEqual(2, EffectProperties.calculateEffectPriority(
+ self.assertEqual(2, EffectProperties.calculate_effect_priority(
3, 1, Gtk.TreeViewDropPosition.AFTER))
- self.assertEqual(2, EffectProperties.calculateEffectPriority(
+ self.assertEqual(2, EffectProperties.calculate_effect_priority(
3, 2, Gtk.TreeViewDropPosition.BEFORE))
# Dragging 0 and 2 onto 1.
- self.assertEqual(1, EffectProperties.calculateEffectPriority(
+ self.assertEqual(1, EffectProperties.calculate_effect_priority(
0, 1, Gtk.TreeViewDropPosition.INTO_OR_BEFORE))
- self.assertEqual(1, EffectProperties.calculateEffectPriority(
+ self.assertEqual(1, EffectProperties.calculate_effect_priority(
0, 1, Gtk.TreeViewDropPosition.INTO_OR_AFTER))
- self.assertEqual(1, EffectProperties.calculateEffectPriority(
+ self.assertEqual(1, EffectProperties.calculate_effect_priority(
2, 1, Gtk.TreeViewDropPosition.INTO_OR_BEFORE))
- self.assertEqual(1, EffectProperties.calculateEffectPriority(
+ self.assertEqual(1, EffectProperties.calculate_effect_priority(
2, 1, Gtk.TreeViewDropPosition.INTO_OR_AFTER))
@@ -77,7 +77,7 @@ class TransformationPropertiesTest(BaseTestTimeline):
app = timeline_container.app
transformation_box = TransformationProperties(app)
project = timeline_container._project
- transformation_box._newProjectLoadedCb(app, project)
+ transformation_box._new_project_loaded_cb(app, project)
return transformation_box
@@ -89,7 +89,7 @@ class TransformationPropertiesTest(BaseTestTimeline):
spin_buttons = transformation_box.spin_buttons
# Add a clip and select it
- clip = self.addClipsSimple(timeline, 1)[0]
+ clip = self.add_clips_simple(timeline, 1)[0]
timeline.selection.select([clip])
# Check that spin buttons display the correct values by default
@@ -118,7 +118,7 @@ class TransformationPropertiesTest(BaseTestTimeline):
spin_buttons = transformation_box.spin_buttons
# Add a clip and select it
- clip = self.addClipsSimple(timeline, 1)[0]
+ clip = self.add_clips_simple(timeline, 1)[0]
timeline.selection.select([clip])
source = transformation_box.source
self.assertIsNotNone(source)
@@ -152,7 +152,7 @@ class TransformationPropertiesTest(BaseTestTimeline):
spin_buttons = transformation_box.spin_buttons
# Add two clips and select the first one
- clips = self.addClipsSimple(timeline, 2)
+ clips = self.add_clips_simple(timeline, 2)
timeline.selection.select([clips[0]])
source = transformation_box.source
self.assertIsNotNone(source)
@@ -184,7 +184,7 @@ class TransformationPropertiesTest(BaseTestTimeline):
timeline = transformation_box.app.gui.editor.timeline_ui.timeline
# Add a clip and select it
- clip = self.addClipsSimple(timeline, 1)[0]
+ clip = self.add_clips_simple(timeline, 1)[0]
timeline.selection.select([clip])
source = transformation_box.source
self.assertIsNotNone(source)
@@ -221,7 +221,7 @@ class TransformationPropertiesTest(BaseTestTimeline):
spin_buttons = transformation_box.spin_buttons
# Add a clip and select it
- clip = self.addClipsSimple(timeline, 1)[0]
+ clip = self.add_clips_simple(timeline, 1)[0]
timeline.selection.select([clip])
source = transformation_box.source
self.assertIsNotNone(source)
@@ -237,7 +237,7 @@ class TransformationPropertiesTest(BaseTestTimeline):
for prop in ["posx", "posy", "width", "height"]:
for index, offset in enumerate(offsets):
timestamp, value = inpoint + offset, offset * 10
- with mock.patch.object(pipeline, "getPosition") as get_position:
+ with mock.patch.object(pipeline, "get_position") as get_position:
get_position.return_value = start + offset
spin_buttons[prop].set_value(value)
@@ -253,7 +253,7 @@ class TransformationPropertiesTest(BaseTestTimeline):
pipeline = timeline._project.pipeline
# Add a clip and select it
- clip = self.addClipsSimple(timeline, 1)[0]
+ clip = self.add_clips_simple(timeline, 1)[0]
timeline.selection.select([clip])
source = transformation_box.source
self.assertIsNotNone(source)
@@ -281,7 +281,7 @@ class TransformationPropertiesTest(BaseTestTimeline):
prev_keyframe_ts = offsets[prev_index] + inpoint
next_keyframe_ts = offsets[next_index] + inpoint
- with mock.patch.object(pipeline, "getPosition") as get_position:
+ with mock.patch.object(pipeline, "get_position") as get_position:
get_position.return_value = start + position
with mock.patch.object(pipeline, "simple_seek") as simple_seek:
transformation_box._prev_keyframe_btn.clicked()
@@ -301,7 +301,7 @@ class TransformationPropertiesTest(BaseTestTimeline):
timeline = transformation_box.app.gui.editor.timeline_ui.timeline
# Add a clip and select it
- clip = self.addClipsSimple(timeline, 1)[0]
+ clip = self.add_clips_simple(timeline, 1)[0]
timeline.selection.select([clip])
source = transformation_box.source
self.assertIsNotNone(source)
diff --git a/tests/test_editorperspective.py b/tests/test_editorperspective.py
index a4562a3c..4d633ddd 100644
--- a/tests/test_editorperspective.py
+++ b/tests/test_editorperspective.py
@@ -41,12 +41,12 @@ class TestEditorPerspective(common.TestCase):
(2, GES.TitleClip()),
(0, GES.SourceClip()),
(1, GES.TransitionClip())]:
- editorperspective.switchContextTab(b_element)
+ editorperspective.switch_context_tab(b_element)
self.assertEqual(editorperspective.context_tabs.get_current_page(),
expected_tab,
b_element)
# Make sure the tab does not change when using an invalid argument.
- editorperspective.switchContextTab("invalid")
+ editorperspective.switch_context_tab("invalid")
self.assertEqual(editorperspective.context_tabs.get_current_page(),
expected_tab)
@@ -77,10 +77,10 @@ class TestEditorPerspective(common.TestCase):
dialog.get_new_uri.return_value = None
# Call the actual callback
- app.proxy_manager.checkProxyLoadingSucceeded = \
+ app.proxy_manager.check_proxy_loading_succeeded = \
mock.MagicMock(return_value=has_proxy)
- editorperspective._projectManagerMissingUriCb(
+ editorperspective._project_manager_missing_uri_cb(
project_manager, project, error, asset)
self.assertTrue(constructor.called)
@@ -88,11 +88,11 @@ class TestEditorPerspective(common.TestCase):
self.assertEqual(failed_cb.called, not has_proxy)
app.project_manager.connect("missing-uri",
- editorperspective._projectManagerMissingUriCb)
+ editorperspective._project_manager_missing_uri_cb)
mainloop.quit()
disconnect_all_by_func(app.project_manager,
- editorperspective._projectManagerMissingUriCb)
+ editorperspective._project_manager_missing_uri_cb)
app.project_manager.connect("missing-uri", __pm_missing_uri_cb)
diff --git a/tests/test_effects.py b/tests/test_effects.py
index 1288fa94..be047420 100644
--- a/tests/test_effects.py
+++ b/tests/test_effects.py
@@ -85,7 +85,7 @@ class EffectsPropertiesManagerTest(common.TestCase):
self.builder = Gtk.Builder()
path = os.path.join(os.path.dirname(__file__), "plugins", "test_alpha.ui")
self.builder.add_objects_from_file(path, widgets)
- self.element_settings_widget.mapBuilder(self.builder)
+ self.element_settings_widget.map_builder(self.builder)
return self.builder.get_object("GstAlpha::black-sensitivity")
def _register_alpha_widget(self, widgets):
@@ -99,8 +99,8 @@ class EffectsPropertiesManagerTest(common.TestCase):
self.element_settings_widget = GstElementSettingsWidget(self.alpha_effect, PROPS_TO_IGNORE)
self.effects_prop_manager.emit("create-widget", self.element_settings_widget, self.alpha_effect)
- self.effects_prop_manager._connectAllWidgetCallbacks(self.element_settings_widget, self.alpha_effect)
- self.effects_prop_manager._postConfiguration(self.alpha_effect, self.element_settings_widget)
+ self.effects_prop_manager._connect_all_widget_callbacks(self.element_settings_widget,
self.alpha_effect)
+ self.effects_prop_manager._post_configuration(self.alpha_effect, self.element_settings_widget)
def test_wrapping(self):
"""Checks UI updating results in updating the effect."""
@@ -113,12 +113,12 @@ class EffectsPropertiesManagerTest(common.TestCase):
self.assertTrue(isinstance(wrapped_spin_button, NumericWidget))
# Check if the wrapper has the correct default value
- self.assertEqual(self.prop.default_value, wrapped_spin_button.getWidgetDefault())
+ self.assertEqual(self.prop.default_value, wrapped_spin_button.get_widget_default())
# Check if the callbacks are functioning
value = (1 + self.prop.default_value) % self.prop.maximum
- wrapped_spin_button.setWidgetValue(value)
- self.assertEqual(wrapped_spin_button.getWidgetValue(), value)
+ wrapped_spin_button.set_widget_value(value)
+ self.assertEqual(wrapped_spin_button.get_widget_value(), value)
_, prop_value = self.alpha_effect.get_child_property(self.prop_name)
self.assertEqual(prop_value, value)
@@ -159,10 +159,10 @@ class EffectsPropertiesManagerTest(common.TestCase):
wrapped_spin_button = self.element_settings_widget.properties[self.prop]
_, prop_value = self.alpha_effect.get_child_property(self.prop_name)
self.assertEqual(self.prop.default_value, prop_value)
- self.assertEqual(self.prop.default_value, wrapped_spin_button.getWidgetValue())
+ self.assertEqual(self.prop.default_value, wrapped_spin_button.get_widget_value())
# Set the property value to a different value than the default
- wrapped_spin_button.setWidgetValue((1 + self.prop.default_value) % self.prop.maximum)
+ wrapped_spin_button.set_widget_value((1 + self.prop.default_value) % self.prop.maximum)
_, prop_value = self.alpha_effect.get_child_property(self.prop_name)
self.assertEqual(prop_value, (1 + self.prop.default_value) % self.prop.maximum)
@@ -172,7 +172,7 @@ class EffectsPropertiesManagerTest(common.TestCase):
prop_reset_button.clicked()
_, prop_value = self.alpha_effect.get_child_property(self.prop_name)
self.assertEqual(self.prop.default_value, prop_value)
- self.assertEqual(self.prop.default_value, wrapped_spin_button.getWidgetValue())
+ self.assertEqual(self.prop.default_value, wrapped_spin_button.get_widget_value())
def test_dependent_properties(self):
"""Checks dependent properties updating is handled correctly."""
@@ -199,12 +199,12 @@ class EffectsPropertiesManagerTest(common.TestCase):
effect = GES.Effect.new("aspectratiocrop")
effect.set_child_property = set_child_property
- effect_widget = manager.getEffectConfigurationUI(effect)
+ effect_widget = manager.get_effect_configuration_ui(effect)
widgets = {prop.name: widget
for prop, widget in effect_widget.properties.items()}
# Simulate the user choosing an aspect-ratio.
- widgets["aspect-ratio"].setWidgetValue(Gst.Fraction(4, 3))
+ widgets["aspect-ratio"].set_widget_value(Gst.Fraction(4, 3))
mainloop.run(until_empty=True)
diff --git a/tests/test_log.py b/tests/test_log.py
index 3beda995..cecb7f8a 100644
--- a/tests/test_log.py
+++ b/tests/test_log.py
@@ -29,7 +29,7 @@ class LogTester(log.Loggable):
class LogFunctionTester(log.Loggable):
- def logFunction(self, fmt, *args):
+ def log_function(self, fmt, *args):
return (("override " + fmt), ) + args[1:]
@@ -63,14 +63,14 @@ class TestLog(TestWithHandler):
# just test for parsing semi- or non-valid FLU_DEBUG variables
- def testSetDebug(self):
+ def test_set_debug(self):
log.set_debug(":5")
log.set_debug("*")
log.set_debug("5")
# test for adding a log handler
- def testLimitInvisible(self):
+ def test_limit_invisible(self):
log.set_debug("testlog:%d" % log.INFO)
log.add_limited_log_handler(self.handler)
@@ -85,7 +85,7 @@ class TestLog(TestWithHandler):
self.assertFalse(self.level)
self.assertFalse(self.message)
- def testLimitedVisible(self):
+ def test_limited_visible(self):
log.set_debug("testlog:%d" % log.INFO)
log.add_limited_log_handler(self.handler)
@@ -100,7 +100,7 @@ class TestLog(TestWithHandler):
self.assertEqual(self.level, log.WARN)
self.assertEqual(self.message, 'also visible')
- def testFormatStrings(self):
+ def test_format_strings(self):
log.set_debug("testlog:%d" % log.INFO)
log.add_limited_log_handler(self.handler)
@@ -109,7 +109,7 @@ class TestLog(TestWithHandler):
self.assertEqual(self.level, log.INFO)
self.assertEqual(self.message, '42 the answer')
- def testLimitedError(self):
+ def test_limited_error(self):
log.set_debug("testlog:%d" % log.ERROR)
log.add_limited_log_handler(self.handler)
@@ -118,7 +118,7 @@ class TestLog(TestWithHandler):
self.assertEqual(self.level, log.ERROR)
self.assertEqual(self.message, 'error')
- def testLogHandlerLimitedLevels(self):
+ def test_log_handler_limited_levels(self):
log.set_debug("testlog:%d" % log.INFO)
log.add_limited_log_handler(self.handler)
@@ -137,7 +137,7 @@ class TestLog(TestWithHandler):
# test that we get all log messages
- def testLogHandler(self):
+ def test_log_handler(self):
log.set_debug("testlog:%d" % log.INFO)
log.add_log_handler(self.handler)
@@ -156,14 +156,14 @@ class TestOwnLogHandler(TestWithHandler):
# test if our own log handler correctly mangles the message
- def testOwnLogHandlerLimited(self):
+ def test_own_log_handler_limited(self):
log.set_debug("testlog:%d" % log.INFO)
log.add_log_handler(self.handler)
self.tester.log("visible")
self.assertEqual(self.message, 'override visible')
- def testLogHandlerAssertion(self):
+ def test_log_handler_assertion(self):
self.assertRaises(TypeError, log.add_limited_log_handler, None)
@@ -178,21 +178,21 @@ class TestGetExceptionMessage(unittest.TestCase):
def func1(self):
raise TypeError("I am in func1")
- def testLevel2(self):
+ def test_level2(self):
try:
self.func2()
self.fail("Should not get to this point")
except TypeError as e:
- self.verifyException(e)
+ self.verify_exception(e)
- def testLevel3(self):
+ def test_level3(self):
try:
self.func3()
self.fail("Should not get to this point")
except TypeError as e:
- self.verifyException(e)
+ self.verify_exception(e)
- def verifyException(self, e):
+ def verify_exception(self, e):
message = log.get_exception_message(e)
self.assertTrue("func1()" in message, message)
self.assertTrue("test_log.py" in message, message)
@@ -201,7 +201,7 @@ class TestGetExceptionMessage(unittest.TestCase):
class TestLogSettings(unittest.TestCase):
- def testSet(self):
+ def test_set(self):
old = log.get_log_settings()
log.set_debug('*:5')
self.assertNotEqual(old, log.get_log_settings())
@@ -212,7 +212,7 @@ class TestLogSettings(unittest.TestCase):
class TestLogNames(unittest.TestCase):
- def testGetLevelCode(self):
+ def test_get_level_code(self):
self.assertEqual(1, log.get_level_int('ERROR'))
self.assertEqual(2, log.get_level_int('WARN'))
self.assertEqual(3, log.get_level_int('FIXME'))
@@ -220,7 +220,7 @@ class TestLogNames(unittest.TestCase):
self.assertEqual(5, log.get_level_int('DEBUG'))
self.assertEqual(6, log.get_level_int('LOG'))
- def testGetLevelName(self):
+ def test_get_level_name(self):
self.assertEqual('ERROR', log.get_level_name(1))
self.assertEqual('WARN', log.get_level_name(2))
self.assertEqual('FIXME', log.get_level_name(3))
diff --git a/tests/test_medialibrary.py b/tests/test_medialibrary.py
index e413e74f..21e0da47 100644
--- a/tests/test_medialibrary.py
+++ b/tests/test_medialibrary.py
@@ -51,7 +51,7 @@ class BaseTestMediaLibrary(common.TestCase):
self.medialibrary.finalize()
self.medialibrary = None
- def _customSetUp(self, project_uri=None, **settings):
+ def _custom_set_up(self, project_uri=None, **settings):
# Always make sure we start with a clean medialibrary, and no other
# is connected to some assets.
self.clean()
@@ -68,13 +68,13 @@ class BaseTestMediaLibrary(common.TestCase):
self.app.project_manager.new_blank_project()
self.app.project_manager.current_project.connect(
- "loaded", self.projectLoadedCb)
+ "loaded", self.project_loaded_cb)
self.mainloop.run()
- def projectLoadedCb(self, unused_project, unused_timeline):
+ def project_loaded_cb(self, unused_project, unused_timeline):
self.mainloop.quit()
- def _progressBarCb(self, progressbar, unused_pspec):
+ def _progress_bar_cb(self, progressbar, unused_pspec):
if self.check_no_transcoding:
self.assertTrue(progressbar.props.fraction == 1.0 or
progressbar.props.fraction == 0.0,
@@ -94,13 +94,13 @@ class BaseTestMediaLibrary(common.TestCase):
def check_import(self, samples, proxying_strategy=ProxyingStrategy.ALL,
check_no_transcoding=False):
- self._customSetUp(proxying_strategy=proxying_strategy,
- num_transcoding_jobs=4,
- last_clip_view=medialibrary.SHOW_TREEVIEW)
+ self._custom_set_up(proxying_strategy=proxying_strategy,
+ num_transcoding_jobs=4,
+ last_clip_view=medialibrary.SHOW_TREEVIEW)
self.check_no_transcoding = check_no_transcoding
self.medialibrary._progressbar.connect(
- "notify::fraction", self._progressBarCb)
+ "notify::fraction", self._progress_bar_cb)
self._create_assets(samples)
self.mainloop.run()
@@ -188,7 +188,7 @@ class TestMediaLibrary(BaseTestMediaLibrary):
mock_filter = mock.Mock()
mock_filter.mime_type = "video/mp4"
- self._customSetUp()
+ self._custom_set_up()
mlib = self.medialibrary
# Test HQ Proxies are filtered
@@ -228,14 +228,14 @@ class TestMediaLibrary(BaseTestMediaLibrary):
self.check_import([sample_name],
check_no_transcoding=True)
- def testDisableProxies(self):
+ def test_disable_proxies(self):
sample_name = "30fps_numeroted_frames_red.mkv"
with common.cloned_sample(sample_name):
self.check_import([sample_name],
proxying_strategy=ProxyingStrategy.NOTHING,
check_no_transcoding=True)
- def testSaveProjectWithRemovedProxy(self):
+ def test_save_project_with_removed_proxy(self):
sample_name = "30fps_numeroted_frames_red.mkv"
with common.cloned_sample(sample_name):
self.check_import([sample_name])
@@ -256,7 +256,7 @@ class TestMediaLibrary(BaseTestMediaLibrary):
project_uri = Gst.filename_to_uri(tempfile.NamedTemporaryFile().name)
project.save(project.ges_timeline, project_uri, None, True)
- self._customSetUp(project_uri)
+ self._custom_set_up(project_uri)
self.assertNotEqual(project, self.app.project_manager.current_project)
project = self.app.project_manager.current_project
self.assertEqual(project.list_assets(GES.Extractable), [])
@@ -266,7 +266,7 @@ class TestMediaLibrary(BaseTestMediaLibrary):
"30fps_numeroted_frames_blue.webm"]
with common.cloned_sample(*samples):
self.check_import(samples, **kwargs)
- self.assertEqual(len(list(self.medialibrary.getSelectedPaths())),
+ self.assertEqual(len(list(self.medialibrary.get_selected_paths())),
len(self.samples))
def test_newly_imported_asset_selected_optimize_all(self):
@@ -289,7 +289,7 @@ class TestMediaLibrary(BaseTestMediaLibrary):
self.stop_using_proxies(delete_proxies=True)
asset = self.medialibrary.storemodel[0][medialibrary.COL_ASSET]
- proxy_uri = self.app.proxy_manager.getProxyUri(asset)
+ proxy_uri = self.app.proxy_manager.get_proxy_uri(asset)
# Requesting UriClip sync will return None if the asset is not in cache
# this way we make sure that this asset used to exist
@@ -307,7 +307,7 @@ class TestMediaLibrary(BaseTestMediaLibrary):
self.assertTrue("Proxy creation progress:" in
self.medialibrary.storemodel[0][medialibrary.COL_INFOTEXT])
- # Run the mainloop and let _progressBarCb stop it when the proxy is
+ # Run the mainloop and let _progress_bar_cb stop it when the proxy is
# ready
self.mainloop.run()
@@ -334,12 +334,12 @@ class TestMediaLibrary(BaseTestMediaLibrary):
# Create and disable scaled proxy
proxy = self.check_add_proxy(asset, scaled=True)
- scaled_uri = self.app.proxy_manager.getProxyUri(asset, scaled=True)
+ scaled_uri = self.app.proxy_manager.get_proxy_uri(asset, scaled=True)
self.check_disable_proxy(proxy, asset)
# Create and disable HQ proxy
proxy = self.check_add_proxy(asset)
- hq_uri = self.app.proxy_manager.getProxyUri(asset)
+ hq_uri = self.app.proxy_manager.get_proxy_uri(asset)
self.check_disable_proxy(proxy, asset)
# Check both files exist
@@ -368,7 +368,7 @@ class TestMediaLibrary(BaseTestMediaLibrary):
# Create scaled proxy
proxy = self.check_add_proxy(asset, scaled=True)
- proxy_uri = self.app.proxy_manager.getProxyUri(asset, scaled=True)
+ proxy_uri = self.app.proxy_manager.get_proxy_uri(asset, scaled=True)
# Change target resolution and trigger regeneration (1/4 Asset width)
self.app.project_manager.current_project.scaled_proxy_width = 80
@@ -399,15 +399,15 @@ class TestMediaLibrary(BaseTestMediaLibrary):
# Mark all formats as unsupported
with mock.patch.object(self.app.proxy_manager,
- "isAssetFormatWellSupported",
+ "is_asset_format_well_supported",
return_value=False):
# Create scaled proxy
proxy = self.check_add_proxy(asset, scaled=True, w=80, h=34)
- proxy_uri = self.app.proxy_manager.getProxyUri(asset, scaled=True)
+ proxy_uri = self.app.proxy_manager.get_proxy_uri(asset, scaled=True)
self.mainloop.run(until_empty=True)
# Check that HQ proxy was created
- hq_uri = self.app.proxy_manager.getProxyUri(asset)
+ hq_uri = self.app.proxy_manager.get_proxy_uri(asset)
self.assertTrue(os.path.exists(Gst.uri_get_location(hq_uri)))
# Delete scaled proxy
@@ -416,7 +416,7 @@ class TestMediaLibrary(BaseTestMediaLibrary):
# Check that we revert to HQ proxy
proxy = self.medialibrary.storemodel[0][medialibrary.COL_ASSET]
- proxy_uri = self.app.proxy_manager.getProxyUri(asset, scaled=False)
+ proxy_uri = self.app.proxy_manager.get_proxy_uri(asset, scaled=False)
self.assertEqual(proxy.props.id, proxy_uri)
# Delete HQ Proxy
@@ -427,7 +427,7 @@ class TestMediaLibrary(BaseTestMediaLibrary):
with common.cloned_sample(audio_sample):
asset_uri = common.get_sample_uri(audio_sample)
with common.created_project_file(asset_uri) as uri:
- self._customSetUp(project_uri=uri)
+ self._custom_set_up(project_uri=uri)
def test_scale_proxy_audio_post_import(self):
sample = "mp3_sample.mp3"
@@ -447,5 +447,5 @@ class TestMediaLibrary(BaseTestMediaLibrary):
def test_missing_uri_displayed(self):
asset_uri = common.get_sample_uri("image-which-does-not-exist.png")
with common.created_project_file(asset_uri) as uri:
- self._customSetUp(project_uri=uri)
+ self._custom_set_up(project_uri=uri)
self.assertTrue(self.medialibrary._import_warning_infobar.props.visible)
diff --git a/tests/test_pipeline.py b/tests/test_pipeline.py
index f5f9dc8d..65abe503 100644
--- a/tests/test_pipeline.py
+++ b/tests/test_pipeline.py
@@ -41,7 +41,7 @@ class TestPipeline(common.TestCase):
error = GLib.Error.new_literal(Gst.core_error_quark(),
"fake", Gst.CoreError.TOO_LAZY)
message.parse_error = mock.MagicMock(return_value=(error, "fake"))
- pipeline._busMessageCb(None, message)
+ pipeline._bus_message_cb(None, message)
def test_recovery(self):
"""Checks the recovery mechanism."""
@@ -106,12 +106,12 @@ class TestPipeline(common.TestCase):
message.type = Gst.MessageType.STATE_CHANGED
message.src = pipe._pipeline
message.parse_state_changed.return_value = (Gst.State.NULL, Gst.State.READY, Gst.State.PAUSED)
- pipe._busMessageCb(None, message)
+ pipe._bus_message_cb(None, message)
# Pretend the state changed to PAUSED.
message.parse_state_changed.return_value = (Gst.State.READY, Gst.State.PAUSED,
Gst.State.VOID_PENDING)
self.assertEqual(pipe._next_seek, None)
- pipe._busMessageCb(None, message)
+ pipe._bus_message_cb(None, message)
self.assertEqual(pipe._recovery_state, SimplePipeline.RecoveryState.SEEKED_AFTER_RECOVERING)
self.assertTrue(pipe._busy_async)
# The pipeline should have tried to seek back to the last position.
@@ -121,7 +121,7 @@ class TestPipeline(common.TestCase):
message.type = Gst.MessageType.ASYNC_DONE
with mock.patch.object(pipe, "get_state") as get_state:
get_state.return_value = (0, Gst.State.PAUSED, 0)
- pipe._busMessageCb(None, message)
+ pipe._bus_message_cb(None, message)
self.assertEqual(pipe._recovery_state, SimplePipeline.RecoveryState.NOT_RECOVERING)
# Should still be busy because of seeking to _next_seek.
self.assertTrue(pipe._busy_async)
@@ -129,7 +129,7 @@ class TestPipeline(common.TestCase):
# Pretend the seek async operation finished.
message.type = Gst.MessageType.ASYNC_DONE
- pipe._busMessageCb(None, message)
+ pipe._bus_message_cb(None, message)
self.assertEqual(pipe._recovery_state, SimplePipeline.RecoveryState.NOT_RECOVERING)
self.assertFalse(pipe._busy_async)
self.assertIsNone(pipe._next_seek)
@@ -140,7 +140,7 @@ class TestPipeline(common.TestCase):
timeline = GES.Timeline()
pipe.set_timeline(timeline)
- with mock.patch.object(pipe, "get_simple_state") as get_state:
+ with mock.patch.object(pipe, "get_state") as get_state:
get_state.return_value = (0, Gst.State.PAUSED, 0)
with mock.patch.object(timeline, "commit") as commit:
with pipe.commit_timeline_after():
diff --git a/tests/test_prefs.py b/tests/test_prefs.py
index 913a3706..940068e7 100644
--- a/tests/test_prefs.py
+++ b/tests/test_prefs.py
@@ -36,67 +36,67 @@ class PreferencesDialogTest(common.TestCase):
with mock.patch.object(Gtk.Dialog, "set_transient_for"):
PreferencesDialog(app)
- def testNumeric(self):
- PreferencesDialog.addNumericPreference('numericPreference1',
- label="Open Range",
- section="timeline",
- description="This option has no upper bound",
- lower=-10)
+ def test_numeric(self):
+ PreferencesDialog.add_numeric_preference('numericPreference1',
+ label="Open Range",
+ section="timeline",
+ description="This option has no upper bound",
+ lower=-10)
self.assertTrue(
'numericPreference1' in PreferencesDialog.prefs["timeline"])
- PreferencesDialog.addNumericPreference('numericPreference2',
- label="Closed Range",
- section="timeline",
- description="This option has both upper and lower bounds",
- lower=-10,
- upper=10000)
+ PreferencesDialog.add_numeric_preference('numericPreference2',
+ label="Closed Range",
+ section="timeline",
+ description="This option has both upper and lower bounds",
+ lower=-10,
+ upper=10000)
- def testText(self):
- PreferencesDialog.addTextPreference('textPreference1',
- label="Unfiltered",
- section="timeline",
- description="Anything can go in this box")
-
- PreferencesDialog.addTextPreference('textPreference2',
- label="Numbers only",
- section="timeline",
- description="This input validates its input with a regex",
- matches=r"^-?\d+(\.\d+)?$")
-
- def testOther(self):
- PreferencesDialog.addPathPreference('aPathPreference',
- label="Test Path",
- section="timeline",
- description="Test the path widget")
-
- PreferencesDialog.addChoicePreference('aChoicePreference',
- label="Swallow Velocity",
+ def test_text(self):
+ PreferencesDialog.add_text_preference('textPreference1',
+ label="Unfiltered",
section="timeline",
- description="What is the airspeed velocity of a coconut-laden
swallow?",
- choices=(
- ("42 Knots", 32),
- ("9 furlongs per fortnight", 42),
- ("I don't know that!", None)))
+ description="Anything can go in this box")
- PreferencesDialog.addChoicePreference('aLongChoicePreference',
- label="Favorite Color",
+ PreferencesDialog.add_text_preference('textPreference2',
+ label="Numbers only",
section="timeline",
- description="What is the color of the parrot's plumage?",
- choices=(
- ("Mauve", "Mauve"),
- ("Chartreuse", "Chartreuse"),
- ("Magenta", "Magenta"),
- ("Pink", "Pink"),
- ("Norwegian Blue", "Norwegian Blue"),
- ("Yellow Ochre", "Yellow Ochre")))
+ description="This input validates its input with a regex",
+ matches=r"^-?\d+(\.\d+)?$")
- PreferencesDialog.addTogglePreference('aTogglePreference',
- label="Test Toggle",
+ def test_other(self):
+ PreferencesDialog.add_path_preference('aPathPreference',
+ label="Test Path",
section="timeline",
- description="Test the toggle widget")
+ description="Test the path widget")
+
+ PreferencesDialog.add_choice_preference('aChoicePreference',
+ label="Swallow Velocity",
+ section="timeline",
+ description="What is the airspeed velocity of a
coconut-laden swallow?",
+ choices=(
+ ("42 Knots", 32),
+ ("9 furlongs per fortnight", 42),
+ ("I don't know that!", None)))
- PreferencesDialog.addFontPreference('aFontPreference',
- label="Foo Font",
- section="timeline",
- description="Test the font widget")
+ PreferencesDialog.add_choice_preference('aLongChoicePreference',
+ label="Favorite Color",
+ section="timeline",
+ description="What is the color of the parrot's plumage?",
+ choices=(
+ ("Mauve", "Mauve"),
+ ("Chartreuse", "Chartreuse"),
+ ("Magenta", "Magenta"),
+ ("Pink", "Pink"),
+ ("Norwegian Blue", "Norwegian Blue"),
+ ("Yellow Ochre", "Yellow Ochre")))
+
+ PreferencesDialog.add_toggle_preference('aTogglePreference',
+ label="Test Toggle",
+ section="timeline",
+ description="Test the toggle widget")
+
+ PreferencesDialog.add_font_preference('aFontPreference',
+ label="Foo Font",
+ section="timeline",
+ description="Test the font widget")
diff --git a/tests/test_preset.py b/tests/test_preset.py
index 32382272..1f8dbe47 100644
--- a/tests/test_preset.py
+++ b/tests/test_preset.py
@@ -54,58 +54,58 @@ class TestPresetBasics(common.TestCase):
def setUp(self):
self.manager = PresetManager(None, tempfile.mkdtemp(), System())
- self.manager._serializePreset = lambda preset: dict(preset.items())
+ self.manager._serialize_preset = lambda preset: dict(preset.items())
def tearDown(self):
clear_preset_manager_paths(self.manager)
- def testAddPreset(self):
- self.manager.createPreset('preseT onE', {'name1': '1A'})
- self.manager.createPreset('Preset One', {'name1': '2A'})
+ def test_add_preset(self):
+ self.manager.create_preset('preseT onE', {'name1': '1A'})
+ self.manager.create_preset('Preset One', {'name1': '2A'})
self.assertEqual(2, len(self.manager.presets))
- def testAddPresetWithNonAsciiName(self):
+ def test_add_preset_with_non_ascii_name(self):
unicode_name = "ソリッド・スネーク"
- self.manager.createPreset(unicode_name, {})
- self.assertTrue(unicode_name in self.manager.getPresetNames())
+ self.manager.create_preset(unicode_name, {})
+ self.assertTrue(unicode_name in self.manager.get_preset_names())
- def testRenamePreset(self):
- self.manager.createPreset('preseT onE', {'name1': '1A'})
- self.manager.createPreset('Preset Two', {'name1': '2A'})
+ def test_rename_preset(self):
+ self.manager.create_preset('preseT onE', {'name1': '1A'})
+ self.manager.create_preset('Preset Two', {'name1': '2A'})
self.assertEqual(2, len(self.manager.presets))
- self.manager.restorePreset('preseT onE')
- self.manager.saveCurrentPreset('Preset One')
+ self.manager.restore_preset('preseT onE')
+ self.manager.save_current_preset('Preset One')
self.assertEqual(2, len(self.manager.presets))
- self.manager.saveCurrentPreset('Preset TWO')
+ self.manager.save_current_preset('Preset TWO')
self.assertEqual(2, len(self.manager.presets))
- self.manager.saveCurrentPreset('Preset two')
+ self.manager.save_current_preset('Preset two')
self.assertEqual(2, len(self.manager.presets))
- self.manager.saveCurrentPreset('Preset Two')
+ self.manager.save_current_preset('Preset Two')
self.assertEqual(1, len(self.manager.presets))
- self.manager.saveCurrentPreset('Preset Two')
+ self.manager.save_current_preset('Preset Two')
self.assertEqual(1, len(self.manager.presets))
- self.manager.saveCurrentPreset('preseT onE')
+ self.manager.save_current_preset('preseT onE')
self.assertEqual(1, len(self.manager.presets))
- def testLoadHandlesMissingDirectory(self):
+ def test_load_handles_missing_directory(self):
self.manager.default_path = '/pitivi/non/existing/directory/1'
self.manager.user_path = '/pitivi/non/existing/directory/2'
- self.manager.loadAll()
+ self.manager.load_all()
- def testGetUniquePresetName(self):
- name = self.manager.getNewPresetName()
+ def test_get_unique_preset_name(self):
+ name = self.manager.get_new_preset_name()
self.assertEqual('New preset', name)
- self.manager.createPreset(name, {})
- new_preset1 = self.manager.getNewPresetName()
+ self.manager.create_preset(name, {})
+ new_preset1 = self.manager.get_new_preset_name()
self.assertEqual('New preset 1', new_preset1)
# Intentionally add 'New preset 2' before 'New preset 1'.
- self.manager.createPreset('New preset 2', {})
- self.manager.createPreset('New preset 1', {})
- new_preset3 = self.manager.getNewPresetName()
+ self.manager.create_preset('New preset 2', {})
+ self.manager.create_preset('New preset 1', {})
+ new_preset3 = self.manager.get_new_preset_name()
self.assertEqual('New preset 3', new_preset3)
@@ -118,103 +118,103 @@ class TestAudioPresetsIO(common.TestCase):
def tearDown(self):
clear_preset_manager_paths(self.manager)
- def createOtherManager(self):
+ def create_other_manager(self):
other_manager = AudioPresetManager(System())
other_manager.user_path = self.manager.user_path
return other_manager
- def testSaveAndLoad(self):
- self.manager.createPreset("Vegeta",
- {"channels": 6000,
- "sample-rate": 44100})
- self.manager.saveAll()
+ def test_save_and_load(self):
+ self.manager.create_preset("Vegeta",
+ {"channels": 6000,
+ "sample-rate": 44100})
+ self.manager.save_all()
self.assertEqual(1, count_user_presets(self.manager))
- self.manager.createPreset("Nappa",
- {"channels": 4000,
- "sample-rate": 44100})
- self.manager.saveAll()
+ self.manager.create_preset("Nappa",
+ {"channels": 4000,
+ "sample-rate": 44100})
+ self.manager.save_all()
self.assertEqual(2, count_user_presets(self.manager))
- other_manager = self.createOtherManager()
- other_manager.loadAll()
+ other_manager = self.create_other_manager()
+ other_manager.load_all()
total_presets = count_default_presets(
self.manager) + count_user_presets(self.manager)
self.assertEqual(total_presets, len(other_manager.presets))
- def testNonAsciiFilenamesSaveAndLoad(self):
+ def test_non_ascii_filenames_save_and_load(self):
non_ascii_preset_name = "Solid Snake (ソリッド・スネーク) \\#!\"'$%?&*"
- self.manager.createPreset(non_ascii_preset_name,
- {"channels": 2,
- "sample-rate": 44100})
+ self.manager.create_preset(non_ascii_preset_name,
+ {"channels": 2,
+ "sample-rate": 44100})
snake = self.manager.presets[non_ascii_preset_name]
self.assertEqual(2, len(snake))
- self.manager.saveAll()
+ self.manager.save_all()
- other_manager = self.createOtherManager()
- other_manager.loadAll()
+ other_manager = self.create_other_manager()
+ other_manager.load_all()
self.assertEqual(1 + count_default_presets(
other_manager), len(other_manager.presets))
snaaaake = other_manager.presets[non_ascii_preset_name]
self.assertEqual(snake, snaaaake)
- def testInvalidFilenamesSaveAndLoad(self):
+ def test_invalid_filenames_save_and_load(self):
# This would be an invalid file name as is.
preset_name = " / % "
- self.manager.createPreset(preset_name,
- {"channels": 2,
- "sample-rate": 44100})
+ self.manager.create_preset(preset_name,
+ {"channels": 2,
+ "sample-rate": 44100})
values = self.manager.presets[preset_name]
self.assertEqual(2, len(values))
- self.manager.saveAll()
+ self.manager.save_all()
- other_manager = self.createOtherManager()
- other_manager.loadAll()
+ other_manager = self.create_other_manager()
+ other_manager.load_all()
self.assertEqual(1 + count_default_presets(
other_manager), len(other_manager.presets))
other_values = other_manager.presets[preset_name]
self.assertEqual(values, other_values)
- def testRemovingSystemPresets(self):
- self.manager.loadAll()
+ def test_removing_system_presets(self):
+ self.manager.load_all()
system_presets = list(self.manager.presets.keys())
for preset_name in system_presets:
- self.manager.restorePreset(preset_name)
- self.manager.removeCurrentPreset()
+ self.manager.restore_preset(preset_name)
+ self.manager.remove_current_preset()
# Check that the files have not been deleted or changed.
other_manager = AudioPresetManager(System())
other_manager.user_path = "/pitivi/non/existing/directory"
- other_manager.loadAll()
+ other_manager.load_all()
for preset_name in system_presets:
- self.assertTrue(other_manager.hasPreset(preset_name))
+ self.assertTrue(other_manager.has_preset(preset_name))
# Check that overwrite files have been created and
# they mark the system presets as deleted.
- other_manager = self.createOtherManager()
- other_manager.loadAll()
+ other_manager = self.create_other_manager()
+ other_manager.load_all()
for preset_name in system_presets:
- self.assertFalse(other_manager.hasPreset(preset_name))
+ self.assertFalse(other_manager.has_preset(preset_name))
- def testRenamingSystemPresets(self):
- self.manager.loadAll()
+ def test_renaming_system_presets(self):
+ self.manager.load_all()
system_presets = list(self.manager.presets.keys())
new_name_template = "%s new"
for preset_name in system_presets:
- self.manager.restorePreset(preset_name)
+ self.manager.restore_preset(preset_name)
new_name = new_name_template % preset_name
- self.manager.saveCurrentPreset(new_name)
+ self.manager.save_current_preset(new_name)
# Check that the files have not been deleted or changed.
other_manager = AudioPresetManager(System())
other_manager.user_path = "/pitivi/non/existing/directory"
- other_manager.loadAll()
+ other_manager.load_all()
for preset_name in system_presets:
- self.assertTrue(other_manager.hasPreset(preset_name), preset_name)
+ self.assertTrue(other_manager.has_preset(preset_name), preset_name)
- other_manager = self.createOtherManager()
- other_manager.loadAll()
+ other_manager = self.create_other_manager()
+ other_manager.load_all()
for preset_name in system_presets:
- self.assertFalse(other_manager.hasPreset(preset_name), preset_name)
+ self.assertFalse(other_manager.has_preset(preset_name), preset_name)
new_name = new_name_template % preset_name
- self.assertTrue(other_manager.hasPreset(new_name), new_name)
+ self.assertTrue(other_manager.has_preset(new_name), new_name)
diff --git a/tests/test_previewers.py b/tests/test_previewers.py
index 55f517ee..32c92697 100644
--- a/tests/test_previewers.py
+++ b/tests/test_previewers.py
@@ -105,7 +105,7 @@ class TestPreviewer(common.TestCase):
"""Checks the `thumb_interval` method."""
def run_thumb_interval(interval):
"""Runs thumb_interval."""
- with mock.patch("pitivi.utils.timeline.Zoomable.pixelToNs") as pixel_to_ns:
+ with mock.patch("pitivi.utils.timeline.Zoomable.pixel_to_ns") as pixel_to_ns:
pixel_to_ns.return_value = interval
return Previewer.thumb_interval(1)
diff --git a/tests/test_project.py b/tests/test_project.py
index 43e7f3fc..36d37d51 100644
--- a/tests/test_project.py
+++ b/tests/test_project.py
@@ -40,19 +40,19 @@ class ProjectManagerListener():
def __init__(self, manager):
self.manager = manager
- self.connectToProjectManager()
+ self.connect_to_project_manager()
self._reset()
def _reset(self):
self.signals = []
- def connectToProjectManager(self):
+ def connect_to_project_manager(self):
for signal in ("new-project-loading", "new-project-loaded",
"new-project-created", "new-project-failed", "missing-uri",
"closing-project", "project-closed"):
- self.manager.connect(signal, self._recordSignal, signal)
+ self.manager.connect(signal, self._record_signal, signal)
- def _recordSignal(self, *args):
+ def _record_signal(self, *args):
signal = args[-1]
args = args[1:-1]
self.signals.append((signal, args))
@@ -64,9 +64,9 @@ class TestProjectManager(common.TestCase):
def setUp(self):
super(TestProjectManager, self).setUp()
- self.setupApp()
+ self.setup_app()
- def setupApp(self, app=None):
+ def setup_app(self, app=None):
if not app:
app = mock.MagicMock()
self.manager = ProjectManager(app)
@@ -100,8 +100,8 @@ class TestProjectManager(common.TestCase):
name, _args = self.signals[2]
self.assertEqual("new-project-loaded", name, self.signals)
- def testMissingUriForwarded(self):
- self.setupApp(app=common.create_pitivi_mock())
+ def test_missing_uri_forwarded(self):
+ self.setup_app(app=common.create_pitivi_mock())
mainloop = common.create_main_loop()
def missing_uri_cb(self, project, error, clip_asset, result):
@@ -118,7 +118,7 @@ class TestProjectManager(common.TestCase):
mainloop.run()
self.assertTrue(result[0], "missing-uri has not been emitted")
- def testLoaded(self):
+ def test_loaded(self):
mainloop = common.create_main_loop()
def new_project_loaded_cb(project_manager, project):
@@ -135,13 +135,13 @@ class TestProjectManager(common.TestCase):
self.assertFalse(project.at_least_one_asset_missing)
self.assertTrue(project.loaded)
- self.assertFalse(project.hasUnsavedModifications())
+ self.assertFalse(project.has_unsaved_modifications())
- def testCloseRunningProjectNoProject(self):
- self.assertTrue(self.manager.closeRunningProject())
+ def test_close_running_project_no_project(self):
+ self.assertTrue(self.manager.close_running_project())
self.assertFalse(self.signals)
- def testCloseRunningProjectRefuseFromSignal(self):
+ def test_close_running_project_refuse_from_signal(self):
def closing_cb(manager, project):
return False
@@ -149,16 +149,16 @@ class TestProjectManager(common.TestCase):
self.manager.current_project.uri = "file:///ciao"
self.manager.connect("closing-project", closing_cb)
- self.assertFalse(self.manager.closeRunningProject())
+ self.assertFalse(self.manager.close_running_project())
self.assertEqual(1, len(self.signals))
name, args = self.signals[0]
self.assertEqual("closing-project", name)
project = args[0]
self.assertTrue(project is self.manager.current_project)
- def testCloseRunningProject(self):
+ def test_close_running_project(self):
project = self.manager.new_blank_project()
- self.assertTrue(self.manager.closeRunningProject())
+ self.assertTrue(self.manager.close_running_project())
self.assertEqual(5, len(self.signals), self.signals)
name, args = self.signals[-2]
@@ -171,7 +171,7 @@ class TestProjectManager(common.TestCase):
self.assertTrue(self.manager.current_project is None)
- def testNewBlankProject(self):
+ def test_new_blank_project(self):
self.assertIsNotNone(self.manager.new_blank_project())
self.assertEqual(3, len(self.signals))
@@ -196,7 +196,7 @@ class TestProjectManager(common.TestCase):
self.assertIsNotNone(project.ges_timeline)
self.assertIsNotNone(project.ges_timeline.get_marker_list("markers"))
- def testSaveProject(self):
+ def test_save_project(self):
self.manager.new_blank_project()
unused, path = tempfile.mkstemp(suffix=".xges")
@@ -206,14 +206,14 @@ class TestProjectManager(common.TestCase):
uri2 = "file://" + os.path.abspath(path2)
# Save the project.
- self.assertTrue(self.manager.saveProject(uri=uri, backup=False))
+ self.assertTrue(self.manager.save_project(uri=uri, backup=False))
self.assertTrue(os.path.isfile(path))
# Wait a bit.
time.sleep(0.1)
# Save the project at a new location.
- self.assertTrue(self.manager.saveProject(uri2, backup=False))
+ self.assertTrue(self.manager.save_project(uri2, backup=False))
self.assertTrue(os.path.isfile(path2))
# Make sure the old path and the new path have different mtimes.
@@ -225,7 +225,7 @@ class TestProjectManager(common.TestCase):
time.sleep(0.1)
# Save project again under the new path (by omitting uri arg)
- self.assertTrue(self.manager.saveProject(backup=False))
+ self.assertTrue(self.manager.save_project(backup=False))
# regression test for bug 594396
# make sure we didn't save to the old URI
@@ -236,11 +236,11 @@ class TestProjectManager(common.TestCase):
os.remove(path)
os.remove(path2)
- def testMakeBackupUri(self):
+ def test_make_backup_uri(self):
uri = "file:///tmp/x.xges"
- self.assertEqual(uri + "~", self.manager._makeBackupURI(uri))
+ self.assertEqual(uri + "~", self.manager._make_backup_uri(uri))
- def testBackupProject(self):
+ def test_backup_project(self):
self.manager.new_blank_project()
# Assign an uri to the project where it's saved by default.
@@ -248,14 +248,14 @@ class TestProjectManager(common.TestCase):
uri = "file://" + os.path.abspath(xges_path)
self.manager.current_project.uri = uri
# This is where the automatic backup file is saved.
- backup_uri = self.manager._makeBackupURI(uri)
+ backup_uri = self.manager._make_backup_uri(uri)
# Save the backup
- self.assertTrue(self.manager.saveProject(
+ self.assertTrue(self.manager.save_project(
self.manager.current_project, backup=True))
self.assertTrue(os.path.isfile(path_from_uri(backup_uri)))
- self.manager.closeRunningProject()
+ self.manager.close_running_project()
self.assertFalse(os.path.isfile(path_from_uri(backup_uri)),
"Backup file not deleted when project closed")
@@ -314,7 +314,7 @@ class TestProjectLoading(common.TestCase):
proxy_manager.connect("proxy-ready", proxy_ready_cb)
uris = [common.get_sample_uri("tears_of_steel.webm")]
- project.addUris(uris)
+ project.add_uris(uris)
mainloop.run()
@@ -532,14 +532,14 @@ class TestProjectLoading(common.TestCase):
class TestProjectSettings(common.TestCase):
- def testAudio(self):
+ def test_audio(self):
project = common.create_project()
project.audiochannels = 2
self.assertEqual(2, project.audiochannels)
project.audiorate = 44100
self.assertEqual(44100, project.audiorate)
- def testVideo(self):
+ def test_video(self):
project = common.create_project()
project.videowidth = 1920
self.assertEqual(1920, project.videowidth)
@@ -548,10 +548,10 @@ class TestProjectSettings(common.TestCase):
project.videorate = Gst.Fraction(50, 7)
self.assertEqual(Gst.Fraction(50, 7), project.videorate)
- def testSetAudioProp(self):
+ def test_set_audio_prop(self):
timeline = common.create_timeline_container()
project = timeline.app.project_manager.current_project
- project.addUris([common.get_sample_uri("mp3_sample.mp3")])
+ project.add_uris([common.get_sample_uri("mp3_sample.mp3")])
audio_track = [t for t in project.ges_timeline.tracks if isinstance(t, GES.AudioTrack)][0]
mainloop = common.create_main_loop()
@@ -573,7 +573,7 @@ class TestProjectSettings(common.TestCase):
ccaps = audio_track.props.restriction_caps
self.assertTrue(ccaps.is_equal_fixed(expected), "%s != %s" % (ccaps, expected))
- def testInitialization(self):
+ def test_initialization(self):
mainloop = common.create_main_loop()
uris = collections.deque([
common.get_sample_uri("flat_colour1_640x480.png"),
@@ -581,12 +581,12 @@ class TestProjectSettings(common.TestCase):
common.get_sample_uri("1sec_simpsons_trailer.mp4")])
def loaded_cb(project, timeline):
- project.addUris([uris.popleft()])
+ project.add_uris([uris.popleft()])
def progress_cb(project, progress, estimated_time):
if progress == 100:
if uris:
- project.addUris([uris.popleft()])
+ project.add_uris([uris.popleft()])
else:
mainloop.quit()
@@ -615,7 +615,7 @@ class TestProjectSettings(common.TestCase):
self.assertEqual(400, project.videoheight)
self.assertEqual(Gst.Fraction(24, 1), project.videorate)
- def testLoad(self):
+ def test_load(self):
project = Project(uri="fake.xges", app=common.create_pitivi_mock())
self.assertEqual(project.name, "fake")
self.assertFalse(project._has_default_video_settings)
@@ -641,7 +641,7 @@ class TestProjectSettings(common.TestCase):
with tempfile.NamedTemporaryFile() as temp_file:
uri = Gst.filename_to_uri(temp_file.name)
- manager.saveProject(uri=uri, backup=False)
+ manager.save_project(uri=uri, backup=False)
app2 = common.create_pitivi_mock(default_scaled_proxy_width=12,
default_scaled_proxy_height=45)
project2 = ProjectManager(app2).load_project(uri)
@@ -656,7 +656,7 @@ class TestProjectSettings(common.TestCase):
self.assertEqual(project.scaled_proxy_height, 456)
with tempfile.NamedTemporaryFile() as temp_file:
- manager.saveProject(uri=uri, backup=False)
+ manager.save_project(uri=uri, backup=False)
app2 = common.create_pitivi_mock(default_scaled_proxy_width=1,
default_scaled_proxy_height=4)
project2 = ProjectManager(app2).load_project(uri)
@@ -712,7 +712,7 @@ class TestExportSettings(common.TestCase):
mainloop = common.create_main_loop()
def loaded_cb(project, timeline):
- project.addUris([common.get_sample_uri("tears_of_steel.webm")])
+ project.add_uris([common.get_sample_uri("tears_of_steel.webm")])
def progress_cb(project, progress, estimated_time):
if progress == 100:
diff --git a/tests/test_proxy.py b/tests/test_proxy.py
index 771dd3ff..49a1e849 100644
--- a/tests/test_proxy.py
+++ b/tests/test_proxy.py
@@ -53,28 +53,28 @@ class TestProxyManager(common.TestCase):
self._check_scale_asset_resolution((10, 1000), (100, 100), (10, 1000))
self._check_scale_asset_resolution((100, 100), (200, 200), (100, 100))
- def _check_getTargetUri(self, proxy_uri, expected_uri):
+ def _check_get_target_uri(self, proxy_uri, expected_uri):
app = common.create_pitivi_mock()
manager = app.proxy_manager
asset = mock.Mock(spec=GES.Asset)
asset.props.id = proxy_uri
- result = manager.getTargetUri(asset)
+ result = manager.get_target_uri(asset)
self.assertEqual(result, expected_uri)
- def test_getTargetUri(self):
- """Checks the getTargetUri method."""
- self._check_getTargetUri("file:///home/filename.ext.size.scaled_res.scaledproxy.mkv",
- "file:///home/filename.ext")
- self._check_getTargetUri("file:///home/filename.ext.size.proxy.mkv",
- "file:///home/filename.ext")
- self._check_getTargetUri("file:///home/file.name.mp4.1927006.1280x720.scaledproxy.mkv",
- "file:///home/file.name.mp4")
- self._check_getTargetUri("file:///home/file.name.mp4.1927006.proxy.mkv",
- "file:///home/file.name.mp4")
-
- def _check_getProxyUri(self, asset_uri, expected_uri, size=10, scaled=False, scaled_res=(1280, 720)):
+ def test_get_target_uri(self):
+ """Checks the get_target_uri method."""
+ self._check_get_target_uri("file:///home/filename.ext.size.scaled_res.scaledproxy.mkv",
+ "file:///home/filename.ext")
+ self._check_get_target_uri("file:///home/filename.ext.size.proxy.mkv",
+ "file:///home/filename.ext")
+ self._check_get_target_uri("file:///home/file.name.mp4.1927006.1280x720.scaledproxy.mkv",
+ "file:///home/file.name.mp4")
+ self._check_get_target_uri("file:///home/file.name.mp4.1927006.proxy.mkv",
+ "file:///home/file.name.mp4")
+
+ def _check_get_proxy_uri(self, asset_uri, expected_uri, size=10, scaled=False, scaled_res=(1280, 720)):
app = common.create_pitivi_mock()
manager = app.proxy_manager
@@ -86,16 +86,16 @@ class TestProxyManager(common.TestCase):
gio.new_for_uri.return_value = gio
gio.query_info().get_size.return_value = size
- result = manager.getProxyUri(asset, scaled=scaled)
+ result = manager.get_proxy_uri(asset, scaled=scaled)
self.assertEqual(result, expected_uri)
- def test_getProxyUri(self):
- """Checks the getProxyUri method."""
- self._check_getProxyUri("file:///home/file.name.mp4",
- "file:///home/file.name.mp4.10.proxy.mkv")
- self._check_getProxyUri("file:///home/file.name.mp4",
- "file:///home/file.name.mp4.10.1280x720.scaledproxy.mkv",
- scaled=True)
+ def test_get_proxy_uri(self):
+ """Checks the get_proxy_uri method."""
+ self._check_get_proxy_uri("file:///home/file.name.mp4",
+ "file:///home/file.name.mp4.10.proxy.mkv")
+ self._check_get_proxy_uri("file:///home/file.name.mp4",
+ "file:///home/file.name.mp4.10.1280x720.scaledproxy.mkv",
+ scaled=True)
def test_asset_matches_target_res(self):
"""Checks the asset_matches_target_res method."""
diff --git a/tests/test_render.py b/tests/test_render.py
index 4bc7ef32..00b92a17 100644
--- a/tests/test_render.py
+++ b/tests/test_render.py
@@ -79,7 +79,7 @@ class TestRender(BaseTestMediaLibrary):
with mock.patch("pitivi.preset.xdg_data_home") as xdg_data_home:
xdg_data_home.return_value = "/pitivi-dir-which-does-not-exist"
preset_manager = EncodingTargetManager(project.app)
- preset_manager.loadAll()
+ preset_manager.load_all()
self.assertTrue(preset_manager.presets)
for unused_name, container_profile in preset_manager.presets.items():
# Preset name is only set when the project loads it
@@ -102,7 +102,7 @@ class TestRender(BaseTestMediaLibrary):
project.connect("asset-added", asset_added_cb)
uris = [common.get_sample_uri("tears_of_steel.webm")]
- project.addUris(uris)
+ project.add_uris(uris)
mainloop.run()
layer, = project.ges_timeline.get_layers()
@@ -135,10 +135,10 @@ class TestRender(BaseTestMediaLibrary):
dialog = self.create_rendering_dialog(project)
from pitivi.render import RenderingProgressDialog
- with mock.patch.object(dialog, "startAction"):
+ with mock.patch.object(dialog, "start_action"):
with mock.patch.object(RenderingProgressDialog, "__new__"):
with mock.patch.object(dialog, "_pipeline"):
- return dialog._renderButtonClickedCb(None)
+ return dialog._render_button_clicked_cb(None)
@skipUnless(*factory_exists("x264enc", "matroskamux"))
def test_encoder_restrictions(self):
@@ -287,7 +287,7 @@ class TestRender(BaseTestMediaLibrary):
return_value=Gst.filename_to_uri(temp_dir)):
with mock.patch.object(dialog.fileentry, "get_text", return_value="outfile"):
with mock.patch.object(RenderingProgressDialog, "__new__"):
- dialog._renderButtonClickedCb(None)
+ dialog._render_button_clicked_cb(None)
message = dialog._pipeline.get_bus().timed_pop_filtered(
Gst.CLOCK_TIME_NONE,
@@ -315,7 +315,7 @@ class TestRender(BaseTestMediaLibrary):
project = self.app.project_manager.current_project
timeline_container = TimelineContainer(self.app)
- timeline_container.setProject(project)
+ timeline_container.set_project(project)
assets = project.list_assets(GES.UriClip)
asset, = [a for a in assets if "proxy" in a.props.id]
@@ -331,7 +331,7 @@ class TestRender(BaseTestMediaLibrary):
# Simulate setting the scale to 10%.
with mock.patch.object(dialog.scale_spinbutton, "get_value",
return_value=10):
- dialog._scaleSpinbuttonChangedCb(None)
+ dialog._scale_spinbutton_changed_cb(None)
self.render(dialog)
self.mainloop.run(until_empty=True)
@@ -350,7 +350,7 @@ class TestRender(BaseTestMediaLibrary):
project = self.app.project_manager.current_project
proxy_manager = self.app.proxy_manager
timeline_container = TimelineContainer(self.app)
- timeline_container.setProject(project)
+ timeline_container.set_project(project)
rendering_asset = None
asset, = project.list_assets(GES.UriClip)
@@ -391,17 +391,17 @@ class TestRender(BaseTestMediaLibrary):
project = self.app.project_manager.current_project
proxy_manager = self.app.proxy_manager
timeline_container = TimelineContainer(self.app)
- timeline_container.setProject(project)
+ timeline_container.set_project(project)
rendering_asset = None
asset, = project.list_assets(GES.UriClip)
with mock.patch.object(proxy_manager,
- "isAssetFormatWellSupported",
+ "is_asset_format_well_supported",
return_value=False):
proxy = self.check_add_proxy(asset, scaled=True)
# Check that HQ proxy was created
- hq_uri = self.app.proxy_manager.getProxyUri(asset)
+ hq_uri = self.app.proxy_manager.get_proxy_uri(asset)
self.assertTrue(os.path.exists(Gst.uri_get_location(hq_uri)), hq_uri)
layer, = project.ges_timeline.get_layers()
@@ -447,10 +447,10 @@ class TestRender(BaseTestMediaLibrary):
project, dialog = self.setup_project_with_profile("youtube")
dialog.window = None # Make sure the dialog window is never set to Mock.
- dialog._videoSettingsButtonClickedCb(None)
+ dialog._video_settings_button_clicked_cb(None)
self.assertEqual(dialog.dialog.elementsettings.get_caps_values(), {"profile": "high"})
- dialog.dialog.elementsettings.caps_widgets["profile"].setWidgetValue("baseline")
+ dialog.dialog.elementsettings.caps_widgets["profile"].set_widget_value("baseline")
self.assertEqual(dialog.dialog.elementsettings.get_caps_values(), {"profile": "baseline"})
caps = dialog.dialog.get_caps()
@@ -459,7 +459,7 @@ class TestRender(BaseTestMediaLibrary):
dialog.dialog.ok_btn.emit("clicked")
self.assert_caps_equal(project.video_profile.get_format(), "video/x-h264,profile=baseline")
- dialog._videoSettingsButtonClickedCb(None)
+ dialog._video_settings_button_clicked_cb(None)
caps = dialog.dialog.get_caps()
self.assert_caps_equal(caps, "video/x-h264,profile=baseline")
diff --git a/tests/test_settings.py b/tests/test_settings.py
index 5105b93d..6d0e7cec 100644
--- a/tests/test_settings.py
+++ b/tests/test_settings.py
@@ -37,16 +37,16 @@ class TestGlobalSettings(common.TestCase):
self.__options = GlobalSettings.options
self.__environment = GlobalSettings.environment
self.__defaults = GlobalSettings.defaults
- self.__add_config_option_real = GlobalSettings.addConfigOption
+ self.__add_config_option_real = GlobalSettings.add_config_option
GlobalSettings.options = {}
GlobalSettings.environment = set()
GlobalSettings.defaults = {}
- GlobalSettings.addConfigOption = self.__add_config_option
+ GlobalSettings.add_config_option = self.__add_config_option
def __add_config_option(self, attrname, *args, **kwargs):
- """Calls GlobalSettings.addConfigOption but remembers attributes.
+ """Calls GlobalSettings.add_config_option but remembers attributes.
- It receives the same arguments as GlobalSettings.addConfigOption but
+ It receives the same arguments as GlobalSettings.add_config_option but
remembers attributes so they can be cleaned later.
"""
self.__add_config_option_real(attrname, *args, **kwargs)
@@ -57,7 +57,7 @@ class TestGlobalSettings(common.TestCase):
GlobalSettings.options = self.__options
GlobalSettings.environment = self.__environment
GlobalSettings.defaults = self.__defaults
- GlobalSettings.addConfigOption = self.__add_config_option_real
+ GlobalSettings.add_config_option = self.__add_config_option_real
self.__clean_settings_attributes()
def __clean_settings_attributes(self):
@@ -67,37 +67,37 @@ class TestGlobalSettings(common.TestCase):
self.__attributes = []
def test_add_section(self):
- GlobalSettings.addConfigSection("section-a")
- GlobalSettings.addConfigSection("section-a")
+ GlobalSettings.add_config_section("section-a")
+ GlobalSettings.add_config_section("section-a")
def test_add_config_option(self):
def add_option():
- GlobalSettings.addConfigOption("optionA1", section="section-a",
- key="option-a-1", default=False)
+ GlobalSettings.add_config_option("optionA1", section="section-a",
+ key="option-a-1", default=False)
# "section-a" does not exist.
with self.assertRaises(ConfigError):
add_option()
- GlobalSettings.addConfigSection("section-a")
+ GlobalSettings.add_config_section("section-a")
add_option()
self.assertFalse(GlobalSettings.optionA1)
with self.assertRaises(ConfigError):
add_option()
def test_read_config_file(self):
- GlobalSettings.addConfigSection("section-1")
- GlobalSettings.addConfigOption("section1OptionA", section="section-1",
- key="option-a", default=50)
- GlobalSettings.addConfigOption("section1OptionB", section="section-1",
- key="option-b", default=False)
- GlobalSettings.addConfigOption("section1OptionC", section="section-1",
- key="option-c", default="")
- GlobalSettings.addConfigOption("section1OptionD", section="section-1",
- key="option-d", default=[])
- GlobalSettings.addConfigOption("section1OptionE", section="section-1",
- key="option-e", default=["foo"])
- GlobalSettings.addConfigOption("section1OptionF", section="section-1",
- key="option-f", default=Gdk.RGBA())
+ GlobalSettings.add_config_section("section-1")
+ GlobalSettings.add_config_option("section1OptionA", section="section-1",
+ key="option-a", default=50)
+ GlobalSettings.add_config_option("section1OptionB", section="section-1",
+ key="option-b", default=False)
+ GlobalSettings.add_config_option("section1OptionC", section="section-1",
+ key="option-c", default="")
+ GlobalSettings.add_config_option("section1OptionD", section="section-1",
+ key="option-d", default=[])
+ GlobalSettings.add_config_option("section1OptionE", section="section-1",
+ key="option-e", default=["foo"])
+ GlobalSettings.add_config_option("section1OptionF", section="section-1",
+ key="option-f", default=Gdk.RGBA())
self.assertEqual(GlobalSettings.section1OptionA, 50)
self.assertEqual(GlobalSettings.section1OptionB, False)
@@ -144,13 +144,13 @@ class TestGlobalSettings(common.TestCase):
self.assertEqual(settings.section1OptionF, Gdk.RGBA(0.2, 0.4, 1.0, 0.4))
def test_write_config_file(self):
- GlobalSettings.addConfigSection("section-new")
- GlobalSettings.addConfigOption("sectionNewOptionA",
- section="section-new", key="option-a",
- default="elmo")
- GlobalSettings.addConfigOption("sectionNewOptionB",
- section="section-new", key="option-b",
- default=["foo"])
+ GlobalSettings.add_config_section("section-new")
+ GlobalSettings.add_config_option("sectionNewOptionA",
+ section="section-new", key="option-a",
+ default="elmo")
+ GlobalSettings.add_config_option("sectionNewOptionB",
+ section="section-new", key="option-b",
+ default=["foo"])
with mock.patch("pitivi.settings.xdg_config_home") as xdg_config_home,\
tempfile.TemporaryDirectory() as temp_dir:
@@ -159,7 +159,7 @@ class TestGlobalSettings(common.TestCase):
settings1.sectionNewOptionA = "kermit"
settings1.sectionNewOptionB = []
- settings1.storeSettings()
+ settings1.store_settings()
settings2 = GlobalSettings()
self.assertEqual(settings2.sectionNewOptionA, "kermit")
diff --git a/tests/test_system.py b/tests/test_system.py
index 95e7b874..8c70d317 100644
--- a/tests/test_system.py
+++ b/tests/test_system.py
@@ -25,12 +25,12 @@ from pitivi.utils.system import System
class TestSystem(TestCase):
- def testGetUniqueFilename(self):
+ def test_get_unique_filename(self):
system = System()
- self.assertNotEqual(system.getUniqueFilename("a/b"),
- system.getUniqueFilename("a%47b"))
- self.assertNotEqual(system.getUniqueFilename("a%b"),
- system.getUniqueFilename("a%37b"))
- self.assertNotEqual(system.getUniqueFilename("a%/b"),
- system.getUniqueFilename("a%37%3747b"))
- self.assertEqual("a b", system.getUniqueFilename("a b"))
+ self.assertNotEqual(system.get_unique_filename("a/b"),
+ system.get_unique_filename("a%47b"))
+ self.assertNotEqual(system.get_unique_filename("a%b"),
+ system.get_unique_filename("a%37b"))
+ self.assertNotEqual(system.get_unique_filename("a%/b"),
+ system.get_unique_filename("a%37%3747b"))
+ self.assertEqual("a b", system.get_unique_filename("a b"))
diff --git a/tests/test_timeline_elements.py b/tests/test_timeline_elements.py
index 5b70c765..2d8f3d53 100644
--- a/tests/test_timeline_elements.py
+++ b/tests/test_timeline_elements.py
@@ -85,7 +85,7 @@ class TestKeyframeCurve(BaseTestTimeline):
# Add keyframes.
for offset in offsets:
position = start + offset
- pipeline.getPosition = mock.Mock(return_value=position)
+ pipeline.get_position = mock.Mock(return_value=position)
timeline_container._keyframe_cb(None, None)
values = [item.timestamp for item in control_source.get_all()]
self.assertIn(inpoint + offset, values)
@@ -93,7 +93,7 @@ class TestKeyframeCurve(BaseTestTimeline):
# Remove keyframes.
for offset in offsets:
position = start + offset
- pipeline.getPosition = mock.Mock(return_value=position)
+ pipeline.get_position = mock.Mock(return_value=position)
timeline_container._keyframe_cb(None, None)
values = [item.timestamp for item in control_source.get_all()]
self.assertNotIn(inpoint + offset, values, offset)
@@ -102,7 +102,7 @@ class TestKeyframeCurve(BaseTestTimeline):
# cannot be toggled.
for offset in [0, duration]:
position = start + offset
- pipeline.getPosition = mock.Mock(return_value=position)
+ pipeline.get_position = mock.Mock(return_value=position)
values = [item.timestamp for item in control_source.get_all()]
self.assertIn(inpoint + offset, values)
timeline_container._keyframe_cb(None, None)
@@ -113,7 +113,7 @@ class TestKeyframeCurve(BaseTestTimeline):
for offset in [-1, duration + 1]:
position = min(max(0, start + offset),
timeline.ges_timeline.props.duration)
- pipeline.getPosition = mock.Mock(return_value=position)
+ pipeline.get_position = mock.Mock(return_value=position)
timeline_container._keyframe_cb(None, None)
values = [item.timestamp for item in control_source.get_all()]
self.assertEqual(values, [inpoint, inpoint + duration])
@@ -123,10 +123,10 @@ class TestKeyframeCurve(BaseTestTimeline):
timeline = timeline_container.timeline
start = ges_clip.props.start
- start_px = Zoomable.nsToPixel(start)
+ start_px = Zoomable.ns_to_pixel(start)
inpoint = ges_clip.props.in_point
duration = ges_clip.props.duration
- duration_px = Zoomable.nsToPixel(duration)
+ duration_px = Zoomable.ns_to_pixel(duration)
offsets_px = (1, int(duration_px / 2), int(duration_px) - 1)
timeline.selection.select([ges_clip])
@@ -140,7 +140,7 @@ class TestKeyframeCurve(BaseTestTimeline):
# Add keyframes by simulating mouse clicks.
for offset_px in offsets_px:
- offset = Zoomable.pixelToNs(start_px + offset_px) - start
+ offset = Zoomable.pixel_to_ns(start_px + offset_px) - start
xdata, ydata = inpoint + offset, 1
x, y = keyframe_curve._ax.transData.transform((xdata, ydata))
@@ -167,7 +167,7 @@ class TestKeyframeCurve(BaseTestTimeline):
# Remove keyframes by simulating mouse double-clicks.
for offset_px in offsets_px:
- offset = Zoomable.pixelToNs(start_px + offset_px) - start
+ offset = Zoomable.pixel_to_ns(start_px + offset_px) - start
xdata, ydata = inpoint + offset, 1
x, y = keyframe_curve._ax.transData.transform((xdata, ydata))
@@ -215,7 +215,7 @@ class TestVideoSource(BaseTestTimeline):
timeline = timeline_container.timeline
project = timeline.app.project_manager.current_project
- clip = self.addClipsSimple(timeline, 1)[0]
+ clip = self.add_clips_simple(timeline, 1)[0]
video_source = clip.find_track_element(None, GES.VideoUriSource)
sinfo = video_source.get_asset().get_stream_info()
@@ -270,7 +270,7 @@ class TestVideoSource(BaseTestTimeline):
timeline_container = common.create_timeline_container()
timeline = timeline_container.timeline
- clip = self.addClipsSimple(timeline, 1)[0]
+ clip = self.add_clips_simple(timeline, 1)[0]
video_source = clip.find_track_element(None, GES.VideoUriSource)
sinfo = video_source.get_asset().get_stream_info()
diff --git a/tests/test_timeline_layer.py b/tests/test_timeline_layer.py
index 8dab08b1..897711ed 100644
--- a/tests/test_timeline_layer.py
+++ b/tests/test_timeline_layer.py
@@ -30,23 +30,23 @@ class TestLayerControl(common.TestCase):
timeline = mock.MagicMock()
ges_layer = GES.Layer()
layer = Layer(ges_layer, timeline)
- self.assertEqual(layer.getName(), "Layer 0", "Default name generation failed")
+ self.assertEqual(layer.get_name(), "Layer 0", "Default name generation failed")
ges_layer.set_meta("audio::name", "a")
- self.assertEqual(layer.getName(), "a", "Cannot use old audio name")
+ self.assertEqual(layer.get_name(), "a", "Cannot use old audio name")
ges_layer.set_meta("video::name", "v")
- self.assertEqual(layer.getName(), "v", "Cannot use old video name")
+ self.assertEqual(layer.get_name(), "v", "Cannot use old video name")
- layer.setName("vv")
- self.assertEqual(layer.getName(), "vv")
+ layer.set_name("vv")
+ self.assertEqual(layer.get_name(), "vv")
def test_name_meaningful(self):
timeline = mock.MagicMock()
ges_layer = GES.Layer()
layer = Layer(ges_layer, timeline)
- layer.setName("Layer 0x")
- self.assertEqual(layer.getName(), "Layer 0x")
+ layer.set_name("Layer 0x")
+ self.assertEqual(layer.get_name(), "Layer 0x")
class TestLayer(common.TestCase):
@@ -61,7 +61,7 @@ class TestLayer(common.TestCase):
timeline_container = common.create_timeline_container()
timeline = timeline_container.timeline
# This will add widgets for the clips in ges_layer and
- # the layer will use checkMediaTypes which updates the
+ # the layer will use check_media_types which updates the
# height of layer.control_ui, which now it should not be set.
self.assertFalse(hasattr(ges_layer, "control_ui"))
unused_layer = Layer(ges_layer, timeline)
diff --git a/tests/test_timeline_markers.py b/tests/test_timeline_markers.py
index c40240f9..a73f26d5 100644
--- a/tests/test_timeline_markers.py
+++ b/tests/test_timeline_markers.py
@@ -50,7 +50,7 @@ class TestMarkers(BaseTestUndoTimeline):
event.guiEvent = Gdk.Event.new(Gdk.EventType.BUTTON_RELEASE)
marker_box.do_button_release_event(event)
- position = Zoomable.pixelToNs(event.x)
+ position = Zoomable.pixel_to_ns(event.x)
self.assert_markers(markers, [(position, None)])
def test_marker_removed_ui(self):
@@ -61,7 +61,7 @@ class TestMarkers(BaseTestUndoTimeline):
marker_box.markers_container = markers
x = 200
- position = Zoomable.pixelToNs(x)
+ position = Zoomable.pixel_to_ns(x)
marker = marker_box.markers_container.add(position)
self.assert_markers(markers, [(position, None)])
@@ -87,12 +87,12 @@ class TestMarkers(BaseTestUndoTimeline):
marker_box.markers_container = markers
x1 = 300
- position1 = Zoomable.pixelToNs(x1)
+ position1 = Zoomable.pixel_to_ns(x1)
marker = marker_box.markers_container.add(position1)
self.assert_markers(markers, [(position1, None)])
x2 = 400
- position2 = Zoomable.pixelToNs(x2)
+ position2 = Zoomable.pixel_to_ns(x2)
event = mock.Mock(spec=Gdk.EventButton)
event.x = x2
@@ -121,7 +121,7 @@ class TestMarkers(BaseTestUndoTimeline):
marker_box.markers_container = markers
x = 500
- position = Zoomable.pixelToNs(x)
+ position = Zoomable.pixel_to_ns(x)
marker = marker_box.markers_container.add(position)
self.assert_markers(markers, [(position, None)])
diff --git a/tests/test_timeline_timeline.py b/tests/test_timeline_timeline.py
index 74a117b6..708387b2 100644
--- a/tests/test_timeline_timeline.py
+++ b/tests/test_timeline_timeline.py
@@ -46,7 +46,7 @@ class BaseTestTimeline(common.TestCase):
return clip
- def addClipsSimple(self, timeline, num_clips):
+ def add_clips_simple(self, timeline, num_clips):
"""Creates a number of clips on a new layer."""
layer = timeline.ges_timeline.append_layer()
clips = [self.add_clip(layer, i * 10) for i in range(num_clips)]
@@ -57,37 +57,37 @@ class BaseTestTimeline(common.TestCase):
class TestLayers(BaseTestTimeline):
"""Tests for the layers."""
- def testDraggingLayer(self):
- self.checkGetLayerAt([THIN, THIN, THIN], 1, True,
- [0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2])
- self.checkGetLayerAt([THICK, THICK, THICK], 1, True,
- [0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2])
- self.checkGetLayerAt([THIN, THICK, THIN], 1, True,
- [0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2])
- self.checkGetLayerAt([THICK, THIN, THICK], 1, True,
- [0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2])
-
- def testDraggingClipFromLayer(self):
- self.checkGetLayerAt([THIN, THIN, THIN], 1, False,
- [0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2])
- self.checkGetLayerAt([THICK, THICK, THICK], 1, False,
- [0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2])
- self.checkGetLayerAt([THIN, THICK, THIN], 1, False,
- [0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2])
- self.checkGetLayerAt([THICK, THIN, THICK], 1, False,
- [0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2])
-
- def testDraggingClipFromOuterSpace(self):
- self.checkGetLayerAt([THIN, THIN, THIN], None, False,
- [0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2])
- self.checkGetLayerAt([THICK, THICK, THICK], None, False,
- [0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2])
- self.checkGetLayerAt([THIN, THICK, THIN], None, False,
- [0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2])
- self.checkGetLayerAt([THICK, THIN, THICK], None, False,
- [0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2])
-
- def checkGetLayerAt(self, heights, preferred, past_middle_when_adjacent, expectations):
+ def test_dragging_layer(self):
+ self.check_get_layer_at([THIN, THIN, THIN], 1, True,
+ [0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2])
+ self.check_get_layer_at([THICK, THICK, THICK], 1, True,
+ [0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2])
+ self.check_get_layer_at([THIN, THICK, THIN], 1, True,
+ [0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2])
+ self.check_get_layer_at([THICK, THIN, THICK], 1, True,
+ [0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2])
+
+ def test_dragging_clip_from_layer(self):
+ self.check_get_layer_at([THIN, THIN, THIN], 1, False,
+ [0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2])
+ self.check_get_layer_at([THICK, THICK, THICK], 1, False,
+ [0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2])
+ self.check_get_layer_at([THIN, THICK, THIN], 1, False,
+ [0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2])
+ self.check_get_layer_at([THICK, THIN, THICK], 1, False,
+ [0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2])
+
+ def test_dragging_clip_from_outer_space(self):
+ self.check_get_layer_at([THIN, THIN, THIN], None, False,
+ [0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2])
+ self.check_get_layer_at([THICK, THICK, THICK], None, False,
+ [0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2])
+ self.check_get_layer_at([THIN, THICK, THIN], None, False,
+ [0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2])
+ self.check_get_layer_at([THICK, THIN, THICK], None, False,
+ [0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2])
+
+ def check_get_layer_at(self, heights, preferred, past_middle_when_adjacent, expectations):
timeline_container = common.create_timeline_container()
timeline = timeline_container.timeline
@@ -145,13 +145,13 @@ class TestLayers(BaseTestTimeline):
assert_layer_at(ges_layers[expectations[14]], h[0] + SEPARATOR_HEIGHT + h[1] + SEPARATOR_HEIGHT +
h[2] / 2)
assert_layer_at(ges_layers[expectations[15]], h[0] + SEPARATOR_HEIGHT + h[1] + SEPARATOR_HEIGHT +
h[2] - 1)
- def testSetSeparatorsPrelight(self):
+ def test_set_separators_prelight(self):
timeline_container = common.create_timeline_container()
timeline = timeline_container.timeline
timeline.__on_separators = [mock.Mock()]
- timeline._setSeparatorsPrelight(False)
+ timeline._set_separators_prelight(False)
self.assertEqual(len(timeline.__on_separators), 1,
- "The separators must be forgotten only in dragEnd()")
+ "The separators must be forgotten only in drag_end()")
def test_media_types(self):
timeline_container = common.create_timeline_container()
@@ -284,7 +284,7 @@ class TestLayers(BaseTestTimeline):
ges_layer = timeline.create_layer(priority)
ges_layers.append(ges_layer)
- timeline.moveLayer(ges_layers[from_priority], to_priority)
+ timeline.move_layer(ges_layers[from_priority], to_priority)
self.check_priorities_and_positions(timeline, ges_layers, expected_priorities)
@@ -298,7 +298,7 @@ class TestGrouping(BaseTestTimeline):
timeline_container = common.create_timeline_container()
timeline = timeline_container.timeline
self.__check_can_group_ungroup(timeline_container, False, False)
- ges_clip, = self.addClipsSimple(timeline, 1)
+ ges_clip, = self.add_clips_simple(timeline, 1)
self.toggle_clip_selection(ges_clip, expect_selected=True)
self.__check_can_group_ungroup(timeline_container, False, True)
@@ -353,17 +353,17 @@ class TestGrouping(BaseTestTimeline):
group = clips[0].get_parent()
self.assertEqual(len(group.get_children(False)), len(clips))
- def testGroup(self):
+ def test_group(self):
timeline_container = common.create_timeline_container()
timeline = timeline_container.timeline
- clips = self.addClipsSimple(timeline, 2)
+ clips = self.add_clips_simple(timeline, 2)
self.group_clips(timeline_container, clips)
- def testGroupSelection(self):
+ def test_group_selection(self):
num_clips = 2
timeline_container = common.create_timeline_container()
timeline = timeline_container.timeline
- clips = self.addClipsSimple(timeline, num_clips)
+ clips = self.add_clips_simple(timeline, num_clips)
self.group_clips(timeline_container, clips)
layer = timeline.ges_timeline.get_layers()[0]
clips = layer.get_clips()
@@ -377,11 +377,11 @@ class TestGrouping(BaseTestTimeline):
self.assertFalse(bool(clip.ui.get_state_flags() & Gtk.StateFlags.SELECTED))
self.assertFalse(clip.selected.selected)
- def testGroupUngroup(self):
+ def test_group_ungroup(self):
num_clips = 2
timeline_container = common.create_timeline_container()
timeline = timeline_container.timeline
- clips = self.addClipsSimple(timeline, num_clips)
+ clips = self.add_clips_simple(timeline, num_clips)
self.group_clips(timeline_container, clips)
self.assertEqual(len(timeline.selection.selected), num_clips)
@@ -394,15 +394,15 @@ class TestGrouping(BaseTestTimeline):
for clip in clips:
self.assertIsNone(clip.get_parent())
- def testGroupSplittedClipAndSelectGroup(self):
+ def test_group_splitted_clip_and_select_group(self):
position = 5
timeline_container = common.create_timeline_container()
timeline = timeline_container.timeline
- clips = self.addClipsSimple(timeline, 1)
+ clips = self.add_clips_simple(timeline, 1)
self.toggle_clip_selection(clips[0], expect_selected=True)
- timeline.ges_timeline.get_asset().pipeline.getPosition = mock.Mock(return_value=position)
+ timeline.ges_timeline.get_asset().pipeline.get_position = mock.Mock(return_value=position)
layer = timeline.ges_timeline.get_layers()[0]
# Split
@@ -431,10 +431,10 @@ class TestGrouping(BaseTestTimeline):
self.toggle_clip_selection(clips[1], expect_selected=True)
- def testUngroupClip(self):
+ def test_ungroup_clip(self):
timeline_container = common.create_timeline_container()
timeline = timeline_container.timeline
- ges_clip, = self.addClipsSimple(timeline, 1)
+ ges_clip, = self.add_clips_simple(timeline, 1)
self.toggle_clip_selection(ges_clip, expect_selected=True)
@@ -467,11 +467,11 @@ class TestGrouping(BaseTestTimeline):
# Create two clips on different layers and group them.
timeline_container = common.create_timeline_container()
timeline = timeline_container.timeline
- clip1, = self.addClipsSimple(timeline, 1)
+ clip1, = self.add_clips_simple(timeline, 1)
layer1 = clip1.get_layer()
# Add another clip on a new layer.
- clip2, = self.addClipsSimple(timeline, 1)
+ clip2, = self.add_clips_simple(timeline, 1)
self.assertEqual(len(timeline.ges_timeline.get_layers()), 2)
self.group_clips(timeline_container, [clip1, clip2])
@@ -506,11 +506,11 @@ class TestGrouping(BaseTestTimeline):
class TestCopyPaste(BaseTestTimeline):
- def copyClips(self, num_clips):
+ def copy_clips(self, num_clips):
timeline_container = common.create_timeline_container()
timeline = timeline_container.timeline
- clips = self.addClipsSimple(timeline, num_clips)
+ clips = self.add_clips_simple(timeline, num_clips)
# Press <ctrl> so selecting in ADD mode
event = mock.Mock()
@@ -530,8 +530,8 @@ class TestCopyPaste(BaseTestTimeline):
return timeline_container
- def testCopyPaste(self):
- timeline_container = self.copyClips(2)
+ def test_copy_paste(self):
+ timeline_container = self.copy_clips(2)
timeline = timeline_container.timeline
layer = timeline.ges_timeline.get_layers()[0]
project = timeline.ges_timeline.get_asset()
@@ -541,7 +541,7 @@ class TestCopyPaste(BaseTestTimeline):
# Pasting clips for the first time.
position = 20
- project.pipeline.getPosition = mock.Mock(return_value=position)
+ project.pipeline.get_position = mock.Mock(return_value=position)
timeline_container.paste_action.emit("activate", None)
n_clips = layer.get_clips()
@@ -554,7 +554,7 @@ class TestCopyPaste(BaseTestTimeline):
# Pasting same clips second time.
position = 40
- project.pipeline.getPosition = mock.Mock(return_value=position)
+ project.pipeline.get_position = mock.Mock(return_value=position)
timeline_container.paste_action.emit("activate", None)
n_clips = layer.get_clips()
@@ -566,14 +566,14 @@ class TestCopyPaste(BaseTestTimeline):
self.assertEqual(copied_clips[3].props.start, position + 10)
def test_paste_not_possible(self):
- timeline_container = self.copyClips(1)
+ timeline_container = self.copy_clips(1)
timeline = timeline_container.timeline
layer = timeline.ges_timeline.get_layers()[0]
project = timeline.ges_timeline.get_asset()
self.assertEqual(len(layer.get_clips()), 1)
position = 0
- project.pipeline.getPosition = mock.Mock(return_value=position)
+ project.pipeline.get_position = mock.Mock(return_value=position)
timeline_container.paste_action.emit("activate", None)
self.assertEqual(len(layer.get_clips()), 1)
@@ -584,7 +584,7 @@ class TestEditing(BaseTestTimeline):
# Create a clip
timeline_container = common.create_timeline_container()
timeline = timeline_container.timeline
- clip, = self.addClipsSimple(timeline, 1)
+ clip, = self.add_clips_simple(timeline, 1)
layer = clip.get_layer()
# Click the right trim handle of the clip.
@@ -622,7 +622,7 @@ class TestShiftSelection(BaseTestTimeline):
layers = timeline.ges_timeline.get_layers()
for layer in layers:
clips = layer.get_clips()
- timeline.selection.setSelection(clips, UNSELECT)
+ timeline.selection.set_selection(clips, UNSELECT)
timeline.set_selection_meta_info(layer, 0, UNSELECT)
def __check_selected(self, selected_clips, not_selected_clips):
@@ -807,7 +807,7 @@ class TestClipsEdges(BaseTestTimeline):
"""Test function for function clips_edges."""
timeline_container = common.create_timeline_container()
timeline = timeline_container.timeline
- clips = self.addClipsSimple(timeline, 5)
+ clips = self.add_clips_simple(timeline, 5)
timeline.ges_timeline.layers[0].remove_clip(clips[0])
self.add_clip(timeline.ges_timeline.layers[0], 5, 0, 10)
diff --git a/tests/test_titleeditor.py b/tests/test_titleeditor.py
index 7c101153..1f8a5a97 100644
--- a/tests/test_titleeditor.py
+++ b/tests/test_titleeditor.py
@@ -51,13 +51,13 @@ class TitleEditorTest(BaseTestUndoTimeline):
from pitivi.timeline.timeline import TimelineContainer
timeline_container = TimelineContainer(self.app)
- timeline_container.setProject(self.project)
+ timeline_container.set_project(self.project)
self.app.gui.editor.timeline_ui = timeline_container
- title_editor._newProjectLoadedCb(None, self.project)
- self.project.pipeline.getPosition = mock.Mock(return_value=0)
+ title_editor._new_project_loaded_cb(None, self.project)
+ self.project.pipeline.get_position = mock.Mock(return_value=0)
- title_editor._createCb(None)
+ title_editor._create_cb(None)
ps1 = self._get_title_source_child_props()
self.action_log.undo()
diff --git a/tests/test_undo.py b/tests/test_undo.py
index c24c0a98..6e36b2b5 100644
--- a/tests/test_undo.py
+++ b/tests/test_undo.py
@@ -35,7 +35,7 @@ from tests import common
class TestUndoableActionStack(common.TestCase):
"""Tests for the UndoableActionStack class."""
- def testUndoDo(self):
+ def test_undo_do(self):
"""Checks an undo() and do() sequence."""
state = {"actions": 2}
@@ -59,7 +59,7 @@ class TestUndoableActionStack(common.TestCase):
stack.do()
self.assertEqual(state["actions"], 2)
- def testUndoError(self):
+ def test_undo_error(self):
"""Checks undo a stack containing a failing action."""
stack = UndoableActionStack("meh")
action1 = mock.Mock(spec=UndoableAction)
@@ -83,7 +83,7 @@ class TestUndoableActionLog(common.TestCase):
def setUp(self):
self.log = UndoableActionLog()
- self._connectToUndoableActionLog(self.log)
+ self._connect_to_undoable_action_log(self.log)
self.signals = []
def tearDown(self):
@@ -94,30 +94,30 @@ class TestUndoableActionLog(common.TestCase):
signal_name = args.pop(-1)
self.signals.append((signal_name, args))
- def _connectToUndoableActionLog(self, log):
+ def _connect_to_undoable_action_log(self, log):
for signal_name in ("begin", "push", "rollback", "commit", "move"):
log.connect(signal_name, self._undo_action_log_signal_cb, signal_name)
def _disconnect_from_undoable_action_log(self):
self.log.disconnect_by_func(self._undo_action_log_signal_cb)
- def testRollbackWrongState(self):
+ def test_rollback_wrong_state(self):
self.assertRaises(UndoWrongStateError, self.log.rollback)
- def testCommitWrongState(self):
+ def test_commit_wrong_state(self):
self.assertRaises(UndoWrongStateError, self.log.commit, "")
- def testPushWrongState(self):
+ def test_push_wrong_state(self):
# no error in this case
self.log.push(None)
- def testUndoWrongState(self):
+ def test_undo_wrong_state(self):
self.assertRaises(UndoWrongStateError, self.log.undo)
- def testRedoWrongState(self):
+ def test_redo_wrong_state(self):
self.assertRaises(UndoWrongStateError, self.log.redo)
- def testCheckpoint(self):
+ def test_checkpoint(self):
self.log.begin("meh")
self.log.push(mock.Mock(spec=UndoableAction))
self.assertRaises(UndoWrongStateError, self.log.checkpoint)
@@ -125,7 +125,7 @@ class TestUndoableActionLog(common.TestCase):
self.log.checkpoint()
self.assertNotEqual(self.log._checkpoint, None)
- def testDirty(self):
+ def test_dirty(self):
self.assertFalse(self.log.dirty())
self.log.begin("meh")
self.log.push(mock.Mock(spec=UndoableAction))
@@ -138,7 +138,7 @@ class TestUndoableActionLog(common.TestCase):
self.log.redo()
self.assertFalse(self.log.dirty())
- def testCommit(self):
+ def test_commit(self):
"""Checks committing a stack."""
self.assertEqual(len(self.log.undo_stacks), 0)
self.assertEqual(len(self.log.redo_stacks), 0)
@@ -164,7 +164,7 @@ class TestUndoableActionLog(common.TestCase):
self.log.begin("meh")
self.assertRaises(UndoWrongStateError, self.log.commit, "notmeh")
- def testNestedCommit(self):
+ def test_nested_commit(self):
"""Checks two nested commits."""
self.assertEqual(len(self.log.undo_stacks), 0)
self.assertEqual(len(self.log.redo_stacks), 0)
@@ -214,7 +214,7 @@ class TestUndoableActionLog(common.TestCase):
# For now, we call the finalizing action only for the top stack.
action2.do.assert_not_called()
- def testRollback(self):
+ def test_rollback(self):
"""Checks a rollback."""
self.assertEqual(len(self.log.undo_stacks), 0)
self.assertEqual(len(self.log.redo_stacks), 0)
@@ -232,7 +232,7 @@ class TestUndoableActionLog(common.TestCase):
self.assertEqual(len(self.log.undo_stacks), 0)
self.assertEqual(len(self.log.redo_stacks), 0)
- def testNestedRollback(self):
+ def test_nested_rollback(self):
"""Checks two nested rollbacks."""
self.assertEqual(len(self.log.undo_stacks), 0)
self.assertEqual(len(self.log.redo_stacks), 0)
@@ -266,7 +266,7 @@ class TestUndoableActionLog(common.TestCase):
self.assertEqual(len(self.log.undo_stacks), 0)
self.assertEqual(len(self.log.redo_stacks), 0)
- def testUndoRedo(self):
+ def test_undo_redo(self):
"""Tries an undo() redo() sequence."""
# begin
self.log.begin("meh")
@@ -330,7 +330,7 @@ class TestUndoableActionLog(common.TestCase):
self.assertEqual(action2.do.call_count, 1)
self.assertEqual(action2.undo.call_count, 1)
- def testOrder(self):
+ def test_order(self):
"""Checks actions are undone and redone in the correct order."""
order = mock.Mock()
order.action1 = mock.Mock(spec=UndoableAction)
diff --git a/tests/test_undo_markers.py b/tests/test_undo_markers.py
index c85984d3..1c924d6a 100644
--- a/tests/test_undo_markers.py
+++ b/tests/test_undo_markers.py
@@ -195,15 +195,15 @@ class TestMarkers(BaseTestUndoTimeline):
self.assert_markers(markers, [(10, None), (20, None)])
project_uri = Gst.filename_to_uri(tempfile.NamedTemporaryFile().name)
- self.app.project_manager.saveProject(project_uri)
+ self.app.project_manager.save_project(project_uri)
self.app.project_manager.connect("closing-project", closing)
- self.app.project_manager.closeRunningProject()
+ self.app.project_manager.close_running_project()
project = self.app.project_manager.new_blank_project()
markers = project.ges_timeline.get_marker_list("markers")
self.assert_markers(markers, [])
- self.app.project_manager.closeRunningProject()
+ self.app.project_manager.close_running_project()
project = self.app.project_manager.load_project(project_uri)
project.connect("loaded", loaded_cb)
mainloop = common.create_main_loop()
diff --git a/tests/test_undo_project.py b/tests/test_undo_project.py
index ad5b3bb6..d3621ff0 100644
--- a/tests/test_undo_project.py
+++ b/tests/test_undo_project.py
@@ -49,7 +49,7 @@ class TestProjectUndo(common.TestCase):
mainloop = common.create_main_loop()
def loaded_cb(unused_project, unused_timeline):
- self.project.addUris(uris)
+ self.project.add_uris(uris)
self.project.connect_after("loaded", loaded_cb)
@@ -77,7 +77,7 @@ class TestProjectUndo(common.TestCase):
def loaded_cb(unused_project, unused_timeline):
# The new project has been loaded, add some assets.
- self.project.addUris(uris)
+ self.project.add_uris(uris)
self.project.connect_after("loaded", loaded_cb)
def progress_cb(unused_project, progress, unused_estimated_time):
@@ -133,12 +133,12 @@ class TestProjectUndo(common.TestCase):
dialog.author_entry.set_text("a1")
dialog.year_spinbutton.set_value(2001)
- dialog.updateProject()
+ dialog.update_project()
assert_meta("a1", "2001")
dialog.author_entry.set_text("a2")
dialog.year_spinbutton.set_value(2002)
- dialog.updateProject()
+ dialog.update_project()
assert_meta("a2", "2002")
self.action_log.undo()
diff --git a/tests/test_undo_timeline.py b/tests/test_undo_timeline.py
index 772fc840..1cb77dc7 100644
--- a/tests/test_undo_timeline.py
+++ b/tests/test_undo_timeline.py
@@ -54,13 +54,13 @@ class BaseTestUndoTimeline(common.TestCase):
def setup_timeline_container(self):
project = self.app.project_manager.current_project
self.timeline_container = TimelineContainer(self.app)
- self.timeline_container.setProject(project)
+ self.timeline_container.set_project(project)
timeline = self.timeline_container.timeline
timeline.app.project_manager.current_project = project
timeline.get_parent = mock.MagicMock(return_value=self.timeline_container)
- def getTimelineClips(self):
+ def get_timeline_clips(self):
for layer in self.timeline.layers:
for clip in layer.get_clips():
yield clip
@@ -191,47 +191,47 @@ class TestTimelineObserver(BaseTestUndoTimeline):
asset = GES.UriClipAsset.request_sync(uri)
clip = asset.extract()
self.layer.add_clip(clip)
- clips = list(self.getTimelineClips())
+ clips = list(self.get_timeline_clips())
self.assertEqual(len(clips), 1, clips)
self.assertEqual(len(clips[0].get_children(False)), 2)
common.TestCase.toggle_clip_selection(self, clips[0], True)
self.timeline_container.ungroup_action.activate(None)
- clips = list(self.getTimelineClips())
+ clips = list(self.get_timeline_clips())
self.assertEqual(len(clips), 2, clips)
self.assertEqual(len(clips[0].get_children(False)), 1)
self.assertEqual(len(clips[1].get_children(False)), 1)
timeline.selection.select(clips)
self.timeline_container.group_action.activate(None)
- clips = list(self.getTimelineClips())
+ clips = list(self.get_timeline_clips())
self.assertEqual(len(clips), 1, clips)
self.assertEqual(len(clips[0].get_children(False)), 2)
for _ in range(2):
# Undo grouping.
self.action_log.undo()
- clips = list(self.getTimelineClips())
+ clips = list(self.get_timeline_clips())
self.assertEqual(len(clips), 2, clips)
self.assertEqual(len(clips[0].get_children(False)), 1)
self.assertEqual(len(clips[1].get_children(False)), 1)
# Undo ungrouping.
self.action_log.undo()
- clips = list(self.getTimelineClips())
+ clips = list(self.get_timeline_clips())
self.assertEqual(len(clips), 1, clips)
self.assertEqual(len(clips[0].get_children(False)), 2)
# Redo ungrouping.
self.action_log.redo()
- clips = list(self.getTimelineClips())
+ clips = list(self.get_timeline_clips())
self.assertEqual(len(clips), 2, clips)
self.assertEqual(len(clips[0].get_children(False)), 1)
self.assertEqual(len(clips[1].get_children(False)), 1)
# Redo grouping.
self.action_log.redo()
- clips = list(self.getTimelineClips())
+ clips = list(self.get_timeline_clips())
self.assertEqual(len(clips), 1, clips)
self.assertEqual(len(clips[0].get_children(False)), 2)
@@ -241,17 +241,17 @@ class TestTimelineObserver(BaseTestUndoTimeline):
asset = GES.UriClipAsset.request_sync(uri)
clip1 = asset.extract()
self.timeline_container.insert_clips_on_first_layer(clips=[clip1], position=0)
- clips = list(self.getTimelineClips())
+ clips = list(self.get_timeline_clips())
self.assertEqual(len(clips), 1, clips)
# Undo insert on first layer
self.action_log.undo()
- clips = list(self.getTimelineClips())
+ clips = list(self.get_timeline_clips())
self.assertEqual(len(clips), 0, clips)
# Redo insert on first layer
self.action_log.redo()
- clips = list(self.getTimelineClips())
+ clips = list(self.get_timeline_clips())
self.assertEqual(len(clips), 1, clips)
# Insert new clip to create a layer
@@ -280,14 +280,14 @@ class TestTimelineObserver(BaseTestUndoTimeline):
class TestLayerObserver(BaseTestUndoTimeline):
- def testLayerMoved(self):
+ def test_layer_moved(self):
layer1 = self.layer
layer2 = self.timeline.append_layer()
layer3 = self.timeline.append_layer()
self.assertEqual(self.timeline.get_layers(), [layer1, layer2, layer3])
timeline_ui = Timeline(app=self.app, size_group=mock.Mock())
- timeline_ui.setProject(self.app.project_manager.current_project)
+ timeline_ui.set_project(self.app.project_manager.current_project)
# Click and drag a layer control box to move the layer.
with mock.patch.object(Gtk, 'get_event_widget') as get_event_widget:
@@ -314,17 +314,17 @@ class TestLayerObserver(BaseTestUndoTimeline):
def test_layer_renamed(self):
layer = Layer(self.layer, timeline=mock.Mock())
- self.assertIsNone(layer._nameIfSet())
+ self.assertIsNone(layer._name_if_set())
with self.app.action_log.started("change layer name"):
- layer.setName("Beautiful name")
- self.assertEqual(layer._nameIfSet(), "Beautiful name")
+ layer.set_name("Beautiful name")
+ self.assertEqual(layer._name_if_set(), "Beautiful name")
self.action_log.undo()
- self.assertIsNone(layer._nameIfSet())
+ self.assertIsNone(layer._name_if_set())
self.action_log.redo()
- self.assertEqual(layer._nameIfSet(), "Beautiful name")
+ self.assertEqual(layer._name_if_set(), "Beautiful name")
def test_add_clip(self):
clip1 = GES.TitleClip()
@@ -334,15 +334,15 @@ class TestLayerObserver(BaseTestUndoTimeline):
stack = self.action_log.undo_stacks[0]
self.assertEqual(len(stack.done_actions), 2, stack.done_actions)
self.assertTrue(isinstance(stack.done_actions[0], ClipAdded))
- self.assertTrue(clip1 in self.getTimelineClips())
+ self.assertTrue(clip1 in self.get_timeline_clips())
self.action_log.undo()
- self.assertFalse(clip1 in self.getTimelineClips())
+ self.assertFalse(clip1 in self.get_timeline_clips())
self.action_log.redo()
- self.assertTrue(clip1 in self.getTimelineClips())
+ self.assertTrue(clip1 in self.get_timeline_clips())
- def testRemoveClip(self):
+ def test_remove_clip(self):
stacks = []
self.action_log.connect("commit", BaseTestUndoTimeline.commit_cb, stacks)
@@ -356,13 +356,13 @@ class TestLayerObserver(BaseTestUndoTimeline):
self.assertEqual(1, len(stack.done_actions))
action = stack.done_actions[0]
self.assertTrue(isinstance(action, ClipRemoved))
- self.assertFalse(clip1 in self.getTimelineClips())
+ self.assertFalse(clip1 in self.get_timeline_clips())
self.action_log.undo()
- self.assertTrue(clip1 in self.getTimelineClips())
+ self.assertTrue(clip1 in self.get_timeline_clips())
self.action_log.redo()
- self.assertFalse(clip1 in self.getTimelineClips())
+ self.assertFalse(clip1 in self.get_timeline_clips())
def test_layer_added(self):
self.setup_timeline_container()
@@ -406,7 +406,7 @@ class TestLayerObserver(BaseTestUndoTimeline):
clip1.set_start(5 * Gst.SECOND)
clip1.set_duration(0.5 * Gst.SECOND)
- timeline_clips = list(self.getTimelineClips())
+ timeline_clips = list(self.get_timeline_clips())
self.assertEqual(1, len(timeline_clips), timeline_clips)
self.assertEqual(5 * Gst.SECOND, timeline_clips[0].get_start())
self.assertEqual(0.5 * Gst.SECOND, timeline_clips[0].get_duration())
@@ -414,7 +414,7 @@ class TestLayerObserver(BaseTestUndoTimeline):
with self.action_log.started("ungroup"):
ungrouped = GES.Container.ungroup(clip1, False)
self.assertEqual(2, len(ungrouped), ungrouped)
- timeline_clips = list(self.getTimelineClips())
+ timeline_clips = list(self.get_timeline_clips())
self.assertEqual(2, len(timeline_clips), timeline_clips)
self.assertEqual(5 * Gst.SECOND, timeline_clips[0].get_start())
self.assertEqual(0.5 * Gst.SECOND, timeline_clips[0].get_duration())
@@ -422,20 +422,20 @@ class TestLayerObserver(BaseTestUndoTimeline):
self.assertEqual(0.5 * Gst.SECOND, timeline_clips[1].get_duration())
self.action_log.undo()
- timeline_clips = list(self.getTimelineClips())
+ timeline_clips = list(self.get_timeline_clips())
self.assertEqual(1, len(timeline_clips))
self.assertEqual(5 * Gst.SECOND, timeline_clips[0].get_start())
self.assertEqual(0.5 * Gst.SECOND, timeline_clips[0].get_duration())
self.action_log.redo()
- timeline_clips = list(self.getTimelineClips())
+ timeline_clips = list(self.get_timeline_clips())
self.assertEqual(2, len(timeline_clips), timeline_clips)
self.assertEqual(5 * Gst.SECOND, timeline_clips[0].get_start())
self.assertEqual(0.5 * Gst.SECOND, timeline_clips[0].get_duration())
self.assertEqual(5 * Gst.SECOND, timeline_clips[1].get_start())
self.assertEqual(0.5 * Gst.SECOND, timeline_clips[1].get_duration())
- def testSplitClip(self):
+ def test_split_clip(self):
clip = GES.TitleClip()
clip.set_start(0 * Gst.SECOND)
clip.set_duration(20 * Gst.SECOND)
@@ -460,7 +460,7 @@ class TestLayerObserver(BaseTestUndoTimeline):
self.action_log.redo()
self.assertEqual(3, len(self.layer.get_clips()))
- def testAddEffectToClip(self):
+ def test_add_effect_to_clip(self):
stacks = []
self.action_log.connect("commit", BaseTestUndoTimeline.commit_cb, stacks)
@@ -490,7 +490,7 @@ class TestLayerObserver(BaseTestUndoTimeline):
clip1.get_children(True)
if isinstance(effect, GES.Effect)]))
- def testRemoveEffectFromClip(self):
+ def test_remove_effect_from_clip(self):
stacks = []
self.action_log.connect("commit", BaseTestUndoTimeline.commit_cb, stacks)
@@ -683,7 +683,7 @@ class TestLayerObserver(BaseTestUndoTimeline):
self.timeline_container.copy_action.emit("activate", None)
position = 10
- project.pipeline.getPosition = mock.Mock(return_value=position)
+ project.pipeline.get_position = mock.Mock(return_value=position)
self.timeline_container.paste_action.emit("activate", None)
self.assertEqual(len(self.layer.get_clips()), 2)
@@ -696,7 +696,7 @@ class TestLayerObserver(BaseTestUndoTimeline):
class TestControlSourceObserver(BaseTestUndoTimeline):
- def testControlSourceValueAdded(self):
+ def test_control_source_value_added(self):
uri = common.get_sample_uri("tears_of_steel.webm")
asset = GES.UriClipAsset.request_sync(uri)
clip = asset.extract()
@@ -720,7 +720,7 @@ class TestControlSourceObserver(BaseTestUndoTimeline):
self.assertEqual(Gst.SECOND * 0.5, keyframes[0].timestamp)
self.assertEqual(0.2, keyframes[0].value)
- def testControlSourceValueRemoved(self):
+ def test_control_source_value_removed(self):
uri = common.get_sample_uri("tears_of_steel.webm")
asset = GES.UriClipAsset.request_sync(uri)
clip = asset.extract()
@@ -745,7 +745,7 @@ class TestControlSourceObserver(BaseTestUndoTimeline):
self.action_log.redo()
self.assertEqual(0, len(control_source.get_all()))
- def testControlSourceValueChanged(self):
+ def test_control_source_value_changed(self):
uri = common.get_sample_uri("tears_of_steel.webm")
asset = GES.UriClipAsset.request_sync(uri)
clip = asset.extract()
@@ -867,7 +867,7 @@ class TestTrackElementObserver(BaseTestUndoTimeline):
class TestTimelineElementObserver(BaseTestUndoTimeline):
- def testTrackElementPropertyChanged(self):
+ def test_track_element_property_changed(self):
clip1 = GES.TitleClip()
self.layer.add_clip(clip1)
@@ -935,7 +935,7 @@ class TestTimelineElementObserver(BaseTestUndoTimeline):
class TestGObjectObserver(BaseTestUndoTimeline):
- def testClipPropertyChange(self):
+ def test_clip_property_change(self):
stacks = []
self.action_log.connect("commit", BaseTestUndoTimeline.commit_cb, stacks)
diff --git a/tests/test_utils.py b/tests/test_utils.py
index e97b3775..75e3ff05 100644
--- a/tests/test_utils.py
+++ b/tests/test_utils.py
@@ -157,7 +157,7 @@ class TestFormatAudiochannels(common.TestCase):
class TestDependencyChecks(common.TestCase):
- def testDependencies(self):
+ def test_dependencies(self):
gi_dep = GstDependency("Gst", "1.0", "1.0.0")
gi_dep.check()
self.assertTrue(gi_dep.satisfied)
diff --git a/tests/test_utils_timeline.py b/tests/test_utils_timeline.py
index 40db10cc..d30082f2 100644
--- a/tests/test_utils_timeline.py
+++ b/tests/test_utils_timeline.py
@@ -32,7 +32,7 @@ from tests.test_timeline_timeline import BaseTestTimeline
class TestSelected(common.TestCase):
- def testBoolEvaluation(self):
+ def test_bool_evaluation(self):
selected = Selected()
self.assertFalse(selected)
@@ -45,71 +45,71 @@ class TestSelected(common.TestCase):
class TestSelection(BaseTestTimeline):
- def testBoolEvaluation(self):
+ def test_bool_evaluation(self):
clip1 = mock.MagicMock()
selection = Selection()
self.assertFalse(selection)
- selection.setSelection([clip1], SELECT)
+ selection.set_selection([clip1], SELECT)
self.assertTrue(selection)
- selection.setSelection([clip1], SELECT_ADD)
+ selection.set_selection([clip1], SELECT_ADD)
self.assertTrue(selection)
- selection.setSelection([clip1], UNSELECT)
+ selection.set_selection([clip1], UNSELECT)
self.assertFalse(selection)
- def testGetSingleClip(self):
+ def test_get_single_clip(self):
selection = Selection()
clip1 = common.create_test_clip(GES.UriClip)
clip2 = common.create_test_clip(GES.TitleClip)
# Selection empty.
- self.assertIsNone(selection.getSingleClip())
- self.assertIsNone(selection.getSingleClip(GES.UriClip))
- self.assertIsNone(selection.getSingleClip(GES.TitleClip))
+ self.assertIsNone(selection.get_single_clip())
+ self.assertIsNone(selection.get_single_clip(GES.UriClip))
+ self.assertIsNone(selection.get_single_clip(GES.TitleClip))
- selection.setSelection([clip1], SELECT)
- self.assertEqual(selection.getSingleClip(), clip1)
- self.assertEqual(selection.getSingleClip(GES.UriClip), clip1)
- self.assertIsNone(selection.getSingleClip(GES.TitleClip))
+ selection.set_selection([clip1], SELECT)
+ self.assertEqual(selection.get_single_clip(), clip1)
+ self.assertEqual(selection.get_single_clip(GES.UriClip), clip1)
+ self.assertIsNone(selection.get_single_clip(GES.TitleClip))
- selection.setSelection([clip2], SELECT)
- self.assertEqual(selection.getSingleClip(), clip2)
- self.assertIsNone(selection.getSingleClip(GES.UriClip))
- self.assertEqual(selection.getSingleClip(GES.TitleClip), clip2)
+ selection.set_selection([clip2], SELECT)
+ self.assertEqual(selection.get_single_clip(), clip2)
+ self.assertIsNone(selection.get_single_clip(GES.UriClip))
+ self.assertEqual(selection.get_single_clip(GES.TitleClip), clip2)
- selection.setSelection([clip1, clip2], SELECT)
- self.assertIsNone(selection.getSingleClip())
- self.assertIsNone(selection.getSingleClip(GES.UriClip))
- self.assertIsNone(selection.getSingleClip(GES.TitleClip))
+ selection.set_selection([clip1, clip2], SELECT)
+ self.assertIsNone(selection.get_single_clip())
+ self.assertIsNone(selection.get_single_clip(GES.UriClip))
+ self.assertIsNone(selection.get_single_clip(GES.TitleClip))
def test_can_group_ungroup(self):
timeline_container = common.create_timeline_container()
timeline = timeline_container.timeline
- clip1, clip2 = self.addClipsSimple(timeline, 2)
+ clip1, clip2 = self.add_clips_simple(timeline, 2)
selection = Selection()
self.assertFalse(selection.can_group)
self.assertFalse(selection.can_ungroup)
- selection.setSelection([clip1], SELECT)
+ selection.set_selection([clip1], SELECT)
self.assertFalse(selection.can_group)
self.assertTrue(selection.can_ungroup)
- selection.setSelection([clip2], SELECT_ADD)
+ selection.set_selection([clip2], SELECT_ADD)
self.assertTrue(selection.can_group)
self.assertFalse(selection.can_ungroup)
- selection.setSelection([], SELECT)
+ selection.set_selection([], SELECT)
self.assertFalse(selection.can_group)
self.assertFalse(selection.can_ungroup)
def test_toplevels(self):
timeline_container = common.create_timeline_container()
timeline = timeline_container.timeline
- clip1, clip2, clip3, clip4 = self.addClipsSimple(timeline, 4)
+ clip1, clip2, clip3, clip4 = self.add_clips_simple(timeline, 4)
selection = Selection()
- selection.setSelection([clip1, clip2, clip3, clip4], SELECT)
+ selection.set_selection([clip1, clip2, clip3, clip4], SELECT)
self.assertSetEqual(selection.toplevels, {clip1, clip2, clip3, clip4})
group1 = GES.Container.group([clip1, clip2])
diff --git a/tests/test_widgets.py b/tests/test_widgets.py
index 6279debe..b359c443 100644
--- a/tests/test_widgets.py
+++ b/tests/test_widgets.py
@@ -33,7 +33,7 @@ from tests import common
class TestWidgets(common.TestCase):
- def testConstruction(self):
+ def test_construction(self):
widgets = (
(PathWidget, "file:///home/", ()),
(TextWidget, "banana", ()),
@@ -48,34 +48,34 @@ class TestWidgets(common.TestCase):
for widget_class, default, args in widgets:
widget = widget_class(*args, default=default)
- self.assertEqual(default, widget.getWidgetDefault())
- widget.setWidgetToDefault()
- self.assertEqual(default, widget.getWidgetValue())
- widget.setWidgetValue(default)
- self.assertEqual(default, widget.getWidgetValue())
+ self.assertEqual(default, widget.get_widget_default())
+ widget.set_widget_to_default()
+ self.assertEqual(default, widget.get_widget_value())
+ widget.set_widget_value(default)
+ self.assertEqual(default, widget.get_widget_value())
- def testValidation(self):
+ def test_validation(self):
widget = TextWidget("^([a-zA-Z]+\\s*)+$")
bad_value = "1"
- self.assertNotEqual(bad_value, widget.getWidgetValue())
+ self.assertNotEqual(bad_value, widget.get_widget_value())
widget = TextWidget("^\\d+$", ("12", "14"))
bad_value = "non-digits"
- self.assertNotEqual(bad_value, widget.getWidgetValue())
+ self.assertNotEqual(bad_value, widget.get_widget_value())
class TestFractionWidget(common.TestCase):
def test_widget_text(self):
widget = FractionWidget()
- widget.setWidgetValue(Gst.Fraction(1000000, 1))
+ widget.set_widget_value(Gst.Fraction(1000000, 1))
self.assertEqual(widget.text.get_text(), "1000000:1")
- widget.setWidgetValue(Gst.Fraction(7504120000000001, 4503600000000002))
+ widget.set_widget_value(Gst.Fraction(7504120000000001, 4503600000000002))
self.assertEqual(widget.text.get_text(), "7504120000000001:4503600000000002")
- def test_widget_text_magic_M(self):
+ def test_widget_text_magic__m(self):
widget = FractionWidget()
- widget.setWidgetValue(Gst.Fraction(1000000000, 1001))
+ widget.set_widget_value(Gst.Fraction(1000000000, 1001))
self.assertEqual(widget.text.get_text(), "1000000M")
@@ -88,4 +88,4 @@ class TestGstElementSettingsDialog(common.TestCase):
values)
widgets = {prop.name: widget
for prop, widget in dialog.elementsettings.properties.items()}
- self.assertEqual(widgets["datarate"].getWidgetValue(), 12)
+ self.assertEqual(widgets["datarate"].get_widget_value(), 12)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]