Permalink
Browse files

Fix overview tab cleanup

Fixes #1441
  • Loading branch information...
1 parent 2f1a120 commit 72d3e7cd1bdcd872a9cefb9db558d9804248f72d @totycro totycro committed Feb 10, 2012
Showing with 17 additions and 5 deletions.
  1. +7 −2 horizons/gui/tabs/overviewtab.py
  2. +10 −3 run_gui_tests.sh
@@ -71,7 +71,10 @@ def _schedule_refresh(self):
This saves a lot of CPU time, if you have a huge island, or play on high speed."""
if not self._refresh_scheduled:
self._refresh_scheduled = True
- ExtScheduler().add_new_object(self.refresh, self, run_in=0.3)
+ def unset_flag():
+ self._refresh_scheduled = False
+ ExtScheduler().add_new_object(Callback.ChainedCallbacks(unset_flag, self.refresh),
+ self, run_in=0.3)
def refresh(self):
if (hasattr(self.instance, 'name') or self.instance.has_component(NamedComponent)) and self.widget.child_finder('name'):
@@ -88,7 +91,6 @@ def refresh(self):
unicode( self.instance.running_costs )
self.widget.adaptLayout()
- self._refresh_scheduled = False
def show(self):
super(OverviewTab, self).show()
@@ -114,6 +116,9 @@ def hide(self):
self.instance.settlement.has_change_listener(self._schedule_refresh):
self.instance.settlement.remove_change_listener(self._schedule_refresh)
+ if self._refresh_scheduled:
+ ExtScheduler().rem_all_classinst_calls(self)
+
def on_instance_removed(self):
self.on_remove()
self.instance = None
View
@@ -1,24 +1,31 @@
#!/bin/bash
# script to run gui tests
+TESTS="tests/gui/"
+for i in $@; do
+ if [ -f "$i" ] ; then
+ # another test was specified, run that one rather
+ TESTS=""
+ fi
+done
if which xvfb-run >/dev/null 2>/dev/null ; then
echo "Running tests using xvfb-run"
- xvfb-run python run_tests.py -a gui tests/gui/ --nologcapture $@
+ xvfb-run python run_tests.py -a gui $TESTS --nologcapture $@
exit $?
fi
if which Xvfb >/dev/null 2>/dev/null ; then
echo "Running tests using Xvfb"
Xvfb :99 2>/dev/null &
PID=$!
- DISPLAY=":99" python run_tests.py -a gui tests/gui/ --nologcapture $@
+ DISPLAY=":99" python run_tests.py -a gui $TESTS --nologcapture $@
RET=$?
kill -9 $PID
exit $RET
fi
# just run in the normal x server
echo "Unable to locate xvfb, running test in current X session"
-python run_tests.py -a gui tests/gui/ --nologcapture $@
+python run_tests.py -a gui $TESTS --nologcapture $@

0 comments on commit 72d3e7c

Please sign in to comment.