Beispiel #1
0
def test_create_with_serial():
    m = Mocker()
    serial = {"path": "/temp/non-existent/project.edxt"}
    assert not os.path.exists(serial["path"])
    with m:
        result = Project.create_with_serial(serial)
        try:
            eq_(result.path, serial["path"])
        finally:
            result.close()
Beispiel #2
0
def test_create_with_serial():
    m = Mocker()
    serial = {"path": "/temp/non-existent/project.edxt"}
    assert not os.path.exists(serial["path"])
    with m:
        result = Project.create_with_serial(serial)
        try:
            eq_(result.path, serial["path"])
        finally:
            result.close()
Beispiel #3
0
 def deserialize(self, data):
     if data:
         for serial in data.get("project_serials", []):
             proj = Project.create_with_serial(serial)
             self.projects.append(proj)
         for proj_index, doc_index in data.get("recent_items", []):
             if proj_index < len(self.projects):
                 proj = self.projects[proj_index]
                 if doc_index == "<project>":
                     self.recent.push(proj.id)
                 elif doc_index < len(proj.documents()):
                     doc = proj.documents()[doc_index]
                     self.recent.push(doc.id)
         self.discard_and_focus_recent(None)
Beispiel #4
0
 def _setstate(self, state):
     if state:
         for serial in state.get("project_serials", []):
             proj = Project.create_with_serial(serial)
             self.projects.append(proj)
         for proj_index, doc_index in state.get("recent_items", []):
             if proj_index < len(self.projects):
                 proj = self.projects[proj_index]
                 if doc_index == "<project>":
                     self.recent.push(proj.id)
                 elif doc_index < len(proj.documents()):
                     doc = proj.documents()[doc_index]
                     self.recent.push(doc.id)
         if 'window_settings' in state:
             self.window_settings = state['window_settings']
         self.discard_and_focus_recent(None)