[gevice/gevice_2_0] new branch gevice_2_0: Lite-Gevice
- From: Alejandro Valdes Jimenez <avaldes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gevice/gevice_2_0] new branch gevice_2_0: Lite-Gevice
- Date: Fri, 14 Dec 2012 00:40:43 +0000 (UTC)
commit 759fadbe55bb5bc968c72a5605a7635c5bc07a4d
Author: Alejandro Valdes Jimenez <avaldes gnome org>
Date: Thu Dec 13 21:35:43 2012 -0300
new branch gevice_2_0: Lite-Gevice
ChangeLog | 18 +
configure.ac | 2 +-
data/other/db_gevice.sql | 84 ++----
data/ui/device.xml | 199 +------------
data/ui/main.xml | 4 +-
data/ui/menu.xml | 12 +-
src/config.py.in | 34 --
src/gevice.py | 767 ++++++++++++----------------------------------
src/gevicedatabase.py | 186 ++++--------
src/gevicedevice.py | 212 ++------------
src/gevicediagram.py | 18 +
src/geviceexport.py | 18 +
src/gevicefind.py | 18 +
src/gevicemaintainer.py | 18 +
src/gevicemodel.py | 111 ++-----
src/geviceprefer.py | 18 +
src/gevicevte.py | 27 ++-
17 files changed, 469 insertions(+), 1277 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 68d94fe..e1ff70b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2012-12-13 Alejandro ValdéJimenez <avaldes gnome org>
+ * configure.ac: Change version to 2.0.1
+ * data/other/db_gevice.sql: Modify schema.
+ * data/ui/device.xml: Eliminate widgets.
+ * data/ui/main.xml: Eliminate widgets.
+ * data/ui/menu.xml: Modify menuitems.
+ * src/config.py.in: Eliminate old constants.
+ * src/gevice.py: clean code.
+ * src/gevicedatabase.py: clean code.
+ * src/gevicedevice.py: clean code
+ * src/gevicediagram.py: .
+ * src/geviceexport.py: .
+ * src/gevicefind.py: .
+ * src/gevicemaintainer.py: .
+ * src/gevicemodel.py: clean code
+ * src/geviceprefer.py: .
+ * src/gevicevte.py: clean code
+
2012-11-14 Alejandro Valdes J. <avaldes gnome org>
* prepare-ChangeLog.pl: Add script.
* src/gevicediagram.py: fixed preferences reading.
diff --git a/configure.ac b/configure.ac
index ce7a41c..6673ed3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,4 @@
-AC_INIT([gevice], [2.0.0],[http://bugzilla.gnome.org/enter_bug.cgi?product=gevice],[gevice])
+AC_INIT([gevice], [2.0.1],[http://bugzilla.gnome.org/enter_bug.cgi?product=gevice],[gevice])
AC_CONFIG_SRCDIR(src/gevice.py)
AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
diff --git a/data/other/db_gevice.sql b/data/other/db_gevice.sql
index 071b282..a196286 100644
--- a/data/other/db_gevice.sql
+++ b/data/other/db_gevice.sql
@@ -1,57 +1,27 @@
-PRAGMA foreign_keys=OFF;
-BEGIN TRANSACTION;
-CREATE TABLE campus(id_campus NUMERIC PRIMARY KEY NOT NULL, nom_campus TEXT NOT NULL);
-INSERT INTO "campus" VALUES(0,'None');
-CREATE TABLE marca (id_marca NUMERIC PRIMARY KEY NOT NULL, nom_marca TEXT NOT NULL);
-INSERT INTO "marca" VALUES(0,'None');
-INSERT INTO "marca" VALUES(1,'Cisco');
-INSERT INTO "marca" VALUES(2,'Sun');
-CREATE TABLE tipo_disp (id_tipo_disp NUMERIC PRIMARY KEY NOT NULL, nom_tipo_disp TEXT NOT NULL);
-INSERT INTO "tipo_disp" VALUES(0,'None');
-INSERT INTO "tipo_disp" VALUES(1,'Switch');
-INSERT INTO "tipo_disp" VALUES(2,'Router');
-INSERT INTO "tipo_disp" VALUES(3,'Router/Switch');
-INSERT INTO "tipo_disp" VALUES(4,'Server');
-CREATE TABLE tipo_enlace (id_tipo_enlace NUMERIC PRIMARY KEY NOT NULL, nom_tipo_enlace TEXT NOT NULL);
-INSERT INTO "tipo_enlace" VALUES(0,'None');
-INSERT INTO "tipo_enlace" VALUES(1,'1000mbps UTP');
-CREATE TABLE nivel (id_nivel NUMERIC PRIMARY KEY NOT NULL, nom_nivel TEXT NOT NULL);
-INSERT INTO "nivel" VALUES(0,'None');
-CREATE TABLE modelo (id_modelo NUMERIC PRIMARY KEY NOT NULL, nom_modelo TEXT NOT NULL, id_tipo_disp NUMERIC, id_marca NUMERIC, FOREIGN KEY (id_tipo_disp) REFERENCES tipo_disp (id_tipo_disp), FOREIGN KEY (id_marca) REFERENCES marca (id_marca));
-INSERT INTO "modelo" VALUES(0,'None',0,0);
-INSERT INTO "modelo" VALUES(1,'WS-C2950T24',1,1);
-INSERT INTO "modelo" VALUES(2,'WS-C3550-24',3,1);
-INSERT INTO "modelo" VALUES(3,'X4140',4,2);
-CREATE TABLE edificio (id_edif NUMERIC PRIMARY KEY NOT NULL, nom_edif TEXT NOT NULL, id_campus NUMERIC, FOREIGN KEY (id_campus) REFERENCES campus (id_campus));
-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, 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,'Cisco');
-INSERT INTO "dispositivo" VALUES('11111111','sw-main','','127.0.0.1','',1,0,'Cisco');
-INSERT INTO "dispositivo" VALUES('33333333','srv-web1','','127.0.0.1','',3,0,'Debian64');
-INSERT INTO "dispositivo" VALUES('44444444','srv-dns','','127.0.0.1','',3,0,'Redhat64');
-INSERT INTO "dispositivo" VALUES('55555555','srv-dhcp','','127.0.0.1','',3,0,'Ubuntu64');
-INSERT INTO "dispositivo" VALUES('66666666','rsw-campus1','','127.0.0.1','',2,0,'Cisco');
-INSERT INTO "dispositivo" VALUES('77777777','sw-campus1-1','','127.0.0.1','',1,0,'Cisco');
-INSERT INTO "dispositivo" VALUES('88888888','srv-dhcp2','','127.0.0.1','',3,0,'Windows2003');
-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);
-INSERT INTO "conecta" VALUES('11111111','33333333',1);
-INSERT INTO "conecta" VALUES('11111111','44444444',1);
-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, dispositivo.os
- FROM dispositivo
- JOIN modelo ON dispositivo.id_modelo = modelo.id_modelo
- JOIN marca ON modelo.id_marca = marca.id_marca
- JOIN tipo_disp ON modelo.id_tipo_disp = tipo_disp.id_tipo_disp
- JOIN rack ON dispositivo.id_rack = rack.id_rack
- JOIN nivel ON rack.id_nivel = nivel.id_nivel
- JOIN edificio ON rack.id_edif = edificio.id_edif
- JOIN campus ON edificio.id_campus = campus.id_campus
- ORDER BY dispositivo.serial;
-COMMIT;
+--Table: device
+
+--DROP TABLE device;
+
+CREATE TABLE device (
+ id_dev varchar(30) PRIMARY KEY NOT NULL UNIQUE,
+ ip_dev varchar(15) DEFAULT '127.0.0.1'
+);
+
+--Table: connect
+
+--DROP TABLE connect;
+
+CREATE TABLE connect (
+ id_devp varchar(30) NOT NULL,
+ id_devc varchar(30) NOT NULL,
+ PRIMARY KEY (id_devp, id_devc),
+ /* Foreign keys */
+ FOREIGN KEY (id_devc)
+ REFERENCES device(id_dev)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE,
+ FOREIGN KEY (id_devp)
+ REFERENCES device(id_dev)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE
+);
diff --git a/data/ui/device.xml b/data/ui/device.xml
index 7de1cb6..7e92329 100644
--- a/data/ui/device.xml
+++ b/data/ui/device.xml
@@ -1,11 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
- <!-- interface-requires gtk+ 2.6 -->
+ <!-- interface-requires gtk+ 3.0 -->
<object class="GtkWindow" id="window_device">
<property name="can_focus">False</property>
<property name="border_width">10</property>
<property name="title" translatable="yes">Device</property>
<property name="resizable">False</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>
@@ -23,79 +24,11 @@
<object class="GtkTable" id="table_data">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="n_rows">9</property>
+ <property name="n_rows">2</property>
<property name="n_columns">2</property>
<property name="column_spacing">2</property>
<property name="row_spacing">2</property>
<child>
- <object class="GtkEntry" id="entry_comment_device">
- <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="max_length">250</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">5</property>
- <property name="bottom_attach">6</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes" context="yes">Comment</property>
- </object>
- <packing>
- <property name="top_attach">5</property>
- <property name="bottom_attach">6</property>
- </packing>
- </child>
- <child>
- <object class="GtkEntry" id="entry_serial_device">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="max_length">25</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">4</property>
- <property name="bottom_attach">5</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label11">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes" context="yes">Serial</property>
- </object>
- <packing>
- <property name="top_attach">4</property>
- <property name="bottom_attach">5</property>
- <property name="x_options"></property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label5">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes" context="yes">Model</property>
- </object>
- <packing>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="x_options"></property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
<object class="GtkEntry" id="entry_ip_device">
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -106,7 +39,7 @@
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
- <property name="y_options"></property>
+ <property name="y_options"/>
</packing>
</child>
<child>
@@ -119,36 +52,8 @@
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
- <property name="x_options"></property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkComboBox" id="combo_link">
- <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">3</property>
- <property name="bottom_attach">4</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label12">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes" context="yes">Link</property>
- </object>
- <packing>
- <property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
- <property name="x_options"></property>
- <property name="y_options"></property>
+ <property name="x_options"/>
+ <property name="y_options"/>
</packing>
</child>
<child>
@@ -161,7 +66,7 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
- <property name="y_options"></property>
+ <property name="y_options"/>
</packing>
</child>
<child>
@@ -172,94 +77,8 @@
<property name="label" translatable="yes" context="yes">Name</property>
</object>
<packing>
- <property name="x_options"></property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label3">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Location</property>
- </object>
- <packing>
- <property name="top_attach">6</property>
- <property name="bottom_attach">7</property>
- </packing>
- </child>
- <child>
- <object class="GtkComboBox" id="combo_location">
- <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">6</property>
- <property name="bottom_attach">7</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label6">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Ports Availables</property>
- </object>
- <packing>
- <property name="top_attach">7</property>
- <property name="bottom_attach">8</property>
- </packing>
- </child>
- <child>
- <object class="GtkEntry" id="entry_ports">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="max_length">2</property>
- <property name="invisible_char">â</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">7</property>
- <property name="bottom_attach">8</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkComboBox" id="combo_model">
- <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">2</property>
- <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>
+ <property name="x_options"/>
+ <property name="y_options"/>
</packing>
</child>
</object>
diff --git a/data/ui/main.xml b/data/ui/main.xml
index c7c69ac..bab69b1 100644
--- a/data/ui/main.xml
+++ b/data/ui/main.xml
@@ -1,9 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
- <!-- interface-requires gtk+ 2.6 -->
+ <!-- interface-requires gtk+ 3.0 -->
<object class="GtkWindow" id="window_main">
- <property name="width_request">850</property>
- <property name="height_request">600</property>
<property name="can_focus">False</property>
<property name="title" translatable="yes">Gevice</property>
<property name="window_position">center</property>
diff --git a/data/ui/menu.xml b/data/ui/menu.xml
index f4c71ce..73e4a0c 100644
--- a/data/ui/menu.xml
+++ b/data/ui/menu.xml
@@ -17,15 +17,9 @@
<menuitem action="Tree"/>
<menuitem action="Terminal"/>
</menu>
- <menu action="Maintainer">
- <menuitem action="Mark"/>
- <menuitem action="TypeOfLink"/>
- <menuitem action="TypeOfDev"/>
- <menuitem action="Model"/>
- <menuitem action="Level"/>
- <menuitem action="Campus"/>
- <menuitem action="Edifice"/>
- <menuitem action="Location"/>
+ <menu action="Session">
+ <menuitem action="ssh"/>
+ <menuitem action="telnet"/>
</menu>
<menu action="ActionsMenu">
<menuitem action="AddDevice"/>
diff --git a/src/config.py.in b/src/config.py.in
index 36c7d81..61d9e43 100644
--- a/src/config.py.in
+++ b/src/config.py.in
@@ -46,37 +46,3 @@ else:
UIDIR = "@UIDIR@"
ARTDIR = "@ARTDIR@"
OTHERDIR = "@OTHERDIR@"
-
-# struct main treestore
-
-COLUMN_NAME_DEV = 0
-COLUMN_NAME_MODEL_DEV = 1
-COLUMN_IP_DEV = 2
-COLUMN_SERIAL_DEV = 3
-COLUMN_OBS_DEV = 4
-COLUMN_LOCATION = 5
-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
-COLUMN_ID_MODEL_DEV2 = 1
-
-# struct liststore of links
-COLUMN_NAME_TYPE_LINK_DEV2 = 0
-COLUMN_ID_TYPE_LINK_DEV2 = 1
-
-# struct liststore of location
-COLUMN_LOCATION_DEV2 = 0
-COLUMN_ID_LOCATION_DEV2 = 1
-
-
-DEFAULT_TMP = "/tmp/"
-
-# width and high of main window
-DEFAULT_WIDTH = 800
-DEFAULT_HIGH = 600
diff --git a/src/gevice.py b/src/gevice.py
index efd66d4..00a0a58 100755
--- a/src/gevice.py
+++ b/src/gevice.py
@@ -23,15 +23,15 @@ import os.path
from struct import unpack
import config
-import gevicefind
-import gevicediagram
-import geviceprefer
+###import gevicefind
+###import gevicediagram
+###import geviceprefer
import gevicevte
import gevicedevice
import gevicemodel
import gevicedatabase
-import geviceexport
-import gevicemaintainer
+###import geviceexport
+###import gevicemaintainer
import gettext
gettext.bindtextdomain(config.PACKAGE,config.LOCALEDIR)
@@ -43,27 +43,11 @@ class Gevice:
def __init__ (self):
# SQLite format 3 (header string)
self.magic = ('\x53', '\x51', '\x4c', '\x69', '\x74', '\x65', '\x20', '\x66', '\x6f', '\x72', '\x6d', '\x61', '\x74', '\x20', '\x33', '\x00')
- self.list_models = None
- self.list_links = None
- self.list_location = None
self.connected_to_database = False
self.context_id = None
-
- # set lists for remote users session (ssh)
- self.modelusers = Gtk.ListStore(str)
-
- # set lists of protocols
- self.modelproto = Gtk.ListStore(str,int)
- self.set_lists_of_protocols()
-
- # set lists of operative systems.
- self.set_lists_of_operating_system()
+ self.session = "ssh"
- # model for display geometry (vnc,rdp)
- self.modelgeometry = Gtk.ListStore(str)
- self.set_lists_of_geometry_display()
-
- # set model for devices
+ # set treemodel for devices
self.gmodel = gevicemodel.GeviceModel(self)
# get widgets of main app
@@ -71,18 +55,18 @@ class Gevice:
builder.add_from_file(os.path.join (config.UIDIR, "main.xml"))
self.window_main = builder.get_object ("window_main")
+ self.window_main.maximize()
self.vbox_main = builder.get_object ("vbox_main")
self.hpaned = builder.get_object ("hpaned")
self.vboxtreeview = builder.get_object ("vboxtreeview")
self.vboxterminal = builder.get_object ("vboxterminal")
self.notebook = builder.get_object ("notebook")
self.statusbar = builder.get_object ("statusbar")
-
+ self.context_id = self.statusbar.get_context_id("status")
+
self.window_main.set_icon (GdkPixbuf.Pixbuf.new_from_file(os.path.join (config.ARTDIR,"gevice.png")))
self.window_main.set_title(config.PACKAGE)
self.window_main.connect ("delete_event",self.on_delete_event)
-
- self.context_id = self.statusbar.get_context_id("status")
# create UIManager instance
self.uimanager = Gtk.UIManager()
@@ -103,81 +87,15 @@ class Gevice:
# create a Toolbar and set style
self.maintoolbar = self.uimanager.get_widget ('/MainToolbar')
style_context = self.maintoolbar.get_style_context()
- Gtk.StyleContext.add_class (style_context,Gtk.STYLE_CLASS_PRIMARY_TOOLBAR)
-
- # create horizontal container for toolbar and users combobox
- self.hbox = Gtk.HBox(homogeneous=False, spacing=0)
- self.vbox_main.pack_start (self.hbox,False,False,0)
-
- # create toolitem for combobox for SSH user session
- separator_user = Gtk.SeparatorToolItem()
- self.toolitem_user = Gtk.ToolItem()
- self.maintoolbar.insert(separator_user,10)
- self.maintoolbar.insert(self.toolitem_user,11)
-
- # create combobox_user
- self.vboxcombo = Gtk.VBox(homogeneous=False,spacing=0)
- self.combobox_user = Gtk.ComboBox(model=self.modelusers,has_entry=False)
- self.vboxcombo.pack_end (self.combobox_user,True,False,0)
- self.toolitem_user.add(self.vboxcombo)
-
- cell = Gtk.CellRendererText()
- self.combobox_user.pack_start(cell, True)
- self.combobox_user.add_attribute(cell, "text", 0)
-
- # create toolitem for combobox protocol
- self.toolitem_proto = Gtk.ToolItem()
- self.maintoolbar.insert(self.toolitem_proto,12)
-
- # create combobox_proto
- self.vboxproto = Gtk.VBox(homogeneous=False,spacing=0)
- self.combobox_proto = Gtk.ComboBox(model=self.modelproto,has_entry=False)
- self.vboxproto.pack_end (self.combobox_proto,True,False,0)
- self.toolitem_proto.add(self.vboxproto)
- self.combobox_proto.set_active(0)
- self.combobox_proto.connect("changed", self.on_protocol_changed)
-
- cell = Gtk.CellRendererText()
- self.combobox_proto.pack_start(cell, True)
- self.combobox_proto.add_attribute(cell, "text", 0)
-
- # create toolitem for spinbutton ports
- self.toolitem_port = Gtk.ToolItem()
- self.maintoolbar.insert(self.toolitem_port,13)
-
- # create spinbutton ports
- self.vboxports = Gtk.VBox(homogeneous=False,spacing=0)
- #adjustment = Gtk.Adjustment(value=5, lower=0, upper=65535, step_increment=1, page_increment=1, page_size=0)
- adjustment = Gtk.Adjustment(value=0, lower=0, upper=65535, step_increment=1)
- self.spinb_ports = Gtk.SpinButton(adjustment=adjustment)
- self.vboxports.pack_end (self.spinb_ports,True,False,0)
- self.toolitem_port.add(self.vboxports)
-
- # create toolitem for combobox display geometry
- self.toolitem_geometry = Gtk.ToolItem()
- self.maintoolbar.insert(self.toolitem_geometry,14)
-
- # create combobox_geometry
- self.vboxgeometry = Gtk.VBox(homogeneous=False,spacing=0)
- self.combobox_geometry = Gtk.ComboBox(model=self.modelgeometry,has_entry=False)
- self.vboxgeometry.pack_end (self.combobox_geometry,True,False,0)
- self.toolitem_geometry.add(self.vboxgeometry)
- self.combobox_geometry.set_active(0)
-
- cell = Gtk.CellRendererText()
- self.combobox_geometry.pack_start(cell, True)
- self.combobox_geometry.add_attribute(cell, "text", 0)
-
- self.hbox.pack_start (self.maintoolbar,True,True,0)
+ Gtk.StyleContext.add_class (style_context,Gtk.STYLE_CLASS_PRIMARY_TOOLBAR)
+ self.vbox_main.pack_start (self.maintoolbar,False,False,0)
# infobar
self.infobar = Gtk.InfoBar()
self.infobar.add_button (Gtk.STOCK_OK, Gtk.ResponseType.OK)
- self.infobar.connect("response", self.infobar_response_received)
-
- self.vbox_main.pack_start(self.infobar,False,False,0)
-
- self.label_infobar = Gtk.Label(label="InfoBar Example")
+ self.infobar.connect("response", self.infobar_response_received)
+ self.vbox_main.pack_start(self.infobar,False,False,0)
+ self.label_infobar = Gtk.Label(label=".")
content = self.infobar.get_content_area()
content.add(self.label_infobar)
@@ -188,7 +106,7 @@ class Gevice:
# setting notebook properties
self.notebook.set_scrollable (True)
- self.notebook.set_show_border (False)
+ self.notebook.set_show_border (True)
self.notebook.set_show_tabs (True)
self.hpaned.add2 (self.notebook)
@@ -196,69 +114,15 @@ class Gevice:
self.hpaned.set_position (-1)
# load preferences
- self.gpref = geviceprefer.GevicePrefer(self)
- self.gpref.load_interface (self)
- self.set_listusers_on_combobox()
+ ###self.gpref = geviceprefer.GevicePrefer(self)
+ ###self.gpref.load_interface (self)
+ ###self.set_listusers_on_combobox()
# show all
self.window_main.show_all()
-
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:
- infobar.hide()
-
def create_actionsgroups (self):
self.actiongroup_window = Gtk.ActionGroup ('Window Actions')
self.actiongroup_model = Gtk.ActionGroup ('Model Actions')
@@ -268,7 +132,7 @@ class Gevice:
self.accelgroup = self.uimanager.get_accel_group()
self.window_main.add_accel_group (self.accelgroup)
- self.actiongroup_window.add_toggle_actions([
+ self.actiongroup_device.add_toggle_actions([
('Dual', Gtk.STOCK_NETWORK, '_Dual', None,_('Dual terminal'), None)])
# creat actions
@@ -276,32 +140,21 @@ class Gevice:
('FileMenu', None, _('_File')),
('EditMenu', None, _('_Edit')),
('ViewMenu', None, _('_View')),
- ('Protocol', None, _('_Protocol')),
+ ('Session', None, _('_Session')),
('HelpMenu', None, _('_Help')),
- ('Maintainer', None, _('_Maintainer')),
('ActionsMenu', None, _('_Actions')),
- ('Open', Gtk.STOCK_DISCONNECT, _('Connect'), None, _('Connect to database'), self.on_action_open),
- ('OpenLocalTerminal', Gtk.STOCK_HOME, _('Local'), None, _('Open local terminal'), self.on_action_open_local_terminal),
('Quit', Gtk.STOCK_QUIT, _('_Quit'), None, _('Quit the program'), self.on_action_quit),
- ('Prefer', Gtk.STOCK_PREFERENCES, _('Preferences'), None, _('Setting preferences'), self.on_action_preferences),
+ ('Prefer', Gtk.STOCK_PREFERENCES, _('Preferences'), None, _('Setting preferences'), self.passing),
('About', Gtk.STOCK_ABOUT, None, None, None, self.on_action_about),
- ('Connect', Gtk.STOCK_JUMP_TO, _('Open terminal'), None, _('Open terminal'), self.on_action_connect),
- ('Nbase', None, _('New Database'),None, _('New Database'), self.on_action_ndbase),
+ ('Nbase', None, _('New Database'),None, _('New Database'), self.on_action_ndbase),
+ ('Open', Gtk.STOCK_DISCONNECT, _('Connect'), None, _('Connect to database'), self.on_action_open),
])
self.actiongroup_model.add_actions([
- ('Find', Gtk.STOCK_FIND, _('Find'),None, _('Search a device'), self.on_action_find),
+ ('Find', Gtk.STOCK_FIND, _('Find'),None, _('Search a device'), self.passing),
('Save', Gtk.STOCK_SAVE, _('Save'), None, _('Save model'), self.on_action_save),
- ('Export', Gtk.STOCK_SELECT_ALL, _('Export all to CSV'), None, _('Export all to CSV'), self.on_action_export),
+ ('Export', Gtk.STOCK_SELECT_ALL, _('Export all to CSV'), None, _('Export all to CSV'), self.passing),
('AddDevice', Gtk.STOCK_ADD, _('Add'),None, _('Add a device'), self.on_action_adddevice),
- ('Mark', Gtk.STOCK_EDIT, _('Mark'),None, _('Mark'), self.on_action_mark),
- ('TypeOfLink', Gtk.STOCK_EDIT, _('Type of link'),None, _('Type of link'), self.on_action_typeoflink),
- ('TypeOfDev', Gtk.STOCK_EDIT, _('Type of device'),None, _('Type of device'), self.on_action_typeofdev),
- ('Model', Gtk.STOCK_EDIT, _('Model of device'),None, _('Model of device'), self.on_action_model),
- ('Level', Gtk.STOCK_EDIT, _('Levels of locations'),None, _('Levels of locations'), self.on_action_level),
- ('Campus', Gtk.STOCK_EDIT, _('Campus of organization'),None, _('Campus of Organization'), self.on_action_campus),
- ('Location', Gtk.STOCK_EDIT, _('Locations of devices'),None, _('Locations of devices'),self.on_action_location),
- ('Edifice', Gtk.STOCK_EDIT, _('Edifices of campus'),None, _('Edifices of campus'), self.on_action_edifice),
])
self.actiongroup_device.add_actions([
@@ -309,7 +162,8 @@ class Gevice:
('EditDevice', Gtk.STOCK_EDIT, _('Edit'), None, _('Edit data of device selected'), self.on_action_editdevice),
('Expand', Gtk.STOCK_INDENT, _('Expand'), None, _('Expand tree of device selected'), self.on_action_expand),
('Decrease', Gtk.STOCK_UNINDENT, _('Decrease'), None, _('Decrease tree of device selected'), self.on_action_decrease),
- ('Diagram', Gtk.STOCK_CONVERT, _('Generate Diagram'),None, _('Generate diagram of devices'), self.on_action_diagram),
+ ('Diagram', Gtk.STOCK_CONVERT, _('Generate Diagram'),None, _('Generate diagram of devices'), self.passing),
+ ('Connect', Gtk.STOCK_JUMP_TO, _('Open terminal'), None, _('Open terminal'), self.on_action_connect),
])
self.actiongroup_window.add_toggle_actions([
@@ -317,28 +171,21 @@ class Gevice:
('Terminal', None, _('Terminal'),None, _('Show terminal'), self.on_toggle_terminal, True),
])
+ self.actiongroup_device.add_radio_actions([
+ ("ssh", None, _("ssh"), None, _('SSH Session'), 1),
+ ("telnet", None, _("telnet"), None, _('Telnet Session'), 2)
+ ], 1, self.on_action_session)
+
self.actiongroup_model.set_sensitive (False)
self.actiongroup_window.set_sensitive (True)
self.actiongroup_device.set_sensitive (False)
+ def passing(self):
+ pass
+
def main(self):
Gtk.main()
- def set_listusers_on_combobox (self):
- self.modelusers.clear()
-
- for user in self.gpref.listusers:
- self.modelusers.append([user])
-
- self.combobox_user.set_active(0)
-
- def on_protocol_changed (self, combo):
- tree_iter = combo.get_active_iter()
- proto = self.modelproto.get_value(tree_iter,0)
- port = self.modelproto.get_value(tree_iter,1)
-
- self.spinb_ports.set_value (port)
-
def show_infobar_message (self,msg,type_msg):
self.infobar.set_message_type(type_msg)
self.label_infobar.set_text(msg)
@@ -359,150 +206,11 @@ class Gevice:
dialog.destroy()
return result
-
- def close_page_of_notebook(self,widget,vpaned):
- page = self.notebook.page_num(vpaned)
- self.notebook.remove_page(page)
-
- def remove_all_page_of_notebook (self):
- n = self.notebook.get_n_pages()
- i = n
-
- while i >= 0:
- self.notebook.remove_page(i)
- i = i - 1
-
- def connect_to_device (self,local=None):
- if (self.actiongroup_window.get_action("Dual").get_active()):
- isdual = True
- else:
- isdual = False
-
- vpaned = Gtk.VPaned()
- vpaned.set_position (-1)
-
- label = Gtk.Label()
- button_close = self.create_button_with_image (Gtk.STOCK_CLOSE,True)
- hbox_label = Gtk.HBox(homogeneous=False,spacing=0)
- hbox_label.pack_start(label,False,False,1)
- hbox_label.pack_start(button_close,True,False,0)
-
- gvte = gevicevte.GeviceVte()
-
- hbox_term,terminal = gvte.new_terminal (self)
- vpaned.add1 (hbox_term)
-
- button_close.connect('clicked',self.close_page_of_notebook,vpaned)
-
- if local:
- label.set_text(_("Local"))
- terminal.fork_command_full (Vte.PtyFlags.DEFAULT, None, [Vte.get_user_shell()], None, GLib.SpawnFlags.SEARCH_PATH, None, None)
-
- if isdual:
- hbox_term2,terminal2 = gvte.new_terminal (self)
- vpaned.add2 (hbox_term2)
- terminal2.fork_command_full (Vte.PtyFlags.DEFAULT, None, [Vte.get_user_shell()], None, GLib.SpawnFlags.SEARCH_PATH, None, None)
-
- else:
- i = self.gmodel.get_iter_selected (self.gmodel.treeview)
-
- if not i["iter"]:
- result = gevice.show_infobar_message (_("Not device selected"),
- Gtk.MessageType.INFO)
- return
- else:
- # get data from device selected (devicename, IP)
- data = self.gmodel.get_data_of_device_from_model(self.gmodel.treeview)
- label.set_text(data[0])
-
- # get name of user selected (for ssh session)
- model_user = self.combobox_user.get_model()
- iter_user = self.combobox_user.get_active_iter()
- user = model_user.get(iter_user,0)
- port = self.spinb_ports.get_value_as_int ()
-
- proto = self.get_protocol_selected()
-
- geometry = self.get_geometry_display_selected()
-
- if (proto == "rdp"):
- cmd = "rdesktop "
- cmd += "-T'" + data[2] + "' "
- cmd += "-u" + user[0]
- #cmd += " -g1024x720 "
- cmd += " -g" + geometry + " "
- cmd += "-rsound:local "
- cmd += "-rclipboard:PRIMARYCLIPBOARD "
- cmd += "-b -4 "
- cmd += data[2]
- cmd += " &"
-
- os.system(cmd)
- return
-
- if (proto == "vnc"):
- cmd = "vncviewer "
- #cmd += "-geometry 1024x720 "
- cmd += "-geometry " + geometry + " "
- cmd += "-Xdialog "
- cmd += data[2]
- cmd += ":"
- cmd += str(port)
- cmd += " &"
-
- os.system(cmd)
- return
-
- if (proto == "ssh"):
- terminal.fork_command_full (Vte.PtyFlags.DEFAULT, None,
- [proto,'-l',user[0],'-p',str(port),data[2]],
- [], GLib.SpawnFlags.SEARCH_PATH, None, None)
-
- if isdual:
- hbox_term2,terminal2 = gvte.new_terminal (self)
- vpaned.add2 (hbox_term2)
- terminal2.fork_command_full (Vte.PtyFlags.DEFAULT, None,
- [proto,'-l',user[0],'-p',str(port),data[2]],
- [], GLib.SpawnFlags.SEARCH_PATH, None, None)
-
- if (proto == "telnet"):
- terminal.fork_command_full (Vte.PtyFlags.DEFAULT, None,
- [proto,'-l',user[0],data[2],str(port)],
- [], GLib.SpawnFlags.SEARCH_PATH, None, None)
-
- if isdual:
- hbox_term2,terminal2 = gvte.new_terminal (self)
- vpaned.add2 (hbox_term2)
- terminal2.fork_command_full (Vte.PtyFlags.DEFAULT, None,
- [proto,'-l',user[0],data[2],str(port)],
- [], GLib.SpawnFlags.SEARCH_PATH, None, None)
-
- page = self.notebook.append_page(vpaned,hbox_label)
- self.notebook.set_tab_reorderable(vpaned,True)
- self.notebook.set_tab_detachable(vpaned,True)
- hbox_label.show_all()
- vpaned.show_all()
- self.notebook.set_current_page(page)
-
- def create_button_with_image (self,id_stock,sensitive):
- "return a button with image, utilized in tool of browser"
-
- hbox_image = Gtk.HBox(homogeneous=False,spacing=0)
- image = Gtk.Image()
- image.set_from_stock(id_stock,Gtk.IconSize.MENU)
- hbox_image.pack_start(image,True,False,False)
-
- button = Gtk.Button()
-
- button.add(hbox_image)
- button.set_sensitive (sensitive)
-
- return button
-
- def on_action_ndbase(gevice,action):
+ def on_action_ndbase(self,action):
+ ###FIXME: Open the new database after created
filechooser = Gtk.FileChooserDialog(title=_("New Database"),
- parent=gevice.window_main,
+ parent=self.window_main,
action=Gtk.FileChooserAction.SAVE,
buttons=(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, Gtk.STOCK_OK, Gtk.ResponseType.ACCEPT))
@@ -518,142 +226,13 @@ class Gevice:
if (FILE):
FILE.close()
file_database = os.path.join (config.OTHERDIR,"db_gevice.sql")
- id = os.popen('sqlite3 ' + dbsqlite + ' <' + file_database)
+ id = os.popen('sqlite3 ' + dbsqlite + ' <' + file_database)
except:
- result = gevice.show_infobar_message (_("Can not write to file"),
+ result = self.show_infobar_message (_("Can not write to file"),
Gtk.MessageType.ERROR)
filechooser.destroy()
- def on_action_model (gevice,action):
- sql_select = "select modelo.id_modelo,tipo_disp.nom_tipo_disp || ' ' || marca.nom_marca,modelo.nom_modelo "
- sql_select = sql_select + "from modelo inner join marca on modelo.id_marca = marca.id_marca inner join tipo_disp "
- sql_select = sql_select + "on modelo.id_tipo_disp = tipo_disp.id_tipo_disp order by 2;"
-
- sql = {"select":sql_select,
- "update1":"update modelo set nom_modelo=",
- "update2":" where id_modelo=",
- "delete":"delete from modelo where id_modelo=",
- "max_id":"select max(id_modelo) + 1 from modelo;",
- "insert":"insert into modelo (id_modelo, id_tipo_disp, id_marca, nom_modelo) values ",
- "sql_mark":"select nom_marca,id_marca from marca;",
- "sql_tipo_disp":"select nom_tipo_disp,id_tipo_disp from tipo_disp"}
-
- dialogmaintainer = gevicemaintainer.GeviceMaintainer ()
- dialogmaintainer.load_interface1 (gevice,_("Model of device"),sql)
- dialogmaintainer.load_data1 (gevice,sql)
- dialogmaintainer.show_interface ()
-
- def on_action_location (gevice,action):
- sql_select = "select rack.id_rack,'[' || campus.nom_campus || '][' || edificio.nom_edif || '][' || nivel.nom_nivel || ']',rack.detalle "
- sql_select = sql_select + "from rack inner join nivel on rack.id_nivel = nivel.id_nivel "
- sql_select = sql_select + "inner join edificio on rack.id_edif = edificio.id_edif "
- sql_select = sql_select + "inner join campus on edificio.id_campus = campus.id_campus order by 2;"
-
- sql = {"select":sql_select,
- "update1":"update rack set detalle=",
- "update2":" where id_rack=",
- "delete":"delete from rack where id_rack=",
- "max_id":"select max(id_rack) + 1 from rack;",
- "insert":"insert into rack (id_rack, id_nivel, id_edif, detalle) values ",
- "sql_level":"select nom_nivel,id_nivel from nivel;",
- "sql_edifice":"select '[' || campus.nom_campus || '][' || edificio.nom_edif || ']', edificio.id_edif from edificio inner join campus on edificio.id_campus = campus.id_campus order by campus.nom_campus,edificio.nom_edif "}
-
- dialogmaintainer = gevicemaintainer.GeviceMaintainer ()
- dialogmaintainer.load_interface2 (gevice,_("Locations of devices"),sql)
- dialogmaintainer.load_data1 (gevice,sql)
- dialogmaintainer.show_interface ()
-
- def on_action_edifice (gevice,action):
- sql_select = "select edificio.id_edif, campus.nom_campus, edificio.nom_edif "
- sql_select = sql_select + "from edificio inner join campus on edificio.id_campus = campus.id_campus "
- sql_select = sql_select + "order by 2,3"
-
- print sql_select
-
- sql = {"select":sql_select,
- "update1":"update edificio set nom_edif=",
- "update2":" where id_edif=",
- "delete":"delete from edificio where id_edif=",
- "max_id":"select max(id_edif) + 1 from edificio;",
- "insert":"insert into edificio (id_edif, id_campus, nom_edif) values ",
- "sql_campus":"select nom_campus, id_campus from campus;"}
-
- dialogmaintainer = gevicemaintainer.GeviceMaintainer ()
- dialogmaintainer.load_interface3 (gevice,_("Edifices of campus"),sql)
- dialogmaintainer.load_data1 (gevice,sql)
- dialogmaintainer.show_interface ()
-
- def on_action_level (gevice,action):
- sql = {"select":"select * from nivel order by 1",
- "insert":"insert into nivel (id_nivel, nom_nivel) values ",
- "delete":"delete from nivel where id_nivel=",
- "update1":"update nivel set nom_nivel=",
- "update2":" where id_nivel=",
- "max_id":"select max(id_nivel)+1 from nivel;"}
-
- dialogmaintainer = gevicemaintainer.GeviceMaintainer ()
- dialogmaintainer.load_interface (gevice,_("Level"),sql)
- dialogmaintainer.load_data (gevice,sql)
- dialogmaintainer.show_interface ()
-
- def on_action_campus (gevice,action):
- sql = {"select":"select * from campus order by 1",
- "insert":"insert into campus (id_campus, nom_campus) values ",
- "delete":"delete from campus where id_campus=",
- "update1":"update campus set nom_campus=",
- "update2":" where id_campus=",
- "max_id":"select max(id_campus)+1 from campus;"}
-
- dialogmaintainer = gevicemaintainer.GeviceMaintainer ()
- dialogmaintainer.load_interface (gevice,_("Campus"),sql)
- dialogmaintainer.load_data (gevice,sql)
- dialogmaintainer.show_interface ()
-
- def on_action_mark (gevice,action):
- sql = {"select":"select * from marca order by 1",
- "insert":"insert into marca (id_marca, nom_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 (gevice,_("Mark"),sql)
- dialogmaintainer.load_data (gevice,sql)
- dialogmaintainer.show_interface ()
-
- def on_action_typeofdev (gevice,action):
- sql = {"select":"select * from tipo_disp order by 1",
- "insert":"insert into tipo_disp (id_tipo_disp, nom_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):
- sql = {"select":"select * from tipo_enlace order by 1",
- "insert":"insert into tipo_enlace (id_tipo_enlace, nom_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 ()
- dialogexport.load_interface (gevice)
- dialogexport.save_file (gevice)
-
def on_delete_event (self,data1=None,data2=None):
Gtk.main_quit()
@@ -662,59 +241,11 @@ class Gevice:
def on_action_quit (self,action):
self.on_delete_event ()
-
- def on_action_preferences (gevice,action):
- gevice.gpref.load_interface(gevice)
- gevice.gpref.show_interface()
-
- def on_action_find (gevice,action):
- gevice.gevicefind = gevicefind.GeviceFind ()
- gevice.gevicefind.load_interface(gevice)
- gevice.gevicefind.show_interface()
-
- def on_action_diagram (gevice,action):
- i = gevice.gmodel.get_iter_selected(gevice.gmodel.treeview)
-
- #check if the user have selected some device
- if (i["iter"]):
- gevice.gdiagram = gevicediagram.GeviceDiagram ()
- gevice.gdiagram.load_interface (gevice)
- gevice.gdiagram.show_interface ()
- else:
- result = gevice.show_infobar_message (_("You need choose some device to generate the diagram."),
- Gtk.MessageType.INFO)
-
- def on_action_print (gevice,action):
- gprint = geviceprint.GevicePrint()
- gprint.load_interface(gevice)
- gprint.show_interface()
-
- def on_action_expand (gevice,action):
- gevice.gmodel.expand_treeview (True)
-
- def on_action_decrease (gevice,action):
- gevice.gmodel.expand_treeview (False)
-
- def on_action_adddevice (gevice,action):
- gevice.gdevice = gevicedevice.GeviceDevice ()
- gevice.gdevice.load_interface (gevice)
- gevice.gdevice.add_device()
- gevice.gdevice.show_interface ()
-
- def on_action_removedevice (gevice,action):
- gevice.gdevice = gevicedevice.GeviceDevice ()
- gevice.gdevice.remove_device(gevice)
-
- def on_action_editdevice (gevice,action):
- gevice.gdevice = gevicedevice.GeviceDevice ()
- gevice.gdevice.load_interface (gevice)
- gevice.gdevice.modify_device(gevice)
- gevice.gdevice.show_interface ()
-
- def on_action_open (gevice,action):
- if (not gevice.connected_to_database):
+
+ def on_action_open (self,action):
+ if (not self.connected_to_database):
filechooser = Gtk.FileChooserDialog(title=_("Open Database"),
- parent=gevice.window_main,
+ parent=self.window_main,
action=Gtk.FileChooserAction.OPEN,
buttons=(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, Gtk.STOCK_OPEN, Gtk.ResponseType.ACCEPT))
@@ -729,64 +260,29 @@ class Gevice:
with open(dbsqlite, 'rb') as handle:
s = unpack('cccccccccccccccc', handle.read(16))
- if s == gevice.magic:
- gevice.gdbase = gevicedatabase.GeviceDatabase (dbsqlite,gevice)
- gevice.update_statusbar (dbsqlite)
- gevice.actiongroup_device.set_sensitive (False)
+ if s == self.magic:
+ self.gdbase = gevicedatabase.GeviceDatabase (dbsqlite,gevice)
+ self.update_statusbar (dbsqlite)
+ self.actiongroup_device.set_sensitive (False)
else:
- result = gevice.show_infobar_message (_("Seems not sqlite3: " + dbsqlite),
+ result = self.show_infobar_message (_("Seems not sqlite3: " + dbsqlite),
Gtk.MessageType.ERROR)
else:
- gevice.gmodel.treestore.clear()
- gevice.gmodel.treeview.set_model(None)
+ self.gmodel.treestore.clear()
+ self.gmodel.treeview.set_model(None)
- action_open = gevice.actiongroup_window.get_action("Open")
+ action_open = self.actiongroup_window.get_action("Open")
action_open.set_property ("stock-id",Gtk.STOCK_DISCONNECT)
action_open.set_property ("tooltip",_("Connect to database"))
action_open.set_property ("label",_("Connect"))
- gevice.actiongroup_window.set_sensitive (True)
- gevice.actiongroup_model.set_sensitive (False)
- gevice.actiongroup_device.set_sensitive (False)
- gevice.connected_to_database = False
+ self.actiongroup_window.set_sensitive (True)
+ self.actiongroup_model.set_sensitive (False)
+ self.actiongroup_device.set_sensitive (False)
+ self.connected_to_database = False
- gevice.update_statusbar("")
-
- def on_action_save (gevice,action):
- gevice.gdbase.save_data_to_database(gevice)
- result = gevice.show_infobar_message (_("Model saved"),
- Gtk.MessageType.INFO)
-
- def on_action_connect(self,action):
- flag = True
- proto = self.get_protocol_selected()
-
- if (proto != "local"):
- flag = False
+ self.update_statusbar("")
- self.connect_to_device(flag)
-
- def on_action_open_local_terminal(self,action):
- self.connect_to_device(True)
-
- def on_toggle_tree (gevice,action):
- if (action.get_active() == True):
- gevice.vboxtreeview.show()
- else:
- gevice.vboxtreeview.hide ()
-
- def on_toggle_terminal (gevice,action):
- if (action.get_active() == True):
- gevice.vboxterminal.show()
- else:
- gevice.vboxterminal.hide ()
-
- def get_ips(self,model,path,iter,pinglist):
- data = model.get(iter,config.COLUMN_NAME_DEV,config.COLUMN_IP_DEV,config.COLUMN_SERIAL_DEV)
- current = geviceping.GevicePing(data[1])
- pinglist.append(current)
- current.start()
-
def create_about_dialog (self):
authors = ('Alejandro Valdes Jimenez [avaldes gnome org]','')
translator_credits = ('Alejandro Valdes Jimenez [avaldes gnome org]')
@@ -807,20 +303,145 @@ class Gevice:
about.destroy()
return True
- def get_protocol_selected (self):
- iter = self.combobox_proto.get_active_iter()
- proto = self.modelproto.get_value(iter,0)
+ def update_statusbar (self,dbsqlite):
+ self.statusbar.push (self.context_id,dbsqlite)
+
+ def infobar_response_received(self,infobar,response):
+ if response == Gtk.ResponseType.OK:
+ infobar.hide()
+
+ def on_action_adddevice (self,action):
+ self.gdevice = gevicedevice.GeviceDevice ()
+ self.gdevice.load_interface (self)
+ self.gdevice.add_device()
+ self.gdevice.show_interface ()
+
+ def on_action_editdevice (self,action):
+ self.gdevice = gevicedevice.GeviceDevice ()
+ self.gdevice.load_interface (self)
+ self.gdevice.modify_device(self)
+ self.gdevice.show_interface ()
+
+ def on_action_removedevice (self,action):
+ self.gdevice = gevicedevice.GeviceDevice ()
+ self.gdevice.remove_device(self)
+
+ def on_action_expand (self,action):
+ self.expand_treeview (True)
+
+ def on_action_decrease (self,action):
+ self.expand_treeview (False)
+
+ def expand_treeview (self,flag):
+ seleccion,iterador = self.gmodel.treeview.get_selection().get_selected()
+ path = self.gmodel.treestore.get_path(iterador)
+
+ if flag:
+ self.gmodel.treeview.expand_row(path,True)
+ else:
+ self.gmodel.treeview.collapse_row(path)
+
+ def on_action_save (self,action):
+ self.gdbase.save_data_to_database(self)
+
+ ### FIXME: Validate to error
+ result = self.show_infobar_message (_("Model saved"), Gtk.MessageType.INFO)
+ ###result = self.show_infobar_message (_("Model Not saved"), Gtk.MessageType.ERROR)
+
+ def on_toggle_tree (self,action):
+ if (action.get_active() == True):
+ self.vboxtreeview.show()
+ else:
+ self.vboxtreeview.hide ()
+
+ def on_toggle_terminal (self,action):
+ if (action.get_active() == True):
+ self.vboxterminal.show()
+ else:
+ self.vboxterminal.hide ()
+
+ def on_action_session(self,widget,current):
+ self.session = current.get_name()
+
+ def on_action_connect(self,action):
+ self.connect_to_device()
- return proto
+ def connect_to_device (self):
+ if (self.actiongroup_device.get_action("Dual").get_active()):
+ isdual = True
+ else:
+ isdual = False
- def get_geometry_display_selected (self):
- iter = self.combobox_geometry.get_active_iter()
- geometry = self.modelgeometry.get_value(iter,0)
+ vpaned = Gtk.VPaned()
+ vpaned.set_position (-1)
- return geometry
-
- def update_statusbar (self,dbsqlite):
- self.statusbar.push (self.context_id,dbsqlite)
+ hbox_image = Gtk.HBox(homogeneous=False,spacing=0)
+ image = Gtk.Image()
+ image.set_from_stock(Gtk.STOCK_CLOSE,Gtk.IconSize.MENU)
+ hbox_image.pack_start(image,True,False,False)
+ button_close = Gtk.Button()
+ button_close.add(hbox_image)
+ button_close.set_sensitive (True)
+ button_close.connect('clicked',self.close_page_of_notebook,vpaned)
+
+ label = Gtk.Label()
+ hbox_label = Gtk.HBox(homogeneous=False,spacing=0)
+ hbox_label.pack_start(label,False,False,1)
+ hbox_label.pack_start(button_close,True,False,0)
+
+ gvte = gevicevte.GeviceVte()
+
+ hbox_term,terminal = gvte.new_terminal (self)
+ vpaned.add1 (hbox_term)
+
+ i = self.gmodel.get_iter_selected (self.gmodel.treeview)
+ if not i["iter"]:
+ result = gevice.show_infobar_message (_("Not device selected"), Gtk.MessageType.INFO)
+ return
+ else:
+ # get data from device selected (devicename, IP)
+ data = self.gmodel.get_data_of_device_from_model(self.gmodel.treeview)
+ label.set_text(data[0])
+
+ # get name of user selected (for ssh session)
+ user = "avaldes"
+ port = 22
+
+ if (self.session == "ssh"):
+ terminal.fork_command_full (Vte.PtyFlags.DEFAULT, None,
+ [self.session,'-l',user,'-p',str(port),data[1]],
+ [], GLib.SpawnFlags.SEARCH_PATH, None, None)
+
+ if isdual:
+ hbox_term2,terminal2 = gvte.new_terminal (self)
+ vpaned.add2 (hbox_term2)
+ terminal2.fork_command_full (Vte.PtyFlags.DEFAULT, None,
+ [self.session,'-l',user,'-p',str(port),data[1]],
+ [], GLib.SpawnFlags.SEARCH_PATH, None, None)
+
+ if (self.session == "telnet"):
+ terminal.fork_command_full (Vte.PtyFlags.DEFAULT, None,
+ [self.session,'-l',user,data[1],str(port)],
+ [], GLib.SpawnFlags.SEARCH_PATH, None, None)
+
+ if isdual:
+ hbox_term2,terminal2 = gvte.new_terminal (self)
+ vpaned.add2 (hbox_term2)
+ terminal2.fork_command_full (Vte.PtyFlags.DEFAULT, None,
+ [self.session,'-l',user,data[1],str(port)],
+ [], GLib.SpawnFlags.SEARCH_PATH, None, None)
+
+ page = self.notebook.append_page(vpaned,hbox_label)
+ self.notebook.set_tab_reorderable(vpaned,True)
+ self.notebook.set_tab_detachable(vpaned,True)
+
+ hbox_label.show_all()
+ vpaned.show_all()
+ self.notebook.set_current_page(page)
+
+ def close_page_of_notebook(self,widget,vpaned):
+ page = self.notebook.page_num(vpaned)
+ self.notebook.remove_page(page)
if __name__ == "__main__":
gevice = Gevice()
diff --git a/src/gevicedatabase.py b/src/gevicedatabase.py
index 6c9c868..580b75b 100644
--- a/src/gevicedatabase.py
+++ b/src/gevicedatabase.py
@@ -1,3 +1,21 @@
+#!/usr/bin/env python
+#
+# gevice GNOME Network Device Manager.
+# Copyright (C) Alejandro Valdes Jimenez 2008 <avaldes gnome org>
+#
+# gevice.py is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# gevice.py is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program. If not, see <http://www.gnu.org/licenses/>.
+
from gi.repository import Gtk, Gdk
import os
import sqlite3
@@ -22,8 +40,8 @@ class GeviceDatabase:
gevice.connected_to_database = True
self.cur = self.conn.cursor()
- if (self.if_enable_foreign_key() == False):
- self.enable_foreign_key()
+ if (self.if_enable_foreign_key(gevice) == False):
+ self.enable_foreign_key(gevice)
self.load_data_from_database(gevice)
@@ -43,19 +61,16 @@ class GeviceDatabase:
result = gevice.show_message (_("Unable to connect to the database"), Gtk.MessageType.ERROR, (Gtk.STOCK_OK, Gtk.ResponseType.OK), None)
return False
- def enable_foreign_key (self):
+ def enable_foreign_key (self,gevice):
self.cur.execute ("PRAGMA foreign_keys = ON ")
- print "foreign_keys enabled..."
- def if_enable_foreign_key(self):
+ def if_enable_foreign_key(self,gevice):
self.cur.execute ("PRAGMA foreign_keys")
rows = self.cur.fetchall()
if (rows[0][0] == 0):
- print "foreign_keys Not enabled..."
return False
else:
- print "foreign_keys enabled..."
return True
def execute_sql_select (self,gevice,sql):
@@ -67,38 +82,14 @@ class GeviceDatabase:
result = gevice.show_message (_("Unable to execute SQL: " + sql), Gtk.MessageType.ERROR, (Gtk.STOCK_OK, Gtk.ResponseType.OK), None)
return False
- def execute_sql_insert (self,gevice,sql):
- try:
- self.cur.execute(sql)
- return True
- except:
- result = gevice.show_message (_("Unable to execute SQL: " + sql), Gtk.MessageType.ERROR, (Gtk.STOCK_OK, Gtk.ResponseType.OK), None)
- return False
-
- def execute_sql_delete (self,gevice,sql):
- try:
- self.cur.execute(sql)
- return True
- except:
- result = gevice.show_message (_("Unable to execute SQL: " + sql), Gtk.MessageType.ERROR, (Gtk.STOCK_OK, Gtk.ResponseType.OK), None)
- return False
-
- def execute_sql_update (self,gevice,sql):
- try:
- self.cur.execute(sql)
- return True
- except:
- result = gevice.show_message (_("Unable to execute SQL: " + sql), Gtk.MessageType.ERROR, (Gtk.STOCK_OK, Gtk.ResponseType.OK), None)
- return False
-
def load_data_from_database (self,gevice):
gevice.gmodel.treestore.clear()
gevice.gmodel.treeview.set_model(None)
gevice.gmodel.treeview.set_model(gevice.gmodel.treestore)
self.lserial = []
- sql = "select dispositivo.serial from dispositivo where dispositivo.serial "
- sql = sql + "not in (select serialh from conecta order by serialh)"
+ sql = "select device.id_dev from device where device.id_dev "
+ sql = sql + "not in (select id_devc from connect order by id_devc)"
rows = self.execute_sql_select(gevice,sql)
@@ -111,7 +102,7 @@ class GeviceDatabase:
token = None
for serial in self.lserial:
if (not serial == token):
- self.process_row (serial,None,0,gevice)
+ self.process_row (serial,None,gevice)
token = serial
gevice.gmodel.treeview.expand_all()
@@ -119,50 +110,37 @@ class GeviceDatabase:
gevice.actiongroup_model.set_sensitive(True)
gevice.actiongroup_device.set_sensitive (True)
- 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,os "
- sql = sql + " from todoslosdispositivos where serial='" + serial + "'"
+ def process_row (self,serial,iterp,gevice):
+ sql = "select id_dev, ip_dev from device where id_dev='" + str(serial) + "'"
row = self.execute_sql_select(gevice,sql)
if row:
itern = gevice.gmodel.treestore.append(iterp)
- iconpixbuf = gevice.arrayos[row[0][9]]
- gevice.gmodel.insert_new_item (itern,row,id_type_link,iconpixbuf)
+ gevice.gmodel.insert_new_item (itern,row,None,None)
- sql2 = "select serialh,id_tipo_enlace from conecta where serialp='" + serial + "'"
+ sql2 = "select id_devc from connect where id_devp='" + str(serial) + "'"
rows = self.execute_sql_select(gevice,sql2)
if rows:
for children in rows:
- self.process_row (children[0],itern,children[1],gevice)
+ self.process_row (children[0],itern,gevice)
def save_data_to_database (self,gevice):
- self.delete_conections(gevice)
- self.delete_devices (gevice)
+ self.execute_sql(gevice,"delete from connect")
+ self.execute_sql(gevice,"delete from device")
self.devices_to_connect = []
- # save deviceis into database
+ # save devices into database
gevice.gmodel.treestore.foreach(self.copy_device_to_dbase,gevice)
for connected in self.devices_to_connect:
- self.insert_conections(connected,gevice)
+ self.insert_connections(connected,gevice)
self.conn.commit()
def copy_device_to_dbase (self,model,path,iter,gevice):
- data = gevice.gmodel.treestore.get(
- iter,
- config.COLUMN_NAME_DEV,
- config.COLUMN_ID_MODEL_DEV,
- config.COLUMN_IP_DEV,
- config.COLUMN_SERIAL_DEV,
- config.COLUMN_OBS_DEV,
- config.COLUMN_ID_TYPE_LINK_DEV,
- config.COLUMN_ID_LOCATION_DEV,
- config.COLUMN_PTAS_DISP,
- config.COLUMN_ID_ICON)
+ data = gevice.gmodel.treestore.get(iter,0,1)
self.insert_device (data,gevice)
@@ -171,86 +149,20 @@ class GeviceDatabase:
next = iterc
while next:
- child = gevice.gmodel.treestore.get(next,config.COLUMN_SERIAL_DEV,config.COLUMN_ID_TYPE_LINK_DEV)
- self.devices_to_connect.append ("'" + data[3] + "','" + child[0] + "'" + "," + child[1])
+ child = gevice.gmodel.treestore.get(next,0)
+ self.devices_to_connect.append ("'" + data[0] + "','" + child[0] + "'")
next2 = gevice.gmodel.treestore.iter_next(next)
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,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):
- sql = "insert into conecta (serialp,serialh,id_tipo_enlace) values (" + serials + ");"
- rp = self.execute_sql_insert (gevice,sql)
-
- def delete_conections (self,gevice):
- sql = "delete from conecta"
- st = self.execute_sql_delete (gevice,sql)
-
- def delete_devices (self,gevice):
- sql = "delete from dispositivo"
- st = self.execute_sql_delete (gevice,sql)
-
- def get_list_of_models (self,gevice):
- liststore = Gtk.ListStore(str,int)
-
- sql = "select nom_tipo_disp || ' ' || nom_marca || ' ' || nom_modelo,modelo.id_modelo "
- sql = sql + "from modelo inner join tipo_disp on modelo.id_tipo_disp = tipo_disp.id_tipo_disp "
- sql = sql + "inner join marca on modelo.id_marca = marca.id_marca order by "
- sql = sql + "nom_tipo_disp,nom_marca,nom_modelo"
-
- rows = self.execute_sql_select(gevice,sql)
-
- if rows:
- for row in rows:
- iter = liststore.append ()
- liststore.set_value (iter, config.COLUMN_NAME_MODEL_DEV2,str(row[0]))
- liststore.set_value (iter, config.COLUMN_ID_MODEL_DEV2,int(row[1]))
-
- return liststore
- else:
- return False
-
- def get_list_of_links (self,gevice):
- liststore = Gtk.ListStore(str,int)
-
- sql = "select nom_tipo_enlace,id_tipo_enlace from tipo_enlace"
-
- rows = self.execute_sql_select(gevice,sql)
-
- if rows:
- for row in rows:
- iter = liststore.append ()
- liststore.set_value (iter,config.COLUMN_NAME_TYPE_LINK_DEV2,str(row[0]))
- liststore.set_value (iter,config.COLUMN_ID_TYPE_LINK_DEV2,int(row[1]))
-
- return liststore
- else:
- return False
-
- def get_list_of_location (self,gevice):
- liststore = Gtk.ListStore(str,int)
-
- sql = "select '[' || campus.nom_campus || '][' || edificio.nom_edif || '][' || nivel.nom_nivel || '][' || rack.detalle || ']' as location, rack.id_rack "
- sql = sql + "from rack "
- sql = sql + "join edificio on rack.id_edif = edificio.id_edif "
- sql = sql + "join nivel on rack.id_nivel = nivel.id_nivel "
- sql = sql + "join campus on edificio.id_campus = campus.id_campus "
- sql = sql + "order by campus.nom_campus,edificio.nom_edif,nivel.nom_nivel "
+ def insert_device (self,data,gevice):
+ sql = "insert into device (id_dev,ip_dev) "
+ sql = sql + "values ('" + data[0] + "','" + data[1] + "');"
+ st = self.execute_sql(gevice,sql)
+ print st
- rows = self.execute_sql_select(gevice,sql)
-
- if rows:
- for row in rows:
- iter = liststore.append ()
- liststore.set_value (iter,config.COLUMN_LOCATION_DEV2,str(row[0]))
- liststore.set_value (iter,config.COLUMN_ID_LOCATION_DEV2,int(row[1]))
-
- return liststore
- else:
- return False
+ def insert_connections (self,serials,gevice):
+ sql = "insert into connect (id_devp,id_devc) values (" + serials + ");"
+ self.execute_sql (gevice,sql)
def get_list_of_data (self,gevice,sql):
liststore = Gtk.ListStore(str,int)
@@ -266,3 +178,11 @@ class GeviceDatabase:
return liststore
else:
return False
+
+ def execute_sql (self,gevice,sql):
+ try:
+ self.cur.execute(sql)
+ return True
+ except:
+ result = gevice.show_message (_("Unable to execute SQL: " + sql), Gtk.MessageType.ERROR, (Gtk.STOCK_OK, Gtk.ResponseType.OK), None)
+ return False
diff --git a/src/gevicedevice.py b/src/gevicedevice.py
index 259aa00..00e6ec6 100644
--- a/src/gevicedevice.py
+++ b/src/gevicedevice.py
@@ -1,8 +1,24 @@
+#!/usr/bin/env python
+#
+# gevice GNOME Network Device Manager.
+# Copyright (C) Alejandro Valdes Jimenez 2008 <avaldes gnome org>
+#
+# gevice.py is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# gevice.py is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program. If not, see <http://www.gnu.org/licenses/>.
+
from gi.repository import Gtk
import os
-
import config
-
import gettext
gettext.bindtextdomain(config.PACKAGE,config.LOCALEDIR)
gettext.textdomain(config.PACKAGE)
@@ -12,115 +28,23 @@ from gettext import gettext as _
class GeviceDevice:
def __init__ (self):
self.action = "add"
- self.exists_serial = False
- self.exists_serial_name = ""
-
- self.window_device = None
- self.entry_name_device = None
- self.entry_ip_device = None
- self.entry_comment_device = None
- self.entry_serial_device = None
- self.entry_ports = None
- self.combo_link = None
- self.combo_model = None
- self.combo_location = None
- self.button_cancel_device = None
- self.button_accept_device = None
def add_device (self):
self.action = "add"
-
- self.entry_serial_device.set_sensitive (True)
-
- self.entry_name_device.set_text("")
+ self.entry_name_device.set_text(_("NoName"))
self.entry_ip_device.set_text("127.0.0.1")
- self.entry_serial_device.set_text("")
- self.entry_ports.set_text("")
- self.entry_comment_device.set_text("")
- 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):
- self.action = "mod"
-
- self.entry_serial_device.set_sensitive (False)
-
- self.index_combo = 0
- self.index_link = 0
- self.index_location = 0
- self.index_icon = 0
-
+ self.action = "mod"
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)
-
- links = gevice.gdbase.get_list_of_links (gevice)
- links.foreach (self.get_index_combo_link,gevice)
-
- 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)
- self.entry_ip_device.set_text(data[2])
- self.entry_serial_device.set_text(data[3])
- self.entry_comment_device.set_text(data[4])
- 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.entry_ip_device.set_text(data[1])
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,
- config.COLUMN_ID_MODEL_DEV2)
-
- if (int(data[0]) == int(self.id_model)):
- return True
-
- self.index_combo = self.index_combo + 1
-
- def get_index_combo_link (self,model,path,iter,gevice):
- data = model.get (iter,
- config.COLUMN_ID_TYPE_LINK_DEV2)
-
- if (int(data[0]) == int(self.id_link)):
- return True
-
- self.index_link = self.index_link + 1
-
- def get_index_combo_location (self,model,path,iter,gevice):
- data = model.get (iter,
- config.COLUMN_ID_LOCATION_DEV2)
-
- if (int(data[0]) == int(self.id_location)):
- return True
-
- self.index_location = self.index_location + 1
-
def remove_device (self,gevice):
self.action = "del"
-
data = gevice.gmodel.get_data_of_device_from_model(gevice.gmodel.treeview)
result = gevice.show_message (_("Do you want to remove: ") + data[0],
@@ -139,13 +63,6 @@ class GeviceDevice:
self.window_device = builder.get_object ("window_device")
self.entry_name_device = builder.get_object ("entry_name_device")
self.entry_ip_device = builder.get_object ("entry_ip_device")
- self.entry_comment_device = builder.get_object ("entry_comment_device")
- self.entry_serial_device = builder.get_object ("entry_serial_device")
- self.entry_ports = builder.get_object ("entry_ports")
- 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")
@@ -154,29 +71,6 @@ class GeviceDevice:
self.button_cancel_device.connect ("clicked",self.on_button_cancel_device_clicked)
self.button_accept_device.connect ("clicked",self.on_button_accept_device_clicked,gevice)
- cell = Gtk.CellRendererText()
- self.combo_model.pack_start(cell,True)
- self.combo_model.add_attribute(cell, 'text', 0)
- gevice.list_models = gevice.gdbase.get_list_of_models (gevice)
- self.combo_model.set_model (gevice.list_models)
-
- cell = Gtk.CellRendererText()
- self.combo_link.pack_start(cell,True)
- self.combo_link.add_attribute(cell, 'text', 0)
- gevice.list_links = gevice.gdbase.get_list_of_links (gevice)
- self.combo_link.set_model (gevice.list_links)
-
- cell = Gtk.CellRendererText()
- self.combo_location.pack_start(cell,True)
- 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 ()
@@ -189,68 +83,20 @@ class GeviceDevice:
def on_window_device_delete_event (self,window,event):
self.close_window (window)
- def verify_serial(self,model,path,iter,serial):
- data = model.get(
- iter,
- config.COLUMN_NAME_DEV,
- config.COLUMN_ID_MODEL_DEV,
- config.COLUMN_IP_DEV,
- config.COLUMN_SERIAL_DEV,
- config.COLUMN_OBS_DEV,
- config.COLUMN_ID_TYPE_LINK_DEV)
-
- if (serial.strip() == data[3].strip()):
- self.exists_serial = True
- self.exists_serial_name = data[0]
- return
-
def on_button_accept_device_clicked (self,button,gevice):
alldata = True
- serial = self.entry_serial_device.get_text()
name = self.entry_name_device.get_text()
ip = self.entry_ip_device.get_text()
- comment = self.entry_comment_device.get_text()
- ports = self.entry_ports.get_text()
if (not name.strip()):
alldata = False
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)
- 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)
-
if alldata:
- 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)
if self.action == "add":
@@ -258,20 +104,8 @@ class GeviceDevice:
else:
newiter = i["iter"]
- gevice.gmodel.treestore.set_value (newiter, config.COLUMN_NAME_DEV,str(name.strip()))
- gevice.gmodel.treestore.set_value (newiter, config.COLUMN_ID_MODEL_DEV,str(id_model))
- gevice.gmodel.treestore.set_value (newiter, config.COLUMN_NAME_MODEL_DEV,str(name_model))
- gevice.gmodel.treestore.set_value (newiter, config.COLUMN_IP_DEV,str(ip))
- gevice.gmodel.treestore.set_value (newiter, config.COLUMN_SERIAL_DEV,str(serial))
- gevice.gmodel.treestore.set_value (newiter, config.COLUMN_OBS_DEV,str(comment))
- gevice.gmodel.treestore.set_value (newiter, config.COLUMN_LOCATION,str(name_location))
- 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))
+ gevice.gmodel.treestore.set_value (newiter,0,str(name.strip()))
+ gevice.gmodel.treestore.set_value (newiter,1,str(ip))
if i["path"]:
gevice.gmodel.treeview.expand_to_path(i["path"][0])
diff --git a/src/gevicediagram.py b/src/gevicediagram.py
index ffe753b..e1258a3 100644
--- a/src/gevicediagram.py
+++ b/src/gevicediagram.py
@@ -1,3 +1,21 @@
+#!/usr/bin/env python
+#
+# gevice GNOME Network Device Manager.
+# Copyright (C) Alejandro Valdes Jimenez 2008 <avaldes gnome org>
+#
+# gevice.py is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# gevice.py is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program. If not, see <http://www.gnu.org/licenses/>.
+
from gi.repository import Gtk
import os
from pygraphviz import *
diff --git a/src/geviceexport.py b/src/geviceexport.py
index 5955d08..5b43297 100644
--- a/src/geviceexport.py
+++ b/src/geviceexport.py
@@ -1,3 +1,21 @@
+#!/usr/bin/env python
+#
+# gevice GNOME Network Device Manager.
+# Copyright (C) Alejandro Valdes Jimenez 2008 <avaldes gnome org>
+#
+# gevice.py is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# gevice.py is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program. If not, see <http://www.gnu.org/licenses/>.
+
from gi.repository import Gtk
import os
diff --git a/src/gevicefind.py b/src/gevicefind.py
index 76f9797..758d6f2 100644
--- a/src/gevicefind.py
+++ b/src/gevicefind.py
@@ -1,3 +1,21 @@
+#!/usr/bin/env python
+#
+# gevice GNOME Network Device Manager.
+# Copyright (C) Alejandro Valdes Jimenez 2008 <avaldes gnome org>
+#
+# gevice.py is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# gevice.py is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program. If not, see <http://www.gnu.org/licenses/>.
+
from gi.repository import Gtk, Gdk
import os
diff --git a/src/gevicemaintainer.py b/src/gevicemaintainer.py
index a28865b..829d9ab 100644
--- a/src/gevicemaintainer.py
+++ b/src/gevicemaintainer.py
@@ -1,3 +1,21 @@
+#!/usr/bin/env python
+#
+# gevice GNOME Network Device Manager.
+# Copyright (C) Alejandro Valdes Jimenez 2008 <avaldes gnome org>
+#
+# gevice.py is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# gevice.py is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program. If not, see <http://www.gnu.org/licenses/>.
+
from gi.repository import Gtk
import os
diff --git a/src/gevicemodel.py b/src/gevicemodel.py
index 741dbc2..63afaca 100644
--- a/src/gevicemodel.py
+++ b/src/gevicemodel.py
@@ -1,3 +1,21 @@
+#!/usr/bin/env python
+#
+# gevice GNOME Network Device Manager.
+# Copyright (C) Alejandro Valdes Jimenez 2008 <avaldes gnome org>
+#
+# gevice.py is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# gevice.py is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program. If not, see <http://www.gnu.org/licenses/>.
+
from gi.repository import Gtk, GdkPixbuf
import os
import os.path
@@ -12,7 +30,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,GdkPixbuf.Pixbuf,str)
+ self.treestore = Gtk.TreeStore(str,str)
self.treeview = Gtk.TreeView (model=self.treestore)
self.treeview.set_rules_hint (True)
@@ -22,58 +40,16 @@ class GeviceModel:
col = Gtk.TreeViewColumn (_("Device"))
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,False)
- col.add_attribute (cell,"text",config.COLUMN_NAME_DEV)
-
-
- ############
- col = Gtk.TreeViewColumn (_("Model"))
- col.set_resizable (True)
- self.treeview.append_column (col)
- cell = Gtk.CellRendererText()
- col.pack_start (cell,True)
- col.add_attribute (cell,"text",config.COLUMN_NAME_MODEL_DEV)
-
- col = Gtk.TreeViewColumn (_("IP"))
- col.set_resizable (True)
- self.treeview.append_column (col)
- cell = Gtk.CellRendererText()
- col.pack_start (cell,True)
- col.add_attribute (cell,"text",config.COLUMN_IP_DEV)
-
- col = Gtk.TreeViewColumn (_("Serial"))
- col.set_resizable (True)
- self.treeview.append_column (col)
- cell = Gtk.CellRendererText()
- col.pack_start (cell,True)
- col.add_attribute (cell,"text",config.COLUMN_SERIAL_DEV)
-
- col = Gtk.TreeViewColumn (_("Comments"))
+ col.add_attribute (cell,"text",0)
+
+ col = Gtk.TreeViewColumn (_("IP Address"))
col.set_resizable (True)
self.treeview.append_column (col)
cell = Gtk.CellRendererText()
- col.pack_start (cell,True)
- col.add_attribute (cell,"text",config.COLUMN_OBS_DEV)
-
- col = Gtk.TreeViewColumn (_("Location"))
- col.set_resizable (True)
- self.treeview.append_column (col)
- cell = Gtk.CellRendererText()
- col.pack_start (cell,True)
- col.add_attribute (cell,"text",config.COLUMN_LOCATION)
-
- col = Gtk.TreeViewColumn (_("Ports Availables"))
- col.set_resizable (True)
- self.treeview.append_column (col)
- cell = Gtk.CellRendererText()
- col.pack_start (cell,True)
- col.add_attribute (cell,"text",config.COLUMN_PTAS_DISP)
+ col.pack_start (cell,False)
+ col.add_attribute (cell,"text",1)
selection = self.treeview.get_selection()
selection.connect ("changed",self.on_device_selection_changed,gevice)
@@ -81,18 +57,9 @@ class GeviceModel:
return
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]))
- self.treestore.set_value (newiter, config.COLUMN_IP_DEV, str(row[0][3]))
- self.treestore.set_value (newiter, config.COLUMN_SERIAL_DEV, str(row[0][4]))
- self.treestore.set_value (newiter, config.COLUMN_OBS_DEV, str(row[0][5]))
- self.treestore.set_value (newiter, config.COLUMN_LOCATION, str(row[0][6]))
- 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]))
+ self.treestore.set_value (newiter,0,str(row[0][0]))
+ self.treestore.set_value (newiter,1,str(row[0][1]))
+
def on_device_selection_changed (self,selection,gevice):
model,iter = selection.get_selected()
@@ -105,26 +72,13 @@ class GeviceModel:
def get_iter_selected (self,treeview):
treeselection = treeview.get_selection()
model,iter = treeselection.get_selected()
-
model,path = treeselection.get_selected_rows()
selected = {"iter":iter,"path":path,"model":model}
-
return selected
def get_data_of_device_from_model(self,treeview):
i = self.get_iter_selected (treeview)
-
- data = i["model"].get(i["iter"],
- config.COLUMN_NAME_DEV,
- config.COLUMN_ID_MODEL_DEV,
- config.COLUMN_IP_DEV,
- config.COLUMN_SERIAL_DEV,
- config.COLUMN_OBS_DEV,
- config.COLUMN_ID_TYPE_LINK_DEV,
- config.COLUMN_ID_LOCATION_DEV,
- config.COLUMN_PTAS_DISP,
- config.COLUMN_ID_ICON)
-
+ data = i["model"].get(i["iter"],0,1)
return data
def get_model_from_device (self,treestore,path,iter):
@@ -187,12 +141,3 @@ class GeviceModel:
iter = links.iter_next(iter)
return None,None
-
- def expand_treeview (self,flag):
- seleccion,iterador = self.treeview.get_selection().get_selected()
- path = self.treestore.get_path(iterador)
-
- if flag:
- self.treeview.expand_row(path,True)
- else:
- self.treeview.collapse_row(path)
diff --git a/src/geviceprefer.py b/src/geviceprefer.py
index 47a0877..cd43b01 100644
--- a/src/geviceprefer.py
+++ b/src/geviceprefer.py
@@ -1,3 +1,21 @@
+#!/usr/bin/env python
+#
+# gevice GNOME Network Device Manager.
+# Copyright (C) Alejandro Valdes Jimenez 2008 <avaldes gnome org>
+#
+# gevice.py is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# gevice.py is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program. If not, see <http://www.gnu.org/licenses/>.
+
from gi.repository import Gtk, Gdk, Gio
import os
diff --git a/src/gevicevte.py b/src/gevicevte.py
index d82ad05..98d464a 100644
--- a/src/gevicevte.py
+++ b/src/gevicevte.py
@@ -1,5 +1,22 @@
-from gi.repository import Gtk, Vte, Gdk
+#!/usr/bin/env python
+#
+# gevice GNOME Network Device Manager.
+# Copyright (C) Alejandro Valdes Jimenez 2008 <avaldes gnome org>
+#
+# gevice.py is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# gevice.py is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program. If not, see <http://www.gnu.org/licenses/>.
+from gi.repository import Gtk, Vte, Gdk
import config
import gettext
@@ -23,11 +40,11 @@ class GeviceVte:
terminal.set_mouse_autohide(True)
terminal.set_default_colors()
- bgcolor = Gdk.color_parse(gevice.gpref.settings.get_string("backcolor"))
- terminal.set_color_background(bgcolor)
+ ###bgcolor = Gdk.color_parse(gevice.gpref.settings.get_string("backcolor"))
+ ###terminal.set_color_background(bgcolor)
- fgcolor = Gdk.color_parse(gevice.gpref.settings.get_string("forecolor"))
- terminal.set_color_foreground(fgcolor)
+ ###fgcolor = Gdk.color_parse(gevice.gpref.settings.get_string("forecolor"))
+ ###terminal.set_color_foreground(fgcolor)
terminal.set_size_request(10,10)
terminal.set_size (30,1)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]