Пример #1
0
class NormalWidget(QWidget):
    def __init__(self, fileBubble, fileSelectedTarget, currentUserNb, method,
                 density, currentTargetSize):
        QWidget.__init__(self)
        self.targets = []
        self.toSelected = []
        # chargé les fichier csv
        self.createTargets(fileBubble)
        self.createSelectedTargets(fileSelectedTarget)
        self.cursor = NormalCursor(self.targets, self.toSelected,
                                   currentUserNb, method, density,
                                   currentTargetSize)

    def paintEvent(self, event):
        painter = QPainter(self)
        for target in self.targets:
            target.paint(painter)
        # self.cursor.paint(painter)

    def mouseReleaseEvent(self, event):
        self.cursor.select(event.x(), event.y())
        self.update()

    def createTargets(self, filename):
        with open(filename, 'r') as bubbles:
            reader = csv.reader(bubbles)
            for row in reader:
                self.targets.append(
                    Target(int(row[0]), int(row[1]), int(row[2])))

    def createSelectedTargets(self, filename):
        with open(filename, 'r') as selected:
            reader = csv.reader(selected)
            for row in reader:
                self.toSelected.append(self.targets[int(row[0])])
Пример #2
0
 def __init__(self, fileBubble, fileSelectedTarget, currentUserNb, method,
              density, currentTargetSize):
     QWidget.__init__(self)
     self.targets = []
     # chargé les fichier csv
     self.createTargets(fileBubble)
     self.createSelectedTargets(fileSelectedTarget)
     self.cursor = NormalCursor(self.targets, currentUserNb, method,
                                density, currentTargetSize)
Пример #3
0
 def __init__(self):
     QWidget.__init__(self)
     self.targets = []
     # chargé le fichier targets.csv
     with open('src_tp_bubble.csv', 'r') as file:
         reader = csv.reader(file)
         for row in reader:
             self.targets.append(
                 Target(int(row[0]), int(row[1]), int(row[2])))
     self.cursor = NormalCursor(self.targets)
Пример #4
0
class NormalWidget(QWidget):
    def __init__(self):
        QWidget.__init__(self)
        self.targets = []
        # chargé le fichier targets.csv
        with open('src_tp_bubble.csv', 'r') as file:
            reader = csv.reader(file)
            for row in reader:
                self.targets.append(
                    Target(int(row[0]), int(row[1]), int(row[2])))
        self.cursor = NormalCursor(self.targets)

    def paintEvent(self, event):
        painter = QPainter(self)
        for target in self.targets:
            target.paint(painter)
        # self.cursor.paint(painter)

    def mouseMoveEvent(self, event):
        self.cursor.select(event.x(), event.y())
        self.update()
Пример #5
0
    def __init__(self, type, fileBubble, fileSelectedTarget, currentUserNb,
                 method, density, currentTargetSize):
        QWidget.__init__(self)
        self.targets = []
        self.toSelected = []
        # chargé les fichier csv
        self.createTargets(fileBubble)
        self.createSelectedTargets(fileSelectedTarget)
        self.setMouseTracking(True)

        if (type == "Rope"):
            self.cursor = RopeCursor(self.targets, self.toSelected,
                                     currentUserNb, method, density,
                                     currentTargetSize)
        elif (type == "Bubble"):
            self.cursor = BubbleCursor(self.targets, self.toSelected,
                                       currentUserNb, method, density,
                                       currentTargetSize)
        else:
            self.cursor = NormalCursor(self.targets, self.toSelected,
                                       currentUserNb, method, density,
                                       currentTargetSize)