Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/sugar/graphics/grid.py
blob: 8ee124a361fe431b5bdd095db0ef31419a871927 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import gtk

COLS = 16
ROWS = 12

class Grid(object):
	def __init__(self):
		self._factor = gtk.gdk.screen_width() / COLS

	def point(self, x, y):
		return [x * self._factor, y * self._factor]

	def rectangle(self, x, y, width, height):
		return [x * self._factor, y * self._factor,
				width * self._factor, height * self._factor]