version 1.2 con capacidad para portapapeles

This commit is contained in:
José Carlos Cuevas 2010-05-26 17:59:23 +02:00
parent ba589b3c22
commit ecaaace930
2 changed files with 31 additions and 12 deletions

View file

@ -184,14 +184,18 @@
<object class="GtkWindow" id="TextWindow">
<property name="title" translatable="yes">Introducir texto JSON</property>
<property name="modal">True</property>
<property name="window_position">center</property>
<property name="default_width">200</property>
<property name="default_height">180</property>
<signal name="destroy" handler="onCopyJSONDestroy"/>
<signal name="delete_event" handler="onCopyJSONDelete"/>
<child>
<object class="GtkVBox" id="vbox2">
<property name="visible">True</property>
<child>
<object class="GtkTextView" id="textview1">
<property name="width_request">180</property>
<property name="height_request">90</property>
<property name="width_request">200</property>
<property name="height_request">140</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="wrap_mode">char</property>
@ -214,7 +218,7 @@
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
<signal name="activate" handler="onCopyJSONAcceptClicked"/>
<signal name="clicked" handler="onCopyJSONAcceptClicked"/>
</object>
<packing>
<property name="expand">False</property>
@ -232,7 +236,7 @@
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
<signal name="activate" handler="onCopyJSONCancelClicked"/>
<signal name="clicked" handler="onCopyJSONCancelClicked"/>
</object>
<packing>
<property name="expand">False</property>

View file

@ -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__":