Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS2
-rwxr-xr-xactivity.py89
-rw-r--r--activity/activity.info2
-rw-r--r--createcardpanel.py12
-rw-r--r--model.py14
5 files changed, 33 insertions, 86 deletions
diff --git a/NEWS b/NEWS
index 8ef7868..ea11ed9 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,5 @@
+21
+
20
19
diff --git a/activity.py b/activity.py
index be689a7..bd16683 100755
--- a/activity.py
+++ b/activity.py
@@ -64,7 +64,6 @@ class MemorizeActivity(Activity):
self.play_mode = False
toolbox = ActivityToolbox(self)
- toolbox.connect('current-toolbar-changed', self.change_mode)
activity_toolbar = toolbox.get_activity_toolbar()
self._memorizeToolbar = memorizetoolbar.MemorizeToolbar(self)
@@ -117,23 +116,6 @@ class MemorizeActivity(Activity):
self.hbox.pack_start(self.scoreboard, False, False)
self.hbox.pack_start(self.table)
self.set_canvas(self.hbox)
-
- # create csound instance to play sound files
- self.sound = 0
- try:
- import csnd
- del csnd
- self.sound = 1
- except:
- self.sound = 0
-
- if self.sound == 1:
- from csound.csoundserver import CsoundServer
- cs = CsoundServer()
- if cs.start() != 0:
- self.sound = 0
- else:
- cs.quit()
# connect to the in/out events of the memorize activity
self.connect('focus_in_event', self._focus_in)
@@ -142,16 +124,10 @@ class MemorizeActivity(Activity):
# start on the game toolbar, might change this to the create toolbar later
self.toolbox.set_current_toolbar(_TOOLBAR_PLAY)
+ toolbox.connect('current-toolbar-changed', self.change_mode)
# Get the Presence Service
self.pservice = presenceservice.get_instance()
- #try:
- # name, path = self.pservice.get_preferred_connection()
- # self.tp_conn_name = name
- # self.tp_conn_path = path
- # self.conn = telepathy.client.Connection(name, path)
- #except TypeError:
- # _logger.debug('Offline')
self.initiating = None
# Buddy object for you
@@ -243,45 +219,6 @@ class MemorizeActivity(Activity):
self._shared_activity.connect('buddy-joined', self._buddy_joined_cb)
self._shared_activity.connect('buddy-left', self._buddy_left_cb)
- '''
- # Work out what our room is called and whether we have Tubes already
- room = None
- tubes_chan = None
- text_chan = None
- for channel_path in channel_paths:
- channel = telepathy.client.Channel(bus_name, channel_path)
- htype, handle = channel.GetHandle()
- if htype == telepathy.HANDLE_TYPE_ROOM:
- _logger.debug('Found our room: it has handle#%d "%s"',
- handle, self.conn.InspectHandles(htype, [handle])[0])
- room = handle
- ctype = channel.GetChannelType()
- if ctype == telepathy.CHANNEL_TYPE_TUBES:
- _logger.debug('Found our Tubes channel at %s', channel_path)
- tubes_chan = channel
- elif ctype == telepathy.CHANNEL_TYPE_TEXT:
- _logger.debug('Found our Text channel at %s', channel_path)
- text_chan = channel
-
- if room is None:
- _logger.error("Presence service didn't create a room")
- return
- if text_chan is None:
- _logger.error("Presence service didn't create a text channel")
- return
-
- # Make sure we have a Tubes channel - PS doesn't yet provide one
- if tubes_chan is None:
- _logger.debug("Didn't find our Tubes channel, requesting one...")
- tubes_chan = self.conn.request_channel(telepathy.CHANNEL_TYPE_TUBES,
- telepathy.HANDLE_TYPE_ROOM, room, True)
-
- self.tubes_chan = tubes_chan
- self.text_chan = text_chan
-
- tubes_chan[telepathy.CHANNEL_TYPE_TUBES].connect_to_signal('NewTube',
- self._new_tube_cb)
- '''
def _list_tubes_reply_cb(self, tubes):
for tube_info in tubes:
self._new_tube_cb(*tube_info)
@@ -363,19 +300,25 @@ class MemorizeActivity(Activity):
self.game.rem_buddy(buddy)
def _focus_in(self, event, data=None):
+ pass
+ '''
if self.sound == 1:
- pass
- #self.game.cs.start()
- #_logger.debug(" Memorize is visible: start csound server. ")
+ self.game.cs.start()
+ _logger.debug(" Memorize is visible: start csound server. ")
+ '''
def _focus_out(self, event, data=None):
+ pass
+ '''
if self.sound == 1:
- pass
- #self.game.cs.pause()
- #_logger.debug(" Memorize is invisible: pause csound server. ")
+ self.game.cs.pause()
+ _logger.debug(" Memorize is invisible: pause csound server. ")
+ '''
def _cleanup_cb(self, data=None):
+ pass
+ '''
if self.sound == 1:
- pass
- #self.game.cs.quit()
- #_logger.debug(" Memorize closes: close csound server. ")
+ self.game.cs.quit()
+ _logger.debug(" Memorize closes: close csound server. ")
+ '''
diff --git a/activity/activity.info b/activity/activity.info
index 0a69cbb..6be4baa 100644
--- a/activity/activity.info
+++ b/activity/activity.info
@@ -3,6 +3,6 @@ name = Memorize
service_name = org.laptop.Memorize
exec = sugar-activity activity.MemorizeActivity
icon = activity-memorize
-activity_version = 20
+activity_version = 21
show_launcher = yes
mime_types = application/x-memorize-project; \ No newline at end of file
diff --git a/createcardpanel.py b/createcardpanel.py
index a89d1de..626c4f4 100644
--- a/createcardpanel.py
+++ b/createcardpanel.py
@@ -51,7 +51,7 @@ class CreateCardPanel(gtk.EventBox):
add_image.set_from_file(add_icon)
self._addbutton = gtk.Button(' ' + _('Add as new pair'))
self._addbutton.set_image(add_image)
- self._addbutton.connect('button-press-event', self.emit_add_pair)
+ self._addbutton.connect('pressed', self.emit_add_pair)
# Set update selected pair buttom
update_icon = join(dirname(__file__), 'images', 'pair-update.svg')
@@ -59,7 +59,7 @@ class CreateCardPanel(gtk.EventBox):
update_image.set_from_file(update_icon)
self._updatebutton = gtk.Button(' ' + _('Update selected pair'))
self._updatebutton.set_image(update_image)
- self._updatebutton.connect('button-press-event', self.emit_update_pair)
+ self._updatebutton.connect('pressed', self.emit_update_pair)
# Set card editors
self.cardeditor1 = CardEditor()
@@ -83,7 +83,8 @@ class CreateCardPanel(gtk.EventBox):
self.add(self.table)
self.show_all()
- def emit_add_pair(self, widget, event):
+ def emit_add_pair(self, widget):
+ self._addbutton.set_sensitive(False)
if self.equal_pairs:
self.emit('add-pair', self.cardeditor1.get_text(), self.cardeditor1.get_text(), self.cardeditor1.get_pixbuf(), self.cardeditor1.get_pixbuf(), self.cardeditor1.get_snd(), self.cardeditor1.get_snd())
else:
@@ -91,7 +92,8 @@ class CreateCardPanel(gtk.EventBox):
self.clean(None)
- def emit_update_pair(self, widget, event):
+ def emit_update_pair(self, widget):
+ self._addbutton.set_sensitive(False)
if self.equal_pairs:
self.emit('update-pair', self.cardeditor1.get_text(), self.cardeditor1.get_text(), self.cardeditor1.get_pixbuf(), self.cardeditor1.get_pixbuf(), self.cardeditor1.get_snd(), self.cardeditor1.get_snd())
else:
@@ -171,7 +173,7 @@ class CardEditor(gtk.EventBox):
gtk.EventBox.__init__(self)
self.set_size_request(310, 320)
- tmp_root = join(dirname(__file__), 'instance')
+ tmp_root = join(environ['SUGAR_ACTIVITY_ROOT'], 'instance')
self.temp_folder = tempfile.mkdtemp(dir=tmp_root)
table = gtk.Table()
diff --git a/model.py b/model.py
index 2b25949..b3498bc 100644
--- a/model.py
+++ b/model.py
@@ -32,12 +32,12 @@ _logger = logging.getLogger('model')
class Pair(gobject.GObject):
__gproperties__ = {
- 'aimg' : (str, None, None, None, gobject.PARAM_READWRITE),
- 'asnd' : (str, None, None, None, gobject.PARAM_READWRITE),
- 'achar' : (str, None, None, None, gobject.PARAM_READWRITE),
- 'bimg' : (str, None, None, None, gobject.PARAM_READWRITE),
- 'bsnd' : (str, None, None, None, gobject.PARAM_READWRITE),
- 'bchar' : (str, None, None, None, gobject.PARAM_READWRITE),
+ 'aimg' : (str, None, None, None, gobject.PARAM_READWRITE),
+ 'asnd' : (str, None, None, None, gobject.PARAM_READWRITE),
+ 'achar': (str, None, None, None, gobject.PARAM_READWRITE),
+ 'bimg' : (str, None, None, None, gobject.PARAM_READWRITE),
+ 'bsnd' : (str, None, None, None, gobject.PARAM_READWRITE),
+ 'bchar': (str, None, None, None, gobject.PARAM_READWRITE),
'color': (gobject.TYPE_INT, 'Base', 'Base', 0, 10, 0, gobject.PARAM_READWRITE)
}
@@ -122,7 +122,7 @@ class Model(object):
self.count = 0
def read(self, game_file):
- tmp_root = join(dirname(__file__), 'instance')
+ tmp_root = join(environ['SUGAR_ACTIVITY_ROOT'], 'instance')
temp_folder = tempfile.mkdtemp(dir=tmp_root)
self.data['key'] = basename(game_file)