本文整理匯總了Python中Box.Box.__init__方法的典型用法代碼示例。如果您正苦於以下問題:Python Box.__init__方法的具體用法?Python Box.__init__怎麽用?Python Box.__init__使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Box.Box
的用法示例。
在下文中一共展示了Box.__init__方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: from Box import Box [as 別名]
# 或者: from Box.Box import __init__ [as 別名]
def __init__ (self, key, options, _props={}):
Box.__init__ (self)
self.props = _props.copy()
self._options = options
if not 'id' in self.props:
self.id = 'RadioGroup_%s' %(self.uniq_id)
cfg_value = cfg.get_val (key)
for o in options:
val, desc = o
new_props = {}
new_props['name'] = key
new_props['value'] = val
# Initial value
if cfg_value != None and \
cfg_value == val:
new_props['checked'] = 1
elif 'checked' in self.props:
if self.props['checked'] == val:
new_props['checked'] = 1
self += RadioText (desc, new_props)
示例2: __init__
# 需要導入模塊: from Box import Box [as 別名]
# 或者: from Box.Box import __init__ [as 別名]
def __init__ (self, title, widget, comment, props_={}):
self.title = title
self.widget = widget
self.comment = comment
# Properties
props = props_.copy()
if 'id' in props:
self.id = props.pop('id')
if 'class' in props:
props['class'] += ' entry'
else:
props['class'] = 'entry'
# Constructor
Box.__init__ (self, props)
# Compose
self += Box ({'class': 'title'}, RawHTML(self.title))
if self.widget:
self += Box ({'class': 'widget'}, widget)
else:
self += Box ({'class': 'widget'}, Container())
if isinstance(comment, Widget):
self += Box ({'class': 'comment'}, comment)
else:
self += Box ({'class': 'comment'}, RawHTML(comment))
self += RawHTML('<div class="after"></div>')
示例3: __init__
# 需要導入模塊: from Box import Box [as 別名]
# 或者: from Box.Box import __init__ [as 別名]
def __init__(self,data=None,pos=None,size=None,fontsize=14,colorbg=COLORS['white'],colorfg=COLORS['tablelight']):
self.data=data
self.pos=pos
self.size=[-1,-1]
self.fontsize=fontsize
self.colorbg=colorbg
self.colorfg=colorfg
self.alpha=1000
self.updated=False
self.centeredx=False
self.centeredy=True
self.font=FONTS[self.fontsize]
if size==None:
self.size[0]=125
self.size[1]=int(5*self.fontsize*len(self.data)/4+len(self.data))
else:
if size[0]>0:
self.size[0]=size[0]
else:
self.size[0]=125
if size[1]>0:
self.size[1]=size[1]
else:
self.size[1]=int(5*self.fontsize*len(self.data)/4+len(self.data))
Box.__init__(self,self.size,pos,self.colorbg)
self.surf.set_alpha(self.alpha)
if data:
self.update(data)
示例4: __init__
# 需要導入模塊: from Box import Box [as 別名]
# 或者: from Box.Box import __init__ [as 別名]
def __init__ (self, _props={}):
# Properties
props = _props.copy()
if 'class' in props:
props['class'] += ' druid-button-panel'
else:
props['class'] = 'druid-button-panel'
# Parent's constructor
Box.__init__ (self, props)
self.buttons = []
示例5: __init__
# 需要導入模塊: from Box import Box [as 別名]
# 或者: from Box.Box import __init__ [as 別名]
def __init__(self,screen):
self.dx=45
self.dy=25
self.colorfg=COLORS['black']
self.font=FONTS[12]
screct=screen.get_rect()
self.maxrows=8
self.size=[self.dx*DECKDEFS.nseats,self.dy*self.maxrows]
self.pos=(screct.right-DECKDEFS.cardsize[0]-self.size[0]-10,screct.centery-90)
Box.__init__(self,self.size,self.pos,COLORS['white'])
self.visible=False
self.drawHeaders(screen)
示例6: __init__
# 需要導入模塊: from Box import Box [as 別名]
# 或者: from Box.Box import __init__ [as 別名]
def __init__(self, image):
Box.__init__(self)
Visible.__init__(self)
if issubclass(image.__class__, Image):
self.w = image.w
self.h = image.h
self.nativeW = image.nativeW
self.nativeH = image.nativeH
self._texture = image._texture
elif issubclass(image.__class__, pygame.Surface):
self._texture = None
Image.initFromSurface(self, image)
示例7: __init__
# 需要導入模塊: from Box import Box [as 別名]
# 或者: from Box.Box import __init__ [as 別名]
def __init__(self):
Box.__init__(self)
Visible.__init__(self)
self.fillColor = (0.0, 0.0, 0.0)
self.borderColor = (1.0, 1.0, 1.0)
self.borderWidth = 1.0
self.rotX = 0.0
self.rotY = 0.0
self.rotZ = 0.0
self.borderOpacity = 1.0
self.fillOpacity = 1.0
if Rectangle.fillDisplayList is None:
self._genDisplayLists()
示例8: __init__
# 需要導入模塊: from Box import Box [as 別名]
# 或者: from Box.Box import __init__ [as 別名]
def __init__ (self, props_={}):
props = props_.copy()
if 'class' in props:
props['class'] += " carousel"
else:
props['class'] = "carousel"
Box.__init__ (self, props.copy())
self.images = List ({'class': 'overview'})
self.pager = List ({'class': 'pager'})
self.controls = None
Box.__iadd__ (self, self.images)
示例9: __init__
# 需要導入模塊: from Box import Box [as 別名]
# 或者: from Box.Box import __init__ [as 別名]
def __init__ (self, _props={}):
# Properties
props = _props.copy()
if 'class' in props:
props['class'] += ' ui-dialog-buttonpane'
else:
props['class'] = 'ui-dialog-buttonpane'
props['class'] += ' ui-widget-content ui-helper-clearfix'
# Parent's constructor
Box.__init__ (self, props)
self.buttons = []
示例10: __init__
# 需要導入模塊: from Box import Box [as 別名]
# 或者: from Box.Box import __init__ [as 別名]
def __init__ (self, props={}):
Box.__init__ (self, {'class': 'star-rating'})
assert type(props) == dict
self.selected = props.get('selected', '5')
self.can_set = props.pop('can_set', False)
if 'style' in props:
props['style'] += ' display:none;'
else:
props['style'] = 'display:none;'
combo = Combobox (props.copy(), RATING_OPTIONS)
self += combo
示例11: __init__
# 需要導入模塊: from Box import Box [as 別名]
# 或者: from Box.Box import __init__ [as 別名]
def __init__ (self, url, props={}):
Box.__init__ (self)
self.url = url
self.id = "downloader_%d" %(self.uniq_id)
# Other GUI components
self.progressbar = ProgressBar()
self += self.progressbar
# Register the uploader path
self._url_local = "/downloader_%d_report" %(self.uniq_id)
publish (self._url_local, DownloadReport, url=url)
download = DownloadEntry_Factory (self.url)
示例12: __init__
# 需要導入模塊: from Box import Box [as 別名]
# 或者: from Box.Box import __init__ [as 別名]
def __init__ (self, results_num, page_num, items_per_page, total_pages, refreshable):
Box.__init__ (self, {'class': 'paginator-footer'})
# Get the base URL
url = refreshable.url
while url[-1] in string.digits+'/':
url = url[:-1]
# Reckon the range
extra = 0
if page_num + FOOTER_OPTIONS > total_pages:
extra += abs (total_pages - (page_num + FOOTER_OPTIONS))
if page_num - FOOTER_OPTIONS < 0:
extra += abs (page_num - (FOOTER_OPTIONS + 1))
chunk_raw = range(page_num - (FOOTER_OPTIONS + extra), page_num + FOOTER_OPTIONS + extra + 1)
chunk = filter (lambda x: x >= 0 and x < total_pages, chunk_raw)
# Render it
if page_num != 0:
url = '%s/%d' %(refreshable.url, page_num-1)
link = Link (None, RawHTML (_("Previous")), {'class': 'paginator-footer-prev'})
link.bind ('click', refreshable.JS_to_refresh(url=url))
self += link
indexes = Container()
for p in chunk:
if p == page_num:
indexes += RawHTML ("%d"%(p+1))
else:
url = '%s/%d' %(refreshable.url, p)
link = Link (None, RawHTML ("%d"%(p+1)), {'class': 'paginator-footer-page'})
link.bind ('click', refreshable.JS_to_refresh(url=url))
indexes += link
if chunk.index(p) < len(chunk)-1:
indexes += RawHTML (", ")
self += indexes
if page_num < total_pages-1:
url = '%s/%d' %(refreshable.url, page_num+1)
link = Link (None, RawHTML (_("Next")), {'class': 'paginator-footer-next'})
link.bind ('click', refreshable.JS_to_refresh(url=url))
self += link
示例13: __init__
# 需要導入模塊: from Box import Box [as 別名]
# 或者: from Box.Box import __init__ [as 別名]
def __init__ (self, host, req, props=None):
Box.__init__ (self)
self._url_local = '/proxy_widget_%d' %(self.uniq_id)
if props:
self.props = props
else:
self.props = {}
if host == None:
scgi = get_scgi()
host = scgi.env['HTTP_HOST']
self._async = self.props.pop('async', True)
self.id = 'proxy%d'%(self.uniq_id)
# Register the proxy path
publish (self._url_local, ProxyRequest, host=host, req=req)
示例14: __init__
# 需要導入模塊: from Box import Box [as 別名]
# 或者: from Box.Box import __init__ [as 別名]
def __init__ (self, props_={}):
props = props_.copy()
if 'class' in props:
props['class'] += " carousel"
else:
props['class'] = "carousel"
Box.__init__ (self, props.copy())
self.images = List ({'class': 'overview'})
self.pager = List ({'class': 'pager'})
Box.__iadd__ (self, self.images)
arrows = Box({'class':'arrows'})
arrows += Link (None, RawHTML("%s"%(_('left'))), {'class': "buttons prev"})
arrows += Link (None, RawHTML("%s"%(_('right'))), {'class': "buttons next"})
controls = Box({'class':'controls'})
controls += arrows
controls += self.pager
Box.__iadd__ (self, controls)
示例15: __init__
# 需要導入模塊: from Box import Box [as 別名]
# 或者: from Box.Box import __init__ [as 別名]
def __init__ (self, opener_widget, props={}, params=None, direct=True):
Box.__init__ (self)
self.id = 'ajax_upload_%d' %(self.uniq_id)
self._url_local = '/ajax_upload_%d' %(self.uniq_id)
self.props = props.copy()
self.opener_widget = opener_widget
handler = self.props.get('handler')
target_dir = self.props.get('target_dir')
# Widgets
msg = Box ({'class': 'msg'}, RawHTML(' '))
self += opener_widget
self += msg
# Register the uploader path
publish (self._url_local, UploadRequest,
handler=handler, target_dir=target_dir, params=params, direct=direct)