[gevice] Cleaning code.



commit 05740b97903d2257e4cf1cb530ae893176091744
Author: Alejandro Valdes Jimenez <avaldes gnome org>
Date:   Wed Jul 18 15:49:39 2012 -0400

    Cleaning code.

 ChangeLog     |    3 ++
 src/gevice.py |  105 +++++++++++++++++++++++++++++++--------------------------
 2 files changed, 60 insertions(+), 48 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 223893f..deca41c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
+2012-07-18  Alejandro Valdes Jimenez  <avaldes gnome org>
+	* src/gevice.py: Cleaning code.
+
 2011-12-16  Alejandro Valdes Jimenez  <avaldes gnome org>
 	* data/images/Makefile.am:
 	* data/other/db_gevice.sql: New image.
diff --git a/src/gevice.py b/src/gevice.py
index 5bd80ab..a8159f2 100755
--- a/src/gevice.py
+++ b/src/gevice.py
@@ -49,61 +49,21 @@ class Gevice:
     self.connected_to_database = False
     self.context_id = None
     
-    # model for list of users for SSH session
-    self.modelusers = Gtk.ListStore(str)
+    # set lists for remote users session (ssh)
+    self.modelusers = Gtk.ListStore(str)    
     
-    # model for protocol (protocol and default port)
+    # set lists of protocols
     self.modelproto = Gtk.ListStore(str,int)
-    self.modelproto.append ([_("Protocol"),0])
-    self.modelproto.append (["ssh",22])
-    self.modelproto.append (["telnet",23])
-    self.modelproto.append (["local",0])
-    # for VNC value is display
-    self.modelproto.append (["vnc",1])
-    self.modelproto.append (["rdp",0])
-    #self.modelproto.append (["xdmcp",0])
+    self.set_lists_of_protocols()
     
-    # 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
-    icon  = GdkPixbuf.Pixbuf.new_from_file_at_size (os.path.join (config.ARTDIR,"cisco.png"), 24, 24)
-    self.arrayos['Cisco'] = 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)
+    # set lists of operative systems.
+    self.set_lists_of_operating_system()
 
     # model for display geometry (vnc,rdp)
     self.modelgeometry = Gtk.ListStore(str)
-    self.modelgeometry.append ([_("Geometry")])
-    self.modelgeometry.append (["800x600"])
-    self.modelgeometry.append (["1024x768"])    
+    self.set_lists_of_geometry_display()
     
-    # model for devices
+    # set model for devices
     self.gmodel = gevicemodel.GeviceModel(self)
 
     # get widgets of main app
@@ -246,6 +206,55 @@ class Gevice:
 
     self.infobar.hide()
     return
+  
+  def set_lists_of_geometry_display(self):
+    self.modelgeometry.append ([_("Geometry")])
+    self.modelgeometry.append (["800x600"])
+    self.modelgeometry.append (["1024x768"])    
+
+  def set_lists_of_operating_system (self):
+    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
+    icon  = GdkPixbuf.Pixbuf.new_from_file_at_size (os.path.join (config.ARTDIR,"cisco.png"), 24, 24)
+    self.arrayos['Cisco'] = 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)
+
+  def set_lists_of_protocols (self):
+    self.modelproto.append ([_("Protocol"),0])
+    self.modelproto.append (["ssh",22])
+    self.modelproto.append (["telnet",23])
+    self.modelproto.append (["local",0])
+    # for VNC value is display
+    self.modelproto.append (["vnc",1])
+    self.modelproto.append (["rdp",0])
+    #self.modelproto.append (["xdmcp",0])
 
   def infobar_response_received(self, infobar, response):
     if response == Gtk.ResponseType.OK:



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