trim EOL (end-of-line) spaces on source files
This commit is contained in:
+19
-19
@@ -50,7 +50,7 @@ import gtk
|
||||
import gobject
|
||||
import hippo
|
||||
import math
|
||||
|
||||
|
||||
from sugar.graphics import style
|
||||
from sugar.graphics.icon import Icon
|
||||
|
||||
@@ -111,24 +111,24 @@ class Alert(gtk.EventBox):
|
||||
self._msg_label.set_alignment(0, 0.5)
|
||||
self._msg_box.pack_start(self._msg_label, False)
|
||||
self._hbox.pack_start(self._msg_box, False)
|
||||
|
||||
|
||||
self._buttons_box = gtk.HButtonBox()
|
||||
self._buttons_box.set_layout(gtk.BUTTONBOX_END)
|
||||
self._buttons_box.set_spacing(style.DEFAULT_SPACING)
|
||||
self._hbox.pack_start(self._buttons_box)
|
||||
|
||||
|
||||
gobject.GObject.__init__(self, **kwargs)
|
||||
|
||||
self.set_visible_window(True)
|
||||
self.add(self._hbox)
|
||||
self.set_visible_window(True)
|
||||
self.add(self._hbox)
|
||||
self._title_label.show()
|
||||
self._msg_label.show()
|
||||
self._buttons_box.show()
|
||||
self._msg_box.show()
|
||||
self._hbox.show()
|
||||
self.show()
|
||||
|
||||
def do_set_property(self, pspec, value):
|
||||
|
||||
def do_set_property(self, pspec, value):
|
||||
"""
|
||||
Set alert property
|
||||
|
||||
@@ -299,21 +299,21 @@ class _TimeoutIcon(hippo.CanvasText, hippo.CanvasItem):
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
hippo.CanvasText.__init__(self, **kwargs)
|
||||
|
||||
|
||||
self.props.orientation = hippo.ORIENTATION_HORIZONTAL
|
||||
self.props.border_left = style.DEFAULT_SPACING
|
||||
self.props.border_right = style.DEFAULT_SPACING
|
||||
|
||||
|
||||
def do_paint_background(self, cr, damaged_box):
|
||||
[width, height] = self.get_allocation()
|
||||
|
||||
|
||||
xval = width * 0.5
|
||||
yval = height * 0.5
|
||||
radius = min(width * 0.5, height * 0.5)
|
||||
|
||||
radius = min(width * 0.5, height * 0.5)
|
||||
|
||||
hippo.cairo_set_source_rgba32(cr, self.props.background_color)
|
||||
cr.arc(xval, yval, radius, 0, 2*math.pi)
|
||||
cr.fill_preserve()
|
||||
cr.arc(xval, yval, radius, 0, 2*math.pi)
|
||||
cr.fill_preserve()
|
||||
|
||||
|
||||
class TimeoutAlert(Alert):
|
||||
@@ -362,22 +362,22 @@ class TimeoutAlert(Alert):
|
||||
Alert.__init__(self, **kwargs)
|
||||
|
||||
self._timeout = timeout
|
||||
|
||||
|
||||
icon = Icon(icon_name='dialog-cancel')
|
||||
self.add_button(gtk.RESPONSE_CANCEL, _('Cancel'), icon)
|
||||
icon.show()
|
||||
|
||||
|
||||
self._timeout_text = _TimeoutIcon(
|
||||
text=self._timeout,
|
||||
color=style.COLOR_BUTTON_GREY.get_int(),
|
||||
background_color=style.COLOR_WHITE.get_int())
|
||||
background_color=style.COLOR_WHITE.get_int())
|
||||
canvas = hippo.Canvas()
|
||||
canvas.set_root(self._timeout_text)
|
||||
canvas.show()
|
||||
canvas.show()
|
||||
self.add_button(gtk.RESPONSE_OK, _('Continue'), canvas)
|
||||
|
||||
gobject.timeout_add_seconds(1, self.__timeout)
|
||||
|
||||
|
||||
def __timeout(self):
|
||||
self._timeout -= 1
|
||||
self._timeout_text.props.text = self._timeout
|
||||
|
||||
@@ -31,7 +31,7 @@ class Animator(gobject.GObject):
|
||||
'completed': (gobject.SIGNAL_RUN_FIRST,
|
||||
gobject.TYPE_NONE, ([])),
|
||||
}
|
||||
|
||||
|
||||
def __init__(self, duration, fps=20, easing=EASE_OUT_EXPO):
|
||||
gobject.GObject.__init__(self)
|
||||
self._animations = []
|
||||
|
||||
@@ -29,11 +29,11 @@ class CanvasTextView(hippo.CanvasWidget):
|
||||
self.text_view_widget.props.right_margin = style.DEFAULT_SPACING
|
||||
self.text_view_widget.props.wrap_mode = gtk.WRAP_WORD
|
||||
self.text_view_widget.show()
|
||||
|
||||
|
||||
# TODO: These fields should expand vertically instead of scrolling
|
||||
scrolled_window = gtk.ScrolledWindow()
|
||||
scrolled_window.set_shadow_type(gtk.SHADOW_OUT)
|
||||
scrolled_window.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
|
||||
scrolled_window.add(self.text_view_widget)
|
||||
|
||||
|
||||
self.props.widget = scrolled_window
|
||||
|
||||
@@ -29,7 +29,7 @@ from sugar.graphics.palette import Palette, ToolInvoker, WidgetInvoker
|
||||
_ = lambda msg: gettext.dgettext('sugar-toolkit', msg)
|
||||
|
||||
def get_svg_color_string(color):
|
||||
return '#%.2X%.2X%.2X' % (color.red / 257, color.green / 257,
|
||||
return '#%.2X%.2X%.2X' % (color.red / 257, color.green / 257,
|
||||
color.blue / 257)
|
||||
|
||||
class _ColorButton(gtk.Button):
|
||||
@@ -40,11 +40,11 @@ class _ColorButton(gtk.Button):
|
||||
As a preview an sugar.graphics.Icon is used. The fill color will be set to
|
||||
the current color, and the stroke color is set to the font color.
|
||||
"""
|
||||
|
||||
|
||||
__gtype_name__ = 'SugarColorButton'
|
||||
__gsignals__ = { 'color-set' : (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,
|
||||
tuple())}
|
||||
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
self._title = _('Choose a color')
|
||||
self._color = gtk.gdk.Color(0, 0, 0)
|
||||
@@ -92,10 +92,10 @@ class _ColorButton(gtk.Button):
|
||||
|
||||
def __palette_color_set_cb(self, palette):
|
||||
self.emit('color-set')
|
||||
|
||||
|
||||
def __palette_color_changed(self, palette, pspec):
|
||||
self.color = self._palette.color
|
||||
|
||||
|
||||
def do_style_set(self, previous_style):
|
||||
self._preview.stroke_color = \
|
||||
get_svg_color_string(self.style.fg[gtk.STATE_NORMAL])
|
||||
@@ -111,12 +111,12 @@ class _ColorButton(gtk.Button):
|
||||
|
||||
def set_color(self, color):
|
||||
assert isinstance(color, gtk.gdk.Color)
|
||||
|
||||
|
||||
if self._color.red == color.red and \
|
||||
self._color.green == color.green and \
|
||||
self._color.blue == color.blue:
|
||||
return
|
||||
|
||||
|
||||
self._color = gtk.gdk.Color(color.red, color.green, color.blue)
|
||||
self._preview.fill_color = get_svg_color_string(self._color)
|
||||
if self._palette:
|
||||
@@ -201,9 +201,9 @@ class _ColorButton(gtk.Button):
|
||||
red = self._color.red / 257
|
||||
green = self._color.green / 257
|
||||
blue = self._color.blue / 257
|
||||
|
||||
|
||||
pixbuf.fill(red << 24 + green << 16 + blue << 8 + 0xff)
|
||||
|
||||
|
||||
context.set_icon_pixbuf(pixbuf)
|
||||
|
||||
def __drag_data_get_cb(self, widget, context, selection_data, info, time):
|
||||
@@ -258,7 +258,7 @@ class _ColorPalette(Palette):
|
||||
self._picker_hbox.pack_start(self._swatch_tray)
|
||||
self._picker_hbox.pack_start(gtk.VSeparator(),
|
||||
padding=style.DEFAULT_SPACING)
|
||||
|
||||
|
||||
self._chooser_table = gtk.Table(3, 2)
|
||||
self._chooser_table.set_col_spacing(0, style.DEFAULT_PADDING)
|
||||
|
||||
@@ -271,7 +271,7 @@ class _ColorPalette(Palette):
|
||||
self._create_color_scale(_('Blue'), self._BLUE, 2))
|
||||
|
||||
self._picker_hbox.add(self._chooser_table)
|
||||
|
||||
|
||||
self._picker_hbox.show_all()
|
||||
|
||||
self._build_swatches()
|
||||
@@ -300,7 +300,7 @@ class _ColorPalette(Palette):
|
||||
|
||||
return scale
|
||||
|
||||
|
||||
|
||||
|
||||
def _build_swatches(self):
|
||||
for child in self._swatch_tray.get_children():
|
||||
@@ -370,12 +370,12 @@ class _ColorPalette(Palette):
|
||||
return
|
||||
|
||||
self._color = color.copy()
|
||||
|
||||
|
||||
if self._scales:
|
||||
self._scales[self._RED].set_value(self._color.red / 65535.0)
|
||||
self._scales[self._GREEN].set_value(self._color.green / 65535.0)
|
||||
self._scales[self._BLUE].set_value(self._color.blue / 65535.0)
|
||||
|
||||
|
||||
self.notify('color')
|
||||
|
||||
def get_color(self):
|
||||
|
||||
@@ -23,7 +23,7 @@ import gobject
|
||||
import gtk
|
||||
|
||||
class ComboBox(gtk.ComboBox):
|
||||
__gtype_name__ = 'SugarComboBox'
|
||||
__gtype_name__ = 'SugarComboBox'
|
||||
|
||||
def __init__(self):
|
||||
gtk.ComboBox.__init__(self)
|
||||
@@ -129,7 +129,7 @@ class ComboBox(gtk.ComboBox):
|
||||
None
|
||||
|
||||
"""
|
||||
self._model.append([0, None, None, True])
|
||||
self._model.append([0, None, None, True])
|
||||
|
||||
def get_active_item(self):
|
||||
"""
|
||||
|
||||
@@ -337,10 +337,10 @@ class Icon(gtk.Image):
|
||||
if self._buffer.file_name != self.props.file:
|
||||
self._buffer.file_name = self.props.file
|
||||
|
||||
if self.props.pixel_size == -1:
|
||||
if self.props.pixel_size == -1:
|
||||
width, height = gtk.icon_size_lookup(self.props.icon_size)
|
||||
else:
|
||||
width = height = self.props.pixel_size
|
||||
width = height = self.props.pixel_size
|
||||
if self._buffer.width != width or self._buffer.height != height:
|
||||
self._buffer.width = width
|
||||
self._buffer.height = height
|
||||
@@ -917,7 +917,7 @@ class CanvasIcon(hippo.CanvasBox, hippo.CanvasItem):
|
||||
|
||||
def get_palette_invoker(self):
|
||||
return self._palette_invoker
|
||||
|
||||
|
||||
def set_palette_invoker(self, palette_invoker):
|
||||
self._palette_invoker.detach()
|
||||
self._palette_invoker = palette_invoker
|
||||
@@ -929,7 +929,7 @@ class CanvasIcon(hippo.CanvasBox, hippo.CanvasItem):
|
||||
from sugar.graphics.palette import Palette
|
||||
|
||||
self.set_palette(Palette(text))
|
||||
|
||||
|
||||
palette = property(get_palette, set_palette)
|
||||
|
||||
class CellRendererIcon(gtk.GenericCellRenderer):
|
||||
@@ -1019,7 +1019,7 @@ class CellRendererIcon(gtk.GenericCellRenderer):
|
||||
if self._buffer.background_color != value:
|
||||
self._buffer.background_color = value
|
||||
|
||||
background_color = gobject.property(type=object,
|
||||
background_color = gobject.property(type=object,
|
||||
setter=set_background_color)
|
||||
|
||||
def set_size(self, value):
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
"""Notebook class
|
||||
|
||||
This class create a gtk.Notebook() widget supporting
|
||||
This class create a gtk.Notebook() widget supporting
|
||||
a close button in every tab when the 'can-close-tabs' gproperty
|
||||
is enabled (True)
|
||||
|
||||
@@ -38,11 +38,11 @@ class Notebook(gtk.Notebook):
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
# Initialise the Widget
|
||||
#
|
||||
# Side effects:
|
||||
|
||||
# Side effects:
|
||||
# Set the 'can-close-tabs' property using **kwargs
|
||||
# Set True the scrollable notebook property
|
||||
|
||||
|
||||
gobject.GObject.__init__(self, **kwargs)
|
||||
|
||||
self._can_close_tabs = None
|
||||
@@ -108,7 +108,7 @@ class Notebook(gtk.Notebook):
|
||||
|
||||
tab_box.show_all()
|
||||
event_box.add(tab_box)
|
||||
|
||||
|
||||
return event_box
|
||||
|
||||
def add_page(self, text_label, widget):
|
||||
@@ -130,16 +130,16 @@ class Notebook(gtk.Notebook):
|
||||
# Add a new page to the notebook
|
||||
if self._can_close_tabs:
|
||||
eventbox = self._create_custom_tab(text_label, widget)
|
||||
self.append_page(widget, eventbox)
|
||||
self.append_page(widget, eventbox)
|
||||
else:
|
||||
self.append_page(widget, gtk.Label(text_label))
|
||||
|
||||
|
||||
pages = self.get_n_pages()
|
||||
|
||||
# Set the new page
|
||||
self.set_current_page(pages - 1)
|
||||
self.show_all()
|
||||
|
||||
|
||||
return True
|
||||
|
||||
def _close_page(self, button, child):
|
||||
|
||||
@@ -56,7 +56,7 @@ class ObjectChooser(object):
|
||||
self._chooser_id = None
|
||||
self._response_code = gtk.RESPONSE_NONE
|
||||
self._what_filter = what_filter
|
||||
|
||||
|
||||
def run(self):
|
||||
self._object_id = None
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ class Palette(PaletteWindow):
|
||||
|
||||
__gtype_name__ = 'SugarPalette'
|
||||
|
||||
# DEPRECATED: label is passed with the primary-text property, accel_path
|
||||
# DEPRECATED: label is passed with the primary-text property, accel_path
|
||||
# is set via the invoker property, and menu_after_content is not used
|
||||
def __init__(self, label=None, accel_path=None, menu_after_content=False,
|
||||
text_maxlen=60, **kwargs):
|
||||
@@ -67,9 +67,9 @@ class Palette(PaletteWindow):
|
||||
primary_box.pack_start(self._icon_box, expand=False)
|
||||
|
||||
labels_box = gtk.VBox()
|
||||
self._label_alignment = gtk.Alignment(xalign=0, yalign=0.5,
|
||||
self._label_alignment = gtk.Alignment(xalign=0, yalign=0.5,
|
||||
xscale=1, yscale=0.33)
|
||||
self._label_alignment.set_padding(0, 0, style.DEFAULT_SPACING,
|
||||
self._label_alignment.set_padding(0, 0, style.DEFAULT_SPACING,
|
||||
style.DEFAULT_SPACING)
|
||||
self._label_alignment.add(labels_box)
|
||||
self._label_alignment.show()
|
||||
@@ -182,7 +182,7 @@ class Palette(PaletteWindow):
|
||||
|
||||
if self._invoker is not None:
|
||||
self._update_full_request()
|
||||
|
||||
|
||||
PaletteWindow.popup(self, immediate)
|
||||
|
||||
if state is None:
|
||||
@@ -194,7 +194,7 @@ class Palette(PaletteWindow):
|
||||
def on_enter(self, event):
|
||||
PaletteWindow.on_enter(self, event)
|
||||
self._secondary_anim.start()
|
||||
|
||||
|
||||
def _add_menu(self):
|
||||
self._menu_box = gtk.VBox()
|
||||
self._secondary_box.pack_start(self._menu_box)
|
||||
|
||||
@@ -76,7 +76,7 @@ class Group(gobject.GObject):
|
||||
|
||||
def popdown(self):
|
||||
for palette in self._palettes:
|
||||
if palette.is_up():
|
||||
if palette.is_up():
|
||||
palette.popdown(immediate=True)
|
||||
|
||||
def _palette_popup_cb(self, palette):
|
||||
|
||||
@@ -47,7 +47,7 @@ def _calculate_gap(a, b):
|
||||
gap_side = gtk.POS_TOP
|
||||
else:
|
||||
gap = False
|
||||
|
||||
|
||||
if gap:
|
||||
if gap_side == gtk.POS_BOTTOM or gap_side == gtk.POS_TOP:
|
||||
gap_start = min(a.width, max(0, b.x - a.x))
|
||||
@@ -181,7 +181,7 @@ class PaletteWindow(gtk.Window):
|
||||
self.set_group_id(None)
|
||||
|
||||
def set_invoker(self, invoker):
|
||||
for hid in self._invoker_hids[:]:
|
||||
for hid in self._invoker_hids[:]:
|
||||
self._invoker.disconnect(hid)
|
||||
self._invoker_hids.remove(hid)
|
||||
|
||||
@@ -212,7 +212,7 @@ class PaletteWindow(gtk.Window):
|
||||
immediate = False
|
||||
|
||||
if self.is_up():
|
||||
self._popdown_anim.stop()
|
||||
self._popdown_anim.stop()
|
||||
return
|
||||
|
||||
if self._group_id:
|
||||
@@ -629,7 +629,7 @@ class Invoker(gobject.GObject):
|
||||
|
||||
def get_palette(self):
|
||||
return self._palette
|
||||
|
||||
|
||||
def set_palette(self, palette):
|
||||
if self._palette:
|
||||
self._palette.props.invoker = None
|
||||
@@ -787,7 +787,7 @@ class CanvasInvoker(Invoker):
|
||||
return gtk.gdk.Rectangle(x, y, width, height)
|
||||
else:
|
||||
return gtk.gdk.Rectangle()
|
||||
|
||||
|
||||
def __motion_notify_event_cb(self, button, event):
|
||||
if event.detail == hippo.MOTION_DETAIL_ENTER:
|
||||
self.notify_mouse_enter()
|
||||
|
||||
@@ -154,7 +154,7 @@ class RadioToolButton(gtk.RadioToolButton):
|
||||
|
||||
def get_palette_invoker(self):
|
||||
return self._palette_invoker
|
||||
|
||||
|
||||
def set_palette_invoker(self, palette_invoker):
|
||||
self._palette_invoker.detach()
|
||||
self._palette_invoker = palette_invoker
|
||||
|
||||
@@ -35,13 +35,13 @@ class CanvasRoundBox(hippo.CanvasBox, hippo.CanvasItem):
|
||||
|
||||
# TODO: we should calculate radius depending on the height of the box.
|
||||
self._radius = style.zoom(10)
|
||||
|
||||
|
||||
self.props.orientation = hippo.ORIENTATION_HORIZONTAL
|
||||
self.props.border = self._BORDER_DEFAULT
|
||||
self.props.border_left = self._radius
|
||||
self.props.border_right = self._radius
|
||||
self.props.border_color = style.COLOR_BLACK.get_int()
|
||||
|
||||
|
||||
def do_paint_background(self, cr, damaged_box):
|
||||
[width, height] = self.get_allocation()
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ class ToggleToolButton(gtk.ToggleToolButton):
|
||||
|
||||
def get_palette_invoker(self):
|
||||
return self._palette_invoker
|
||||
|
||||
|
||||
def set_palette_invoker(self, palette_invoker):
|
||||
self._palette_invoker.detach()
|
||||
self._palette_invoker = palette_invoker
|
||||
@@ -69,7 +69,7 @@ class ToggleToolButton(gtk.ToggleToolButton):
|
||||
|
||||
def set_tooltip(self, text):
|
||||
self.set_palette(Palette(text))
|
||||
|
||||
|
||||
def do_expose_event(self, event):
|
||||
allocation = self.get_allocation()
|
||||
child = self.get_child()
|
||||
@@ -85,5 +85,5 @@ class ToggleToolButton(gtk.ToggleToolButton):
|
||||
allocation.width, allocation.height)
|
||||
|
||||
gtk.ToggleToolButton.do_expose_event(self, event)
|
||||
|
||||
|
||||
palette = property(get_palette, set_palette)
|
||||
|
||||
@@ -27,7 +27,7 @@ from sugar.graphics import palettegroup
|
||||
class ToolbarButton(ToolButton):
|
||||
def __init__(self, page=None, **kwargs):
|
||||
ToolButton.__init__(self, **kwargs)
|
||||
|
||||
|
||||
self.page_widget = None
|
||||
|
||||
self.set_page(page)
|
||||
|
||||
@@ -36,7 +36,7 @@ class Toolbox(gtk.VBox):
|
||||
|
||||
def __init__(self):
|
||||
gtk.VBox.__init__(self)
|
||||
|
||||
|
||||
self._notebook = gtk.Notebook()
|
||||
self._notebook.set_tab_pos(gtk.POS_BOTTOM)
|
||||
self._notebook.set_show_border(False)
|
||||
@@ -55,12 +55,12 @@ class Toolbox(gtk.VBox):
|
||||
border_bottom=style.LINE_WIDTH)
|
||||
self._separator.set_root(box)
|
||||
self.pack_start(self._separator, False)
|
||||
|
||||
|
||||
self._notebook.connect('notify::page', self._notify_page_cb)
|
||||
|
||||
def _notify_page_cb(self, notebook, pspec):
|
||||
self.emit('current-toolbar-changed', notebook.props.page)
|
||||
|
||||
|
||||
def add_toolbar(self, name, toolbar):
|
||||
label = gtk.Label(name)
|
||||
width, height_ = label.size_request()
|
||||
@@ -68,7 +68,7 @@ class Toolbox(gtk.VBox):
|
||||
label.set_alignment(0.0, 0.5)
|
||||
|
||||
event_box = gtk.EventBox()
|
||||
|
||||
|
||||
alignment = gtk.Alignment(0.0, 0.0, 1.0, 1.0)
|
||||
alignment.set_padding(0, 0, style.TOOLBOX_HORIZONTAL_PADDING,
|
||||
style.TOOLBOX_HORIZONTAL_PADDING)
|
||||
@@ -83,7 +83,7 @@ class Toolbox(gtk.VBox):
|
||||
if self._notebook.get_n_pages() > 1:
|
||||
self._notebook.set_show_tabs(True)
|
||||
self._separator.show()
|
||||
|
||||
|
||||
def remove_toolbar(self, index):
|
||||
self._notebook.remove_page(index)
|
||||
|
||||
@@ -96,6 +96,6 @@ class Toolbox(gtk.VBox):
|
||||
|
||||
def get_current_toolbar(self):
|
||||
return self._notebook.get_current_page()
|
||||
|
||||
|
||||
current_toolbar = property(get_current_toolbar, set_current_toolbar)
|
||||
|
||||
|
||||
@@ -128,7 +128,7 @@ class ToolButton(gtk.ToolButton):
|
||||
|
||||
def get_palette_invoker(self):
|
||||
return self._palette_invoker
|
||||
|
||||
|
||||
def set_palette_invoker(self, palette_invoker):
|
||||
self._palette_invoker.detach()
|
||||
self._palette_invoker = palette_invoker
|
||||
|
||||
@@ -64,7 +64,7 @@ class _TrayViewport(gtk.Viewport):
|
||||
adj = self.get_vadjustment()
|
||||
adj.connect('changed', self._adjustment_changed_cb)
|
||||
adj.connect('value-changed', self._adjustment_changed_cb)
|
||||
|
||||
|
||||
def scroll(self, direction):
|
||||
if direction == _PREVIOUS_PAGE:
|
||||
self._scroll_previous()
|
||||
@@ -447,7 +447,7 @@ class TrayIcon(gtk.ToolItem):
|
||||
|
||||
def get_palette_invoker(self):
|
||||
return self._palette_invoker
|
||||
|
||||
|
||||
def set_palette_invoker(self, palette_invoker):
|
||||
self._palette_invoker.detach()
|
||||
self._palette_invoker = palette_invoker
|
||||
|
||||
@@ -86,12 +86,12 @@ class Window(gtk.Window):
|
||||
self.connect('realize', self.__window_realize_cb)
|
||||
self.connect('window-state-event', self.__window_state_event_cb)
|
||||
self.connect('key-press-event', self.__key_press_cb)
|
||||
|
||||
|
||||
self._toolbar_box = None
|
||||
self._alerts = []
|
||||
self._canvas = None
|
||||
self.tray = None
|
||||
|
||||
|
||||
self._vbox = gtk.VBox()
|
||||
self._hbox = gtk.HBox()
|
||||
self._vbox.pack_start(self._hbox)
|
||||
@@ -100,7 +100,7 @@ class Window(gtk.Window):
|
||||
self._event_box = gtk.EventBox()
|
||||
self._hbox.pack_start(self._event_box)
|
||||
self._event_box.show()
|
||||
self._event_box.add_events(gtk.gdk.POINTER_MOTION_HINT_MASK
|
||||
self._event_box.add_events(gtk.gdk.POINTER_MOTION_HINT_MASK
|
||||
| gtk.gdk.POINTER_MOTION_MASK)
|
||||
self._event_box.connect('motion-notify-event', self.__motion_notify_cb)
|
||||
|
||||
@@ -120,7 +120,7 @@ class Window(gtk.Window):
|
||||
|
||||
if canvas:
|
||||
self._event_box.add(canvas)
|
||||
|
||||
|
||||
self._canvas = canvas
|
||||
|
||||
def get_canvas(self):
|
||||
@@ -144,16 +144,16 @@ class Window(gtk.Window):
|
||||
|
||||
def set_tray(self, tray, position):
|
||||
if self.tray:
|
||||
box = self.tray.get_parent()
|
||||
box = self.tray.get_parent()
|
||||
box.remove(self.tray)
|
||||
|
||||
|
||||
if position == gtk.POS_LEFT:
|
||||
self._hbox.pack_start(tray, False)
|
||||
elif position == gtk.POS_RIGHT:
|
||||
self._hbox.pack_end(tray, False)
|
||||
elif position == gtk.POS_BOTTOM:
|
||||
self._vbox.pack_end(tray, False)
|
||||
|
||||
|
||||
self.tray = tray
|
||||
|
||||
def add_alert(self, alert):
|
||||
@@ -162,14 +162,14 @@ class Window(gtk.Window):
|
||||
self._vbox.pack_start(alert, False)
|
||||
if self._toolbar_box is not None:
|
||||
self._vbox.reorder_child(alert, 1)
|
||||
else:
|
||||
else:
|
||||
self._vbox.reorder_child(alert, 0)
|
||||
|
||||
|
||||
def remove_alert(self, alert):
|
||||
if alert in self._alerts:
|
||||
self._alerts.remove(alert)
|
||||
# if the alert is the visible one on top of the queue
|
||||
if alert.get_parent() is not None:
|
||||
if alert.get_parent() is not None:
|
||||
self._vbox.remove(alert)
|
||||
if len(self._alerts) >= 1:
|
||||
self._vbox.pack_start(self._alerts[0], False)
|
||||
@@ -177,7 +177,7 @@ class Window(gtk.Window):
|
||||
self._vbox.reorder_child(self._alerts[0], 1)
|
||||
else:
|
||||
self._vbox.reorder_child(self._alert[0], 0)
|
||||
|
||||
|
||||
def __window_realize_cb(self, window):
|
||||
group = gtk.Window()
|
||||
group.realize()
|
||||
|
||||
Reference in New Issue
Block a user