Skip to content

Commit

Permalink
Added some more checks to prevent exceptions.
Browse files Browse the repository at this point in the history
Fixed window size
  • Loading branch information
ThePromidius committed Jan 16, 2022
1 parent 0b94c1f commit 9a0aa09
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion MangaManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,27 +249,34 @@ def opencovers():
"""

velog("Selecting covers in opencovers")
self.button3_load_images.grid_remove()


self.button3_load_images.configure(text="Loading...",state="disabled")
covers_path_list = filedialog.askopenfiles(initialdir=launch_path,
title="Open all covers you want to work with:"
)
self.licycle = cycle(covers_path_list)
try:
self.nextelem = next(self.licycle)
except StopIteration:
# self.button3_load_images.configure(text="Select covers")
mb.showwarning("No file selected","No images were selected.")
self.image = None
self.button3_load_images.configure(text="Select covers",state="normal")
self.button3_load_images.grid()
logging.critical("No images were selected when asked for")
raise
self.prevelem = None
self.enableButtons(self.frame_coversetter)
try:
self.button3_load_images.grid_remove()

show_first_cover()

except UnidentifiedImageError as e:
mb.showerror("File is not a valid image", f"The file {self.thiselem.name} is not a valid image file")
logging.critical(f"UnidentifiedImageError - Image file: {self.thiselem.name}")
self.button3_load_images.configure(text="Select covers", state="normal")
self.button3_load_images.grid()

def show_first_cover():
Expand Down Expand Up @@ -382,6 +389,7 @@ def add_file_to_list(delete=False):
self.canvas1_coverimage.grid(column=0, row=0, padx="10 30")
self.button3_load_images = tk.Button(self.canvas_frame,text="Select covers",command=opencovers)
self.button3_load_images.grid(column=0,row=0,pady=20)

self.cover_image_name_label_var = tk.StringVar(value='OPEN ONE OR MORE IMAGES')
self.label_coverimagetitle = ttk.Label(self.canvas_frame)
self.label_coverimagetitle.configure(textvariable=self.cover_image_name_label_var)
Expand Down

0 comments on commit 9a0aa09

Please sign in to comment.