This file contains hidden or 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
using System; | |
using System.Collections.Generic; | |
using System.ComponentModel; | |
using System.Runtime.CompilerServices; | |
namespace NotifyExample | |
{ | |
public abstract class NotifyBase : INotifyPropertyChanged | |
{ | |
public event PropertyChangedEventHandler PropertyChanged; |
This file contains hidden or 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
public class RandomColorGenerator { | |
Random r = new Random(DateTime.Now.Millisecond); | |
public RandomColorGenerator(){ | |
} | |
public Color RandomColor(){ | |
byte red = (byte)r.Next(0, 255); | |
byte green = (byte)r.Next(0, 255); |
This file contains hidden or 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
rowMax = 10 | |
rowSpacing = 30 | |
columnSpacing = 40 | |
delete objects | |
for row = 0 to 9 do | |
( | |
for column = 0 to 19 do | |
( |
This file contains hidden or 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
list1 = [1,2,3,4,5,6] | |
list2 = [3, 5, 7, 9] | |
results = list(set(list1).intersection(list2)) | |
print results |
This file contains hidden or 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
tree = [ | |
{ | |
"parent" : "Chris", | |
"children" : [ | |
{ | |
"parent" : "Doug", | |
"children" : [] | |
}, | |
{ | |
"parent" : "Michelle", |
This file contains hidden or 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
""" | |
- return[0] true if all items selected are the same level in heirarchy tree | |
- return[1] unique list of all levels containing a item selected | |
- return[2] select items | |
""" | |
def get_treewidget_selection_level(treewidget): | |
items = treewidget.selectedItems() | |
levels = set() |
This file contains hidden or 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
def clear_layout(self, layout): | |
while layout.count(): | |
child = layout.takeAt(0) | |
if child.widget() is not None: | |
child.widget().deleteLater() | |
elif child.layout() is not None: | |
clear_layout(child.layout()) | |
def clear_layout(self, layout): | |
for x in reversed(range(layout.count())): |
This file contains hidden or 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
import sys | |
from PySide import QtGui, QtCore | |
class ScrollPanelWidget(QtGui.QWidget): | |
def __init__(self, parent= None): | |
super(ScrollPanelWidget, self).__init__() | |
self.initUI() | |
def initUI(self): |
This file contains hidden or 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
# Imports | |
# ------------------------------------------------------------------------------ | |
import sys | |
import uuid | |
# Class Object | |
# ------------------------------------------------------------------------------ | |
class Node(object): | |
def __init__(self, name="", age=None): | |
self.name = name |