Skip to content

Instantly share code, notes, and snippets.

View JokerMartini's full-sized avatar
😀

John Martini JokerMartini

😀
View GitHub Profile
@JokerMartini
JokerMartini / Returns Select Information for QTreeWidget | .py
Created November 11, 2015 19:43
Pyside Python: returns[0] true if all items selected are the same level in hierarchy tree. returns[1] unique list of all levels containing a item selected. returns[2] select items
#!/bin/env python
# ------------------------------------------------------------------------------
# Imports
# ------------------------------------------------------------------------------
import sys
from PySide import QtCore, QtGui
# ------------------------------------------------------------------------------
# Open UI
@JokerMartini
JokerMartini / Rename Dictionary Key | .py
Last active June 18, 2022 18:04
Python: Renames recursively every key in a dictionary to lowercase.
import sys
data = {
'MIKE' : ['Great'],
'SUE' : ['happy'],
'JAN' : ['sad']
}
for k, v in data.items():
print k, v
@JokerMartini
JokerMartini / Popup Rename Dialog - OK + Cancel | .py
Last active July 5, 2017 14:17
Pyside Pythong: Demonstrates a popup dialog used to edit names and returns true/false along with value.
import re
from PySide import QtGui, QtCore
from PySide.QtGui import QDialog, QVBoxLayout, QDialogButtonBox, QDateTimeEdit, QApplication
from PySide.QtCore import Qt, QDateTime
class RenameDialog(QDialog):
def __init__(self, parent = None):
super(RenameDialog, self).__init__(parent)
@JokerMartini
JokerMartini / Custom QTreeWidgetItem | .py
Created November 5, 2015 18:14
Pyside Python: Demonstrates how to create a custom QTreeWidgetItem in pyside.
#!/bin/env python
# ------------------------------------------------------------------------------
# Imports
# ------------------------------------------------------------------------------
import sys
from PySide import QtCore, QtGui
# ------------------------------------------------------------------------------
# Open UI
@JokerMartini
JokerMartini / Class Inheritance 01| .py
Last active July 5, 2017 14:17
Python: Simple example of class inheritance
import sys
class Animal:
def __init__(self):
print "Animal created"
def whoAmI(self):
print "Animal"
def eat(self):
@JokerMartini
JokerMartini / Toggle GroupBox Collapse | .py
Created November 4, 2015 14:44
Python Pyside: Toggle the expansion of a groupbox in pyside using the groupbox.
import sys
from PySide import QtGui, QtCore
class Example(QtGui.QWidget):
def __init__(self,):
super(Example, self).__init__()
self.initUI()
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
namespace DirectoryTree
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
namespace DirectoryTree
@JokerMartini
JokerMartini / Saving Scene Nodes To XML | .ms
Created October 26, 2015 18:41
Maxscript: Saves the current 3ds Max scene nodes and various object properties to an XML.
clearlistener()
delete objects
--// create test scene
fn testSceneSetup =
(
local nodeCount = 100
for i = 1 to nodeCount do
(
@JokerMartini
JokerMartini / Timestamping Data | .ms
Created October 22, 2015 18:31
Maxscript: This snippet demonstrates how to timestamp memory and execution time.
--Info Logging Start
clearlistener()
RunStartTime = (timestamp())
RunStartMemory = heapfree
-- Function goes here
--Info Logging End
RunEndTime = (timestamp())
RunEndMemory = heapfree