Ajout de fonctionnaliter mollet et mouse dragging

This commit is contained in:
Tom LAVEILLE 2024-11-14 17:16:23 +01:00
parent 7fd53159e9
commit 654a8f579f
4 changed files with 70 additions and 6 deletions

View File

@ -29,6 +29,8 @@ else:
os_user = os.environ['USERNAME']
if os_user == 'STAGE':
os_user='stage'
if os_user == 'Administrateur':
os_user = 'stage'
geom = "geom"
champ_travaux_prevus_multipolygon="""(gid serial NOT NULL, groupe_gestion text, gestion_lib text, id_gestion text, datedebut date, datefin date, commentaire text, surface_m2 double precision, surface_ha double precision, date_creation date, date_maj date, geom geometry(MultiPolygon,2154))"""

View File

@ -1,6 +1,6 @@
import logging
import os
from PyQt5.QtCore import QSettings
from PyQt5.QtCore import QSettings,QPointF
from collections import namedtuple
from enum import Enum
from functools import partial
@ -57,6 +57,7 @@ from qgis.PyQt.QtWidgets import (
QVBoxLayout,
)
from PyQt5 import QtGui
from PyQt5.QtWidgets import QApplication
from qgis.PyQt.QtXml import QDomDocument
from qgis.utils import iface
import glob
@ -148,14 +149,75 @@ class PageRender_Editor(QDialog, EDITOR_CLASS):
self.toolButton_2.clicked.connect(self.type_page)
self.pushButton_2.clicked.connect(self.load)
self.verticalScrollBar.valueChanged.connect(self.moveFrame)
#self.setAcceptHoverEvents(True)
def raise_(self):
self.activateWindow()
self.setNavigator()
self.verticalScrollBar.setValue(self.frame.y())
def mousePressEvent(self, event):
QApplication.setOverrideCursor(Qt.OpenHandCursor)
global lastPos
lastPos = {'x':event.pos().x(),'y':event.pos().y()}
def moveFrame(self):
self.frame.move(self.frame.x(),self.verticalScrollBar.value())
def wheelEvent(self,event):
if (event.angleDelta().y() >= 1):
vsb = self.verticalScrollBar.value()+50
else:
vsb = self.verticalScrollBar.value()-50
self.verticalScrollBar.setValue(vsb)
def mouseMoveEvent(self, event):
updated_cursor_position = event.pos()
selection_name = (self.tableWidget.currentItem()).text()
all_children = self.frame.children()
selection = 0
for children in all_children:
if selection_name == children.objectName():
selection = children
frame_x = self.frame.x()
frame_y = self.frame.y()
frame_w = self.frame.width()+frame_x
frame_h = self.frame.height()+frame_y
global lastPos
orig_position_w = selection.width()
orig_position_h = selection.height()
if (frame_x <= round(updated_cursor_position.x()) <= frame_w and self.radioButton.isChecked() == True):
updated_cursor_position_x = orig_position_w+(round(updated_cursor_position.x()-lastPos['x']))
lastPos['x'] = event.pos().x()
selection.resize(updated_cursor_position_x,orig_position_h)
orig_position_w = selection.width()
orig_position_h = selection.height()
if (frame_y <= round(updated_cursor_position.y()) <= frame_h and self.radioButton.isChecked() == True):
updated_cursor_position_y = orig_position_h+(round(updated_cursor_position.y()-lastPos['y']))
lastPos['y'] = event.pos().y()
selection.resize(orig_position_w,updated_cursor_position_y)
orig_position_x = selection.pos().x()
orig_position_y = selection.pos().y()
if (frame_x <= round(updated_cursor_position.x()) <= frame_w and self.radioButton.isChecked() == False):
updated_cursor_position_x = orig_position_x+(round(updated_cursor_position.x()-lastPos['x']))
lastPos['x'] = event.pos().x()
#print(updated_cursor_position_x)
selection.move(updated_cursor_position_x,orig_position_y)
orig_position_x = selection.pos().x()
orig_position_y = selection.pos().y()
if (frame_y <= round(updated_cursor_position.y()) <= frame_h and self.radioButton.isChecked() == False):
updated_cursor_position_y = orig_position_y+(round(updated_cursor_position.y()-lastPos['y']))
lastPos['y'] = event.pos().y()
#print(updated_cursor_position_y)
selection.move(orig_position_x,updated_cursor_position_y)
def mouseReleaseEvent(self, event):
#print('x: {0}, y: {1}'.format(event.pos().x(), event.pos().y()))
QApplication.restoreOverrideCursor()
def select_file(self):
options = QFileDialog.Options()
options |= QFileDialog.ShowDirsOnly

View File

@ -6,7 +6,7 @@
name=CenRa_PageRender
qgisMinimumVersion=3.0
description=CenRa_PageRender
version=1.3
version=1.4
author=Conservatoire d'Espaces Naturels de Rhône-Alpes
email=si_besoin@cen-rhonealpes.fr
@ -21,7 +21,7 @@ tracker=https://gitea.cenra-outils.org/api/v1/repos/CEN-RA/Plugin_QGIS/issues
hasProcessingProvider=no
# Uncomment the following line and add your changelog:
changelog=<h2>CenRa_PageRender:</h2></br><p><h3>08/11/2024 - Version 1.3: </h3> - Correctif de bug. </br><p><h3>21/10/2024 - Version 1.1: </h3> - Les match en if. </br> - Bouton de scroll et adaptation portrait.</p></br><p><h3>09/10/2024 - Version 1.0: </h3> - Création.</p>
changelog=<h2>CenRa_PageRender:</h2></br><p><h3>14/11/2024 - Version 1.4: </h3> - Implementation de la mollet. </br> - Implementation du dragging pour déplacer et modification de la taille </br></p></br><p><h3>08/11/2024 - Version 1.3: </h3> - Correctif de bug. </br><p><h3>21/10/2024 - Version 1.1: </h3> - Les match en if. </br> - Bouton de scroll et adaptation portrait.</p></br><p><h3>09/10/2024 - Version 1.0: </h3> - Création.</p>
# Tags are comma separated with spaces allowed
tags=python

View File

@ -102,9 +102,9 @@
<tags>cenra,mise en page,atlas</tags>
</pyqgis_plugin>
<pyqgis_plugin name="CenRa_PAGERENDER" version="1.3">
<pyqgis_plugin name="CenRa_PAGERENDER" version="1.4">
<description><![CDATA[Dépôt pour les extensiont QGIS du CEN Rhone-Alpes, sur GitHub.]]></description>
<version>1.3</version>
<version>1.4</version>
<qgis_minimum_version>3.16</qgis_minimum_version>
<homepage>https://plateformesig.cenra-outils.org/</homepage>
<file_name>CenRa_PAGERENDER.zip</file_name>
@ -113,7 +113,7 @@
<download_url>https://gitea.cenra-outils.org/CEN-RA/Plugin_QGIS/releases/download/latest/CenRa_PAGERENDER.zip</download_url>
<uploaded_by>CEN-Rhone-Alpes</uploaded_by>
<create_date>2024-10-09</create_date>
<update_date>2024-11-08</update_date>
<update_date>2024-11-14</update_date>
<experimental>True</experimental>
<deprecated>False</deprecated>
<tags>cenra,mise en page,atlas</tags>