Browse Source

erstmal final

master
Eddie 2 years ago
parent
commit
9ef2de95c2
  1. 2
      api.py
  2. 2
      app.py
  3. 25
      frames.py
  4. 7
      sender2.sh

2
api.py

@ -10,7 +10,7 @@ key = os.getenv('API_KEY')
header = {"Authorization": "Bearer " + key}
def get_person_all():
endpoint = url + 'budget-py-personens'
endpoint = url + 'budget-py-people'
r = requests.get(url=endpoint, headers=header)
data = r.json()
return data

2
app.py

@ -16,7 +16,7 @@ class App(customtkinter.CTk):
container.grid_columnconfigure(0, weight=1)
# Sidebar Creation
self.sidebar = SidebarFrame(container, self)
self.sidebar.grid(row=0, column=0, padx=20, pady=20)
self.sidebar.grid(row=0, column=0, padx=20, pady=20, stick='nws')
# Frame Creation
self.frames = {}
self.frames['personFrame'] = PersonFrame(container, self)

25
frames.py

@ -90,16 +90,27 @@ class PersonFrame(customtkinter.CTkFrame):
# create textbox
persons = get_person_all()
personNames = []
if len(personNames) != 0:
for person in persons:
personNames.append(person['Name'])
personNames.append(person['name'])
else:
personNames.append('Null')
self.textbox = customtkinter.CTkTextbox(self, width=600, height=100)
self.textbox.grid(row=0, column=0, padx=(20, 0), pady=(20, 0), sticky="nsew")
self.textbox = customtkinter.CTkTextbox(self, height=100,)
self.textbox.grid(row=0, column=0, columnspan=4, padx=(20, 0), pady=(20, 0), sticky="nsew")
# set active person
self.activePersonLabel = customtkinter.CTkLabel(self, text='Aktive Person')
self.activePersonLabel.grid(row=1,column=0, padx=(20, 0), pady=(20,0), sticky="nw")
self.optionMenu = customtkinter.CTkOptionMenu(self,values=personNames, command=self.optionmenu_callback)
self.optionMenu.grid(row=2, column=0, padx=(20, 0), sticky="nw")
self.optionMenu = customtkinter.CTkOptionMenu(self,values=personNames, command=self.optionmenu_callback, )
self.optionMenu.grid(row=2, column=0, padx=(20, 0), pady=(20,0), sticky="nws")
# create person
self.createPersonLabel = customtkinter.CTkLabel(self, text='Person erstellen')
self.createPersonLabel.grid(row=1,column=1, padx=(20, 0), pady=(20,0), sticky="nw")
self.personNameEntry = customtkinter.CTkEntry(self, placeholder_text='Name')
self.personNameEntry.grid(row=2, column=1, padx=(20, 0), pady=(20,0), sticky='nw')
self.createButton = customtkinter.CTkButton(self, text='Erstellen', command=self.createPerson)
self.createButton.grid(row=2,column=2, padx=(20, 0), pady=(20,0), sticky='nw')
# set default values
self.textbox.insert("0.0", "Person\n\n" + 'Hier kannst du neue Personen erstellen, und die aktuell aktive Person auswählen')
self.textbox.configure(state='disabled')
@ -107,6 +118,10 @@ class PersonFrame(customtkinter.CTkFrame):
def optionmenu_callback(self, choice):
print("optionmenu dropdown clicked:", choice)
def createPerson(self):
name = self.personNameEntry.get()
print(name)
class ExampleFrame(customtkinter.CTkFrame):
def __init__(self, parent, controller):
customtkinter.CTkFrame.__init__(self, parent)

7
sender2.sh

@ -0,0 +1,7 @@
#!/bin/bash
API=https://cloud1.sommerschein.de/ocs/v1.php/apps/spreed/api/v1/chat/onxr79pz
LOGIN="Maily:Gtjik-qP48b-y62bC-r8yos-qJT9Y"
MESSAGE=$1
curl -d '{"token":"onxr79pz", "message":"'"$MESSAGE"'"}' -H "Content-Type: application/json" -H "Accept:application/json" -H "OCS-APIRequest:true" -u "$LOGIN" $API 2> /dev/null | > /dev/null
Loading…
Cancel
Save