def __init__(self, tileWidth, tileHeight , thumb): """ @type tileWidth: int @param tileWidth: current width of map in tiles @type tileHeight: int @param tileHeight: current height of map in tiles @type thumb: cairo.ImageSurface @param thumb: thumbnail image of the map """ gtk.DrawingArea.__init__(self) self.__tWidth = thumb.get_width() self.__tHeight = thumb.get_height() self.__pixelSize = int(max(thumb.get_width(), thumb.get_height())) self.__oldWidth = tileWidth self.__oldHeight = tileHeight self.__thumb = thumb self.__newWidth = tileWidth self.__newHeight = tileHeight self.__scaleFactor = 1.0 self.__top = 0 self.__bottom = 0 self.__left = 0 self.__right = 0 self.__checkerBoard = graphics.getCheckerPattern(16) self.set_size_request(thumb.get_width(), thumb.get_height())
def __init__(self, width, height, tileSize): gtk.DrawingArea.__init__(self) self.showGrid = False self.__scaleFactor = 1.0 self.__zoomLevel = preferences.zoomNormalIndex self.__tileSize = tileSize self.__tools = [] self.__selectedTool = 0 self.__width = 0 self.__height = 0 self.checkerPattern = graphics.getCheckerPattern(tileSize) # DrawingArea can't get events of its own for whatever reason. # Sticking it in an EventBox works around this self.eventBox = gtk.EventBox() self.eventBox.connect("button-press-event", self.buttonPress) self.eventBox.connect("button-release-event", self.buttonRelease) self.eventBox.connect("motion-notify-event", self.mouseMotion) self.eventBox.connect("leave-notify-event", self.mouseLeave) self.eventBox.connect("enter-notify-event", self.mouseEnter) self.eventBox.connect("key-press-event", self.keyPress) self.eventBox.add(self) self.eventBox.set_events(gtk.gdk.POINTER_MOTION_MASK | gtk.gdk.POINTER_MOTION_HINT_MASK | gtk.gdk.BUTTON_PRESS_MASK | gtk.gdk.SCROLL_MASK | gtk.gdk.KEY_PRESS_MASK | gtk.gdk.BUTTON_RELEASE_MASK | gtk.gdk.LEAVE_NOTIFY_MASK | gtk.gdk.ENTER_NOTIFY_MASK) self.eventBox.show_all()
def __init__(self, tileWidth, tileHeight, thumb): """ @type tileWidth: int @param tileWidth: current width of map in tiles @type tileHeight: int @param tileHeight: current height of map in tiles @type thumb: cairo.ImageSurface @param thumb: thumbnail image of the map """ gtk.DrawingArea.__init__(self) self.__tWidth = thumb.get_width() self.__tHeight = thumb.get_height() self.__pixelSize = int(max(thumb.get_width(), thumb.get_height())) self.__oldWidth = tileWidth self.__oldHeight = tileHeight self.__thumb = thumb self.__newWidth = tileWidth self.__newHeight = tileHeight self.__scaleFactor = 1.0 self.__top = 0 self.__bottom = 0 self.__left = 0 self.__right = 0 self.__checkerBoard = graphics.getCheckerPattern(16) self.set_size_request(thumb.get_width(), thumb.get_height())
def __init__(self): gtk.DrawingArea.__init__(self) self.__checkerBoard = graphics.getCheckerPattern(16) self.shapes = [] vPoly = shapes.Polygon([ shapes.Point(10, 10), shapes.Point(10, 86), shapes.Point(40, 86), shapes.Point(86, 10), ]) iPoly = shapes.Polygon([ shapes.Point(106, 10), shapes.Point(96, 86), shapes.Point(140, 86), shapes.Point(120, 50), shapes.Point(160, 10), ]) circle = shapes.Circle(35) circle.setCenter(shapes.Point(200, 48)) self.shapes.append(vPoly) self.shapes.append(iPoly) self.shapes.append(circle) self.set_size_request(256, 96)
def __init__(self): gtk.DrawingArea.__init__(self) self.__checkerBoard = graphics.getCheckerPattern(16) self.shapes = [] vPoly = shapes.Polygon([shapes.Point(10, 10), shapes.Point(10, 86), shapes.Point(40, 86), shapes.Point(86, 10)]) iPoly = shapes.Polygon( [ shapes.Point(106, 10), shapes.Point(96, 86), shapes.Point(140, 86), shapes.Point(120, 50), shapes.Point(160, 10), ] ) circle = shapes.Circle(35) circle.setCenter(shapes.Point(200, 48)) self.shapes.append(vPoly) self.shapes.append(iPoly) self.shapes.append(circle) self.set_size_request(256, 96)