Package screenlets :: Class Screenlet

[hide private]
[frames] | no frames]

# Class Screenlet

source code

                 object --+
                          |
            gobject.GObject --+
                              |
    options.EditableOptions --+
                              |
            drawing.Drawing --+
                              |
                             Screenlet

A Screenlet is a (i.e. contains a) shaped gtk-window that is fully invisible by default. Subclasses of Screenlet can render their owner-drawn graphics on fully transparent background.

Version: 0.0

Author: Nenhum autor definido para este Screenlet

Instance Methods | [hide private]

__init__(self, id=`'````'`, width=100, height=100, parent_window=None, show_window=True, is_widget=False, is_sticky=False, uses_theme=True, draw_buttons=True, path=`'``/home/helder/sl112/screenlets``'`, drag_drop=False, session=None, enable_saving=True, service_class=<class 'screenlets.services.ScreenletService'>, uses_pango=False, is_sizable=True, resize_on_scroll=True, ask_on_option_override=False)
Constructor - should only be subclassed

source code

__setattr__(self, name, value) x.__setattr__('name', value) <==> x.name = value | source code

add_default_menuitems(self, flags=507) Appends the default menu-items to self.menu. | source code

add_menuitem(self, id, label, callback=None) Simple way to add menuitems to a right-click menu. | source code

add_submenuitem(self, id, label, lst, callback=None) Simple way to add submenuitems to the right-click menu through a list. | source code

load_buttons(self, event) | source code

create_buttons(self) | source code

clear_cairo_context(self, ctx) Fills the given cairo.Context with fully transparent white. | source code

close(self) Close this Screenlet TODO: send close-notify instead of destroying window? | source code

create_drag_icon(self) Create drag-icon and -mask for drag-operation. | source code

enable_saving(self, enabled=True) Enable/Disable realtime-saving of options. | source code

find_theme(self, name) Find the first occurence of a theme and return its global path. | source code

get_short_name(self) Return the short name of this screenlet. | source code

get_screenlet_dir(self) Return the name of this screenlet's personal directory. | source code

get_theme_dir(self) Return the name of this screenlet's personal theme-dir. | source code

get_available_themes(self) Returns a list with the names of all available themes in this Screenlet's theme-directory. | source code

reshow(self) | source code

finish_loading(self) Called when screenlet finishes loading | source code

hide(self) Hides this Screenlet's underlying gtk.Window | source code

load_theme(self, path) Load a theme for this Screenlet from the given path. | source code

main(self) If the Screenlet runs as stand-alone app, starts gtk.main() | source code

register_service(self, service_classobj) Register or create the given ScreenletService-(sub)class as the new service for this Screenlet. | source code

set_is_widget(self, value) Set this window to be treated as a Widget (only supported by compiz using the widget-plugin yet) | source code

show(self) Show this Screenlet's underlying gtk.Window | source code

show_settings_dialog(self) Show the EditableSettingsDialog for this Screenlet. | source code

redraw_canvas(self) Redraw the entire Screenlet's window area. | source code

redraw_canvas_area(self, x, y, width, height) Redraw the given Rectangle (x, y, width, height) within the current Screenlet's window. | source code

remove_shape(self) Removed shaped window , in case the nom composited shape has been set | source code

update_shape(self) Update window shape (only call this when shape has changed because it is very ressource intense if ran too often). | source code

update_shape_non_composited(self) TEST: This function is intended to shape the window whenever no composited environment can be found. | source code

on_delete(self) Called when the Screenlet gets deleted. | source code

on_after_set_atribute(self, name, value) Called after setting screenlet atributes | source code

on_before_set_atribute(self, name, value) Called before setting screenlet atributes | source code

on_create_drag_icon(self) Called when the screenlet's drag-icon is created. | source code

on_map(self) Called when screenlet was mapped | source code

on_unmap(self) Called when screenlet was unmapped | source code

on_composite_changed(self) Called when composite state has changed | source code

on_drag_begin(self, drag_context) Called when the Screenlet gets dragged. | source code

on_drag_enter(self, drag_context, x, y, timestamp) Called when something gets dragged into the Screenlets area. | source code

on_drag_leave(self, drag_context, timestamp) Called when something gets dragged out of the Screenlets area. | source code

on_draw(self, ctx) Callback for drawing the Screenlet's window - override in subclasses to implement your own drawing. | source code

on_draw_shape(self, ctx) Callback for drawing the Screenlet's shape - override in subclasses to draw the window's input-shape-mask. | source code

on_drop(self, x, y, sel_data, timestamp) Called when a selection is dropped on this Screenlet. | source code

on_focus(self, event) Called when the Screenlet's window receives focus. | source code

on_hide(self) Called when the Screenlet gets hidden. | source code

on_init(self) Called when the Screenlet's options have been applied and the screenlet finished its initialization. | source code

on_key_down(self, keycode, keyvalue, event=None) Called when a key is pressed within the screenlet's window. | source code

on_load_theme(self) Called when the theme is reloaded (after loading, before redraw). | source code

on_menuitem_select(self, id) Called when a menuitem is selected. | source code

on_mouse_down(self, event) Called when a buttonpress-event occured in Screenlet's window. | source code

on_mouse_enter(self, event) Called when the mouse enters the Screenlet's window. | source code

on_mouse_leave(self, event) Called when the mouse leaves the Screenlet's window. | source code

on_mouse_move(self, event) Called when the mouse moves in the Screenlet's window. | source code

on_mouse_up(self, event) Called when a buttonrelease-event occured in Screenlet's window. | source code

on_quit(self) Callback for handling destroy-event. | source code

on_realize(self) "Callback for handling the realize-event. | source code

on_scale(self) Called when Screenlet.scale is changed. | source code

on_scroll_up(self) Called when mousewheel is scrolled up (button4). | source code

on_scroll_down(self) Called when mousewheel is scrolled down (button5). | source code

on_show(self) Called when the Screenlet gets shown after being hidden. | source code

on_switch_widget_state(self, state) Called when the Screenlet enters/leaves "Widget"-state. | source code

on_unfocus(self, event) Called when the Screenlet's window loses focus. | source code

on_update_shape(self) Called when the Screenlet's window is updating shape | source code

alpha_screen_changed(self, window, screen=None) set colormap for window | source code

button_press(self, widget, event) | source code

button_release(self, widget, event) | source code

composite_changed(self, widget) | source code

configure_event(self, widget, event) | source code

delete_event(self, widget, event, data=None) | source code

destroy(self, widget, data=None) | source code

drag_begin(self, widget, drag_context) | source code

drag_data_received(self, widget, dc, x, y, sel_data, info, timestamp) | source code

drag_end(self, widget, drag_context) | source code

drag_motion(self, widget, drag_context, x, y, timestamp) | source code

drag_leave(self, widget, drag_context, timestamp) | source code

enter_notify_event(self, widget, event) | source code

expose(self, widget, event) | source code

focus_in_event(self, widget, event) | source code

focus_out_event(self, widget, event) | source code

key_press(self, widget, event) Handle keypress events, needed for in-place editing. | source code

leave_notify_event(self, widget, event) | source code

menuitem_callback(self, widget, id) | source code

map_event(self, widget, event) | source code

unmap_event(self, widget, event) | source code

motion_notify_event(self, widget, event) | source code

realize_event(self, widget) called when window has been realized | source code

scroll_event(self, widget, event) | source code

show_notification(self, text) Show notification window at current mouse position. | source code

hide_notification(self) hide notification window | source code

show_tooltip(self, text, tooltipx, tooltipy) Show tooltip window at current mouse position. | source code

hide_tooltip(self) hide tooltip window | source code

Inherited from `gobject.GObject`: `__cmp__`, `__delattr__`, `__gdoc__`, `__gobject_init__`, `__hash__`, `__new__`, `__repr__`, `chain`, `connect`, `connect_after`, `connect_object`, `connect_object_after`, `disconnect`, `disconnect_by_func`, `emit`, `emit_stop_by_name`, `freeze_notify`, `get_data`, `get_properties`, `get_property`, `handler_block`, `handler_block_by_func`, `handler_disconnect`, `handler_is_connected`, `handler_unblock`, `handler_unblock_by_func`, `props`, `set_data`, `set_properties`, `set_property`, `stop_emission`, `thaw_notify`, `weak_ref`

Inherited from `object`: `__getattribute__`, `__reduce__`, `__reduce_ex__`, `__str__`

Inherited from `options.EditableOptions`: `add_option`, `add_options_from_file`, `add_options_group`, `disable_option`, `export_options_as_list`, `get_option_by_name`, `remove_option`

Inherited from `drawing.Drawing`: `check_for_icon`, `draw_circle`, `draw_icon`, `draw_image`, `draw_line`, `draw_quadrant_shadow`, `draw_rectangle`, `draw_rectangle_advanced`, `draw_rounded_rectangle`, `draw_scaled_image`, `draw_shadow`, `draw_side_shadow`, `draw_text`, `draw_triangle`, `get_image_size`, `get_text_line`, `get_text_line_count`, `get_text_width`

Class Variables | [hide private]

| __name__ = ``'``Nenhum conjunto nome para este Screenlet``'``
| __desc__ = ``'``Nenhumas informa\xc3\xa7\xc3\xb5es definidas para` `...``
| __requires__ = ``[``]``
| id = ``'````'``
| window = `None`
| theme = `None`
| uses_theme = `True`
| draw_buttons = `True`
| show_buttons = `True`
| menu = `None`
| is_dragged = `False`
| quit_on_close = `True`
| saving_enabled = `True`
| dragging_over = `False`
| disable_updates = `False`
| p_context = `None`
| x = `0`
| y = `0`
| mousex = `0`
| mousey = `0`
| mouse_is_over = `False`
| width = `100`
| height = `100`
| scale = `1.0`
| opacity = `1.0`
| theme_name = ``'````'``
| is_visible = `True`
| is_sticky = `False`
| is_widget = `False`
| keep_above = `True`
| keep_below = `False`
| skip_pager = `True`
| first_run = `False`
| skip_taskbar = `True`
| lock_position = `False`
| allow_option_override = `True`
| ask_on_option_override = `True`
| resize_on_scroll = `True`
| has_started = `False`
| has_focus = `False`
| gtk_icon_theme = `None`
| __lastx = `0`
| __lasty = `0`
| p_fdesc = `None`
| p_layout = `None`
| tooltip = `None`
| notify = `None`
| __mi_keep_above = `None`
| __mi_keep_below = `None`
| __mi_widget = `None`
| __mi_sticky = `None`
| __mi_lock = `None`
| __gsignals__ = `dict(screenlet_removed= (gobject.SIGNAL_RUN_FIR`...``
| __gtype__ = `<GType screenlets+Screenlet (140285104)>`

Properties | [hide private]

Inherited from `gobject.GObject`: `__grefcount__` Inherited from `object`: `__class__`

Method Details | [hide private]

### __init__(self, id=`'````'`, width=100, height=100, parent_window=None, show_window=True, is_widget=False, is_sticky=False, uses_theme=True, draw_buttons=True, path=`'``/home/helder/sl112/screenlets``'`, drag_drop=False, session=None, enable_saving=True, service_class=<class 'screenlets.services.ScreenletService'>, uses_pango=False, is_sizable=True, resize_on_scroll=True, ask_on_option_override=False)
(Constructor)

source code

Constructor - should only be subclassed

Overrides: gobject.GObject.__init__

### __setattr__(self, name, value)

source code

x.__setattr__('name', value) <==> x.name = value

Overrides: gobject.GObject.__setattr__
  (inherited documentation)

### add_default_menuitems(self, flags=507)

source code

Appends the default menu-items to self.menu. You can add on OR'ed flag with DefaultMenuItems you want to add.

### add_menuitem(self, id, label, callback=None)

source code

Simple way to add menuitems to a right-click menu. This function wraps screenlets.menu.add_menuitem. For backwards compatibility, the order of the parameters to this function is switched.

### create_drag_icon(self)

source code

Create drag-icon and -mask for drag-operation. Returns a 2-tuple with the icon and the mask. To supply your own icon you can use the on_create_drag_icon-handler and return the icon/mask as 2-tuple.

### get_short_name(self)

source code

Return the short name of this screenlet. This returns the classname of the screenlet without trailing "Screenlet". Please always use this function if you want to retrieve the short name of a Screenlet.

### get_theme_dir(self)

source code

Return the name of this screenlet's personal theme-dir. (Only returns the dir under the screenlet's location

### load_theme(self, path)

source code

Load a theme for this Screenlet from the given path. NOTE: load_theme does NOT call redraw_canvas and update_shape!!!!! To do all in one call, set the attribute self.theme_name instead.

### register_service(self, service_classobj)

source code

Register or create the given ScreenletService-(sub)class as the new service for this Screenlet. If self is not the first instance in the current session, the service from the first instance will be used instead and no new service is created.

### redraw_canvas(self)

source code

Redraw the entire Screenlet's window area. TODO: store window alloaction in class and change when size changes.

### update_shape_non_composited(self)

source code

TEST: This function is intended to shape the window whenever no composited environment can be found. (NOT WORKING YET!!!!)

### on_delete(self)

source code

Called when the Screenlet gets deleted. Return True to cancel. TODO: sometimes not properly called

### on_create_drag_icon(self)

source code

Called when the screenlet's drag-icon is created. You can supply your own icon and mask by returning them as a 2-tuple.

### on_init(self)

source code

Called when the Screenlet's options have been applied and the screenlet finished its initialization. If you want to have your Screenlet do things on startup you should use this handler.

### on_mouse_down(self, event)

source code

Called when a buttonpress-event occured in Screenlet's window. Returning True causes the event to be not further propagated.

### on_mouse_up(self, event)

source code

Called when a buttonrelease-event occured in Screenlet's window. Returning True causes the event to be not further propagated.

### on_quit(self)

source code

Callback for handling destroy-event. Perform your cleanup here!

Class Variable Details | [hide private]

### __desc__

Value:

      'Nenhumas informa\xc3\xa7\xc3\xb5es definidas para este Screenlet'

### __gsignals__

Value:

      dict(screenlet_removed= (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,
      (gobject.TYPE_OBJECT,)))