Hi Carlos,
sorry, I looked in the wrong file: The function restore_directory_state
is in the file explorer.py and not
projectexplorer.py, as I thought.
So, no regression, but it still does not work on my (work) PC, which is
a Core2, 2 GHz, with normal
hard drive. The bug is fixed on my (private) PC, which is a Core i7, 3.4
GHz with an SSD.
I had to increase the delay in line 696 of the file explorer.py to 1000
ms an my (work) PC to avoid
a crash.
The worst case test scenario:
- 7 open projects, each about 10-15 files
- launch Spyder directly after a reboot, so that nothing is in the RAM
cache yet
So increasing this delay from 200ms to 1000ms is good enough for people
with a 2 GHz core duo,
but what about the people who have an even slower computer?
Sorry for not being happy yet (: !
Uwe
On 04.02.2013 18:34, Carlos Córdoba wrote:
Hi Uwe,
I confirmed that the method restore_directory_state that you mention
is still present in beta2. I just downloaded the zip, uncompressed it
and checked it out and it's still there, so I don't know what could be
happening.
Could someone else confirm it?
Cheers,
Carlos
El 04/02/13 12:02, Uwe Fechner escribió:
Hello,
the bug that was described in the following thread:
https://groups.google.com/forum/?fromgroups=#!topic/spyderlib/9fK32oIY4fo
was fixed in beta 1, but now it is back again.
If I look into the source than the following function in the file
explorer.py - that fixed the bug -
is missing in beta2:
def restore_directory_state(self, fname):
674 """Restore directory expanded state""" 674 """Restore
directory expanded state"""
675 root = osp.normpath(unicode(fname)) 675 root =
osp.normpath(unicode(fname))
676 if not osp.exists(root): 676 if not osp.exists(root):
677 # Directory has been (re)moved outside Spyder 677 #
Directory has been (re)moved outside Spyder
678 return 678 return
679 for basename in os.listdir(root): 679 for basename in
os.listdir(root):
680 path = osp.normpath(osp.join(root, basename)) 680 path =
osp.normpath(osp.join(root, basename))
681 if osp.isdir(path) and path in self.__expanded_state: 681
if osp.isdir(path) and path in self.__expanded_state:
682 self.__expanded_state.pop(self.__expanded_state.index(path)) 682
self.__expanded_state.pop(self.__expanded_state.index(path))
683 if self._to_be_loaded is None: 683 if
self._to_be_loaded is None:
684 self._to_be_loaded = [] 684 self._to_be_loaded = []
685 self._to_be_loaded.append(path) 685
self._to_be_loaded.append(path)
686 686
687 # Prevent Qt from crashing or showing warnings like: 687
# Prevent Qt from crashing or showing warnings like:
688 # "QSortFilterProxyModel: index from wrong model passed
to 688 # "QSortFilterProxyModel: index from wrong model
passed to
689 # mapFromSource", probably due to the fact that the file
689 # mapFromSource", probably due to the fact that the file
690 # system model is being built 690 # system model is
being built
691 QTimer.singleShot(50, lambda path=path: 691 #
692 # This is just a workaround (any cleaner
implementation would
693 # be welcomed). The delay was first set to 50ms, but
with
694 # slower machines, it appears that 200ms is a better
choice:
695 #
https://groups.google.com/group/spyderlib/browse_thread/thread/f5f2b7da8218e1fa
696 QTimer.singleShot(200, lambda path=path:
692 self.setExpanded(self.get_index(path), True)) 697
self.setExpanded(self.get_index(path), True))
693 698
694 if not self.__expanded_state: 699 if not
self.__expanded_state:
695 self.disconnect(self.fsmodel,
SIGNAL('directoryLoaded(QString)'), 700
self.disconnect(self.fsmodel, SIGNAL('directoryLoaded(QString)'),
696 self.restore_directory_state) 701
self.restore_directory_state)
Can someone please check how this could happen and fix it?
Best regards:
Uwe Fechner
--
You received this message because you are subscribed to the Google Groups
"spyder" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/spyderlib?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.