本文整理汇总了Python中component.Component类的典型用法代码示例。如果您正苦于以下问题:Python Component类的具体用法?Python Component怎么用?Python Component使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Component类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, dData):
Component.__init__(self, "BOX:%s"%(dData['componentID']), False, 1)
self._box = sf.RectangleShape((int(dData['width']),int(dData['height'])))
self._box.position = (int(dData['x']),int(dData['y']))
self._box.fill_color = sf.Color.WHITE
self._box.outline_color = sf.Color.RED
self._box.outline_thickness = 3.0
示例2: __init__
def __init__(self):
Component.__init__(self)
self.output = O()
self.x = 0
self.y = 0
self.width = 100
self.height = 100
示例3: __init__
def __init__(self, parent = None, longFormat = False):
Component.__init__(self, parent)
TextBase.__init__(self)
self.iPlatform = subsys.GetLatestInterface('IPlatform')
self.date = 2007, 1, 1
self.margin = (2, 2, 2, 2)
self.longFormat = longFormat
self.bind('Mouse Down', koan.action.PureAction(self.setFocus))
self.__datePicker = koan.platform.CreateDatePicker(callback = self.callback, longFormat = self.longFormat)
self.window._window.AttachChild2( self.__datePicker.GetHWND() )
#self.__datePicker.Show( False )
self.changeEvent('text', self.invoke, 'Value Change', self)
self.changeEvent('date', self.__onDateChange)
self.changeEvent('font', self.__onFontChanged, sync = False)
self.changeEvent('fontSize', self.__onFontChanged, sync = False)
#koan.anim.Execute(0.3, self.__datePicker.Show, True)
# font
self.bind('Visible Change', self.__onEditVisibleChange)
self.bind('Size Change', self.__updateEditWndPos)
self.bind('Position Change', self.__updateEditWndPos)
self.bind('Parent Position Change', self.__updateEditWndPos)
self.bind('Focus Change', self.__onEditVisibleChange)
child = self
while parent != None:
child.autoRemove(parent.bind('Parent Position Change', child.invoke, 'Parent Position Change', postevent = False))
child = parent
parent = child.parent
示例4: __init__
def __init__(self, parent):
Component.__init__(self, parent)
TextBase.__init__(self)
CheckBase.__init__(self)
TipBase.__init__(self)
self.command = ''
self.changeEvent('checked', self.__onCheckChanged, postevent = False)
示例5: __init__
def __init__(self, parent = None):
Component.__init__(self, parent)
TextBase.__init__(self)
self.vscroll = False
self.hscroll = False
self.maxlen = -1
self.bgColor = color.white
self.margin = (2, 2, 2, 2)
self.bind('Mouse Down', koan.action.PureAction(self.setFocus))
self.__edit = koan.platform.CreateEdit(callback = self.callback)
self.changeEvent('text', self.__onTextChanged, sync = False)
self.changeEvent('text', self.invoke, 'Value Change', self)
self.changeEvent('align', self.__onEditStyleChange)
self.changeEvent('vscroll', self.__onEditStyleChange)
self.changeEvent('hscroll', self.__onEditStyleChange)
self.changeEvent('maxlen', self.__onEditMaxlenChange, sync = False)
# font
self.changeEvent('font', self.__onFontChanged, sync = False)
self.changeEvent('fontSize', self.__onFontChanged, sync = False)
self.changeEvent('fontColor', self.__onFontColorChange, sync = False)
self.changeEvent('bgColor', self.__onBgColorChange, sync = False)
self.bind('Visible Change', self.__onEditVisibleChange)
self.bind('Size Change', self.__updateEditWndPos)
self.bind('Position Change', self.__updateEditWndPos)
self.bind('Parent Position Change', self.__updateEditWndPos)
self.bind('Focus Change', self.__onEditVisibleChange)
child = self
while parent != None:
child.autoRemove(parent.bind('Parent Position Change', child.invoke, 'Parent Position Change', postevent = False))
child = parent
parent = child.parent
示例6: __init__
def __init__(self, scheme = 'axisymmetric', **kwargs):
# Initialize scheme-dependent attributes
if scheme not in ['axisymmetric','two_column']:
raise ValueError,'\n \n ++++ CliMT.dynamics: Scheme %s unknown' % scheme
exec('self.__%s_dynamics__init__()' % string.lower(scheme))
# Initialize fields etc.
Component.__init__(self, **kwargs)
示例7: __init__
def __init__(self, dData): #sComponentID, textureGrid, fDelay, iFrameWidth, iFrameHeight, iFramesWide, iFramesHigh):
Component.__init__(self, "ANIMATION:%s"%(dData['componentID']), True, 2)
#This animation starts off as inactive and will await a trigger from a system function
self._bActive = False
#This will denote the time in-between each frame of the animation in the textureGrid.
self._fDelay = dData['delay']
#This will tell us when it is time to update the frame.
self._fAnim_Time = 0.0
#The current frame on the texture grid (top-left)
self._iCurrent_Frame = [0,0]
#The texture grid details
self._iFrame_Width = dData['frameWidth']
self._iFrame_Height = dData['frameHeight']
self._iFrames_Wide = dData['framesWide']
self._iFrames_High = dData['framesHigh']
#This holds the texture for the animation!
self._Animation_Sprite = sf.Sprite(dData['Texture'][0])
self._Animation_Sprite.set_texture_rect(sf.IntRect(0,0,self._iFrame_Width, self._iFrame_Height))
示例8: get_dash_dash_state_from_string
def get_dash_dash_state_from_string(self, state, state_str, state_id=None, loc_not_modifier=None):
"""
Complete Association or Intraprotein state from str.
Returns State object.
"""
comp = state_str.split('--')
compA_name = comp[0].split('_')[0]
compA_domain = self.df.get_association_domain_from_str(state_str, 'A')
compB_name = comp[1].split('_')[0]
compB_domain = self.df.get_association_domain_from_str(state_str, 'B')
if compB_name.startswith('['):
state.type = 'Intraprotein' # A_[a]--[b]
comp_object = Component(compA_name, compA_domain)
comp_object.second_domain = re.sub('[\[\]]', '', compB_name)
state.components = [comp_object]
else:
state.type = 'Association' # A--B
if state_id:
idA = state_id.split('--')[0]
idB = state_id.split('--')[1]
else:
idA = None
idB = None
compA_object = Component(compA_name, compA_domain, idA)
compB_object = Component(compB_name, compB_domain, idB)
state.components = [compA_object, compB_object]
if compA_name == compB_name:
state.homodimer = True
return state
示例9: __init__
def __init__(self):
Component.__init__(self)
self.tailNodes = []
self.previousHeadX = 1
self.previousHeadY = 1
self.tailIndex = 0
self.addNodeOnUpdate = False
示例10: __init__
def __init__(self, parent = None):
Component.__init__(self, parent)
self.vertical = False
# range
self.__valueStart = 0
self.__valueEnd = 1
# value
self.__value = 0
# snap
self.snap = 0
# thumb
self.thumb = Thumb(self)
self.bindData('gamma', self.thumb, 'gamma', dir = '->')
self._thumbStartAnim = koan.anim.AnimTarget('decay', 0, 0, 0, self)
self.thumbImage = ''
self.thumbEffect = None
#self.bindData('thumbImage', self.thumb, 'background')
self.autoDirty( ['thumbImage'] )
# drag / drop thumb
# self.changeEvent('snap', self.__updateValue)
self.autoRemove( self.thumb.bind('Capture Begin', self.onSlideStart) )
self.autoRemove( self.thumb.bind('Capture Offset', self.onSlideMove) )
self.autoRemove( self.thumb.bind('Capture End', self.onSlideStop) )
# click to
self.bind('Mouse Down', self.onSlideTo)
self.__updateThumbSize()
self.bind('Size Change', self.__updateThumbSize)
示例11: __init__
def __init__(self, scheme = 'hard', **kwargs):
# Initialize scheme-dependent attributes
try: exec('self.__%s__init__()' % string.lower(scheme))
except: raise ValueError,'\n \n ++++ CliMT.convection: Scheme "%s" unknown' % scheme
# Initialize fields etc.
Component.__init__(self, **kwargs)
示例12: __init__
def __init__(self, transfer_func, transfer_func_params, time_const_RC,
time_const_output, debug=False):
Component.__init__(self, transfer_func, transfer_func_params,
0, time_const_output, debug)
self.time_const_RC = time_const_RC
self.input_pre = 0
示例13: __init__
def __init__(self, scheme='slab', **kwargs):
# Initialize scheme-dependent attributes
if scheme == 'slab': self.__slab__init__()
else: raise ValueError,'\n \n ++++ CliMT.ocean: Scheme %s unknown' % scheme
# Initialize parameters, grid, fields etc
Component.__init__(self, **kwargs)
示例14: __init__
def __init__(self, parent=None):
Component.__init__(self, parent)
CaptureObject.__init__(self)
self.vertical = True
self.autoHide = False
self.setRange(100, 10)
self.changeEvent("autoHide", self.__fixVisible)
self.changeEvent("fullSize", self.__fixVisible)
self.changeEvent("viewSize", self.__fixVisible)
self.__offset = 0 # 0 ~ 1
self.thumbEffect = None
self.thumbMinSize = 50
self.thumbImage = ""
self.isMouseOverThumb = False
self.capture = False
self.autoDirty(["viewSize", "fullSize", "thumbImage"])
self.changeEvent("fullSize", self.__fixScroll)
self.changeEvent("viewSize", self.__fixScroll)
self.bind("Capture Begin", self.__onBeginScroll, postevent=False)
self.bind("Capture Offset", self.__onScroll, postevent=False)
self.bind("Capture End", self.__onEndScroll, postevent=False)
self.bind("Mouse Move", self.__onMouseMove)
self.bind("Mouse Leave", setattr, self, "isMouseOverThumb", False)
self.__thumbStartAnim = koan.anim.AnimTarget("decay", 0, 0, 0, self)
示例15: determineFitOffset
def determineFitOffset(components, full, shelled):
'''
This function will take a list of components and an object body,
and will then determine how far components must be set back from the surface
to prevent intersection with it.
'''
# figure out how far back we need to set each component to make it
# not intersect the body of the object.
for comp in components:
if comp['type'] in Component.no_offset():
continue
loc = comp['coords']
normal = comp['threed_normal']
ct = 0
print 'original:', loc
while True:
mod_comp = dict(comp)
mod_comp['coords'] = [c_i - n_i for c_i, n_i in zip(loc, normal)]
writeOpenSCAD(CHECK_INTERSECT_SCRIPT, [mod_comp], object_body=shelled)
empty = createsEmptySTL(CHECK_INTERSECT_SCRIPT, SCRATCH)
ct += 1
if empty:
break
if ct > Component.max_offset(mod_comp['type']):
raise Exception(''.join(["can't fit component",str(mod_comp),"into body"]))
loc = mod_comp['coords']
comp['coords'] = loc
comp['offset'] = ct # note that this is in units of mm, for button caps
print 'new:', loc
return components