Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__pycache__/
12 changes: 9 additions & 3 deletions MainGUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from functools import partial
from tkinter import messagebox
import os.path
import webbrowser

class MainGUI:

Expand Down Expand Up @@ -55,14 +56,19 @@ def pick_file(self):
self.__file_path.set(path)

# Uses convert_to_html function to convert the file chosen,
# the resets the GUI. If no file has been chosen, do nothing.
# then resets the GUI. If no file has been chosen, do nothing.
def convert(self):
path = self.__file_path.get()

target_file = ""
if(path): #If a file has been chosen, then attempt convertion
self.convert_to_html(path)
messagebox.showinfo("Success", "You HTML has been successfully generated")
target_file = self.convert_to_html(path)

if(target_file): # If the HTML is generated successfuly
messagebox.showinfo("Success", "Your HTML has been generated at: \n" + target_file)
self.reset()
else:
messagebox.showerror("Error", "Something went wrong and the file could not be generated")

# Resets the GUI to its original state.
def reset(self):
Expand Down
3 changes: 3 additions & 0 deletions usfm2html.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@ def convert_to_html(convert_file):
newfile.write("</body></html>")
newfile.close()

return target_file


arguments=sys.argv[1:]
count_args=len(arguments)
print("usfm2html: Making your output prettier since 2018\n")
Expand Down