File: thumbspage/user_configs.py

"""
================================================================================
user_configs.py, part of thumbspage [added in 1.6]

Change the Python-coded default settings here to configure thumbspage results. 

These are lesser-used options, beyond per-run console inputs, but easier to 
tailor than custom HTML.  For more advanced customizations, the index page 
can also be customized with HEADER.html and FOOTER.html insert files, and the 
viewer-page template file can be edited freely (but may be best left intact).

For example, a HEADER.html can code a custom message, whole-page font, and 
thumbs-table font for the index page.  Include CSS style blocks to set fonts
(e.g., <style>body {font-family: Arial;}</style> for the whole page, and 
<style>td {font-family: times; font-style: italic;}</style> for the table).
See the examples/ folder here for HEADER.html and other usage examples. 
Note: always use Python's True/False here, not JavaScript's true/false.
================================================================================
"""


#-------------------------------------------------------------------------------
# Output folder/file names
#-------------------------------------------------------------------------------

THUMBS = '_thumbspage'              # built subfolder name (thumbs+viewers) [1.6]
INDEX  = 'index'                    # built index-page name ('default'?, 'home'?)


#-------------------------------------------------------------------------------
# Code generation options
#-------------------------------------------------------------------------------

listSubfolders = True               # auto folder list? (or via header)
uniformColumns = True               # same-width columns? (else content)

# Now always on, for table borders [1.5]
# spanFullWindow = False            # stretch table to window's width?

# Assorted additions
useViewPort   = True                # add mobile-friendly viewport? [1.4]
caseSensOrder = True                # index/nav order case sensitive? [1.5]


#-------------------------------------------------------------------------------
# Colors: index- and viewer-page background, foreground, etc. (also Top ahead)
#-------------------------------------------------------------------------------
# Set Border=Bg color to omit index image borders.  Use any web color name or 
# a #RRGGBB hex string (e.g., 'ivory', '#633025' (a brown), '#008080' (a teal)).
#-------------------------------------------------------------------------------

# Index page:

thumbsBgColor = '#f5f5f5'           # thumbs page table background color [1.5]
thumbsFgColor = 'black'             # thumbs page table foreground (text) [1.6]
thumbsBorderColor = thumbsFgColor   # index-page thumbnail border color [1.6]

# Image-viewer pages (_and_ their info popups [2.0])

viewerBgColor = 'black'             # viewer pages background color [1.5]
viewerFgColor = 'white'             # viewer pages foreground (text) [1.6]
viewerJSColor = 'red'               # no-JavaScript note text color [1.6]
viewerBorderColor = viewerFgColor   # viewer-page image border color (=Fg?) [1.6]

# See also Top button colors ahead


#-------------------------------------------------------------------------------
# Stretch smaller images beyond actual size on viewer pages?
#-------------------------------------------------------------------------------

expandSmallImages = False           # True = show larger, but may be blurry [1.6]


#-------------------------------------------------------------------------------
# Unicode text-file settings (generally best unchanged)
#-------------------------------------------------------------------------------
# insertEncoding 
#     Used for loading index-page header/footer insert files.
#     None=default platform encoding; 'UTF-8' also handles ASCII.
#     The generated index page is encoded per outputEncoding.
#
# outputEncoding
#     Used for all generated page content, and default HTML <meta> tags.
#     Use a real encoding name (not None); 'UTF-8' works for all text.
#     Not used for URL encoding: this is always UTF-8 (see url_escape()).
#     Encoding in a HEADER.html <meta> tag should match outputEncoding.
#
# templateEncoding
#     Used for loading the viewer-page template file, "template-viewpage.html".
#     The resulting viewer pages generated are encoded per outputEncoding.
#
#     [2.0] templateEncoding is now also used to load the floating Top button's 
#     "template-floatingtop.html" (added to index pages per outputEncoding).
#-------------------------------------------------------------------------------

insertEncoding   = 'UTF-8'          # index-page header/footer files
outputEncoding   = 'UTF-8'          # used for all generated pages 
templateEncoding = 'UTF-8'          # viewer-page+Top template files [1.6] [2.0]


#-------------------------------------------------------------------------------
# Turn off disable for image-history destacking for Chrome on iOS (temporary)
#-------------------------------------------------------------------------------
# Chrome on iOS (only) has a bug in its location.replace(), which requires
# disabling thumbspage's viewer-page history destacking feature in this browser 
# alone.  Set to True if ever fixed.  See 1.6 notes in UserGuide and JS code.
# Update: still broken in May 2020's iOS Chrome 75; True here stacks all pages.
#
# Update: iOS Chrome's behavior is not fixed, but is now no different than the 
# work-around; default to True here to skip the work-around.  Navigation pages
# will be stacked on iOS Chrome until it's fixed (or this switch is changed). 
#
# Update: this iOS Chrome history bug was eventually fixed, as of Chrome 83
# in June 2020 (and perhaps earlier).  The True setting below adopts the fix,
# which no longer stacks navigation pages in browser history--as intended.
#-------------------------------------------------------------------------------

chromeiOSBackFixed = True           # True = stop disabling the work-around [1.6]


#-------------------------------------------------------------------------------
# Automatic right-side up image and thumbnail orientation (best unchanged)
#-------------------------------------------------------------------------------
# If autoRotateImages is True, images and their thumbnails are automatically 
# rotated as needed to display their top side on top.  If backupRotatedImages
# is True, any rotated images are saved to backup copies in the images folder
# with ".original" extensions before any changes are made.  To restore originals
# from backups, run examples/reorientation/restore-originals.py.  Auto-rotation 
# works only for some image types and cameras/tools, and is just an automatic
# alternative to manually rotating tilted images before running thumbspage.
#-------------------------------------------------------------------------------

autoRotateImages    = True          # False = no auto rotations attempted [1.6]
backupRotatedImages = True          # False = no ".original" backup copies [1.6]


#-------------------------------------------------------------------------------
# Use pre-1.7 CSS-based display instead of JS scaling for iOS+Safari+landscape
#-------------------------------------------------------------------------------
# As of 1.7, thumbspage uses JavaScript image scaling for landscape orientation
# in all browsers.  This works well everywhere, including iOS Safari as long as 
# users enable the toolbar-hiding option added in iOS 13.  On devices not using
# the iOS 13 option, the landscape scaled display requires a minor scroll in 
# Safari, but is better than the former CSS-based scaling.  For compatibility,
# a True here reenables the pre-1.7 CSS-based landscape display for iOS Safari.
#-------------------------------------------------------------------------------

iOSSafariLandscapeCSS = False       # True = use former legacy display [1.7]


#-------------------------------------------------------------------------------
# Don't upscale (boost) index-page text in iOS Safari in landscape orientation
#-------------------------------------------------------------------------------
# As of 1.7, thumbspage emits a "-webkit-text-size-adjust" style in default 
# thumbnail index pages, to disable iOS Safari upscaling (a.k.a. size boosting)
# for some text in landscape orientation.  This allows more text to be viewed, 
# and is new in index-page default headers only.  To restore prior behavior, 
# use either False below, or a custom HEADER.html file without the new style.
#-------------------------------------------------------------------------------

noiOSIndexTextBoost = True          # False = upscale index-page text [1.7]


#-------------------------------------------------------------------------------
# Per-gallery delay between image-viewer pages for automatic slideshows
#-------------------------------------------------------------------------------
# As of 2.0, thumbspage image-viewer pages implement an automatic slideshow 
# that advances to the next image after a fixed delay.  The delay cannot be
# changed by gallery users, but can vary per generated gallery: set it here
# before build, with a milliseconds-delay value (e.g., 3000 is 3 seconds, 
# and 100 is fun but probably too fast for anything but a strobe light).
#
# Note: the previous/next buttons work during, and do not cancel, slideshows
# in progress; the slideshow toggle and most gallery exits cancel slideshows.
#-------------------------------------------------------------------------------

autoSlideShowDelayMS = 5000     # milliseconds between pages in slideshows [2.0]


#-------------------------------------------------------------------------------
# Disable or configure the floating "Top" button displayed on index pages
#-------------------------------------------------------------------------------
# As of 2.0, thumbspage generates index-page code to display a floating
# Top button that jumps to page top when clicked/tapped.  This is intended 
# for larger indexes that have useful content at page top, and is more useful
# on mobile than desktop browsers to minimize scrolls.  Settings here can omit 
# the button in a given gallery, tailor the scroll location at which it first
# appears, and specify its distance from page bottom to allow for toolbars.
# For background and foreground colors, use any web name or #RRGGBB hex string. 
#
# Note: when using a custom FOOTER.html, you may need to add margin spacing
# below its last content line, to prevent the Top button from covering it
# (e.g., <P style="margin-bottom: 80px;"> - see template-floatingtop.html).
#-------------------------------------------------------------------------------

floatingTopEnabled = True       # True = emit code for floating Top [2.0]
floatingTopAppearAt = 500       # show Top when scroll to this pixel offset+ [2.0]
floatingTopSpaceBelow = 36      # Top's pixel offset from page bottom [2.0]

floatingTopFgColor = 'white'    # background: any 'name' or '#RRGGGBB' hex string
floatingTopBgColor = '#999'     # which is #999999, which is rgb(153, 153, 153): grey


#-------------------------------------------------------------------------------
# Enable Full fullscreen toggle button in image-viewer toolbars (limited)
#-------------------------------------------------------------------------------
# As of 2.0, thumbspage viewer page toolbars can optionally have a Full button
# which toggles fullscreen display on and off for that page - only.  Because
# this lasts for just one page and is unsupported on some platforms (e.g., iOS),
# this feature can be disabled here (it's on by default as a demo).  Users can 
# manually enable a fullscreen mode in some browsers that spans pages (e.g., all
# pages visited during an Auto slideshow); see UserGuide.html#fullscreenmanual.
#-------------------------------------------------------------------------------

showFullscreenButton = True     # True = show Full button on viewer pages [2.0]


# [end]



[Home] Books Programs Blog Python Author Training Search Email ©M.Lutz