changeset 16:60bc5117926c

no durus
author Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
date Fri, 19 Apr 2013 00:04:20 +0200
parents 2a13413dcc13
children a7b9f7e7dfa4
files Generic/__init__.py Generic/globalVars.py Gtk/gui.py Gtk/importFiebdc.py
diffstat 4 files changed, 84 insertions(+), 83 deletions(-) [+]
line wrap: on
line diff
--- a/Generic/__init__.py	Sun Jan 02 10:27:16 2011 +0100
+++ b/Generic/__init__.py	Fri Apr 19 00:04:20 2013 +0200
@@ -23,7 +23,7 @@
 __all__ = [
     'base',
     'config',
-    'durusdatabase',
+    #'durusdatabase',
     'fiebdc',
     'globalVars',
     'openwith',
--- a/Generic/globalVars.py	Sun Jan 02 10:27:16 2011 +0100
+++ b/Generic/globalVars.py	Fri Apr 19 00:04:20 2013 +0200
@@ -24,14 +24,14 @@
 import sys
 
 version = "pyArq Presupuestos v0.0.0"
-changeset = 10
+changeset = 11
 baseversion = 0
 
 # path: Paths where find the program files needed
 path = {
     "HOME" : "",
     "APPDATA" : "",
-    "DURUS-DATABASE": "/pyArq-Presupuestos/durus/",
+    #"DURUS-DATABASE": "/pyArq-Presupuestos/durus/",
     "BUDGET": "/pyArq-Presupuestos/budget/",
     "ICON" : "/images/pyArq-Presupuestos.png",
     "CHAPTER-ICON" : "/images/chapter.png",
--- a/Gtk/gui.py	Sun Jan 02 10:27:16 2011 +0100
+++ b/Gtk/gui.py	Fri Apr 19 00:04:20 2013 +0200
@@ -55,7 +55,7 @@
 from Gtk import importFiebdc
 from Generic import base
 from Generic import fiebdc
-from Generic import durusdatabase
+#from Generic import durusdatabase
 from Generic import utils
 from Generic import globalVars
 from Generic import openwith
@@ -118,10 +118,6 @@
         <menuitem action="GoUp"/>
         <menuitem action="GoToRoot"/>
       </menu>
-      <menu action="Test">
-        <menuitem action="ImportFiebdcPriceDatabase"/>
-        <menuitem action="OpenPriceDatabase"/>
-      </menu>
     </menubar>
     <toolbar name="ToolBar">
       <toolitem action="ImportFiebdc"/>
@@ -134,6 +130,11 @@
     </toolbar>
     </ui>'''
 
+    #<menu action="Test">
+    #  <menuitem action="ImportFiebdcPriceDatabase"/>
+    #  <menuitem action="OpenPriceDatabase"/>
+    #</menu>
+
     def __init__(self):
         """__init__()
         
@@ -173,11 +174,11 @@
              ("View", None, _("_View")),
              ("Go", None, _("_Go")),
              ("Test", None, _("_Test")),
-             ('ImportFiebdcPriceDatabase', gtk.STOCK_OPEN,
-                _("Import Fiebdc _price database"), "", _("Import database"),
-                self._menuitemImportPriceDatabase ),
-             ("OpenPriceDatabase", gtk.STOCK_OPEN, _('_Open price database'),
-                "", _('Open Database'), self._menuitemOpenPriceDatabase),
+             #('ImportFiebdcPriceDatabase', gtk.STOCK_OPEN,
+             #   _("Import Fiebdc _price database"), "", _("Import database"),
+             #   self._menuitemImportPriceDatabase ),
+             #("OpenPriceDatabase", gtk.STOCK_OPEN, _('_Open price database'),
+             #   "", _('Open Database'), self._menuitemOpenPriceDatabase),
             ])
         self.__navigation_action_group = gtk.ActionGroup("Navigation")
         self.__navigation_action_group.add_actions(
@@ -373,40 +374,40 @@
         _file_window = importFiebdc.FileSelectionWindow(self,
             _read_method, _budget, _filename, _exit_method, _filetype)
 
-    def _menuitemImportPriceDatabase(self, widget):
-        """_menuitemImportPriceDatabase(widget)
-        
-        widget: the widget where the event is emitted from
-        Callback to open a price database file.
-        
-        Creates and shows a file selection window to open a price database
-        file.
-        """
-        _budget = base.Budget()
-        _budget_file = fiebdc.Read()
-        _read_method = _budget_file.readFile
-        _filename = "file"
-        _filetype = "database"
-        _exit_method = _budget_file.cancel
-        _file_window = importFiebdc.FileSelectionWindow(self,
-            _read_method, _budget, _filename, _exit_method, _filetype)
-
-    def _menuitemOpenPriceDatabase(self, widget):
-        """_menuitemOpenPriceDatabase(widget)
-        
-        widget: the widget where the event is emitted from
-        Callback to open a price database from a durus file.
-        
-        Creates and shows a file selection window to open a durus database
-        """
-        _budget = None
-        _budget_file = durusdatabase.Read()
-        _read_method = _budget_file.readFile
-        _filename = "file"
-        _filetype = "durus"
-        _exit_method = _budget_file.cancel
-        _file_window = importFiebdc.FileSelectionWindow(self,
-            _read_method, _budget, _filename, _exit_method, _filetype)
+    #def _menuitemImportPriceDatabase(self, widget):
+    #    """_menuitemImportPriceDatabase(widget)
+    #    
+    #    widget: the widget where the event is emitted from
+    #    Callback to open a price database file.
+    #    
+    #    Creates and shows a file selection window to open a price database
+    #    file.
+    #    """
+    #    _budget = base.Budget()
+    #    _budget_file = fiebdc.Read()
+    #    _read_method = _budget_file.readFile
+    #    _filename = "file"
+    #    _filetype = "database"
+    #    _exit_method = _budget_file.cancel
+    #    _file_window = importFiebdc.FileSelectionWindow(self,
+    #        _read_method, _budget, _filename, _exit_method, _filetype)
+
+    #def _menuitemOpenPriceDatabase(self, widget):
+    #    """_menuitemOpenPriceDatabase(widget)
+    #    
+    #    widget: the widget where the event is emitted from
+    #    Callback to open a price database from a durus file.
+    #    
+    #    Creates and shows a file selection window to open a durus database
+    #    """
+    #    _budget = None
+    #    _budget_file = durusdatabase.Read()
+    #    _read_method = _budget_file.readFile
+    #    _filename = "file"
+    #    _filetype = "durus"
+    #    _exit_method = _budget_file.cancel
+    #    _file_window = importFiebdc.FileSelectionWindow(self,
+    #        _read_method, _budget, _filename, _exit_method, _filetype)
 
     def _menuitemClose(self, widget):
         """_menuitemClose(widget)
@@ -418,11 +419,11 @@
         _page_num = self.__notebook.get_current_page()
         if _page_num != -1:
             _page = self.__page_list[_page_num]
-            if isinstance(_page, EmptyPage) and _page.filetype == "durus":
-                print _("Cancel reading Durus database has not been "
-                        "implemented.")
-            else:
-                _page.close()
+            #if isinstance(_page, EmptyPage) and _page.filetype == "durus":
+            #    print _("Cancel reading Durus database has not been "
+            #            "implemented.")
+            #else:
+            _page.close()
 
     def closePage(self, page):
         """closePage(page)
@@ -657,8 +658,8 @@
         _progressframe.set_shadow_type(gtk.SHADOW_IN)
         _progressframe.show()
         self.__progress_bar = gtk.ProgressBar()
-        if self.__filetype != "durus":
-            self.__progress_bar.show()
+        #if self.__filetype != "durus":
+        #    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)
@@ -713,11 +714,11 @@
             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]
+        #if self.__filetype != "durus":
+        #    gobject.timeout_add(500, self._updateProgressBar)
+        #    self.__cancel = [False, False]
+        #else:
+        self.__cancel = [True, False]
         gobject.timeout_add(1000, self._autoClose)
 
     def _updateProgressBar(self):
--- a/Gtk/importFiebdc.py	Sun Jan 02 10:27:16 2011 +0100
+++ b/Gtk/importFiebdc.py	Fri Apr 19 00:04:20 2013 +0200
@@ -33,7 +33,7 @@
 # pyArq-Presupuestos Modules
 from Generic import utils
 from Generic import globalVars
-from Generic import durusdatabase
+#from Generic import durusdatabase
 import gui
 
 class FileSelectionWindow(object):
@@ -93,11 +93,11 @@
             buttons=(gtk.STOCK_CANCEL,gtk.RESPONSE_CANCEL,
                      gtk.STOCK_OPEN,gtk.RESPONSE_OK))
         self.__window.set_default_response(gtk.RESPONSE_OK)
-        if self.__filetype == "budget" or self.__filetype == "database":
-            self.__window.set_current_folder(globalVars.getHomePath("BUDGET"))
-        else: # "durus"
-            self.__window.set_current_folder(
-                globalVars.getHomePath("DURUS-DATABASE"))
+        #if self.__filetype == "budget" or self.__filetype == "database":
+        self.__window.set_current_folder(globalVars.getHomePath("BUDGET"))
+        #else: # "durus"
+        #    self.__window.set_current_folder(
+        #        globalVars.getHomePath("DURUS-DATABASE"))
         if self.__window.run() == gtk.RESPONSE_OK:
             self._openFile(self.__window.get_filename())
         self.__window.destroy()
@@ -133,8 +133,8 @@
         if (self.__filetype == "budget" or self.__filetype == "database") and \
             _filename_ext != "bc3" and _filename_ext != "BC3":
             print _("The file must have 'bc3' extension")
-        elif self.__filetype == "durus" and _filename_ext != "durus":
-            print _("The file must have 'durus' extension")
+        #elif self.__filetype == "durus" and _filename_ext != "durus":
+        #    print _("The file must have 'durus' extension")
         else:
             self.__window.destroy()
             # TODO: the file exits? is it not binary?, can it be readed?
@@ -423,23 +423,23 @@
         else:
             _mainWindow = self.__mainWindow
             self.__page.threadFinishedSignal(_budget)
-            if self.__filetype == "database":
-                self.saveDurusDatabase()
+            #if self.__filetype == "database":
+            #    self.saveDurusDatabase()
         self.clear()
         
-    def saveDurusDatabase(self):
-        _path = globalVars.getHomePath("DURUS-DATABASE")
-        _file_whit_path_bc3 = self.__budget.filename
-        _filename_bc3 = _file_whit_path_bc3.split("/")[-1]
-        _filename = _filename_bc3.split(".")[-2]
-        _file = _path + _filename + ".durus"
-        print utils.mapping(_("Saving file: $1"), (_file,))
-        _time = time.time()
-        _durus_file = durusdatabase.DurusFile(_file,True)
-        _durus_file.setBudget(self.__budget)
-        _durus_file.close()
-        print utils.mapping(_("Saving time: $1 seconds"),
-              (("%.2f" %(time.time()-_time) ),))
+    #def saveDurusDatabase(self):
+    #    _path = globalVars.getHomePath("DURUS-DATABASE")
+    #    _file_whit_path_bc3 = self.__budget.filename
+    #    _filename_bc3 = _file_whit_path_bc3.split("/")[-1]
+    #    _filename = _filename_bc3.split(".")[-2]
+    #    _file = _path + _filename + ".durus"
+    #    print utils.mapping(_("Saving file: $1"), (_file,))
+    #    _time = time.time()
+    #    _durus_file = durusdatabase.DurusFile(_file,True)
+    #    _durus_file.setBudget(self.__budget)
+    #    _durus_file.close()
+    #    print utils.mapping(_("Saving time: $1 seconds"),
+    #          (("%.2f" %(time.time()-_time) ),))
 
     def cancel(self):
         """cancel(self)
@@ -464,4 +464,4 @@
         del self.__budget
         del self.__filename
         del self.__cancelMethod
-        del self.__cancel
\ No newline at end of file
+        del self.__cancel