[gevice] repaired maintainers, modified some propierties in UI files



commit 078c3e22ced85fef415b6d15e94ec7307e3055bd
Author: Alejandro Valdes Jimenez <avaldes gnome org>
Date:   Thu Oct 6 12:33:31 2011 -0300

    repaired maintainers, modified some propierties in UI files

 ChangeLog               |   17 +++++++++++++++++
 data/ui/dbase.xml       |    3 ++-
 data/ui/device.xml      |    2 +-
 data/ui/diagram.xml     |    2 +-
 data/ui/edifice.xml     |    7 +++++--
 data/ui/find.xml        |    2 +-
 data/ui/location.xml    |    4 +++-
 data/ui/maintainer.xml  |    6 ++++++
 data/ui/maintainer1.xml |    6 ++++++
 data/ui/model.xml       |    4 +++-
 data/ui/pref.xml        |    2 +-
 src/gevice.py           |   13 ++++++++-----
 src/gevicedatabase.py   |   25 ++++++++++++++++++++-----
 src/gevicedevice.py     |   20 +++++++++++++++-----
 src/gevicemaintainer.py |   47 +++++++++++++++++++++--------------------------
 src/geviceprefer.py     |    8 ++++++--
 16 files changed, 116 insertions(+), 52 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 200a834..4b7f24f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,21 @@
 2011-10-06  Alejandro Valdes Jimenez  <avaldes gnome org>
+	* data/ui/dbase.xml:
+	* data/ui/device.xml:
+	* data/ui/diagram.xml:
+	* data/ui/edifice.xml:
+	* data/ui/find.xml:
+	* data/ui/location.xml:
+	* data/ui/maintainer.xml:
+	* data/ui/maintainer1.xml:
+	* data/ui/model.xml:
+	* data/ui/pref.xml:
+	* src/gevice.py:
+	* src/gevicedatabase.py:
+	* src/gevicedevice.py:
+	* src/gevicemaintainer.py:
+	* src/geviceprefer.py:
+
+2011-10-06  Alejandro Valdes Jimenez  <avaldes gnome org>
 	* src/gevice.py:
 	* src/gevicefind.py: 
 		* on_button_find_find_clicked(): rewritten
diff --git a/data/ui/dbase.xml b/data/ui/dbase.xml
index 5353e63..8737eb0 100644
--- a/data/ui/dbase.xml
+++ b/data/ui/dbase.xml
@@ -3,6 +3,7 @@
   <!-- interface-requires gtk+ 2.6 -->
   <object class="GtkWindow" id="window_database">
     <property name="can_focus">False</property>
+    <property name="border_width">10</property>
     <property name="title" translatable="yes" context="yes">Connect to database</property>
     <property name="modal">True</property>
     <property name="window_position">center</property>
@@ -10,7 +11,7 @@
       <object class="GtkVBox" id="vbox6">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
-        <property name="spacing">5</property>
+        <property name="spacing">15</property>
         <child>
           <object class="GtkTable" id="table6">
             <property name="visible">True</property>
diff --git a/data/ui/device.xml b/data/ui/device.xml
index 5694856..c583200 100644
--- a/data/ui/device.xml
+++ b/data/ui/device.xml
@@ -3,7 +3,7 @@
   <!-- interface-requires gtk+ 2.6 -->
   <object class="GtkWindow" id="window_device">
     <property name="can_focus">False</property>
-    <property name="border_width">5</property>
+    <property name="border_width">10</property>
     <property name="title" translatable="yes">Device</property>
     <property name="resizable">False</property>
     <property name="window_position">center</property>
diff --git a/data/ui/diagram.xml b/data/ui/diagram.xml
index 270de80..512d28d 100644
--- a/data/ui/diagram.xml
+++ b/data/ui/diagram.xml
@@ -44,7 +44,7 @@
   <object class="GtkWindow" id="window_diagram">
     <property name="can_focus">False</property>
     <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-    <property name="border_width">5</property>
+    <property name="border_width">10</property>
     <property name="title" translatable="yes" context="yes">Generate Diagram</property>
     <property name="resizable">False</property>
     <property name="window_position">center</property>
diff --git a/data/ui/edifice.xml b/data/ui/edifice.xml
index 3fe9eb8..1d8669d 100644
--- a/data/ui/edifice.xml
+++ b/data/ui/edifice.xml
@@ -3,14 +3,16 @@
   <!-- interface-requires gtk+ 2.6 -->
   <object class="GtkWindow" id="window_edifice">
     <property name="can_focus">False</property>
+    <property name="border_width">10</property>
     <property name="title" translatable="yes" context="yes">New Edifice</property>
-    <property name="modal">True</property>
     <property name="window_position">center</property>
+    <property name="destroy_with_parent">True</property>
+    <property name="type_hint">dialog</property>
     <child>
       <object class="GtkVBox" id="vbox13">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
-        <property name="spacing">5</property>
+        <property name="spacing">15</property>
         <child>
           <object class="GtkTable" id="table10">
             <property name="visible">True</property>
@@ -76,6 +78,7 @@
           <object class="GtkHBox" id="hbox15">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
+            <property name="spacing">5</property>
             <child>
               <object class="GtkButton" id="button_ok">
                 <property name="label" context="yes">gtk-ok</property>
diff --git a/data/ui/find.xml b/data/ui/find.xml
index 7928e85..36f9363 100644
--- a/data/ui/find.xml
+++ b/data/ui/find.xml
@@ -4,7 +4,7 @@
   <object class="GtkWindow" id="window_find">
     <property name="can_focus">False</property>
     <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-    <property name="border_width">5</property>
+    <property name="border_width">10</property>
     <property name="title" translatable="yes" context="yes">Find</property>
     <property name="resizable">False</property>
     <property name="window_position">center</property>
diff --git a/data/ui/location.xml b/data/ui/location.xml
index 87cc417..9fb45b4 100644
--- a/data/ui/location.xml
+++ b/data/ui/location.xml
@@ -3,6 +3,7 @@
   <!-- interface-requires gtk+ 2.6 -->
   <object class="GtkWindow" id="window_location">
     <property name="can_focus">False</property>
+    <property name="border_width">10</property>
     <property name="title" translatable="yes" context="yes">New Location</property>
     <property name="modal">True</property>
     <property name="window_position">center</property>
@@ -10,7 +11,7 @@
       <object class="GtkVBox" id="vbox12">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
-        <property name="spacing">5</property>
+        <property name="spacing">15</property>
         <child>
           <object class="GtkTable" id="table9">
             <property name="visible">True</property>
@@ -101,6 +102,7 @@
           <object class="GtkHBox" id="hbox14">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
+            <property name="spacing">5</property>
             <child>
               <object class="GtkButton" id="button_ok">
                 <property name="label" context="yes">gtk-ok</property>
diff --git a/data/ui/maintainer.xml b/data/ui/maintainer.xml
index 14e719c..ae9056f 100644
--- a/data/ui/maintainer.xml
+++ b/data/ui/maintainer.xml
@@ -3,6 +3,8 @@
   <!-- interface-requires gtk+ 2.6 -->
   <object class="GtkWindow" id="window_maintainer">
     <property name="can_focus">False</property>
+    <property name="border_width">10</property>
+    <property name="modal">True</property>
     <property name="window_position">center</property>
     <property name="default_width">350</property>
     <property name="default_height">300</property>
@@ -10,6 +12,7 @@
       <object class="GtkVBox" id="vbox7">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
+        <property name="spacing">15</property>
         <child>
           <object class="GtkScrolledWindow" id="scrolledwindow3">
             <property name="visible">True</property>
@@ -20,6 +23,9 @@
                 <property name="can_focus">True</property>
                 <property name="reorderable">True</property>
                 <property name="rules_hint">True</property>
+                <child internal-child="selection">
+                  <object class="GtkTreeSelection" id="treeview-selection1"/>
+                </child>
               </object>
             </child>
           </object>
diff --git a/data/ui/maintainer1.xml b/data/ui/maintainer1.xml
index 5d24d38..4c4a683 100644
--- a/data/ui/maintainer1.xml
+++ b/data/ui/maintainer1.xml
@@ -3,6 +3,8 @@
   <!-- interface-requires gtk+ 2.6 -->
   <object class="GtkWindow" id="window_maintainer1">
     <property name="can_focus">False</property>
+    <property name="border_width">10</property>
+    <property name="modal">True</property>
     <property name="window_position">center</property>
     <property name="default_width">350</property>
     <property name="default_height">300</property>
@@ -10,6 +12,7 @@
       <object class="GtkVBox" id="vbox9">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
+        <property name="spacing">15</property>
         <child>
           <object class="GtkScrolledWindow" id="scrolledwindow4">
             <property name="visible">True</property>
@@ -20,6 +23,9 @@
                 <property name="can_focus">True</property>
                 <property name="reorderable">True</property>
                 <property name="rules_hint">True</property>
+                <child internal-child="selection">
+                  <object class="GtkTreeSelection" id="treeview-selection1"/>
+                </child>
               </object>
             </child>
           </object>
diff --git a/data/ui/model.xml b/data/ui/model.xml
index 37e0877..7334dbd 100644
--- a/data/ui/model.xml
+++ b/data/ui/model.xml
@@ -3,6 +3,7 @@
   <!-- interface-requires gtk+ 2.6 -->
   <object class="GtkWindow" id="window_model">
     <property name="can_focus">False</property>
+    <property name="border_width">10</property>
     <property name="title" translatable="yes" context="yes">New Model</property>
     <property name="modal">True</property>
     <property name="window_position">center</property>
@@ -10,7 +11,7 @@
       <object class="GtkVBox" id="vbox10">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
-        <property name="spacing">5</property>
+        <property name="spacing">15</property>
         <child>
           <object class="GtkTable" id="table5">
             <property name="visible">True</property>
@@ -100,6 +101,7 @@
           <object class="GtkHBox" id="hbox13">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
+            <property name="spacing">5</property>
             <child>
               <object class="GtkButton" id="button_ok">
                 <property name="label" context="yes">gtk-ok</property>
diff --git a/data/ui/pref.xml b/data/ui/pref.xml
index 08dcea7..efeb90a 100644
--- a/data/ui/pref.xml
+++ b/data/ui/pref.xml
@@ -3,7 +3,7 @@
   <!-- interface-requires gtk+ 2.6 -->
   <object class="GtkWindow" id="window_prefer">
     <property name="can_focus">False</property>
-    <property name="border_width">5</property>
+    <property name="border_width">10</property>
     <property name="title" translatable="yes" context="yes">Preferences</property>
     <property name="resizable">False</property>
     <property name="window_position">center</property>
diff --git a/src/gevice.py b/src/gevice.py
index 967fccc..ea4bd58 100755
--- a/src/gevice.py
+++ b/src/gevice.py
@@ -531,7 +531,10 @@ class Gevice:
       gevice.gdiagram.load_interface (gevice)
       gevice.gdiagram.show_interface ()
     else:
-      result = gevice.show_message (_("You need choose some device to generate the diagram."),None,(Gtk.STOCK_OK, Gtk.ResponseType.OK),gevice.window_main)
+      result = gevice.show_message (_("You need choose some device to generate the diagram."),
+	None,
+	(Gtk.STOCK_OK, Gtk.ResponseType.OK),
+	gevice.window_main)
       
   def on_action_print (gevice,action):
     gprint = geviceprint.GevicePrint()
@@ -584,7 +587,10 @@ class Gevice:
     
   def on_action_save (gevice,action,data):
     gevice.gdbase.save_data_to_database(gevice)
-    result = gevice.show_message (_("Model saved"),None,(Gtk.STOCK_OK, Gtk.ResponseType.OK),None)
+    result = gevice.show_message (_("Model saved"),
+      None,
+      (Gtk.STOCK_OK, Gtk.ResponseType.OK),
+      None)
     
   def on_action_connect(self,action,data):
     flag = True
@@ -597,9 +603,6 @@ class Gevice:
       
   def on_action_open_local_terminal(self,action):
     self.connect_to_device(True)
-    
-  #def on_action_radio(gevice,action,current,data):
-    #gevice.action_radio = action
    
   def on_toggle_tree (gevice,action,data):
     if (action.get_active() == True):
diff --git a/src/gevicedatabase.py b/src/gevicedatabase.py
index d3f737f..eb897fd 100644
--- a/src/gevicedatabase.py
+++ b/src/gevicedatabase.py
@@ -26,7 +26,10 @@ class GeviceDatabase:
             conn = psycopg2.connect("dbname=" + gevice.gpref.dbase + " user=" + gevice.gpref.user_dbase + " host=" + gevice.gpref.host + " password=" + passwd)
             return conn
         except:
-	    result = gevice.show_message (_("Unable to connect to the database"),None,(Gtk.STOCK_OK, Gtk.ResponseType.OK),self.window_database)
+	    result = gevice.show_message (_("Unable to connect to the database"),
+	      None,
+	      (Gtk.STOCK_OK, Gtk.ResponseType.OK),
+	      self.window_database)
             return False
 
 
@@ -36,7 +39,10 @@ class GeviceDatabase:
             rows = self.cur.fetchall()
             return rows
         except:
-	    result = gevice.show_message (_("Unable to execute SQL: " + sql),None,(Gtk.STOCK_OK, Gtk.ResponseType.OK),None)
+	    result = gevice.show_message (_("Unable to execute SQL: " + sql),
+	      None,
+	      (Gtk.STOCK_OK, Gtk.ResponseType.OK),
+	      None)
             return False
         
     def execute_sql_insert (self,gevice,sql):
@@ -44,7 +50,10 @@ class GeviceDatabase:
             self.cur.execute(sql)
             return True
         except:
-	    result = gevice.show_message (_("Unable to execute SQL: " + sql),None,(Gtk.STOCK_OK, Gtk.ResponseType.OK),None)
+	    result = gevice.show_message (_("Unable to execute SQL: " + sql),
+	      None,
+	      (Gtk.STOCK_OK, Gtk.ResponseType.OK),
+	      None)
             return False
             
     def execute_sql_delete (self,gevice,sql):
@@ -52,7 +61,10 @@ class GeviceDatabase:
             self.cur.execute(sql)
             return True
         except:
-	    result = gevice.show_message (_("Unable to execute SQL: " + sql),None,(Gtk.STOCK_OK, Gtk.ResponseType.OK),None)
+	    result = gevice.show_message (_("Unable to execute SQL: " + sql),
+	      None,
+	      (Gtk.STOCK_OK, Gtk.ResponseType.OK),
+	      None)
             return False
 
     def execute_sql_update (self,gevice,sql):
@@ -60,7 +72,10 @@ class GeviceDatabase:
             self.cur.execute(sql)
             return True
         except:
-	    result = gevice.show_message (_("Unable to execute SQL: " + sql),None,(Gtk.STOCK_OK, Gtk.ResponseType.OK),None)
+	    result = gevice.show_message (_("Unable to execute SQL: " + sql),
+	      None,
+	      (Gtk.STOCK_OK, Gtk.ResponseType.OK),
+	      None)
             return False
 
     def load_interface (self,gevice,action="connect"):
diff --git a/src/gevicedevice.py b/src/gevicedevice.py
index 1587fad..7a03d7a 100644
--- a/src/gevicedevice.py
+++ b/src/gevicedevice.py
@@ -111,7 +111,9 @@ class GeviceDevice:
         data = gevice.gmodel.get_data_of_device_from_model(gevice.gmodel.treeview)
 	
 	result = gevice.show_message (_("Do you want to remove: ") + data[0],
-	  None,(Gtk.STOCK_YES, Gtk.ResponseType.YES, Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL),None)
+	  None,
+	  (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, Gtk.STOCK_YES, Gtk.ResponseType.YES),
+	  None)
 
 	if result == Gtk.ResponseType.YES:
             i = gevice.gmodel.get_iter_selected (gevice.gmodel.treeview)
@@ -197,18 +199,26 @@ class GeviceDevice:
         
         if (not name.strip()):
             alldata = False
-	    result = gevice.show_message (_("Enter name of device"),None,(Gtk.STOCK_OK, Gtk.ResponseType.OK),self.window_device)
+	    result = gevice.show_message (_("Enter name of device"),
+	      None,
+	      (Gtk.STOCK_OK, Gtk.ResponseType.OK),
+	      self.window_device)	      
         elif (not serial.strip()):
             alldata = False
-	    result = gevice.show_message (_("Enter serial number of device"),None,(Gtk.STOCK_OK, Gtk.ResponseType.OK),self.window_device)
+	    result = gevice.show_message (_("Enter serial number of device"),
+	      None,
+	      (Gtk.STOCK_OK, Gtk.ResponseType.OK),
+	      self.window_device)
 
         gevice.gmodel.treestore.foreach(self.verify_serial,serial)
 
         if self.action == "add":
             if (self.exists_serial):
                 alldata = False
-		result = gevice.show_message (_("Serial number exist, view device: "  + self.exists_serial_name),None,(Gtk.STOCK_OK, Gtk.ResponseType.OK),self.window_device)
-
+		result = gevice.show_message (_("Serial number exist, view device: "  + self.exists_serial_name),
+		  None,
+		  (Gtk.STOCK_OK, Gtk.ResponseType.OK),
+		  self.window_device)
 
         if alldata:        
             iter_model = self.combo_model.get_active_iter()
diff --git a/src/gevicemaintainer.py b/src/gevicemaintainer.py
index aa13c66..f35d0dc 100644
--- a/src/gevicemaintainer.py
+++ b/src/gevicemaintainer.py
@@ -1,8 +1,6 @@
 from gi.repository import Gtk
 
 import os
-#import gobject
-
 import psycopg2
 import config
 
@@ -29,7 +27,6 @@ class GeviceMaintainer:
         self.button_close = builder.get_object ("button_close")
         self.treeview = builder.get_object ("treeview")        
         
-        #self.treeview.set_rules_hint (True)
         self.window_maintainer.set_title (title)
         
         # create columns
@@ -313,11 +310,9 @@ class GeviceMaintainer:
         if rows:
             for row in rows:
                 iter = liststore.append ()
-                liststore.set (
-                    iter,
-                    0,row[0],
-                    1,row[1],
-                    2,row[2])
+                liststore.set_value (iter,0,int(row[0]))
+		liststore.set_value (iter,1,str(row[1]))
+		liststore.set_value (iter,2,str(row[2]))
 
 
     def close_window (self,window):
@@ -342,16 +337,17 @@ class GeviceMaintainer:
         model.foreach(self.is_newname_in_list, newname)
         
         if not self.is_in_list:
-            model.set(iter,1,newname)
+            model.set_value (iter,1,str(newname))
+	    
             update = sql["update1"] + "'" + newname + "'" + sql["update2"] + str(id)
             if (gevice.gdbase.execute_sql_update(gevice,update)):
                 gevice.gdbase.conn.commit()
 
         else:
-            #show error message and delete the row.
-            #result = gevice.show_message (_("Name exist: ") + newname,Gtk.MESSAGE_INFO,Gtk.BUTTONS_OK)
-	    print self
-	    result = gevice.show_message (_("Name exist: ") + newname,None,(Gtk.STOCK_OK, Gtk.ResponseType.OK),None)
+	    result = gevice.show_message (_("Name exist: ") + newname,
+	      None,
+	      (Gtk.STOCK_OK, Gtk.ResponseType.OK),
+	      self.window_maintainer)
 
        
     def is_newname_in_list(self,model,path,iter,newname):
@@ -373,7 +369,7 @@ class GeviceMaintainer:
         if oldname == newname:
             return
 
-        model.set(iter,2,newname)
+        model.set_value (iter,2,str(newname))
         update = sql["update1"] + "'" + newname + "'" + sql["update2"] + str(id)
         
         if (gevice.gdbase.execute_sql_update(gevice,update)):
@@ -385,10 +381,8 @@ class GeviceMaintainer:
         
         liststore = self.treeview.get_model()
         iter = liststore.append ()
-        liststore.set (
-            iter,
-            0,row[0][0],
-            1,"New" + str(row[0][0]))
+        liststore.set_value (iter,0,int(row[0][0]))
+	liststore.set_value (iter,1,"New" + str(row[0][0]))
             
         path = liststore.get_path(iter)
         self.treeview.set_cursor(path,None,False)        
@@ -417,11 +411,12 @@ class GeviceMaintainer:
         
         delete = sql["delete"] + str(id)
         
-        #result = gevice.show_message (_("Do you want to remove: ") + name,Gtk.MESSAGE_QUESTION,Gtk.BUTTONS_YES_NO)
-	result = gevice.show_message (_("Do you want to remove: ") + name,
-	  None,(Gtk.STOCK_YES, Gtk.ResponseType.YES, Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL),None)
+	result = gevice.show_message (_("Do you want to remove: ") + name, 
+	  None,
+	  (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, Gtk.STOCK_YES, Gtk.ResponseType.YES),
+	  self.window_maintainer)
 
-        if result == Gtk.RESPONSE_YES:
+        if result == Gtk.ResponseType.YES:
             if (gevice.gdbase.execute_sql_delete (gevice,delete)):
                 model.remove(iter)
             
@@ -438,13 +433,13 @@ class GeviceMaintainer:
         
         delete = sql["delete"] + str(id)
         
-       
-        #result = gevice.show_message (_("Do you want to remove: ") + name,Gtk.MESSAGE_QUESTION,Gtk.BUTTONS_YES_NO)
 	result = gevice.show_message (_("Do you want to remove: ") + name,
-	  None,(Gtk.STOCK_YES, Gtk.ResponseType.YES, Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL),None)
+	  None,
+	  (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, Gtk.STOCK_YES, Gtk.ResponseType.YES),
+	  self.window_maintainer)
 	
 
-        if result == Gtk.RESPONSE_YES:
+        if result == Gtk.ResponseType.YES:
             if (gevice.gdbase.execute_sql_delete (gevice,delete)):
                 model.remove(iter)
             
diff --git a/src/geviceprefer.py b/src/geviceprefer.py
index 07fe19a..f123c64 100644
--- a/src/geviceprefer.py
+++ b/src/geviceprefer.py
@@ -136,7 +136,9 @@ class GevicePrefer:
             gevice.modelusers.set_value(iter,0,newname)
             self.save_preferences(gevice)
         else:
-	    result = gevice.show_message (_("Name exist: ") + newname,None,(Gtk.STOCK_OK, Gtk.ResponseType.OK),self.window_prefer)
+	    result = gevice.show_message (_("Name exist: ") + newname,
+	      None,(Gtk.STOCK_OK, Gtk.ResponseType.OK),
+	      self.window_prefer)
 
 
     def is_newname_in_list(self,model,path,iter,newname):
@@ -173,7 +175,9 @@ class GevicePrefer:
         name = model.get(iter,0)[0]
                 
 	result = gevice.show_message (_("Do you want to remove: ") + name,
-	  None, (Gtk.STOCK_YES, Gtk.ResponseType.YES, Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL),self.window_prefer)
+	  None, 
+	  (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, Gtk.STOCK_YES, Gtk.ResponseType.YES),
+	  self.window_prefer)
         
         if result == Gtk.ResponseType.YES:
                 model.remove(iter)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]