# Copyright (C) 2007 Jason Smith
#
# 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 1, 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., 675 Mass Ave, Cambridge, MA 02139, USA.
import gtk, pygtk
PLUGIN_NAME = "Information Panel"
PLUGIN_AUTHORS = ['Jason Smith <jassmith@gmail.com>']
PLUGIN_VERSION = '0.0.1'
PLUGIN_DESCRIPTION = r"""Will one day display information about the currently playing song"""
PLUGIN_ENABLED = False
PLUGIN_ICON = None
#setup infobox namespace
INFOBOX = None
CONNS = plugins.SignalContainer()
class infobox:
def __init__(self):
"""
Set up variables and create window
"""
self.WINDOW = None
self.window_visible = 0
self.create_window()
def create_window(self):
self.WINDOW = gtk.Window(gtk.WINDOW_TOPLEVEL)
self.WINDOW.set_title("Information Panel")
self.WINDOW.set_border_width(10)
#what to do when window is destroyed
self.WINDOW.connect("delete_event", self.destroy_window)
self.EXTERNAL_BOX = gtk.VBox(homogeneous=False, spacing=0)
self.WINDOW.add(self.EXTERNAL_BOX)
#create out simple hello world button
self.BUTTON = gtk.Button("Hello World")
self.EXTERNAL_BOX.pack_start(self.BUTTON, True, True, 0)
self.BUTTON.show()
#create a second button
self.BUTTON2 = gtk.Button("I Rock")
self.EXTERNAL_BOX.pack_start(self.BUTTON2, True, True, 0)
self.BUTTON2.show()
#make everything show
self.EXTERNAL_BOX.show()
self.WINDOW.show()
self.window_visible = 1
def destroy_window(self, widget, event, data=None):
self.WINDOW.destroy()
self.window_visible = 0
def update(self):
pass
def initialize():
"""
Called when the plugin is enabled
"""
global INFOBOX
#create INFOBOX object from infobox() class
INFOBOX = infobox()
#setup callback on play track
#CONNS.connect(APP.player, 'play-track', INFOBOX.update)
return True
def destroy():
"""
Called when the plugin is disabled
"""
INFOBOX.destroy_window()
CONNS.disconnect_all()
def configure():
"""
Called when the user clicks Configure in the Plugin Manager
"""
dialog = gtk.MessageDialog(APP.window, gtk.DIALOG_DESTROY_WITH_PARENT,
gtk.MESSAGE_INFO, gtk.BUTTONS_OK, "Configuring...")
dialog.run()
dialog.destroy()
dialog.destroy()