MOON
Server: Apache/2.2.34 (Unix) mod_ssl/2.2.34 OpenSSL/0.9.8e-fips-rhel5 mod_bwlimited/1.4 FrontPage/5.0.2.2635
System: Linux server.asjudinet.com 2.6.32-042stab141.3 #1 SMP Fri Nov 15 22:45:34 MSK 2019 i686
User: asjudine (504)
PHP: 5.2.17
Disabled: NONE
Upload Files
File: //proc/self/root/proc/3/cwd/usr/lib/python2.4/site-packages/pynche/Switchboard.pyc
mς
‚=5Dc@s<dZdkZdklZdkZdfd„ƒYZdS(s½Switchboard class.

This class is used to coordinate updates among all Viewers.  Every Viewer must
conform to the following interface:

    - it must include a method called update_yourself() which takes three
      arguments; the red, green, and blue values of the selected color.

    - When a Viewer selects a color and wishes to update all other Views, it
      should call update_views() on the Switchboard object.  Note that the
      Viewer typically does *not* update itself before calling update_views(),
      since this would cause it to get updated twice.

Optionally, Viewers can also implement:

    - save_options() which takes an optiondb (a dictionary).  Store into this
      dictionary any values the Viewer wants to save in the persistent
      ~/.pynche file.  This dictionary is saved using marshal.  The namespace
      for the keys is ad-hoc; make sure you don't clobber some other Viewer's
      keys!

    - withdraw() which takes no arguments.  This is called when Pynche is
      unmapped.  All Viewers should implement this.

    - colordb_changed() which takes a single argument, an instance of
      ColorDB.  This is called whenever the color name database is changed and
      gives a chance for the Viewers to do something on those events.  See
      ListViewer for details.

External Viewers are found dynamically.  Viewer modules should have names such
as FooViewer.py.  If such a named module has a module global variable called
ADDTOVIEW and this variable is true, the Viewer will be added dynamically to
the `View' menu.  ADDTOVIEW contains a string which is used as the menu item
to display the Viewer (one kludge: if the string contains a `%', this is used
to indicate that the next character will get an underline in the menu,
otherwise the first character is underlined).

FooViewer.py should contain a class called FooViewer, and its constructor
should take two arguments, an instance of Switchboard, and optionally a Tk
master window.

N(sDictTypetSwitchboardcBswtZd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Z	d	„Z
d
„Zdd„Zd
„Z
RS(NcCsξ||_d|_h|_g|_d|_d|_d|_	d|_
d}|o•zxyUt|ƒ}t
i|ƒ|_t|itƒp tidI|IJh|_nWntttfj
onXWd|o|iƒnXndS(Nis"Problem reading options from file:(tinitfiletselft_Switchboard__initfiletNonet_Switchboard__colordbt_Switchboard__optiondbt_Switchboard__viewst_Switchboard__redt_Switchboard__greent_Switchboard__bluet_Switchboard__canceledtfptopentmarshaltloadt
isinstancetDictTypetsyststderrtIOErrortEOFErrort
ValueErrortclose(RRR((t6/usr/lib/python2.4/site-packages/pynche/Switchboard.pyt__init__3s,									cCs|ii|ƒdS(N(RRtappendtview(RR((Rtadd_viewMscCsF||_||_||_x$|iD]}|i	|||ƒq%WdS(N(
tredRRtgreenR	tblueR
Rtvtupdate_yourself(RRRRR ((Rtupdate_viewsPs			
cCs |i|i|i|iƒdS(N(RR"RR	R
(R((Rtupdate_views_currentWscCs|i|i|ifS(N(RRR	R
(R((Rtcurrent_rgbZscCs|iS(N(RR(R((Rtcolordb]scCsL||_x2|iD]'}t|dƒo|i|ƒqqW|iƒdS(Ntcolordb_changed(R%RRRR thasattrR&R#(RR%R ((Rtset_colordb`s	
cCs|iS(N(RR(R((RtoptiondbgscCsϊ|i|id<|i|id<|i|id<x5|iD]*}t|dƒo|i|iƒq:q:W|i	i
ƒ|id<d}zYyt
|idƒ}Wn)tj
otidI|iIJnXti|i|ƒWd|o|iƒnXdS(NtREDtGREENtBLUEtsave_optionstDBFILEtwsCannot write options to file:(RRRR	R
RR R'R-RtfilenameRRR
RRRRRtdumpR(RRR ((Rt
save_viewsjs$
cCs6x/|iD]$}t|dƒo|iƒq
q
WdS(Ntwithdraw(RRR R'R3(RR ((Rtwithdraw_views‚s
icCs
||_dS(N(tflagRR(RR5((Rtcanceled‡scCs|iS(N(RR(R((Rt
canceled_pŠs(t__name__t
__module__RRR"R#R$R%R(R)R2R4R6R7(((RR2s										(t__doc__RttypesRRR(RRRR((Rt?*s