Back to index

python3.2  3.2.2
Public Member Functions | Private Attributes
pynche.Switchboard.Switchboard Class Reference

List of all members.

Public Member Functions

def __init__
def add_view
def update_views
def update_views_current
def current_rgb
def colordb
def set_colordb
def optiondb
def save_views
def withdraw_views
def canceled
def canceled_p

Private Attributes

 __initfile
 __colordb
 __optiondb
 __views
 __red
 __green
 __blue
 __canceled

Detailed Description

Definition at line 49 of file Switchboard.py.


Constructor & Destructor Documentation

def pynche.Switchboard.Switchboard.__init__ (   self,
  initfile 
)

Definition at line 50 of file Switchboard.py.

00050 
00051     def __init__(self, initfile):
00052         self.__initfile = initfile
00053         self.__colordb = None
00054         self.__optiondb = {}
00055         self.__views = []
00056         self.__red = 0
00057         self.__green = 0
00058         self.__blue = 0
00059         self.__canceled = 0
00060         # read the initialization file
00061         fp = None
00062         if initfile:
00063             try:
00064                 try:
00065                     fp = open(initfile, 'rb')
00066                     self.__optiondb = marshal.load(fp)
00067                     if not isinstance(self.__optiondb, dict):
00068                         print('Problem reading options from file:', initfile,
00069                               file=sys.stderr)
00070                         self.__optiondb = {}
00071                 except (IOError, EOFError, ValueError):
00072                     pass
00073             finally:
00074                 if fp:
00075                     fp.close()

Here is the caller graph for this function:


Member Function Documentation

def pynche.Switchboard.Switchboard.add_view (   self,
  view 
)

Definition at line 76 of file Switchboard.py.

00076 
00077     def add_view(self, view):
00078         self.__views.append(view)

def pynche.Switchboard.Switchboard.canceled (   self,
  flag = 1 
)

Definition at line 134 of file Switchboard.py.

00134 
00135     def canceled(self, flag=1):
00136         self.__canceled = flag

Definition at line 137 of file Switchboard.py.

00137 
00138     def canceled_p(self):
00139         return self.__canceled

Definition at line 92 of file Switchboard.py.

00092 
00093     def colordb(self):
00094         return self.__colordb

Definition at line 89 of file Switchboard.py.

00089 
00090     def current_rgb(self):
00091         return self.__red, self.__green, self.__blue

Definition at line 102 of file Switchboard.py.

00102 
00103     def optiondb(self):
00104         return self.__optiondb

Definition at line 105 of file Switchboard.py.

00105 
00106     def save_views(self):
00107         # save the current color
00108         self.__optiondb['RED'] = self.__red
00109         self.__optiondb['GREEN'] = self.__green
00110         self.__optiondb['BLUE'] = self.__blue
00111         for v in self.__views:
00112             if hasattr(v, 'save_options'):
00113                 v.save_options(self.__optiondb)
00114         # save the name of the file used for the color database.  we'll try to
00115         # load this first.
00116         self.__optiondb['DBFILE'] = self.__colordb.filename()
00117         fp = None
00118         try:
00119             try:
00120                 fp = open(self.__initfile, 'wb')
00121             except IOError:
00122                 print('Cannot write options to file:', \
00123                       self.__initfile, file=sys.stderr)
00124             else:
00125                 marshal.dump(self.__optiondb, fp)
00126         finally:
00127             if fp:
00128                 fp.close()

def pynche.Switchboard.Switchboard.set_colordb (   self,
  colordb 
)

Definition at line 95 of file Switchboard.py.

00095 
00096     def set_colordb(self, colordb):
00097         self.__colordb = colordb
00098         for v in self.__views:
00099             if hasattr(v, 'colordb_changed'):
00100                 v.colordb_changed(colordb)
00101         self.update_views_current()

Here is the call graph for this function:

def pynche.Switchboard.Switchboard.update_views (   self,
  red,
  green,
  blue 
)

Definition at line 79 of file Switchboard.py.

00079 
00080     def update_views(self, red, green, blue):
00081         self.__red = red
00082         self.__green = green
00083         self.__blue = blue
00084         for v in self.__views:
00085             v.update_yourself(red, green, blue)

Here is the caller graph for this function:

Definition at line 86 of file Switchboard.py.

00086 
00087     def update_views_current(self):
00088         self.update_views(self.__red, self.__green, self.__blue)

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 129 of file Switchboard.py.

00129 
00130     def withdraw_views(self):
00131         for v in self.__views:
00132             if hasattr(v, 'withdraw'):
00133                 v.withdraw()


Member Data Documentation

Definition at line 57 of file Switchboard.py.

Definition at line 58 of file Switchboard.py.

Definition at line 52 of file Switchboard.py.

Definition at line 56 of file Switchboard.py.

Definition at line 51 of file Switchboard.py.

Definition at line 53 of file Switchboard.py.

Definition at line 55 of file Switchboard.py.

Definition at line 54 of file Switchboard.py.


The documentation for this class was generated from the following file: