/[ascend]/branches/adrian/pygtk/study.py
ViewVC logotype

Diff of /branches/adrian/pygtk/study.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3075 by adrian, Wed Aug 19 12:10:14 2015 UTC revision 3076 by adrian, Wed Aug 19 13:34:55 2015 UTC
# Line 107  class StudyWin: Line 107  class StudyWin:
107          self.browser.builder.connect_signals(self)          self.browser.builder.connect_signals(self)
108          self.lowerb.select_region(0, -1)          self.lowerb.select_region(0, -1)
109          self.solve_interrupt = False          self.solve_interrupt = False
110            self.data = {}
111            
112      def get_step_type(self):      def get_step_type(self):
113          _s = self.step_menu.get_active_iter()          _s = self.step_menu.get_active_iter()
# Line 385  class StudyWin: Line 386  class StudyWin:
386          self.studywin.destroy()          self.studywin.destroy()
387          reporter = StudyReporter(_b, _b.sim.getNumVars(), self.instance, _nsteps, self)          reporter = StudyReporter(_b, _b.sim.getNumVars(), self.instance, _nsteps, self)
388    
389            self.data = {}
390            for tab in self.browser.observers:
391                if tab.alive:
392                    self.data[tab.name] = []
393          self.solve_interrupt = False          self.solve_interrupt = False
394          thread = threading.Thread(target=self.solve_thread, args=(_b, reporter, _start, _step, _nsteps, _dist))          thread = threading.Thread(target=self.solve_thread, args=(_b, reporter, _start, _step, _nsteps, _dist))
395          thread.daemon = True          thread.daemon = True
# Line 426  class StudyWin: Line 431  class StudyWin:
431                      time.sleep(0.001)                      time.sleep(0.001)
432                      if res != 0:                      if res != 0:
433                          break                          break
434                    self.save_data()
435                  GLib.idle_add(self.solve_finish_step, reporter, status)                  GLib.idle_add(self.solve_finish_step, reporter, status)
436                  browser.sim.postsolve(status)                  browser.sim.postsolve(status)
437              except RuntimeError, err:              except RuntimeError, err:
# Line 434  class StudyWin: Line 440  class StudyWin:
440              i += 1              i += 1
441    
442          GLib.idle_add(self.solve_update, reporter, i)          GLib.idle_add(self.solve_update, reporter, i)
443          GLib.idle_add(self.solve_finish, browser)          GLib.idle_add(self.solve_finish, browser, reporter)
444    
445        def save_data(self):
446            for tab in self.browser.observers:
447                if tab.alive:
448                    v = tab.get_values()
449                    self.data[tab.name].append(v)
450    
451      def solve_update(self, reporter, i):      def solve_update(self, reporter, i):
452          reporter.updateVarDetails(i)          reporter.updateVarDetails(i)
# Line 448  class StudyWin: Line 460  class StudyWin:
460          reporter.finalise(status)          reporter.finalise(status)
461          return False          return False
462    
463      def solve_finish(self, browser):      def solve_finish(self, browser, reporter):
464            reporter.report_observed(self.data)
465          browser.stop_waiting()          browser.stop_waiting()
466          browser.modelview.refreshtree()          browser.modelview.refreshtree()
467          return False          return False

Legend:
Removed from v.3075  
changed lines
  Added in v.3076

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22