Please review this at http://codereview.appspot.com/913045/show

Affected files:
  M tryton/gui/window/view_form/model/group.py
  M tryton/gui/window/view_form/screen/screen.py
  M tryton/gui/window/win_form.py


Index: tryton/gui/window/view_form/model/group.py
===================================================================
--- a/tryton/gui/window/view_form/model/group.py
+++ b/tryton/gui/window/view_form/model/group.py
@@ -14,7 +14,7 @@
             parent_datetime_field=None):
         super(Group, self).__init__()
         self.lock_signal = False
-        self.window = window
+        self.__window = window
         self.parent = parent
         self.parent_name = parent_name
         self.parent_datetime_field = parent_datetime_field
@@ -32,6 +32,16 @@
             self.readonly = True
         self.__id2record = {}

+    def __get_window(self):
+        return self.__window
+
+    def __set_window(self, window):
+        for record in self:
+            record.window = window
+        self.__window = window
+
+    window = property(__get_window, __set_window)
+
     def insert(self, pos, record):
         if pos >= 1:
             self.__getitem__(pos - 1).next[id(self)] = record
Index: tryton/gui/window/view_form/screen/screen.py
===================================================================
--- a/tryton/gui/window/view_form/screen/screen.py
+++ b/tryton/gui/window/view_form/screen/screen.py
@@ -48,7 +48,7 @@
         self.view_ids = view_ids
         self.parent = None
         self.parent_name = None
-        self.window = window
+        self.__window = window
         self.__group = None
         self.group = Group(model_name, {}, self.window,
context=self.context,
                 readonly=readonly)
@@ -217,6 +217,15 @@

     current_record = property(__get_current_record, __set_current_record)

+    def __get_window(self):
+        return self.__window
+
+    def __set_window(self, window):
+        self.group.window = window
+        self.__window = window
+
+    window = property(__get_window, __set_window)
+
     def update_attachment(self, record):
         if record != self.current_record:
             return False
Index: tryton/gui/window/win_form.py
===================================================================
--- a/tryton/gui/window/win_form.py
+++ b/tryton/gui/window/win_form.py
@@ -188,6 +188,9 @@

         self.win.show()

+        self.prev_window = self.screen.window
+        self.screen.window = self.win
+
         self.screen.display()
         self.screen.current_view.set_cursor()

@@ -312,5 +315,6 @@
             viewport.remove(viewport.get_child())
         self.screen.switch_view(view_type=self.prev_view.view_type)
         self.screen.signal_unconnect(self)
+        self.screen.window = self.prev_window
         self.win.destroy()
         self.parent.present()



-- 
Cédric Krier

B2CK SPRL
Rue de Rotterdam, 4
4000 Liège
Belgium
Tel: +32 472 54 46 59
Email/Jabber: cedric.kr...@b2ck.com
Website: http://www.b2ck.com/

Attachment: pgpgKLNVY5R0r.pgp
Description: PGP signature

Reply via email to