Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
OpenGEODE
Commits
7c119987
Commit
7c119987
authored
Aug 05, 2016
by
Maxime Perrotin
Browse files
Improve GUI performance
parent
3475675b
Changes
5
Hide whitespace changes
Inline
Side-by-side
opengeode/TextInteraction.py
View file @
7c119987
...
...
@@ -163,7 +163,7 @@ class EditableText(QGraphicsTextItem, object):
self
.
highlighter
=
Highlighter
(
self
.
document
(),
parent
.
blackbold
,
parent
.
redbold
)
self
.
completion_prefix
=
''
self
.
set_textbox_position
()
#
self.set_textbox_position()
self
.
set_text_alignment
()
# Increase the Z value of the text area so that the autocompleter
# always appear on top of text's siblings (parents's followers)
...
...
@@ -206,10 +206,10 @@ class EditableText(QGraphicsTextItem, object):
y_pos
=
rect_center
.
y
()
self
.
setPos
(
x_pos
,
y_pos
)
def
paint
(
self
,
painter
,
_
,
___
):
''' Place the textbox in the parent symbol and draw it '''
self
.
set_textbox_position
()
super
(
EditableText
,
self
).
paint
(
painter
,
_
,
___
)
#
def paint(self, painter, _, ___):
#
''' Place the textbox in the parent symbol and draw it '''
#
self.set_textbox_position()
#
super(EditableText, self).paint(painter, _, ___)
def
try_resize
(
self
):
'''
...
...
@@ -220,8 +220,8 @@ class EditableText(QGraphicsTextItem, object):
self
.
setTextWidth
(
-
1
)
parent_rect
=
self
.
parent
.
boundingRect
()
rect
=
self
.
boundingRect
()
if
rect
.
width
()
+
30
>
parent_rect
.
width
():
parent_rect
.
setWidth
(
rect
.
width
()
+
30
)
if
rect
.
width
()
+
15
>
parent_rect
.
width
():
parent_rect
.
setWidth
(
rect
.
width
()
+
15
)
parent_rect
.
setHeight
(
max
(
rect
.
height
(),
parent_rect
.
height
()))
self
.
parent
.
resize_item
(
parent_rect
)
...
...
opengeode/genericSymbols.py
View file @
7c119987
...
...
@@ -551,9 +551,9 @@ class Symbol(QObject, QGraphicsPathItem, object):
# Minimum size is the size of the text inside the symbol
try
:
height
=
max
(
user_height
,
self
.
text
.
boundingRect
().
height
()
+
10
)
self
.
text
.
boundingRect
().
height
())
width
=
max
(
user_width
,
self
.
text
.
boundingRect
().
width
()
+
30
)
self
.
text
.
boundingRect
().
width
()
+
15
)
except
AttributeError
:
height
=
max
(
user_height
,
15
)
width
=
max
(
user_width
,
30
)
...
...
@@ -1214,11 +1214,17 @@ class VerticalSymbol(Symbol, object):
# Create the connection with the parent symbol
self
.
connection
=
self
.
connect_to_parent
()
self
.
update_position
()
#
self.update_position()
self
.
updateConnectionPoints
()
if
y
is
not
None
:
self
.
pos_y
=
y
#self.cam(self.position, self.position)
if
parent
and
y
is
None
:
self
.
pos_y
=
self
.
parent
.
boundingRect
().
height
()
+
20
try
:
self
.
text
.
set_textbox_position
()
except
AttributeError
:
# if called before text is initialized - or if no textbox
pass
def
mouse_move
(
self
,
event
):
''' Click and move: forbid symbol to move on the x axis '''
...
...
opengeode/ogAST.py
View file @
7c119987
...
...
@@ -344,7 +344,7 @@ class Answer(object):
self
.
charPositionInLine
=
None
self
.
pos_x
,
self
.
pos_y
=
None
,
None
self
.
width
=
70
self
.
height
=
10.5
self
.
height
=
23
# one of 'closed_range' 'constant' 'open_range' 'else' 'informal_text'
self
.
kind
=
None
# informalText is a string, when kind == 'informal_text'
...
...
opengeode/opengeode.py
View file @
7c119987
...
...
@@ -624,8 +624,8 @@ class SDL_Scene(QtGui.QGraphicsScene, object):
def
refresh
(
self
):
''' Scene refresh - make sure it happens only once per cycle '''
LOG
.
debug
(
'scene refresh requested by '
+
str
(
traceback
.
extract_stack
(
limit
=
2
)[
-
2
][
1
:
3
]))
#
LOG.debug('scene refresh requested by '
#
+ str(traceback.extract_stack(limit=2)[-2][1:3]))
if
not
self
.
refresh_requested
:
self
.
refresh_requested
=
True
QTimer
.
singleShot
(
0
,
self
.
scene_refresh
)
...
...
@@ -633,10 +633,10 @@ class SDL_Scene(QtGui.QGraphicsScene, object):
def
scene_refresh
(
self
):
''' Refresh the symbols and connections in the scene '''
self
.
refresh_requested
=
False
LOG
.
debug
(
'scene refresh done'
)
for
symbol
in
self
.
visible_symb
:
symbol
.
updateConnectionPointPosition
()
symbol
.
updateConnectionPoints
()
#
LOG.debug('scene refresh done')
#
for symbol in self.visible_symb:
#
symbol.updateConnectionPointPosition()
#
symbol.updateConnectionPoints()
for
symbol
in
self
.
editable_texts
:
# EditableText refreshing - design explanation:
# The first one is tricky: at symbol initialization,
...
...
@@ -656,7 +656,7 @@ class SDL_Scene(QtGui.QGraphicsScene, object):
# This has the effect of re-computing the bounding rect
# and fixing the width issue.
symbol
.
setTextWidth
(
-
1
)
symbol
.
set_textbox_position
()
#
symbol.set_textbox_position()
symbol
.
try_resize
()
symbol
.
set_text_alignment
()
for
symbol
in
self
.
visible_symb
:
...
...
@@ -1095,7 +1095,7 @@ class SDL_Scene(QtGui.QGraphicsScene, object):
# Add the item to the scene
if
item
not
in
self
.
items
():
self
.
addItem
(
item
)
# Create Undo command (makes the call to the insert
S
ymbol function):
# Create Undo command (makes the call to the insert
_s
ymbol function):
undo_cmd
=
undoCommands
.
InsertSymbol
(
item
=
item
,
parent
=
parent
,
pos
=
pos
)
self
.
undo_stack
.
push
(
undo_cmd
)
# If no item is selected (e.g. new STATE), add it to the scene
...
...
@@ -1399,15 +1399,15 @@ class SDL_View(QtGui.QGraphicsView, object):
def
refresh
(
self
):
''' View refresh - make sure it happens only once per cycle '''
LOG
.
debug
(
'view refresh requested by '
+
str
(
traceback
.
extract_stack
(
limit
=
2
)[
-
2
][
0
:
3
]))
#
LOG.debug('view refresh requested by '
#
+ str(traceback.extract_stack(limit=2)[-2][0:3]))
if
not
self
.
refresh_requested
:
self
.
refresh_requested
=
True
QTimer
.
singleShot
(
0
,
self
.
view_refresh
)
def
view_refresh
(
self
):
''' Refresh the complete view '''
LOG
.
debug
(
'view refresh done'
)
#
LOG.debug('view refresh done')
self
.
refresh_requested
=
False
self
.
scene
().
refresh
()
self
.
setSceneRect
(
self
.
scene
().
sceneRect
())
...
...
opengeode/sdlSymbols.py
View file @
7c119987
...
...
@@ -449,6 +449,7 @@ class DecisionAnswer(HorizontalSymbol):
super
(
DecisionAnswer
,
self
).
insert_symbol
(
item_parent
,
x
,
y
)
self
.
last_branch_item
.
connectionBelow
=
\
JoinConnection
(
self
.
last_branch_item
,
item_parent
)
self
.
text
.
try_resize
()
def
boundingRect
(
self
):
return
QRectF
(
0
,
0
,
self
.
width
,
self
.
height
)
...
...
@@ -456,7 +457,7 @@ class DecisionAnswer(HorizontalSymbol):
def
set_shape
(
self
,
width
,
height
):
''' ANSWER has round, disjoint sides - does not fit in a polygon '''
self
.
width
,
self
.
height
=
width
,
height
point
=
20
#width / 2.85
point
=
20
path
=
QPainterPath
()
left
=
QRect
(
0
,
0
,
point
,
height
)
right
=
QRect
(
width
-
point
,
0
,
point
,
height
)
...
...
Write
Preview
Supports
Markdown
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!
Cancel
Please
register
or
sign in
to comment