diff Gtk/gui.py @ 22:7bd4ca56607d

bug fix: Mutable default arguments
author Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
date Tue, 30 Sep 2014 17:16:50 +0200
parents f7e0cc58737f
children 65e7ae0d0e63
line wrap: on
line diff
--- a/Gtk/gui.py	Sun Sep 14 17:23:02 2014 +0200
+++ b/Gtk/gui.py	Tue Sep 30 17:16:50 2014 +0200
@@ -2,7 +2,7 @@
 ## File gui.py
 ## This file is part of pyArq-Presupuestos.
 ##
-## Copyright (C) 2010 Miguel Ángel Bárcena Rodríguez
+## Copyright (C) 2010-2014 Miguel Ángel Bárcena Rodríguez
 ##                         <miguelangel@obraencurso.es>
 ##
 ## pyArq-Presupuestos is free software: you can redistribute it and/or modify
@@ -914,8 +914,8 @@
     # TODO:  * pane types
     # TODO:      * General budget properties (is better a dialog?)
 
-    def __init__(self, mainWindow, budget, path_record=(0,)):
-        """__init__(mainWindow, budget, path_record=(0,))
+    def __init__(self, mainWindow, budget, path_record=None):
+        """__init__(mainWindow, budget, path_record=None)
         
         mainWindow: MainWindow object
         budget: "base.Budget" object
@@ -931,6 +931,8 @@
         self.__back_menu: a gtk.Menu
         self.__forward_menu: a gtk.Menu
         """
+        if path_record is None:
+            path_record = (0,)
         #TODO: __panes_list should come from config file...
         self.__mainWindow = mainWindow
         self.__widget = gtk.VBox()
@@ -1090,8 +1092,8 @@
             # Thre is only one item in the page, it can not be closed
             pass
 
-    def _itemsFactory(self, list_paned, pane_path=(0,)):
-        """_itemsFactory(list_paned, pane_path(0,))
+    def _itemsFactory(self, list_paned, pane_path=None):
+        """_itemsFactory(list_paned, pane_path=None)
         
         list_paned: list in "__panes_list" format
             [ "v" or "h", panel1_type, panel2_type]
@@ -1107,6 +1109,8 @@
         
         Creates the items and widgets and returns the main item
         """
+        if pane_path is None:
+            pane_path = (0,)
         if not isinstance(list_paned , list):
             raise ValueError, _("The value must be a list")
         if list_paned[0] == "v" or  list_paned[0] == "h":
@@ -2195,8 +2199,8 @@
         runMessage
     """
 
-    def __init__(self, budget, page, pane_path, path_record=(0,)):
-        """__init__(budget, page, pane_path, path_record=(0,))
+    def __init__(self, budget, page, pane_path, path_record=None):
+        """__init__(budget, page, pane_path, path_record=None)
         
         budget: budget showed ("base.Budget" object)
         page: weak reference from Page instance which creates this class
@@ -2246,6 +2250,8 @@
         """
         # TODO: to group all columns in a dicctionary
         # Budget
+        if path_record is None:
+            parh_record = (0,)
         if not isinstance(budget, base.Budget):
             raise ValueError, _("Argument must be a Budget object")
         self.__budget = budget
@@ -2823,8 +2829,8 @@
         runMessage
     """
 
-    def __init__(self, budget, page, pane_path, path_record=(0,)):
-        """__init__(budget, page, pane_path, path_record=(0,))
+    def __init__(self, budget, page, pane_path, path_record=None):
+        """__init__(budget, page, pane_path, path_record=None)
         
         budget: budget: budget showed ("base.Budget" object)
         page: weak reference from Page instance which creates this class
@@ -2873,6 +2879,8 @@
             * Connects the events
         """
         # Seting init args
+        if path_record is None:
+            path_record = (0,)
         if not isinstance(budget, base.Budget):
             raise ValueError, _("Argument must be a Budget object")
         self.__budget = budget
@@ -3411,8 +3419,8 @@
     """
     # TODO: make standar: "DecompositonList and Description"
 
-    def __init__(self, budget, page, pane_path, path_record=(0,)):
-        """__init__(budget, page, pane_path, path_record=(0,))
+    def __init__(self, budget, page, pane_path, path_record=None):
+        """__init__(budget, page, pane_path, path_record=None)
         
         budget: the budget (base.obra object)
         page: weak reference from Page instance which creates this class
@@ -3432,6 +3440,8 @@
         Creates an shows the scroledwindow that contain the description text
         of the record to be showed in a pane.
         """
+        if path_record is None:
+            path_record = (0,)
         self.__budget = budget
         self.__page = page
         self.__pane_path = pane_path
@@ -3592,8 +3602,8 @@
         runMessage
     """
 
-    def __init__(self, budget, page, pane_path, path_record=(0,)):
-        """__init__(budget, page, pane_path, path_record=(0,))
+    def __init__(self, budget, page, pane_path, path_record=None):
+        """__init__(budget, page, pane_path, path_record=None)
         
         budget: the budget (base.obra object)
         page: weak reference from Page instance which creates this class
@@ -3618,6 +3628,8 @@
         Creates an shows the scroledwindow that contain the description text
         of the record to be showed in a pane.
         """
+        if path_record is None:
+            path_record = (0,)
         self.__budget = budget
         self.__page = page
         self.__pane_path = pane_path
@@ -3939,8 +3951,8 @@
         runMessage
     """
 
-    def __init__(self, budget, page, pane_path, path_record=(0,)):
-        """__init__(budget, page, pane_path, path_record=(0,))
+    def __init__(self, budget, page, pane_path, path_record=None):
+        """__init__(budget, page, pane_path, path_record=None)
         
         budget: the budget (base.obra object)
         page: weak reference from Page instance which creates this class
@@ -3958,6 +3970,8 @@
         Creates an shows the scroledwindow that contain icon files
         of the record to be showed in a pane.
         """
+        if path_record is None:
+            path_record = (0,)
         self.__budget = budget
         self.__page = page
         self.__pane_path = pane_path
@@ -4182,8 +4196,8 @@
         runMessage
     """
 
-    def __init__(self, budget, page, pane_path, path_record=(0,)):
-        """__init__(budget, page, pane_path, path_record=(0,))
+    def __init__(self, budget, page, pane_path, path_record=None):
+        """__init__(budget, page, pane_path, path_record=None)
         
         budget: budget: budget showed ("base.Budget" object)
         page: weak reference from Page instance which creates this class
@@ -4201,6 +4215,8 @@
         
         Creates an shows the scroledwindow that contain the company data.
         """
+        if path_record is None:
+            path_record = (0,)
         self.__selection = None
         # Seting init args
         if not isinstance(budget, base.Budget):