Beispiel #1
0
 def scan(self, s, parent):
     '''Create an outline from a MindMap (.csv) file.'''
     # pylint: disable=no-member
     # pylint confuses this module with the stdlib json module
     c = self.c
     self.gnx_dict = {}
     try:
         d = json.loads(s)
         for d2 in d.get('nodes', []):
             gnx = d2.get('gnx')
             self.gnx_dict[gnx] = d2
         top_d = d.get('top')
         if top_d:
             # Don't set parent.h or parent.gnx or parent.v.u.
             parent.b = top_d.get('b') or ''
             self.create_nodes(parent, top_d)
             c.redraw()
         return bool(top_d)
     except Exception:
         # Fix #1098
         try:
             obj = json.loads(s)
         except Exception:
             g.error('Bad .json file: %s' % parent.h)
             g.es_exception()
             obj = s
         parent.b = g.objToString(obj)
         c.redraw()
         return True
Beispiel #2
0
 def scan(self, s, parent):
     '''Create an outline from a MindMap (.csv) file.'''
     # pylint: disable=no-member
     # pylint confuses this module with the stdlib json module
     c = self.c
     self.gnx_dict = {}
     try:
         d = json.loads(s)
         for d2 in d.get('nodes', []):
             gnx = d2.get('gnx')
             self.gnx_dict[gnx] = d2
         top_d = d.get('top')
         if top_d:
             # Don't set parent.h or parent.gnx or parent.v.u.
             parent.b = top_d.get('b') or ''
             self.create_nodes(parent, top_d)
             c.redraw()
         return bool(top_d)
     except Exception:
         # Fix #1098
         try:
             obj = json.loads(s)
         except Exception:
             g.error('Bad .json file: %s' % parent.h)
             g.es_exception()
             obj = s
         parent.b = g.objToString(obj)
         c.redraw()
         return True
Beispiel #3
0
 def __repr__(self):
     
     d = {'c': self.c.shortFileName()}
     for ivar in ('char', 'event', 'stroke', 'w'):
         d[ivar] = getattr(self, ivar)
     return 'LeoKeyEvent:\n%s' % g.objToString(d)