Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--shell/console/__init__.py19
-rw-r--r--shell/console/console.py9
-rw-r--r--shell/console/logviewer.py6
-rw-r--r--shell/view/Shell.py9
-rw-r--r--shell/view/keyhandler.py2
5 files changed, 19 insertions, 26 deletions
diff --git a/shell/console/__init__.py b/shell/console/__init__.py
index d6553b7..5e15721 100644
--- a/shell/console/__init__.py
+++ b/shell/console/__init__.py
@@ -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()
-
diff --git a/shell/console/console.py b/shell/console/console.py
index 1bdd5ce..9e4578b 100644
--- a/shell/console/console.py
+++ b/shell/console/console.py
@@ -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()
diff --git a/shell/console/logviewer.py b/shell/console/logviewer.py
index 102552b..ed631fa 100644
--- a/shell/console/logviewer.py
+++ b/shell/console/logviewer.py
@@ -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)
diff --git a/shell/view/Shell.py b/shell/view/Shell.py
index 9d14a2f..e816308 100644
--- a/shell/view/Shell.py
+++ b/shell/view/Shell.py
@@ -36,6 +36,7 @@ from view.frame.frame import Frame
from view.keyhandler import KeyHandler
from view.home.HomeWindow import HomeWindow
from model.shellmodel import ShellModel
+from console import Console
class Shell(gobject.GObject):
def __init__(self, model):
@@ -64,6 +65,8 @@ class Shell(gobject.GObject):
home_model.connect('pending-activity-changed',
self._pending_activity_changed_cb)
+ self._console = Console(model)
+
gobject.idle_add(self._start_journal_idle)
def _start_journal_idle(self):
@@ -165,6 +168,12 @@ class Shell(gobject.GObject):
return host
return None
+ def toggle_console_visibility(self):
+ if self._console.props.visible:
+ self._console.hide()
+ else:
+ self._console.show()
+
def toggle_chat_visibility(self):
act = self.get_current_activity()
if not act:
diff --git a/shell/view/keyhandler.py b/shell/view/keyhandler.py
index 373bceb..971c8a6 100644
--- a/shell/view/keyhandler.py
+++ b/shell/view/keyhandler.py
@@ -148,7 +148,7 @@ class KeyHandler(object):
gobject.idle_add(self._toggle_console_visibility_cb)
def handle_new_console(self):
- console.toggle_visibility()
+ self._shell.toggle_console_visibility()
def handle_frame(self):
self._shell.get_frame().notify_key_press()