Commit 387d104d authored by dwoiwode's avatar dwoiwode
Browse files

GUI Style changes + Code cleanup

parent 0ce1aabb
......@@ -202,9 +202,8 @@ class ProtocolPad(BasePad):
@property
def grav_path(self) -> Path:
return Path(
opt.GIT_REPO_PATH).absolute() / opt.GRAV_PROTOCOL_PATH / self.semester._grav_name() / self.date.strftime(
"%Y-%m-%d") / str("-fgvv" * self.is_fachgruppenvollversammlung) / "default.de.md"
datestr = self.date.strftime("%Y-%m-%d") + "-fgvv" * self.is_fachgruppenvollversammlung
return Path(opt.GIT_REPO_PATH) / opt.GRAV_PROTOCOL_PATH / self.semester._grav_name() / datestr / "default.de.md"
def parse_tops(self):
# TODO: better top filter?
......@@ -239,7 +238,7 @@ class ProtocolPad(BasePad):
if ignore:
continue
lines_new.append(line)
return "\n".join(lines_new)
return "\n".join(lines_new).strip()
def send_mail_as_preliminary(self) -> bool:
sender = MailParticipant(opt.LDAP_MAIL, opt.MAIL_DISPLAY_NAME)
......@@ -305,6 +304,7 @@ class ProtocolPad(BasePad):
f"tops: {tops_text}\n"
"---\n\n"
"[MINITOC]\n\n")
# Upload
self.grav_path.parent.mkdir(parents=True, exist_ok=True)
with self.grav_path.open("w", encoding="utf-8") as f:
......
import tkinter as tk
from functools import wraps
import webbrowser
import config
import linkToPDF2 as pter
......@@ -20,7 +21,7 @@ class ProtocolGUI(tk.Tk):
self.top_row = tk.Frame(self)
self.top_row.pack(fill=tk.X, expand=True)
self.folder_label = tk.Label(self.top_row)
self.button_left = tk.Button(self.top_row, text="<", state=tk.DISABLED, command=self.update_folder_index(-1))
self.button_left = tk.Button(self.top_row, text="<", command=self.update_folder_index(-1))
self.button_right = tk.Button(self.top_row, text=">", command=self.update_folder_index(1))
self.button_left.pack(side=tk.LEFT)
......@@ -47,9 +48,13 @@ class ProtocolGUI(tk.Tk):
for i, pad in enumerate(self.current_pads):
assert isinstance(pad, pter.ProtocolPad)
approved_state = tk.NORMAL if pad.is_approved else tk.DISABLED
color = "green" if pad.is_approved else "red"
color = "#BCF5A9" if pad.is_approved else "#F5A9A9" # green / red
tk.Label(self.pad_frame, text=pad.date.strftime("%Y-%m-%d"), anchor=tk.W).grid(row=i, column=0) # Date
tk.Label(self.pad_frame, text=pad.source.url, anchor=tk.W).grid(row=i, column=1, sticky=tk.W) # URL
url = tk.Label(self.pad_frame, text=pad.source.url, anchor=tk.W, cursor="hand2") # URL
url.bind("<1>", lambda event: webbrowser.open(pad.source.url))
url.grid(row=i, column=1, sticky=tk.W)
# Button Download
btn_download = tk.Button(self.pad_frame, text="Download",
command=pad.download)
......@@ -71,12 +76,12 @@ class ProtocolGUI(tk.Tk):
btn_mail_fr_info.grid(row=i, column=5)
# Button Website
btn_website = tk.Button(self.pad_frame, text="Approved Website", state=approved_state, bg=color,
btn_website = tk.Button(self.pad_frame, text="Upload to Website", state=approved_state, bg=color,
command=pad.upload_to_grav)
btn_website.grid(row=i, column=6)
# Button Cloud
btn_cloud = tk.Button(self.pad_frame, text="Approved Cloud", state=approved_state, bg=color,
btn_cloud = tk.Button(self.pad_frame, text="Upload to Cloud", state=approved_state, bg=color,
command=pad.upload_to_cloud)
btn_cloud.grid(row=i, column=7)
......
......@@ -24,6 +24,7 @@ class Gremium:
GREMIUM_FR = Gremium("finf", "Fachrat Informatik", "pandoc.finf.tex")
GREMIUM_FSR = Gremium("fsr", "Fachschaftsrat Elektrotechnik und Informatik", "pandoc.fsr.tex")
GREMIUM_PROMO = Gremium("promo", "Promovierendenvertretung", "pandoc.promo.tex")
@dataclass
......@@ -85,7 +86,7 @@ def send_fr_mail(text: str, subject: str, sender: MailParticipant, receivers: Li
class GitHelper:
def __init__(self, repository: str, repository_path: str):
self.repository = repository
self.repository_url = repository
self.repository_path = repository_path
def config(self, email, name):
......@@ -97,7 +98,7 @@ class GitHelper:
return os.system(cmd)
def clone(self):
cmd = f'git clone {self.repository} {self.repository_path}'
cmd = f'git clone {self.repository_url} {self.repository_path}'
return os.system(cmd)
def force_pull(self):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment