コード例 #1
0
    def _validate(self, theme_name):
        path = ""

        try:
            if theme_name in self.data:
                raise Exception("Duplicate theme. Is it already added?")

            path = "%s/theme.json" % theme_name

            options = "".join(utils.file_read(path))
            blob = utils.is_json(options)
            theme_name = Theme(name=theme_name, data=blob)

            return theme_name

        except IOError:
            raise Exception(
                "Could not read \"%s%s\" - Themes file not found." %
                (self.base, path))

        except ValueError as ex:
            raise Exception("Could not parse \"%s\" - Contents not json: %s" %
                            (path, str(ex)))

        except Exception as ex:
            raise Exception(str(ex))
コード例 #2
0
ファイル: themes.py プロジェクト: nick3085/findex-gui
    def validate_dir(self, dir):
        try:
            if dir in self.themes:
                raise Exception('Duplicate theme. Is it already added?')

            path = '%s/%s/theme.json' % (self.theme_dir, dir)

            options = ''.join(utils.file_read(path))
            blob = utils.is_json(options)

            theme = Theme(data=blob)
            self.themes[theme['theme_name']] = theme.options

        except IOError:
            raise Exception("Could not read \"%s%s\" - Themes file not found." % (self.theme_dir, path))

        except ValueError as ex:
            raise Exception("Could not parse \"%s\" - Contents not json: %s" % (path, str(ex)))

        except Exception as ex:
            raise Exception(str(ex))
コード例 #3
0
ファイル: themes.py プロジェクト: skftn/findex-gui
    def _validate(self, theme_name):
        path = ""

        try:
            if theme_name in self.data:
                raise Exception("Duplicate theme. Is it already added?")

            path = "%s/theme.json" % theme_name

            options = "".join(utils.file_read(path))
            blob = utils.is_json(options)
            theme_name = Theme(name=theme_name, data=blob)

            return theme_name

        except IOError:
            raise Exception('Could not read "%s%s" - Themes file not found.' % (self.base, path))

        except ValueError as ex:
            raise Exception('Could not parse "%s" - Contents not json: %s' % (path, str(ex)))

        except Exception as ex:
            raise Exception(str(ex))
コード例 #4
0
ファイル: themes.py プロジェクト: iksteen/findex-gui
    def validate_dir(self, dir):
        try:
            if dir in self.themes:
                raise Exception('Duplicate theme. Is it already added?')

            path = '%s%s/theme.json' % (self.theme_dir, dir)

            options = ''.join(utils.file_read(path))
            blob = utils.is_json(options)

            theme = Theme(data=blob)
            self.themes[theme['theme_name']] = theme.options

        except IOError:
            raise Exception(
                "Could not read \"%s%s\" - Themes file not found." %
                (self.theme_dir, path))

        except ValueError as ex:
            raise Exception("Could not parse \"%s\" - Contents not json: %s" %
                            (path, str(ex)))

        except Exception as ex:
            raise Exception(str(ex))