diff python/libs/project.py @ 68:654c5ac4f2c5

Refactor of menus
author windel
date Sat, 13 Oct 2012 16:13:05 +0200
parents 99bf4f7d47f4
children
line wrap: on
line diff
--- a/python/libs/project.py	Fri Oct 12 16:11:31 2012 +0200
+++ b/python/libs/project.py	Sat Oct 13 16:13:05 2012 +0200
@@ -4,7 +4,6 @@
  - modules
    - primitives like functions, types and variables
    - other modules
-
 """
 
 import json
@@ -15,14 +14,17 @@
       self.modules = []
       self.elements = []
       self.settings = {}
+      if filename:
+         self.load(filename)
+
+   def load(self, filename):
+      """ Load the project from file """
       self.filename = filename
 
-      if self.filename:
-         """ Load the project from the XML file """
-         with open(self.filename, 'r') as f:
-            d = json.load(f)
-         self.elements = d['elements']
-
+      with open(self.filename, 'r') as f:
+         d = json.load(f)
+      self.elements = d['elements']
+      
    def save(self):
       if self.filename:
          d = {'elements': self.elements}