Added Remove Computer
All checks were successful
Potlatch Loggers Organization/ComputerKeeper/pipeline/head This commit looks good

This commit is contained in:
Josh Biltonen 2022-09-08 17:44:20 -07:00
parent 446befd788
commit da8432d465
2 changed files with 8 additions and 4 deletions

View File

@ -1 +1 @@
{"_default": {"1": {"Serial Number": "123", "Brand": "d", "Grade": "7", "Name": "jb"}, "2": {"Serial Number": "1", "Brand": "2", "Grade": "3", "Name": "4"}}}
{"_default": {"1": {"Serial Number": "123", "Brand": "d", "Grade": "7", "Name": "jb"}, "2": {"Serial Number": "1", "Brand": "2", "Grade": "3", "Name": "4"}, "3": {"Serial Number": "4321", "Brand": "d", "Grade": "12", "Name": "qb"}}}

10
main.py
View File

@ -6,8 +6,8 @@ from tinydb import TinyDB, Query
# Define the window's contents
colum_lut = ["Serial Number","Brand","Grade","Name"],
layout = [[sg.Menu([['File', ['Open', 'Save', 'Add Computer',]]])]
colum_lut = ["Serial Number","Brand","Grade","Name"]
layout = [[sg.Menu([['File', ['Open', 'Save', 'Add Computer','Remove Computer']]])],
[sg.Table([["word","Yes"]],colum_lut,key = "table")],
[sg.Text("Serial Number")],
[sg.Input(key='Serial Number')],
@ -46,7 +46,6 @@ def main():
db= TinyDB("./db.json")
Computer = []
for item in db.all():
print(item)
The_Device = []
for colum in colum_lut:
The_Device.append(item[colum])
@ -67,6 +66,11 @@ def main():
existing_table.append( list(new_computer.values()))
window["table"].update(existing_table)
db.insert(new_computer)
elif event == 'Remove Computer':
if values["table"]:
existing_table = window["table"].get()
existing_table.pop(values["table"][0])
window["table"].update(existing_table)
# Finish up by removing from the screen
window.close()