Skip to content

Commit

Permalink
Tidy up
Browse files Browse the repository at this point in the history
  • Loading branch information
dbr committed Jan 8, 2012
1 parent 10ddfd7 commit 5f4d45d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion tabtabtab.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,9 @@ def __init__(self, mlist, weights, num_items = 20, filtertext = ""):

self._all = mlist
self._filtertext = filtertext

# _items is the list of objects to be shown, update sets this
self._items = []
self.update()

def set_filter(self, filtertext):
Expand All @@ -202,9 +205,11 @@ def update(self):

scored = []
for n in self._all:
# Turn "3D/Shader/Phong" into "Phong [3D/Shader]"
uiname = "%s [%s]" % (n.rpartition("/")[2], n.rpartition("/")[0])

if nonconsec_find(filtertext, uiname.lower(), anchored=True):
# Turn "3D/Shader/Phong" into "Phong [3D/Shader]"
# Matches, get weighting and add to list of stuff
score = self.weights.get(n)

scored.append({
Expand Down Expand Up @@ -302,6 +307,7 @@ def event(self, event):
elif is_keypress and event.key() == QtCore.Qt.Key_Down:
self.pressed_arrow.emit("down")
return True

elif is_keypress and event.key() == QtCore.Qt.Key_Escape:
self.cancelled.emit()
return True
Expand All @@ -327,6 +333,7 @@ def __init__(self, on_create = None, parent = None, winflags = None):
# Node weighting
self.weights = NodeWeights(os.path.expanduser("~/.nuke/tabtabtab_weights.json"))
self.weights.load() # save called in close method

try:
import nuke
nodes = find_menu_items(nuke.menu("Nodes"))
Expand Down

0 comments on commit 5f4d45d

Please sign in to comment.