mirror of
https://github.com/k4yt3x/video2x.git
synced 2025-01-04 04:39:10 +00:00
GUI 1.1.0 added basic menu bar and better output file naming check
This commit is contained in:
parent
db603062e9
commit
8c3a85ac42
@ -4,7 +4,7 @@
|
|||||||
Name: Video2x GUI
|
Name: Video2x GUI
|
||||||
Author: K4YT3X
|
Author: K4YT3X
|
||||||
Date Created: July 27, 2019
|
Date Created: July 27, 2019
|
||||||
Last Modified: July 27, 2019
|
Last Modified: August 7, 2019
|
||||||
|
|
||||||
Description: GUI for Video2X
|
Description: GUI for Video2X
|
||||||
"""
|
"""
|
||||||
@ -25,12 +25,17 @@ import threading
|
|||||||
import time
|
import time
|
||||||
import tkinter as tk
|
import tkinter as tk
|
||||||
|
|
||||||
VERSION = '1.0.0'
|
VERSION = '1.1.0'
|
||||||
|
|
||||||
|
LEGAL_INFO = f'''Video2X GUI Version: {VERSION}
|
||||||
|
Author: K4YT3X
|
||||||
|
License: GNU GPL v3
|
||||||
|
Github Page: https://github.com/k4yt3x/video2x
|
||||||
|
Contact: k4yt3x@k4yt3x.com'''
|
||||||
|
|
||||||
# global static variables
|
# global static variables
|
||||||
|
AVAILABLE_METHODS = {
|
||||||
AVAILABLE_METHODS = {'GPU': 'gpu',
|
'GPU': 'gpu',
|
||||||
'CUDNN': 'cudnn',
|
'CUDNN': 'cudnn',
|
||||||
'CPU': 'cpu'
|
'CPU': 'cpu'
|
||||||
}
|
}
|
||||||
@ -56,6 +61,21 @@ class Video2xGui():
|
|||||||
self.main_frame = Frame()
|
self.main_frame = Frame()
|
||||||
self.main_frame.pack(fill=BOTH, expand=True)
|
self.main_frame.pack(fill=BOTH, expand=True)
|
||||||
|
|
||||||
|
# add menu bar
|
||||||
|
self.menu_bar = Menu(self.main_frame)
|
||||||
|
|
||||||
|
# file menu
|
||||||
|
self.file_menu = Menu(self.menu_bar, tearoff=0)
|
||||||
|
self.file_menu.add_command(label='Exit', command=self.main_frame.quit)
|
||||||
|
self.menu_bar.add_cascade(label='File', menu=self.file_menu)
|
||||||
|
|
||||||
|
# help menu
|
||||||
|
self.help_menu = Menu(self.menu_bar, tearoff=0)
|
||||||
|
self.help_menu.add_command(label='About', command=self._display_help)
|
||||||
|
self.menu_bar.add_cascade(label='Help', menu=self.help_menu)
|
||||||
|
|
||||||
|
self.main_window.config(menu=self.menu_bar)
|
||||||
|
|
||||||
# file frame
|
# file frame
|
||||||
self.file_frame = Frame(self.main_frame)
|
self.file_frame = Frame(self.main_frame)
|
||||||
self.file_frame.pack(fill=X, padx=5, pady=5, expand=True)
|
self.file_frame.pack(fill=X, padx=5, pady=5, expand=True)
|
||||||
@ -164,6 +184,9 @@ class Video2xGui():
|
|||||||
|
|
||||||
self.main_frame.mainloop()
|
self.main_frame.mainloop()
|
||||||
|
|
||||||
|
def _display_help(self):
|
||||||
|
messagebox.showinfo('About', LEGAL_INFO)
|
||||||
|
|
||||||
def _launch_upscaling(self):
|
def _launch_upscaling(self):
|
||||||
|
|
||||||
# prevent launching multiple instances
|
# prevent launching multiple instances
|
||||||
@ -317,7 +340,17 @@ class Video2xGui():
|
|||||||
|
|
||||||
def _select_input(self):
|
def _select_input(self):
|
||||||
self.input_file.set(askopenfilename(title='Select Input File'))
|
self.input_file.set(askopenfilename(title='Select Input File'))
|
||||||
self.output_file.set(f'{self.input_file.get()}_output.mp4')
|
|
||||||
|
# try to set an output file name automatically
|
||||||
|
output_file = pathlib.Path(f'{self.input_file.get()}_output.mp4')
|
||||||
|
|
||||||
|
output_file_id = 0
|
||||||
|
while output_file.is_file() and output_file_id <= 10:
|
||||||
|
output_file = pathlib.Path(f'{self.input_file.get()}_output_{output_file_id}.mp4')
|
||||||
|
output_file_id += 1
|
||||||
|
|
||||||
|
if not output_file.exists():
|
||||||
|
self.output_file.set(str(output_file))
|
||||||
|
|
||||||
def _select_output(self):
|
def _select_output(self):
|
||||||
self.output_file.set(asksaveasfilename(title='Select Output File'))
|
self.output_file.set(asksaveasfilename(title='Select Output File'))
|
||||||
|
Loading…
Reference in New Issue
Block a user