Skip to content

Commit

Permalink
fix html loading
Browse files Browse the repository at this point in the history
  • Loading branch information
johnwangwyx committed May 20, 2024
1 parent 22d4cee commit c114fcf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
* GUI improvements.

### DEBUGGED
* Fix command heightening unable to highlight `−` (a way to represent `-` in html)
* Fix command heightening unable to highlight `−` (a way to represent `-` in html).
* Fix Html not being loaded in some cases.

## Version 0.2.0 (Initial Development)

Expand Down
11 changes: 5 additions & 6 deletions cmdcompass/gui/manpagebox.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ def capture_original_scroll_bar_style(self):
}

def set_man_page(self, command):
html_content = ""
self.command = command
command_str = command.command_str
if command.user_defined_man_page :
Expand All @@ -64,19 +63,19 @@ def set_man_page(self, command):
existing_core_man_page = os.path.join(HTML_CORE_DIR, f"{command_name}.html")
if os.path.exists(existing_core_man_page):
with open(existing_core_man_page, "r") as f:
html_content = f.read()
self.html_content = f.read()
elif os.path.exists(dynamically_downloaded_html):
with open(dynamically_downloaded_html, "r") as f:
html_content = f.read()
self.html_content = f.read()
else:
def download_and_update():
progress_window = self.create_progress_window()
progress_window.update_progress(f"Downloading {command_name}...")
download_and_process_package(command_name, progress_window)
# After download and processing is complete, update the HTML
with open(dynamically_downloaded_html, "r") as f:
html_content = f.read()
self.html_view.load_html(html_content)
self.html_content = f.read()
self.html_view.load_html(self.html_content)
if progress_window:
progress_window.update_progress("Complete! Closing Window in 5 seconds", 1)
progress_window.close()
Expand All @@ -87,9 +86,9 @@ def download_and_update():
download_thread.start()
except Exception as e:
print(f"Error getting man page: {e}")
self.html_content = html_content
self.options = command.extract_options()
self.change_theme()
self.highlight_switch.deselect()
if self.options:
self.highlight_switch.grid(row=0, column=0, pady=(10, 0), sticky="w")
else:
Expand Down

0 comments on commit c114fcf

Please sign in to comment.