[gevice] modified: ../data/glade/gevice.glade
- From: Alejandro Valdes Jimenez <avaldes src gnome org>
- To: svn-commits-list gnome org
- Subject: [gevice] modified: ../data/glade/gevice.glade
- Date: Tue, 5 May 2009 23:08:17 -0400 (EDT)
commit 3f6996624ed67b604d673f870ce24b1440a176c9
Author: Alejandro Valdes Jimenez <avaldes utalca cl>
Date: Tue May 5 23:07:45 2009 -0400
modified: ../data/glade/gevice.glade
modified: gevice.py
modified: gevicedatabase.py
modified: gevicemaintainer.py
---
data/glade/gevice.glade | 255 ++++++++++++++++++++++++++---------------------
src/gevice.py | 35 ++++++-
src/gevicedatabase.py | 11 ++
src/gevicemaintainer.py | 142 +++++++++++++++++++++-----
4 files changed, 296 insertions(+), 147 deletions(-)
diff --git a/data/glade/gevice.glade b/data/glade/gevice.glade
index e980ada..4dad72d 100644
--- a/data/glade/gevice.glade
+++ b/data/glade/gevice.glade
@@ -1,12 +1,12 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
-<!--*- mode: xml -*-->
+<?xml version="1.0"?>
<glade-interface>
+ <!-- interface-requires gtk+ 2.16 -->
+ <!-- interface-naming-policy toplevel-contextual -->
<widget class="GtkWindow" id="window_main">
<property name="width_request">700</property>
<property name="height_request">500</property>
<property name="title" translatable="yes">Gevice</property>
- <property name="window_position">GTK_WIN_POS_CENTER</property>
+ <property name="window_position">center</property>
<child>
<widget class="GtkVBox" id="vbox_main">
<property name="visible">True</property>
@@ -40,6 +40,9 @@
</packing>
</child>
</widget>
+ <packing>
+ <property name="position">0</property>
+ </packing>
</child>
</widget>
</child>
@@ -48,9 +51,9 @@
<property name="border_width">5</property>
<property name="title" translatable="yes">Device</property>
<property name="resizable">False</property>
- <property name="window_position">GTK_WIN_POS_CENTER</property>
+ <property name="window_position">center</property>
<property name="destroy_with_parent">True</property>
- <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
+ <property name="type_hint">dialog</property>
<child>
<widget class="GtkVBox" id="vbox4">
<property name="visible">True</property>
@@ -223,12 +226,14 @@
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
+ <property name="position">0</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
+ <property name="position">0</property>
</packing>
</child>
<child>
@@ -237,31 +242,32 @@
<property name="spacing">5</property>
<child>
<widget class="GtkButton" id="button_cancel_device">
+ <property name="label" context="yes">gtk-cancel</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="label" context="yes">gtk-cancel</property>
+ <property name="receives_default">False</property>
<property name="use_stock">True</property>
- <property name="response_id">0</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="pack_type">GTK_PACK_END</property>
+ <property name="pack_type">end</property>
<property name="position">1</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="button_accept_device">
+ <property name="label" context="yes">gtk-ok</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="label" context="yes">gtk-ok</property>
+ <property name="receives_default">False</property>
<property name="use_stock">True</property>
- <property name="response_id">0</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="pack_type">GTK_PACK_END</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
</packing>
</child>
</widget>
@@ -278,9 +284,9 @@
<property name="border_width">5</property>
<property name="title" translatable="yes" context="yes">Preferences</property>
<property name="resizable">False</property>
- <property name="window_position">GTK_WIN_POS_CENTER</property>
+ <property name="window_position">center</property>
<property name="destroy_with_parent">True</property>
- <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
+ <property name="type_hint">dialog</property>
<child>
<widget class="GtkVBox" id="vbox3">
<property name="visible">True</property>
@@ -297,11 +303,11 @@
<property name="n_columns">2</property>
<child>
<widget class="GtkCheckButton" id="checkbutton_model">
+ <property name="label" translatable="yes" context="yes">Model</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="label" translatable="yes" context="yes">Model</property>
+ <property name="receives_default">False</property>
<property name="use_underline">True</property>
- <property name="response_id">0</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
</widget>
@@ -312,22 +318,22 @@
</child>
<child>
<widget class="GtkCheckButton" id="checkbutton_ip">
+ <property name="label" translatable="yes" context="yes">IP</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="label" translatable="yes" context="yes">IP</property>
+ <property name="receives_default">False</property>
<property name="use_underline">True</property>
- <property name="response_id">0</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
</widget>
</child>
<child>
<widget class="GtkCheckButton" id="checkbutton_serial">
+ <property name="label" translatable="yes" context="yes">Serial</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="label" translatable="yes" context="yes">Serial</property>
+ <property name="receives_default">False</property>
<property name="use_underline">True</property>
- <property name="response_id">0</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
</widget>
@@ -338,11 +344,11 @@
</child>
<child>
<widget class="GtkCheckButton" id="checkbutton_comments">
+ <property name="label" translatable="yes" context="yes">Comments</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="label" translatable="yes" context="yes">Comments</property>
+ <property name="receives_default">False</property>
<property name="use_underline">True</property>
- <property name="response_id">0</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
</widget>
@@ -364,8 +370,8 @@
<property name="label" translatable="yes" context="yes">View</property>
</widget>
<packing>
- <property name="type">tab</property>
<property name="tab_fill">False</property>
+ <property name="type">tab</property>
</packing>
</child>
<child>
@@ -408,7 +414,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">False</property>
- <property name="invisible_char">â??</property>
+ <property name="invisible_char">●</property>
</widget>
<packing>
<property name="left_attach">1</property>
@@ -422,7 +428,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">False</property>
- <property name="invisible_char">â??</property>
+ <property name="invisible_char">●</property>
</widget>
<packing>
<property name="left_attach">1</property>
@@ -435,11 +441,11 @@
</child>
<child>
<widget class="GtkButton" id="button_backcolor">
+ <property name="label" context="yes">gtk-select-color</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="label" context="yes">gtk-select-color</property>
+ <property name="receives_default">False</property>
<property name="use_stock">True</property>
- <property name="response_id">0</property>
</widget>
<packing>
<property name="left_attach">2</property>
@@ -450,11 +456,11 @@
</child>
<child>
<widget class="GtkButton" id="button_forecolor">
+ <property name="label" context="yes">gtk-select-color</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="label" context="yes">gtk-select-color</property>
+ <property name="receives_default">False</property>
<property name="use_stock">True</property>
- <property name="response_id">0</property>
</widget>
<packing>
<property name="left_attach">2</property>
@@ -477,9 +483,9 @@
<property name="label" translatable="yes" context="yes">Colors</property>
</widget>
<packing>
- <property name="type">tab</property>
<property name="position">3</property>
<property name="tab_fill">False</property>
+ <property name="type">tab</property>
</packing>
</child>
<child>
@@ -489,15 +495,12 @@
<property name="n_rows">2</property>
<property name="n_columns">2</property>
<child>
- <placeholder/>
- </child>
- <child>
<widget class="GtkCheckButton" id="checkbutton_link_diag">
+ <property name="label" translatable="yes" context="yes">Link</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="label" translatable="yes" context="yes">Link</property>
+ <property name="receives_default">False</property>
<property name="use_underline">True</property>
- <property name="response_id">0</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
</widget>
@@ -508,11 +511,11 @@
</child>
<child>
<widget class="GtkCheckButton" id="checkbutton_model_diag">
+ <property name="label" translatable="yes" context="yes">Model</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="label" translatable="yes" context="yes">Model</property>
+ <property name="receives_default">False</property>
<property name="use_underline">True</property>
- <property name="response_id">0</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
</widget>
@@ -523,15 +526,18 @@
</child>
<child>
<widget class="GtkCheckButton" id="checkbutton_ip_diag">
+ <property name="label" translatable="yes" context="yes">IP</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="label" translatable="yes" context="yes">IP</property>
+ <property name="receives_default">False</property>
<property name="use_underline">True</property>
- <property name="response_id">0</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
</widget>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="position">4</property>
@@ -543,9 +549,9 @@
<property name="label" translatable="yes" context="yes">Diagram</property>
</widget>
<packing>
- <property name="type">tab</property>
<property name="position">4</property>
<property name="tab_fill">False</property>
+ <property name="type">tab</property>
</packing>
</child>
<child>
@@ -558,7 +564,7 @@
<widget class="GtkEntry" id="entry_host">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="invisible_char">â??</property>
+ <property name="invisible_char">●</property>
</widget>
<packing>
<property name="left_attach">1</property>
@@ -569,7 +575,7 @@
<widget class="GtkEntry" id="entry_dbase">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="invisible_char">â??</property>
+ <property name="invisible_char">●</property>
</widget>
<packing>
<property name="left_attach">1</property>
@@ -582,7 +588,7 @@
<widget class="GtkEntry" id="entry_user_dbase">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="invisible_char">â??</property>
+ <property name="invisible_char">●</property>
</widget>
<packing>
<property name="left_attach">1</property>
@@ -632,9 +638,9 @@
<property name="label" translatable="yes" context="yes">Database</property>
</widget>
<packing>
- <property name="type">tab</property>
<property name="position">5</property>
<property name="tab_fill">False</property>
+ <property name="type">tab</property>
</packing>
</child>
<child>
@@ -646,7 +652,7 @@
<widget class="GtkEntry" id="entry_csvseparator">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="invisible_char">â??</property>
+ <property name="invisible_char">●</property>
</widget>
<packing>
<property name="left_attach">1</property>
@@ -672,15 +678,16 @@
<property name="label" translatable="yes" context="yes">CSV</property>
</widget>
<packing>
- <property name="type">tab</property>
<property name="position">6</property>
<property name="tab_fill">False</property>
+ <property name="type">tab</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
+ <property name="position">0</property>
</packing>
</child>
<child>
@@ -688,16 +695,17 @@
<property name="visible">True</property>
<child>
<widget class="GtkButton" id="button_close_prefer">
+ <property name="label" context="yes">gtk-close</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="label" context="yes">gtk-close</property>
+ <property name="receives_default">False</property>
<property name="use_stock">True</property>
- <property name="response_id">0</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="pack_type">GTK_PACK_END</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
</packing>
</child>
</widget>
@@ -714,9 +722,9 @@
<property name="border_width">5</property>
<property name="title" translatable="yes" context="yes">Print</property>
<property name="resizable">False</property>
- <property name="window_position">GTK_WIN_POS_CENTER</property>
+ <property name="window_position">center</property>
<property name="destroy_with_parent">True</property>
- <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
+ <property name="type_hint">dialog</property>
<child>
<widget class="GtkVBox" id="vbox6">
<property name="visible">True</property>
@@ -731,6 +739,9 @@
<property name="visible">True</property>
<property name="label" translatable="yes" context="yes">Model</property>
</widget>
+ <packing>
+ <property name="position">0</property>
+ </packing>
</child>
<child>
<widget class="GtkComboBox" id="cb_model_print">
@@ -744,6 +755,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
+ <property name="position">0</property>
</packing>
</child>
<child>
@@ -752,31 +764,32 @@
<property name="spacing">5</property>
<child>
<widget class="GtkButton" id="button_cancel_print">
+ <property name="label" context="yes">gtk-cancel</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="label" context="yes">gtk-cancel</property>
+ <property name="receives_default">False</property>
<property name="use_stock">True</property>
- <property name="response_id">0</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="pack_type">GTK_PACK_END</property>
+ <property name="pack_type">end</property>
<property name="position">1</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="button_print_print">
+ <property name="label" context="yes">gtk-print</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="label" context="yes">gtk-print</property>
+ <property name="receives_default">False</property>
<property name="use_stock">True</property>
- <property name="response_id">0</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="pack_type">GTK_PACK_END</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
</packing>
</child>
</widget>
@@ -794,7 +807,7 @@
<property name="border_width">5</property>
<property name="title" translatable="yes" context="yes">Generate diagram</property>
<property name="resizable">False</property>
- <property name="window_position">GTK_WIN_POS_CENTER</property>
+ <property name="window_position">center</property>
<child>
<widget class="GtkVBox" id="vbox8">
<property name="visible">True</property>
@@ -811,6 +824,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
+ <property name="position">0</property>
</packing>
</child>
<child>
@@ -856,6 +870,7 @@ svg</property>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
+ <property name="position">0</property>
</packing>
</child>
<child>
@@ -864,31 +879,32 @@ svg</property>
<property name="spacing">5</property>
<child>
<widget class="GtkButton" id="button_diagram_cancel">
+ <property name="label" context="yes">gtk-cancel</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="label" context="yes">gtk-cancel</property>
+ <property name="receives_default">False</property>
<property name="use_stock">True</property>
- <property name="response_id">0</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="pack_type">GTK_PACK_END</property>
+ <property name="pack_type">end</property>
<property name="position">1</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="button_diagram_generate">
+ <property name="label" context="yes">gtk-convert</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="label" context="yes">gtk-convert</property>
+ <property name="receives_default">False</property>
<property name="use_stock">True</property>
- <property name="response_id">0</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="pack_type">GTK_PACK_END</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
</packing>
</child>
</widget>
@@ -905,7 +921,7 @@ svg</property>
<property name="border_width">5</property>
<property name="title" translatable="yes" context="yes">Find</property>
<property name="resizable">False</property>
- <property name="window_position">GTK_WIN_POS_CENTER</property>
+ <property name="window_position">center</property>
<child>
<widget class="GtkVBox" id="vbox1">
<property name="visible">True</property>
@@ -916,22 +932,25 @@ svg</property>
<property name="spacing">5</property>
<child>
<widget class="GtkRadioButton" id="radiobutton_namedevice">
+ <property name="label" translatable="yes" context="yes">Device name</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="label" translatable="yes" context="yes">Device name</property>
+ <property name="receives_default">False</property>
<property name="use_underline">True</property>
- <property name="response_id">0</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
</widget>
+ <packing>
+ <property name="position">0</property>
+ </packing>
</child>
<child>
<widget class="GtkRadioButton" id="radiobutton_ip">
+ <property name="label" translatable="yes" context="yes">IP</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="label" translatable="yes" context="yes">IP</property>
+ <property name="receives_default">False</property>
<property name="use_underline">True</property>
- <property name="response_id">0</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
<property name="group">radiobutton_namedevice</property>
@@ -942,11 +961,11 @@ svg</property>
</child>
<child>
<widget class="GtkRadioButton" id="radiobutton_serial">
+ <property name="label" translatable="yes" context="yes">Serial</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="label" translatable="yes" context="yes">Serial</property>
+ <property name="receives_default">False</property>
<property name="use_underline">True</property>
- <property name="response_id">0</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
<property name="group">radiobutton_namedevice</property>
@@ -959,6 +978,7 @@ svg</property>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
+ <property name="position">0</property>
</packing>
</child>
<child>
@@ -973,6 +993,7 @@ svg</property>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
+ <property name="position">0</property>
</packing>
</child>
<child>
@@ -980,7 +1001,7 @@ svg</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="invisible_char">â??</property>
+ <property name="invisible_char">●</property>
</widget>
<packing>
<property name="expand">False</property>
@@ -1001,31 +1022,32 @@ svg</property>
<property name="spacing">5</property>
<child>
<widget class="GtkButton" id="button_find_cancel">
+ <property name="label" context="yes">gtk-cancel</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="label" context="yes">gtk-cancel</property>
+ <property name="receives_default">False</property>
<property name="use_stock">True</property>
- <property name="response_id">0</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="pack_type">GTK_PACK_END</property>
+ <property name="pack_type">end</property>
<property name="position">1</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="button_find_find">
+ <property name="label" context="yes">gtk-find</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="label" context="yes">gtk-find</property>
+ <property name="receives_default">False</property>
<property name="use_stock">True</property>
- <property name="response_id">0</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="pack_type">GTK_PACK_END</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
</packing>
</child>
</widget>
@@ -1041,7 +1063,7 @@ svg</property>
<widget class="GtkWindow" id="window_database">
<property name="title" translatable="yes" context="yes">Connect to database</property>
<property name="modal">True</property>
- <property name="window_position">GTK_WIN_POS_CENTER</property>
+ <property name="window_position">center</property>
<child>
<widget class="GtkVBox" id="vbox5">
<property name="visible">True</property>
@@ -1059,7 +1081,7 @@ svg</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="visibility">False</property>
- <property name="invisible_char">â??</property>
+ <property name="invisible_char">●</property>
</widget>
<packing>
<property name="left_attach">1</property>
@@ -1143,6 +1165,9 @@ svg</property>
</widget>
</child>
</widget>
+ <packing>
+ <property name="position">0</property>
+ </packing>
</child>
<child>
<widget class="GtkHBox" id="hbox11">
@@ -1151,31 +1176,32 @@ svg</property>
<property name="spacing">5</property>
<child>
<widget class="GtkButton" id="button_connect_cancel">
+ <property name="label" context="yes">gtk-cancel</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="label" context="yes">gtk-cancel</property>
+ <property name="receives_default">False</property>
<property name="use_stock">True</property>
- <property name="response_id">0</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="pack_type">GTK_PACK_END</property>
+ <property name="pack_type">end</property>
<property name="position">1</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="button_connect_dbase">
+ <property name="label" context="yes">gtk-connect</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="label" context="yes">gtk-connect</property>
+ <property name="receives_default">False</property>
<property name="use_stock">True</property>
- <property name="response_id">0</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="pack_type">GTK_PACK_END</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
</packing>
</child>
</widget>
@@ -1188,83 +1214,82 @@ svg</property>
</child>
</widget>
<widget class="GtkWindow" id="window_maintainer">
- <property name="default_width">300</property>
+ <property name="window_position">center</property>
+ <property name="default_width">350</property>
<property name="default_height">300</property>
<child>
<widget class="GtkVBox" id="vbox7">
<property name="visible">True</property>
- <property name="orientation">GTK_ORIENTATION_VERTICAL</property>
- <property name="orientation">GTK_ORIENTATION_VERTICAL</property>
+ <property name="orientation">vertical</property>
<child>
- <widget class="GtkTreeView" id="treeview">
+ <widget class="GtkScrolledWindow" id="scrolledwindow1">
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="hscrollbar_policy">automatic</property>
+ <property name="vscrollbar_policy">automatic</property>
+ <child>
+ <widget class="GtkTreeView" id="treeview">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="reorderable">True</property>
+ <property name="rules_hint">True</property>
+ </widget>
+ </child>
</widget>
+ <packing>
+ <property name="position">0</property>
+ </packing>
</child>
<child>
<widget class="GtkHBox" id="hbox10">
<property name="visible">True</property>
+ <property name="spacing">5</property>
+ <child>
+ <placeholder/>
+ </child>
<child>
<widget class="GtkButton" id="button_close">
+ <property name="label" translatable="yes">gtk-close</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
- <property name="label" translatable="yes">gtk-close</property>
<property name="use_stock">True</property>
- <property name="response_id">0</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="pack_type">GTK_PACK_END</property>
+ <property name="pack_type">end</property>
<property name="position">3</property>
</packing>
</child>
<child>
- <widget class="GtkButton" id="button_apply">
+ <widget class="GtkButton" id="button_add">
+ <property name="label" translatable="yes">gtk-add</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
- <property name="label" translatable="yes">gtk-apply</property>
<property name="use_stock">True</property>
- <property name="response_id">0</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="pack_type">GTK_PACK_END</property>
+ <property name="pack_type">end</property>
<property name="position">2</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="button_rem">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
<property name="label" translatable="yes">gtk-remove</property>
- <property name="use_stock">True</property>
- <property name="response_id">0</property>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="pack_type">GTK_PACK_END</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <widget class="GtkButton" id="button_add">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
- <property name="label" translatable="yes">gtk-add</property>
<property name="use_stock">True</property>
- <property name="response_id">0</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="pack_type">GTK_PACK_END</property>
+ <property name="pack_type">end</property>
+ <property name="position">1</property>
</packing>
</child>
</widget>
diff --git a/src/gevice.py b/src/gevice.py
index 629d696..079c0d2 100755
--- a/src/gevice.py
+++ b/src/gevice.py
@@ -365,16 +365,43 @@ class Gevice:
return button
def on_action_mark (gevice,action):
+ sql = {"select":"select * from marca order by 1",
+ "insert":"insert into marca values ",
+ "delete":"delete from marca where id_marca=",
+ "update1":"update marca set nom_marca=",
+ "update2":" where id_marca=",
+ "max_id":"select max(id_marca)+1 from marca;"}
dialogmaintainer = gevicemaintainer.GeviceMaintainer ()
- dialogmaintainer.load_interface ("Mark")
+ dialogmaintainer.load_interface (gevice,_("Mark"),sql)
+ dialogmaintainer.load_data (gevice,sql)
dialogmaintainer.show_interface ()
- #dialogmaintainer.load_data ("select * from marca order by 1")
+
def on_action_typeofdev (gevice,action):
- pass
+ sql = {"select":"select * from tipo_disp order by 1",
+ "insert":"insert into tipo_disp values ",
+ "delete":"delete from tipo_disp where id_tipo_disp=",
+ "update1":"update tipo_disp set nom_tipo_disp=",
+ "update2":" where id_tipo_disp=",
+ "max_id":"select max(id_tipo_disp)+1 from tipo_disp;"}
+ dialogmaintainer = gevicemaintainer.GeviceMaintainer ()
+ dialogmaintainer.load_interface (gevice,_("Type of Device"),sql)
+ dialogmaintainer.load_data (gevice,sql)
+ dialogmaintainer.show_interface ()
+
def on_action_typeoflink (gevice,action):
- pass
+ sql = {"select":"select * from tipo_enlace order by 1",
+ "insert":"insert into tipo_enlace values ",
+ "delete":"delete from tipo_enlace where id_tipo_enlace=",
+ "update1":"update tipo_enlace set nom_tipo_enlace=",
+ "update2":" where id_tipo_enlace=",
+ "max_id":"select max(id_tipo_enlace)+1 from tipo_enlace;"}
+ dialogmaintainer = gevicemaintainer.GeviceMaintainer ()
+ dialogmaintainer.load_interface (gevice,_("Type of Link"),sql)
+ dialogmaintainer.load_data (gevice,sql)
+ dialogmaintainer.show_interface ()
+
def on_action_export (gevice,action):
dialogexport = geviceexport.GeviceExport ()
diff --git a/src/gevicedatabase.py b/src/gevicedatabase.py
index eb76d3a..d95d9cd 100644
--- a/src/gevicedatabase.py
+++ b/src/gevicedatabase.py
@@ -34,6 +34,7 @@ class GeviceDatabase:
def execute_sql_select (self,gevice,sql):
+ print sql
try:
self.cur.execute(sql)
rows = self.cur.fetchall()
@@ -43,6 +44,7 @@ class GeviceDatabase:
return False
def execute_sql_insert (self,gevice,sql):
+ print sql
try:
self.cur.execute(sql)
return True
@@ -51,6 +53,7 @@ class GeviceDatabase:
return False
def execute_sql_delete (self,gevice,sql):
+ print sql
try:
self.cur.execute(sql)
return True
@@ -58,6 +61,14 @@ class GeviceDatabase:
gevice.show_message (_("Unable to execute SQL: " + sql),gtk.MESSAGE_ERROR)
return False
+ def execute_sql_update (self,gevice,sql):
+ print sql
+ try:
+ self.cur.execute(sql)
+ return True
+ except:
+ gevice.show_message (_("Unable to execute SQL: " + sql),gtk.MESSAGE_ERROR)
+ return False
def load_interface (self,gevice):
glade_file = gtk.glade.XML (os.path.join (config.GLADEDIR, "gevice.glade"),"window_database",None)
diff --git a/src/gevicemaintainer.py b/src/gevicemaintainer.py
index bd29aba..3c48e93 100644
--- a/src/gevicemaintainer.py
+++ b/src/gevicemaintainer.py
@@ -2,6 +2,7 @@ import pygtk
pygtk.require('2.0')
import gtk
import os
+import gobject
import gettext
gettext.textdomain("gevice")
@@ -14,47 +15,132 @@ class GeviceMaintainer:
def __ini__ (self):
pass
- def load_interface (self,title):
+ def load_interface (self,gevice,title,sql):
glade_file = gtk.glade.XML (os.path.join (config.GLADEDIR, "gevice.glade"),"window_maintainer",None)
self.window_maintainer = glade_file.get_widget ("window_maintainer")
self.button_add = glade_file.get_widget ("button_add")
self.button_rem = glade_file.get_widget ("button_rem")
- self.button_apply = glade_file.get_widget ("button_apply")
- self.button_cancel = glade_file.get_widget ("button_cancel")
+ self.button_close = glade_file.get_widget ("button_close")
+ self.treeview = glade_file.get_widget ("treeview")
+
+ #self.treeview.set_rules_hint (True)
self.window_maintainer.set_title (title)
+
+ # create columns
+ col = gtk.TreeViewColumn (_("ID"))
+ col.set_resizable (True)
+ self.treeview.append_column (col)
+ cell = gtk.CellRendererText()
+ cell.set_property('editable',False)
+ col.pack_start (cell,True)
+ col.add_attribute (cell,"text",0)
+
+ col = gtk.TreeViewColumn (_("Name"))
+ col.set_resizable (True)
+ self.treeview.append_column (col)
+ cell = gtk.CellRendererText()
+ cell.set_property('editable',True)
+ cell.connect('edited', self.on_name_edited,gevice,sql)
+ col.pack_start (cell,True)
+ col.add_attribute (cell,"text",1)
- #self.button_connect_dbase.connect ("clicked",self.on_button_connect_dbase_clicked,gevice)
+ self.button_close.connect ("clicked",self.on_button_close_clicked)
+ self.button_add.connect ("clicked",self.on_button_add_clicked,gevice,sql)
+ self.button_rem.connect ("clicked",self.on_button_rem_clicked,gevice,sql)
def show_interface (self):
self.window_maintainer.show_all()
- def load_data (self,query):
- gdb.gnome_db_init("gevice", "3.0", None, None)
- error_ptr = ctypes.POINTER(ctypes.c_int)() # TODO define error pointer properly
+ def load_data (self,gevice,sql):
+ liststore = gtk.ListStore(
+ gobject.TYPE_INT,
+ gobject.TYPE_STRING)
+
+ self.treeview.set_model (liststore)
+
+ rows = gevice.gdbase.execute_sql_select(gevice,sql["select"])
+
+ if rows:
+ for row in rows:
+ iter = liststore.append ()
+ liststore.set (
+ iter,
+ 0,row[0],
+ 1,row[1])
+
+ def close_window (self,window):
+ window.destroy()
+
+ def on_button_close_clicked (self,button):
+ self.close_window (self.window_maintainer)
+
+ def on_name_edited (self, cell, path, newname,gevice,sql):
+ newname = newname.strip()
+ model = self.treeview.get_model()
+ iter = model.get_iter_from_string(path)
+ id,oldname = model.get(iter,0,1)
+
+ # check, newname exists
+ if oldname == newname:
+ return
+
+ self.is_in_list = False
+ model.foreach(self.is_newname_in_list, newname)
+
+ if not self.is_in_list:
+ model.set(iter,1,newname)
+ update = sql["update1"] + "'" + newname + "'" + sql["update2"] + str(id)
+ gevice.gdbase.execute_sql_update(gevice,update)
+ else:
+ #show error message and delete the row.
+ dialog = gtk.MessageDialog(None,gtk.DIALOG_MODAL, gtk.MESSAGE_ERROR,gtk.BUTTONS_OK,_("Name exist: " + newname) )
+ dialog.run()
+ dialog.destroy()
+
+
+ def is_newname_in_list(self,model,path,iter,newname):
+ oldname = model.get(iter,1)[0]
+
+ self.is_in_list = False;
+ if oldname == newname:
+ self.is_in_list = True;
+ return True
+ return False;
+
+ def on_button_add_clicked(self,button,gevice,sql):
+ row = gevice.gdbase.execute_sql_select (gevice,sql["max_id"])
- gda.gda_init ("gevice", "3.0", None, None);
- gda.gda_config_save_data_source ("db_gevice","PostgreSQL","DATABASE=db_gevice","Base datos Gevice",None,None)
- client = gda.gda_client_new()
- cnc = gda.gda_client_open_connection (client,"db_gevice","plataforma","rss123",GDA_CONNECTION_OPTIONS_DONT_SHARE,ctypes.byref(error_ptr))
+ liststore = self.treeview.get_model()
+ iter = liststore.append ()
+ liststore.set (
+ iter,
+ 0,row[0][0],
+ 1,"New" + str(row[0][0]))
+
+ insert = sql["insert"] + " (" + str(row[0][0]) + ",'" + "New" + str(row[0][0]) + "')"
+ gevice.gdbase.execute_sql_insert (gevice,insert)
+
+
+ def on_button_rem_clicked(self,button,gevice,sql):
+ selection = self.treeview.get_selection()
+ model,iter = selection.get_selected()
- if not cnc:
- print "could not connect"
+ id = model.get(iter,0)[0]
+ name = model.get(iter,1)[0]
- sql=ctypes.create_string_buffer(query)
- command = gda.gda_command_new (sql, GDA_COMMAND_TYPE_SQL, GDA_COMMAND_OPTION_STOP_ON_ERRORS)
- data_model = gda.gda_connection_execute_select_command (cnc, command, None, ctypes.byref(error_ptr))
- print data_model
- if not data_model:
- print "could not get data_model for sql"
- # TODO define error structure so error can be displayed
+ delete = sql["delete"] + str(id)
- window = gtk.gtk_window_new(GTK_WINDOW_TOPLEVEL)
- grid = gdb.gnome_db_grid_new(data_model)
- gtk.g_object_unref(data_model)
- gtk.gtk_container_add(window, grid)
- gtk.gtk_window_set_default_size(window, 400, 300);
+ dialog = gtk.MessageDialog(None,gtk.DIALOG_MODAL, gtk.MESSAGE_QUESTION,
+ gtk.BUTTONS_YES_NO, _("Really delete: ") + name)
+
+ result = dialog.run()
+
+ if result == gtk.RESPONSE_YES:
+ if (gevice.gdbase.execute_sql_delete (gevice,delete)):
+ model.remove(iter)
+
+ gevice.gdbase.conn.commit()
+
+ dialog.destroy()
- QUITFUNC = ctypes.CFUNCTYPE(ctypes.c_int,ctypes.c_int) # 2 not 1 - TODO find out wtf is going on !
- gtk.gtk_widget_show_all (window)
- gda.gda_connection_close (cnc);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]