[gevice] Uses new Gtk.FileChooserDialog().



commit e3fbb06aa6c8e1f912c51d6ad28f14ab8cc9bc68
Author: Alejandro Valdes Jimenez <avaldes gnome org>
Date:   Tue Oct 4 12:20:38 2011 -0300

    Uses new  Gtk.FileChooserDialog().

 ChangeLog           |    4 ++++
 src/gevice.py       |   11 ++---------
 src/geviceexport.py |   29 ++++++++++++++++-------------
 3 files changed, 22 insertions(+), 22 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 8d51660..152ab4d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,8 @@
 2011-10-04  Alejandro Valdes Jimenez  <avaldes gnome org>
+	* src/gevice.py:
+	* src/geviceexport.py: load_interface(). Uses new  Gtk.FileChooserDialog().
+
+2011-10-04  Alejandro Valdes Jimenez  <avaldes gnome org>
 	* src/gevice.py: 
 		* show_message(). Add new parameter "window". This indicate the father window where show the message
 		* on_action_save(). rewritten.
diff --git a/src/gevice.py b/src/gevice.py
index 4cb82c7..60dff06 100755
--- a/src/gevice.py
+++ b/src/gevice.py
@@ -31,7 +31,7 @@ import gevicevte
 import gevicedevice
 import gevicemodel
 import gevicedatabase
-#import geviceexport
+import geviceexport
 #import gevicemaintainer
 
 
@@ -439,7 +439,7 @@ class Gevice:
     dialogmaintainer.load_data (gevice,sql)
     dialogmaintainer.show_interface ()
   
-  def on_action_export (gevice,action):
+  def on_action_export (gevice,action,data):
     dialogexport = geviceexport.GeviceExport ()
     dialogexport.load_interface (gevice)
     dialogexport.save_file (gevice)
@@ -528,15 +528,8 @@ class Gevice:
     gevice.connected_to_database = False
     
   def on_action_save (gevice,action,data):
-    #print gevice.gdbase.cur
     gevice.gdbase.save_data_to_database(gevice)
     result = gevice.show_message (_("Model saved"),None,(Gtk.STOCK_OK, Gtk.ResponseType.OK),None)
-    #gevice.gdbase = gevicedatabase.GeviceDatabase ()
-    #gevice.gdbase.load_interface (gevice,"save")
-    #gevice.gdbase.label_host.set_text (gevice.gpref.host)
-    #gevice.gdbase.label_dbase.set_text (gevice.gpref.dbase)
-    #gevice.gdbase.label_user_dbase.set_text (gevice.gpref.user_dbase)
-    #gevice.gdbase.show_interface()
     
   def on_action_connect(self,action,data):
     flag = True
diff --git a/src/geviceexport.py b/src/geviceexport.py
index db78146..6fafb7f 100644
--- a/src/geviceexport.py
+++ b/src/geviceexport.py
@@ -1,11 +1,11 @@
-import pygtk
-pygtk.require('2.0')
+from gi.repository import Gtk
+
 import os
-import gtk
 
 import gettext
 gettext.textdomain("gevice")
 from gettext import gettext as _
+
 import config
 
 class GeviceExport:
@@ -15,16 +15,19 @@ class GeviceExport:
         self.filename = ""
     
     def load_interface (self,gevice):
-        filechooser = gtk.FileChooserDialog(_("Save file as"), 
-        None, 
-        gtk.FILE_CHOOSER_ACTION_SAVE,
-        (gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT,
-        gtk.STOCK_OK, gtk.RESPONSE_ACCEPT))
+	filechooser = Gtk.FileChooserDialog(title=_("Save file as"), 
+	  parent=gevice.window_main, 
+	  action=Gtk.FileChooserAction.SAVE,
+	  buttons=(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, Gtk.STOCK_SAVE, Gtk.ResponseType.ACCEPT))
+	
+	filechooser.set_select_multiple(False)
+	
+	response = filechooser.run()
+	
+	if response == Gtk.ResponseType.ACCEPT:
+	  self.filename = filechooser.get_filename()
 
-        filechooser.set_select_multiple(False)
-        responce = filechooser.run()
-        self.filename = filechooser.get_filename()
-        filechooser.destroy()
+	filechooser.destroy()
 
     def save_file (self,gevice):
         if self.filename:
@@ -37,7 +40,7 @@ class GeviceExport:
                 	self.get_all_data_from_view (gevice,FILE)
                 	FILE.close()
             except:
-            	result = gevice.show_message (_("Can not write to file"),gtk.MESSAGE_ERROR,gtk.BUTTONS_OK)
+		result = gevice.show_message (_("Can not write to file"),None,(Gtk.STOCK_OK, Gtk.ResponseType.OK),self.window_database)
 
     def get_all_data_from_view (self,gevice,FILE):
         #sql = "select nom_tipo_disp,nom_marca,nom_modelo,nom_tipo_disp || ' ' || nom_marca || ' ' || nom_modelo,count(nom_tipo_disp) "



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