Browse Source

Add a cli option to specify the theme.

pull/9/merge
Simon 14 years ago
parent
commit
97063d8246
  1. 7
      sigal/__init__.py
  2. 5
      sigal/gallery.py
  3. 4
      sigal/writer.py

7
sigal/__init__.py

@ -78,13 +78,16 @@ def main():
parser.add_argument('--version', action='version',
version="%(prog)s version " + __version__)
parser.add_argument("-f", "--force", action='store_true',
help="force the reprocessing of existing images")
help="Force the reprocessing of existing images.")
parser.add_argument('-v', '--verbose', action='store_const',
const=logging.INFO, dest='verbosity',
help='Show all messages.')
parser.add_argument('-d', '--debug', action='store_const',
const=logging.DEBUG, dest='verbosity',
help='Show all message, including debug messages.')
parser.add_argument("-t", "--theme", action='store',
help="Specify a theme directory, or a theme name for "
"the themes delivered with Sigal.")
args = parser.parse_args()
level = args.verbosity or logging.WARNING
@ -102,5 +105,5 @@ def main():
# create gallery
gallery = Gallery(settings, args.input_dir, args.output_dir,
force=args.force)
force=args.force, theme=args.theme)
gallery.build()

5
sigal/gallery.py

@ -40,13 +40,14 @@ DESCRIPTION_FILE = "index.md"
class Gallery:
"Prepare images"
def __init__(self, settings, input_dir, output_dir, force=False):
def __init__(self, settings, input_dir, output_dir, force=False,
theme=None):
self.settings = settings
self.force = force
self.input_dir = os.path.abspath(input_dir)
self.output_dir = os.path.abspath(output_dir)
self.logger = logging.getLogger(__name__)
self.writer = Writer(settings, output_dir)
self.writer = Writer(settings, output_dir, theme=theme)
def build_paths(self):
"Build the list of directories with images"

4
sigal/writer.py

@ -53,10 +53,10 @@ def do_link(link, title):
class Writer():
"""Generate html pages for each directory of images."""
def __init__(self, settings, output_dir, theme='default'):
def __init__(self, settings, output_dir, theme=None):
self.settings = settings
self.output_dir = os.path.abspath(output_dir)
self.theme = settings['theme'] or theme
self.theme = theme or settings['theme']
self.logger = logging.getLogger(__name__)
# search the theme in sigal/theme if the given one does not exists

Loading…
Cancel
Save