Pymecavideo 8.0
Étude cinématique à l'aide de vidéos
choix_origine.py
1# -*- coding: utf-8 -*-
2"""
3 choix_origine, a module for pymecavideo:
4 a program to track moving points in a video frameset
5
6 Copyright (C) 2007 Jean-Baptiste Butet <ashashiwa@gmail.com>
7 Copyright (C) 2022 Georges Khaznadar <georgesk@debian.org>
8
9 This program is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>.
21"""
22from PyQt6.QtCore import QThread, pyqtSignal, QLocale, QTranslator, Qt, QSize, QTimer, QObject, QRect, QPoint, QPointF
23from PyQt6.QtGui import QKeySequence, QIcon, QPixmap, QImage, QPainter, QPen, QColor, QShortcut
24from PyQt6.QtWidgets import QApplication, QMainWindow, QWidget, QLayout, QFileDialog, QTableWidgetItem, QInputDialog, QLineEdit, QMessageBox, QTableWidgetSelectionRange
25
26from vecteur import vecteur
27
28
29class ChoixOrigineWidget(QWidget):
30 """
31 Un widget pour choisir une nouvelle origine ; il est posé sur le
32 widget vidéo, et durant sa vie, il permet d'avoir un retour visuel
33 pendant qu'on bouge la souris vers la nouvelle origine.
34
35 Paramètres du constructeur:
36 @param parent un videoWidget
37 @param pw le widget principal de l'onglet de pointage
38 """
39
40 def __init__(self, parent, pw):
41 QWidget.__init__(self, parent)
42 self.pw = pw
43 self.setAutoFillBackground(False)
44 self.setGeometry(QRect(0, 0, parent.image_w, parent.image_h))
45 self.setCursor(Qt.CursorShape.CrossCursor)
46 self.cropX2 = None
47 self.setMouseTracking(True)
48
49 def mouseMoveEvent(self, event):
50 self.pw.update_zoom.emit(vecteur(qPoint = event.position()))
51 return
52
53 def mouseReleaseEvent(self, event):
54 p = vecteur(qPoint = event.position())
55 self.pw.origine = p
56 self.pw.update_zoom.emit(p)
57 self.pw.app.egalise_origine()
58 self.close()
59 return
Un widget pour choisir une nouvelle origine ; il est posé sur le widget vidéo, et durant sa vie,...
une classe pour des vecteurs 2D ; les coordonnées sont flottantes, et on peut accéder à celles-ci par...
Definition: vecteur.py:44