Changeset 109 for trunk/chavier/gui.py
- Timestamp:
- 10/27/08 16:49:58 (4 years ago)
- Files:
-
- 1 modified
-
trunk/chavier/gui.py (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/chavier/gui.py
r108 r109 22 22 from chavier.dialogs import ( 23 23 TextInputDialog, PointDialog, OptionDialog, RandomGeneratorDialog, 24 AboutDialog, 24 AboutDialog, warning 25 25 ) 26 26 … … 29 29 self.app = app 30 30 31 self.chart = None 31 32 self.surface = None 32 33 … … 123 124 '<ctrl>g', 'Generate random points', 124 125 self.generate_random_points), 126 ('dump-chart-state', gtk.STOCK_CONVERT, '_Dump chart state', 127 '<ctrl>d', 'Dump internal chart variables', 128 self.dump_chart_state), 125 129 ('help', None, '_Help', None, 'Help', None), 126 130 ('about', gtk.STOCK_ABOUT, None, None, 'About this program', … … 168 172 <menu action="tools"> 169 173 <menuitem action="random-points"/> 174 <menuitem action="dump-chart-state"/> 170 175 </menu> 171 176 <menu action="help"> … … 357 362 358 363 def drawing_area_expose_event(self, widget, event, data=None): 359 if self. surfaceis None:364 if self.chart is None: 360 365 return 361 366 … … 364 369 event.area.width, event.area.height) 365 370 cr.clip() 366 cr.set_source_surface(self. surface, 0, 0)371 cr.set_source_surface(self.chart.surface, 0, 0) 367 372 cr.paint() 368 373 369 374 def drawing_area_size_allocate_event(self, widget, event, data=None): 370 if self. surfaceis not None:375 if self.chart is not None: 371 376 self.refresh() 372 377 373 378 def on_chart_type_change(self, action, current, data=None): 374 if self. surfaceis not None:379 if self.chart is not None: 375 380 self.refresh() 376 381 … … 478 483 chart_type = self._get_chart_type() 479 484 alloc = self.drawing_area.get_allocation() 480 self. surface= self.app.get_chart(datasets, options, chart_type,481 alloc.width, alloc.height)485 self.chart = self.app.get_chart(datasets, options, chart_type, 486 alloc.width, alloc.height) 482 487 self.drawing_area.queue_draw() 483 488 else: 484 self. surface= None489 self.chart = None 485 490 486 491 def generate_random_points(self, action=None): … … 500 505 dialog.destroy() 501 506 507 def dump_chart_state(self, action=None): 508 if self.chart is None: 509 return 510 511 alloc = self.drawing_area.get_allocation() 512 513 print 'CHART STATE' 514 print '-' * 70 515 print 'surface: %d x %d' % (alloc.width, alloc.height) 516 print 'area :', self.chart.area 517 print 518 print 'minxval:', self.chart.minxval 519 print 'maxxval:', self.chart.maxxval 520 print 'xrange :', self.chart.xrange 521 print 522 print 'minyval:', self.chart.minyval 523 print 'maxyval:', self.chart.maxyval 524 print 'yrange :', self.chart.yrange 525 502 526 def about(self, action=None): 503 527 dialog = AboutDialog(self.main_window)
