[gevice] Now, the devices show your operating system. (assigned manually).



commit b215fb1742c1939ef9511681c70c6ce0e8c812bc
Author: Alejandro Valdes Jimenez <avaldes gnome org>
Date:   Fri Dec 16 13:24:27 2011 -0300

    Now, the devices show your operating system. (assigned manually).

 ChangeLog                  |   16 ++++++++++++++++
 data/images/debian.png     |  Bin 0 -> 2288 bytes
 data/images/debian64.png   |  Bin 0 -> 2444 bytes
 data/images/none.png       |  Bin 0 -> 1908 bytes
 data/images/redhat.png     |  Bin 0 -> 2039 bytes
 data/images/redhat64.png   |  Bin 0 -> 2253 bytes
 data/images/ubuntu.png     |  Bin 0 -> 1922 bytes
 data/images/ubuntu64.png   |  Bin 0 -> 2043 bytes
 data/images/win2003-64.png |  Bin 0 -> 2638 bytes
 data/images/win2003.png    |  Bin 0 -> 2666 bytes
 data/images/win2008-64.png |  Bin 0 -> 2639 bytes
 data/images/win2008.png    |  Bin 0 -> 2672 bytes
 data/images/winxp.png      |  Bin 0 -> 2568 bytes
 data/other/db_gevice.sql   |   20 ++++++++++----------
 data/ui/device.xml         |   27 ++++++++++++++++++++++++++-
 src/config.py.in           |    3 +++
 src/gevice.py              |   32 ++++++++++++++++++++++++++++++++
 src/gevicedatabase.py      |   12 +++++++-----
 src/gevicedevice.py        |   29 ++++++++++++++++++++++++++++-
 src/gevicemodel.py         |   23 +++++++++++++++++------
 20 files changed, 139 insertions(+), 23 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 9468856..fcabdf1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2011-12-16  Alejandro Valdes Jimenez  <avaldes gnome org>
+	* Now, the devices show your operating system. (assigned manually).
+	* New images.
+	* data/images/debian.png:
+	* data/images/debian64.png:
+	* data/images/none.png:
+	* data/images/redhat.png:
+	* data/images/redhat64.png:
+	* data/images/ubuntu.png:
+	* data/images/ubuntu64.png:
+	* data/images/win2003-64.png:
+	* data/images/win2003.png:
+	* data/images/win2008-64.png:
+	* data/images/win2008.png:
+	* data/images/winxp.png:
+
 2011-11-21  Alejandro Valdes Jimenez  <avaldes gnome org>
 	* src/gevice.py: changed value of geometry 1024x720 to 1024x768
 
diff --git a/data/images/debian.png b/data/images/debian.png
new file mode 100644
index 0000000..5481204
Binary files /dev/null and b/data/images/debian.png differ
diff --git a/data/images/debian64.png b/data/images/debian64.png
new file mode 100644
index 0000000..fdb8f78
Binary files /dev/null and b/data/images/debian64.png differ
diff --git a/data/images/none.png b/data/images/none.png
new file mode 100644
index 0000000..cbad2ca
Binary files /dev/null and b/data/images/none.png differ
diff --git a/data/images/redhat.png b/data/images/redhat.png
new file mode 100644
index 0000000..2856190
Binary files /dev/null and b/data/images/redhat.png differ
diff --git a/data/images/redhat64.png b/data/images/redhat64.png
new file mode 100644
index 0000000..2b3818a
Binary files /dev/null and b/data/images/redhat64.png differ
diff --git a/data/images/ubuntu.png b/data/images/ubuntu.png
new file mode 100644
index 0000000..093a9eb
Binary files /dev/null and b/data/images/ubuntu.png differ
diff --git a/data/images/ubuntu64.png b/data/images/ubuntu64.png
new file mode 100644
index 0000000..c4108a0
Binary files /dev/null and b/data/images/ubuntu64.png differ
diff --git a/data/images/win2003-64.png b/data/images/win2003-64.png
new file mode 100644
index 0000000..b84deca
Binary files /dev/null and b/data/images/win2003-64.png differ
diff --git a/data/images/win2003.png b/data/images/win2003.png
new file mode 100644
index 0000000..317ccb3
Binary files /dev/null and b/data/images/win2003.png differ
diff --git a/data/images/win2008-64.png b/data/images/win2008-64.png
new file mode 100644
index 0000000..bf6e07f
Binary files /dev/null and b/data/images/win2008-64.png differ
diff --git a/data/images/win2008.png b/data/images/win2008.png
new file mode 100644
index 0000000..aeeb7c7
Binary files /dev/null and b/data/images/win2008.png differ
diff --git a/data/images/winxp.png b/data/images/winxp.png
new file mode 100644
index 0000000..d686e52
Binary files /dev/null and b/data/images/winxp.png differ
diff --git a/data/other/db_gevice.sql b/data/other/db_gevice.sql
index eecc671..4c96b3d 100644
--- a/data/other/db_gevice.sql
+++ b/data/other/db_gevice.sql
@@ -26,15 +26,15 @@ CREATE TABLE edificio (id_edif NUMERIC PRIMARY KEY NOT NULL, nom_edif TEXT NOT N
 INSERT INTO "edificio" VALUES(0,'None',0);
 CREATE TABLE rack (id_rack NUMERIC PRIMARY KEY NOT NULL, detalle TEXT, id_nivel NUMERIC, id_edif NUMERIC, FOREIGN KEY (id_nivel) REFERENCES nivel (id_nivel), FOREIGN KEY (id_edif) REFERENCES edificio (id_edif));
 INSERT INTO "rack" VALUES(0,'None',0,0);
-CREATE TABLE dispositivo (serial TEXT PRIMARY KEY NOT NULL, nom_disp TEXT NOT NULL,obs_disp TEXT, ip_disp TEXT, ptas_disp TEXT, id_modelo NUMERIC, id_rack NUMERIC, FOREIGN KEY (id_modelo) REFERENCES modelo (id_modelo), FOREIGN KEY (id_rack) REFERENCES rack (id_rack));
-INSERT INTO "dispositivo" VALUES('22222222','rsw-main','','127.0.0.1','',2,0);
-INSERT INTO "dispositivo" VALUES('11111111','sw-main','','127.0.0.1','',1,0);
-INSERT INTO "dispositivo" VALUES('33333333','srv-web1','','127.0.0.1','',3,0);
-INSERT INTO "dispositivo" VALUES('44444444','srv-dns','','127.0.0.1','',3,0);
-INSERT INTO "dispositivo" VALUES('55555555','srv-dhcp','','127.0.0.1','',3,0);
-INSERT INTO "dispositivo" VALUES('66666666','rsw-campus1','','127.0.0.1','',2,0);
-INSERT INTO "dispositivo" VALUES('77777777','sw-campus1-1','','127.0.0.1','',1,0);
-INSERT INTO "dispositivo" VALUES('88888888','srv-dhcp2','','127.0.0.1','',3,0);
+CREATE TABLE dispositivo (serial TEXT PRIMARY KEY NOT NULL, nom_disp TEXT NOT NULL,obs_disp TEXT, ip_disp TEXT, ptas_disp TEXT, id_modelo NUMERIC, id_rack NUMERIC, os TEXT NOT NULL default "None", FOREIGN KEY (id_modelo) REFERENCES modelo (id_modelo), FOREIGN KEY (id_rack) REFERENCES rack (id_rack));
+INSERT INTO "dispositivo" VALUES('22222222','rsw-main','','127.0.0.1','',2,0,'None');
+INSERT INTO "dispositivo" VALUES('11111111','sw-main','','127.0.0.1','',1,0,'None');
+INSERT INTO "dispositivo" VALUES('33333333','srv-web1','','127.0.0.1','',3,0,'None');
+INSERT INTO "dispositivo" VALUES('44444444','srv-dns','','127.0.0.1','',3,0,'None');
+INSERT INTO "dispositivo" VALUES('55555555','srv-dhcp','','127.0.0.1','',3,0,'None');
+INSERT INTO "dispositivo" VALUES('66666666','rsw-campus1','','127.0.0.1','',2,0,'None');
+INSERT INTO "dispositivo" VALUES('77777777','sw-campus1-1','','127.0.0.1','',1,0,'None');
+INSERT INTO "dispositivo" VALUES('88888888','srv-dhcp2','','127.0.0.1','',3,0,'None');
 CREATE TABLE conecta (serialp TEXT NOT NULL, serialh TEXT NOT NULL, id_tipo_enlace NUMERIC NOT NULL, FOREIGN KEY (serialp) REFERENCES dispositivo (serial), FOREIGN KEY (serialh) REFERENCES dispositivo (serial), FOREIGN KEY (id_tipo_enlace) REFERENCES tipo_enlace (id_tipo_enlace), PRIMARY KEY (serialp,serialh,id_tipo_enlace));
 INSERT INTO "conecta" VALUES('22222222','11111111',1);
 INSERT INTO "conecta" VALUES('22222222','66666666',1);
@@ -44,7 +44,7 @@ INSERT INTO "conecta" VALUES('11111111','55555555',1);
 INSERT INTO "conecta" VALUES('66666666','77777777',1);
 INSERT INTO "conecta" VALUES('77777777','88888888',1);
 CREATE VIEW todoslosdispositivos as
-SELECT tipo_disp.id_tipo_disp, tipo_disp.nom_tipo_disp, marca.id_marca, marca.nom_marca, modelo.id_modelo, modelo.nom_modelo, dispositivo.serial, dispositivo.nom_disp, dispositivo.ip_disp, dispositivo.obs_disp, '[' || campus.nom_campus || '][' || edificio.nom_edif || '][' || nivel.nom_nivel || '][' || rack.detalle || ']' AS ubicacion, rack.id_rack, edificio.id_edif, nivel.id_nivel, campus.id_campus, dispositivo.ptas_disp
+SELECT tipo_disp.id_tipo_disp, tipo_disp.nom_tipo_disp, marca.id_marca, marca.nom_marca, modelo.id_modelo, modelo.nom_modelo, dispositivo.serial, dispositivo.nom_disp, dispositivo.ip_disp, dispositivo.obs_disp, '[' || campus.nom_campus || '][' || edificio.nom_edif || '][' || nivel.nom_nivel || '][' || rack.detalle || ']' AS ubicacion, rack.id_rack, edificio.id_edif, nivel.id_nivel, campus.id_campus, dispositivo.ptas_disp, dispositivo.os
    FROM dispositivo
    JOIN modelo ON dispositivo.id_modelo = modelo.id_modelo
    JOIN marca ON modelo.id_marca = marca.id_marca
diff --git a/data/ui/device.xml b/data/ui/device.xml
index c583200..7de1cb6 100644
--- a/data/ui/device.xml
+++ b/data/ui/device.xml
@@ -23,7 +23,7 @@
               <object class="GtkTable" id="table_data">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="n_rows">8</property>
+                <property name="n_rows">9</property>
                 <property name="n_columns">2</property>
                 <property name="column_spacing">2</property>
                 <property name="row_spacing">2</property>
@@ -239,6 +239,29 @@
                     <property name="bottom_attach">3</property>
                   </packing>
                 </child>
+                <child>
+                  <object class="GtkLabel" id="label7">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="label" translatable="yes">Operating System</property>
+                  </object>
+                  <packing>
+                    <property name="top_attach">8</property>
+                    <property name="bottom_attach">9</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkComboBox" id="combo_os">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="right_attach">2</property>
+                    <property name="top_attach">8</property>
+                    <property name="bottom_attach">9</property>
+                  </packing>
+                </child>
               </object>
               <packing>
                 <property name="expand">False</property>
@@ -261,6 +284,7 @@
             <child>
               <object class="GtkButton" id="button_accept_device">
                 <property name="label" context="yes">gtk-ok</property>
+                <property name="use_action_appearance">False</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">False</property>
@@ -277,6 +301,7 @@
             <child>
               <object class="GtkButton" id="button_cancel_device">
                 <property name="label" context="yes">gtk-cancel</property>
+                <property name="use_action_appearance">False</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">False</property>
diff --git a/src/config.py.in b/src/config.py.in
index 9de4eb4..36c7d81 100644
--- a/src/config.py.in
+++ b/src/config.py.in
@@ -48,6 +48,7 @@ else:
     OTHERDIR	= "@OTHERDIR@"
 
 # struct main treestore
+
 COLUMN_NAME_DEV = 0
 COLUMN_NAME_MODEL_DEV = 1
 COLUMN_IP_DEV = 2
@@ -58,6 +59,8 @@ COLUMN_PTAS_DISP = 6
 COLUMN_ID_MODEL_DEV = 7
 COLUMN_ID_TYPE_LINK_DEV = 8
 COLUMN_ID_LOCATION_DEV = 9
+COLUMN_ICON_DEV = 10
+COLUMN_ID_ICON = 11
 
 # struct liststore of models
 COLUMN_NAME_MODEL_DEV2 = 0
diff --git a/src/gevice.py b/src/gevice.py
index 6d1a626..0d59499 100755
--- a/src/gevice.py
+++ b/src/gevice.py
@@ -63,6 +63,38 @@ class Gevice:
     self.modelproto.append (["rdp",0])
     #self.modelproto.append (["xdmcp",0])
     
+    # model for operative systems.
+    icon  = GdkPixbuf.Pixbuf.new_from_file_at_size (os.path.join (config.ARTDIR,"none.png"), 24, 24)
+    self.arrayos = {'None': icon}
+    icon  = GdkPixbuf.Pixbuf.new_from_file_at_size (os.path.join (config.ARTDIR,"debian.png"), 24, 24)
+    self.arrayos['Debian'] = icon
+    icon  = GdkPixbuf.Pixbuf.new_from_file_at_size (os.path.join (config.ARTDIR,"debian64.png"), 24, 24)
+    self.arrayos['Debian64'] = icon
+    icon  = GdkPixbuf.Pixbuf.new_from_file_at_size (os.path.join (config.ARTDIR,"ubuntu.png"), 24, 24)
+    self.arrayos['Ubuntu'] = icon
+    icon  = GdkPixbuf.Pixbuf.new_from_file_at_size (os.path.join (config.ARTDIR,"ubuntu64.png"), 24, 24)
+    self.arrayos['Ubuntu64'] = icon
+    icon  = GdkPixbuf.Pixbuf.new_from_file_at_size (os.path.join (config.ARTDIR,"redhat.png"), 24, 24)
+    self.arrayos['Redhat'] = icon
+    icon  = GdkPixbuf.Pixbuf.new_from_file_at_size (os.path.join (config.ARTDIR,"redhat64.png"), 24, 24)
+    self.arrayos['Redhat64'] = icon
+    icon  = GdkPixbuf.Pixbuf.new_from_file_at_size (os.path.join (config.ARTDIR,"win2003.png"), 24, 24)
+    self.arrayos['Windows2003'] = icon
+    icon  = GdkPixbuf.Pixbuf.new_from_file_at_size (os.path.join (config.ARTDIR,"win2003-64.png"), 24, 24)
+    self.arrayos['Windows2003-64'] = icon
+    icon  = GdkPixbuf.Pixbuf.new_from_file_at_size (os.path.join (config.ARTDIR,"win2008.png"), 24, 24)
+    self.arrayos['Windows2008'] = icon
+    icon  = GdkPixbuf.Pixbuf.new_from_file_at_size (os.path.join (config.ARTDIR,"win2008-64.png"), 24, 24)
+    self.arrayos['Windows2008-64'] = icon
+    icon  = GdkPixbuf.Pixbuf.new_from_file_at_size (os.path.join (config.ARTDIR,"winxp.png"), 24, 24)
+    self.arrayos['WindowsXP'] = icon
+    
+    self.modelos = Gtk.ListStore(str,str)
+    for m in self.arrayos:
+      iter = self.modelos.append()
+      self.modelos.set_value (iter,0,m)
+      self.modelos.set_value (iter,1,m)
+
     # model for display geometry (vnc,rdp)
     self.modelgeometry = Gtk.ListStore(str)
     self.modelgeometry.append ([_("Geometry")])
diff --git a/src/gevicedatabase.py b/src/gevicedatabase.py
index f4ee161..6c9c868 100644
--- a/src/gevicedatabase.py
+++ b/src/gevicedatabase.py
@@ -121,14 +121,15 @@ class GeviceDatabase:
 
   def process_row (self,serial,iterp,id_type_link,gevice):
     sql = "select nom_disp,id_modelo,nom_tipo_disp || ' ' || nom_marca || ' ' || nom_modelo, "
-    sql = sql + "ip_disp,serial,obs_disp,ubicacion,id_rack,ptas_disp "
+    sql = sql + "ip_disp,serial,obs_disp,ubicacion,id_rack,ptas_disp,os "
     sql = sql + " from todoslosdispositivos where serial='" + serial + "'"
 
     row = self.execute_sql_select(gevice,sql)
 
     if row:
       itern = gevice.gmodel.treestore.append(iterp)
-      gevice.gmodel.insert_new_item (itern,row,id_type_link)
+      iconpixbuf = gevice.arrayos[row[0][9]]
+      gevice.gmodel.insert_new_item (itern,row,id_type_link,iconpixbuf)
 
       sql2 = "select serialh,id_tipo_enlace from conecta where serialp='" + serial + "'"
       rows = self.execute_sql_select(gevice,sql2)
@@ -160,7 +161,8 @@ class GeviceDatabase:
       config.COLUMN_OBS_DEV,
       config.COLUMN_ID_TYPE_LINK_DEV,
       config.COLUMN_ID_LOCATION_DEV,
-      config.COLUMN_PTAS_DISP)
+      config.COLUMN_PTAS_DISP,
+      config.COLUMN_ID_ICON)
 
     self.insert_device (data,gevice)
 
@@ -175,8 +177,8 @@ class GeviceDatabase:
         next = next2
 
   def insert_device (self,data,gevice):        
-    sql = "insert into dispositivo (serial,id_modelo,nom_disp,obs_disp,ip_disp,id_rack,ptas_disp) "
-    sql = sql + "values ('" + data[3] + "'," + data[1] + ",'" + data[0] + "','" + data[4] + "','" + data[2] + "','" + data[6] + "','" + data[7] + "');"
+    sql = "insert into dispositivo (serial,id_modelo,nom_disp,obs_disp,ip_disp,id_rack,ptas_disp,os) "
+    sql = sql + "values ('" + data[3] + "'," + data[1] + ",'" + data[0] + "','" + data[4] + "','" + data[2] + "','" + data[6] + "','" + data[7] + "','" + data[8] + "');"
     rp = self.execute_sql_insert (gevice,sql)
 
   def insert_conections (self,serials,gevice):
diff --git a/src/gevicedevice.py b/src/gevicedevice.py
index ec91f8b..259aa00 100644
--- a/src/gevicedevice.py
+++ b/src/gevicedevice.py
@@ -40,6 +40,7 @@ class GeviceDevice:
     self.combo_model.set_active(0)
     self.combo_link.set_active(0)
     self.combo_location.set_active(0)
+    self.combo_os.set_active(0)
     self.window_device.set_title (_("New device"))
 
   def modify_device (self,gevice):
@@ -50,12 +51,14 @@ class GeviceDevice:
     self.index_combo = 0
     self.index_link = 0
     self.index_location = 0
+    self.index_icon = 0
 
     data = gevice.gmodel.get_data_of_device_from_model(gevice.gmodel.treeview)
 
     self.id_model = data[1]
     self.id_link = data[5]
     self.id_location = data[6]
+    self.id_icon = data[8]
 
     models = gevice.gdbase.get_list_of_models (gevice)
     models.foreach (self.get_index_combo_model,gevice)
@@ -65,6 +68,8 @@ class GeviceDevice:
 
     location = gevice.gdbase.get_list_of_location (gevice)
     location.foreach (self.get_index_combo_location,gevice)        
+    
+    gevice.modelos.foreach (self.get_index_combo_os,gevice)            
 
     self.entry_name_device.set_text(data[0])
     self.combo_model.set_active(self.index_combo)
@@ -74,8 +79,17 @@ class GeviceDevice:
     self.entry_ports.set_text(data[7])
     self.combo_link.set_active(self.index_link)
     self.combo_location.set_active(self.index_location)
+    self.combo_os.set_active(self.index_icon)
 
     self.window_device.set_title (_("Modify device"))
+
+  def get_index_combo_os (self,model,path,iter,gevice):
+    data = model.get (iter,0)
+
+    if (data[0] == self.id_icon):
+      return True
+
+    self.index_icon = self.index_icon + 1    
     
   def get_index_combo_model (self,model,path,iter,gevice):
     data = model.get (iter,
@@ -131,6 +145,7 @@ class GeviceDevice:
     self.combo_link = builder.get_object ("combo_link")
     self.combo_location = builder.get_object ("combo_location")
     self.combo_model = builder.get_object ("combo_model")
+    self.combo_os = builder.get_object ("combo_os")
     self.button_cancel_device = builder.get_object ("button_cancel_device")
     self.button_accept_device = builder.get_object ("button_accept_device")
 
@@ -156,6 +171,11 @@ class GeviceDevice:
     self.combo_location.add_attribute(cell, 'text', 0)
     gevice.list_location = gevice.gdbase.get_list_of_location (gevice)
     self.combo_location.set_model (gevice.list_location)        
+    
+    cell = Gtk.CellRendererText()
+    self.combo_os.pack_start(cell,True)
+    self.combo_os.add_attribute(cell, 'text', 0)
+    self.combo_os.set_model (gevice.modelos)        
 
   def show_interface (self):
     self.window_device.show_all ()
@@ -220,13 +240,16 @@ class GeviceDevice:
       iter_model = self.combo_model.get_active_iter()
       id_model = gevice.list_models.get_value(iter_model,config.COLUMN_ID_MODEL_DEV2)
       name_model = gevice.list_models.get_value(iter_model,config.COLUMN_NAME_MODEL_DEV2)
-
+      
       iter_type_link = self.combo_link.get_active_iter()
       id_link = gevice.list_links.get_value(iter_type_link,config.COLUMN_ID_TYPE_LINK_DEV2)
 
       iter_type_location = self.combo_location.get_active_iter()
       id_location = gevice.list_location.get_value(iter_type_location,config.COLUMN_ID_LOCATION_DEV2)            
       name_location = gevice.list_location.get_value(iter_type_location,config.COLUMN_LOCATION_DEV2)
+      
+      iter_icon = self.combo_os.get_active_iter()
+      id_icon = gevice.modelos.get_value(iter_icon,0)
 
       i = gevice.gmodel.get_iter_selected(gevice.gmodel.treeview)
 
@@ -245,6 +268,10 @@ class GeviceDevice:
       gevice.gmodel.treestore.set_value (newiter, config.COLUMN_ID_LOCATION_DEV,str(id_location))
       gevice.gmodel.treestore.set_value (newiter, config.COLUMN_ID_TYPE_LINK_DEV,str(id_link))
       gevice.gmodel.treestore.set_value (newiter, config.COLUMN_PTAS_DISP,str(ports))
+      
+      iconpixbuf = gevice.arrayos[id_icon]
+      gevice.gmodel.treestore.set_value (newiter, config.COLUMN_ICON_DEV,iconpixbuf)
+      gevice.gmodel.treestore.set_value (newiter, config.COLUMN_ID_ICON,str(id_icon))
 
       if i["path"]:
         gevice.gmodel.treeview.expand_to_path(i["path"][0])
diff --git a/src/gevicemodel.py b/src/gevicemodel.py
index 3c350fd..741dbc2 100644
--- a/src/gevicemodel.py
+++ b/src/gevicemodel.py
@@ -1,4 +1,6 @@
-from gi.repository import Gtk
+from gi.repository import Gtk,  GdkPixbuf
+import os
+import os.path
 
 import config
 
@@ -10,7 +12,7 @@ from gettext import gettext as _
 
 class GeviceModel:
   def __init__ (self,gevice):
-    self.treestore = Gtk.TreeStore(str,str,str,str,str,str,str,str,str,str)
+    self.treestore = Gtk.TreeStore(str,str,str,str,str,str,str,str,str,str,GdkPixbuf.Pixbuf,str)
 
     self.treeview = Gtk.TreeView (model=self.treestore)
     self.treeview.set_rules_hint (True)
@@ -21,10 +23,16 @@ class GeviceModel:
     col.set_resizable (True)
     self.treeview.append_column (col)
 
+    cellrendererpixbuf = Gtk.CellRendererPixbuf()
+    col.pack_start(cellrendererpixbuf, False)
+    col.add_attribute(cellrendererpixbuf, "pixbuf", config.COLUMN_ICON_DEV)
+
     cell =  Gtk.CellRendererText()
-    col.pack_start (cell,True)
-    col.add_attribute (cell,"text",config.COLUMN_NAME_DEV)
+    col.pack_start (cell,False)
+    col.add_attribute (cell,"text",config.COLUMN_NAME_DEV)   
+
 
+    ############
     col = Gtk.TreeViewColumn (_("Model"))
     col.set_resizable (True)
     self.treeview.append_column (col)
@@ -72,7 +80,7 @@ class GeviceModel:
 
     return
 
-  def insert_new_item (self,newiter,row,id_type_link):
+  def insert_new_item (self,newiter,row,id_type_link,iconpixbuf):
     self.treestore.set_value (newiter, config.COLUMN_NAME_DEV, str(row[0][0]))
     self.treestore.set_value (newiter, config.COLUMN_ID_MODEL_DEV, str(row[0][1]))
     self.treestore.set_value (newiter, config.COLUMN_NAME_MODEL_DEV, str(row[0][2]))
@@ -83,6 +91,8 @@ class GeviceModel:
     self.treestore.set_value (newiter, config.COLUMN_ID_LOCATION_DEV, str(row[0][7]))
     self.treestore.set_value (newiter, config.COLUMN_PTAS_DISP, str(row[0][8]))
     self.treestore.set_value (newiter, config.COLUMN_ID_TYPE_LINK_DEV, str(id_type_link))
+    self.treestore.set_value (newiter, config.COLUMN_ICON_DEV, iconpixbuf)
+    self.treestore.set_value (newiter, config.COLUMN_ID_ICON, str(row[0][9]))
 
   def on_device_selection_changed (self,selection,gevice):
     model,iter = selection.get_selected()
@@ -112,7 +122,8 @@ class GeviceModel:
       config.COLUMN_OBS_DEV,
       config.COLUMN_ID_TYPE_LINK_DEV,
       config.COLUMN_ID_LOCATION_DEV,
-      config.COLUMN_PTAS_DISP)
+      config.COLUMN_PTAS_DISP,
+      config.COLUMN_ID_ICON)
 
     return data
 



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