Skip to content

Commit

Permalink
Merge pull request #16 from itaki/Remove-six-for-Nuke-14.1-and-15
Browse files Browse the repository at this point in the history
removed python package 'six'
  • Loading branch information
adrianpueyo authored Jan 14, 2024
2 parents 547f12d + 35e528c commit 976575e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 26 deletions.
14 changes: 7 additions & 7 deletions KnobScripter/knob_scripter.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import os
import json
import six
#import six
import io

from nukescripts import panels
Expand Down Expand Up @@ -60,7 +60,7 @@ def symlink_ms(source, link_name):
from KnobScripter.info import __version__, __date__
from KnobScripter import config, prefs, utils, dialogs, widgets, ksscripteditormain
from KnobScripter import snippets, codegallery, script_output, findreplace, content
from KnobScripter.utils import string

# logging.basicConfig(level=logging.DEBUG)

nuke.tprint('KnobScripter v{0}, built {1}.\n'
Expand Down Expand Up @@ -612,9 +612,9 @@ def loadKnobValue(self, check=True, update_dict=False):
try:
# If blinkscript, use getValue.
if knob_language == "blink":
obtained_knob_value = string(self.node[dropdown_value].getValue())
obtained_knob_value = self.node[dropdown_value].getValue()
elif knob_language == "python":
obtained_knob_value = string(self.node[dropdown_value].value())
obtained_knob_value = self.node[dropdown_value].value()
logging.debug(obtained_knob_value)
logging.debug(type(obtained_knob_value))
else: # TODO: knob language is None -> try to get the expression for tcl???
Expand Down Expand Up @@ -803,7 +803,7 @@ def updateUnsavedKnobs(self):
if len(self.unsaved_knobs) > 0:
for k in self.unsaved_knobs.copy():
if self.node.knob(k):
if string(self.getKnobValue(k)) == string(self.unsaved_knobs[k]):
if self.getKnobValue(k) == self.unsaved_knobs[k]:
del self.unsaved_knobs[k]
else:
del self.unsaved_knobs[k]
Expand Down Expand Up @@ -1415,7 +1415,7 @@ def saveScriptContents(self, temp=True):
if temp:
if os.path.isfile(script_path):
with io.open(script_path, 'r', encoding="utf-8") as script:
orig_content = string(script.read()) # string()
orig_content = script.read()
elif script_content == "" and os.path.isfile(script_path_temp):
# If script path doesn't exist and autosave does but the script is empty...
os.remove(script_path_temp)
Expand Down Expand Up @@ -2061,7 +2061,7 @@ def saveClicked(self):
def setModified(self):
if self.nodeMode:
if not self.current_knob_modified:
if string(self.getKnobValue(self.knob)) != self.script_editor.toPlainText(): # string()
if self.getKnobValue(self.knob) != self.script_editor.toPlainText():
self.setKnobModified(True)
elif not self.current_script_modified:
self.setScriptModified(True)
Expand Down
19 changes: 0 additions & 19 deletions KnobScripter/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"""
import nuke
import six

from KnobScripter import config
try:
Expand Down Expand Up @@ -75,24 +74,6 @@ def findSE():
return widget


def string(text):
# Quick workaround for python 2 vs 3 unicode str headache
if six.PY3:
unicode = str
if isinstance(text, six.binary_type):
return text.decode("utf-8")
else:
return text

def check_str(text):
""" Quick check of str type in order to understand this topic. """
print("Text type (unicode in py2, str in py3): {0}\n"
"Binary type? (str in py2, bytes in py3): {1}\n"
"Type is: {2}".format(isinstance(text, six.text_type), isinstance(text, six.binary_type),
type(text)))
return


def findSEInput(se):
children = se.children()
splitter = [w for w in children if isinstance(w, QtWidgets.QSplitter)]
Expand Down

0 comments on commit 976575e

Please sign in to comment.