SkinningTools.UI.utils

Module Contents

Classes

LineEdit

override the focus steal on the lineedit

SimplePopupSpinBox

spinbox delegate that is able to display as its own window

Functions

FalseFolderCharacters(inString)

checking a string for characters that are not allowed in folder structures

FalseFolderCharactersJapanese(self, inString)

checking a string for characters that are not allowed in folder structures

QuickDialog(title)

convenience Quick dialog for simple accept and reject functions

addChecks(cls, button, checks=None)

add checkboxes to a button for extra functionality

addContextToMenu(cls, actionNames, btn)

add context menu to button based on the checkboxes

arrowButton(arrowType, sizePolicy)

toolbutton function with arrows

buttonsToAttach(name, command, *_)

convenience function to attach signal command to qpushbutton on creation

checkStringForBadChars(self, inText, button, option=1, *args)

checking a string for characters that are not allowed in folder structures

clamp(val, minVal=0.0, maxVal=1.0)

clamp value between min and max

compare_vec3(a, b, epsilon=1e-05)

compare 2 vectors if they are close enough to eahother, rounding the values as we dont want precision to interfere

convertImageToString(inPath)

convenience function to save an image as a string format so the image does not have to be placed with the file

convertStringToImage(inString)

convenience function to restore an image from an encoded string

findMissingItems(inList)

find the numbers in the list that are not identified

gDriveDownload(urlinfo, destination, progressBar=None)

google download functionality

getClosestVector(inList, currentPos, amountTosearch=1)

get the closest position in the given list from current position

getDebugState()

convenience function to work with debug mode

getNumericName(text, names)

get unique identifiers for names that are created

incrementName(name)

simple version of adding new trailing number

invLerp(a, b, v)

lerp the other way around, use the end product to get the weigth

lerp(a, b, t)

blend the value from start to end based on the weight

loadLanguageFile(language, widgetName)

load the language file based on given inputs

nullGridLayout(parent=None, size=0)

convenience function for the QGridLayout

nullHBoxLayout(parent=None, size=0)

convenience function for the QHBoxLayout

nullVBoxLayout(parent=None, size=0)

convenience function for the QVBoxLayout

onContextMenu(buttonObj, popMenu, functions, point)

popup the context menu when requested

pushButton(text='')

simple button command with correct stylesheet

remap(iMin, iMax, oMin, oMax, v)

remap the value from 1 range to another range

remapClosestPoints(sourceList, targetList, amount)

map given positions to the closest positions

round_compare(vA, vB, debug=False)

compare 2 objects if they are close enough to eahother, rounding the values as we dont want precision to interfere

saveResponseContent(response, destination)

save the chunks of data into a file

setProgress(inValue, progressBar=None, inText='')

convenience function to set the progress bar value even when a qProgressbar does not exist

similarString(inString, inList)

check if there is an object that resembles the given string in the list

smart_round(value, ndigits)

function to cap the decimals

smart_roundVec(inVector, nDigits)

function to cap the decimals of a vector

storeLanguageFile(inDict, language, widgetName)

store the language file based on given inputs

svgButton(name='', pixmap='', size=None, toolTipInfo=None)

toolbutton function with image from svg file

toolButton(pixmap='', orientation=0, size=None)

toolbutton function with image

vLerp(start, end, percent)

blend the vector from start to end based on the weight

veclength(inVec)

get the length of a vector

widgetsAt(pos)

Qt convenience function to get the widget at given screen position

SkinningTools.UI.utils.UIDIRECTORY
class SkinningTools.UI.utils.LineEdit

override the focus steal on the lineedit

keyPressEvent(self, event)
class SkinningTools.UI.utils.SimplePopupSpinBox(parent=None, value=0.5)

spinbox delegate that is able to display as its own window

closed
closeEvent(self, e)
SkinningTools.UI.utils.FalseFolderCharacters(inString)

checking a string for characters that are not allowed in folder structures

Parameters

inString (string) – the string to check

Returns

if the string has bad characters

Return type

bool

SkinningTools.UI.utils.FalseFolderCharactersJapanese(self, inString)

checking a string for characters that are not allowed in folder structures

Parameters

inString (string) – the string to check

Returns

if the string has bad characters

Return type

bool

SkinningTools.UI.utils.QuickDialog(title)

convenience Quick dialog for simple accept and reject functions

Parameters

title (string) – title for the dialog

Returns

the window to be created

Return type

QDialog

SkinningTools.UI.utils.addChecks(cls, button, checks=None)

add checkboxes to a button for extra functionality

Parameters
  • cls (<class>) – parent class

  • button (QPushButton) – the button to add the checkboxes to

  • checks (list) – names of all the checkboxes to add

SkinningTools.UI.utils.addContextToMenu(cls, actionNames, btn)

add context menu to button based on the checkboxes

Parameters
  • cls (<class>) – parent class

  • actionNames (list) – names of all the checkboxes

  • button (QPushButton) – the button to add context menu to

Returns

functions dictionary, Qmenu

Return type

list

SkinningTools.UI.utils.arrowButton(arrowType, sizePolicy)

toolbutton function with arrows

Parameters
  • arrowType (Qt.Arrow) – Arrow, arrow type to add to the button

  • sizePolicy (QSizePolicy) – list of sizepolicy information for width and height

Returns

the button

Return type

QToolButton

SkinningTools.UI.utils.buttonsToAttach(name, command, *_)

convenience function to attach signal command to qpushbutton on creation

Parameters
  • name (string) – text to add to the button

  • command (<function>) – python command to attach to the current button on clicked signal

Returns

the button

Return type

QPushButton

SkinningTools.UI.utils.checkStringForBadChars(self, inText, button, option=1, *args)

checking a string for characters that are not allowed in folder structures

Parameters
  • inText (string) – the text to check

  • option (int) – the type of structure to check for

Returns

if the string has bad characters

Return type

bool

SkinningTools.UI.utils.clamp(val, minVal=0.0, maxVal=1.0)

clamp value between min and max

Parameters
  • val (float) – value to clamp

  • minVal (float) – minimum value

  • maxVal (float) – maximum value

Returns

the clamped value

Return type

float

SkinningTools.UI.utils.compare_vec3(a, b, epsilon=1e-05)

compare 2 vectors if they are close enough to eahother, rounding the values as we dont want precision to interfere

Parameters
  • a (list) – the value to compare

  • b (list) – the value to compare

  • epsilon (double) – the precision allowance that the vectors can have between them

Returns

if the objects are the same or not

Return type

bool

SkinningTools.UI.utils.convertImageToString(inPath)

convenience function to save an image as a string format so the image does not have to be placed with the file

Parameters

inPath (string) – the path the the image

Returns

encoded string and extension type

Return type

list

SkinningTools.UI.utils.convertStringToImage(inString)

convenience function to restore an image from an encoded string

Parameters

inString (list) – encoded string and extension type

Returns

the path the the image

Return type

string

SkinningTools.UI.utils.findMissingItems(inList)

find the numbers in the list that are not identified

Parameters

inList (list) – list of names to check

Returns

list of missing numbers

Return type

list

SkinningTools.UI.utils.gDriveDownload(urlinfo, destination, progressBar=None)

google download functionality

Parameters
  • urlinfo (dict) – dict of filenames and corresponding files to download

  • destination (string) – the folder to place downloaded files

  • progressBar (QProgressbar) – the progressbar to show how much is downloaded

SkinningTools.UI.utils.getClosestVector(inList, currentPos, amountTosearch=1)

get the closest position in the given list from current position

Parameters
  • inList (list) – list of positions to choose from

  • currentPos (vector) – the position to search from

  • amountToSearch (int) – the amoutn of closest positions to return

Returns

list of closest positions

Return type

list

SkinningTools.UI.utils.getDebugState()

convenience function to work with debug mode this gets turned to False when packaged using the package creator

Returns

the debug state

Return type

boolean

SkinningTools.UI.utils.getNumericName(text, names)

get unique identifiers for names that are created if the name already exists, add a number at the end to make it unique again

Parameters
  • text (string) – the text to check for unique names

  • names (list) – the names that already exist

Returns

a unique name

Return type

string

SkinningTools.UI.utils.incrementName(name)

simple version of adding new trailing number

Parameters

name (string) – object to add trailing number to

Returns

objects name with new trailing number

Return type

string

SkinningTools.UI.utils.invLerp(a, b, v)

lerp the other way around, use the end product to get the weigth

Parameters
  • a (float) – start value

  • b (float) – end value

  • v (float) – middle value

Returns

the weight

Return type

float

SkinningTools.UI.utils.lerp(a, b, t)

blend the value from start to end based on the weight

Parameters
  • a (float) – start value

  • b (float) – end value

  • t (float) – the weight

Returns

the value in between

Return type

float

SkinningTools.UI.utils.loadLanguageFile(language, widgetName)

load the language file based on given inputs

Parameters
  • language (string) – the language used in the dictionary

  • widgetName (string) – name of the widget used to link the language file with

Returns

the translation dictionary

Return type

dict

SkinningTools.UI.utils.nullGridLayout(parent=None, size=0)

convenience function for the QGridLayout

Parameters
  • parent (QWidget) – the possible parent for the layout

  • size (int) – the size of the margins

Returns

the layout

Return type

QGridLayout

SkinningTools.UI.utils.nullHBoxLayout(parent=None, size=0)

convenience function for the QHBoxLayout

Parameters
  • parent (QWidget) – the possible parent for the layout

  • size (int) – the size of the margins

Returns

the layout

Return type

QHBoxLayout

SkinningTools.UI.utils.nullVBoxLayout(parent=None, size=0)

convenience function for the QVBoxLayout

Parameters
  • parent (QWidget) – the possible parent for the layout

  • size (int) – the size of the margins

Returns

the layout

Return type

QVBoxLayout

SkinningTools.UI.utils.onContextMenu(buttonObj, popMenu, functions, point)

popup the context menu when requested

Parameters
  • buttonObj (QPushButton) – the button to add context menu to

  • popMenu (QMenu) – the menu to popup

  • functions (list) – names of all the checkboxes

  • point (Qpos) – position to spawn the menu on screen

SkinningTools.UI.utils.pushButton(text='')

simple button command with correct stylesheet

Parameters

text (string) – text to add to the button

Returns

the button

Return type

QPushButton

SkinningTools.UI.utils.remap(iMin, iMax, oMin, oMax, v)

remap the value from 1 range to another range

Parameters
  • iMin (float) – new min value

  • iMax (float) – new max value

  • oMin (float) – old min value

  • oMax (float) – old max value

  • v (float) – value to remap

Returns

remapped value

Return type

float

SkinningTools.UI.utils.remapClosestPoints(sourceList, targetList, amount)

map given positions to the closest positions

Parameters
  • sourceList – list of positions to search from

  • targetList (list) – list of positions to choose from

  • amount (int) – the amoutn of closest positions to return

Returns

closest positions, weight values

Return type

list

SkinningTools.UI.utils.round_compare(vA, vB, debug=False)

compare 2 objects if they are close enough to eahother, rounding the values as we dont want precision to interfere

Parameters
  • vA (float/ double) – the value to compare

  • vB (float/ double) – the value to compare

  • debug (bool) – if True prints the info, if False just returns the value

Returns

if the objects are the same or not

Return type

bool

SkinningTools.UI.utils.saveResponseContent(response, destination)

save the chunks of data into a file

Parameters
  • response (<response>) – the information gathered from the website

  • destination (string) – the folder to place downloaded files

SkinningTools.UI.utils.setProgress(inValue, progressBar=None, inText='')

convenience function to set the progress bar value even when a qProgressbar does not exist

Parameters
  • inValue (int) – the current percentage of the progressbar

  • progressbar (QProgressBar) – the progressbar to update

  • inText (string) – additional text to show with the progressbar

SkinningTools.UI.utils.similarString(inString, inList)

check if there is an object that resembles the given string in the list

Parameters
  • inString (string) – string to check for

  • inList (list) – list of strings to choose from

Returns

the string that resembles the input the most

Return type

string

SkinningTools.UI.utils.smart_round(value, ndigits)

function to cap the decimals

Parameters
  • value (float/double) – the value to cap

  • ndigits (int) – amount of decimals needed

Returns

rounded float

Return type

float

SkinningTools.UI.utils.smart_roundVec(inVector, nDigits)

function to cap the decimals of a vector

Parameters
  • inVector (list) – the value to cap

  • ndigits (int) – amount of decimals needed

Returns

rounded vector

Return type

list

SkinningTools.UI.utils.storeLanguageFile(inDict, language, widgetName)

store the language file based on given inputs

Parameters
  • inDict (dict) – the translation dictionary

  • language (string) – the language used in the dictionary

  • widgetName (string) – name of the widget used to link the language file with

SkinningTools.UI.utils.svgButton(name='', pixmap='', size=None, toolTipInfo=None)

toolbutton function with image from svg file

Parameters
  • name (string) – text to add to the button

  • pixmap (string) – location of the svg file

  • size (int) – height and width of image in pixels

Returns

the button

Return type

QPushButton

SkinningTools.UI.utils.toolButton(pixmap='', orientation=0, size=None)

toolbutton function with image

Parameters
  • pixmap (string) – location of the image

  • orientation (int) – rotation in degrees clockwise

  • size (int) – height and width of image in pixels

Returns

the button

Return type

QToolButton

SkinningTools.UI.utils.vLerp(start, end, percent)

blend the vector from start to end based on the weight

Parameters
  • start (vector) – start vector

  • end (vector) – end vector

  • percent (float) – the weight

Returns

the vector in between

Return type

vector

SkinningTools.UI.utils.veclength(inVec)

get the length of a vector

Parameters

inVec (list) – the vector to get the length of

Returns

length of a vector

Return type

float

SkinningTools.UI.utils.widgetsAt(pos)

Qt convenience function to get the widget at given screen position

Parameters

pos (QPos) – the position on screen

Returns

widget on the position given

Return type

QWidget