X-Git-Url: https://vcs.maemo.org/git/?a=blobdiff_plain;f=src%2Ffile_view.py;fp=src%2Ffile_view.py;h=5ba94fe472d96e0bd6a1b1a8cbe60bae8e9c2661;hb=0ba4348cb475c8ddfb1ac674995201f09bba8b8e;hp=0000000000000000000000000000000000000000;hpb=19f6af9b50b1e76ef81628c77b9fab9248cc8b52;p=doneit diff --git a/src/file_view.py b/src/file_view.py new file mode 100644 index 0000000..5ba94fe --- /dev/null +++ b/src/file_view.py @@ -0,0 +1,52 @@ +""" +@todo Remove blocking operations from UI thread +""" + +import common_view + +import gtk_toolbox +import file_backend + + +class FileView(common_view.CommonView): + + def __init__(self, widgetTree, errorDisplay, defaultPath): + super(FileView, self).__init__(widgetTree, errorDisplay) + self._path = defaultPath + + @staticmethod + def name(): + return "File" + + def load_settings(self, config): + """ + @note Thread Agnostic + """ + path = config.get(self.name(), "path") + if path is not None: + self._path + + def save_settings(self, config): + """ + @note Thread Agnostic + """ + self._manager.save() + config.add_section(self.name()) + config.set(self.name(), "path", self._path) + + def login(self): + """ + @note UI Thread + """ + if self._manager is not None: + return + + self._manager = file_backend.FileBackend(self._path) + self._manager.load() + + def logout(self): + """ + @note Thread Agnostic + """ + self._manager.save() + self._manager = None