Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/Waves.activity/csndsugui.py
diff options
context:
space:
mode:
Diffstat (limited to 'Waves.activity/csndsugui.py')
-rw-r--r--Waves.activity/csndsugui.py91
1 files changed, 80 insertions, 11 deletions
diff --git a/Waves.activity/csndsugui.py b/Waves.activity/csndsugui.py
index 8281b19..621587c 100644
--- a/Waves.activity/csndsugui.py
+++ b/Waves.activity/csndsugui.py
@@ -26,7 +26,7 @@
# file might be covered by the GNU Lesser General Public License.
#
#
-# version 0.1.2 18/03/08
+# version 0.1.2 24/03/08
import pygtk
pygtk.require('2.0')
@@ -48,18 +48,18 @@ class BasicGUI:
def set_channel(self,name, val):
"""basic bus channel setting method,
should be overriden for full-functionality."""
- print "channel:%s, value:%.1f" % (name,val)
+ self.logger.debug("channel:%s, value:%.1f" % (name,val))
def set_filechannel(self,chan,name):
"""basic filename channel setting method
should be overriden for full-functionality."""
- print "channel:%s, filename:%s" % (chan,name)
+ self.logger.debug("channel:%s, filename:%s" % (chan,name))
def set_message(self, mess):
"""basic message setting method
should be overriden for full-functionality."""
- print mess
+ self.logger.debug(mess)
def get_slider_value(self,name):
"""returns the slider value
@@ -96,7 +96,7 @@ class BasicGUI:
def set_focus(self):
""" called whenever the focus changes """
- print self.focus
+ self.logger.debug(self.focus)
def focus_out(self, widget, event):
if(self.focus):
@@ -125,6 +125,14 @@ class BasicGUI:
i[0].modify_bg(gtk.STATE_PRELIGHT, gtk.gdk.Color(0xFFFF,0,0, 2))
self.set_channel(i[1], i[2])
+ def button_setvalue(self, widget, value):
+ if not value:
+ widget.modify_bg(gtk.STATE_NORMAL, gtk.gdk.Color(0x0FFF,0,0x00FF, 2))
+ widget.modify_bg(gtk.STATE_PRELIGHT, gtk.gdk.Color(0xFFFF,0,0xFFFF, 2))
+ else:
+ widget.modify_bg(gtk.STATE_NORMAL, gtk.gdk.Color(0xFFFF,0,0, 1))
+ widget.modify_bg(gtk.STATE_PRELIGHT, gtk.gdk.Color(0xFFFF,0,0, 2))
+
def mbuttcallback(self, widget, data=None):
for i in self.mbuttons:
if i[0] == widget:
@@ -163,8 +171,6 @@ class BasicGUI:
def destroy_chooser(self,widget):
self.curfile[0].destroy()
-
- # internal callback
def fbuttcallback(self, widget, data=None):
self.focus_disconnect()
self.fback = self.window.connect('focus_in_event', self.focus_back)
@@ -466,14 +472,77 @@ class BasicGUI:
def channels_reinit(self):
""" resets channel to current widget values"""
- for i in self.channel_widgets:
- for j in i:
+ for j in self.buttons:
+ self.set_channel(j[1],j[2])
+ for j in self.sliders:
+ if j[4]:
+ self.set_channel(j[1],j[2])
+ pass
+ else:
+ value = j[5]*pow(j[6]/j[5], j[2]/j[6])
+ self.set_channel(j[1], value)
+ for j in self.spins:
+ self.set_channel(j[1],j[2])
+
+
+
+ def widgets_reset(self):
+ """ resets widget to channel values"""
+ for j in self.buttons:
+ self.button_setvalue(j[0], j[2])
+ self.set_channel(j[1],j[2])
+ for j in self.sliders:
+ j[0].set_value(j[2])
+ j[0].emit("value_changed")
+ for j in self.spins:
+ j[0].set_value(j[2])
+ j[0].emit("value_changed")
+
+ def channels_save(self):
+ """ Saves a list with channel names and current values.
+ Returns a list of tuples (channel_name, channel_value)"""
+ chan_list = []
+ for i in self.channel_widgets:
+ for j in i:
if(j[1] != "pause"):
if(j[1] != "play"):
if(j[1] != "reset"):
- self.set_channel(j[1],j[2])
- self.logger.debug(j[1])
+ chan_list.append((j[1],j[2]));
+ return chan_list
+ def channels_load(self, chan_list):
+ """ Loads a list with channel names and values into the
+ current channel list """
+ for i in self.channnel_widgets:
+ for j in i:
+ cnt = 0
+ while(j[1] == chan_list[cnt][0]):
+ j[1] = chann_list[cnt][0]
+ j[2] = chan_list[cnt][1]
+ cnt = cnt+1
+ self.widgets_reset()
+
+ def set_channel_metadata(self):
+ """ Saves channel data as metadata. Can be called in
+ write_file() to save channel/widget data """
+ mdata = self.channels_save()
+ for i in mdata:
+ self.window.metadata['channel-'+i[0]] = str(i[1])
+
+ def get_channel_metadata(self):
+ """ Retrieves channel data from metadata. Can be called after
+ widgets have been created to retrieve channel data and
+ reset widgets """
+ for i in self.channel_widgets:
+ for j in i:
+ mdata = self.window.metadata.get('channel-'+j[1],'0')
+ if mdata is None: continue
+ else:
+ try: j[2] = float(mdata)
+ except: j[2] = mdata
+ self.widgets_reset()
+
+
def nofocus(self):
pass