From 7e09e122f75145085ba93a25d19759a8711771c7 Mon Sep 17 00:00:00 2001 From: Blaine Date: Wed, 17 Jun 2020 14:43:10 +0530 Subject: preserve comments --- src/main/python/shapes/line.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/main/python/shapes/line.py b/src/main/python/shapes/line.py index 1438fbc..c893fe6 100644 --- a/src/main/python/shapes/line.py +++ b/src/main/python/shapes/line.py @@ -284,10 +284,8 @@ class LineLabel(QGraphicsTextItem): def focusOutEvent(self, event): super(LineLabel, self).focusOutEvent(event) - self.setTextInteractionFlags(Qt.NoTextInteraction) - self.nameChanged.emit() - self.setTextInteractionFlags(Qt.NoTextInteraction) # set text non interactive + self.nameChanged.emit() def __getstate__(self): return { -- cgit From fe42ad1a31426b58809d22d29131c6861723b1a3 Mon Sep 17 00:00:00 2001 From: Blaine Date: Wed, 17 Jun 2020 15:21:26 +0530 Subject: line and grip items work properly --- src/main/python/shapes/shapes.py | 41 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 4 deletions(-) diff --git a/src/main/python/shapes/shapes.py b/src/main/python/shapes/shapes.py index 117ffb8..05ac233 100644 --- a/src/main/python/shapes/shapes.py +++ b/src/main/python/shapes/shapes.py @@ -12,6 +12,17 @@ from PyQt5.QtWidgets import (QGraphicsColorizeEffect, QGraphicsEllipseItem, from .line import Line, findIndex from utils.app import fileImporter +directionsEnum = [ + "top", + "right", + "left", + "bottom" +] + +orientationEnum = [ + Qt.Horizontal, + Qt.Vertical +] class ItemLabel(QGraphicsTextItem): """Extends PyQt5's QGraphicsPathItem to create text label for svg item @@ -91,7 +102,7 @@ class SizeGripItem(QGraphicsPathItem): self.setPen(QPen(QColor("black"), 0)) self.setZValue(2) # property direction - self._direction = direction + self._direction = orientationEnum.index(direction) self.m_index = index @property @@ -99,7 +110,10 @@ class SizeGripItem(QGraphicsPathItem): """ property that returns the current intended resize direction of the grip item object """ - return self._direction + if self.parentItem().rotation % 2: + return orientationEnum[(self._direction + 1)%2] + else: + return orientationEnum[self._direction] def updatePath(self): """updates path of size grip item @@ -209,7 +223,7 @@ class LineGripItem(QGraphicsPathItem): # store position of self self.position = QPointF(grip[0], grip[1]) # set location - self._m_location = grip[2] + self._m_location = directionsEnum.index(grip[2]) # set size in case of rectangle grip self.size = grip[3] if len(grip) == 4 else None # stores current line which is in process @@ -226,7 +240,11 @@ class LineGripItem(QGraphicsPathItem): @property def m_location(self): - return self._m_location + return directionsEnum[(self._m_location + self.parentItem().rotation)%4] + + @m_location.setter + def m_location(self, location): + self._m_location = directionsEnum.index(location) def shape(self): # return interactive path @@ -428,7 +446,22 @@ class NodeItem(QGraphicsSvgItem): self.lineGripItems = [] self.sizeGripItems = [] self.label = None + self._rotation = 0 + @property + def rotation(self): + return self._rotation + + @rotation.setter + def rotation(self, rotation): + self._rotation = rotation % 4 + transform = QTransform() + transform.rotate(90*rotation) + self.setTransform(transform) + for i in self.lineGripItems: + for j in i.lines: + j.createPath() + def boundingRect(self): """Overrides QGraphicsSvgItem's boundingRect() virtual public function and returns a valid bounding -- cgit From 24ceacaf31b35ed472645a0d98415aae1db64594 Mon Sep 17 00:00:00 2001 From: Blaine Date: Wed, 17 Jun 2020 15:21:34 +0530 Subject: add shortcuts for rotation --- src/main/python/main.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/python/main.py b/src/main/python/main.py index 42b4e48..4cf1791 100644 --- a/src/main/python/main.py +++ b/src/main/python/main.py @@ -212,7 +212,16 @@ class appWindow(QMainWindow): else: return event.accept() - + elif event.key() == Qt.Key_Q: + if self.mdi.activeSubWindow() and self.mdi.activeSubWindow().tabber.currentWidget(): + for item in self.mdi.activeSubWindow().tabber.currentWidget().painter.selectedItems(): + item.rotation -= 1 + + elif event.key() == Qt.Key_E: + if self.mdi.activeSubWindow() and self.mdi.activeSubWindow().tabber.currentWidget(): + for item in self.mdi.activeSubWindow().tabber.currentWidget().painter.selectedItems(): + item.rotation += 1 + if __name__ == '__main__': # 1. Instantiate ApplicationContext -- cgit From 776c773f17632d12247a13640cc294f5dbb2fa7d Mon Sep 17 00:00:00 2001 From: Blaine Date: Wed, 17 Jun 2020 19:25:56 +0530 Subject: minor fixes --- src/main/python/shapes/shapes.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/python/shapes/shapes.py b/src/main/python/shapes/shapes.py index 05ac233..dbf3e9e 100644 --- a/src/main/python/shapes/shapes.py +++ b/src/main/python/shapes/shapes.py @@ -102,9 +102,13 @@ class SizeGripItem(QGraphicsPathItem): self.setPen(QPen(QColor("black"), 0)) self.setZValue(2) # property direction - self._direction = orientationEnum.index(direction) - self.m_index = index + self._direction = (orientationEnum.index(direction) + self.parentItem().rotation) % 4 + self._m_index = index + @property + def m_index(self): + return (self._m_index + self.parentItem().rotation) % 4 + @property def direction(self): """ -- cgit From 06164a26602d3694beacffd8c364ffdba0edb30a Mon Sep 17 00:00:00 2001 From: Blaine Date: Wed, 17 Jun 2020 19:54:22 +0530 Subject: stream table fixes --- src/main/resources/base/app.qss | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/main/resources/base/app.qss b/src/main/resources/base/app.qss index 5650279..d7b25b4 100644 --- a/src/main/resources/base/app.qss +++ b/src/main/resources/base/app.qss @@ -268,13 +268,27 @@ customTabWidget customView { QHeaderView { qproperty-defaultAlignment: AlignHCenter; } + QHeaderView::section { padding: 4px; border-style: none; background-color: white; } +QHeaderView::section:first{ + border-bottom: 1px solid black; +} + QTableView { border: none; - background-color: white; -} \ No newline at end of file +} + +QTableView::item { + border: none; + color: black; +} + +QTableView::item:selected { + background-color: transparent; + color: black; +} -- cgit From 4e52d02b6e7ccc36176eb90f35bd1013ecc74a10 Mon Sep 17 00:00:00 2001 From: Blaine Date: Thu, 18 Jun 2020 13:57:11 +0530 Subject: minor fix --- src/main/python/shapes/shapes.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/python/shapes/shapes.py b/src/main/python/shapes/shapes.py index dbf3e9e..71e9be7 100644 --- a/src/main/python/shapes/shapes.py +++ b/src/main/python/shapes/shapes.py @@ -15,8 +15,8 @@ from utils.app import fileImporter directionsEnum = [ "top", "right", - "left", - "bottom" + "bottom", + "left" ] orientationEnum = [ -- cgit From 79b0690d4ae7d9f8853aa90ba0cdbe58af7c1c4d Mon Sep 17 00:00:00 2001 From: Blaine Date: Thu, 18 Jun 2020 14:00:01 +0530 Subject: fix line grip item transform --- src/main/python/shapes/shapes.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/python/shapes/shapes.py b/src/main/python/shapes/shapes.py index 71e9be7..7205ba7 100644 --- a/src/main/python/shapes/shapes.py +++ b/src/main/python/shapes/shapes.py @@ -463,6 +463,8 @@ class NodeItem(QGraphicsSvgItem): transform.rotate(90*rotation) self.setTransform(transform) for i in self.lineGripItems: + i.setTransform(transform) + i.updatePosition() for j in i.lines: j.createPath() -- cgit