-
""".format(
@@ -208,8 +227,22 @@ function create_button(direction, to) {{
image=image, title=title, content=content
)
+
+ def is_created_with_mirva(self):
+
+ with open("index.html", "rt") as fp:
+ for line in fp.readlines():
+ if line.strip() == '
':
+ return True
+ return False
+
def write_index(self):
+ if os.path.exists("index.html"):
+ if not self.is_created_with_mirva():
+ print("index.html exists, and it's not written with Mirva. Not overwriting.")
+ sys.exit(1)
+
with open("index.html", "wt") as fp:
fp.write(
self.get_index(
@@ -227,7 +260,13 @@ function create_button(direction, to) {{
except Exception:
pass
- for f in ("style.css", "arrow_up.png", "arrow_down.png", "banner.jpg", "mirva.ico"):
+ for f in (
+ "style.css",
+ "arrow_up.png",
+ "arrow_down.png",
+ "banner.jpg",
+ "mirva.ico",
+ ):
if os.path.exists(os.path.join(self.resource_dir, f)):
continue
shutil.copy(
@@ -246,7 +285,6 @@ function create_button(direction, to) {{
if link:
r = 0
-
force = self.options.force
for f in self.file_list:
res = "{:d}x{:d}>".format(int(r), int(r))
@@ -260,10 +298,7 @@ function create_button(direction, to) {{
if not os.path.exists(outfile):
if link:
- os.symlink(
- "../{}".format(f),
- outfile
- )
+ os.symlink("../{}".format(f), outfile)
continue
convargs = [
@@ -283,6 +318,3 @@ function create_button(direction, to) {{
sys.stdout.write(".")
sys.stdout.flush()
subprocess.call(convargs)
-
-
-
diff --git a/mirva/resources/arrow_down.png b/mirva/resources/arrow_down.png
index 162483c..6dbc50c 100644
Binary files a/mirva/resources/arrow_down.png and b/mirva/resources/arrow_down.png differ
diff --git a/mirva/resources/arrow_up.png b/mirva/resources/arrow_up.png
index d00f450..e25e8fb 100644
Binary files a/mirva/resources/arrow_up.png and b/mirva/resources/arrow_up.png differ
diff --git a/mirva/resources/banner.jpg b/mirva/resources/banner.jpg
index 8fde91b..eea507c 100644
Binary files a/mirva/resources/banner.jpg and b/mirva/resources/banner.jpg differ
diff --git a/mirva/resources/style.css b/mirva/resources/style.css
index 2a2ad29..d710f26 100644
--- a/mirva/resources/style.css
+++ b/mirva/resources/style.css
@@ -6,112 +6,112 @@ Released for free under the Creative Commons Attribution License
*/
body {
- margin: 0;
- padding: 0;
- background-color: #eeeeee;
- font-family: Arial, Helvetica, sans-serif;
- font-size: 12px;
- color: #383838;
+ margin: 0;
+ padding: 0;
+ background-color: #eeeeee;
+ font-family: Arial, Helvetica, sans-serif;
+ font-size: 12px;
+ color: #383838;
overflow-x: hidden;
}
h1, h2, h3 {
- margin: 0;
- padding: 0;
- font-weight: normal;
- color: #000000;
+ margin: 0;
+ padding: 0;
+ font-weight: normal;
+ color: #000000;
}
h1 {
- font-size: 2em;
+ font-size: 2em;
}
h2 {
- font-size: 2.4em;
+ font-size: 2.4em;
}
h3 {
- font-size: 1.6em;
+ font-size: 1.6em;
}
p, ul, ol {
- margin-top: 0;
- line-height: 180%;
+ margin-top: 0;
+ line-height: 180%;
}
ul, ol {
}
a {
- text-decoration: none;
- color: #7EAD01;
+ text-decoration: none;
+ color: #7EAD01;
}
a:hover {
}
#wrapper {
- width: 100vw;
- margin: 0 auto;
- padding: 0;
+ width: 100vw;
+ margin: 0 auto;
+ padding: 0;
}
/* Header */
#header {
- clear: both;
- width: 100vw;
- height: 330px;
- margin: 0 auto;
- padding: 0px;
- background: url(banner.jpg) no-repeat left top;
- background-size: cover;
+ clear: both;
+ width: 100vw;
+ height: 330px;
+ margin: 0 auto;
+ padding: 0px;
+ background: url(banner.jpg) no-repeat left top;
+ background-size: cover;
}
/* Logo */
#logo {
- margin: 0;
- padding: 0px 0px 0px 0px;
- color: #000000;
+ margin: 0;
+ padding: 0px 0px 0px 0px;
+ color: #000000;
}
#logo h1, #logo p {
- margin: 0;
- padding: 0;
+ margin: 0;
+ padding: 0;
color: #ffffff;
}
#logo h1 {
- padding-top: 160px;
- letter-spacing: -1px;
- font-size: 3.8em;
- word-break: break-all;
- text-align: center;
+ padding-top: 160px;
+ letter-spacing: -1px;
+ font-size: 3.8em;
+ word-break: break-all;
+ text-align: center;
}
#logo p {
- margin: 0;
- padding: 0px 0 0 60px;
- font: normal 14px Georgia, "Times New Roman", Times, serif;
- font-style: italic;
- color: #FFFFFF;
+ margin: 0;
+ padding: 0px 0 0 60px;
+ font: normal 14px Georgia, "Times New Roman", Times, serif;
+ font-style: italic;
+ color: #FFFFFF;
}
#logo a {
- border: none;
- background: none;
- text-decoration: none;
- color: #FFFFFF;
+ border: none;
+ background: none;
+ text-decoration: none;
+ color: #FFFFFF;
}
/* Page */
#page {
- width: calc(100vw - 128px);
- margin: 0 auto;
- padding: 0px 0px 0px 0px;
+ width: calc(100vw - 128px);
+ margin: 0 auto;
+ padding: 0px 0px 0px 0px;
}
@media only screen and (max-width: 800px) {
#page {
@@ -120,7 +120,7 @@ a:hover {
}
#page-bgtop {
- padding: 20px 0px;
+ padding: 20px 0px;
}
#page-bgbtm {
@@ -130,11 +130,11 @@ a:hover {
#content {
width: 100%;
- padding: 30px 0px 0px 0px;
+ padding: 30px 0px 0px 0px;
}
.post {
- margin-bottom: 15px;
+ margin-bottom: 15px;
border-top: lightgray dashed 2px;
padding-top: 2px;
}
@@ -146,24 +146,24 @@ a:hover {
}
.post .title {
- height: 38px;
- margin-bottom: 10px;
- padding: 12px 0 0 0px;
- letter-spacing: -.5px;
- color: #000000;
+ height: 38px;
+ margin-bottom: 10px;
+ padding: 12px 0 0 0px;
+ letter-spacing: -.5px;
+ color: #000000;
}
.post .title a {
- color: #000000;
- border: none;
+ color: #000000;
+ border: none;
}
.post .meta {
- padding: 5px 0px 5px 0px;
- text-align: center;
- font-family: Arial, Helvetica, sans-serif;
- font-size: 13px;
- font-weight: bold;
+ padding: 5px 0px 5px 0px;
+ text-align: center;
+ font-family: Arial, Helvetica, sans-serif;
+ font-size: 13px;
+ font-weight: bold;
}
.post .meta .name {
@@ -177,14 +177,14 @@ a:hover {
}
.post .entry {
- padding: 0px 5px 20px 5px;
- text-align: justify;
+ padding: 0px 5px 20px 5px;
+ text-align: justify;
}
.links {
- padding-top: 20px;
- font-size: 12px;
- font-weight: bold;
+ padding-top: 20px;
+ font-size: 12px;
+ font-weight: bold;
}
.center {
@@ -199,32 +199,33 @@ a:hover {
}
@media only screen and (max-width: 800px) {
.post_image {
- max-width: 100vw;
+ max-height: calc(100vh - 2px);
+ max-width: calc(100vw - 2px);
}
}
/* Footer */
#footer {
- height: 50px;
- margin: 0 auto;
- padding: 0px 0 15px 0;
- background: #ECECEC;
- border-top: 1px solid #DEDEDE;
- font-family: Arial, Helvetica, sans-serif;
+ height: 50px;
+ margin: 0 auto;
+ padding: 0px 0 15px 0;
+ background: #ECECEC;
+ border-top: 1px solid #DEDEDE;
+ font-family: Arial, Helvetica, sans-serif;
}
#footer p {
- margin: 0;
- padding-top: 20px;
- line-height: normal;
- font-size: 9px;
- text-transform: uppercase;
- text-align: center;
- color: #A0A0A0;
+ margin: 0;
+ padding-top: 20px;
+ line-height: normal;
+ font-size: 9px;
+ text-transform: uppercase;
+ text-align: center;
+ color: #A0A0A0;
}
#footer a {
- color: #8A8A8A;
+ color: #8A8A8A;
}
/* navi */
diff --git a/scripts/mirva b/scripts/mirva
deleted file mode 100755
index 5965fdc..0000000
--- a/scripts/mirva
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/usr/bin/env python3
-# -*- coding: utf-8 -*-
-from mirva.mirva import Mirva
-
-if __name__ == '__main__':
- Mirva()
diff --git a/setup.cfg b/setup.cfg
index b88034e..12edba2 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,2 +1,10 @@
[metadata]
description-file = README.md
+version = attr: mirva.__version__
+license = MIT
+description = A tool to create a web gallery from a folder of images.
+author = Ville Rantanen
+author_email = ville.q.rantanen@gmail.com
+url = https://bitbucket.org/MoonQ/mirva
+download_url = https://bitbucket.org/MoonQ/mirva/get/master.zip
+keywords = album, generator, javascript
diff --git a/setup.py b/setup.py
index 20ed7d5..e62edf7 100644
--- a/setup.py
+++ b/setup.py
@@ -1,18 +1,14 @@
from distutils.core import setup
+
setup(
- name = 'mirva',
- packages = ['mirva'],
- scripts = ['scripts/mirva',
- ],
- package_data={'':['resources/*']},
- include_package_data=True,
- version = '20210820',
- description = 'A tool to create a web gallery from a folder of images.',
- author = 'Ville Rantanen',
- author_email = 'ville.q.rantanen@gmail.com',
- url = 'https://bitbucket.org/MoonQ/mirva',
- download_url = 'https://bitbucket.org/MoonQ/mirva/get/master.zip',
- keywords = ['album', 'generator', 'javascript'],
- classifiers = [],
- license = 'MIT',
+ name="mirva",
+ packages=["mirva"],
+ package_data={"": ["resources/*"]},
+ include_package_data=True,
+ classifiers=[],
+ entry_points={
+ "console_scripts": [
+ "mirva=mirva:main",
+ ],
+ },
)