from __future__ import absolute_import from math import ceil as float_ceil ceil = lambda f: int(float_ceil(f)) import cairo from gi.repository import Gtk from gi.repository import Gdk from gi.repository import GObject from .OverlayWindow import OverlayWindow POSITIONS_COUNT = 5 NORTH, EAST, SOUTH, WEST, CENTER = range(POSITIONS_COUNT) DX_DY = ((0,-1), (1,0), (0,1), (-1,0), (0,0)) PADDING_X = 0.2 # Amount of button width PADDING_Y = 0.4 # Amount of button height class StarArrowButton (OverlayWindow): __gsignals__ = { 'dropped' : (GObject.SignalFlags.RUN_FIRST, None, (int, object)), 'hovered' : (GObject.SignalFlags.RUN_FIRST, None, (int, object)), 'left' : (GObject.SignalFlags.RUN_FIRST, None, ()), } def __init__ (self, parent, northSvg, eastSvg, southSvg, westSvg, centerSvg, bgSvg): OverlayWindow.__init__(self, parent) self.myparent = parent self.svgs = (northSvg, eastSvg, southSvg, westSvg, centerSvg)
def ceil(num): return int(float_ceil(num))