def load_project(self, filename):
     # load new project and if it is sucessfully loaded,
     # detach the old project
     new_project = load_project(filename)
     if new_project:
         # TODO: remove old plotter objects for this project
         # TODO: is the project deleted ?
         self.set_project(new_project)
 def _cb_load_test_project(self,widget):
     try:
         filename = const.internal_path(const.PATH_EXAMPLE+'/example.spj')
         spj = load_project(filename)
     except IOError:
         # TODO: Message Box
         return None
     self.set_project(spj)
 def load_project(self, filename):
     # load new project and if it is sucessfully loaded,
     # detach the old project
     new_project = load_project(filename)
     if new_project:
         self.set_project(new_project)
         self.recent_files.insert(0, os.path.abspath(filename))
         if len(self.recent_files) > 10:
             self.recent_files.pop(-1)
         Signals.emit(self, "update-recent-files")
 def load_project(self, filename):
     """
     Load new project from the file with the given 'filename'
     and if it is sucessfully loaded, detach the old project.
     """
     try:
         new_project = load_project(filename)
     except IOError, msg:
         self.error_msg("Error when trying to open project %s:\n\n%s" %
                        (filename, msg))
         return
def main():

    gtkutils.register_all_png_icons(const.internal_path(const.PATH_ICONS), 'sloppy-')

    try:
        filename = const.internal_path(const.PATH_EXAMPLE)
        filename = os.path.join(filename, 'example.spj')
        spj = load_project(filename)
    except IOError, msg:
	logger.error("IOError! Sample Project could not be loaded: %s" % msg )
        spj = None        
    def load_project(self, filename):
        # load new project and if it is sucessfully loaded,
        # detach the old project
        new_project = load_project(filename)
        if new_project:
            self.set_project(new_project)

            # Add filename to list of recent_files __unless__
            # it is identical with the most recent file.
            new_filename = os.path.abspath(filename)
            if len(self.recent_files) == 0 or \
                   self.recent_files[0] != new_filename:                               
                self.recent_files.insert(0, new_filename)
                if len(self.recent_files) > 10:
                    self.recent_files.pop(-1)
                Signals.emit(self, "update-recent-files")
    def __init__(self, project=None):
        " 'project' may be a Project object or a filename. "

        # Set up the Project...
        self._project = None
        if isinstance(project, basestring):
            try:
                project = load_project(project)
            except IOError:
                error_msg("Failed to load project '%s'\nSetting up an empty project instead." % project)
                project = Project()
        self.set_project(project)

        self.plugins = dict()
        self.init_plugins()
        self.progresslist = ProgressList

        self.journal = UndoRedo()