Skip to content

Commit

Permalink
Merge pull request #29 from MahmoudHousam/22-simulate-a-presentation
Browse files Browse the repository at this point in the history
Pull Request: New Features and Enhancements
  • Loading branch information
MahmoudHousam authored Dec 20, 2024
2 parents 81ea251 + 7accf85 commit e739f2f
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ tof.py
TOF Analysis.html
Example Report.html
Test Report.html
Integration Test Report.html
demo.mp4
example_options2.py
.vscode/
Expand Down
5 changes: 0 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,6 @@ Besides its main job, this repo intends to teach aspiring data analysts or even

##### Useful Resources

These are the resources that helped this work appear
* [GitHub Actions for Python Packages: How to Automate Releases to PyPi](https://www.youtube.com/watch?v=NMQwzI9hprg&ab_channel=ArjanCodes)

* [Automated Python Unit Testing Made Easy with Pytest and GitHub Actions](https://pytest-with-eric.com/integrations/pytest-github-actions/)

* [Building and testing Python | Official GitHub Actions Docs](https://docs.github.com/en/actions/use-cases-and-examples/building-and-testing/building-and-testing-python)

* [pypi-publish | GitHub Action](https://github.com/marketplace/actions/pypi-publish)
Binary file modified demo/demo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
58 changes: 56 additions & 2 deletions templates/report_template.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,19 @@
overflow: hidden;
}
.page {
display: none;
position: absolute;
top: 0;
left: 0;
height: 100vh;
width: 100vw;
opacity: 0;
visibility: hidden;
transition: opacity 0.5s ease-in-out, visibility 0.5s ease-in-out;
}
.active {
display: block;
opacity: 1;
visibility: visible;
z-index: 1;
}
.plotly-graph-div {
height: 100vh !important;
Expand All @@ -45,6 +52,9 @@
<script>
var currentPage = 0;
var totalPages = {{ total_pages }};
var slideTimer = null;
var timerRunning = false;

function showPage(page) {
document.querySelectorAll('.page').forEach(function(div, index) {
div.classList.remove('active');
Expand All @@ -65,11 +75,55 @@
showPage(currentPage);
}
}

function goToFirstPage() {
currentPage = 0;
showPage(currentPage);
}

function goToLastPage() {
currentPage = totalPages - 1;
showPage(currentPage);
}

function startTimer() {
if (!timerRunning) {
slideTimer = setInterval(() => {
if (currentPage < totalPages - 1) {
nextPage();
} else {
clearInterval(slideTimer);
timerRunning = false;
}
}, 10000);
timerRunning = true;
console.log("Timer Started!");
}
}

function stopTimer() {
if (timerRunning) {
clearInterval(slideTimer);
timerRunning = false;
console.log("Timer Stopped!")
}
}

document.addEventListener('keydown', function(event) {
if (event.key === 'ArrowLeft') {
prevPage();
} else if (event.key === 'ArrowRight') {
nextPage();
} else if (event.key === 'Home') {
goToFirstPage();
} else if (event.key === 'End') {
goToLastPage();
} else if (event.key === ' ') {
if (timerRunning) {
stopTimer();
} else {
startTimer();
}
}
});

Expand Down
2 changes: 1 addition & 1 deletion vizblend/create_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def blend_graphs_to_html(self):
for i, figure in enumerate(self.figures):
div = figure.to_html(
full_html=False,
include_plotlyjs=True,
include_plotlyjs=False,
config={"displayModeBar": False},
)
divs.append(div)
Expand Down

0 comments on commit e739f2f

Please sign in to comment.