-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## Templates #### Make HDA by Template - New *Inherit parameters* option - Pick node color and shape - Pick icon from disk - Preview for current icon - Fixed #66 ## Show User Data - New *Pin to node* mode - New *Word-Wrap* mode - Zooming with `Ctrl+Wheel` and `Ctrl+Plus/Minus` - Display node shape for *nodeshape* key - Fixed #70 #### Prettify - Redesigned and generalized - Support for XML - Support for INI-like - Support for comma-separated sequence ## Find Icon - Default icon size increased from 64x64 to 90x90 - Change icon size with slider in real-time - Slight UI acceleration
- Loading branch information
Ivan Titov
authored
Mar 23, 2021
1 parent
addec56
commit d7bac8b
Showing
18 changed files
with
1,682 additions
and
415 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
""" | ||
Tool Development Kit for SideFX Houdini | ||
Copyright (C) 2021 Ivan Titov | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
""" | ||
|
||
from __future__ import print_function | ||
|
||
try: | ||
from PyQt5.QtWidgets import * | ||
from PyQt5.QtGui import * | ||
from PyQt5.QtCore import * | ||
|
||
Signal = pyqtSignal | ||
except ImportError: | ||
from PySide2.QtWidgets import * | ||
from PySide2.QtGui import * | ||
from PySide2.QtCore import * | ||
|
||
|
||
def fuzzyMatch(pattern, text): | ||
if pattern == text: | ||
return True, 999999 | ||
|
||
try: | ||
pattern_start = text.index(pattern) | ||
pattern_length = len(pattern) | ||
return True, pattern_length * pattern_length + (1 - pattern_start / 500.0) | ||
except ValueError: | ||
pass | ||
|
||
weight = 0 | ||
count = 0 | ||
index = 0 | ||
for char in text: | ||
try: | ||
if char == pattern[index]: | ||
count += 1 | ||
index += 1 | ||
elif count != 0: | ||
weight += count * count | ||
count = 0 | ||
except IndexError: | ||
pass | ||
|
||
weight += count * count | ||
if index < len(pattern): | ||
return False, weight | ||
|
||
return True, weight + (1 - text.index(pattern[0]) / 500.0) | ||
|
||
|
||
class FuzzyFilterProxyModel(QSortFilterProxyModel): | ||
def __init__(self, parent=None, accept_text_role=Qt.UserRole, comp_text_role=Qt.DisplayRole): | ||
super(FuzzyFilterProxyModel, self).__init__(parent) | ||
|
||
self._accept_text_role = accept_text_role | ||
self.comp_text_role = comp_text_role | ||
|
||
self.setDynamicSortFilter(True) | ||
self.setFilterCaseSensitivity(Qt.CaseInsensitive) | ||
self.sort(0, Qt.DescendingOrder) | ||
|
||
self._pattern = '' | ||
|
||
def setFilterPattern(self, pattern): | ||
self._pattern = pattern.lower() | ||
self.invalidate() | ||
|
||
def filterAcceptsRow(self, source_row, source_parent): | ||
if not self._pattern: | ||
return True | ||
|
||
source_model = self.sourceModel() | ||
text = source_model.data(source_model.index(source_row, 0, source_parent), self._accept_text_role) | ||
matches, _ = fuzzyMatch(self._pattern, text.lower()) | ||
return matches | ||
|
||
def lessThan(self, source_left, source_right): | ||
if not self._pattern: | ||
return source_left.row() < source_right.row() | ||
|
||
text1 = source_left.data(self.comp_text_role) | ||
_, weight1 = fuzzyMatch(self._pattern, text1.lower()) | ||
|
||
text2 = source_right.data(self.comp_text_role) | ||
_, weight2 = fuzzyMatch(self._pattern, text2.lower()) | ||
|
||
return weight1 < weight2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,8 +23,6 @@ | |
import os | ||
import tempfile | ||
|
||
import os | ||
|
||
try: | ||
from PyQt5.QtWidgets import * | ||
from PyQt5.QtGui import * | ||
|
Oops, something went wrong.