Template
forked from CEN-RA/Plugin_QGIS
création d'un nouveau modell
This commit is contained in:
@@ -39,6 +39,7 @@ from qgis.core import (
|
||||
QgsLayoutTableColumn,
|
||||
QgsRectangle,
|
||||
QgsLayoutItemMapOverviewStack,
|
||||
QgsLayoutItemHtml,
|
||||
)
|
||||
from qgis.PyQt.QtCore import QLocale, QUrl, QDateTime, Qt
|
||||
from qgis.PyQt.QtGui import QDesktopServices, QIcon, QColor, QFont, QMovie
|
||||
@@ -150,19 +151,33 @@ class PageRender_Editor(QDialog, EDITOR_CLASS):
|
||||
self.pushButton_2.clicked.connect(self.load)
|
||||
self.verticalScrollBar.valueChanged.connect(self.moveFrame)
|
||||
#self.setAcceptHoverEvents(True)
|
||||
self.tableWidget.setTabKeyNavigation(False)
|
||||
|
||||
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()}
|
||||
if self.tableWidget.currentItem() != None:
|
||||
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 keyPressEvent(self, event):
|
||||
#if event.modifiers() & Qt.ControlModifier:
|
||||
if event.key() == Qt.Key_Up:
|
||||
self.verticalSlider.setValue(self.spinBox_2.value()+1)
|
||||
if event.key() == Qt.Key_Down:
|
||||
self.verticalSlider.setValue(self.spinBox_2.value()-1)
|
||||
if event.key() == Qt.Key_Right:
|
||||
self.horizontalSlider.setValue(self.spinBox.value()+1)
|
||||
if event.key() == Qt.Key_Left:
|
||||
self.horizontalSlider.setValue(self.spinBox.value()-1)
|
||||
|
||||
|
||||
def wheelEvent(self,event):
|
||||
if (event.angleDelta().y() >= 1):
|
||||
vsb = self.verticalScrollBar.value()+50
|
||||
@@ -172,51 +187,57 @@ class PageRender_Editor(QDialog, EDITOR_CLASS):
|
||||
|
||||
def mouseMoveEvent(self, event):
|
||||
updated_cursor_position = event.pos()
|
||||
if self.tableWidget.currentItem() != None:
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
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)
|
||||
self.horizontalSlider.setValue(round(updated_cursor_position_x/3.5))
|
||||
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)
|
||||
self.verticalSlider.setValue(round(updated_cursor_position_y/3.5))
|
||||
|
||||
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)
|
||||
self.horizontalSlider.setValue(round(updated_cursor_position_x/3.5))
|
||||
|
||||
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)
|
||||
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)
|
||||
self.verticalSlider.setValue(round(updated_cursor_position_y/3.5))
|
||||
|
||||
def mouseReleaseEvent(self, event):
|
||||
#print('x: {0}, y: {1}'.format(event.pos().x(), event.pos().y()))
|
||||
QApplication.restoreOverrideCursor()
|
||||
if self.tableWidget.currentItem() != None:
|
||||
QApplication.restoreOverrideCursor()
|
||||
|
||||
def select_file(self):
|
||||
options = QFileDialog.Options()
|
||||
@@ -442,6 +463,7 @@ def fletch_canvas(self):
|
||||
self.frame.move(frame_x,frame_y)
|
||||
def setSlider(self):
|
||||
if self.tableWidget.currentItem() != None:
|
||||
print(self.tableWidget.tabKeyNavigation())
|
||||
selection_name = (self.tableWidget.currentItem()).text()
|
||||
all_children = self.frame.children()
|
||||
selection = 0
|
||||
@@ -467,14 +489,18 @@ def fletch_canvas(self):
|
||||
|
||||
def rotate_color(self,selection,last_children):
|
||||
global last_select
|
||||
if self.radioButton.isChecked() == False:
|
||||
ColorCode = "10, 10, 80, 50"
|
||||
else:
|
||||
ColorCode = "249, 238, 148, 50"
|
||||
if self.rotate_object[selection.objectName()] == 0:
|
||||
selection.setStyleSheet("border: 2px solid;border-color:red;border-bottom-color: blue;background-color: rgb(10, 10, 80, 50)")
|
||||
selection.setStyleSheet("border: 2px solid;border-color:red;border-bottom-color: blue;background-color: rgb("+ColorCode+")")
|
||||
elif self.rotate_object[selection.objectName()] == 90:
|
||||
selection.setStyleSheet("border: 2px solid;border-color:red;border-left-color: blue;background-color: rgb(10, 10, 80, 50)")
|
||||
selection.setStyleSheet("border: 2px solid;border-color:red;border-left-color: blue;background-color: rgb("+ColorCode+")")
|
||||
elif self.rotate_object[selection.objectName()] == 180:
|
||||
selection.setStyleSheet("border: 2px solid;border-color:red;border-top-color: blue;background-color: rgb(10, 10, 80, 50)")
|
||||
selection.setStyleSheet("border: 2px solid;border-color:red;border-top-color: blue;background-color: rgb("+ColorCode+")")
|
||||
elif self.rotate_object[selection.objectName()] == 270:
|
||||
selection.setStyleSheet("border: 2px solid;border-color:red;border-right-color: blue;background-color: rgb(10, 10, 80, 50)")
|
||||
selection.setStyleSheet("border: 2px solid;border-color:red;border-right-color: blue;background-color: rgb("+ColorCode+")")
|
||||
if last_children != 0:
|
||||
if last_select != selection.objectName():
|
||||
last_children.setStyleSheet("background-color: rgb(10, 10, 10, 50)")
|
||||
|
||||
Reference in New Issue
Block a user