Browse Source
input validation for chord and block editors
input validation for chord and block editors
add icon add about dialogue improve preview renderingmaster
Ivan Holmes
5 years ago
14 changed files with 323 additions and 103 deletions
-
3_version.py
-
15chordsheet/parsers.py
-
3chordsheet/tableView.py
-
BINexamples/example.pdf
-
BINexamples/example.png
-
47examples/example.xml
-
230gui.py
-
2mac.spec
-
121ui/aboutdialog.ui
-
BINui/icon.afdesign
-
BINui/icon.icns
-
BINui/icon.ico
-
BINui/icon.png
-
1win.spec
@ -0,0 +1,3 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
|
||||
|
version = '0.4' |
@ -1,24 +1,29 @@ |
|||||
# -*- coding: utf-8 -*- |
# -*- coding: utf-8 -*- |
||||
|
|
||||
from sys import exit |
|
||||
|
|
||||
def parseFingering(fingering, instrument): |
def parseFingering(fingering, instrument): |
||||
|
""" |
||||
|
Converts fingerings into the list format that Chord objects understand. |
||||
|
""" |
||||
if instrument == 'guitar': |
if instrument == 'guitar': |
||||
numStrings = 6 |
numStrings = 6 |
||||
if len(fingering) == numStrings: |
|
||||
|
if len(fingering) == numStrings: # if the fingering is entered in concise format e.g. xx4455 |
||||
output = list(fingering) |
output = list(fingering) |
||||
else: |
|
||||
|
else: # if entered in long format e.g. x,x,10,10,11,11 |
||||
output = [x for x in fingering.split(',')] |
output = [x for x in fingering.split(',')] |
||||
if len(output) == numStrings: |
if len(output) == numStrings: |
||||
return output |
return output |
||||
else: |
else: |
||||
exit("Voicing <{v}> is malformed.".format(v=fingering)) |
|
||||
|
raise Exception("Voicing <{}> is malformed.".format(fingering)) |
||||
else: |
else: |
||||
return [fingering] |
return [fingering] |
||||
|
|
||||
|
# dictionary holding text to be replaced in chord names |
||||
nameReplacements = { "b":"♭", "#":"♯" } |
nameReplacements = { "b":"♭", "#":"♯" } |
||||
|
|
||||
def parseName(chordName): |
def parseName(chordName): |
||||
|
""" |
||||
|
Replaces symbols in chord names. |
||||
|
""" |
||||
parsedName = chordName |
parsedName = chordName |
||||
for i, j in nameReplacements.items(): |
for i, j in nameReplacements.items(): |
||||
parsedName = parsedName.replace(i, j) |
parsedName = parsedName.replace(i, j) |
After Width: 2480 | Height: 3507 | Size: 274 KiB |
@ -1,46 +1 @@ |
|||||
<chordsheet> |
|
||||
<title>Composition</title> |
|
||||
<composer>A. Person</composer> |
|
||||
<timesignature>4</timesignature> |
|
||||
<chords> |
|
||||
<chord> |
|
||||
<name>B</name> |
|
||||
<voicing instrument="guitar">xx2341</voicing> |
|
||||
<voicing instrument="piano">abcdefg</voicing> |
|
||||
</chord> |
|
||||
<chord> |
|
||||
<name>E</name> |
|
||||
<voicing instrument="guitar">022100</voicing> |
|
||||
</chord> |
|
||||
<chord> |
|
||||
<name>Cm9</name> |
|
||||
<voicing instrument="guitar">x,x,8,8,8,10</voicing> |
|
||||
</chord> |
|
||||
<chord> |
|
||||
<name>D7b5#9</name> |
|
||||
</chord> |
|
||||
</chords> |
|
||||
<progression> |
|
||||
<block> |
|
||||
<length>4</length> |
|
||||
<chord>B</chord> |
|
||||
<notes>These are notes</notes> |
|
||||
</block> |
|
||||
<block> |
|
||||
<length>4</length> |
|
||||
<chord>E</chord> |
|
||||
</block> |
|
||||
<block> |
|
||||
<length>12</length> |
|
||||
<chord>Cm9</chord> |
|
||||
</block> |
|
||||
<block> |
|
||||
<length>6</length> |
|
||||
<chord>D7b5#9</chord> |
|
||||
</block> |
|
||||
<block> |
|
||||
<length>6</length> |
|
||||
<notes>For quiet contemplation.</notes> |
|
||||
</block> |
|
||||
</progression> |
|
||||
</chordsheet> |
|
||||
|
<chordsheet><title>Composition</title><composer>A. Person</composer><timesignature>4</timesignature><chords><chord><name>B</name><voicing instrument="guitar">x,x,2,3,4,1</voicing></chord><chord><name>E</name><voicing instrument="guitar">0,2,2,1,0,0</voicing></chord><chord><name>Cm9</name><voicing instrument="guitar">x,x,8,8,8,10</voicing></chord><chord><name>D7♭5♯9</name></chord></chords><progression><block><length>4</length><chord>B</chord><notes>These are notes.</notes></block><block><length>4</length><chord>E</chord></block><block><length>12</length><chord>Cm9</chord></block><block><length>6</length><chord>D7♭5♯9</chord></block><block><length>6</length><notes>For quiet contemplation.</notes></block></progression></chordsheet> |
@ -0,0 +1,121 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<ui version="4.0"> |
||||
|
<class>Dialog</class> |
||||
|
<widget class="QDialog" name="Dialog"> |
||||
|
<property name="enabled"> |
||||
|
<bool>true</bool> |
||||
|
</property> |
||||
|
<property name="geometry"> |
||||
|
<rect> |
||||
|
<x>0</x> |
||||
|
<y>0</y> |
||||
|
<width>400</width> |
||||
|
<height>200</height> |
||||
|
</rect> |
||||
|
</property> |
||||
|
<property name="sizePolicy"> |
||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"> |
||||
|
<horstretch>0</horstretch> |
||||
|
<verstretch>0</verstretch> |
||||
|
</sizepolicy> |
||||
|
</property> |
||||
|
<property name="minimumSize"> |
||||
|
<size> |
||||
|
<width>400</width> |
||||
|
<height>200</height> |
||||
|
</size> |
||||
|
</property> |
||||
|
<property name="windowTitle"> |
||||
|
<string>About Chordsheet</string> |
||||
|
</property> |
||||
|
<layout class="QHBoxLayout" name="horizontalLayout"> |
||||
|
<item> |
||||
|
<layout class="QVBoxLayout" name="leftPane"> |
||||
|
<item> |
||||
|
<widget class="QLabel" name="iconLabel"> |
||||
|
<property name="sizePolicy"> |
||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"> |
||||
|
<horstretch>0</horstretch> |
||||
|
<verstretch>0</verstretch> |
||||
|
</sizepolicy> |
||||
|
</property> |
||||
|
<property name="minimumSize"> |
||||
|
<size> |
||||
|
<width>128</width> |
||||
|
<height>128</height> |
||||
|
</size> |
||||
|
</property> |
||||
|
<property name="text"> |
||||
|
<string/> |
||||
|
</property> |
||||
|
<property name="scaledContents"> |
||||
|
<bool>true</bool> |
||||
|
</property> |
||||
|
</widget> |
||||
|
</item> |
||||
|
<item> |
||||
|
<spacer name="verticalSpacer"> |
||||
|
<property name="orientation"> |
||||
|
<enum>Qt::Vertical</enum> |
||||
|
</property> |
||||
|
<property name="sizeHint" stdset="0"> |
||||
|
<size> |
||||
|
<width>20</width> |
||||
|
<height>40</height> |
||||
|
</size> |
||||
|
</property> |
||||
|
</spacer> |
||||
|
</item> |
||||
|
</layout> |
||||
|
</item> |
||||
|
<item> |
||||
|
<widget class="Line" name="line"> |
||||
|
<property name="orientation"> |
||||
|
<enum>Qt::Vertical</enum> |
||||
|
</property> |
||||
|
</widget> |
||||
|
</item> |
||||
|
<item> |
||||
|
<layout class="QVBoxLayout" name="rightPane"> |
||||
|
<item> |
||||
|
<widget class="QLabel" name="label"> |
||||
|
<property name="sizePolicy"> |
||||
|
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> |
||||
|
<horstretch>0</horstretch> |
||||
|
<verstretch>0</verstretch> |
||||
|
</sizepolicy> |
||||
|
</property> |
||||
|
<property name="text"> |
||||
|
<string><html><head/><body><p><span style=" font-size:24pt; font-weight:600;">Chordsheet</span><br/>by Ivan Holmes</p><p>Chordsheet is a piece of software that generates a chord sheet with a simple GUI. </p><p><a href="https://github.com/ivanholmes/chordsheet"><span style=" text-decoration: underline; color:#0000ff;">Github</span></a></p></body></html></string> |
||||
|
</property> |
||||
|
<property name="alignment"> |
||||
|
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> |
||||
|
</property> |
||||
|
<property name="wordWrap"> |
||||
|
<bool>true</bool> |
||||
|
</property> |
||||
|
</widget> |
||||
|
</item> |
||||
|
<item> |
||||
|
<widget class="QLabel" name="versionLabel"> |
||||
|
<property name="sizePolicy"> |
||||
|
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Minimum"> |
||||
|
<horstretch>0</horstretch> |
||||
|
<verstretch>0</verstretch> |
||||
|
</sizepolicy> |
||||
|
</property> |
||||
|
<property name="text"> |
||||
|
<string>Version not set</string> |
||||
|
</property> |
||||
|
<property name="alignment"> |
||||
|
<set>Qt::AlignBottom|Qt::AlignRight|Qt::AlignTrailing</set> |
||||
|
</property> |
||||
|
</widget> |
||||
|
</item> |
||||
|
</layout> |
||||
|
</item> |
||||
|
</layout> |
||||
|
</widget> |
||||
|
<resources/> |
||||
|
<connections/> |
||||
|
</ui> |
After Width: 1024 | Height: 1024 | Size: 236 KiB |
Write
Preview
Loading…
Cancel
Save
Reference in new issue