[pitivi] preset: Rename methods to make them protected instead of public



commit 0d4a18344c70896ac4d707f6fe13dc22d2d5034f
Author: Alex BÄluÈ <alexandru balut gmail com>
Date:   Sun Nov 11 13:21:57 2012 +0100

    preset: Rename methods to make them protected instead of public

 pitivi/preset.py     |   26 +++++++++++++-------------
 tests/test_preset.py |    2 +-
 2 files changed, 14 insertions(+), 14 deletions(-)
---
diff --git a/pitivi/preset.py b/pitivi/preset.py
index 58b6dc3..602de9a 100644
--- a/pitivi/preset.py
+++ b/pitivi/preset.py
@@ -76,9 +76,9 @@ class PresetManager(object):
         except Exception:
             pass
 
-        for file in filepaths:
-            if file.endswith("json"):
-                self.loadSection(os.path.join(self.default_path, file))
+        for filepath in filepaths:
+            if filepath.endswith("json"):
+                self._loadSection(os.path.join(self.default_path, filepath))
 
     def saveAll(self):
         """Write changes to disk for all presets"""
@@ -96,7 +96,7 @@ class PresetManager(object):
                     filepath = os.path.join(self.user_path, filename)
                 try:
                     fout = open(filepath, "w")
-                    self.saveSection(fout, name)
+                    self._saveSection(fout, name)
                     self.presets[name]["filepath"] = filepath
                 except IOError:
                     # FIXME: this can happen in two cases: a permissions error,
@@ -208,7 +208,7 @@ class PresetManager(object):
         self._ignore_update_requests = False
 
     def savePreset(self):
-        """Update the preset values and write to disk"""
+        """Update the current preset values from the widgets and save it."""
         if self.cur_preset != _("No preset"):
             self._updatePreset()
             if os.path.isfile(self.user_path):
@@ -222,7 +222,7 @@ class PresetManager(object):
                 filepath = os.path.join(self.user_path, self.cur_preset + ".json")
             try:
                 fout = open(filepath, "w")
-                self.saveSection(fout, self.cur_preset)
+                self._saveSection(fout, self.cur_preset)
                 self.presets[self.cur_preset]["filepath"] = filepath
             except IOError:
                 # TODO: show an error infobar... but this should never happen,
@@ -302,7 +302,7 @@ class PresetManager(object):
             return True
         return False
 
-    def saveSection(self, fout, section):
+    def _saveSection(self, fout, section):
         """Save the specified section into the specified file.
 
         @param fout: The file where to save the section.
@@ -318,7 +318,7 @@ class VideoPresetManager(PresetManager):
     default_path = get_videopresets_dir()
     user_path = os.path.join(xdg_data_home(), 'video_presets')
 
-    def loadSection(self, filepath):
+    def _loadSection(self, filepath):
         parser = json.loads(open(filepath).read())
 
         name = parser["name"]
@@ -341,7 +341,7 @@ class VideoPresetManager(PresetManager):
             "filepath": filepath,
         })
 
-    def saveSection(self, fout, section):
+    def _saveSection(self, fout, section):
         values = self.presets[section]
         data = json.dumps({
             "name": section,
@@ -360,7 +360,7 @@ class AudioPresetManager(PresetManager):
     default_path = get_audiopresets_dir()
     user_path = os.path.join(xdg_data_home(), 'audio_presets')
 
-    def loadSection(self, filepath):
+    def _loadSection(self, filepath):
         parser = json.loads(open(filepath).read())
 
         name = parser["name"]
@@ -376,7 +376,7 @@ class AudioPresetManager(PresetManager):
             "filepath": filepath,
         })
 
-    def saveSection(self, fout, section):
+    def _saveSection(self, fout, section):
         values = self.presets[section]
         data = json.dumps({
             "name": section,
@@ -392,7 +392,7 @@ class RenderPresetManager(PresetManager):
     default_path = get_renderpresets_dir()
     user_path = os.path.join(xdg_data_home(), 'render_presets')
 
-    def loadSection(self, filepath):
+    def _loadSection(self, filepath):
         parser = json.loads(open(filepath).read())
 
         name = parser["name"]
@@ -433,7 +433,7 @@ class RenderPresetManager(PresetManager):
             "filepath": filepath,
         })
 
-    def saveSection(self, fout, section):
+    def _saveSection(self, fout, section):
         values = self.presets[section]
         data = json.dumps({
             "name": section,
diff --git a/tests/test_preset.py b/tests/test_preset.py
index 1c35b87..bbf4e50 100644
--- a/tests/test_preset.py
+++ b/tests/test_preset.py
@@ -36,7 +36,7 @@ from pitivi.preset import DuplicatePresetNameException, \
 
 class FakePresetManager(PresetManager):
 
-    def saveSection(self, fout, section):
+    def _saveSection(self, fout, section):
         pass
 
 



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