File structure set
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -0,0 +1 @@
|
|||||||
|
__pycache__/
|
||||||
37
Logic/Filehandler.py
Normal file
37
Logic/Filehandler.py
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
import zipfile
|
||||||
|
import os
|
||||||
|
|
||||||
|
def vytvor_zip(zip_path, soubory):
|
||||||
|
with zipfile.ZipFile(zip_path, 'w') as zipf:
|
||||||
|
for soubor in soubory:
|
||||||
|
zipf.write(soubor)
|
||||||
|
|
||||||
|
def extrahuj_zip(zip_path, cilovy_adresar):
|
||||||
|
with zipfile.ZipFile(zip_path, 'r') as zipf:
|
||||||
|
zipf.extractall(cilovy_adresar)
|
||||||
|
|
||||||
|
def vypis_obsah_zip(zip_path):
|
||||||
|
with zipfile.ZipFile(zip_path, 'r') as zipf:
|
||||||
|
for nazev in zipf.namelist():
|
||||||
|
print(nazev)
|
||||||
|
|
||||||
|
def pridej_do_zip(zip_path, soubor):
|
||||||
|
with zipfile.ZipFile(zip_path, 'a') as zipf:
|
||||||
|
zipf.write(soubor)
|
||||||
|
|
||||||
|
def prepis_soubor_v_zipu(zip_path, novy_soubor, jmeno_v_zipu=None):
|
||||||
|
jmeno_v_zipu = jmeno_v_zipu or os.path.basename(novy_soubor)
|
||||||
|
temp_zip = zip_path + '.tmp'
|
||||||
|
|
||||||
|
with zipfile.ZipFile(zip_path, 'r') as zip_read, \
|
||||||
|
zipfile.ZipFile(temp_zip, 'w') as zip_write:
|
||||||
|
for item in zip_read.infolist():
|
||||||
|
if item.filename != jmeno_v_zipu:
|
||||||
|
data = zip_read.read(item.filename)
|
||||||
|
zip_write.writestr(item, data)
|
||||||
|
zip_write.write(novy_soubor, arcname=jmeno_v_zipu)
|
||||||
|
|
||||||
|
os.replace(temp_zip, zip_path)
|
||||||
|
|
||||||
|
#vytvor_zip("test.vf", ["material_hardness.xlsx", "material_denominations.xlsx"])
|
||||||
|
#vypis_obsah_zip("test.vf")
|
||||||
3
Test/Startup.py
Normal file
3
Test/Startup.py
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
def startup_test():
|
||||||
|
print("Zahajuji testování")
|
||||||
|
print("V pořádku")
|
||||||
43
UI/GUI.py
Normal file
43
UI/GUI.py
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
import tkinter as tk
|
||||||
|
from tkinter import ttk
|
||||||
|
from Logic.Filehandler import vytvor_zip
|
||||||
|
|
||||||
|
def run_app():
|
||||||
|
root = tk.Tk()
|
||||||
|
root.title("Three Tab GUI")
|
||||||
|
root.geometry("1280x720")
|
||||||
|
|
||||||
|
notebook = ttk.Notebook(root)
|
||||||
|
notebook.pack(expand=True, fill='both')
|
||||||
|
|
||||||
|
tab1 = ttk.Frame(notebook)
|
||||||
|
tab2 = ttk.Frame(notebook)
|
||||||
|
tab3 = ttk.Frame(notebook)
|
||||||
|
|
||||||
|
notebook.add(tab1, text="Tab 1")
|
||||||
|
notebook.add(tab2, text="Tab 2")
|
||||||
|
notebook.add(tab3, text="Tab 3")
|
||||||
|
|
||||||
|
label1 = ttk.Label(tab1, text="Welcome to Tab 1")
|
||||||
|
columns = ("Name", "Age", "Occupation")
|
||||||
|
|
||||||
|
tree = ttk.Treeview(tab1, columns=columns, show='headings')
|
||||||
|
|
||||||
|
# Define column headers
|
||||||
|
for col in columns:
|
||||||
|
tree.heading(col, text=col)
|
||||||
|
tree.column(col, anchor='center', width=150)
|
||||||
|
|
||||||
|
label1.pack(pady=20)
|
||||||
|
tree.pack(pady=20)
|
||||||
|
|
||||||
|
label2 = ttk.Label(tab2, text="This is Tab 2")
|
||||||
|
label2.pack(pady=20)
|
||||||
|
|
||||||
|
label3 = ttk.Label(tab3, text="You are in Tab 3")
|
||||||
|
label3.pack(pady=20)
|
||||||
|
|
||||||
|
root.mainloop()
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
run_app()
|
||||||
41
Vault.py
41
Vault.py
@@ -1,37 +1,6 @@
|
|||||||
import zipfile
|
from UI.GUI import run_app
|
||||||
import os
|
from Logic.Filehandler import *
|
||||||
|
from Test.Startup import startup_test
|
||||||
|
|
||||||
def vytvor_zip(zip_path, soubory):
|
startup_test()
|
||||||
with zipfile.ZipFile(zip_path, 'w') as zipf:
|
run_app()
|
||||||
for soubor in soubory:
|
|
||||||
zipf.write(soubor)
|
|
||||||
|
|
||||||
def extrahuj_zip(zip_path, cilovy_adresar):
|
|
||||||
with zipfile.ZipFile(zip_path, 'r') as zipf:
|
|
||||||
zipf.extractall(cilovy_adresar)
|
|
||||||
|
|
||||||
def vypis_obsah_zip(zip_path):
|
|
||||||
with zipfile.ZipFile(zip_path, 'r') as zipf:
|
|
||||||
for nazev in zipf.namelist():
|
|
||||||
print(nazev)
|
|
||||||
|
|
||||||
def pridej_do_zip(zip_path, soubor):
|
|
||||||
with zipfile.ZipFile(zip_path, 'a') as zipf:
|
|
||||||
zipf.write(soubor)
|
|
||||||
|
|
||||||
def prepis_soubor_v_zipu(zip_path, novy_soubor, jmeno_v_zipu=None):
|
|
||||||
jmeno_v_zipu = jmeno_v_zipu or os.path.basename(novy_soubor)
|
|
||||||
temp_zip = zip_path + '.tmp'
|
|
||||||
|
|
||||||
with zipfile.ZipFile(zip_path, 'r') as zip_read, \
|
|
||||||
zipfile.ZipFile(temp_zip, 'w') as zip_write:
|
|
||||||
for item in zip_read.infolist():
|
|
||||||
if item.filename != jmeno_v_zipu:
|
|
||||||
data = zip_read.read(item.filename)
|
|
||||||
zip_write.writestr(item, data)
|
|
||||||
zip_write.write(novy_soubor, arcname=jmeno_v_zipu)
|
|
||||||
|
|
||||||
os.replace(temp_zip, zip_path)
|
|
||||||
|
|
||||||
#vytvor_zip("test.vf", ["material_hardness.xlsx", "material_denominations.xlsx"])
|
|
||||||
vypis_obsah_zip("test.vf")
|
|
||||||
Reference in New Issue
Block a user