Skip to content

Commit 6dcec47

Browse files
committed
Variables have now more readable names
1 parent 66f0ca5 commit 6dcec47

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

src/windows/export.py

+19-19
Original file line numberDiff line numberDiff line change
@@ -313,10 +313,10 @@ def getProfileName(self, profile_path):
313313
if profile_path == path:
314314
return profile
315315

316-
def updateProgressBar(self, title_message, start_frame, end_frame, current_frame, progress_format):
316+
def updateProgressBar(self, title_message, start_frame, end_frame, current_frame, format_of_progress_string):
317317
"""Update progress bar during exporting"""
318318
if end_frame - start_frame > 0:
319-
percentage_string = progress_format % (( current_frame - start_frame ) / ( end_frame - start_frame ) * 100)
319+
percentage_string = format_of_progress_string % (( current_frame - start_frame ) / ( end_frame - start_frame ) * 100)
320320
else:
321321
percentage_string = "100%"
322322
self.progressExportVideo.setValue(current_frame)
@@ -913,31 +913,31 @@ def titlestring(sec, fps, mess):
913913
start_frame_export = video_settings.get("start_frame")
914914
end_frame_export = video_settings.get("end_frame")
915915
last_exported_time = time.time()
916-
old_part = 0.0
917-
new_part = 0.0
918-
afterpoint = 1
916+
last_displayed_exported_portion = 0.0
917+
current_exported_portion = 0.0
918+
digits_after_decimalpoint = 1
919919
# Precision of the progress bar
920-
progress_format = "%4.1f%% "
920+
format_of_progress_string = "%4.1f%% "
921921
# Write each frame in the selected range
922922
for frame in range(video_settings.get("start_frame"), video_settings.get("end_frame") + 1):
923923
# Update progress bar (emit signal to main window)
924924
end_time_export = time.time()
925925
if ((frame % progressstep) == 0) or ((end_time_export - last_exported_time) > 1):
926-
new_part = (frame - start_frame_export) * 1.0 / (end_frame_export - start_frame_export)
927-
if ((new_part - old_part) > 0.0):
926+
current_exported_portion = (frame - start_frame_export) * 1.0 / (end_frame_export - start_frame_export)
927+
if ((current_exported_portion - last_displayed_exported_portion) > 0.0):
928928
# the log10 of the difference of the fraction of the completed frames is the negativ
929929
# number of digits after the decimal point after which the first digit is not 0
930-
afterpoint = math.ceil( -2.0 - math.log10( new_part - old_part ))
930+
digits_after_decimalpoint = math.ceil( -2.0 - math.log10( current_exported_portion - last_displayed_exported_portion ))
931931
else:
932-
afterpoint = 1
933-
if afterpoint < 1:
932+
digits_after_decimalpoint = 1
933+
if digits_after_decimalpoint < 1:
934934
# We want at least 1 digit after the decimal point
935-
afterpoint = 1
936-
if afterpoint > 5:
935+
digits_after_decimalpoint = 1
936+
if digits_after_decimalpoint > 5:
937937
# We don't want not more than 5 difits after the decimal point
938-
afterpoint = 5
939-
old_part = new_part
940-
progress_format = "%4." + str(afterpoint) + "f%% "
938+
digits_after_decimalpoint = 5
939+
last_displayed_exported_portion = current_exported_portion
940+
format_of_progress_string = "%4." + str(digits_after_decimalpoint) + "f%% "
941941
last_exported_time = time.time()
942942
if ((( frame - start_frame_export ) != 0) & (( end_time_export - start_time_export ) != 0)):
943943
seconds_left = round(( start_time_export - end_time_export )*( frame - end_frame_export )/( frame - start_frame_export ))
@@ -948,7 +948,7 @@ def titlestring(sec, fps, mess):
948948
title_message = titlestring(seconds_left, fps_encode, "Remaining")
949949

950950
# Emit frame exported
951-
get_app().window.ExportFrame.emit(title_message, video_settings.get("start_frame"), video_settings.get("end_frame"), frame, progress_format)
951+
get_app().window.ExportFrame.emit(title_message, video_settings.get("start_frame"), video_settings.get("end_frame"), frame, format_of_progress_string)
952952

953953
# Process events (to show the progress bar moving)
954954
QCoreApplication.processEvents()
@@ -968,7 +968,7 @@ def titlestring(sec, fps, mess):
968968
title_message = titlestring(seconds_run, fps_encode, "Elapsed")
969969

970970
get_app().window.ExportFrame.emit(title_message, video_settings.get("start_frame"),
971-
video_settings.get("end_frame"), frame, progress_format)
971+
video_settings.get("end_frame"), frame, format_of_progress_string)
972972

973973
except Exception as e:
974974
# TODO: Find a better way to catch the error. This is the only way I have found that
@@ -1036,7 +1036,7 @@ def titlestring(sec, fps, mess):
10361036
title_message = titlestring(seconds_run, fps_encode, "Elapsed")
10371037

10381038
get_app().window.ExportFrame.emit(title_message, video_settings.get("start_frame"),
1039-
video_settings.get("end_frame"), frame, progress_format)
1039+
video_settings.get("end_frame"), frame, format_of_progress_string)
10401040

10411041
# Make progress bar green (to indicate we are done)
10421042
from PyQt5.QtGui import QPalette

0 commit comments

Comments
 (0)