added disable logging check box

This commit is contained in:
k4yt3x 2020-06-07 23:59:00 -04:00
parent 7e87dac15e
commit 60cf792c23
4 changed files with 17 additions and 9 deletions

View File

@ -121,7 +121,7 @@ def parse_arguments():
default=pathlib.Path(__file__).parent.absolute() / 'video2x.yaml')
video2x_options.add_argument('--log', type=pathlib.Path, help=_('log file path'),
default=pathlib.Path(__file__).parent.absolute() / f'video2x_{datetime.datetime.now().strftime("%Y-%m-%d_%H-%M-%S")}.log')
video2x_options.add_argument('--nolog', help=_('disable logging'), action='store_true')
video2x_options.add_argument('--disable_logging', help=_('disable logging'), action='store_true')
video2x_options.add_argument('-v', '--version', help=_('display version, lawful information and exit'), action='store_true')
# scaling options
@ -184,7 +184,7 @@ if video2x_args.version:
sys.exit(0)
# redirect output to both terminal and log file
if video2x_args.nolog is False:
if video2x_args.disable_logging is False:
LOGFILE = video2x_args.log
Avalon.debug_info(_('Redirecting console logs to {}').format(LOGFILE))
sys.stdout = BiLogger(sys.stdout, LOGFILE)

View File

@ -17,7 +17,6 @@ from wrappers.ffmpeg import Ffmpeg
import contextlib
import datetime
import json
import math
import mimetypes
import os
import pathlib
@ -281,6 +280,7 @@ class Video2XMainWindow(QMainWindow):
self.image_output_extension_line_edit = self.findChild(QLineEdit, 'imageOutputExtensionLineEdit')
self.video_output_extension_line_edit = self.findChild(QLineEdit, 'videoOutputExtensionLineEdit')
self.preserve_frames_check_box = self.findChild(QCheckBox, 'preserveFramesCheckBox')
self.disable_logging_check_box = self.findChild(QCheckBox, 'disableLoggingCheckBox')
# frame preview
self.frame_preview_show_preview_check_box = self.findChild(QCheckBox, 'framePreviewShowPreviewCheckBox')
@ -1154,9 +1154,10 @@ It\'s also highly recommended for you to attach the [log file]({}) under the pro
self.show_warning('Output path unspecified')
return
print(f'Redirecting console logs to {self.logfile}', file=sys.stderr)
sys.stdout = BiLogger(sys.stdout, self.logfile)
sys.stderr = BiLogger(sys.stderr, self.logfile)
if self.disable_logging_check_box.isChecked() is False:
print(f'Redirecting console logs to {self.logfile}', file=sys.stderr)
sys.stdout = BiLogger(sys.stdout, self.logfile)
sys.stderr = BiLogger(sys.stderr, self.logfile)
if len(self.input_table_data) == 1:
input_directory = self.input_table_data[0]

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.12.0, 2020-06-07T15:25:44. -->
<!-- Written by QtCreator 4.12.0, 2020-06-07T23:58:53. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
@ -170,7 +170,7 @@
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
<value type="QString" key="RunConfiguration.WorkingDirectory"></value>
<value type="QString" key="RunConfiguration.WorkingDirectory.default"></value>
<value type="QString" key="RunConfiguration.WorkingDirectory.default">C:/Users/k4yt3x/Documents/Projects/video2x/src</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
</valuemap>

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>673</width>
<height>876</height>
<height>910</height>
</rect>
</property>
<property name="acceptDrops">
@ -468,6 +468,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="disableLoggingCheckBox">
<property name="text">
<string>Disable Logging</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>