Example #1
0
 def actionAddValue(self, par, obj):
     if obj is not None:
         inx = par.index(obj) + 1
         new = Jso.JIndex(inx, Jso.copyObject(obj.value))
     else:
         inx = -1
         new = Jso.JIndex(par.count(), self.createLine())
     par.append(new, inx)
     self.treeView.refresh()
     self.flow.add(copy.deepcopy(self.jsonData))
Example #2
0
 def actionDuplicate(self, par, obj):
     if obj is not None:
         inx = par.index(obj) + 1
         new = Jso.JIndex(inx, Jso.copyObject(obj.value))
         par.append(new, inx)
         self.treeView.refresh()
         self.flow.add(copy.deepcopy(self.jsonData))
Example #3
0
 def actionAddValue(self, par, obj):
     if isinstance(par, Jso.JObject):
         new = Jso.JKey("<new key>", "")
         if obj is not None:
             inx = par.index(obj) + 1
         else:
             inx = -1
         par.addKey(new, inx)
     elif isinstance(par, Jso.JList):
         if obj is not None:
             inx = par.index(obj) + 1
             new = Jso.JIndex(inx, "")
         else:
             inx = -1
             new = Jso.JIndex(par.count(), "")
         par.append(new, inx)
     self.treeView.refresh()
     self.flow.add(copy.deepcopy(self.jsonData))
Example #4
0
 def actionAddList(self, par, obj):
     if isinstance(par, Jso.JObject):
         child = Jso.JList()
         new_item = Jso.JIndex(0, "")
         child.append(new_item)
         new = Jso.JKey("<new key>", child)
         if obj is not None:
             inx = par.index(obj) + 1
         else:
             inx = -1
         par.addKey(new, inx)
     elif isinstance(par, Jso.JList):
         child = Jso.JList()
         new_item = Jso.JIndex(0, "")
         child.append(new_item)
         if obj is not None:
             inx = par.index(obj) + 1
             new = Jso.JIndex(inx, child)
         else:
             inx = -1
             new = Jso.JIndex(par.count(), child)
         par.append(new, inx)
     self.treeView.refresh()
     self.flow.add(copy.deepcopy(self.jsonData))