id
int32
0
252k
repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
236,400
manns/pyspread
pyspread/src/lib/vlc.py
libvlc_media_player_set_video_title_display
def libvlc_media_player_set_video_title_display(p_mi, position, timeout): '''Set if, and how, the video title will be shown when media is played. @param p_mi: the media player. @param position: position at which to display the title, or libvlc_position_disable to prevent the title from being displayed. @param timeout: title display timeout in milliseconds (ignored if libvlc_position_disable). @version: libVLC 2.1.0 or later. ''' f = _Cfunctions.get('libvlc_media_player_set_video_title_display', None) or \ _Cfunction('libvlc_media_player_set_video_title_display', ((1,), (1,), (1,),), None, None, MediaPlayer, Position, ctypes.c_int) return f(p_mi, position, timeout)
python
def libvlc_media_player_set_video_title_display(p_mi, position, timeout): '''Set if, and how, the video title will be shown when media is played. @param p_mi: the media player. @param position: position at which to display the title, or libvlc_position_disable to prevent the title from being displayed. @param timeout: title display timeout in milliseconds (ignored if libvlc_position_disable). @version: libVLC 2.1.0 or later. ''' f = _Cfunctions.get('libvlc_media_player_set_video_title_display', None) or \ _Cfunction('libvlc_media_player_set_video_title_display', ((1,), (1,), (1,),), None, None, MediaPlayer, Position, ctypes.c_int) return f(p_mi, position, timeout)
[ "def", "libvlc_media_player_set_video_title_display", "(", "p_mi", ",", "position", ",", "timeout", ")", ":", "f", "=", "_Cfunctions", ".", "get", "(", "'libvlc_media_player_set_video_title_display'", ",", "None", ")", "or", "_Cfunction", "(", "'libvlc_media_player_set_video_title_display'", ",", "(", "(", "1", ",", ")", ",", "(", "1", ",", ")", ",", "(", "1", ",", ")", ",", ")", ",", "None", ",", "None", ",", "MediaPlayer", ",", "Position", ",", "ctypes", ".", "c_int", ")", "return", "f", "(", "p_mi", ",", "position", ",", "timeout", ")" ]
Set if, and how, the video title will be shown when media is played. @param p_mi: the media player. @param position: position at which to display the title, or libvlc_position_disable to prevent the title from being displayed. @param timeout: title display timeout in milliseconds (ignored if libvlc_position_disable). @version: libVLC 2.1.0 or later.
[ "Set", "if", "and", "how", "the", "video", "title", "will", "be", "shown", "when", "media", "is", "played", "." ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L5530-L5540
236,401
manns/pyspread
pyspread/src/lib/vlc.py
libvlc_set_fullscreen
def libvlc_set_fullscreen(p_mi, b_fullscreen): '''Enable or disable fullscreen. @warning: With most window managers, only a top-level windows can be in full-screen mode. Hence, this function will not operate properly if L{libvlc_media_player_set_xwindow}() was used to embed the video in a non-top-level window. In that case, the embedding window must be reparented to the root window B{before} fullscreen mode is enabled. You will want to reparent it back to its normal parent when disabling fullscreen. @param p_mi: the media player. @param b_fullscreen: boolean for fullscreen status. ''' f = _Cfunctions.get('libvlc_set_fullscreen', None) or \ _Cfunction('libvlc_set_fullscreen', ((1,), (1,),), None, None, MediaPlayer, ctypes.c_int) return f(p_mi, b_fullscreen)
python
def libvlc_set_fullscreen(p_mi, b_fullscreen): '''Enable or disable fullscreen. @warning: With most window managers, only a top-level windows can be in full-screen mode. Hence, this function will not operate properly if L{libvlc_media_player_set_xwindow}() was used to embed the video in a non-top-level window. In that case, the embedding window must be reparented to the root window B{before} fullscreen mode is enabled. You will want to reparent it back to its normal parent when disabling fullscreen. @param p_mi: the media player. @param b_fullscreen: boolean for fullscreen status. ''' f = _Cfunctions.get('libvlc_set_fullscreen', None) or \ _Cfunction('libvlc_set_fullscreen', ((1,), (1,),), None, None, MediaPlayer, ctypes.c_int) return f(p_mi, b_fullscreen)
[ "def", "libvlc_set_fullscreen", "(", "p_mi", ",", "b_fullscreen", ")", ":", "f", "=", "_Cfunctions", ".", "get", "(", "'libvlc_set_fullscreen'", ",", "None", ")", "or", "_Cfunction", "(", "'libvlc_set_fullscreen'", ",", "(", "(", "1", ",", ")", ",", "(", "1", ",", ")", ",", ")", ",", "None", ",", "None", ",", "MediaPlayer", ",", "ctypes", ".", "c_int", ")", "return", "f", "(", "p_mi", ",", "b_fullscreen", ")" ]
Enable or disable fullscreen. @warning: With most window managers, only a top-level windows can be in full-screen mode. Hence, this function will not operate properly if L{libvlc_media_player_set_xwindow}() was used to embed the video in a non-top-level window. In that case, the embedding window must be reparented to the root window B{before} fullscreen mode is enabled. You will want to reparent it back to its normal parent when disabling fullscreen. @param p_mi: the media player. @param b_fullscreen: boolean for fullscreen status.
[ "Enable", "or", "disable", "fullscreen", "." ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L5562-L5576
236,402
manns/pyspread
pyspread/src/lib/vlc.py
libvlc_video_set_key_input
def libvlc_video_set_key_input(p_mi, on): '''Enable or disable key press events handling, according to the LibVLC hotkeys configuration. By default and for historical reasons, keyboard events are handled by the LibVLC video widget. @note: On X11, there can be only one subscriber for key press and mouse click events per window. If your application has subscribed to those events for the X window ID of the video widget, then LibVLC will not be able to handle key presses and mouse clicks in any case. @warning: This function is only implemented for X11 and Win32 at the moment. @param p_mi: the media player. @param on: true to handle key press events, false to ignore them. ''' f = _Cfunctions.get('libvlc_video_set_key_input', None) or \ _Cfunction('libvlc_video_set_key_input', ((1,), (1,),), None, None, MediaPlayer, ctypes.c_uint) return f(p_mi, on)
python
def libvlc_video_set_key_input(p_mi, on): '''Enable or disable key press events handling, according to the LibVLC hotkeys configuration. By default and for historical reasons, keyboard events are handled by the LibVLC video widget. @note: On X11, there can be only one subscriber for key press and mouse click events per window. If your application has subscribed to those events for the X window ID of the video widget, then LibVLC will not be able to handle key presses and mouse clicks in any case. @warning: This function is only implemented for X11 and Win32 at the moment. @param p_mi: the media player. @param on: true to handle key press events, false to ignore them. ''' f = _Cfunctions.get('libvlc_video_set_key_input', None) or \ _Cfunction('libvlc_video_set_key_input', ((1,), (1,),), None, None, MediaPlayer, ctypes.c_uint) return f(p_mi, on)
[ "def", "libvlc_video_set_key_input", "(", "p_mi", ",", "on", ")", ":", "f", "=", "_Cfunctions", ".", "get", "(", "'libvlc_video_set_key_input'", ",", "None", ")", "or", "_Cfunction", "(", "'libvlc_video_set_key_input'", ",", "(", "(", "1", ",", ")", ",", "(", "1", ",", ")", ",", ")", ",", "None", ",", "None", ",", "MediaPlayer", ",", "ctypes", ".", "c_uint", ")", "return", "f", "(", "p_mi", ",", "on", ")" ]
Enable or disable key press events handling, according to the LibVLC hotkeys configuration. By default and for historical reasons, keyboard events are handled by the LibVLC video widget. @note: On X11, there can be only one subscriber for key press and mouse click events per window. If your application has subscribed to those events for the X window ID of the video widget, then LibVLC will not be able to handle key presses and mouse clicks in any case. @warning: This function is only implemented for X11 and Win32 at the moment. @param p_mi: the media player. @param on: true to handle key press events, false to ignore them.
[ "Enable", "or", "disable", "key", "press", "events", "handling", "according", "to", "the", "LibVLC", "hotkeys", "configuration", ".", "By", "default", "and", "for", "historical", "reasons", "keyboard", "events", "are", "handled", "by", "the", "LibVLC", "video", "widget", "." ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L5588-L5603
236,403
manns/pyspread
pyspread/src/lib/vlc.py
libvlc_video_get_size
def libvlc_video_get_size(p_mi, num): '''Get the pixel dimensions of a video. @param p_mi: media player. @param num: number of the video (starting from, and most commonly 0). @return: px pixel width, py pixel height. ''' f = _Cfunctions.get('libvlc_video_get_size', None) or \ _Cfunction('libvlc_video_get_size', ((1,), (1,), (2,), (2,),), None, ctypes.c_int, MediaPlayer, ctypes.c_uint, ctypes.POINTER(ctypes.c_uint), ctypes.POINTER(ctypes.c_uint)) return f(p_mi, num)
python
def libvlc_video_get_size(p_mi, num): '''Get the pixel dimensions of a video. @param p_mi: media player. @param num: number of the video (starting from, and most commonly 0). @return: px pixel width, py pixel height. ''' f = _Cfunctions.get('libvlc_video_get_size', None) or \ _Cfunction('libvlc_video_get_size', ((1,), (1,), (2,), (2,),), None, ctypes.c_int, MediaPlayer, ctypes.c_uint, ctypes.POINTER(ctypes.c_uint), ctypes.POINTER(ctypes.c_uint)) return f(p_mi, num)
[ "def", "libvlc_video_get_size", "(", "p_mi", ",", "num", ")", ":", "f", "=", "_Cfunctions", ".", "get", "(", "'libvlc_video_get_size'", ",", "None", ")", "or", "_Cfunction", "(", "'libvlc_video_get_size'", ",", "(", "(", "1", ",", ")", ",", "(", "1", ",", ")", ",", "(", "2", ",", ")", ",", "(", "2", ",", ")", ",", ")", ",", "None", ",", "ctypes", ".", "c_int", ",", "MediaPlayer", ",", "ctypes", ".", "c_uint", ",", "ctypes", ".", "POINTER", "(", "ctypes", ".", "c_uint", ")", ",", "ctypes", ".", "POINTER", "(", "ctypes", ".", "c_uint", ")", ")", "return", "f", "(", "p_mi", ",", "num", ")" ]
Get the pixel dimensions of a video. @param p_mi: media player. @param num: number of the video (starting from, and most commonly 0). @return: px pixel width, py pixel height.
[ "Get", "the", "pixel", "dimensions", "of", "a", "video", "." ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L5619-L5628
236,404
manns/pyspread
pyspread/src/lib/vlc.py
libvlc_video_get_aspect_ratio
def libvlc_video_get_aspect_ratio(p_mi): '''Get current video aspect ratio. @param p_mi: the media player. @return: the video aspect ratio or NULL if unspecified (the result must be released with free() or L{libvlc_free}()). ''' f = _Cfunctions.get('libvlc_video_get_aspect_ratio', None) or \ _Cfunction('libvlc_video_get_aspect_ratio', ((1,),), string_result, ctypes.c_void_p, MediaPlayer) return f(p_mi)
python
def libvlc_video_get_aspect_ratio(p_mi): '''Get current video aspect ratio. @param p_mi: the media player. @return: the video aspect ratio or NULL if unspecified (the result must be released with free() or L{libvlc_free}()). ''' f = _Cfunctions.get('libvlc_video_get_aspect_ratio', None) or \ _Cfunction('libvlc_video_get_aspect_ratio', ((1,),), string_result, ctypes.c_void_p, MediaPlayer) return f(p_mi)
[ "def", "libvlc_video_get_aspect_ratio", "(", "p_mi", ")", ":", "f", "=", "_Cfunctions", ".", "get", "(", "'libvlc_video_get_aspect_ratio'", ",", "None", ")", "or", "_Cfunction", "(", "'libvlc_video_get_aspect_ratio'", ",", "(", "(", "1", ",", ")", ",", ")", ",", "string_result", ",", "ctypes", ".", "c_void_p", ",", "MediaPlayer", ")", "return", "f", "(", "p_mi", ")" ]
Get current video aspect ratio. @param p_mi: the media player. @return: the video aspect ratio or NULL if unspecified (the result must be released with free() or L{libvlc_free}()).
[ "Get", "current", "video", "aspect", "ratio", "." ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L5676-L5684
236,405
manns/pyspread
pyspread/src/lib/vlc.py
libvlc_video_set_aspect_ratio
def libvlc_video_set_aspect_ratio(p_mi, psz_aspect): '''Set new video aspect ratio. @param p_mi: the media player. @param psz_aspect: new video aspect-ratio or NULL to reset to default @note Invalid aspect ratios are ignored. ''' f = _Cfunctions.get('libvlc_video_set_aspect_ratio', None) or \ _Cfunction('libvlc_video_set_aspect_ratio', ((1,), (1,),), None, None, MediaPlayer, ctypes.c_char_p) return f(p_mi, psz_aspect)
python
def libvlc_video_set_aspect_ratio(p_mi, psz_aspect): '''Set new video aspect ratio. @param p_mi: the media player. @param psz_aspect: new video aspect-ratio or NULL to reset to default @note Invalid aspect ratios are ignored. ''' f = _Cfunctions.get('libvlc_video_set_aspect_ratio', None) or \ _Cfunction('libvlc_video_set_aspect_ratio', ((1,), (1,),), None, None, MediaPlayer, ctypes.c_char_p) return f(p_mi, psz_aspect)
[ "def", "libvlc_video_set_aspect_ratio", "(", "p_mi", ",", "psz_aspect", ")", ":", "f", "=", "_Cfunctions", ".", "get", "(", "'libvlc_video_set_aspect_ratio'", ",", "None", ")", "or", "_Cfunction", "(", "'libvlc_video_set_aspect_ratio'", ",", "(", "(", "1", ",", ")", ",", "(", "1", ",", ")", ",", ")", ",", "None", ",", "None", ",", "MediaPlayer", ",", "ctypes", ".", "c_char_p", ")", "return", "f", "(", "p_mi", ",", "psz_aspect", ")" ]
Set new video aspect ratio. @param p_mi: the media player. @param psz_aspect: new video aspect-ratio or NULL to reset to default @note Invalid aspect ratios are ignored.
[ "Set", "new", "video", "aspect", "ratio", "." ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L5686-L5694
236,406
manns/pyspread
pyspread/src/lib/vlc.py
libvlc_video_get_spu
def libvlc_video_get_spu(p_mi): '''Get current video subtitle. @param p_mi: the media player. @return: the video subtitle selected, or -1 if none. ''' f = _Cfunctions.get('libvlc_video_get_spu', None) or \ _Cfunction('libvlc_video_get_spu', ((1,),), None, ctypes.c_int, MediaPlayer) return f(p_mi)
python
def libvlc_video_get_spu(p_mi): '''Get current video subtitle. @param p_mi: the media player. @return: the video subtitle selected, or -1 if none. ''' f = _Cfunctions.get('libvlc_video_get_spu', None) or \ _Cfunction('libvlc_video_get_spu', ((1,),), None, ctypes.c_int, MediaPlayer) return f(p_mi)
[ "def", "libvlc_video_get_spu", "(", "p_mi", ")", ":", "f", "=", "_Cfunctions", ".", "get", "(", "'libvlc_video_get_spu'", ",", "None", ")", "or", "_Cfunction", "(", "'libvlc_video_get_spu'", ",", "(", "(", "1", ",", ")", ",", ")", ",", "None", ",", "ctypes", ".", "c_int", ",", "MediaPlayer", ")", "return", "f", "(", "p_mi", ")" ]
Get current video subtitle. @param p_mi: the media player. @return: the video subtitle selected, or -1 if none.
[ "Get", "current", "video", "subtitle", "." ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L5696-L5704
236,407
manns/pyspread
pyspread/src/lib/vlc.py
libvlc_video_set_spu
def libvlc_video_set_spu(p_mi, i_spu): '''Set new video subtitle. @param p_mi: the media player. @param i_spu: video subtitle track to select (i_id from track description). @return: 0 on success, -1 if out of range. ''' f = _Cfunctions.get('libvlc_video_set_spu', None) or \ _Cfunction('libvlc_video_set_spu', ((1,), (1,),), None, ctypes.c_int, MediaPlayer, ctypes.c_int) return f(p_mi, i_spu)
python
def libvlc_video_set_spu(p_mi, i_spu): '''Set new video subtitle. @param p_mi: the media player. @param i_spu: video subtitle track to select (i_id from track description). @return: 0 on success, -1 if out of range. ''' f = _Cfunctions.get('libvlc_video_set_spu', None) or \ _Cfunction('libvlc_video_set_spu', ((1,), (1,),), None, ctypes.c_int, MediaPlayer, ctypes.c_int) return f(p_mi, i_spu)
[ "def", "libvlc_video_set_spu", "(", "p_mi", ",", "i_spu", ")", ":", "f", "=", "_Cfunctions", ".", "get", "(", "'libvlc_video_set_spu'", ",", "None", ")", "or", "_Cfunction", "(", "'libvlc_video_set_spu'", ",", "(", "(", "1", ",", ")", ",", "(", "1", ",", ")", ",", ")", ",", "None", ",", "ctypes", ".", "c_int", ",", "MediaPlayer", ",", "ctypes", ".", "c_int", ")", "return", "f", "(", "p_mi", ",", "i_spu", ")" ]
Set new video subtitle. @param p_mi: the media player. @param i_spu: video subtitle track to select (i_id from track description). @return: 0 on success, -1 if out of range.
[ "Set", "new", "video", "subtitle", "." ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L5726-L5735
236,408
manns/pyspread
pyspread/src/lib/vlc.py
libvlc_video_set_subtitle_file
def libvlc_video_set_subtitle_file(p_mi, psz_subtitle): '''Set new video subtitle file. @param p_mi: the media player. @param psz_subtitle: new video subtitle file. @return: the success status (boolean). ''' f = _Cfunctions.get('libvlc_video_set_subtitle_file', None) or \ _Cfunction('libvlc_video_set_subtitle_file', ((1,), (1,),), None, ctypes.c_int, MediaPlayer, ctypes.c_char_p) return f(p_mi, psz_subtitle)
python
def libvlc_video_set_subtitle_file(p_mi, psz_subtitle): '''Set new video subtitle file. @param p_mi: the media player. @param psz_subtitle: new video subtitle file. @return: the success status (boolean). ''' f = _Cfunctions.get('libvlc_video_set_subtitle_file', None) or \ _Cfunction('libvlc_video_set_subtitle_file', ((1,), (1,),), None, ctypes.c_int, MediaPlayer, ctypes.c_char_p) return f(p_mi, psz_subtitle)
[ "def", "libvlc_video_set_subtitle_file", "(", "p_mi", ",", "psz_subtitle", ")", ":", "f", "=", "_Cfunctions", ".", "get", "(", "'libvlc_video_set_subtitle_file'", ",", "None", ")", "or", "_Cfunction", "(", "'libvlc_video_set_subtitle_file'", ",", "(", "(", "1", ",", ")", ",", "(", "1", ",", ")", ",", ")", ",", "None", ",", "ctypes", ".", "c_int", ",", "MediaPlayer", ",", "ctypes", ".", "c_char_p", ")", "return", "f", "(", "p_mi", ",", "psz_subtitle", ")" ]
Set new video subtitle file. @param p_mi: the media player. @param psz_subtitle: new video subtitle file. @return: the success status (boolean).
[ "Set", "new", "video", "subtitle", "file", "." ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L5737-L5746
236,409
manns/pyspread
pyspread/src/lib/vlc.py
libvlc_video_set_spu_delay
def libvlc_video_set_spu_delay(p_mi, i_delay): '''Set the subtitle delay. This affects the timing of when the subtitle will be displayed. Positive values result in subtitles being displayed later, while negative values will result in subtitles being displayed earlier. The subtitle delay will be reset to zero each time the media changes. @param p_mi: media player. @param i_delay: time (in microseconds) the display of subtitles should be delayed. @return: 0 on success, -1 on error. @version: LibVLC 2.0.0 or later. ''' f = _Cfunctions.get('libvlc_video_set_spu_delay', None) or \ _Cfunction('libvlc_video_set_spu_delay', ((1,), (1,),), None, ctypes.c_int, MediaPlayer, ctypes.c_int64) return f(p_mi, i_delay)
python
def libvlc_video_set_spu_delay(p_mi, i_delay): '''Set the subtitle delay. This affects the timing of when the subtitle will be displayed. Positive values result in subtitles being displayed later, while negative values will result in subtitles being displayed earlier. The subtitle delay will be reset to zero each time the media changes. @param p_mi: media player. @param i_delay: time (in microseconds) the display of subtitles should be delayed. @return: 0 on success, -1 on error. @version: LibVLC 2.0.0 or later. ''' f = _Cfunctions.get('libvlc_video_set_spu_delay', None) or \ _Cfunction('libvlc_video_set_spu_delay', ((1,), (1,),), None, ctypes.c_int, MediaPlayer, ctypes.c_int64) return f(p_mi, i_delay)
[ "def", "libvlc_video_set_spu_delay", "(", "p_mi", ",", "i_delay", ")", ":", "f", "=", "_Cfunctions", ".", "get", "(", "'libvlc_video_set_spu_delay'", ",", "None", ")", "or", "_Cfunction", "(", "'libvlc_video_set_spu_delay'", ",", "(", "(", "1", ",", ")", ",", "(", "1", ",", ")", ",", ")", ",", "None", ",", "ctypes", ".", "c_int", ",", "MediaPlayer", ",", "ctypes", ".", "c_int64", ")", "return", "f", "(", "p_mi", ",", "i_delay", ")" ]
Set the subtitle delay. This affects the timing of when the subtitle will be displayed. Positive values result in subtitles being displayed later, while negative values will result in subtitles being displayed earlier. The subtitle delay will be reset to zero each time the media changes. @param p_mi: media player. @param i_delay: time (in microseconds) the display of subtitles should be delayed. @return: 0 on success, -1 on error. @version: LibVLC 2.0.0 or later.
[ "Set", "the", "subtitle", "delay", ".", "This", "affects", "the", "timing", "of", "when", "the", "subtitle", "will", "be", "displayed", ".", "Positive", "values", "result", "in", "subtitles", "being", "displayed", "later", "while", "negative", "values", "will", "result", "in", "subtitles", "being", "displayed", "earlier", ".", "The", "subtitle", "delay", "will", "be", "reset", "to", "zero", "each", "time", "the", "media", "changes", "." ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L5760-L5773
236,410
manns/pyspread
pyspread/src/lib/vlc.py
libvlc_video_get_chapter_description
def libvlc_video_get_chapter_description(p_mi, i_title): '''Get the description of available chapters for specific title. @param p_mi: the media player. @param i_title: selected title. @return: list containing description of available chapter for title i_title. ''' f = _Cfunctions.get('libvlc_video_get_chapter_description', None) or \ _Cfunction('libvlc_video_get_chapter_description', ((1,), (1,),), None, ctypes.POINTER(TrackDescription), MediaPlayer, ctypes.c_int) return f(p_mi, i_title)
python
def libvlc_video_get_chapter_description(p_mi, i_title): '''Get the description of available chapters for specific title. @param p_mi: the media player. @param i_title: selected title. @return: list containing description of available chapter for title i_title. ''' f = _Cfunctions.get('libvlc_video_get_chapter_description', None) or \ _Cfunction('libvlc_video_get_chapter_description', ((1,), (1,),), None, ctypes.POINTER(TrackDescription), MediaPlayer, ctypes.c_int) return f(p_mi, i_title)
[ "def", "libvlc_video_get_chapter_description", "(", "p_mi", ",", "i_title", ")", ":", "f", "=", "_Cfunctions", ".", "get", "(", "'libvlc_video_get_chapter_description'", ",", "None", ")", "or", "_Cfunction", "(", "'libvlc_video_get_chapter_description'", ",", "(", "(", "1", ",", ")", ",", "(", "1", ",", ")", ",", ")", ",", "None", ",", "ctypes", ".", "POINTER", "(", "TrackDescription", ")", ",", "MediaPlayer", ",", "ctypes", ".", "c_int", ")", "return", "f", "(", "p_mi", ",", "i_title", ")" ]
Get the description of available chapters for specific title. @param p_mi: the media player. @param i_title: selected title. @return: list containing description of available chapter for title i_title.
[ "Get", "the", "description", "of", "available", "chapters", "for", "specific", "title", "." ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L5785-L5794
236,411
manns/pyspread
pyspread/src/lib/vlc.py
libvlc_video_set_crop_geometry
def libvlc_video_set_crop_geometry(p_mi, psz_geometry): '''Set new crop filter geometry. @param p_mi: the media player. @param psz_geometry: new crop filter geometry (NULL to unset). ''' f = _Cfunctions.get('libvlc_video_set_crop_geometry', None) or \ _Cfunction('libvlc_video_set_crop_geometry', ((1,), (1,),), None, None, MediaPlayer, ctypes.c_char_p) return f(p_mi, psz_geometry)
python
def libvlc_video_set_crop_geometry(p_mi, psz_geometry): '''Set new crop filter geometry. @param p_mi: the media player. @param psz_geometry: new crop filter geometry (NULL to unset). ''' f = _Cfunctions.get('libvlc_video_set_crop_geometry', None) or \ _Cfunction('libvlc_video_set_crop_geometry', ((1,), (1,),), None, None, MediaPlayer, ctypes.c_char_p) return f(p_mi, psz_geometry)
[ "def", "libvlc_video_set_crop_geometry", "(", "p_mi", ",", "psz_geometry", ")", ":", "f", "=", "_Cfunctions", ".", "get", "(", "'libvlc_video_set_crop_geometry'", ",", "None", ")", "or", "_Cfunction", "(", "'libvlc_video_set_crop_geometry'", ",", "(", "(", "1", ",", ")", ",", "(", "1", ",", ")", ",", ")", ",", "None", ",", "None", ",", "MediaPlayer", ",", "ctypes", ".", "c_char_p", ")", "return", "f", "(", "p_mi", ",", "psz_geometry", ")" ]
Set new crop filter geometry. @param p_mi: the media player. @param psz_geometry: new crop filter geometry (NULL to unset).
[ "Set", "new", "crop", "filter", "geometry", "." ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L5806-L5814
236,412
manns/pyspread
pyspread/src/lib/vlc.py
libvlc_video_set_teletext
def libvlc_video_set_teletext(p_mi, i_page): '''Set new teletext page to retrieve. @param p_mi: the media player. @param i_page: teletex page number requested. ''' f = _Cfunctions.get('libvlc_video_set_teletext', None) or \ _Cfunction('libvlc_video_set_teletext', ((1,), (1,),), None, None, MediaPlayer, ctypes.c_int) return f(p_mi, i_page)
python
def libvlc_video_set_teletext(p_mi, i_page): '''Set new teletext page to retrieve. @param p_mi: the media player. @param i_page: teletex page number requested. ''' f = _Cfunctions.get('libvlc_video_set_teletext', None) or \ _Cfunction('libvlc_video_set_teletext', ((1,), (1,),), None, None, MediaPlayer, ctypes.c_int) return f(p_mi, i_page)
[ "def", "libvlc_video_set_teletext", "(", "p_mi", ",", "i_page", ")", ":", "f", "=", "_Cfunctions", ".", "get", "(", "'libvlc_video_set_teletext'", ",", "None", ")", "or", "_Cfunction", "(", "'libvlc_video_set_teletext'", ",", "(", "(", "1", ",", ")", ",", "(", "1", ",", ")", ",", ")", ",", "None", ",", "None", ",", "MediaPlayer", ",", "ctypes", ".", "c_int", ")", "return", "f", "(", "p_mi", ",", "i_page", ")" ]
Set new teletext page to retrieve. @param p_mi: the media player. @param i_page: teletex page number requested.
[ "Set", "new", "teletext", "page", "to", "retrieve", "." ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L5826-L5834
236,413
manns/pyspread
pyspread/src/lib/vlc.py
libvlc_video_get_track_description
def libvlc_video_get_track_description(p_mi): '''Get the description of available video tracks. @param p_mi: media player. @return: list with description of available video tracks, or NULL on error. ''' f = _Cfunctions.get('libvlc_video_get_track_description', None) or \ _Cfunction('libvlc_video_get_track_description', ((1,),), None, ctypes.POINTER(TrackDescription), MediaPlayer) return f(p_mi)
python
def libvlc_video_get_track_description(p_mi): '''Get the description of available video tracks. @param p_mi: media player. @return: list with description of available video tracks, or NULL on error. ''' f = _Cfunctions.get('libvlc_video_get_track_description', None) or \ _Cfunction('libvlc_video_get_track_description', ((1,),), None, ctypes.POINTER(TrackDescription), MediaPlayer) return f(p_mi)
[ "def", "libvlc_video_get_track_description", "(", "p_mi", ")", ":", "f", "=", "_Cfunctions", ".", "get", "(", "'libvlc_video_get_track_description'", ",", "None", ")", "or", "_Cfunction", "(", "'libvlc_video_get_track_description'", ",", "(", "(", "1", ",", ")", ",", ")", ",", "None", ",", "ctypes", ".", "POINTER", "(", "TrackDescription", ")", ",", "MediaPlayer", ")", "return", "f", "(", "p_mi", ")" ]
Get the description of available video tracks. @param p_mi: media player. @return: list with description of available video tracks, or NULL on error.
[ "Get", "the", "description", "of", "available", "video", "tracks", "." ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L5855-L5863
236,414
manns/pyspread
pyspread/src/lib/vlc.py
libvlc_video_set_deinterlace
def libvlc_video_set_deinterlace(p_mi, psz_mode): '''Enable or disable deinterlace filter. @param p_mi: libvlc media player. @param psz_mode: type of deinterlace filter, NULL to disable. ''' f = _Cfunctions.get('libvlc_video_set_deinterlace', None) or \ _Cfunction('libvlc_video_set_deinterlace', ((1,), (1,),), None, None, MediaPlayer, ctypes.c_char_p) return f(p_mi, psz_mode)
python
def libvlc_video_set_deinterlace(p_mi, psz_mode): '''Enable or disable deinterlace filter. @param p_mi: libvlc media player. @param psz_mode: type of deinterlace filter, NULL to disable. ''' f = _Cfunctions.get('libvlc_video_set_deinterlace', None) or \ _Cfunction('libvlc_video_set_deinterlace', ((1,), (1,),), None, None, MediaPlayer, ctypes.c_char_p) return f(p_mi, psz_mode)
[ "def", "libvlc_video_set_deinterlace", "(", "p_mi", ",", "psz_mode", ")", ":", "f", "=", "_Cfunctions", ".", "get", "(", "'libvlc_video_set_deinterlace'", ",", "None", ")", "or", "_Cfunction", "(", "'libvlc_video_set_deinterlace'", ",", "(", "(", "1", ",", ")", ",", "(", "1", ",", ")", ",", ")", ",", "None", ",", "None", ",", "MediaPlayer", ",", "ctypes", ".", "c_char_p", ")", "return", "f", "(", "p_mi", ",", "psz_mode", ")" ]
Enable or disable deinterlace filter. @param p_mi: libvlc media player. @param psz_mode: type of deinterlace filter, NULL to disable.
[ "Enable", "or", "disable", "deinterlace", "filter", "." ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L5902-L5910
236,415
manns/pyspread
pyspread/src/lib/vlc.py
libvlc_video_get_marquee_string
def libvlc_video_get_marquee_string(p_mi, option): '''Get a string marquee option value. @param p_mi: libvlc media player. @param option: marq option to get See libvlc_video_marquee_string_option_t. ''' f = _Cfunctions.get('libvlc_video_get_marquee_string', None) or \ _Cfunction('libvlc_video_get_marquee_string', ((1,), (1,),), string_result, ctypes.c_void_p, MediaPlayer, ctypes.c_uint) return f(p_mi, option)
python
def libvlc_video_get_marquee_string(p_mi, option): '''Get a string marquee option value. @param p_mi: libvlc media player. @param option: marq option to get See libvlc_video_marquee_string_option_t. ''' f = _Cfunctions.get('libvlc_video_get_marquee_string', None) or \ _Cfunction('libvlc_video_get_marquee_string', ((1,), (1,),), string_result, ctypes.c_void_p, MediaPlayer, ctypes.c_uint) return f(p_mi, option)
[ "def", "libvlc_video_get_marquee_string", "(", "p_mi", ",", "option", ")", ":", "f", "=", "_Cfunctions", ".", "get", "(", "'libvlc_video_get_marquee_string'", ",", "None", ")", "or", "_Cfunction", "(", "'libvlc_video_get_marquee_string'", ",", "(", "(", "1", ",", ")", ",", "(", "1", ",", ")", ",", ")", ",", "string_result", ",", "ctypes", ".", "c_void_p", ",", "MediaPlayer", ",", "ctypes", ".", "c_uint", ")", "return", "f", "(", "p_mi", ",", "option", ")" ]
Get a string marquee option value. @param p_mi: libvlc media player. @param option: marq option to get See libvlc_video_marquee_string_option_t.
[ "Get", "a", "string", "marquee", "option", "value", "." ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L5922-L5930
236,416
manns/pyspread
pyspread/src/lib/vlc.py
libvlc_video_set_marquee_string
def libvlc_video_set_marquee_string(p_mi, option, psz_text): '''Set a marquee string option. @param p_mi: libvlc media player. @param option: marq option to set See libvlc_video_marquee_string_option_t. @param psz_text: marq option value. ''' f = _Cfunctions.get('libvlc_video_set_marquee_string', None) or \ _Cfunction('libvlc_video_set_marquee_string', ((1,), (1,), (1,),), None, None, MediaPlayer, ctypes.c_uint, ctypes.c_char_p) return f(p_mi, option, psz_text)
python
def libvlc_video_set_marquee_string(p_mi, option, psz_text): '''Set a marquee string option. @param p_mi: libvlc media player. @param option: marq option to set See libvlc_video_marquee_string_option_t. @param psz_text: marq option value. ''' f = _Cfunctions.get('libvlc_video_set_marquee_string', None) or \ _Cfunction('libvlc_video_set_marquee_string', ((1,), (1,), (1,),), None, None, MediaPlayer, ctypes.c_uint, ctypes.c_char_p) return f(p_mi, option, psz_text)
[ "def", "libvlc_video_set_marquee_string", "(", "p_mi", ",", "option", ",", "psz_text", ")", ":", "f", "=", "_Cfunctions", ".", "get", "(", "'libvlc_video_set_marquee_string'", ",", "None", ")", "or", "_Cfunction", "(", "'libvlc_video_set_marquee_string'", ",", "(", "(", "1", ",", ")", ",", "(", "1", ",", ")", ",", "(", "1", ",", ")", ",", ")", ",", "None", ",", "None", ",", "MediaPlayer", ",", "ctypes", ".", "c_uint", ",", "ctypes", ".", "c_char_p", ")", "return", "f", "(", "p_mi", ",", "option", ",", "psz_text", ")" ]
Set a marquee string option. @param p_mi: libvlc media player. @param option: marq option to set See libvlc_video_marquee_string_option_t. @param psz_text: marq option value.
[ "Set", "a", "marquee", "string", "option", "." ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L5945-L5954
236,417
manns/pyspread
pyspread/src/lib/vlc.py
libvlc_video_get_logo_int
def libvlc_video_get_logo_int(p_mi, option): '''Get integer logo option. @param p_mi: libvlc media player instance. @param option: logo option to get, values of libvlc_video_logo_option_t. ''' f = _Cfunctions.get('libvlc_video_get_logo_int', None) or \ _Cfunction('libvlc_video_get_logo_int', ((1,), (1,),), None, ctypes.c_int, MediaPlayer, ctypes.c_uint) return f(p_mi, option)
python
def libvlc_video_get_logo_int(p_mi, option): '''Get integer logo option. @param p_mi: libvlc media player instance. @param option: logo option to get, values of libvlc_video_logo_option_t. ''' f = _Cfunctions.get('libvlc_video_get_logo_int', None) or \ _Cfunction('libvlc_video_get_logo_int', ((1,), (1,),), None, ctypes.c_int, MediaPlayer, ctypes.c_uint) return f(p_mi, option)
[ "def", "libvlc_video_get_logo_int", "(", "p_mi", ",", "option", ")", ":", "f", "=", "_Cfunctions", ".", "get", "(", "'libvlc_video_get_logo_int'", ",", "None", ")", "or", "_Cfunction", "(", "'libvlc_video_get_logo_int'", ",", "(", "(", "1", ",", ")", ",", "(", "1", ",", ")", ",", ")", ",", "None", ",", "ctypes", ".", "c_int", ",", "MediaPlayer", ",", "ctypes", ".", "c_uint", ")", "return", "f", "(", "p_mi", ",", "option", ")" ]
Get integer logo option. @param p_mi: libvlc media player instance. @param option: logo option to get, values of libvlc_video_logo_option_t.
[ "Get", "integer", "logo", "option", "." ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L5956-L5964
236,418
manns/pyspread
pyspread/src/lib/vlc.py
libvlc_video_set_logo_string
def libvlc_video_set_logo_string(p_mi, option, psz_value): '''Set logo option as string. Options that take a different type value are ignored. @param p_mi: libvlc media player instance. @param option: logo option to set, values of libvlc_video_logo_option_t. @param psz_value: logo option value. ''' f = _Cfunctions.get('libvlc_video_set_logo_string', None) or \ _Cfunction('libvlc_video_set_logo_string', ((1,), (1,), (1,),), None, None, MediaPlayer, ctypes.c_uint, ctypes.c_char_p) return f(p_mi, option, psz_value)
python
def libvlc_video_set_logo_string(p_mi, option, psz_value): '''Set logo option as string. Options that take a different type value are ignored. @param p_mi: libvlc media player instance. @param option: logo option to set, values of libvlc_video_logo_option_t. @param psz_value: logo option value. ''' f = _Cfunctions.get('libvlc_video_set_logo_string', None) or \ _Cfunction('libvlc_video_set_logo_string', ((1,), (1,), (1,),), None, None, MediaPlayer, ctypes.c_uint, ctypes.c_char_p) return f(p_mi, option, psz_value)
[ "def", "libvlc_video_set_logo_string", "(", "p_mi", ",", "option", ",", "psz_value", ")", ":", "f", "=", "_Cfunctions", ".", "get", "(", "'libvlc_video_set_logo_string'", ",", "None", ")", "or", "_Cfunction", "(", "'libvlc_video_set_logo_string'", ",", "(", "(", "1", ",", ")", ",", "(", "1", ",", ")", ",", "(", "1", ",", ")", ",", ")", ",", "None", ",", "None", ",", "MediaPlayer", ",", "ctypes", ".", "c_uint", ",", "ctypes", ".", "c_char_p", ")", "return", "f", "(", "p_mi", ",", "option", ",", "psz_value", ")" ]
Set logo option as string. Options that take a different type value are ignored. @param p_mi: libvlc media player instance. @param option: logo option to set, values of libvlc_video_logo_option_t. @param psz_value: logo option value.
[ "Set", "logo", "option", "as", "string", ".", "Options", "that", "take", "a", "different", "type", "value", "are", "ignored", "." ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L5980-L5990
236,419
manns/pyspread
pyspread/src/lib/vlc.py
libvlc_video_get_adjust_float
def libvlc_video_get_adjust_float(p_mi, option): '''Get float adjust option. @param p_mi: libvlc media player instance. @param option: adjust option to get, values of libvlc_video_adjust_option_t. @version: LibVLC 1.1.1 and later. ''' f = _Cfunctions.get('libvlc_video_get_adjust_float', None) or \ _Cfunction('libvlc_video_get_adjust_float', ((1,), (1,),), None, ctypes.c_float, MediaPlayer, ctypes.c_uint) return f(p_mi, option)
python
def libvlc_video_get_adjust_float(p_mi, option): '''Get float adjust option. @param p_mi: libvlc media player instance. @param option: adjust option to get, values of libvlc_video_adjust_option_t. @version: LibVLC 1.1.1 and later. ''' f = _Cfunctions.get('libvlc_video_get_adjust_float', None) or \ _Cfunction('libvlc_video_get_adjust_float', ((1,), (1,),), None, ctypes.c_float, MediaPlayer, ctypes.c_uint) return f(p_mi, option)
[ "def", "libvlc_video_get_adjust_float", "(", "p_mi", ",", "option", ")", ":", "f", "=", "_Cfunctions", ".", "get", "(", "'libvlc_video_get_adjust_float'", ",", "None", ")", "or", "_Cfunction", "(", "'libvlc_video_get_adjust_float'", ",", "(", "(", "1", ",", ")", ",", "(", "1", ",", ")", ",", ")", ",", "None", ",", "ctypes", ".", "c_float", ",", "MediaPlayer", ",", "ctypes", ".", "c_uint", ")", "return", "f", "(", "p_mi", ",", "option", ")" ]
Get float adjust option. @param p_mi: libvlc media player instance. @param option: adjust option to get, values of libvlc_video_adjust_option_t. @version: LibVLC 1.1.1 and later.
[ "Get", "float", "adjust", "option", "." ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L6018-L6027
236,420
manns/pyspread
pyspread/src/lib/vlc.py
libvlc_video_set_adjust_float
def libvlc_video_set_adjust_float(p_mi, option, value): '''Set adjust option as float. Options that take a different type value are ignored. @param p_mi: libvlc media player instance. @param option: adust option to set, values of libvlc_video_adjust_option_t. @param value: adjust option value. @version: LibVLC 1.1.1 and later. ''' f = _Cfunctions.get('libvlc_video_set_adjust_float', None) or \ _Cfunction('libvlc_video_set_adjust_float', ((1,), (1,), (1,),), None, None, MediaPlayer, ctypes.c_uint, ctypes.c_float) return f(p_mi, option, value)
python
def libvlc_video_set_adjust_float(p_mi, option, value): '''Set adjust option as float. Options that take a different type value are ignored. @param p_mi: libvlc media player instance. @param option: adust option to set, values of libvlc_video_adjust_option_t. @param value: adjust option value. @version: LibVLC 1.1.1 and later. ''' f = _Cfunctions.get('libvlc_video_set_adjust_float', None) or \ _Cfunction('libvlc_video_set_adjust_float', ((1,), (1,), (1,),), None, None, MediaPlayer, ctypes.c_uint, ctypes.c_float) return f(p_mi, option, value)
[ "def", "libvlc_video_set_adjust_float", "(", "p_mi", ",", "option", ",", "value", ")", ":", "f", "=", "_Cfunctions", ".", "get", "(", "'libvlc_video_set_adjust_float'", ",", "None", ")", "or", "_Cfunction", "(", "'libvlc_video_set_adjust_float'", ",", "(", "(", "1", ",", ")", ",", "(", "1", ",", ")", ",", "(", "1", ",", ")", ",", ")", ",", "None", ",", "None", ",", "MediaPlayer", ",", "ctypes", ".", "c_uint", ",", "ctypes", ".", "c_float", ")", "return", "f", "(", "p_mi", ",", "option", ",", "value", ")" ]
Set adjust option as float. Options that take a different type value are ignored. @param p_mi: libvlc media player instance. @param option: adust option to set, values of libvlc_video_adjust_option_t. @param value: adjust option value. @version: LibVLC 1.1.1 and later.
[ "Set", "adjust", "option", "as", "float", ".", "Options", "that", "take", "a", "different", "type", "value", "are", "ignored", "." ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L6029-L6040
236,421
manns/pyspread
pyspread/src/lib/vlc.py
libvlc_audio_output_list_get
def libvlc_audio_output_list_get(p_instance): '''Gets the list of available audio output modules. @param p_instance: libvlc instance. @return: list of available audio outputs. It must be freed it with In case of error, NULL is returned. ''' f = _Cfunctions.get('libvlc_audio_output_list_get', None) or \ _Cfunction('libvlc_audio_output_list_get', ((1,),), None, ctypes.POINTER(AudioOutput), Instance) return f(p_instance)
python
def libvlc_audio_output_list_get(p_instance): '''Gets the list of available audio output modules. @param p_instance: libvlc instance. @return: list of available audio outputs. It must be freed it with In case of error, NULL is returned. ''' f = _Cfunctions.get('libvlc_audio_output_list_get', None) or \ _Cfunction('libvlc_audio_output_list_get', ((1,),), None, ctypes.POINTER(AudioOutput), Instance) return f(p_instance)
[ "def", "libvlc_audio_output_list_get", "(", "p_instance", ")", ":", "f", "=", "_Cfunctions", ".", "get", "(", "'libvlc_audio_output_list_get'", ",", "None", ")", "or", "_Cfunction", "(", "'libvlc_audio_output_list_get'", ",", "(", "(", "1", ",", ")", ",", ")", ",", "None", ",", "ctypes", ".", "POINTER", "(", "AudioOutput", ")", ",", "Instance", ")", "return", "f", "(", "p_instance", ")" ]
Gets the list of available audio output modules. @param p_instance: libvlc instance. @return: list of available audio outputs. It must be freed it with In case of error, NULL is returned.
[ "Gets", "the", "list", "of", "available", "audio", "output", "modules", "." ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L6042-L6050
236,422
manns/pyspread
pyspread/src/lib/vlc.py
libvlc_audio_output_list_release
def libvlc_audio_output_list_release(p_list): '''Frees the list of available audio output modules. @param p_list: list with audio outputs for release. ''' f = _Cfunctions.get('libvlc_audio_output_list_release', None) or \ _Cfunction('libvlc_audio_output_list_release', ((1,),), None, None, ctypes.POINTER(AudioOutput)) return f(p_list)
python
def libvlc_audio_output_list_release(p_list): '''Frees the list of available audio output modules. @param p_list: list with audio outputs for release. ''' f = _Cfunctions.get('libvlc_audio_output_list_release', None) or \ _Cfunction('libvlc_audio_output_list_release', ((1,),), None, None, ctypes.POINTER(AudioOutput)) return f(p_list)
[ "def", "libvlc_audio_output_list_release", "(", "p_list", ")", ":", "f", "=", "_Cfunctions", ".", "get", "(", "'libvlc_audio_output_list_release'", ",", "None", ")", "or", "_Cfunction", "(", "'libvlc_audio_output_list_release'", ",", "(", "(", "1", ",", ")", ",", ")", ",", "None", ",", "None", ",", "ctypes", ".", "POINTER", "(", "AudioOutput", ")", ")", "return", "f", "(", "p_list", ")" ]
Frees the list of available audio output modules. @param p_list: list with audio outputs for release.
[ "Frees", "the", "list", "of", "available", "audio", "output", "modules", "." ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L6052-L6059
236,423
manns/pyspread
pyspread/src/lib/vlc.py
libvlc_audio_output_set
def libvlc_audio_output_set(p_mi, psz_name): '''Selects an audio output module. @note: Any change will take be effect only after playback is stopped and restarted. Audio output cannot be changed while playing. @param p_mi: media player. @param psz_name: name of audio output, use psz_name of See L{AudioOutput}. @return: 0 if function succeded, -1 on error. ''' f = _Cfunctions.get('libvlc_audio_output_set', None) or \ _Cfunction('libvlc_audio_output_set', ((1,), (1,),), None, ctypes.c_int, MediaPlayer, ctypes.c_char_p) return f(p_mi, psz_name)
python
def libvlc_audio_output_set(p_mi, psz_name): '''Selects an audio output module. @note: Any change will take be effect only after playback is stopped and restarted. Audio output cannot be changed while playing. @param p_mi: media player. @param psz_name: name of audio output, use psz_name of See L{AudioOutput}. @return: 0 if function succeded, -1 on error. ''' f = _Cfunctions.get('libvlc_audio_output_set', None) or \ _Cfunction('libvlc_audio_output_set', ((1,), (1,),), None, ctypes.c_int, MediaPlayer, ctypes.c_char_p) return f(p_mi, psz_name)
[ "def", "libvlc_audio_output_set", "(", "p_mi", ",", "psz_name", ")", ":", "f", "=", "_Cfunctions", ".", "get", "(", "'libvlc_audio_output_set'", ",", "None", ")", "or", "_Cfunction", "(", "'libvlc_audio_output_set'", ",", "(", "(", "1", ",", ")", ",", "(", "1", ",", ")", ",", ")", ",", "None", ",", "ctypes", ".", "c_int", ",", "MediaPlayer", ",", "ctypes", ".", "c_char_p", ")", "return", "f", "(", "p_mi", ",", "psz_name", ")" ]
Selects an audio output module. @note: Any change will take be effect only after playback is stopped and restarted. Audio output cannot be changed while playing. @param p_mi: media player. @param psz_name: name of audio output, use psz_name of See L{AudioOutput}. @return: 0 if function succeded, -1 on error.
[ "Selects", "an", "audio", "output", "module", "." ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L6061-L6072
236,424
manns/pyspread
pyspread/src/lib/vlc.py
libvlc_audio_output_device_list_release
def libvlc_audio_output_device_list_release(p_list): '''Frees a list of available audio output devices. @param p_list: list with audio outputs for release. @version: LibVLC 2.1.0 or later. ''' f = _Cfunctions.get('libvlc_audio_output_device_list_release', None) or \ _Cfunction('libvlc_audio_output_device_list_release', ((1,),), None, None, ctypes.POINTER(AudioOutputDevice)) return f(p_list)
python
def libvlc_audio_output_device_list_release(p_list): '''Frees a list of available audio output devices. @param p_list: list with audio outputs for release. @version: LibVLC 2.1.0 or later. ''' f = _Cfunctions.get('libvlc_audio_output_device_list_release', None) or \ _Cfunction('libvlc_audio_output_device_list_release', ((1,),), None, None, ctypes.POINTER(AudioOutputDevice)) return f(p_list)
[ "def", "libvlc_audio_output_device_list_release", "(", "p_list", ")", ":", "f", "=", "_Cfunctions", ".", "get", "(", "'libvlc_audio_output_device_list_release'", ",", "None", ")", "or", "_Cfunction", "(", "'libvlc_audio_output_device_list_release'", ",", "(", "(", "1", ",", ")", ",", ")", ",", "None", ",", "None", ",", "ctypes", ".", "POINTER", "(", "AudioOutputDevice", ")", ")", "return", "f", "(", "p_list", ")" ]
Frees a list of available audio output devices. @param p_list: list with audio outputs for release. @version: LibVLC 2.1.0 or later.
[ "Frees", "a", "list", "of", "available", "audio", "output", "devices", "." ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L6112-L6120
236,425
manns/pyspread
pyspread/src/lib/vlc.py
libvlc_audio_set_mute
def libvlc_audio_set_mute(p_mi, status): '''Set mute status. @param p_mi: media player. @param status: If status is true then mute, otherwise unmute @warning This function does not always work. If there are no active audio playback stream, the mute status might not be available. If digital pass-through (S/PDIF, HDMI...) is in use, muting may be unapplicable. Also some audio output plugins do not support muting at all. @note To force silent playback, disable all audio tracks. This is more efficient and reliable than mute. ''' f = _Cfunctions.get('libvlc_audio_set_mute', None) or \ _Cfunction('libvlc_audio_set_mute', ((1,), (1,),), None, None, MediaPlayer, ctypes.c_int) return f(p_mi, status)
python
def libvlc_audio_set_mute(p_mi, status): '''Set mute status. @param p_mi: media player. @param status: If status is true then mute, otherwise unmute @warning This function does not always work. If there are no active audio playback stream, the mute status might not be available. If digital pass-through (S/PDIF, HDMI...) is in use, muting may be unapplicable. Also some audio output plugins do not support muting at all. @note To force silent playback, disable all audio tracks. This is more efficient and reliable than mute. ''' f = _Cfunctions.get('libvlc_audio_set_mute', None) or \ _Cfunction('libvlc_audio_set_mute', ((1,), (1,),), None, None, MediaPlayer, ctypes.c_int) return f(p_mi, status)
[ "def", "libvlc_audio_set_mute", "(", "p_mi", ",", "status", ")", ":", "f", "=", "_Cfunctions", ".", "get", "(", "'libvlc_audio_set_mute'", ",", "None", ")", "or", "_Cfunction", "(", "'libvlc_audio_set_mute'", ",", "(", "(", "1", ",", ")", ",", "(", "1", ",", ")", ",", ")", ",", "None", ",", "None", ",", "MediaPlayer", ",", "ctypes", ".", "c_int", ")", "return", "f", "(", "p_mi", ",", "status", ")" ]
Set mute status. @param p_mi: media player. @param status: If status is true then mute, otherwise unmute @warning This function does not always work. If there are no active audio playback stream, the mute status might not be available. If digital pass-through (S/PDIF, HDMI...) is in use, muting may be unapplicable. Also some audio output plugins do not support muting at all. @note To force silent playback, disable all audio tracks. This is more efficient and reliable than mute.
[ "Set", "mute", "status", "." ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L6193-L6201
236,426
manns/pyspread
pyspread/src/lib/vlc.py
libvlc_audio_set_volume
def libvlc_audio_set_volume(p_mi, i_volume): '''Set current software audio volume. @param p_mi: media player. @param i_volume: the volume in percents (0 = mute, 100 = 0dB). @return: 0 if the volume was set, -1 if it was out of range. ''' f = _Cfunctions.get('libvlc_audio_set_volume', None) or \ _Cfunction('libvlc_audio_set_volume', ((1,), (1,),), None, ctypes.c_int, MediaPlayer, ctypes.c_int) return f(p_mi, i_volume)
python
def libvlc_audio_set_volume(p_mi, i_volume): '''Set current software audio volume. @param p_mi: media player. @param i_volume: the volume in percents (0 = mute, 100 = 0dB). @return: 0 if the volume was set, -1 if it was out of range. ''' f = _Cfunctions.get('libvlc_audio_set_volume', None) or \ _Cfunction('libvlc_audio_set_volume', ((1,), (1,),), None, ctypes.c_int, MediaPlayer, ctypes.c_int) return f(p_mi, i_volume)
[ "def", "libvlc_audio_set_volume", "(", "p_mi", ",", "i_volume", ")", ":", "f", "=", "_Cfunctions", ".", "get", "(", "'libvlc_audio_set_volume'", ",", "None", ")", "or", "_Cfunction", "(", "'libvlc_audio_set_volume'", ",", "(", "(", "1", ",", ")", ",", "(", "1", ",", ")", ",", ")", ",", "None", ",", "ctypes", ".", "c_int", ",", "MediaPlayer", ",", "ctypes", ".", "c_int", ")", "return", "f", "(", "p_mi", ",", "i_volume", ")" ]
Set current software audio volume. @param p_mi: media player. @param i_volume: the volume in percents (0 = mute, 100 = 0dB). @return: 0 if the volume was set, -1 if it was out of range.
[ "Set", "current", "software", "audio", "volume", "." ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L6213-L6222
236,427
manns/pyspread
pyspread/src/lib/vlc.py
libvlc_audio_set_track
def libvlc_audio_set_track(p_mi, i_track): '''Set current audio track. @param p_mi: media player. @param i_track: the track ID (i_id field from track description). @return: 0 on success, -1 on error. ''' f = _Cfunctions.get('libvlc_audio_set_track', None) or \ _Cfunction('libvlc_audio_set_track', ((1,), (1,),), None, ctypes.c_int, MediaPlayer, ctypes.c_int) return f(p_mi, i_track)
python
def libvlc_audio_set_track(p_mi, i_track): '''Set current audio track. @param p_mi: media player. @param i_track: the track ID (i_id field from track description). @return: 0 on success, -1 on error. ''' f = _Cfunctions.get('libvlc_audio_set_track', None) or \ _Cfunction('libvlc_audio_set_track', ((1,), (1,),), None, ctypes.c_int, MediaPlayer, ctypes.c_int) return f(p_mi, i_track)
[ "def", "libvlc_audio_set_track", "(", "p_mi", ",", "i_track", ")", ":", "f", "=", "_Cfunctions", ".", "get", "(", "'libvlc_audio_set_track'", ",", "None", ")", "or", "_Cfunction", "(", "'libvlc_audio_set_track'", ",", "(", "(", "1", ",", ")", ",", "(", "1", ",", ")", ",", ")", ",", "None", ",", "ctypes", ".", "c_int", ",", "MediaPlayer", ",", "ctypes", ".", "c_int", ")", "return", "f", "(", "p_mi", ",", "i_track", ")" ]
Set current audio track. @param p_mi: media player. @param i_track: the track ID (i_id field from track description). @return: 0 on success, -1 on error.
[ "Set", "current", "audio", "track", "." ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L6254-L6263
236,428
manns/pyspread
pyspread/src/lib/vlc.py
libvlc_audio_set_channel
def libvlc_audio_set_channel(p_mi, channel): '''Set current audio channel. @param p_mi: media player. @param channel: the audio channel, See libvlc_audio_output_channel_t. @return: 0 on success, -1 on error. ''' f = _Cfunctions.get('libvlc_audio_set_channel', None) or \ _Cfunction('libvlc_audio_set_channel', ((1,), (1,),), None, ctypes.c_int, MediaPlayer, ctypes.c_int) return f(p_mi, channel)
python
def libvlc_audio_set_channel(p_mi, channel): '''Set current audio channel. @param p_mi: media player. @param channel: the audio channel, See libvlc_audio_output_channel_t. @return: 0 on success, -1 on error. ''' f = _Cfunctions.get('libvlc_audio_set_channel', None) or \ _Cfunction('libvlc_audio_set_channel', ((1,), (1,),), None, ctypes.c_int, MediaPlayer, ctypes.c_int) return f(p_mi, channel)
[ "def", "libvlc_audio_set_channel", "(", "p_mi", ",", "channel", ")", ":", "f", "=", "_Cfunctions", ".", "get", "(", "'libvlc_audio_set_channel'", ",", "None", ")", "or", "_Cfunction", "(", "'libvlc_audio_set_channel'", ",", "(", "(", "1", ",", ")", ",", "(", "1", ",", ")", ",", ")", ",", "None", ",", "ctypes", ".", "c_int", ",", "MediaPlayer", ",", "ctypes", ".", "c_int", ")", "return", "f", "(", "p_mi", ",", "channel", ")" ]
Set current audio channel. @param p_mi: media player. @param channel: the audio channel, See libvlc_audio_output_channel_t. @return: 0 on success, -1 on error.
[ "Set", "current", "audio", "channel", "." ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L6275-L6284
236,429
manns/pyspread
pyspread/src/lib/vlc.py
libvlc_audio_get_delay
def libvlc_audio_get_delay(p_mi): '''Get current audio delay. @param p_mi: media player. @return: the audio delay (microseconds). @version: LibVLC 1.1.1 or later. ''' f = _Cfunctions.get('libvlc_audio_get_delay', None) or \ _Cfunction('libvlc_audio_get_delay', ((1,),), None, ctypes.c_int64, MediaPlayer) return f(p_mi)
python
def libvlc_audio_get_delay(p_mi): '''Get current audio delay. @param p_mi: media player. @return: the audio delay (microseconds). @version: LibVLC 1.1.1 or later. ''' f = _Cfunctions.get('libvlc_audio_get_delay', None) or \ _Cfunction('libvlc_audio_get_delay', ((1,),), None, ctypes.c_int64, MediaPlayer) return f(p_mi)
[ "def", "libvlc_audio_get_delay", "(", "p_mi", ")", ":", "f", "=", "_Cfunctions", ".", "get", "(", "'libvlc_audio_get_delay'", ",", "None", ")", "or", "_Cfunction", "(", "'libvlc_audio_get_delay'", ",", "(", "(", "1", ",", ")", ",", ")", ",", "None", ",", "ctypes", ".", "c_int64", ",", "MediaPlayer", ")", "return", "f", "(", "p_mi", ")" ]
Get current audio delay. @param p_mi: media player. @return: the audio delay (microseconds). @version: LibVLC 1.1.1 or later.
[ "Get", "current", "audio", "delay", "." ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L6286-L6295
236,430
manns/pyspread
pyspread/src/lib/vlc.py
libvlc_audio_equalizer_get_preset_name
def libvlc_audio_equalizer_get_preset_name(u_index): '''Get the name of a particular equalizer preset. This name can be used, for example, to prepare a preset label or menu in a user interface. @param u_index: index of the preset, counting from zero. @return: preset name, or NULL if there is no such preset. @version: LibVLC 2.2.0 or later. ''' f = _Cfunctions.get('libvlc_audio_equalizer_get_preset_name', None) or \ _Cfunction('libvlc_audio_equalizer_get_preset_name', ((1,),), None, ctypes.c_char_p, ctypes.c_uint) return f(u_index)
python
def libvlc_audio_equalizer_get_preset_name(u_index): '''Get the name of a particular equalizer preset. This name can be used, for example, to prepare a preset label or menu in a user interface. @param u_index: index of the preset, counting from zero. @return: preset name, or NULL if there is no such preset. @version: LibVLC 2.2.0 or later. ''' f = _Cfunctions.get('libvlc_audio_equalizer_get_preset_name', None) or \ _Cfunction('libvlc_audio_equalizer_get_preset_name', ((1,),), None, ctypes.c_char_p, ctypes.c_uint) return f(u_index)
[ "def", "libvlc_audio_equalizer_get_preset_name", "(", "u_index", ")", ":", "f", "=", "_Cfunctions", ".", "get", "(", "'libvlc_audio_equalizer_get_preset_name'", ",", "None", ")", "or", "_Cfunction", "(", "'libvlc_audio_equalizer_get_preset_name'", ",", "(", "(", "1", ",", ")", ",", ")", ",", "None", ",", "ctypes", ".", "c_char_p", ",", "ctypes", ".", "c_uint", ")", "return", "f", "(", "u_index", ")" ]
Get the name of a particular equalizer preset. This name can be used, for example, to prepare a preset label or menu in a user interface. @param u_index: index of the preset, counting from zero. @return: preset name, or NULL if there is no such preset. @version: LibVLC 2.2.0 or later.
[ "Get", "the", "name", "of", "a", "particular", "equalizer", "preset", ".", "This", "name", "can", "be", "used", "for", "example", "to", "prepare", "a", "preset", "label", "or", "menu", "in", "a", "user", "interface", "." ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L6319-L6330
236,431
manns/pyspread
pyspread/src/lib/vlc.py
libvlc_audio_equalizer_get_band_frequency
def libvlc_audio_equalizer_get_band_frequency(u_index): '''Get a particular equalizer band frequency. This value can be used, for example, to create a label for an equalizer band control in a user interface. @param u_index: index of the band, counting from zero. @return: equalizer band frequency (Hz), or -1 if there is no such band. @version: LibVLC 2.2.0 or later. ''' f = _Cfunctions.get('libvlc_audio_equalizer_get_band_frequency', None) or \ _Cfunction('libvlc_audio_equalizer_get_band_frequency', ((1,),), None, ctypes.c_float, ctypes.c_uint) return f(u_index)
python
def libvlc_audio_equalizer_get_band_frequency(u_index): '''Get a particular equalizer band frequency. This value can be used, for example, to create a label for an equalizer band control in a user interface. @param u_index: index of the band, counting from zero. @return: equalizer band frequency (Hz), or -1 if there is no such band. @version: LibVLC 2.2.0 or later. ''' f = _Cfunctions.get('libvlc_audio_equalizer_get_band_frequency', None) or \ _Cfunction('libvlc_audio_equalizer_get_band_frequency', ((1,),), None, ctypes.c_float, ctypes.c_uint) return f(u_index)
[ "def", "libvlc_audio_equalizer_get_band_frequency", "(", "u_index", ")", ":", "f", "=", "_Cfunctions", ".", "get", "(", "'libvlc_audio_equalizer_get_band_frequency'", ",", "None", ")", "or", "_Cfunction", "(", "'libvlc_audio_equalizer_get_band_frequency'", ",", "(", "(", "1", ",", ")", ",", ")", ",", "None", ",", "ctypes", ".", "c_float", ",", "ctypes", ".", "c_uint", ")", "return", "f", "(", "u_index", ")" ]
Get a particular equalizer band frequency. This value can be used, for example, to create a label for an equalizer band control in a user interface. @param u_index: index of the band, counting from zero. @return: equalizer band frequency (Hz), or -1 if there is no such band. @version: LibVLC 2.2.0 or later.
[ "Get", "a", "particular", "equalizer", "band", "frequency", ".", "This", "value", "can", "be", "used", "for", "example", "to", "create", "a", "label", "for", "an", "equalizer", "band", "control", "in", "a", "user", "interface", "." ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L6342-L6353
236,432
manns/pyspread
pyspread/src/lib/vlc.py
libvlc_audio_equalizer_get_preamp
def libvlc_audio_equalizer_get_preamp(p_equalizer): '''Get the current pre-amplification value from an equalizer. @param p_equalizer: valid equalizer handle, must not be NULL. @return: preamp value (Hz). @version: LibVLC 2.2.0 or later. ''' f = _Cfunctions.get('libvlc_audio_equalizer_get_preamp', None) or \ _Cfunction('libvlc_audio_equalizer_get_preamp', ((1,),), None, ctypes.c_float, ctypes.c_void_p) return f(p_equalizer)
python
def libvlc_audio_equalizer_get_preamp(p_equalizer): '''Get the current pre-amplification value from an equalizer. @param p_equalizer: valid equalizer handle, must not be NULL. @return: preamp value (Hz). @version: LibVLC 2.2.0 or later. ''' f = _Cfunctions.get('libvlc_audio_equalizer_get_preamp', None) or \ _Cfunction('libvlc_audio_equalizer_get_preamp', ((1,),), None, ctypes.c_float, ctypes.c_void_p) return f(p_equalizer)
[ "def", "libvlc_audio_equalizer_get_preamp", "(", "p_equalizer", ")", ":", "f", "=", "_Cfunctions", ".", "get", "(", "'libvlc_audio_equalizer_get_preamp'", ",", "None", ")", "or", "_Cfunction", "(", "'libvlc_audio_equalizer_get_preamp'", ",", "(", "(", "1", ",", ")", ",", ")", ",", "None", ",", "ctypes", ".", "c_float", ",", "ctypes", ".", "c_void_p", ")", "return", "f", "(", "p_equalizer", ")" ]
Get the current pre-amplification value from an equalizer. @param p_equalizer: valid equalizer handle, must not be NULL. @return: preamp value (Hz). @version: LibVLC 2.2.0 or later.
[ "Get", "the", "current", "pre", "-", "amplification", "value", "from", "an", "equalizer", "." ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L6413-L6422
236,433
manns/pyspread
pyspread/src/lib/vlc.py
libvlc_audio_equalizer_get_amp_at_index
def libvlc_audio_equalizer_get_amp_at_index(p_equalizer, u_band): '''Get the amplification value for a particular equalizer frequency band. @param p_equalizer: valid equalizer handle, must not be NULL. @param u_band: index, counting from zero, of the frequency band to get. @return: amplification value (Hz); NaN if there is no such frequency band. @version: LibVLC 2.2.0 or later. ''' f = _Cfunctions.get('libvlc_audio_equalizer_get_amp_at_index', None) or \ _Cfunction('libvlc_audio_equalizer_get_amp_at_index', ((1,), (1,),), None, ctypes.c_float, ctypes.c_void_p, ctypes.c_uint) return f(p_equalizer, u_band)
python
def libvlc_audio_equalizer_get_amp_at_index(p_equalizer, u_band): '''Get the amplification value for a particular equalizer frequency band. @param p_equalizer: valid equalizer handle, must not be NULL. @param u_band: index, counting from zero, of the frequency band to get. @return: amplification value (Hz); NaN if there is no such frequency band. @version: LibVLC 2.2.0 or later. ''' f = _Cfunctions.get('libvlc_audio_equalizer_get_amp_at_index', None) or \ _Cfunction('libvlc_audio_equalizer_get_amp_at_index', ((1,), (1,),), None, ctypes.c_float, ctypes.c_void_p, ctypes.c_uint) return f(p_equalizer, u_band)
[ "def", "libvlc_audio_equalizer_get_amp_at_index", "(", "p_equalizer", ",", "u_band", ")", ":", "f", "=", "_Cfunctions", ".", "get", "(", "'libvlc_audio_equalizer_get_amp_at_index'", ",", "None", ")", "or", "_Cfunction", "(", "'libvlc_audio_equalizer_get_amp_at_index'", ",", "(", "(", "1", ",", ")", ",", "(", "1", ",", ")", ",", ")", ",", "None", ",", "ctypes", ".", "c_float", ",", "ctypes", ".", "c_void_p", ",", "ctypes", ".", "c_uint", ")", "return", "f", "(", "p_equalizer", ",", "u_band", ")" ]
Get the amplification value for a particular equalizer frequency band. @param p_equalizer: valid equalizer handle, must not be NULL. @param u_band: index, counting from zero, of the frequency band to get. @return: amplification value (Hz); NaN if there is no such frequency band. @version: LibVLC 2.2.0 or later.
[ "Get", "the", "amplification", "value", "for", "a", "particular", "equalizer", "frequency", "band", "." ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L6440-L6450
236,434
manns/pyspread
pyspread/src/lib/vlc.py
libvlc_vlm_set_loop
def libvlc_vlm_set_loop(p_instance, psz_name, b_loop): '''Set a media's loop status. @param p_instance: the instance. @param psz_name: the media to work on. @param b_loop: the new status. @return: 0 on success, -1 on error. ''' f = _Cfunctions.get('libvlc_vlm_set_loop', None) or \ _Cfunction('libvlc_vlm_set_loop', ((1,), (1,), (1,),), None, ctypes.c_int, Instance, ctypes.c_char_p, ctypes.c_int) return f(p_instance, psz_name, b_loop)
python
def libvlc_vlm_set_loop(p_instance, psz_name, b_loop): '''Set a media's loop status. @param p_instance: the instance. @param psz_name: the media to work on. @param b_loop: the new status. @return: 0 on success, -1 on error. ''' f = _Cfunctions.get('libvlc_vlm_set_loop', None) or \ _Cfunction('libvlc_vlm_set_loop', ((1,), (1,), (1,),), None, ctypes.c_int, Instance, ctypes.c_char_p, ctypes.c_int) return f(p_instance, psz_name, b_loop)
[ "def", "libvlc_vlm_set_loop", "(", "p_instance", ",", "psz_name", ",", "b_loop", ")", ":", "f", "=", "_Cfunctions", ".", "get", "(", "'libvlc_vlm_set_loop'", ",", "None", ")", "or", "_Cfunction", "(", "'libvlc_vlm_set_loop'", ",", "(", "(", "1", ",", ")", ",", "(", "1", ",", ")", ",", "(", "1", ",", ")", ",", ")", ",", "None", ",", "ctypes", ".", "c_int", ",", "Instance", ",", "ctypes", ".", "c_char_p", ",", "ctypes", ".", "c_int", ")", "return", "f", "(", "p_instance", ",", "psz_name", ",", "b_loop", ")" ]
Set a media's loop status. @param p_instance: the instance. @param psz_name: the media to work on. @param b_loop: the new status. @return: 0 on success, -1 on error.
[ "Set", "a", "media", "s", "loop", "status", "." ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L6580-L6590
236,435
manns/pyspread
pyspread/src/lib/vlc.py
libvlc_vlm_seek_media
def libvlc_vlm_seek_media(p_instance, psz_name, f_percentage): '''Seek in the named broadcast. @param p_instance: the instance. @param psz_name: the name of the broadcast. @param f_percentage: the percentage to seek to. @return: 0 on success, -1 on error. ''' f = _Cfunctions.get('libvlc_vlm_seek_media', None) or \ _Cfunction('libvlc_vlm_seek_media', ((1,), (1,), (1,),), None, ctypes.c_int, Instance, ctypes.c_char_p, ctypes.c_float) return f(p_instance, psz_name, f_percentage)
python
def libvlc_vlm_seek_media(p_instance, psz_name, f_percentage): '''Seek in the named broadcast. @param p_instance: the instance. @param psz_name: the name of the broadcast. @param f_percentage: the percentage to seek to. @return: 0 on success, -1 on error. ''' f = _Cfunctions.get('libvlc_vlm_seek_media', None) or \ _Cfunction('libvlc_vlm_seek_media', ((1,), (1,), (1,),), None, ctypes.c_int, Instance, ctypes.c_char_p, ctypes.c_float) return f(p_instance, psz_name, f_percentage)
[ "def", "libvlc_vlm_seek_media", "(", "p_instance", ",", "psz_name", ",", "f_percentage", ")", ":", "f", "=", "_Cfunctions", ".", "get", "(", "'libvlc_vlm_seek_media'", ",", "None", ")", "or", "_Cfunction", "(", "'libvlc_vlm_seek_media'", ",", "(", "(", "1", ",", ")", ",", "(", "1", ",", ")", ",", "(", "1", ",", ")", ",", ")", ",", "None", ",", "ctypes", ".", "c_int", ",", "Instance", ",", "ctypes", ".", "c_char_p", ",", "ctypes", ".", "c_float", ")", "return", "f", "(", "p_instance", ",", "psz_name", ",", "f_percentage", ")" ]
Seek in the named broadcast. @param p_instance: the instance. @param psz_name: the name of the broadcast. @param f_percentage: the percentage to seek to. @return: 0 on success, -1 on error.
[ "Seek", "in", "the", "named", "broadcast", "." ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L6655-L6665
236,436
manns/pyspread
pyspread/src/lib/vlc.py
libvlc_vlm_show_media
def libvlc_vlm_show_media(p_instance, psz_name): '''Return information about the named media as a JSON string representation. This function is mainly intended for debugging use, if you want programmatic access to the state of a vlm_media_instance_t, please use the corresponding libvlc_vlm_get_media_instance_xxx -functions. Currently there are no such functions available for vlm_media_t though. @param p_instance: the instance. @param psz_name: the name of the media, if the name is an empty string, all media is described. @return: string with information about named media, or NULL on error. ''' f = _Cfunctions.get('libvlc_vlm_show_media', None) or \ _Cfunction('libvlc_vlm_show_media', ((1,), (1,),), string_result, ctypes.c_void_p, Instance, ctypes.c_char_p) return f(p_instance, psz_name)
python
def libvlc_vlm_show_media(p_instance, psz_name): '''Return information about the named media as a JSON string representation. This function is mainly intended for debugging use, if you want programmatic access to the state of a vlm_media_instance_t, please use the corresponding libvlc_vlm_get_media_instance_xxx -functions. Currently there are no such functions available for vlm_media_t though. @param p_instance: the instance. @param psz_name: the name of the media, if the name is an empty string, all media is described. @return: string with information about named media, or NULL on error. ''' f = _Cfunctions.get('libvlc_vlm_show_media', None) or \ _Cfunction('libvlc_vlm_show_media', ((1,), (1,),), string_result, ctypes.c_void_p, Instance, ctypes.c_char_p) return f(p_instance, psz_name)
[ "def", "libvlc_vlm_show_media", "(", "p_instance", ",", "psz_name", ")", ":", "f", "=", "_Cfunctions", ".", "get", "(", "'libvlc_vlm_show_media'", ",", "None", ")", "or", "_Cfunction", "(", "'libvlc_vlm_show_media'", ",", "(", "(", "1", ",", ")", ",", "(", "1", ",", ")", ",", ")", ",", "string_result", ",", "ctypes", ".", "c_void_p", ",", "Instance", ",", "ctypes", ".", "c_char_p", ")", "return", "f", "(", "p_instance", ",", "psz_name", ")" ]
Return information about the named media as a JSON string representation. This function is mainly intended for debugging use, if you want programmatic access to the state of a vlm_media_instance_t, please use the corresponding libvlc_vlm_get_media_instance_xxx -functions. Currently there are no such functions available for vlm_media_t though. @param p_instance: the instance. @param psz_name: the name of the media, if the name is an empty string, all media is described. @return: string with information about named media, or NULL on error.
[ "Return", "information", "about", "the", "named", "media", "as", "a", "JSON", "string", "representation", ".", "This", "function", "is", "mainly", "intended", "for", "debugging", "use", "if", "you", "want", "programmatic", "access", "to", "the", "state", "of", "a", "vlm_media_instance_t", "please", "use", "the", "corresponding", "libvlc_vlm_get_media_instance_xxx", "-", "functions", ".", "Currently", "there", "are", "no", "such", "functions", "available", "for", "vlm_media_t", "though", "." ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L6667-L6683
236,437
manns/pyspread
pyspread/src/lib/vlc.py
libvlc_vlm_get_media_instance_position
def libvlc_vlm_get_media_instance_position(p_instance, psz_name, i_instance): '''Get vlm_media instance position by name or instance id. @param p_instance: a libvlc instance. @param psz_name: name of vlm media instance. @param i_instance: instance id. @return: position as float or -1. on error. ''' f = _Cfunctions.get('libvlc_vlm_get_media_instance_position', None) or \ _Cfunction('libvlc_vlm_get_media_instance_position', ((1,), (1,), (1,),), None, ctypes.c_float, Instance, ctypes.c_char_p, ctypes.c_int) return f(p_instance, psz_name, i_instance)
python
def libvlc_vlm_get_media_instance_position(p_instance, psz_name, i_instance): '''Get vlm_media instance position by name or instance id. @param p_instance: a libvlc instance. @param psz_name: name of vlm media instance. @param i_instance: instance id. @return: position as float or -1. on error. ''' f = _Cfunctions.get('libvlc_vlm_get_media_instance_position', None) or \ _Cfunction('libvlc_vlm_get_media_instance_position', ((1,), (1,), (1,),), None, ctypes.c_float, Instance, ctypes.c_char_p, ctypes.c_int) return f(p_instance, psz_name, i_instance)
[ "def", "libvlc_vlm_get_media_instance_position", "(", "p_instance", ",", "psz_name", ",", "i_instance", ")", ":", "f", "=", "_Cfunctions", ".", "get", "(", "'libvlc_vlm_get_media_instance_position'", ",", "None", ")", "or", "_Cfunction", "(", "'libvlc_vlm_get_media_instance_position'", ",", "(", "(", "1", ",", ")", ",", "(", "1", ",", ")", ",", "(", "1", ",", ")", ",", ")", ",", "None", ",", "ctypes", ".", "c_float", ",", "Instance", ",", "ctypes", ".", "c_char_p", ",", "ctypes", ".", "c_int", ")", "return", "f", "(", "p_instance", ",", "psz_name", ",", "i_instance", ")" ]
Get vlm_media instance position by name or instance id. @param p_instance: a libvlc instance. @param psz_name: name of vlm media instance. @param i_instance: instance id. @return: position as float or -1. on error.
[ "Get", "vlm_media", "instance", "position", "by", "name", "or", "instance", "id", "." ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L6685-L6695
236,438
manns/pyspread
pyspread/src/lib/vlc.py
libvlc_vlm_get_media_instance_time
def libvlc_vlm_get_media_instance_time(p_instance, psz_name, i_instance): '''Get vlm_media instance time by name or instance id. @param p_instance: a libvlc instance. @param psz_name: name of vlm media instance. @param i_instance: instance id. @return: time as integer or -1 on error. ''' f = _Cfunctions.get('libvlc_vlm_get_media_instance_time', None) or \ _Cfunction('libvlc_vlm_get_media_instance_time', ((1,), (1,), (1,),), None, ctypes.c_int, Instance, ctypes.c_char_p, ctypes.c_int) return f(p_instance, psz_name, i_instance)
python
def libvlc_vlm_get_media_instance_time(p_instance, psz_name, i_instance): '''Get vlm_media instance time by name or instance id. @param p_instance: a libvlc instance. @param psz_name: name of vlm media instance. @param i_instance: instance id. @return: time as integer or -1 on error. ''' f = _Cfunctions.get('libvlc_vlm_get_media_instance_time', None) or \ _Cfunction('libvlc_vlm_get_media_instance_time', ((1,), (1,), (1,),), None, ctypes.c_int, Instance, ctypes.c_char_p, ctypes.c_int) return f(p_instance, psz_name, i_instance)
[ "def", "libvlc_vlm_get_media_instance_time", "(", "p_instance", ",", "psz_name", ",", "i_instance", ")", ":", "f", "=", "_Cfunctions", ".", "get", "(", "'libvlc_vlm_get_media_instance_time'", ",", "None", ")", "or", "_Cfunction", "(", "'libvlc_vlm_get_media_instance_time'", ",", "(", "(", "1", ",", ")", ",", "(", "1", ",", ")", ",", "(", "1", ",", ")", ",", ")", ",", "None", ",", "ctypes", ".", "c_int", ",", "Instance", ",", "ctypes", ".", "c_char_p", ",", "ctypes", ".", "c_int", ")", "return", "f", "(", "p_instance", ",", "psz_name", ",", "i_instance", ")" ]
Get vlm_media instance time by name or instance id. @param p_instance: a libvlc instance. @param psz_name: name of vlm media instance. @param i_instance: instance id. @return: time as integer or -1 on error.
[ "Get", "vlm_media", "instance", "time", "by", "name", "or", "instance", "id", "." ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L6697-L6707
236,439
manns/pyspread
pyspread/src/lib/vlc.py
libvlc_vlm_get_event_manager
def libvlc_vlm_get_event_manager(p_instance): '''Get libvlc_event_manager from a vlm media. The p_event_manager is immutable, so you don't have to hold the lock. @param p_instance: a libvlc instance. @return: libvlc_event_manager. ''' f = _Cfunctions.get('libvlc_vlm_get_event_manager', None) or \ _Cfunction('libvlc_vlm_get_event_manager', ((1,),), class_result(EventManager), ctypes.c_void_p, Instance) return f(p_instance)
python
def libvlc_vlm_get_event_manager(p_instance): '''Get libvlc_event_manager from a vlm media. The p_event_manager is immutable, so you don't have to hold the lock. @param p_instance: a libvlc instance. @return: libvlc_event_manager. ''' f = _Cfunctions.get('libvlc_vlm_get_event_manager', None) or \ _Cfunction('libvlc_vlm_get_event_manager', ((1,),), class_result(EventManager), ctypes.c_void_p, Instance) return f(p_instance)
[ "def", "libvlc_vlm_get_event_manager", "(", "p_instance", ")", ":", "f", "=", "_Cfunctions", ".", "get", "(", "'libvlc_vlm_get_event_manager'", ",", "None", ")", "or", "_Cfunction", "(", "'libvlc_vlm_get_event_manager'", ",", "(", "(", "1", ",", ")", ",", ")", ",", "class_result", "(", "EventManager", ")", ",", "ctypes", ".", "c_void_p", ",", "Instance", ")", "return", "f", "(", "p_instance", ")" ]
Get libvlc_event_manager from a vlm media. The p_event_manager is immutable, so you don't have to hold the lock. @param p_instance: a libvlc instance. @return: libvlc_event_manager.
[ "Get", "libvlc_event_manager", "from", "a", "vlm", "media", ".", "The", "p_event_manager", "is", "immutable", "so", "you", "don", "t", "have", "to", "hold", "the", "lock", "." ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L6772-L6781
236,440
manns/pyspread
pyspread/src/lib/vlc.py
debug_callback
def debug_callback(event, *args, **kwds): '''Example callback, useful for debugging. ''' l = ['event %s' % (event.type,)] if args: l.extend(map(str, args)) if kwds: l.extend(sorted('%s=%s' % t for t in kwds.items())) print('Debug callback (%s)' % ', '.join(l))
python
def debug_callback(event, *args, **kwds): '''Example callback, useful for debugging. ''' l = ['event %s' % (event.type,)] if args: l.extend(map(str, args)) if kwds: l.extend(sorted('%s=%s' % t for t in kwds.items())) print('Debug callback (%s)' % ', '.join(l))
[ "def", "debug_callback", "(", "event", ",", "*", "args", ",", "*", "*", "kwds", ")", ":", "l", "=", "[", "'event %s'", "%", "(", "event", ".", "type", ",", ")", "]", "if", "args", ":", "l", ".", "extend", "(", "map", "(", "str", ",", "args", ")", ")", "if", "kwds", ":", "l", ".", "extend", "(", "sorted", "(", "'%s=%s'", "%", "t", "for", "t", "in", "kwds", ".", "items", "(", ")", ")", ")", "print", "(", "'Debug callback (%s)'", "%", "', '", ".", "join", "(", "l", ")", ")" ]
Example callback, useful for debugging.
[ "Example", "callback", "useful", "for", "debugging", "." ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L6882-L6890
236,441
manns/pyspread
pyspread/src/lib/vlc.py
EventManager.event_attach
def event_attach(self, eventtype, callback, *args, **kwds): """Register an event notification. @param eventtype: the desired event type to be notified about. @param callback: the function to call when the event occurs. @param args: optional positional arguments for the callback. @param kwds: optional keyword arguments for the callback. @return: 0 on success, ENOMEM on error. @note: The callback function must have at least one argument, an Event instance. Any other, optional positional and keyword arguments are in B{addition} to the first one. """ if not isinstance(eventtype, EventType): raise VLCException("%s required: %r" % ('EventType', eventtype)) if not hasattr(callback, '__call__'): # callable() raise VLCException("%s required: %r" % ('callable', callback)) # check that the callback expects arguments if not any(getargspec(callback)[:2]): # list(...) raise VLCException("%s required: %r" % ('argument', callback)) if self._callback_handler is None: _called_from_ctypes = ctypes.CFUNCTYPE(None, ctypes.POINTER(Event), ctypes.c_void_p) @_called_from_ctypes def _callback_handler(event, k): """(INTERNAL) handle callback call from ctypes. @note: We cannot simply make this an EventManager method since ctypes does not prepend self as the first parameter, hence this closure. """ try: # retrieve Python callback and arguments call, args, kwds = self._callbacks[k] # deref event.contents to simplify callback code call(event.contents, *args, **kwds) except KeyError: # detached? pass self._callback_handler = _callback_handler self._callbacks = {} k = eventtype.value r = libvlc_event_attach(self, k, self._callback_handler, k) if not r: self._callbacks[k] = (callback, args, kwds) return r
python
def event_attach(self, eventtype, callback, *args, **kwds): """Register an event notification. @param eventtype: the desired event type to be notified about. @param callback: the function to call when the event occurs. @param args: optional positional arguments for the callback. @param kwds: optional keyword arguments for the callback. @return: 0 on success, ENOMEM on error. @note: The callback function must have at least one argument, an Event instance. Any other, optional positional and keyword arguments are in B{addition} to the first one. """ if not isinstance(eventtype, EventType): raise VLCException("%s required: %r" % ('EventType', eventtype)) if not hasattr(callback, '__call__'): # callable() raise VLCException("%s required: %r" % ('callable', callback)) # check that the callback expects arguments if not any(getargspec(callback)[:2]): # list(...) raise VLCException("%s required: %r" % ('argument', callback)) if self._callback_handler is None: _called_from_ctypes = ctypes.CFUNCTYPE(None, ctypes.POINTER(Event), ctypes.c_void_p) @_called_from_ctypes def _callback_handler(event, k): """(INTERNAL) handle callback call from ctypes. @note: We cannot simply make this an EventManager method since ctypes does not prepend self as the first parameter, hence this closure. """ try: # retrieve Python callback and arguments call, args, kwds = self._callbacks[k] # deref event.contents to simplify callback code call(event.contents, *args, **kwds) except KeyError: # detached? pass self._callback_handler = _callback_handler self._callbacks = {} k = eventtype.value r = libvlc_event_attach(self, k, self._callback_handler, k) if not r: self._callbacks[k] = (callback, args, kwds) return r
[ "def", "event_attach", "(", "self", ",", "eventtype", ",", "callback", ",", "*", "args", ",", "*", "*", "kwds", ")", ":", "if", "not", "isinstance", "(", "eventtype", ",", "EventType", ")", ":", "raise", "VLCException", "(", "\"%s required: %r\"", "%", "(", "'EventType'", ",", "eventtype", ")", ")", "if", "not", "hasattr", "(", "callback", ",", "'__call__'", ")", ":", "# callable()", "raise", "VLCException", "(", "\"%s required: %r\"", "%", "(", "'callable'", ",", "callback", ")", ")", "# check that the callback expects arguments", "if", "not", "any", "(", "getargspec", "(", "callback", ")", "[", ":", "2", "]", ")", ":", "# list(...)", "raise", "VLCException", "(", "\"%s required: %r\"", "%", "(", "'argument'", ",", "callback", ")", ")", "if", "self", ".", "_callback_handler", "is", "None", ":", "_called_from_ctypes", "=", "ctypes", ".", "CFUNCTYPE", "(", "None", ",", "ctypes", ".", "POINTER", "(", "Event", ")", ",", "ctypes", ".", "c_void_p", ")", "@", "_called_from_ctypes", "def", "_callback_handler", "(", "event", ",", "k", ")", ":", "\"\"\"(INTERNAL) handle callback call from ctypes.\n\n @note: We cannot simply make this an EventManager\n method since ctypes does not prepend self as the\n first parameter, hence this closure.\n \"\"\"", "try", ":", "# retrieve Python callback and arguments", "call", ",", "args", ",", "kwds", "=", "self", ".", "_callbacks", "[", "k", "]", "# deref event.contents to simplify callback code", "call", "(", "event", ".", "contents", ",", "*", "args", ",", "*", "*", "kwds", ")", "except", "KeyError", ":", "# detached?", "pass", "self", ".", "_callback_handler", "=", "_callback_handler", "self", ".", "_callbacks", "=", "{", "}", "k", "=", "eventtype", ".", "value", "r", "=", "libvlc_event_attach", "(", "self", ",", "k", ",", "self", ".", "_callback_handler", ",", "k", ")", "if", "not", "r", ":", "self", ".", "_callbacks", "[", "k", "]", "=", "(", "callback", ",", "args", ",", "kwds", ")", "return", "r" ]
Register an event notification. @param eventtype: the desired event type to be notified about. @param callback: the function to call when the event occurs. @param args: optional positional arguments for the callback. @param kwds: optional keyword arguments for the callback. @return: 0 on success, ENOMEM on error. @note: The callback function must have at least one argument, an Event instance. Any other, optional positional and keyword arguments are in B{addition} to the first one.
[ "Register", "an", "event", "notification", "." ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L1428-L1472
236,442
manns/pyspread
pyspread/src/lib/vlc.py
Instance.media_player_new
def media_player_new(self, uri=None): """Create a new MediaPlayer instance. @param uri: an optional URI to play in the player. """ p = libvlc_media_player_new(self) if uri: p.set_media(self.media_new(uri)) p._instance = self return p
python
def media_player_new(self, uri=None): """Create a new MediaPlayer instance. @param uri: an optional URI to play in the player. """ p = libvlc_media_player_new(self) if uri: p.set_media(self.media_new(uri)) p._instance = self return p
[ "def", "media_player_new", "(", "self", ",", "uri", "=", "None", ")", ":", "p", "=", "libvlc_media_player_new", "(", "self", ")", "if", "uri", ":", "p", ".", "set_media", "(", "self", ".", "media_new", "(", "uri", ")", ")", "p", ".", "_instance", "=", "self", "return", "p" ]
Create a new MediaPlayer instance. @param uri: an optional URI to play in the player.
[ "Create", "a", "new", "MediaPlayer", "instance", "." ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L1519-L1528
236,443
manns/pyspread
pyspread/src/lib/vlc.py
Instance.media_new
def media_new(self, mrl, *options): """Create a new Media instance. If mrl contains a colon (:) preceded by more than 1 letter, it will be treated as a URL. Else, it will be considered as a local path. If you need more control, directly use media_new_location/media_new_path methods. Options can be specified as supplementary string parameters, but note that many options cannot be set at the media level, and rather at the Instance level. For instance, the marquee filter must be specified when creating the vlc.Instance or vlc.MediaPlayer. Alternatively, options can be added to the media using the Media.add_options method (with the same limitation). @param options: optional media option=value strings """ if ':' in mrl and mrl.index(':') > 1: # Assume it is a URL m = libvlc_media_new_location(self, str_to_bytes(mrl)) else: # Else it should be a local path. m = libvlc_media_new_path(self, str_to_bytes(os.path.normpath(mrl))) for o in options: libvlc_media_add_option(m, str_to_bytes(o)) m._instance = self return m
python
def media_new(self, mrl, *options): """Create a new Media instance. If mrl contains a colon (:) preceded by more than 1 letter, it will be treated as a URL. Else, it will be considered as a local path. If you need more control, directly use media_new_location/media_new_path methods. Options can be specified as supplementary string parameters, but note that many options cannot be set at the media level, and rather at the Instance level. For instance, the marquee filter must be specified when creating the vlc.Instance or vlc.MediaPlayer. Alternatively, options can be added to the media using the Media.add_options method (with the same limitation). @param options: optional media option=value strings """ if ':' in mrl and mrl.index(':') > 1: # Assume it is a URL m = libvlc_media_new_location(self, str_to_bytes(mrl)) else: # Else it should be a local path. m = libvlc_media_new_path(self, str_to_bytes(os.path.normpath(mrl))) for o in options: libvlc_media_add_option(m, str_to_bytes(o)) m._instance = self return m
[ "def", "media_new", "(", "self", ",", "mrl", ",", "*", "options", ")", ":", "if", "':'", "in", "mrl", "and", "mrl", ".", "index", "(", "':'", ")", ">", "1", ":", "# Assume it is a URL", "m", "=", "libvlc_media_new_location", "(", "self", ",", "str_to_bytes", "(", "mrl", ")", ")", "else", ":", "# Else it should be a local path.", "m", "=", "libvlc_media_new_path", "(", "self", ",", "str_to_bytes", "(", "os", ".", "path", ".", "normpath", "(", "mrl", ")", ")", ")", "for", "o", "in", "options", ":", "libvlc_media_add_option", "(", "m", ",", "str_to_bytes", "(", "o", ")", ")", "m", ".", "_instance", "=", "self", "return", "m" ]
Create a new Media instance. If mrl contains a colon (:) preceded by more than 1 letter, it will be treated as a URL. Else, it will be considered as a local path. If you need more control, directly use media_new_location/media_new_path methods. Options can be specified as supplementary string parameters, but note that many options cannot be set at the media level, and rather at the Instance level. For instance, the marquee filter must be specified when creating the vlc.Instance or vlc.MediaPlayer. Alternatively, options can be added to the media using the Media.add_options method (with the same limitation). @param options: optional media option=value strings
[ "Create", "a", "new", "Media", "instance", "." ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L1537-L1565
236,444
manns/pyspread
pyspread/src/lib/vlc.py
Instance.media_list_new
def media_list_new(self, mrls=None): """Create a new MediaList instance. @param mrls: optional list of MRL strings """ l = libvlc_media_list_new(self) # We should take the lock, but since we did not leak the # reference, nobody else can access it. if mrls: for m in mrls: l.add_media(m) l._instance = self return l
python
def media_list_new(self, mrls=None): """Create a new MediaList instance. @param mrls: optional list of MRL strings """ l = libvlc_media_list_new(self) # We should take the lock, but since we did not leak the # reference, nobody else can access it. if mrls: for m in mrls: l.add_media(m) l._instance = self return l
[ "def", "media_list_new", "(", "self", ",", "mrls", "=", "None", ")", ":", "l", "=", "libvlc_media_list_new", "(", "self", ")", "# We should take the lock, but since we did not leak the", "# reference, nobody else can access it.", "if", "mrls", ":", "for", "m", "in", "mrls", ":", "l", ".", "add_media", "(", "m", ")", "l", ".", "_instance", "=", "self", "return", "l" ]
Create a new MediaList instance. @param mrls: optional list of MRL strings
[ "Create", "a", "new", "MediaList", "instance", "." ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L1567-L1578
236,445
manns/pyspread
pyspread/src/lib/vlc.py
Instance.audio_output_enumerate_devices
def audio_output_enumerate_devices(self): """Enumerate the defined audio output devices. @return: list of dicts {name:, description:, devices:} """ r = [] head = libvlc_audio_output_list_get(self) if head: i = head while i: i = i.contents d = [{'id': libvlc_audio_output_device_id (self, i.name, d), 'longname': libvlc_audio_output_device_longname(self, i.name, d)} for d in range(libvlc_audio_output_device_count (self, i.name))] r.append({'name': i.name, 'description': i.description, 'devices': d}) i = i.next libvlc_audio_output_list_release(head) return r
python
def audio_output_enumerate_devices(self): """Enumerate the defined audio output devices. @return: list of dicts {name:, description:, devices:} """ r = [] head = libvlc_audio_output_list_get(self) if head: i = head while i: i = i.contents d = [{'id': libvlc_audio_output_device_id (self, i.name, d), 'longname': libvlc_audio_output_device_longname(self, i.name, d)} for d in range(libvlc_audio_output_device_count (self, i.name))] r.append({'name': i.name, 'description': i.description, 'devices': d}) i = i.next libvlc_audio_output_list_release(head) return r
[ "def", "audio_output_enumerate_devices", "(", "self", ")", ":", "r", "=", "[", "]", "head", "=", "libvlc_audio_output_list_get", "(", "self", ")", "if", "head", ":", "i", "=", "head", "while", "i", ":", "i", "=", "i", ".", "contents", "d", "=", "[", "{", "'id'", ":", "libvlc_audio_output_device_id", "(", "self", ",", "i", ".", "name", ",", "d", ")", ",", "'longname'", ":", "libvlc_audio_output_device_longname", "(", "self", ",", "i", ".", "name", ",", "d", ")", "}", "for", "d", "in", "range", "(", "libvlc_audio_output_device_count", "(", "self", ",", "i", ".", "name", ")", ")", "]", "r", ".", "append", "(", "{", "'name'", ":", "i", ".", "name", ",", "'description'", ":", "i", ".", "description", ",", "'devices'", ":", "d", "}", ")", "i", "=", "i", ".", "next", "libvlc_audio_output_list_release", "(", "head", ")", "return", "r" ]
Enumerate the defined audio output devices. @return: list of dicts {name:, description:, devices:}
[ "Enumerate", "the", "defined", "audio", "output", "devices", "." ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L1580-L1597
236,446
manns/pyspread
pyspread/src/lib/vlc.py
Instance.vlm_add_input
def vlm_add_input(self, psz_name, psz_input): '''Add a media's input MRL. This will add the specified one. @param psz_name: the media to work on. @param psz_input: the input MRL. @return: 0 on success, -1 on error. ''' return libvlc_vlm_add_input(self, str_to_bytes(psz_name), str_to_bytes(psz_input))
python
def vlm_add_input(self, psz_name, psz_input): '''Add a media's input MRL. This will add the specified one. @param psz_name: the media to work on. @param psz_input: the input MRL. @return: 0 on success, -1 on error. ''' return libvlc_vlm_add_input(self, str_to_bytes(psz_name), str_to_bytes(psz_input))
[ "def", "vlm_add_input", "(", "self", ",", "psz_name", ",", "psz_input", ")", ":", "return", "libvlc_vlm_add_input", "(", "self", ",", "str_to_bytes", "(", "psz_name", ")", ",", "str_to_bytes", "(", "psz_input", ")", ")" ]
Add a media's input MRL. This will add the specified one. @param psz_name: the media to work on. @param psz_input: the input MRL. @return: 0 on success, -1 on error.
[ "Add", "a", "media", "s", "input", "MRL", ".", "This", "will", "add", "the", "specified", "one", "." ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L1869-L1875
236,447
manns/pyspread
pyspread/src/lib/vlc.py
Instance.vlm_change_media
def vlm_change_media(self, psz_name, psz_input, psz_output, i_options, ppsz_options, b_enabled, b_loop): '''Edit the parameters of a media. This will delete all existing inputs and add the specified one. @param psz_name: the name of the new broadcast. @param psz_input: the input MRL. @param psz_output: the output MRL (the parameter to the "sout" variable). @param i_options: number of additional options. @param ppsz_options: additional options. @param b_enabled: boolean for enabling the new broadcast. @param b_loop: Should this broadcast be played in loop ? @return: 0 on success, -1 on error. ''' return libvlc_vlm_change_media(self, str_to_bytes(psz_name), str_to_bytes(psz_input), str_to_bytes(psz_output), i_options, ppsz_options, b_enabled, b_loop)
python
def vlm_change_media(self, psz_name, psz_input, psz_output, i_options, ppsz_options, b_enabled, b_loop): '''Edit the parameters of a media. This will delete all existing inputs and add the specified one. @param psz_name: the name of the new broadcast. @param psz_input: the input MRL. @param psz_output: the output MRL (the parameter to the "sout" variable). @param i_options: number of additional options. @param ppsz_options: additional options. @param b_enabled: boolean for enabling the new broadcast. @param b_loop: Should this broadcast be played in loop ? @return: 0 on success, -1 on error. ''' return libvlc_vlm_change_media(self, str_to_bytes(psz_name), str_to_bytes(psz_input), str_to_bytes(psz_output), i_options, ppsz_options, b_enabled, b_loop)
[ "def", "vlm_change_media", "(", "self", ",", "psz_name", ",", "psz_input", ",", "psz_output", ",", "i_options", ",", "ppsz_options", ",", "b_enabled", ",", "b_loop", ")", ":", "return", "libvlc_vlm_change_media", "(", "self", ",", "str_to_bytes", "(", "psz_name", ")", ",", "str_to_bytes", "(", "psz_input", ")", ",", "str_to_bytes", "(", "psz_output", ")", ",", "i_options", ",", "ppsz_options", ",", "b_enabled", ",", "b_loop", ")" ]
Edit the parameters of a media. This will delete all existing inputs and add the specified one. @param psz_name: the name of the new broadcast. @param psz_input: the input MRL. @param psz_output: the output MRL (the parameter to the "sout" variable). @param i_options: number of additional options. @param ppsz_options: additional options. @param b_enabled: boolean for enabling the new broadcast. @param b_loop: Should this broadcast be played in loop ? @return: 0 on success, -1 on error.
[ "Edit", "the", "parameters", "of", "a", "media", ".", "This", "will", "delete", "all", "existing", "inputs", "and", "add", "the", "specified", "one", "." ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L1896-L1908
236,448
manns/pyspread
pyspread/src/lib/vlc.py
MediaPlayer.set_mrl
def set_mrl(self, mrl, *options): """Set the MRL to play. Warning: most audio and video options, such as text renderer, have no effects on an individual media. These options must be set at the vlc.Instance or vlc.MediaPlayer instanciation. @param mrl: The MRL @param options: optional media option=value strings @return: the Media object """ m = self.get_instance().media_new(mrl, *options) self.set_media(m) return m
python
def set_mrl(self, mrl, *options): """Set the MRL to play. Warning: most audio and video options, such as text renderer, have no effects on an individual media. These options must be set at the vlc.Instance or vlc.MediaPlayer instanciation. @param mrl: The MRL @param options: optional media option=value strings @return: the Media object """ m = self.get_instance().media_new(mrl, *options) self.set_media(m) return m
[ "def", "set_mrl", "(", "self", ",", "mrl", ",", "*", "options", ")", ":", "m", "=", "self", ".", "get_instance", "(", ")", ".", "media_new", "(", "mrl", ",", "*", "options", ")", "self", ".", "set_media", "(", "m", ")", "return", "m" ]
Set the MRL to play. Warning: most audio and video options, such as text renderer, have no effects on an individual media. These options must be set at the vlc.Instance or vlc.MediaPlayer instanciation. @param mrl: The MRL @param options: optional media option=value strings @return: the Media object
[ "Set", "the", "MRL", "to", "play", "." ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L2727-L2740
236,449
manns/pyspread
pyspread/src/lib/undo.py
_Action.do
def do(self): 'Do or redo the action' self._runner = self._generator(*self.args, **self.kwargs) rets = next(self._runner) if isinstance(rets, tuple): self._text = rets[0] return rets[1:] elif rets is None: self._text = '' return None else: self._text = rets return None
python
def do(self): 'Do or redo the action' self._runner = self._generator(*self.args, **self.kwargs) rets = next(self._runner) if isinstance(rets, tuple): self._text = rets[0] return rets[1:] elif rets is None: self._text = '' return None else: self._text = rets return None
[ "def", "do", "(", "self", ")", ":", "self", ".", "_runner", "=", "self", ".", "_generator", "(", "*", "self", ".", "args", ",", "*", "*", "self", ".", "kwargs", ")", "rets", "=", "next", "(", "self", ".", "_runner", ")", "if", "isinstance", "(", "rets", ",", "tuple", ")", ":", "self", ".", "_text", "=", "rets", "[", "0", "]", "return", "rets", "[", "1", ":", "]", "elif", "rets", "is", "None", ":", "self", ".", "_text", "=", "''", "return", "None", "else", ":", "self", ".", "_text", "=", "rets", "return", "None" ]
Do or redo the action
[ "Do", "or", "redo", "the", "action" ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/undo.py#L44-L56
236,450
manns/pyspread
pyspread/src/lib/undo.py
Stack.redo
def redo(self): ''' Redo the last undone action. This is only possible if no other actions have occurred since the last undo call. ''' if self.canredo(): undoable = self._redos.pop() with self._pausereceiver(): try: undoable.do() except: self.clear() raise else: self._undos.append(undoable) self.docallback()
python
def redo(self): ''' Redo the last undone action. This is only possible if no other actions have occurred since the last undo call. ''' if self.canredo(): undoable = self._redos.pop() with self._pausereceiver(): try: undoable.do() except: self.clear() raise else: self._undos.append(undoable) self.docallback()
[ "def", "redo", "(", "self", ")", ":", "if", "self", ".", "canredo", "(", ")", ":", "undoable", "=", "self", ".", "_redos", ".", "pop", "(", ")", "with", "self", ".", "_pausereceiver", "(", ")", ":", "try", ":", "undoable", ".", "do", "(", ")", "except", ":", "self", ".", "clear", "(", ")", "raise", "else", ":", "self", ".", "_undos", ".", "append", "(", "undoable", ")", "self", ".", "docallback", "(", ")" ]
Redo the last undone action. This is only possible if no other actions have occurred since the last undo call.
[ "Redo", "the", "last", "undone", "action", ".", "This", "is", "only", "possible", "if", "no", "other", "actions", "have", "occurred", "since", "the", "last", "undo", "call", "." ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/undo.py#L214-L230
236,451
manns/pyspread
pyspread/src/lib/undo.py
Stack.clear
def clear(self): ''' Clear the undo list. ''' self._undos.clear() self._redos.clear() self._savepoint = None self._receiver = self._undos
python
def clear(self): ''' Clear the undo list. ''' self._undos.clear() self._redos.clear() self._savepoint = None self._receiver = self._undos
[ "def", "clear", "(", "self", ")", ":", "self", ".", "_undos", ".", "clear", "(", ")", "self", ".", "_redos", ".", "clear", "(", ")", "self", ".", "_savepoint", "=", "None", "self", ".", "_receiver", "=", "self", ".", "_undos" ]
Clear the undo list.
[ "Clear", "the", "undo", "list", "." ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/undo.py#L246-L251
236,452
manns/pyspread
pyspread/src/lib/xrect.py
Rect.is_bbox_not_intersecting
def is_bbox_not_intersecting(self, other): """Returns False iif bounding boxed of self and other intersect""" self_x_min, self_x_max, self_y_min, self_y_max = self.get_bbox() other_x_min, other_x_max, other_y_min, other_y_max = other.get_bbox() return \ self_x_min > other_x_max or \ other_x_min > self_x_max or \ self_y_min > other_y_max or \ other_y_min > self_y_max
python
def is_bbox_not_intersecting(self, other): """Returns False iif bounding boxed of self and other intersect""" self_x_min, self_x_max, self_y_min, self_y_max = self.get_bbox() other_x_min, other_x_max, other_y_min, other_y_max = other.get_bbox() return \ self_x_min > other_x_max or \ other_x_min > self_x_max or \ self_y_min > other_y_max or \ other_y_min > self_y_max
[ "def", "is_bbox_not_intersecting", "(", "self", ",", "other", ")", ":", "self_x_min", ",", "self_x_max", ",", "self_y_min", ",", "self_y_max", "=", "self", ".", "get_bbox", "(", ")", "other_x_min", ",", "other_x_max", ",", "other_y_min", ",", "other_y_max", "=", "other", ".", "get_bbox", "(", ")", "return", "self_x_min", ">", "other_x_max", "or", "other_x_min", ">", "self_x_max", "or", "self_y_min", ">", "other_y_max", "or", "other_y_min", ">", "self_y_max" ]
Returns False iif bounding boxed of self and other intersect
[ "Returns", "False", "iif", "bounding", "boxed", "of", "self", "and", "other", "intersect" ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/xrect.py#L47-L57
236,453
manns/pyspread
pyspread/src/lib/xrect.py
RotoOriginRect.is_edge_not_excluding_vertices
def is_edge_not_excluding_vertices(self, other): """Returns False iif any edge excludes all vertices of other.""" c_a = cos(self.angle) s_a = sin(self.angle) # Get min and max of other. other_x_min, other_x_max, other_y_min, other_y_max = other.get_bbox() self_x_diff = 0.5 * self.width self_y_diff = 0.5 * self.height if c_a > 0: if s_a > 0: return \ c_a * other_x_max + s_a * other_y_max < -self_x_diff or \ c_a * other_x_min + s_a * other_y_min > self_x_diff or \ c_a * other_y_max - s_a * other_x_min < -self_y_diff or \ c_a * other_y_min - s_a * other_x_max > self_y_diff else: # s_a <= 0.0 return \ c_a * other_x_max + s_a * other_y_min < -self_x_diff or \ c_a * other_x_min + s_a * other_y_max > self_x_diff or \ c_a * other_y_max - s_a * other_x_max < -self_y_diff or \ c_a * other_y_min - s_a * other_x_min > self_y_diff else: # c_a <= 0.0 if s_a > 0: return \ c_a * other_x_min + s_a * other_y_max < -self_x_diff or \ c_a * other_x_max + s_a * other_y_min > self_x_diff or \ c_a * other_y_min - s_a * other_x_min < -self_y_diff or \ c_a * other_y_max - s_a * other_x_max > self_y_diff else: # s_a <= 0.0 return \ c_a * other_x_min + s_a * other_y_min < -self_x_diff or \ c_a * other_x_max + s_a * other_y_max > self_x_diff or \ c_a * other_y_min - s_a * other_x_max < -self_y_diff or \ c_a * other_y_max - s_a * other_x_min > self_y_diff
python
def is_edge_not_excluding_vertices(self, other): """Returns False iif any edge excludes all vertices of other.""" c_a = cos(self.angle) s_a = sin(self.angle) # Get min and max of other. other_x_min, other_x_max, other_y_min, other_y_max = other.get_bbox() self_x_diff = 0.5 * self.width self_y_diff = 0.5 * self.height if c_a > 0: if s_a > 0: return \ c_a * other_x_max + s_a * other_y_max < -self_x_diff or \ c_a * other_x_min + s_a * other_y_min > self_x_diff or \ c_a * other_y_max - s_a * other_x_min < -self_y_diff or \ c_a * other_y_min - s_a * other_x_max > self_y_diff else: # s_a <= 0.0 return \ c_a * other_x_max + s_a * other_y_min < -self_x_diff or \ c_a * other_x_min + s_a * other_y_max > self_x_diff or \ c_a * other_y_max - s_a * other_x_max < -self_y_diff or \ c_a * other_y_min - s_a * other_x_min > self_y_diff else: # c_a <= 0.0 if s_a > 0: return \ c_a * other_x_min + s_a * other_y_max < -self_x_diff or \ c_a * other_x_max + s_a * other_y_min > self_x_diff or \ c_a * other_y_min - s_a * other_x_min < -self_y_diff or \ c_a * other_y_max - s_a * other_x_max > self_y_diff else: # s_a <= 0.0 return \ c_a * other_x_min + s_a * other_y_min < -self_x_diff or \ c_a * other_x_max + s_a * other_y_max > self_x_diff or \ c_a * other_y_min - s_a * other_x_max < -self_y_diff or \ c_a * other_y_max - s_a * other_x_min > self_y_diff
[ "def", "is_edge_not_excluding_vertices", "(", "self", ",", "other", ")", ":", "c_a", "=", "cos", "(", "self", ".", "angle", ")", "s_a", "=", "sin", "(", "self", ".", "angle", ")", "# Get min and max of other.", "other_x_min", ",", "other_x_max", ",", "other_y_min", ",", "other_y_max", "=", "other", ".", "get_bbox", "(", ")", "self_x_diff", "=", "0.5", "*", "self", ".", "width", "self_y_diff", "=", "0.5", "*", "self", ".", "height", "if", "c_a", ">", "0", ":", "if", "s_a", ">", "0", ":", "return", "c_a", "*", "other_x_max", "+", "s_a", "*", "other_y_max", "<", "-", "self_x_diff", "or", "c_a", "*", "other_x_min", "+", "s_a", "*", "other_y_min", ">", "self_x_diff", "or", "c_a", "*", "other_y_max", "-", "s_a", "*", "other_x_min", "<", "-", "self_y_diff", "or", "c_a", "*", "other_y_min", "-", "s_a", "*", "other_x_max", ">", "self_y_diff", "else", ":", "# s_a <= 0.0", "return", "c_a", "*", "other_x_max", "+", "s_a", "*", "other_y_min", "<", "-", "self_x_diff", "or", "c_a", "*", "other_x_min", "+", "s_a", "*", "other_y_max", ">", "self_x_diff", "or", "c_a", "*", "other_y_max", "-", "s_a", "*", "other_x_max", "<", "-", "self_y_diff", "or", "c_a", "*", "other_y_min", "-", "s_a", "*", "other_x_min", ">", "self_y_diff", "else", ":", "# c_a <= 0.0", "if", "s_a", ">", "0", ":", "return", "c_a", "*", "other_x_min", "+", "s_a", "*", "other_y_max", "<", "-", "self_x_diff", "or", "c_a", "*", "other_x_max", "+", "s_a", "*", "other_y_min", ">", "self_x_diff", "or", "c_a", "*", "other_y_min", "-", "s_a", "*", "other_x_min", "<", "-", "self_y_diff", "or", "c_a", "*", "other_y_max", "-", "s_a", "*", "other_x_max", ">", "self_y_diff", "else", ":", "# s_a <= 0.0", "return", "c_a", "*", "other_x_min", "+", "s_a", "*", "other_y_min", "<", "-", "self_x_diff", "or", "c_a", "*", "other_x_max", "+", "s_a", "*", "other_y_max", ">", "self_x_diff", "or", "c_a", "*", "other_y_min", "-", "s_a", "*", "other_x_max", "<", "-", "self_y_diff", "or", "c_a", "*", "other_y_max", "-", "s_a", "*", "other_x_min", ">", "self_y_diff" ]
Returns False iif any edge excludes all vertices of other.
[ "Returns", "False", "iif", "any", "edge", "excludes", "all", "vertices", "of", "other", "." ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/xrect.py#L151-L192
236,454
manns/pyspread
pyspread/src/lib/xrect.py
RotoOriginRect.collides
def collides(self, other): """Returns collision with axis aligned rect""" angle = self.angle width = self.width height = self.height if angle == 0: return other.collides(Rect(-0.5 * width, -0.5 * height, width, height)) # Phase 1 # # * Form bounding box on tilted rectangle P. # * Check whether bounding box and other intersect. # * If not, then self and other do not intersect. # * Otherwise proceed to Phase 2. # Now perform the standard rectangle intersection test. if self.is_bbox_not_intersecting(other): return False # Phase 2 # # If we get here, check the edges of self to see # * if one of them excludes all vertices of other. # * If so, then self and other do not intersect. # * (If not, then self and other do intersect.) return not self.is_edge_not_excluding_vertices(other)
python
def collides(self, other): """Returns collision with axis aligned rect""" angle = self.angle width = self.width height = self.height if angle == 0: return other.collides(Rect(-0.5 * width, -0.5 * height, width, height)) # Phase 1 # # * Form bounding box on tilted rectangle P. # * Check whether bounding box and other intersect. # * If not, then self and other do not intersect. # * Otherwise proceed to Phase 2. # Now perform the standard rectangle intersection test. if self.is_bbox_not_intersecting(other): return False # Phase 2 # # If we get here, check the edges of self to see # * if one of them excludes all vertices of other. # * If so, then self and other do not intersect. # * (If not, then self and other do intersect.) return not self.is_edge_not_excluding_vertices(other)
[ "def", "collides", "(", "self", ",", "other", ")", ":", "angle", "=", "self", ".", "angle", "width", "=", "self", ".", "width", "height", "=", "self", ".", "height", "if", "angle", "==", "0", ":", "return", "other", ".", "collides", "(", "Rect", "(", "-", "0.5", "*", "width", ",", "-", "0.5", "*", "height", ",", "width", ",", "height", ")", ")", "# Phase 1", "#", "# * Form bounding box on tilted rectangle P.", "# * Check whether bounding box and other intersect.", "# * If not, then self and other do not intersect.", "# * Otherwise proceed to Phase 2.", "# Now perform the standard rectangle intersection test.", "if", "self", ".", "is_bbox_not_intersecting", "(", "other", ")", ":", "return", "False", "# Phase 2", "#", "# If we get here, check the edges of self to see", "# * if one of them excludes all vertices of other.", "# * If so, then self and other do not intersect.", "# * (If not, then self and other do intersect.)", "return", "not", "self", ".", "is_edge_not_excluding_vertices", "(", "other", ")" ]
Returns collision with axis aligned rect
[ "Returns", "collision", "with", "axis", "aligned", "rect" ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/xrect.py#L194-L224
236,455
manns/pyspread
pyspread/src/lib/xrect.py
RotoRect.get_vec_lr
def get_vec_lr(self): """Returns vector from left to right""" return self.width * self.cos_a(), -self.width * self.sin_a()
python
def get_vec_lr(self): """Returns vector from left to right""" return self.width * self.cos_a(), -self.width * self.sin_a()
[ "def", "get_vec_lr", "(", "self", ")", ":", "return", "self", ".", "width", "*", "self", ".", "cos_a", "(", ")", ",", "-", "self", ".", "width", "*", "self", ".", "sin_a", "(", ")" ]
Returns vector from left to right
[ "Returns", "vector", "from", "left", "to", "right" ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/xrect.py#L268-L271
236,456
manns/pyspread
pyspread/src/lib/xrect.py
RotoRect.get_vec_tb
def get_vec_tb(self): """Returns vector from top to bottom""" return self.height * self.sin_a(), self.height * self.cos_a()
python
def get_vec_tb(self): """Returns vector from top to bottom""" return self.height * self.sin_a(), self.height * self.cos_a()
[ "def", "get_vec_tb", "(", "self", ")", ":", "return", "self", ".", "height", "*", "self", ".", "sin_a", "(", ")", ",", "self", ".", "height", "*", "self", ".", "cos_a", "(", ")" ]
Returns vector from top to bottom
[ "Returns", "vector", "from", "top", "to", "bottom" ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/xrect.py#L273-L276
236,457
manns/pyspread
pyspread/src/lib/xrect.py
RotoRect.get_center
def get_center(self): """Returns rectangle center""" lr_x, lr_y = self.get_vec_lr() tb_x, tb_y = self.get_vec_tb() center_x = self.x + (lr_x + tb_x) / 2.0 center_y = self.y + (lr_y + tb_y) / 2.0 return center_x, center_y
python
def get_center(self): """Returns rectangle center""" lr_x, lr_y = self.get_vec_lr() tb_x, tb_y = self.get_vec_tb() center_x = self.x + (lr_x + tb_x) / 2.0 center_y = self.y + (lr_y + tb_y) / 2.0 return center_x, center_y
[ "def", "get_center", "(", "self", ")", ":", "lr_x", ",", "lr_y", "=", "self", ".", "get_vec_lr", "(", ")", "tb_x", ",", "tb_y", "=", "self", ".", "get_vec_tb", "(", ")", "center_x", "=", "self", ".", "x", "+", "(", "lr_x", "+", "tb_x", ")", "/", "2.0", "center_y", "=", "self", ".", "y", "+", "(", "lr_y", "+", "tb_y", ")", "/", "2.0", "return", "center_x", ",", "center_y" ]
Returns rectangle center
[ "Returns", "rectangle", "center" ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/xrect.py#L279-L288
236,458
manns/pyspread
pyspread/src/lib/xrect.py
RotoRect.get_edges
def get_edges(self): """Returns 2-tuples for each edge top_left top_right bottom_left bottom_right """ lr_x, lr_y = self.get_vec_lr() tb_x, tb_y = self.get_vec_tb() top_left = self.x, self.y top_right = self.x + lr_x, self.y + lr_y bottom_left = self.x + tb_x, self.y + tb_y bottom_right = self.x + lr_x + tb_x, self.y + lr_y + tb_y return top_left, top_right, bottom_left, bottom_right
python
def get_edges(self): """Returns 2-tuples for each edge top_left top_right bottom_left bottom_right """ lr_x, lr_y = self.get_vec_lr() tb_x, tb_y = self.get_vec_tb() top_left = self.x, self.y top_right = self.x + lr_x, self.y + lr_y bottom_left = self.x + tb_x, self.y + tb_y bottom_right = self.x + lr_x + tb_x, self.y + lr_y + tb_y return top_left, top_right, bottom_left, bottom_right
[ "def", "get_edges", "(", "self", ")", ":", "lr_x", ",", "lr_y", "=", "self", ".", "get_vec_lr", "(", ")", "tb_x", ",", "tb_y", "=", "self", ".", "get_vec_tb", "(", ")", "top_left", "=", "self", ".", "x", ",", "self", ".", "y", "top_right", "=", "self", ".", "x", "+", "lr_x", ",", "self", ".", "y", "+", "lr_y", "bottom_left", "=", "self", ".", "x", "+", "tb_x", ",", "self", ".", "y", "+", "tb_y", "bottom_right", "=", "self", ".", "x", "+", "lr_x", "+", "tb_x", ",", "self", ".", "y", "+", "lr_y", "+", "tb_y", "return", "top_left", ",", "top_right", ",", "bottom_left", ",", "bottom_right" ]
Returns 2-tuples for each edge top_left top_right bottom_left bottom_right
[ "Returns", "2", "-", "tuples", "for", "each", "edge" ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/xrect.py#L290-L308
236,459
manns/pyspread
pyspread/src/lib/xrect.py
RotoRect.collides_axisaligned_rect
def collides_axisaligned_rect(self, other): """Returns collision with axis aligned other rect""" # Shift both rects so that self is centered at origin self_shifted = RotoOriginRect(self.width, self.height, -self.angle) s_a = self.sin_a() c_a = self.cos_a() center_x = self.x + self.width / 2.0 * c_a - self.height / 2.0 * s_a center_y = self.y - self.height / 2.0 * c_a - self.width / 2.0 * s_a other_shifted = Rect(other.x - center_x, other.y - center_y, other.width, other.height) # Calculate collision return self_shifted.collides(other_shifted)
python
def collides_axisaligned_rect(self, other): """Returns collision with axis aligned other rect""" # Shift both rects so that self is centered at origin self_shifted = RotoOriginRect(self.width, self.height, -self.angle) s_a = self.sin_a() c_a = self.cos_a() center_x = self.x + self.width / 2.0 * c_a - self.height / 2.0 * s_a center_y = self.y - self.height / 2.0 * c_a - self.width / 2.0 * s_a other_shifted = Rect(other.x - center_x, other.y - center_y, other.width, other.height) # Calculate collision return self_shifted.collides(other_shifted)
[ "def", "collides_axisaligned_rect", "(", "self", ",", "other", ")", ":", "# Shift both rects so that self is centered at origin", "self_shifted", "=", "RotoOriginRect", "(", "self", ".", "width", ",", "self", ".", "height", ",", "-", "self", ".", "angle", ")", "s_a", "=", "self", ".", "sin_a", "(", ")", "c_a", "=", "self", ".", "cos_a", "(", ")", "center_x", "=", "self", ".", "x", "+", "self", ".", "width", "/", "2.0", "*", "c_a", "-", "self", ".", "height", "/", "2.0", "*", "s_a", "center_y", "=", "self", ".", "y", "-", "self", ".", "height", "/", "2.0", "*", "c_a", "-", "self", ".", "width", "/", "2.0", "*", "s_a", "other_shifted", "=", "Rect", "(", "other", ".", "x", "-", "center_x", ",", "other", ".", "y", "-", "center_y", ",", "other", ".", "width", ",", "other", ".", "height", ")", "# Calculate collision", "return", "self_shifted", ".", "collides", "(", "other_shifted", ")" ]
Returns collision with axis aligned other rect
[ "Returns", "collision", "with", "axis", "aligned", "other", "rect" ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/xrect.py#L310-L328
236,460
manns/pyspread
pyspread/src/gui/icons.py
GtkArtProvider.get_paths
def get_paths(self, theme, icon_size): """Returns tuple of theme, icon, action and toggle paths""" _size_str = "x".join(map(str, icon_size)) theme_path = get_program_path() + "share" + os.sep + "icons" + os.sep icon_path = theme_path + theme + os.sep + _size_str + os.sep action_path = icon_path + "actions" + os.sep toggle_path = icon_path + "toggles" + os.sep return theme_path, icon_path, action_path, toggle_path
python
def get_paths(self, theme, icon_size): """Returns tuple of theme, icon, action and toggle paths""" _size_str = "x".join(map(str, icon_size)) theme_path = get_program_path() + "share" + os.sep + "icons" + os.sep icon_path = theme_path + theme + os.sep + _size_str + os.sep action_path = icon_path + "actions" + os.sep toggle_path = icon_path + "toggles" + os.sep return theme_path, icon_path, action_path, toggle_path
[ "def", "get_paths", "(", "self", ",", "theme", ",", "icon_size", ")", ":", "_size_str", "=", "\"x\"", ".", "join", "(", "map", "(", "str", ",", "icon_size", ")", ")", "theme_path", "=", "get_program_path", "(", ")", "+", "\"share\"", "+", "os", ".", "sep", "+", "\"icons\"", "+", "os", ".", "sep", "icon_path", "=", "theme_path", "+", "theme", "+", "os", ".", "sep", "+", "_size_str", "+", "os", ".", "sep", "action_path", "=", "icon_path", "+", "\"actions\"", "+", "os", ".", "sep", "toggle_path", "=", "icon_path", "+", "\"toggles\"", "+", "os", ".", "sep", "return", "theme_path", ",", "icon_path", ",", "action_path", ",", "toggle_path" ]
Returns tuple of theme, icon, action and toggle paths
[ "Returns", "tuple", "of", "theme", "icon", "action", "and", "toggle", "paths" ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/icons.py#L108-L118
236,461
manns/pyspread
pyspread/src/gui/icons.py
GtkArtProvider.CreateBitmap
def CreateBitmap(self, artid, client, size): """Adds custom images to Artprovider""" if artid in self.extra_icons: return wx.Bitmap(self.extra_icons[artid], wx.BITMAP_TYPE_ANY) else: return wx.ArtProvider.GetBitmap(artid, client, size)
python
def CreateBitmap(self, artid, client, size): """Adds custom images to Artprovider""" if artid in self.extra_icons: return wx.Bitmap(self.extra_icons[artid], wx.BITMAP_TYPE_ANY) else: return wx.ArtProvider.GetBitmap(artid, client, size)
[ "def", "CreateBitmap", "(", "self", ",", "artid", ",", "client", ",", "size", ")", ":", "if", "artid", "in", "self", ".", "extra_icons", ":", "return", "wx", ".", "Bitmap", "(", "self", ".", "extra_icons", "[", "artid", "]", ",", "wx", ".", "BITMAP_TYPE_ANY", ")", "else", ":", "return", "wx", ".", "ArtProvider", ".", "GetBitmap", "(", "artid", ",", "client", ",", "size", ")" ]
Adds custom images to Artprovider
[ "Adds", "custom", "images", "to", "Artprovider" ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/icons.py#L120-L127
236,462
manns/pyspread
pyspread/src/lib/fileio.py
AOpenMixin.set_initial_state
def set_initial_state(self, kwargs): """Sets class state from kwargs attributes, pops extra kwargs""" self.main_window = kwargs.pop("main_window") try: statustext = kwargs.pop("statustext") except KeyError: statustext = "" try: self.total_lines = kwargs.pop("total_lines") self.statustext = statustext + \ _("{nele} of {totalele} elements processed.") except KeyError: self.total_lines = None self.statustext = statustext + _("{nele} elements processed.") try: self.freq = kwargs.pop("freq") except KeyError: self.freq = 1000 # The aborted attribute makes next() to raise StopIteration self.aborted = False # Line counter self.line = 0 # Bindings self.main_window.Bind(wx.EVT_KEY_DOWN, self.on_key)
python
def set_initial_state(self, kwargs): """Sets class state from kwargs attributes, pops extra kwargs""" self.main_window = kwargs.pop("main_window") try: statustext = kwargs.pop("statustext") except KeyError: statustext = "" try: self.total_lines = kwargs.pop("total_lines") self.statustext = statustext + \ _("{nele} of {totalele} elements processed.") except KeyError: self.total_lines = None self.statustext = statustext + _("{nele} elements processed.") try: self.freq = kwargs.pop("freq") except KeyError: self.freq = 1000 # The aborted attribute makes next() to raise StopIteration self.aborted = False # Line counter self.line = 0 # Bindings self.main_window.Bind(wx.EVT_KEY_DOWN, self.on_key)
[ "def", "set_initial_state", "(", "self", ",", "kwargs", ")", ":", "self", ".", "main_window", "=", "kwargs", ".", "pop", "(", "\"main_window\"", ")", "try", ":", "statustext", "=", "kwargs", ".", "pop", "(", "\"statustext\"", ")", "except", "KeyError", ":", "statustext", "=", "\"\"", "try", ":", "self", ".", "total_lines", "=", "kwargs", ".", "pop", "(", "\"total_lines\"", ")", "self", ".", "statustext", "=", "statustext", "+", "_", "(", "\"{nele} of {totalele} elements processed.\"", ")", "except", "KeyError", ":", "self", ".", "total_lines", "=", "None", "self", ".", "statustext", "=", "statustext", "+", "_", "(", "\"{nele} elements processed.\"", ")", "try", ":", "self", ".", "freq", "=", "kwargs", ".", "pop", "(", "\"freq\"", ")", "except", "KeyError", ":", "self", ".", "freq", "=", "1000", "# The aborted attribute makes next() to raise StopIteration", "self", ".", "aborted", "=", "False", "# Line counter", "self", ".", "line", "=", "0", "# Bindings", "self", ".", "main_window", ".", "Bind", "(", "wx", ".", "EVT_KEY_DOWN", ",", "self", ".", "on_key", ")" ]
Sets class state from kwargs attributes, pops extra kwargs
[ "Sets", "class", "state", "from", "kwargs", "attributes", "pops", "extra", "kwargs" ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/fileio.py#L53-L86
236,463
manns/pyspread
pyspread/src/lib/fileio.py
AOpenMixin.progress_status
def progress_status(self): """Displays progress in statusbar""" if self.line % self.freq == 0: text = self.statustext.format(nele=self.line, totalele=self.total_lines) if self.main_window.grid.actions.pasting: try: post_command_event(self.main_window, self.main_window.StatusBarMsg, text=text) except TypeError: # The main window does not exist any more pass else: # Write directly to the status bar because the event queue # is not emptied during file access self.main_window.GetStatusBar().SetStatusText(text) # Now wait for the statusbar update to be written on screen if is_gtk(): try: wx.Yield() except: pass self.line += 1
python
def progress_status(self): """Displays progress in statusbar""" if self.line % self.freq == 0: text = self.statustext.format(nele=self.line, totalele=self.total_lines) if self.main_window.grid.actions.pasting: try: post_command_event(self.main_window, self.main_window.StatusBarMsg, text=text) except TypeError: # The main window does not exist any more pass else: # Write directly to the status bar because the event queue # is not emptied during file access self.main_window.GetStatusBar().SetStatusText(text) # Now wait for the statusbar update to be written on screen if is_gtk(): try: wx.Yield() except: pass self.line += 1
[ "def", "progress_status", "(", "self", ")", ":", "if", "self", ".", "line", "%", "self", ".", "freq", "==", "0", ":", "text", "=", "self", ".", "statustext", ".", "format", "(", "nele", "=", "self", ".", "line", ",", "totalele", "=", "self", ".", "total_lines", ")", "if", "self", ".", "main_window", ".", "grid", ".", "actions", ".", "pasting", ":", "try", ":", "post_command_event", "(", "self", ".", "main_window", ",", "self", ".", "main_window", ".", "StatusBarMsg", ",", "text", "=", "text", ")", "except", "TypeError", ":", "# The main window does not exist any more", "pass", "else", ":", "# Write directly to the status bar because the event queue", "# is not emptied during file access", "self", ".", "main_window", ".", "GetStatusBar", "(", ")", ".", "SetStatusText", "(", "text", ")", "# Now wait for the statusbar update to be written on screen", "if", "is_gtk", "(", ")", ":", "try", ":", "wx", ".", "Yield", "(", ")", "except", ":", "pass", "self", ".", "line", "+=", "1" ]
Displays progress in statusbar
[ "Displays", "progress", "in", "statusbar" ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/fileio.py#L117-L145
236,464
manns/pyspread
pyspread/src/lib/fileio.py
AOpenMixin.on_key
def on_key(self, event): """Sets aborted state if escape is pressed""" if self.main_window.grid.actions.pasting and \ event.GetKeyCode() == wx.WXK_ESCAPE: self.aborted = True event.Skip()
python
def on_key(self, event): """Sets aborted state if escape is pressed""" if self.main_window.grid.actions.pasting and \ event.GetKeyCode() == wx.WXK_ESCAPE: self.aborted = True event.Skip()
[ "def", "on_key", "(", "self", ",", "event", ")", ":", "if", "self", ".", "main_window", ".", "grid", ".", "actions", ".", "pasting", "and", "event", ".", "GetKeyCode", "(", ")", "==", "wx", ".", "WXK_ESCAPE", ":", "self", ".", "aborted", "=", "True", "event", ".", "Skip", "(", ")" ]
Sets aborted state if escape is pressed
[ "Sets", "aborted", "state", "if", "escape", "is", "pressed" ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/fileio.py#L147-L154
236,465
manns/pyspread
pyspread/src/interfaces/ods.py
Ods._get_tables
def _get_tables(self, ods): """Returns list of table nodes from ods object""" childnodes = ods.spreadsheet.childNodes qname_childnodes = [(s.qname[1], s) for s in childnodes] return [node for name, node in qname_childnodes if name == u"table"]
python
def _get_tables(self, ods): """Returns list of table nodes from ods object""" childnodes = ods.spreadsheet.childNodes qname_childnodes = [(s.qname[1], s) for s in childnodes] return [node for name, node in qname_childnodes if name == u"table"]
[ "def", "_get_tables", "(", "self", ",", "ods", ")", ":", "childnodes", "=", "ods", ".", "spreadsheet", ".", "childNodes", "qname_childnodes", "=", "[", "(", "s", ".", "qname", "[", "1", "]", ",", "s", ")", "for", "s", "in", "childnodes", "]", "return", "[", "node", "for", "name", ",", "node", "in", "qname_childnodes", "if", "name", "==", "u\"table\"", "]" ]
Returns list of table nodes from ods object
[ "Returns", "list", "of", "table", "nodes", "from", "ods", "object" ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/interfaces/ods.py#L67-L72
236,466
manns/pyspread
pyspread/src/interfaces/ods.py
Ods._get_rows
def _get_rows(self, table): """Returns rows from table""" childnodes = table.childNodes qname_childnodes = [(s.qname[1], s) for s in childnodes] return [node for name, node in qname_childnodes if name == u'table-row']
python
def _get_rows(self, table): """Returns rows from table""" childnodes = table.childNodes qname_childnodes = [(s.qname[1], s) for s in childnodes] return [node for name, node in qname_childnodes if name == u'table-row']
[ "def", "_get_rows", "(", "self", ",", "table", ")", ":", "childnodes", "=", "table", ".", "childNodes", "qname_childnodes", "=", "[", "(", "s", ".", "qname", "[", "1", "]", ",", "s", ")", "for", "s", "in", "childnodes", "]", "return", "[", "node", "for", "name", ",", "node", "in", "qname_childnodes", "if", "name", "==", "u'table-row'", "]" ]
Returns rows from table
[ "Returns", "rows", "from", "table" ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/interfaces/ods.py#L74-L80
236,467
manns/pyspread
pyspread/src/interfaces/ods.py
Ods._get_cells
def _get_cells(self, row): """Returns rows from row""" childnodes = row.childNodes qname_childnodes = [(s.qname[1], s) for s in childnodes] return [node for name, node in qname_childnodes if name == u'table-cell']
python
def _get_cells(self, row): """Returns rows from row""" childnodes = row.childNodes qname_childnodes = [(s.qname[1], s) for s in childnodes] return [node for name, node in qname_childnodes if name == u'table-cell']
[ "def", "_get_cells", "(", "self", ",", "row", ")", ":", "childnodes", "=", "row", ".", "childNodes", "qname_childnodes", "=", "[", "(", "s", ".", "qname", "[", "1", "]", ",", "s", ")", "for", "s", "in", "childnodes", "]", "return", "[", "node", "for", "name", ",", "node", "in", "qname_childnodes", "if", "name", "==", "u'table-cell'", "]" ]
Returns rows from row
[ "Returns", "rows", "from", "row" ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/interfaces/ods.py#L82-L88
236,468
manns/pyspread
pyspread/src/interfaces/ods.py
Ods._ods2code
def _ods2code(self): """Updates code in code_array""" ods = ODSReader(self.ods_file, clonespannedcolumns=True) tables = ods.sheets for tab_id, table in enumerate(tables): for row_id in xrange(len(table)): for col_id in xrange(len(table[row_id])): key = row_id, col_id, tab_id text = unicode(table[row_id][col_id]) self.code_array[key] = text
python
def _ods2code(self): """Updates code in code_array""" ods = ODSReader(self.ods_file, clonespannedcolumns=True) tables = ods.sheets for tab_id, table in enumerate(tables): for row_id in xrange(len(table)): for col_id in xrange(len(table[row_id])): key = row_id, col_id, tab_id text = unicode(table[row_id][col_id]) self.code_array[key] = text
[ "def", "_ods2code", "(", "self", ")", ":", "ods", "=", "ODSReader", "(", "self", ".", "ods_file", ",", "clonespannedcolumns", "=", "True", ")", "tables", "=", "ods", ".", "sheets", "for", "tab_id", ",", "table", "in", "enumerate", "(", "tables", ")", ":", "for", "row_id", "in", "xrange", "(", "len", "(", "table", ")", ")", ":", "for", "col_id", "in", "xrange", "(", "len", "(", "table", "[", "row_id", "]", ")", ")", ":", "key", "=", "row_id", ",", "col_id", ",", "tab_id", "text", "=", "unicode", "(", "table", "[", "row_id", "]", "[", "col_id", "]", ")", "self", ".", "code_array", "[", "key", "]", "=", "text" ]
Updates code in code_array
[ "Updates", "code", "in", "code_array" ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/interfaces/ods.py#L90-L100
236,469
manns/pyspread
pyspread/src/pyspread.py
pyspread
def pyspread(S=None): """Holds application main loop""" # Initialize main application app = MainApplication(S=S, redirect=False) app.MainLoop()
python
def pyspread(S=None): """Holds application main loop""" # Initialize main application app = MainApplication(S=S, redirect=False) app.MainLoop()
[ "def", "pyspread", "(", "S", "=", "None", ")", ":", "# Initialize main application", "app", "=", "MainApplication", "(", "S", "=", "S", ",", "redirect", "=", "False", ")", "app", ".", "MainLoop", "(", ")" ]
Holds application main loop
[ "Holds", "application", "main", "loop" ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/pyspread.py#L230-L236
236,470
manns/pyspread
pyspread/src/lib/ODSReader.py
ODSReader.readSheet
def readSheet(self, sheet): """Reads a sheet in the sheet dictionary Stores each sheet as an array (rows) of arrays (columns) """ name = sheet.getAttribute("name") rows = sheet.getElementsByType(TableRow) arrRows = [] # for each row for row in rows: row_comment = "" arrCells = GrowingList() cells = row.getElementsByType(TableCell) # for each cell count = 0 for cell in cells: # repeated value? repeat = cell.getAttribute("numbercolumnsrepeated") if(not repeat): repeat = 1 spanned = \ int(cell.getAttribute('numbercolumnsspanned') or 0) # clone spanned cells if self.clonespannedcolumns is not None and spanned > 1: repeat = spanned ps = cell.getElementsByType(P) textContent = "" # for each text/text:span node for p in ps: for n in p.childNodes: if (n.nodeType == 1 and n.tagName == "text:span"): for c in n.childNodes: if (c.nodeType == 3): textContent = u'{}{}'.format(textContent, n.data) if (n.nodeType == 3): textContent = u'{}{}'.format(textContent, n.data) if(textContent): if(textContent[0] != "#"): # ignore comments cells for rr in xrange(int(repeat)): # repeated? arrCells[count]=textContent count+=1 else: row_comment = row_comment + textContent + " " else: for rr in xrange(int(repeat)): count+=1 # if row contained something if(len(arrCells)): arrRows.append(arrCells) #else: # print ("Empty or commented row (", row_comment, ")") self.sheets.append(arrRows) self.sheet_names.append(name)
python
def readSheet(self, sheet): """Reads a sheet in the sheet dictionary Stores each sheet as an array (rows) of arrays (columns) """ name = sheet.getAttribute("name") rows = sheet.getElementsByType(TableRow) arrRows = [] # for each row for row in rows: row_comment = "" arrCells = GrowingList() cells = row.getElementsByType(TableCell) # for each cell count = 0 for cell in cells: # repeated value? repeat = cell.getAttribute("numbercolumnsrepeated") if(not repeat): repeat = 1 spanned = \ int(cell.getAttribute('numbercolumnsspanned') or 0) # clone spanned cells if self.clonespannedcolumns is not None and spanned > 1: repeat = spanned ps = cell.getElementsByType(P) textContent = "" # for each text/text:span node for p in ps: for n in p.childNodes: if (n.nodeType == 1 and n.tagName == "text:span"): for c in n.childNodes: if (c.nodeType == 3): textContent = u'{}{}'.format(textContent, n.data) if (n.nodeType == 3): textContent = u'{}{}'.format(textContent, n.data) if(textContent): if(textContent[0] != "#"): # ignore comments cells for rr in xrange(int(repeat)): # repeated? arrCells[count]=textContent count+=1 else: row_comment = row_comment + textContent + " " else: for rr in xrange(int(repeat)): count+=1 # if row contained something if(len(arrCells)): arrRows.append(arrCells) #else: # print ("Empty or commented row (", row_comment, ")") self.sheets.append(arrRows) self.sheet_names.append(name)
[ "def", "readSheet", "(", "self", ",", "sheet", ")", ":", "name", "=", "sheet", ".", "getAttribute", "(", "\"name\"", ")", "rows", "=", "sheet", ".", "getElementsByType", "(", "TableRow", ")", "arrRows", "=", "[", "]", "# for each row", "for", "row", "in", "rows", ":", "row_comment", "=", "\"\"", "arrCells", "=", "GrowingList", "(", ")", "cells", "=", "row", ".", "getElementsByType", "(", "TableCell", ")", "# for each cell", "count", "=", "0", "for", "cell", "in", "cells", ":", "# repeated value?", "repeat", "=", "cell", ".", "getAttribute", "(", "\"numbercolumnsrepeated\"", ")", "if", "(", "not", "repeat", ")", ":", "repeat", "=", "1", "spanned", "=", "int", "(", "cell", ".", "getAttribute", "(", "'numbercolumnsspanned'", ")", "or", "0", ")", "# clone spanned cells", "if", "self", ".", "clonespannedcolumns", "is", "not", "None", "and", "spanned", ">", "1", ":", "repeat", "=", "spanned", "ps", "=", "cell", ".", "getElementsByType", "(", "P", ")", "textContent", "=", "\"\"", "# for each text/text:span node", "for", "p", "in", "ps", ":", "for", "n", "in", "p", ".", "childNodes", ":", "if", "(", "n", ".", "nodeType", "==", "1", "and", "n", ".", "tagName", "==", "\"text:span\"", ")", ":", "for", "c", "in", "n", ".", "childNodes", ":", "if", "(", "c", ".", "nodeType", "==", "3", ")", ":", "textContent", "=", "u'{}{}'", ".", "format", "(", "textContent", ",", "n", ".", "data", ")", "if", "(", "n", ".", "nodeType", "==", "3", ")", ":", "textContent", "=", "u'{}{}'", ".", "format", "(", "textContent", ",", "n", ".", "data", ")", "if", "(", "textContent", ")", ":", "if", "(", "textContent", "[", "0", "]", "!=", "\"#\"", ")", ":", "# ignore comments cells", "for", "rr", "in", "xrange", "(", "int", "(", "repeat", ")", ")", ":", "# repeated?", "arrCells", "[", "count", "]", "=", "textContent", "count", "+=", "1", "else", ":", "row_comment", "=", "row_comment", "+", "textContent", "+", "\" \"", "else", ":", "for", "rr", "in", "xrange", "(", "int", "(", "repeat", ")", ")", ":", "count", "+=", "1", "# if row contained something", "if", "(", "len", "(", "arrCells", ")", ")", ":", "arrRows", ".", "append", "(", "arrCells", ")", "#else:", "# print (\"Empty or commented row (\", row_comment, \")\")", "self", ".", "sheets", ".", "append", "(", "arrRows", ")", "self", ".", "sheet_names", ".", "append", "(", "name", ")" ]
Reads a sheet in the sheet dictionary Stores each sheet as an array (rows) of arrays (columns)
[ "Reads", "a", "sheet", "in", "the", "sheet", "dictionary" ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/ODSReader.py#L41-L105
236,471
manns/pyspread
pyspread/src/lib/__csv.py
sniff
def sniff(filepath): """ Sniffs CSV dialect and header info from csvfilepath Returns a tuple of dialect and has_header """ with open(filepath, "rb") as csvfile: sample = csvfile.read(config["sniff_size"]) sniffer = csv.Sniffer() dialect = sniffer.sniff(sample)() has_header = sniffer.has_header(sample) return dialect, has_header
python
def sniff(filepath): """ Sniffs CSV dialect and header info from csvfilepath Returns a tuple of dialect and has_header """ with open(filepath, "rb") as csvfile: sample = csvfile.read(config["sniff_size"]) sniffer = csv.Sniffer() dialect = sniffer.sniff(sample)() has_header = sniffer.has_header(sample) return dialect, has_header
[ "def", "sniff", "(", "filepath", ")", ":", "with", "open", "(", "filepath", ",", "\"rb\"", ")", "as", "csvfile", ":", "sample", "=", "csvfile", ".", "read", "(", "config", "[", "\"sniff_size\"", "]", ")", "sniffer", "=", "csv", ".", "Sniffer", "(", ")", "dialect", "=", "sniffer", ".", "sniff", "(", "sample", ")", "(", ")", "has_header", "=", "sniffer", ".", "has_header", "(", "sample", ")", "return", "dialect", ",", "has_header" ]
Sniffs CSV dialect and header info from csvfilepath Returns a tuple of dialect and has_header
[ "Sniffs", "CSV", "dialect", "and", "header", "info", "from", "csvfilepath" ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/__csv.py#L58-L73
236,472
manns/pyspread
pyspread/src/lib/__csv.py
get_first_line
def get_first_line(filepath, dialect): """Returns List of first line items of file filepath""" with open(filepath, "rb") as csvfile: csvreader = csv.reader(csvfile, dialect=dialect) for first_line in csvreader: break return first_line
python
def get_first_line(filepath, dialect): """Returns List of first line items of file filepath""" with open(filepath, "rb") as csvfile: csvreader = csv.reader(csvfile, dialect=dialect) for first_line in csvreader: break return first_line
[ "def", "get_first_line", "(", "filepath", ",", "dialect", ")", ":", "with", "open", "(", "filepath", ",", "\"rb\"", ")", "as", "csvfile", ":", "csvreader", "=", "csv", ".", "reader", "(", "csvfile", ",", "dialect", "=", "dialect", ")", "for", "first_line", "in", "csvreader", ":", "break", "return", "first_line" ]
Returns List of first line items of file filepath
[ "Returns", "List", "of", "first", "line", "items", "of", "file", "filepath" ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/__csv.py#L76-L85
236,473
manns/pyspread
pyspread/src/lib/__csv.py
digested_line
def digested_line(line, digest_types): """Returns list of digested values in line""" digested_line = [] for i, ele in enumerate(line): try: digest_key = digest_types[i] except IndexError: digest_key = digest_types[0] digest = Digest(acceptable_types=[digest_key]) try: digested_line.append(repr(digest(ele))) except Exception: digested_line.append("") return digested_line
python
def digested_line(line, digest_types): """Returns list of digested values in line""" digested_line = [] for i, ele in enumerate(line): try: digest_key = digest_types[i] except IndexError: digest_key = digest_types[0] digest = Digest(acceptable_types=[digest_key]) try: digested_line.append(repr(digest(ele))) except Exception: digested_line.append("") return digested_line
[ "def", "digested_line", "(", "line", ",", "digest_types", ")", ":", "digested_line", "=", "[", "]", "for", "i", ",", "ele", "in", "enumerate", "(", "line", ")", ":", "try", ":", "digest_key", "=", "digest_types", "[", "i", "]", "except", "IndexError", ":", "digest_key", "=", "digest_types", "[", "0", "]", "digest", "=", "Digest", "(", "acceptable_types", "=", "[", "digest_key", "]", ")", "try", ":", "digested_line", ".", "append", "(", "repr", "(", "digest", "(", "ele", ")", ")", ")", "except", "Exception", ":", "digested_line", ".", "append", "(", "\"\"", ")", "return", "digested_line" ]
Returns list of digested values in line
[ "Returns", "list", "of", "digested", "values", "in", "line" ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/__csv.py#L88-L107
236,474
manns/pyspread
pyspread/src/lib/__csv.py
csv_digest_gen
def csv_digest_gen(filepath, dialect, has_header, digest_types): """Generator of digested values from csv file in filepath Parameters ---------- filepath:String \tFile path of csv file to read dialect: Object \tCsv dialect digest_types: tuple of types \tTypes of data for each col """ with open(filepath, "rb") as csvfile: csvreader = csv.reader(csvfile, dialect=dialect) if has_header: # Ignore first line for line in csvreader: break for line in csvreader: yield digested_line(line, digest_types)
python
def csv_digest_gen(filepath, dialect, has_header, digest_types): """Generator of digested values from csv file in filepath Parameters ---------- filepath:String \tFile path of csv file to read dialect: Object \tCsv dialect digest_types: tuple of types \tTypes of data for each col """ with open(filepath, "rb") as csvfile: csvreader = csv.reader(csvfile, dialect=dialect) if has_header: # Ignore first line for line in csvreader: break for line in csvreader: yield digested_line(line, digest_types)
[ "def", "csv_digest_gen", "(", "filepath", ",", "dialect", ",", "has_header", ",", "digest_types", ")", ":", "with", "open", "(", "filepath", ",", "\"rb\"", ")", "as", "csvfile", ":", "csvreader", "=", "csv", ".", "reader", "(", "csvfile", ",", "dialect", "=", "dialect", ")", "if", "has_header", ":", "# Ignore first line", "for", "line", "in", "csvreader", ":", "break", "for", "line", "in", "csvreader", ":", "yield", "digested_line", "(", "line", ",", "digest_types", ")" ]
Generator of digested values from csv file in filepath Parameters ---------- filepath:String \tFile path of csv file to read dialect: Object \tCsv dialect digest_types: tuple of types \tTypes of data for each col
[ "Generator", "of", "digested", "values", "from", "csv", "file", "in", "filepath" ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/__csv.py#L110-L133
236,475
manns/pyspread
pyspread/src/lib/__csv.py
cell_key_val_gen
def cell_key_val_gen(iterable, shape, topleft=(0, 0)): """Generator of row, col, value tuple from iterable of iterables it: Iterable of iterables \tMatrix that shall be mapped on target grid shape: Tuple of Integer \tShape of target grid topleft: 2-tuple of Integer \tTop left cell for insertion of it """ top, left = topleft for __row, line in enumerate(iterable): row = top + __row if row >= shape[0]: break for __col, value in enumerate(line): col = left + __col if col >= shape[1]: break yield row, col, value
python
def cell_key_val_gen(iterable, shape, topleft=(0, 0)): """Generator of row, col, value tuple from iterable of iterables it: Iterable of iterables \tMatrix that shall be mapped on target grid shape: Tuple of Integer \tShape of target grid topleft: 2-tuple of Integer \tTop left cell for insertion of it """ top, left = topleft for __row, line in enumerate(iterable): row = top + __row if row >= shape[0]: break for __col, value in enumerate(line): col = left + __col if col >= shape[1]: break yield row, col, value
[ "def", "cell_key_val_gen", "(", "iterable", ",", "shape", ",", "topleft", "=", "(", "0", ",", "0", ")", ")", ":", "top", ",", "left", "=", "topleft", "for", "__row", ",", "line", "in", "enumerate", "(", "iterable", ")", ":", "row", "=", "top", "+", "__row", "if", "row", ">=", "shape", "[", "0", "]", ":", "break", "for", "__col", ",", "value", "in", "enumerate", "(", "line", ")", ":", "col", "=", "left", "+", "__col", "if", "col", ">=", "shape", "[", "1", "]", ":", "break", "yield", "row", ",", "col", ",", "value" ]
Generator of row, col, value tuple from iterable of iterables it: Iterable of iterables \tMatrix that shall be mapped on target grid shape: Tuple of Integer \tShape of target grid topleft: 2-tuple of Integer \tTop left cell for insertion of it
[ "Generator", "of", "row", "col", "value", "tuple", "from", "iterable", "of", "iterables" ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/__csv.py#L136-L160
236,476
manns/pyspread
pyspread/src/lib/__csv.py
encode_gen
def encode_gen(line, encoding="utf-8"): """Encodes all Unicode strings in line to encoding Parameters ---------- line: Iterable of Unicode strings \tDate to be encoded encoding: String, defaults to "utf-8" \tTarget encoding """ for ele in line: if isinstance(ele, types.UnicodeType): yield ele.encode(encoding) else: yield ele
python
def encode_gen(line, encoding="utf-8"): """Encodes all Unicode strings in line to encoding Parameters ---------- line: Iterable of Unicode strings \tDate to be encoded encoding: String, defaults to "utf-8" \tTarget encoding """ for ele in line: if isinstance(ele, types.UnicodeType): yield ele.encode(encoding) else: yield ele
[ "def", "encode_gen", "(", "line", ",", "encoding", "=", "\"utf-8\"", ")", ":", "for", "ele", "in", "line", ":", "if", "isinstance", "(", "ele", ",", "types", ".", "UnicodeType", ")", ":", "yield", "ele", ".", "encode", "(", "encoding", ")", "else", ":", "yield", "ele" ]
Encodes all Unicode strings in line to encoding Parameters ---------- line: Iterable of Unicode strings \tDate to be encoded encoding: String, defaults to "utf-8" \tTarget encoding
[ "Encodes", "all", "Unicode", "strings", "in", "line", "to", "encoding" ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/__csv.py#L163-L179
236,477
manns/pyspread
pyspread/src/lib/__csv.py
CsvInterface._get_csv_cells_gen
def _get_csv_cells_gen(self, line): """Generator of values in a csv line""" digest_types = self.digest_types for j, value in enumerate(line): if self.first_line: digest_key = None digest = lambda x: x.decode(self.encoding) else: try: digest_key = digest_types[j] except IndexError: digest_key = digest_types[0] digest = Digest(acceptable_types=[digest_key], encoding=self.encoding) try: digest_res = digest(value) if digest_res == "\b": digest_res = None elif digest_key is not types.CodeType: digest_res = repr(digest_res) except Exception: digest_res = "" yield digest_res
python
def _get_csv_cells_gen(self, line): """Generator of values in a csv line""" digest_types = self.digest_types for j, value in enumerate(line): if self.first_line: digest_key = None digest = lambda x: x.decode(self.encoding) else: try: digest_key = digest_types[j] except IndexError: digest_key = digest_types[0] digest = Digest(acceptable_types=[digest_key], encoding=self.encoding) try: digest_res = digest(value) if digest_res == "\b": digest_res = None elif digest_key is not types.CodeType: digest_res = repr(digest_res) except Exception: digest_res = "" yield digest_res
[ "def", "_get_csv_cells_gen", "(", "self", ",", "line", ")", ":", "digest_types", "=", "self", ".", "digest_types", "for", "j", ",", "value", "in", "enumerate", "(", "line", ")", ":", "if", "self", ".", "first_line", ":", "digest_key", "=", "None", "digest", "=", "lambda", "x", ":", "x", ".", "decode", "(", "self", ".", "encoding", ")", "else", ":", "try", ":", "digest_key", "=", "digest_types", "[", "j", "]", "except", "IndexError", ":", "digest_key", "=", "digest_types", "[", "0", "]", "digest", "=", "Digest", "(", "acceptable_types", "=", "[", "digest_key", "]", ",", "encoding", "=", "self", ".", "encoding", ")", "try", ":", "digest_res", "=", "digest", "(", "value", ")", "if", "digest_res", "==", "\"\\b\"", ":", "digest_res", "=", "None", "elif", "digest_key", "is", "not", "types", ".", "CodeType", ":", "digest_res", "=", "repr", "(", "digest_res", ")", "except", "Exception", ":", "digest_res", "=", "\"\"", "yield", "digest_res" ]
Generator of values in a csv line
[ "Generator", "of", "values", "in", "a", "csv", "line" ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/__csv.py#L402-L432
236,478
manns/pyspread
pyspread/src/lib/__csv.py
CsvInterface.write
def write(self, iterable): """Writes values from iterable into CSV file""" io_error_text = _("Error writing to file {filepath}.") io_error_text = io_error_text.format(filepath=self.path) try: with open(self.path, "wb") as csvfile: csv_writer = csv.writer(csvfile, self.dialect) for line in iterable: csv_writer.writerow( list(encode_gen(line, encoding=self.encoding))) except IOError: txt = \ _("Error opening file {filepath}.").format(filepath=self.path) try: post_command_event(self.main_window, self.StatusBarMsg, text=txt) except TypeError: # The main window does not exist any more pass return False
python
def write(self, iterable): """Writes values from iterable into CSV file""" io_error_text = _("Error writing to file {filepath}.") io_error_text = io_error_text.format(filepath=self.path) try: with open(self.path, "wb") as csvfile: csv_writer = csv.writer(csvfile, self.dialect) for line in iterable: csv_writer.writerow( list(encode_gen(line, encoding=self.encoding))) except IOError: txt = \ _("Error opening file {filepath}.").format(filepath=self.path) try: post_command_event(self.main_window, self.StatusBarMsg, text=txt) except TypeError: # The main window does not exist any more pass return False
[ "def", "write", "(", "self", ",", "iterable", ")", ":", "io_error_text", "=", "_", "(", "\"Error writing to file {filepath}.\"", ")", "io_error_text", "=", "io_error_text", ".", "format", "(", "filepath", "=", "self", ".", "path", ")", "try", ":", "with", "open", "(", "self", ".", "path", ",", "\"wb\"", ")", "as", "csvfile", ":", "csv_writer", "=", "csv", ".", "writer", "(", "csvfile", ",", "self", ".", "dialect", ")", "for", "line", "in", "iterable", ":", "csv_writer", ".", "writerow", "(", "list", "(", "encode_gen", "(", "line", ",", "encoding", "=", "self", ".", "encoding", ")", ")", ")", "except", "IOError", ":", "txt", "=", "_", "(", "\"Error opening file {filepath}.\"", ")", ".", "format", "(", "filepath", "=", "self", ".", "path", ")", "try", ":", "post_command_event", "(", "self", ".", "main_window", ",", "self", ".", "StatusBarMsg", ",", "text", "=", "txt", ")", "except", "TypeError", ":", "# The main window does not exist any more", "pass", "return", "False" ]
Writes values from iterable into CSV file
[ "Writes", "values", "from", "iterable", "into", "CSV", "file" ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/__csv.py#L434-L459
236,479
manns/pyspread
pyspread/src/interfaces/xls.py
Xls._shape2xls
def _shape2xls(self, worksheets): """Writes shape to xls file Format: <rows>\t<cols>\t<tabs>\n """ __, __, tabs = self.code_array.shape if tabs > self.xls_max_tabs: tabs = self.xls_max_tabs for tab in xrange(tabs): worksheet = self.workbook.add_sheet(str(tab)) worksheets.append(worksheet)
python
def _shape2xls(self, worksheets): """Writes shape to xls file Format: <rows>\t<cols>\t<tabs>\n """ __, __, tabs = self.code_array.shape if tabs > self.xls_max_tabs: tabs = self.xls_max_tabs for tab in xrange(tabs): worksheet = self.workbook.add_sheet(str(tab)) worksheets.append(worksheet)
[ "def", "_shape2xls", "(", "self", ",", "worksheets", ")", ":", "__", ",", "__", ",", "tabs", "=", "self", ".", "code_array", ".", "shape", "if", "tabs", ">", "self", ".", "xls_max_tabs", ":", "tabs", "=", "self", ".", "xls_max_tabs", "for", "tab", "in", "xrange", "(", "tabs", ")", ":", "worksheet", "=", "self", ".", "workbook", ".", "add_sheet", "(", "str", "(", "tab", ")", ")", "worksheets", ".", "append", "(", "worksheet", ")" ]
Writes shape to xls file Format: <rows>\t<cols>\t<tabs>\n
[ "Writes", "shape", "to", "xls", "file" ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/interfaces/xls.py#L121-L135
236,480
manns/pyspread
pyspread/src/interfaces/xls.py
Xls._code2xls
def _code2xls(self, worksheets): """Writes code to xls file Format: <row>\t<col>\t<tab>\t<code>\n """ code_array = self.code_array xls_max_shape = self.xls_max_rows, self.xls_max_cols, self.xls_max_tabs for key in code_array: if all(kele < mele for kele, mele in zip(key, xls_max_shape)): # Cell lies within Excel boundaries row, col, tab = key code_str = code_array(key) if code_str is not None: style = self._get_xfstyle(worksheets, key) worksheets[tab].write(row, col, label=code_str, style=style) # Handle cell formatting in cells without code # Get bboxes for all cell_attributes max_shape = [min(xls_max_shape[0], code_array.shape[0]), min(xls_max_shape[1], code_array.shape[1])] # Prevent systems from blocking if max_shape[0] * max_shape[1] > 1024000: # Ignore all cell attributes below row 3999 max_shape[0] = 4000 cell_attributes = code_array.dict_grid.cell_attributes bboxes = [] for s, __tab, __ in cell_attributes: if s: bboxes.append((s.get_grid_bbox(code_array.shape), __tab)) # Get bbox_cell_set from bboxes cells = [] for ((bb_top, bb_left), (bb_bottom, bb_right)), __tab in bboxes: __bb_bottom = min(bb_bottom, max_shape[0]) __bb_right = min(bb_right, max_shape[1]) for __row, __col in product(xrange(bb_top, __bb_bottom + 1), xrange(bb_left, __bb_right + 1)): cells.append((__row, __col, __tab)) cell_set = set(cells) # Loop over those with non-standard attributes for key in cell_set: if key not in code_array and all(ele >= 0 for ele in key): row, col, tab = key style = self._get_xfstyle(worksheets, key) worksheets[tab].write(row, col, label="", style=style)
python
def _code2xls(self, worksheets): """Writes code to xls file Format: <row>\t<col>\t<tab>\t<code>\n """ code_array = self.code_array xls_max_shape = self.xls_max_rows, self.xls_max_cols, self.xls_max_tabs for key in code_array: if all(kele < mele for kele, mele in zip(key, xls_max_shape)): # Cell lies within Excel boundaries row, col, tab = key code_str = code_array(key) if code_str is not None: style = self._get_xfstyle(worksheets, key) worksheets[tab].write(row, col, label=code_str, style=style) # Handle cell formatting in cells without code # Get bboxes for all cell_attributes max_shape = [min(xls_max_shape[0], code_array.shape[0]), min(xls_max_shape[1], code_array.shape[1])] # Prevent systems from blocking if max_shape[0] * max_shape[1] > 1024000: # Ignore all cell attributes below row 3999 max_shape[0] = 4000 cell_attributes = code_array.dict_grid.cell_attributes bboxes = [] for s, __tab, __ in cell_attributes: if s: bboxes.append((s.get_grid_bbox(code_array.shape), __tab)) # Get bbox_cell_set from bboxes cells = [] for ((bb_top, bb_left), (bb_bottom, bb_right)), __tab in bboxes: __bb_bottom = min(bb_bottom, max_shape[0]) __bb_right = min(bb_right, max_shape[1]) for __row, __col in product(xrange(bb_top, __bb_bottom + 1), xrange(bb_left, __bb_right + 1)): cells.append((__row, __col, __tab)) cell_set = set(cells) # Loop over those with non-standard attributes for key in cell_set: if key not in code_array and all(ele >= 0 for ele in key): row, col, tab = key style = self._get_xfstyle(worksheets, key) worksheets[tab].write(row, col, label="", style=style)
[ "def", "_code2xls", "(", "self", ",", "worksheets", ")", ":", "code_array", "=", "self", ".", "code_array", "xls_max_shape", "=", "self", ".", "xls_max_rows", ",", "self", ".", "xls_max_cols", ",", "self", ".", "xls_max_tabs", "for", "key", "in", "code_array", ":", "if", "all", "(", "kele", "<", "mele", "for", "kele", ",", "mele", "in", "zip", "(", "key", ",", "xls_max_shape", ")", ")", ":", "# Cell lies within Excel boundaries", "row", ",", "col", ",", "tab", "=", "key", "code_str", "=", "code_array", "(", "key", ")", "if", "code_str", "is", "not", "None", ":", "style", "=", "self", ".", "_get_xfstyle", "(", "worksheets", ",", "key", ")", "worksheets", "[", "tab", "]", ".", "write", "(", "row", ",", "col", ",", "label", "=", "code_str", ",", "style", "=", "style", ")", "# Handle cell formatting in cells without code", "# Get bboxes for all cell_attributes", "max_shape", "=", "[", "min", "(", "xls_max_shape", "[", "0", "]", ",", "code_array", ".", "shape", "[", "0", "]", ")", ",", "min", "(", "xls_max_shape", "[", "1", "]", ",", "code_array", ".", "shape", "[", "1", "]", ")", "]", "# Prevent systems from blocking", "if", "max_shape", "[", "0", "]", "*", "max_shape", "[", "1", "]", ">", "1024000", ":", "# Ignore all cell attributes below row 3999", "max_shape", "[", "0", "]", "=", "4000", "cell_attributes", "=", "code_array", ".", "dict_grid", ".", "cell_attributes", "bboxes", "=", "[", "]", "for", "s", ",", "__tab", ",", "__", "in", "cell_attributes", ":", "if", "s", ":", "bboxes", ".", "append", "(", "(", "s", ".", "get_grid_bbox", "(", "code_array", ".", "shape", ")", ",", "__tab", ")", ")", "# Get bbox_cell_set from bboxes", "cells", "=", "[", "]", "for", "(", "(", "bb_top", ",", "bb_left", ")", ",", "(", "bb_bottom", ",", "bb_right", ")", ")", ",", "__tab", "in", "bboxes", ":", "__bb_bottom", "=", "min", "(", "bb_bottom", ",", "max_shape", "[", "0", "]", ")", "__bb_right", "=", "min", "(", "bb_right", ",", "max_shape", "[", "1", "]", ")", "for", "__row", ",", "__col", "in", "product", "(", "xrange", "(", "bb_top", ",", "__bb_bottom", "+", "1", ")", ",", "xrange", "(", "bb_left", ",", "__bb_right", "+", "1", ")", ")", ":", "cells", ".", "append", "(", "(", "__row", ",", "__col", ",", "__tab", ")", ")", "cell_set", "=", "set", "(", "cells", ")", "# Loop over those with non-standard attributes", "for", "key", "in", "cell_set", ":", "if", "key", "not", "in", "code_array", "and", "all", "(", "ele", ">=", "0", "for", "ele", "in", "key", ")", ":", "row", ",", "col", ",", "tab", "=", "key", "style", "=", "self", ".", "_get_xfstyle", "(", "worksheets", ",", "key", ")", "worksheets", "[", "tab", "]", ".", "write", "(", "row", ",", "col", ",", "label", "=", "\"\"", ",", "style", "=", "style", ")" ]
Writes code to xls file Format: <row>\t<col>\t<tab>\t<code>\n
[ "Writes", "code", "to", "xls", "file" ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/interfaces/xls.py#L150-L203
236,481
manns/pyspread
pyspread/src/interfaces/xls.py
Xls._xls2code
def _xls2code(self, worksheet, tab): """Updates code in xls code_array""" def xlrddate2datetime(xlrd_date): """Returns datetime from xlrd_date""" try: xldate_tuple = xlrd.xldate_as_tuple(xlrd_date, self.workbook.datemode) return datetime(xldate_tuple) except (ValueError, TypeError): return '' type2mapper = { 0: lambda x: None, # Empty cell 1: lambda x: str(x), # Text cell 2: lambda x: str(x), # Number cell 3: xlrddate2datetime, # Date 4: lambda x: str(bool(x)), # Boolean cell 5: lambda x: str(x), # Error cell 6: lambda x: None, # Blank cell } rows, cols = worksheet.nrows, worksheet.ncols for row, col in product(xrange(rows), xrange(cols)): cell_type = worksheet.cell_type(row, col) cell_value = worksheet.cell_value(row, col) key = row, col, tab mapper = type2mapper[cell_type] self.code_array[key] = mapper(cell_value)
python
def _xls2code(self, worksheet, tab): """Updates code in xls code_array""" def xlrddate2datetime(xlrd_date): """Returns datetime from xlrd_date""" try: xldate_tuple = xlrd.xldate_as_tuple(xlrd_date, self.workbook.datemode) return datetime(xldate_tuple) except (ValueError, TypeError): return '' type2mapper = { 0: lambda x: None, # Empty cell 1: lambda x: str(x), # Text cell 2: lambda x: str(x), # Number cell 3: xlrddate2datetime, # Date 4: lambda x: str(bool(x)), # Boolean cell 5: lambda x: str(x), # Error cell 6: lambda x: None, # Blank cell } rows, cols = worksheet.nrows, worksheet.ncols for row, col in product(xrange(rows), xrange(cols)): cell_type = worksheet.cell_type(row, col) cell_value = worksheet.cell_value(row, col) key = row, col, tab mapper = type2mapper[cell_type] self.code_array[key] = mapper(cell_value)
[ "def", "_xls2code", "(", "self", ",", "worksheet", ",", "tab", ")", ":", "def", "xlrddate2datetime", "(", "xlrd_date", ")", ":", "\"\"\"Returns datetime from xlrd_date\"\"\"", "try", ":", "xldate_tuple", "=", "xlrd", ".", "xldate_as_tuple", "(", "xlrd_date", ",", "self", ".", "workbook", ".", "datemode", ")", "return", "datetime", "(", "xldate_tuple", ")", "except", "(", "ValueError", ",", "TypeError", ")", ":", "return", "''", "type2mapper", "=", "{", "0", ":", "lambda", "x", ":", "None", ",", "# Empty cell", "1", ":", "lambda", "x", ":", "str", "(", "x", ")", ",", "# Text cell", "2", ":", "lambda", "x", ":", "str", "(", "x", ")", ",", "# Number cell", "3", ":", "xlrddate2datetime", ",", "# Date", "4", ":", "lambda", "x", ":", "str", "(", "bool", "(", "x", ")", ")", ",", "# Boolean cell", "5", ":", "lambda", "x", ":", "str", "(", "x", ")", ",", "# Error cell", "6", ":", "lambda", "x", ":", "None", ",", "# Blank cell", "}", "rows", ",", "cols", "=", "worksheet", ".", "nrows", ",", "worksheet", ".", "ncols", "for", "row", ",", "col", "in", "product", "(", "xrange", "(", "rows", ")", ",", "xrange", "(", "cols", ")", ")", ":", "cell_type", "=", "worksheet", ".", "cell_type", "(", "row", ",", "col", ")", "cell_value", "=", "worksheet", ".", "cell_value", "(", "row", ",", "col", ")", "key", "=", "row", ",", "col", ",", "tab", "mapper", "=", "type2mapper", "[", "cell_type", "]", "self", ".", "code_array", "[", "key", "]", "=", "mapper", "(", "cell_value", ")" ]
Updates code in xls code_array
[ "Updates", "code", "in", "xls", "code_array" ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/interfaces/xls.py#L205-L236
236,482
manns/pyspread
pyspread/src/interfaces/xls.py
Xls._get_font
def _get_font(self, pys_style): """Returns xlwt.Font for pyspread style""" # Return None if there is no font if "textfont" not in pys_style: return font = xlwt.Font() font.name = pys_style["textfont"] if "pointsize" in pys_style: font.height = pys_style["pointsize"] * 20.0 if "fontweight" in pys_style: font.bold = (pys_style["fontweight"] == wx.BOLD) if "fontstyle" in pys_style: font.italic = (pys_style["fontstyle"] == wx.ITALIC) if "textcolor" in pys_style: textcolor = wx.Colour() textcolor.SetRGB(pys_style["textcolor"]) font.colour_index = self.color2idx(*textcolor.Get()) if "underline" in pys_style: font.underline_type = pys_style["underline"] if "strikethrough" in pys_style: font.struck_out = pys_style["strikethrough"] return font
python
def _get_font(self, pys_style): """Returns xlwt.Font for pyspread style""" # Return None if there is no font if "textfont" not in pys_style: return font = xlwt.Font() font.name = pys_style["textfont"] if "pointsize" in pys_style: font.height = pys_style["pointsize"] * 20.0 if "fontweight" in pys_style: font.bold = (pys_style["fontweight"] == wx.BOLD) if "fontstyle" in pys_style: font.italic = (pys_style["fontstyle"] == wx.ITALIC) if "textcolor" in pys_style: textcolor = wx.Colour() textcolor.SetRGB(pys_style["textcolor"]) font.colour_index = self.color2idx(*textcolor.Get()) if "underline" in pys_style: font.underline_type = pys_style["underline"] if "strikethrough" in pys_style: font.struck_out = pys_style["strikethrough"] return font
[ "def", "_get_font", "(", "self", ",", "pys_style", ")", ":", "# Return None if there is no font", "if", "\"textfont\"", "not", "in", "pys_style", ":", "return", "font", "=", "xlwt", ".", "Font", "(", ")", "font", ".", "name", "=", "pys_style", "[", "\"textfont\"", "]", "if", "\"pointsize\"", "in", "pys_style", ":", "font", ".", "height", "=", "pys_style", "[", "\"pointsize\"", "]", "*", "20.0", "if", "\"fontweight\"", "in", "pys_style", ":", "font", ".", "bold", "=", "(", "pys_style", "[", "\"fontweight\"", "]", "==", "wx", ".", "BOLD", ")", "if", "\"fontstyle\"", "in", "pys_style", ":", "font", ".", "italic", "=", "(", "pys_style", "[", "\"fontstyle\"", "]", "==", "wx", ".", "ITALIC", ")", "if", "\"textcolor\"", "in", "pys_style", ":", "textcolor", "=", "wx", ".", "Colour", "(", ")", "textcolor", ".", "SetRGB", "(", "pys_style", "[", "\"textcolor\"", "]", ")", "font", ".", "colour_index", "=", "self", ".", "color2idx", "(", "*", "textcolor", ".", "Get", "(", ")", ")", "if", "\"underline\"", "in", "pys_style", ":", "font", ".", "underline_type", "=", "pys_style", "[", "\"underline\"", "]", "if", "\"strikethrough\"", "in", "pys_style", ":", "font", ".", "struck_out", "=", "pys_style", "[", "\"strikethrough\"", "]", "return", "font" ]
Returns xlwt.Font for pyspread style
[ "Returns", "xlwt", ".", "Font", "for", "pyspread", "style" ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/interfaces/xls.py#L238-L269
236,483
manns/pyspread
pyspread/src/interfaces/xls.py
Xls._get_alignment
def _get_alignment(self, pys_style): """Returns xlwt.Alignment for pyspread style""" # Return None if there is no alignment alignment_styles = ["justification", "vertical_align", "angle"] if not any(astyle in pys_style for astyle in alignment_styles): return def angle2xfrotation(angle): """Returns angle from xlrotatation""" # angle is counterclockwise if 0 <= angle <= 90: return angle elif -90 <= angle < 0: return 90 - angle return 0 justification2xfalign = { "left": 1, "center": 2, "right": 3, } vertical_align2xfalign = { "top": 0, "middle": 1, "bottom": 2, } alignment = xlwt.Alignment() try: alignment.horz = justification2xfalign[pys_style["justification"]] except KeyError: pass try: alignment.vert = \ vertical_align2xfalign[pys_style["vertical_align"]] except KeyError: pass try: alignment.rota = angle2xfrotation(pys_style["angle"]) except KeyError: pass return alignment
python
def _get_alignment(self, pys_style): """Returns xlwt.Alignment for pyspread style""" # Return None if there is no alignment alignment_styles = ["justification", "vertical_align", "angle"] if not any(astyle in pys_style for astyle in alignment_styles): return def angle2xfrotation(angle): """Returns angle from xlrotatation""" # angle is counterclockwise if 0 <= angle <= 90: return angle elif -90 <= angle < 0: return 90 - angle return 0 justification2xfalign = { "left": 1, "center": 2, "right": 3, } vertical_align2xfalign = { "top": 0, "middle": 1, "bottom": 2, } alignment = xlwt.Alignment() try: alignment.horz = justification2xfalign[pys_style["justification"]] except KeyError: pass try: alignment.vert = \ vertical_align2xfalign[pys_style["vertical_align"]] except KeyError: pass try: alignment.rota = angle2xfrotation(pys_style["angle"]) except KeyError: pass return alignment
[ "def", "_get_alignment", "(", "self", ",", "pys_style", ")", ":", "# Return None if there is no alignment", "alignment_styles", "=", "[", "\"justification\"", ",", "\"vertical_align\"", ",", "\"angle\"", "]", "if", "not", "any", "(", "astyle", "in", "pys_style", "for", "astyle", "in", "alignment_styles", ")", ":", "return", "def", "angle2xfrotation", "(", "angle", ")", ":", "\"\"\"Returns angle from xlrotatation\"\"\"", "# angle is counterclockwise", "if", "0", "<=", "angle", "<=", "90", ":", "return", "angle", "elif", "-", "90", "<=", "angle", "<", "0", ":", "return", "90", "-", "angle", "return", "0", "justification2xfalign", "=", "{", "\"left\"", ":", "1", ",", "\"center\"", ":", "2", ",", "\"right\"", ":", "3", ",", "}", "vertical_align2xfalign", "=", "{", "\"top\"", ":", "0", ",", "\"middle\"", ":", "1", ",", "\"bottom\"", ":", "2", ",", "}", "alignment", "=", "xlwt", ".", "Alignment", "(", ")", "try", ":", "alignment", ".", "horz", "=", "justification2xfalign", "[", "pys_style", "[", "\"justification\"", "]", "]", "except", "KeyError", ":", "pass", "try", ":", "alignment", ".", "vert", "=", "vertical_align2xfalign", "[", "pys_style", "[", "\"vertical_align\"", "]", "]", "except", "KeyError", ":", "pass", "try", ":", "alignment", ".", "rota", "=", "angle2xfrotation", "(", "pys_style", "[", "\"angle\"", "]", ")", "except", "KeyError", ":", "pass", "return", "alignment" ]
Returns xlwt.Alignment for pyspread style
[ "Returns", "xlwt", ".", "Alignment", "for", "pyspread", "style" ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/interfaces/xls.py#L271-L324
236,484
manns/pyspread
pyspread/src/interfaces/xls.py
Xls._get_pattern
def _get_pattern(self, pys_style): """Returns xlwt.pattern for pyspread style""" # Return None if there is no bgcolor if "bgcolor" not in pys_style: return pattern = xlwt.Pattern() pattern.pattern = xlwt.Pattern.SOLID_PATTERN bgcolor = wx.Colour() bgcolor.SetRGB(pys_style["bgcolor"]) pattern.pattern_fore_colour = self.color2idx(*bgcolor.Get()) return pattern
python
def _get_pattern(self, pys_style): """Returns xlwt.pattern for pyspread style""" # Return None if there is no bgcolor if "bgcolor" not in pys_style: return pattern = xlwt.Pattern() pattern.pattern = xlwt.Pattern.SOLID_PATTERN bgcolor = wx.Colour() bgcolor.SetRGB(pys_style["bgcolor"]) pattern.pattern_fore_colour = self.color2idx(*bgcolor.Get()) return pattern
[ "def", "_get_pattern", "(", "self", ",", "pys_style", ")", ":", "# Return None if there is no bgcolor", "if", "\"bgcolor\"", "not", "in", "pys_style", ":", "return", "pattern", "=", "xlwt", ".", "Pattern", "(", ")", "pattern", ".", "pattern", "=", "xlwt", ".", "Pattern", ".", "SOLID_PATTERN", "bgcolor", "=", "wx", ".", "Colour", "(", ")", "bgcolor", ".", "SetRGB", "(", "pys_style", "[", "\"bgcolor\"", "]", ")", "pattern", ".", "pattern_fore_colour", "=", "self", ".", "color2idx", "(", "*", "bgcolor", ".", "Get", "(", ")", ")", "return", "pattern" ]
Returns xlwt.pattern for pyspread style
[ "Returns", "xlwt", ".", "pattern", "for", "pyspread", "style" ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/interfaces/xls.py#L326-L340
236,485
manns/pyspread
pyspread/src/interfaces/xls.py
Xls._get_borders
def _get_borders(self, pys_style, pys_style_above, pys_style_left): """Returns xlwt.Borders for pyspread style""" # Return None if there is no border key border_keys = [ "borderwidth_right", "borderwidth_bottom", "bordercolor_right", "bordercolor_bottom", ] if not any(border_key in pys_style for border_key in border_keys): return def width2border_line_style(width): if width == 0: return xlwt.Borders.NO_LINE if 0 < width < 2: return xlwt.Borders.THIN if 2 <= width < 6: return xlwt.Borders.MEDIUM if width >= 6: return xlwt.Borders.THICK raise ValueError("Width {} unknown".format(width)) DEFAULT_LINE_STYLE = xlwt.Borders.THIN DEFAULT_COLOR_IDX = 0x16 # Tried out with gnumeric and LibreOffice borders = xlwt.Borders() # Width / style # ------------- # Bottom width try: bottom_pys_style = pys_style["borderwidth_bottom"] bottom_line_style = width2border_line_style(bottom_pys_style) except KeyError: # No or unknown border width bottom_line_style = DEFAULT_LINE_STYLE finally: borders.bottom = bottom_line_style # Right width try: right_pys_style = pys_style["borderwidth_right"] right_line_style = width2border_line_style(right_pys_style) except KeyError: # No or unknown border width right_line_style = DEFAULT_LINE_STYLE finally: borders.right = right_line_style # Top width try: top_pys_style = pys_style_above["borderwidth_bottom"] top_line_style = width2border_line_style(top_pys_style) except KeyError: # No or unknown border width top_line_style = DEFAULT_LINE_STYLE finally: borders.top = top_line_style # Left width try: left_pys_style = pys_style_left["borderwidth_right"] left_line_style = width2border_line_style(left_pys_style) except KeyError: # No or unknown border width left_line_style = DEFAULT_LINE_STYLE finally: borders.left = left_line_style # Border colors # ------------- # Bottom color def _get_color_idx(color): """Converts wx.Colour to Excel color index Differs from self.color2idx because it maps the pyspread default grid color to the Excel default color Parameters ---------- color: wx.Colour \tColor to be converted """ if color == get_color(config["grid_color"]): return DEFAULT_COLOR_IDX else: return self.color2idx(*color.Get()) try: bottom_color_pys_style = pys_style["bordercolor_bottom"] bcolor = wx.Colour() bcolor.SetRGB(bottom_color_pys_style) bottom_color_idx = _get_color_idx(bcolor) except KeyError: # No or unknown border color bottom_color_idx = DEFAULT_COLOR_IDX finally: borders.bottom_colour = bottom_color_idx # Right color try: right_color_pys_style = pys_style["bordercolor_right"] rcolor = wx.Colour() rcolor.SetRGB(right_color_pys_style) right_colour_idx = _get_color_idx(rcolor) except KeyError: # No or unknown border color right_colour_idx = DEFAULT_COLOR_IDX finally: borders.right_colour = right_colour_idx # Top color try: top_color_pys_style = pys_style_above["bordercolor_bottom"] tcolor = wx.Colour() tcolor.SetRGB(top_color_pys_style) top_color_idx = _get_color_idx(tcolor) except KeyError: # No or unknown border color top_color_idx = DEFAULT_COLOR_IDX finally: borders.top_colour = top_color_idx # Left color try: left_color_pys_style = pys_style_left["bordercolor_right"] lcolor = wx.Colour() lcolor.SetRGB(left_color_pys_style) left_colour_idx = _get_color_idx(lcolor) except KeyError: # No or unknown border color left_colour_idx = DEFAULT_COLOR_IDX finally: borders.left_colour = left_colour_idx return borders
python
def _get_borders(self, pys_style, pys_style_above, pys_style_left): """Returns xlwt.Borders for pyspread style""" # Return None if there is no border key border_keys = [ "borderwidth_right", "borderwidth_bottom", "bordercolor_right", "bordercolor_bottom", ] if not any(border_key in pys_style for border_key in border_keys): return def width2border_line_style(width): if width == 0: return xlwt.Borders.NO_LINE if 0 < width < 2: return xlwt.Borders.THIN if 2 <= width < 6: return xlwt.Borders.MEDIUM if width >= 6: return xlwt.Borders.THICK raise ValueError("Width {} unknown".format(width)) DEFAULT_LINE_STYLE = xlwt.Borders.THIN DEFAULT_COLOR_IDX = 0x16 # Tried out with gnumeric and LibreOffice borders = xlwt.Borders() # Width / style # ------------- # Bottom width try: bottom_pys_style = pys_style["borderwidth_bottom"] bottom_line_style = width2border_line_style(bottom_pys_style) except KeyError: # No or unknown border width bottom_line_style = DEFAULT_LINE_STYLE finally: borders.bottom = bottom_line_style # Right width try: right_pys_style = pys_style["borderwidth_right"] right_line_style = width2border_line_style(right_pys_style) except KeyError: # No or unknown border width right_line_style = DEFAULT_LINE_STYLE finally: borders.right = right_line_style # Top width try: top_pys_style = pys_style_above["borderwidth_bottom"] top_line_style = width2border_line_style(top_pys_style) except KeyError: # No or unknown border width top_line_style = DEFAULT_LINE_STYLE finally: borders.top = top_line_style # Left width try: left_pys_style = pys_style_left["borderwidth_right"] left_line_style = width2border_line_style(left_pys_style) except KeyError: # No or unknown border width left_line_style = DEFAULT_LINE_STYLE finally: borders.left = left_line_style # Border colors # ------------- # Bottom color def _get_color_idx(color): """Converts wx.Colour to Excel color index Differs from self.color2idx because it maps the pyspread default grid color to the Excel default color Parameters ---------- color: wx.Colour \tColor to be converted """ if color == get_color(config["grid_color"]): return DEFAULT_COLOR_IDX else: return self.color2idx(*color.Get()) try: bottom_color_pys_style = pys_style["bordercolor_bottom"] bcolor = wx.Colour() bcolor.SetRGB(bottom_color_pys_style) bottom_color_idx = _get_color_idx(bcolor) except KeyError: # No or unknown border color bottom_color_idx = DEFAULT_COLOR_IDX finally: borders.bottom_colour = bottom_color_idx # Right color try: right_color_pys_style = pys_style["bordercolor_right"] rcolor = wx.Colour() rcolor.SetRGB(right_color_pys_style) right_colour_idx = _get_color_idx(rcolor) except KeyError: # No or unknown border color right_colour_idx = DEFAULT_COLOR_IDX finally: borders.right_colour = right_colour_idx # Top color try: top_color_pys_style = pys_style_above["bordercolor_bottom"] tcolor = wx.Colour() tcolor.SetRGB(top_color_pys_style) top_color_idx = _get_color_idx(tcolor) except KeyError: # No or unknown border color top_color_idx = DEFAULT_COLOR_IDX finally: borders.top_colour = top_color_idx # Left color try: left_color_pys_style = pys_style_left["bordercolor_right"] lcolor = wx.Colour() lcolor.SetRGB(left_color_pys_style) left_colour_idx = _get_color_idx(lcolor) except KeyError: # No or unknown border color left_colour_idx = DEFAULT_COLOR_IDX finally: borders.left_colour = left_colour_idx return borders
[ "def", "_get_borders", "(", "self", ",", "pys_style", ",", "pys_style_above", ",", "pys_style_left", ")", ":", "# Return None if there is no border key", "border_keys", "=", "[", "\"borderwidth_right\"", ",", "\"borderwidth_bottom\"", ",", "\"bordercolor_right\"", ",", "\"bordercolor_bottom\"", ",", "]", "if", "not", "any", "(", "border_key", "in", "pys_style", "for", "border_key", "in", "border_keys", ")", ":", "return", "def", "width2border_line_style", "(", "width", ")", ":", "if", "width", "==", "0", ":", "return", "xlwt", ".", "Borders", ".", "NO_LINE", "if", "0", "<", "width", "<", "2", ":", "return", "xlwt", ".", "Borders", ".", "THIN", "if", "2", "<=", "width", "<", "6", ":", "return", "xlwt", ".", "Borders", ".", "MEDIUM", "if", "width", ">=", "6", ":", "return", "xlwt", ".", "Borders", ".", "THICK", "raise", "ValueError", "(", "\"Width {} unknown\"", ".", "format", "(", "width", ")", ")", "DEFAULT_LINE_STYLE", "=", "xlwt", ".", "Borders", ".", "THIN", "DEFAULT_COLOR_IDX", "=", "0x16", "# Tried out with gnumeric and LibreOffice", "borders", "=", "xlwt", ".", "Borders", "(", ")", "# Width / style", "# -------------", "# Bottom width", "try", ":", "bottom_pys_style", "=", "pys_style", "[", "\"borderwidth_bottom\"", "]", "bottom_line_style", "=", "width2border_line_style", "(", "bottom_pys_style", ")", "except", "KeyError", ":", "# No or unknown border width", "bottom_line_style", "=", "DEFAULT_LINE_STYLE", "finally", ":", "borders", ".", "bottom", "=", "bottom_line_style", "# Right width", "try", ":", "right_pys_style", "=", "pys_style", "[", "\"borderwidth_right\"", "]", "right_line_style", "=", "width2border_line_style", "(", "right_pys_style", ")", "except", "KeyError", ":", "# No or unknown border width", "right_line_style", "=", "DEFAULT_LINE_STYLE", "finally", ":", "borders", ".", "right", "=", "right_line_style", "# Top width", "try", ":", "top_pys_style", "=", "pys_style_above", "[", "\"borderwidth_bottom\"", "]", "top_line_style", "=", "width2border_line_style", "(", "top_pys_style", ")", "except", "KeyError", ":", "# No or unknown border width", "top_line_style", "=", "DEFAULT_LINE_STYLE", "finally", ":", "borders", ".", "top", "=", "top_line_style", "# Left width", "try", ":", "left_pys_style", "=", "pys_style_left", "[", "\"borderwidth_right\"", "]", "left_line_style", "=", "width2border_line_style", "(", "left_pys_style", ")", "except", "KeyError", ":", "# No or unknown border width", "left_line_style", "=", "DEFAULT_LINE_STYLE", "finally", ":", "borders", ".", "left", "=", "left_line_style", "# Border colors", "# -------------", "# Bottom color", "def", "_get_color_idx", "(", "color", ")", ":", "\"\"\"Converts wx.Colour to Excel color index\n\n Differs from self.color2idx because it maps\n the pyspread default grid color to the Excel default color\n\n Parameters\n ----------\n color: wx.Colour\n \\tColor to be converted\n\n \"\"\"", "if", "color", "==", "get_color", "(", "config", "[", "\"grid_color\"", "]", ")", ":", "return", "DEFAULT_COLOR_IDX", "else", ":", "return", "self", ".", "color2idx", "(", "*", "color", ".", "Get", "(", ")", ")", "try", ":", "bottom_color_pys_style", "=", "pys_style", "[", "\"bordercolor_bottom\"", "]", "bcolor", "=", "wx", ".", "Colour", "(", ")", "bcolor", ".", "SetRGB", "(", "bottom_color_pys_style", ")", "bottom_color_idx", "=", "_get_color_idx", "(", "bcolor", ")", "except", "KeyError", ":", "# No or unknown border color", "bottom_color_idx", "=", "DEFAULT_COLOR_IDX", "finally", ":", "borders", ".", "bottom_colour", "=", "bottom_color_idx", "# Right color", "try", ":", "right_color_pys_style", "=", "pys_style", "[", "\"bordercolor_right\"", "]", "rcolor", "=", "wx", ".", "Colour", "(", ")", "rcolor", ".", "SetRGB", "(", "right_color_pys_style", ")", "right_colour_idx", "=", "_get_color_idx", "(", "rcolor", ")", "except", "KeyError", ":", "# No or unknown border color", "right_colour_idx", "=", "DEFAULT_COLOR_IDX", "finally", ":", "borders", ".", "right_colour", "=", "right_colour_idx", "# Top color", "try", ":", "top_color_pys_style", "=", "pys_style_above", "[", "\"bordercolor_bottom\"", "]", "tcolor", "=", "wx", ".", "Colour", "(", ")", "tcolor", ".", "SetRGB", "(", "top_color_pys_style", ")", "top_color_idx", "=", "_get_color_idx", "(", "tcolor", ")", "except", "KeyError", ":", "# No or unknown border color", "top_color_idx", "=", "DEFAULT_COLOR_IDX", "finally", ":", "borders", ".", "top_colour", "=", "top_color_idx", "# Left color", "try", ":", "left_color_pys_style", "=", "pys_style_left", "[", "\"bordercolor_right\"", "]", "lcolor", "=", "wx", ".", "Colour", "(", ")", "lcolor", ".", "SetRGB", "(", "left_color_pys_style", ")", "left_colour_idx", "=", "_get_color_idx", "(", "lcolor", ")", "except", "KeyError", ":", "# No or unknown border color", "left_colour_idx", "=", "DEFAULT_COLOR_IDX", "finally", ":", "borders", ".", "left_colour", "=", "left_colour_idx", "return", "borders" ]
Returns xlwt.Borders for pyspread style
[ "Returns", "xlwt", ".", "Borders", "for", "pyspread", "style" ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/interfaces/xls.py#L342-L512
236,486
manns/pyspread
pyspread/src/interfaces/xls.py
Xls._get_xfstyle
def _get_xfstyle(self, worksheets, key): """Gets XFStyle for cell key""" row, col, tab = key dict_grid = self.code_array.dict_grid dict_grid.cell_attributes._update_table_cache() pys_style = dict_grid.cell_attributes[key] pys_style_above = dict_grid.cell_attributes[row - 1, col, tab] pys_style_left = dict_grid.cell_attributes[row, col - 1, tab] xfstyle = xlwt.XFStyle() # Font # ---- font = self._get_font(pys_style) if font is not None: xfstyle.font = font # Alignment # --------- alignment = self._get_alignment(pys_style) if alignment is not None: xfstyle.alignment = alignment # Background / pattern # -------------------- pattern = self._get_pattern(pys_style) if pattern is not None: xfstyle.pattern = pattern # Border # ------ borders = self._get_borders(pys_style, pys_style_above, pys_style_left) if borders is not None: xfstyle.borders = borders return xfstyle
python
def _get_xfstyle(self, worksheets, key): """Gets XFStyle for cell key""" row, col, tab = key dict_grid = self.code_array.dict_grid dict_grid.cell_attributes._update_table_cache() pys_style = dict_grid.cell_attributes[key] pys_style_above = dict_grid.cell_attributes[row - 1, col, tab] pys_style_left = dict_grid.cell_attributes[row, col - 1, tab] xfstyle = xlwt.XFStyle() # Font # ---- font = self._get_font(pys_style) if font is not None: xfstyle.font = font # Alignment # --------- alignment = self._get_alignment(pys_style) if alignment is not None: xfstyle.alignment = alignment # Background / pattern # -------------------- pattern = self._get_pattern(pys_style) if pattern is not None: xfstyle.pattern = pattern # Border # ------ borders = self._get_borders(pys_style, pys_style_above, pys_style_left) if borders is not None: xfstyle.borders = borders return xfstyle
[ "def", "_get_xfstyle", "(", "self", ",", "worksheets", ",", "key", ")", ":", "row", ",", "col", ",", "tab", "=", "key", "dict_grid", "=", "self", ".", "code_array", ".", "dict_grid", "dict_grid", ".", "cell_attributes", ".", "_update_table_cache", "(", ")", "pys_style", "=", "dict_grid", ".", "cell_attributes", "[", "key", "]", "pys_style_above", "=", "dict_grid", ".", "cell_attributes", "[", "row", "-", "1", ",", "col", ",", "tab", "]", "pys_style_left", "=", "dict_grid", ".", "cell_attributes", "[", "row", ",", "col", "-", "1", ",", "tab", "]", "xfstyle", "=", "xlwt", ".", "XFStyle", "(", ")", "# Font", "# ----", "font", "=", "self", ".", "_get_font", "(", "pys_style", ")", "if", "font", "is", "not", "None", ":", "xfstyle", ".", "font", "=", "font", "# Alignment", "# ---------", "alignment", "=", "self", ".", "_get_alignment", "(", "pys_style", ")", "if", "alignment", "is", "not", "None", ":", "xfstyle", ".", "alignment", "=", "alignment", "# Background / pattern", "# --------------------", "pattern", "=", "self", ".", "_get_pattern", "(", "pys_style", ")", "if", "pattern", "is", "not", "None", ":", "xfstyle", ".", "pattern", "=", "pattern", "# Border", "# ------", "borders", "=", "self", ".", "_get_borders", "(", "pys_style", ",", "pys_style_above", ",", "pys_style_left", ")", "if", "borders", "is", "not", "None", ":", "xfstyle", ".", "borders", "=", "borders", "return", "xfstyle" ]
Gets XFStyle for cell key
[ "Gets", "XFStyle", "for", "cell", "key" ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/interfaces/xls.py#L514-L555
236,487
manns/pyspread
pyspread/src/interfaces/xls.py
Xls._cell_attribute_append
def _cell_attribute_append(self, selection, tab, attributes): """Appends to cell_attributes with checks""" cell_attributes = self.code_array.cell_attributes thick_bottom_cells = [] thick_right_cells = [] # Does any cell in selection.cells have a larger bottom border? if "borderwidth_bottom" in attributes: bwidth = attributes["borderwidth_bottom"] for row, col in selection.cells: __bwidth = cell_attributes[row, col, tab]["borderwidth_bottom"] if __bwidth > bwidth: thick_bottom_cells.append((row, col)) # Does any cell in selection.cells have a larger right border? if "borderwidth_right" in attributes: rwidth = attributes["borderwidth_right"] for row, col in selection.cells: __rwidth = cell_attributes[row, col, tab]["borderwidth_right"] if __rwidth > rwidth: thick_right_cells.append((row, col)) for thick_cell in thick_bottom_cells + thick_right_cells: try: selection.cells.remove(thick_cell) except ValueError: pass cell_attributes.append((selection, tab, attributes)) if thick_bottom_cells: bsel = copy(selection) bsel.cells = thick_bottom_cells battrs = copy(attributes) battrs.pop("borderwidth_bottom") cell_attributes.append((bsel, tab, battrs)) if thick_right_cells: rsel = copy(selection) rsel.cells = thick_right_cells rattrs = copy(attributes) rattrs.pop("borderwidth_right") cell_attributes.append((rsel, tab, rattrs))
python
def _cell_attribute_append(self, selection, tab, attributes): """Appends to cell_attributes with checks""" cell_attributes = self.code_array.cell_attributes thick_bottom_cells = [] thick_right_cells = [] # Does any cell in selection.cells have a larger bottom border? if "borderwidth_bottom" in attributes: bwidth = attributes["borderwidth_bottom"] for row, col in selection.cells: __bwidth = cell_attributes[row, col, tab]["borderwidth_bottom"] if __bwidth > bwidth: thick_bottom_cells.append((row, col)) # Does any cell in selection.cells have a larger right border? if "borderwidth_right" in attributes: rwidth = attributes["borderwidth_right"] for row, col in selection.cells: __rwidth = cell_attributes[row, col, tab]["borderwidth_right"] if __rwidth > rwidth: thick_right_cells.append((row, col)) for thick_cell in thick_bottom_cells + thick_right_cells: try: selection.cells.remove(thick_cell) except ValueError: pass cell_attributes.append((selection, tab, attributes)) if thick_bottom_cells: bsel = copy(selection) bsel.cells = thick_bottom_cells battrs = copy(attributes) battrs.pop("borderwidth_bottom") cell_attributes.append((bsel, tab, battrs)) if thick_right_cells: rsel = copy(selection) rsel.cells = thick_right_cells rattrs = copy(attributes) rattrs.pop("borderwidth_right") cell_attributes.append((rsel, tab, rattrs))
[ "def", "_cell_attribute_append", "(", "self", ",", "selection", ",", "tab", ",", "attributes", ")", ":", "cell_attributes", "=", "self", ".", "code_array", ".", "cell_attributes", "thick_bottom_cells", "=", "[", "]", "thick_right_cells", "=", "[", "]", "# Does any cell in selection.cells have a larger bottom border?", "if", "\"borderwidth_bottom\"", "in", "attributes", ":", "bwidth", "=", "attributes", "[", "\"borderwidth_bottom\"", "]", "for", "row", ",", "col", "in", "selection", ".", "cells", ":", "__bwidth", "=", "cell_attributes", "[", "row", ",", "col", ",", "tab", "]", "[", "\"borderwidth_bottom\"", "]", "if", "__bwidth", ">", "bwidth", ":", "thick_bottom_cells", ".", "append", "(", "(", "row", ",", "col", ")", ")", "# Does any cell in selection.cells have a larger right border?", "if", "\"borderwidth_right\"", "in", "attributes", ":", "rwidth", "=", "attributes", "[", "\"borderwidth_right\"", "]", "for", "row", ",", "col", "in", "selection", ".", "cells", ":", "__rwidth", "=", "cell_attributes", "[", "row", ",", "col", ",", "tab", "]", "[", "\"borderwidth_right\"", "]", "if", "__rwidth", ">", "rwidth", ":", "thick_right_cells", ".", "append", "(", "(", "row", ",", "col", ")", ")", "for", "thick_cell", "in", "thick_bottom_cells", "+", "thick_right_cells", ":", "try", ":", "selection", ".", "cells", ".", "remove", "(", "thick_cell", ")", "except", "ValueError", ":", "pass", "cell_attributes", ".", "append", "(", "(", "selection", ",", "tab", ",", "attributes", ")", ")", "if", "thick_bottom_cells", ":", "bsel", "=", "copy", "(", "selection", ")", "bsel", ".", "cells", "=", "thick_bottom_cells", "battrs", "=", "copy", "(", "attributes", ")", "battrs", ".", "pop", "(", "\"borderwidth_bottom\"", ")", "cell_attributes", ".", "append", "(", "(", "bsel", ",", "tab", ",", "battrs", ")", ")", "if", "thick_right_cells", ":", "rsel", "=", "copy", "(", "selection", ")", "rsel", ".", "cells", "=", "thick_right_cells", "rattrs", "=", "copy", "(", "attributes", ")", "rattrs", ".", "pop", "(", "\"borderwidth_right\"", ")", "cell_attributes", ".", "append", "(", "(", "rsel", ",", "tab", ",", "rattrs", ")", ")" ]
Appends to cell_attributes with checks
[ "Appends", "to", "cell_attributes", "with", "checks" ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/interfaces/xls.py#L557-L602
236,488
manns/pyspread
pyspread/src/interfaces/xls.py
Xls._row_heights2xls
def _row_heights2xls(self, worksheets): """Writes row_heights to xls file Format: <row>\t<tab>\t<value>\n """ xls_max_rows, xls_max_tabs = self.xls_max_rows, self.xls_max_tabs dict_grid = self.code_array.dict_grid for row, tab in dict_grid.row_heights: if row < xls_max_rows and tab < xls_max_tabs: height_pixels = dict_grid.row_heights[(row, tab)] height_inches = height_pixels / float(get_dpi()[1]) height_points = height_inches * 72.0 worksheets[tab].row(row).height_mismatch = True worksheets[tab].row(row).height = int(height_points * 20.0)
python
def _row_heights2xls(self, worksheets): """Writes row_heights to xls file Format: <row>\t<tab>\t<value>\n """ xls_max_rows, xls_max_tabs = self.xls_max_rows, self.xls_max_tabs dict_grid = self.code_array.dict_grid for row, tab in dict_grid.row_heights: if row < xls_max_rows and tab < xls_max_tabs: height_pixels = dict_grid.row_heights[(row, tab)] height_inches = height_pixels / float(get_dpi()[1]) height_points = height_inches * 72.0 worksheets[tab].row(row).height_mismatch = True worksheets[tab].row(row).height = int(height_points * 20.0)
[ "def", "_row_heights2xls", "(", "self", ",", "worksheets", ")", ":", "xls_max_rows", ",", "xls_max_tabs", "=", "self", ".", "xls_max_rows", ",", "self", ".", "xls_max_tabs", "dict_grid", "=", "self", ".", "code_array", ".", "dict_grid", "for", "row", ",", "tab", "in", "dict_grid", ".", "row_heights", ":", "if", "row", "<", "xls_max_rows", "and", "tab", "<", "xls_max_tabs", ":", "height_pixels", "=", "dict_grid", ".", "row_heights", "[", "(", "row", ",", "tab", ")", "]", "height_inches", "=", "height_pixels", "/", "float", "(", "get_dpi", "(", ")", "[", "1", "]", ")", "height_points", "=", "height_inches", "*", "72.0", "worksheets", "[", "tab", "]", ".", "row", "(", "row", ")", ".", "height_mismatch", "=", "True", "worksheets", "[", "tab", "]", ".", "row", "(", "row", ")", ".", "height", "=", "int", "(", "height_points", "*", "20.0", ")" ]
Writes row_heights to xls file Format: <row>\t<tab>\t<value>\n
[ "Writes", "row_heights", "to", "xls", "file" ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/interfaces/xls.py#L770-L788
236,489
manns/pyspread
pyspread/src/interfaces/xls.py
Xls.pys_width2xls_width
def pys_width2xls_width(self, pys_width): """Returns xls width from given pyspread width""" width_0 = get_default_text_extent("0")[0] # Scale relative to 12 point font instead of 10 point width_0_char = pys_width * 1.2 / width_0 return int(width_0_char * 256.0)
python
def pys_width2xls_width(self, pys_width): """Returns xls width from given pyspread width""" width_0 = get_default_text_extent("0")[0] # Scale relative to 12 point font instead of 10 point width_0_char = pys_width * 1.2 / width_0 return int(width_0_char * 256.0)
[ "def", "pys_width2xls_width", "(", "self", ",", "pys_width", ")", ":", "width_0", "=", "get_default_text_extent", "(", "\"0\"", ")", "[", "0", "]", "# Scale relative to 12 point font instead of 10 point", "width_0_char", "=", "pys_width", "*", "1.2", "/", "width_0", "return", "int", "(", "width_0_char", "*", "256.0", ")" ]
Returns xls width from given pyspread width
[ "Returns", "xls", "width", "from", "given", "pyspread", "width" ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/interfaces/xls.py#L804-L810
236,490
manns/pyspread
pyspread/src/interfaces/xls.py
Xls._col_widths2xls
def _col_widths2xls(self, worksheets): """Writes col_widths to xls file Format: <col>\t<tab>\t<value>\n """ xls_max_cols, xls_max_tabs = self.xls_max_cols, self.xls_max_tabs dict_grid = self.code_array.dict_grid for col, tab in dict_grid.col_widths: if col < xls_max_cols and tab < xls_max_tabs: pys_width = dict_grid.col_widths[(col, tab)] xls_width = self.pys_width2xls_width(pys_width) worksheets[tab].col(col).width = xls_width
python
def _col_widths2xls(self, worksheets): """Writes col_widths to xls file Format: <col>\t<tab>\t<value>\n """ xls_max_cols, xls_max_tabs = self.xls_max_cols, self.xls_max_tabs dict_grid = self.code_array.dict_grid for col, tab in dict_grid.col_widths: if col < xls_max_cols and tab < xls_max_tabs: pys_width = dict_grid.col_widths[(col, tab)] xls_width = self.pys_width2xls_width(pys_width) worksheets[tab].col(col).width = xls_width
[ "def", "_col_widths2xls", "(", "self", ",", "worksheets", ")", ":", "xls_max_cols", ",", "xls_max_tabs", "=", "self", ".", "xls_max_cols", ",", "self", ".", "xls_max_tabs", "dict_grid", "=", "self", ".", "code_array", ".", "dict_grid", "for", "col", ",", "tab", "in", "dict_grid", ".", "col_widths", ":", "if", "col", "<", "xls_max_cols", "and", "tab", "<", "xls_max_tabs", ":", "pys_width", "=", "dict_grid", ".", "col_widths", "[", "(", "col", ",", "tab", ")", "]", "xls_width", "=", "self", ".", "pys_width2xls_width", "(", "pys_width", ")", "worksheets", "[", "tab", "]", ".", "col", "(", "col", ")", ".", "width", "=", "xls_width" ]
Writes col_widths to xls file Format: <col>\t<tab>\t<value>\n
[ "Writes", "col_widths", "to", "xls", "file" ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/interfaces/xls.py#L820-L835
236,491
manns/pyspread
pyspread/src/interfaces/xls.py
Xls.from_code_array
def from_code_array(self): """Returns xls workbook object with everything from code_array""" worksheets = [] self._shape2xls(worksheets) self._code2xls(worksheets) self._row_heights2xls(worksheets) self._col_widths2xls(worksheets) return self.workbook
python
def from_code_array(self): """Returns xls workbook object with everything from code_array""" worksheets = [] self._shape2xls(worksheets) self._code2xls(worksheets) self._row_heights2xls(worksheets) self._col_widths2xls(worksheets) return self.workbook
[ "def", "from_code_array", "(", "self", ")", ":", "worksheets", "=", "[", "]", "self", ".", "_shape2xls", "(", "worksheets", ")", "self", ".", "_code2xls", "(", "worksheets", ")", "self", ".", "_row_heights2xls", "(", "worksheets", ")", "self", ".", "_col_widths2xls", "(", "worksheets", ")", "return", "self", ".", "workbook" ]
Returns xls workbook object with everything from code_array
[ "Returns", "xls", "workbook", "object", "with", "everything", "from", "code_array" ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/interfaces/xls.py#L852-L863
236,492
manns/pyspread
pyspread/src/interfaces/xls.py
Xls.to_code_array
def to_code_array(self): """Replaces everything in code_array from xls_file""" self._xls2shape() worksheets = self.workbook.sheet_names() for tab, worksheet_name in enumerate(worksheets): worksheet = self.workbook.sheet_by_name(worksheet_name) self._xls2code(worksheet, tab) self._xls2attributes(worksheet, tab) self._xls2row_heights(worksheet, tab) self._xls2col_widths(worksheet, tab)
python
def to_code_array(self): """Replaces everything in code_array from xls_file""" self._xls2shape() worksheets = self.workbook.sheet_names() for tab, worksheet_name in enumerate(worksheets): worksheet = self.workbook.sheet_by_name(worksheet_name) self._xls2code(worksheet, tab) self._xls2attributes(worksheet, tab) self._xls2row_heights(worksheet, tab) self._xls2col_widths(worksheet, tab)
[ "def", "to_code_array", "(", "self", ")", ":", "self", ".", "_xls2shape", "(", ")", "worksheets", "=", "self", ".", "workbook", ".", "sheet_names", "(", ")", "for", "tab", ",", "worksheet_name", "in", "enumerate", "(", "worksheets", ")", ":", "worksheet", "=", "self", ".", "workbook", ".", "sheet_by_name", "(", "worksheet_name", ")", "self", ".", "_xls2code", "(", "worksheet", ",", "tab", ")", "self", ".", "_xls2attributes", "(", "worksheet", ",", "tab", ")", "self", ".", "_xls2row_heights", "(", "worksheet", ",", "tab", ")", "self", ".", "_xls2col_widths", "(", "worksheet", ",", "tab", ")" ]
Replaces everything in code_array from xls_file
[ "Replaces", "everything", "in", "code_array", "from", "xls_file" ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/interfaces/xls.py#L865-L877
236,493
manns/pyspread
pyspread/src/interfaces/pys.py
Pys._split_tidy
def _split_tidy(self, string, maxsplit=None): """Rstrips string for \n and splits string for \t""" if maxsplit is None: return string.rstrip("\n").split("\t") else: return string.rstrip("\n").split("\t", maxsplit)
python
def _split_tidy(self, string, maxsplit=None): """Rstrips string for \n and splits string for \t""" if maxsplit is None: return string.rstrip("\n").split("\t") else: return string.rstrip("\n").split("\t", maxsplit)
[ "def", "_split_tidy", "(", "self", ",", "string", ",", "maxsplit", "=", "None", ")", ":", "if", "maxsplit", "is", "None", ":", "return", "string", ".", "rstrip", "(", "\"\\n\"", ")", ".", "split", "(", "\"\\t\"", ")", "else", ":", "return", "string", ".", "rstrip", "(", "\"\\n\"", ")", ".", "split", "(", "\"\\t\"", ",", "maxsplit", ")" ]
Rstrips string for \n and splits string for \t
[ "Rstrips", "string", "for", "\\", "n", "and", "splits", "string", "for", "\\", "t" ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/interfaces/pys.py#L107-L113
236,494
manns/pyspread
pyspread/src/interfaces/pys.py
Pys._pys_assert_version
def _pys_assert_version(self, line): """Asserts pys file version""" if float(line.strip()) > 1.0: # Abort if file version not supported msg = _("File version {version} unsupported (>1.0).").format( version=line.strip()) raise ValueError(msg)
python
def _pys_assert_version(self, line): """Asserts pys file version""" if float(line.strip()) > 1.0: # Abort if file version not supported msg = _("File version {version} unsupported (>1.0).").format( version=line.strip()) raise ValueError(msg)
[ "def", "_pys_assert_version", "(", "self", ",", "line", ")", ":", "if", "float", "(", "line", ".", "strip", "(", ")", ")", ">", "1.0", ":", "# Abort if file version not supported", "msg", "=", "_", "(", "\"File version {version} unsupported (>1.0).\"", ")", ".", "format", "(", "version", "=", "line", ".", "strip", "(", ")", ")", "raise", "ValueError", "(", "msg", ")" ]
Asserts pys file version
[ "Asserts", "pys", "file", "version" ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/interfaces/pys.py#L120-L127
236,495
manns/pyspread
pyspread/src/interfaces/pys.py
Pys._shape2pys
def _shape2pys(self): """Writes shape to pys file Format: <rows>\t<cols>\t<tabs>\n """ shape_line = u"\t".join(map(unicode, self.code_array.shape)) + u"\n" self.pys_file.write(shape_line)
python
def _shape2pys(self): """Writes shape to pys file Format: <rows>\t<cols>\t<tabs>\n """ shape_line = u"\t".join(map(unicode, self.code_array.shape)) + u"\n" self.pys_file.write(shape_line)
[ "def", "_shape2pys", "(", "self", ")", ":", "shape_line", "=", "u\"\\t\"", ".", "join", "(", "map", "(", "unicode", ",", "self", ".", "code_array", ".", "shape", ")", ")", "+", "u\"\\n\"", "self", ".", "pys_file", ".", "write", "(", "shape_line", ")" ]
Writes shape to pys file Format: <rows>\t<cols>\t<tabs>\n
[ "Writes", "shape", "to", "pys", "file" ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/interfaces/pys.py#L138-L146
236,496
manns/pyspread
pyspread/src/interfaces/pys.py
Pys._code2pys
def _code2pys(self): """Writes code to pys file Format: <row>\t<col>\t<tab>\t<code>\n """ for key in self.code_array: key_str = u"\t".join(repr(ele) for ele in key) code_str = self.code_array(key) if code_str is not None: out_str = key_str + u"\t" + code_str + u"\n" self.pys_file.write(out_str.encode("utf-8"))
python
def _code2pys(self): """Writes code to pys file Format: <row>\t<col>\t<tab>\t<code>\n """ for key in self.code_array: key_str = u"\t".join(repr(ele) for ele in key) code_str = self.code_array(key) if code_str is not None: out_str = key_str + u"\t" + code_str + u"\n" self.pys_file.write(out_str.encode("utf-8"))
[ "def", "_code2pys", "(", "self", ")", ":", "for", "key", "in", "self", ".", "code_array", ":", "key_str", "=", "u\"\\t\"", ".", "join", "(", "repr", "(", "ele", ")", "for", "ele", "in", "key", ")", "code_str", "=", "self", ".", "code_array", "(", "key", ")", "if", "code_str", "is", "not", "None", ":", "out_str", "=", "key_str", "+", "u\"\\t\"", "+", "code_str", "+", "u\"\\n\"", "self", ".", "pys_file", ".", "write", "(", "out_str", ".", "encode", "(", "\"utf-8\"", ")", ")" ]
Writes code to pys file Format: <row>\t<col>\t<tab>\t<code>\n
[ "Writes", "code", "to", "pys", "file" ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/interfaces/pys.py#L153-L166
236,497
manns/pyspread
pyspread/src/interfaces/pys.py
Pys._pys2code
def _pys2code(self, line): """Updates code in pys code_array""" row, col, tab, code = self._split_tidy(line, maxsplit=3) key = self._get_key(row, col, tab) self.code_array.dict_grid[key] = unicode(code, encoding='utf-8')
python
def _pys2code(self, line): """Updates code in pys code_array""" row, col, tab, code = self._split_tidy(line, maxsplit=3) key = self._get_key(row, col, tab) self.code_array.dict_grid[key] = unicode(code, encoding='utf-8')
[ "def", "_pys2code", "(", "self", ",", "line", ")", ":", "row", ",", "col", ",", "tab", ",", "code", "=", "self", ".", "_split_tidy", "(", "line", ",", "maxsplit", "=", "3", ")", "key", "=", "self", ".", "_get_key", "(", "row", ",", "col", ",", "tab", ")", "self", ".", "code_array", ".", "dict_grid", "[", "key", "]", "=", "unicode", "(", "code", ",", "encoding", "=", "'utf-8'", ")" ]
Updates code in pys code_array
[ "Updates", "code", "in", "pys", "code_array" ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/interfaces/pys.py#L168-L174
236,498
manns/pyspread
pyspread/src/interfaces/pys.py
Pys._attributes2pys
def _attributes2pys(self): """Writes attributes to pys file Format: <selection[0]>\t[...]\t<tab>\t<key>\t<value>\t[...]\n """ # Remove doublettes purged_cell_attributes = [] purged_cell_attributes_keys = [] for selection, tab, attr_dict in self.code_array.cell_attributes: if purged_cell_attributes_keys and \ (selection, tab) == purged_cell_attributes_keys[-1]: purged_cell_attributes[-1][2].update(attr_dict) else: purged_cell_attributes_keys.append((selection, tab)) purged_cell_attributes.append([selection, tab, attr_dict]) for selection, tab, attr_dict in purged_cell_attributes: sel_list = [selection.block_tl, selection.block_br, selection.rows, selection.cols, selection.cells] tab_list = [tab] attr_dict_list = [] for key in attr_dict: attr_dict_list.append(key) attr_dict_list.append(attr_dict[key]) if config["font_save_enabled"] and key == 'textfont': self.fonts_used.append(attr_dict[key]) line_list = map(repr, sel_list + tab_list + attr_dict_list) self.pys_file.write(u"\t".join(line_list) + u"\n")
python
def _attributes2pys(self): """Writes attributes to pys file Format: <selection[0]>\t[...]\t<tab>\t<key>\t<value>\t[...]\n """ # Remove doublettes purged_cell_attributes = [] purged_cell_attributes_keys = [] for selection, tab, attr_dict in self.code_array.cell_attributes: if purged_cell_attributes_keys and \ (selection, tab) == purged_cell_attributes_keys[-1]: purged_cell_attributes[-1][2].update(attr_dict) else: purged_cell_attributes_keys.append((selection, tab)) purged_cell_attributes.append([selection, tab, attr_dict]) for selection, tab, attr_dict in purged_cell_attributes: sel_list = [selection.block_tl, selection.block_br, selection.rows, selection.cols, selection.cells] tab_list = [tab] attr_dict_list = [] for key in attr_dict: attr_dict_list.append(key) attr_dict_list.append(attr_dict[key]) if config["font_save_enabled"] and key == 'textfont': self.fonts_used.append(attr_dict[key]) line_list = map(repr, sel_list + tab_list + attr_dict_list) self.pys_file.write(u"\t".join(line_list) + u"\n")
[ "def", "_attributes2pys", "(", "self", ")", ":", "# Remove doublettes", "purged_cell_attributes", "=", "[", "]", "purged_cell_attributes_keys", "=", "[", "]", "for", "selection", ",", "tab", ",", "attr_dict", "in", "self", ".", "code_array", ".", "cell_attributes", ":", "if", "purged_cell_attributes_keys", "and", "(", "selection", ",", "tab", ")", "==", "purged_cell_attributes_keys", "[", "-", "1", "]", ":", "purged_cell_attributes", "[", "-", "1", "]", "[", "2", "]", ".", "update", "(", "attr_dict", ")", "else", ":", "purged_cell_attributes_keys", ".", "append", "(", "(", "selection", ",", "tab", ")", ")", "purged_cell_attributes", ".", "append", "(", "[", "selection", ",", "tab", ",", "attr_dict", "]", ")", "for", "selection", ",", "tab", ",", "attr_dict", "in", "purged_cell_attributes", ":", "sel_list", "=", "[", "selection", ".", "block_tl", ",", "selection", ".", "block_br", ",", "selection", ".", "rows", ",", "selection", ".", "cols", ",", "selection", ".", "cells", "]", "tab_list", "=", "[", "tab", "]", "attr_dict_list", "=", "[", "]", "for", "key", "in", "attr_dict", ":", "attr_dict_list", ".", "append", "(", "key", ")", "attr_dict_list", ".", "append", "(", "attr_dict", "[", "key", "]", ")", "if", "config", "[", "\"font_save_enabled\"", "]", "and", "key", "==", "'textfont'", ":", "self", ".", "fonts_used", ".", "append", "(", "attr_dict", "[", "key", "]", ")", "line_list", "=", "map", "(", "repr", ",", "sel_list", "+", "tab_list", "+", "attr_dict_list", ")", "self", ".", "pys_file", ".", "write", "(", "u\"\\t\"", ".", "join", "(", "line_list", ")", "+", "u\"\\n\"", ")" ]
Writes attributes to pys file Format: <selection[0]>\t[...]\t<tab>\t<key>\t<value>\t[...]\n
[ "Writes", "attributes", "to", "pys", "file" ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/interfaces/pys.py#L176-L211
236,499
manns/pyspread
pyspread/src/interfaces/pys.py
Pys._row_heights2pys
def _row_heights2pys(self): """Writes row_heights to pys file Format: <row>\t<tab>\t<value>\n """ for row, tab in self.code_array.dict_grid.row_heights: if row < self.code_array.shape[0] and \ tab < self.code_array.shape[2]: height = self.code_array.dict_grid.row_heights[(row, tab)] height_strings = map(repr, [row, tab, height]) self.pys_file.write(u"\t".join(height_strings) + u"\n")
python
def _row_heights2pys(self): """Writes row_heights to pys file Format: <row>\t<tab>\t<value>\n """ for row, tab in self.code_array.dict_grid.row_heights: if row < self.code_array.shape[0] and \ tab < self.code_array.shape[2]: height = self.code_array.dict_grid.row_heights[(row, tab)] height_strings = map(repr, [row, tab, height]) self.pys_file.write(u"\t".join(height_strings) + u"\n")
[ "def", "_row_heights2pys", "(", "self", ")", ":", "for", "row", ",", "tab", "in", "self", ".", "code_array", ".", "dict_grid", ".", "row_heights", ":", "if", "row", "<", "self", ".", "code_array", ".", "shape", "[", "0", "]", "and", "tab", "<", "self", ".", "code_array", ".", "shape", "[", "2", "]", ":", "height", "=", "self", ".", "code_array", ".", "dict_grid", ".", "row_heights", "[", "(", "row", ",", "tab", ")", "]", "height_strings", "=", "map", "(", "repr", ",", "[", "row", ",", "tab", ",", "height", "]", ")", "self", ".", "pys_file", ".", "write", "(", "u\"\\t\"", ".", "join", "(", "height_strings", ")", "+", "u\"\\n\"", ")" ]
Writes row_heights to pys file Format: <row>\t<tab>\t<value>\n
[ "Writes", "row_heights", "to", "pys", "file" ]
0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/interfaces/pys.py#L235-L247