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)
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)
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>')
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)
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>')
def __init__ (self, txt, props={}): Box.__init__ (self) self.radio = Radio (props.copy()) self += self.radio self.text = Box ({'class': 'radio-text'}, RawHTML(txt)) self += self.text self.text.bind ('click', "$('#%s').attr('checked', true).trigger('change');" %(self.radio.id))
def __init__(self, canvas: Canvas, text: str = "", zoom: int = 1, border: int = 0, speed: int = 0): Box.__init__(self, canvas, (0, 6), (9, 8), zoom, border) self.__text = text self.__current_line = [] self.__speed = speed self.__line_finished = True
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 = []
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)
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)
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 = []
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)
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 = []
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()
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
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)
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
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
def __init__(self, name, url, props={}): Box.__init__(self) self.url = url self.name = name self.id = "downloader_%s" % (name) # Other GUI components self.progressbar = ProgressBar() self += self.progressbar # Register the uploader path self._url_local = "/downloader_%s_report" % (name) publish(self._url_local, DownloadReport, url=url) download = DownloadEntry_Factory(self.url)
def __init__(self, refreshable, _props={}): # Properties props = _props.copy() if 'class' in props: props['class'] += ' druid' else: props['class'] = 'druid' # Parent's constructor Box.__init__(self, props) # Widget assert isinstance(refreshable, RefreshableURL) self.refreshable = refreshable self += self.refreshable
def __init__ (self, refreshable, _props={}): # Properties props = _props.copy() if 'class' in props: props['class'] += ' druid' else: props['class'] = 'druid' # Parent's constructor Box.__init__ (self, props) # Widget assert isinstance (refreshable, RefreshableURL) self.refreshable = refreshable self += self.refreshable
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
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)
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)
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)
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)
def __init__(self, list=None): self.set_border() if list: if type(list[1]) is str: Box.__init__(self, [list[0]] + list[2:]) self.set_name(list[1]) else: Box.__init__(self, list) else: Box.__init__(self)
def __init__(self, x=0.0, y=0.0, w=0.0, h=0.0, padding=0.0, justify=solidfuel.constants.CENTER): Box.__init__(self, x, y, w, h) self.padding = padding self.justify = justify
def __init__(self, list=None): # Load defaults self.set_color() Box.__init__(self, list)
def __init__(self): Box.__init__(self) self.set_orientation(self.HORIZONTAL)
def __init__(self, list=None): Box.__init__(self, None) self.set_size([1.0, 1.0, 1.0]) if list is not None: self.set_instance(list[1])
def __init__ (self, **kwargs): Box.__init__ (self, {'class': "propstable"})
def __init__(self): Box.__init__(self) self.set_orientation(self.VERTICAL)
def __init__(self, **kwargs): Box.__init__(self, {'class': "propstable"})
def __init__(self, list=None): self.set_mode() self.set_flag() self.set_team() self.set_safety() Box.__init__(self, list)
def __init__(self,pos,size,colorbg,colorfg,font): self.font=font self.colorfg=colorfg Box.__init__(self,size,pos,colorbg)
def __init__(self): Box.__init__(self) url = druid_url_next(request.url) self += RawHTML(js=DruidContent__JS_to_goto(self.id, url))
def __init__ (self): Box.__init__ (self) url = druid_url_next (request.url) self += RawHTML (js = DruidContent__JS_to_goto (self.id, url))
def __init__(self, canvas: Canvas, zoom: int = 1, border: int = 0): Box.__init__(self, canvas, (5, 0), (9, 8), zoom, border) Box.__init__(self, canvas, (0, 1), (3, 3), zoom, border) self.__items = [POKEDEX, POKEMON, ITEM, PLAYER, SAVE, OPTION, EXIT] self.__shown_items = [False, False, True, True, True, True, True] self.__current = 0