source: subversion/applications/routing/pyroute/listable.py @ 8327

Last change on this file since 8327 was 5947, checked in by ojw, 12 years ago

"meta" menu, will list all the modules in use, and allow each one to
display status, memory use, cache size, warnings, etc.

File size: 1.8 KB
Line 
1#!/usr/bin/python
2#-----------------------------------------------------------------------------
3# Interface for things which can be listed
4#
5# Usage:
6#   (base-class for pyroute GUI libraries)
7#-----------------------------------------------------------------------------
8# Copyright 2007, Oliver White
9#
10# This program is free software: you can redistribute it and/or modify
11# it under the terms of the GNU General Public License as published by
12# the Free Software Foundation, either version 3 of the License, or
13# (at your option) any later version.
14#
15# This program is distributed in the hope that it will be useful,
16# but WITHOUT ANY WARRANTY; without even the implied warranty of
17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18# GNU General Public License for more details.
19#
20# You should have received a copy of the GNU General Public License
21# along with this program.  If not, see <http://www.gnu.org/licenses/>.
22#-----------------------------------------------------------------------------
23
24class listable:
25  """Base-class (interface) for anything that can be listed in a menu"""
26  def numItems(self):
27    """Return how many items are available"""
28    return(0)
29 
30  def getItemText(self,n):
31    """Return the label for any item number"""
32    return("-")
33 
34  def getItemStatus(self,n):
35    """Return current status for any item number"""
36    return("-")
37 
38  def isLocation(self,n):
39    """Return true if the item represents a location"""
40    return(False)
41 
42  def getItemLatLon(self,n):
43    """If the item represents a location, return it's position"""
44    return(0,0)
45 
46  def getItemClickable(self,n):
47    """If not a location, return true if the item should have a button to click on"""
48    return(False)
49   
50  def getItemAction(self,n):
51    """If the item isn't a location, return what happens if it's selected"""
52    return("")
53
Note: See TracBrowser for help on using the repository browser.