Make the Shell own the console. Some view changes.

This commit is contained in:
Marco Pesenti Gritti
2007-09-30 14:24:03 +02:00
parent c8b5ab290e
commit ce72600b02
5 changed files with 19 additions and 26 deletions
-19
View File
@@ -1,20 +1 @@
from console import Console
console = None
def show():
global console
if not console:
console = Console()
console.show()
def hide():
if console:
console.hide()
def toggle_visibility():
if not console or not console.props.visible:
show()
else:
hide()
+6 -3
View File
@@ -3,10 +3,14 @@ import os
import gtk
import hippo
from sugar.graphics.roundbox import CanvasRoundBox
class Console(gtk.Window):
def __init__(self):
def __init__(self, shell_model):
gtk.Window.__init__(self)
self._shell_model = shell_model
self.set_default_size(gtk.gdk.screen_width() * 3 / 4,
gtk.gdk.screen_height() * 3 / 4)
self.set_decorated(False)
@@ -17,8 +21,7 @@ class Console(gtk.Window):
self.add(canvas)
canvas.show()
box = hippo.CanvasBox(padding=20, border_color=0x000000FF,
border=3)
box = hippo.CanvasBox(padding=20, background_color=0x000000FF)
canvas.set_root(box)
self.registry = Registry()
+3 -3
View File
@@ -5,7 +5,6 @@ import hippo
import gnomevfs
from louie import dispatcher
from sugar.graphics.roundbox import CanvasRoundBox
from sugar import env
class LogEntry(object):
@@ -55,7 +54,7 @@ class LogView(hippo.CanvasBox):
widget.props.vadjustment.connect('changed', self._vadj_changed_cb)
self.append(scrollbars, hippo.PACK_EXPAND)
self.box = hippo.CanvasBox(spacing=5)
self.box = hippo.CanvasBox(spacing=5, background_color=0xFFFFFFFF)
scrollbars.set_root(self.box)
for entry_model in self.model:
@@ -64,10 +63,11 @@ class LogView(hippo.CanvasBox):
dispatcher.connect(self._entry_added_cb, 'entry-added', self.model)
def add_entry(self, entry_model):
entry_box = CanvasRoundBox(background_color=0xffffffff, padding=5)
entry_box = hippo.CanvasBox(padding=5)
self.box.append(entry_box)
entry = hippo.CanvasText(text=entry_model.text,
xalign=hippo.ALIGNMENT_START,
size_mode=hippo.CANVAS_SIZE_WRAP_WORD)
entry_box.append(entry)