id
int32 0
252k
| repo
stringlengths 7
55
| path
stringlengths 4
127
| func_name
stringlengths 1
88
| original_string
stringlengths 75
19.8k
| language
stringclasses 1
value | code
stringlengths 51
19.8k
| code_tokens
sequence | docstring
stringlengths 3
17.3k
| docstring_tokens
sequence | sha
stringlengths 40
40
| url
stringlengths 87
242
|
---|---|---|---|---|---|---|---|---|---|---|---|
250,100 | manns/pyspread | pyspread/src/gui/_toolbars.py | AttributesToolbar._create_font_choice_combo | def _create_font_choice_combo(self):
"""Creates font choice combo box"""
self.fonts = get_font_list()
self.font_choice_combo = \
_widgets.FontChoiceCombobox(self, choices=self.fonts,
style=wx.CB_READONLY, size=(125, -1))
self.font_choice_combo.SetToolTipString(_(u"Text font"))
self.AddControl(self.font_choice_combo)
self.Bind(wx.EVT_COMBOBOX, self.OnTextFont, self.font_choice_combo)
self.parent.Bind(self.EVT_CMD_TOOLBAR_UPDATE, self.OnUpdate) | python | def _create_font_choice_combo(self):
self.fonts = get_font_list()
self.font_choice_combo = \
_widgets.FontChoiceCombobox(self, choices=self.fonts,
style=wx.CB_READONLY, size=(125, -1))
self.font_choice_combo.SetToolTipString(_(u"Text font"))
self.AddControl(self.font_choice_combo)
self.Bind(wx.EVT_COMBOBOX, self.OnTextFont, self.font_choice_combo)
self.parent.Bind(self.EVT_CMD_TOOLBAR_UPDATE, self.OnUpdate) | [
"def",
"_create_font_choice_combo",
"(",
"self",
")",
":",
"self",
".",
"fonts",
"=",
"get_font_list",
"(",
")",
"self",
".",
"font_choice_combo",
"=",
"_widgets",
".",
"FontChoiceCombobox",
"(",
"self",
",",
"choices",
"=",
"self",
".",
"fonts",
",",
"style",
"=",
"wx",
".",
"CB_READONLY",
",",
"size",
"=",
"(",
"125",
",",
"-",
"1",
")",
")",
"self",
".",
"font_choice_combo",
".",
"SetToolTipString",
"(",
"_",
"(",
"u\"Text font\"",
")",
")",
"self",
".",
"AddControl",
"(",
"self",
".",
"font_choice_combo",
")",
"self",
".",
"Bind",
"(",
"wx",
".",
"EVT_COMBOBOX",
",",
"self",
".",
"OnTextFont",
",",
"self",
".",
"font_choice_combo",
")",
"self",
".",
"parent",
".",
"Bind",
"(",
"self",
".",
"EVT_CMD_TOOLBAR_UPDATE",
",",
"self",
".",
"OnUpdate",
")"
] | Creates font choice combo box | [
"Creates",
"font",
"choice",
"combo",
"box"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/_toolbars.py#L561-L574 |
250,101 | manns/pyspread | pyspread/src/gui/_toolbars.py | AttributesToolbar._create_font_size_combo | def _create_font_size_combo(self):
"""Creates font size combo box"""
self.std_font_sizes = config["font_default_sizes"]
font_size = str(get_default_font().GetPointSize())
self.font_size_combo = \
wx.ComboBox(self, -1, value=font_size, size=(60, -1),
choices=map(unicode, self.std_font_sizes),
style=wx.CB_DROPDOWN | wx.TE_PROCESS_ENTER)
self.font_size_combo.SetToolTipString(_(u"Text size\n(points)"))
self.AddControl(self.font_size_combo)
self.Bind(wx.EVT_COMBOBOX, self.OnTextSize, self.font_size_combo)
self.Bind(wx.EVT_TEXT_ENTER, self.OnTextSize, self.font_size_combo) | python | def _create_font_size_combo(self):
self.std_font_sizes = config["font_default_sizes"]
font_size = str(get_default_font().GetPointSize())
self.font_size_combo = \
wx.ComboBox(self, -1, value=font_size, size=(60, -1),
choices=map(unicode, self.std_font_sizes),
style=wx.CB_DROPDOWN | wx.TE_PROCESS_ENTER)
self.font_size_combo.SetToolTipString(_(u"Text size\n(points)"))
self.AddControl(self.font_size_combo)
self.Bind(wx.EVT_COMBOBOX, self.OnTextSize, self.font_size_combo)
self.Bind(wx.EVT_TEXT_ENTER, self.OnTextSize, self.font_size_combo) | [
"def",
"_create_font_size_combo",
"(",
"self",
")",
":",
"self",
".",
"std_font_sizes",
"=",
"config",
"[",
"\"font_default_sizes\"",
"]",
"font_size",
"=",
"str",
"(",
"get_default_font",
"(",
")",
".",
"GetPointSize",
"(",
")",
")",
"self",
".",
"font_size_combo",
"=",
"wx",
".",
"ComboBox",
"(",
"self",
",",
"-",
"1",
",",
"value",
"=",
"font_size",
",",
"size",
"=",
"(",
"60",
",",
"-",
"1",
")",
",",
"choices",
"=",
"map",
"(",
"unicode",
",",
"self",
".",
"std_font_sizes",
")",
",",
"style",
"=",
"wx",
".",
"CB_DROPDOWN",
"|",
"wx",
".",
"TE_PROCESS_ENTER",
")",
"self",
".",
"font_size_combo",
".",
"SetToolTipString",
"(",
"_",
"(",
"u\"Text size\\n(points)\"",
")",
")",
"self",
".",
"AddControl",
"(",
"self",
".",
"font_size_combo",
")",
"self",
".",
"Bind",
"(",
"wx",
".",
"EVT_COMBOBOX",
",",
"self",
".",
"OnTextSize",
",",
"self",
".",
"font_size_combo",
")",
"self",
".",
"Bind",
"(",
"wx",
".",
"EVT_TEXT_ENTER",
",",
"self",
".",
"OnTextSize",
",",
"self",
".",
"font_size_combo",
")"
] | Creates font size combo box | [
"Creates",
"font",
"size",
"combo",
"box"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/_toolbars.py#L576-L590 |
250,102 | manns/pyspread | pyspread/src/gui/_toolbars.py | AttributesToolbar._create_font_face_buttons | def _create_font_face_buttons(self):
"""Creates font face buttons"""
font_face_buttons = [
(wx.FONTFLAG_BOLD, "OnBold", "FormatTextBold", _("Bold")),
(wx.FONTFLAG_ITALIC, "OnItalics", "FormatTextItalic",
_("Italics")),
(wx.FONTFLAG_UNDERLINED, "OnUnderline", "FormatTextUnderline",
_("Underline")),
(wx.FONTFLAG_STRIKETHROUGH, "OnStrikethrough",
"FormatTextStrikethrough", _("Strikethrough")),
(wx.FONTFLAG_MASK, "OnFreeze", "Freeze", _("Freeze")),
(wx.FONTFLAG_NOT_ANTIALIASED, "OnLock", "Lock", _("Lock cell")),
(wx.FONTFAMILY_DECORATIVE, "OnMarkup", "Markup", _("Markup")),
]
for __id, method, iconname, helpstring in font_face_buttons:
bmp = icons[iconname]
self.AddCheckTool(__id, iconname, bmp, bmp,
short_help_string=helpstring)
self.Bind(wx.EVT_TOOL, getattr(self, method), id=__id) | python | def _create_font_face_buttons(self):
font_face_buttons = [
(wx.FONTFLAG_BOLD, "OnBold", "FormatTextBold", _("Bold")),
(wx.FONTFLAG_ITALIC, "OnItalics", "FormatTextItalic",
_("Italics")),
(wx.FONTFLAG_UNDERLINED, "OnUnderline", "FormatTextUnderline",
_("Underline")),
(wx.FONTFLAG_STRIKETHROUGH, "OnStrikethrough",
"FormatTextStrikethrough", _("Strikethrough")),
(wx.FONTFLAG_MASK, "OnFreeze", "Freeze", _("Freeze")),
(wx.FONTFLAG_NOT_ANTIALIASED, "OnLock", "Lock", _("Lock cell")),
(wx.FONTFAMILY_DECORATIVE, "OnMarkup", "Markup", _("Markup")),
]
for __id, method, iconname, helpstring in font_face_buttons:
bmp = icons[iconname]
self.AddCheckTool(__id, iconname, bmp, bmp,
short_help_string=helpstring)
self.Bind(wx.EVT_TOOL, getattr(self, method), id=__id) | [
"def",
"_create_font_face_buttons",
"(",
"self",
")",
":",
"font_face_buttons",
"=",
"[",
"(",
"wx",
".",
"FONTFLAG_BOLD",
",",
"\"OnBold\"",
",",
"\"FormatTextBold\"",
",",
"_",
"(",
"\"Bold\"",
")",
")",
",",
"(",
"wx",
".",
"FONTFLAG_ITALIC",
",",
"\"OnItalics\"",
",",
"\"FormatTextItalic\"",
",",
"_",
"(",
"\"Italics\"",
")",
")",
",",
"(",
"wx",
".",
"FONTFLAG_UNDERLINED",
",",
"\"OnUnderline\"",
",",
"\"FormatTextUnderline\"",
",",
"_",
"(",
"\"Underline\"",
")",
")",
",",
"(",
"wx",
".",
"FONTFLAG_STRIKETHROUGH",
",",
"\"OnStrikethrough\"",
",",
"\"FormatTextStrikethrough\"",
",",
"_",
"(",
"\"Strikethrough\"",
")",
")",
",",
"(",
"wx",
".",
"FONTFLAG_MASK",
",",
"\"OnFreeze\"",
",",
"\"Freeze\"",
",",
"_",
"(",
"\"Freeze\"",
")",
")",
",",
"(",
"wx",
".",
"FONTFLAG_NOT_ANTIALIASED",
",",
"\"OnLock\"",
",",
"\"Lock\"",
",",
"_",
"(",
"\"Lock cell\"",
")",
")",
",",
"(",
"wx",
".",
"FONTFAMILY_DECORATIVE",
",",
"\"OnMarkup\"",
",",
"\"Markup\"",
",",
"_",
"(",
"\"Markup\"",
")",
")",
",",
"]",
"for",
"__id",
",",
"method",
",",
"iconname",
",",
"helpstring",
"in",
"font_face_buttons",
":",
"bmp",
"=",
"icons",
"[",
"iconname",
"]",
"self",
".",
"AddCheckTool",
"(",
"__id",
",",
"iconname",
",",
"bmp",
",",
"bmp",
",",
"short_help_string",
"=",
"helpstring",
")",
"self",
".",
"Bind",
"(",
"wx",
".",
"EVT_TOOL",
",",
"getattr",
"(",
"self",
",",
"method",
")",
",",
"id",
"=",
"__id",
")"
] | Creates font face buttons | [
"Creates",
"font",
"face",
"buttons"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/_toolbars.py#L592-L612 |
250,103 | manns/pyspread | pyspread/src/gui/_toolbars.py | AttributesToolbar._create_textrotation_button | def _create_textrotation_button(self):
"""Create text rotation toggle button"""
iconnames = ["TextRotate270", "TextRotate0", "TextRotate90",
"TextRotate180"]
bmplist = [icons[iconname] for iconname in iconnames]
self.rotation_tb = _widgets.BitmapToggleButton(self, bmplist)
self.rotation_tb.SetToolTipString(_(u"Cell text rotation"))
self.Bind(wx.EVT_BUTTON, self.OnRotate, self.rotation_tb)
self.AddControl(self.rotation_tb) | python | def _create_textrotation_button(self):
iconnames = ["TextRotate270", "TextRotate0", "TextRotate90",
"TextRotate180"]
bmplist = [icons[iconname] for iconname in iconnames]
self.rotation_tb = _widgets.BitmapToggleButton(self, bmplist)
self.rotation_tb.SetToolTipString(_(u"Cell text rotation"))
self.Bind(wx.EVT_BUTTON, self.OnRotate, self.rotation_tb)
self.AddControl(self.rotation_tb) | [
"def",
"_create_textrotation_button",
"(",
"self",
")",
":",
"iconnames",
"=",
"[",
"\"TextRotate270\"",
",",
"\"TextRotate0\"",
",",
"\"TextRotate90\"",
",",
"\"TextRotate180\"",
"]",
"bmplist",
"=",
"[",
"icons",
"[",
"iconname",
"]",
"for",
"iconname",
"in",
"iconnames",
"]",
"self",
".",
"rotation_tb",
"=",
"_widgets",
".",
"BitmapToggleButton",
"(",
"self",
",",
"bmplist",
")",
"self",
".",
"rotation_tb",
".",
"SetToolTipString",
"(",
"_",
"(",
"u\"Cell text rotation\"",
")",
")",
"self",
".",
"Bind",
"(",
"wx",
".",
"EVT_BUTTON",
",",
"self",
".",
"OnRotate",
",",
"self",
".",
"rotation_tb",
")",
"self",
".",
"AddControl",
"(",
"self",
".",
"rotation_tb",
")"
] | Create text rotation toggle button | [
"Create",
"text",
"rotation",
"toggle",
"button"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/_toolbars.py#L614-L624 |
250,104 | manns/pyspread | pyspread/src/gui/_toolbars.py | AttributesToolbar._create_justification_button | def _create_justification_button(self):
"""Creates horizontal justification button"""
iconnames = ["JustifyLeft", "JustifyCenter", "JustifyRight"]
bmplist = [icons[iconname] for iconname in iconnames]
self.justify_tb = _widgets.BitmapToggleButton(self, bmplist)
self.justify_tb.SetToolTipString(_(u"Justification"))
self.Bind(wx.EVT_BUTTON, self.OnJustification, self.justify_tb)
self.AddControl(self.justify_tb) | python | def _create_justification_button(self):
iconnames = ["JustifyLeft", "JustifyCenter", "JustifyRight"]
bmplist = [icons[iconname] for iconname in iconnames]
self.justify_tb = _widgets.BitmapToggleButton(self, bmplist)
self.justify_tb.SetToolTipString(_(u"Justification"))
self.Bind(wx.EVT_BUTTON, self.OnJustification, self.justify_tb)
self.AddControl(self.justify_tb) | [
"def",
"_create_justification_button",
"(",
"self",
")",
":",
"iconnames",
"=",
"[",
"\"JustifyLeft\"",
",",
"\"JustifyCenter\"",
",",
"\"JustifyRight\"",
"]",
"bmplist",
"=",
"[",
"icons",
"[",
"iconname",
"]",
"for",
"iconname",
"in",
"iconnames",
"]",
"self",
".",
"justify_tb",
"=",
"_widgets",
".",
"BitmapToggleButton",
"(",
"self",
",",
"bmplist",
")",
"self",
".",
"justify_tb",
".",
"SetToolTipString",
"(",
"_",
"(",
"u\"Justification\"",
")",
")",
"self",
".",
"Bind",
"(",
"wx",
".",
"EVT_BUTTON",
",",
"self",
".",
"OnJustification",
",",
"self",
".",
"justify_tb",
")",
"self",
".",
"AddControl",
"(",
"self",
".",
"justify_tb",
")"
] | Creates horizontal justification button | [
"Creates",
"horizontal",
"justification",
"button"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/_toolbars.py#L626-L634 |
250,105 | manns/pyspread | pyspread/src/gui/_toolbars.py | AttributesToolbar._create_alignment_button | def _create_alignment_button(self):
"""Creates vertical alignment button"""
iconnames = ["AlignTop", "AlignCenter", "AlignBottom"]
bmplist = [icons[iconname] for iconname in iconnames]
self.alignment_tb = _widgets.BitmapToggleButton(self, bmplist)
self.alignment_tb.SetToolTipString(_(u"Alignment"))
self.Bind(wx.EVT_BUTTON, self.OnAlignment, self.alignment_tb)
self.AddControl(self.alignment_tb) | python | def _create_alignment_button(self):
iconnames = ["AlignTop", "AlignCenter", "AlignBottom"]
bmplist = [icons[iconname] for iconname in iconnames]
self.alignment_tb = _widgets.BitmapToggleButton(self, bmplist)
self.alignment_tb.SetToolTipString(_(u"Alignment"))
self.Bind(wx.EVT_BUTTON, self.OnAlignment, self.alignment_tb)
self.AddControl(self.alignment_tb) | [
"def",
"_create_alignment_button",
"(",
"self",
")",
":",
"iconnames",
"=",
"[",
"\"AlignTop\"",
",",
"\"AlignCenter\"",
",",
"\"AlignBottom\"",
"]",
"bmplist",
"=",
"[",
"icons",
"[",
"iconname",
"]",
"for",
"iconname",
"in",
"iconnames",
"]",
"self",
".",
"alignment_tb",
"=",
"_widgets",
".",
"BitmapToggleButton",
"(",
"self",
",",
"bmplist",
")",
"self",
".",
"alignment_tb",
".",
"SetToolTipString",
"(",
"_",
"(",
"u\"Alignment\"",
")",
")",
"self",
".",
"Bind",
"(",
"wx",
".",
"EVT_BUTTON",
",",
"self",
".",
"OnAlignment",
",",
"self",
".",
"alignment_tb",
")",
"self",
".",
"AddControl",
"(",
"self",
".",
"alignment_tb",
")"
] | Creates vertical alignment button | [
"Creates",
"vertical",
"alignment",
"button"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/_toolbars.py#L636-L645 |
250,106 | manns/pyspread | pyspread/src/gui/_toolbars.py | AttributesToolbar._create_borderchoice_combo | def _create_borderchoice_combo(self):
"""Create border choice combo box"""
choices = [c[0] for c in self.border_toggles]
self.borderchoice_combo = \
_widgets.BorderEditChoice(self, choices=choices,
style=wx.CB_READONLY, size=(50, -1))
self.borderchoice_combo.SetToolTipString(
_(u"Choose borders for which attributes are changed"))
self.borderstate = self.border_toggles[0][0]
self.AddControl(self.borderchoice_combo)
self.Bind(wx.EVT_COMBOBOX, self.OnBorderChoice,
self.borderchoice_combo)
self.borderchoice_combo.SetValue("AllBorders") | python | def _create_borderchoice_combo(self):
choices = [c[0] for c in self.border_toggles]
self.borderchoice_combo = \
_widgets.BorderEditChoice(self, choices=choices,
style=wx.CB_READONLY, size=(50, -1))
self.borderchoice_combo.SetToolTipString(
_(u"Choose borders for which attributes are changed"))
self.borderstate = self.border_toggles[0][0]
self.AddControl(self.borderchoice_combo)
self.Bind(wx.EVT_COMBOBOX, self.OnBorderChoice,
self.borderchoice_combo)
self.borderchoice_combo.SetValue("AllBorders") | [
"def",
"_create_borderchoice_combo",
"(",
"self",
")",
":",
"choices",
"=",
"[",
"c",
"[",
"0",
"]",
"for",
"c",
"in",
"self",
".",
"border_toggles",
"]",
"self",
".",
"borderchoice_combo",
"=",
"_widgets",
".",
"BorderEditChoice",
"(",
"self",
",",
"choices",
"=",
"choices",
",",
"style",
"=",
"wx",
".",
"CB_READONLY",
",",
"size",
"=",
"(",
"50",
",",
"-",
"1",
")",
")",
"self",
".",
"borderchoice_combo",
".",
"SetToolTipString",
"(",
"_",
"(",
"u\"Choose borders for which attributes are changed\"",
")",
")",
"self",
".",
"borderstate",
"=",
"self",
".",
"border_toggles",
"[",
"0",
"]",
"[",
"0",
"]",
"self",
".",
"AddControl",
"(",
"self",
".",
"borderchoice_combo",
")",
"self",
".",
"Bind",
"(",
"wx",
".",
"EVT_COMBOBOX",
",",
"self",
".",
"OnBorderChoice",
",",
"self",
".",
"borderchoice_combo",
")",
"self",
".",
"borderchoice_combo",
".",
"SetValue",
"(",
"\"AllBorders\"",
")"
] | Create border choice combo box | [
"Create",
"border",
"choice",
"combo",
"box"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/_toolbars.py#L647-L665 |
250,107 | manns/pyspread | pyspread/src/gui/_toolbars.py | AttributesToolbar._create_penwidth_combo | def _create_penwidth_combo(self):
"""Create pen width combo box"""
choices = map(unicode, xrange(12))
self.pen_width_combo = \
_widgets.PenWidthComboBox(self, choices=choices,
style=wx.CB_READONLY, size=(50, -1))
self.pen_width_combo.SetToolTipString(_(u"Border width"))
self.AddControl(self.pen_width_combo)
self.Bind(wx.EVT_COMBOBOX, self.OnLineWidth, self.pen_width_combo) | python | def _create_penwidth_combo(self):
choices = map(unicode, xrange(12))
self.pen_width_combo = \
_widgets.PenWidthComboBox(self, choices=choices,
style=wx.CB_READONLY, size=(50, -1))
self.pen_width_combo.SetToolTipString(_(u"Border width"))
self.AddControl(self.pen_width_combo)
self.Bind(wx.EVT_COMBOBOX, self.OnLineWidth, self.pen_width_combo) | [
"def",
"_create_penwidth_combo",
"(",
"self",
")",
":",
"choices",
"=",
"map",
"(",
"unicode",
",",
"xrange",
"(",
"12",
")",
")",
"self",
".",
"pen_width_combo",
"=",
"_widgets",
".",
"PenWidthComboBox",
"(",
"self",
",",
"choices",
"=",
"choices",
",",
"style",
"=",
"wx",
".",
"CB_READONLY",
",",
"size",
"=",
"(",
"50",
",",
"-",
"1",
")",
")",
"self",
".",
"pen_width_combo",
".",
"SetToolTipString",
"(",
"_",
"(",
"u\"Border width\"",
")",
")",
"self",
".",
"AddControl",
"(",
"self",
".",
"pen_width_combo",
")",
"self",
".",
"Bind",
"(",
"wx",
".",
"EVT_COMBOBOX",
",",
"self",
".",
"OnLineWidth",
",",
"self",
".",
"pen_width_combo",
")"
] | Create pen width combo box | [
"Create",
"pen",
"width",
"combo",
"box"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/_toolbars.py#L667-L677 |
250,108 | manns/pyspread | pyspread/src/gui/_toolbars.py | AttributesToolbar._create_color_buttons | def _create_color_buttons(self):
"""Create color choice buttons"""
button_size = (30, 30)
button_style = wx.NO_BORDER
try:
self.linecolor_choice = \
csel.ColourSelect(self, -1, unichr(0x2500), (0, 0, 0),
size=button_size, style=button_style)
except UnicodeEncodeError:
# ANSI wxPython installed
self.linecolor_choice = \
csel.ColourSelect(self, -1, "-", (0, 0, 0),
size=button_size, style=button_style)
self.bgcolor_choice = \
csel.ColourSelect(self, -1, "", (255, 255, 255),
size=button_size, style=button_style)
self.textcolor_choice = \
csel.ColourSelect(self, -1, "A", (0, 0, 0),
size=button_size, style=button_style)
self.linecolor_choice.SetToolTipString(_(u"Border line color"))
self.bgcolor_choice.SetToolTipString(_(u"Cell background"))
self.textcolor_choice.SetToolTipString(_(u"Text color"))
self.AddControl(self.linecolor_choice)
self.AddControl(self.bgcolor_choice)
self.AddControl(self.textcolor_choice)
self.linecolor_choice.Bind(csel.EVT_COLOURSELECT, self.OnLineColor)
self.bgcolor_choice.Bind(csel.EVT_COLOURSELECT, self.OnBGColor)
self.textcolor_choice.Bind(csel.EVT_COLOURSELECT, self.OnTextColor) | python | def _create_color_buttons(self):
button_size = (30, 30)
button_style = wx.NO_BORDER
try:
self.linecolor_choice = \
csel.ColourSelect(self, -1, unichr(0x2500), (0, 0, 0),
size=button_size, style=button_style)
except UnicodeEncodeError:
# ANSI wxPython installed
self.linecolor_choice = \
csel.ColourSelect(self, -1, "-", (0, 0, 0),
size=button_size, style=button_style)
self.bgcolor_choice = \
csel.ColourSelect(self, -1, "", (255, 255, 255),
size=button_size, style=button_style)
self.textcolor_choice = \
csel.ColourSelect(self, -1, "A", (0, 0, 0),
size=button_size, style=button_style)
self.linecolor_choice.SetToolTipString(_(u"Border line color"))
self.bgcolor_choice.SetToolTipString(_(u"Cell background"))
self.textcolor_choice.SetToolTipString(_(u"Text color"))
self.AddControl(self.linecolor_choice)
self.AddControl(self.bgcolor_choice)
self.AddControl(self.textcolor_choice)
self.linecolor_choice.Bind(csel.EVT_COLOURSELECT, self.OnLineColor)
self.bgcolor_choice.Bind(csel.EVT_COLOURSELECT, self.OnBGColor)
self.textcolor_choice.Bind(csel.EVT_COLOURSELECT, self.OnTextColor) | [
"def",
"_create_color_buttons",
"(",
"self",
")",
":",
"button_size",
"=",
"(",
"30",
",",
"30",
")",
"button_style",
"=",
"wx",
".",
"NO_BORDER",
"try",
":",
"self",
".",
"linecolor_choice",
"=",
"csel",
".",
"ColourSelect",
"(",
"self",
",",
"-",
"1",
",",
"unichr",
"(",
"0x2500",
")",
",",
"(",
"0",
",",
"0",
",",
"0",
")",
",",
"size",
"=",
"button_size",
",",
"style",
"=",
"button_style",
")",
"except",
"UnicodeEncodeError",
":",
"# ANSI wxPython installed",
"self",
".",
"linecolor_choice",
"=",
"csel",
".",
"ColourSelect",
"(",
"self",
",",
"-",
"1",
",",
"\"-\"",
",",
"(",
"0",
",",
"0",
",",
"0",
")",
",",
"size",
"=",
"button_size",
",",
"style",
"=",
"button_style",
")",
"self",
".",
"bgcolor_choice",
"=",
"csel",
".",
"ColourSelect",
"(",
"self",
",",
"-",
"1",
",",
"\"\"",
",",
"(",
"255",
",",
"255",
",",
"255",
")",
",",
"size",
"=",
"button_size",
",",
"style",
"=",
"button_style",
")",
"self",
".",
"textcolor_choice",
"=",
"csel",
".",
"ColourSelect",
"(",
"self",
",",
"-",
"1",
",",
"\"A\"",
",",
"(",
"0",
",",
"0",
",",
"0",
")",
",",
"size",
"=",
"button_size",
",",
"style",
"=",
"button_style",
")",
"self",
".",
"linecolor_choice",
".",
"SetToolTipString",
"(",
"_",
"(",
"u\"Border line color\"",
")",
")",
"self",
".",
"bgcolor_choice",
".",
"SetToolTipString",
"(",
"_",
"(",
"u\"Cell background\"",
")",
")",
"self",
".",
"textcolor_choice",
".",
"SetToolTipString",
"(",
"_",
"(",
"u\"Text color\"",
")",
")",
"self",
".",
"AddControl",
"(",
"self",
".",
"linecolor_choice",
")",
"self",
".",
"AddControl",
"(",
"self",
".",
"bgcolor_choice",
")",
"self",
".",
"AddControl",
"(",
"self",
".",
"textcolor_choice",
")",
"self",
".",
"linecolor_choice",
".",
"Bind",
"(",
"csel",
".",
"EVT_COLOURSELECT",
",",
"self",
".",
"OnLineColor",
")",
"self",
".",
"bgcolor_choice",
".",
"Bind",
"(",
"csel",
".",
"EVT_COLOURSELECT",
",",
"self",
".",
"OnBGColor",
")",
"self",
".",
"textcolor_choice",
".",
"Bind",
"(",
"csel",
".",
"EVT_COLOURSELECT",
",",
"self",
".",
"OnTextColor",
")"
] | Create color choice buttons | [
"Create",
"color",
"choice",
"buttons"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/_toolbars.py#L679-L712 |
250,109 | manns/pyspread | pyspread/src/gui/_toolbars.py | AttributesToolbar._create_merge_button | def _create_merge_button(self):
"""Create merge button"""
bmp = icons["Merge"]
self.mergetool_id = wx.NewId()
self.AddCheckTool(self.mergetool_id, "Merge", bmp, bmp,
short_help_string=_("Merge cells"))
self.Bind(wx.EVT_TOOL, self.OnMerge, id=self.mergetool_id) | python | def _create_merge_button(self):
bmp = icons["Merge"]
self.mergetool_id = wx.NewId()
self.AddCheckTool(self.mergetool_id, "Merge", bmp, bmp,
short_help_string=_("Merge cells"))
self.Bind(wx.EVT_TOOL, self.OnMerge, id=self.mergetool_id) | [
"def",
"_create_merge_button",
"(",
"self",
")",
":",
"bmp",
"=",
"icons",
"[",
"\"Merge\"",
"]",
"self",
".",
"mergetool_id",
"=",
"wx",
".",
"NewId",
"(",
")",
"self",
".",
"AddCheckTool",
"(",
"self",
".",
"mergetool_id",
",",
"\"Merge\"",
",",
"bmp",
",",
"bmp",
",",
"short_help_string",
"=",
"_",
"(",
"\"Merge cells\"",
")",
")",
"self",
".",
"Bind",
"(",
"wx",
".",
"EVT_TOOL",
",",
"self",
".",
"OnMerge",
",",
"id",
"=",
"self",
".",
"mergetool_id",
")"
] | Create merge button | [
"Create",
"merge",
"button"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/_toolbars.py#L714-L721 |
250,110 | manns/pyspread | pyspread/src/gui/_toolbars.py | AttributesToolbar._update_font | def _update_font(self, textfont):
"""Updates text font widget
Parameters
----------
textfont: String
\tFont name
"""
try:
fontface_id = self.fonts.index(textfont)
except ValueError:
fontface_id = 0
self.font_choice_combo.Select(fontface_id) | python | def _update_font(self, textfont):
try:
fontface_id = self.fonts.index(textfont)
except ValueError:
fontface_id = 0
self.font_choice_combo.Select(fontface_id) | [
"def",
"_update_font",
"(",
"self",
",",
"textfont",
")",
":",
"try",
":",
"fontface_id",
"=",
"self",
".",
"fonts",
".",
"index",
"(",
"textfont",
")",
"except",
"ValueError",
":",
"fontface_id",
"=",
"0",
"self",
".",
"font_choice_combo",
".",
"Select",
"(",
"fontface_id",
")"
] | Updates text font widget
Parameters
----------
textfont: String
\tFont name | [
"Updates",
"text",
"font",
"widget"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/_toolbars.py#L726-L742 |
250,111 | manns/pyspread | pyspread/src/gui/_toolbars.py | AttributesToolbar._update_font_weight | def _update_font_weight(self, font_weight):
"""Updates font weight widget
Parameters
----------
font_weight: Integer
\tButton down iif font_weight == wx.FONTWEIGHT_BOLD
"""
toggle_state = font_weight & wx.FONTWEIGHT_BOLD == wx.FONTWEIGHT_BOLD
self.ToggleTool(wx.FONTFLAG_BOLD, toggle_state) | python | def _update_font_weight(self, font_weight):
toggle_state = font_weight & wx.FONTWEIGHT_BOLD == wx.FONTWEIGHT_BOLD
self.ToggleTool(wx.FONTFLAG_BOLD, toggle_state) | [
"def",
"_update_font_weight",
"(",
"self",
",",
"font_weight",
")",
":",
"toggle_state",
"=",
"font_weight",
"&",
"wx",
".",
"FONTWEIGHT_BOLD",
"==",
"wx",
".",
"FONTWEIGHT_BOLD",
"self",
".",
"ToggleTool",
"(",
"wx",
".",
"FONTFLAG_BOLD",
",",
"toggle_state",
")"
] | Updates font weight widget
Parameters
----------
font_weight: Integer
\tButton down iif font_weight == wx.FONTWEIGHT_BOLD | [
"Updates",
"font",
"weight",
"widget"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/_toolbars.py#L757-L770 |
250,112 | manns/pyspread | pyspread/src/gui/_toolbars.py | AttributesToolbar._update_font_style | def _update_font_style(self, font_style):
"""Updates font style widget
Parameters
----------
font_style: Integer
\tButton down iif font_style == wx.FONTSTYLE_ITALIC
"""
toggle_state = font_style & wx.FONTSTYLE_ITALIC == wx.FONTSTYLE_ITALIC
self.ToggleTool(wx.FONTFLAG_ITALIC, toggle_state) | python | def _update_font_style(self, font_style):
toggle_state = font_style & wx.FONTSTYLE_ITALIC == wx.FONTSTYLE_ITALIC
self.ToggleTool(wx.FONTFLAG_ITALIC, toggle_state) | [
"def",
"_update_font_style",
"(",
"self",
",",
"font_style",
")",
":",
"toggle_state",
"=",
"font_style",
"&",
"wx",
".",
"FONTSTYLE_ITALIC",
"==",
"wx",
".",
"FONTSTYLE_ITALIC",
"self",
".",
"ToggleTool",
"(",
"wx",
".",
"FONTFLAG_ITALIC",
",",
"toggle_state",
")"
] | Updates font style widget
Parameters
----------
font_style: Integer
\tButton down iif font_style == wx.FONTSTYLE_ITALIC | [
"Updates",
"font",
"style",
"widget"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/_toolbars.py#L772-L785 |
250,113 | manns/pyspread | pyspread/src/gui/_toolbars.py | AttributesToolbar._update_frozencell | def _update_frozencell(self, frozen):
"""Updates frozen cell widget
Parameters
----------
frozen: Bool or string
\tUntoggled iif False
"""
toggle_state = frozen is not False
self.ToggleTool(wx.FONTFLAG_MASK, toggle_state) | python | def _update_frozencell(self, frozen):
toggle_state = frozen is not False
self.ToggleTool(wx.FONTFLAG_MASK, toggle_state) | [
"def",
"_update_frozencell",
"(",
"self",
",",
"frozen",
")",
":",
"toggle_state",
"=",
"frozen",
"is",
"not",
"False",
"self",
".",
"ToggleTool",
"(",
"wx",
".",
"FONTFLAG_MASK",
",",
"toggle_state",
")"
] | Updates frozen cell widget
Parameters
----------
frozen: Bool or string
\tUntoggled iif False | [
"Updates",
"frozen",
"cell",
"widget"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/_toolbars.py#L787-L800 |
250,114 | manns/pyspread | pyspread/src/gui/_toolbars.py | AttributesToolbar._update_textrotation | def _update_textrotation(self, angle):
"""Updates text rotation toggle button"""
states = {0: 0, -90: 1, 180: 2, 90: 3}
try:
self.rotation_tb.state = states[round(angle)]
except KeyError:
self.rotation_tb.state = 0
self.rotation_tb.toggle(None)
self.rotation_tb.Refresh() | python | def _update_textrotation(self, angle):
states = {0: 0, -90: 1, 180: 2, 90: 3}
try:
self.rotation_tb.state = states[round(angle)]
except KeyError:
self.rotation_tb.state = 0
self.rotation_tb.toggle(None)
self.rotation_tb.Refresh() | [
"def",
"_update_textrotation",
"(",
"self",
",",
"angle",
")",
":",
"states",
"=",
"{",
"0",
":",
"0",
",",
"-",
"90",
":",
"1",
",",
"180",
":",
"2",
",",
"90",
":",
"3",
"}",
"try",
":",
"self",
".",
"rotation_tb",
".",
"state",
"=",
"states",
"[",
"round",
"(",
"angle",
")",
"]",
"except",
"KeyError",
":",
"self",
".",
"rotation_tb",
".",
"state",
"=",
"0",
"self",
".",
"rotation_tb",
".",
"toggle",
"(",
"None",
")",
"self",
".",
"rotation_tb",
".",
"Refresh",
"(",
")"
] | Updates text rotation toggle button | [
"Updates",
"text",
"rotation",
"toggle",
"button"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/_toolbars.py#L854-L865 |
250,115 | manns/pyspread | pyspread/src/gui/_toolbars.py | AttributesToolbar._update_justification | def _update_justification(self, justification):
"""Updates horizontal text justification button
Parameters
----------
justification: String in ["left", "center", "right"]
\tSwitches button to untoggled if False and toggled if True
"""
states = {"left": 2, "center": 0, "right": 1}
self.justify_tb.state = states[justification]
self.justify_tb.toggle(None)
self.justify_tb.Refresh() | python | def _update_justification(self, justification):
states = {"left": 2, "center": 0, "right": 1}
self.justify_tb.state = states[justification]
self.justify_tb.toggle(None)
self.justify_tb.Refresh() | [
"def",
"_update_justification",
"(",
"self",
",",
"justification",
")",
":",
"states",
"=",
"{",
"\"left\"",
":",
"2",
",",
"\"center\"",
":",
"0",
",",
"\"right\"",
":",
"1",
"}",
"self",
".",
"justify_tb",
".",
"state",
"=",
"states",
"[",
"justification",
"]",
"self",
".",
"justify_tb",
".",
"toggle",
"(",
"None",
")",
"self",
".",
"justify_tb",
".",
"Refresh",
"(",
")"
] | Updates horizontal text justification button
Parameters
----------
justification: String in ["left", "center", "right"]
\tSwitches button to untoggled if False and toggled if True | [
"Updates",
"horizontal",
"text",
"justification",
"button"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/_toolbars.py#L867-L883 |
250,116 | manns/pyspread | pyspread/src/gui/_toolbars.py | AttributesToolbar._update_alignment | def _update_alignment(self, alignment):
"""Updates vertical text alignment button
Parameters
----------
alignment: String in ["top", "middle", "right"]
\tSwitches button to untoggled if False and toggled if True
"""
states = {"top": 2, "middle": 0, "bottom": 1}
self.alignment_tb.state = states[alignment]
self.alignment_tb.toggle(None)
self.alignment_tb.Refresh() | python | def _update_alignment(self, alignment):
states = {"top": 2, "middle": 0, "bottom": 1}
self.alignment_tb.state = states[alignment]
self.alignment_tb.toggle(None)
self.alignment_tb.Refresh() | [
"def",
"_update_alignment",
"(",
"self",
",",
"alignment",
")",
":",
"states",
"=",
"{",
"\"top\"",
":",
"2",
",",
"\"middle\"",
":",
"0",
",",
"\"bottom\"",
":",
"1",
"}",
"self",
".",
"alignment_tb",
".",
"state",
"=",
"states",
"[",
"alignment",
"]",
"self",
".",
"alignment_tb",
".",
"toggle",
"(",
"None",
")",
"self",
".",
"alignment_tb",
".",
"Refresh",
"(",
")"
] | Updates vertical text alignment button
Parameters
----------
alignment: String in ["top", "middle", "right"]
\tSwitches button to untoggled if False and toggled if True | [
"Updates",
"vertical",
"text",
"alignment",
"button"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/_toolbars.py#L885-L901 |
250,117 | manns/pyspread | pyspread/src/gui/_toolbars.py | AttributesToolbar._update_fontcolor | def _update_fontcolor(self, fontcolor):
"""Updates text font color button
Parameters
----------
fontcolor: Integer
\tText color in integer RGB format
"""
textcolor = wx.SystemSettings_GetColour(wx.SYS_COLOUR_WINDOWTEXT)
textcolor.SetRGB(fontcolor)
self.textcolor_choice.SetColour(textcolor) | python | def _update_fontcolor(self, fontcolor):
textcolor = wx.SystemSettings_GetColour(wx.SYS_COLOUR_WINDOWTEXT)
textcolor.SetRGB(fontcolor)
self.textcolor_choice.SetColour(textcolor) | [
"def",
"_update_fontcolor",
"(",
"self",
",",
"fontcolor",
")",
":",
"textcolor",
"=",
"wx",
".",
"SystemSettings_GetColour",
"(",
"wx",
".",
"SYS_COLOUR_WINDOWTEXT",
")",
"textcolor",
".",
"SetRGB",
"(",
"fontcolor",
")",
"self",
".",
"textcolor_choice",
".",
"SetColour",
"(",
"textcolor",
")"
] | Updates text font color button
Parameters
----------
fontcolor: Integer
\tText color in integer RGB format | [
"Updates",
"text",
"font",
"color",
"button"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/_toolbars.py#L903-L917 |
250,118 | manns/pyspread | pyspread/src/gui/_toolbars.py | AttributesToolbar.OnBorderChoice | def OnBorderChoice(self, event):
"""Change the borders that are affected by color and width changes"""
choicelist = event.GetEventObject().GetItems()
self.borderstate = choicelist[event.GetInt()] | python | def OnBorderChoice(self, event):
choicelist = event.GetEventObject().GetItems()
self.borderstate = choicelist[event.GetInt()] | [
"def",
"OnBorderChoice",
"(",
"self",
",",
"event",
")",
":",
"choicelist",
"=",
"event",
".",
"GetEventObject",
"(",
")",
".",
"GetItems",
"(",
")",
"self",
".",
"borderstate",
"=",
"choicelist",
"[",
"event",
".",
"GetInt",
"(",
")",
"]"
] | Change the borders that are affected by color and width changes | [
"Change",
"the",
"borders",
"that",
"are",
"affected",
"by",
"color",
"and",
"width",
"changes"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/_toolbars.py#L975-L979 |
250,119 | manns/pyspread | pyspread/src/gui/_toolbars.py | AttributesToolbar.OnLineColor | def OnLineColor(self, event):
"""Line color choice event handler"""
color = event.GetValue().GetRGB()
borders = self.bordermap[self.borderstate]
post_command_event(self, self.BorderColorMsg, color=color,
borders=borders) | python | def OnLineColor(self, event):
color = event.GetValue().GetRGB()
borders = self.bordermap[self.borderstate]
post_command_event(self, self.BorderColorMsg, color=color,
borders=borders) | [
"def",
"OnLineColor",
"(",
"self",
",",
"event",
")",
":",
"color",
"=",
"event",
".",
"GetValue",
"(",
")",
".",
"GetRGB",
"(",
")",
"borders",
"=",
"self",
".",
"bordermap",
"[",
"self",
".",
"borderstate",
"]",
"post_command_event",
"(",
"self",
",",
"self",
".",
"BorderColorMsg",
",",
"color",
"=",
"color",
",",
"borders",
"=",
"borders",
")"
] | Line color choice event handler | [
"Line",
"color",
"choice",
"event",
"handler"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/_toolbars.py#L981-L988 |
250,120 | manns/pyspread | pyspread/src/gui/_toolbars.py | AttributesToolbar.OnLineWidth | def OnLineWidth(self, event):
"""Line width choice event handler"""
linewidth_combobox = event.GetEventObject()
idx = event.GetInt()
width = int(linewidth_combobox.GetString(idx))
borders = self.bordermap[self.borderstate]
post_command_event(self, self.BorderWidthMsg, width=width,
borders=borders) | python | def OnLineWidth(self, event):
linewidth_combobox = event.GetEventObject()
idx = event.GetInt()
width = int(linewidth_combobox.GetString(idx))
borders = self.bordermap[self.borderstate]
post_command_event(self, self.BorderWidthMsg, width=width,
borders=borders) | [
"def",
"OnLineWidth",
"(",
"self",
",",
"event",
")",
":",
"linewidth_combobox",
"=",
"event",
".",
"GetEventObject",
"(",
")",
"idx",
"=",
"event",
".",
"GetInt",
"(",
")",
"width",
"=",
"int",
"(",
"linewidth_combobox",
".",
"GetString",
"(",
"idx",
")",
")",
"borders",
"=",
"self",
".",
"bordermap",
"[",
"self",
".",
"borderstate",
"]",
"post_command_event",
"(",
"self",
",",
"self",
".",
"BorderWidthMsg",
",",
"width",
"=",
"width",
",",
"borders",
"=",
"borders",
")"
] | Line width choice event handler | [
"Line",
"width",
"choice",
"event",
"handler"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/_toolbars.py#L990-L999 |
250,121 | manns/pyspread | pyspread/src/gui/_toolbars.py | AttributesToolbar.OnBGColor | def OnBGColor(self, event):
"""Background color choice event handler"""
color = event.GetValue().GetRGB()
post_command_event(self, self.BackgroundColorMsg, color=color) | python | def OnBGColor(self, event):
color = event.GetValue().GetRGB()
post_command_event(self, self.BackgroundColorMsg, color=color) | [
"def",
"OnBGColor",
"(",
"self",
",",
"event",
")",
":",
"color",
"=",
"event",
".",
"GetValue",
"(",
")",
".",
"GetRGB",
"(",
")",
"post_command_event",
"(",
"self",
",",
"self",
".",
"BackgroundColorMsg",
",",
"color",
"=",
"color",
")"
] | Background color choice event handler | [
"Background",
"color",
"choice",
"event",
"handler"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/_toolbars.py#L1001-L1006 |
250,122 | manns/pyspread | pyspread/src/gui/_toolbars.py | AttributesToolbar.OnTextColor | def OnTextColor(self, event):
"""Text color choice event handler"""
color = event.GetValue().GetRGB()
post_command_event(self, self.TextColorMsg, color=color) | python | def OnTextColor(self, event):
color = event.GetValue().GetRGB()
post_command_event(self, self.TextColorMsg, color=color) | [
"def",
"OnTextColor",
"(",
"self",
",",
"event",
")",
":",
"color",
"=",
"event",
".",
"GetValue",
"(",
")",
".",
"GetRGB",
"(",
")",
"post_command_event",
"(",
"self",
",",
"self",
".",
"TextColorMsg",
",",
"color",
"=",
"color",
")"
] | Text color choice event handler | [
"Text",
"color",
"choice",
"event",
"handler"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/_toolbars.py#L1008-L1013 |
250,123 | manns/pyspread | pyspread/src/gui/_toolbars.py | AttributesToolbar.OnTextFont | def OnTextFont(self, event):
"""Text font choice event handler"""
fontchoice_combobox = event.GetEventObject()
idx = event.GetInt()
try:
font_string = fontchoice_combobox.GetString(idx)
except AttributeError:
font_string = event.GetString()
post_command_event(self, self.FontMsg, font=font_string) | python | def OnTextFont(self, event):
fontchoice_combobox = event.GetEventObject()
idx = event.GetInt()
try:
font_string = fontchoice_combobox.GetString(idx)
except AttributeError:
font_string = event.GetString()
post_command_event(self, self.FontMsg, font=font_string) | [
"def",
"OnTextFont",
"(",
"self",
",",
"event",
")",
":",
"fontchoice_combobox",
"=",
"event",
".",
"GetEventObject",
"(",
")",
"idx",
"=",
"event",
".",
"GetInt",
"(",
")",
"try",
":",
"font_string",
"=",
"fontchoice_combobox",
".",
"GetString",
"(",
"idx",
")",
"except",
"AttributeError",
":",
"font_string",
"=",
"event",
".",
"GetString",
"(",
")",
"post_command_event",
"(",
"self",
",",
"self",
".",
"FontMsg",
",",
"font",
"=",
"font_string",
")"
] | Text font choice event handler | [
"Text",
"font",
"choice",
"event",
"handler"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/_toolbars.py#L1015-L1026 |
250,124 | manns/pyspread | pyspread/src/gui/_toolbars.py | AttributesToolbar.OnTextSize | def OnTextSize(self, event):
"""Text size combo text event handler"""
try:
size = int(event.GetString())
except Exception:
size = get_default_font().GetPointSize()
post_command_event(self, self.FontSizeMsg, size=size) | python | def OnTextSize(self, event):
try:
size = int(event.GetString())
except Exception:
size = get_default_font().GetPointSize()
post_command_event(self, self.FontSizeMsg, size=size) | [
"def",
"OnTextSize",
"(",
"self",
",",
"event",
")",
":",
"try",
":",
"size",
"=",
"int",
"(",
"event",
".",
"GetString",
"(",
")",
")",
"except",
"Exception",
":",
"size",
"=",
"get_default_font",
"(",
")",
".",
"GetPointSize",
"(",
")",
"post_command_event",
"(",
"self",
",",
"self",
".",
"FontSizeMsg",
",",
"size",
"=",
"size",
")"
] | Text size combo text event handler | [
"Text",
"size",
"combo",
"text",
"event",
"handler"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/_toolbars.py#L1028-L1037 |
250,125 | manns/pyspread | pyspread/src/actions/_grid_cell_actions.py | CellActions.set_code | def set_code(self, key, code):
"""Sets code of cell key, marks grid as changed"""
old_code = self.grid.code_array(key)
try:
old_code = unicode(old_code, encoding="utf-8")
except TypeError:
pass
if code == old_code:
return
if not (old_code is None and not code) and code != old_code:
# Mark content as changed
post_command_event(self.main_window, self.ContentChangedMsg)
# Set cell code
self.grid.code_array.__setitem__(key, code) | python | def set_code(self, key, code):
old_code = self.grid.code_array(key)
try:
old_code = unicode(old_code, encoding="utf-8")
except TypeError:
pass
if code == old_code:
return
if not (old_code is None and not code) and code != old_code:
# Mark content as changed
post_command_event(self.main_window, self.ContentChangedMsg)
# Set cell code
self.grid.code_array.__setitem__(key, code) | [
"def",
"set_code",
"(",
"self",
",",
"key",
",",
"code",
")",
":",
"old_code",
"=",
"self",
".",
"grid",
".",
"code_array",
"(",
"key",
")",
"try",
":",
"old_code",
"=",
"unicode",
"(",
"old_code",
",",
"encoding",
"=",
"\"utf-8\"",
")",
"except",
"TypeError",
":",
"pass",
"if",
"code",
"==",
"old_code",
":",
"return",
"if",
"not",
"(",
"old_code",
"is",
"None",
"and",
"not",
"code",
")",
"and",
"code",
"!=",
"old_code",
":",
"# Mark content as changed",
"post_command_event",
"(",
"self",
".",
"main_window",
",",
"self",
".",
"ContentChangedMsg",
")",
"# Set cell code",
"self",
".",
"grid",
".",
"code_array",
".",
"__setitem__",
"(",
"key",
",",
"code",
")"
] | Sets code of cell key, marks grid as changed | [
"Sets",
"code",
"of",
"cell",
"key",
"marks",
"grid",
"as",
"changed"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/actions/_grid_cell_actions.py#L50-L69 |
250,126 | manns/pyspread | pyspread/src/actions/_grid_cell_actions.py | CellActions.quote_code | def quote_code(self, key):
"""Returns string quoted code """
code = self.grid.code_array(key)
quoted_code = quote(code)
if quoted_code is not None:
self.set_code(key, quoted_code) | python | def quote_code(self, key):
code = self.grid.code_array(key)
quoted_code = quote(code)
if quoted_code is not None:
self.set_code(key, quoted_code) | [
"def",
"quote_code",
"(",
"self",
",",
"key",
")",
":",
"code",
"=",
"self",
".",
"grid",
".",
"code_array",
"(",
"key",
")",
"quoted_code",
"=",
"quote",
"(",
"code",
")",
"if",
"quoted_code",
"is",
"not",
"None",
":",
"self",
".",
"set_code",
"(",
"key",
",",
"quoted_code",
")"
] | Returns string quoted code | [
"Returns",
"string",
"quoted",
"code"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/actions/_grid_cell_actions.py#L71-L78 |
250,127 | manns/pyspread | pyspread/src/actions/_grid_cell_actions.py | CellActions.delete_cell | def delete_cell(self, key):
"""Deletes key cell"""
try:
self.code_array.pop(key)
except KeyError:
pass
self.grid.code_array.result_cache.clear() | python | def delete_cell(self, key):
try:
self.code_array.pop(key)
except KeyError:
pass
self.grid.code_array.result_cache.clear() | [
"def",
"delete_cell",
"(",
"self",
",",
"key",
")",
":",
"try",
":",
"self",
".",
"code_array",
".",
"pop",
"(",
"key",
")",
"except",
"KeyError",
":",
"pass",
"self",
".",
"grid",
".",
"code_array",
".",
"result_cache",
".",
"clear",
"(",
")"
] | Deletes key cell | [
"Deletes",
"key",
"cell"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/actions/_grid_cell_actions.py#L80-L89 |
250,128 | manns/pyspread | pyspread/src/actions/_grid_cell_actions.py | CellActions.append_reference_code | def append_reference_code(self, key, ref_key, ref_type="absolute"):
"""Appends reference code to cell code.
Replaces existing reference.
Parameters
----------
key: 3-tuple of Integer
\tKey of cell that gets the reference
ref_key: 3-tuple of Integer
\tKey of cell that is referenced
ref_type: Sting in ["absolute", "relative"]
\tAn absolute or a relative reference is added
"""
if ref_type == "absolute":
code = self._get_absolute_reference(ref_key)
elif ref_type == "relative":
code = self._get_relative_reference(key, ref_key)
else:
raise ValueError(_('ref_type has to be "absolute" or "relative".'))
old_code = self.grid.code_array(key)
if old_code is None:
old_code = u""
if "S" in old_code and old_code[-1] == "]":
old_code_left, __ = old_code.rsplit("S", 1)
new_code = old_code_left + code
else:
new_code = old_code + code
post_command_event(self.grid.main_window, self.EntryLineMsg,
text=new_code)
return new_code | python | def append_reference_code(self, key, ref_key, ref_type="absolute"):
if ref_type == "absolute":
code = self._get_absolute_reference(ref_key)
elif ref_type == "relative":
code = self._get_relative_reference(key, ref_key)
else:
raise ValueError(_('ref_type has to be "absolute" or "relative".'))
old_code = self.grid.code_array(key)
if old_code is None:
old_code = u""
if "S" in old_code and old_code[-1] == "]":
old_code_left, __ = old_code.rsplit("S", 1)
new_code = old_code_left + code
else:
new_code = old_code + code
post_command_event(self.grid.main_window, self.EntryLineMsg,
text=new_code)
return new_code | [
"def",
"append_reference_code",
"(",
"self",
",",
"key",
",",
"ref_key",
",",
"ref_type",
"=",
"\"absolute\"",
")",
":",
"if",
"ref_type",
"==",
"\"absolute\"",
":",
"code",
"=",
"self",
".",
"_get_absolute_reference",
"(",
"ref_key",
")",
"elif",
"ref_type",
"==",
"\"relative\"",
":",
"code",
"=",
"self",
".",
"_get_relative_reference",
"(",
"key",
",",
"ref_key",
")",
"else",
":",
"raise",
"ValueError",
"(",
"_",
"(",
"'ref_type has to be \"absolute\" or \"relative\".'",
")",
")",
"old_code",
"=",
"self",
".",
"grid",
".",
"code_array",
"(",
"key",
")",
"if",
"old_code",
"is",
"None",
":",
"old_code",
"=",
"u\"\"",
"if",
"\"S\"",
"in",
"old_code",
"and",
"old_code",
"[",
"-",
"1",
"]",
"==",
"\"]\"",
":",
"old_code_left",
",",
"__",
"=",
"old_code",
".",
"rsplit",
"(",
"\"S\"",
",",
"1",
")",
"new_code",
"=",
"old_code_left",
"+",
"code",
"else",
":",
"new_code",
"=",
"old_code",
"+",
"code",
"post_command_event",
"(",
"self",
".",
"grid",
".",
"main_window",
",",
"self",
".",
"EntryLineMsg",
",",
"text",
"=",
"new_code",
")",
"return",
"new_code"
] | Appends reference code to cell code.
Replaces existing reference.
Parameters
----------
key: 3-tuple of Integer
\tKey of cell that gets the reference
ref_key: 3-tuple of Integer
\tKey of cell that is referenced
ref_type: Sting in ["absolute", "relative"]
\tAn absolute or a relative reference is added | [
"Appends",
"reference",
"code",
"to",
"cell",
"code",
"."
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/actions/_grid_cell_actions.py#L145-L184 |
250,129 | manns/pyspread | pyspread/src/actions/_grid_cell_actions.py | CellActions._set_cell_attr | def _set_cell_attr(self, selection, table, attr):
"""Sets cell attr for key cell and mark grid content as changed
Parameters
----------
attr: dict
\tContains cell attribute keys
\tkeys in ["borderwidth_bottom", "borderwidth_right",
\t"bordercolor_bottom", "bordercolor_right",
\t"bgcolor", "textfont",
\t"pointsize", "fontweight", "fontstyle", "textcolor", "underline",
\t"strikethrough", "angle", "column-width", "row-height",
\t"vertical_align", "justification", "frozen", "merge_area"]
"""
# Mark content as changed
post_command_event(self.main_window, self.ContentChangedMsg)
if selection is not None:
self.code_array.cell_attributes.append((selection, table, attr)) | python | def _set_cell_attr(self, selection, table, attr):
# Mark content as changed
post_command_event(self.main_window, self.ContentChangedMsg)
if selection is not None:
self.code_array.cell_attributes.append((selection, table, attr)) | [
"def",
"_set_cell_attr",
"(",
"self",
",",
"selection",
",",
"table",
",",
"attr",
")",
":",
"# Mark content as changed",
"post_command_event",
"(",
"self",
".",
"main_window",
",",
"self",
".",
"ContentChangedMsg",
")",
"if",
"selection",
"is",
"not",
"None",
":",
"self",
".",
"code_array",
".",
"cell_attributes",
".",
"append",
"(",
"(",
"selection",
",",
"table",
",",
"attr",
")",
")"
] | Sets cell attr for key cell and mark grid content as changed
Parameters
----------
attr: dict
\tContains cell attribute keys
\tkeys in ["borderwidth_bottom", "borderwidth_right",
\t"bordercolor_bottom", "bordercolor_right",
\t"bgcolor", "textfont",
\t"pointsize", "fontweight", "fontstyle", "textcolor", "underline",
\t"strikethrough", "angle", "column-width", "row-height",
\t"vertical_align", "justification", "frozen", "merge_area"] | [
"Sets",
"cell",
"attr",
"for",
"key",
"cell",
"and",
"mark",
"grid",
"content",
"as",
"changed"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/actions/_grid_cell_actions.py#L186-L207 |
250,130 | manns/pyspread | pyspread/src/actions/_grid_cell_actions.py | CellActions.set_attr | def set_attr(self, attr, value, selection=None):
"""Sets attr of current selection to value"""
if selection is None:
selection = self.grid.selection
if not selection:
# Add current cell to selection so that it gets changed
selection.cells.append(self.grid.actions.cursor[:2])
attrs = {attr: value}
table = self.grid.current_table
# Change model
self._set_cell_attr(selection, table, attrs) | python | def set_attr(self, attr, value, selection=None):
if selection is None:
selection = self.grid.selection
if not selection:
# Add current cell to selection so that it gets changed
selection.cells.append(self.grid.actions.cursor[:2])
attrs = {attr: value}
table = self.grid.current_table
# Change model
self._set_cell_attr(selection, table, attrs) | [
"def",
"set_attr",
"(",
"self",
",",
"attr",
",",
"value",
",",
"selection",
"=",
"None",
")",
":",
"if",
"selection",
"is",
"None",
":",
"selection",
"=",
"self",
".",
"grid",
".",
"selection",
"if",
"not",
"selection",
":",
"# Add current cell to selection so that it gets changed",
"selection",
".",
"cells",
".",
"append",
"(",
"self",
".",
"grid",
".",
"actions",
".",
"cursor",
"[",
":",
"2",
"]",
")",
"attrs",
"=",
"{",
"attr",
":",
"value",
"}",
"table",
"=",
"self",
".",
"grid",
".",
"current_table",
"# Change model",
"self",
".",
"_set_cell_attr",
"(",
"selection",
",",
"table",
",",
"attrs",
")"
] | Sets attr of current selection to value | [
"Sets",
"attr",
"of",
"current",
"selection",
"to",
"value"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/actions/_grid_cell_actions.py#L209-L224 |
250,131 | manns/pyspread | pyspread/src/actions/_grid_cell_actions.py | CellActions.set_border_attr | def set_border_attr(self, attr, value, borders):
"""Sets border attribute by adjusting selection to borders
Parameters
----------
attr: String in ["borderwidth", "bordercolor"]
\tBorder attribute that shall be changed
value: wx.Colour or Integer
\tAttribute value dependent on attribute type
borders: Iterable over "top", "bottom", "left", "right", "inner"
\tSpecifies to which borders of the selection the attr is applied
"""
selection = self.grid.selection
if not selection:
selection.cells.append(self.grid.actions.cursor[:2])
# determine selection for core cells and selection for border cells
# Then apply according to inner and outer
# A cell is inner iif it is not at the edge of the selection bbox
if "inner" in borders:
if "top" in borders:
adj_selection = selection + (-1, 0)
self.set_attr(attr + "_bottom", value, adj_selection)
if "bottom" in borders:
self.set_attr(attr + "_bottom", value)
if "left" in borders:
adj_selection = selection + (0, -1)
self.set_attr(attr + "_right", value, adj_selection)
if "right" in borders:
self.set_attr(attr + "_right", value)
else:
# Adjust selection so that only bounding box edge is in selection
bbox_tl, bbox_lr = selection.get_bbox()
if "top" in borders:
adj_selection = Selection([bbox_tl],
[(bbox_tl[0], bbox_lr[1])],
[], [], []) + (-1, 0)
self.set_attr(attr + "_bottom", value, adj_selection)
if "bottom" in borders:
adj_selection = Selection([(bbox_lr[0], bbox_tl[1])],
[bbox_lr], [], [], [])
self.set_attr(attr + "_bottom", value, adj_selection)
if "left" in borders:
adj_selection = Selection([bbox_tl],
[(bbox_lr[0], bbox_tl[1])],
[], [], []) + (0, -1)
self.set_attr(attr + "_right", value, adj_selection)
if "right" in borders:
adj_selection = Selection([(bbox_tl[0], bbox_lr[1])],
[bbox_lr], [], [], [])
self.set_attr(attr + "_right", value, adj_selection) | python | def set_border_attr(self, attr, value, borders):
selection = self.grid.selection
if not selection:
selection.cells.append(self.grid.actions.cursor[:2])
# determine selection for core cells and selection for border cells
# Then apply according to inner and outer
# A cell is inner iif it is not at the edge of the selection bbox
if "inner" in borders:
if "top" in borders:
adj_selection = selection + (-1, 0)
self.set_attr(attr + "_bottom", value, adj_selection)
if "bottom" in borders:
self.set_attr(attr + "_bottom", value)
if "left" in borders:
adj_selection = selection + (0, -1)
self.set_attr(attr + "_right", value, adj_selection)
if "right" in borders:
self.set_attr(attr + "_right", value)
else:
# Adjust selection so that only bounding box edge is in selection
bbox_tl, bbox_lr = selection.get_bbox()
if "top" in borders:
adj_selection = Selection([bbox_tl],
[(bbox_tl[0], bbox_lr[1])],
[], [], []) + (-1, 0)
self.set_attr(attr + "_bottom", value, adj_selection)
if "bottom" in borders:
adj_selection = Selection([(bbox_lr[0], bbox_tl[1])],
[bbox_lr], [], [], [])
self.set_attr(attr + "_bottom", value, adj_selection)
if "left" in borders:
adj_selection = Selection([bbox_tl],
[(bbox_lr[0], bbox_tl[1])],
[], [], []) + (0, -1)
self.set_attr(attr + "_right", value, adj_selection)
if "right" in borders:
adj_selection = Selection([(bbox_tl[0], bbox_lr[1])],
[bbox_lr], [], [], [])
self.set_attr(attr + "_right", value, adj_selection) | [
"def",
"set_border_attr",
"(",
"self",
",",
"attr",
",",
"value",
",",
"borders",
")",
":",
"selection",
"=",
"self",
".",
"grid",
".",
"selection",
"if",
"not",
"selection",
":",
"selection",
".",
"cells",
".",
"append",
"(",
"self",
".",
"grid",
".",
"actions",
".",
"cursor",
"[",
":",
"2",
"]",
")",
"# determine selection for core cells and selection for border cells",
"# Then apply according to inner and outer",
"# A cell is inner iif it is not at the edge of the selection bbox",
"if",
"\"inner\"",
"in",
"borders",
":",
"if",
"\"top\"",
"in",
"borders",
":",
"adj_selection",
"=",
"selection",
"+",
"(",
"-",
"1",
",",
"0",
")",
"self",
".",
"set_attr",
"(",
"attr",
"+",
"\"_bottom\"",
",",
"value",
",",
"adj_selection",
")",
"if",
"\"bottom\"",
"in",
"borders",
":",
"self",
".",
"set_attr",
"(",
"attr",
"+",
"\"_bottom\"",
",",
"value",
")",
"if",
"\"left\"",
"in",
"borders",
":",
"adj_selection",
"=",
"selection",
"+",
"(",
"0",
",",
"-",
"1",
")",
"self",
".",
"set_attr",
"(",
"attr",
"+",
"\"_right\"",
",",
"value",
",",
"adj_selection",
")",
"if",
"\"right\"",
"in",
"borders",
":",
"self",
".",
"set_attr",
"(",
"attr",
"+",
"\"_right\"",
",",
"value",
")",
"else",
":",
"# Adjust selection so that only bounding box edge is in selection",
"bbox_tl",
",",
"bbox_lr",
"=",
"selection",
".",
"get_bbox",
"(",
")",
"if",
"\"top\"",
"in",
"borders",
":",
"adj_selection",
"=",
"Selection",
"(",
"[",
"bbox_tl",
"]",
",",
"[",
"(",
"bbox_tl",
"[",
"0",
"]",
",",
"bbox_lr",
"[",
"1",
"]",
")",
"]",
",",
"[",
"]",
",",
"[",
"]",
",",
"[",
"]",
")",
"+",
"(",
"-",
"1",
",",
"0",
")",
"self",
".",
"set_attr",
"(",
"attr",
"+",
"\"_bottom\"",
",",
"value",
",",
"adj_selection",
")",
"if",
"\"bottom\"",
"in",
"borders",
":",
"adj_selection",
"=",
"Selection",
"(",
"[",
"(",
"bbox_lr",
"[",
"0",
"]",
",",
"bbox_tl",
"[",
"1",
"]",
")",
"]",
",",
"[",
"bbox_lr",
"]",
",",
"[",
"]",
",",
"[",
"]",
",",
"[",
"]",
")",
"self",
".",
"set_attr",
"(",
"attr",
"+",
"\"_bottom\"",
",",
"value",
",",
"adj_selection",
")",
"if",
"\"left\"",
"in",
"borders",
":",
"adj_selection",
"=",
"Selection",
"(",
"[",
"bbox_tl",
"]",
",",
"[",
"(",
"bbox_lr",
"[",
"0",
"]",
",",
"bbox_tl",
"[",
"1",
"]",
")",
"]",
",",
"[",
"]",
",",
"[",
"]",
",",
"[",
"]",
")",
"+",
"(",
"0",
",",
"-",
"1",
")",
"self",
".",
"set_attr",
"(",
"attr",
"+",
"\"_right\"",
",",
"value",
",",
"adj_selection",
")",
"if",
"\"right\"",
"in",
"borders",
":",
"adj_selection",
"=",
"Selection",
"(",
"[",
"(",
"bbox_tl",
"[",
"0",
"]",
",",
"bbox_lr",
"[",
"1",
"]",
")",
"]",
",",
"[",
"bbox_lr",
"]",
",",
"[",
"]",
",",
"[",
"]",
",",
"[",
"]",
")",
"self",
".",
"set_attr",
"(",
"attr",
"+",
"\"_right\"",
",",
"value",
",",
"adj_selection",
")"
] | Sets border attribute by adjusting selection to borders
Parameters
----------
attr: String in ["borderwidth", "bordercolor"]
\tBorder attribute that shall be changed
value: wx.Colour or Integer
\tAttribute value dependent on attribute type
borders: Iterable over "top", "bottom", "left", "right", "inner"
\tSpecifies to which borders of the selection the attr is applied | [
"Sets",
"border",
"attribute",
"by",
"adjusting",
"selection",
"to",
"borders"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/actions/_grid_cell_actions.py#L226-L286 |
250,132 | manns/pyspread | pyspread/src/actions/_grid_cell_actions.py | CellActions.toggle_attr | def toggle_attr(self, attr):
"""Toggles an attribute attr for current selection"""
selection = self.grid.selection
# Selection or single cell access?
if selection:
value = self.get_new_selection_attr_state(selection, attr)
else:
value = self.get_new_cell_attr_state(self.grid.actions.cursor,
attr)
# Set the toggled value
self.set_attr(attr, value) | python | def toggle_attr(self, attr):
selection = self.grid.selection
# Selection or single cell access?
if selection:
value = self.get_new_selection_attr_state(selection, attr)
else:
value = self.get_new_cell_attr_state(self.grid.actions.cursor,
attr)
# Set the toggled value
self.set_attr(attr, value) | [
"def",
"toggle_attr",
"(",
"self",
",",
"attr",
")",
":",
"selection",
"=",
"self",
".",
"grid",
".",
"selection",
"# Selection or single cell access?",
"if",
"selection",
":",
"value",
"=",
"self",
".",
"get_new_selection_attr_state",
"(",
"selection",
",",
"attr",
")",
"else",
":",
"value",
"=",
"self",
".",
"get_new_cell_attr_state",
"(",
"self",
".",
"grid",
".",
"actions",
".",
"cursor",
",",
"attr",
")",
"# Set the toggled value",
"self",
".",
"set_attr",
"(",
"attr",
",",
"value",
")"
] | Toggles an attribute attr for current selection | [
"Toggles",
"an",
"attribute",
"attr",
"for",
"current",
"selection"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/actions/_grid_cell_actions.py#L288-L304 |
250,133 | manns/pyspread | pyspread/src/actions/_grid_cell_actions.py | CellActions.change_frozen_attr | def change_frozen_attr(self):
"""Changes frozen state of cell if there is no selection"""
# Selections are not supported
if self.grid.selection:
statustext = _("Freezing selections is not supported.")
post_command_event(self.main_window, self.StatusBarMsg,
text=statustext)
cursor = self.grid.actions.cursor
frozen = self.grid.code_array.cell_attributes[cursor]["frozen"]
if frozen:
# We have an frozen cell that has to be unfrozen
# Delete frozen cache content
self.grid.code_array.frozen_cache.pop(repr(cursor))
else:
# We have an non-frozen cell that has to be frozen
# Add frozen cache content
res_obj = self.grid.code_array[cursor]
self.grid.code_array.frozen_cache[repr(cursor)] = res_obj
# Set the new frozen state / code
selection = Selection([], [], [], [], [cursor[:2]])
self.set_attr("frozen", not frozen, selection=selection) | python | def change_frozen_attr(self):
# Selections are not supported
if self.grid.selection:
statustext = _("Freezing selections is not supported.")
post_command_event(self.main_window, self.StatusBarMsg,
text=statustext)
cursor = self.grid.actions.cursor
frozen = self.grid.code_array.cell_attributes[cursor]["frozen"]
if frozen:
# We have an frozen cell that has to be unfrozen
# Delete frozen cache content
self.grid.code_array.frozen_cache.pop(repr(cursor))
else:
# We have an non-frozen cell that has to be frozen
# Add frozen cache content
res_obj = self.grid.code_array[cursor]
self.grid.code_array.frozen_cache[repr(cursor)] = res_obj
# Set the new frozen state / code
selection = Selection([], [], [], [], [cursor[:2]])
self.set_attr("frozen", not frozen, selection=selection) | [
"def",
"change_frozen_attr",
"(",
"self",
")",
":",
"# Selections are not supported",
"if",
"self",
".",
"grid",
".",
"selection",
":",
"statustext",
"=",
"_",
"(",
"\"Freezing selections is not supported.\"",
")",
"post_command_event",
"(",
"self",
".",
"main_window",
",",
"self",
".",
"StatusBarMsg",
",",
"text",
"=",
"statustext",
")",
"cursor",
"=",
"self",
".",
"grid",
".",
"actions",
".",
"cursor",
"frozen",
"=",
"self",
".",
"grid",
".",
"code_array",
".",
"cell_attributes",
"[",
"cursor",
"]",
"[",
"\"frozen\"",
"]",
"if",
"frozen",
":",
"# We have an frozen cell that has to be unfrozen",
"# Delete frozen cache content",
"self",
".",
"grid",
".",
"code_array",
".",
"frozen_cache",
".",
"pop",
"(",
"repr",
"(",
"cursor",
")",
")",
"else",
":",
"# We have an non-frozen cell that has to be frozen",
"# Add frozen cache content",
"res_obj",
"=",
"self",
".",
"grid",
".",
"code_array",
"[",
"cursor",
"]",
"self",
".",
"grid",
".",
"code_array",
".",
"frozen_cache",
"[",
"repr",
"(",
"cursor",
")",
"]",
"=",
"res_obj",
"# Set the new frozen state / code",
"selection",
"=",
"Selection",
"(",
"[",
"]",
",",
"[",
"]",
",",
"[",
"]",
",",
"[",
"]",
",",
"[",
"cursor",
"[",
":",
"2",
"]",
"]",
")",
"self",
".",
"set_attr",
"(",
"\"frozen\"",
",",
"not",
"frozen",
",",
"selection",
"=",
"selection",
")"
] | Changes frozen state of cell if there is no selection | [
"Changes",
"frozen",
"state",
"of",
"cell",
"if",
"there",
"is",
"no",
"selection"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/actions/_grid_cell_actions.py#L308-L337 |
250,134 | manns/pyspread | pyspread/src/actions/_grid_cell_actions.py | CellActions.unmerge | def unmerge(self, unmerge_area, tab):
"""Unmerges all cells in unmerge_area"""
top, left, bottom, right = unmerge_area
selection = Selection([(top, left)], [(bottom, right)], [], [], [])
attr = {"merge_area": None, "locked": False}
self._set_cell_attr(selection, tab, attr) | python | def unmerge(self, unmerge_area, tab):
top, left, bottom, right = unmerge_area
selection = Selection([(top, left)], [(bottom, right)], [], [], [])
attr = {"merge_area": None, "locked": False}
self._set_cell_attr(selection, tab, attr) | [
"def",
"unmerge",
"(",
"self",
",",
"unmerge_area",
",",
"tab",
")",
":",
"top",
",",
"left",
",",
"bottom",
",",
"right",
"=",
"unmerge_area",
"selection",
"=",
"Selection",
"(",
"[",
"(",
"top",
",",
"left",
")",
"]",
",",
"[",
"(",
"bottom",
",",
"right",
")",
"]",
",",
"[",
"]",
",",
"[",
"]",
",",
"[",
"]",
")",
"attr",
"=",
"{",
"\"merge_area\"",
":",
"None",
",",
"\"locked\"",
":",
"False",
"}",
"self",
".",
"_set_cell_attr",
"(",
"selection",
",",
"tab",
",",
"attr",
")"
] | Unmerges all cells in unmerge_area | [
"Unmerges",
"all",
"cells",
"in",
"unmerge_area"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/actions/_grid_cell_actions.py#L339-L346 |
250,135 | manns/pyspread | pyspread/src/actions/_grid_cell_actions.py | CellActions.merge | def merge(self, merge_area, tab):
"""Merges top left cell with all cells until bottom_right"""
top, left, bottom, right = merge_area
cursor = self.grid.actions.cursor
top_left_code = self.code_array((top, left, cursor[2]))
selection = Selection([(top, left)], [(bottom, right)], [], [], [])
# Check if the merge area overlaps another merge area
error_msg = _("Overlapping merge area at {} prevents merge.")
for row in xrange(top, bottom + 1):
for col in xrange(left, right + 1):
key = row, col, tab
if self.code_array.cell_attributes[key]["merge_area"]:
post_command_event(self.main_window, self.StatusBarMsg,
text=error_msg.format(str(key)))
return
self.delete_selection(selection)
self.set_code((top, left, cursor[2]), top_left_code)
attr = {"merge_area": merge_area, "locked": True}
self._set_cell_attr(selection, tab, attr)
tl_selection = Selection([], [], [], [], [(top, left)])
attr = {"locked": False}
self._set_cell_attr(tl_selection, tab, attr) | python | def merge(self, merge_area, tab):
top, left, bottom, right = merge_area
cursor = self.grid.actions.cursor
top_left_code = self.code_array((top, left, cursor[2]))
selection = Selection([(top, left)], [(bottom, right)], [], [], [])
# Check if the merge area overlaps another merge area
error_msg = _("Overlapping merge area at {} prevents merge.")
for row in xrange(top, bottom + 1):
for col in xrange(left, right + 1):
key = row, col, tab
if self.code_array.cell_attributes[key]["merge_area"]:
post_command_event(self.main_window, self.StatusBarMsg,
text=error_msg.format(str(key)))
return
self.delete_selection(selection)
self.set_code((top, left, cursor[2]), top_left_code)
attr = {"merge_area": merge_area, "locked": True}
self._set_cell_attr(selection, tab, attr)
tl_selection = Selection([], [], [], [], [(top, left)])
attr = {"locked": False}
self._set_cell_attr(tl_selection, tab, attr) | [
"def",
"merge",
"(",
"self",
",",
"merge_area",
",",
"tab",
")",
":",
"top",
",",
"left",
",",
"bottom",
",",
"right",
"=",
"merge_area",
"cursor",
"=",
"self",
".",
"grid",
".",
"actions",
".",
"cursor",
"top_left_code",
"=",
"self",
".",
"code_array",
"(",
"(",
"top",
",",
"left",
",",
"cursor",
"[",
"2",
"]",
")",
")",
"selection",
"=",
"Selection",
"(",
"[",
"(",
"top",
",",
"left",
")",
"]",
",",
"[",
"(",
"bottom",
",",
"right",
")",
"]",
",",
"[",
"]",
",",
"[",
"]",
",",
"[",
"]",
")",
"# Check if the merge area overlaps another merge area",
"error_msg",
"=",
"_",
"(",
"\"Overlapping merge area at {} prevents merge.\"",
")",
"for",
"row",
"in",
"xrange",
"(",
"top",
",",
"bottom",
"+",
"1",
")",
":",
"for",
"col",
"in",
"xrange",
"(",
"left",
",",
"right",
"+",
"1",
")",
":",
"key",
"=",
"row",
",",
"col",
",",
"tab",
"if",
"self",
".",
"code_array",
".",
"cell_attributes",
"[",
"key",
"]",
"[",
"\"merge_area\"",
"]",
":",
"post_command_event",
"(",
"self",
".",
"main_window",
",",
"self",
".",
"StatusBarMsg",
",",
"text",
"=",
"error_msg",
".",
"format",
"(",
"str",
"(",
"key",
")",
")",
")",
"return",
"self",
".",
"delete_selection",
"(",
"selection",
")",
"self",
".",
"set_code",
"(",
"(",
"top",
",",
"left",
",",
"cursor",
"[",
"2",
"]",
")",
",",
"top_left_code",
")",
"attr",
"=",
"{",
"\"merge_area\"",
":",
"merge_area",
",",
"\"locked\"",
":",
"True",
"}",
"self",
".",
"_set_cell_attr",
"(",
"selection",
",",
"tab",
",",
"attr",
")",
"tl_selection",
"=",
"Selection",
"(",
"[",
"]",
",",
"[",
"]",
",",
"[",
"]",
",",
"[",
"]",
",",
"[",
"(",
"top",
",",
"left",
")",
"]",
")",
"attr",
"=",
"{",
"\"locked\"",
":",
"False",
"}",
"self",
".",
"_set_cell_attr",
"(",
"tl_selection",
",",
"tab",
",",
"attr",
")"
] | Merges top left cell with all cells until bottom_right | [
"Merges",
"top",
"left",
"cell",
"with",
"all",
"cells",
"until",
"bottom_right"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/actions/_grid_cell_actions.py#L348-L380 |
250,136 | manns/pyspread | pyspread/src/actions/_grid_cell_actions.py | CellActions.merge_selected_cells | def merge_selected_cells(self, selection):
"""Merges or unmerges cells that are in the selection bounding box
Parameters
----------
selection: Selection object
\tSelection for which attr toggle shall be returned
"""
tab = self.grid.current_table
# Get the selection bounding box
bbox = selection.get_bbox()
if bbox is None:
row, col, tab = self.grid.actions.cursor
(bb_top, bb_left), (bb_bottom, bb_right) = (row, col), (row, col)
else:
(bb_top, bb_left), (bb_bottom, bb_right) = bbox
merge_area = bb_top, bb_left, bb_bottom, bb_right
# Check if top-left cell is already merged
cell_attributes = self.grid.code_array.cell_attributes
tl_merge_area = cell_attributes[(bb_top, bb_left, tab)]["merge_area"]
if tl_merge_area is not None and tl_merge_area[:2] == merge_area[:2]:
self.unmerge(tl_merge_area, tab)
else:
self.merge(merge_area, tab) | python | def merge_selected_cells(self, selection):
tab = self.grid.current_table
# Get the selection bounding box
bbox = selection.get_bbox()
if bbox is None:
row, col, tab = self.grid.actions.cursor
(bb_top, bb_left), (bb_bottom, bb_right) = (row, col), (row, col)
else:
(bb_top, bb_left), (bb_bottom, bb_right) = bbox
merge_area = bb_top, bb_left, bb_bottom, bb_right
# Check if top-left cell is already merged
cell_attributes = self.grid.code_array.cell_attributes
tl_merge_area = cell_attributes[(bb_top, bb_left, tab)]["merge_area"]
if tl_merge_area is not None and tl_merge_area[:2] == merge_area[:2]:
self.unmerge(tl_merge_area, tab)
else:
self.merge(merge_area, tab) | [
"def",
"merge_selected_cells",
"(",
"self",
",",
"selection",
")",
":",
"tab",
"=",
"self",
".",
"grid",
".",
"current_table",
"# Get the selection bounding box",
"bbox",
"=",
"selection",
".",
"get_bbox",
"(",
")",
"if",
"bbox",
"is",
"None",
":",
"row",
",",
"col",
",",
"tab",
"=",
"self",
".",
"grid",
".",
"actions",
".",
"cursor",
"(",
"bb_top",
",",
"bb_left",
")",
",",
"(",
"bb_bottom",
",",
"bb_right",
")",
"=",
"(",
"row",
",",
"col",
")",
",",
"(",
"row",
",",
"col",
")",
"else",
":",
"(",
"bb_top",
",",
"bb_left",
")",
",",
"(",
"bb_bottom",
",",
"bb_right",
")",
"=",
"bbox",
"merge_area",
"=",
"bb_top",
",",
"bb_left",
",",
"bb_bottom",
",",
"bb_right",
"# Check if top-left cell is already merged",
"cell_attributes",
"=",
"self",
".",
"grid",
".",
"code_array",
".",
"cell_attributes",
"tl_merge_area",
"=",
"cell_attributes",
"[",
"(",
"bb_top",
",",
"bb_left",
",",
"tab",
")",
"]",
"[",
"\"merge_area\"",
"]",
"if",
"tl_merge_area",
"is",
"not",
"None",
"and",
"tl_merge_area",
"[",
":",
"2",
"]",
"==",
"merge_area",
"[",
":",
"2",
"]",
":",
"self",
".",
"unmerge",
"(",
"tl_merge_area",
",",
"tab",
")",
"else",
":",
"self",
".",
"merge",
"(",
"merge_area",
",",
"tab",
")"
] | Merges or unmerges cells that are in the selection bounding box
Parameters
----------
selection: Selection object
\tSelection for which attr toggle shall be returned | [
"Merges",
"or",
"unmerges",
"cells",
"that",
"are",
"in",
"the",
"selection",
"bounding",
"box"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/actions/_grid_cell_actions.py#L382-L410 |
250,137 | manns/pyspread | pyspread/src/actions/_grid_cell_actions.py | CellActions.get_new_cell_attr_state | def get_new_cell_attr_state(self, key, attr_key):
"""Returns new attr cell state for toggles
Parameters
----------
key: 3-Tuple
\tCell for which attr toggle shall be returned
attr_key: Hashable
\tAttribute key
"""
cell_attributes = self.grid.code_array.cell_attributes
attr_values = self.attr_toggle_values[attr_key]
# Map attr_value to next attr_value
attr_map = dict(zip(attr_values, attr_values[1:] + attr_values[:1]))
# Return next value from attr_toggle_values value list
return attr_map[cell_attributes[key][attr_key]] | python | def get_new_cell_attr_state(self, key, attr_key):
cell_attributes = self.grid.code_array.cell_attributes
attr_values = self.attr_toggle_values[attr_key]
# Map attr_value to next attr_value
attr_map = dict(zip(attr_values, attr_values[1:] + attr_values[:1]))
# Return next value from attr_toggle_values value list
return attr_map[cell_attributes[key][attr_key]] | [
"def",
"get_new_cell_attr_state",
"(",
"self",
",",
"key",
",",
"attr_key",
")",
":",
"cell_attributes",
"=",
"self",
".",
"grid",
".",
"code_array",
".",
"cell_attributes",
"attr_values",
"=",
"self",
".",
"attr_toggle_values",
"[",
"attr_key",
"]",
"# Map attr_value to next attr_value",
"attr_map",
"=",
"dict",
"(",
"zip",
"(",
"attr_values",
",",
"attr_values",
"[",
"1",
":",
"]",
"+",
"attr_values",
"[",
":",
"1",
"]",
")",
")",
"# Return next value from attr_toggle_values value list",
"return",
"attr_map",
"[",
"cell_attributes",
"[",
"key",
"]",
"[",
"attr_key",
"]",
"]"
] | Returns new attr cell state for toggles
Parameters
----------
key: 3-Tuple
\tCell for which attr toggle shall be returned
attr_key: Hashable
\tAttribute key | [
"Returns",
"new",
"attr",
"cell",
"state",
"for",
"toggles"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/actions/_grid_cell_actions.py#L425-L445 |
250,138 | manns/pyspread | pyspread/src/actions/_grid_cell_actions.py | CellActions.get_new_selection_attr_state | def get_new_selection_attr_state(self, selection, attr_key):
"""Toggles new attr selection state and returns it
Parameters
----------
selection: Selection object
\tSelection for which attr toggle shall be returned
attr_key: Hashable
\tAttribute key
"""
cell_attributes = self.grid.code_array.cell_attributes
attr_values = self.attr_toggle_values[attr_key]
# Map attr_value to next attr_value
attr_map = dict(zip(attr_values, attr_values[1:] + attr_values[:1]))
selection_attrs = \
(attr for attr in cell_attributes if attr[0] == selection)
attrs = {}
for selection_attr in selection_attrs:
attrs.update(selection_attr[2])
if attr_key in attrs:
return attr_map[attrs[attr_key]]
else:
# Default next value
return self.attr_toggle_values[attr_key][1] | python | def get_new_selection_attr_state(self, selection, attr_key):
cell_attributes = self.grid.code_array.cell_attributes
attr_values = self.attr_toggle_values[attr_key]
# Map attr_value to next attr_value
attr_map = dict(zip(attr_values, attr_values[1:] + attr_values[:1]))
selection_attrs = \
(attr for attr in cell_attributes if attr[0] == selection)
attrs = {}
for selection_attr in selection_attrs:
attrs.update(selection_attr[2])
if attr_key in attrs:
return attr_map[attrs[attr_key]]
else:
# Default next value
return self.attr_toggle_values[attr_key][1] | [
"def",
"get_new_selection_attr_state",
"(",
"self",
",",
"selection",
",",
"attr_key",
")",
":",
"cell_attributes",
"=",
"self",
".",
"grid",
".",
"code_array",
".",
"cell_attributes",
"attr_values",
"=",
"self",
".",
"attr_toggle_values",
"[",
"attr_key",
"]",
"# Map attr_value to next attr_value",
"attr_map",
"=",
"dict",
"(",
"zip",
"(",
"attr_values",
",",
"attr_values",
"[",
"1",
":",
"]",
"+",
"attr_values",
"[",
":",
"1",
"]",
")",
")",
"selection_attrs",
"=",
"(",
"attr",
"for",
"attr",
"in",
"cell_attributes",
"if",
"attr",
"[",
"0",
"]",
"==",
"selection",
")",
"attrs",
"=",
"{",
"}",
"for",
"selection_attr",
"in",
"selection_attrs",
":",
"attrs",
".",
"update",
"(",
"selection_attr",
"[",
"2",
"]",
")",
"if",
"attr_key",
"in",
"attrs",
":",
"return",
"attr_map",
"[",
"attrs",
"[",
"attr_key",
"]",
"]",
"else",
":",
"# Default next value",
"return",
"self",
".",
"attr_toggle_values",
"[",
"attr_key",
"]",
"[",
"1",
"]"
] | Toggles new attr selection state and returns it
Parameters
----------
selection: Selection object
\tSelection for which attr toggle shall be returned
attr_key: Hashable
\tAttribute key | [
"Toggles",
"new",
"attr",
"selection",
"state",
"and",
"returns",
"it"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/actions/_grid_cell_actions.py#L447-L477 |
250,139 | manns/pyspread | pyspread/src/actions/_grid_cell_actions.py | CellActions.refresh_frozen_cell | def refresh_frozen_cell(self, key):
"""Refreshes a frozen cell"""
code = self.grid.code_array(key)
result = self.grid.code_array._eval_cell(key, code)
self.grid.code_array.frozen_cache[repr(key)] = result | python | def refresh_frozen_cell(self, key):
code = self.grid.code_array(key)
result = self.grid.code_array._eval_cell(key, code)
self.grid.code_array.frozen_cache[repr(key)] = result | [
"def",
"refresh_frozen_cell",
"(",
"self",
",",
"key",
")",
":",
"code",
"=",
"self",
".",
"grid",
".",
"code_array",
"(",
"key",
")",
"result",
"=",
"self",
".",
"grid",
".",
"code_array",
".",
"_eval_cell",
"(",
"key",
",",
"code",
")",
"self",
".",
"grid",
".",
"code_array",
".",
"frozen_cache",
"[",
"repr",
"(",
"key",
")",
"]",
"=",
"result"
] | Refreshes a frozen cell | [
"Refreshes",
"a",
"frozen",
"cell"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/actions/_grid_cell_actions.py#L479-L484 |
250,140 | manns/pyspread | pyspread/src/actions/_grid_cell_actions.py | CellActions.refresh_selected_frozen_cells | def refresh_selected_frozen_cells(self, selection=None):
"""Refreshes content of frozen cells that are currently selected
If there is no selection, the cell at the cursor is updated.
Parameters
----------
selection: Selection, defaults to None
\tIf not None then use this selection instead of the grid selection
"""
if selection is None:
selection = self.grid.selection
# Add cursor to empty selection
if not selection:
selection.cells.append(self.grid.actions.cursor[:2])
cell_attributes = self.grid.code_array.cell_attributes
refreshed_keys = []
for attr_selection, tab, attr_dict in cell_attributes:
if tab == self.grid.actions.cursor[2] and \
"frozen" in attr_dict and attr_dict["frozen"]:
# Only single cells are allowed for freezing
skey = attr_selection.cells[0]
if skey in selection:
key = tuple(list(skey) + [tab])
if key not in refreshed_keys and \
cell_attributes[key]["frozen"]:
self.refresh_frozen_cell(key)
refreshed_keys.append(key)
cell_attributes._attr_cache.clear()
cell_attributes._table_cache.clear() | python | def refresh_selected_frozen_cells(self, selection=None):
if selection is None:
selection = self.grid.selection
# Add cursor to empty selection
if not selection:
selection.cells.append(self.grid.actions.cursor[:2])
cell_attributes = self.grid.code_array.cell_attributes
refreshed_keys = []
for attr_selection, tab, attr_dict in cell_attributes:
if tab == self.grid.actions.cursor[2] and \
"frozen" in attr_dict and attr_dict["frozen"]:
# Only single cells are allowed for freezing
skey = attr_selection.cells[0]
if skey in selection:
key = tuple(list(skey) + [tab])
if key not in refreshed_keys and \
cell_attributes[key]["frozen"]:
self.refresh_frozen_cell(key)
refreshed_keys.append(key)
cell_attributes._attr_cache.clear()
cell_attributes._table_cache.clear() | [
"def",
"refresh_selected_frozen_cells",
"(",
"self",
",",
"selection",
"=",
"None",
")",
":",
"if",
"selection",
"is",
"None",
":",
"selection",
"=",
"self",
".",
"grid",
".",
"selection",
"# Add cursor to empty selection",
"if",
"not",
"selection",
":",
"selection",
".",
"cells",
".",
"append",
"(",
"self",
".",
"grid",
".",
"actions",
".",
"cursor",
"[",
":",
"2",
"]",
")",
"cell_attributes",
"=",
"self",
".",
"grid",
".",
"code_array",
".",
"cell_attributes",
"refreshed_keys",
"=",
"[",
"]",
"for",
"attr_selection",
",",
"tab",
",",
"attr_dict",
"in",
"cell_attributes",
":",
"if",
"tab",
"==",
"self",
".",
"grid",
".",
"actions",
".",
"cursor",
"[",
"2",
"]",
"and",
"\"frozen\"",
"in",
"attr_dict",
"and",
"attr_dict",
"[",
"\"frozen\"",
"]",
":",
"# Only single cells are allowed for freezing",
"skey",
"=",
"attr_selection",
".",
"cells",
"[",
"0",
"]",
"if",
"skey",
"in",
"selection",
":",
"key",
"=",
"tuple",
"(",
"list",
"(",
"skey",
")",
"+",
"[",
"tab",
"]",
")",
"if",
"key",
"not",
"in",
"refreshed_keys",
"and",
"cell_attributes",
"[",
"key",
"]",
"[",
"\"frozen\"",
"]",
":",
"self",
".",
"refresh_frozen_cell",
"(",
"key",
")",
"refreshed_keys",
".",
"append",
"(",
"key",
")",
"cell_attributes",
".",
"_attr_cache",
".",
"clear",
"(",
")",
"cell_attributes",
".",
"_table_cache",
".",
"clear",
"(",
")"
] | Refreshes content of frozen cells that are currently selected
If there is no selection, the cell at the cursor is updated.
Parameters
----------
selection: Selection, defaults to None
\tIf not None then use this selection instead of the grid selection | [
"Refreshes",
"content",
"of",
"frozen",
"cells",
"that",
"are",
"currently",
"selected"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/actions/_grid_cell_actions.py#L486-L523 |
250,141 | manns/pyspread | pyspread/src/actions/_main_window_actions.py | ExchangeActions._import_csv | def _import_csv(self, path):
"""CSV import workflow"""
# If path is not set, do nothing
if not path:
return
# Get csv info
try:
dialect, has_header, digest_types, encoding = \
self.main_window.interfaces.get_csv_import_info(path)
except IOError:
msg = _("Error opening file {filepath}.").format(filepath=path)
post_command_event(self.main_window, self.StatusBarMsg, text=msg)
return
except TypeError:
return # Import is aborted or empty
return CsvInterface(self.main_window,
path, dialect, digest_types, has_header, encoding) | python | def _import_csv(self, path):
# If path is not set, do nothing
if not path:
return
# Get csv info
try:
dialect, has_header, digest_types, encoding = \
self.main_window.interfaces.get_csv_import_info(path)
except IOError:
msg = _("Error opening file {filepath}.").format(filepath=path)
post_command_event(self.main_window, self.StatusBarMsg, text=msg)
return
except TypeError:
return # Import is aborted or empty
return CsvInterface(self.main_window,
path, dialect, digest_types, has_header, encoding) | [
"def",
"_import_csv",
"(",
"self",
",",
"path",
")",
":",
"# If path is not set, do nothing",
"if",
"not",
"path",
":",
"return",
"# Get csv info",
"try",
":",
"dialect",
",",
"has_header",
",",
"digest_types",
",",
"encoding",
"=",
"self",
".",
"main_window",
".",
"interfaces",
".",
"get_csv_import_info",
"(",
"path",
")",
"except",
"IOError",
":",
"msg",
"=",
"_",
"(",
"\"Error opening file {filepath}.\"",
")",
".",
"format",
"(",
"filepath",
"=",
"path",
")",
"post_command_event",
"(",
"self",
".",
"main_window",
",",
"self",
".",
"StatusBarMsg",
",",
"text",
"=",
"msg",
")",
"return",
"except",
"TypeError",
":",
"return",
"# Import is aborted or empty",
"return",
"CsvInterface",
"(",
"self",
".",
"main_window",
",",
"path",
",",
"dialect",
",",
"digest_types",
",",
"has_header",
",",
"encoding",
")"
] | CSV import workflow | [
"CSV",
"import",
"workflow"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/actions/_main_window_actions.py#L88-L110 |
250,142 | manns/pyspread | pyspread/src/actions/_main_window_actions.py | ExchangeActions.import_file | def import_file(self, filepath, filterindex):
"""Imports external file
Parameters
----------
filepath: String
\tPath of import file
filterindex: Integer
\tIndex for type of file, 0: csv, 1: tab-delimited text file
"""
# Mark content as changed
post_command_event(self.main_window, self.ContentChangedMsg)
if filterindex == 0:
# CSV import option choice
return self._import_csv(filepath)
elif filterindex == 1:
# TXT import option choice
return self._import_txt(filepath)
else:
msg = _("Unknown import choice {choice}.")
msg = msg.format(choice=filterindex)
short_msg = _('Error reading CSV file')
self.main_window.interfaces.display_warning(msg, short_msg) | python | def import_file(self, filepath, filterindex):
# Mark content as changed
post_command_event(self.main_window, self.ContentChangedMsg)
if filterindex == 0:
# CSV import option choice
return self._import_csv(filepath)
elif filterindex == 1:
# TXT import option choice
return self._import_txt(filepath)
else:
msg = _("Unknown import choice {choice}.")
msg = msg.format(choice=filterindex)
short_msg = _('Error reading CSV file')
self.main_window.interfaces.display_warning(msg, short_msg) | [
"def",
"import_file",
"(",
"self",
",",
"filepath",
",",
"filterindex",
")",
":",
"# Mark content as changed",
"post_command_event",
"(",
"self",
".",
"main_window",
",",
"self",
".",
"ContentChangedMsg",
")",
"if",
"filterindex",
"==",
"0",
":",
"# CSV import option choice",
"return",
"self",
".",
"_import_csv",
"(",
"filepath",
")",
"elif",
"filterindex",
"==",
"1",
":",
"# TXT import option choice",
"return",
"self",
".",
"_import_txt",
"(",
"filepath",
")",
"else",
":",
"msg",
"=",
"_",
"(",
"\"Unknown import choice {choice}.\"",
")",
"msg",
"=",
"msg",
".",
"format",
"(",
"choice",
"=",
"filterindex",
")",
"short_msg",
"=",
"_",
"(",
"'Error reading CSV file'",
")",
"self",
".",
"main_window",
".",
"interfaces",
".",
"display_warning",
"(",
"msg",
",",
"short_msg",
")"
] | Imports external file
Parameters
----------
filepath: String
\tPath of import file
filterindex: Integer
\tIndex for type of file, 0: csv, 1: tab-delimited text file | [
"Imports",
"external",
"file"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/actions/_main_window_actions.py#L117-L144 |
250,143 | manns/pyspread | pyspread/src/actions/_main_window_actions.py | ExchangeActions._export_csv | def _export_csv(self, filepath, data, preview_data):
"""CSV export of code_array results
Parameters
----------
filepath: String
\tPath of export file
data: Object
\tCode array result object slice, i. e. one object or iterable of
\tsuch objects
"""
# Get csv info
csv_info = \
self.main_window.interfaces.get_csv_export_info(preview_data)
if csv_info is None:
return
try:
dialect, digest_types, has_header = csv_info
except TypeError:
return
# Export CSV file
csv_interface = CsvInterface(self.main_window, filepath, dialect,
digest_types, has_header)
try:
csv_interface.write(data)
except IOError, err:
msg = _("The file {filepath} could not be fully written\n \n"
"Error message:\n{msg}")
msg = msg.format(filepath=filepath, msg=err)
short_msg = _('Error writing CSV file')
self.main_window.interfaces.display_warning(msg, short_msg) | python | def _export_csv(self, filepath, data, preview_data):
# Get csv info
csv_info = \
self.main_window.interfaces.get_csv_export_info(preview_data)
if csv_info is None:
return
try:
dialect, digest_types, has_header = csv_info
except TypeError:
return
# Export CSV file
csv_interface = CsvInterface(self.main_window, filepath, dialect,
digest_types, has_header)
try:
csv_interface.write(data)
except IOError, err:
msg = _("The file {filepath} could not be fully written\n \n"
"Error message:\n{msg}")
msg = msg.format(filepath=filepath, msg=err)
short_msg = _('Error writing CSV file')
self.main_window.interfaces.display_warning(msg, short_msg) | [
"def",
"_export_csv",
"(",
"self",
",",
"filepath",
",",
"data",
",",
"preview_data",
")",
":",
"# Get csv info",
"csv_info",
"=",
"self",
".",
"main_window",
".",
"interfaces",
".",
"get_csv_export_info",
"(",
"preview_data",
")",
"if",
"csv_info",
"is",
"None",
":",
"return",
"try",
":",
"dialect",
",",
"digest_types",
",",
"has_header",
"=",
"csv_info",
"except",
"TypeError",
":",
"return",
"# Export CSV file",
"csv_interface",
"=",
"CsvInterface",
"(",
"self",
".",
"main_window",
",",
"filepath",
",",
"dialect",
",",
"digest_types",
",",
"has_header",
")",
"try",
":",
"csv_interface",
".",
"write",
"(",
"data",
")",
"except",
"IOError",
",",
"err",
":",
"msg",
"=",
"_",
"(",
"\"The file {filepath} could not be fully written\\n \\n\"",
"\"Error message:\\n{msg}\"",
")",
"msg",
"=",
"msg",
".",
"format",
"(",
"filepath",
"=",
"filepath",
",",
"msg",
"=",
"err",
")",
"short_msg",
"=",
"_",
"(",
"'Error writing CSV file'",
")",
"self",
".",
"main_window",
".",
"interfaces",
".",
"display_warning",
"(",
"msg",
",",
"short_msg",
")"
] | CSV export of code_array results
Parameters
----------
filepath: String
\tPath of export file
data: Object
\tCode array result object slice, i. e. one object or iterable of
\tsuch objects | [
"CSV",
"export",
"of",
"code_array",
"results"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/actions/_main_window_actions.py#L146-L185 |
250,144 | manns/pyspread | pyspread/src/actions/_main_window_actions.py | ExchangeActions._export_figure | def _export_figure(self, filepath, data, format):
"""Export of single cell that contains a matplotlib figure
Parameters
----------
filepath: String
\tPath of export file
data: Matplotlib Figure
\tMatplotlib figure that is eported
format: String in ["png", "pdf", "ps", "eps", "svg"]
"""
formats = ["svg", "eps", "ps", "pdf", "png"]
assert format in formats
data = fig2x(data, format)
try:
outfile = open(filepath, "wb")
outfile.write(data)
except IOError, err:
msg = _("The file {filepath} could not be fully written\n \n"
"Error message:\n{msg}")
msg = msg.format(filepath=filepath, msg=err)
short_msg = _('Error writing SVG file')
self.main_window.interfaces.display_warning(msg, short_msg)
finally:
outfile.close() | python | def _export_figure(self, filepath, data, format):
formats = ["svg", "eps", "ps", "pdf", "png"]
assert format in formats
data = fig2x(data, format)
try:
outfile = open(filepath, "wb")
outfile.write(data)
except IOError, err:
msg = _("The file {filepath} could not be fully written\n \n"
"Error message:\n{msg}")
msg = msg.format(filepath=filepath, msg=err)
short_msg = _('Error writing SVG file')
self.main_window.interfaces.display_warning(msg, short_msg)
finally:
outfile.close() | [
"def",
"_export_figure",
"(",
"self",
",",
"filepath",
",",
"data",
",",
"format",
")",
":",
"formats",
"=",
"[",
"\"svg\"",
",",
"\"eps\"",
",",
"\"ps\"",
",",
"\"pdf\"",
",",
"\"png\"",
"]",
"assert",
"format",
"in",
"formats",
"data",
"=",
"fig2x",
"(",
"data",
",",
"format",
")",
"try",
":",
"outfile",
"=",
"open",
"(",
"filepath",
",",
"\"wb\"",
")",
"outfile",
".",
"write",
"(",
"data",
")",
"except",
"IOError",
",",
"err",
":",
"msg",
"=",
"_",
"(",
"\"The file {filepath} could not be fully written\\n \\n\"",
"\"Error message:\\n{msg}\"",
")",
"msg",
"=",
"msg",
".",
"format",
"(",
"filepath",
"=",
"filepath",
",",
"msg",
"=",
"err",
")",
"short_msg",
"=",
"_",
"(",
"'Error writing SVG file'",
")",
"self",
".",
"main_window",
".",
"interfaces",
".",
"display_warning",
"(",
"msg",
",",
"short_msg",
")",
"finally",
":",
"outfile",
".",
"close",
"(",
")"
] | Export of single cell that contains a matplotlib figure
Parameters
----------
filepath: String
\tPath of export file
data: Matplotlib Figure
\tMatplotlib figure that is eported
format: String in ["png", "pdf", "ps", "eps", "svg"] | [
"Export",
"of",
"single",
"cell",
"that",
"contains",
"a",
"matplotlib",
"figure"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/actions/_main_window_actions.py#L187-L217 |
250,145 | manns/pyspread | pyspread/src/actions/_main_window_actions.py | ExchangeActions.export_file | def export_file(self, filepath, __filter, data, preview_data=None):
"""Export data for other applications
Parameters
----------
filepath: String
\tPath of export file
__filter: String
\tImport filter
data: Object
\tCode array result object slice, i. e. one object or iterable of
\tsuch objects
"""
if __filter.startswith("cell_"):
self._export_figure(filepath, data, __filter[5:])
elif __filter == "csv":
self._export_csv(filepath, data, preview_data=preview_data)
elif __filter in ["pdf", "svg"]:
self.export_cairo(filepath, __filter) | python | def export_file(self, filepath, __filter, data, preview_data=None):
if __filter.startswith("cell_"):
self._export_figure(filepath, data, __filter[5:])
elif __filter == "csv":
self._export_csv(filepath, data, preview_data=preview_data)
elif __filter in ["pdf", "svg"]:
self.export_cairo(filepath, __filter) | [
"def",
"export_file",
"(",
"self",
",",
"filepath",
",",
"__filter",
",",
"data",
",",
"preview_data",
"=",
"None",
")",
":",
"if",
"__filter",
".",
"startswith",
"(",
"\"cell_\"",
")",
":",
"self",
".",
"_export_figure",
"(",
"filepath",
",",
"data",
",",
"__filter",
"[",
"5",
":",
"]",
")",
"elif",
"__filter",
"==",
"\"csv\"",
":",
"self",
".",
"_export_csv",
"(",
"filepath",
",",
"data",
",",
"preview_data",
"=",
"preview_data",
")",
"elif",
"__filter",
"in",
"[",
"\"pdf\"",
",",
"\"svg\"",
"]",
":",
"self",
".",
"export_cairo",
"(",
"filepath",
",",
"__filter",
")"
] | Export data for other applications
Parameters
----------
filepath: String
\tPath of export file
__filter: String
\tImport filter
data: Object
\tCode array result object slice, i. e. one object or iterable of
\tsuch objects | [
"Export",
"data",
"for",
"other",
"applications"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/actions/_main_window_actions.py#L219-L241 |
250,146 | manns/pyspread | pyspread/src/actions/_main_window_actions.py | ExchangeActions.get_print_rect | def get_print_rect(self, grid_rect):
"""Returns wx.Rect that is correctly positioned on the print canvas"""
grid = self.grid
rect_x = grid_rect.x - \
grid.GetScrollPos(wx.HORIZONTAL) * grid.GetScrollLineX()
rect_y = grid_rect.y - \
grid.GetScrollPos(wx.VERTICAL) * grid.GetScrollLineY()
return wx.Rect(rect_x, rect_y, grid_rect.width, grid_rect.height) | python | def get_print_rect(self, grid_rect):
grid = self.grid
rect_x = grid_rect.x - \
grid.GetScrollPos(wx.HORIZONTAL) * grid.GetScrollLineX()
rect_y = grid_rect.y - \
grid.GetScrollPos(wx.VERTICAL) * grid.GetScrollLineY()
return wx.Rect(rect_x, rect_y, grid_rect.width, grid_rect.height) | [
"def",
"get_print_rect",
"(",
"self",
",",
"grid_rect",
")",
":",
"grid",
"=",
"self",
".",
"grid",
"rect_x",
"=",
"grid_rect",
".",
"x",
"-",
"grid",
".",
"GetScrollPos",
"(",
"wx",
".",
"HORIZONTAL",
")",
"*",
"grid",
".",
"GetScrollLineX",
"(",
")",
"rect_y",
"=",
"grid_rect",
".",
"y",
"-",
"grid",
".",
"GetScrollPos",
"(",
"wx",
".",
"VERTICAL",
")",
"*",
"grid",
".",
"GetScrollLineY",
"(",
")",
"return",
"wx",
".",
"Rect",
"(",
"rect_x",
",",
"rect_y",
",",
"grid_rect",
".",
"width",
",",
"grid_rect",
".",
"height",
")"
] | Returns wx.Rect that is correctly positioned on the print canvas | [
"Returns",
"wx",
".",
"Rect",
"that",
"is",
"correctly",
"positioned",
"on",
"the",
"print",
"canvas"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/actions/_main_window_actions.py#L243-L253 |
250,147 | manns/pyspread | pyspread/src/actions/_main_window_actions.py | ExchangeActions.export_cairo | def export_cairo(self, filepath, filetype):
"""Exports grid to the PDF file filepath
Parameters
----------
filepath: String
\tPath of file to export
filetype in ["pdf", "svg"]
\tType of file to export
"""
if cairo is None:
return
export_info = \
self.main_window.interfaces.get_cairo_export_info(filetype)
if export_info is None:
# Dialog has been canceled
return
top_row = max(0, export_info["top_row"])
bottom_row = min(self.grid.code_array.shape[0] - 1,
export_info["bottom_row"])
left_col = max(0, export_info["left_col"])
right_col = min(self.grid.code_array.shape[1] - 1,
export_info["right_col"])
first_tab = max(0, export_info["first_tab"])
last_tab = min(self.grid.code_array.shape[2] - 1,
export_info["last_tab"])
width = export_info["paper_width"]
height = export_info["paper_height"]
orientation = export_info["orientation"]
if orientation == "landscape":
width, height = height, width
if filetype == "pdf":
surface = cairo.PDFSurface(filepath, width, height)
elif filetype == "svg":
surface = cairo.SVGSurface(filepath, width, height)
else:
msg = "Export filetype {filtype} not supported.".format(
filetype=filetype)
raise ValueError(msg)
context = cairo.Context(surface)
grid_cairo_renderer = GridCairoRenderer(
context,
self.code_array,
(top_row, bottom_row + 1),
(left_col, right_col + 1),
(first_tab, last_tab + 1),
width,
height,
orientation,
view_frozen=self.grid._view_frozen,
)
grid_cairo_renderer.draw()
# Finish is required for matplotlib figures
surface.finish() | python | def export_cairo(self, filepath, filetype):
if cairo is None:
return
export_info = \
self.main_window.interfaces.get_cairo_export_info(filetype)
if export_info is None:
# Dialog has been canceled
return
top_row = max(0, export_info["top_row"])
bottom_row = min(self.grid.code_array.shape[0] - 1,
export_info["bottom_row"])
left_col = max(0, export_info["left_col"])
right_col = min(self.grid.code_array.shape[1] - 1,
export_info["right_col"])
first_tab = max(0, export_info["first_tab"])
last_tab = min(self.grid.code_array.shape[2] - 1,
export_info["last_tab"])
width = export_info["paper_width"]
height = export_info["paper_height"]
orientation = export_info["orientation"]
if orientation == "landscape":
width, height = height, width
if filetype == "pdf":
surface = cairo.PDFSurface(filepath, width, height)
elif filetype == "svg":
surface = cairo.SVGSurface(filepath, width, height)
else:
msg = "Export filetype {filtype} not supported.".format(
filetype=filetype)
raise ValueError(msg)
context = cairo.Context(surface)
grid_cairo_renderer = GridCairoRenderer(
context,
self.code_array,
(top_row, bottom_row + 1),
(left_col, right_col + 1),
(first_tab, last_tab + 1),
width,
height,
orientation,
view_frozen=self.grid._view_frozen,
)
grid_cairo_renderer.draw()
# Finish is required for matplotlib figures
surface.finish() | [
"def",
"export_cairo",
"(",
"self",
",",
"filepath",
",",
"filetype",
")",
":",
"if",
"cairo",
"is",
"None",
":",
"return",
"export_info",
"=",
"self",
".",
"main_window",
".",
"interfaces",
".",
"get_cairo_export_info",
"(",
"filetype",
")",
"if",
"export_info",
"is",
"None",
":",
"# Dialog has been canceled",
"return",
"top_row",
"=",
"max",
"(",
"0",
",",
"export_info",
"[",
"\"top_row\"",
"]",
")",
"bottom_row",
"=",
"min",
"(",
"self",
".",
"grid",
".",
"code_array",
".",
"shape",
"[",
"0",
"]",
"-",
"1",
",",
"export_info",
"[",
"\"bottom_row\"",
"]",
")",
"left_col",
"=",
"max",
"(",
"0",
",",
"export_info",
"[",
"\"left_col\"",
"]",
")",
"right_col",
"=",
"min",
"(",
"self",
".",
"grid",
".",
"code_array",
".",
"shape",
"[",
"1",
"]",
"-",
"1",
",",
"export_info",
"[",
"\"right_col\"",
"]",
")",
"first_tab",
"=",
"max",
"(",
"0",
",",
"export_info",
"[",
"\"first_tab\"",
"]",
")",
"last_tab",
"=",
"min",
"(",
"self",
".",
"grid",
".",
"code_array",
".",
"shape",
"[",
"2",
"]",
"-",
"1",
",",
"export_info",
"[",
"\"last_tab\"",
"]",
")",
"width",
"=",
"export_info",
"[",
"\"paper_width\"",
"]",
"height",
"=",
"export_info",
"[",
"\"paper_height\"",
"]",
"orientation",
"=",
"export_info",
"[",
"\"orientation\"",
"]",
"if",
"orientation",
"==",
"\"landscape\"",
":",
"width",
",",
"height",
"=",
"height",
",",
"width",
"if",
"filetype",
"==",
"\"pdf\"",
":",
"surface",
"=",
"cairo",
".",
"PDFSurface",
"(",
"filepath",
",",
"width",
",",
"height",
")",
"elif",
"filetype",
"==",
"\"svg\"",
":",
"surface",
"=",
"cairo",
".",
"SVGSurface",
"(",
"filepath",
",",
"width",
",",
"height",
")",
"else",
":",
"msg",
"=",
"\"Export filetype {filtype} not supported.\"",
".",
"format",
"(",
"filetype",
"=",
"filetype",
")",
"raise",
"ValueError",
"(",
"msg",
")",
"context",
"=",
"cairo",
".",
"Context",
"(",
"surface",
")",
"grid_cairo_renderer",
"=",
"GridCairoRenderer",
"(",
"context",
",",
"self",
".",
"code_array",
",",
"(",
"top_row",
",",
"bottom_row",
"+",
"1",
")",
",",
"(",
"left_col",
",",
"right_col",
"+",
"1",
")",
",",
"(",
"first_tab",
",",
"last_tab",
"+",
"1",
")",
",",
"width",
",",
"height",
",",
"orientation",
",",
"view_frozen",
"=",
"self",
".",
"grid",
".",
"_view_frozen",
",",
")",
"grid_cairo_renderer",
".",
"draw",
"(",
")",
"# Finish is required for matplotlib figures",
"surface",
".",
"finish",
"(",
")"
] | Exports grid to the PDF file filepath
Parameters
----------
filepath: String
\tPath of file to export
filetype in ["pdf", "svg"]
\tType of file to export | [
"Exports",
"grid",
"to",
"the",
"PDF",
"file",
"filepath"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/actions/_main_window_actions.py#L255-L319 |
250,148 | manns/pyspread | pyspread/src/actions/_main_window_actions.py | PrintActions.print_preview | def print_preview(self, print_area, print_data):
"""Launch print preview"""
if cairo is None:
return
print_info = \
self.main_window.interfaces.get_cairo_export_info("Print")
if print_info is None:
# Dialog has been canceled
return
printout_preview = Printout(self.grid, print_data, print_info)
printout_printing = Printout(self.grid, print_data, print_info)
preview = wx.PrintPreview(printout_preview, printout_printing,
print_data)
if not preview.Ok():
# Printout preview failed
return
pfrm = wx.PreviewFrame(preview, self.main_window, _("Print preview"))
pfrm.Initialize()
pfrm.SetPosition(self.main_window.GetPosition())
pfrm.SetSize(self.main_window.GetSize())
pfrm.Show(True) | python | def print_preview(self, print_area, print_data):
if cairo is None:
return
print_info = \
self.main_window.interfaces.get_cairo_export_info("Print")
if print_info is None:
# Dialog has been canceled
return
printout_preview = Printout(self.grid, print_data, print_info)
printout_printing = Printout(self.grid, print_data, print_info)
preview = wx.PrintPreview(printout_preview, printout_printing,
print_data)
if not preview.Ok():
# Printout preview failed
return
pfrm = wx.PreviewFrame(preview, self.main_window, _("Print preview"))
pfrm.Initialize()
pfrm.SetPosition(self.main_window.GetPosition())
pfrm.SetSize(self.main_window.GetSize())
pfrm.Show(True) | [
"def",
"print_preview",
"(",
"self",
",",
"print_area",
",",
"print_data",
")",
":",
"if",
"cairo",
"is",
"None",
":",
"return",
"print_info",
"=",
"self",
".",
"main_window",
".",
"interfaces",
".",
"get_cairo_export_info",
"(",
"\"Print\"",
")",
"if",
"print_info",
"is",
"None",
":",
"# Dialog has been canceled",
"return",
"printout_preview",
"=",
"Printout",
"(",
"self",
".",
"grid",
",",
"print_data",
",",
"print_info",
")",
"printout_printing",
"=",
"Printout",
"(",
"self",
".",
"grid",
",",
"print_data",
",",
"print_info",
")",
"preview",
"=",
"wx",
".",
"PrintPreview",
"(",
"printout_preview",
",",
"printout_printing",
",",
"print_data",
")",
"if",
"not",
"preview",
".",
"Ok",
"(",
")",
":",
"# Printout preview failed",
"return",
"pfrm",
"=",
"wx",
".",
"PreviewFrame",
"(",
"preview",
",",
"self",
".",
"main_window",
",",
"_",
"(",
"\"Print preview\"",
")",
")",
"pfrm",
".",
"Initialize",
"(",
")",
"pfrm",
".",
"SetPosition",
"(",
"self",
".",
"main_window",
".",
"GetPosition",
"(",
")",
")",
"pfrm",
".",
"SetSize",
"(",
"self",
".",
"main_window",
".",
"GetSize",
"(",
")",
")",
"pfrm",
".",
"Show",
"(",
"True",
")"
] | Launch print preview | [
"Launch",
"print",
"preview"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/actions/_main_window_actions.py#L325-L353 |
250,149 | manns/pyspread | pyspread/src/actions/_main_window_actions.py | PrintActions.printout | def printout(self, print_area, print_data):
"""Print out print area
See:
http://aspn.activestate.com/ASPN/Mail/Message/wxpython-users/3471083
"""
print_info = \
self.main_window.interfaces.get_cairo_export_info("Print")
if print_info is None:
# Dialog has been canceled
return
pdd = wx.PrintDialogData(print_data)
printer = wx.Printer(pdd)
printout = Printout(self.grid, print_data, print_info)
if printer.Print(self.main_window, printout, True):
self.print_data = \
wx.PrintData(printer.GetPrintDialogData().GetPrintData())
printout.Destroy() | python | def printout(self, print_area, print_data):
print_info = \
self.main_window.interfaces.get_cairo_export_info("Print")
if print_info is None:
# Dialog has been canceled
return
pdd = wx.PrintDialogData(print_data)
printer = wx.Printer(pdd)
printout = Printout(self.grid, print_data, print_info)
if printer.Print(self.main_window, printout, True):
self.print_data = \
wx.PrintData(printer.GetPrintDialogData().GetPrintData())
printout.Destroy() | [
"def",
"printout",
"(",
"self",
",",
"print_area",
",",
"print_data",
")",
":",
"print_info",
"=",
"self",
".",
"main_window",
".",
"interfaces",
".",
"get_cairo_export_info",
"(",
"\"Print\"",
")",
"if",
"print_info",
"is",
"None",
":",
"# Dialog has been canceled",
"return",
"pdd",
"=",
"wx",
".",
"PrintDialogData",
"(",
"print_data",
")",
"printer",
"=",
"wx",
".",
"Printer",
"(",
"pdd",
")",
"printout",
"=",
"Printout",
"(",
"self",
".",
"grid",
",",
"print_data",
",",
"print_info",
")",
"if",
"printer",
".",
"Print",
"(",
"self",
".",
"main_window",
",",
"printout",
",",
"True",
")",
":",
"self",
".",
"print_data",
"=",
"wx",
".",
"PrintData",
"(",
"printer",
".",
"GetPrintDialogData",
"(",
")",
".",
"GetPrintData",
"(",
")",
")",
"printout",
".",
"Destroy",
"(",
")"
] | Print out print area
See:
http://aspn.activestate.com/ASPN/Mail/Message/wxpython-users/3471083 | [
"Print",
"out",
"print",
"area"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/actions/_main_window_actions.py#L355-L379 |
250,150 | manns/pyspread | pyspread/src/actions/_main_window_actions.py | ClipboardActions.copy | def copy(self, selection, getter=None, delete=False):
"""Returns code from selection in a tab separated string
Cells that are not in selection are included as empty.
Parameters
----------
selection: Selection object
\tSelection of cells in current table that shall be copied
getter: Function, defaults to _get_code
\tGetter function for copy content
delete: Bool
\tDeletes all cells inside selection
"""
if getter is None:
getter = self._get_code
tab = self.grid.current_table
selection_bbox = selection.get_bbox()
if not selection_bbox:
# There is no selection
bb_top, bb_left = self.grid.actions.cursor[:2]
bb_bottom, bb_right = bb_top, bb_left
else:
replace_none = self.main_window.grid.actions._replace_bbox_none
(bb_top, bb_left), (bb_bottom, bb_right) = \
replace_none(selection.get_bbox())
data = []
for __row in xrange(bb_top, bb_bottom + 1):
data.append([])
for __col in xrange(bb_left, bb_right + 1):
# Only copy content if cell is in selection or
# if there is no selection
if (__row, __col) in selection or not selection_bbox:
content = getter((__row, __col, tab))
# Delete cell if delete flag is set
if delete:
try:
self.grid.code_array.pop((__row, __col, tab))
except KeyError:
pass
# Store data
if content is None:
data[-1].append(u"")
else:
data[-1].append(content)
else:
data[-1].append(u"")
return "\n".join("\t".join(line) for line in data) | python | def copy(self, selection, getter=None, delete=False):
if getter is None:
getter = self._get_code
tab = self.grid.current_table
selection_bbox = selection.get_bbox()
if not selection_bbox:
# There is no selection
bb_top, bb_left = self.grid.actions.cursor[:2]
bb_bottom, bb_right = bb_top, bb_left
else:
replace_none = self.main_window.grid.actions._replace_bbox_none
(bb_top, bb_left), (bb_bottom, bb_right) = \
replace_none(selection.get_bbox())
data = []
for __row in xrange(bb_top, bb_bottom + 1):
data.append([])
for __col in xrange(bb_left, bb_right + 1):
# Only copy content if cell is in selection or
# if there is no selection
if (__row, __col) in selection or not selection_bbox:
content = getter((__row, __col, tab))
# Delete cell if delete flag is set
if delete:
try:
self.grid.code_array.pop((__row, __col, tab))
except KeyError:
pass
# Store data
if content is None:
data[-1].append(u"")
else:
data[-1].append(content)
else:
data[-1].append(u"")
return "\n".join("\t".join(line) for line in data) | [
"def",
"copy",
"(",
"self",
",",
"selection",
",",
"getter",
"=",
"None",
",",
"delete",
"=",
"False",
")",
":",
"if",
"getter",
"is",
"None",
":",
"getter",
"=",
"self",
".",
"_get_code",
"tab",
"=",
"self",
".",
"grid",
".",
"current_table",
"selection_bbox",
"=",
"selection",
".",
"get_bbox",
"(",
")",
"if",
"not",
"selection_bbox",
":",
"# There is no selection",
"bb_top",
",",
"bb_left",
"=",
"self",
".",
"grid",
".",
"actions",
".",
"cursor",
"[",
":",
"2",
"]",
"bb_bottom",
",",
"bb_right",
"=",
"bb_top",
",",
"bb_left",
"else",
":",
"replace_none",
"=",
"self",
".",
"main_window",
".",
"grid",
".",
"actions",
".",
"_replace_bbox_none",
"(",
"bb_top",
",",
"bb_left",
")",
",",
"(",
"bb_bottom",
",",
"bb_right",
")",
"=",
"replace_none",
"(",
"selection",
".",
"get_bbox",
"(",
")",
")",
"data",
"=",
"[",
"]",
"for",
"__row",
"in",
"xrange",
"(",
"bb_top",
",",
"bb_bottom",
"+",
"1",
")",
":",
"data",
".",
"append",
"(",
"[",
"]",
")",
"for",
"__col",
"in",
"xrange",
"(",
"bb_left",
",",
"bb_right",
"+",
"1",
")",
":",
"# Only copy content if cell is in selection or",
"# if there is no selection",
"if",
"(",
"__row",
",",
"__col",
")",
"in",
"selection",
"or",
"not",
"selection_bbox",
":",
"content",
"=",
"getter",
"(",
"(",
"__row",
",",
"__col",
",",
"tab",
")",
")",
"# Delete cell if delete flag is set",
"if",
"delete",
":",
"try",
":",
"self",
".",
"grid",
".",
"code_array",
".",
"pop",
"(",
"(",
"__row",
",",
"__col",
",",
"tab",
")",
")",
"except",
"KeyError",
":",
"pass",
"# Store data",
"if",
"content",
"is",
"None",
":",
"data",
"[",
"-",
"1",
"]",
".",
"append",
"(",
"u\"\"",
")",
"else",
":",
"data",
"[",
"-",
"1",
"]",
".",
"append",
"(",
"content",
")",
"else",
":",
"data",
"[",
"-",
"1",
"]",
".",
"append",
"(",
"u\"\"",
")",
"return",
"\"\\n\"",
".",
"join",
"(",
"\"\\t\"",
".",
"join",
"(",
"line",
")",
"for",
"line",
"in",
"data",
")"
] | Returns code from selection in a tab separated string
Cells that are not in selection are included as empty.
Parameters
----------
selection: Selection object
\tSelection of cells in current table that shall be copied
getter: Function, defaults to _get_code
\tGetter function for copy content
delete: Bool
\tDeletes all cells inside selection | [
"Returns",
"code",
"from",
"selection",
"in",
"a",
"tab",
"separated",
"string"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/actions/_main_window_actions.py#L416-L481 |
250,151 | manns/pyspread | pyspread/src/actions/_main_window_actions.py | ClipboardActions.img2code | def img2code(self, key, img):
"""Pastes wx.Image into single cell"""
code_template = \
"wx.ImageFromData({width}, {height}, " + \
"bz2.decompress(base64.b64decode('{data}'))).ConvertToBitmap()"
code_alpha_template = \
"wx.ImageFromDataWithAlpha({width}, {height}, " + \
"bz2.decompress(base64.b64decode('{data}')), " + \
"bz2.decompress(base64.b64decode('{alpha}'))).ConvertToBitmap()"
data = base64.b64encode(bz2.compress(img.GetData(), 9))
if img.HasAlpha():
alpha = base64.b64encode(bz2.compress(img.GetAlphaData(), 9))
code_str = code_alpha_template.format(
width=img.GetWidth(), height=img.GetHeight(),
data=data, alpha=alpha)
else:
code_str = code_template.format(width=img.GetWidth(),
height=img.GetHeight(), data=data)
return code_str | python | def img2code(self, key, img):
code_template = \
"wx.ImageFromData({width}, {height}, " + \
"bz2.decompress(base64.b64decode('{data}'))).ConvertToBitmap()"
code_alpha_template = \
"wx.ImageFromDataWithAlpha({width}, {height}, " + \
"bz2.decompress(base64.b64decode('{data}')), " + \
"bz2.decompress(base64.b64decode('{alpha}'))).ConvertToBitmap()"
data = base64.b64encode(bz2.compress(img.GetData(), 9))
if img.HasAlpha():
alpha = base64.b64encode(bz2.compress(img.GetAlphaData(), 9))
code_str = code_alpha_template.format(
width=img.GetWidth(), height=img.GetHeight(),
data=data, alpha=alpha)
else:
code_str = code_template.format(width=img.GetWidth(),
height=img.GetHeight(), data=data)
return code_str | [
"def",
"img2code",
"(",
"self",
",",
"key",
",",
"img",
")",
":",
"code_template",
"=",
"\"wx.ImageFromData({width}, {height}, \"",
"+",
"\"bz2.decompress(base64.b64decode('{data}'))).ConvertToBitmap()\"",
"code_alpha_template",
"=",
"\"wx.ImageFromDataWithAlpha({width}, {height}, \"",
"+",
"\"bz2.decompress(base64.b64decode('{data}')), \"",
"+",
"\"bz2.decompress(base64.b64decode('{alpha}'))).ConvertToBitmap()\"",
"data",
"=",
"base64",
".",
"b64encode",
"(",
"bz2",
".",
"compress",
"(",
"img",
".",
"GetData",
"(",
")",
",",
"9",
")",
")",
"if",
"img",
".",
"HasAlpha",
"(",
")",
":",
"alpha",
"=",
"base64",
".",
"b64encode",
"(",
"bz2",
".",
"compress",
"(",
"img",
".",
"GetAlphaData",
"(",
")",
",",
"9",
")",
")",
"code_str",
"=",
"code_alpha_template",
".",
"format",
"(",
"width",
"=",
"img",
".",
"GetWidth",
"(",
")",
",",
"height",
"=",
"img",
".",
"GetHeight",
"(",
")",
",",
"data",
"=",
"data",
",",
"alpha",
"=",
"alpha",
")",
"else",
":",
"code_str",
"=",
"code_template",
".",
"format",
"(",
"width",
"=",
"img",
".",
"GetWidth",
"(",
")",
",",
"height",
"=",
"img",
".",
"GetHeight",
"(",
")",
",",
"data",
"=",
"data",
")",
"return",
"code_str"
] | Pastes wx.Image into single cell | [
"Pastes",
"wx",
".",
"Image",
"into",
"single",
"cell"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/actions/_main_window_actions.py#L555-L578 |
250,152 | manns/pyspread | pyspread/src/actions/_main_window_actions.py | ClipboardActions._get_paste_data_gen | def _get_paste_data_gen(self, key, data):
"""Generator for paste data
Can be used in grid.actions.paste
"""
if type(data) is wx._gdi.Bitmap:
code_str = self.bmp2code(key, data)
return [[code_str]]
else:
return (line.split("\t") for line in data.split("\n")) | python | def _get_paste_data_gen(self, key, data):
if type(data) is wx._gdi.Bitmap:
code_str = self.bmp2code(key, data)
return [[code_str]]
else:
return (line.split("\t") for line in data.split("\n")) | [
"def",
"_get_paste_data_gen",
"(",
"self",
",",
"key",
",",
"data",
")",
":",
"if",
"type",
"(",
"data",
")",
"is",
"wx",
".",
"_gdi",
".",
"Bitmap",
":",
"code_str",
"=",
"self",
".",
"bmp2code",
"(",
"key",
",",
"data",
")",
"return",
"[",
"[",
"code_str",
"]",
"]",
"else",
":",
"return",
"(",
"line",
".",
"split",
"(",
"\"\\t\"",
")",
"for",
"line",
"in",
"data",
".",
"split",
"(",
"\"\\n\"",
")",
")"
] | Generator for paste data
Can be used in grid.actions.paste | [
"Generator",
"for",
"paste",
"data"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/actions/_main_window_actions.py#L585-L596 |
250,153 | manns/pyspread | pyspread/src/actions/_main_window_actions.py | ClipboardActions.paste | def paste(self, key, data):
"""Pastes data into grid
Parameters
----------
key: 2-Tuple of Integer
\tTop left cell
data: String or wx.Bitmap
\tTab separated string of paste data
\tor paste data image
"""
data_gen = self._get_paste_data_gen(key, data)
self.grid.actions.paste(key[:2], data_gen, freq=1000)
self.main_window.grid.ForceRefresh() | python | def paste(self, key, data):
data_gen = self._get_paste_data_gen(key, data)
self.grid.actions.paste(key[:2], data_gen, freq=1000)
self.main_window.grid.ForceRefresh() | [
"def",
"paste",
"(",
"self",
",",
"key",
",",
"data",
")",
":",
"data_gen",
"=",
"self",
".",
"_get_paste_data_gen",
"(",
"key",
",",
"data",
")",
"self",
".",
"grid",
".",
"actions",
".",
"paste",
"(",
"key",
"[",
":",
"2",
"]",
",",
"data_gen",
",",
"freq",
"=",
"1000",
")",
"self",
".",
"main_window",
".",
"grid",
".",
"ForceRefresh",
"(",
")"
] | Pastes data into grid
Parameters
----------
key: 2-Tuple of Integer
\tTop left cell
data: String or wx.Bitmap
\tTab separated string of paste data
\tor paste data image | [
"Pastes",
"data",
"into",
"grid"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/actions/_main_window_actions.py#L598-L615 |
250,154 | manns/pyspread | pyspread/src/actions/_main_window_actions.py | ClipboardActions._get_pasteas_data | def _get_pasteas_data(self, dim, obj):
"""Returns list of lists of obj than has dimensionality dim
Parameters
----------
dim: Integer
\tDimensionality of obj
obj: Object
\tIterable object of dimensionality dim
"""
if dim == 0:
return [[repr(obj)]]
elif dim == 1:
return [[repr(o)] for o in obj]
elif dim == 2:
return [map(repr, o) for o in obj] | python | def _get_pasteas_data(self, dim, obj):
if dim == 0:
return [[repr(obj)]]
elif dim == 1:
return [[repr(o)] for o in obj]
elif dim == 2:
return [map(repr, o) for o in obj] | [
"def",
"_get_pasteas_data",
"(",
"self",
",",
"dim",
",",
"obj",
")",
":",
"if",
"dim",
"==",
"0",
":",
"return",
"[",
"[",
"repr",
"(",
"obj",
")",
"]",
"]",
"elif",
"dim",
"==",
"1",
":",
"return",
"[",
"[",
"repr",
"(",
"o",
")",
"]",
"for",
"o",
"in",
"obj",
"]",
"elif",
"dim",
"==",
"2",
":",
"return",
"[",
"map",
"(",
"repr",
",",
"o",
")",
"for",
"o",
"in",
"obj",
"]"
] | Returns list of lists of obj than has dimensionality dim
Parameters
----------
dim: Integer
\tDimensionality of obj
obj: Object
\tIterable object of dimensionality dim | [
"Returns",
"list",
"of",
"lists",
"of",
"obj",
"than",
"has",
"dimensionality",
"dim"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/actions/_main_window_actions.py#L617-L634 |
250,155 | manns/pyspread | pyspread/src/actions/_main_window_actions.py | ClipboardActions.paste_as | def paste_as(self, key, data):
"""Paste and transform data
Data may be given as a Python code as well as a tab separated
multi-line strings similar to paste.
"""
def error_msg(err):
msg = _("Error evaluating data: ") + str(err)
post_command_event(self.main_window, self.StatusBarMsg, text=msg)
interfaces = self.main_window.interfaces
key = self.main_window.grid.actions.cursor
try:
obj = ast.literal_eval(data)
except (SyntaxError, AttributeError):
# This is no Python code so te try to interpret it as paste data
try:
obj = [map(ast.literal_eval, line.split("\t"))
for line in data.split("\n")]
except Exception, err:
# This must just be text.
try:
obj = [line.split('\t') for line in data.split('\n')]
except Exception, err:
# Now I really have no idea
error_msg(err)
return
except ValueError, err:
error_msg(err)
return
parameters = interfaces.get_pasteas_parameters_from_user(obj)
if parameters is None:
# Dialog aborted
return
paste_data = self._get_pasteas_data(parameters["dim"], obj)
if parameters["transpose"]:
paste_data = zip(*paste_data)
self.main_window.grid.actions.paste(key, paste_data, freq=1000) | python | def paste_as(self, key, data):
def error_msg(err):
msg = _("Error evaluating data: ") + str(err)
post_command_event(self.main_window, self.StatusBarMsg, text=msg)
interfaces = self.main_window.interfaces
key = self.main_window.grid.actions.cursor
try:
obj = ast.literal_eval(data)
except (SyntaxError, AttributeError):
# This is no Python code so te try to interpret it as paste data
try:
obj = [map(ast.literal_eval, line.split("\t"))
for line in data.split("\n")]
except Exception, err:
# This must just be text.
try:
obj = [line.split('\t') for line in data.split('\n')]
except Exception, err:
# Now I really have no idea
error_msg(err)
return
except ValueError, err:
error_msg(err)
return
parameters = interfaces.get_pasteas_parameters_from_user(obj)
if parameters is None:
# Dialog aborted
return
paste_data = self._get_pasteas_data(parameters["dim"], obj)
if parameters["transpose"]:
paste_data = zip(*paste_data)
self.main_window.grid.actions.paste(key, paste_data, freq=1000) | [
"def",
"paste_as",
"(",
"self",
",",
"key",
",",
"data",
")",
":",
"def",
"error_msg",
"(",
"err",
")",
":",
"msg",
"=",
"_",
"(",
"\"Error evaluating data: \"",
")",
"+",
"str",
"(",
"err",
")",
"post_command_event",
"(",
"self",
".",
"main_window",
",",
"self",
".",
"StatusBarMsg",
",",
"text",
"=",
"msg",
")",
"interfaces",
"=",
"self",
".",
"main_window",
".",
"interfaces",
"key",
"=",
"self",
".",
"main_window",
".",
"grid",
".",
"actions",
".",
"cursor",
"try",
":",
"obj",
"=",
"ast",
".",
"literal_eval",
"(",
"data",
")",
"except",
"(",
"SyntaxError",
",",
"AttributeError",
")",
":",
"# This is no Python code so te try to interpret it as paste data",
"try",
":",
"obj",
"=",
"[",
"map",
"(",
"ast",
".",
"literal_eval",
",",
"line",
".",
"split",
"(",
"\"\\t\"",
")",
")",
"for",
"line",
"in",
"data",
".",
"split",
"(",
"\"\\n\"",
")",
"]",
"except",
"Exception",
",",
"err",
":",
"# This must just be text.",
"try",
":",
"obj",
"=",
"[",
"line",
".",
"split",
"(",
"'\\t'",
")",
"for",
"line",
"in",
"data",
".",
"split",
"(",
"'\\n'",
")",
"]",
"except",
"Exception",
",",
"err",
":",
"# Now I really have no idea",
"error_msg",
"(",
"err",
")",
"return",
"except",
"ValueError",
",",
"err",
":",
"error_msg",
"(",
"err",
")",
"return",
"parameters",
"=",
"interfaces",
".",
"get_pasteas_parameters_from_user",
"(",
"obj",
")",
"if",
"parameters",
"is",
"None",
":",
"# Dialog aborted",
"return",
"paste_data",
"=",
"self",
".",
"_get_pasteas_data",
"(",
"parameters",
"[",
"\"dim\"",
"]",
",",
"obj",
")",
"if",
"parameters",
"[",
"\"transpose\"",
"]",
":",
"paste_data",
"=",
"zip",
"(",
"*",
"paste_data",
")",
"self",
".",
"main_window",
".",
"grid",
".",
"actions",
".",
"paste",
"(",
"key",
",",
"paste_data",
",",
"freq",
"=",
"1000",
")"
] | Paste and transform data
Data may be given as a Python code as well as a tab separated
multi-line strings similar to paste. | [
"Paste",
"and",
"transform",
"data"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/actions/_main_window_actions.py#L636-L684 |
250,156 | manns/pyspread | pyspread/src/actions/_main_window_actions.py | MacroActions.execute_macros | def execute_macros(self):
"""Executes macros and marks grid as changed"""
# Mark content as changed
post_command_event(self.main_window, self.ContentChangedMsg)
(result, err) = self.grid.code_array.execute_macros()
# Post event to macro dialog
post_command_event(self.main_window, self.MacroErrorMsg,
msg=result, err=err) | python | def execute_macros(self):
# Mark content as changed
post_command_event(self.main_window, self.ContentChangedMsg)
(result, err) = self.grid.code_array.execute_macros()
# Post event to macro dialog
post_command_event(self.main_window, self.MacroErrorMsg,
msg=result, err=err) | [
"def",
"execute_macros",
"(",
"self",
")",
":",
"# Mark content as changed",
"post_command_event",
"(",
"self",
".",
"main_window",
",",
"self",
".",
"ContentChangedMsg",
")",
"(",
"result",
",",
"err",
")",
"=",
"self",
".",
"grid",
".",
"code_array",
".",
"execute_macros",
"(",
")",
"# Post event to macro dialog",
"post_command_event",
"(",
"self",
".",
"main_window",
",",
"self",
".",
"MacroErrorMsg",
",",
"msg",
"=",
"result",
",",
"err",
"=",
"err",
")"
] | Executes macros and marks grid as changed | [
"Executes",
"macros",
"and",
"marks",
"grid",
"as",
"changed"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/actions/_main_window_actions.py#L695-L705 |
250,157 | manns/pyspread | pyspread/src/actions/_main_window_actions.py | MacroActions.open_macros | def open_macros(self, filepath):
"""Loads macros from file and marks grid as changed
Parameters
----------
filepath: String
\tPath to macro file
"""
try:
wx.BeginBusyCursor()
self.main_window.grid.Disable()
with open(filepath) as macro_infile:
# Enter safe mode
self.main_window.grid.actions.enter_safe_mode()
post_command_event(self.main_window, self.SafeModeEntryMsg)
# Mark content as changed
post_command_event(self.main_window, self.ContentChangedMsg)
macrocode = macro_infile.read()
self.grid.code_array.macros += "\n" + macrocode.strip("\n")
self.grid.main_window.macro_panel.codetext_ctrl.SetText(
self.grid.code_array.macros)
except IOError:
msg = _("Error opening file {filepath}.").format(filepath=filepath)
post_command_event(self.main_window, self.StatusBarMsg, text=msg)
return False
finally:
self.main_window.grid.Enable()
wx.EndBusyCursor()
# Mark content as changed
try:
post_command_event(self.main_window, self.ContentChangedMsg)
except TypeError:
# The main window does not exist any more
pass | python | def open_macros(self, filepath):
try:
wx.BeginBusyCursor()
self.main_window.grid.Disable()
with open(filepath) as macro_infile:
# Enter safe mode
self.main_window.grid.actions.enter_safe_mode()
post_command_event(self.main_window, self.SafeModeEntryMsg)
# Mark content as changed
post_command_event(self.main_window, self.ContentChangedMsg)
macrocode = macro_infile.read()
self.grid.code_array.macros += "\n" + macrocode.strip("\n")
self.grid.main_window.macro_panel.codetext_ctrl.SetText(
self.grid.code_array.macros)
except IOError:
msg = _("Error opening file {filepath}.").format(filepath=filepath)
post_command_event(self.main_window, self.StatusBarMsg, text=msg)
return False
finally:
self.main_window.grid.Enable()
wx.EndBusyCursor()
# Mark content as changed
try:
post_command_event(self.main_window, self.ContentChangedMsg)
except TypeError:
# The main window does not exist any more
pass | [
"def",
"open_macros",
"(",
"self",
",",
"filepath",
")",
":",
"try",
":",
"wx",
".",
"BeginBusyCursor",
"(",
")",
"self",
".",
"main_window",
".",
"grid",
".",
"Disable",
"(",
")",
"with",
"open",
"(",
"filepath",
")",
"as",
"macro_infile",
":",
"# Enter safe mode",
"self",
".",
"main_window",
".",
"grid",
".",
"actions",
".",
"enter_safe_mode",
"(",
")",
"post_command_event",
"(",
"self",
".",
"main_window",
",",
"self",
".",
"SafeModeEntryMsg",
")",
"# Mark content as changed",
"post_command_event",
"(",
"self",
".",
"main_window",
",",
"self",
".",
"ContentChangedMsg",
")",
"macrocode",
"=",
"macro_infile",
".",
"read",
"(",
")",
"self",
".",
"grid",
".",
"code_array",
".",
"macros",
"+=",
"\"\\n\"",
"+",
"macrocode",
".",
"strip",
"(",
"\"\\n\"",
")",
"self",
".",
"grid",
".",
"main_window",
".",
"macro_panel",
".",
"codetext_ctrl",
".",
"SetText",
"(",
"self",
".",
"grid",
".",
"code_array",
".",
"macros",
")",
"except",
"IOError",
":",
"msg",
"=",
"_",
"(",
"\"Error opening file {filepath}.\"",
")",
".",
"format",
"(",
"filepath",
"=",
"filepath",
")",
"post_command_event",
"(",
"self",
".",
"main_window",
",",
"self",
".",
"StatusBarMsg",
",",
"text",
"=",
"msg",
")",
"return",
"False",
"finally",
":",
"self",
".",
"main_window",
".",
"grid",
".",
"Enable",
"(",
")",
"wx",
".",
"EndBusyCursor",
"(",
")",
"# Mark content as changed",
"try",
":",
"post_command_event",
"(",
"self",
".",
"main_window",
",",
"self",
".",
"ContentChangedMsg",
")",
"except",
"TypeError",
":",
"# The main window does not exist any more",
"pass"
] | Loads macros from file and marks grid as changed
Parameters
----------
filepath: String
\tPath to macro file | [
"Loads",
"macros",
"from",
"file",
"and",
"marks",
"grid",
"as",
"changed"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/actions/_main_window_actions.py#L707-L751 |
250,158 | manns/pyspread | pyspread/src/actions/_main_window_actions.py | MacroActions.save_macros | def save_macros(self, filepath, macros):
"""Saves macros to file
Parameters
----------
filepath: String
\tPath to macro file
macros: String
\tMacro code
"""
io_error_text = _("Error writing to file {filepath}.")
io_error_text = io_error_text.format(filepath=filepath)
# Make sure that old macro file does not get lost on abort save
tmpfile = filepath + "~"
try:
wx.BeginBusyCursor()
self.main_window.grid.Disable()
with open(tmpfile, "w") as macro_outfile:
macro_outfile.write(macros)
# Move save file from temp file to filepath
try:
os.rename(tmpfile, filepath)
except OSError:
# No tmp file present
pass
except IOError:
try:
post_command_event(self.main_window, self.StatusBarMsg,
text=io_error_text)
except TypeError:
# The main window does not exist any more
pass
return False
finally:
self.main_window.grid.Enable()
wx.EndBusyCursor() | python | def save_macros(self, filepath, macros):
io_error_text = _("Error writing to file {filepath}.")
io_error_text = io_error_text.format(filepath=filepath)
# Make sure that old macro file does not get lost on abort save
tmpfile = filepath + "~"
try:
wx.BeginBusyCursor()
self.main_window.grid.Disable()
with open(tmpfile, "w") as macro_outfile:
macro_outfile.write(macros)
# Move save file from temp file to filepath
try:
os.rename(tmpfile, filepath)
except OSError:
# No tmp file present
pass
except IOError:
try:
post_command_event(self.main_window, self.StatusBarMsg,
text=io_error_text)
except TypeError:
# The main window does not exist any more
pass
return False
finally:
self.main_window.grid.Enable()
wx.EndBusyCursor() | [
"def",
"save_macros",
"(",
"self",
",",
"filepath",
",",
"macros",
")",
":",
"io_error_text",
"=",
"_",
"(",
"\"Error writing to file {filepath}.\"",
")",
"io_error_text",
"=",
"io_error_text",
".",
"format",
"(",
"filepath",
"=",
"filepath",
")",
"# Make sure that old macro file does not get lost on abort save",
"tmpfile",
"=",
"filepath",
"+",
"\"~\"",
"try",
":",
"wx",
".",
"BeginBusyCursor",
"(",
")",
"self",
".",
"main_window",
".",
"grid",
".",
"Disable",
"(",
")",
"with",
"open",
"(",
"tmpfile",
",",
"\"w\"",
")",
"as",
"macro_outfile",
":",
"macro_outfile",
".",
"write",
"(",
"macros",
")",
"# Move save file from temp file to filepath",
"try",
":",
"os",
".",
"rename",
"(",
"tmpfile",
",",
"filepath",
")",
"except",
"OSError",
":",
"# No tmp file present",
"pass",
"except",
"IOError",
":",
"try",
":",
"post_command_event",
"(",
"self",
".",
"main_window",
",",
"self",
".",
"StatusBarMsg",
",",
"text",
"=",
"io_error_text",
")",
"except",
"TypeError",
":",
"# The main window does not exist any more",
"pass",
"return",
"False",
"finally",
":",
"self",
".",
"main_window",
".",
"grid",
".",
"Enable",
"(",
")",
"wx",
".",
"EndBusyCursor",
"(",
")"
] | Saves macros to file
Parameters
----------
filepath: String
\tPath to macro file
macros: String
\tMacro code | [
"Saves",
"macros",
"to",
"file"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/actions/_main_window_actions.py#L753-L797 |
250,159 | manns/pyspread | pyspread/src/actions/_main_window_actions.py | HelpActions.launch_help | def launch_help(self, helpname, filename):
"""Generic help launcher
Launches HTMLWindow that shows content of filename
or the Internet page with the filename url
Parameters
----------
filename: String
\thtml file or url
"""
# Set up window
position = config["help_window_position"]
size = config["help_window_size"]
self.help_window = wx.Frame(self.main_window, -1,
helpname, position, size)
self.help_htmlwindow = wx.html.HtmlWindow(self.help_window, -1,
(0, 0), size)
self.help_window.Bind(wx.EVT_MOVE, self.OnHelpMove)
self.help_window.Bind(wx.EVT_SIZE, self.OnHelpSize)
self.help_htmlwindow.Bind(wx.EVT_RIGHT_DOWN, self.OnHelpBack)
self.help_htmlwindow.Bind(wx.html.EVT_HTML_LINK_CLICKED,
lambda e: self.open_external_links(e))
self.help_htmlwindow.Bind(wx.EVT_MOUSEWHEEL,
lambda e: self.zoom_html(e))
# Get help data
current_path = os.getcwd()
os.chdir(get_help_path())
try:
if os.path.isfile(filename):
self.help_htmlwindow.LoadFile(filename)
else:
self.help_htmlwindow.LoadPage(filename)
except IOError:
self.help_htmlwindow.LoadPage(filename)
# Show tutorial window
self.help_window.Show()
os.chdir(current_path) | python | def launch_help(self, helpname, filename):
# Set up window
position = config["help_window_position"]
size = config["help_window_size"]
self.help_window = wx.Frame(self.main_window, -1,
helpname, position, size)
self.help_htmlwindow = wx.html.HtmlWindow(self.help_window, -1,
(0, 0), size)
self.help_window.Bind(wx.EVT_MOVE, self.OnHelpMove)
self.help_window.Bind(wx.EVT_SIZE, self.OnHelpSize)
self.help_htmlwindow.Bind(wx.EVT_RIGHT_DOWN, self.OnHelpBack)
self.help_htmlwindow.Bind(wx.html.EVT_HTML_LINK_CLICKED,
lambda e: self.open_external_links(e))
self.help_htmlwindow.Bind(wx.EVT_MOUSEWHEEL,
lambda e: self.zoom_html(e))
# Get help data
current_path = os.getcwd()
os.chdir(get_help_path())
try:
if os.path.isfile(filename):
self.help_htmlwindow.LoadFile(filename)
else:
self.help_htmlwindow.LoadPage(filename)
except IOError:
self.help_htmlwindow.LoadPage(filename)
# Show tutorial window
self.help_window.Show()
os.chdir(current_path) | [
"def",
"launch_help",
"(",
"self",
",",
"helpname",
",",
"filename",
")",
":",
"# Set up window",
"position",
"=",
"config",
"[",
"\"help_window_position\"",
"]",
"size",
"=",
"config",
"[",
"\"help_window_size\"",
"]",
"self",
".",
"help_window",
"=",
"wx",
".",
"Frame",
"(",
"self",
".",
"main_window",
",",
"-",
"1",
",",
"helpname",
",",
"position",
",",
"size",
")",
"self",
".",
"help_htmlwindow",
"=",
"wx",
".",
"html",
".",
"HtmlWindow",
"(",
"self",
".",
"help_window",
",",
"-",
"1",
",",
"(",
"0",
",",
"0",
")",
",",
"size",
")",
"self",
".",
"help_window",
".",
"Bind",
"(",
"wx",
".",
"EVT_MOVE",
",",
"self",
".",
"OnHelpMove",
")",
"self",
".",
"help_window",
".",
"Bind",
"(",
"wx",
".",
"EVT_SIZE",
",",
"self",
".",
"OnHelpSize",
")",
"self",
".",
"help_htmlwindow",
".",
"Bind",
"(",
"wx",
".",
"EVT_RIGHT_DOWN",
",",
"self",
".",
"OnHelpBack",
")",
"self",
".",
"help_htmlwindow",
".",
"Bind",
"(",
"wx",
".",
"html",
".",
"EVT_HTML_LINK_CLICKED",
",",
"lambda",
"e",
":",
"self",
".",
"open_external_links",
"(",
"e",
")",
")",
"self",
".",
"help_htmlwindow",
".",
"Bind",
"(",
"wx",
".",
"EVT_MOUSEWHEEL",
",",
"lambda",
"e",
":",
"self",
".",
"zoom_html",
"(",
"e",
")",
")",
"# Get help data",
"current_path",
"=",
"os",
".",
"getcwd",
"(",
")",
"os",
".",
"chdir",
"(",
"get_help_path",
"(",
")",
")",
"try",
":",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"filename",
")",
":",
"self",
".",
"help_htmlwindow",
".",
"LoadFile",
"(",
"filename",
")",
"else",
":",
"self",
".",
"help_htmlwindow",
".",
"LoadPage",
"(",
"filename",
")",
"except",
"IOError",
":",
"self",
".",
"help_htmlwindow",
".",
"LoadPage",
"(",
"filename",
")",
"# Show tutorial window",
"self",
".",
"help_window",
".",
"Show",
"(",
")",
"os",
".",
"chdir",
"(",
"current_path",
")"
] | Generic help launcher
Launches HTMLWindow that shows content of filename
or the Internet page with the filename url
Parameters
----------
filename: String
\thtml file or url | [
"Generic",
"help",
"launcher"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/actions/_main_window_actions.py#L803-L853 |
250,160 | manns/pyspread | pyspread/src/actions/_main_window_actions.py | HelpActions.OnHelpMove | def OnHelpMove(self, event):
"""Help window move event handler stores position in config"""
position = event.GetPosition()
config["help_window_position"] = repr((position.x, position.y))
event.Skip() | python | def OnHelpMove(self, event):
position = event.GetPosition()
config["help_window_position"] = repr((position.x, position.y))
event.Skip() | [
"def",
"OnHelpMove",
"(",
"self",
",",
"event",
")",
":",
"position",
"=",
"event",
".",
"GetPosition",
"(",
")",
"config",
"[",
"\"help_window_position\"",
"]",
"=",
"repr",
"(",
"(",
"position",
".",
"x",
",",
"position",
".",
"y",
")",
")",
"event",
".",
"Skip",
"(",
")"
] | Help window move event handler stores position in config | [
"Help",
"window",
"move",
"event",
"handler",
"stores",
"position",
"in",
"config"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/actions/_main_window_actions.py#L861-L867 |
250,161 | manns/pyspread | pyspread/src/actions/_main_window_actions.py | HelpActions.OnHelpSize | def OnHelpSize(self, event):
"""Help window size event handler stores size in config"""
size = event.GetSize()
config["help_window_size"] = repr((size.width, size.height))
event.Skip() | python | def OnHelpSize(self, event):
size = event.GetSize()
config["help_window_size"] = repr((size.width, size.height))
event.Skip() | [
"def",
"OnHelpSize",
"(",
"self",
",",
"event",
")",
":",
"size",
"=",
"event",
".",
"GetSize",
"(",
")",
"config",
"[",
"\"help_window_size\"",
"]",
"=",
"repr",
"(",
"(",
"size",
".",
"width",
",",
"size",
".",
"height",
")",
")",
"event",
".",
"Skip",
"(",
")"
] | Help window size event handler stores size in config | [
"Help",
"window",
"size",
"event",
"handler",
"stores",
"size",
"in",
"config"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/actions/_main_window_actions.py#L869-L875 |
250,162 | manns/pyspread | pyspread/src/gui/grid_panels.py | vlcpanel_factory | def vlcpanel_factory(filepath, volume=None):
"""Returns a VLCPanel class
Parameters
----------
filepath: String
\tFile path of video
volume: Float, optional
\tSound volume
"""
vlc_panel_cls = VLCPanel
VLCPanel.filepath = filepath
if volume is not None:
VLCPanel.volume = volume
return vlc_panel_cls | python | def vlcpanel_factory(filepath, volume=None):
vlc_panel_cls = VLCPanel
VLCPanel.filepath = filepath
if volume is not None:
VLCPanel.volume = volume
return vlc_panel_cls | [
"def",
"vlcpanel_factory",
"(",
"filepath",
",",
"volume",
"=",
"None",
")",
":",
"vlc_panel_cls",
"=",
"VLCPanel",
"VLCPanel",
".",
"filepath",
"=",
"filepath",
"if",
"volume",
"is",
"not",
"None",
":",
"VLCPanel",
".",
"volume",
"=",
"volume",
"return",
"vlc_panel_cls"
] | Returns a VLCPanel class
Parameters
----------
filepath: String
\tFile path of video
volume: Float, optional
\tSound volume | [
"Returns",
"a",
"VLCPanel",
"class"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/grid_panels.py#L175-L192 |
250,163 | manns/pyspread | pyspread/src/gui/grid_panels.py | VLCPanel.SetClientRect | def SetClientRect(self, rect):
"""Positions and resizes video panel
Parameters
----------
rect: 4-tuple of Integer
\tRect area of video panel
"""
panel_posx = rect[0] + self.grid.GetRowLabelSize()
panel_posy = rect[1] + self.grid.GetColLabelSize()
panel_scrolled_pos = self.grid.CalcScrolledPosition(panel_posx,
panel_posy)
# If the scrolled position is inside the grid labels then hide
self.SetPosition(panel_scrolled_pos)
wx.Panel.SetClientRect(self, wx.Rect(0, 0, rect[2], rect[3]))
# Handle videos that are partly visible or that become invisible
row_label_size = self.grid.GetRowLabelSize()
col_label_size = self.grid.GetColLabelSize()
if panel_scrolled_pos[0] < row_label_size or \
panel_scrolled_pos[1] < col_label_size:
self.Hide()
else:
self.Show() | python | def SetClientRect(self, rect):
panel_posx = rect[0] + self.grid.GetRowLabelSize()
panel_posy = rect[1] + self.grid.GetColLabelSize()
panel_scrolled_pos = self.grid.CalcScrolledPosition(panel_posx,
panel_posy)
# If the scrolled position is inside the grid labels then hide
self.SetPosition(panel_scrolled_pos)
wx.Panel.SetClientRect(self, wx.Rect(0, 0, rect[2], rect[3]))
# Handle videos that are partly visible or that become invisible
row_label_size = self.grid.GetRowLabelSize()
col_label_size = self.grid.GetColLabelSize()
if panel_scrolled_pos[0] < row_label_size or \
panel_scrolled_pos[1] < col_label_size:
self.Hide()
else:
self.Show() | [
"def",
"SetClientRect",
"(",
"self",
",",
"rect",
")",
":",
"panel_posx",
"=",
"rect",
"[",
"0",
"]",
"+",
"self",
".",
"grid",
".",
"GetRowLabelSize",
"(",
")",
"panel_posy",
"=",
"rect",
"[",
"1",
"]",
"+",
"self",
".",
"grid",
".",
"GetColLabelSize",
"(",
")",
"panel_scrolled_pos",
"=",
"self",
".",
"grid",
".",
"CalcScrolledPosition",
"(",
"panel_posx",
",",
"panel_posy",
")",
"# If the scrolled position is inside the grid labels then hide",
"self",
".",
"SetPosition",
"(",
"panel_scrolled_pos",
")",
"wx",
".",
"Panel",
".",
"SetClientRect",
"(",
"self",
",",
"wx",
".",
"Rect",
"(",
"0",
",",
"0",
",",
"rect",
"[",
"2",
"]",
",",
"rect",
"[",
"3",
"]",
")",
")",
"# Handle videos that are partly visible or that become invisible",
"row_label_size",
"=",
"self",
".",
"grid",
".",
"GetRowLabelSize",
"(",
")",
"col_label_size",
"=",
"self",
".",
"grid",
".",
"GetColLabelSize",
"(",
")",
"if",
"panel_scrolled_pos",
"[",
"0",
"]",
"<",
"row_label_size",
"or",
"panel_scrolled_pos",
"[",
"1",
"]",
"<",
"col_label_size",
":",
"self",
".",
"Hide",
"(",
")",
"else",
":",
"self",
".",
"Show",
"(",
")"
] | Positions and resizes video panel
Parameters
----------
rect: 4-tuple of Integer
\tRect area of video panel | [
"Positions",
"and",
"resizes",
"video",
"panel"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/grid_panels.py#L93-L120 |
250,164 | manns/pyspread | pyspread/src/gui/grid_panels.py | VLCPanel.OnTogglePlay | def OnTogglePlay(self, event):
"""Toggles the video status between play and hold"""
if self.player.get_state() == vlc.State.Playing:
self.player.pause()
else:
self.player.play()
event.Skip() | python | def OnTogglePlay(self, event):
if self.player.get_state() == vlc.State.Playing:
self.player.pause()
else:
self.player.play()
event.Skip() | [
"def",
"OnTogglePlay",
"(",
"self",
",",
"event",
")",
":",
"if",
"self",
".",
"player",
".",
"get_state",
"(",
")",
"==",
"vlc",
".",
"State",
".",
"Playing",
":",
"self",
".",
"player",
".",
"pause",
"(",
")",
"else",
":",
"self",
".",
"player",
".",
"play",
"(",
")",
"event",
".",
"Skip",
"(",
")"
] | Toggles the video status between play and hold | [
"Toggles",
"the",
"video",
"status",
"between",
"play",
"and",
"hold"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/grid_panels.py#L125-L133 |
250,165 | manns/pyspread | pyspread/src/gui/grid_panels.py | VLCPanel.OnShiftVideo | def OnShiftVideo(self, event):
"""Shifts through the video"""
length = self.player.get_length()
time = self.player.get_time()
if event.GetWheelRotation() < 0:
target_time = max(0, time-length/100.0)
elif event.GetWheelRotation() > 0:
target_time = min(length, time+length/100.0)
self.player.set_time(int(target_time)) | python | def OnShiftVideo(self, event):
length = self.player.get_length()
time = self.player.get_time()
if event.GetWheelRotation() < 0:
target_time = max(0, time-length/100.0)
elif event.GetWheelRotation() > 0:
target_time = min(length, time+length/100.0)
self.player.set_time(int(target_time)) | [
"def",
"OnShiftVideo",
"(",
"self",
",",
"event",
")",
":",
"length",
"=",
"self",
".",
"player",
".",
"get_length",
"(",
")",
"time",
"=",
"self",
".",
"player",
".",
"get_time",
"(",
")",
"if",
"event",
".",
"GetWheelRotation",
"(",
")",
"<",
"0",
":",
"target_time",
"=",
"max",
"(",
"0",
",",
"time",
"-",
"length",
"/",
"100.0",
")",
"elif",
"event",
".",
"GetWheelRotation",
"(",
")",
">",
"0",
":",
"target_time",
"=",
"min",
"(",
"length",
",",
"time",
"+",
"length",
"/",
"100.0",
")",
"self",
".",
"player",
".",
"set_time",
"(",
"int",
"(",
"target_time",
")",
")"
] | Shifts through the video | [
"Shifts",
"through",
"the",
"video"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/grid_panels.py#L149-L160 |
250,166 | manns/pyspread | pyspread/src/gui/grid_panels.py | VLCPanel.OnAdjustVolume | def OnAdjustVolume(self, event):
"""Changes video volume"""
self.volume = self.player.audio_get_volume()
if event.GetWheelRotation() < 0:
self.volume = max(0, self.volume-10)
elif event.GetWheelRotation() > 0:
self.volume = min(200, self.volume+10)
self.player.audio_set_volume(self.volume) | python | def OnAdjustVolume(self, event):
self.volume = self.player.audio_get_volume()
if event.GetWheelRotation() < 0:
self.volume = max(0, self.volume-10)
elif event.GetWheelRotation() > 0:
self.volume = min(200, self.volume+10)
self.player.audio_set_volume(self.volume) | [
"def",
"OnAdjustVolume",
"(",
"self",
",",
"event",
")",
":",
"self",
".",
"volume",
"=",
"self",
".",
"player",
".",
"audio_get_volume",
"(",
")",
"if",
"event",
".",
"GetWheelRotation",
"(",
")",
"<",
"0",
":",
"self",
".",
"volume",
"=",
"max",
"(",
"0",
",",
"self",
".",
"volume",
"-",
"10",
")",
"elif",
"event",
".",
"GetWheelRotation",
"(",
")",
">",
"0",
":",
"self",
".",
"volume",
"=",
"min",
"(",
"200",
",",
"self",
".",
"volume",
"+",
"10",
")",
"self",
".",
"player",
".",
"audio_set_volume",
"(",
"self",
".",
"volume",
")"
] | Changes video volume | [
"Changes",
"video",
"volume"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/grid_panels.py#L162-L172 |
250,167 | manns/pyspread | pyspread/src/config.py | Config.load | def load(self):
"""Loads configuration file"""
# Config files prior to 0.2.4 dor not have config version keys
old_config = not self.cfg_file.Exists("config_version")
# Reset data
self.data.__dict__.update(self.defaults.__dict__)
for key in self.defaults.__dict__:
if self.cfg_file.Exists(key):
setattr(self.data, key, self.cfg_file.Read(key))
# Reset keys that should be reset on version upgrades
if old_config or self.version != self.data.config_version:
for key in self.reset_on_version_change:
setattr(self.data, key, getattr(DefaultConfig(), key))
self.data.config_version = self.version
# Delete gpg_key_uid and insert fingerprint key
if hasattr(self.data, "gpg_key_uid"):
oldkey = "gpg_key_uid"
delattr(self.data, oldkey)
newkey = "gpg_key_fingerprint"
setattr(self.data, newkey, getattr(DefaultConfig(), newkey)) | python | def load(self):
# Config files prior to 0.2.4 dor not have config version keys
old_config = not self.cfg_file.Exists("config_version")
# Reset data
self.data.__dict__.update(self.defaults.__dict__)
for key in self.defaults.__dict__:
if self.cfg_file.Exists(key):
setattr(self.data, key, self.cfg_file.Read(key))
# Reset keys that should be reset on version upgrades
if old_config or self.version != self.data.config_version:
for key in self.reset_on_version_change:
setattr(self.data, key, getattr(DefaultConfig(), key))
self.data.config_version = self.version
# Delete gpg_key_uid and insert fingerprint key
if hasattr(self.data, "gpg_key_uid"):
oldkey = "gpg_key_uid"
delattr(self.data, oldkey)
newkey = "gpg_key_fingerprint"
setattr(self.data, newkey, getattr(DefaultConfig(), newkey)) | [
"def",
"load",
"(",
"self",
")",
":",
"# Config files prior to 0.2.4 dor not have config version keys",
"old_config",
"=",
"not",
"self",
".",
"cfg_file",
".",
"Exists",
"(",
"\"config_version\"",
")",
"# Reset data",
"self",
".",
"data",
".",
"__dict__",
".",
"update",
"(",
"self",
".",
"defaults",
".",
"__dict__",
")",
"for",
"key",
"in",
"self",
".",
"defaults",
".",
"__dict__",
":",
"if",
"self",
".",
"cfg_file",
".",
"Exists",
"(",
"key",
")",
":",
"setattr",
"(",
"self",
".",
"data",
",",
"key",
",",
"self",
".",
"cfg_file",
".",
"Read",
"(",
"key",
")",
")",
"# Reset keys that should be reset on version upgrades",
"if",
"old_config",
"or",
"self",
".",
"version",
"!=",
"self",
".",
"data",
".",
"config_version",
":",
"for",
"key",
"in",
"self",
".",
"reset_on_version_change",
":",
"setattr",
"(",
"self",
".",
"data",
",",
"key",
",",
"getattr",
"(",
"DefaultConfig",
"(",
")",
",",
"key",
")",
")",
"self",
".",
"data",
".",
"config_version",
"=",
"self",
".",
"version",
"# Delete gpg_key_uid and insert fingerprint key",
"if",
"hasattr",
"(",
"self",
".",
"data",
",",
"\"gpg_key_uid\"",
")",
":",
"oldkey",
"=",
"\"gpg_key_uid\"",
"delattr",
"(",
"self",
".",
"data",
",",
"oldkey",
")",
"newkey",
"=",
"\"gpg_key_fingerprint\"",
"setattr",
"(",
"self",
".",
"data",
",",
"newkey",
",",
"getattr",
"(",
"DefaultConfig",
"(",
")",
",",
"newkey",
")",
")"
] | Loads configuration file | [
"Loads",
"configuration",
"file"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/config.py#L195-L220 |
250,168 | manns/pyspread | pyspread/src/config.py | Config.save | def save(self):
"""Saves configuration file"""
for key in self.defaults.__dict__:
data = getattr(self.data, key)
self.cfg_file.Write(key, data) | python | def save(self):
for key in self.defaults.__dict__:
data = getattr(self.data, key)
self.cfg_file.Write(key, data) | [
"def",
"save",
"(",
"self",
")",
":",
"for",
"key",
"in",
"self",
".",
"defaults",
".",
"__dict__",
":",
"data",
"=",
"getattr",
"(",
"self",
".",
"data",
",",
"key",
")",
"self",
".",
"cfg_file",
".",
"Write",
"(",
"key",
",",
"data",
")"
] | Saves configuration file | [
"Saves",
"configuration",
"file"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/config.py#L222-L228 |
250,169 | manns/pyspread | pyspread/src/lib/vlc.py | string_result | def string_result(result, func, arguments):
"""Errcheck function. Returns a string and frees the original pointer.
It assumes the result is a char *.
"""
if result:
# make a python string copy
s = bytes_to_str(ctypes.string_at(result))
# free original string ptr
libvlc_free(result)
return s
return None | python | def string_result(result, func, arguments):
if result:
# make a python string copy
s = bytes_to_str(ctypes.string_at(result))
# free original string ptr
libvlc_free(result)
return s
return None | [
"def",
"string_result",
"(",
"result",
",",
"func",
",",
"arguments",
")",
":",
"if",
"result",
":",
"# make a python string copy",
"s",
"=",
"bytes_to_str",
"(",
"ctypes",
".",
"string_at",
"(",
"result",
")",
")",
"# free original string ptr",
"libvlc_free",
"(",
"result",
")",
"return",
"s",
"return",
"None"
] | Errcheck function. Returns a string and frees the original pointer.
It assumes the result is a char *. | [
"Errcheck",
"function",
".",
"Returns",
"a",
"string",
"and",
"frees",
"the",
"original",
"pointer",
"."
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L293-L304 |
250,170 | manns/pyspread | pyspread/src/lib/vlc.py | class_result | def class_result(classname):
"""Errcheck function. Returns a function that creates the specified class.
"""
def wrap_errcheck(result, func, arguments):
if result is None:
return None
return classname(result)
return wrap_errcheck | python | def class_result(classname):
def wrap_errcheck(result, func, arguments):
if result is None:
return None
return classname(result)
return wrap_errcheck | [
"def",
"class_result",
"(",
"classname",
")",
":",
"def",
"wrap_errcheck",
"(",
"result",
",",
"func",
",",
"arguments",
")",
":",
"if",
"result",
"is",
"None",
":",
"return",
"None",
"return",
"classname",
"(",
"result",
")",
"return",
"wrap_errcheck"
] | Errcheck function. Returns a function that creates the specified class. | [
"Errcheck",
"function",
".",
"Returns",
"a",
"function",
"that",
"creates",
"the",
"specified",
"class",
"."
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L306-L313 |
250,171 | manns/pyspread | pyspread/src/lib/vlc.py | libvlc_vprinterr | def libvlc_vprinterr(fmt, ap):
'''Sets the LibVLC error status and message for the current thread.
Any previous error is overridden.
@param fmt: the format string.
@param ap: the arguments.
@return: a nul terminated string in any case.
'''
f = _Cfunctions.get('libvlc_vprinterr', None) or \
_Cfunction('libvlc_vprinterr', ((1,), (1,),), None,
ctypes.c_char_p, ctypes.c_char_p, ctypes.c_void_p)
return f(fmt, ap) | python | def libvlc_vprinterr(fmt, ap):
'''Sets the LibVLC error status and message for the current thread.
Any previous error is overridden.
@param fmt: the format string.
@param ap: the arguments.
@return: a nul terminated string in any case.
'''
f = _Cfunctions.get('libvlc_vprinterr', None) or \
_Cfunction('libvlc_vprinterr', ((1,), (1,),), None,
ctypes.c_char_p, ctypes.c_char_p, ctypes.c_void_p)
return f(fmt, ap) | [
"def",
"libvlc_vprinterr",
"(",
"fmt",
",",
"ap",
")",
":",
"f",
"=",
"_Cfunctions",
".",
"get",
"(",
"'libvlc_vprinterr'",
",",
"None",
")",
"or",
"_Cfunction",
"(",
"'libvlc_vprinterr'",
",",
"(",
"(",
"1",
",",
")",
",",
"(",
"1",
",",
")",
",",
")",
",",
"None",
",",
"ctypes",
".",
"c_char_p",
",",
"ctypes",
".",
"c_char_p",
",",
"ctypes",
".",
"c_void_p",
")",
"return",
"f",
"(",
"fmt",
",",
"ap",
")"
] | Sets the LibVLC error status and message for the current thread.
Any previous error is overridden.
@param fmt: the format string.
@param ap: the arguments.
@return: a nul terminated string in any case. | [
"Sets",
"the",
"LibVLC",
"error",
"status",
"and",
"message",
"for",
"the",
"current",
"thread",
".",
"Any",
"previous",
"error",
"is",
"overridden",
"."
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L3781-L3791 |
250,172 | manns/pyspread | pyspread/src/lib/vlc.py | libvlc_add_intf | def libvlc_add_intf(p_instance, name):
'''Try to start a user interface for the libvlc instance.
@param p_instance: the instance.
@param name: interface name, or NULL for default.
@return: 0 on success, -1 on error.
'''
f = _Cfunctions.get('libvlc_add_intf', None) or \
_Cfunction('libvlc_add_intf', ((1,), (1,),), None,
ctypes.c_int, Instance, ctypes.c_char_p)
return f(p_instance, name) | python | def libvlc_add_intf(p_instance, name):
'''Try to start a user interface for the libvlc instance.
@param p_instance: the instance.
@param name: interface name, or NULL for default.
@return: 0 on success, -1 on error.
'''
f = _Cfunctions.get('libvlc_add_intf', None) or \
_Cfunction('libvlc_add_intf', ((1,), (1,),), None,
ctypes.c_int, Instance, ctypes.c_char_p)
return f(p_instance, name) | [
"def",
"libvlc_add_intf",
"(",
"p_instance",
",",
"name",
")",
":",
"f",
"=",
"_Cfunctions",
".",
"get",
"(",
"'libvlc_add_intf'",
",",
"None",
")",
"or",
"_Cfunction",
"(",
"'libvlc_add_intf'",
",",
"(",
"(",
"1",
",",
")",
",",
"(",
"1",
",",
")",
",",
")",
",",
"None",
",",
"ctypes",
".",
"c_int",
",",
"Instance",
",",
"ctypes",
".",
"c_char_p",
")",
"return",
"f",
"(",
"p_instance",
",",
"name",
")"
] | Try to start a user interface for the libvlc instance.
@param p_instance: the instance.
@param name: interface name, or NULL for default.
@return: 0 on success, -1 on error. | [
"Try",
"to",
"start",
"a",
"user",
"interface",
"for",
"the",
"libvlc",
"instance",
"."
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L3827-L3836 |
250,173 | manns/pyspread | pyspread/src/lib/vlc.py | libvlc_event_attach | def libvlc_event_attach(p_event_manager, i_event_type, f_callback, user_data):
'''Register for an event notification.
@param p_event_manager: the event manager to which you want to attach to. Generally it is obtained by vlc_my_object_event_manager() where my_object is the object you want to listen to.
@param i_event_type: the desired event to which we want to listen.
@param f_callback: the function to call when i_event_type occurs.
@param user_data: user provided data to carry with the event.
@return: 0 on success, ENOMEM on error.
'''
f = _Cfunctions.get('libvlc_event_attach', None) or \
_Cfunction('libvlc_event_attach', ((1,), (1,), (1,), (1,),), None,
ctypes.c_int, EventManager, ctypes.c_uint, Callback, ctypes.c_void_p)
return f(p_event_manager, i_event_type, f_callback, user_data) | python | def libvlc_event_attach(p_event_manager, i_event_type, f_callback, user_data):
'''Register for an event notification.
@param p_event_manager: the event manager to which you want to attach to. Generally it is obtained by vlc_my_object_event_manager() where my_object is the object you want to listen to.
@param i_event_type: the desired event to which we want to listen.
@param f_callback: the function to call when i_event_type occurs.
@param user_data: user provided data to carry with the event.
@return: 0 on success, ENOMEM on error.
'''
f = _Cfunctions.get('libvlc_event_attach', None) or \
_Cfunction('libvlc_event_attach', ((1,), (1,), (1,), (1,),), None,
ctypes.c_int, EventManager, ctypes.c_uint, Callback, ctypes.c_void_p)
return f(p_event_manager, i_event_type, f_callback, user_data) | [
"def",
"libvlc_event_attach",
"(",
"p_event_manager",
",",
"i_event_type",
",",
"f_callback",
",",
"user_data",
")",
":",
"f",
"=",
"_Cfunctions",
".",
"get",
"(",
"'libvlc_event_attach'",
",",
"None",
")",
"or",
"_Cfunction",
"(",
"'libvlc_event_attach'",
",",
"(",
"(",
"1",
",",
")",
",",
"(",
"1",
",",
")",
",",
"(",
"1",
",",
")",
",",
"(",
"1",
",",
")",
",",
")",
",",
"None",
",",
"ctypes",
".",
"c_int",
",",
"EventManager",
",",
"ctypes",
".",
"c_uint",
",",
"Callback",
",",
"ctypes",
".",
"c_void_p",
")",
"return",
"f",
"(",
"p_event_manager",
",",
"i_event_type",
",",
"f_callback",
",",
"user_data",
")"
] | Register for an event notification.
@param p_event_manager: the event manager to which you want to attach to. Generally it is obtained by vlc_my_object_event_manager() where my_object is the object you want to listen to.
@param i_event_type: the desired event to which we want to listen.
@param f_callback: the function to call when i_event_type occurs.
@param user_data: user provided data to carry with the event.
@return: 0 on success, ENOMEM on error. | [
"Register",
"for",
"an",
"event",
"notification",
"."
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L3906-L3917 |
250,174 | manns/pyspread | pyspread/src/lib/vlc.py | libvlc_event_type_name | def libvlc_event_type_name(event_type):
'''Get an event's type name.
@param event_type: the desired event.
'''
f = _Cfunctions.get('libvlc_event_type_name', None) or \
_Cfunction('libvlc_event_type_name', ((1,),), None,
ctypes.c_char_p, ctypes.c_uint)
return f(event_type) | python | def libvlc_event_type_name(event_type):
'''Get an event's type name.
@param event_type: the desired event.
'''
f = _Cfunctions.get('libvlc_event_type_name', None) or \
_Cfunction('libvlc_event_type_name', ((1,),), None,
ctypes.c_char_p, ctypes.c_uint)
return f(event_type) | [
"def",
"libvlc_event_type_name",
"(",
"event_type",
")",
":",
"f",
"=",
"_Cfunctions",
".",
"get",
"(",
"'libvlc_event_type_name'",
",",
"None",
")",
"or",
"_Cfunction",
"(",
"'libvlc_event_type_name'",
",",
"(",
"(",
"1",
",",
")",
",",
")",
",",
"None",
",",
"ctypes",
".",
"c_char_p",
",",
"ctypes",
".",
"c_uint",
")",
"return",
"f",
"(",
"event_type",
")"
] | Get an event's type name.
@param event_type: the desired event. | [
"Get",
"an",
"event",
"s",
"type",
"name",
"."
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L3931-L3938 |
250,175 | manns/pyspread | pyspread/src/lib/vlc.py | libvlc_log_set_file | def libvlc_log_set_file(p_instance, stream):
'''Sets up logging to a file.
@param p_instance: libvlc instance.
@param stream: FILE pointer opened for writing (the FILE pointer must remain valid until L{libvlc_log_unset}()).
@version: LibVLC 2.1.0 or later.
'''
f = _Cfunctions.get('libvlc_log_set_file', None) or \
_Cfunction('libvlc_log_set_file', ((1,), (1,),), None,
None, Instance, FILE_ptr)
return f(p_instance, stream) | python | def libvlc_log_set_file(p_instance, stream):
'''Sets up logging to a file.
@param p_instance: libvlc instance.
@param stream: FILE pointer opened for writing (the FILE pointer must remain valid until L{libvlc_log_unset}()).
@version: LibVLC 2.1.0 or later.
'''
f = _Cfunctions.get('libvlc_log_set_file', None) or \
_Cfunction('libvlc_log_set_file', ((1,), (1,),), None,
None, Instance, FILE_ptr)
return f(p_instance, stream) | [
"def",
"libvlc_log_set_file",
"(",
"p_instance",
",",
"stream",
")",
":",
"f",
"=",
"_Cfunctions",
".",
"get",
"(",
"'libvlc_log_set_file'",
",",
"None",
")",
"or",
"_Cfunction",
"(",
"'libvlc_log_set_file'",
",",
"(",
"(",
"1",
",",
")",
",",
"(",
"1",
",",
")",
",",
")",
",",
"None",
",",
"None",
",",
"Instance",
",",
"FILE_ptr",
")",
"return",
"f",
"(",
"p_instance",
",",
"stream",
")"
] | Sets up logging to a file.
@param p_instance: libvlc instance.
@param stream: FILE pointer opened for writing (the FILE pointer must remain valid until L{libvlc_log_unset}()).
@version: LibVLC 2.1.0 or later. | [
"Sets",
"up",
"logging",
"to",
"a",
"file",
"."
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L4000-L4009 |
250,176 | manns/pyspread | pyspread/src/lib/vlc.py | libvlc_module_description_list_release | def libvlc_module_description_list_release(p_list):
'''Release a list of module descriptions.
@param p_list: the list to be released.
'''
f = _Cfunctions.get('libvlc_module_description_list_release', None) or \
_Cfunction('libvlc_module_description_list_release', ((1,),), None,
None, ctypes.POINTER(ModuleDescription))
return f(p_list) | python | def libvlc_module_description_list_release(p_list):
'''Release a list of module descriptions.
@param p_list: the list to be released.
'''
f = _Cfunctions.get('libvlc_module_description_list_release', None) or \
_Cfunction('libvlc_module_description_list_release', ((1,),), None,
None, ctypes.POINTER(ModuleDescription))
return f(p_list) | [
"def",
"libvlc_module_description_list_release",
"(",
"p_list",
")",
":",
"f",
"=",
"_Cfunctions",
".",
"get",
"(",
"'libvlc_module_description_list_release'",
",",
"None",
")",
"or",
"_Cfunction",
"(",
"'libvlc_module_description_list_release'",
",",
"(",
"(",
"1",
",",
")",
",",
")",
",",
"None",
",",
"None",
",",
"ctypes",
".",
"POINTER",
"(",
"ModuleDescription",
")",
")",
"return",
"f",
"(",
"p_list",
")"
] | Release a list of module descriptions.
@param p_list: the list to be released. | [
"Release",
"a",
"list",
"of",
"module",
"descriptions",
"."
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L4011-L4018 |
250,177 | manns/pyspread | pyspread/src/lib/vlc.py | libvlc_audio_filter_list_get | def libvlc_audio_filter_list_get(p_instance):
'''Returns a list of audio filters that are available.
@param p_instance: libvlc instance.
@return: a list of module descriptions. It should be freed with L{libvlc_module_description_list_release}(). In case of an error, NULL is returned. See L{ModuleDescription} See L{libvlc_module_description_list_release}.
'''
f = _Cfunctions.get('libvlc_audio_filter_list_get', None) or \
_Cfunction('libvlc_audio_filter_list_get', ((1,),), None,
ctypes.POINTER(ModuleDescription), Instance)
return f(p_instance) | python | def libvlc_audio_filter_list_get(p_instance):
'''Returns a list of audio filters that are available.
@param p_instance: libvlc instance.
@return: a list of module descriptions. It should be freed with L{libvlc_module_description_list_release}(). In case of an error, NULL is returned. See L{ModuleDescription} See L{libvlc_module_description_list_release}.
'''
f = _Cfunctions.get('libvlc_audio_filter_list_get', None) or \
_Cfunction('libvlc_audio_filter_list_get', ((1,),), None,
ctypes.POINTER(ModuleDescription), Instance)
return f(p_instance) | [
"def",
"libvlc_audio_filter_list_get",
"(",
"p_instance",
")",
":",
"f",
"=",
"_Cfunctions",
".",
"get",
"(",
"'libvlc_audio_filter_list_get'",
",",
"None",
")",
"or",
"_Cfunction",
"(",
"'libvlc_audio_filter_list_get'",
",",
"(",
"(",
"1",
",",
")",
",",
")",
",",
"None",
",",
"ctypes",
".",
"POINTER",
"(",
"ModuleDescription",
")",
",",
"Instance",
")",
"return",
"f",
"(",
"p_instance",
")"
] | Returns a list of audio filters that are available.
@param p_instance: libvlc instance.
@return: a list of module descriptions. It should be freed with L{libvlc_module_description_list_release}(). In case of an error, NULL is returned. See L{ModuleDescription} See L{libvlc_module_description_list_release}. | [
"Returns",
"a",
"list",
"of",
"audio",
"filters",
"that",
"are",
"available",
"."
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L4020-L4028 |
250,178 | manns/pyspread | pyspread/src/lib/vlc.py | libvlc_media_new_location | def libvlc_media_new_location(p_instance, psz_mrl):
'''Create a media with a certain given media resource location,
for instance a valid URL.
@note: To refer to a local file with this function,
the file://... URI syntax B{must} be used (see IETF RFC3986).
We recommend using L{libvlc_media_new_path}() instead when dealing with
local files.
See L{libvlc_media_release}.
@param p_instance: the instance.
@param psz_mrl: the media location.
@return: the newly created media or NULL on error.
'''
f = _Cfunctions.get('libvlc_media_new_location', None) or \
_Cfunction('libvlc_media_new_location', ((1,), (1,),), class_result(Media),
ctypes.c_void_p, Instance, ctypes.c_char_p)
return f(p_instance, psz_mrl) | python | def libvlc_media_new_location(p_instance, psz_mrl):
'''Create a media with a certain given media resource location,
for instance a valid URL.
@note: To refer to a local file with this function,
the file://... URI syntax B{must} be used (see IETF RFC3986).
We recommend using L{libvlc_media_new_path}() instead when dealing with
local files.
See L{libvlc_media_release}.
@param p_instance: the instance.
@param psz_mrl: the media location.
@return: the newly created media or NULL on error.
'''
f = _Cfunctions.get('libvlc_media_new_location', None) or \
_Cfunction('libvlc_media_new_location', ((1,), (1,),), class_result(Media),
ctypes.c_void_p, Instance, ctypes.c_char_p)
return f(p_instance, psz_mrl) | [
"def",
"libvlc_media_new_location",
"(",
"p_instance",
",",
"psz_mrl",
")",
":",
"f",
"=",
"_Cfunctions",
".",
"get",
"(",
"'libvlc_media_new_location'",
",",
"None",
")",
"or",
"_Cfunction",
"(",
"'libvlc_media_new_location'",
",",
"(",
"(",
"1",
",",
")",
",",
"(",
"1",
",",
")",
",",
")",
",",
"class_result",
"(",
"Media",
")",
",",
"ctypes",
".",
"c_void_p",
",",
"Instance",
",",
"ctypes",
".",
"c_char_p",
")",
"return",
"f",
"(",
"p_instance",
",",
"psz_mrl",
")"
] | Create a media with a certain given media resource location,
for instance a valid URL.
@note: To refer to a local file with this function,
the file://... URI syntax B{must} be used (see IETF RFC3986).
We recommend using L{libvlc_media_new_path}() instead when dealing with
local files.
See L{libvlc_media_release}.
@param p_instance: the instance.
@param psz_mrl: the media location.
@return: the newly created media or NULL on error. | [
"Create",
"a",
"media",
"with",
"a",
"certain",
"given",
"media",
"resource",
"location",
"for",
"instance",
"a",
"valid",
"URL",
"."
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L4053-L4068 |
250,179 | manns/pyspread | pyspread/src/lib/vlc.py | libvlc_media_duplicate | def libvlc_media_duplicate(p_md):
'''Duplicate a media descriptor object.
@param p_md: a media descriptor object.
'''
f = _Cfunctions.get('libvlc_media_duplicate', None) or \
_Cfunction('libvlc_media_duplicate', ((1,),), class_result(Media),
ctypes.c_void_p, Media)
return f(p_md) | python | def libvlc_media_duplicate(p_md):
'''Duplicate a media descriptor object.
@param p_md: a media descriptor object.
'''
f = _Cfunctions.get('libvlc_media_duplicate', None) or \
_Cfunction('libvlc_media_duplicate', ((1,),), class_result(Media),
ctypes.c_void_p, Media)
return f(p_md) | [
"def",
"libvlc_media_duplicate",
"(",
"p_md",
")",
":",
"f",
"=",
"_Cfunctions",
".",
"get",
"(",
"'libvlc_media_duplicate'",
",",
"None",
")",
"or",
"_Cfunction",
"(",
"'libvlc_media_duplicate'",
",",
"(",
"(",
"1",
",",
")",
",",
")",
",",
"class_result",
"(",
"Media",
")",
",",
"ctypes",
".",
"c_void_p",
",",
"Media",
")",
"return",
"f",
"(",
"p_md",
")"
] | Duplicate a media descriptor object.
@param p_md: a media descriptor object. | [
"Duplicate",
"a",
"media",
"descriptor",
"object",
"."
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L4207-L4214 |
250,180 | manns/pyspread | pyspread/src/lib/vlc.py | libvlc_media_save_meta | def libvlc_media_save_meta(p_md):
'''Save the meta previously set.
@param p_md: the media desriptor.
@return: true if the write operation was successful.
'''
f = _Cfunctions.get('libvlc_media_save_meta', None) or \
_Cfunction('libvlc_media_save_meta', ((1,),), None,
ctypes.c_int, Media)
return f(p_md) | python | def libvlc_media_save_meta(p_md):
'''Save the meta previously set.
@param p_md: the media desriptor.
@return: true if the write operation was successful.
'''
f = _Cfunctions.get('libvlc_media_save_meta', None) or \
_Cfunction('libvlc_media_save_meta', ((1,),), None,
ctypes.c_int, Media)
return f(p_md) | [
"def",
"libvlc_media_save_meta",
"(",
"p_md",
")",
":",
"f",
"=",
"_Cfunctions",
".",
"get",
"(",
"'libvlc_media_save_meta'",
",",
"None",
")",
"or",
"_Cfunction",
"(",
"'libvlc_media_save_meta'",
",",
"(",
"(",
"1",
",",
")",
",",
")",
",",
"None",
",",
"ctypes",
".",
"c_int",
",",
"Media",
")",
"return",
"f",
"(",
"p_md",
")"
] | Save the meta previously set.
@param p_md: the media desriptor.
@return: true if the write operation was successful. | [
"Save",
"the",
"meta",
"previously",
"set",
"."
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L4246-L4254 |
250,181 | manns/pyspread | pyspread/src/lib/vlc.py | libvlc_media_get_stats | def libvlc_media_get_stats(p_md, p_stats):
'''Get the current statistics about the media.
@param p_md:: media descriptor object.
@param p_stats:: structure that contain the statistics about the media (this structure must be allocated by the caller).
@return: true if the statistics are available, false otherwise \libvlc_return_bool.
'''
f = _Cfunctions.get('libvlc_media_get_stats', None) or \
_Cfunction('libvlc_media_get_stats', ((1,), (1,),), None,
ctypes.c_int, Media, ctypes.POINTER(MediaStats))
return f(p_md, p_stats) | python | def libvlc_media_get_stats(p_md, p_stats):
'''Get the current statistics about the media.
@param p_md:: media descriptor object.
@param p_stats:: structure that contain the statistics about the media (this structure must be allocated by the caller).
@return: true if the statistics are available, false otherwise \libvlc_return_bool.
'''
f = _Cfunctions.get('libvlc_media_get_stats', None) or \
_Cfunction('libvlc_media_get_stats', ((1,), (1,),), None,
ctypes.c_int, Media, ctypes.POINTER(MediaStats))
return f(p_md, p_stats) | [
"def",
"libvlc_media_get_stats",
"(",
"p_md",
",",
"p_stats",
")",
":",
"f",
"=",
"_Cfunctions",
".",
"get",
"(",
"'libvlc_media_get_stats'",
",",
"None",
")",
"or",
"_Cfunction",
"(",
"'libvlc_media_get_stats'",
",",
"(",
"(",
"1",
",",
")",
",",
"(",
"1",
",",
")",
",",
")",
",",
"None",
",",
"ctypes",
".",
"c_int",
",",
"Media",
",",
"ctypes",
".",
"POINTER",
"(",
"MediaStats",
")",
")",
"return",
"f",
"(",
"p_md",
",",
"p_stats",
")"
] | Get the current statistics about the media.
@param p_md:: media descriptor object.
@param p_stats:: structure that contain the statistics about the media (this structure must be allocated by the caller).
@return: true if the statistics are available, false otherwise \libvlc_return_bool. | [
"Get",
"the",
"current",
"statistics",
"about",
"the",
"media",
"."
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L4271-L4280 |
250,182 | manns/pyspread | pyspread/src/lib/vlc.py | libvlc_media_get_codec_description | def libvlc_media_get_codec_description(i_type, i_codec):
'''Get codec description from media elementary stream.
@param i_type: i_type from L{MediaTrack}.
@param i_codec: i_codec or i_original_fourcc from L{MediaTrack}.
@return: codec description.
@version: LibVLC 3.0.0 and later. See L{MediaTrack}.
'''
f = _Cfunctions.get('libvlc_media_get_codec_description', None) or \
_Cfunction('libvlc_media_get_codec_description', ((1,), (1,),), None,
ctypes.c_char_p, TrackType, ctypes.c_uint32)
return f(i_type, i_codec) | python | def libvlc_media_get_codec_description(i_type, i_codec):
'''Get codec description from media elementary stream.
@param i_type: i_type from L{MediaTrack}.
@param i_codec: i_codec or i_original_fourcc from L{MediaTrack}.
@return: codec description.
@version: LibVLC 3.0.0 and later. See L{MediaTrack}.
'''
f = _Cfunctions.get('libvlc_media_get_codec_description', None) or \
_Cfunction('libvlc_media_get_codec_description', ((1,), (1,),), None,
ctypes.c_char_p, TrackType, ctypes.c_uint32)
return f(i_type, i_codec) | [
"def",
"libvlc_media_get_codec_description",
"(",
"i_type",
",",
"i_codec",
")",
":",
"f",
"=",
"_Cfunctions",
".",
"get",
"(",
"'libvlc_media_get_codec_description'",
",",
"None",
")",
"or",
"_Cfunction",
"(",
"'libvlc_media_get_codec_description'",
",",
"(",
"(",
"1",
",",
")",
",",
"(",
"1",
",",
")",
",",
")",
",",
"None",
",",
"ctypes",
".",
"c_char_p",
",",
"TrackType",
",",
"ctypes",
".",
"c_uint32",
")",
"return",
"f",
"(",
"i_type",
",",
"i_codec",
")"
] | Get codec description from media elementary stream.
@param i_type: i_type from L{MediaTrack}.
@param i_codec: i_codec or i_original_fourcc from L{MediaTrack}.
@return: codec description.
@version: LibVLC 3.0.0 and later. See L{MediaTrack}. | [
"Get",
"codec",
"description",
"from",
"media",
"elementary",
"stream",
"."
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L4420-L4430 |
250,183 | manns/pyspread | pyspread/src/lib/vlc.py | libvlc_media_tracks_release | def libvlc_media_tracks_release(p_tracks, i_count):
'''Release media descriptor's elementary streams description array.
@param p_tracks: tracks info array to release.
@param i_count: number of elements in the array.
@version: LibVLC 2.1.0 and later.
'''
f = _Cfunctions.get('libvlc_media_tracks_release', None) or \
_Cfunction('libvlc_media_tracks_release', ((1,), (1,),), None,
None, ctypes.POINTER(MediaTrack), ctypes.c_uint)
return f(p_tracks, i_count) | python | def libvlc_media_tracks_release(p_tracks, i_count):
'''Release media descriptor's elementary streams description array.
@param p_tracks: tracks info array to release.
@param i_count: number of elements in the array.
@version: LibVLC 2.1.0 and later.
'''
f = _Cfunctions.get('libvlc_media_tracks_release', None) or \
_Cfunction('libvlc_media_tracks_release', ((1,), (1,),), None,
None, ctypes.POINTER(MediaTrack), ctypes.c_uint)
return f(p_tracks, i_count) | [
"def",
"libvlc_media_tracks_release",
"(",
"p_tracks",
",",
"i_count",
")",
":",
"f",
"=",
"_Cfunctions",
".",
"get",
"(",
"'libvlc_media_tracks_release'",
",",
"None",
")",
"or",
"_Cfunction",
"(",
"'libvlc_media_tracks_release'",
",",
"(",
"(",
"1",
",",
")",
",",
"(",
"1",
",",
")",
",",
")",
",",
"None",
",",
"None",
",",
"ctypes",
".",
"POINTER",
"(",
"MediaTrack",
")",
",",
"ctypes",
".",
"c_uint",
")",
"return",
"f",
"(",
"p_tracks",
",",
"i_count",
")"
] | Release media descriptor's elementary streams description array.
@param p_tracks: tracks info array to release.
@param i_count: number of elements in the array.
@version: LibVLC 2.1.0 and later. | [
"Release",
"media",
"descriptor",
"s",
"elementary",
"streams",
"description",
"array",
"."
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L4432-L4441 |
250,184 | manns/pyspread | pyspread/src/lib/vlc.py | libvlc_media_get_type | def libvlc_media_get_type(p_md):
'''Get the media type of the media descriptor object.
@param p_md: media descriptor object.
@return: media type.
@version: LibVLC 3.0.0 and later. See libvlc_media_type_t.
'''
f = _Cfunctions.get('libvlc_media_get_type', None) or \
_Cfunction('libvlc_media_get_type', ((1,),), None,
MediaType, Media)
return f(p_md) | python | def libvlc_media_get_type(p_md):
'''Get the media type of the media descriptor object.
@param p_md: media descriptor object.
@return: media type.
@version: LibVLC 3.0.0 and later. See libvlc_media_type_t.
'''
f = _Cfunctions.get('libvlc_media_get_type', None) or \
_Cfunction('libvlc_media_get_type', ((1,),), None,
MediaType, Media)
return f(p_md) | [
"def",
"libvlc_media_get_type",
"(",
"p_md",
")",
":",
"f",
"=",
"_Cfunctions",
".",
"get",
"(",
"'libvlc_media_get_type'",
",",
"None",
")",
"or",
"_Cfunction",
"(",
"'libvlc_media_get_type'",
",",
"(",
"(",
"1",
",",
")",
",",
")",
",",
"None",
",",
"MediaType",
",",
"Media",
")",
"return",
"f",
"(",
"p_md",
")"
] | Get the media type of the media descriptor object.
@param p_md: media descriptor object.
@return: media type.
@version: LibVLC 3.0.0 and later. See libvlc_media_type_t. | [
"Get",
"the",
"media",
"type",
"of",
"the",
"media",
"descriptor",
"object",
"."
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L4443-L4452 |
250,185 | manns/pyspread | pyspread/src/lib/vlc.py | libvlc_media_discoverer_localized_name | def libvlc_media_discoverer_localized_name(p_mdis):
'''Get media service discover object its localized name.
@param p_mdis: media discover object.
@return: localized name.
'''
f = _Cfunctions.get('libvlc_media_discoverer_localized_name', None) or \
_Cfunction('libvlc_media_discoverer_localized_name', ((1,),), string_result,
ctypes.c_void_p, MediaDiscoverer)
return f(p_mdis) | python | def libvlc_media_discoverer_localized_name(p_mdis):
'''Get media service discover object its localized name.
@param p_mdis: media discover object.
@return: localized name.
'''
f = _Cfunctions.get('libvlc_media_discoverer_localized_name', None) or \
_Cfunction('libvlc_media_discoverer_localized_name', ((1,),), string_result,
ctypes.c_void_p, MediaDiscoverer)
return f(p_mdis) | [
"def",
"libvlc_media_discoverer_localized_name",
"(",
"p_mdis",
")",
":",
"f",
"=",
"_Cfunctions",
".",
"get",
"(",
"'libvlc_media_discoverer_localized_name'",
",",
"None",
")",
"or",
"_Cfunction",
"(",
"'libvlc_media_discoverer_localized_name'",
",",
"(",
"(",
"1",
",",
")",
",",
")",
",",
"string_result",
",",
"ctypes",
".",
"c_void_p",
",",
"MediaDiscoverer",
")",
"return",
"f",
"(",
"p_mdis",
")"
] | Get media service discover object its localized name.
@param p_mdis: media discover object.
@return: localized name. | [
"Get",
"media",
"service",
"discover",
"object",
"its",
"localized",
"name",
"."
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L4510-L4518 |
250,186 | manns/pyspread | pyspread/src/lib/vlc.py | libvlc_media_discoverer_media_list | def libvlc_media_discoverer_media_list(p_mdis):
'''Get media service discover media list.
@param p_mdis: media service discover object.
@return: list of media items.
'''
f = _Cfunctions.get('libvlc_media_discoverer_media_list', None) or \
_Cfunction('libvlc_media_discoverer_media_list', ((1,),), class_result(MediaList),
ctypes.c_void_p, MediaDiscoverer)
return f(p_mdis) | python | def libvlc_media_discoverer_media_list(p_mdis):
'''Get media service discover media list.
@param p_mdis: media service discover object.
@return: list of media items.
'''
f = _Cfunctions.get('libvlc_media_discoverer_media_list', None) or \
_Cfunction('libvlc_media_discoverer_media_list', ((1,),), class_result(MediaList),
ctypes.c_void_p, MediaDiscoverer)
return f(p_mdis) | [
"def",
"libvlc_media_discoverer_media_list",
"(",
"p_mdis",
")",
":",
"f",
"=",
"_Cfunctions",
".",
"get",
"(",
"'libvlc_media_discoverer_media_list'",
",",
"None",
")",
"or",
"_Cfunction",
"(",
"'libvlc_media_discoverer_media_list'",
",",
"(",
"(",
"1",
",",
")",
",",
")",
",",
"class_result",
"(",
"MediaList",
")",
",",
"ctypes",
".",
"c_void_p",
",",
"MediaDiscoverer",
")",
"return",
"f",
"(",
"p_mdis",
")"
] | Get media service discover media list.
@param p_mdis: media service discover object.
@return: list of media items. | [
"Get",
"media",
"service",
"discover",
"media",
"list",
"."
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L4520-L4528 |
250,187 | manns/pyspread | pyspread/src/lib/vlc.py | libvlc_media_discoverer_event_manager | def libvlc_media_discoverer_event_manager(p_mdis):
'''Get event manager from media service discover object.
@param p_mdis: media service discover object.
@return: event manager object.
'''
f = _Cfunctions.get('libvlc_media_discoverer_event_manager', None) or \
_Cfunction('libvlc_media_discoverer_event_manager', ((1,),), class_result(EventManager),
ctypes.c_void_p, MediaDiscoverer)
return f(p_mdis) | python | def libvlc_media_discoverer_event_manager(p_mdis):
'''Get event manager from media service discover object.
@param p_mdis: media service discover object.
@return: event manager object.
'''
f = _Cfunctions.get('libvlc_media_discoverer_event_manager', None) or \
_Cfunction('libvlc_media_discoverer_event_manager', ((1,),), class_result(EventManager),
ctypes.c_void_p, MediaDiscoverer)
return f(p_mdis) | [
"def",
"libvlc_media_discoverer_event_manager",
"(",
"p_mdis",
")",
":",
"f",
"=",
"_Cfunctions",
".",
"get",
"(",
"'libvlc_media_discoverer_event_manager'",
",",
"None",
")",
"or",
"_Cfunction",
"(",
"'libvlc_media_discoverer_event_manager'",
",",
"(",
"(",
"1",
",",
")",
",",
")",
",",
"class_result",
"(",
"EventManager",
")",
",",
"ctypes",
".",
"c_void_p",
",",
"MediaDiscoverer",
")",
"return",
"f",
"(",
"p_mdis",
")"
] | Get event manager from media service discover object.
@param p_mdis: media service discover object.
@return: event manager object. | [
"Get",
"event",
"manager",
"from",
"media",
"service",
"discover",
"object",
"."
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L4530-L4538 |
250,188 | manns/pyspread | pyspread/src/lib/vlc.py | libvlc_media_discoverer_is_running | def libvlc_media_discoverer_is_running(p_mdis):
'''Query if media service discover object is running.
@param p_mdis: media service discover object.
@return: true if running, false if not \libvlc_return_bool.
'''
f = _Cfunctions.get('libvlc_media_discoverer_is_running', None) or \
_Cfunction('libvlc_media_discoverer_is_running', ((1,),), None,
ctypes.c_int, MediaDiscoverer)
return f(p_mdis) | python | def libvlc_media_discoverer_is_running(p_mdis):
'''Query if media service discover object is running.
@param p_mdis: media service discover object.
@return: true if running, false if not \libvlc_return_bool.
'''
f = _Cfunctions.get('libvlc_media_discoverer_is_running', None) or \
_Cfunction('libvlc_media_discoverer_is_running', ((1,),), None,
ctypes.c_int, MediaDiscoverer)
return f(p_mdis) | [
"def",
"libvlc_media_discoverer_is_running",
"(",
"p_mdis",
")",
":",
"f",
"=",
"_Cfunctions",
".",
"get",
"(",
"'libvlc_media_discoverer_is_running'",
",",
"None",
")",
"or",
"_Cfunction",
"(",
"'libvlc_media_discoverer_is_running'",
",",
"(",
"(",
"1",
",",
")",
",",
")",
",",
"None",
",",
"ctypes",
".",
"c_int",
",",
"MediaDiscoverer",
")",
"return",
"f",
"(",
"p_mdis",
")"
] | Query if media service discover object is running.
@param p_mdis: media service discover object.
@return: true if running, false if not \libvlc_return_bool. | [
"Query",
"if",
"media",
"service",
"discover",
"object",
"is",
"running",
"."
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L4540-L4548 |
250,189 | manns/pyspread | pyspread/src/lib/vlc.py | libvlc_media_library_new | def libvlc_media_library_new(p_instance):
'''Create an new Media Library object.
@param p_instance: the libvlc instance.
@return: a new object or NULL on error.
'''
f = _Cfunctions.get('libvlc_media_library_new', None) or \
_Cfunction('libvlc_media_library_new', ((1,),), class_result(MediaLibrary),
ctypes.c_void_p, Instance)
return f(p_instance) | python | def libvlc_media_library_new(p_instance):
'''Create an new Media Library object.
@param p_instance: the libvlc instance.
@return: a new object or NULL on error.
'''
f = _Cfunctions.get('libvlc_media_library_new', None) or \
_Cfunction('libvlc_media_library_new', ((1,),), class_result(MediaLibrary),
ctypes.c_void_p, Instance)
return f(p_instance) | [
"def",
"libvlc_media_library_new",
"(",
"p_instance",
")",
":",
"f",
"=",
"_Cfunctions",
".",
"get",
"(",
"'libvlc_media_library_new'",
",",
"None",
")",
"or",
"_Cfunction",
"(",
"'libvlc_media_library_new'",
",",
"(",
"(",
"1",
",",
")",
",",
")",
",",
"class_result",
"(",
"MediaLibrary",
")",
",",
"ctypes",
".",
"c_void_p",
",",
"Instance",
")",
"return",
"f",
"(",
"p_instance",
")"
] | Create an new Media Library object.
@param p_instance: the libvlc instance.
@return: a new object or NULL on error. | [
"Create",
"an",
"new",
"Media",
"Library",
"object",
"."
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L4550-L4558 |
250,190 | manns/pyspread | pyspread/src/lib/vlc.py | libvlc_media_library_load | def libvlc_media_library_load(p_mlib):
'''Load media library.
@param p_mlib: media library object.
@return: 0 on success, -1 on error.
'''
f = _Cfunctions.get('libvlc_media_library_load', None) or \
_Cfunction('libvlc_media_library_load', ((1,),), None,
ctypes.c_int, MediaLibrary)
return f(p_mlib) | python | def libvlc_media_library_load(p_mlib):
'''Load media library.
@param p_mlib: media library object.
@return: 0 on success, -1 on error.
'''
f = _Cfunctions.get('libvlc_media_library_load', None) or \
_Cfunction('libvlc_media_library_load', ((1,),), None,
ctypes.c_int, MediaLibrary)
return f(p_mlib) | [
"def",
"libvlc_media_library_load",
"(",
"p_mlib",
")",
":",
"f",
"=",
"_Cfunctions",
".",
"get",
"(",
"'libvlc_media_library_load'",
",",
"None",
")",
"or",
"_Cfunction",
"(",
"'libvlc_media_library_load'",
",",
"(",
"(",
"1",
",",
")",
",",
")",
",",
"None",
",",
"ctypes",
".",
"c_int",
",",
"MediaLibrary",
")",
"return",
"f",
"(",
"p_mlib",
")"
] | Load media library.
@param p_mlib: media library object.
@return: 0 on success, -1 on error. | [
"Load",
"media",
"library",
"."
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L4582-L4590 |
250,191 | manns/pyspread | pyspread/src/lib/vlc.py | libvlc_media_library_media_list | def libvlc_media_library_media_list(p_mlib):
'''Get media library subitems.
@param p_mlib: media library object.
@return: media list subitems.
'''
f = _Cfunctions.get('libvlc_media_library_media_list', None) or \
_Cfunction('libvlc_media_library_media_list', ((1,),), class_result(MediaList),
ctypes.c_void_p, MediaLibrary)
return f(p_mlib) | python | def libvlc_media_library_media_list(p_mlib):
'''Get media library subitems.
@param p_mlib: media library object.
@return: media list subitems.
'''
f = _Cfunctions.get('libvlc_media_library_media_list', None) or \
_Cfunction('libvlc_media_library_media_list', ((1,),), class_result(MediaList),
ctypes.c_void_p, MediaLibrary)
return f(p_mlib) | [
"def",
"libvlc_media_library_media_list",
"(",
"p_mlib",
")",
":",
"f",
"=",
"_Cfunctions",
".",
"get",
"(",
"'libvlc_media_library_media_list'",
",",
"None",
")",
"or",
"_Cfunction",
"(",
"'libvlc_media_library_media_list'",
",",
"(",
"(",
"1",
",",
")",
",",
")",
",",
"class_result",
"(",
"MediaList",
")",
",",
"ctypes",
".",
"c_void_p",
",",
"MediaLibrary",
")",
"return",
"f",
"(",
"p_mlib",
")"
] | Get media library subitems.
@param p_mlib: media library object.
@return: media list subitems. | [
"Get",
"media",
"library",
"subitems",
"."
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L4592-L4600 |
250,192 | manns/pyspread | pyspread/src/lib/vlc.py | libvlc_media_list_new | def libvlc_media_list_new(p_instance):
'''Create an empty media list.
@param p_instance: libvlc instance.
@return: empty media list, or NULL on error.
'''
f = _Cfunctions.get('libvlc_media_list_new', None) or \
_Cfunction('libvlc_media_list_new', ((1,),), class_result(MediaList),
ctypes.c_void_p, Instance)
return f(p_instance) | python | def libvlc_media_list_new(p_instance):
'''Create an empty media list.
@param p_instance: libvlc instance.
@return: empty media list, or NULL on error.
'''
f = _Cfunctions.get('libvlc_media_list_new', None) or \
_Cfunction('libvlc_media_list_new', ((1,),), class_result(MediaList),
ctypes.c_void_p, Instance)
return f(p_instance) | [
"def",
"libvlc_media_list_new",
"(",
"p_instance",
")",
":",
"f",
"=",
"_Cfunctions",
".",
"get",
"(",
"'libvlc_media_list_new'",
",",
"None",
")",
"or",
"_Cfunction",
"(",
"'libvlc_media_list_new'",
",",
"(",
"(",
"1",
",",
")",
",",
")",
",",
"class_result",
"(",
"MediaList",
")",
",",
"ctypes",
".",
"c_void_p",
",",
"Instance",
")",
"return",
"f",
"(",
"p_instance",
")"
] | Create an empty media list.
@param p_instance: libvlc instance.
@return: empty media list, or NULL on error. | [
"Create",
"an",
"empty",
"media",
"list",
"."
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L4602-L4610 |
250,193 | manns/pyspread | pyspread/src/lib/vlc.py | libvlc_media_list_event_manager | def libvlc_media_list_event_manager(p_ml):
'''Get libvlc_event_manager from this media list instance.
The p_event_manager is immutable, so you don't have to hold the lock.
@param p_ml: a media list instance.
@return: libvlc_event_manager.
'''
f = _Cfunctions.get('libvlc_media_list_event_manager', None) or \
_Cfunction('libvlc_media_list_event_manager', ((1,),), class_result(EventManager),
ctypes.c_void_p, MediaList)
return f(p_ml) | python | def libvlc_media_list_event_manager(p_ml):
'''Get libvlc_event_manager from this media list instance.
The p_event_manager is immutable, so you don't have to hold the lock.
@param p_ml: a media list instance.
@return: libvlc_event_manager.
'''
f = _Cfunctions.get('libvlc_media_list_event_manager', None) or \
_Cfunction('libvlc_media_list_event_manager', ((1,),), class_result(EventManager),
ctypes.c_void_p, MediaList)
return f(p_ml) | [
"def",
"libvlc_media_list_event_manager",
"(",
"p_ml",
")",
":",
"f",
"=",
"_Cfunctions",
".",
"get",
"(",
"'libvlc_media_list_event_manager'",
",",
"None",
")",
"or",
"_Cfunction",
"(",
"'libvlc_media_list_event_manager'",
",",
"(",
"(",
"1",
",",
")",
",",
")",
",",
"class_result",
"(",
"EventManager",
")",
",",
"ctypes",
".",
"c_void_p",
",",
"MediaList",
")",
"return",
"f",
"(",
"p_ml",
")"
] | Get libvlc_event_manager from this media list instance.
The p_event_manager is immutable, so you don't have to hold the lock.
@param p_ml: a media list instance.
@return: libvlc_event_manager. | [
"Get",
"libvlc_event_manager",
"from",
"this",
"media",
"list",
"instance",
".",
"The",
"p_event_manager",
"is",
"immutable",
"so",
"you",
"don",
"t",
"have",
"to",
"hold",
"the",
"lock",
"."
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L4756-L4765 |
250,194 | manns/pyspread | pyspread/src/lib/vlc.py | libvlc_media_list_player_new | def libvlc_media_list_player_new(p_instance):
'''Create new media_list_player.
@param p_instance: libvlc instance.
@return: media list player instance or NULL on error.
'''
f = _Cfunctions.get('libvlc_media_list_player_new', None) or \
_Cfunction('libvlc_media_list_player_new', ((1,),), class_result(MediaListPlayer),
ctypes.c_void_p, Instance)
return f(p_instance) | python | def libvlc_media_list_player_new(p_instance):
'''Create new media_list_player.
@param p_instance: libvlc instance.
@return: media list player instance or NULL on error.
'''
f = _Cfunctions.get('libvlc_media_list_player_new', None) or \
_Cfunction('libvlc_media_list_player_new', ((1,),), class_result(MediaListPlayer),
ctypes.c_void_p, Instance)
return f(p_instance) | [
"def",
"libvlc_media_list_player_new",
"(",
"p_instance",
")",
":",
"f",
"=",
"_Cfunctions",
".",
"get",
"(",
"'libvlc_media_list_player_new'",
",",
"None",
")",
"or",
"_Cfunction",
"(",
"'libvlc_media_list_player_new'",
",",
"(",
"(",
"1",
",",
")",
",",
")",
",",
"class_result",
"(",
"MediaListPlayer",
")",
",",
"ctypes",
".",
"c_void_p",
",",
"Instance",
")",
"return",
"f",
"(",
"p_instance",
")"
] | Create new media_list_player.
@param p_instance: libvlc instance.
@return: media list player instance or NULL on error. | [
"Create",
"new",
"media_list_player",
"."
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L4767-L4775 |
250,195 | manns/pyspread | pyspread/src/lib/vlc.py | libvlc_media_list_player_event_manager | def libvlc_media_list_player_event_manager(p_mlp):
'''Return the event manager of this media_list_player.
@param p_mlp: media list player instance.
@return: the event manager.
'''
f = _Cfunctions.get('libvlc_media_list_player_event_manager', None) or \
_Cfunction('libvlc_media_list_player_event_manager', ((1,),), class_result(EventManager),
ctypes.c_void_p, MediaListPlayer)
return f(p_mlp) | python | def libvlc_media_list_player_event_manager(p_mlp):
'''Return the event manager of this media_list_player.
@param p_mlp: media list player instance.
@return: the event manager.
'''
f = _Cfunctions.get('libvlc_media_list_player_event_manager', None) or \
_Cfunction('libvlc_media_list_player_event_manager', ((1,),), class_result(EventManager),
ctypes.c_void_p, MediaListPlayer)
return f(p_mlp) | [
"def",
"libvlc_media_list_player_event_manager",
"(",
"p_mlp",
")",
":",
"f",
"=",
"_Cfunctions",
".",
"get",
"(",
"'libvlc_media_list_player_event_manager'",
",",
"None",
")",
"or",
"_Cfunction",
"(",
"'libvlc_media_list_player_event_manager'",
",",
"(",
"(",
"1",
",",
")",
",",
")",
",",
"class_result",
"(",
"EventManager",
")",
",",
"ctypes",
".",
"c_void_p",
",",
"MediaListPlayer",
")",
"return",
"f",
"(",
"p_mlp",
")"
] | Return the event manager of this media_list_player.
@param p_mlp: media list player instance.
@return: the event manager. | [
"Return",
"the",
"event",
"manager",
"of",
"this",
"media_list_player",
"."
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L4800-L4808 |
250,196 | manns/pyspread | pyspread/src/lib/vlc.py | libvlc_media_list_player_set_media_player | def libvlc_media_list_player_set_media_player(p_mlp, p_mi):
'''Replace media player in media_list_player with this instance.
@param p_mlp: media list player instance.
@param p_mi: media player instance.
'''
f = _Cfunctions.get('libvlc_media_list_player_set_media_player', None) or \
_Cfunction('libvlc_media_list_player_set_media_player', ((1,), (1,),), None,
None, MediaListPlayer, MediaPlayer)
return f(p_mlp, p_mi) | python | def libvlc_media_list_player_set_media_player(p_mlp, p_mi):
'''Replace media player in media_list_player with this instance.
@param p_mlp: media list player instance.
@param p_mi: media player instance.
'''
f = _Cfunctions.get('libvlc_media_list_player_set_media_player', None) or \
_Cfunction('libvlc_media_list_player_set_media_player', ((1,), (1,),), None,
None, MediaListPlayer, MediaPlayer)
return f(p_mlp, p_mi) | [
"def",
"libvlc_media_list_player_set_media_player",
"(",
"p_mlp",
",",
"p_mi",
")",
":",
"f",
"=",
"_Cfunctions",
".",
"get",
"(",
"'libvlc_media_list_player_set_media_player'",
",",
"None",
")",
"or",
"_Cfunction",
"(",
"'libvlc_media_list_player_set_media_player'",
",",
"(",
"(",
"1",
",",
")",
",",
"(",
"1",
",",
")",
",",
")",
",",
"None",
",",
"None",
",",
"MediaListPlayer",
",",
"MediaPlayer",
")",
"return",
"f",
"(",
"p_mlp",
",",
"p_mi",
")"
] | Replace media player in media_list_player with this instance.
@param p_mlp: media list player instance.
@param p_mi: media player instance. | [
"Replace",
"media",
"player",
"in",
"media_list_player",
"with",
"this",
"instance",
"."
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L4810-L4818 |
250,197 | manns/pyspread | pyspread/src/lib/vlc.py | libvlc_media_list_player_set_media_list | def libvlc_media_list_player_set_media_list(p_mlp, p_mlist):
'''Set the media list associated with the player.
@param p_mlp: media list player instance.
@param p_mlist: list of media.
'''
f = _Cfunctions.get('libvlc_media_list_player_set_media_list', None) or \
_Cfunction('libvlc_media_list_player_set_media_list', ((1,), (1,),), None,
None, MediaListPlayer, MediaList)
return f(p_mlp, p_mlist) | python | def libvlc_media_list_player_set_media_list(p_mlp, p_mlist):
'''Set the media list associated with the player.
@param p_mlp: media list player instance.
@param p_mlist: list of media.
'''
f = _Cfunctions.get('libvlc_media_list_player_set_media_list', None) or \
_Cfunction('libvlc_media_list_player_set_media_list', ((1,), (1,),), None,
None, MediaListPlayer, MediaList)
return f(p_mlp, p_mlist) | [
"def",
"libvlc_media_list_player_set_media_list",
"(",
"p_mlp",
",",
"p_mlist",
")",
":",
"f",
"=",
"_Cfunctions",
".",
"get",
"(",
"'libvlc_media_list_player_set_media_list'",
",",
"None",
")",
"or",
"_Cfunction",
"(",
"'libvlc_media_list_player_set_media_list'",
",",
"(",
"(",
"1",
",",
")",
",",
"(",
"1",
",",
")",
",",
")",
",",
"None",
",",
"None",
",",
"MediaListPlayer",
",",
"MediaList",
")",
"return",
"f",
"(",
"p_mlp",
",",
"p_mlist",
")"
] | Set the media list associated with the player.
@param p_mlp: media list player instance.
@param p_mlist: list of media. | [
"Set",
"the",
"media",
"list",
"associated",
"with",
"the",
"player",
"."
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L4820-L4828 |
250,198 | manns/pyspread | pyspread/src/lib/vlc.py | libvlc_media_list_player_is_playing | def libvlc_media_list_player_is_playing(p_mlp):
'''Is media list playing?
@param p_mlp: media list player instance.
@return: true for playing and false for not playing \libvlc_return_bool.
'''
f = _Cfunctions.get('libvlc_media_list_player_is_playing', None) or \
_Cfunction('libvlc_media_list_player_is_playing', ((1,),), None,
ctypes.c_int, MediaListPlayer)
return f(p_mlp) | python | def libvlc_media_list_player_is_playing(p_mlp):
'''Is media list playing?
@param p_mlp: media list player instance.
@return: true for playing and false for not playing \libvlc_return_bool.
'''
f = _Cfunctions.get('libvlc_media_list_player_is_playing', None) or \
_Cfunction('libvlc_media_list_player_is_playing', ((1,),), None,
ctypes.c_int, MediaListPlayer)
return f(p_mlp) | [
"def",
"libvlc_media_list_player_is_playing",
"(",
"p_mlp",
")",
":",
"f",
"=",
"_Cfunctions",
".",
"get",
"(",
"'libvlc_media_list_player_is_playing'",
",",
"None",
")",
"or",
"_Cfunction",
"(",
"'libvlc_media_list_player_is_playing'",
",",
"(",
"(",
"1",
",",
")",
",",
")",
",",
"None",
",",
"ctypes",
".",
"c_int",
",",
"MediaListPlayer",
")",
"return",
"f",
"(",
"p_mlp",
")"
] | Is media list playing?
@param p_mlp: media list player instance.
@return: true for playing and false for not playing \libvlc_return_bool. | [
"Is",
"media",
"list",
"playing?"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L4848-L4856 |
250,199 | manns/pyspread | pyspread/src/lib/vlc.py | libvlc_media_list_player_get_state | def libvlc_media_list_player_get_state(p_mlp):
'''Get current libvlc_state of media list player.
@param p_mlp: media list player instance.
@return: libvlc_state_t for media list player.
'''
f = _Cfunctions.get('libvlc_media_list_player_get_state', None) or \
_Cfunction('libvlc_media_list_player_get_state', ((1,),), None,
State, MediaListPlayer)
return f(p_mlp) | python | def libvlc_media_list_player_get_state(p_mlp):
'''Get current libvlc_state of media list player.
@param p_mlp: media list player instance.
@return: libvlc_state_t for media list player.
'''
f = _Cfunctions.get('libvlc_media_list_player_get_state', None) or \
_Cfunction('libvlc_media_list_player_get_state', ((1,),), None,
State, MediaListPlayer)
return f(p_mlp) | [
"def",
"libvlc_media_list_player_get_state",
"(",
"p_mlp",
")",
":",
"f",
"=",
"_Cfunctions",
".",
"get",
"(",
"'libvlc_media_list_player_get_state'",
",",
"None",
")",
"or",
"_Cfunction",
"(",
"'libvlc_media_list_player_get_state'",
",",
"(",
"(",
"1",
",",
")",
",",
")",
",",
"None",
",",
"State",
",",
"MediaListPlayer",
")",
"return",
"f",
"(",
"p_mlp",
")"
] | Get current libvlc_state of media list player.
@param p_mlp: media list player instance.
@return: libvlc_state_t for media list player. | [
"Get",
"current",
"libvlc_state",
"of",
"media",
"list",
"player",
"."
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L4858-L4866 |
Subsets and Splits