示例#1
0
 def build_settings(self):
     """
     This dictionary contains the values of the settings listed in setting
     "public_settings". Eg. `self.build_settings['version']`.
     """
     if is_frozen():
         return _frozen.load_build_settings()
     return _source.load_build_settings(self._project_dir)
示例#2
0
from fbs_runtime import _frozen, _source

from pathlib import Path
import sys

# constants as an alternative to using fbs app context,
#  which needs early instantiation and whatnot

_source.project_dir = Path.cwd()

IS_FROZEN = not Path(sys.executable).name == 'python.exe'   # else it would be MyApp.exe in target

RESOURCE_DIR = Path(sys.executable).parent if IS_FROZEN else _source.project_dir / 'src/main/resources/base/'

BUILD_SETTINGS = _frozen.BUILD_SETTINGS if IS_FROZEN else _source.load_build_settings(_source.project_dir)# json.load(Path.cwd() / 'src/build/settings/base.json')

BOOK_DIR = RESOURCE_DIR / 'data/cleaned'
BOOK_FP_TEMPLATE = str(BOOK_DIR / '{}.json')

###--- other app-specific constants

def _read_csv(fp):
    '''Returns list of chunks per line'''
    with open(fp, 'r') as file:
        line = file.readline()
        while line:
            yield line.split(',')
            line = file.readline()

CHAPTER_COUNTS = {