blob: c3054e45f8f7eb82238b90fb21e555edd5eaaadc (
plain)
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
|
# Copyright 2008 Nanorex, Inc. See LICENSE file for details.
"""
@author: Ninad
@version: $Id$
@copyright: 2008 Nanorex, Inc. See LICENSE file for details.
@license: GPL
TODOs:
Many changes planned in JoinStrands_GraphicsMode .
"""
from dna.commands.JoinStrands.JoinStrands_PropertyManager import JoinStrands_PropertyManager
from dna.command_support.BreakOrJoinStrands_Command import BreakOrJoinStrands_Command
from dna.commands.JoinStrands.JoinStrands_GraphicsMode import JoinStrands_GraphicsMode
import foundation.env as env
from utilities.prefs_constants import joinStrandsCommand_clickToJoinDnaStrands_prefs_key
# == Command part
_superclass = BreakOrJoinStrands_Command
class JoinStrands_Command(BreakOrJoinStrands_Command):
"""
Command part for joining two strands.
@see: superclass B{BreakOrJoinStrands_Command}
"""
# class constants
commandName = 'JOIN_STRANDS'
featurename = "Join Strands"
GraphicsMode_class = JoinStrands_GraphicsMode
PM_class = JoinStrands_PropertyManager
def _get_init_gui_flyout_action_string(self):
return 'joinStrandsAction'
def command_update_state(self):
"""
See superclass for documentation.
Note that this method is called only when self is the currentcommand on
the command stack.
@see: BuildAtomsFlyout.resetStateOfActions()
@see: self.activateAtomsTool()
"""
_superclass.command_update_state(self)
#Make sure that the command Name is JOIN_STRANDS. (because subclasses
#of JoinStrands_Command might be using this method).
#As of 2008-10-23, if the checkbox 'Click on strand to join'
#in the join strands PM is checked, NE1 will enter a command that
#implements different mouse behavior in its graphics mode and will stay
#there.
if self.commandName == 'JOIN_STRANDS' and \
env.prefs[joinStrandsCommand_clickToJoinDnaStrands_prefs_key] \
and not self.graphicsMode.exit_command_on_leftUp:
self.commandSequencer.userEnterCommand('CLICK_TO_JOIN_STRANDS')
|