diff Gtk/gui.py @ 21:f7e0cc58737f

Default interface in readFile method
author Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
date Sun, 14 Sep 2014 17:23:02 +0200
parents 60bc5117926c
children 7bd4ca56607d
line wrap: on
line diff
--- a/Gtk/gui.py	Thu Sep 11 19:03:07 2014 +0200
+++ b/Gtk/gui.py	Sun Sep 14 17:23:02 2014 +0200
@@ -569,7 +569,11 @@
         filetype: Read. budget, basedata or durus
     Methods:
         run
-        progress
+        readFile_progress
+        readFile_send_message
+        readFile_set_statistics
+        readFile_end
+        readFile_cancel
         stopLoading
         threadFinishedSignal
         threadCanceled
@@ -597,6 +601,7 @@
         self.__filetype: "budget", "database" or "durus"
         self.__children: the read thread
         self.__progress: 0 to 1 progress
+        self.__statistics: record statistics
         self.__widget: main widget, a gtk.VBox object
         self.__main_item: None
         self.__throbber: a gtk.Image
@@ -617,6 +622,7 @@
         self.__children = None
         self.__cancel = [False, False]
         self.__progress = 0.0
+        self.__statistics = None
         self.__widget = gtk.VBox()
         self.__main_item = None
         self.__widget.show()
@@ -658,8 +664,7 @@
         _progressframe.set_shadow_type(gtk.SHADOW_IN)
         _progressframe.show()
         self.__progress_bar = gtk.ProgressBar()
-        #if self.__filetype != "durus":
-        #    self.__progress_bar.show()
+        self.__progress_bar.show()
         _progressframe.add(self.__progress_bar)
         self.__statusbar.pack_start(_progressframe, False, False, 0)
         self.__widget.pack_end(self.__statusbar, False, True, 0)
@@ -675,8 +680,8 @@
         self._launchChildren()
         self._launchTimeout()
 
-    def progress(self, percent):
-        """progress(percent)
+    def readFile_progress(self, percent):
+        """readFile_progress(percent)
         
         percent: Percentage executed.
         
@@ -685,6 +690,38 @@
         _progress = str(int(round(100 * percent,0)))
         self.__progress = percent
 
+    def readFile_send_message(self, message):
+        """readFile_send_message(message)
+        
+        message: mesage from readFile method
+        
+        print message
+        """
+        print message
+
+    def readFile_set_statistics(self, statistics):
+        """readFile_set_statistics(statistics)
+        
+        statistics: record statistics from readFile method
+        
+        sets record statistics
+        """
+        self.__statistics = statistics
+
+    def readFile_end(self):
+        """readFile_end()
+        
+        The readFile method end successfully
+        """
+        print self.__statistics
+
+    def readFile_cancel(self):
+        """readFile_cancel()
+        
+        The readFile method is canceled
+        """
+        print _("Process terminated")
+
     def stopLoading(self):
         """stopLoading()
         
@@ -714,11 +751,9 @@
             3- If the other timetouts are stoped the window is closed
         """
         gobject.timeout_add(1000, self._updateLabel, time.time())
-        #if self.__filetype != "durus":
-        #    gobject.timeout_add(500, self._updateProgressBar)
-        #    self.__cancel = [False, False]
-        #else:
-        self.__cancel = [True, False]
+        gobject.timeout_add(500, self._updateProgressBar)
+        self.__cancel = [False, False]
+        #self.__cancel = [True, False]
         gobject.timeout_add(1000, self._autoClose)
 
     def _updateProgressBar(self):