def __init__(self, path=None, slice_left=0, slice_right=0, slice_top=0, slice_bottom=0, fill=False, **kwargs): Widget.__init__(self, fill=fill, **kwargs) #: path to the image file self.path = path self.image_data, self.image_w, self.image_h = None, None, None if path: self.image_data = cairo.ImageSurface.create_from_png(self.path) self.image_w, self.image_h = self.image_data.get_width( ), self.image_data.get_height() self.min_width, self.min_height = self.min_width or self.image_w, self.min_height or self.image_h #: pixels from left that should not be scaled upon image scale self.slice_left = slice_left #: pixels from right that should not be scaled upon image scale self.slice_right = slice_right #: pixels from top that should not be scaled upon image scale self.slice_top = slice_top #: pixels from bottom that should not be scaled upon image scale self.slice_bottom = slice_bottom self._slices = [] self._slice()
def __init__(self, value, label=None, **kwargs): Widget.__init__(self, **kwargs) #: value self.value = value #: label self.label = label
def __init__(self): self.__buffer = None self.__title = "" self.__info = "- no media loaded -" self.__cover = theme.mb_logo self.__prepared_file = None Component.__init__(self) Widget.__init__(self) self.connect_clicked(self.__on_click)
def __init__(self, rows=[], renderers=None, select_on_drag=False, spacing=0, row_height=None, **kwargs): Widget.__init__(self, **kwargs) self.interactive, self.can_focus = True, True self.mouse_cursor = False #: should an item be select upon drag motion. By default select happens #: only when clicking self.select_on_drag = select_on_drag #: the list of text strings available for selection self.rows = rows #: row height in pixels. if specified, will be using that instead of #: asking cell renderers. defaults to None. self.row_height = row_height self._search_string = "" self._search_timeout = None self._row_pos = None # cache of row positions self._hover_row = None #: currently selected item self.current_row = None if renderers is not None: self.renderers = renderers else: self.renderers = [renderer() for renderer in self.renderers] self.connect("on-mouse-move", self.__on_mouse_move) self.connect("on-mouse-down", self.__on_mouse_down) self.connect("on-mouse-out", self.__on_mouse_out) self.connect("on-mouse-scroll", self.on_mouse_scroll) self.connect("on-double-click", self.on_doubleclick) self.connect("on-key-press", self.__on_key_press) self.connect("on-render", self.__on_render)
def __init__(self, filename): Widget.__init__(self) self._filename = resources.realpath(filename) (self._texture, real_size) = self.load_texture(self._filename)
def __init__(self, width=1, **kwargs): Widget.__init__(self, **kwargs) self.width = width self.draggable = True
def __init__(self, contents=None, **kwargs): Widget.__init__(self, **kwargs) #: contents of the container - either a widget or a list of widgets self.contents = contents self._cached_w, self._cached_h = None, None
def __init__(self, editable=False, **kwargs): Widget.__init__(self, **kwargs) self.editable = editable self._target = None self._cell = None
def __init__(self, position=Vector3(0,0,0), size=Vector2i(1,1), *widgets): Container.__init__(self, children=widgets) Widget.__init__(self, position, size)
def __init__(self, icon, callback=None, *args, **kwargs): Widget.__init__(self, *args, **kwargs) self._icon = icon self._icon.pos = self.pos self._callback = callback or (lambda *args: None)
def __init__(self, spacing=None, **kwargs): Widget.__init__(self) if spacing: self.spacing = spacing self.menu = None
def __init__(self, columns, rows, *widgets): Container.__init__(self, children=widgets) Widget.__init__(self) self._cols = int(columns) self._rows = int(rows)