Compare commits
18 Commits
acd812fed1
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
b481863d47
|
|||
|
4078f5f83d
|
|||
|
42498fe19b
|
|||
|
|
bb7b075657 | ||
|
|
864c0dbddd | ||
|
595f8087dc
|
|||
|
|
285f0cd443 | ||
|
2637281af6
|
|||
|
|
c27071bdcd | ||
|
5d9a306c64
|
|||
|
9c85ee9f2f
|
|||
| 967457883a | |||
|
e43abc01e6
|
|||
|
d580765162
|
|||
|
dcc3ee8b55
|
|||
|
c6591219e6
|
|||
|
52042c4c35
|
|||
|
9a9ac137ef
|
@@ -20,6 +20,7 @@
|
|||||||
<li><a href="about.html">O nás</a></li>
|
<li><a href="about.html">O nás</a></li>
|
||||||
<li><a href="https://animo.zamberk.cz"><img src="img/animo.png" alt="Animo logo" style="max-width:100%;"></a></li>
|
<li><a href="https://animo.zamberk.cz"><img src="img/animo.png" alt="Animo logo" style="max-width:100%;"></a></li>
|
||||||
<li><a href="index.html"><img src="img/logo.png" alt="FMCZ logo" style="max-width:100%;"></a></li>
|
<li><a href="index.html"><img src="img/logo.png" alt="FMCZ logo" style="max-width:100%;"></a></li>
|
||||||
|
<li><a href="https://www.reichard.cz/"><img src="img/reichard_white.png" alt="Reichard logo" style="max-width:100%;"></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
</aside>
|
</aside>
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
<li><a href="about.html">O nás</a></li>
|
<li><a href="about.html">O nás</a></li>
|
||||||
<li><a href="https://animo.zamberk.cz"><img src="img/animo.png" alt="Animo logo" style="max-width:100%;"></a></li>
|
<li><a href="https://animo.zamberk.cz"><img src="img/animo.png" alt="Animo logo" style="max-width:100%;"></a></li>
|
||||||
<li><a href="index.html"><img src="img/logo.png" alt="FMCZ logo" style="max-width:100%;"></a></li>
|
<li><a href="index.html"><img src="img/logo.png" alt="FMCZ logo" style="max-width:100%;"></a></li>
|
||||||
|
<li><a href="https://www.reichard.cz/"><img src="img/reichard_white.png" alt="Reichard logo" style="max-width:100%;"></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
</aside>
|
</aside>
|
||||||
|
|||||||
29
edit.py
29
edit.py
@@ -3,10 +3,31 @@ from tkinter import messagebox
|
|||||||
from tkinter import filedialog
|
from tkinter import filedialog
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
|
from git import Repo
|
||||||
|
|
||||||
|
PATH_OF_GIT_REPO = r'.git'
|
||||||
|
COMMIT_MESSAGE = 'news update'
|
||||||
HTML_INSERT_TAG = "<!-- INSERT HERE -->"
|
HTML_INSERT_TAG = "<!-- INSERT HERE -->"
|
||||||
uploaded_image_path = None # Global to track uploaded image
|
uploaded_image_path = None # Global to track uploaded image
|
||||||
|
|
||||||
|
def git_pull():
|
||||||
|
try:
|
||||||
|
repo = Repo(PATH_OF_GIT_REPO)
|
||||||
|
origin = repo.remotes.origin
|
||||||
|
origin.pull()
|
||||||
|
except:
|
||||||
|
messagebox.showerror("Git error", "Something went wrong while pulling from origin")
|
||||||
|
|
||||||
|
def git_push():
|
||||||
|
try:
|
||||||
|
repo = Repo(PATH_OF_GIT_REPO)
|
||||||
|
repo.git.add(update=True)
|
||||||
|
repo.index.commit(COMMIT_MESSAGE)
|
||||||
|
origin = repo.remote(name='origin')
|
||||||
|
origin.push()
|
||||||
|
except:
|
||||||
|
messagebox.showerror("Git error", "Something went wrong while pushing to origin")
|
||||||
|
|
||||||
def upload_image():
|
def upload_image():
|
||||||
global uploaded_image_path
|
global uploaded_image_path
|
||||||
path = filedialog.askopenfilename(
|
path = filedialog.askopenfilename(
|
||||||
@@ -37,7 +58,7 @@ def submit_content():
|
|||||||
|
|
||||||
# if not html_file_path:
|
# if not html_file_path:
|
||||||
# return
|
# return
|
||||||
html_file_path = './home.html'
|
html_file_path = './index.html'
|
||||||
|
|
||||||
if not img_lib:
|
if not img_lib:
|
||||||
new_entry = f"""
|
new_entry = f"""
|
||||||
@@ -85,7 +106,7 @@ def submit_content():
|
|||||||
return
|
return
|
||||||
|
|
||||||
full_entry = f"{new_entry}\n{image_tag}" if image_tag else new_entry
|
full_entry = f"{new_entry}\n{image_tag}" if image_tag else new_entry
|
||||||
new_html = html_content.replace(HTML_INSERT_TAG, f"{HTML_INSERT_TAG}\n{full_entry}")
|
new_html = html_content.replace(HTML_INSERT_TAG, f"{HTML_INSERT_TAG}\n{full_entry}\n<hr>")
|
||||||
|
|
||||||
with open(html_file_path, 'w', encoding='utf-8') as f:
|
with open(html_file_path, 'w', encoding='utf-8') as f:
|
||||||
f.write(new_html)
|
f.write(new_html)
|
||||||
@@ -94,6 +115,8 @@ def submit_content():
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
messagebox.showerror("Error", str(e))
|
messagebox.showerror("Error", str(e))
|
||||||
|
|
||||||
|
git_push()
|
||||||
|
|
||||||
|
|
||||||
# GUI Setup
|
# GUI Setup
|
||||||
root = tk.Tk()
|
root = tk.Tk()
|
||||||
@@ -122,5 +145,7 @@ img_lib_text.pack(padx=10, pady=5)
|
|||||||
submit_button = tk.Button(root, text="Submit to HTML", command=submit_content)
|
submit_button = tk.Button(root, text="Submit to HTML", command=submit_content)
|
||||||
submit_button.pack(pady=5)
|
submit_button.pack(pady=5)
|
||||||
|
|
||||||
|
git_pull()
|
||||||
|
|
||||||
root.mainloop()
|
root.mainloop()
|
||||||
|
|
||||||
|
|||||||
BIN
img/header.jpg
BIN
img/header.jpg
Binary file not shown.
|
Before Width: | Height: | Size: 129 KiB After Width: | Height: | Size: 1.9 MiB |
BIN
img/logo.png
BIN
img/logo.png
Binary file not shown.
|
Before Width: | Height: | Size: 124 KiB After Width: | Height: | Size: 138 KiB |
BIN
img/reichard_white.png
Normal file
BIN
img/reichard_white.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
@@ -20,6 +20,7 @@
|
|||||||
<li><a href="about.html">O nás</a></li>
|
<li><a href="about.html">O nás</a></li>
|
||||||
<li><a href="https://animo.zamberk.cz"><img src="img/animo.png" alt="Animo logo" style="max-width:100%;"></a></li>
|
<li><a href="https://animo.zamberk.cz"><img src="img/animo.png" alt="Animo logo" style="max-width:100%;"></a></li>
|
||||||
<li><a href="index.html"><img src="img/logo.png" alt="FMCZ logo" style="max-width:100%;"></a></li>
|
<li><a href="index.html"><img src="img/logo.png" alt="FMCZ logo" style="max-width:100%;"></a></li>
|
||||||
|
<li><a href="https://www.reichard.cz/"><img src="img/reichard_white.png" alt="Reichard logo" style="max-width:100%;"></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
</aside>
|
</aside>
|
||||||
@@ -30,6 +31,11 @@
|
|||||||
<ul>
|
<ul>
|
||||||
<!-- INSERT HERE -->
|
<!-- INSERT HERE -->
|
||||||
|
|
||||||
|
<li><i>16.7.2025</i></li>
|
||||||
|
<li><b>Spuštění stránek</b></li>
|
||||||
|
<li>Slavnostně oznamujeme spuštění kroužkových stránek</li>
|
||||||
|
<hr>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
</section>
|
</section>
|
||||||
</main>
|
</main>
|
||||||
|
|||||||
3
requirements.txt
Normal file
3
requirements.txt
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
tk
|
||||||
|
GitPython
|
||||||
|
shutils
|
||||||
Reference in New Issue
Block a user