3 choix_origine, a module for pymecavideo:
4 a program to track moving points
in a video frameset
6 Copyright (C) 2007 Jean-Baptiste Butet <ashashiwa
@gmail.com>
7 Copyright (C) 2022 Georges Khaznadar <georgesk
@debian.org>
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.
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.
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/>.
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
26from vecteur import vecteur
29class ChoixOrigineWidget(QWidget):
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.
35 Paramètres du constructeur:
36 @param parent un videoWidget
37 @param pw le widget principal de l
'onglet de pointage
40 def __init__(self, parent, pw):
41 QWidget.__init__(self, parent)
43 self.setAutoFillBackground(
False)
44 self.setGeometry(QRect(0, 0, parent.image_w, parent.image_h))
45 self.setCursor(Qt.CursorShape.CrossCursor)
47 self.setMouseTracking(
True)
49 def mouseMoveEvent(self, event):
50 self.
pw.update_zoom.emit(
vecteur(qPoint = event.position()))
53 def mouseReleaseEvent(self, event):
54 p =
vecteur(qPoint = event.position())
56 self.
pw.update_zoom.emit(p)
57 self.
pw.app.egalise_origine()
une classe pour des vecteurs 2D ; les coordonnées sont flottantes, et on peut accéder à celles-ci par...