def display(self): glTranslatef(*self.pos) CairoWidget.display(self) glPushMatrix() self.get_active_child().display() glPopMatrix()
def __init__(self, position, size, bordersize=1, *args, **kwargs): if position is None: position = get_autopos(size) BaseWindow.__init__(self, **kwargs) CairoWidget.__init__(self, position, size, *args, **kwargs) self._bordersize = bordersize self._titlefont = self.create_font(size=9)
def __init__(self, position=Vector3(0, 0, 0), size=Vector2i(1, 1), tabs=[], **kwargs): for x in tabs: if not isinstance(x, Tab): raise ValueError, "TabView can only contain Tabs, not %s", type(x) self._children = [x.widget for x in tabs] self._titles = [x.title for x in tabs] Container.__init__(self, children=self._children) CairoWidget.__init__(self, position, size, **kwargs) self._font = self.create_font(size=9) self._selected = 0
def __init__(self, position=Vector3(0,0,0), size=Vector2i(1,1), tabs=[], **kwargs): for x in tabs: if not isinstance(x, Tab): raise ValueError, 'TabView can only contain Tabs, not %s', type(x) self._children = [x.widget for x in tabs] self._titles = [x.title for x in tabs] Container.__init__(self, children=self._children) CairoWidget.__init__(self, position, size, **kwargs) self._font = self.create_font(size=9) self._selected = 0
def do_render(self): cr = self.cr CairoWidget.clear(cr, (0,0,0,0)) self.render_decoration() p = [v * self.size for v in self.points] cr.set_source_rgba (0., 0.0, 0.0, 1.0); cr.move_to (p[0].x, p[0].y); cr.curve_to (p[1].x, p[1].y, p[2].x, p[2].y, p[3].x, p[3].y); cr.set_line_width (10.0); cr.stroke (); cr.set_source_rgba (1, 0.2, 0.2, 0.6); cr.set_line_width (6.0); cr.move_to (p[0].x, p[0].y); cr.line_to (p[1].x, p[1].y); cr.move_to (p[2].x, p[2].y); cr.line_to (p[3].x, p[3].y); cr.stroke ();
def render(self): CairoWidget.render(self) for x in self.get_children(): glPushMatrix() x.render() glPopMatrix()
def on_resize(self, size, *args, **kwargs): CairoWidget.on_resize(self, size, *args, **kwargs) childsize = Vector2i(size[0], size[1] - self.tab_bar_height) for widget in self.get_children(): widget.on_resize(childsize, *args, **kwargs)
def __init__(self, size, title, *args, **kwargs): CairoWidget.__init__(self, Vector2i(0,0 ), size, *args, **kwargs) self._title = title self._titlefont = self.create_font(size=9)
def __init__(self, info): CairoWidget.__init__(self, Vector2i(0,0), Vector2i(1,1)) info['Minable'] and 'Yes' or 'No' info['Cargo'] = ', '.join(['%s:%d' % (x['Type'],y) for x,y in info['Cargo']]) self._info = info self._font = self.create_font('Monospace')
def on_resize(self, size, *args, **kwargs): CairoWidget.on_resize(self, size, *args, **kwargs) childsize = Vector2i(size[0], size[1]-self.tab_bar_height) for widget in self.get_children(): widget.on_resize(childsize, *args, **kwargs)