mailr22265 - in /branches/double_rotor: ./ gui/analyses/__init__.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on February 24, 2014 - 10:42:
Author: bugman
Date: Mon Feb 24 10:42:33 2014
New Revision: 22265

URL: http://svn.gna.org/viewcvs/relax?rev=22265&view=rev
Log:
Merged revisions 22264 via svnmerge from 
svn+ssh://bugman@xxxxxxxxxxx/svn/relax/trunk

........
  r22264 | bugman | 2014-02-24 10:41:44 +0100 (Mon, 24 Feb 2014) | 6 lines
  
  Fix for bug #21720 (https://gna.org/bugs/?21720).
  
  This is the faulty pipe switching behaviour when a non-last analysis tab is 
deleted in the GUI.  Now
  the correct data pipe should be always switched to when closing an analysis 
tab.
........

Modified:
    branches/double_rotor/   (props changed)
    branches/double_rotor/gui/analyses/__init__.py

Propchange: branches/double_rotor/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon Feb 24 10:42:33 2014
@@ -1,1 +1,1 @@
-/trunk:1-22262
+/trunk:1-22264

Modified: branches/double_rotor/gui/analyses/__init__.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/double_rotor/gui/analyses/__init__.py?rev=22265&r1=22264&r2=22265&view=diff
==============================================================================
--- branches/double_rotor/gui/analyses/__init__.py (original)
+++ branches/double_rotor/gui/analyses/__init__.py Mon Feb 24 10:42:33 2014
@@ -1,6 +1,6 @@
 
###############################################################################
 #                                                                            
 #
-# Copyright (C) 2010-2013 Edward d'Auvergne                                  
 #
+# Copyright (C) 2010-2014 Edward d'Auvergne                                  
 #
 #                                                                            
 #
 # This file is part of the program relax (http://www.nmr-relax.com).         
 #
 #                                                                            
 #
@@ -242,21 +242,6 @@
             print("debug> %s:  Deleting the analysis GUI object." % 
full_name)
         self._analyses.pop(index)
 
-        # The current page has been deleted, so switch one back (if 
possible).
-        if index == self._current and self._current != 0:
-            if status.debug:
-                print("debug> %s:  Switching to page %s." % (full_name, 
self._current-1))
-            self.switch_page(self._current-1)
-
-        # No more analyses, so in the initial state.
-        if self._num_analyses == 0:
-            if status.debug:
-                print("debug> %s:  Setting the initial state." % full_name)
-            self.set_init_state()
-
-        # Notify the observers of the change.
-        status.observers.gui_analysis.notify()
-
         # Store the pipe bundle.
         pipe_bundle = ds.relax_gui.analyses[index].pipe_bundle
 
@@ -271,6 +256,29 @@
                 if status.debug:
                     print("debug> %s:  Deleting the data pipe '%s' from the 
'%s' bundle." % (full_name, pipe, pipe_bundle))
                 pipes.delete(pipe)
+
+        # No more analyses, so in the initial state.
+        if self._num_analyses == 0:
+            if status.debug:
+                print("debug> %s:  Setting the initial state." % full_name)
+            self.set_init_state()
+
+        # The current page has been deleted, so handle page switching to 
another page.
+        elif index == self._current:
+            # Default to the current page index - so that the switch is to 
the next page.
+            page_index = self._current
+
+            # Switch back one page.
+            if self._num_analyses <= self._current:
+                page_index = self._current - 1
+
+            # Make the switch.
+            if status.debug:
+                print("debug> %s:  Switching to page %s." % (full_name, 
page_index))
+            self.switch_page(page_index)
+
+        # Notify the observers of the change.
+        status.observers.gui_analysis.notify()
 
 
     def get_page_from_name(self, name):
@@ -740,6 +748,10 @@
         # Set the current page number.
         self._current = index
 
+        # Switch to the major data pipe of the page if not the current one.
+        if pipes.cdp_name() != 
ds.relax_gui.analyses[self._current].pipe_name:
+            self.gui.interpreter.apply('pipe.switch', 
ds.relax_gui.analyses[self._current].pipe_name)
+
         # Switch to the page.
         wx.CallAfter(self.notebook.SetSelection, self._current)
 




Related Messages


Powered by MHonArc, Updated Mon Feb 24 11:00:02 2014