Commits

marcus  committed 4a852f2

Added get_arraytype() to sndarray and surfarray for querying the active array type. Renamed use_array() to use_arraytype().

  • Participants
  • Parent commits 9c1cb81

Comments (0)

Files changed (4)

File lib/sndarray.doc

 as default if installed. If neither Numeric nor numpy are installed, the
 module will raise an ImportError.
 
-The array type to use can be changed at runtime using the use_array()
+The array type to use can be changed at runtime using the use_arraytype()
 method, which requires one of the above types as string.
 
 Note: numpy and Numeric are not completely compatible. Certain array
 format.
 <END>
 
-use_array
+use_arraytype
 Sets the array system to be used for sound arrays
-pygame.sndarray.use_array (arraytype): return None
+pygame.sndarray.use_arraytype (arraytype): return None
 
 Uses the requested array type for the module functions.
 Currently supported array types are:
 New in pygame 1.8.
 <END>
 
+get_arraytype
+Gets the currently active array type.
+pygame.sndarray.get_arraytype (): return str
+
+Returns the currently active array type. This will be a value of the
+get_arraytypes() tuple and indicates which type of array module is used
+for the array creation.
+
+New in pygame 1.8
+<END>
+
 get_arraytypes
 Gets the array system types currently supported.
 pygame.sndarray.get_arraytypes (): return tuple
 
 Checks, which array systems are available and returns them as a tuple of
 strings. The values of the tuple can be used directly in the
-pygame.sndarray.use_array() method. If no supported array system could
-be found, None will be returned.
+pygame.sndarray.use_arraytype () method. If no supported array system
+could be found, None will be returned.
 
 New in pygame 1.8.
 <END>

File lib/sndarray.py

 as default if installed. If neither Numeric nor numpy are installed, the
 module will raise an ImportError.
 
-The array type to use can be changed at runtime using the use_array()
+The array type to use can be changed at runtime using the use_arraytype()
 method, which requires one of the above types as string.
 
 Note: numpy and Numeric are not completely compatible. Certain array
 
 import pygame
 
-# Global array type setting. See use_array().
+# Global array type setting. See use_arraytype().
 __arraytype = None
 
 # Try to import the necessary modules.
         return numpysnd.make_sound (array)
     raise NotImplementedError, "sound arrays are not supported"
 
-def use_array (arraytype):
-    """pygame.sndarray.use_array (arraytype): return None
+def use_arraytype (arraytype):
+    """pygame.sndarray.use_arraytype (arraytype): return None
 
     Sets the array system to be used for sound arrays.
 
     else:
         raise ValueError, "invalid array type"
 
+def get_arraytype ():
+    """pygame.sndarray.get_arraytype (): return str
+
+    Gets the currently active array type.
+
+    Returns the currently active array type. This will be a value of the
+    get_arraytypes() tuple and indicates which type of array module is
+    used for the array creation.
+    """
+    return __arraytype
+
 def get_arraytypes ():
     """pygame.sndarray.get_arraytypes (): return tuple
 
 
     Checks, which array system types are available and returns them as a
     tuple of strings. The values of the tuple can be used directly in
-    the use_array () method.
+    the use_arraytype () method.
 
     If no supported array system could be found, None will be returned.
     """

File lib/surfarray.doc

 as default if installed. If neither Numeric nor numpy are installed, the
 module will raise an ImportError.
 
-The array type to use can be changed at runtime using the use_array()
+The array type to use can be changed at runtime using the use_arraytype ()
 method, which requires one of the above types as string.
 
 Note: numpy and Numeric are not completely compatible. Certain array
 supported.
 <END>
 
-use_array
+use_arraytype
 Sets the array system to be used for surface arrays
-pygame.surfarray.use_array (arraytype): return None
+pygame.surfarray.use_arraytype (arraytype): return None
 
 Uses the requested array type for the module functions.
 Currently supported array types are:
 New in pygame 1.8.
 <END>
 
+get_arraytype
+Gets the currently active array type.
+pygame.surfarray.get_arraytype (): return str
+
+Returns the currently active array type. This will be a value of the
+get_arraytypes() tuple and indicates which type of array module is used
+for the array creation.
+
+New in pygame 1.8
+<END>
+
 get_arraytypes
 Gets the array system types currently supported.
 pygame.surfarray.get_arraytypes (): return tuple
 
 Checks, which array systems are available and returns them as a tuple of
 strings. The values of the tuple can be used directly in the
-pygame.surfarray.use_array() method. If no supported array system could
+pygame.surfarray.use_arraytype () method. If no supported array system could
 be found, None will be returned.
 
 New in pygame 1.8.

File lib/surfarray.py

 as default if installed. If neither Numeric nor numpy are installed, the
 module will raise an ImportError.
 
-The array type to use can be changed at runtime using the use_array()
+The array type to use can be changed at runtime using the use_arraytype()
 method, which requires one of the above types as string.
 
 Note: numpy and Numeric are not completely compatible. Certain array
 
 import pygame
 
-# Global array type setting. See use_array().
+# Global array type setting. See use_arraytype().
 __arraytype = None
 
 # Try to import the necessary modules.
         return numpysf.map_array (surface, array)
     raise NotImplementedError, "surface arrays are not supported"
 
-def use_array (arraytype):
-    """pygame.surfarray.use_array (arraytype): return None
+def use_arraytype (arraytype):
+    """pygame.surfarray.use_arraytype (arraytype): return None
 
     Sets the array system to be used for surface arrays.
 
     else:
         raise ValueError, "invalid array type"
 
+def get_arraytype ():
+    """pygame.surfarray.get_arraytype (): return str
+
+    Gets the currently active array type.
+
+    Returns the currently active array type. This will be a value of the
+    get_arraytypes() tuple and indicates which type of array module is
+    used for the array creation.
+    """
+    return __arraytype
+
 def get_arraytypes ():
     """pygame.surfarray.get_arraytypes (): return tuple
 
 
     Checks, which array system types are available and returns them as a
     tuple of strings. The values of the tuple can be used directly in
-    the use_array () method.
+    the use_arraytype () method.
 
     If no supported array system could be found, None will be returned.
     """
     if len (vals) == 0:
         return None
     return tuple (vals)
+