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
from PyQt4.QtCore import Qt, QPointF, QRectF | |
from PyQt4.QtGui import QApplication, QWidget, QGraphicsView, QGraphicsScene, QGraphicsItem, QVBoxLayout, QSpacerItem, QSizePolicy, QCursor | |
class DraggableBox( QGraphicsItem ): | |
""" | |
A simple QGraphicsItem that can be dragged around the scene. | |
Of course, this behavior is easier to achieve if you simply use the default | |
event handler implementations in place and call | |
QGraphicsItem.setFlags( QGraphicsItem.ItemIsMovable ) | |
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
import numpy | |
original_labels = None | |
mapping = None | |
# TODO: Ensure that all labels are present in mapping dict | |
# because none of these functions work otherwise. | |
def using_index_array(): | |
consecutivized_labels = numpy.searchsorted( sorted( mapping.iterkeys() ), original_labels ) |
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
# Colors for the prompt | |
blue="\033[0;34m" | |
white="\033[0;37m" | |
green="\033[0;32m" | |
# Brackets needed around non-printable characters in PS1 | |
ps1_blue='\['"$blue"'\]' | |
ps1_green='\['"$green"'\]' | |
ps1_white='\['"$white"'\]' |
NewerOlder