[turbine] Add a "New" button to clear all the fields
- From: Thomas Wood <thos src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [turbine] Add a "New" button to clear all the fields
- Date: Fri, 27 Nov 2009 14:41:06 +0000 (UTC)
commit 5e0347a099e9f57cc801b9c60be0d762b5ce806a
Author: Thomas Wood <thomas pepper localdomain>
Date: Fri Nov 27 13:23:02 2009 +0000
Add a "New" button to clear all the fields
src/turbine/__init__.py | 12 ++++++++++++
src/turbine/turbine.xml | 11 +++++++++++
2 files changed, 23 insertions(+), 0 deletions(-)
---
diff --git a/src/turbine/__init__.py b/src/turbine/__init__.py
index 5b85787..5ad1a0a 100755
--- a/src/turbine/__init__.py
+++ b/src/turbine/__init__.py
@@ -315,6 +315,15 @@ def interface_edited_cb (cellrenderertext, path, new_text, ui):
struct_name = new_text.replace ('_TYPE', '').replace ('_', ' ').title().replace (' ', '') + 'Iface';
model.set (model.get_iter (path), 0, new_text, 1, struct_name)
+def clear_ui (button, ui):
+ entry = ui.get_object
+ string_keys = ("class_camel", "class_lower", "package_upper",
+ "object_upper", "parent", "parent_camel");
+ for key in string_keys:
+ ui.get_object (key).set_text ("")
+ model = ui.get_object ('interfaces-model').clear ()
+
+
def main(argv = sys.argv, stdout=sys.stdout, stderr=sys.stderr):
ui = gtk.Builder()
ui_file = os.path.join(os.path.dirname(__file__), 'turbine.xml');
@@ -324,6 +333,9 @@ def main(argv = sys.argv, stdout=sys.stdout, stderr=sys.stderr):
window.show_all()
window.connect ('delete-event', gtk.main_quit);
+ button = ui.get_object ('new-button')
+ button.connect ('clicked', clear_ui, ui)
+
button = ui.get_object ('save-button')
button.connect ('clicked', handle_post, ui)
diff --git a/src/turbine/turbine.xml b/src/turbine/turbine.xml
index b4b4767..dee9bc4 100644
--- a/src/turbine/turbine.xml
+++ b/src/turbine/turbine.xml
@@ -23,6 +23,17 @@
<object class="GtkToolbar" id="toolbar1">
<property name="visible">True</property>
<child>
+ <object class="GtkToolButton" id="new-button">
+ <property name="visible">True</property>
+ <property name="use_underline">True</property>
+ <property name="stock_id">gtk-new</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">True</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkToolButton" id="save-button">
<property name="visible">True</property>
<property name="sensitive">False</property>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]