コード例 #1
0
    def __init__(self, title="", verbosity=1):
        """Initialize a new shell."""

        # Load localized strings
        Language.load("shell.ini")

        self._title = title
        self._width = 79
        self._running = False
        self._verbosity = verbosity
        self._commands = {}

        self.add_command(commands.Exit())
        self.add_command(commands.Help())
コード例 #2
0
 def __init__(self, verbosity=1):
     shell.Shell.__init__(self, title="beer", verbosity=verbosity)
     Language.load("beershell.ini")
     self.add_command(convert.Command())
     self.add_command(hop.Command())
     self.add_command(yeast.Command())
コード例 #3
0
ファイル: __init__.py プロジェクト: julienvaslet/beer
from .unit import *
from .time import *
from .color import *
from .weight import *
from .volume import *
from .density import *
from .extract import *
from .pressure import *
from .proportion import *
from .bitterness import *
from .temperature import *

from language import Language

Language.load( "units.ini" )

def _load_units( cls ):
	"""Recursively loads all subclasses of Unit into *.units class variables."""
	
	for unit_cls in cls.__subclasses__():
		_load_units( unit_cls )
		
		# If the class is an Unit
		if "unit" in unit_cls.__dict__:
			cls.units[unit_cls.unit] = unit_cls
			
			for multiple in unit_cls.multiples:
				cls.units[multiple] = unit_cls
		
		# If the class is an Unit-container it is merged with its parent
コード例 #4
0
ファイル: beer.py プロジェクト: julienvaslet/beer
from language import Language
from beershell import *
from brewery.ingredients import *
from units import *

if __name__ == "__main__":

    argv = list(sys.argv)
    argv.pop(0)

    if len(argv) > 0 and argv[0] == "autocomplete":
        argv.pop(0)

        if len(argv) > 0:
            Language.initialize(lang="en")
            Language.load("hops.ini")
            Language.load("ingredients.ini")
            ingredient.Ingredient.load_directory("data%singredients" % os.sep)

            shell = beershell.BeerShell(verbosity=0)
            choices = shell.autocomplete(argv[0])

        if len(choices):
            print("\n".join(choices))

    else:
        # Development needs
        log.verbosity = 3

        Language.initialize(lang="en")
        Language.load("hops.ini")