User can now insert their own CSS file
This commit is contained in:
10
Qalbum.py
10
Qalbum.py
@@ -26,7 +26,7 @@ from datetime import datetime
|
|||||||
|
|
||||||
# (c) ville.rantanen@helsinki.fi
|
# (c) ville.rantanen@helsinki.fi
|
||||||
|
|
||||||
__version__='2.1'
|
__version__='2.2'
|
||||||
|
|
||||||
webfilesearch=re.compile('.*index.html$|gallerystyle.css$|galleryscript.js$|descriptions.csv$|^info.txt$|\..*',re.I)
|
webfilesearch=re.compile('.*index.html$|gallerystyle.css$|galleryscript.js$|descriptions.csv$|^info.txt$|\..*',re.I)
|
||||||
imagesearch=re.compile('.*\.jpg$|.*\.jpeg$|.*\.gif$|.*\.png$|.*\.svg$|.*\.pdf$',re.I)
|
imagesearch=re.compile('.*\.jpg$|.*\.jpeg$|.*\.gif$|.*\.png$|.*\.svg$|.*\.pdf$',re.I)
|
||||||
@@ -412,6 +412,8 @@ def setupoptions():
|
|||||||
parser.add_argument("--version",action='version', version=__version__)
|
parser.add_argument("--version",action='version', version=__version__)
|
||||||
parser.add_argument("-r",action="store_true",dest="reverse",default=False,
|
parser.add_argument("-r",action="store_true",dest="reverse",default=False,
|
||||||
help="Reverse sort orded")
|
help="Reverse sort orded")
|
||||||
|
parser.add_argument("-s",type=str,dest="style",
|
||||||
|
help="User defined CSS style file.")
|
||||||
parser.add_argument("-t",action="store_true",dest="timesort",default=False,
|
parser.add_argument("-t",action="store_true",dest="timesort",default=False,
|
||||||
help="Sort by file modification time")
|
help="Sort by file modification time")
|
||||||
parser.add_argument("-a",action="store_false",dest="attachments",default=True,
|
parser.add_argument("-a",action="store_false",dest="attachments",default=True,
|
||||||
@@ -445,6 +447,8 @@ def setupdefaultoptions(options):
|
|||||||
options.recursive=True
|
options.recursive=True
|
||||||
if 'reverse' not in options:
|
if 'reverse' not in options:
|
||||||
options.reverse=False
|
options.reverse=False
|
||||||
|
if 'style' not in options or options.style is None:
|
||||||
|
options.style=os.path.join(os.path.abspath(os.path.dirname(os.path.realpath(sys.argv[0]))),'gallerystyle.css')
|
||||||
if 'timesort' not in options:
|
if 'timesort' not in options:
|
||||||
options.timesort=False
|
options.timesort=False
|
||||||
if 'width' not in options:
|
if 'width' not in options:
|
||||||
@@ -458,7 +462,9 @@ def execute_plain():
|
|||||||
# Copy all resources to target folder
|
# Copy all resources to target folder
|
||||||
pathname=os.path.dirname(os.path.realpath(sys.argv[0]))
|
pathname=os.path.dirname(os.path.realpath(sys.argv[0]))
|
||||||
fullpath=os.path.abspath(pathname)
|
fullpath=os.path.abspath(pathname)
|
||||||
shutil.copyfile(os.path.join(fullpath,'gallerystyle.css'),os.path.join(options.startpath,'gallerystyle.css'))
|
if not os.path.exists(options.style):
|
||||||
|
raise IOError('File not found: "'+options.style+'"')
|
||||||
|
shutil.copyfile(options.style,os.path.join(options.startpath,'gallerystyle.css'))
|
||||||
shutil.copyfile(os.path.join(fullpath,'galleryscript.js'),os.path.join(options.startpath,'galleryscript.js'))
|
shutil.copyfile(os.path.join(fullpath,'galleryscript.js'),os.path.join(options.startpath,'galleryscript.js'))
|
||||||
|
|
||||||
inputs=[]
|
inputs=[]
|
||||||
|
|||||||
Reference in New Issue
Block a user