Variablen ausgelagert. JSON Save hinzugefügt.
This commit is contained in:
parent
b51e8ead99
commit
887fd14f72
3
.idea/.gitignore
generated
vendored
Normal file
3
.idea/.gitignore
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
8
.idea/Zeiterfassung.iml
generated
Normal file
8
.idea/Zeiterfassung.iml
generated
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="PYTHON_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager">
|
||||||
|
<content url="file://$MODULE_DIR$" />
|
||||||
|
<orderEntry type="jdk" jdkName="Python 3.11" jdkType="Python SDK" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
</module>
|
6
.idea/inspectionProfiles/profiles_settings.xml
generated
Normal file
6
.idea/inspectionProfiles/profiles_settings.xml
generated
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<component name="InspectionProjectProfileManager">
|
||||||
|
<settings>
|
||||||
|
<option name="USE_PROJECT_PROFILE" value="false" />
|
||||||
|
<version value="1.0" />
|
||||||
|
</settings>
|
||||||
|
</component>
|
7
.idea/misc.xml
generated
Normal file
7
.idea/misc.xml
generated
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Black">
|
||||||
|
<option name="sdkName" value="Python 3.11" />
|
||||||
|
</component>
|
||||||
|
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.11" project-jdk-type="Python SDK" />
|
||||||
|
</project>
|
8
.idea/modules.xml
generated
Normal file
8
.idea/modules.xml
generated
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/.idea/Zeiterfassung.iml" filepath="$PROJECT_DIR$/.idea/Zeiterfassung.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
6
.idea/vcs.xml
generated
Normal file
6
.idea/vcs.xml
generated
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
BIN
__pycache__/definitions.cpython-311.pyc
Normal file
BIN
__pycache__/definitions.cpython-311.pyc
Normal file
Binary file not shown.
BIN
__pycache__/definitions.cpython-38.pyc
Normal file
BIN
__pycache__/definitions.cpython-38.pyc
Normal file
Binary file not shown.
BIN
__pycache__/jsonhandler.cpython-311.pyc
Normal file
BIN
__pycache__/jsonhandler.cpython-311.pyc
Normal file
Binary file not shown.
Binary file not shown.
BIN
__pycache__/timestamping.cpython-311.pyc
Normal file
BIN
__pycache__/timestamping.cpython-311.pyc
Normal file
Binary file not shown.
Binary file not shown.
BIN
__pycache__/users.cpython-311.pyc
Normal file
BIN
__pycache__/users.cpython-311.pyc
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
9
definitions.py
Normal file
9
definitions.py
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# Zeiterfassung
|
||||||
|
#
|
||||||
|
# statische Werte
|
||||||
|
|
||||||
|
userfolder = "users"
|
||||||
|
settingsfolder = "settings"
|
||||||
|
usersettingsfilename = "settings.json"
|
||||||
|
program_name = "Zeiterfassung"
|
||||||
|
program_version = "Development"
|
@ -7,8 +7,7 @@
|
|||||||
import json
|
import json
|
||||||
|
|
||||||
from users import *
|
from users import *
|
||||||
from zeiterfassung import userfolder
|
from definitions import *
|
||||||
from zeiterfassung import settingsfolder
|
|
||||||
|
|
||||||
# Datenstrutur:
|
# Datenstrutur:
|
||||||
|
|
||||||
@ -22,3 +21,8 @@ def load_settings(filename):
|
|||||||
data = json.load(json_file)
|
data = json.load(json_file)
|
||||||
|
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
def write_settings(filename, settings):
|
||||||
|
|
||||||
|
with open(filename, "w") as json_file:
|
||||||
|
json.dump(settings, json_file, indent=4)
|
@ -3,6 +3,7 @@
|
|||||||
import time
|
import time
|
||||||
import datetime
|
import datetime
|
||||||
import os
|
import os
|
||||||
|
from definitions import *
|
||||||
|
|
||||||
# Zeitstempel schreiben
|
# Zeitstempel schreiben
|
||||||
def append_timestamp(filename):
|
def append_timestamp(filename):
|
||||||
|
15
tkinter Demo.py
Normal file
15
tkinter Demo.py
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
import tkinter as tk
|
||||||
|
|
||||||
|
def aktionSF():
|
||||||
|
label3 = tk.Label(root, text="Aktion durchgeführt", bg="yellow")
|
||||||
|
label3.pack()
|
||||||
|
|
||||||
|
root = tk.Tk()
|
||||||
|
|
||||||
|
label1 = tk.Label(root, text="Hallo Welt", bg="orange")
|
||||||
|
label1.pack()
|
||||||
|
|
||||||
|
schaltf1 = tk.Button(root, text="Aktion durchführen", command=aktionSF)
|
||||||
|
schaltf1.pack()
|
||||||
|
|
||||||
|
root.mainloop()
|
6
users.py
6
users.py
@ -5,8 +5,7 @@ import os
|
|||||||
import time
|
import time
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
from zeiterfassung import userfolder
|
from definitions import *
|
||||||
from zeiterfassung import settingsfolder
|
|
||||||
|
|
||||||
# Benutzer anhand Verzeichnisse auflisten
|
# Benutzer anhand Verzeichnisse auflisten
|
||||||
def list_users(directory):
|
def list_users(directory):
|
||||||
@ -20,8 +19,7 @@ def determine_filename(user, type="stamping"):
|
|||||||
completepath = scriptpath() + "/" + userfolder +"/" + user + "/" + year + "-" + month + ".txt"
|
completepath = scriptpath() + "/" + userfolder +"/" + user + "/" + year + "-" + month + ".txt"
|
||||||
return completepath
|
return completepath
|
||||||
elif type == "settings":
|
elif type == "settings":
|
||||||
settings_filename = "setting.json"
|
completepath = scriptpath() + "/" + userfolder +"/" + user + "/" + usersettingsfilename
|
||||||
completepath = scriptpath() + "/" + userfolder +"/" + user + "/" settings_filename
|
|
||||||
return completepath
|
return completepath
|
||||||
|
|
||||||
# Installationsverzeichnis bestimmen
|
# Installationsverzeichnis bestimmen
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"username": "testuser",
|
"username": "testuser",
|
||||||
"name": "Der Tester",
|
"name": "Der neue Tester",
|
||||||
"password": "123456789"
|
"password": "123456789"
|
||||||
}
|
}
|
@ -4,3 +4,5 @@
|
|||||||
1744018315
|
1744018315
|
||||||
1744018470
|
1744018470
|
||||||
1744018696
|
1744018696
|
||||||
|
1744100316
|
||||||
|
1744100330
|
||||||
|
@ -9,43 +9,60 @@ import os
|
|||||||
from timestamping import *
|
from timestamping import *
|
||||||
from users import *
|
from users import *
|
||||||
from jsonhandler import *
|
from jsonhandler import *
|
||||||
|
from definitions import *
|
||||||
# Statische Definitionen
|
|
||||||
# Pfade:
|
|
||||||
userfolder = "users"
|
|
||||||
settingsfolder = "settings"
|
|
||||||
program_name = "Zeiterfassung"
|
|
||||||
program_version = "0.0.0"
|
|
||||||
|
|
||||||
# Funktionen
|
# Funktionen
|
||||||
|
|
||||||
|
def printUserList():
|
||||||
|
userlist = list_users(scriptpath() + "/" + userfolder)
|
||||||
|
for i in range(0, len(userlist)):
|
||||||
|
print(str(i + 1) + ": " + str(userlist[i]))
|
||||||
|
return(userlist)
|
||||||
|
|
||||||
# Hauptfunktion
|
# Hauptfunktion
|
||||||
def main():
|
def main():
|
||||||
print(program_name + " " + str(program_version))
|
while True:
|
||||||
print("Welche Funktion soll ausgeführt werden?")
|
|
||||||
print("1: Stempeln")
|
|
||||||
print("2: Stempelübersicht anzeigen")
|
|
||||||
question = int(input("Geben Sie Ihre Antwort ein: "))
|
|
||||||
|
|
||||||
if question == 1:
|
print(program_name + " " + str(program_version))
|
||||||
userlist = list_users(scriptpath() + "/" + userfolder)
|
print("Welche Funktion soll ausgeführt werden?")
|
||||||
print(userlist)
|
print("1: Stempeln")
|
||||||
for i in range (0, len(userlist)):
|
print("2: Stempelübersicht anzeigen")
|
||||||
print(str(i + 1) + ": " + str(userlist[i]))
|
print("3: Einstellungen ändern")
|
||||||
|
print("0: Beenden")
|
||||||
|
question = int(input("Geben Sie Ihre Antwort ein: "))
|
||||||
|
|
||||||
which_user = input("Für welchen User soll gestempelt werden? ")
|
if question == 1:
|
||||||
append_timestamp(determine_filename(userlist[int(which_user) - 1]))
|
userlist = printUserList()
|
||||||
print("Stempeleintrag vorgenommen")
|
which_user = input("Für welchen User soll gestempelt werden? ")
|
||||||
elif question == 2:
|
append_timestamp(determine_filename(userlist[int(which_user) - 1]))
|
||||||
userlist = list_users(scriptpath() + "/" + userfolder)
|
print("Stempeleintrag vorgenommen")
|
||||||
for i in range (0, len(userlist)):
|
elif question == 2:
|
||||||
print(str(i + 1) + ": " + str(userlist[i]))
|
userlist = printUserList()
|
||||||
|
which_user = input("Für welchen User sollen die Stempelzeiten angezeigt werden? " )
|
||||||
|
print("Zustand: " + stempel_zustand(determine_filename(userlist[int(which_user) -1])))
|
||||||
|
overview(determine_filename(userlist[int(which_user) - 1]))
|
||||||
|
|
||||||
which_user = input("Für welchen User sollen die Stempelzeiten angezeigt werden? " )
|
elif question == 3:
|
||||||
print("Zustand: " + stempel_zustand(determine_filename(userlist[int(which_user) -1])))
|
userlist = printUserList()
|
||||||
overview(determine_filename(userlist[int(which_user) - 1]))
|
which_user = input("Für welchen Benutzer sollen die Einstellungen geändert werden? ")
|
||||||
else:
|
selected_user = userlist[int(which_user) - 1]
|
||||||
print("Keine Eingabe erkannt.")
|
print("Benutzereinstellungen für Benutzer " + str(selected_user) + ":")
|
||||||
|
settings = load_settings(determine_filename(selected_user, "settings"))
|
||||||
|
for x in settings:
|
||||||
|
print(x + ": " + settings[x])
|
||||||
|
setting_to_change = input("Welche Einstellung soll geändert werden? ")
|
||||||
|
if setting_to_change in settings:
|
||||||
|
new_value = input("Wie ist der neue Wert? ")
|
||||||
|
settings[setting_to_change] = new_value
|
||||||
|
for x in settings:
|
||||||
|
print(x + ": " + settings[x])
|
||||||
|
print("Speicher Einstellungen")
|
||||||
|
write_settings(determine_filename(selected_user, type="settings"), settings)
|
||||||
|
|
||||||
|
elif question == 0:
|
||||||
|
exit()
|
||||||
|
else:
|
||||||
|
print("Keine Eingabe erkannt.")
|
||||||
|
|
||||||
|
|
||||||
# Programmstart
|
# Programmstart
|
||||||
|
Loading…
x
Reference in New Issue
Block a user