diff options
author | Walter Bender <walter.bender@gmail.com> | 2012-01-11 01:21:44 (GMT) |
---|---|---|
committer | Walter Bender <walter.bender@gmail.com> | 2012-01-11 01:21:44 (GMT) |
commit | 0e3f13d2c4c65036e02d9b1058cc6d767ab67d98 (patch) | |
tree | c85e4bf809d9407c108068daabb56f18ecf2b74d | |
parent | 545f060848acd00ca91e61960ebd88225ac90f8d (diff) |
inital support for XO 3.0
-rw-r--r-- | RulerActivity.py | 29 | ||||
-rw-r--r-- | show_rulers.py | 4 |
2 files changed, 16 insertions, 17 deletions
diff --git a/RulerActivity.py b/RulerActivity.py index 6aa1eee..f536c09 100644 --- a/RulerActivity.py +++ b/RulerActivity.py @@ -107,8 +107,8 @@ class RulerActivity(activity.Activity): self.callback_dict = {} self._ready = False - _font = 'helvetica 12' - _font_bold = 'helvetica bold 12' + font = 'helvetica 12' + font_bold = 'helvetica bold 12' # # We need a canvas @@ -117,12 +117,15 @@ class RulerActivity(activity.Activity): self.set_canvas(self._canvas) self._canvas.show() - _width = gtk.gdk.screen_width() - _height = gtk.gdk.screen_height() - GRID_CELL_SIZE + width = gtk.gdk.screen_width() + height = gtk.gdk.screen_height() - GRID_CELL_SIZE # Read the dpi from the Journal if get_hardware()[0:2] == 'xo': - self._canvas.set_dpi(200) # OLPC XO + if width == 1024: + self._canvas.set_dpi(160) # OLPC XO 3.0 + else: + self._canvas.set_dpi(200) # other OLPC XO self.known_dpi = True else: self.known_dpi = False @@ -134,16 +137,12 @@ class RulerActivity(activity.Activity): self._canvas.set_dpi(96) # Just a guess # Create instances of our graphics - self._r = show_rulers.ScreenOfRulers(_font, _font_bold, _width, - _height) - self._gcm = show_grids.ScreenGrid_cm(_font, _font_bold, _width, - _height) - self._gmm = show_grids.ScreenGrid_mm(_font, _font_bold, _width, - _height) - self._a90 = show_angles.Angles90(_font, _font_bold, _width, _height) - self._a360 = show_angles.Angles360(_font, _font_bold, _width, _height) - self._c = show_checkers.ScreenOfCircles(_font, _font_bold, _width, - _height) + self._r = show_rulers.ScreenOfRulers(font, font_bold, width, height) + self._gcm = show_grids.ScreenGrid_cm(font, font_bold, width, height) + self._gmm = show_grids.ScreenGrid_mm(font, font_bold, width, height) + self._a90 = show_angles.Angles90(font, font_bold, width, height) + self._a360 = show_angles.Angles360(font, font_bold, width, height) + self._c = show_checkers.ScreenOfCircles(font, font_bold, width, height) # start with a ruler self._current = self._r diff --git a/show_rulers.py b/show_rulers.py index 387f3d0..8d32132 100644 --- a/show_rulers.py +++ b/show_rulers.py @@ -39,8 +39,8 @@ class ScreenOfRulers(): self.draw_ruler_pair(c, dpi, mm(dpi, 20)) - # only calculate offsets if on an OLPC XO-1 - if self.hw[0:2] == 'xo': + # only calculate offsets if on an OLPC XO-1, 1.5, 1.75 + if self.hw[0:2] == 'xo' and dpi == 200: # Not applicable to XO 3.0 offset_of_xo_side_from_screen = mm(dpi, -38.5) #XXX needs checking c.move_to(offset_of_xo_side_from_screen, mm(dpi, 65)) self.draw_cm_ruler(c, dpi, 180) |