Skip to content

Commit

Permalink
added config file & changed cehckbox message
Browse files Browse the repository at this point in the history
  • Loading branch information
chpoit committed Dec 3, 2018
1 parent 096948d commit 30679a6
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,11 @@ ENV/
test.py

*.idea
*.db
*.db

#Vscode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
3 changes: 3 additions & 0 deletions config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"default_temporary_chapter_cleanup_behavior": true
}
13 changes: 10 additions & 3 deletions wuxiaworld2ebook.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@
from tkinter import ttk
from urllib.error import HTTPError, URLError
import os
import json
from os import path

#Initializing Stuff

main = tk.Tk()
main.title("Wuxiaworld-2-eBook")
main.geometry("400x190")
main.geometry("535x190")
main.resizable(True, True)
app = tk.Frame(main)
app.grid()
Expand Down Expand Up @@ -100,6 +101,11 @@ def _get_xhtml_path(raw_info, s_chapter, extension=".xhtml"):
hasbook.append(i[0])
namelist.sort()

#Load config
config_file = open("config.json", "r")
app_config = json.loads(config_file.read())
config_file.close()

#Code for the Combobox and the label
label1 = ttk.Label(app, text = "Select Novel:")
label1.grid(column = 0, row = 0, pady = 10, sticky = "W")
Expand Down Expand Up @@ -132,11 +138,12 @@ def _get_xhtml_path(raw_info, s_chapter, extension=".xhtml"):
ending_chapter_chosen.grid(column = 1, row = 3, sticky = "W")

#Code for delete chapters
label5 = ttk.Label(app, text = "Cleanup when done: ")
label5 = ttk.Label(app, text = "Delete temporary chapter files after download: ")
label5.grid(column = 0, row = 4, pady = 10, sticky = "W")
delete_chapters = tk.BooleanVar()
delete_chapters.set(app_config["default_temporary_chapter_cleanup_behavior"])
delete_chapters_chosen = ttk.Checkbutton(app, variable = delete_chapters, offvalue=False, onvalue=True)
delete_chapters_chosen.grid(column = 1, row = 4, sticky = "W")
delete_chapters_chosen.grid(column =1, row = 4, sticky = "W")

#Code for "Generate" button
generate_button = ttk.Button(app, text = "Generate", command = button_press)
Expand Down

0 comments on commit 30679a6

Please sign in to comment.