<commit_before>from PyQt4 import QtGui, QtCore

class FsmState(QtGui.QGraphicsEllipseItem):
#class FsmState(QtGui.QGraphicsItem):
    
    def __init__(self, contextMenu, parent=None, scene=None):
        super(FsmState, self).__init__(parent, scene)

        self.stateName = "S0"
        self.diameter = 50
        self.setRect(self.diameter//-2,self.diameter//-2,self.diameter,self.diameter)
        self.arrows = []
        self.contextMenu = contextMenu

        #self.setPolygon(self.myPolygon)
        self.setFlag(QtGui.QGraphicsItem.ItemIsMovable, True)
        self.setFlag(QtGui.QGraphicsItem.ItemIsSelectable, True)
        self.setFlag(QtGui.QGraphicsItem.ItemSendsGeometryChanges, True)
                
    def paint(self, painter, option, widget=None):
#        painter.drawEllipse(-self.diameter/2, -self.diameter/2, self.diameter, self.diameter)
        super(FsmState, self).paint(painter, option, widget)
        painter.drawText(self.boundingRect(), QtCore.Qt.AlignCenter, self.stateName)

    def removeArrow(self, arrow):
        try:
            self.arrows.remove(arrow)
        except ValueError:
            pass

    def removeArrows(self):
        for arrow in self.arrows[:]:
            arrow.startItem().removeArrow(arrow)
            arrow.endItem().removeArrow(arrow)<commit_msg>state standalone paint with selection dependent background color<commit_after>from PyQt4 import QtGui, QtCore

class FsmState(QtGui.QGraphicsEllipseItem):
#class FsmState(QtGui.QGraphicsItem):
    
    def __init__(self, contextMenu, parent=None, scene=None):
        super(FsmState, self).__init__(parent, scene)

        self.stateName = "S0"
        self.diameter = 50
        self.setRect(self.diameter//-2,self.diameter//-2,self.diameter,self.diameter)
        self.arrows = []
        self.contextMenu = contextMenu

        #self.setPolygon(self.myPolygon)
        self.setFlag(QtGui.QGraphicsItem.ItemIsMovable, True)
        self.setFlag(QtGui.QGraphicsItem.ItemIsSelectable, True)
        self.setFlag(QtGui.QGraphicsItem.ItemSendsGeometryChanges, True)
                
    def paint(self, painter, option, widget=None):
        if self.isSelected():
            painter.setBrush(QtCore.Qt.yellow)
        else:
            painter.setBrush(QtCore.Qt.cyan)
        painter.drawEllipse(-self.diameter/2, -self.diameter/2, self.diameter, self.diameter)
 #       super(FsmState, self).paint(painter, option, widget)
        painter.drawText(self.boundingRect(), QtCore.Qt.AlignCenter, self.stateName)

    def removeArrow(self, arrow):
        try:
            self.arrows.remove(arrow)
        except ValueError:
            pass

    def removeArrows(self):
        for arrow in self.arrows[:]:
            arrow.startItem().removeArrow(arrow)
            arrow.endItem().removeArrow(arrow)
{'fraction_non_alphanumeric': 0.1119800924280128, 'fraction_numerical': 0.005687877710629221, 'mean_word_length': 2.823369565217391, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4954913', 'n_tokens_mistral': 911, 'n_tokens_neox': 875, 'n_words': 139}