[pitivi] pitivi: Rename self.current (aka self.app.current) to self.current_project



commit 741ce784b2fa833b64347eb4fb4bc702cdea5499
Author: Jean-François Fortin Tam <nekohayo gmail com>
Date:   Sat Aug 31 21:51:33 2013 -0400

    pitivi: Rename self.current (aka self.app.current) to self.current_project
    
    This elongates some lines, but makes its purpose and origin crystal clear

 pitivi/application.py        |   23 ++++++-------
 pitivi/clipproperties.py     |   10 +++---
 pitivi/effects.py            |    2 +-
 pitivi/mainwindow.py         |   60 +++++++++++++++++-----------------
 pitivi/medialibrary.py       |   22 ++++++------
 pitivi/project.py            |   71 ++++++++++++++++++++---------------------
 pitivi/render.py             |    8 ++--
 pitivi/timeline/timeline.py  |   12 +++---
 pitivi/transitions.py        |    6 ++--
 pitivi/viewer.py             |    6 ++--
 tests/test_basic.py          |    2 +-
 tests/test_projectmanager.py |   32 +++++++++---------
 12 files changed, 126 insertions(+), 128 deletions(-)
---
diff --git a/pitivi/application.py b/pitivi/application.py
index c8170ef..0507152 100644
--- a/pitivi/application.py
+++ b/pitivi/application.py
@@ -126,7 +126,7 @@ class Pitivi(Loggable, Signallable):
                 % APPNAME)
         instance.PiTiVi = self
 
-        self.current = None
+        self.current_project = None
 
         # get settings
         self.settings = GlobalSettings()
@@ -159,12 +159,12 @@ class Pitivi(Loggable, Signallable):
         self.debug("shutting down")
         # we refuse to close if we're running a user interface and the user
         # doesn't want us to close the current project.
-        if self.current and not self.projectManager.closeRunningProject():
+        if self.current_project and not self.projectManager.closeRunningProject():
             self.warning("Not closing since running project doesn't want to close")
             return False
         self.threads.stopAllThreads()
         self.settings.storeSettings()
-        self.current = None
+        self.current_project = None
         instance.PiTiVi = None
         self.emit("shutdown")
         return True
@@ -182,15 +182,14 @@ class Pitivi(Loggable, Signallable):
         self.emit("new-project-loading", uri)
 
     def _projectManagerNewProjectCreated(self, projectManager, project):
-        self.current = project
+        self.current_project = project
         self.emit("new-project-created", project)
 
     def _newProjectLoaded(self, project):
         pass
 
-    def _projectManagerNewProjectLoaded(self, projectManager, project,
-            unused_fully_loaded):
-        self.current = project
+    def _projectManagerNewProjectLoaded(self, projectManager, project, unused_fully_loaded):
+        self.current_project = project
         self.action_log.clean()
         #self.timelineLogObserver.startObserving(project.timeline)
         self.projectLogObserver.startObserving(project)
@@ -206,7 +205,7 @@ class Pitivi(Loggable, Signallable):
     def _projectManagerProjectClosed(self, projectManager, project):
         #self.timelineLogObserver.stopObserving(project.timeline)
         self.projectLogObserver.stopObserving(project)
-        self.current = None
+        self.current_project = None
         self.emit("project-closed", project)
 
     def _checkVersion(self):
@@ -334,7 +333,7 @@ class ProjectCreatorGuiPitivi(GuiPitivi):
         self.projectManager.newBlankProject(False)
         uris = [quote_uri(os.path.abspath(media_filename))
                 for media_filename in media_filenames]
-        lib = self.current.medialibrary
+        lib = self.current_project.medialibrary
         lib.connect("source-added", self._sourceAddedCb, uris, add_to_timeline)
         lib.connect("discovery-error", self._discoveryErrorCb, uris)
         lib.addUris(uris)
@@ -345,7 +344,7 @@ class ProjectCreatorGuiPitivi(GuiPitivi):
             self.action_log.begin("add clip")
             src = GES.UriClip(uri=info.get_uri())
             src.set_property("priority", 1)
-            self.current.timeline.get_layers()[0].add_clip(src)
+            self.current_project.timeline.get_layers()[0].add_clip(src)
             self.action_log.commit()
 
     def _discoveryErrorCb(self, medialibrary, uri, error, debug, startup_uris):
@@ -361,8 +360,8 @@ class ProjectCreatorGuiPitivi(GuiPitivi):
             return False
 
         if not startup_uris:
-            self.current.medialibrary.disconnect_by_function(self._sourceAddedCb)
-            self.current.medialibrary.disconnect_by_function(self._discoveryErrorCb)
+            self.current_project.medialibrary.disconnect_by_function(self._sourceAddedCb)
+            self.current_project.medialibrary.disconnect_by_function(self._discoveryErrorCb)
 
         return True
 
diff --git a/pitivi/clipproperties.py b/pitivi/clipproperties.py
index 40c29b1..932cd85 100644
--- a/pitivi/clipproperties.py
+++ b/pitivi/clipproperties.py
@@ -339,7 +339,7 @@ class EffectProperties(Gtk.Expander, Loggable):
                     clip.add(effect)
                     self.updateAll()
                     self.app.action_log.commit()
-                    self.app.current.pipeline.flushSeek()
+                    self.app.current_project.pipeline.flushSeek()
 
                     break
 
@@ -371,7 +371,7 @@ class EffectProperties(Gtk.Expander, Loggable):
         tck_effect.set_active(not tck_effect.is_active())
         cellrenderertoggle.set_active(tck_effect.is_active())
         self._updateTreeview()
-        self.app.current.timeline.commit()
+        self.app.current_project.timeline.commit()
         self.app.action_log.commit()
 
     def _expandedCb(self, expander, params):
@@ -591,7 +591,7 @@ class TransformationProperties(Gtk.Expander):
         self.app.gui.setActionsSensitive(True)
 
     def _flushPipeLineCb(self, widget):
-        self.app.current.pipeline.flushSeek()
+        self.app.current_project.pipeline.flushSeek()
 
     def _findEffect(self, name):
         for effect in self._selected_clip.get_children(False):
@@ -605,7 +605,7 @@ class TransformationProperties(Gtk.Expander):
         if not effect:
             effect = GES.Effect.new(bin_description=name)
             self._selected_clip.add(effect)
-            tracks = self.app.projectManager.current.timeline.get_tracks()
+            tracks = self.app.projectManager.current_project.timeline.get_tracks()
             effect = self._findEffect(name)
             # disable the effect on default
             a = self.effect.get_gnlobject()
@@ -632,7 +632,7 @@ class TransformationProperties(Gtk.Expander):
             if self._selected_clip:
                 self._selected_clip = None
                 self.zoom_scale.set_value(1.0)
-                self.app.current.pipeline.flushSeek()
+                self.app.current_project.pipeline.flushSeek()
             self.effect = None
             self.hide()
         self._updateBoxVisibility()
diff --git a/pitivi/effects.py b/pitivi/effects.py
index adc7638..98d74fc 100644
--- a/pitivi/effects.py
+++ b/pitivi/effects.py
@@ -695,5 +695,5 @@ class EffectsPropertiesManager:
             self._current_effect_setting_ui.element.set_child_property(prop.name, value)
             self.action_log.commit()
 
-            self.app.current.pipeline.flushSeek()
+            self.app.current_project.pipeline.flushSeek()
             self._current_element_values[prop.name] = value
diff --git a/pitivi/mainwindow.py b/pitivi/mainwindow.py
index b4cccfe..5dc6220 100644
--- a/pitivi/mainwindow.py
+++ b/pitivi/mainwindow.py
@@ -235,7 +235,7 @@ class PitiviMainWindow(Gtk.Window, Loggable):
         self.set_sensitive(True)
 
     def _renderCb(self, unused_button):
-        self.showRenderDialog(self.app.current)
+        self.showRenderDialog(self.app.current_project)
 
     def _setActions(self, instance):
         """
@@ -671,13 +671,13 @@ class PitiviMainWindow(Gtk.Window, Loggable):
         self.openProject()
 
     def _saveProjectCb(self, unused_action):
-        if not self.app.current.uri or self.app.projectManager.disable_save is True:
+        if not self.app.current_project.uri or self.app.projectManager.disable_save is True:
             self._saveProjectAsCb(unused_action)
         else:
             self.app.projectManager.saveProject()
 
     def _saveProjectAsCb(self, unused_action):
-        uri = self._showSaveAsDialog(self.app.current)
+        uri = self._showSaveAsDialog(self.app.current_project)
         if uri is not None:
             return self.app.projectManager.saveProject(uri)
 
@@ -687,10 +687,10 @@ class PitiviMainWindow(Gtk.Window, Loggable):
         return self.app.projectManager.revertToSavedProject()
 
     def _exportProjectAsTarCb(self, unused_action):
-        uri = self._showExportDialog(self.app.current)
+        uri = self._showExportDialog(self.app.current_project)
         result = None
         if uri:
-            result = self.app.projectManager.exportProject(self.app.current, uri)
+            result = self.app.projectManager.exportProject(self.app.current_project, uri)
 
         if not result:
             self.log("Project couldn't be exported")
@@ -706,7 +706,7 @@ class PitiviMainWindow(Gtk.Window, Loggable):
 
     def showProjectSettingsDialog(self):
         from pitivi.project import ProjectSettingsDialog
-        ProjectSettingsDialog(self, self.app.current).window.run()
+        ProjectSettingsDialog(self, self.app.current_project).window.run()
         self.updateTitle()
 
     def _quitCb(self, unused_action):
@@ -839,10 +839,10 @@ class PitiviMainWindow(Gtk.Window, Loggable):
         "ready" signal to populate the timeline.
         """
         self.log("A new project is loaded")
-        self._connectToProject(self.app.current)
-        self.app.current.timeline.connect("notify::duration",
+        self._connectToProject(self.app.current_project)
+        self.app.current_project.timeline.connect("notify::duration",
                 self._timelineDurationChangedCb)
-        self.app.current.pipeline.activatePositionListener()
+        self.app.current_project.pipeline.activatePositionListener()
         self._setProject()
 
         #FIXME GES we should re-enable this when possible
@@ -852,7 +852,7 @@ class PitiviMainWindow(Gtk.Window, Loggable):
         # Enable export functionality
         self.main_actions.get_action("ExportProject").set_sensitive(True)
         if self._missingUriOnLoading:
-            self.app.current.setModificationState(True)
+            self.app.current_project.setModificationState(True)
             self.main_actions.get_action("SaveProject").set_sensitive(True)
             self._missingUriOnLoading = False
 
@@ -861,7 +861,7 @@ class PitiviMainWindow(Gtk.Window, Loggable):
             # redirects to it if needed, so we still want it to be enabled:
             self.main_actions.get_action("SaveProject").set_sensitive(True)
 
-        if self.app.current.timeline.props.duration != 0:
+        if self.app.current_project.timeline.props.duration != 0:
             self.render_button.set_sensitive(True)
 
     def _projectManagerNewProjectLoadingCb(self, projectManager, uri):
@@ -986,7 +986,7 @@ class PitiviMainWindow(Gtk.Window, Loggable):
         return False
 
     def _projectManagerRevertingToSavedCb(self, projectManager, unused_project):
-        if self.app.current.hasUnsavedModifications():
+        if self.app.current_project.hasUnsavedModifications():
             dialog = Gtk.MessageDialog(self,
                     Gtk.DialogFlags.MODAL,
                     Gtk.MessageType.WARNING,
@@ -1098,7 +1098,7 @@ class PitiviMainWindow(Gtk.Window, Loggable):
         if response == Gtk.ResponseType.OK:
             self.log("User chose a new URI for the missing file")
             new_uri = chooser.get_uri()
-            self.app.current.setModificationState(False)
+            self.app.current_project.setModificationState(False)
         else:
             # Even if the user clicks Cancel, the discoverer keeps trying to
             # import the rest of the clips...
@@ -1106,7 +1106,7 @@ class PitiviMainWindow(Gtk.Window, Loggable):
             # this async operation, or the filechooser will keep showing up
             # and all sorts of weird things will happen.
             # TODO: bugs #661059, 609136
-            attempted_uri = self.app.current.uri
+            attempted_uri = self.app.current_project.uri
             reason = _('No replacement file was provided for "<i>%s</i>".\n\n'
                     'PiTiVi does not currently support partial projects.'
                     % info_name(asset))
@@ -1155,10 +1155,10 @@ class PitiviMainWindow(Gtk.Window, Loggable):
         dirty = action_log.dirty()
         save_action = self.main_actions.get_action("SaveProject")
         save_action.set_sensitive(dirty)
-        if self.app.current.uri is not None:
+        if self.app.current_project.uri is not None:
             revert_action = self.main_actions.get_action("RevertToSavedProject")
             revert_action.set_sensitive(dirty)
-        self.app.current.setModificationState(dirty)
+        self.app.current_project.setModificationState(dirty)
 
         redo_action = self.main_actions.get_action("Redo")
         can_redo = bool(action_log.redo_stacks)
@@ -1171,28 +1171,28 @@ class PitiviMainWindow(Gtk.Window, Loggable):
         """
         Disconnect and reconnect callbacks to the new current project
         """
-        if not self.app.current:
+        if not self.app.current_project:
             self.warning("Current project instance does not exist")
             return False
         try:
-            self.app.current.disconnect_by_func(self._renderingSettingsChangedCb)
+            self.app.current_project.disconnect_by_func(self._renderingSettingsChangedCb)
         except:
             # When loading the first project, the signal has never been
             # connected before.
             pass
-        self.app.current.connect("rendering-settings-changed", self._renderingSettingsChangedCb)
+        self.app.current_project.connect("rendering-settings-changed", self._renderingSettingsChangedCb)
 
-        self.viewer.setPipeline(self.app.current.pipeline)
-        self._renderingSettingsChangedCb(self.app.current)
+        self.viewer.setPipeline(self.app.current_project.pipeline)
+        self._renderingSettingsChangedCb(self.app.current_project)
         if self.timeline_ui:
-            self.clipconfig.project = self.app.current
+            self.clipconfig.project = self.app.current_project
             #FIXME GES port undo/redo
-            #self.app.timelineLogObserver.pipeline = self.app.current.pipeline
+            #self.app.timelineLogObserver.pipeline = self.app.current_project.pipeline
 
         # When creating a blank project, medialibrary will eventually trigger
         # this _setProject method, but there's no project URI yet.
-        if self.app.current.uri:
-            folder_path = os.path.dirname(path_from_uri(self.app.current.uri))
+        if self.app.current_project.uri:
+            folder_path = os.path.dirname(path_from_uri(self.app.current_project.uri))
             self.settings.lastProjectFolder = folder_path
 
     def _renderingSettingsChangedCb(self, project, item=None, value=None):
@@ -1320,7 +1320,7 @@ class PitiviMainWindow(Gtk.Window, Loggable):
         preview_window.hide()  # Hack to allow setting the window position
         previewer.previewUri(uri)
         previewer.setMinimal()
-        info = self.app.current.get_asset(uri, GES.UriClip).get_info()
+        info = self.app.current_project.get_asset(uri, GES.UriClip).get_info()
         try:
             # For videos and images, automatically resize the window
             # Try to keep it 1:1 if it can fit within 85% of the parent window
@@ -1353,12 +1353,12 @@ class PitiviMainWindow(Gtk.Window, Loggable):
 
     def updateTitle(self):
         name = touched = ""
-        if self.app.current:
-            if self.app.current.name:
-                name = self.app.current.name
+        if self.app.current_project:
+            if self.app.current_project.name:
+                name = self.app.current_project.name
             else:
                 name = _("Untitled")
-            if self.app.current.hasUnsavedModifications():
+            if self.app.current_project.hasUnsavedModifications():
                 touched = "*"
         title = "%s%s — %s" % (touched, name, APPNAME)
         self.set_title(title)
diff --git a/pitivi/medialibrary.py b/pitivi/medialibrary.py
index 1db573d..9ea2b5c 100644
--- a/pitivi/medialibrary.py
+++ b/pitivi/medialibrary.py
@@ -352,7 +352,7 @@ class MediaLibraryWidget(Gtk.VBox, Loggable):
     def _trackElementAddedCb(self, source, unused_track_element):
         """ After an object has been added to the first track, position it
         correctly and request the next source to be processed. """
-        timeline = self.app.current.timeline
+        timeline = self.app.current_project.timeline
         layer = timeline.get_layers()[0]  # FIXME Get the longest layer
 
         # Handle the case where we just inserted the first clip
@@ -510,8 +510,8 @@ class MediaLibraryWidget(Gtk.VBox, Loggable):
         """
         Update the _progressbar with the ratio of clips imported vs the total
         """
-        current_clip_iter = self.app.current.nb_imported_files
-        total_clips = self.app.current.nb_remaining_file_to_import + current_clip_iter
+        current_clip_iter = self.app.current_project.nb_imported_files
+        total_clips = self.app.current_project.nb_remaining_file_to_import + current_clip_iter
 
         progressbar_text = _("Importing clip %(current_clip)d of %(total)d" %
             {"current_clip": current_clip_iter,
@@ -680,7 +680,7 @@ class MediaLibraryWidget(Gtk.VBox, Loggable):
             self.app.settings.closeImportDialog = \
                 dialogbox.props.extra_widget.get_active()
             filenames = dialogbox.get_uris()
-            self.app.current.addUris(filenames)
+            self.app.current_project.addUris(filenames)
             if self.app.settings.closeImportDialog:
                 dialogbox.destroy()
                 self._importDialog = None
@@ -710,12 +710,12 @@ class MediaLibraryWidget(Gtk.VBox, Loggable):
         self.app.action_log.begin("remove clip from source list")
         for row in rows:
             asset = model[row.get_path()][COL_ASSET]
-            self.app.current.remove_asset(asset)
+            self.app.current_project.remove_asset(asset)
         self.app.action_log.commit()
 
     def _sourceIsUsed(self, asset):
         """Check if a given URI is present in the timeline"""
-        layers = self.app.current.timeline.get_layers()
+        layers = self.app.current_project.timeline.get_layers()
         for layer in layers:
             for clip in layer.get_clips():
                 if clip.get_asset() == asset:
@@ -726,7 +726,7 @@ class MediaLibraryWidget(Gtk.VBox, Loggable):
         """
         Select, in the media library, unused sources in the project.
         """
-        assets = self.app.current.list_assets(GES.UriClip)
+        assets = self.app.current_project.list_assets(GES.UriClip)
         unused_sources_uris = []
 
         model = self.treeview.get_model()
@@ -763,7 +763,7 @@ class MediaLibraryWidget(Gtk.VBox, Loggable):
         paths = self.getSelectedPaths()[0]  # Only use the first item
         model = self.treeview.get_model()
         info = model[paths][COL_ASSET].get_info()
-        d = clipmediapropsDialog(self.app.current,
+        d = clipmediapropsDialog(self.app.current_project,
                                 info.get_audio_streams(),
                                 info.get_video_streams())
         d.run()
@@ -977,8 +977,8 @@ class MediaLibraryWidget(Gtk.VBox, Loggable):
         self._project = None
 
     def _addUris(self, uris):
-        if self.app.current:
-            self.app.current.addUris(uris)
+        if self.app.current_project:
+            self.app.current_project.addUris(uris)
         else:
             self.warning("Adding uris to project, but the project has changed in the meantime")
         return False
@@ -1013,7 +1013,7 @@ class MediaLibraryWidget(Gtk.VBox, Loggable):
             #TODO waiting for remote files downloader support to be implemented
             self.fixme("Importing remote files is not implemented")
         if len(filenames):
-            self.app.current.addUris(filenames)
+            self.app.current_project.addUris(filenames)
 
     #used with TreeView and IconView
     def _dndDragDataGetCb(self, unused_view, context, data, info, timestamp):
diff --git a/pitivi/project.py b/pitivi/project.py
index dbd84ff..c485ad8 100644
--- a/pitivi/project.py
+++ b/pitivi/project.py
@@ -124,8 +124,7 @@ class ProjectManager(Signallable, Loggable):
         Signallable.__init__(self)
         Loggable.__init__(self)
         self.app = app_instance
-        # Current project:
-        self.current = None
+        self.current_project = None
         self.disable_save = False  # Enforce "Save as" for backup and xptv files
         self._backup_lock = 0
 
@@ -135,7 +134,7 @@ class ProjectManager(Signallable, Loggable):
         should be loaded instead, and if so, force the user to use "Save as"
         afterwards.
         """
-        if self.current is not None and not self.closeRunningProject():
+        if self.current_project is not None and not self.closeRunningProject():
             return False
 
         self.emit("new-project-loading", uri)
@@ -158,7 +157,7 @@ class ProjectManager(Signallable, Loggable):
             self.debug('Loading project from backup "%s"' % uri)
 
         # Load the project:
-        self.current = Project(uri=uri)
+        self.current_project = Project(uri=uri)
         # For backup files and legacy formats, force the user to use "Save as"
         if use_backup or path.endswith(".xptv"):
             self.debug("Enforcing read-only mode")
@@ -166,12 +165,12 @@ class ProjectManager(Signallable, Loggable):
         else:
             self.disable_save = False
 
-        self.current.connect("missing-uri", self._missingURICb)
-        self.current.connect("loaded", self._projectLoadedCb)
+        self.current_project.connect("missing-uri", self._missingURICb)
+        self.current_project.connect("loaded", self._projectLoadedCb)
 
-        if self.current.createTimeline():
-            self.emit("new-project-created", self.current)
-            self.current.connect("project-changed", self._projectChangedCb)
+        if self.current_project.createTimeline():
+            self.emit("new-project-created", self.current_project)
+            self.current_project.connect("project-changed", self._projectChangedCb)
             return True
         else:
             self.emit("new-project-failed", uri,
@@ -256,18 +255,18 @@ class ProjectManager(Signallable, Loggable):
             return
 
         if backup:
-            if self.current is not None and self.current.uri is not None:
+            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.uri)
+                uri = self._makeBackupURI(self.current_project.uri)
             else:
                 # Do not try to save backup files for blank projects.
-                # It is possible that self.current.uri == None when the backup
+                # It is possible that self.current_project.uri == None when the backup
                 # timer sent us an old instance of the (now closed) project.
                 return
         elif uri is None:
             # "Normal save" scenario. The filechoosers in mainwindow ask users
             # for permission to overwrite the file (if needed), so we're safe.
-            uri = self.current.uri
+            uri = self.current_project.uri
         else:
             # "Save As" (or "normal-save a blank project") scenario. We use the
             # provided URI, so ensure it's properly encoded, or GIO will fail:
@@ -283,7 +282,7 @@ class ProjectManager(Signallable, Loggable):
             # "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.
-            saved = self.current.save(self.current.timeline, uri, formatter_type, overwrite=True)
+            saved = self.current_project.save(self.current_project.timeline, uri, formatter_type, 
overwrite=True)
         except Exception, e:
             saved = False
             self.emit("save-project-failed", uri, e)
@@ -291,13 +290,13 @@ class ProjectManager(Signallable, Loggable):
         if saved:
             if not backup:
                 # Do not emit the signal when autosaving a backup file
-                self.current.setModificationState(False)
-                self.emit("project-saved", self.current, uri)
+                self.current_project.setModificationState(False)
+                self.emit("project-saved", self.current_project, uri)
                 self.debug('Saved project "%s"' % uri)
                 # Update the project instance's uri,
                 # otherwise, subsequent saves will be to the old uri.
                 self.info("Setting the project instance's URI to %s" % uri)
-                self.current.uri = uri
+                self.current_project.uri = uri
                 self.disable_save = False
             else:
                 self.debug('Saved backup "%s"' % uri)
@@ -318,9 +317,9 @@ class ProjectManager(Signallable, 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:
-            _old_uri = self.current.uri
+            _old_uri = self.current_project.uri
             self.saveProject(tmp_uri)
-            self.current.uri = _old_uri
+            self.current_project.uri = _old_uri
 
             # create tar file
             with tarfile.open(path_from_uri(uri), mode="w") as tar:
@@ -364,33 +363,33 @@ class ProjectManager(Signallable, Loggable):
     def closeRunningProject(self):
         """ close the current project """
 
-        if self.current is None:
+        if self.current_project is None:
             self.warning("Trying to close a project that was already closed/didn't exist")
             return True
 
-        self.info("closing running project %s", self.current.props.uri)
-        if not self.emit("closing-project", self.current):
+        self.info("closing running project %s", self.current_project.uri)
+        if not self.emit("closing-project", self.current_project):
             self.error("Could not close project")
             return False
 
-        self.emit("project-closed", self.current)
+        self.emit("project-closed", self.current_project)
         # We should never choke on silly stuff like disconnecting signals
         # that were already disconnected. It blocks the UI for nothing.
         # This can easily happen when a project load/creation failed.
         try:
-            self.current.disconnect_by_function(self._projectChangedCb)
+            self.current_project.disconnect_by_function(self._projectChangedCb)
         except Exception:
             self.debug("Tried disconnecting signals, but they were not connected")
-        self._cleanBackup(self.current.uri)
-        self.current.release()
-        self.current = None
+        self._cleanBackup(self.current_project.uri)
+        self.current_project.release()
+        self.current_project = None
 
         return True
 
     def newBlankProject(self, emission=True):
         """ start up a new blank project """
         # if there's a running project we must close it
-        if self.current is not None and not self.closeRunningProject():
+        if self.current_project is not None and not self.closeRunningProject():
             return False
 
         if emission:
@@ -403,10 +402,10 @@ class ProjectManager(Signallable, Loggable):
 
         project.createTimeline()
         self.emit("new-project-created", project)
-        self.current = project
+        self.current_project = project
 
         project.connect("project-changed", self._projectChangedCb)
-        self.emit("new-project-loaded", self.current, emission)
+        self.emit("new-project-loaded", self.current_project, emission)
         self.time_loaded = time()
 
         return True
@@ -415,13 +414,13 @@ class ProjectManager(Signallable, Loggable):
         """
         Discard all unsaved changes and reload current open project
         """
-        if self.current.uri is None or not self.current.hasUnsavedModifications():
+        if self.current_project.uri is None or not self.current_project.hasUnsavedModifications():
             return True
-        if not self.emit("reverting-to-saved", self.current):
+        if not self.emit("reverting-to-saved", self.current_project):
             return False
 
-        uri = self.current.uri
-        self.current.setModificationState(False)
+        uri = self.current_project.uri
+        self.current_project.setModificationState(False)
         self.closeRunningProject()
         self.loadProject(uri)
 
@@ -473,8 +472,8 @@ class ProjectManager(Signallable, Loggable):
         return self.emit("missing-uri", project, error, asset)
 
     def _projectLoadedCb(self, project, timeline):
-        self.debug("Project loaded %s", self.current.props.uri)
-        self.emit("new-project-loaded", self.current, True)
+        self.debug("Project loaded %s", self.current_project.props.uri)
+        self.emit("new-project-loaded", self.current_project, True)
         self.time_loaded = time()
 
 
diff --git a/pitivi/render.py b/pitivi/render.py
index d1a2b0e..acae08c 100644
--- a/pitivi/render.py
+++ b/pitivi/render.py
@@ -796,7 +796,7 @@ class RenderDialog(Loggable):
         self._pipeline.set_mode(GES.PipelineFlags.FULL_PREVIEW)
 
     def _pauseRender(self, progress):
-        self.app.current.pipeline.togglePlayback()
+        self.app.current_project.pipeline.togglePlayback()
 
     def _destroyProgressWindow(self):
         """ Handle the completion or the cancellation of the render process. """
@@ -809,7 +809,7 @@ class RenderDialog(Loggable):
             obj.disconnect(id)
         self._gstSigId = {}
         try:
-            self.app.current.pipeline.disconnect_by_func(self._updatePositionCb)
+            self.app.current_project.pipeline.disconnect_by_func(self._updatePositionCb)
         except TypeError:
             # The render was successful, so this was already disconnected
             pass
@@ -842,7 +842,7 @@ class RenderDialog(Loggable):
         bus = self._pipeline.get_bus()
         bus.add_signal_watch()
         self._gstSigId[bus] = bus.connect('message', self._busMessageCb)
-        self.app.current.pipeline.connect("position", self._updatePositionCb)
+        self.app.current_project.pipeline.connect("position", self._updatePositionCb)
         # 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()
@@ -902,7 +902,7 @@ class RenderDialog(Loggable):
         if self.progress:
             text = None
             timediff = time.time() - self.timestarted
-            length = self.app.current.timeline.props.duration
+            length = self.app.current_project.timeline.props.duration
             fraction = float(min(position, length)) / float(length)
             if timediff > 5.0 and position:
                 # only display ETA after 5s in order to have enough averaging and
diff --git a/pitivi/timeline/timeline.py b/pitivi/timeline/timeline.py
index 5bbc669..a0ac507 100644
--- a/pitivi/timeline/timeline.py
+++ b/pitivi/timeline/timeline.py
@@ -1087,7 +1087,7 @@ class Timeline(Gtk.VBox, Zoomable, Loggable):
             return
         canvas_size = self.embed.get_allocation().width - CONTROL_WIDTH
         try:
-            new_pos = Zoomable.nsToPixel(self.app.current.pipeline.getPosition())
+            new_pos = Zoomable.nsToPixel(self.app.current_project.pipeline.getPosition())
         except PipelineError, e:
             self.info("Pipeline error: %s" % e)
             return
@@ -1193,7 +1193,7 @@ class Timeline(Gtk.VBox, Zoomable, Loggable):
         self.bTimeline.commit()
 
     def _splitElements(self, elements):
-        position = self.app.current.pipeline.getPosition()
+        position = self.app.current_project.pipeline.getPosition()
         for element in elements:
             start = element.get_start()
             end = start + element.get_duration()
@@ -1211,7 +1211,7 @@ class Timeline(Gtk.VBox, Zoomable, Loggable):
 
         for obj in selected:
             keyframe_exists = False
-            position = self.app.current.pipeline.getPosition()
+            position = self.app.current_project.pipeline.getPosition()
             position_in_obj = (position - obj.start) + obj.in_point
             interpolators = obj.getInterpolators()
             for value in interpolators:
@@ -1229,7 +1229,7 @@ class Timeline(Gtk.VBox, Zoomable, Loggable):
                     self.app.action_log.commit()
 
     def _playPause(self, unused_action):
-        self.app.current.pipeline.togglePlayback()
+        self.app.current_project.pipeline.togglePlayback()
 
     def transposeXY(self, x, y):
         height = self.ruler.get_allocation().height
@@ -1388,14 +1388,14 @@ class Timeline(Gtk.VBox, Zoomable, Loggable):
             self._project.pipeline.save_thumbnail(-1, -1, mime, path)
 
     def _previousKeyframeCb(self, action):
-        position = self.app.current.pipeline.getPosition()
+        position = self.app.current_project.pipeline.getPosition()
         prev_kf = self.timeline.getPrevKeyframe(position)
         if prev_kf:
             self._seeker.seek(prev_kf)
             self.scrollToPlayhead()
 
     def _nextKeyframeCb(self, action):
-        position = self.app.current.pipeline.getPosition()
+        position = self.app.current_project.pipeline.getPosition()
         next_kf = self.timeline.getNextKeyframe(position)
         if next_kf:
             self._seeker.seek(next_kf)
diff --git a/pitivi/transitions.py b/pitivi/transitions.py
index b2a0467..c6cc63b 100644
--- a/pitivi/transitions.py
+++ b/pitivi/transitions.py
@@ -162,7 +162,7 @@ class TransitionsListWidget(Signallable, Gtk.VBox, Loggable):
             self.props_widgets.set_sensitive(True)
 
         self.element.get_parent().set_asset(transition_asset)
-        self.app.current.seeker.flush(True)
+        self.app.current_project.seeker.flush(True)
 
         return True
 
@@ -170,13 +170,13 @@ class TransitionsListWidget(Signallable, Gtk.VBox, Loggable):
         value = range_changed.get_value()
         self.debug("User changed the border property to %s" % value)
         self.element.set_border(int(value))
-        self.app.current.seeker.flush(True)
+        self.app.current_project.seeker.flush(True)
 
     def _invertCheckboxCb(self, widget):
         value = widget.get_active()
         self.debug("User changed the invert property to %s" % value)
         self.element.set_inverted(value)
-        self.app.current.seeker.flush()
+        self.app.current_project.seeker.flush()
 
     def _borderTypeChangedCb(self, widget=None):
         """
diff --git a/pitivi/viewer.py b/pitivi/viewer.py
index 0d955d0..554d066 100644
--- a/pitivi/viewer.py
+++ b/pitivi/viewer.py
@@ -328,7 +328,7 @@ class PitiviViewer(Gtk.VBox, Loggable):
             self.target.renderbox()
 
     def _playButtonCb(self, unused_button, playing):
-        self.app.current.pipeline.togglePlayback()
+        self.app.current_project.pipeline.togglePlayback()
 
     def _goToStartCb(self, unused_button):
         self.seeker.seek(0)
@@ -343,7 +343,7 @@ class PitiviViewer(Gtk.VBox, Loggable):
 
     def _goToEndCb(self, unused_button):
         try:
-            end = self.app.current.pipeline.getDuration()
+            end = self.app.current_project.pipeline.getDuration()
         except:
             self.warning("Couldn't get timeline duration")
         try:
@@ -464,7 +464,7 @@ class PitiviViewer(Gtk.VBox, Loggable):
         if self._tmp_pipeline is not None:
             self._tmp_pipeline.set_state(Gst.State.NULL)
             self._tmp_pipeline = None  # Free the memory
-            self.setPipeline(self.app.current.pipeline, self._oldTimelinePos)
+            self.setPipeline(self.app.current_project.pipeline, self._oldTimelinePos)
             self.debug("Back to old pipeline")
 
     def _pipelineStateChangedCb(self, pipeline, state):
diff --git a/tests/test_basic.py b/tests/test_basic.py
index af7906a..8565bda 100644
--- a/tests/test_basic.py
+++ b/tests/test_basic.py
@@ -15,7 +15,7 @@ class BasicTest(TestCase):
         self.assert_(ptv)
 
         # were the contents of pitivi properly created
-        self.assertEqual(ptv.current, None)
+        self.assertEqual(ptv.current_project, None)
         self.assert_(ptv.effects)
 
         # was the unique instance object properly set
diff --git a/tests/test_projectmanager.py b/tests/test_projectmanager.py
index 28aed64..29fd279 100644
--- a/tests/test_projectmanager.py
+++ b/tests/test_projectmanager.py
@@ -239,9 +239,9 @@
         #def closing(manager, project):
             #return False
 
-        #self.manager.current = MockProject()
-        #self.manager.current.has_mods = False
-        #self.manager.current.uri = "file:///ciao"
+        #self.manager.current_project = MockProject()
+        #self.manager.current_project.has_mods = False
+        #self.manager.current_project.uri = "file:///ciao"
         #self.manager.connect("closing-project", closing)
 
         #self.failIf(self.manager.closeRunningProject())
@@ -249,11 +249,11 @@
         #name, args = self.signals[0]
         #self.failUnlessEqual(name, "closing-project")
         #project = args[0]
-        #self.failUnless(project is self.manager.current)
+        #self.failUnless(project is self.manager.current_project)
 
     #def testCloseRunningProject(self):
-        #current = self.manager.current = MockProject()
-        #self.manager.current.has_mods = False
+        #current = self.manager.current_project = MockProject()
+        #self.manager.current_project.has_mods = False
         #self.failUnless(self.manager.closeRunningProject())
         #self.failUnlessEqual(len(self.signals), 2)
 
@@ -267,15 +267,15 @@
         #project = args[0]
         #self.failUnless(project is current)
 
-        #self.failUnlessEqual(self.manager.current, None)
+        #self.failUnlessEqual(self.manager.current_project, None)
 
     #def testNewBlankProjectCantCloseCurrent(self):
         #def closing(manager, project):
             #return False
 
-        #self.manager.current = MockProject()
-        #self.manager.current.has_mods = False
-        #self.manager.current.uri = "file:///ciao"
+        #self.manager.current_project = MockProject()
+        #self.manager.current_project.has_mods = False
+        #self.manager.current_project.uri = "file:///ciao"
         #self.manager.connect("closing-project", closing)
         #self.failIf(self.manager.newBlankProject())
         #self.failUnlessEqual(len(self.signals), 1)
@@ -299,7 +299,7 @@
         #name, args = self.signals[2]
         #self.failUnlessEqual(name, "new-project-loaded")
         #project = args[0]
-        #self.failUnless(project is self.manager.current)
+        #self.failUnless(project is self.manager.current_project)
 
     #def testSaveProject(self):
         #uri = "file://" + os.path.abspath("testproject.xptv")
@@ -317,7 +317,7 @@
         ## save a project
         #self.failUnless(self.manager.newBlankProject())
         #self.failUnless(self.manager.saveProject(
-            #self.manager.current, uri, True))
+            #self.manager.current_project, uri, True))
         #self.failUnless(uri_is_reachable(uri))
 
         ## wait a bit
@@ -325,7 +325,7 @@
 
         ## save project under new path
         #self.failUnless(self.manager.saveProject(
-            #self.manager.current, uri2, True))
+            #self.manager.current_project, uri2, True))
         #self.failUnless(uri_is_reachable(uri2))
 
         ## make sure the old path and the new path have different mtime
@@ -338,7 +338,7 @@
 
         ## save project again under new path (by omitting uri arg)
         #self.failUnless(self.manager.saveProject(
-            #self.manager.current, overwrite=True))
+            #self.manager.current_project, overwrite=True))
 
         ## regression test for bug 594396
         ## make sure we didn't save to the old URI
@@ -358,10 +358,10 @@
 
         ## Create and save the project
         #self.manager.newBlankProject()
-        #self.manager.saveProject(self.manager.current, uri, True)
+        #self.manager.saveProject(self.manager.current_project, uri, True)
 
         ## Save the backup
-        #self.manager._saveBackupCb(self.manager.current, uri)
+        #self.manager._saveBackupCb(self.manager.current_project, uri)
         #backup_uri = self.manager._makeBackupURI(uri)
         #self.failUnless(uri_is_reachable(uri))
         #self.failUnless(uri_is_reachable(backup_uri))



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