2015-10-04 12:34:09 +00:00
|
|
|
#! /usr/bin/env python3
|
|
|
|
|
|
|
|
from random import randint
|
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
|
|
|
|
import gi
|
|
|
|
|
|
|
|
gi.require_version('Clutter', '1.0')
|
|
|
|
|
|
|
|
from gi.repository import Clutter
|
2015-10-30 16:42:05 +00:00
|
|
|
from gi.repository import GLib
|
2015-10-04 12:34:09 +00:00
|
|
|
|
2015-11-03 16:38:03 +00:00
|
|
|
from .resources import ResourcesCollection
|
|
|
|
from .utils import ensureDirExists
|
2015-10-04 12:34:09 +00:00
|
|
|
|
|
|
|
win32 = False
|
|
|
|
apple = False
|
2015-10-30 16:42:05 +00:00
|
|
|
developer = True
|
2015-10-04 12:34:09 +00:00
|
|
|
|
2015-10-30 16:42:05 +00:00
|
|
|
PREFIX = '/usr'
|
2015-10-04 12:34:09 +00:00
|
|
|
# Clutter.init()
|
|
|
|
#
|
|
|
|
# stage = Clutter.Stage()
|
|
|
|
# stage.connect('destroy', lambda x: Clutter.main_quit())
|
|
|
|
# stage.title = 'Test'
|
|
|
|
# background = Clutter.Color()
|
|
|
|
# background.red, background.blue, background.green, background.alpha = 10, 10, 10, 255
|
|
|
|
# stage.set_background_color(background)
|
|
|
|
#
|
|
|
|
# actorRectangle = Clutter.Actor()
|
|
|
|
# actorRectangle.set_size(100, 100)
|
|
|
|
# actorRectangle.set_position(100, 100)
|
|
|
|
# rectColor = Clutter.Color()
|
|
|
|
# rectColor.red, rectColor.blue, rectColor.green, rectColor.alpha = 100, 100, 100, 255
|
|
|
|
# actorRectangle.set_background_color(rectColor)
|
|
|
|
#
|
|
|
|
# def changeRectanglePosition(x, y):
|
|
|
|
# sizex, sizey = stage.get_size()
|
|
|
|
# newx = randint(0, sizex)
|
|
|
|
# newy = randint(0, sizey)
|
|
|
|
# actorRectangle.set_position(newx, newy)
|
|
|
|
#
|
|
|
|
# actorRectangle.set_reactive(True)
|
|
|
|
# actorRectangle.connect('enter-event', changeRectanglePosition)
|
|
|
|
#
|
|
|
|
# stage.add_actor(actorRectangle)
|
|
|
|
# stage.show()
|
|
|
|
# Clutter.main()
|
|
|
|
|
|
|
|
def loadResources(selfPath):
|
|
|
|
dirs = []
|
|
|
|
|
|
|
|
if win32:
|
|
|
|
dirs.append(getStorage().get("path", "") + "\\res")
|
|
|
|
elif apple:
|
|
|
|
dirs.append(getResourcesPath(selfPath))
|
|
|
|
else:
|
|
|
|
dirs.append(PREFIX + "/share/einstein/res")
|
|
|
|
dirs.append(os.environ["HOME"] + "/.einstein/res")
|
|
|
|
|
2015-10-30 16:42:05 +00:00
|
|
|
if developer:
|
|
|
|
dirs.append(os.path.dirname(os.path.dirname(__file__)))
|
|
|
|
|
2015-10-04 12:34:09 +00:00
|
|
|
dirs.append("res")
|
|
|
|
dirs.append(".")
|
|
|
|
resources = ResourcesCollection(dirs)
|
|
|
|
msg.load()
|
|
|
|
|
2015-11-03 16:38:03 +00:00
|
|
|
def main(script, *args):
|
2015-10-04 12:34:09 +00:00
|
|
|
ensureDirExists(os.environ["HOME"] + "/.einstein")
|
|
|
|
|
2015-11-03 14:53:47 +00:00
|
|
|
loadResources(sys.argv[0])
|
|
|
|
initScreen()
|
|
|
|
initAudio()
|
|
|
|
menu()
|
|
|
|
getStorage().flush()
|
2015-10-04 12:34:09 +00:00
|
|
|
|
|
|
|
# screen.doneCursors();
|