~ubuntu-branches/ubuntu/quantal/jokosher/quantal

« back to all changes in this revision

Viewing changes to Jokosher/StatusBar.py

  • Committer: Bazaar Package Importer
  • Author(s): Luca Falavigna, Luca Falavigna, Piotr Ożarowski
  • Date: 2009-05-12 00:37:15 UTC
  • mfrom: (1.3.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20090512003715-3hp2ycoqjlzwfnlv
Tags: 0.11.2-1
[ Luca Falavigna ]
* New upstream release (Closes: #517234).
  - Jokosher now appears under Sound & Video (Closes: #443788).
* New Maintainer (Closes: #523167).
* Add Python Applications Packaging Team to Uploaders.
* Add Vcs-* fields in source stanza.
* Adjust copyright informations:
  - Refresh upstream authors and copyright holders.
  - Link to /usr/share/common-licenses/GPL-2.
  - Adjust copyright holders for Debian packaging.
  - Replace (c) with ©.
* Apply changes from Ubuntu by Daniel Holbach (thanks!):
  - Drop scrollkeeper from Build-Depends.
  - Drop useless dependencies: python-alsaaudio, gstreamer0.10-gnomevfs,
    librsvg2-common, python-gnome2.
  - Bump gstreamer0.10-plugins-good requirement to >= 0.10.9.
  - Drop debian/jokosher.sh, useless.
  - Provide debian/watch file.
* Switch to debhelper 7.
* Install Jokosher module in private directory.
* Unpack egg files to let python-support handle them.
* Drop python-dev from Build-Depends, use python (>= 2.4) instead.
* Depend on python-gobject.
* Switch dependency from python-setuptools to python-pkg-resources
  because of package rename (Closes: #468728).
* debian/patches/10_update_mime_database.dpatch:
  - Refresh for new upstream release.
* debian/patches/20_LevelList_IOError.dpatch:
  - Fix IOError exception trying to add an audio file to a project.
* debian/patches/30_desktop_file.dpatch:
  - Adhere to Freedesktop.org standards by removing deprecated entries.
* debian/patches/50_CreateNewProject_return.dpatch:
  - Return class while creating a new project.
* Provide a simple man page for jokosher.
* Bump Standards-Version to 3.8.1:
  - Provide Homepage field in source stanza.
  - Provide debian/README.source to document dpatch usage.

[ Piotr Ożarowski ]
* Add 40_load_extensions_from_unpacked_eggs patch so that extensions in
  unzipped Eggs are recognized as well

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#
2
 
#       THIS FILE IS PART OF THE JOKOSHER PROJECT AND LICENSED UNDER THE GPL. SEE
3
 
#       THE 'COPYING' FILE FOR DETAILS
4
 
#
5
 
#       StatusBar.py
6
 
#       
7
 
#       This module is a better status bar than the one included
8
 
#       with gtk because it allows pango markup (bold, etc.).
9
 
#
10
 
#-------------------------------------------------------------------------------
11
 
 
12
 
import gtk
13
 
 
14
 
#=========================================================================
15
 
 
16
 
class StatusBar(gtk.HBox):
17
 
        """
18
 
        Implements an improved status bar which allows pango markup styles (bold, italics, etc).
19
 
        """
20
 
        #_____________________________________________________________________
21
 
 
22
 
        def __init__(self):
23
 
                """
24
 
                Creates a new instance of StatusBar with no messages shown.
25
 
                """
26
 
                gtk.HBox.__init__(self)
27
 
                self.latest_id = 0
28
 
                self.label = gtk.Label()
29
 
                self.label.set_justify(gtk.JUSTIFY_LEFT)
30
 
                self.pack_start(self.label, False)
31
 
                # message stack is a dictionary as this is a very easy type
32
 
                # to add and remove from
33
 
                self.stack = {}
34
 
                
35
 
        #_____________________________________________________________________
36
 
 
37
 
        def Push(self, message):
38
 
                """
39
 
                Insert a new message into the messages stack.
40
 
                
41
 
                Parameters:
42
 
                        message -- string containing the new message to be added to the StatusBar.
43
 
                        
44
 
                Return:
45
 
                        the value of the next valid message ID.
46
 
                """
47
 
                # increment message_id - this will be key for
48
 
                # message and highest message_id will be 'top of stack'
49
 
                self.latest_id += 1
50
 
                self.stack[self.latest_id] = message
51
 
                self.DisplayTopOfStack()
52
 
                
53
 
                return self.latest_id
54
 
        
55
 
        #_____________________________________________________________________
56
 
 
57
 
        def Remove(self, message_id):
58
 
                """
59
 
                Removes a new message from the messages stack.
60
 
                
61
 
                Parameters:
62
 
                        message_id -- numerical id of the message to be removed from the StatusBar.
63
 
                """
64
 
                # remove message from stack (first check if it's really there)
65
 
                if message_id in self.stack:
66
 
                        del self.stack[message_id]
67
 
                        
68
 
                self.DisplayTopOfStack()
69
 
                
70
 
        #_____________________________________________________________________
71
 
 
72
 
        def DisplayTopOfStack(self):
73
 
                """
74
 
                Updates the StatusBar display when a message is added or removed.
75
 
                """
76
 
                # if stack is now empty then clear status bar
77
 
                if len(self.stack) == 0:
78
 
                        self.label.set_markup("")
79
 
                        return
80
 
                
81
 
                # find the message at the top of the stack and display it
82
 
                self.label.set_markup(self.stack[max(self.stack.keys())])
83
 
                
84
 
        #_____________________________________________________________________
85
 
 
86
 
#=========================================================================