1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
# Copyright 2008-2009 Nanorex, Inc. See LICENSE file for details.
"""
BuildProtein_GraphicsMode.py
@author: Mark
@version: $Id$
@copyright: 2008-2009 Nanorex, Inc. See LICENSE file for details.
"""
from commands.SelectChunks.SelectChunks_GraphicsMode import SelectChunks_GraphicsMode
from commands.Select.Select_GraphicsMode import DRAG_STICKINESS_LIMIT
DEBUG_CLICK_ON_OBJECT_ENTERS_ITS_EDIT_COMMAND = True
_superclass = SelectChunks_GraphicsMode
class BuildProtein_GraphicsMode(SelectChunks_GraphicsMode):
"""
Graphics mode for Build Protein command.
"""
def Enter_GraphicsMode(self):
_superclass.Enter_GraphicsMode(self)
return
def chunkLeftUp(self, aChunk, event):
"""
Upon chunkLeftUp, it enters the protein edit command
This is an alternative implementation. As of 2008-03-03,
we have decided to change this implementation. Keeping the
related methods alive if, in future, we want to switch to this
implementation and/or add a user preference to do this.
"""
_superclass.chunkLeftUp(self, aChunk, event)
if self.glpane.modkeys is not None:
#Don't go further if some modkey is pressed. We will call the
#edit method of the protein only if no modifier key is
#pressed
return
if not self.mouse_within_stickiness_limit(event, DRAG_STICKINESS_LIMIT):
return
#@TODO: If the object under mouse was double clicked, don't enter the
#edit mode, instead do appropriate operation such as expand selection or
#contract selection (done in superclass)
#Note: when the object is just single clicked, it becomes editable).
if self.editObjectOnSingleClick():
if aChunk.picked:
if aChunk.isProteinChunk():
aChunk.protein.edit(self.win)
return
def editObjectOnSingleClick(self):
"""
Subclasses can override this method. If this method returns True,
when you left click on a DnaSegment or a DnaStrand, it becomes editable
(i.e. program enters the edit command of that particular object if
that object is editable)
@see: MakeCrossover_GraphicsMode.editObjectOnSingleClick()
"""
if DEBUG_CLICK_ON_OBJECT_ENTERS_ITS_EDIT_COMMAND:
return True
pass
|