Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWalter Bender <walter@sugarlabs.org>2010-07-24 14:34:26 (GMT)
committer Walter Bender <walter@sugarlabs.org>2010-07-24 14:34:26 (GMT)
commitdddafd226c1c4bce57fcea0d804694084acd1ad1 (patch)
treeeeff6e8ca7740429f3ddb616786f6ac487acfc7c
parent38b7d592ebd221e787f91f9514a8e164a622a482 (diff)
string cleanupv30
-rw-r--r--drawwaveform.py10
-rw-r--r--sensor_toolbar.py27
-rw-r--r--sound_toolbar.py53
-rw-r--r--toolbar_side.py3
4 files changed, 45 insertions, 48 deletions
diff --git a/drawwaveform.py b/drawwaveform.py
index ccc9950..17edb04 100644
--- a/drawwaveform.py
+++ b/drawwaveform.py
@@ -102,11 +102,11 @@ class DrawWaveform(gtk.DrawingArea):
self.fft_show = False
self.side_toolbar_copy = None
- self.scaleX = str(1.04167 / self.draw_interval) + " ms"
+ self.scaleX = str(1.04167 / self.draw_interval) + ' ms'
self.scaleY = ""
self._back_surf = None
- self.expose_event_id = self.connect("expose_event", self._expose)
+ self.expose_event_id = self.connect('expose_event', self._expose)
self.pr_time = 0
self.MAX_GRAPHS = MAX_GRAPHS # Maximum simultaneous graphs
@@ -128,7 +128,7 @@ class DrawWaveform(gtk.DrawingArea):
self.Xend.append(1000)
self.Yend.append(500)
self.type .append(0)
- self.color.append("#FF0000")
+ self.color.append('#FF0000')
self.source.append(0)
self.graph_id.append(x)
@@ -179,7 +179,7 @@ class DrawWaveform(gtk.DrawingArea):
self.ringbuffer = RingBuffer1d(self.max_samples, dtype='int16')
- self.debug_str = "start"
+ self.debug_str = 'start'
self.context = True
@@ -325,7 +325,7 @@ class DrawWaveform(gtk.DrawingArea):
return True
def _expose(self, widget, event):
- """The "expose" event handler does all the drawing"""
+ """The 'expose' event handler does all the drawing"""
# Real time drawing
if self.context and self.active:
diff --git a/sensor_toolbar.py b/sensor_toolbar.py
index e849bd2..9843bec 100644
--- a/sensor_toolbar.py
+++ b/sensor_toolbar.py
@@ -46,13 +46,10 @@ class SensorToolbar(gtk.Toolbar):
self._STR_BASIC = \
_("Sensors, DC (connect sensor to pink 'Mic In' on left side of XO)") \
- + " "
- self._STR_R = _("Bias/Offset Enabled") + " " + _("Ohms") + " "
- self._STR_V = _("Bias/Offset Disabled") + " " + _("Volts") + " "
- self._STR_I = _(" Invert") + " "
-
- # self.gain_state = None
- # self.boost_state = None
+ + ' '
+ self._STR_R = _('Bias/Offset Enabled') + ' ' + _('Ohms') + ' '
+ self._STR_V = _('Bias/Offset Disabled') + ' ' + _('Volts') + ' '
+ self._STR_I = ' ' + _('Invert') + ' '
self.string_for_textbox = ""
@@ -160,7 +157,7 @@ class SensorToolbar(gtk.Toolbar):
try:
return interval_dictionary[self.logginginterval_status]
except ValueError:
- logging.error("logging interval status = %s" %\
+ logging.error('logging interval status = %s' %\
(str(self.logginginterval_status)))
return 0
@@ -187,9 +184,8 @@ class SensorToolbar(gtk.Toolbar):
self.voltage.show()
self._update_string_for_textbox()
if self.activity.has_toolbarbox:
- self.activity.mode_image.set_from_file(ICONS_DIR +\
- '/bias-on2.svg')
- self.activity.label.set_text(" " + _('Resistance Sensor'))
+ self.activity.label_button.set_icon('bias-on2')
+ self.activity.label_button.set_tooltip(_('Resistance Sensor'))
elif mode_to_set == 'voltage':
self.resistance.set_icon('bias-on')
self.voltage.set_icon('bias-off2')
@@ -197,11 +193,10 @@ class SensorToolbar(gtk.Toolbar):
self.voltage.show()
self._update_string_for_textbox()
if self.activity.has_toolbarbox:
- self.activity.mode_image.set_from_file(ICONS_DIR +\
- '/bias-off2.svg')
- self.activity.label.set_text(" " + _('Voltage Sensor'))
+ self.activity.label_button.set_icon('bias-off2')
+ self.activity.label_button.set_tooltip(_('Voltage Sensor'))
else:
- logging.error("unknown mode %s" % (mode_to_set))
+ logging.error('unknown mode %s' % (mode_to_set))
if self.activity.has_toolbarbox:
self.activity.sound_toolbar.time.set_icon('domain-time')
self.activity.sound_toolbar.freq.set_icon('domain-freq')
@@ -248,5 +243,5 @@ class SensorToolbar(gtk.Toolbar):
if self.activity.wave.get_invert_state():
self.string_for_textbox += self._STR_I
if value is not None:
- self.string_for_textbox += "\t(%s)" % (str(value))
+ self.string_for_textbox += '\t(%s)' % (str(value))
self.activity.text_box.set_data_params(0, self.string_for_textbox)
diff --git a/sound_toolbar.py b/sound_toolbar.py
index 823dbf2..4397e7b 100644
--- a/sound_toolbar.py
+++ b/sound_toolbar.py
@@ -46,11 +46,11 @@ logging.basicConfig()
class SoundToolbar(gtk.Toolbar):
""" Set up the toolbar for audio (analog) capture mode """
- SAMPLE_NOW = _("Capture now")
- SAMPLE_30_SEC = _("Every 30 sec.")
- SAMPLE_2_MIN = _("Every 2 min.")
- SAMPLE_10_MIN = _("Every 10 min.")
- SAMPLE_30_MIN = _("Every 30 min.")
+ SAMPLE_NOW = _('Capture now')
+ SAMPLE_30_SEC = _('Every 30 sec.')
+ SAMPLE_2_MIN = _('Every 2 min.')
+ SAMPLE_10_MIN = _('Every 10 min.')
+ SAMPLE_30_MIN = _('Every 30 min.')
LOWER = 0.0
UPPER = 1.0
@@ -61,13 +61,13 @@ class SoundToolbar(gtk.Toolbar):
self.activity = activity
- self._STR_BASIC = _("Sound") + " "
- self._STR1 = _("Time Base") + " "
- self._STR2 = _("Frequency Base") + " "
- self._STR3 = _(" Invert") + " "
+ self._STR_BASIC = _('Sound') + ' '
+ self._STR1 = _('Time Base') + ' '
+ self._STR2 = _('Frequency Base') + ' '
+ self._STR3 = ' ' + _('Invert') + ' '
self._STR_SCALEX = ""
self._STR_XAXIS_TEXT = \
- _("X Axis Scale: 1 division = %(division)s %(unit)s")
+ _('X Axis Scale: 1 division = %(division)s %(unit)s')
# TRANSLATORS: This is milli seconds.
self._ms = _('ms')
# TRANSLATORS: This is Hertz, so 1/second.
@@ -128,11 +128,11 @@ class SoundToolbar(gtk.Toolbar):
_(self.SAMPLE_10_MIN),
_(self.SAMPLE_30_MIN)]
try:
- self._loginterval_combo.set_tooltip_text("Sampling interval")
- except:
+ self._loginterval_combo.set_tooltip_text(_('Sampling interval'))
+ except KeyError:
pass
- self._interval_changed_id = self._loginterval_combo.connect("changed",
+ self._interval_changed_id = self._loginterval_combo.connect('changed',
self.loginterval_control)
for i, s in enumerate(self.interval):
@@ -163,13 +163,16 @@ class SoundToolbar(gtk.Toolbar):
self.activity.wave.TRIGGER_POS,
self.activity.wave.TRIGGER_NEG]
- self._trigger_changed_id = self._trigger_combo.connect("changed",
+ self._trigger_changed_id = self._trigger_combo.connect('changed',
self.update_trigger_control)
for i, s in enumerate(self.trigger):
self._trigger_combo.append_item(i, s, None)
self._trigger_combo.set_active(0)
-
+ try:
+ self._trigger_combo.set_tooltip_text(_('Create a trigger'))
+ except KeyError:
+ pass
self._trigger_tool = ToolComboBox(self._trigger_combo)
self.insert(self._trigger_tool, -1)
self.show_all()
@@ -184,7 +187,7 @@ class SoundToolbar(gtk.Toolbar):
self.activity.adjustmentf = gtk.Adjustment(0.5, self.LOWER, self.UPPER,
0.01, 0.1, 0)
- self.activity.adjustmentf.connect("value_changed", self.cb_page_sizef)
+ self.activity.adjustmentf.connect('value_changed', self.cb_page_sizef)
self._freq_range = gtk.HScale(self.activity.adjustmentf)
self._freq_range.set_inverted(True)
self._freq_range.set_draw_value(False)
@@ -323,9 +326,8 @@ class SoundToolbar(gtk.Toolbar):
self.freq.show()
self._update_string_for_textbox()
if self.activity.has_toolbarbox:
- self.activity.mode_image.set_from_file(ICONS_DIR +\
- '/domain-time2.svg')
- self.activity.label.set_text(" " + _('Time Base'))
+ self.activity.label_button.set_icon('domain-time2')
+ self.activity.label_button.set_tooltip(_('Time Base'))
else:
self.activity.wave.set_fft_mode(True)
self.time.set_icon('domain-time')
@@ -334,11 +336,10 @@ class SoundToolbar(gtk.Toolbar):
self.freq.show()
self._update_string_for_textbox()
if self.activity.has_toolbarbox:
- self.activity.mode_image.set_from_file(ICONS_DIR +\
- '/domain-freq2.svg')
- self.activity.label.set_text(" " + _('Frequency Base'))
+ self.activity.label_button.set_icon('domain-freq2')
+ self.activity.label_button.set_tooltip(_('Frequency Base'))
if self.activity.has_toolbarbox and \
- hasattr(self.activity, "sensor_toolbar"):
+ hasattr(self.activity, 'sensor_toolbar'):
self.activity.sensor_toolbar.resistance.set_icon('bias-on')
self.activity.sensor_toolbar.voltage.set_icon('bias-off')
return False
@@ -410,7 +411,7 @@ class SoundToolbar(gtk.Toolbar):
def context_on(self):
"""When the sound context is switched on"""
self.activity.audiograb.start_sound_device()
- self.activity.audiograb.set_sensor_type("sound")
+ self.activity.audiograb.set_sensor_type('sound')
self.activity.wave.set_fft_mode(False)
print "context on: gain and y_mag are %f and %f" %\
(self.gain, self.y_mag)
@@ -429,12 +430,12 @@ class SoundToolbar(gtk.Toolbar):
{'unit': self._Hz, 'division': self.activity.wave.freq_div}
self.string_for_textbox = ""
- self.string_for_textbox += (self._STR_BASIC + "\t")
+ self.string_for_textbox += (self._STR_BASIC + '\t')
if not self.activity.wave.get_fft_mode():
self.string_for_textbox += self._STR1
else:
self.string_for_textbox += self._STR2
if self.activity.wave.get_invert_state():
self.string_for_textbox += self._STR3
- self.string_for_textbox += ("\n" + self._STR_SCALEX)
+ self.string_for_textbox += ('\n' + self._STR_SCALEX)
self.activity.text_box.set_data_params(0, self.string_for_textbox)
diff --git a/toolbar_side.py b/toolbar_side.py
index 0d6fcaa..b36dde1 100644
--- a/toolbar_side.py
+++ b/toolbar_side.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
#! /usr/bin/python
#
# Author: Arjun Sarwal arjun@laptop.org
@@ -49,7 +50,7 @@ class SideToolbar(gtk.Toolbar):
self.adjustmenty = gtk.Adjustment(self.mode_values[self.mode],
self.LOWER, self.UPPER,
0.1, 0.1, 0.0)
- self.adjustmenty.connect("value_changed", self._yscrollbar_cb,
+ self.adjustmenty.connect('value_changed', self._yscrollbar_cb,
self.adjustmenty)
self.yscrollbar = gtk.VScale(self.adjustmenty)
self.yscrollbar.set_draw_value(False)