0c261c8313
It just causes problems
80 lines
1.9 KiB
Python
Executable File
80 lines
1.9 KiB
Python
Executable File
#! /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
|
|
from gi.repository import GLib
|
|
|
|
from resources import ResourcesCollection
|
|
from utils import ensureDirExists
|
|
|
|
win32 = False
|
|
apple = False
|
|
developer = True
|
|
|
|
PREFIX = '/usr'
|
|
# 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")
|
|
|
|
if developer:
|
|
dirs.append(os.path.dirname(os.path.dirname(__file__)))
|
|
|
|
dirs.append("res")
|
|
dirs.append(".")
|
|
resources = ResourcesCollection(dirs)
|
|
msg.load()
|
|
|
|
if __name__ == '__main__':
|
|
ensureDirExists(os.environ["HOME"] + "/.einstein")
|
|
|
|
loadResources(sys.argv[0])
|
|
initScreen()
|
|
initAudio()
|
|
menu()
|
|
getStorage().flush()
|
|
|
|
# screen.doneCursors();
|