Skip to content

Commit

Permalink
fix: html remove img
Browse files Browse the repository at this point in the history
  • Loading branch information
latorc committed Apr 18, 2024
1 parent ff604bc commit 11997c2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
7 changes: 5 additions & 2 deletions gui/help_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ def __init__(self, parent:tk.Frame, st:Settings, updater:Updater):
# self.textbox.insert(tk.END, st.lan().HELP_STR)
# self.textbox.configure(state='disabled') # Make the text read-only
self.html_text:str = None
self.html_box = HTMLScrolledText(self, html=st.lan().HELP+" Loading...", wrap=tk.CHAR, font=GUI_STYLE.font_normal(), height=25)
self.html_box = HTMLScrolledText(
self, html=st.lan().HELP+" Loading...",
wrap=tk.CHAR, font=GUI_STYLE.font_normal(), height=25,
state=tk.DISABLED)
self.html_box.pack(padx=10, pady=10, side=tk.TOP, fill=tk.BOTH, expand=True)

self.frame_bot = tk.Frame(self, height=30)
Expand Down Expand Up @@ -69,7 +72,7 @@ def __init__(self, parent:tk.Frame, st:Settings, updater:Updater):
# label.pack(padx=5, pady=5, side=tk.LEFT)
# label.bind("<Button-1>", lambda event: open_link())

self._refresh_ui()
self.after_idle(self._refresh_ui)


def _check_for_update(self):
Expand Down
6 changes: 3 additions & 3 deletions updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ def get_html(self, url:str) -> str:
r'<meta[^>]*>',
r'<title[^>]*>.*?</title>',
r'<link[^>]*>',
# r'<figure[^>]*>',
# r'</figure>',
]
r'<img[^>]*>',
r'<nav[^>]*>',
] # patterns to remove
for p in rm_patterns:
res_text = re.sub(p, '', res_text, flags=re.DOTALL)
rep_patterns = {
Expand Down

0 comments on commit 11997c2

Please sign in to comment.