Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
moose
Manage
Activity
Members
Labels
Plan
Issues
9
Issue boards
Milestones
Wiki
Code
Merge requests
2
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sahil Moza
moose
Commits
224487f4
Commit
224487f4
authored
8 years ago
by
Dilawar Singh
Browse files
Options
Downloads
Plain Diff
Merge commit '
25a907eb
'
parents
02fcf721
25a907eb
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
moose-gui/plugins/kkitCalcArrow.py
+7
-7
7 additions, 7 deletions
moose-gui/plugins/kkitCalcArrow.py
moose-gui/plugins/kkitQGraphics.py
+10
-2
10 additions, 2 deletions
moose-gui/plugins/kkitQGraphics.py
with
17 additions
and
9 deletions
moose-gui/plugins/kkitCalcArrow.py
+
7
−
7
View file @
224487f4
from
PyQt4.QtGui
import
QPolygonF
from
PyQt4.QtGui
import
QPolygonF
from
PyQt4.QtCore
import
QLineF
,
QPointF
from
PyQt4.QtCore
import
QLineF
,
QPointF
import
math
from
math
import
sin
,
cos
,
atan2
,
radians
from
kkitQGraphics
import
PoolItem
#, ReacItem,EnzItem,CplxItem,ComptItem
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
\
'''
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):
...
@@ -46,9 +46,9 @@ def calcArrow(srcdes_list,itemignoreZooming,iconScale):
dy
=
desRect
.
center
().
y
()
-
srcRect
.
center
().
y
()
dy
=
desRect
.
center
().
y
()
-
srcRect
.
center
().
y
()
dx0
=
dy
dx0
=
dy
dy0
=
-
dx
dy0
=
-
dx
tetha1
=
(
math
.
atan2
(
dy0
,
dx0
))
tetha1
=
(
atan2
(
dy0
,
dx0
))
a0
=
4
*
(
math
.
cos
(
tetha1
))
a0
=
4
*
(
cos
(
tetha1
))
b0
=
4
*
(
math
.
sin
(
tetha1
))
b0
=
4
*
(
sin
(
tetha1
))
'''
Higher order ( > 4) connectivity will not be done
'''
'''
Higher order ( > 4) connectivity will not be done
'''
if
((
order
==
3
)
or
(
order
==
4
)):
if
((
order
==
3
)
or
(
order
==
4
)):
a0
=
a0
*
2
a0
=
a0
*
2
...
@@ -154,9 +154,9 @@ def calcLineRectIntersection(rect, centerLine):
...
@@ -154,9 +154,9 @@ def calcLineRectIntersection(rect, centerLine):
def
arrowHead
(
srcAngle
,
degree
,
lineSpoint
,
iconScale
):
def
arrowHead
(
srcAngle
,
degree
,
lineSpoint
,
iconScale
):
'''
arrow head is calculated
'''
'''
arrow head is calculated
'''
r
=
8
*
iconScale
r
=
8
*
iconScale
delta
=
math
.
radians
(
srcAngle
)
+
math
.
radians
(
degree
)
delta
=
radians
(
srcAngle
)
+
radians
(
degree
)
width
=
math
.
sin
(
delta
)
*
r
width
=
sin
(
delta
)
*
r
height
=
math
.
cos
(
delta
)
*
r
height
=
cos
(
delta
)
*
r
srcXArr
=
(
lineSpoint
.
x
()
+
width
)
srcXArr
=
(
lineSpoint
.
x
()
+
width
)
srcYArr
=
(
lineSpoint
.
y
()
+
height
)
srcYArr
=
(
lineSpoint
.
y
()
+
height
)
return
srcXArr
,
srcYArr
return
srcXArr
,
srcYArr
This diff is collapsed.
Click to expand it.
moose-gui/plugins/kkitQGraphics.py
+
10
−
2
View file @
224487f4
...
@@ -15,6 +15,7 @@ from PyQt4 import QtGui, QtCore, Qt
...
@@ -15,6 +15,7 @@ from PyQt4 import QtGui, QtCore, Qt
from
moose
import
*
from
moose
import
*
from
PyQt4.QtGui
import
QPixmap
,
QImage
,
QGraphicsPixmapItem
from
PyQt4.QtGui
import
QPixmap
,
QImage
,
QGraphicsPixmapItem
from
constants
import
*
from
constants
import
*
from
os
import
path
class
KineticsDisplayItem
(
QtGui
.
QGraphicsWidget
):
class
KineticsDisplayItem
(
QtGui
.
QGraphicsWidget
):
"""
Base class for display elemenets in kinetics layout
"""
"""
Base class for display elemenets in kinetics layout
"""
...
@@ -71,7 +72,9 @@ class FuncItem(KineticsDisplayItem):
...
@@ -71,7 +72,9 @@ class FuncItem(KineticsDisplayItem):
def
__init__
(
self
,
mobj
,
parent
):
def
__init__
(
self
,
mobj
,
parent
):
super
(
FuncItem
,
self
).
__init__
(
mobj
,
parent
)
super
(
FuncItem
,
self
).
__init__
(
mobj
,
parent
)
self
.
setFlag
(
QtGui
.
QGraphicsItem
.
ItemIsMovable
,
True
)
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
=
QtGui
.
QGraphicsRectItem
(
self
)
self
.
bg
.
setAcceptHoverEvents
(
True
)
self
.
bg
.
setAcceptHoverEvents
(
True
)
self
.
gobj
=
QtGui
.
QGraphicsPixmapItem
(
QtGui
.
QPixmap
.
fromImage
(
self
.
funcImage
),
self
.
bg
)
self
.
gobj
=
QtGui
.
QGraphicsPixmapItem
(
QtGui
.
QPixmap
.
fromImage
(
self
.
funcImage
),
self
.
bg
)
...
@@ -195,6 +198,9 @@ class PoolItem(KineticsDisplayItem):
...
@@ -195,6 +198,9 @@ class PoolItem(KineticsDisplayItem):
#This func will adjust the background color with respect to text size
#This func will adjust the background color with respect to text size
self
.
gobj
.
setText
(
self
.
mobj
.
name
)
self
.
gobj
.
setText
(
self
.
mobj
.
name
)
self
.
bg
.
setRect
(
0
,
0
,
self
.
gobj
.
boundingRect
().
width
()
+
PoolItem
.
fontMetrics
.
width
(
'
'
),
self
.
gobj
.
boundingRect
().
height
())
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
):
def
updateColor
(
self
,
bgcolor
):
self
.
bg
.
setBrush
(
QtGui
.
QBrush
(
QtGui
.
QColor
(
bgcolor
)))
self
.
bg
.
setBrush
(
QtGui
.
QBrush
(
QtGui
.
QColor
(
bgcolor
)))
...
@@ -490,7 +496,9 @@ class ComptItem(QtGui.QGraphicsRectItem):
...
@@ -490,7 +496,9 @@ class ComptItem(QtGui.QGraphicsRectItem):
self
.
setFlag
(
QtGui
.
QGraphicsItem
.
ItemIsMovable
,
True
);
self
.
setFlag
(
QtGui
.
QGraphicsItem
.
ItemIsMovable
,
True
);
self
.
setFlag
(
QtGui
.
QGraphicsItem
.
ItemIsSelectable
)
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
:
if
config
.
QT_MINOR_VERSION
>=
6
:
self
.
setFlag
(
QtGui
.
QGraphicsItem
.
ItemSendsGeometryChanges
,
1
)
self
.
setFlag
(
QtGui
.
QGraphicsItem
.
ItemSendsGeometryChanges
,
1
)
'''
'''
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment