From 1b5f8bdd6ccb09b7f6f2914cf9044d294e16be4a Mon Sep 17 00:00:00 2001 From: Aleksey Lim Date: Mon, 19 Jan 2009 16:27:12 +0000 Subject: ... --- diff --git a/Main.py b/Main.py index 8332f66..b11be9c 100644 --- a/Main.py +++ b/Main.py @@ -150,7 +150,7 @@ class CartoonBuilder: self.drawmain() def _sound_cb(self, widget): - Sound.switch(widget.props.value) + Sound.change(widget.props.value) def oldplayframe(self): self.mfdraw.fgimgpath = self.frameimgpaths[self.playframenum] diff --git a/Sound.py b/Sound.py index f6262e2..aec6e87 100644 --- a/Sound.py +++ b/Sound.py @@ -18,6 +18,7 @@ import gst from gettext import gettext as _ import Theme +from Utils import * from sugar.activity.activity import get_bundle_path sound_icon = Theme.pixmap('icons/sound_icon.png') @@ -47,31 +48,18 @@ THEMES = ( 'pixbuf': sound_icon, 'sound' : None } ) -class FileInstanceVariable: - def __init__(self, value = None): - self.value = value - - def get(self): - return self.value - - def set(self, value): - self.value = value - - def __getitem__(self, key): - return self.value[key] - theme = FileInstanceVariable(THEMES[0]) playing = FileInstanceVariable(False) def play(): playing.set(True) - switch(theme.get()) + change(theme.get()) def stop(): playing.set(False) player.set_state(gst.STATE_NULL) -def switch(a_theme): +def change(a_theme): if not a_theme: return theme.set(a_theme) diff --git a/Utils.py b/Utils.py new file mode 100644 index 0000000..1e539c0 --- /dev/null +++ b/Utils.py @@ -0,0 +1,26 @@ +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +class FileInstanceVariable: + def __init__(self, value = None): + self.value = value + + def get(self): + return self.value + + def set(self, value): + self.value = value + + def __getitem__(self, key): + return self.value[key] diff --git a/icons/sound_icon.png b/icons/sound_icon.png index e953394..9283e50 100644 --- a/icons/sound_icon.png +++ b/icons/sound_icon.png Binary files differ -- cgit v0.9.1