Skip to content

Commit

Permalink
Preferences: Fix logging calls
Browse files Browse the repository at this point in the history
  • Loading branch information
ferdnyc committed Nov 25, 2021
1 parent 54f87bc commit a308850
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"""

import sys
import os.path
import os
import argparse

from PyQt5.QtCore import Qt
Expand Down
18 changes: 11 additions & 7 deletions src/windows/preferences.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def __init__(self):

def txtSearch_changed(self):
"""textChanged event handler for search box"""
log.info("Search for %s" % self.txtSearch.text())
log.info("Search for %s", self.txtSearch.text())

# Populate preferences
self.Populate(filter=self.txtSearch.text())
Expand Down Expand Up @@ -317,7 +317,7 @@ def Populate(self, filter=""):
value_list.remove(value_item)

# Remove hardware mode items which cannot decode the example video
log.debug("Preparing to test hardware decoding: %s" % (value_list))
log.debug("Preparing to test hardware decoding: %s", value_list)
for value_item in list(value_list):
v = value_item["value"]
if (not self.testHardwareDecode(value_list, v, 0)
Expand Down Expand Up @@ -470,7 +470,7 @@ def bool_value_changed(self, widget, param, state):
# Trigger specific actions
if param["setting"] == "debug-mode":
# Update debug setting of timeline
log.info("Setting debug-mode to %s" % (state == Qt.Checked))
log.info("Setting debug-mode to %s", state == Qt.Checked)
debug_enabled = (state == Qt.Checked)

# Enable / Disable logger
Expand Down Expand Up @@ -528,7 +528,9 @@ def text_value_changed(self, widget, param, value=None):
if param.get("category") == "Keyboard":
previous_value = value
value = QKeySequence(value).toString()
log.info("Parsing keyboard mapping via QKeySequence from %s to %s" % (previous_value, value))
log.info(
"Parsing keyboard mapping via QKeySequence from %s to %s",
previous_value, value)

# Save setting
self.s.set(param["setting"], value)
Expand Down Expand Up @@ -604,19 +606,21 @@ def testHardwareDecode(self, all_decoders, decoder, decoder_card="0"):
if reader.GetFrame(0).CheckPixel(0, 0, 2, 133, 255, 255, 5):
is_supported = True
self.hardware_tests_cards[decoder_card].append(int(decoder))
log.debug("Successful hardware decoder! %s (%s-%s)" % (decoder_name, decoder, decoder_card))
log.debug(
"Successful hardware decoder! %s (%s-%s)",
decoder_name, decoder, decoder_card)
else:
log.debug(
"CheckPixel failed testing hardware decoding (i.e. wrong color found): %s (%s-%s)",
(decoder_name, decoder, decoder_card))
decoder_name, decoder, decoder_card)

reader.Close()
clip.Close()

except Exception:
log.debug(
"Exception trying to test hardware decoding (this is expected): %s (%s-%s)",
(decoder_name, decoder, decoder_card))
decoder_name, decoder, decoder_card)

# Resume current settings
openshot.Settings.Instance().HARDWARE_DECODER = current_decoder
Expand Down

0 comments on commit a308850

Please sign in to comment.