Commit 3307da77 authored by VIGNET Pierre's avatar VIGNET Pierre
Browse files

Fix typos FOR PEOPLE THAT DONT KNOW THAT LEAVING TRAILING SPACES IS NOT...

Fix typos FOR PEOPLE THAT DONT KNOW THAT LEAVING TRAILING SPACES IS NOT SOMETHING THAT WE USUALLY DO!
parent ed06ba40
## Filename : chart_view.py
## Author(s) : Michel Le Borgne
## Created : 4/3/2010
## Revision :
## Source :
## Revision :
## Source :
##
## Copyright 2009 - 2010 : IRISA/IRSET
##
......@@ -33,8 +33,8 @@
## IRISA
## Symbiose team
## IRISA Campus de Beaulieu
## 35042 RENNES Cedex, FRANCE
##
## 35042 RENNES Cedex, FRANCE
##
##
## Contributor(s): Geoffroy Andrieux, Nolwenn Le Meur
##
......@@ -52,9 +52,9 @@ class ChartView(gtk.DrawingArea):
def __init__(self, width, height, drawing_style, controler, model):
"""
@param width, height: int - size of the view
@param drawing_style: a Drawing style associated with the pattern
@param drawing_style: a Drawing style associated with the pattern
@param controler: the controller as in the MVC pattern
@param model: a ChartModel
@param model: a ChartModel
"""
gtk.DrawingArea.__init__(self)
self.controler = controler
......@@ -63,7 +63,7 @@ class ChartView(gtk.DrawingArea):
# attach as model observer
model.attach(self)
# signals
self.set_events(gtk.gdk.EXPOSURE_MASK
| gtk.gdk.LEAVE_NOTIFY_MASK
......@@ -74,12 +74,12 @@ class ChartView(gtk.DrawingArea):
| gtk.gdk.POINTER_MOTION_HINT_MASK)
self.connect("expose-event", self.expose_event)
self.connect("configure_event", self.configure_event)
# controlled events
self.connect("button_press_event", controler.button_press)
self.connect("button_release_event", controler.button_release)
self.connect("motion_notify_event", controler.motion_notify)
# drawing stuffs
drawing_style.view = self
self.drawing_style = drawing_style
......@@ -93,7 +93,7 @@ class ChartView(gtk.DrawingArea):
self.pixmap = None # cannot be initialized before self.window creation
self.page = None
self.zoom_count = 0
def expose_event(self, widget, event):
"""
Redisplay drawing after cover and exposure of the window
......@@ -105,7 +105,7 @@ class ChartView(gtk.DrawingArea):
self.model.draw(self)
# expose the drawing
self.window.draw_drawable(self.get_style().fg_gc[gtk.STATE_NORMAL],
self.pixmap, 0, 0, 0, 0,
self.pixmap, 0, 0, 0, 0,
self.draw_width, self.draw_height)
if self.page:
self.page.notify(widget)
......@@ -114,23 +114,23 @@ class ChartView(gtk.DrawingArea):
def configure_event(self, widget, event):
"""
Initialisation and change in size
"""
# adjust to visible window
"""
# adjust to visible window
xor , yor, width, height = widget.get_allocation()
self.draw_width = max(width, self.min_width)
self.draw_height = max(height, self.min_height)
# set pixmap if necesssary
if not self.pixmap:
self.pixmap = gtk.gdk.Pixmap(self.window,
self.draw_width, self.draw_height)
self.pixmap = gtk.gdk.Pixmap(self.window,
self.draw_width, self.draw_height)
# adjust the pixmap to size
size = self.pixmap.get_size()
if size[0] != self.draw_width or size[1] != self.draw_height:
self.set_size_request(self.draw_width, self.draw_height)
self.pixmap = gtk.gdk.Pixmap(self.window,
self.draw_width, self.draw_height)
self.pixmap = gtk.gdk.Pixmap(self.window,
self.draw_width, self.draw_height)
return True
def update(self):
"""
Display a new drawing of the model
......@@ -139,11 +139,11 @@ class ChartView(gtk.DrawingArea):
if not self.window:
return
# resize if virtual drawing window size changed
# resize if virtual drawing window size changed
size = self.pixmap.get_size()
if size[0] != self.draw_width or size[1] != self.draw_height:
self.set_size_request(self.draw_width, self.draw_height)
self.pixmap = gtk.gdk.Pixmap(self.window,
self.pixmap = gtk.gdk.Pixmap(self.window,
self.draw_width, self.draw_height)
self.pixmap.draw_rectangle(self.get_style().white_gc,
True, 0, 0, self.draw_width, self.draw_height)
......@@ -151,7 +151,7 @@ class ChartView(gtk.DrawingArea):
self.model.draw(self)
# expose the drawing
self.window.draw_drawable(self.get_style().fg_gc[gtk.STATE_NORMAL],
self.pixmap, 0, 0, 0, 0,
self.pixmap, 0, 0, 0, 0,
self.draw_width, self.draw_height)
......@@ -199,23 +199,23 @@ class NavView(ChartView):
self.w_ret = 1
self.h_ret = 1
self.show_all()
def configure_event(self, widget, event):
"""
Initialization and change in size
"""
xor, yor, width, height = widget.get_allocation()
self.draw_width = width
self.draw_height = height
self.pixmap = gtk.gdk.Pixmap(self.window,
self.draw_height = height
self.pixmap = gtk.gdk.Pixmap(self.window,
self.draw_width, self.draw_height)
self.pixmap.draw_rectangle(widget.get_style().white_gc,
True, 0, 0, self.draw_width, self.draw_height)
True, 0, 0, self.draw_width, self.draw_height)
self.ret_gc = self.window.new_gc()
self.ret_gc.set_rgb_fg_color(gtk.gdk.color_parse('red'))
self.ret_gc.set_rgb_fg_color(gtk.gdk.color_parse('red'))
return True
def expose_event(self, widget, event):
"""
Redisplay drawing after cover and exposure of the window
......@@ -226,14 +226,14 @@ class NavView(ChartView):
self.model.draw(self)
# expose the drawing
self.window.draw_drawable(self.get_style().fg_gc[gtk.STATE_NORMAL],
self.pixmap, 0, 0, 0, 0,
self.pixmap, 0, 0, 0, 0,
self.draw_width, self.draw_height)
# draw reticule
self.window.draw_rectangle(self.ret_gc,
False, self.x_ret, self.y_ret,
self.w_ret, self.h_ret)
False, self.x_ret, self.y_ret,
self.w_ret, self.h_ret)
return True
def update(self):
"""
Display a new drawing of the model
......@@ -253,15 +253,15 @@ class NavView(ChartView):
self.pixmap, 0, 0, 0, 0,
self.draw_width, self.draw_height)
# draw reticule
self.window.draw_rectangle(self.ret_gc, False,
self.x_ret, self.y_ret,
self.window.draw_rectangle(self.ret_gc, False,
self.x_ret, self.y_ret,
self.w_ret, self.h_ret)
def scroll_update(self, xor, yor, width, height):
"""
Updating function used when the linked window is scrolled
"""
if not self.window:
if not self.window:
return
self.x_ret = int(xor * self.draw_width)
self.y_ret = int(yor * self.draw_height)
......@@ -271,19 +271,19 @@ class NavView(ChartView):
self.window.draw_rectangle(self.get_style().white_gc,
True, 0, 0, self.draw_width, self.draw_height)
self.window.draw_drawable(self.get_style().fg_gc[gtk.STATE_NORMAL],
self.pixmap, 0, 0, 0, 0,
self.pixmap, 0, 0, 0, 0,
self.draw_width, self.draw_height)
# draw reticule
self.window.draw_rectangle(self.ret_gc, False,
self.x_ret, self.y_ret,
self.w_ret, self.h_ret)
self.window.draw_rectangle(self.ret_gc, False,
self.x_ret, self.y_ret,
self.w_ret, self.h_ret)
def clear(self):
"""
As it says
"""
self.window.draw_rectangle(self.get_style().white_gc,
True, 0, 0, self.draw_width, self.draw_height)
True, 0, 0, self.draw_width, self.draw_height)
class ChartPage(gtk.Frame):
......@@ -292,7 +292,7 @@ class ChartPage(gtk.Frame):
"""
def __init__(self, width, height, drst, controler, model):
"""
"""
gtk.Frame.__init__(self)
# for observers
......@@ -315,8 +315,8 @@ class ChartPage(gtk.Frame):
viewport.add(self.draw)
self.add(scr_w)
self.show_all()
# observer pattern methods
def attach(self, obs):
"""
......@@ -324,13 +324,13 @@ class ChartPage(gtk.Frame):
"""
if not obs in self.__observer_list:
self.__observer_list.append(obs)
def detach(self, obs):
"""
standard in observer pattern
"""
self.__observer_list.remove(obs)
def notify(self, widget):
"""
used when the viewport is moved from inside (hbar and vbar)
......@@ -342,7 +342,7 @@ class ChartPage(gtk.Frame):
height = self.vadj.page_size/self.draw.draw_height
for obs in self.__observer_list:
obs.scroll_update(x_pos, y_pos, width, height)
# signal call back
def update(self, dxx, dyy):
"""
......@@ -357,8 +357,8 @@ class ChartPage(gtk.Frame):
self.scr_w.set_vadjustment(self.vadj)
self.allow_adj = True
self.notify(None)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment