sugar-toolkit-gtk3/shell/frame/Frame.py

69 lines
1.6 KiB
Python
Raw Normal View History

2006-08-23 11:52:18 +02:00
import gtk
import gobject
2006-09-07 15:11:51 +02:00
import goocanvas
2006-08-23 11:52:18 +02:00
2006-09-01 15:11:52 +02:00
from frame.BottomPanel import BottomPanel
2006-09-08 01:13:42 +02:00
from frame.RightPanel import RightPanel
2006-09-08 00:51:45 +02:00
from frame.TopPanel import TopPanel
2006-09-07 15:11:51 +02:00
from frame.PanelWindow import PanelWindow
from sugar.canvas.Grid import Grid
2006-08-23 11:52:18 +02:00
2006-09-01 15:11:52 +02:00
class Frame:
def __init__(self, shell, owner):
2006-09-07 15:11:51 +02:00
self._windows = []
model = goocanvas.CanvasModelSimple()
root = model.get_root_item()
2006-09-07 15:11:51 +02:00
grid = Grid()
2006-08-23 11:52:18 +02:00
bg = goocanvas.Rect(fill_color="#4f4f4f")
grid.set_constraints(bg, 0, 0, 80, 60)
root.add_child(bg)
2006-09-01 15:33:55 +02:00
panel = BottomPanel(grid, shell, owner.get_invites())
grid.set_constraints(panel, 5, 55)
root.add_child(panel)
2006-09-07 15:11:51 +02:00
panel_window = PanelWindow(grid, model, 0, 55, 80, 5)
self._windows.append(panel_window)
2006-09-08 01:13:42 +02:00
panel = TopPanel(grid, shell)
root.add_child(panel)
2006-09-08 01:13:42 +02:00
panel_window = PanelWindow(grid, model, 0, 0, 80, 5)
self._windows.append(panel_window)
panel = RightPanel(grid, shell, owner.get_friends())
grid.set_constraints(panel, 75, 5)
root.add_child(panel)
2006-09-07 15:11:51 +02:00
panel_window = PanelWindow(grid, model, 75, 5, 5, 50)
self._windows.append(panel_window)
2006-09-08 00:51:45 +02:00
panel_window = PanelWindow(grid, model, 0, 5, 5, 50)
self._windows.append(panel_window)
2006-08-28 16:53:29 +02:00
def __hide_timeout_cb(self):
self.hide()
return False
def show_and_hide(self, seconds):
self.show()
gobject.timeout_add(seconds * 1000, self.__hide_timeout_cb)
2006-08-28 16:53:29 +02:00
def show(self):
2006-09-07 15:11:51 +02:00
for panel in self._windows:
2006-09-01 15:33:55 +02:00
panel.show()
2006-08-28 16:53:29 +02:00
def hide(self):
2006-09-07 15:11:51 +02:00
for panel in self._windows:
2006-09-01 15:33:55 +02:00
panel.hide()
2006-08-23 11:52:18 +02:00
2006-08-28 16:53:29 +02:00
def toggle_visibility(self):
2006-09-07 15:11:51 +02:00
for panel in self._windows:
2006-09-01 15:33:55 +02:00
if panel.props.visible:
panel.hide()
else:
panel.show()