diff --git a/moose-gui/plugins/kkitCalcArrow.py b/moose-gui/plugins/kkitCalcArrow.py index e11ebe3ff29d3110751239f00782dd1f260143ed..3b46a2c80502383b12429f3185eb1aef0d053212 100644 --- a/moose-gui/plugins/kkitCalcArrow.py +++ b/moose-gui/plugins/kkitCalcArrow.py @@ -1,6 +1,6 @@ from PyQt4.QtGui import QPolygonF from PyQt4.QtCore import QLineF,QPointF -import math +from math import sin,cos,atan2,radians from kkitQGraphics import PoolItem #, ReacItem,EnzItem,CplxItem,ComptItem ''' One to need to pass the source, destination,endtype and order for drawing the arrow between 2 object \ @@ -46,9 +46,9 @@ def calcArrow(srcdes_list,itemignoreZooming,iconScale): dy = desRect.center().y()- srcRect.center().y() dx0 = dy dy0 = -dx - tetha1 = (math.atan2(dy0,dx0)) - a0 = 4 *(math.cos(tetha1)) - b0 = 4 *(math.sin(tetha1)) + tetha1 = (atan2(dy0,dx0)) + a0 = 4 *(cos(tetha1)) + b0 = 4 *(sin(tetha1)) ''' Higher order ( > 4) connectivity will not be done''' if ((order == 3) or (order == 4)): a0 = a0*2 @@ -154,9 +154,9 @@ def calcLineRectIntersection(rect, centerLine): def arrowHead(srcAngle,degree,lineSpoint,iconScale): ''' arrow head is calculated ''' r = 8*iconScale - delta = math.radians(srcAngle) + math.radians(degree) - width = math.sin(delta)*r - height = math.cos(delta)*r + delta = radians(srcAngle) + radians(degree) + width = sin(delta)*r + height = cos(delta)*r srcXArr = (lineSpoint.x() + width) srcYArr = (lineSpoint.y() + height) return srcXArr,srcYArr diff --git a/moose-gui/plugins/kkitQGraphics.py b/moose-gui/plugins/kkitQGraphics.py index 2487100c51fe10e56a89685c0b7ee81bf97e8f5e..1a804b0d530b324539aa76f29f512cc6a9afedfc 100644 --- a/moose-gui/plugins/kkitQGraphics.py +++ b/moose-gui/plugins/kkitQGraphics.py @@ -15,6 +15,7 @@ from PyQt4 import QtGui, QtCore, Qt from moose import * from PyQt4.QtGui import QPixmap, QImage, QGraphicsPixmapItem from constants import * +from os import path class KineticsDisplayItem(QtGui.QGraphicsWidget): """Base class for display elemenets in kinetics layout""" @@ -71,7 +72,9 @@ class FuncItem(KineticsDisplayItem): def __init__(self, mobj, parent): super(FuncItem, self).__init__(mobj, parent) self.setFlag(QtGui.QGraphicsItem.ItemIsMovable, True) - self.funcImage = QImage('icons/classIcon/Function.png').scaled(15,33) + #self.funcImage = QImage('icons/classIcon/Function.png').scaled(15,33) + iconmap_file = (path.join(config.settings[config.KEY_ICON_DIR], 'classIcon/Function.png')) + self.funcImage = QImage(iconmap_file).scaled(15,33) self.bg = QtGui.QGraphicsRectItem(self) self.bg.setAcceptHoverEvents(True) self.gobj = QtGui.QGraphicsPixmapItem(QtGui.QPixmap.fromImage(self.funcImage),self.bg) @@ -195,6 +198,9 @@ class PoolItem(KineticsDisplayItem): #This func will adjust the background color with respect to text size self.gobj.setText(self.mobj.name) self.bg.setRect(0, 0, self.gobj.boundingRect().width()+PoolItem.fontMetrics.width(' '), self.gobj.boundingRect().height()) + self.setGeometry(self.pos().x(),self.pos().y(),self.gobj.boundingRect().width() + +PoolItem.fontMetrics.width(''), + self.gobj.boundingRect().height()) def updateColor(self,bgcolor): self.bg.setBrush(QtGui.QBrush(QtGui.QColor(bgcolor))) @@ -490,7 +496,9 @@ class ComptItem(QtGui.QGraphicsRectItem): self.setFlag(QtGui.QGraphicsItem.ItemIsMovable, True); self.setFlag(QtGui.QGraphicsItem.ItemIsSelectable) - #self.setFlag(QtGui.QGraphicsItem.ItemSendsGeometryChanges, 1) + #self.setFlag(QtGui.QGraphicsItem.ItemSendsGeometryChanges, 1) + QT_VERSION = str(QtCore.QT_VERSION_STR).split('.') + QT_MINOR_VERSION = int(QT_VERSION[1]) if config.QT_MINOR_VERSION >= 6: self.setFlag(QtGui.QGraphicsItem.ItemSendsGeometryChanges, 1) '''