-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
74 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,50 @@ | ||
from genhtml.w3c.tag import tag | ||
from genhtml.w3c.figure import figure | ||
from genhtml.w3c.div import div | ||
from genhtml.w3c.image import image | ||
|
||
class photo_builder(tag): | ||
div_id = 0 | ||
auto_index = 0 | ||
|
||
def __init__(self, *args, **kwargs): | ||
# no inheritance | ||
super().__init__([], {}) | ||
|
||
photo_builder.auto_index += 1 | ||
|
||
image_file = kwargs.get("src") | ||
file_path = kwargs.get("path") | ||
file_style = kwargs.get("style") | ||
|
||
photo_builder.div_id += 1 | ||
|
||
display = "display:visible;"\ | ||
if file_style == "folder" else "display:none;" | ||
|
||
div_id = f"photo{photo_builder.div_id}"\ | ||
if file_style != "folder" else "" | ||
|
||
class_type = "folder" if file_style == "folder" else "picture" | ||
|
||
self.set_content( | ||
f""" | ||
<div data-target="{div_id}" data-path="{file_path}" class="column is-one-quarter {class_type} hoverArea modal-button js-modal-trigger"> | ||
<figure class="image is-square div-bottom"> | ||
<img src="{image_file}" class="rounded" style="z-index:-1;"> | ||
<div id="{div_id}" class="box is-align-content-center" | ||
style="{display} width:100%; background-color:rgba(0,0,0,0.6);"> | ||
<div class="center-text">{file_path}</div> | ||
</div> | ||
</figure> | ||
</div> | ||
""" | ||
).make_element() | ||
file_type = kwargs.get("type") | ||
|
||
if file_type == "folder": | ||
div_id = "" | ||
display_class = "display:visible;" | ||
else: | ||
div_id = f"photo_{photo_builder.auto_index}" | ||
display_class = "display:none;" | ||
|
||
_div = div( | ||
figure( | ||
image( | ||
src=f"{image_file}", | ||
style="z-index:-1;", | ||
class_="rounded" | ||
), | ||
div( | ||
div(class_="center-text", | ||
content=f"{file_path}"), | ||
id_=f"{div_id}", | ||
class_="box is-align-content-center", | ||
style=f"{display_class} width:100%;"\ | ||
f"background-color:rgba(0,0,0,0.6);", | ||
|
||
), | ||
class_="image is-squre div-bottom", | ||
), | ||
data_target=f"{div_id}", | ||
data_path=f"{file_path}", | ||
class_=f"column is-one-quarter modal-button"\ | ||
f"js-modal-trigger hoverArea {file_type}" | ||
) | ||
|
||
self.append(_div) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
from genhtml.w3c.tag import tag | ||
|
||
|
||
class br(tag): | ||
def __init__(self, *args, **kwargs): | ||
super().__init__([], {}) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from genhtml.w3c.tag import tag | ||
|
||
|
||
class figure(tag): | ||
def __init__(self, *args, **kwargs): | ||
super().__init__(*args, **kwargs) | ||
self.set_tag("figure").make_element() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters