|
@@ -1,16 +1,20 @@
|
|
|
-
|
|
|
|
|
-"""DirectNotify module: this module contains the DirectNotify class"""
|
|
|
|
|
|
|
+"""
|
|
|
|
|
+DirectNotify module: this module contains the DirectNotify class
|
|
|
|
|
+"""
|
|
|
|
|
|
|
|
import Notifier
|
|
import Notifier
|
|
|
import Logger
|
|
import Logger
|
|
|
|
|
|
|
|
class DirectNotify:
|
|
class DirectNotify:
|
|
|
- """DirectNotify class: this class contains methods for creating
|
|
|
|
|
- mulitple notify categories via a dictionary of Notifiers."""
|
|
|
|
|
|
|
+ """
|
|
|
|
|
+ DirectNotify class: this class contains methods for creating
|
|
|
|
|
+ mulitple notify categories via a dictionary of Notifiers.
|
|
|
|
|
+ """
|
|
|
|
|
|
|
|
def __init__(self):
|
|
def __init__(self):
|
|
|
- """__init__(self)
|
|
|
|
|
- DirectNotify class keeps a dictionary of Notfiers"""
|
|
|
|
|
|
|
+ """
|
|
|
|
|
+ DirectNotify class keeps a dictionary of Notfiers
|
|
|
|
|
+ """
|
|
|
self.__categories = { }
|
|
self.__categories = { }
|
|
|
# create a default log file
|
|
# create a default log file
|
|
|
self.logger = Logger.Logger()
|
|
self.logger = Logger.Logger()
|
|
@@ -21,25 +25,29 @@ class DirectNotify:
|
|
|
self.streamWriter = None
|
|
self.streamWriter = None
|
|
|
|
|
|
|
|
def __str__(self):
|
|
def __str__(self):
|
|
|
- """__str__(self)
|
|
|
|
|
- Print handling routine"""
|
|
|
|
|
|
|
+ """
|
|
|
|
|
+ Print handling routine
|
|
|
|
|
+ """
|
|
|
return "DirectNotify categories: %s" % (self.__categories)
|
|
return "DirectNotify categories: %s" % (self.__categories)
|
|
|
|
|
|
|
|
#getters and setters
|
|
#getters and setters
|
|
|
def getCategories(self):
|
|
def getCategories(self):
|
|
|
- """getCategories(self)
|
|
|
|
|
- Return list of category dictionary keys"""
|
|
|
|
|
|
|
+ """
|
|
|
|
|
+ Return list of category dictionary keys
|
|
|
|
|
+ """
|
|
|
return (self.__categories.keys())
|
|
return (self.__categories.keys())
|
|
|
|
|
|
|
|
def getCategory(self, categoryName):
|
|
def getCategory(self, categoryName):
|
|
|
"""getCategory(self, string)
|
|
"""getCategory(self, string)
|
|
|
- Return the category with given name if present, None otherwise"""
|
|
|
|
|
|
|
+ Return the category with given name if present, None otherwise
|
|
|
|
|
+ """
|
|
|
return (self.__categories.get(categoryName, None))
|
|
return (self.__categories.get(categoryName, None))
|
|
|
|
|
|
|
|
def newCategory(self, categoryName, logger=None):
|
|
def newCategory(self, categoryName, logger=None):
|
|
|
"""newCategory(self, string)
|
|
"""newCategory(self, string)
|
|
|
Make a new notify category named categoryName. Return new category
|
|
Make a new notify category named categoryName. Return new category
|
|
|
- if no such category exists, else return existing category"""
|
|
|
|
|
|
|
+ if no such category exists, else return existing category
|
|
|
|
|
+ """
|
|
|
if (not self.__categories.has_key(categoryName)):
|
|
if (not self.__categories.has_key(categoryName)):
|
|
|
self.__categories[categoryName] = Notifier.Notifier(categoryName, logger)
|
|
self.__categories[categoryName] = Notifier.Notifier(categoryName, logger)
|
|
|
self.setDconfigLevel(categoryName)
|
|
self.setDconfigLevel(categoryName)
|
|
@@ -54,7 +62,6 @@ class DirectNotify:
|
|
|
to set the notify severity and then set that level. You cannot
|
|
to set the notify severity and then set that level. You cannot
|
|
|
set these until config is set.
|
|
set these until config is set.
|
|
|
"""
|
|
"""
|
|
|
-
|
|
|
|
|
# We cannot check dconfig variables until config has been
|
|
# We cannot check dconfig variables until config has been
|
|
|
# set. Once config is set in ShowBase.py, it tries to set
|
|
# set. Once config is set in ShowBase.py, it tries to set
|
|
|
# all the levels again in case some were created before config
|
|
# all the levels again in case some were created before config
|