Merge pull request #117 from teto/fix_alsa_and_clock

this commit fixes 2 problems:
This commit is contained in:
enkore 2014-09-14 01:02:13 +02:00
commit fc015e8908
2 changed files with 6 additions and 6 deletions

View File

@ -25,7 +25,7 @@ class ALSA(IntervalModule):
("mixer", "ALSA mixer"), ("mixer", "ALSA mixer"),
("mixer_id", "ALSA mixer id"), ("mixer_id", "ALSA mixer id"),
("card", "ALSA sound card"), ("card", "ALSA sound card"),
("increment","integer percentage of max volume to in/decrement volume on mousewheel"), ("increment", "integer percentage of max volume to in/decrement volume on mousewheel"),
"muted", "unmuted", "muted", "unmuted",
"color_muted", "color", "color_muted", "color",
"channel" "channel"
@ -88,12 +88,12 @@ class ALSA(IntervalModule):
def on_rightclick(self): def on_rightclick(self):
if self.has_mute: if self.has_mute:
muted = self.alsamixer.getmute()[self.channel] muted = self.alsamixer.getmute()[self.channel]
self.alsamixer.setmute( not muted ) self.alsamixer.setmute(not muted)
def on_upscroll(self): def on_upscroll(self):
vol = self.alsamixer.getvolume()[self.channel] vol = self.alsamixer.getvolume()[self.channel]
self.alsamixer.setvolume( vol + self.increment) self.alsamixer.setvolume(min(100, vol + self.increment))
def on_downscroll(self): def on_downscroll(self):
vol = self.alsamixer.getvolume()[self.channel] vol = self.alsamixer.getvolume()[self.channel]
self.alsamixer.setvolume( vol - self.increment) self.alsamixer.setvolume(max(0, vol - self.increment))

View File

@ -59,7 +59,7 @@ class Clock(IntervalModule):
else: else:
dt = datetime.datetime.now() dt = datetime.datetime.now()
output = dt.strftime(self.format[self.current_format_id][0]), output = dt.strftime(self.format[self.current_format_id][0])
self.output = { self.output = {
"full_text": output, "full_text": output,