def _set_record(self): for record_bar in self.get_list_obj_by_name(self._record_bar_name): new_pos = self.compute_record_begin() new_size = self.compute_record_end() - new_pos width = min(105 - new_pos, new_size) record_bar.move(left=int_to_percent(round(new_pos))) record_bar.resize(width=int_to_percent(round(width)))
def set_begin(self, time): self._Timebar__begin = time intleft = int((self._Timebar__begin - self._time_reference) * 100.0 / self._time_period + 50 + 0.5) intwidth = int(self._Timebar__duration * 100.0 / self._time_period + 0.5) if intleft + intwidth < 50: self._Timebar__width = int_to_percent(int(50 - intleft)) self._Timebar__left = int_to_percent(int((self._Timebar__begin - self._time_reference) * 100.0 / self._time_period + 50 + 0.5)) log_val('=============> time_bar class : set_begin (left) = %s' % self._Timebar__left)
def __init__(self): wyvas.Container.__init__(self) self._time_bar_name = None self._time_reference = 0 self._time_period = 3600 self._Timebar__duration = 0 self._Timebar__begin = 0 self._Timebar__width = int_to_percent(0) self._Timebar__left = int_to_percent(0) return None
def _create(self): style = self.style icon_size = style['icon_size'] icon_size_sel = style['selected_icon_size'] item_size = style['item_size'] item_size_sel = style['selected_item_size'] text_offset = style['text_offset'] text_offset_sel = style['selected_text_offset'] thumbnail_sel = Image() thumbnail_not_sel = Image() background_sel = Image() background_not_sel = Image() preserve_icon_size = style.get('preserve_icon_size', 0) preserve_icon_aspect = style.get('preserve_icon_aspect', 0) for img in (thumbnail_sel, thumbnail_not_sel, background_not_sel, background_sel): img.set_keep_real_size(preserve_icon_size) img.set_aspect(preserve_aspect=preserve_icon_aspect) thumbnail_not_sel.resize(width=item_size[0], height=item_size[1]) background_not_sel.resize(width=icon_size[0], height=icon_size[1]) thumbnail_sel.resize(width=item_size_sel[0], height=item_size_sel[1]) background_sel.resize(width=icon_size_sel[0], height=icon_size_sel[1]) text_not_sel = TextBlock() text_not_sel.set_color(color=style['text_color']) text_sel = TextBlock() text_sel.set_color(color=style['selected_text_color']) self.text_not_sel = text_not_sel self.text_sel = text_sel self.thumbnail_not_sel = thumbnail_not_sel self.thumbnail_sel = thumbnail_sel self.background_not_sel = background_not_sel self.background_sel = background_sel c = Container() c_sel = Container() tw, th = style['text_size'] iw, ih = style['icon_size'] itw, ith = style['item_size'] c.add_child(text_not_sel, name='text_not_sel', width=tw, height=th, vcenter=int_to_percent(50 + percent_to_int(text_offset[1])), hcenter=int_to_percent(50 + percent_to_int(text_offset[0])), layer=3) c.add_child(background_not_sel, name='background_not_sel', hcenter='50%', vcenter='50%', layer=1) c.add_child(thumbnail_not_sel, name='thumbnail_not_sel', hcenter='50%', vcenter='50%', layer=2) tw, th = style['selected_text_size'] iw, ih = style['selected_icon_size'] itw, ith = style['selected_item_size'] c_sel.add_child(text_sel, name='text_sel', width=tw, height=th, vcenter=int_to_percent(50 + percent_to_int(text_offset_sel[1])), hcenter=int_to_percent(50 + percent_to_int(text_offset_sel[0])), layer=3) c_sel.add_child(background_sel, name='background_sel', hcenter='50%', vcenter='50%', layer=1) c_sel.add_child(thumbnail_sel, name='thumbnail_sel', hcenter='50%', vcenter='50%', layer=2) return (c, c_sel)
def _redraw(self, delta=0): if not self.max: pass computed_pos = int_to_percent(min(100, (self.position - self.min) * 100.0 / (self.max - self.min))) log.info('Progressbar redraw (pos: %s, delta: %s)', self.position, delta) for bar in self.get_list_obj_by_name(self._bar_name): bar.resize(width=computed_pos) for indicator in self.get_list_obj_by_name(self._indicator_name): indicator.move(hcenter=computed_pos)
def add_to_percent(x, p): return int_to_percent(percent_to_int(p) + x) ]:
text_not_sel = TextBlock() text_not_sel.set_color(color=style['text_color']) text_sel = TextBlock() text_sel.set_color(color=style['selected_text_color']) self.text_not_sel = text_not_sel self.text_sel = text_sel self.thumbnail_not_sel = thumbnail_not_sel self.thumbnail_sel = thumbnail_sel self.background_not_sel = background_not_sel self.background_sel = background_sel c = Container() c_sel = Container() tw, th = style['text_size'] iw, ih = style['icon_size'] itw, ith = style['item_size'] c.add_child(text_not_sel, name='text_not_sel', width=tw, height=th, vcenter=int_to_percent(50 + percent_to_int(text_offset[1])), hcenter=int_to_percent(50 + percent_to_int(text_offset[0])), layer=3) c.add_child(background_not_sel, name='background_not_sel', hcenter='50%', vcenter='50%', layer=1) c.add_child(thumbnail_not_sel, name='thumbnail_not_sel', hcenter='50%', vcenter='50%', layer=2) tw, th = style['selected_text_size'] iw, ih = style['selected_icon_size'] itw, ith = style['selected_item_size'] c_sel.add_child(text_sel, name='text_sel', width=tw, height=th, vcenter=int_to_percent(50 + percent_to_int(text_offset_sel[1])), hcenter=int_to_percent(50 + percent_to_int(text_offset_sel[0])), layer=3) c_sel.add_child(background_sel, name='background_sel', hcenter='50%', vcenter='50%', layer=1) c_sel.add_child(thumbnail_sel, name='thumbnail_sel', hcenter='50%', vcenter='50%', layer=2) return (c, c_sel) ]: i: 0(AL), 198() o: nname: 198 n 198(None)[]:
def _redraw(self, delta=0): if not self.max: pass computed_pos = int_to_percent(min(100, (self.position - self.min) * 100.0 / (self.max - self.min)))
o: 134() nname: 111 n 111(None)[for bar in self.get_list_obj_by_name(self._bar_name): bar.resize(width=computed_pos) ]: i: 92(for) o: 133() nname: 92 n 92(None)[]: i: 18(loop) o: 111(for), 133(AF) nname: 18 n 18(None)[computed_pos = int_to_percent(min(100, (self.position - self.min) * 100.0 / (self.max - self.min))) log.info('Progressbar redraw (pos: %s, delta: %s)', self.position, delta) ]: i: 9(), 17() o: 92(loop), 134(AL) nname: 17 n 17(None)[]: i: 0(t) o: 18() nname: 9 n 9(None)[]: i: 0(f) o: 18()
def set_duration(self, duration=0): self._Timebar__duration = duration self._Timebar__width = int_to_percent(int(self._Timebar__duration * 100.0 / self._time_period + 0.5)) log_val('=============> time_bar class : set_duration (width) = %s' % self._Timebar__width)
self.nodes: {0: <unpyclib.structure.node instance at 0xb75e70ec>} nname: 0 n 0(None)[return log.info(*args) ]: i: o: self.nodes: {0: <unpyclib.structure.node instance at 0xb75e704c>} nname: 0 n 0(None)[wyvas.Container.__init__(self) self._time_bar_name = None self._time_reference = 0 self._time_period = 3600 self._Timebar__duration = 0 self._Timebar__begin = 0 self._Timebar__width = int_to_percent(0) self._Timebar__left = int_to_percent(0) return None ]: i: o: self.nodes: {0: <unpyclib.structure.node instance at 0xb75ede4c>} nname: 0 n 0(None)[self._time_reference = reference ]: i: o: self.nodes: {0: <unpyclib.structure.node instance at 0xb75ed6cc>} nname: 0
def _set_timeshift(self): for timeshift_bar in self.get_list_obj_by_name(self._timeshift_bar_name): new_pos = self.compute_timeshift_begin() new_size = self.compute_timeshift_end() - new_pos timeshift_bar.move(left=int_to_percent(new_pos)) timeshift_bar.resize(width=int_to_percent(new_size))
def _set_indicator(self): for indicator in self.get_list_obj_by_name(self._indicator_name): live_pos = self.compute_live_pos() indicator.move(hcenter=int_to_percent(live_pos))
def _set_bar(self): for bar in self.get_list_obj_by_name(self._bar_name): new_size = self.compute_bar_width() bar.resize(width=int_to_percent(new_size))
self.nodes: {0: <unpyclib.structure.node instance at 0xb775fa2c>} nname: 63 n 63(None)[]: i: 0(AL), 62() o: nname: 62 n 62(None)[]: i: 3(AF), 22() o: 63() nname: 22 n 22(None)[for bar in self.get_list_obj_by_name(self._bar_name): new_size = self.compute_bar_width() bar.resize(width=int_to_percent(new_size)) ]: i: 3(for) o: 62() nname: 3 n 3(None)[]: i: 0(loop) o: 22(for), 62(AF) nname: 0 n 0(None)[]: i: o: 3(loop), 63(AL) nname: 63