Skip to content

Commit

Permalink
Documentation; fix opening project bug
Browse files Browse the repository at this point in the history
  • Loading branch information
KrzysMur committed Mar 7, 2024
1 parent d2c4b86 commit fdc3853
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 28 deletions.
Binary file added docs/documentation.docx
Binary file not shown.
2 changes: 1 addition & 1 deletion example_inputs/project.chordsheet
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ capo = 2

[page]
page_width = 21
top_margin = 3.8
top_margin = 1.0
left_margin = 1.0
right_margin = 1.0
bottom_margin = 0.5
Expand Down
20 changes: 0 additions & 20 deletions example_inputs/project1.chordsheet

This file was deleted.

2 changes: 1 addition & 1 deletion example_inputs/project2.chordsheet
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ capo = 2
[E_D|E_D|E_D|Bm_C#m_D_Bm]
|E|Bm|E|Bm_C#m_D_Bm|
[E_D|E_D|E_D|Bm_C#m_D_Bm]
[E_D|E_D|E_D|Bm_C#m_D_Bm]
[E_D|E_D|E_D|Bm_C#m_D_Bm]
[E_D|E_D|E_D|Bm_C#m_D_Bm]
[E_D|E_D|E_D|Bm_C#m_D_Bm]

Expand Down
2 changes: 1 addition & 1 deletion src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ def save_project(self):
self.changes_saved = True

def open_project(self, file_to_open=None):
if file_to_open is not None:
if file_to_open:
selected_file = file_to_open
else:
selected_file, _ = QFileDialog.getOpenFileName(self, "Select File", "",
Expand Down
9 changes: 4 additions & 5 deletions src/input_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class InputParser:
def __init__(self, _input: list[str]):
self.input = _input

def get_metadata(self, return_metadate_ending_index=False):
def get_metadata(self):
metadata = {}
i = 0
while "=" in self.input[i]:
Expand All @@ -14,14 +14,14 @@ def get_metadata(self, return_metadate_ending_index=False):
i += 1
if "chords" in metadata:
metadata.update({"chords": parse_chords(metadata["chords"])})
return (fill_in_metadata(metadata), i) if return_metadate_ending_index else fill_in_metadata(metadata)
return fill_in_metadata(metadata), i

def parse_song(self, song_starting_index=0):
song_lines = [self.input[i] for i in range(song_starting_index, len(self.input))]
return [parse_line(line) for line in song_lines]

def parse(self):
metadata, end_index = self.get_metadata(return_metadate_ending_index=True)
metadata, end_index = self.get_metadata()
song = self.parse_song(end_index)
return metadata, song

Expand Down Expand Up @@ -66,8 +66,7 @@ def divide_line_into_elements(line):
line_elements.append(line[i])
return line_elements


def is_barline(char: str):
return char[0] in "[]|"



0 comments on commit fdc3853

Please sign in to comment.