コード例 #1
0
 def test_annotation(self):
     _xml = fromstring("<node x='0' y='0' id='0' shape='classic' " +
                       "background='#000000' padding='0' size='50'>" +
                       "<annotation>ExampleAnnotation</annotation></node>")
     node = Node()
     node.deserialize(_xml)
     self._check_annotation(node)
コード例 #2
0
 def test_node(self):
     _xml = fromstring("<node x='0' y='0' id='0' shape='classic' " +
                       "background='#000000' height='50' width='100'>" +
                       "</node>")
     node = Node()
     node.deserialize(_xml)
     self._check_node(node)
コード例 #3
0
 def test_text(self):
     _xml = fromstring("<node x='0' y='0' id='0' shape='classic' " +
                       "background='#000000' padding='0' size='50'>" +
                       "<text size='0' color='#000000' font='lol'>" +
                       "ExampleText</text></node>")
     node = Node()
     node.deserialize(_xml)
     self._check_text(node)
コード例 #4
0
ファイル: project.py プロジェクト: FLuptak/MindMapper
 def deserialize(self, xml):
     if xml.text and re.search(r"\w", str(xml.text)):
         raise ValueError(
             "Project shouldn't have text value! But has:\n'" +
             xml.text + "'")
     if xml.attrib.keys():
         raise AttributeError(
             "Project shouldn't have attributes!" +
             "\nDiff: " + str(xml.attrib.keys()))
     for node in xml.iterfind("node"):
         n = Node()
         n.deserialize(node)
         self.nodes[n.id] = n
     for edge in xml.iterfind("edge"):
         e = Edge()
         e.deserialize(edge)
         self.edges[e.id] = e
コード例 #5
0
ファイル: project.py プロジェクト: LukasSlouka/MindMapper
 def deserialize(self, xml):
     if xml.text and re.search(r"\w", str(xml.text)):
         raise ValueError(
             "Project shouldn't have text value! But has:\n'" +
             xml.text + "'")
     if xml.attrib.keys() == ["width", "height"]:
         raise AttributeError(
             "Project have only width and height attributes!" +
             "\nDiff: " + str(self.attribute_diff(
                 xml.attrib.keys(), ["width", "height"])))
     for node in xml.iterfind("node"):
         n = Node()
         n.deserialize(node)
         self.nodes[n.id] = n
     for edge in xml.iterfind("edge"):
         e = Edge()
         e.deserialize(edge)
         self.edges[e.id] = e
     self.workspace_width = xml.attrib["width"]
     self.workspace_height = xml.attrib["height"]
コード例 #6
0
ファイル: __init__.py プロジェクト: FLuptak/MindMapper
 def create_node(self, x, y):
     height = self.node_height
     if height == 0:
         height = 100
     width = self.node_width
     if width == 0:
         width = 100
     node = Node(x=int(x), y=int(y), background=self.node_background,
                 shape=self.node_shape, width=width,
                 height=height, id=self.NODE_IDS, text=Text(
                     font=self.node_text_font, size=self.node_text_size,
                     color=self.node_text_color, text=""),
                 annotation=Annotation())
     if self.node_shape == 2:
         node.background = ""
     self.project.append(node)
     self.nodeViews[self.NODE_IDS] = self.view_manager.create_node(node)
     self.NODE_IDS += 1
     self.active_node = None
     self.node_focus(node.id)