Example #1
0
    def process(self):
        # TODO fix font locations to be configurable
        imlib2.add_font_path("/usr/share/fonts/truetype/")
        imlib2.add_font_path("/usr/share/fonts/truetype/freefont/")
        self.default_font = imlib2.load_font("FreeSans", 20)

        wf = self.artifact.previous_artifact_filepath
        image = imlib2.open(wf)
        new_image = self.do_im(image)

        # Most of the time, we can just modify the image in do_im, but in some
        # cases we need to return a new image object, i.e. when cropping. So,
        # if do_im returns anything replace the image with the returned image.
        if new_image:
            image = new_image

        image.save(self.artifact.filepath())
Example #2
0
    def process(self):
        font_paths = self.FONT_PATHS
        if self.artifact.args.has_key('font-path'):
            font_paths.extend(self.artifact.args['font-path'])

        for path in font_paths:
            imlib2.add_font_path(path)

        self.default_font = imlib2.load_font("FreeSans", 20)

        wf = self.artifact.previous_artifact_filepath
        image = imlib2.open(wf)
        new_image = self.do_im(image)

        # Most of the time, we can just modify the image in do_im, but in some
        # cases we need to return a new image object, i.e. when cropping. So,
        # if do_im returns anything replace the image with the returned image.
        if new_image:
            image = new_image

        image.save(self.artifact.filepath())
Example #3
0
from kaa import imlib2
from util import vfs, objectcache, webcache

widget_styles = {}
definitions = {}
icontheme = None
# Dictionary mapping <filename>-<scaletype>-<size> to an image
image_cache = objectcache.ObjectCache(30, 'dialog images')

USABLE_WIDTH  = config.CONF.width-(config.OSD_OVERSCAN_LEFT+config.OSD_OVERSCAN_RIGHT)
USABLE_HEIGHT = config.CONF.height-(config.OSD_OVERSCAN_TOP+config.OSD_OVERSCAN_BOTTOM)
USABLE_RESOLUTION = '%dx%d' % (USABLE_WIDTH, USABLE_HEIGHT)

# Make sure that the font path is added to imlib2
imlib2.add_font_path(config.FONT_DIR)

def register_definition(name, position, size):
    osdcontainer = OSDDialog(name, position, size)
    definitions[name] = osdcontainer
    return osdcontainer

def get_definition(name):
    if name in definitions:
        return definitions[name]
    return None

def register_widget_style(name, states):
    widget_styles[name] = states

def unregister_widget_style(name):
Example #4
0
        window.show()
    
    if key == 's':
        global shaped
        shaped = not shaped
        if shaped:
            window.set_shape_mask_from_imlib2_image(image, (0,0))
        else:
            window.reset_shape_mask()

def mapped():
    window.focus()

window = display.X11Window(size = (800, 600), title = "Kaa Display Test")

imlib2.add_font_path("data")

image = imlib2.new((800,600))
image.clear()
image.draw_ellipse((400,300), (400, 300), (0,0,255,128))
image.draw_text((10, 50), "This is a Kaa Display Shaped Window Test", (255,255,255,255), "VeraBd/24")

window.signals['expose_event'].connect(redraw)
window.signals['key_press_event'].connect(key_pressed)
window.signals['map_event'].connect(mapped)

window.set_decorated(decorated)
window.set_shape_mask_from_imlib2_image(image, (0,0))
window.show()

Example #5
0
def add_font_path(path):
    return imlib2.add_font_path(path)
Example #6
0
def mapped():
    window.focus()


if x11.get_display().composite_supported():
    composite = True
else:
    print 'Compositing not supported on this display!'
    sys.exit(1)

window = display.X11Window(size=(800, 600),
                           title="Kaa Display Test",
                           composite=composite)

imlib2.add_font_path("data")

image = imlib2.new((800, 600))
image.clear()
image.draw_ellipse((400, 300), (400, 300), (0, 0, 255, 128))
image.draw_text((10, 50), "This is a Kaa Display Composited Window Test",
                (255, 255, 255, 255), "VeraBd/24")

window.signals['expose_event'].connect(redraw)
window.signals['key_press_event'].connect(key_pressed)
window.signals['map_event'].connect(mapped)

window.set_decorated(decorated)
window.show()

print 'Shaped window test app'
Example #7
0
from util import vfs, objectcache, webcache

widget_styles = {}
definitions = {}
icontheme = None
# Dictionary mapping <filename>-<scaletype>-<size> to an image
image_cache = objectcache.ObjectCache(30, 'dialog images')

USABLE_WIDTH = config.CONF.width - (config.OSD_OVERSCAN_LEFT +
                                    config.OSD_OVERSCAN_RIGHT)
USABLE_HEIGHT = config.CONF.height - (config.OSD_OVERSCAN_TOP +
                                      config.OSD_OVERSCAN_BOTTOM)
USABLE_RESOLUTION = '%dx%d' % (USABLE_WIDTH, USABLE_HEIGHT)

# Make sure that the font path is added to imlib2
imlib2.add_font_path(config.FONT_DIR)


def register_definition(name, position, size):
    osdcontainer = OSDDialog(name, position, size)
    definitions[name] = osdcontainer
    return osdcontainer


def get_definition(name):
    if name in definitions:
        return definitions[name]
    return None


def register_widget_style(name, states):
Example #8
0
File: canvas.py Project: clones/kaa
 def _sync_property_fontpath(self):
     self.get_evas().fontpath = self["fontpath"]
     if imlib2:
         for path in self["fontpath"]:
             imlib2.add_font_path(path)