Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/lib/sugar
diff options
context:
space:
mode:
authorSimon Schampijer <simon@schampijer.de>2007-10-18 21:56:58 (GMT)
committer Simon Schampijer <simon@schampijer.de>2007-10-18 21:56:58 (GMT)
commit58f7dca355a53a9e8593d492c9807c75903c5f0d (patch)
treeaa6974fae3eacc74d0d364445388dee91c9b9bef /lib/sugar
parent5084ecf4f4c4fdefe7dd3d986e2aec399649e33d (diff)
Fullscreen support and tray support in activity window
Fullscreen mode hides toolbox and tray
Diffstat (limited to 'lib/sugar')
-rw-r--r--lib/sugar/graphics/window.py63
1 files changed, 49 insertions, 14 deletions
diff --git a/lib/sugar/graphics/window.py b/lib/sugar/graphics/window.py
index e6081fe..e55199f 100644
--- a/lib/sugar/graphics/window.py
+++ b/lib/sugar/graphics/window.py
@@ -16,60 +16,95 @@
# Boston, MA 02111-1307, USA.
import gtk
-import hippo
class Window(gtk.Window):
def __init__(self):
gtk.Window.__init__(self)
- self.connect('realize', self._window_realize_cb)
-
+ self.connect('realize', self.__window_realize_cb)
+ self.connect('window-state-event', self.__window_state_event_cb)
+
self.toolbox = None
self._alerts = []
- self.alert_position = -1
self.canvas = None
-
+ self.tray = None
+
self._vbox = gtk.VBox()
+ self._hbox = gtk.HBox()
+ self._vbox.pack_start(self._hbox)
+ self._hbox.show()
+
self.add(self._vbox)
self._vbox.show()
def set_canvas(self, canvas):
if self.canvas:
- self._vbox.remove(self.canvas)
+ self._hbox.remove(self.canvas)
- self._vbox.pack_start(canvas)
- self._vbox.reorder_child(canvas, -1)
+ self._hbox.pack_start(canvas)
self.canvas = canvas
def set_toolbox(self, toolbox):
if self.toolbox:
self._vbox.remove(self.toolbox)
-
+
self._vbox.pack_start(toolbox, False)
self._vbox.reorder_child(toolbox, 0)
self.toolbox = toolbox
+ def set_tray(self, tray, position):
+ if self.tray:
+ 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):
self._alerts.append(alert)
if len(self._alerts) == 1:
self._vbox.pack_start(alert, False)
- self._vbox.reorder_child(alert, self.alert_position)
-
+ if self.toolbox is not None:
+ self._vbox.reorder_child(alert, 1)
+ else:
+ self._vbox.reorder_child(alert, 0)
+
def remove_alert(self, alert):
if alert in self._alerts:
self._alerts.remove(alert)
self._vbox.remove(alert)
if len(self._alerts) >= 1:
self._vbox.pack_start(self._alerts[0], False)
- self._vbox.reorder_child(self._alerts[0], self.alert_position)
-
- def _window_realize_cb(self, window):
+ if self.toolbox is not None:
+ 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()
window.window.set_group(group.window)
+ def __window_state_event_cb(self, window, event):
+ if event.new_window_state & gtk.gdk.WINDOW_STATE_FULLSCREEN:
+ if self.toolbox is not None:
+ self.toolbox.hide()
+ if self.tray is not None:
+ self.tray.hide()
+ elif event.new_window_state == 0:
+ if self.toolbox is not None:
+ self.toolbox.show()
+ if self.tray is not None:
+ self.tray.show()
+
def get_canvas_screenshot(self):
if not self.canvas:
return None