new feature show works

This commit is contained in:
2023-10-19 20:35:12 +02:00
parent f446120184
commit 10894187b2
2 changed files with 29 additions and 6 deletions

View File

@@ -15,8 +15,10 @@ At the moment, an alpha version is undertaken, with these features:
- Create new users
- Set an active user
- (planned) Show the pieces stored in the database
- Show the pieces stored in the database
- (planned) Mark pieces as masterd for the active user
- (planned) Show pieces by composer
- (planned) Show movements throug pieces
## Requirements

View File

@@ -68,12 +68,18 @@ class Session:
'''
list_of_work_ids = self.db_agent.execute(sql_command).fetchall()
# GET WORKS OUT!
return ''
list_of_works = list()
for item in list_of_work_ids:
list_of_works.append(work_under_id(item[0], self.db_agent))
fun_resultstring = ''
for work in list_of_works:
fun_resultstring += f'{work.id()}: {work.pretty_string()}\n'
return fun_resultstring
# End session
class Werk_unter_id:
class work_under_id:
# con = sqlite3.connect('repertoire.db')
# reader = con.cursor()
@@ -113,7 +119,7 @@ class Werk_unter_id:
saetze[satz[1]] = satz[2], satz[3], satz[4]
if not satz[2] is None:
nummern.add(satz[2])
self.values['Sätze'] = saetze
self.values['movements'] = saetze
if len(nummern) == 1:
self.sätze_unter_nummer = True
self.values['numb'] = nummern.pop()
@@ -127,6 +133,22 @@ class Werk_unter_id:
else:
return sammlung
def id(self):
return self.values['id']
def pretty_string(self):
ret_str = ''
for key in ['first_name', 'name',
'title', 'opus',
'main_key', 'alias',
'work_directory','wd_number']:
if not self.values[key] is None:
if key == 'opus':
ret_str += f'op. {self.values[key]} '
else:
ret_str += f'{self.values[key]} '
return ret_str
def __str__(self):
ret_str = ''
for key, value in self.values.items():
@@ -134,7 +156,7 @@ class Werk_unter_id:
ret_str += f'{key}: {value}\n'
return ret_str
# End Werk_unter_id
# End work_under_id
def parse_user_input(user_in):
split_user_in = user_in.split()
@@ -164,6 +186,5 @@ def main():
con.close()
print('db-connection closed. Bye-bye!')
if __name__ == '__main__':
main()