From 059fbd118972c6cf5d82693f8ed65687623ebbe8 Mon Sep 17 00:00:00 2001 From: SuslikV Date: Sun, 19 Jan 2020 11:09:44 +0200 Subject: [PATCH 1/5] Apply the default profile settings Load a blank project to propagate the default settings when the media file is loaded from the command line. --- src/classes/app.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/classes/app.py b/src/classes/app.py index aeb2a1566d..2c6d0154bf 100644 --- a/src/classes/app.py +++ b/src/classes/app.py @@ -231,7 +231,8 @@ def __init__(self, *args, mode=None): # Auto load project passed as argument self.window.OpenProjectSignal.emit(path) else: - # Auto import media file + # Apply the default settings and Auto import media file + self.project.load("") self.window.filesTreeView.add_file(path) else: # Recover backup file (this can't happen until after the Main Window has completely loaded) From 1cfba5f6bf72d116b881d2f86c48606b921844eb Mon Sep 17 00:00:00 2001 From: Frank Dana Date: Tue, 21 Jan 2020 14:10:48 -0500 Subject: [PATCH 2/5] Use time.time() more defensively This is an attempt to address the (frankly _weird_) error from the logs in #3190, which appears to come down to Python getting confused when `time.time()` is imported over its own module name. Instead we `import time` when needed and call it as `time.time()`. Fixes #3190 (hopefully?) --- src/windows/main_window.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/windows/main_window.py b/src/windows/main_window.py index 9b7b8b1312..5db302b0ce 100644 --- a/src/windows/main_window.py +++ b/src/windows/main_window.py @@ -32,10 +32,10 @@ import platform import shutil import webbrowser +from time import sleep from operator import itemgetter from uuid import uuid4 from copy import deepcopy -from time import sleep, time from PyQt5.QtCore import * from PyQt5.QtGui import QIcon, QCursor, QKeySequence @@ -617,6 +617,8 @@ def actionSave_trigger(self, event): def auto_save_project(self): """Auto save the project""" + import time + app = get_app() s = settings.get_settings() @@ -634,7 +636,7 @@ def auto_save_project(self): file_name, file_ext = os.path.splitext(file_name) # Make copy of unsaved project file in 'recovery' folder - recover_path_with_timestamp = os.path.join(info.RECOVERY_PATH, "%d-%s.osp" % (int(time()), file_name)) + recover_path_with_timestamp = os.path.join(info.RECOVERY_PATH, "%d-%s.osp" % (int(time.time()), file_name)) shutil.copy(file_path, recover_path_with_timestamp) # Find any recovery file older than X auto-saves From 20080cefb48434ab3a90c3205ea5f895c33f4d10 Mon Sep 17 00:00:00 2001 From: SuslikV Date: Wed, 22 Jan 2020 10:22:19 +0200 Subject: [PATCH 3/5] Add confirmation dialog when canceling export --- src/windows/export.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/windows/export.py b/src/windows/export.py index 9d563ce508..e7e7785756 100644 --- a/src/windows/export.py +++ b/src/windows/export.py @@ -979,6 +979,21 @@ def accept(self): super(Export, self).accept() def reject(self): + # Handle cancel + if self.exporting and not self.close_button.isVisible(): + _ = get_app()._tr + ret = QMessageBox(self) + ret.setIcon(QMessageBox.Question) + ret.setWindowTitle(_("Video Export")) + ret.setText(_("Are you sure you want to abort the video export?")) + ret.addButton(_("Yes"), QMessageBox.AcceptRole) + button_No = QPushButton(_("No")) + ret.addButton(button_No, QMessageBox.RejectRole) + ret.setDefaultButton(button_No) + ret.exec_() + if ret.clickedButton() == button_No: + return + # Re-set OMP thread enabled flag if self.s.get("omp_threads_enabled"): openshot.Settings.Instance().WAIT_FOR_VIDEO_PROCESSING_TASK = False From a51640b186663d1d2b5e1371e238ec3ec371b7dd Mon Sep 17 00:00:00 2001 From: "FeRD (Frank Dana)" Date: Sun, 19 Jan 2020 04:45:17 -0500 Subject: [PATCH 4/5] classes/updates: Notify watchers when needed Co-authored-by: SuslikV --- src/classes/updates.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/classes/updates.py b/src/classes/updates.py index 30177ad0c1..bcc0d7e8b5 100644 --- a/src/classes/updates.py +++ b/src/classes/updates.py @@ -192,6 +192,9 @@ def reset(self): self.actionHistory.clear() self.redoHistory.clear() + # Notify watchers of new history state + self.update_watchers() + def add_listener(self, listener, index=-1): """ Add a new listener (which will invoke the changed(action) method each time an UpdateAction is available). """ @@ -343,3 +346,6 @@ def apply_last_action_to_history(self, previous_value): if self.last_action: self.last_action.set_old_values(previous_value) self.actionHistory.append(self.last_action) + + # Notify watchers of new history state + self.update_watchers() From f79842c2f22416cf4bd3f11511ac0a1aeceed6cd Mon Sep 17 00:00:00 2001 From: "FeRD (Frank Dana)" Date: Wed, 22 Jan 2020 14:21:30 -0500 Subject: [PATCH 5/5] Tweak export-cancel confirmation - Change title to "Export Video", already translated - Use QMessageBox.question() convenience function --- src/windows/export.py | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/windows/export.py b/src/windows/export.py index e7e7785756..8f56617413 100644 --- a/src/windows/export.py +++ b/src/windows/export.py @@ -36,6 +36,7 @@ from PyQt5.QtWidgets import * from PyQt5.QtGui import QIcon +from classes import info from classes import ui_util from classes.app import get_app from classes.metrics import * @@ -979,19 +980,15 @@ def accept(self): super(Export, self).accept() def reject(self): - # Handle cancel if self.exporting and not self.close_button.isVisible(): + # Show confirmation dialog _ = get_app()._tr - ret = QMessageBox(self) - ret.setIcon(QMessageBox.Question) - ret.setWindowTitle(_("Video Export")) - ret.setText(_("Are you sure you want to abort the video export?")) - ret.addButton(_("Yes"), QMessageBox.AcceptRole) - button_No = QPushButton(_("No")) - ret.addButton(button_No, QMessageBox.RejectRole) - ret.setDefaultButton(button_No) - ret.exec_() - if ret.clickedButton() == button_No: + result = QMessageBox.question(self, + _("Export Video"), + _("Are you sure you want to cancel the export?"), + QMessageBox.No | QMessageBox.Yes) + if result == QMessageBox.No: + # Resume export return # Re-set OMP thread enabled flag