2006-08-19 01:29:42 +02:00
|
|
|
import gtk
|
|
|
|
|
|
|
|
from home.MeshView import MeshView
|
|
|
|
from home.HomeView import HomeView
|
2006-08-19 02:00:04 +02:00
|
|
|
from home.FriendsView import FriendsView
|
2006-08-19 01:29:42 +02:00
|
|
|
|
|
|
|
class HomeWindow(gtk.Window):
|
2006-08-19 02:00:04 +02:00
|
|
|
HOME_VIEW = 0
|
|
|
|
FRIENDS_VIEW = 1
|
|
|
|
MESH_VIEW = 2
|
|
|
|
|
2006-08-19 11:12:25 +02:00
|
|
|
def __init__(self, shell, model):
|
2006-08-19 01:29:42 +02:00
|
|
|
gtk.Window.__init__(self)
|
|
|
|
|
|
|
|
self.connect('realize', self.__realize_cb)
|
|
|
|
|
|
|
|
self._nb = gtk.Notebook()
|
|
|
|
self._nb.set_show_tabs(False)
|
|
|
|
self._nb.set_show_border(False)
|
|
|
|
|
|
|
|
home_view = HomeView(shell)
|
|
|
|
self._nb.append_page(home_view)
|
|
|
|
self._setup_canvas(home_view)
|
|
|
|
home_view.show()
|
2006-08-19 02:00:04 +02:00
|
|
|
|
2006-08-19 11:12:25 +02:00
|
|
|
friends_view = FriendsView(shell, model.get_friends())
|
2006-08-19 02:00:04 +02:00
|
|
|
self._nb.append_page(friends_view)
|
|
|
|
self._setup_canvas(friends_view)
|
|
|
|
friends_view.show()
|
2006-08-19 01:29:42 +02:00
|
|
|
|
2006-08-19 11:12:25 +02:00
|
|
|
mesh_view = MeshView(shell, model.get_mesh())
|
2006-08-19 01:29:42 +02:00
|
|
|
self._setup_canvas(mesh_view)
|
|
|
|
self._nb.append_page(mesh_view)
|
|
|
|
mesh_view.show()
|
|
|
|
|
|
|
|
self.add(self._nb)
|
|
|
|
self._nb.show()
|
|
|
|
|
2006-08-19 02:00:04 +02:00
|
|
|
def set_view(self, view):
|
|
|
|
self._nb.set_current_page(view)
|
|
|
|
|
2006-08-19 01:29:42 +02:00
|
|
|
def _setup_canvas(self, canvas):
|
|
|
|
canvas.set_bounds(0, 0, 1200, 900)
|
|
|
|
canvas.set_scale(float(800) / float(1200))
|
|
|
|
canvas.set_size_request(800, 600)
|
|
|
|
|
|
|
|
def __realize_cb(self, window):
|
|
|
|
self.window.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_DESKTOP)
|