home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / var / lib / python-support / python2.6 / glchess / ui / ui.pyc (.txt) < prev   
Encoding:
Python Compiled Bytecode  |  2009-04-20  |  23.4 KB  |  650 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. '''
  5. '''
  6. __author__ = 'Robert Ancell <bob27@users.sourceforge.net>'
  7. __license__ = 'GNU General Public License Version 2'
  8. __copyright__ = 'Copyright 2005-2006  Robert Ancell'
  9.  
  10. class Player:
  11.     name = ''
  12.     type = ''
  13.     level = ''
  14.  
  15.  
  16. class Game:
  17.     name = ''
  18.     path = None
  19.     duration = 0
  20.     allowSpectators = False
  21.     
  22.     def __init__(self):
  23.         self.white = Player()
  24.         self.black = Player()
  25.         self.moves = []
  26.  
  27.  
  28.  
  29. class NetworkFeedback:
  30.     '''Template class for feedback from a network game selector'''
  31.     
  32.     def addProfile(self, profile):
  33.         if not False:
  34.             raise AssertionError
  35.  
  36.     
  37.     def setProfile(self, profile):
  38.         if not False:
  39.             raise AssertionError
  40.  
  41.     
  42.     def joinRoom(self, room):
  43.         if not False:
  44.             raise AssertionError
  45.  
  46.     
  47.     def joinTable(self, table):
  48.         if not False:
  49.             raise AssertionError
  50.  
  51.  
  52.  
  53. class NetworkController:
  54.     ''
  55.     
  56.     def setVisible(self, isVisible):
  57.         if not False:
  58.             raise AssertionError
  59.  
  60.     
  61.     def addProfile(self, profile, name):
  62.         if not False:
  63.             raise AssertionError
  64.  
  65.     
  66.     def setBusy(self, isBusy):
  67.         if not False:
  68.             raise AssertionError
  69.  
  70.     
  71.     def addChat(self, user, channel, text):
  72.         '''Add chat 
  73.         '''
  74.         if not False:
  75.             raise AssertionError
  76.  
  77.     
  78.     def addRoom(self, index, name, description, room, protocol):
  79.         """Add a game room.
  80.         
  81.         'index' ???
  82.         'name' is the name of the room (string).
  83.         'description' is a description of the room (string).
  84.         'room' is the room to add (user-defined)
  85.         'protocol' ???
  86.         """
  87.         if not False:
  88.             raise AssertionError
  89.  
  90.     
  91.     def removeRoom(self, room):
  92.         if not False:
  93.             raise AssertionError
  94.  
  95.     
  96.     def clearRooms(self):
  97.         if not False:
  98.             raise AssertionError
  99.  
  100.     
  101.     def addTable(self, name, table):
  102.         if not False:
  103.             raise AssertionError
  104.  
  105.     
  106.     def removeTable(self, table):
  107.         if not False:
  108.             raise AssertionError
  109.  
  110.     
  111.     def clearTables(self):
  112.         if not False:
  113.             raise AssertionError
  114.  
  115.     
  116.     def addPlayer(self, player, name, icon):
  117.         if not False:
  118.             raise AssertionError
  119.  
  120.     
  121.     def removePlayer(self, player):
  122.         if not False:
  123.             raise AssertionError
  124.  
  125.     
  126.     def clearPlayers(self):
  127.         if not False:
  128.             raise AssertionError
  129.  
  130.     
  131.     def addAdvert(self, title, rating, advert):
  132.         """Add a game advert.
  133.         
  134.         'title' is the title of the advert (string).
  135.         'rating' is the rating for this game (string).
  136.         'advert' is an object to key this advert with (user-defined).
  137.         """
  138.         if not False:
  139.             raise AssertionError
  140.  
  141.     
  142.     def removeAdvert(self, advert):
  143.         """Remove a game advert.
  144.         
  145.         'advert' is an object that was passed into addAdvert().
  146.         """
  147.         if not False:
  148.             raise AssertionError
  149.  
  150.     
  151.     def requestGame(self, gameName):
  152.         """Request this player joins a game.
  153.         
  154.         'gameName' is the name of the game this player requested to join (string).
  155.         """
  156.         if not False:
  157.             raise AssertionError
  158.  
  159.  
  160.  
  161. class ViewFeedback:
  162.     '''Template class for feedback from a view object'''
  163.     
  164.     def showMoveHints(self, showHints):
  165.         """Configure move hinting.
  166.         
  167.         'showHints' sets if move hints should be shown (boolean).
  168.         """
  169.         if not False:
  170.             raise AssertionError
  171.  
  172.     
  173.     def showSmooth(self, doNumbering):
  174.         pass
  175.  
  176.     
  177.     def saveGame(self, path):
  178.         """Called when the user requests the game in this view to be saved.
  179.         
  180.         'path' is the path to the file to save to (string).
  181.         
  182.         Returns the error that occured (string) or None if successful.
  183.         """
  184.         if not False:
  185.             raise AssertionError
  186.  
  187.     
  188.     def renderGL(self):
  189.         '''Render the scene using OpenGL'''
  190.         if not False:
  191.             raise AssertionError
  192.  
  193.     
  194.     def renderCairoStatic(self, context):
  195.         """Render the static elements of the scene.
  196.         
  197.         'context' is the cairo context to modify.
  198.         
  199.         Return False if the static elements have not changed otherwise True.
  200.         """
  201.         if not False:
  202.             raise AssertionError
  203.  
  204.     
  205.     def renderCairoDynamic(self, context):
  206.         """Render the dynamic elements of the scene.
  207.         
  208.         'context' is the cairo context to modify.
  209.         """
  210.         if not False:
  211.             raise AssertionError
  212.  
  213.     
  214.     def reshape(self, width, height):
  215.         """This method is called when the UI resizes the scene.
  216.         
  217.         'width' is the new width of the scene in pixels (integer).
  218.         'height' is the new height of the scene in pixels (integer).
  219.         """
  220.         if not False:
  221.             raise AssertionError
  222.  
  223.     
  224.     def select(self, x, y):
  225.         """This method is called when the UI selects a position on the scene.
  226.         
  227.         'x' is the horizontal pixel location when the user has selected (integer, 0 = left pixel).
  228.         'y' is the vertical pixel location when the user has selected (integer, 0 = top pixel).
  229.         """
  230.         if not False:
  231.             raise AssertionError
  232.  
  233.     
  234.     def deselect(self, x, y):
  235.         """This method is called when the UI deselects a position on the scene.
  236.         
  237.         'x' is the horizontal pixel location when the user has selected (integer, 0 = left pixel).
  238.         'y' is the vertical pixel location when the user has selected (integer, 0 = top pixel).
  239.         """
  240.         if not False:
  241.             raise AssertionError
  242.  
  243.     
  244.     def setMoveNumber(self, moveNumber):
  245.         """This method is called when the UI changes the move to render.
  246.         
  247.         'moveNumber' is the moveNumber to watch (integer, negative numbers index from latest move).
  248.         """
  249.         if not False:
  250.             raise AssertionError
  251.  
  252.     
  253.     def getFileName(self):
  254.         '''Get the file name to save to.
  255.         
  256.         Returns the file name (string) or None if game is not saved.
  257.         '''
  258.         if not False:
  259.             raise AssertionError
  260.  
  261.     
  262.     def save(self, filename = None):
  263.         """Save the game using this view.
  264.         
  265.         'filename' is the file to save to (string or None to save to last filename).
  266.         """
  267.         if not False:
  268.             raise AssertionError
  269.  
  270.     
  271.     def undo(self):
  272.         '''Indicates the human player wants to undo their last move'''
  273.         if not False:
  274.             raise AssertionError
  275.  
  276.     
  277.     def regsign(self):
  278.         '''Indicates the human player wants to resign'''
  279.         if not False:
  280.             raise AssertionError
  281.  
  282.     
  283.     def claimDraw(self):
  284.         '''Indicates the human player wants to claim a draw'''
  285.         if not False:
  286.             raise AssertionError
  287.  
  288.  
  289.  
  290. class ViewController:
  291.     '''Template class for methods to control a view'''
  292.     
  293.     def setTitle(self, title):
  294.         """Set the title for this view.
  295.         
  296.         'title' is the title to use (string).
  297.         """
  298.         if not False:
  299.             raise AssertionError
  300.  
  301.     
  302.     def setNeedsSaving(self, needsSaving):
  303.         """Mark if this view needs saving.
  304.         
  305.         'needsSaving' True if this view needs saving.
  306.         """
  307.         if not False:
  308.             raise AssertionError
  309.  
  310.     
  311.     def addMove(self, move):
  312.         """Register a move with this view.
  313.         
  314.         'move' is the move made (string).
  315.         """
  316.         if not False:
  317.             raise AssertionError
  318.  
  319.     
  320.     def undoMove(self):
  321.         '''Remove the last move from this view'''
  322.         if not False:
  323.             raise AssertionError
  324.  
  325.     
  326.     def render(self):
  327.         '''Request this view is redrawn'''
  328.         if not False:
  329.             raise AssertionError
  330.  
  331.     
  332.     def setWhiteTimer(self, total, remaining):
  333.         """Set the time remaining for the white player.
  334.         
  335.         'total' FIXME TODO
  336.         'remaining' FIXME TODO
  337.         """
  338.         if not False:
  339.             raise AssertionError
  340.  
  341.     
  342.     def setBlackTimer(self, total, remaining):
  343.         """Set the time remaining for the black player.
  344.         
  345.         'total' FIXME TODO
  346.         'remaining' FIXME TODO
  347.         """
  348.         if not False:
  349.             raise AssertionError
  350.  
  351.     
  352.     def setAttention(self, requiresAttention):
  353.         """Get the users attention for this view.
  354.         
  355.         'requiresAttention' is a flag to show if this view requires attention.
  356.         """
  357.         if not False:
  358.             raise AssertionError
  359.  
  360.  
  361.  
  362. class UIFeedback:
  363.     '''Template class for feedback from a UI'''
  364.     
  365.     def onAnimate(self, timeStep):
  366.         """Called when an animation tick occurs.
  367.         
  368.         'timeStep' is the time between the last call to this method in seconds (float).
  369.         
  370.         Return True if animation should continue otherwise False
  371.         """
  372.         if not False:
  373.             raise AssertionError
  374.  
  375.     
  376.     def onReadFileDescriptor(self, fd):
  377.         """Called when a file descriptor is able to be read.
  378.         
  379.         'fd' is the file descriptor with available data to read (integer).
  380.         
  381.         Return False when finished otherwise True.
  382.         """
  383.         if not False:
  384.             raise AssertionError
  385.  
  386.     
  387.     def onWriteFileDescriptor(self, fd):
  388.         """Called when a file descriptor can be written to.
  389.         
  390.         'fd' is the file descriptor that can be written to (integer).
  391.         
  392.         Return False if writing is completed otherwise True
  393.         """
  394.         return False
  395.  
  396.     
  397.     def onGameStart(self, game):
  398.         """Called when a local game is started.
  399.         
  400.         'game' is the game propertied (Game).
  401.         """
  402.         if not False:
  403.             raise AssertionError
  404.  
  405.     
  406.     def loadGame(self, path):
  407.         """Called when a game is loaded.
  408.         
  409.         'path' is the path to the game to load (string).
  410.         
  411.         Returns the error that occured (string) or None if successful.
  412.         """
  413.         if not False:
  414.             raise AssertionError
  415.  
  416.     
  417.     def onNewNetworkGame(self):
  418.         '''
  419.         '''
  420.         if not False:
  421.             raise AssertionError
  422.  
  423.     
  424.     def onQuit(self):
  425.         '''Called when the user quits the program'''
  426.         if not False:
  427.             raise AssertionError
  428.  
  429.  
  430.  
  431. class TimerFeedback:
  432.     '''
  433.     '''
  434.     
  435.     def onTick(self, time):
  436.         """Called when the timer hits a one second boundary.
  437.         
  438.         'time' is the boundary time in seconds.
  439.         """
  440.         if not False:
  441.             raise AssertionError
  442.  
  443.     
  444.     def onExpired(self):
  445.         '''Called when this timer expires'''
  446.         if not False:
  447.             raise AssertionError
  448.  
  449.  
  450.  
  451. class Timer:
  452.     '''
  453.     '''
  454.     
  455.     def getRemaining(self):
  456.         '''Get the amount of time remaining on this clock.
  457.         
  458.         returns the amount of time in milliseconds (int)
  459.         '''
  460.         if not False:
  461.             raise AssertionError
  462.  
  463.     
  464.     def pause(self):
  465.         '''Stop this timer from counting down'''
  466.         if not False:
  467.             raise AssertionError
  468.  
  469.     
  470.     def run(self):
  471.         '''Continue counting down'''
  472.         if not False:
  473.             raise AssertionError
  474.  
  475.     
  476.     def delete(self):
  477.         '''Delete this timer'''
  478.         if not False:
  479.             raise AssertionError
  480.  
  481.  
  482.  
  483. class Log:
  484.     '''
  485.     '''
  486.     
  487.     def addBinary(self, data, style = None):
  488.         '''
  489.         '''
  490.         if not False:
  491.             raise AssertionError
  492.  
  493.     
  494.     def addText(self, text, style = None):
  495.         '''
  496.         '''
  497.         if not False:
  498.             raise AssertionError
  499.  
  500.     
  501.     def addLine(self, text, style = None):
  502.         '''
  503.         '''
  504.         if not False:
  505.             raise AssertionError
  506.  
  507.     
  508.     def close(self):
  509.         '''
  510.         '''
  511.         if not False:
  512.             raise AssertionError
  513.  
  514.  
  515. SAVE_YES = 'SAVE_YES'
  516. SAVE_NO = 'SAVE_NO'
  517. SAVE_ABORT = 'SAVE_ABORT'
  518.  
  519. class UI:
  520.     '''Template class for a glChess UI.
  521.     '''
  522.     
  523.     def __init__(self, feedback):
  524.         """Constructor.
  525.         
  526.         'feedback' is the feedback object for this UI to report with (extends UIFeedback).
  527.         """
  528.         if not False:
  529.             raise AssertionError
  530.  
  531.     
  532.     def addLogWindow(self, title, executable, description):
  533.         if not False:
  534.             raise AssertionError
  535.  
  536.     
  537.     def startAnimation(self):
  538.         '''Start the animation callback'''
  539.         if not False:
  540.             raise AssertionError
  541.  
  542.     
  543.     def watchFileDescriptor(self, fd):
  544.         """Notify when a file descriptor is able to be read.
  545.         
  546.         'fd' is the file descriptor to watch (integer).
  547.         
  548.         When data is available onReadFileDescriptor() is called.
  549.         """
  550.         if not False:
  551.             raise AssertionError
  552.  
  553.     
  554.     def unwatchFileDescriptor(self, fd):
  555.         if not False:
  556.             raise AssertionError
  557.  
  558.     
  559.     def writeFileDescriptor(self, fd):
  560.         """Notify when a file descriptor can be written to.
  561.         
  562.         'fd' is the file descriptor to write (integer).
  563.         
  564.         When data can be written onWriteFileDescriptor is called.
  565.         """
  566.         if not False:
  567.             raise AssertionError
  568.  
  569.     
  570.     def addTimer(self, feedback, duration):
  571.         """Add a timer.
  572.         
  573.         'feedback' is an object containing methods to call for feedback (extends TimerFeedback).
  574.         'duration' is the period to call this method at in seconds (integer).
  575.         
  576.         returns a timer object to control this timer (extends Timer).
  577.         """
  578.         if not False:
  579.             raise AssertionError
  580.  
  581.     
  582.     def setView(self, title, feedback, isPlayable = True):
  583.         """Set the view to display.
  584.         
  585.         'title' is the title for the view (string).
  586.         'feedback' is a object to report view events with (extends ViewFeedback).
  587.         'isPlayable' is True if this view can be played.
  588.         
  589.         Returns a view controller object (extends ViewController).
  590.         """
  591.         if not False:
  592.             raise AssertionError
  593.  
  594.     
  595.     def addNetworkDialog(self, feedback):
  596.         """
  597.         'feedback' is a object to report view events with (extends NetworkFeedback).
  598.         
  599.         Returns a network controller object (excends NetworkController).
  600.         """
  601.         if not False:
  602.             raise AssertionError
  603.  
  604.     
  605.     def reportGameLoaded(self, game):
  606.         """Report a loaded game as required by onGameLoad().
  607.         
  608.         'game' is the game properties (Game).
  609.         """
  610.         if not False:
  611.             raise AssertionError
  612.  
  613.     
  614.     def addNetworkGame(self, name, game):
  615.         """Report a detected network game.
  616.         
  617.         'name' is the name of the network game (string).
  618.         'game' is the game detected (user-defined).
  619.         """
  620.         if not False:
  621.             raise AssertionError
  622.  
  623.     
  624.     def removeNetworkGame(self, game):
  625.         """Report a network game as terminated.
  626.         
  627.         'game' is the game that has removed (as registered with addNetworkGame()).
  628.         """
  629.         if not False:
  630.             raise AssertionError
  631.  
  632.     
  633.     def requestSave(self, title):
  634.         """Request a game is saved.
  635.         
  636.         'title' is the request to make to the user.
  637.         
  638.         Returns SAVE_YES, SAVE_NO or SAVE_ABORT.
  639.         """
  640.         if not False:
  641.             raise AssertionError
  642.  
  643.     
  644.     def close(self):
  645.         '''Report the application has ended'''
  646.         if not False:
  647.             raise AssertionError
  648.  
  649.  
  650.