Use matchbox to activate home and people page

This commit is contained in:
Marco Pesenti Gritti 2006-07-19 13:38:24 +02:00
parent 08a52809a6
commit ae00121fbf
11 changed files with 27 additions and 27 deletions

View File

@ -90,7 +90,7 @@ class ActivityRegistry:
elif cp.has_option('Activity', 'python_module'): elif cp.has_option('Activity', 'python_module'):
python_module = cp.get('Activity', 'python_module') python_module = cp.get('Activity', 'python_module')
python_module = cp.get('Activity', 'python_module') python_module = cp.get('Activity', 'python_module')
activity_exec = '%s %s %s' % (env.get_activity_runner(), activity_exec = '%s %s %s' % ('sugar-activity',
activity_id, python_module) activity_id, python_module)
if default_type: if default_type:
activity_exec += ' ' + default_type activity_exec += ' ' + default_type

View File

@ -70,5 +70,6 @@ class Emulator:
process = XnestProcess() process = XnestProcess()
process.start() process.start()
except: except:
logging.error('Cannot run the emulator. You need to install Xephyr or Xnest.') logging.error('Cannot run the emulator. You need to install \
Xephyr or Xnest.')
sys.exit(0) sys.exit(0)

View File

@ -154,8 +154,6 @@ class HomeWindow(gtk.Window):
def create(self, activity_name): def create(self, activity_name):
Activity.create(activity_name) Activity.create(activity_name)
self.hide()
def activate(self, activity_window): def activate(self, activity_window):
activity_window.activate(gtk.get_current_event_time()) activity_window.activate(gtk.get_current_event_time())
self.hide()

View File

@ -8,8 +8,6 @@ class PeopleWindow(gtk.Window):
gtk.Window.__init__(self) gtk.Window.__init__(self)
self.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_DIALOG) self.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_DIALOG)
self.set_skip_taskbar_hint(True)
self.set_decorated(False)
self.set_default_size(620, 460) self.set_default_size(620, 460)
hbox = gtk.HBox(False, 12) hbox = gtk.HBox(False, 12)

View File

@ -106,7 +106,7 @@ class PresenceView(gtk.VBox):
button_box.show() button_box.show()
def _share_button_clicked_cb(self, button): def _share_button_clicked_cb(self, button):
self._shell.get_current_activity().publish() self._activity.publish()
def _on_buddyList_buddy_selected(self, view, *args): def _on_buddyList_buddy_selected(self, view, *args):
(model, aniter) = view.get_selection().get_selected() (model, aniter) = view.get_selection().get_selected()

View File

@ -20,16 +20,12 @@ class ShellDbusService(dbus.service.Object):
dbus.service.Object.__init__(self, bus_name, '/com/redhat/Sugar/Shell') dbus.service.Object.__init__(self, bus_name, '/com/redhat/Sugar/Shell')
self._shell = shell self._shell = shell
def __toggle_people_idle(self): def __show_people_idle(self):
self._shell.toggle_people() self._shell.show_people()
@dbus.service.method('com.redhat.Sugar.Shell') @dbus.service.method('com.redhat.Sugar.Shell')
def toggle_people(self): def show_people(self):
gobject.idle_add(self.__toggle_people_idle) gobject.idle_add(self.__show_people_idle)
@dbus.service.method('com.redhat.Sugar.Shell')
def toggle_home(self):
self._shell.toggle_home()
@dbus.service.method('com.redhat.Sugar.Shell') @dbus.service.method('com.redhat.Sugar.Shell')
def toggle_console(self): def toggle_console(self):
@ -68,9 +64,6 @@ class Shell:
else: else:
window.show() window.show()
def toggle_home(self):
self._toggle_window_visibility(self._home_window)
def get_activity_from_xid(self, xid): def get_activity_from_xid(self, xid):
bus = dbus.SessionBus() bus = dbus.SessionBus()
service = Activity.ACTIVITY_SERVICE_NAME + "%s" % xid service = Activity.ACTIVITY_SERVICE_NAME + "%s" % xid
@ -90,7 +83,7 @@ class Shell:
else: else:
return None return None
def toggle_people(self): def show_people(self):
activity = self.get_current_activity() activity = self.get_current_activity()
if activity: if activity:

View File

@ -5,6 +5,13 @@ import os
import pwd import pwd
import random import random
def add_to_bin_path(path):
if os.environ.has_key('PATH'):
old_path = os.environ['PATH']
os.environ['PATH'] = path + ':' + old_path
else:
os.environ['PATH'] = path
def add_to_python_path(path): def add_to_python_path(path):
sys.path.insert(0, path) sys.path.insert(0, path)
if os.environ.has_key('PYTHONPATH'): if os.environ.has_key('PYTHONPATH'):
@ -34,6 +41,7 @@ basedir = os.path.dirname(curdir)
if os.path.isfile(os.path.join(basedir, 'sugar/__uninstalled__.py')): if os.path.isfile(os.path.join(basedir, 'sugar/__uninstalled__.py')):
print 'Running sugar from ' + basedir + ' ...' print 'Running sugar from ' + basedir + ' ...'
add_to_bin_path(os.path.join(basedir, 'shell'))
add_to_python_path(basedir) add_to_python_path(basedir)
add_to_python_path(os.path.join(basedir, 'shell')) add_to_python_path(os.path.join(basedir, 'shell'))
else: else:

10
shell/sugar-people Executable file
View File

@ -0,0 +1,10 @@
#!/usr/bin/python
import dbus
bus = dbus.SessionBus()
proxy_obj = bus.get_object('com.redhat.Sugar.Shell', '/com/redhat/Sugar/Shell')
shell = dbus.Interface(proxy_obj, 'com.redhat.Sugar.Shell')
shell.show_people()

View File

@ -1,5 +1,4 @@
import os import os
sugar_data_dir = os.path.dirname(os.path.dirname(__file__)) sugar_data_dir = os.path.dirname(os.path.dirname(__file__))
sugar_activity_runner = os.path.join(sugar_data_dir, 'shell/sugar-activity')
sugar_activities_dir = os.path.join(sugar_data_dir, 'activities') sugar_activities_dir = os.path.join(sugar_data_dir, 'activities')

View File

@ -36,6 +36,3 @@ def get_data_dir():
def get_activities_dir(): def get_activities_dir():
return sugar_activities_dir return sugar_activities_dir
def get_activity_runner():
return sugar_activity_runner

View File

@ -13,9 +13,5 @@ def setup_global_keys(window, shell = None):
window.connect("key-press-event", __key_press_event_cb, shell) window.connect("key-press-event", __key_press_event_cb, shell)
def __key_press_event_cb(window, event, shell): def __key_press_event_cb(window, event, shell):
if event.keyval == gtk.keysyms.F1:
shell.toggle_home()
if event.keyval == gtk.keysyms.F2:
shell.toggle_people()
if event.keyval == gtk.keysyms.F3: if event.keyval == gtk.keysyms.F3:
shell.toggle_console() shell.toggle_console()