This commit is contained in:
Dan Williams
2006-09-15 16:50:06 -04:00
54 changed files with 519 additions and 483 deletions
+2 -1
View File
@@ -6,5 +6,6 @@ sugar_dbus_config = '@prefix@/share/sugar/dbus-installed.conf'
sugar_python_path = ['@prefix@/share/sugar/shell',
'@prefix@/share/sugar/bindings',
'@prefix@/share/sugar/activities']
'@prefix@/share/sugar/activities',
'@prefix@/share/sugar/services']
sugar_bin_path = []
+2
View File
@@ -14,6 +14,8 @@ sugar_python_path = ['@prefix@/share/sugar/bindings']
sugar_python_path.append(sugar_source_dir)
sugar_python_path.append(os.path.join(sugar_source_dir, 'shell'))
sugar_python_path.append(os.path.join(sugar_source_dir, 'activities'))
sugar_python_path.append(os.path.join(sugar_source_dir, 'services'))
sugar_bin_path = []
sugar_bin_path.append(os.path.join(sugar_source_dir, 'shell'))
sugar_bin_path.append(os.path.join(sugar_source_dir, 'services/presence'))
+5 -1
View File
@@ -10,7 +10,11 @@ class Grid:
def convert_from_screen(self, x, y):
factor = Grid.COLS / gtk.gdk.screen_width()
return [int(x * factor), int(y * factor)]
grid_x = round(x * factor) - 1
grid_y = round(y * factor) - 1
return [grid_x, grid_y]
def set_constraints(self, component, x, y, width=-1, height=-1):
if isinstance(component, gtk.Window):
+4 -4
View File
@@ -4,7 +4,7 @@ from sugar.canvas import Colors
def _parse_string(color_string):
if color_string == 'white':
return ['#4f4f4f', 'white']
return ['white', '#4f4f4f']
splitted = color_string.split(',')
if len(splitted) == 2:
@@ -19,9 +19,9 @@ class IconColor:
def __init__(self, color_string=None):
if color_string == None or not is_valid(color_string):
n = int(random.random() * (len(Colors.colors) - 1))
[self._fill, self._stroke] = Colors.colors[n]
[self._stroke, self._fill] = Colors.colors[n]
else:
[self._fill, self._stroke] = _parse_string(color_string)
[self._stroke, self._fill] = _parse_string(color_string)
def get_stroke_color(self):
return self._stroke
@@ -30,5 +30,5 @@ class IconColor:
return self._fill
def to_string(self):
return '%s,%s' % (self._fill, self._stroke)
return '%s,%s' % (self._stroke, self._fill)
+19 -12
View File
@@ -195,7 +195,7 @@ class IconItem(goocanvas.ItemSimple, goocanvas.Item):
self.size = 24
self.color = None
self.icon_name = None
self._popdown_timeout = 0
self._popdown_sid = 0
goocanvas.ItemSimple.__init__(self, **kwargs)
@@ -240,29 +240,36 @@ class IconItem(goocanvas.ItemSimple, goocanvas.Item):
def _button_press_cb(self, view, target, event):
self.emit('clicked')
def _start_popup_timeout(self):
self._stop_popup_timeout()
self._popdown_timeout = gobject.timeout_add(1000, self._popdown)
def _start_popdown_timeout(self):
self._stop_popdown_timeout()
self._popdown_sid = gobject.timeout_add(1000, self._popdown_timeout_cb)
def _stop_popup_timeout(self):
if self._popdown_timeout > 0:
gobject.source_remove(self._popdown_timeout)
self._popdown_timeout = 0
def _stop_popdown_timeout(self):
if self._popdown_sid > 0:
gobject.source_remove(self._popdown_sid)
self._popdown_sid = 0
def _enter_notify_event_cb(self, view, target, event, canvas):
self._stop_popup_timeout()
self._stop_popdown_timeout()
[x1, y1] = canvas.convert_to_pixels(view.get_bounds().x1,
view.get_bounds().y1)
[x2, y2] = canvas.convert_to_pixels(view.get_bounds().x2,
view.get_bounds().y2)
[window_x, window_y] = canvas.window.get_origin()
x1 += window_x
y1 += window_y
x2 += window_x
y2 += window_y
self.emit('popup', int(x1), int(y1), int(x2), int(y2))
def _popdown(self):
self._popdown_timeout = 0
def _popdown_timeout_cb(self):
self._popdown_sid = 0
self.emit('popdown')
return False
def _leave_notify_event_cb(self, view, target, event):
self._start_popup_timeout()
self._start_popdown_timeout()
+2 -1
View File
@@ -43,7 +43,8 @@ def setup_system():
runner = os.path.join(sugar_source_dir, 'shell/sugar-activity-factory')
sugar.setup.setup_activities(source, sugar_activities_dir, runner)
bin = os.path.join(sugar_source_dir, 'shell/sugar-presence-service')
bin = os.path.join(sugar_source_dir,
'services/presence/sugar-presence-service')
sugar.setup.write_service('org.laptop.Presence', bin,
sugar_activities_dir)