-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathshowNodeDB.py
81 lines (58 loc) · 3.12 KB
/
showNodeDB.py
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
69
70
71
72
73
74
75
76
77
78
79
80
81
from abaqusConstants import *
from abaqusGui import *
from kernelAccess import mdb, session
import os
from myIcons import showNodeIcon
import i18n
thisPath = os.path.abspath(__file__)
thisDir = os.path.dirname(thisPath)
###########################################################################
# Class definition
###########################################################################
class ShowNodeDB(AFXDataDialog):
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def __init__(self, form):
# Construct the base class.
#
AFXDataDialog.__init__(self, form, 'PickANode',
self.OK|self.CANCEL, DIALOG_ACTIONS_SEPARATOR)
#AFXNote(self, i18n.tr('Das is ein NodePicker\n' \
# 'Returns a Node label'))
okBtn = self.getActionButton(self.ID_CLICKED_OK)
okBtn.setText('OK')
pickHf = FXHorizontalFrame(p=self, opts=0, x=0, y=0, w=0, h=0,
pl=0, pr=0, pt=0, pb=0, hs=DEFAULT_SPACING, vs=DEFAULT_SPACING)
# Note: Set the selector to indicate that this widget should not be
# colored differently from its parent when the 'Color layout managers'
# button is checked in the RSG Dialog Builder dialog.
pickHf.setSelector(99)
label = FXLabel(p=pickHf, text='Text' + ' (None)', ic=None, opts=LAYOUT_CENTER_Y|JUSTIFY_LEFT)
pickHandler = ShowNodeDBPickHandler(form, form.myNodeKw, 'Pick an entity', NODES, ONE, label)
icon = afxGetIcon('select', AFX_ICON_SMALL )
FXButton(p=pickHf, text='\tPick Items in Viewport', ic=icon, tgt=pickHandler, sel=AFXMode.ID_ACTIVATE,
opts=BUTTON_NORMAL|LAYOUT_CENTER_Y, x=0, y=0, w=0, h=0, pl=2, pr=2, pt=1, pb=1)
###########################################################################
# Class definition
###########################################################################
class ShowNodeDBPickHandler(AFXProcedure):
count = 0
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def __init__(self, form, keyword, prompt, entitiesToPick, numberToPick, label):
self.form = form
self.keyword = keyword
self.prompt = prompt
self.entitiesToPick = entitiesToPick # Enum value
self.numberToPick = numberToPick # Enum value
self.label = label
self.labelText = label.getText()
AFXProcedure.__init__(self, form.getOwner())
ShowNodeDBPickHandler.count += 1
self.setModeName('ShowNodeDBPickHandler%d' % (ShowNodeDBPickHandler.count) )
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def getFirstStep(self):
return AFXPickStep(self, self.keyword, self.prompt,
self.entitiesToPick, self.numberToPick, sequenceStyle=TUPLE)
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def getNextStep(self, previousStep):
self.label.setText( self.labelText.replace('None', 'Picked') )
return None