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

59 lines
1.3 KiB
Python
Raw Normal View History

2006-08-23 11:52:18 +02:00
import gtk
import gobject
2006-08-23 11:52:18 +02:00
2006-09-01 15:11:52 +02:00
from frame.BottomPanel import BottomPanel
from frame.RightPanel import RightPanel
from frame.TopPanel import TopPanel
from frame.Panel import Panel
2006-08-23 11:52:18 +02:00
2006-09-01 15:11:52 +02:00
class Frame:
def __init__(self, shell, owner):
2006-08-23 11:52:18 +02:00
size = 30
2006-09-01 15:33:55 +02:00
self._panels = []
panel = BottomPanel(shell, owner.get_invites())
2006-09-01 15:33:55 +02:00
panel.set_position(size, 0)
panel.move(0, gtk.gdk.screen_height() - size)
panel.resize(gtk.gdk.screen_width(), size)
self._panels.append(panel)
panel = RightPanel(shell, owner.get_friends())
panel.move(gtk.gdk.screen_width() - size, size)
panel.resize(size, gtk.gdk.screen_height() - size * 2)
self._panels.append(panel)
panel = TopPanel(shell)
panel.set_position(size, 0)
panel.move(0, 0)
panel.resize(gtk.gdk.screen_width(), size)
self._panels.append(panel)
panel = Panel()
panel.move(0, size)
panel.resize(size, gtk.gdk.screen_height() - size * 2)
self._panels.append(panel)
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-01 15:33:55 +02:00
for panel in self._panels:
panel.show()
2006-08-28 16:53:29 +02:00
def hide(self):
2006-09-01 15:33:55 +02:00
for panel in self._panels:
panel.hide()
2006-08-23 11:52:18 +02:00
2006-08-28 16:53:29 +02:00
def toggle_visibility(self):
2006-09-01 15:33:55 +02:00
for panel in self._panels:
if panel.props.visible:
panel.hide()
else:
panel.show()