[pitivi] medialibrary: Optimize only unsupported assets by default



commit 0e62f784ddb4021a41c8989f33305cf216183fa6
Author: Ritwik Puri <ritwikpuri5678 gmail com>
Date:   Thu Jan 16 20:02:54 2020 +0530

    medialibrary: Optimize only unsupported assets by default
    
    When scaled proxy are used, only the unsupported assets require optimization.
    
    Fixes #2376

 pitivi/medialibrary.py | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)
---
diff --git a/pitivi/medialibrary.py b/pitivi/medialibrary.py
index 95e2f8ce..e8587d6e 100644
--- a/pitivi/medialibrary.py
+++ b/pitivi/medialibrary.py
@@ -20,6 +20,7 @@ import os
 import subprocess
 import sys
 import time
+from enum import IntEnum
 from gettext import gettext as _
 from gettext import ngettext
 from hashlib import md5
@@ -117,6 +118,11 @@ for category, mime_types in SUPPORTED_FILE_FORMATS.items():
         SUPPORTED_MIMETYPES.append(category + "/" + mime)
 
 
+class OptimizeOption(IntEnum):
+    UNSUPPORTED_ASSETS = 0
+    ALL = 1
+
+
 class FileChooserExtraWidget(Gtk.Box, Loggable):
 
     def __init__(self, app):
@@ -136,9 +142,9 @@ class FileChooserExtraWidget(Gtk.Box, Loggable):
         self.hq_proxy_check.connect("toggled", self._hq_proxy_check_cb)
 
         self.hq_combo = Gtk.ComboBoxText.new()
-        self.hq_combo.insert_text(0, _("Unsupported assets"))
-        self.hq_combo.insert_text(1, _("All"))
-        self.hq_combo.props.active = 0
+        self.hq_combo.insert_text(OptimizeOption.UNSUPPORTED_ASSETS, _("Unsupported assets"))
+        self.hq_combo.insert_text(OptimizeOption.ALL, _("All"))
+        self.hq_combo.props.active = OptimizeOption.UNSUPPORTED_ASSETS
         self.hq_combo.set_sensitive(False)
 
         self.help_button = Gtk.Button()
@@ -178,11 +184,11 @@ class FileChooserExtraWidget(Gtk.Box, Loggable):
         if self.app.settings.proxying_strategy == ProxyingStrategy.AUTOMATIC:
             self.hq_proxy_check.set_active(True)
             self.hq_combo.set_sensitive(True)
-            self.hq_combo.props.active = 0
+            self.hq_combo.props.active = OptimizeOption.UNSUPPORTED_ASSETS
         elif self.app.settings.proxying_strategy == ProxyingStrategy.ALL:
             self.hq_proxy_check.set_active(True)
             self.hq_combo.set_sensitive(True)
-            self.hq_combo.props.active = 1
+            self.hq_combo.props.active = OptimizeOption.ALL
 
         if self.app.settings.auto_scaling_enabled:
             self.scaled_proxy_check.set_active(True)
@@ -208,6 +214,7 @@ class FileChooserExtraWidget(Gtk.Box, Loggable):
 
     def _scaled_proxy_check_cb(self, unused_button):
         if self.scaled_proxy_check.get_active():
+            self.hq_combo.props.active = OptimizeOption.UNSUPPORTED_ASSETS
             self.hq_proxy_check.set_active(True)
 
     def _target_res_cb(self, label_widget, unused_uri):
@@ -223,7 +230,7 @@ class FileChooserExtraWidget(Gtk.Box, Loggable):
         self.app.settings.closeImportDialog = not self.__keep_open_check.get_active()
 
         if self.hq_proxy_check.get_active():
-            if self.hq_combo.props.active == 0:
+            if self.hq_combo.props.active == OptimizeOption.UNSUPPORTED_ASSETS:
                 self.app.settings.proxying_strategy = ProxyingStrategy.AUTOMATIC
             else:
                 self.app.settings.proxying_strategy = ProxyingStrategy.ALL


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]