Beispiel #1
0
    def initializeConfig(self):
        # set content directory
        if not os.path.isdir(self.config.CONTENT_DIRECTORY):
            possible_content_paths = ["Content", "content", "Inhalt", "inhalt"]
            warn("{0} is not a valid content directory. Trying defaults...".format(os.path.abspath(self.config.CONTENT_DIRECTORY)))
            path_set = False
            for path in possible_content_paths:
                if os.path.isdir(path):
                    info("setting content Path to : {0}".format(os.path.abspath(path)))
                    self.config.CONTENT_DIRECTORY = os.path.abspath(path)
                    path_set = True
                    break
            if not path_set:
                error("{0} is not a valid content directory. Unable to find content.".format(os.path.abspath(self.config.CONTENT_DIRECTORY)))

        #set alarm directory
        alarmDir = os.path.join(self.config.CONTENT_DIRECTORY, 'Alarm')
        if os.path.isdir(alarmDir):
            self.ALARM_DIRECTORY = alarmDir
            info("Alarm sound is loaded from {0}".format(self.ALARM_DIRECTORY))
        else:
            self.ALARM_DIRECTORY = talkshowUtils.getRelativePath('alarm')
            warn("Expected folder {1} under {0} does not exist. \
            Please create a folder named 'Alarm' under your content directory and place an alarm sound file into it. \
            Defaulting back to inbuilt alarm sound.".format(alarmDir, self.config.CONTENT_DIRECTORY))
Beispiel #2
0
    def __init__(self, parent, name, x, y, w, h, text="button", handler=None, imagePath=None):
        Widget.__init__(self, parent, name, x, y, w, h)
        self.handler = handler

        self.text = text
        self.container = Widget(self, "container", 0, 0, self.w, self.h)
        # self.outline = Box(self.container, "outline", w, h, s = EngraveSettingsOuter)
        b = self.bar = Box(self.container, "bar", w, h, s=BarSettings)

        b.x, b.y = 1, 1

        if imagePath:

            # self, p, name, path, x=0, y=0, w=None, h=None, color="#ffffff", opacity=1.0
            self.image = wrappers.Image(
                self, name, talkshowUtils.getRelativePath(imagePath)
            )  # self.style.home.background_image[5:-2]

        else:

            label = self.label = Label(self, "label", 0, 0, size=h * 2.2 / 4.0, text=text)
            label.x = (self.w - label.w) / 2
            label.y = (self.h - label.h) / 2
            label.progress = 1
Beispiel #3
0
def loadImage(path):
    newpath = talkshowUtils.getRelativePath(path)
    return pyglet.image.load(newpath)
Beispiel #4
0
 def __init__(self):
     self.CONTENT_DIRECTORY = CONTENT_DIRECTORY
     self.path = talkshowUtils.getRelativePath(os.path.join(STYLE_DIRECTORY, STYLE_FILENAME))
     self.parser = parseCSS.CSSParser(self.path)
     self.style = self.parser.style