Skip to content

Commit

Permalink
feat: Adjust css for better mobile experience
Browse files Browse the repository at this point in the history
  • Loading branch information
matiusz committed Feb 2, 2024
1 parent 5713af1 commit 43e0e21
Show file tree
Hide file tree
Showing 6 changed files with 113 additions and 92 deletions.
135 changes: 82 additions & 53 deletions .github/README.md
Original file line number Diff line number Diff line change
@@ -1,53 +1,82 @@
# songbook

[![CircleCI](https://circleci.com/gh/matiusz/songbook/tree/hk-songbook.svg?style=svg)](https://circleci.com/gh/matiusz/songbook/tree/hk-songbook)

[Current PDF](https://hk-songbook.onrender.com/static/artifacts.html)

## songbook

Songbook is an easy to use tool for creating songbooks where each song is represented by a different file, allowing them to be easily shared or moved between different songbooks. It has its own display module or it can generate LaTeX files and compile them to pdf.

## Usage

### Without docker
_Make sure to have installed everything from the Requirements section_

To start the GUI:
```
python3 songbook.py
```

To generate the songbook PDF:
```
python3 songbook_pdf.py
```

### With docker
```
docker run -v $(pwd):/app --rm -it matiusz/songbook
```
and you can run the commands as above. Note that any command involving GUI may require additional setup, depending on the OS.

## Configuration

The configuration can be altered by modifying the `config.json` file.

### pdfSettings

format - e.g. a4paper, a5paper\
sides - oneside/twoside - if twoside is set pdf will have inner and outer margins and will include a blank page if chapter would start on an even page otherwise\
margins
- horizontal - inner in case of twoside option, left otherwise
- vertical - top margin

fontSize - basic size of the font, supports sizes 10, 11, 12\
lyricsFont, chordsFont - one of the fontcodes available e.g. here: https://www.overleaf.com/learn/latex/Font_typefaces#Reference_guide


## Requirements

- Python 3.8+
- PySide6 (pip install PySide6) - GUI module
- aiofiles (pip install aiofiles) - module for async I/O operations on files
- pdfTeX (included with e.g. https://miktex.org/) - required for .tex -> .pdf compilation
# songbook

[![CircleCI](https://circleci.com/gh/matiusz/songbook/tree/hk-songbook.svg?style=svg)](https://circleci.com/gh/matiusz/songbook/tree/hk-songbook)

[Current PDF](https://hk-songbook.onrender.com/static/artifacts.html)

## songbook

Songbook is an easy to use tool for creating songbooks where each song is represented by a different file, allowing them to be easily shared or moved between different songbooks. It has its own display module or it can generate LaTeX files and compile them to pdf.

## Usage

### Without Docker
_Make sure to have installed everything needed from the [Requirements](#requirements) section_

#### GUI:
```
python3 -m apps.run_gui
```
Launches GUI application that allows editing and displaying songs.

#### Generate PDF:
```
python3 -m apps.create_pdf
```
Generates output PDF in root directory

#### Start Flask sever:
```
python3 -m apps.run_flask
```
Starts a Flask server listening on address `0.0.0.0` with `PORT` envvar (default: `5000`)

#### Generate static site files:
```
python3 -m apps.freeze_flask
```
Files are generated in `src/flask/build` directory

### With Docker
```
docker run -v $(pwd):/app --rm -it matiusz/songbook
```
and you can run the commands as above. Note that any command involving GUI may require additional setup, depending on the OS.

## Configuration

### Environment variables
`SONGBOOK_DATA_DIR` - directory in which songbook categories are located
`PORT` - port to start Flask server on


### Configuration file

The configuration can be altered by modifying the `config.json` file.

#### pdfSettings

*format* - e.g. a4paper, a5paper\
*sides* - oneside/twoside - if twoside is set pdf will have inner and outer margins and will include a blank page if chapter would start on an even page otherwise\
*margins* -
- *horizontal* - inner in case of twoside option, left otherwise
- *vertical* - top margin

*fontSize* - basic size of the font, supports sizes 10, 11, 12\
*lyricsFont, chordsFon*t - one of the fontcodes available e.g. here: https://www.overleaf.com/learn/latex/Font_typefaces#Reference_guide


## Requirements

- Python 3.8+ (builds are tested with 3.12)
- aiofiles

### Static deployment
- all modules listed in [requirements.txt](/requirements.txt)

### PDF compilation
- pdfTeX (suggested distribution - TeXLive)

### Full functionality
- pdfTeX
- [requirements_full.txt](/requirements_full.txt)
28 changes: 5 additions & 23 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
.vscode/launch.json
vscode/
dist/
additional_files/
__pycache__/
songbook.tex
songbook.aux
Expand All @@ -11,27 +7,13 @@ songbook.synctex.gz
songbook.toc
songbook.fls
songlist.toc
setup.py
additional_files.rar
songbook.out
latexheader copy.txt
tex.py
texput.log
39venv/
output/
dataMSZ/
dataAll/
dataHK/
dataAll/
dataMSZ/
songbook_list.toc
a_py_2_exe_config.json
Flat-Icons.com-Flat-Guitar.ico
songbook.exe
data/latexheader.txt
debug.log
songbook-pdf.log
songbook-py.log
output/
debug.log
so.py
.vscode/settings.json
src/flask/build/
.vscode
src/flask/build/
songbook.pdf
8 changes: 0 additions & 8 deletions apps/display.py

This file was deleted.

20 changes: 17 additions & 3 deletions src/flask/static/style.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@


.nav-side-menu {
overflow: auto;
font-family: verdana;
Expand Down Expand Up @@ -143,7 +145,7 @@
}

body {
width: fit-content;
width: 100vw;
}
}
@media (min-width: 767px) {
Expand Down Expand Up @@ -304,17 +306,29 @@ body {
text-align: center;
}
}

/*
@media only screen and (min-width : 320px) {
.container, .main {
padding-left: 5%;
}
}

*/
@media only screen and (min-width : 768px) {
.main {
padding-left: 450px;
}
html {
font-size: 1rem;
}
}

@media only screen and (max-width : 767px) {
.main {
font-size: 2.8vw;
}
html {
font-size: 2.8vw;
}
}

.container {
Expand Down
12 changes: 8 additions & 4 deletions src/flask/templates/page.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" rel="stylesheet" crossorigin="anonymous">
<link href="{{url_for('static', filename='style.css' )}}" rel="stylesheet" >
<link href="https://use.fontawesome.com/releases/v4.7.0/css/font-awesome-css.min.css" rel="stylesheet">
<script src="https://use.fontawesome.com/4be8498a81.js"></script>
<title>Śpiewnik HK</title>
</head>

Expand Down Expand Up @@ -50,10 +51,13 @@
{% endfor %}
</ul>
</div>
<div style="text-align: center;"><br>
Author: Mateusz Szwed<br>
Source: <a href="https://github.com/matiusz/songbook">https://github.com/matiusz/songbook</a>
</div>
</div>
<script src="https://use.fontawesome.com/4be8498a81.js"></script>
{% autoescape false %}
<div class="main">
<div class="main" style="overflow: auto;">
{% if song %}
<div class="d-flex flex-column">
<div class="h2 ">{{song.title}}</div>
Expand All @@ -62,12 +66,12 @@
</div>
<table width="100%">
<tr>
<td>
<td style="text-align-last: center;">
<button onclick="shiftChordsDown()" value="Down" class="btn btn-primary">
<i class="fa fa-arrow-down" aria-hidden="true"></i>
</button>
</td>
<td>
<td style="text-align-last: center;">
<button onclick="shiftChordsUp()" value="Up" class="btn btn-primary">
<i class="fa fa-arrow-up" aria-hidden="true"></i>
</button>
Expand Down
2 changes: 1 addition & 1 deletion src/gui/MainMenu.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def __init__(self):
songButton = QPushButton('Song Editor', self)
songButton.clicked.connect(self.addSongField)

tabsButton = QPushButton('Show Songs', self)
tabsButton = QPushButton('Song Display', self)
tabsButton.clicked.connect(self.tabsSongsField)

compileButton = QPushButton('Create PDF', self)
Expand Down

0 comments on commit 43e0e21

Please sign in to comment.