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 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
manns/pyspread | pyspread/src/lib/parsers.py | common_start | def common_start(strings):
"""Returns start sub-string that is common for all given strings
Parameters
----------
strings: List of strings
\tThese strings are evaluated for their largest common start string
"""
def gen_start_strings(string):
"""Generator that yield start sub-strin... | python | def common_start(strings):
"""Returns start sub-string that is common for all given strings
Parameters
----------
strings: List of strings
\tThese strings are evaluated for their largest common start string
"""
def gen_start_strings(string):
"""Generator that yield start sub-strin... | [
"def",
"common_start",
"(",
"strings",
")",
":",
"def",
"gen_start_strings",
"(",
"string",
")",
":",
"for",
"i",
"in",
"xrange",
"(",
"1",
",",
"len",
"(",
"string",
")",
"+",
"1",
")",
":",
"yield",
"string",
"[",
":",
"i",
"]",
"if",
"not",
"s... | Returns start sub-string that is common for all given strings
Parameters
----------
strings: List of strings
\tThese strings are evaluated for their largest common start string | [
"Returns",
"start",
"sub",
"-",
"string",
"that",
"is",
"common",
"for",
"all",
"given",
"strings"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/parsers.py#L159-L186 | train |
manns/pyspread | pyspread/src/lib/parsers.py | is_svg | def is_svg(code):
"""Checks if code is an svg image
Parameters
----------
code: String
\tCode to be parsed in order to check svg complaince
"""
if rsvg is None:
return
try:
rsvg.Handle(data=code)
except glib.GError:
return False
# The SVG file has to... | python | def is_svg(code):
"""Checks if code is an svg image
Parameters
----------
code: String
\tCode to be parsed in order to check svg complaince
"""
if rsvg is None:
return
try:
rsvg.Handle(data=code)
except glib.GError:
return False
# The SVG file has to... | [
"def",
"is_svg",
"(",
"code",
")",
":",
"if",
"rsvg",
"is",
"None",
":",
"return",
"try",
":",
"rsvg",
".",
"Handle",
"(",
"data",
"=",
"code",
")",
"except",
"glib",
".",
"GError",
":",
"return",
"False",
"if",
"\"http://www.w3.org/2000/svg\"",
"in",
... | Checks if code is an svg image
Parameters
----------
code: String
\tCode to be parsed in order to check svg complaince | [
"Checks",
"if",
"code",
"is",
"an",
"svg",
"image"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/parsers.py#L189-L214 | train |
manns/pyspread | pyspread/src/gui/_cairo_export_dialog.py | CairoExportDialog._get_dialog_title | def _get_dialog_title(self):
"""Returns title string"""
title_filetype = self.filetype[0].upper() + self.filetype[1:]
if self.filetype == "print":
title_export = ""
else:
title_export = " export"
return _("{filetype}{export} options").format(filetype=ti... | python | def _get_dialog_title(self):
"""Returns title string"""
title_filetype = self.filetype[0].upper() + self.filetype[1:]
if self.filetype == "print":
title_export = ""
else:
title_export = " export"
return _("{filetype}{export} options").format(filetype=ti... | [
"def",
"_get_dialog_title",
"(",
"self",
")",
":",
"title_filetype",
"=",
"self",
".",
"filetype",
"[",
"0",
"]",
".",
"upper",
"(",
")",
"+",
"self",
".",
"filetype",
"[",
"1",
":",
"]",
"if",
"self",
".",
"filetype",
"==",
"\"print\"",
":",
"title_... | Returns title string | [
"Returns",
"title",
"string"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/_cairo_export_dialog.py#L118-L129 | train |
manns/pyspread | pyspread/src/gui/_cairo_export_dialog.py | CairoExportDialog.on_page_layout_choice | def on_page_layout_choice(self, event):
"""Page layout choice event handler"""
width, height = self.paper_sizes_points[event.GetString()]
self.page_width_text_ctrl.SetValue(str(width / 72.0))
self.page_height_text_ctrl.SetValue(str(height / 72.0))
event.Skip() | python | def on_page_layout_choice(self, event):
"""Page layout choice event handler"""
width, height = self.paper_sizes_points[event.GetString()]
self.page_width_text_ctrl.SetValue(str(width / 72.0))
self.page_height_text_ctrl.SetValue(str(height / 72.0))
event.Skip() | [
"def",
"on_page_layout_choice",
"(",
"self",
",",
"event",
")",
":",
"width",
",",
"height",
"=",
"self",
".",
"paper_sizes_points",
"[",
"event",
".",
"GetString",
"(",
")",
"]",
"self",
".",
"page_width_text_ctrl",
".",
"SetValue",
"(",
"str",
"(",
"widt... | Page layout choice event handler | [
"Page",
"layout",
"choice",
"event",
"handler"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/_cairo_export_dialog.py#L248-L255 | train |
manns/pyspread | pyspread/src/gui/_cairo_export_dialog.py | CairoExportDialog.get_info | def get_info(self):
"""Returns a dict with the dialog PDF info
Dict keys are:
top_row, bottom_row, left_col, right_col, first_tab, last_tab,
paper_width, paper_height
"""
info = {}
info["top_row"] = self.top_row_text_ctrl.GetValue()
info["bottom_row"] ... | python | def get_info(self):
"""Returns a dict with the dialog PDF info
Dict keys are:
top_row, bottom_row, left_col, right_col, first_tab, last_tab,
paper_width, paper_height
"""
info = {}
info["top_row"] = self.top_row_text_ctrl.GetValue()
info["bottom_row"] ... | [
"def",
"get_info",
"(",
"self",
")",
":",
"info",
"=",
"{",
"}",
"info",
"[",
"\"top_row\"",
"]",
"=",
"self",
".",
"top_row_text_ctrl",
".",
"GetValue",
"(",
")",
"info",
"[",
"\"bottom_row\"",
"]",
"=",
"self",
".",
"bottom_row_text_ctrl",
".",
"GetVal... | Returns a dict with the dialog PDF info
Dict keys are:
top_row, bottom_row, left_col, right_col, first_tab, last_tab,
paper_width, paper_height | [
"Returns",
"a",
"dict",
"with",
"the",
"dialog",
"PDF",
"info"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/_cairo_export_dialog.py#L257-L293 | train |
manns/pyspread | pyspread/src/sysvars.py | get_program_path | def get_program_path():
"""Returns the path in which pyspread is installed"""
src_folder = os.path.dirname(__file__)
program_path = os.sep.join(src_folder.split(os.sep)[:-1]) + os.sep
return program_path | python | def get_program_path():
"""Returns the path in which pyspread is installed"""
src_folder = os.path.dirname(__file__)
program_path = os.sep.join(src_folder.split(os.sep)[:-1]) + os.sep
return program_path | [
"def",
"get_program_path",
"(",
")",
":",
"src_folder",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"__file__",
")",
"program_path",
"=",
"os",
".",
"sep",
".",
"join",
"(",
"src_folder",
".",
"split",
"(",
"os",
".",
"sep",
")",
"[",
":",
"-",
"1... | Returns the path in which pyspread is installed | [
"Returns",
"the",
"path",
"in",
"which",
"pyspread",
"is",
"installed"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/sysvars.py#L44-L50 | train |
manns/pyspread | pyspread/src/sysvars.py | get_dpi | def get_dpi():
"""Returns screen dpi resolution"""
def pxmm_2_dpi((pixels, length_mm)):
return pixels * 25.6 / length_mm
return map(pxmm_2_dpi, zip(wx.GetDisplaySize(), wx.GetDisplaySizeMM())) | python | def get_dpi():
"""Returns screen dpi resolution"""
def pxmm_2_dpi((pixels, length_mm)):
return pixels * 25.6 / length_mm
return map(pxmm_2_dpi, zip(wx.GetDisplaySize(), wx.GetDisplaySizeMM())) | [
"def",
"get_dpi",
"(",
")",
":",
"def",
"pxmm_2_dpi",
"(",
"(",
"pixels",
",",
"length_mm",
")",
")",
":",
"return",
"pixels",
"*",
"25.6",
"/",
"length_mm",
"return",
"map",
"(",
"pxmm_2_dpi",
",",
"zip",
"(",
"wx",
".",
"GetDisplaySize",
"(",
")",
... | Returns screen dpi resolution | [
"Returns",
"screen",
"dpi",
"resolution"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/sysvars.py#L83-L89 | train |
manns/pyspread | pyspread/src/sysvars.py | get_font_list | def get_font_list():
"""Returns a sorted list of all system font names"""
font_map = pangocairo.cairo_font_map_get_default()
font_list = [f.get_name() for f in font_map.list_families()]
font_list.sort()
return font_list | python | def get_font_list():
"""Returns a sorted list of all system font names"""
font_map = pangocairo.cairo_font_map_get_default()
font_list = [f.get_name() for f in font_map.list_families()]
font_list.sort()
return font_list | [
"def",
"get_font_list",
"(",
")",
":",
"font_map",
"=",
"pangocairo",
".",
"cairo_font_map_get_default",
"(",
")",
"font_list",
"=",
"[",
"f",
".",
"get_name",
"(",
")",
"for",
"f",
"in",
"font_map",
".",
"list_families",
"(",
")",
"]",
"font_list",
".",
... | Returns a sorted list of all system font names | [
"Returns",
"a",
"sorted",
"list",
"of",
"all",
"system",
"font",
"names"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/sysvars.py#L112-L119 | train |
manns/pyspread | pyspread/src/sysvars.py | get_dependencies | def get_dependencies():
"""Returns list of dicts which indicate installed dependencies"""
dependencies = []
# Numpy
dep_attrs = {
"name": "numpy",
"min_version": "1.1.0",
"description": "required",
}
try:
import numpy
dep_attrs["version"] = numpy.version... | python | def get_dependencies():
"""Returns list of dicts which indicate installed dependencies"""
dependencies = []
# Numpy
dep_attrs = {
"name": "numpy",
"min_version": "1.1.0",
"description": "required",
}
try:
import numpy
dep_attrs["version"] = numpy.version... | [
"def",
"get_dependencies",
"(",
")",
":",
"dependencies",
"=",
"[",
"]",
"dep_attrs",
"=",
"{",
"\"name\"",
":",
"\"numpy\"",
",",
"\"min_version\"",
":",
"\"1.1.0\"",
",",
"\"description\"",
":",
"\"required\"",
",",
"}",
"try",
":",
"import",
"numpy",
"dep... | Returns list of dicts which indicate installed dependencies | [
"Returns",
"list",
"of",
"dicts",
"which",
"indicate",
"installed",
"dependencies"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/sysvars.py#L128-L267 | train |
manns/pyspread | pyspread/src/lib/_grid_cairo_renderer.py | GridCairoRenderer.get_cell_rect | def get_cell_rect(self, row, col, tab):
"""Returns rectangle of cell on canvas"""
top_row = self.row_tb[0]
left_col = self.col_rl[0]
pos_x = self.x_offset
pos_y = self.y_offset
merge_area = self._get_merge_area((row, col, tab))
for __row in xrange(top_row, row... | python | def get_cell_rect(self, row, col, tab):
"""Returns rectangle of cell on canvas"""
top_row = self.row_tb[0]
left_col = self.col_rl[0]
pos_x = self.x_offset
pos_y = self.y_offset
merge_area = self._get_merge_area((row, col, tab))
for __row in xrange(top_row, row... | [
"def",
"get_cell_rect",
"(",
"self",
",",
"row",
",",
"col",
",",
"tab",
")",
":",
"top_row",
"=",
"self",
".",
"row_tb",
"[",
"0",
"]",
"left_col",
"=",
"self",
".",
"col_rl",
"[",
"0",
"]",
"pos_x",
"=",
"self",
".",
"x_offset",
"pos_y",
"=",
"... | Returns rectangle of cell on canvas | [
"Returns",
"rectangle",
"of",
"cell",
"on",
"canvas"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/_grid_cairo_renderer.py#L129-L167 | train |
manns/pyspread | pyspread/src/lib/_grid_cairo_renderer.py | GridCairoRenderer.draw | def draw(self):
"""Draws slice to context"""
row_start, row_stop = self.row_tb
col_start, col_stop = self.col_rl
tab_start, tab_stop = self.tab_fl
for tab in xrange(tab_start, tab_stop):
# Scale context to page extent
# In order to keep the aspect ration... | python | def draw(self):
"""Draws slice to context"""
row_start, row_stop = self.row_tb
col_start, col_stop = self.col_rl
tab_start, tab_stop = self.tab_fl
for tab in xrange(tab_start, tab_stop):
# Scale context to page extent
# In order to keep the aspect ration... | [
"def",
"draw",
"(",
"self",
")",
":",
"row_start",
",",
"row_stop",
"=",
"self",
".",
"row_tb",
"col_start",
",",
"col_stop",
"=",
"self",
".",
"col_rl",
"tab_start",
",",
"tab_stop",
"=",
"self",
".",
"tab_fl",
"for",
"tab",
"in",
"xrange",
"(",
"tab_... | Draws slice to context | [
"Draws",
"slice",
"to",
"context"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/_grid_cairo_renderer.py#L179-L244 | train |
manns/pyspread | pyspread/src/lib/_grid_cairo_renderer.py | GridCellCairoRenderer.draw | def draw(self):
"""Draws cell to context"""
cell_background_renderer = GridCellBackgroundCairoRenderer(
self.context,
self.code_array,
self.key,
self.rect,
self.view_frozen)
cell_content_renderer = GridCellContentCairoRenderer(
... | python | def draw(self):
"""Draws cell to context"""
cell_background_renderer = GridCellBackgroundCairoRenderer(
self.context,
self.code_array,
self.key,
self.rect,
self.view_frozen)
cell_content_renderer = GridCellContentCairoRenderer(
... | [
"def",
"draw",
"(",
"self",
")",
":",
"cell_background_renderer",
"=",
"GridCellBackgroundCairoRenderer",
"(",
"self",
".",
"context",
",",
"self",
".",
"code_array",
",",
"self",
".",
"key",
",",
"self",
".",
"rect",
",",
"self",
".",
"view_frozen",
")",
... | Draws cell to context | [
"Draws",
"cell",
"to",
"context"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/_grid_cairo_renderer.py#L273-L298 | train |
manns/pyspread | pyspread/src/lib/_grid_cairo_renderer.py | GridCellContentCairoRenderer.get_cell_content | def get_cell_content(self):
"""Returns cell content"""
try:
if self.code_array.cell_attributes[self.key]["button_cell"]:
return
except IndexError:
return
try:
return self.code_array[self.key]
except IndexError:
p... | python | def get_cell_content(self):
"""Returns cell content"""
try:
if self.code_array.cell_attributes[self.key]["button_cell"]:
return
except IndexError:
return
try:
return self.code_array[self.key]
except IndexError:
p... | [
"def",
"get_cell_content",
"(",
"self",
")",
":",
"try",
":",
"if",
"self",
".",
"code_array",
".",
"cell_attributes",
"[",
"self",
".",
"key",
"]",
"[",
"\"button_cell\"",
"]",
":",
"return",
"except",
"IndexError",
":",
"return",
"try",
":",
"return",
... | Returns cell content | [
"Returns",
"cell",
"content"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/_grid_cairo_renderer.py#L323-L337 | train |
manns/pyspread | pyspread/src/lib/_grid_cairo_renderer.py | GridCellContentCairoRenderer._get_scalexy | def _get_scalexy(self, ims_width, ims_height):
"""Returns scale_x, scale_y for bitmap display"""
# Get cell attributes
cell_attributes = self.code_array.cell_attributes[self.key]
angle = cell_attributes["angle"]
if abs(angle) == 90:
scale_x = self.rect[3] / float(im... | python | def _get_scalexy(self, ims_width, ims_height):
"""Returns scale_x, scale_y for bitmap display"""
# Get cell attributes
cell_attributes = self.code_array.cell_attributes[self.key]
angle = cell_attributes["angle"]
if abs(angle) == 90:
scale_x = self.rect[3] / float(im... | [
"def",
"_get_scalexy",
"(",
"self",
",",
"ims_width",
",",
"ims_height",
")",
":",
"cell_attributes",
"=",
"self",
".",
"code_array",
".",
"cell_attributes",
"[",
"self",
".",
"key",
"]",
"angle",
"=",
"cell_attributes",
"[",
"\"angle\"",
"]",
"if",
"abs",
... | Returns scale_x, scale_y for bitmap display | [
"Returns",
"scale_x",
"scale_y",
"for",
"bitmap",
"display"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/_grid_cairo_renderer.py#L339-L355 | train |
manns/pyspread | pyspread/src/lib/_grid_cairo_renderer.py | GridCellContentCairoRenderer._get_translation | def _get_translation(self, ims_width, ims_height):
"""Returns x and y for a bitmap translation"""
# Get cell attributes
cell_attributes = self.code_array.cell_attributes[self.key]
justification = cell_attributes["justification"]
vertical_align = cell_attributes["vertical_align"]... | python | def _get_translation(self, ims_width, ims_height):
"""Returns x and y for a bitmap translation"""
# Get cell attributes
cell_attributes = self.code_array.cell_attributes[self.key]
justification = cell_attributes["justification"]
vertical_align = cell_attributes["vertical_align"]... | [
"def",
"_get_translation",
"(",
"self",
",",
"ims_width",
",",
"ims_height",
")",
":",
"cell_attributes",
"=",
"self",
".",
"code_array",
".",
"cell_attributes",
"[",
"self",
".",
"key",
"]",
"justification",
"=",
"cell_attributes",
"[",
"\"justification\"",
"]"... | Returns x and y for a bitmap translation | [
"Returns",
"x",
"and",
"y",
"for",
"a",
"bitmap",
"translation"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/_grid_cairo_renderer.py#L357-L442 | train |
manns/pyspread | pyspread/src/lib/_grid_cairo_renderer.py | GridCellContentCairoRenderer.draw_bitmap | def draw_bitmap(self, content):
"""Draws bitmap cell content to context"""
if content.HasAlpha():
image = wx.ImageFromBitmap(content)
image.ConvertAlphaToMask()
image.SetMask(False)
content = wx.BitmapFromImage(image)
ims = wx.lib.wxcairo.ImageSu... | python | def draw_bitmap(self, content):
"""Draws bitmap cell content to context"""
if content.HasAlpha():
image = wx.ImageFromBitmap(content)
image.ConvertAlphaToMask()
image.SetMask(False)
content = wx.BitmapFromImage(image)
ims = wx.lib.wxcairo.ImageSu... | [
"def",
"draw_bitmap",
"(",
"self",
",",
"content",
")",
":",
"if",
"content",
".",
"HasAlpha",
"(",
")",
":",
"image",
"=",
"wx",
".",
"ImageFromBitmap",
"(",
"content",
")",
"image",
".",
"ConvertAlphaToMask",
"(",
")",
"image",
".",
"SetMask",
"(",
"... | Draws bitmap cell content to context | [
"Draws",
"bitmap",
"cell",
"content",
"to",
"context"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/_grid_cairo_renderer.py#L444-L471 | train |
manns/pyspread | pyspread/src/lib/_grid_cairo_renderer.py | GridCellContentCairoRenderer.draw_svg | def draw_svg(self, svg_str):
"""Draws svg string to cell"""
try:
import rsvg
except ImportError:
self.draw_text(svg_str)
return
svg = rsvg.Handle(data=svg_str)
svg_width, svg_height = svg.get_dimension_data()[:2]
transx, transy = se... | python | def draw_svg(self, svg_str):
"""Draws svg string to cell"""
try:
import rsvg
except ImportError:
self.draw_text(svg_str)
return
svg = rsvg.Handle(data=svg_str)
svg_width, svg_height = svg.get_dimension_data()[:2]
transx, transy = se... | [
"def",
"draw_svg",
"(",
"self",
",",
"svg_str",
")",
":",
"try",
":",
"import",
"rsvg",
"except",
"ImportError",
":",
"self",
".",
"draw_text",
"(",
"svg_str",
")",
"return",
"svg",
"=",
"rsvg",
".",
"Handle",
"(",
"data",
"=",
"svg_str",
")",
"svg_wid... | Draws svg string to cell | [
"Draws",
"svg",
"string",
"to",
"cell"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/_grid_cairo_renderer.py#L473-L498 | train |
manns/pyspread | pyspread/src/lib/_grid_cairo_renderer.py | GridCellContentCairoRenderer.draw_matplotlib_figure | def draw_matplotlib_figure(self, figure):
"""Draws matplotlib figure to context"""
class CustomRendererCairo(RendererCairo):
"""Workaround for older versins with limited draw path length"""
if sys.byteorder == 'little':
BYTE_FORMAT = 0 # BGRA
else:
... | python | def draw_matplotlib_figure(self, figure):
"""Draws matplotlib figure to context"""
class CustomRendererCairo(RendererCairo):
"""Workaround for older versins with limited draw path length"""
if sys.byteorder == 'little':
BYTE_FORMAT = 0 # BGRA
else:
... | [
"def",
"draw_matplotlib_figure",
"(",
"self",
",",
"figure",
")",
":",
"class",
"CustomRendererCairo",
"(",
"RendererCairo",
")",
":",
"if",
"sys",
".",
"byteorder",
"==",
"'little'",
":",
"BYTE_FORMAT",
"=",
"0",
"else",
":",
"BYTE_FORMAT",
"=",
"1",
"def",... | Draws matplotlib figure to context | [
"Draws",
"matplotlib",
"figure",
"to",
"context"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/_grid_cairo_renderer.py#L500-L569 | train |
manns/pyspread | pyspread/src/lib/_grid_cairo_renderer.py | GridCellContentCairoRenderer._get_text_color | def _get_text_color(self):
"""Returns text color rgb tuple of right line"""
color = self.code_array.cell_attributes[self.key]["textcolor"]
return tuple(c / 255.0 for c in color_pack2rgb(color)) | python | def _get_text_color(self):
"""Returns text color rgb tuple of right line"""
color = self.code_array.cell_attributes[self.key]["textcolor"]
return tuple(c / 255.0 for c in color_pack2rgb(color)) | [
"def",
"_get_text_color",
"(",
"self",
")",
":",
"color",
"=",
"self",
".",
"code_array",
".",
"cell_attributes",
"[",
"self",
".",
"key",
"]",
"[",
"\"textcolor\"",
"]",
"return",
"tuple",
"(",
"c",
"/",
"255.0",
"for",
"c",
"in",
"color_pack2rgb",
"(",... | Returns text color rgb tuple of right line | [
"Returns",
"text",
"color",
"rgb",
"tuple",
"of",
"right",
"line"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/_grid_cairo_renderer.py#L571-L575 | train |
manns/pyspread | pyspread/src/lib/_grid_cairo_renderer.py | GridCellContentCairoRenderer.set_font | def set_font(self, pango_layout):
"""Sets the font for draw_text"""
wx2pango_weights = {
wx.FONTWEIGHT_BOLD: pango.WEIGHT_BOLD,
wx.FONTWEIGHT_LIGHT: pango.WEIGHT_LIGHT,
wx.FONTWEIGHT_NORMAL: None, # Do not set a weight by default
}
wx2pango_styles =... | python | def set_font(self, pango_layout):
"""Sets the font for draw_text"""
wx2pango_weights = {
wx.FONTWEIGHT_BOLD: pango.WEIGHT_BOLD,
wx.FONTWEIGHT_LIGHT: pango.WEIGHT_LIGHT,
wx.FONTWEIGHT_NORMAL: None, # Do not set a weight by default
}
wx2pango_styles =... | [
"def",
"set_font",
"(",
"self",
",",
"pango_layout",
")",
":",
"wx2pango_weights",
"=",
"{",
"wx",
".",
"FONTWEIGHT_BOLD",
":",
"pango",
".",
"WEIGHT_BOLD",
",",
"wx",
".",
"FONTWEIGHT_LIGHT",
":",
"pango",
".",
"WEIGHT_LIGHT",
",",
"wx",
".",
"FONTWEIGHT_NO... | Sets the font for draw_text | [
"Sets",
"the",
"font",
"for",
"draw_text"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/_grid_cairo_renderer.py#L577-L626 | train |
manns/pyspread | pyspread/src/lib/_grid_cairo_renderer.py | GridCellContentCairoRenderer._draw_error_underline | def _draw_error_underline(self, ptx, pango_layout, start, stop):
"""Draws an error underline"""
self.context.save()
self.context.set_source_rgb(1.0, 0.0, 0.0)
pit = pango_layout.get_iter()
# Skip characters until start
for i in xrange(start):
pit.next_char(... | python | def _draw_error_underline(self, ptx, pango_layout, start, stop):
"""Draws an error underline"""
self.context.save()
self.context.set_source_rgb(1.0, 0.0, 0.0)
pit = pango_layout.get_iter()
# Skip characters until start
for i in xrange(start):
pit.next_char(... | [
"def",
"_draw_error_underline",
"(",
"self",
",",
"ptx",
",",
"pango_layout",
",",
"start",
",",
"stop",
")",
":",
"self",
".",
"context",
".",
"save",
"(",
")",
"self",
".",
"context",
".",
"set_source_rgb",
"(",
"1.0",
",",
"0.0",
",",
"0.0",
")",
... | Draws an error underline | [
"Draws",
"an",
"error",
"underline"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/_grid_cairo_renderer.py#L655-L693 | train |
manns/pyspread | pyspread/src/lib/_grid_cairo_renderer.py | GridCellContentCairoRenderer._check_spelling | def _check_spelling(self, text, lang="en_US"):
"""Returns a list of start stop tuples that have spelling errors
Parameters
----------
text: Unicode or string
\tThe text that is checked
lang: String, defaults to "en_US"
\tName of spell checking dictionary
... | python | def _check_spelling(self, text, lang="en_US"):
"""Returns a list of start stop tuples that have spelling errors
Parameters
----------
text: Unicode or string
\tThe text that is checked
lang: String, defaults to "en_US"
\tName of spell checking dictionary
... | [
"def",
"_check_spelling",
"(",
"self",
",",
"text",
",",
"lang",
"=",
"\"en_US\"",
")",
":",
"chkr",
"=",
"SpellChecker",
"(",
"lang",
")",
"chkr",
".",
"set_text",
"(",
"text",
")",
"word_starts_ends",
"=",
"[",
"]",
"for",
"err",
"in",
"chkr",
":",
... | Returns a list of start stop tuples that have spelling errors
Parameters
----------
text: Unicode or string
\tThe text that is checked
lang: String, defaults to "en_US"
\tName of spell checking dictionary | [
"Returns",
"a",
"list",
"of",
"start",
"stop",
"tuples",
"that",
"have",
"spelling",
"errors"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/_grid_cairo_renderer.py#L695-L718 | train |
manns/pyspread | pyspread/src/lib/_grid_cairo_renderer.py | GridCellContentCairoRenderer.draw_text | def draw_text(self, content):
"""Draws text cell content to context"""
wx2pango_alignment = {
"left": pango.ALIGN_LEFT,
"center": pango.ALIGN_CENTER,
"right": pango.ALIGN_RIGHT,
}
cell_attributes = self.code_array.cell_attributes[self.key]
a... | python | def draw_text(self, content):
"""Draws text cell content to context"""
wx2pango_alignment = {
"left": pango.ALIGN_LEFT,
"center": pango.ALIGN_CENTER,
"right": pango.ALIGN_RIGHT,
}
cell_attributes = self.code_array.cell_attributes[self.key]
a... | [
"def",
"draw_text",
"(",
"self",
",",
"content",
")",
":",
"wx2pango_alignment",
"=",
"{",
"\"left\"",
":",
"pango",
".",
"ALIGN_LEFT",
",",
"\"center\"",
":",
"pango",
".",
"ALIGN_CENTER",
",",
"\"right\"",
":",
"pango",
".",
"ALIGN_RIGHT",
",",
"}",
"cel... | Draws text cell content to context | [
"Draws",
"text",
"cell",
"content",
"to",
"context"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/_grid_cairo_renderer.py#L720-L797 | train |
manns/pyspread | pyspread/src/lib/_grid_cairo_renderer.py | GridCellContentCairoRenderer.draw_roundedrect | def draw_roundedrect(self, x, y, w, h, r=10):
"""Draws a rounded rectangle"""
# A****BQ
# H C
# * *
# G D
# F****E
context = self.context
context.save
context.move_to(x+r, y) # Move to A
context.line_to(x+w-r, y) # Straight... | python | def draw_roundedrect(self, x, y, w, h, r=10):
"""Draws a rounded rectangle"""
# A****BQ
# H C
# * *
# G D
# F****E
context = self.context
context.save
context.move_to(x+r, y) # Move to A
context.line_to(x+w-r, y) # Straight... | [
"def",
"draw_roundedrect",
"(",
"self",
",",
"x",
",",
"y",
",",
"w",
",",
"h",
",",
"r",
"=",
"10",
")",
":",
"context",
"=",
"self",
".",
"context",
"context",
".",
"save",
"context",
".",
"move_to",
"(",
"x",
"+",
"r",
",",
"y",
")",
"contex... | Draws a rounded rectangle | [
"Draws",
"a",
"rounded",
"rectangle"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/_grid_cairo_renderer.py#L799-L822 | train |
manns/pyspread | pyspread/src/lib/_grid_cairo_renderer.py | GridCellContentCairoRenderer.draw_button | def draw_button(self, x, y, w, h, label):
"""Draws a button"""
context = self.context
self.draw_roundedrect(x, y, w, h)
context.clip()
# Set up the gradients
gradient = cairo.LinearGradient(0, 0, 0, 1)
gradient.add_color_stop_rgba(0, 0.5, 0.5, 0.5, 0.1)
... | python | def draw_button(self, x, y, w, h, label):
"""Draws a button"""
context = self.context
self.draw_roundedrect(x, y, w, h)
context.clip()
# Set up the gradients
gradient = cairo.LinearGradient(0, 0, 0, 1)
gradient.add_color_stop_rgba(0, 0.5, 0.5, 0.5, 0.1)
... | [
"def",
"draw_button",
"(",
"self",
",",
"x",
",",
"y",
",",
"w",
",",
"h",
",",
"label",
")",
":",
"context",
"=",
"self",
".",
"context",
"self",
".",
"draw_roundedrect",
"(",
"x",
",",
"y",
",",
"w",
",",
"h",
")",
"context",
".",
"clip",
"("... | Draws a button | [
"Draws",
"a",
"button"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/_grid_cairo_renderer.py#L824-L863 | train |
manns/pyspread | pyspread/src/lib/_grid_cairo_renderer.py | GridCellContentCairoRenderer.draw | def draw(self):
"""Draws cell content to context"""
# Content is only rendered within rect
self.context.save()
self.context.rectangle(*self.rect)
self.context.clip()
content = self.get_cell_content()
pos_x, pos_y = self.rect[:2]
self.context.translate(p... | python | def draw(self):
"""Draws cell content to context"""
# Content is only rendered within rect
self.context.save()
self.context.rectangle(*self.rect)
self.context.clip()
content = self.get_cell_content()
pos_x, pos_y = self.rect[:2]
self.context.translate(p... | [
"def",
"draw",
"(",
"self",
")",
":",
"self",
".",
"context",
".",
"save",
"(",
")",
"self",
".",
"context",
".",
"rectangle",
"(",
"*",
"self",
".",
"rect",
")",
"self",
".",
"context",
".",
"clip",
"(",
")",
"content",
"=",
"self",
".",
"get_ce... | Draws cell content to context | [
"Draws",
"cell",
"content",
"to",
"context"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/_grid_cairo_renderer.py#L865-L911 | train |
manns/pyspread | pyspread/src/lib/_grid_cairo_renderer.py | GridCellBackgroundCairoRenderer._get_background_color | def _get_background_color(self):
"""Returns background color rgb tuple of right line"""
color = self.cell_attributes[self.key]["bgcolor"]
return tuple(c / 255.0 for c in color_pack2rgb(color)) | python | def _get_background_color(self):
"""Returns background color rgb tuple of right line"""
color = self.cell_attributes[self.key]["bgcolor"]
return tuple(c / 255.0 for c in color_pack2rgb(color)) | [
"def",
"_get_background_color",
"(",
"self",
")",
":",
"color",
"=",
"self",
".",
"cell_attributes",
"[",
"self",
".",
"key",
"]",
"[",
"\"bgcolor\"",
"]",
"return",
"tuple",
"(",
"c",
"/",
"255.0",
"for",
"c",
"in",
"color_pack2rgb",
"(",
"color",
")",
... | Returns background color rgb tuple of right line | [
"Returns",
"background",
"color",
"rgb",
"tuple",
"of",
"right",
"line"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/_grid_cairo_renderer.py#L938-L942 | train |
manns/pyspread | pyspread/src/lib/_grid_cairo_renderer.py | GridCellBackgroundCairoRenderer._draw_frozen_pattern | def _draw_frozen_pattern(self):
"""Draws frozen pattern, i.e. diagonal lines"""
self.context.save()
x, y, w, h = self.rect
self.context.set_source_rgb(0, 0, 1)
self.context.set_line_width(0.25)
self.context.rectangle(*self.rect)
self.context.clip()
for ... | python | def _draw_frozen_pattern(self):
"""Draws frozen pattern, i.e. diagonal lines"""
self.context.save()
x, y, w, h = self.rect
self.context.set_source_rgb(0, 0, 1)
self.context.set_line_width(0.25)
self.context.rectangle(*self.rect)
self.context.clip()
for ... | [
"def",
"_draw_frozen_pattern",
"(",
"self",
")",
":",
"self",
".",
"context",
".",
"save",
"(",
")",
"x",
",",
"y",
",",
"w",
",",
"h",
"=",
"self",
".",
"rect",
"self",
".",
"context",
".",
"set_source_rgb",
"(",
"0",
",",
"0",
",",
"1",
")",
... | Draws frozen pattern, i.e. diagonal lines | [
"Draws",
"frozen",
"pattern",
"i",
".",
"e",
".",
"diagonal",
"lines"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/_grid_cairo_renderer.py#L944-L960 | train |
manns/pyspread | pyspread/src/lib/_grid_cairo_renderer.py | GridCellBackgroundCairoRenderer.draw | def draw(self):
"""Draws cell background to context"""
self.context.set_source_rgb(*self._get_background_color())
self.context.rectangle(*self.rect)
self.context.fill()
# If show frozen is active, show frozen pattern
if self.view_frozen and self.cell_attributes[self.key... | python | def draw(self):
"""Draws cell background to context"""
self.context.set_source_rgb(*self._get_background_color())
self.context.rectangle(*self.rect)
self.context.fill()
# If show frozen is active, show frozen pattern
if self.view_frozen and self.cell_attributes[self.key... | [
"def",
"draw",
"(",
"self",
")",
":",
"self",
".",
"context",
".",
"set_source_rgb",
"(",
"*",
"self",
".",
"_get_background_color",
"(",
")",
")",
"self",
".",
"context",
".",
"rectangle",
"(",
"*",
"self",
".",
"rect",
")",
"self",
".",
"context",
... | Draws cell background to context | [
"Draws",
"cell",
"background",
"to",
"context"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/_grid_cairo_renderer.py#L962-L971 | train |
manns/pyspread | pyspread/src/lib/_grid_cairo_renderer.py | CellBorder.draw | def draw(self, context):
"""Draws self to Cairo context"""
context.set_line_width(self.width)
context.set_source_rgb(*self.color)
context.move_to(*self.start_point)
context.line_to(*self.end_point)
context.stroke() | python | def draw(self, context):
"""Draws self to Cairo context"""
context.set_line_width(self.width)
context.set_source_rgb(*self.color)
context.move_to(*self.start_point)
context.line_to(*self.end_point)
context.stroke() | [
"def",
"draw",
"(",
"self",
",",
"context",
")",
":",
"context",
".",
"set_line_width",
"(",
"self",
".",
"width",
")",
"context",
".",
"set_source_rgb",
"(",
"*",
"self",
".",
"color",
")",
"context",
".",
"move_to",
"(",
"*",
"self",
".",
"start_poin... | Draws self to Cairo context | [
"Draws",
"self",
"to",
"Cairo",
"context"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/_grid_cairo_renderer.py#L996-L1004 | train |
manns/pyspread | pyspread/src/lib/_grid_cairo_renderer.py | Cell.get_above_key_rect | def get_above_key_rect(self):
"""Returns tuple key rect of above cell"""
key_above = self.row - 1, self.col, self.tab
border_width_bottom = \
float(self.cell_attributes[key_above]["borderwidth_bottom"]) / 2.0
rect_above = (self.x, self.y-border_width_bottom,
... | python | def get_above_key_rect(self):
"""Returns tuple key rect of above cell"""
key_above = self.row - 1, self.col, self.tab
border_width_bottom = \
float(self.cell_attributes[key_above]["borderwidth_bottom"]) / 2.0
rect_above = (self.x, self.y-border_width_bottom,
... | [
"def",
"get_above_key_rect",
"(",
"self",
")",
":",
"key_above",
"=",
"self",
".",
"row",
"-",
"1",
",",
"self",
".",
"col",
",",
"self",
".",
"tab",
"border_width_bottom",
"=",
"float",
"(",
"self",
".",
"cell_attributes",
"[",
"key_above",
"]",
"[",
... | Returns tuple key rect of above cell | [
"Returns",
"tuple",
"key",
"rect",
"of",
"above",
"cell"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/_grid_cairo_renderer.py#L1015-L1025 | train |
manns/pyspread | pyspread/src/lib/_grid_cairo_renderer.py | Cell.get_below_key_rect | def get_below_key_rect(self):
"""Returns tuple key rect of below cell"""
key_below = self.row + 1, self.col, self.tab
border_width_bottom = \
float(self.cell_attributes[self.key]["borderwidth_bottom"]) / 2.0
rect_below = (self.x, self.y+self.height,
s... | python | def get_below_key_rect(self):
"""Returns tuple key rect of below cell"""
key_below = self.row + 1, self.col, self.tab
border_width_bottom = \
float(self.cell_attributes[self.key]["borderwidth_bottom"]) / 2.0
rect_below = (self.x, self.y+self.height,
s... | [
"def",
"get_below_key_rect",
"(",
"self",
")",
":",
"key_below",
"=",
"self",
".",
"row",
"+",
"1",
",",
"self",
".",
"col",
",",
"self",
".",
"tab",
"border_width_bottom",
"=",
"float",
"(",
"self",
".",
"cell_attributes",
"[",
"self",
".",
"key",
"]"... | Returns tuple key rect of below cell | [
"Returns",
"tuple",
"key",
"rect",
"of",
"below",
"cell"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/_grid_cairo_renderer.py#L1027-L1037 | train |
manns/pyspread | pyspread/src/lib/_grid_cairo_renderer.py | Cell.get_left_key_rect | def get_left_key_rect(self):
"""Returns tuple key rect of left cell"""
key_left = self.row, self.col - 1, self.tab
border_width_right = \
float(self.cell_attributes[key_left]["borderwidth_right"]) / 2.0
rect_left = (self.x-border_width_right, self.y,
b... | python | def get_left_key_rect(self):
"""Returns tuple key rect of left cell"""
key_left = self.row, self.col - 1, self.tab
border_width_right = \
float(self.cell_attributes[key_left]["borderwidth_right"]) / 2.0
rect_left = (self.x-border_width_right, self.y,
b... | [
"def",
"get_left_key_rect",
"(",
"self",
")",
":",
"key_left",
"=",
"self",
".",
"row",
",",
"self",
".",
"col",
"-",
"1",
",",
"self",
".",
"tab",
"border_width_right",
"=",
"float",
"(",
"self",
".",
"cell_attributes",
"[",
"key_left",
"]",
"[",
"\"b... | Returns tuple key rect of left cell | [
"Returns",
"tuple",
"key",
"rect",
"of",
"left",
"cell"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/_grid_cairo_renderer.py#L1039-L1049 | train |
manns/pyspread | pyspread/src/lib/_grid_cairo_renderer.py | Cell.get_right_key_rect | def get_right_key_rect(self):
"""Returns tuple key rect of right cell"""
key_right = self.row, self.col + 1, self.tab
border_width_right = \
float(self.cell_attributes[self.key]["borderwidth_right"]) / 2.0
rect_right = (self.x+self.width, self.y,
bord... | python | def get_right_key_rect(self):
"""Returns tuple key rect of right cell"""
key_right = self.row, self.col + 1, self.tab
border_width_right = \
float(self.cell_attributes[self.key]["borderwidth_right"]) / 2.0
rect_right = (self.x+self.width, self.y,
bord... | [
"def",
"get_right_key_rect",
"(",
"self",
")",
":",
"key_right",
"=",
"self",
".",
"row",
",",
"self",
".",
"col",
"+",
"1",
",",
"self",
".",
"tab",
"border_width_right",
"=",
"float",
"(",
"self",
".",
"cell_attributes",
"[",
"self",
".",
"key",
"]",... | Returns tuple key rect of right cell | [
"Returns",
"tuple",
"key",
"rect",
"of",
"right",
"cell"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/_grid_cairo_renderer.py#L1051-L1061 | train |
manns/pyspread | pyspread/src/lib/_grid_cairo_renderer.py | Cell.get_above_left_key_rect | def get_above_left_key_rect(self):
"""Returns tuple key rect of above left cell"""
key_above_left = self.row - 1, self.col - 1, self.tab
border_width_right = \
float(self.cell_attributes[key_above_left]["borderwidth_right"]) \
/ 2.0
border_width_bottom = \
... | python | def get_above_left_key_rect(self):
"""Returns tuple key rect of above left cell"""
key_above_left = self.row - 1, self.col - 1, self.tab
border_width_right = \
float(self.cell_attributes[key_above_left]["borderwidth_right"]) \
/ 2.0
border_width_bottom = \
... | [
"def",
"get_above_left_key_rect",
"(",
"self",
")",
":",
"key_above_left",
"=",
"self",
".",
"row",
"-",
"1",
",",
"self",
".",
"col",
"-",
"1",
",",
"self",
".",
"tab",
"border_width_right",
"=",
"float",
"(",
"self",
".",
"cell_attributes",
"[",
"key_a... | Returns tuple key rect of above left cell | [
"Returns",
"tuple",
"key",
"rect",
"of",
"above",
"left",
"cell"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/_grid_cairo_renderer.py#L1063-L1078 | train |
manns/pyspread | pyspread/src/lib/_grid_cairo_renderer.py | Cell.get_above_right_key_rect | def get_above_right_key_rect(self):
"""Returns tuple key rect of above right cell"""
key_above = self.row - 1, self.col, self.tab
key_above_right = self.row - 1, self.col + 1, self.tab
border_width_right = \
float(self.cell_attributes[key_above]["borderwidth_right"]) / 2.0
... | python | def get_above_right_key_rect(self):
"""Returns tuple key rect of above right cell"""
key_above = self.row - 1, self.col, self.tab
key_above_right = self.row - 1, self.col + 1, self.tab
border_width_right = \
float(self.cell_attributes[key_above]["borderwidth_right"]) / 2.0
... | [
"def",
"get_above_right_key_rect",
"(",
"self",
")",
":",
"key_above",
"=",
"self",
".",
"row",
"-",
"1",
",",
"self",
".",
"col",
",",
"self",
".",
"tab",
"key_above_right",
"=",
"self",
".",
"row",
"-",
"1",
",",
"self",
".",
"col",
"+",
"1",
","... | Returns tuple key rect of above right cell | [
"Returns",
"tuple",
"key",
"rect",
"of",
"above",
"right",
"cell"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/_grid_cairo_renderer.py#L1080-L1094 | train |
manns/pyspread | pyspread/src/lib/_grid_cairo_renderer.py | Cell.get_below_left_key_rect | def get_below_left_key_rect(self):
"""Returns tuple key rect of below left cell"""
key_left = self.row, self.col - 1, self.tab
key_below_left = self.row + 1, self.col - 1, self.tab
border_width_right = \
float(self.cell_attributes[key_below_left]["borderwidth_right"]) \
... | python | def get_below_left_key_rect(self):
"""Returns tuple key rect of below left cell"""
key_left = self.row, self.col - 1, self.tab
key_below_left = self.row + 1, self.col - 1, self.tab
border_width_right = \
float(self.cell_attributes[key_below_left]["borderwidth_right"]) \
... | [
"def",
"get_below_left_key_rect",
"(",
"self",
")",
":",
"key_left",
"=",
"self",
".",
"row",
",",
"self",
".",
"col",
"-",
"1",
",",
"self",
".",
"tab",
"key_below_left",
"=",
"self",
".",
"row",
"+",
"1",
",",
"self",
".",
"col",
"-",
"1",
",",
... | Returns tuple key rect of below left cell | [
"Returns",
"tuple",
"key",
"rect",
"of",
"below",
"left",
"cell"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/_grid_cairo_renderer.py#L1096-L1110 | train |
manns/pyspread | pyspread/src/lib/_grid_cairo_renderer.py | Cell.get_below_right_key_rect | def get_below_right_key_rect(self):
"""Returns tuple key rect of below right cell"""
key_below_right = self.row + 1, self.col + 1, self.tab
border_width_right = \
float(self.cell_attributes[self.key]["borderwidth_right"]) / 2.0
border_width_bottom = \
float(self... | python | def get_below_right_key_rect(self):
"""Returns tuple key rect of below right cell"""
key_below_right = self.row + 1, self.col + 1, self.tab
border_width_right = \
float(self.cell_attributes[self.key]["borderwidth_right"]) / 2.0
border_width_bottom = \
float(self... | [
"def",
"get_below_right_key_rect",
"(",
"self",
")",
":",
"key_below_right",
"=",
"self",
".",
"row",
"+",
"1",
",",
"self",
".",
"col",
"+",
"1",
",",
"self",
".",
"tab",
"border_width_right",
"=",
"float",
"(",
"self",
".",
"cell_attributes",
"[",
"sel... | Returns tuple key rect of below right cell | [
"Returns",
"tuple",
"key",
"rect",
"of",
"below",
"right",
"cell"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/_grid_cairo_renderer.py#L1112-L1124 | train |
manns/pyspread | pyspread/src/lib/_grid_cairo_renderer.py | CellBorders._get_bottom_line_coordinates | def _get_bottom_line_coordinates(self):
"""Returns start and stop coordinates of bottom line"""
rect_x, rect_y, rect_width, rect_height = self.rect
start_point = rect_x, rect_y + rect_height
end_point = rect_x + rect_width, rect_y + rect_height
return start_point, end_point | python | def _get_bottom_line_coordinates(self):
"""Returns start and stop coordinates of bottom line"""
rect_x, rect_y, rect_width, rect_height = self.rect
start_point = rect_x, rect_y + rect_height
end_point = rect_x + rect_width, rect_y + rect_height
return start_point, end_point | [
"def",
"_get_bottom_line_coordinates",
"(",
"self",
")",
":",
"rect_x",
",",
"rect_y",
",",
"rect_width",
",",
"rect_height",
"=",
"self",
".",
"rect",
"start_point",
"=",
"rect_x",
",",
"rect_y",
"+",
"rect_height",
"end_point",
"=",
"rect_x",
"+",
"rect_widt... | Returns start and stop coordinates of bottom line | [
"Returns",
"start",
"and",
"stop",
"coordinates",
"of",
"bottom",
"line"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/_grid_cairo_renderer.py#L1151-L1159 | train |
manns/pyspread | pyspread/src/lib/_grid_cairo_renderer.py | CellBorders._get_bottom_line_color | def _get_bottom_line_color(self):
"""Returns color rgb tuple of bottom line"""
color = self.cell_attributes[self.key]["bordercolor_bottom"]
return tuple(c / 255.0 for c in color_pack2rgb(color)) | python | def _get_bottom_line_color(self):
"""Returns color rgb tuple of bottom line"""
color = self.cell_attributes[self.key]["bordercolor_bottom"]
return tuple(c / 255.0 for c in color_pack2rgb(color)) | [
"def",
"_get_bottom_line_color",
"(",
"self",
")",
":",
"color",
"=",
"self",
".",
"cell_attributes",
"[",
"self",
".",
"key",
"]",
"[",
"\"bordercolor_bottom\"",
"]",
"return",
"tuple",
"(",
"c",
"/",
"255.0",
"for",
"c",
"in",
"color_pack2rgb",
"(",
"col... | Returns color rgb tuple of bottom line | [
"Returns",
"color",
"rgb",
"tuple",
"of",
"bottom",
"line"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/_grid_cairo_renderer.py#L1171-L1175 | train |
manns/pyspread | pyspread/src/lib/_grid_cairo_renderer.py | CellBorders._get_right_line_color | def _get_right_line_color(self):
"""Returns color rgb tuple of right line"""
color = self.cell_attributes[self.key]["bordercolor_right"]
return tuple(c / 255.0 for c in color_pack2rgb(color)) | python | def _get_right_line_color(self):
"""Returns color rgb tuple of right line"""
color = self.cell_attributes[self.key]["bordercolor_right"]
return tuple(c / 255.0 for c in color_pack2rgb(color)) | [
"def",
"_get_right_line_color",
"(",
"self",
")",
":",
"color",
"=",
"self",
".",
"cell_attributes",
"[",
"self",
".",
"key",
"]",
"[",
"\"bordercolor_right\"",
"]",
"return",
"tuple",
"(",
"c",
"/",
"255.0",
"for",
"c",
"in",
"color_pack2rgb",
"(",
"color... | Returns color rgb tuple of right line | [
"Returns",
"color",
"rgb",
"tuple",
"of",
"right",
"line"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/_grid_cairo_renderer.py#L1177-L1181 | train |
manns/pyspread | pyspread/src/lib/_grid_cairo_renderer.py | CellBorders.get_b | def get_b(self):
"""Returns the bottom border of the cell"""
start_point, end_point = self._get_bottom_line_coordinates()
width = self._get_bottom_line_width()
color = self._get_bottom_line_color()
return CellBorder(start_point, end_point, width, color) | python | def get_b(self):
"""Returns the bottom border of the cell"""
start_point, end_point = self._get_bottom_line_coordinates()
width = self._get_bottom_line_width()
color = self._get_bottom_line_color()
return CellBorder(start_point, end_point, width, color) | [
"def",
"get_b",
"(",
"self",
")",
":",
"start_point",
",",
"end_point",
"=",
"self",
".",
"_get_bottom_line_coordinates",
"(",
")",
"width",
"=",
"self",
".",
"_get_bottom_line_width",
"(",
")",
"color",
"=",
"self",
".",
"_get_bottom_line_color",
"(",
")",
... | Returns the bottom border of the cell | [
"Returns",
"the",
"bottom",
"border",
"of",
"the",
"cell"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/_grid_cairo_renderer.py#L1193-L1200 | train |
manns/pyspread | pyspread/src/lib/_grid_cairo_renderer.py | CellBorders.get_r | def get_r(self):
"""Returns the right border of the cell"""
start_point, end_point = self._get_right_line_coordinates()
width = self._get_right_line_width()
color = self._get_right_line_color()
return CellBorder(start_point, end_point, width, color) | python | def get_r(self):
"""Returns the right border of the cell"""
start_point, end_point = self._get_right_line_coordinates()
width = self._get_right_line_width()
color = self._get_right_line_color()
return CellBorder(start_point, end_point, width, color) | [
"def",
"get_r",
"(",
"self",
")",
":",
"start_point",
",",
"end_point",
"=",
"self",
".",
"_get_right_line_coordinates",
"(",
")",
"width",
"=",
"self",
".",
"_get_right_line_width",
"(",
")",
"color",
"=",
"self",
".",
"_get_right_line_color",
"(",
")",
"re... | Returns the right border of the cell | [
"Returns",
"the",
"right",
"border",
"of",
"the",
"cell"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/_grid_cairo_renderer.py#L1202-L1209 | train |
manns/pyspread | pyspread/src/lib/_grid_cairo_renderer.py | CellBorders.get_t | def get_t(self):
"""Returns the top border of the cell"""
cell_above = CellBorders(self.cell_attributes,
*self.cell.get_above_key_rect())
return cell_above.get_b() | python | def get_t(self):
"""Returns the top border of the cell"""
cell_above = CellBorders(self.cell_attributes,
*self.cell.get_above_key_rect())
return cell_above.get_b() | [
"def",
"get_t",
"(",
"self",
")",
":",
"cell_above",
"=",
"CellBorders",
"(",
"self",
".",
"cell_attributes",
",",
"*",
"self",
".",
"cell",
".",
"get_above_key_rect",
"(",
")",
")",
"return",
"cell_above",
".",
"get_b",
"(",
")"
] | Returns the top border of the cell | [
"Returns",
"the",
"top",
"border",
"of",
"the",
"cell"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/_grid_cairo_renderer.py#L1211-L1216 | train |
manns/pyspread | pyspread/src/lib/_grid_cairo_renderer.py | CellBorders.get_l | def get_l(self):
"""Returns the left border of the cell"""
cell_left = CellBorders(self.cell_attributes,
*self.cell.get_left_key_rect())
return cell_left.get_r() | python | def get_l(self):
"""Returns the left border of the cell"""
cell_left = CellBorders(self.cell_attributes,
*self.cell.get_left_key_rect())
return cell_left.get_r() | [
"def",
"get_l",
"(",
"self",
")",
":",
"cell_left",
"=",
"CellBorders",
"(",
"self",
".",
"cell_attributes",
",",
"*",
"self",
".",
"cell",
".",
"get_left_key_rect",
"(",
")",
")",
"return",
"cell_left",
".",
"get_r",
"(",
")"
] | Returns the left border of the cell | [
"Returns",
"the",
"left",
"border",
"of",
"the",
"cell"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/_grid_cairo_renderer.py#L1218-L1223 | train |
manns/pyspread | pyspread/src/lib/_grid_cairo_renderer.py | CellBorders.get_tl | def get_tl(self):
"""Returns the top left border of the cell"""
cell_above_left = CellBorders(self.cell_attributes,
*self.cell.get_above_left_key_rect())
return cell_above_left.get_r() | python | def get_tl(self):
"""Returns the top left border of the cell"""
cell_above_left = CellBorders(self.cell_attributes,
*self.cell.get_above_left_key_rect())
return cell_above_left.get_r() | [
"def",
"get_tl",
"(",
"self",
")",
":",
"cell_above_left",
"=",
"CellBorders",
"(",
"self",
".",
"cell_attributes",
",",
"*",
"self",
".",
"cell",
".",
"get_above_left_key_rect",
"(",
")",
")",
"return",
"cell_above_left",
".",
"get_r",
"(",
")"
] | Returns the top left border of the cell | [
"Returns",
"the",
"top",
"left",
"border",
"of",
"the",
"cell"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/_grid_cairo_renderer.py#L1225-L1230 | train |
manns/pyspread | pyspread/src/lib/_grid_cairo_renderer.py | CellBorders.get_tr | def get_tr(self):
"""Returns the top right border of the cell"""
cell_above = CellBorders(self.cell_attributes,
*self.cell.get_above_key_rect())
return cell_above.get_r() | python | def get_tr(self):
"""Returns the top right border of the cell"""
cell_above = CellBorders(self.cell_attributes,
*self.cell.get_above_key_rect())
return cell_above.get_r() | [
"def",
"get_tr",
"(",
"self",
")",
":",
"cell_above",
"=",
"CellBorders",
"(",
"self",
".",
"cell_attributes",
",",
"*",
"self",
".",
"cell",
".",
"get_above_key_rect",
"(",
")",
")",
"return",
"cell_above",
".",
"get_r",
"(",
")"
] | Returns the top right border of the cell | [
"Returns",
"the",
"top",
"right",
"border",
"of",
"the",
"cell"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/_grid_cairo_renderer.py#L1232-L1237 | train |
manns/pyspread | pyspread/src/lib/_grid_cairo_renderer.py | CellBorders.get_rt | def get_rt(self):
"""Returns the right top border of the cell"""
cell_above_right = CellBorders(self.cell_attributes,
*self.cell.get_above_right_key_rect())
return cell_above_right.get_b() | python | def get_rt(self):
"""Returns the right top border of the cell"""
cell_above_right = CellBorders(self.cell_attributes,
*self.cell.get_above_right_key_rect())
return cell_above_right.get_b() | [
"def",
"get_rt",
"(",
"self",
")",
":",
"cell_above_right",
"=",
"CellBorders",
"(",
"self",
".",
"cell_attributes",
",",
"*",
"self",
".",
"cell",
".",
"get_above_right_key_rect",
"(",
")",
")",
"return",
"cell_above_right",
".",
"get_b",
"(",
")"
] | Returns the right top border of the cell | [
"Returns",
"the",
"right",
"top",
"border",
"of",
"the",
"cell"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/_grid_cairo_renderer.py#L1239-L1244 | train |
manns/pyspread | pyspread/src/lib/_grid_cairo_renderer.py | CellBorders.get_rb | def get_rb(self):
"""Returns the right bottom border of the cell"""
cell_right = CellBorders(self.cell_attributes,
*self.cell.get_right_key_rect())
return cell_right.get_b() | python | def get_rb(self):
"""Returns the right bottom border of the cell"""
cell_right = CellBorders(self.cell_attributes,
*self.cell.get_right_key_rect())
return cell_right.get_b() | [
"def",
"get_rb",
"(",
"self",
")",
":",
"cell_right",
"=",
"CellBorders",
"(",
"self",
".",
"cell_attributes",
",",
"*",
"self",
".",
"cell",
".",
"get_right_key_rect",
"(",
")",
")",
"return",
"cell_right",
".",
"get_b",
"(",
")"
] | Returns the right bottom border of the cell | [
"Returns",
"the",
"right",
"bottom",
"border",
"of",
"the",
"cell"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/_grid_cairo_renderer.py#L1246-L1251 | train |
manns/pyspread | pyspread/src/lib/_grid_cairo_renderer.py | CellBorders.get_br | def get_br(self):
"""Returns the bottom right border of the cell"""
cell_below = CellBorders(self.cell_attributes,
*self.cell.get_below_key_rect())
return cell_below.get_r() | python | def get_br(self):
"""Returns the bottom right border of the cell"""
cell_below = CellBorders(self.cell_attributes,
*self.cell.get_below_key_rect())
return cell_below.get_r() | [
"def",
"get_br",
"(",
"self",
")",
":",
"cell_below",
"=",
"CellBorders",
"(",
"self",
".",
"cell_attributes",
",",
"*",
"self",
".",
"cell",
".",
"get_below_key_rect",
"(",
")",
")",
"return",
"cell_below",
".",
"get_r",
"(",
")"
] | Returns the bottom right border of the cell | [
"Returns",
"the",
"bottom",
"right",
"border",
"of",
"the",
"cell"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/_grid_cairo_renderer.py#L1253-L1258 | train |
manns/pyspread | pyspread/src/lib/_grid_cairo_renderer.py | CellBorders.get_bl | def get_bl(self):
"""Returns the bottom left border of the cell"""
cell_below_left = CellBorders(self.cell_attributes,
*self.cell.get_below_left_key_rect())
return cell_below_left.get_r() | python | def get_bl(self):
"""Returns the bottom left border of the cell"""
cell_below_left = CellBorders(self.cell_attributes,
*self.cell.get_below_left_key_rect())
return cell_below_left.get_r() | [
"def",
"get_bl",
"(",
"self",
")",
":",
"cell_below_left",
"=",
"CellBorders",
"(",
"self",
".",
"cell_attributes",
",",
"*",
"self",
".",
"cell",
".",
"get_below_left_key_rect",
"(",
")",
")",
"return",
"cell_below_left",
".",
"get_r",
"(",
")"
] | Returns the bottom left border of the cell | [
"Returns",
"the",
"bottom",
"left",
"border",
"of",
"the",
"cell"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/_grid_cairo_renderer.py#L1260-L1265 | train |
manns/pyspread | pyspread/src/lib/_grid_cairo_renderer.py | CellBorders.get_lb | def get_lb(self):
"""Returns the left bottom border of the cell"""
cell_left = CellBorders(self.cell_attributes,
*self.cell.get_left_key_rect())
return cell_left.get_b() | python | def get_lb(self):
"""Returns the left bottom border of the cell"""
cell_left = CellBorders(self.cell_attributes,
*self.cell.get_left_key_rect())
return cell_left.get_b() | [
"def",
"get_lb",
"(",
"self",
")",
":",
"cell_left",
"=",
"CellBorders",
"(",
"self",
".",
"cell_attributes",
",",
"*",
"self",
".",
"cell",
".",
"get_left_key_rect",
"(",
")",
")",
"return",
"cell_left",
".",
"get_b",
"(",
")"
] | Returns the left bottom border of the cell | [
"Returns",
"the",
"left",
"bottom",
"border",
"of",
"the",
"cell"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/_grid_cairo_renderer.py#L1267-L1272 | train |
manns/pyspread | pyspread/src/lib/_grid_cairo_renderer.py | CellBorders.get_lt | def get_lt(self):
"""Returns the left top border of the cell"""
cell_above_left = CellBorders(self.cell_attributes,
*self.cell.get_above_left_key_rect())
return cell_above_left.get_b() | python | def get_lt(self):
"""Returns the left top border of the cell"""
cell_above_left = CellBorders(self.cell_attributes,
*self.cell.get_above_left_key_rect())
return cell_above_left.get_b() | [
"def",
"get_lt",
"(",
"self",
")",
":",
"cell_above_left",
"=",
"CellBorders",
"(",
"self",
".",
"cell_attributes",
",",
"*",
"self",
".",
"cell",
".",
"get_above_left_key_rect",
"(",
")",
")",
"return",
"cell_above_left",
".",
"get_b",
"(",
")"
] | Returns the left top border of the cell | [
"Returns",
"the",
"left",
"top",
"border",
"of",
"the",
"cell"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/_grid_cairo_renderer.py#L1274-L1279 | train |
manns/pyspread | pyspread/src/lib/_grid_cairo_renderer.py | CellBorders.gen_all | def gen_all(self):
"""Generator of all borders"""
borderfuncs = [
self.get_b, self.get_r, self.get_t, self.get_l,
self.get_tl, self.get_tr, self.get_rt, self.get_rb,
self.get_br, self.get_bl, self.get_lb, self.get_lt,
]
for borderfunc in borderfuncs:... | python | def gen_all(self):
"""Generator of all borders"""
borderfuncs = [
self.get_b, self.get_r, self.get_t, self.get_l,
self.get_tl, self.get_tr, self.get_rt, self.get_rb,
self.get_br, self.get_bl, self.get_lb, self.get_lt,
]
for borderfunc in borderfuncs:... | [
"def",
"gen_all",
"(",
"self",
")",
":",
"borderfuncs",
"=",
"[",
"self",
".",
"get_b",
",",
"self",
".",
"get_r",
",",
"self",
".",
"get_t",
",",
"self",
".",
"get_l",
",",
"self",
".",
"get_tl",
",",
"self",
".",
"get_tr",
",",
"self",
".",
"ge... | Generator of all borders | [
"Generator",
"of",
"all",
"borders"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/_grid_cairo_renderer.py#L1281-L1291 | train |
manns/pyspread | pyspread/src/lib/_grid_cairo_renderer.py | GridCellBorderCairoRenderer.draw | def draw(self):
"""Draws cell border to context"""
# Lines should have a square cap to avoid ugly edges
self.context.set_line_cap(cairo.LINE_CAP_SQUARE)
self.context.save()
self.context.rectangle(*self.rect)
self.context.clip()
cell_borders = CellBorders(self.c... | python | def draw(self):
"""Draws cell border to context"""
# Lines should have a square cap to avoid ugly edges
self.context.set_line_cap(cairo.LINE_CAP_SQUARE)
self.context.save()
self.context.rectangle(*self.rect)
self.context.clip()
cell_borders = CellBorders(self.c... | [
"def",
"draw",
"(",
"self",
")",
":",
"self",
".",
"context",
".",
"set_line_cap",
"(",
"cairo",
".",
"LINE_CAP_SQUARE",
")",
"self",
".",
"context",
".",
"save",
"(",
")",
"self",
".",
"context",
".",
"rectangle",
"(",
"*",
"self",
".",
"rect",
")",... | Draws cell border to context | [
"Draws",
"cell",
"border",
"to",
"context"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/_grid_cairo_renderer.py#L1316-L1332 | train |
manns/pyspread | pyspread/src/gui/_grid_renderer.py | GridRenderer._draw_cursor | def _draw_cursor(self, dc, grid, row, col,
pen=None, brush=None):
"""Draws cursor as Rectangle in lower right corner"""
# If in full screen mode draw no cursor
if grid.main_window.IsFullScreen():
return
key = row, col, grid.current_table
rect = ... | python | def _draw_cursor(self, dc, grid, row, col,
pen=None, brush=None):
"""Draws cursor as Rectangle in lower right corner"""
# If in full screen mode draw no cursor
if grid.main_window.IsFullScreen():
return
key = row, col, grid.current_table
rect = ... | [
"def",
"_draw_cursor",
"(",
"self",
",",
"dc",
",",
"grid",
",",
"row",
",",
"col",
",",
"pen",
"=",
"None",
",",
"brush",
"=",
"None",
")",
":",
"if",
"grid",
".",
"main_window",
".",
"IsFullScreen",
"(",
")",
":",
"return",
"key",
"=",
"row",
"... | Draws cursor as Rectangle in lower right corner | [
"Draws",
"cursor",
"as",
"Rectangle",
"in",
"lower",
"right",
"corner"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/_grid_renderer.py#L91-L157 | train |
manns/pyspread | pyspread/src/gui/_grid_renderer.py | GridRenderer.update_cursor | def update_cursor(self, dc, grid, row, col):
"""Whites out the old cursor and draws the new one"""
old_row, old_col = self.old_cursor_row_col
bgcolor = get_color(config["background_color"])
self._draw_cursor(dc, grid, old_row, old_col,
pen=wx.Pen(bgcolor), br... | python | def update_cursor(self, dc, grid, row, col):
"""Whites out the old cursor and draws the new one"""
old_row, old_col = self.old_cursor_row_col
bgcolor = get_color(config["background_color"])
self._draw_cursor(dc, grid, old_row, old_col,
pen=wx.Pen(bgcolor), br... | [
"def",
"update_cursor",
"(",
"self",
",",
"dc",
",",
"grid",
",",
"row",
",",
"col",
")",
":",
"old_row",
",",
"old_col",
"=",
"self",
".",
"old_cursor_row_col",
"bgcolor",
"=",
"get_color",
"(",
"config",
"[",
"\"background_color\"",
"]",
")",
"self",
"... | Whites out the old cursor and draws the new one | [
"Whites",
"out",
"the",
"old",
"cursor",
"and",
"draws",
"the",
"new",
"one"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/_grid_renderer.py#L159-L168 | train |
manns/pyspread | pyspread/src/gui/_grid_renderer.py | GridRenderer.get_merged_rect | def get_merged_rect(self, grid, key, rect):
"""Returns cell rect for normal or merged cells and None for merged"""
row, col, tab = key
# Check if cell is merged:
cell_attributes = grid.code_array.cell_attributes
merge_area = cell_attributes[(row, col, tab)]["merge_area"]
... | python | def get_merged_rect(self, grid, key, rect):
"""Returns cell rect for normal or merged cells and None for merged"""
row, col, tab = key
# Check if cell is merged:
cell_attributes = grid.code_array.cell_attributes
merge_area = cell_attributes[(row, col, tab)]["merge_area"]
... | [
"def",
"get_merged_rect",
"(",
"self",
",",
"grid",
",",
"key",
",",
"rect",
")",
":",
"row",
",",
"col",
",",
"tab",
"=",
"key",
"cell_attributes",
"=",
"grid",
".",
"code_array",
".",
"cell_attributes",
"merge_area",
"=",
"cell_attributes",
"[",
"(",
"... | Returns cell rect for normal or merged cells and None for merged | [
"Returns",
"cell",
"rect",
"for",
"normal",
"or",
"merged",
"cells",
"and",
"None",
"for",
"merged"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/_grid_renderer.py#L175-L202 | train |
manns/pyspread | pyspread/src/gui/_grid_renderer.py | GridRenderer._get_drawn_rect | def _get_drawn_rect(self, grid, key, rect):
"""Replaces drawn rect if the one provided by wx is incorrect
This handles merged rects including those that are partly off screen.
"""
rect = self.get_merged_rect(grid, key, rect)
if rect is None:
# Merged cell is drawn
... | python | def _get_drawn_rect(self, grid, key, rect):
"""Replaces drawn rect if the one provided by wx is incorrect
This handles merged rects including those that are partly off screen.
"""
rect = self.get_merged_rect(grid, key, rect)
if rect is None:
# Merged cell is drawn
... | [
"def",
"_get_drawn_rect",
"(",
"self",
",",
"grid",
",",
"key",
",",
"rect",
")",
":",
"rect",
"=",
"self",
".",
"get_merged_rect",
"(",
"grid",
",",
"key",
",",
"rect",
")",
"if",
"rect",
"is",
"None",
":",
"if",
"grid",
".",
"is_merged_cell_drawn",
... | Replaces drawn rect if the one provided by wx is incorrect
This handles merged rects including those that are partly off screen. | [
"Replaces",
"drawn",
"rect",
"if",
"the",
"one",
"provided",
"by",
"wx",
"is",
"incorrect"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/_grid_renderer.py#L204-L222 | train |
manns/pyspread | pyspread/src/gui/_grid_renderer.py | GridRenderer._get_draw_cache_key | def _get_draw_cache_key(self, grid, key, drawn_rect, is_selected):
"""Returns key for the screen draw cache"""
row, col, tab = key
cell_attributes = grid.code_array.cell_attributes
zoomed_width = drawn_rect.width / self.zoom
zoomed_height = drawn_rect.height / self.zoom
... | python | def _get_draw_cache_key(self, grid, key, drawn_rect, is_selected):
"""Returns key for the screen draw cache"""
row, col, tab = key
cell_attributes = grid.code_array.cell_attributes
zoomed_width = drawn_rect.width / self.zoom
zoomed_height = drawn_rect.height / self.zoom
... | [
"def",
"_get_draw_cache_key",
"(",
"self",
",",
"grid",
",",
"key",
",",
"drawn_rect",
",",
"is_selected",
")",
":",
"row",
",",
"col",
",",
"tab",
"=",
"key",
"cell_attributes",
"=",
"grid",
".",
"code_array",
".",
"cell_attributes",
"zoomed_width",
"=",
... | Returns key for the screen draw cache | [
"Returns",
"key",
"for",
"the",
"screen",
"draw",
"cache"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/_grid_renderer.py#L224-L261 | train |
manns/pyspread | pyspread/src/gui/_grid_renderer.py | GridRenderer._get_cairo_bmp | def _get_cairo_bmp(self, mdc, key, rect, is_selected, view_frozen):
"""Returns a wx.Bitmap of cell key in size rect"""
bmp = wx.EmptyBitmap(rect.width, rect.height)
mdc.SelectObject(bmp)
mdc.SetBackgroundMode(wx.SOLID)
mdc.SetBackground(wx.WHITE_BRUSH)
mdc.Clear()
... | python | def _get_cairo_bmp(self, mdc, key, rect, is_selected, view_frozen):
"""Returns a wx.Bitmap of cell key in size rect"""
bmp = wx.EmptyBitmap(rect.width, rect.height)
mdc.SelectObject(bmp)
mdc.SetBackgroundMode(wx.SOLID)
mdc.SetBackground(wx.WHITE_BRUSH)
mdc.Clear()
... | [
"def",
"_get_cairo_bmp",
"(",
"self",
",",
"mdc",
",",
"key",
",",
"rect",
",",
"is_selected",
",",
"view_frozen",
")",
":",
"bmp",
"=",
"wx",
".",
"EmptyBitmap",
"(",
"rect",
".",
"width",
",",
"rect",
".",
"height",
")",
"mdc",
".",
"SelectObject",
... | Returns a wx.Bitmap of cell key in size rect | [
"Returns",
"a",
"wx",
".",
"Bitmap",
"of",
"cell",
"key",
"in",
"size",
"rect"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/_grid_renderer.py#L263-L299 | train |
manns/pyspread | pyspread/src/gui/_grid_renderer.py | GridRenderer.Draw | def Draw(self, grid, attr, dc, rect, row, col, isSelected):
"""Draws the cell border and content using pycairo"""
key = row, col, grid.current_table
# If cell is merge draw the merging cell if invisibile
if grid.code_array.cell_attributes[key]["merge_area"]:
key = self.get_... | python | def Draw(self, grid, attr, dc, rect, row, col, isSelected):
"""Draws the cell border and content using pycairo"""
key = row, col, grid.current_table
# If cell is merge draw the merging cell if invisibile
if grid.code_array.cell_attributes[key]["merge_area"]:
key = self.get_... | [
"def",
"Draw",
"(",
"self",
",",
"grid",
",",
"attr",
",",
"dc",
",",
"rect",
",",
"row",
",",
"col",
",",
"isSelected",
")",
":",
"key",
"=",
"row",
",",
"col",
",",
"grid",
".",
"current_table",
"if",
"grid",
".",
"code_array",
".",
"cell_attribu... | Draws the cell border and content using pycairo | [
"Draws",
"the",
"cell",
"border",
"and",
"content",
"using",
"pycairo"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/_grid_renderer.py#L301-L365 | train |
manns/pyspread | pyspread/src/lib/gpg.py | choose_key | def choose_key(gpg_private_keys):
"""Displays gpg key choice and returns key"""
uid_strings_fp = []
uid_string_fp2key = {}
current_key_index = None
for i, key in enumerate(gpg_private_keys):
fingerprint = key['fingerprint']
if fingerprint == config["gpg_key_fingerprint"]:
... | python | def choose_key(gpg_private_keys):
"""Displays gpg key choice and returns key"""
uid_strings_fp = []
uid_string_fp2key = {}
current_key_index = None
for i, key in enumerate(gpg_private_keys):
fingerprint = key['fingerprint']
if fingerprint == config["gpg_key_fingerprint"]:
... | [
"def",
"choose_key",
"(",
"gpg_private_keys",
")",
":",
"uid_strings_fp",
"=",
"[",
"]",
"uid_string_fp2key",
"=",
"{",
"}",
"current_key_index",
"=",
"None",
"for",
"i",
",",
"key",
"in",
"enumerate",
"(",
"gpg_private_keys",
")",
":",
"fingerprint",
"=",
"... | Displays gpg key choice and returns key | [
"Displays",
"gpg",
"key",
"choice",
"and",
"returns",
"key"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/gpg.py#L53-L95 | train |
manns/pyspread | pyspread/src/lib/gpg.py | _register_key | def _register_key(fingerprint, gpg):
"""Registers key in config"""
for private_key in gpg.list_keys(True):
try:
if str(fingerprint) == private_key['fingerprint']:
config["gpg_key_fingerprint"] = \
repr(private_key['fingerprint'])
except KeyError:
... | python | def _register_key(fingerprint, gpg):
"""Registers key in config"""
for private_key in gpg.list_keys(True):
try:
if str(fingerprint) == private_key['fingerprint']:
config["gpg_key_fingerprint"] = \
repr(private_key['fingerprint'])
except KeyError:
... | [
"def",
"_register_key",
"(",
"fingerprint",
",",
"gpg",
")",
":",
"for",
"private_key",
"in",
"gpg",
".",
"list_keys",
"(",
"True",
")",
":",
"try",
":",
"if",
"str",
"(",
"fingerprint",
")",
"==",
"private_key",
"[",
"'fingerprint'",
"]",
":",
"config",... | Registers key in config | [
"Registers",
"key",
"in",
"config"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/gpg.py#L98-L107 | train |
manns/pyspread | pyspread/src/lib/gpg.py | has_no_password | def has_no_password(gpg_secret_keyid):
"""Returns True iif gpg_secret_key has a password"""
if gnupg is None:
return False
gpg = gnupg.GPG()
s = gpg.sign("", keyid=gpg_secret_keyid, passphrase="")
try:
return s.status == "signature created"
except AttributeError:
# Thi... | python | def has_no_password(gpg_secret_keyid):
"""Returns True iif gpg_secret_key has a password"""
if gnupg is None:
return False
gpg = gnupg.GPG()
s = gpg.sign("", keyid=gpg_secret_keyid, passphrase="")
try:
return s.status == "signature created"
except AttributeError:
# Thi... | [
"def",
"has_no_password",
"(",
"gpg_secret_keyid",
")",
":",
"if",
"gnupg",
"is",
"None",
":",
"return",
"False",
"gpg",
"=",
"gnupg",
".",
"GPG",
"(",
")",
"s",
"=",
"gpg",
".",
"sign",
"(",
"\"\"",
",",
"keyid",
"=",
"gpg_secret_keyid",
",",
"passphr... | Returns True iif gpg_secret_key has a password | [
"Returns",
"True",
"iif",
"gpg_secret_key",
"has",
"a",
"password"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/gpg.py#L110-L124 | train |
manns/pyspread | pyspread/src/lib/gpg.py | genkey | def genkey(key_name=None):
"""Creates a new standard GPG key
Parameters
----------
ui: Bool
\tIf True, then a new key is created when required without user interaction
"""
if gnupg is None:
return
gpg_key_param_list = [
('key_type', 'DSA'),
('key_length', '20... | python | def genkey(key_name=None):
"""Creates a new standard GPG key
Parameters
----------
ui: Bool
\tIf True, then a new key is created when required without user interaction
"""
if gnupg is None:
return
gpg_key_param_list = [
('key_type', 'DSA'),
('key_length', '20... | [
"def",
"genkey",
"(",
"key_name",
"=",
"None",
")",
":",
"if",
"gnupg",
"is",
"None",
":",
"return",
"gpg_key_param_list",
"=",
"[",
"(",
"'key_type'",
",",
"'DSA'",
")",
",",
"(",
"'key_length'",
",",
"'2048'",
")",
",",
"(",
"'subkey_type'",
",",
"'E... | Creates a new standard GPG key
Parameters
----------
ui: Bool
\tIf True, then a new key is created when required without user interaction | [
"Creates",
"a",
"new",
"standard",
"GPG",
"key"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/gpg.py#L127-L221 | train |
manns/pyspread | pyspread/src/lib/gpg.py | fingerprint2keyid | def fingerprint2keyid(fingerprint):
"""Returns keyid from fingerprint for private keys"""
if gnupg is None:
return
gpg = gnupg.GPG()
private_keys = gpg.list_keys(True)
keyid = None
for private_key in private_keys:
if private_key['fingerprint'] == config["gpg_key_fingerprint"]:... | python | def fingerprint2keyid(fingerprint):
"""Returns keyid from fingerprint for private keys"""
if gnupg is None:
return
gpg = gnupg.GPG()
private_keys = gpg.list_keys(True)
keyid = None
for private_key in private_keys:
if private_key['fingerprint'] == config["gpg_key_fingerprint"]:... | [
"def",
"fingerprint2keyid",
"(",
"fingerprint",
")",
":",
"if",
"gnupg",
"is",
"None",
":",
"return",
"gpg",
"=",
"gnupg",
".",
"GPG",
"(",
")",
"private_keys",
"=",
"gpg",
".",
"list_keys",
"(",
"True",
")",
"keyid",
"=",
"None",
"for",
"private_key",
... | Returns keyid from fingerprint for private keys | [
"Returns",
"keyid",
"from",
"fingerprint",
"for",
"private",
"keys"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/gpg.py#L224-L239 | train |
manns/pyspread | pyspread/src/lib/gpg.py | sign | def sign(filename):
"""Returns detached signature for file"""
if gnupg is None:
return
gpg = gnupg.GPG()
with open(filename, "rb") as signfile:
keyid = fingerprint2keyid(config["gpg_key_fingerprint"])
if keyid is None:
msg = "No private key for GPG fingerprint '{}... | python | def sign(filename):
"""Returns detached signature for file"""
if gnupg is None:
return
gpg = gnupg.GPG()
with open(filename, "rb") as signfile:
keyid = fingerprint2keyid(config["gpg_key_fingerprint"])
if keyid is None:
msg = "No private key for GPG fingerprint '{}... | [
"def",
"sign",
"(",
"filename",
")",
":",
"if",
"gnupg",
"is",
"None",
":",
"return",
"gpg",
"=",
"gnupg",
".",
"GPG",
"(",
")",
"with",
"open",
"(",
"filename",
",",
"\"rb\"",
")",
"as",
"signfile",
":",
"keyid",
"=",
"fingerprint2keyid",
"(",
"conf... | Returns detached signature for file | [
"Returns",
"detached",
"signature",
"for",
"file"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/gpg.py#L242-L259 | train |
manns/pyspread | pyspread/src/lib/gpg.py | verify | def verify(sigfilename, filefilename=None):
"""Verifies a signature, returns True if successful else False."""
if gnupg is None:
return False
gpg = gnupg.GPG()
with open(sigfilename, "rb") as sigfile:
verified = gpg.verify_file(sigfile, filefilename)
pyspread_keyid = fingerpr... | python | def verify(sigfilename, filefilename=None):
"""Verifies a signature, returns True if successful else False."""
if gnupg is None:
return False
gpg = gnupg.GPG()
with open(sigfilename, "rb") as sigfile:
verified = gpg.verify_file(sigfile, filefilename)
pyspread_keyid = fingerpr... | [
"def",
"verify",
"(",
"sigfilename",
",",
"filefilename",
"=",
"None",
")",
":",
"if",
"gnupg",
"is",
"None",
":",
"return",
"False",
"gpg",
"=",
"gnupg",
".",
"GPG",
"(",
")",
"with",
"open",
"(",
"sigfilename",
",",
"\"rb\"",
")",
"as",
"sigfile",
... | Verifies a signature, returns True if successful else False. | [
"Verifies",
"a",
"signature",
"returns",
"True",
"if",
"successful",
"else",
"False",
"."
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/gpg.py#L262-L278 | train |
manns/pyspread | pyspread/src/model/model.py | CellAttributes._len_table_cache | def _len_table_cache(self):
"""Returns the length of the table cache"""
length = 0
for table in self._table_cache:
length += len(self._table_cache[table])
return length | python | def _len_table_cache(self):
"""Returns the length of the table cache"""
length = 0
for table in self._table_cache:
length += len(self._table_cache[table])
return length | [
"def",
"_len_table_cache",
"(",
"self",
")",
":",
"length",
"=",
"0",
"for",
"table",
"in",
"self",
".",
"_table_cache",
":",
"length",
"+=",
"len",
"(",
"self",
".",
"_table_cache",
"[",
"table",
"]",
")",
"return",
"length"
] | Returns the length of the table cache | [
"Returns",
"the",
"length",
"of",
"the",
"table",
"cache"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/model/model.py#L250-L258 | train |
manns/pyspread | pyspread/src/model/model.py | CellAttributes._update_table_cache | def _update_table_cache(self):
"""Clears and updates the table cache to be in sync with self"""
self._table_cache.clear()
for sel, tab, val in self:
try:
self._table_cache[tab].append((sel, val))
except KeyError:
self._table_cache[tab] = [... | python | def _update_table_cache(self):
"""Clears and updates the table cache to be in sync with self"""
self._table_cache.clear()
for sel, tab, val in self:
try:
self._table_cache[tab].append((sel, val))
except KeyError:
self._table_cache[tab] = [... | [
"def",
"_update_table_cache",
"(",
"self",
")",
":",
"self",
".",
"_table_cache",
".",
"clear",
"(",
")",
"for",
"sel",
",",
"tab",
",",
"val",
"in",
"self",
":",
"try",
":",
"self",
".",
"_table_cache",
"[",
"tab",
"]",
".",
"append",
"(",
"(",
"s... | Clears and updates the table cache to be in sync with self | [
"Clears",
"and",
"updates",
"the",
"table",
"cache",
"to",
"be",
"in",
"sync",
"with",
"self"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/model/model.py#L260-L270 | train |
manns/pyspread | pyspread/src/model/model.py | CellAttributes.get_merging_cell | def get_merging_cell(self, key):
"""Returns key of cell that merges the cell key
or None if cell key not merged
Parameters
----------
key: 3-tuple of Integer
\tThe key of the cell that is merged
"""
row, col, tab = key
# Is cell merged
... | python | def get_merging_cell(self, key):
"""Returns key of cell that merges the cell key
or None if cell key not merged
Parameters
----------
key: 3-tuple of Integer
\tThe key of the cell that is merged
"""
row, col, tab = key
# Is cell merged
... | [
"def",
"get_merging_cell",
"(",
"self",
",",
"key",
")",
":",
"row",
",",
"col",
",",
"tab",
"=",
"key",
"merge_area",
"=",
"self",
"[",
"key",
"]",
"[",
"\"merge_area\"",
"]",
"if",
"merge_area",
":",
"return",
"merge_area",
"[",
"0",
"]",
",",
"mer... | Returns key of cell that merges the cell key
or None if cell key not merged
Parameters
----------
key: 3-tuple of Integer
\tThe key of the cell that is merged | [
"Returns",
"key",
"of",
"cell",
"that",
"merges",
"the",
"cell",
"key"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/model/model.py#L272-L290 | train |
manns/pyspread | pyspread/src/model/model.py | DataArray._get_data | def _get_data(self):
"""Returns dict of data content.
Keys
----
shape: 3-tuple of Integer
\tGrid shape
grid: Dict of 3-tuples to strings
\tCell content
attributes: List of 3-tuples
\tCell attributes
row_heights: Dict of 2-tuples to float
... | python | def _get_data(self):
"""Returns dict of data content.
Keys
----
shape: 3-tuple of Integer
\tGrid shape
grid: Dict of 3-tuples to strings
\tCell content
attributes: List of 3-tuples
\tCell attributes
row_heights: Dict of 2-tuples to float
... | [
"def",
"_get_data",
"(",
"self",
")",
":",
"data",
"=",
"{",
"}",
"data",
"[",
"\"shape\"",
"]",
"=",
"self",
".",
"shape",
"data",
"[",
"\"grid\"",
"]",
"=",
"{",
"}",
".",
"update",
"(",
"self",
".",
"dict_grid",
")",
"data",
"[",
"\"attributes\"... | Returns dict of data content.
Keys
----
shape: 3-tuple of Integer
\tGrid shape
grid: Dict of 3-tuples to strings
\tCell content
attributes: List of 3-tuples
\tCell attributes
row_heights: Dict of 2-tuples to float
\t(row, tab): row_height... | [
"Returns",
"dict",
"of",
"data",
"content",
"."
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/model/model.py#L388-L418 | train |
manns/pyspread | pyspread/src/model/model.py | DataArray._set_data | def _set_data(self, **kwargs):
"""Sets data from given parameters
Old values are deleted.
If a paremeter is not given, nothing is changed.
Parameters
----------
shape: 3-tuple of Integer
\tGrid shape
grid: Dict of 3-tuples to strings
\tCell cont... | python | def _set_data(self, **kwargs):
"""Sets data from given parameters
Old values are deleted.
If a paremeter is not given, nothing is changed.
Parameters
----------
shape: 3-tuple of Integer
\tGrid shape
grid: Dict of 3-tuples to strings
\tCell cont... | [
"def",
"_set_data",
"(",
"self",
",",
"**",
"kwargs",
")",
":",
"if",
"\"shape\"",
"in",
"kwargs",
":",
"self",
".",
"shape",
"=",
"kwargs",
"[",
"\"shape\"",
"]",
"if",
"\"grid\"",
"in",
"kwargs",
":",
"self",
".",
"dict_grid",
".",
"clear",
"(",
")... | Sets data from given parameters
Old values are deleted.
If a paremeter is not given, nothing is changed.
Parameters
----------
shape: 3-tuple of Integer
\tGrid shape
grid: Dict of 3-tuples to strings
\tCell content
attributes: List of 3-tuples
... | [
"Sets",
"data",
"from",
"given",
"parameters"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/model/model.py#L420-L461 | train |
manns/pyspread | pyspread/src/model/model.py | DataArray.get_row_height | def get_row_height(self, row, tab):
"""Returns row height"""
try:
return self.row_heights[(row, tab)]
except KeyError:
return config["default_row_height"] | python | def get_row_height(self, row, tab):
"""Returns row height"""
try:
return self.row_heights[(row, tab)]
except KeyError:
return config["default_row_height"] | [
"def",
"get_row_height",
"(",
"self",
",",
"row",
",",
"tab",
")",
":",
"try",
":",
"return",
"self",
".",
"row_heights",
"[",
"(",
"row",
",",
"tab",
")",
"]",
"except",
"KeyError",
":",
"return",
"config",
"[",
"\"default_row_height\"",
"]"
] | Returns row height | [
"Returns",
"row",
"height"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/model/model.py#L465-L472 | train |
manns/pyspread | pyspread/src/model/model.py | DataArray.get_col_width | def get_col_width(self, col, tab):
"""Returns column width"""
try:
return self.col_widths[(col, tab)]
except KeyError:
return config["default_col_width"] | python | def get_col_width(self, col, tab):
"""Returns column width"""
try:
return self.col_widths[(col, tab)]
except KeyError:
return config["default_col_width"] | [
"def",
"get_col_width",
"(",
"self",
",",
"col",
",",
"tab",
")",
":",
"try",
":",
"return",
"self",
".",
"col_widths",
"[",
"(",
"col",
",",
"tab",
")",
"]",
"except",
"KeyError",
":",
"return",
"config",
"[",
"\"default_col_width\"",
"]"
] | Returns column width | [
"Returns",
"column",
"width"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/model/model.py#L474-L481 | train |
manns/pyspread | pyspread/src/model/model.py | DataArray._set_shape | def _set_shape(self, shape):
"""Deletes all cells beyond new shape and sets dict_grid shape
Parameters
----------
shape: 3-tuple of Integer
\tTarget shape for grid
"""
# Delete each cell that is beyond new borders
old_shape = self.shape
deleted... | python | def _set_shape(self, shape):
"""Deletes all cells beyond new shape and sets dict_grid shape
Parameters
----------
shape: 3-tuple of Integer
\tTarget shape for grid
"""
# Delete each cell that is beyond new borders
old_shape = self.shape
deleted... | [
"def",
"_set_shape",
"(",
"self",
",",
"shape",
")",
":",
"old_shape",
"=",
"self",
".",
"shape",
"deleted_cells",
"=",
"{",
"}",
"if",
"any",
"(",
"new_axis",
"<",
"old_axis",
"for",
"new_axis",
",",
"old_axis",
"in",
"zip",
"(",
"shape",
",",
"old_sh... | Deletes all cells beyond new shape and sets dict_grid shape
Parameters
----------
shape: 3-tuple of Integer
\tTarget shape for grid | [
"Deletes",
"all",
"cells",
"beyond",
"new",
"shape",
"and",
"sets",
"dict_grid",
"shape"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/model/model.py#L568-L603 | train |
manns/pyspread | pyspread/src/model/model.py | DataArray.get_last_filled_cell | def get_last_filled_cell(self, table=None):
"""Returns key for the bottommost rightmost cell with content
Parameters
----------
table: Integer, defaults to None
\tLimit search to this table
"""
maxrow = 0
maxcol = 0
for row, col, tab in self.di... | python | def get_last_filled_cell(self, table=None):
"""Returns key for the bottommost rightmost cell with content
Parameters
----------
table: Integer, defaults to None
\tLimit search to this table
"""
maxrow = 0
maxcol = 0
for row, col, tab in self.di... | [
"def",
"get_last_filled_cell",
"(",
"self",
",",
"table",
"=",
"None",
")",
":",
"maxrow",
"=",
"0",
"maxcol",
"=",
"0",
"for",
"row",
",",
"col",
",",
"tab",
"in",
"self",
".",
"dict_grid",
":",
"if",
"table",
"is",
"None",
"or",
"tab",
"==",
"tab... | Returns key for the bottommost rightmost cell with content
Parameters
----------
table: Integer, defaults to None
\tLimit search to this table | [
"Returns",
"key",
"for",
"the",
"bottommost",
"rightmost",
"cell",
"with",
"content"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/model/model.py#L607-L625 | train |
manns/pyspread | pyspread/src/model/model.py | DataArray.cell_array_generator | def cell_array_generator(self, key):
"""Generator traversing cells specified in key
Parameters
----------
key: Iterable of Integer or slice
\tThe key specifies the cell keys of the generator
"""
for i, key_ele in enumerate(key):
# Get first element... | python | def cell_array_generator(self, key):
"""Generator traversing cells specified in key
Parameters
----------
key: Iterable of Integer or slice
\tThe key specifies the cell keys of the generator
"""
for i, key_ele in enumerate(key):
# Get first element... | [
"def",
"cell_array_generator",
"(",
"self",
",",
"key",
")",
":",
"for",
"i",
",",
"key_ele",
"in",
"enumerate",
"(",
"key",
")",
":",
"if",
"type",
"(",
"key_ele",
")",
"is",
"SliceType",
":",
"slc_keys",
"=",
"xrange",
"(",
"*",
"key_ele",
".",
"in... | Generator traversing cells specified in key
Parameters
----------
key: Iterable of Integer or slice
\tThe key specifies the cell keys of the generator | [
"Generator",
"traversing",
"cells",
"specified",
"in",
"key"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/model/model.py#L720-L752 | train |
manns/pyspread | pyspread/src/model/model.py | DataArray._shift_rowcol | def _shift_rowcol(self, insertion_point, no_to_insert):
"""Shifts row and column sizes when a table is inserted or deleted"""
# Shift row heights
new_row_heights = {}
del_row_heights = []
for row, tab in self.row_heights:
if tab > insertion_point:
n... | python | def _shift_rowcol(self, insertion_point, no_to_insert):
"""Shifts row and column sizes when a table is inserted or deleted"""
# Shift row heights
new_row_heights = {}
del_row_heights = []
for row, tab in self.row_heights:
if tab > insertion_point:
n... | [
"def",
"_shift_rowcol",
"(",
"self",
",",
"insertion_point",
",",
"no_to_insert",
")",
":",
"new_row_heights",
"=",
"{",
"}",
"del_row_heights",
"=",
"[",
"]",
"for",
"row",
",",
"tab",
"in",
"self",
".",
"row_heights",
":",
"if",
"tab",
">",
"insertion_po... | Shifts row and column sizes when a table is inserted or deleted | [
"Shifts",
"row",
"and",
"column",
"sizes",
"when",
"a",
"table",
"is",
"inserted",
"or",
"deleted"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/model/model.py#L754-L791 | train |
manns/pyspread | pyspread/src/model/model.py | DataArray._get_adjusted_merge_area | def _get_adjusted_merge_area(self, attrs, insertion_point, no_to_insert,
axis):
"""Returns updated merge area
Parameters
----------
attrs: Dict
\tCell attribute dictionary that shall be adjusted
insertion_point: Integer
\tPont on ... | python | def _get_adjusted_merge_area(self, attrs, insertion_point, no_to_insert,
axis):
"""Returns updated merge area
Parameters
----------
attrs: Dict
\tCell attribute dictionary that shall be adjusted
insertion_point: Integer
\tPont on ... | [
"def",
"_get_adjusted_merge_area",
"(",
"self",
",",
"attrs",
",",
"insertion_point",
",",
"no_to_insert",
",",
"axis",
")",
":",
"assert",
"axis",
"in",
"range",
"(",
"2",
")",
"if",
"\"merge_area\"",
"not",
"in",
"attrs",
"or",
"attrs",
"[",
"\"merge_area\... | Returns updated merge area
Parameters
----------
attrs: Dict
\tCell attribute dictionary that shall be adjusted
insertion_point: Integer
\tPont on axis, before which insertion takes place
no_to_insert: Integer >= 0
\tNumber of rows/cols/tabs that shall be... | [
"Returns",
"updated",
"merge",
"area"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/model/model.py#L822-L883 | train |
manns/pyspread | pyspread/src/model/model.py | DataArray.set_row_height | def set_row_height(self, row, tab, height):
"""Sets row height"""
try:
old_height = self.row_heights.pop((row, tab))
except KeyError:
old_height = None
if height is not None:
self.row_heights[(row, tab)] = float(height) | python | def set_row_height(self, row, tab, height):
"""Sets row height"""
try:
old_height = self.row_heights.pop((row, tab))
except KeyError:
old_height = None
if height is not None:
self.row_heights[(row, tab)] = float(height) | [
"def",
"set_row_height",
"(",
"self",
",",
"row",
",",
"tab",
",",
"height",
")",
":",
"try",
":",
"old_height",
"=",
"self",
".",
"row_heights",
".",
"pop",
"(",
"(",
"row",
",",
"tab",
")",
")",
"except",
"KeyError",
":",
"old_height",
"=",
"None",... | Sets row height | [
"Sets",
"row",
"height"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/model/model.py#L1078-L1088 | train |
manns/pyspread | pyspread/src/model/model.py | DataArray.set_col_width | def set_col_width(self, col, tab, width):
"""Sets column width"""
try:
old_width = self.col_widths.pop((col, tab))
except KeyError:
old_width = None
if width is not None:
self.col_widths[(col, tab)] = float(width) | python | def set_col_width(self, col, tab, width):
"""Sets column width"""
try:
old_width = self.col_widths.pop((col, tab))
except KeyError:
old_width = None
if width is not None:
self.col_widths[(col, tab)] = float(width) | [
"def",
"set_col_width",
"(",
"self",
",",
"col",
",",
"tab",
",",
"width",
")",
":",
"try",
":",
"old_width",
"=",
"self",
".",
"col_widths",
".",
"pop",
"(",
"(",
"col",
",",
"tab",
")",
")",
"except",
"KeyError",
":",
"old_width",
"=",
"None",
"i... | Sets column width | [
"Sets",
"column",
"width"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/model/model.py#L1090-L1100 | train |
manns/pyspread | pyspread/src/model/model.py | CodeArray._make_nested_list | def _make_nested_list(self, gen):
"""Makes nested list from generator for creating numpy.array"""
res = []
for ele in gen:
if ele is None:
res.append(None)
elif not is_string_like(ele) and is_generator_like(ele):
# Nested generator
... | python | def _make_nested_list(self, gen):
"""Makes nested list from generator for creating numpy.array"""
res = []
for ele in gen:
if ele is None:
res.append(None)
elif not is_string_like(ele) and is_generator_like(ele):
# Nested generator
... | [
"def",
"_make_nested_list",
"(",
"self",
",",
"gen",
")",
":",
"res",
"=",
"[",
"]",
"for",
"ele",
"in",
"gen",
":",
"if",
"ele",
"is",
"None",
":",
"res",
".",
"append",
"(",
"None",
")",
"elif",
"not",
"is_string_like",
"(",
"ele",
")",
"and",
... | Makes nested list from generator for creating numpy.array | [
"Makes",
"nested",
"list",
"from",
"generator",
"for",
"creating",
"numpy",
".",
"array"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/model/model.py#L1174-L1190 | train |
manns/pyspread | pyspread/src/model/model.py | CodeArray._get_assignment_target_end | def _get_assignment_target_end(self, ast_module):
"""Returns position of 1st char after assignment traget.
If there is no assignment, -1 is returned
If there are more than one of any ( expressions or assigments)
then a ValueError is raised.
"""
if len(ast_module.body)... | python | def _get_assignment_target_end(self, ast_module):
"""Returns position of 1st char after assignment traget.
If there is no assignment, -1 is returned
If there are more than one of any ( expressions or assigments)
then a ValueError is raised.
"""
if len(ast_module.body)... | [
"def",
"_get_assignment_target_end",
"(",
"self",
",",
"ast_module",
")",
":",
"if",
"len",
"(",
"ast_module",
".",
"body",
")",
">",
"1",
":",
"raise",
"ValueError",
"(",
"\"More than one expression or assignment.\"",
")",
"elif",
"len",
"(",
"ast_module",
".",... | Returns position of 1st char after assignment traget.
If there is no assignment, -1 is returned
If there are more than one of any ( expressions or assigments)
then a ValueError is raised. | [
"Returns",
"position",
"of",
"1st",
"char",
"after",
"assignment",
"traget",
"."
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/model/model.py#L1192-L1212 | train |
manns/pyspread | pyspread/src/model/model.py | CodeArray._get_updated_environment | def _get_updated_environment(self, env_dict=None):
"""Returns globals environment with 'magic' variable
Parameters
----------
env_dict: Dict, defaults to {'S': self}
\tDict that maps global variable name to value
"""
if env_dict is None:
env_dict = ... | python | def _get_updated_environment(self, env_dict=None):
"""Returns globals environment with 'magic' variable
Parameters
----------
env_dict: Dict, defaults to {'S': self}
\tDict that maps global variable name to value
"""
if env_dict is None:
env_dict = ... | [
"def",
"_get_updated_environment",
"(",
"self",
",",
"env_dict",
"=",
"None",
")",
":",
"if",
"env_dict",
"is",
"None",
":",
"env_dict",
"=",
"{",
"'S'",
":",
"self",
"}",
"env",
"=",
"globals",
"(",
")",
".",
"copy",
"(",
")",
"env",
".",
"update",
... | Returns globals environment with 'magic' variable
Parameters
----------
env_dict: Dict, defaults to {'S': self}
\tDict that maps global variable name to value | [
"Returns",
"globals",
"environment",
"with",
"magic",
"variable"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/model/model.py#L1214-L1230 | train |
manns/pyspread | pyspread/src/model/model.py | CodeArray._eval_cell | def _eval_cell(self, key, code):
"""Evaluates one cell and returns its result"""
# Flatten helper function
def nn(val):
"""Returns flat numpy arraz without None values"""
try:
return numpy.array(filter(None, val.flat))
except AttributeError:
... | python | def _eval_cell(self, key, code):
"""Evaluates one cell and returns its result"""
# Flatten helper function
def nn(val):
"""Returns flat numpy arraz without None values"""
try:
return numpy.array(filter(None, val.flat))
except AttributeError:
... | [
"def",
"_eval_cell",
"(",
"self",
",",
"key",
",",
"code",
")",
":",
"def",
"nn",
"(",
"val",
")",
":",
"try",
":",
"return",
"numpy",
".",
"array",
"(",
"filter",
"(",
"None",
",",
"val",
".",
"flat",
")",
")",
"except",
"AttributeError",
":",
"... | Evaluates one cell and returns its result | [
"Evaluates",
"one",
"cell",
"and",
"returns",
"its",
"result"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/model/model.py#L1232-L1340 | train |
manns/pyspread | pyspread/src/model/model.py | CodeArray.pop | def pop(self, key):
"""Pops dict_grid with undo and redo support
Parameters
----------
key: 3-tuple of Integer
\tCell key that shall be popped
"""
try:
self.result_cache.pop(repr(key))
except KeyError:
pass
return DataA... | python | def pop(self, key):
"""Pops dict_grid with undo and redo support
Parameters
----------
key: 3-tuple of Integer
\tCell key that shall be popped
"""
try:
self.result_cache.pop(repr(key))
except KeyError:
pass
return DataA... | [
"def",
"pop",
"(",
"self",
",",
"key",
")",
":",
"try",
":",
"self",
".",
"result_cache",
".",
"pop",
"(",
"repr",
"(",
"key",
")",
")",
"except",
"KeyError",
":",
"pass",
"return",
"DataArray",
".",
"pop",
"(",
"self",
",",
"key",
")"
] | Pops dict_grid with undo and redo support
Parameters
----------
key: 3-tuple of Integer
\tCell key that shall be popped | [
"Pops",
"dict_grid",
"with",
"undo",
"and",
"redo",
"support"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/model/model.py#L1342-L1358 | train |
manns/pyspread | pyspread/src/model/model.py | CodeArray.reload_modules | def reload_modules(self):
"""Reloads modules that are available in cells"""
import src.lib.charts as charts
from src.gui.grid_panels import vlcpanel_factory
modules = [charts, bz2, base64, re, ast, sys, wx, numpy, datetime]
for module in modules:
reload(module) | python | def reload_modules(self):
"""Reloads modules that are available in cells"""
import src.lib.charts as charts
from src.gui.grid_panels import vlcpanel_factory
modules = [charts, bz2, base64, re, ast, sys, wx, numpy, datetime]
for module in modules:
reload(module) | [
"def",
"reload_modules",
"(",
"self",
")",
":",
"import",
"src",
".",
"lib",
".",
"charts",
"as",
"charts",
"from",
"src",
".",
"gui",
".",
"grid_panels",
"import",
"vlcpanel_factory",
"modules",
"=",
"[",
"charts",
",",
"bz2",
",",
"base64",
",",
"re",
... | Reloads modules that are available in cells | [
"Reloads",
"modules",
"that",
"are",
"available",
"in",
"cells"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/model/model.py#L1360-L1368 | train |
manns/pyspread | pyspread/src/model/model.py | CodeArray.clear_globals | def clear_globals(self):
"""Clears all newly assigned globals"""
base_keys = ['cStringIO', 'IntType', 'KeyValueStore', 'undoable',
'is_generator_like', 'is_string_like', 'bz2', 'base64',
'__package__', 're', 'config', '__doc__', 'SliceType',
... | python | def clear_globals(self):
"""Clears all newly assigned globals"""
base_keys = ['cStringIO', 'IntType', 'KeyValueStore', 'undoable',
'is_generator_like', 'is_string_like', 'bz2', 'base64',
'__package__', 're', 'config', '__doc__', 'SliceType',
... | [
"def",
"clear_globals",
"(",
"self",
")",
":",
"base_keys",
"=",
"[",
"'cStringIO'",
",",
"'IntType'",
",",
"'KeyValueStore'",
",",
"'undoable'",
",",
"'is_generator_like'",
",",
"'is_string_like'",
",",
"'bz2'",
",",
"'base64'",
",",
"'__package__'",
",",
"'re'... | Clears all newly assigned globals | [
"Clears",
"all",
"newly",
"assigned",
"globals"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/model/model.py#L1370-L1384 | train |
manns/pyspread | pyspread/src/model/model.py | CodeArray.execute_macros | def execute_macros(self):
"""Executes all macros and returns result string
Executes macros only when not in safe_mode
"""
if self.safe_mode:
return '', "Safe mode activated. Code not executed."
# Windows exec does not like Windows newline
self.macros = sel... | python | def execute_macros(self):
"""Executes all macros and returns result string
Executes macros only when not in safe_mode
"""
if self.safe_mode:
return '', "Safe mode activated. Code not executed."
# Windows exec does not like Windows newline
self.macros = sel... | [
"def",
"execute_macros",
"(",
"self",
")",
":",
"if",
"self",
".",
"safe_mode",
":",
"return",
"''",
",",
"\"Safe mode activated. Code not executed.\"",
"self",
".",
"macros",
"=",
"self",
".",
"macros",
".",
"replace",
"(",
"'\\r\\n'",
",",
"'\\n'",
")",
"g... | Executes all macros and returns result string
Executes macros only when not in safe_mode | [
"Executes",
"all",
"macros",
"and",
"returns",
"result",
"string"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/model/model.py#L1391-L1459 | train |
manns/pyspread | pyspread/src/model/model.py | CodeArray._sorted_keys | def _sorted_keys(self, keys, startkey, reverse=False):
"""Generator that yields sorted keys starting with startkey
Parameters
----------
keys: Iterable of tuple/list
\tKey sequence that is sorted
startkey: Tuple/list
\tFirst key to be yielded
reverse: Bo... | python | def _sorted_keys(self, keys, startkey, reverse=False):
"""Generator that yields sorted keys starting with startkey
Parameters
----------
keys: Iterable of tuple/list
\tKey sequence that is sorted
startkey: Tuple/list
\tFirst key to be yielded
reverse: Bo... | [
"def",
"_sorted_keys",
"(",
"self",
",",
"keys",
",",
"startkey",
",",
"reverse",
"=",
"False",
")",
":",
"tuple_key",
"=",
"lambda",
"t",
":",
"t",
"[",
":",
":",
"-",
"1",
"]",
"if",
"reverse",
":",
"tuple_cmp",
"=",
"lambda",
"t",
":",
"t",
"[... | Generator that yields sorted keys starting with startkey
Parameters
----------
keys: Iterable of tuple/list
\tKey sequence that is sorted
startkey: Tuple/list
\tFirst key to be yielded
reverse: Bool
\tSort direction reversed if True | [
"Generator",
"that",
"yields",
"sorted",
"keys",
"starting",
"with",
"startkey"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/model/model.py#L1461-L1488 | train |
manns/pyspread | pyspread/src/model/model.py | CodeArray.findnextmatch | def findnextmatch(self, startkey, find_string, flags, search_result=True):
""" Returns a tuple with the position of the next match of find_string
Returns None if string not found.
Parameters:
-----------
startkey: Start position of search
find_string:String to be sear... | python | def findnextmatch(self, startkey, find_string, flags, search_result=True):
""" Returns a tuple with the position of the next match of find_string
Returns None if string not found.
Parameters:
-----------
startkey: Start position of search
find_string:String to be sear... | [
"def",
"findnextmatch",
"(",
"self",
",",
"startkey",
",",
"find_string",
",",
"flags",
",",
"search_result",
"=",
"True",
")",
":",
"assert",
"\"UP\"",
"in",
"flags",
"or",
"\"DOWN\"",
"in",
"flags",
"assert",
"not",
"(",
"\"UP\"",
"in",
"flags",
"and",
... | Returns a tuple with the position of the next match of find_string
Returns None if string not found.
Parameters:
-----------
startkey: Start position of search
find_string:String to be searched for
flags: List of strings, out of
["UP" xor "DOW... | [
"Returns",
"a",
"tuple",
"with",
"the",
"position",
"of",
"the",
"next",
"match",
"of",
"find_string"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/model/model.py#L1532-L1577 | train |
manns/pyspread | pyspread/src/gui/_dialogs.py | IntValidator.Validate | def Validate(self, win):
"""Returns True if Value in digits, False otherwise"""
val = self.GetWindow().GetValue()
for x in val:
if x not in string.digits:
return False
return True | python | def Validate(self, win):
"""Returns True if Value in digits, False otherwise"""
val = self.GetWindow().GetValue()
for x in val:
if x not in string.digits:
return False
return True | [
"def",
"Validate",
"(",
"self",
",",
"win",
")",
":",
"val",
"=",
"self",
".",
"GetWindow",
"(",
")",
".",
"GetValue",
"(",
")",
"for",
"x",
"in",
"val",
":",
"if",
"x",
"not",
"in",
"string",
".",
"digits",
":",
"return",
"False",
"return",
"Tru... | Returns True if Value in digits, False otherwise | [
"Returns",
"True",
"if",
"Value",
"in",
"digits",
"False",
"otherwise"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/_dialogs.py#L99-L108 | train |
manns/pyspread | pyspread/src/gui/_dialogs.py | IntValidator.OnChar | def OnChar(self, event):
"""Eats event if key not in digits"""
key = event.GetKeyCode()
if key < wx.WXK_SPACE or key == wx.WXK_DELETE or key > 255 or \
chr(key) in string.digits:
event.Skip() | python | def OnChar(self, event):
"""Eats event if key not in digits"""
key = event.GetKeyCode()
if key < wx.WXK_SPACE or key == wx.WXK_DELETE or key > 255 or \
chr(key) in string.digits:
event.Skip() | [
"def",
"OnChar",
"(",
"self",
",",
"event",
")",
":",
"key",
"=",
"event",
".",
"GetKeyCode",
"(",
")",
"if",
"key",
"<",
"wx",
".",
"WXK_SPACE",
"or",
"key",
"==",
"wx",
".",
"WXK_DELETE",
"or",
"key",
">",
"255",
"or",
"chr",
"(",
"key",
")",
... | Eats event if key not in digits | [
"Eats",
"event",
"if",
"key",
"not",
"in",
"digits"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/_dialogs.py#L110-L117 | train |
manns/pyspread | pyspread/src/gui/_dialogs.py | ChoiceRenderer.Draw | def Draw(self, grid, attr, dc, rect, row, col, is_selected):
"""Draws the text and the combobox icon"""
render = wx.RendererNative.Get()
# clear the background
dc.SetBackgroundMode(wx.SOLID)
if is_selected:
dc.SetBrush(wx.Brush(wx.BLUE, wx.SOLID))
dc.Se... | python | def Draw(self, grid, attr, dc, rect, row, col, is_selected):
"""Draws the text and the combobox icon"""
render = wx.RendererNative.Get()
# clear the background
dc.SetBackgroundMode(wx.SOLID)
if is_selected:
dc.SetBrush(wx.Brush(wx.BLUE, wx.SOLID))
dc.Se... | [
"def",
"Draw",
"(",
"self",
",",
"grid",
",",
"attr",
",",
"dc",
",",
"rect",
",",
"row",
",",
"col",
",",
"is_selected",
")",
":",
"render",
"=",
"wx",
".",
"RendererNative",
".",
"Get",
"(",
")",
"dc",
".",
"SetBackgroundMode",
"(",
"wx",
".",
... | Draws the text and the combobox icon | [
"Draws",
"the",
"text",
"and",
"the",
"combobox",
"icon"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/_dialogs.py#L140-L167 | train |
manns/pyspread | pyspread/src/gui/_dialogs.py | CsvParameterWidgets._setup_param_widgets | def _setup_param_widgets(self):
"""Creates the parameter entry widgets and binds them to methods"""
for parameter in self.csv_params:
pname, ptype, plabel, phelp = parameter
label = wx.StaticText(self.parent, -1, plabel)
widget = self.type2widget[ptype](self.parent)... | python | def _setup_param_widgets(self):
"""Creates the parameter entry widgets and binds them to methods"""
for parameter in self.csv_params:
pname, ptype, plabel, phelp = parameter
label = wx.StaticText(self.parent, -1, plabel)
widget = self.type2widget[ptype](self.parent)... | [
"def",
"_setup_param_widgets",
"(",
"self",
")",
":",
"for",
"parameter",
"in",
"self",
".",
"csv_params",
":",
"pname",
",",
"ptype",
",",
"plabel",
",",
"phelp",
"=",
"parameter",
"label",
"=",
"wx",
".",
"StaticText",
"(",
"self",
".",
"parent",
",",
... | Creates the parameter entry widgets and binds them to methods | [
"Creates",
"the",
"parameter",
"entry",
"widgets",
"and",
"binds",
"them",
"to",
"methods"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/_dialogs.py#L289-L326 | train |
manns/pyspread | pyspread/src/gui/_dialogs.py | CsvParameterWidgets._do_layout | def _do_layout(self):
"""Sizer hell, returns a sizer that contains all widgets"""
sizer_csvoptions = wx.FlexGridSizer(5, 4, 5, 5)
# Adding parameter widgets to sizer_csvoptions
leftpos = wx.LEFT | wx.ADJUST_MINSIZE
rightpos = wx.RIGHT | wx.EXPAND
current_label_margin =... | python | def _do_layout(self):
"""Sizer hell, returns a sizer that contains all widgets"""
sizer_csvoptions = wx.FlexGridSizer(5, 4, 5, 5)
# Adding parameter widgets to sizer_csvoptions
leftpos = wx.LEFT | wx.ADJUST_MINSIZE
rightpos = wx.RIGHT | wx.EXPAND
current_label_margin =... | [
"def",
"_do_layout",
"(",
"self",
")",
":",
"sizer_csvoptions",
"=",
"wx",
".",
"FlexGridSizer",
"(",
"5",
",",
"4",
",",
"5",
",",
"5",
")",
"leftpos",
"=",
"wx",
".",
"LEFT",
"|",
"wx",
".",
"ADJUST_MINSIZE",
"rightpos",
"=",
"wx",
".",
"RIGHT",
... | Sizer hell, returns a sizer that contains all widgets | [
"Sizer",
"hell",
"returns",
"a",
"sizer",
"that",
"contains",
"all",
"widgets"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/_dialogs.py#L328-L350 | train |
manns/pyspread | pyspread/src/gui/_dialogs.py | CsvParameterWidgets._update_settings | def _update_settings(self, dialect):
"""Sets the widget settings to those of the chosen dialect"""
# the first parameter is the dialect itself --> ignore
for parameter in self.csv_params[2:]:
pname, ptype, plabel, phelp = parameter
widget = self._widget_from_p(pname, pt... | python | def _update_settings(self, dialect):
"""Sets the widget settings to those of the chosen dialect"""
# the first parameter is the dialect itself --> ignore
for parameter in self.csv_params[2:]:
pname, ptype, plabel, phelp = parameter
widget = self._widget_from_p(pname, pt... | [
"def",
"_update_settings",
"(",
"self",
",",
"dialect",
")",
":",
"for",
"parameter",
"in",
"self",
".",
"csv_params",
"[",
"2",
":",
"]",
":",
"pname",
",",
"ptype",
",",
"plabel",
",",
"phelp",
"=",
"parameter",
"widget",
"=",
"self",
".",
"_widget_f... | Sets the widget settings to those of the chosen dialect | [
"Sets",
"the",
"widget",
"settings",
"to",
"those",
"of",
"the",
"chosen",
"dialect"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/_dialogs.py#L352-L371 | train |
manns/pyspread | pyspread/src/gui/_dialogs.py | CsvParameterWidgets._widget_from_p | def _widget_from_p(self, pname, ptype):
"""Returns a widget from its ptype and pname"""
widget_name = self.type2widget[ptype].__name__.lower()
widget_name = "_".join([widget_name, pname])
return getattr(self, widget_name) | python | def _widget_from_p(self, pname, ptype):
"""Returns a widget from its ptype and pname"""
widget_name = self.type2widget[ptype].__name__.lower()
widget_name = "_".join([widget_name, pname])
return getattr(self, widget_name) | [
"def",
"_widget_from_p",
"(",
"self",
",",
"pname",
",",
"ptype",
")",
":",
"widget_name",
"=",
"self",
".",
"type2widget",
"[",
"ptype",
"]",
".",
"__name__",
".",
"lower",
"(",
")",
"widget_name",
"=",
"\"_\"",
".",
"join",
"(",
"[",
"widget_name",
"... | Returns a widget from its ptype and pname | [
"Returns",
"a",
"widget",
"from",
"its",
"ptype",
"and",
"pname"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/_dialogs.py#L373-L378 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.