Skip to content

Commit

Permalink
change volume on scroll
Browse files Browse the repository at this point in the history
  • Loading branch information
h15 committed Sep 29, 2010
1 parent 06ba5d3 commit 03890b7
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions pp.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@
import gtk
import gobject
import os
import re
import sys

class XmmsCli:
""" Class for working with xmms2d via nyxmms2 """
def __init__(self, app):
self.volume = 100
self.app = app
self.play()
self.is_play = True
Expand Down Expand Up @@ -52,7 +55,17 @@ def next(self, null):
def quit(self):
""" Xmms2d exit """
self.send("server shutdown")

def incVolume(self):
if self.volume < 100:
self.volume += 2
self.send('server volume %s' % self.volume)

def decVolume(self):
if self.volume > 0:
self.volume -= 2
self.send('server volume %s' % self.volume)

def send(self, msg):
""" Exec nyxmms2 command """
print msg
Expand Down Expand Up @@ -93,22 +106,19 @@ def __init__(self):
self.tray.set_tooltip('Primitive Player')

self.tray.connect('activate', self.xmms.pp)
# self.tray.connect('scroll_event', self.scroll_event)
self.tray.connect('scroll_event', self.scroll_event)
self.tray.connect('popup-menu', self.popup, self.menu)

# init
self.desktop = gtk.gdk.get_default_root_window()

def scroll_event(self,param2,event):
""" On Scrolling tray """
print os.system("nyxmms2 volume_list")
# if event.direction == gdk.SCROLL_UP:
# if master_slider.get_value() < 100:
# master_slider.set_value(master_slider.get_value() + 1)
#
# if event.direction == gdk.SCROLL_DOWN:
# if master_slider.get_value() > 0:
# master_slider.set_value(master_slider.get_value() - 1)
if event.direction == gtk.gdk.SCROLL_UP:
self.xmms.incVolume()

elif event.direction == gtk.gdk.SCROLL_DOWN:
self.xmms.decVolume()

def popup(self, widget, button, time, data = None):
""" rise on right click """
Expand Down

0 comments on commit 03890b7

Please sign in to comment.