Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TODO and TODOLIST test #2

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .vs/ProjectSettings.json
Obarrie marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"CurrentProjectSetting": null
}
7 changes: 7 additions & 0 deletions .vs/VSWorkspaceState.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"ExpandedNodes": [
""
],
"SelectedNode": "\\C:\\Users\\isaacg\\Source\\Repos\\pechakuchaTest",
"PreviewInSolutionExplorer": false
}
Binary file added .vs/pechakuchaTest/v16/.suo
Binary file not shown.
Binary file added .vs/slnx.sqlite
Binary file not shown.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@ help:
live:
sphinx-autobuild --ignore _build -b dirhtml . _build/dirhtml/



.PHONY: help Makefile


# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
Expand Down
23 changes: 23 additions & 0 deletions _ext/Pechakucha/__init__.py
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's better practice to put the class hear in another file and then import it here (and probably import your pechakucha here too)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so what changes should i make ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

put the class in a file, instaed of the init and then import it here

Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from docutils import nodes
from docutils.parsers.rst import Directive
from sphinx.util.docutils import SphinxDirective

class SlideshowDirective(SphinxDirective):
has_content = True

def run(self):
container = nodes.container('', classes=['slideshow'])
self.set_source_info(container)

for image_path in self.content:
image_node = nodes.image(uri=image_path)
container += nodes.figure('', image_node)

return [container]

def setup(app):
app.add_directive("slideshow", SlideshowDirective)
app.add_css_file('slideshow.css')
app.add_js_file('slideshow.js')

return {'version': '0.1', 'parallel_read_safe': True, 'parallel_write_safe': True}
31 changes: 31 additions & 0 deletions _ext/Pechakucha/pechakucha_directive.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
from docutils import nodes
from sphinx.util.docutils import SphinxDirective
from docutils.parsers.rst import directives

class PechaKuchaDirective(SphinxDirective):
has_content = True
option_spec = {
'transition_time': directives.positive_int,
}

def run(self):
transition_time = self.options.get('transition_time', 3) # Default to 3 seconds

container = nodes.container('', classes=['pechakucha-slideshow'])
container['data-transition-time'] = str(transition_time)

self.set_source_info(container)

for image_path in self.content:
image_node = nodes.image(uri=image_path)
figure_node = nodes.figure('', image_node)
container += figure_node

return [container]

def setup(app):
app.add_directive("pechakucha", PechaKuchaDirective)
app.add_css_file('pechakucha/static/slideshow.css')
app.add_js_file('pechakucha/static/slideshow.js')

return {'version': '0.1', 'parallel_read_safe': True, 'parallel_write_safe': True}
7 changes: 7 additions & 0 deletions _ext/Pechakucha/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from setuptools import setup, find_packages

setup(
name='pechakucha',
version='0.1',
packages=find_packages(),
)
13 changes: 13 additions & 0 deletions _ext/Pechakucha/static/slideshow.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.pechakucha-slideshow figure {
display: none; /* Hide all figures initially */
position: absolute;
width: 100%;
height: 100%;
/* Other styling as needed */
}

.pechakucha-slideshow img {
width: 100%;
height: 100%;
object-fit: cover; /* Adjust this as needed */
}
24 changes: 24 additions & 0 deletions _ext/Pechakucha/static/slideshow.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
document.addEventListener("DOMContentLoaded", function() {
let slideshows = document.querySelectorAll('.pechakucha-slideshow');

slideshows.forEach(function(slideshow) {
let slides = slideshow.getElementsByTagName('figure');
let currentIndex = 0;

// Get the transition_time value from the pechakucha directive
let transitionTime = parseInt(slideshow.getAttribute('data-transition-time')) || 1000; // Default to 1000 ms (1 second)

let slideInterval = setInterval(nextSlide, transitionTime);

function nextSlide() {
slides[currentIndex].style.display = 'none';
currentIndex = (currentIndex + 1) % slides.length;
slides[currentIndex].style.display = 'block';
}

// Initialize the slideshow
Array.from(slides).forEach((slide, index) => {
slide.style.display = index === 0 ? 'block' : 'none';
});
});
});
55 changes: 55 additions & 0 deletions _ext/todo.py
Obarrie marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,58 @@ def setup(app):
'parallel_read_safe': True,
'parallel_write_safe': True,
}

# from docutils import nodes
# from docutils.parsers.rst import Directive

# from sphinx.locale import _
# from sphinx.util.docutils import SphinxDirective
# # Custom node classes
# class PechakuchaSlide(nodes.Admonition, nodes.Element):
# pass

# class PechakuchaSlideshow(nodes.General, nodes.Element):
# pass

# # Directive for individual slides
# class PechakuchaSlideDirective(SphinxDirective):
# has_content = True

# def run(self):
# text = '\n'.join(self.content)
# slide_node = PechakuchaSlide(text)
# return [slide_node]

# # Directive for the slideshow
# class PechakuchaSlideshowDirective(Directive):
# def run(self):
# return [PechakuchaSlideshow('')]

# # Visitor functions for rendering (to be expanded)
# def visit_pechakucha_slide_node(self, node):
# # HTML rendering for a slide
# pass

# def depart_pechakucha_slide_node(self, node):
# # HTML rendering end for a slide
# pass

# def visit_pechakucha_slideshow_node(self, node):
# # HTML rendering for the slideshow
# pass

# def depart_pechakucha_slideshow_node(self, node):
# # HTML rendering end for the slideshow
# pass

# # Setup function to register the extension with Sphinx
# def setup(app):
# app.add_node(PechakuchaSlide,
# html=(visit_pechakucha_slide_node, depart_pechakucha_slide_node))
# app.add_node(PechakuchaSlideshow,
# html=(visit_pechakucha_slideshow_node, depart_pechakucha_slideshow_node))

# app.add_directive('pechakucha_slide', PechakuchaSlideDirective)
# app.add_directive('pechakucha_slideshow', PechakuchaSlideshowDirective)

# return {'version': '0.1', 'parallel_read_safe': True, 'parallel_write_safe': True}
29 changes: 28 additions & 1 deletion _static/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -206,4 +206,31 @@ H1.pechakucha {
.text {
font-size: 11px
}
}
}

.popup-trigger {
cursor: pointer;
}

.popup-image {
display: none;
position: fixed;
z-index: 1000;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
max-width: 90%;
max-height: 90%;
box-shadow: 0 0 25px rgba(0, 0, 0, 0.5);
}

.popup-overlay {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.5);
z-index: 999;
}
26 changes: 26 additions & 0 deletions _templates/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{% extends '!layout.html' %}

{% block footer %}
<script>
let slideIndex = 0;
let slides = document.getElementsByClassName("slide");
if (slides.length > 0 ){
showSlides();
}

function showSlides() {
let i;
let slides = document.getElementsByClassName("slide");

for (i = 0; i < slides.length; i++) {
slides[i].style.display = "none";
}

slideIndex++;
if (slideIndex > slides.length) { slideIndex = 1 }
slides[slideIndex - 1].style.display = "block";

setTimeout(showSlides, 5000); // Change image every 5 seconds
}
</script>
{% endblock %}
Loading