7
7
import imgedit
8
8
9
9
import os
10
- import threading , queue
10
+ import queue
11
+ import threading
11
12
12
13
from enum import Enum
13
14
from tkinter import *
@@ -146,6 +147,69 @@ def display_progress_window(self):
146
147
self .progress_bar .pack (expand = True , fill = "both" , side = "bottom" )
147
148
self .progress_bar ["value" ] = 0
148
149
150
+ def display_about (self ):
151
+ """
152
+ Display the about window (with a scrollbar)
153
+ """
154
+
155
+ if self .about_window is not None :
156
+ self .about_window .destroy ()
157
+
158
+ # Set the window
159
+ self .about_window = Toplevel (self )
160
+ self .about_window .title ("About" )
161
+ self .about_window .geometry ("400x300" )
162
+
163
+ # Header
164
+ header_imagetk = imgedit .HelpingMethods .get_imagetk ("about_header.png" )
165
+
166
+ header_label = Label (self .about_window , width = 400 , height = 150 )
167
+ header_label .pack (side = "top" , fill = "both" )
168
+ header_label .configure (image = header_imagetk )
169
+ header_label .image = header_imagetk
170
+
171
+ # Text with scrollbar
172
+ t = Text (self .about_window , width = 300 , height = 200 , font = ("Courier New" , 11 ))
173
+
174
+ scrollbar = ttk .Scrollbar (self .about_window )
175
+ scrollbar .pack (side = "right" , fill = "y" )
176
+ t .pack (side = "left" , fill = "y" )
177
+ scrollbar .config (command = t .yview )
178
+ t .config (yscrollcommand = scrollbar .set )
179
+
180
+ t .insert (END ,
181
+ "Batch Image Resize (v0.1)"
182
+ "\n "
183
+ "\n Developed by dn0z"
184
+ "\n https://github.com/dn0z/Batch-Image-Resize"
185
+ "\n "
186
+ "\n The icon is designed by Vecteezy "
187
+ "(https://iconfinder.com/icons/532771) "
188
+ "and it is licensed under Creative Commons "
189
+ "(Attribution-Share Alike 3.0 Unported)"
190
+ "\n \n "
191
+ "The MIT License (MIT)"
192
+ "\n \n "
193
+ "Copyright (c) 2016 dn0z"
194
+ "\n \n "
195
+ "Permission is hereby granted, free of charge, to any person obtaining a copy"
196
+ "of this software and associated documentation files (the \" Software\" ), to deal"
197
+ "in the Software without restriction, including without limitation the rights"
198
+ "to use, copy, modify, merge, publish, distribute, sublicense, and/or sell"
199
+ "copies of the Software, and to permit persons to whom the Software is"
200
+ "furnished to do so, subject to the following conditions:"
201
+ "\n \n "
202
+ "The above copyright notice and this permission notice shall be included in all"
203
+ "copies or substantial portions of the Software."
204
+ "\n \n "
205
+ "THE SOFTWARE IS PROVIDED \" AS IS\" , WITHOUT WARRANTY OF ANY KIND, EXPRESS OR"
206
+ "IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,"
207
+ "FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE"
208
+ "AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER"
209
+ "LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,"
210
+ "OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE"
211
+ "SOFTWARE." )
212
+
149
213
def get_settings_status (self ):
150
214
"""
151
215
Check if our settings are valid (directory exists, width and height are digits etc)
@@ -198,11 +262,10 @@ def export_button_handler(self):
198
262
else :
199
263
# Valid settings, confirm settings with the user and export
200
264
if self .confirm_settings ():
201
- # num_of_images = imgedit.image_files_in_dir(self.selected_directory.get())
202
-
203
265
self .display_progress_window ()
204
- print ("Progress window is on screen" )
205
266
267
+ # call `ImgEdit.export_all_in_dir` as the target of a new thread
268
+ # and put the final result in a `Queue`
206
269
q = queue .Queue ()
207
270
my_thread = threading .Thread (target = self .img_edit .export_all_in_dir ,
208
271
args = (self .selected_directory .get (),
@@ -305,9 +368,13 @@ def create_widgets(self):
305
368
ttk .Button (main_container , text = "Export" , command = self .export_button_handler ).grid (
306
369
row = 3 , column = 2 , rowspan = 2 , sticky = "nesw" , padx = 2 )
307
370
371
+ # About
372
+ ttk .Button (main_container , text = "About" , command = self .display_about ).grid (
373
+ row = 5 , column = 2 , sticky = "we" )
374
+
308
375
# Copyright
309
376
Label (main_container , text = "Copyright (c) 2016 dn0z | v0.1" , font = font_small ).grid (
310
- row = 5 , column = 0 , columnspan = 3 , sticky = "we" , pady = 20 )
377
+ row = 5 , column = 0 , columnspan = 2 , sticky = "we" , pady = 20 )
311
378
312
379
def __init__ (self , parent = None ):
313
380
"""
@@ -318,6 +385,7 @@ def __init__(self, parent=None):
318
385
Frame .__init__ (self , parent )
319
386
320
387
# properties
388
+ self .about_window = None
321
389
self .save_as_dropdown = None
322
390
self .progress_window = None
323
391
self .progress_bar = None
0 commit comments