Ran update_copyright.py, updating all the copyright blurbs and adding AUTHORS.
[hooke.git] / hooke / playlist.py
index 60475ac6bb7ac6777fc06962df3d18f9e9373859..fc4ea9a7d72649ceb2354fcbece4750da829c7d4 100644 (file)
@@ -1,3 +1,21 @@
+# Copyright (C) 2010 W. Trevor King <wking@drexel.edu>
+#
+# This file is part of Hooke.
+#
+# Hooke is free software: you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation, either
+# version 3 of the License, or (at your option) any later version.
+#
+# Hooke is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with Hooke.  If not, see
+# <http://www.gnu.org/licenses/>.
+
 """The `playlist` module provides a :class:`Playlist` and its subclass
 :class:`FilePlaylist` for manipulating lists of
 :class:`hooke.curve.Curve`\s.
@@ -80,10 +98,12 @@ class FilePlaylist (Playlist):
         self._digest = None
 
     def set_path(self, path):
-        if not path.endswith('.hkp'):
-            path += '.hkp'
-        if name == None and path != None:
-            name = os.path.basename(path)
+        if path != None:
+            if not path.endswith('.hkp'):
+                path += '.hkp'
+            self.path = path
+            if self.name == None:
+                self.name = os.path.basename(path)
 
     def is_saved(self):
         return self.digest() == self._digest
@@ -222,14 +242,15 @@ class FilePlaylist (Playlist):
         path/to/curve/two
         """
         doc = xml.dom.minidom.parseString(string)
-        return self._from_xml_doc(doc)
+        self._from_xml_doc(doc)
 
     def load(self, path=None):
         """Load a playlist from a file.
         """
         self.set_path(path)
         doc = xml.dom.minidom.parse(self.path)
-        return self._from_xml_doc(doc)
+        self._from_xml_doc(doc)
+        self._digest = self.digest()
 
     def save(self, path=None):
         """Saves the playlist in a XML file.