diff --git a/jsoninspector.glade b/jsoninspector.glade index 73b0832..1f39e68 100644 --- a/jsoninspector.glade +++ b/jsoninspector.glade @@ -184,14 +184,18 @@ Introducir texto JSON True + center + 200 + 180 + True - 180 - 90 + 200 + 140 True True char @@ -214,7 +218,7 @@ True True True - + False @@ -232,7 +236,7 @@ True True True - + False diff --git a/jsoninspector.py b/jsoninspector.py index 657f1cc..99aa81a 100644 --- a/jsoninspector.py +++ b/jsoninspector.py @@ -100,30 +100,46 @@ class MainWindowMethods(object): """ Se ha dado a cerrar la ventana de copiar texto """ - textView = self.builder.get_object("textview1") - textView.hide() + textWindow = self.builder.get_object("TextWindow") + textWindow.hide() + + return True + + def onCopyJSONDestroy(self, widget): + """ + Se ha cerrado la ventana + """ + textWindow = self.builder.get_object("TextWindow") + textWindow.hide() + + return True def onCopyJSONAcceptClicked(self, widget): """ Se ha aceptado el código """ - textView = self.builder.get_objects("textview1") + textView = self.builder.get_object("textview1") jsonBuffer = textView.get_buffer() - jsonText = jsonBuffer.get_text() + jsonText = jsonBuffer.get_text(jsonBuffer.get_start_iter(), + jsonBuffer.get_end_iter()) - textWindow = self.builder.get_object("textview1") + textWindow = self.builder.get_object("TextWindow") textWindow.hide() treestore = self.builder.get_object("treestore1") treestore.clear() + if self.logicObj.loadJSONText(jsonText): + + status_label = self.builder.get_object("StatusLabel") + status_label.set_text("Cargado desde portapapeles.") self.logicObj.loadTree(treestore) def onCopyJSONCancelClicked(self, widget): """ Se ha cancelado """ - textView = self.builder.get_object("textview1") - textView.hide() + textWindow = self.builder.get_object("TextWindow") + textWindow.hide() def onExitMenuClicked(self, widget): """ @@ -228,7 +244,6 @@ class LogicObject(object): str(type(elems[key_val]))]) - # Ejecucion del programa principal if __name__ == "__main__":