You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

69 lines
1.5 KiB
Python

import gtk
import gobject
import goocanvas
from view.frame.BottomPanel import BottomPanel
from view.frame.RightPanel import RightPanel
from view.frame.TopPanel import TopPanel
from view.frame.PanelWindow import PanelWindow
from sugar.canvas.Grid import Grid
class Frame:
def __init__(self, shell):
self._windows = []
model = goocanvas.CanvasModelSimple()
root = model.get_root_item()
grid = shell.get_grid()
18 years ago
bg = goocanvas.Rect(fill_color="#4f4f4f", line_width=0)
grid.set_constraints(bg, 0, 0, 80, 60)
root.add_child(bg)
18 years ago
panel = BottomPanel(shell)
grid.set_constraints(panel, 5, 55)
root.add_child(panel)
panel_window = PanelWindow(grid, model, 0, 55, 80, 5)
self._windows.append(panel_window)
panel = TopPanel(shell)
root.add_child(panel)
panel_window = PanelWindow(grid, model, 0, 0, 80, 5)
self._windows.append(panel_window)
panel = RightPanel(shell)
grid.set_constraints(panel, 75, 5)
root.add_child(panel)
panel_window = PanelWindow(grid, model, 75, 5, 5, 50)
self._windows.append(panel_window)
panel_window = PanelWindow(grid, model, 0, 5, 5, 50)
self._windows.append(panel_window)
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)
def show(self):
for panel in self._windows:
18 years ago
panel.show()
def hide(self):
for panel in self._windows:
18 years ago
panel.hide()
def toggle_visibility(self):
for panel in self._windows:
18 years ago
if panel.props.visible:
panel.hide()
else:
panel.show()