_id stringlengths 2 7 | title stringlengths 1 88 | partition stringclasses 3
values | text stringlengths 75 19.8k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q231800 | GtkArtProvider.get_paths | train | def get_paths(self, theme, icon_size):
"""Returns tuple of theme, icon, action and toggle paths"""
_size_str = "x".join(map(str, icon_size))
theme_path = get_program_path() + "share" + os.sep + "icons" + os.sep
icon_path = theme_path + theme + os.sep + _size_str + os.sep
action... | python | {
"resource": ""
} |
q231801 | GtkArtProvider.CreateBitmap | train | def CreateBitmap(self, artid, client, size):
"""Adds custom images to Artprovider"""
if artid in self.extra_icons:
return wx.Bitmap(self.extra_icons[artid], wx.BITMAP_TYPE_ANY)
else:
return wx.ArtProvider.GetBitmap(artid, client, size) | python | {
"resource": ""
} |
q231802 | AOpenMixin.set_initial_state | train | def set_initial_state(self, kwargs):
"""Sets class state from kwargs attributes, pops extra kwargs"""
self.main_window = kwargs.pop("main_window")
try:
statustext = kwargs.pop("statustext")
except KeyError:
statustext = ""
try:
self.total_l... | python | {
"resource": ""
} |
q231803 | AOpenMixin.progress_status | train | def progress_status(self):
"""Displays progress in statusbar"""
if self.line % self.freq == 0:
text = self.statustext.format(nele=self.line,
totalele=self.total_lines)
if self.main_window.grid.actions.pasting:
try:
... | python | {
"resource": ""
} |
q231804 | AOpenMixin.on_key | train | def on_key(self, event):
"""Sets aborted state if escape is pressed"""
if self.main_window.grid.actions.pasting and \
event.GetKeyCode() == wx.WXK_ESCAPE:
self.aborted = True
event.Skip() | python | {
"resource": ""
} |
q231805 | Ods._get_tables | train | def _get_tables(self, ods):
"""Returns list of table nodes from ods object"""
childnodes = ods.spreadsheet.childNodes
qname_childnodes = [(s.qname[1], s) for s in childnodes]
return [node for name, node in qname_childnodes if name == u"table"] | python | {
"resource": ""
} |
q231806 | Ods._get_rows | train | def _get_rows(self, table):
"""Returns rows from table"""
childnodes = table.childNodes
qname_childnodes = [(s.qname[1], s) for s in childnodes]
return [node for name, node in qname_childnodes
if name == u'table-row'] | python | {
"resource": ""
} |
q231807 | Ods._get_cells | train | def _get_cells(self, row):
"""Returns rows from row"""
childnodes = row.childNodes
qname_childnodes = [(s.qname[1], s) for s in childnodes]
return [node for name, node in qname_childnodes
if name == u'table-cell'] | python | {
"resource": ""
} |
q231808 | Ods._ods2code | train | def _ods2code(self):
"""Updates code in code_array"""
ods = ODSReader(self.ods_file, clonespannedcolumns=True)
tables = ods.sheets
for tab_id, table in enumerate(tables):
for row_id in xrange(len(table)):
for col_id in xrange(len(table[row_id])):
... | python | {
"resource": ""
} |
q231809 | pyspread | train | def pyspread(S=None):
"""Holds application main loop"""
# Initialize main application
app = MainApplication(S=S, redirect=False)
app.MainLoop() | python | {
"resource": ""
} |
q231810 | ODSReader.readSheet | train | def readSheet(self, sheet):
"""Reads a sheet in the sheet dictionary
Stores each sheet as an array (rows) of arrays (columns)
"""
name = sheet.getAttribute("name")
rows = sheet.getElementsByType(TableRow)
arrRows = []
# for each row
for row in rows:
... | python | {
"resource": ""
} |
q231811 | sniff | train | def sniff(filepath):
"""
Sniffs CSV dialect and header info from csvfilepath
Returns a tuple of dialect and has_header
"""
with open(filepath, "rb") as csvfile:
sample = csvfile.read(config["sniff_size"])
sniffer = csv.Sniffer()
dialect = sniffer.sniff(sample)()
has_header = ... | python | {
"resource": ""
} |
q231812 | get_first_line | train | def get_first_line(filepath, dialect):
"""Returns List of first line items of file filepath"""
with open(filepath, "rb") as csvfile:
csvreader = csv.reader(csvfile, dialect=dialect)
for first_line in csvreader:
break
return first_line | python | {
"resource": ""
} |
q231813 | digested_line | train | def digested_line(line, digest_types):
"""Returns list of digested values in line"""
digested_line = []
for i, ele in enumerate(line):
try:
digest_key = digest_types[i]
except IndexError:
digest_key = digest_types[0]
digest = Digest(acceptable_types=[digest... | python | {
"resource": ""
} |
q231814 | csv_digest_gen | train | def csv_digest_gen(filepath, dialect, has_header, digest_types):
"""Generator of digested values from csv file in filepath
Parameters
----------
filepath:String
\tFile path of csv file to read
dialect: Object
\tCsv dialect
digest_types: tuple of types
\tTypes of data for each col
... | python | {
"resource": ""
} |
q231815 | cell_key_val_gen | train | def cell_key_val_gen(iterable, shape, topleft=(0, 0)):
"""Generator of row, col, value tuple from iterable of iterables
it: Iterable of iterables
\tMatrix that shall be mapped on target grid
shape: Tuple of Integer
\tShape of target grid
topleft: 2-tuple of Integer
\tTop left cell for inser... | python | {
"resource": ""
} |
q231816 | encode_gen | train | def encode_gen(line, encoding="utf-8"):
"""Encodes all Unicode strings in line to encoding
Parameters
----------
line: Iterable of Unicode strings
\tDate to be encoded
encoding: String, defaults to "utf-8"
\tTarget encoding
"""
for ele in line:
if isinstance(ele, types.Uni... | python | {
"resource": ""
} |
q231817 | CsvInterface._get_csv_cells_gen | train | def _get_csv_cells_gen(self, line):
"""Generator of values in a csv line"""
digest_types = self.digest_types
for j, value in enumerate(line):
if self.first_line:
digest_key = None
digest = lambda x: x.decode(self.encoding)
else:
... | python | {
"resource": ""
} |
q231818 | CsvInterface.write | train | def write(self, iterable):
"""Writes values from iterable into CSV file"""
io_error_text = _("Error writing to file {filepath}.")
io_error_text = io_error_text.format(filepath=self.path)
try:
with open(self.path, "wb") as csvfile:
csv_writer = csv.writer(cs... | python | {
"resource": ""
} |
q231819 | Xls._shape2xls | train | def _shape2xls(self, worksheets):
"""Writes shape to xls file
Format: <rows>\t<cols>\t<tabs>\n
"""
__, __, tabs = self.code_array.shape
if tabs > self.xls_max_tabs:
tabs = self.xls_max_tabs
for tab in xrange(tabs):
worksheet = self.workbook.ad... | python | {
"resource": ""
} |
q231820 | Xls._code2xls | train | def _code2xls(self, worksheets):
"""Writes code to xls file
Format: <row>\t<col>\t<tab>\t<code>\n
"""
code_array = self.code_array
xls_max_shape = self.xls_max_rows, self.xls_max_cols, self.xls_max_tabs
for key in code_array:
if all(kele < mele for kele, ... | python | {
"resource": ""
} |
q231821 | Xls._xls2code | train | def _xls2code(self, worksheet, tab):
"""Updates code in xls code_array"""
def xlrddate2datetime(xlrd_date):
"""Returns datetime from xlrd_date"""
try:
xldate_tuple = xlrd.xldate_as_tuple(xlrd_date,
self.workboo... | python | {
"resource": ""
} |
q231822 | Xls._get_font | train | def _get_font(self, pys_style):
"""Returns xlwt.Font for pyspread style"""
# Return None if there is no font
if "textfont" not in pys_style:
return
font = xlwt.Font()
font.name = pys_style["textfont"]
if "pointsize" in pys_style:
font.height = ... | python | {
"resource": ""
} |
q231823 | Xls._get_alignment | train | def _get_alignment(self, pys_style):
"""Returns xlwt.Alignment for pyspread style"""
# Return None if there is no alignment
alignment_styles = ["justification", "vertical_align", "angle"]
if not any(astyle in pys_style for astyle in alignment_styles):
return
def ang... | python | {
"resource": ""
} |
q231824 | Xls._get_pattern | train | def _get_pattern(self, pys_style):
"""Returns xlwt.pattern for pyspread style"""
# Return None if there is no bgcolor
if "bgcolor" not in pys_style:
return
pattern = xlwt.Pattern()
pattern.pattern = xlwt.Pattern.SOLID_PATTERN
bgcolor = wx.Colour()
b... | python | {
"resource": ""
} |
q231825 | Xls._get_borders | train | def _get_borders(self, pys_style, pys_style_above, pys_style_left):
"""Returns xlwt.Borders for pyspread style"""
# Return None if there is no border key
border_keys = [
"borderwidth_right",
"borderwidth_bottom",
"bordercolor_right",
"bordercolor_... | python | {
"resource": ""
} |
q231826 | Xls._get_xfstyle | train | def _get_xfstyle(self, worksheets, key):
"""Gets XFStyle for cell key"""
row, col, tab = key
dict_grid = self.code_array.dict_grid
dict_grid.cell_attributes._update_table_cache()
pys_style = dict_grid.cell_attributes[key]
pys_style_above = dict_grid.cell_attributes[row ... | python | {
"resource": ""
} |
q231827 | Xls._cell_attribute_append | train | def _cell_attribute_append(self, selection, tab, attributes):
"""Appends to cell_attributes with checks"""
cell_attributes = self.code_array.cell_attributes
thick_bottom_cells = []
thick_right_cells = []
# Does any cell in selection.cells have a larger bottom border?
... | python | {
"resource": ""
} |
q231828 | Xls._row_heights2xls | train | def _row_heights2xls(self, worksheets):
"""Writes row_heights to xls file
Format: <row>\t<tab>\t<value>\n
"""
xls_max_rows, xls_max_tabs = self.xls_max_rows, self.xls_max_tabs
dict_grid = self.code_array.dict_grid
for row, tab in dict_grid.row_heights:
if... | python | {
"resource": ""
} |
q231829 | Xls.pys_width2xls_width | train | def pys_width2xls_width(self, pys_width):
"""Returns xls width from given pyspread width"""
width_0 = get_default_text_extent("0")[0]
# Scale relative to 12 point font instead of 10 point
width_0_char = pys_width * 1.2 / width_0
return int(width_0_char * 256.0) | python | {
"resource": ""
} |
q231830 | Xls._col_widths2xls | train | def _col_widths2xls(self, worksheets):
"""Writes col_widths to xls file
Format: <col>\t<tab>\t<value>\n
"""
xls_max_cols, xls_max_tabs = self.xls_max_cols, self.xls_max_tabs
dict_grid = self.code_array.dict_grid
for col, tab in dict_grid.col_widths:
if co... | python | {
"resource": ""
} |
q231831 | Xls.from_code_array | train | def from_code_array(self):
"""Returns xls workbook object with everything from code_array"""
worksheets = []
self._shape2xls(worksheets)
self._code2xls(worksheets)
self._row_heights2xls(worksheets)
self._col_widths2xls(worksheets)
return self.workbook | python | {
"resource": ""
} |
q231832 | Xls.to_code_array | train | def to_code_array(self):
"""Replaces everything in code_array from xls_file"""
self._xls2shape()
worksheets = self.workbook.sheet_names()
for tab, worksheet_name in enumerate(worksheets):
worksheet = self.workbook.sheet_by_name(worksheet_name)
self._xls2code(wo... | python | {
"resource": ""
} |
q231833 | Pys._split_tidy | train | def _split_tidy(self, string, maxsplit=None):
"""Rstrips string for \n and splits string for \t"""
if maxsplit is None:
return string.rstrip("\n").split("\t")
else:
return string.rstrip("\n").split("\t", maxsplit) | python | {
"resource": ""
} |
q231834 | Pys._pys_assert_version | train | def _pys_assert_version(self, line):
"""Asserts pys file version"""
if float(line.strip()) > 1.0:
# Abort if file version not supported
msg = _("File version {version} unsupported (>1.0).").format(
version=line.strip())
raise ValueError(msg) | python | {
"resource": ""
} |
q231835 | Pys._shape2pys | train | def _shape2pys(self):
"""Writes shape to pys file
Format: <rows>\t<cols>\t<tabs>\n
"""
shape_line = u"\t".join(map(unicode, self.code_array.shape)) + u"\n"
self.pys_file.write(shape_line) | python | {
"resource": ""
} |
q231836 | Pys._code2pys | train | def _code2pys(self):
"""Writes code to pys file
Format: <row>\t<col>\t<tab>\t<code>\n
"""
for key in self.code_array:
key_str = u"\t".join(repr(ele) for ele in key)
code_str = self.code_array(key)
if code_str is not None:
out_str = k... | python | {
"resource": ""
} |
q231837 | Pys._pys2code | train | def _pys2code(self, line):
"""Updates code in pys code_array"""
row, col, tab, code = self._split_tidy(line, maxsplit=3)
key = self._get_key(row, col, tab)
self.code_array.dict_grid[key] = unicode(code, encoding='utf-8') | python | {
"resource": ""
} |
q231838 | Pys._attributes2pys | train | def _attributes2pys(self):
"""Writes attributes to pys file
Format:
<selection[0]>\t[...]\t<tab>\t<key>\t<value>\t[...]\n
"""
# Remove doublettes
purged_cell_attributes = []
purged_cell_attributes_keys = []
for selection, tab, attr_dict in self.code_arr... | python | {
"resource": ""
} |
q231839 | Pys._row_heights2pys | train | def _row_heights2pys(self):
"""Writes row_heights to pys file
Format: <row>\t<tab>\t<value>\n
"""
for row, tab in self.code_array.dict_grid.row_heights:
if row < self.code_array.shape[0] and \
tab < self.code_array.shape[2]:
height = self.cod... | python | {
"resource": ""
} |
q231840 | Pys._col_widths2pys | train | def _col_widths2pys(self):
"""Writes col_widths to pys file
Format: <col>\t<tab>\t<value>\n
"""
for col, tab in self.code_array.dict_grid.col_widths:
if col < self.code_array.shape[1] and \
tab < self.code_array.shape[2]:
width = self.code_ar... | python | {
"resource": ""
} |
q231841 | Pys._macros2pys | train | def _macros2pys(self):
"""Writes macros to pys file
Format: <macro code line>\n
"""
macros = self.code_array.dict_grid.macros
pys_macros = macros.encode("utf-8")
self.pys_file.write(pys_macros) | python | {
"resource": ""
} |
q231842 | Pys._pys2macros | train | def _pys2macros(self, line):
"""Updates macros in code_array"""
if self.code_array.dict_grid.macros and \
self.code_array.dict_grid.macros[-1] != "\n":
# The last macro line does not end with \n
# Therefore, if not new line is inserted, the codeis broken
s... | python | {
"resource": ""
} |
q231843 | Pys._fonts2pys | train | def _fonts2pys(self):
"""Writes fonts to pys file"""
# Get mapping from fonts to fontfiles
system_fonts = font_manager.findSystemFonts()
font_name2font_file = {}
for sys_font in system_fonts:
font_name = font_manager.FontProperties(fname=sys_font).get_name()
... | python | {
"resource": ""
} |
q231844 | Pys._pys2fonts | train | def _pys2fonts(self, line):
"""Updates custom font list"""
font_name, ascii_font_data = self._split_tidy(line)
font_data = base64.b64decode(ascii_font_data)
# Get system font names
system_fonts = font_manager.findSystemFonts()
system_font_names = []
for sys_fon... | python | {
"resource": ""
} |
q231845 | Pys.from_code_array | train | def from_code_array(self):
"""Replaces everything in pys_file from code_array"""
for key in self._section2writer:
self.pys_file.write(key)
self._section2writer[key]()
try:
if self.pys_file.aborted:
break
except Attribu... | python | {
"resource": ""
} |
q231846 | Pys.to_code_array | train | def to_code_array(self):
"""Replaces everything in code_array from pys_file"""
state = None
# Check if version section starts with first line
first_line = True
# Reset pys_file to start to enable multiple calls of this method
self.pys_file.seek(0)
for line in ... | python | {
"resource": ""
} |
q231847 | PythonSTC._style | train | def _style(self):
"""Set editor style"""
self.fold_symbols = 2
"""
Fold symbols
------------
The following styles are pre-defined:
"arrows" Arrow pointing right for contracted folders,
arrow pointing down for expanded
"p... | python | {
"resource": ""
} |
q231848 | PythonSTC.OnUpdateUI | train | def OnUpdateUI(self, evt):
"""Syntax highlighting while editing"""
# check for matching braces
brace_at_caret = -1
brace_opposite = -1
char_before = None
caret_pos = self.GetCurrentPos()
if caret_pos > 0:
char_before = self.GetCharAt(caret_pos - 1)
... | python | {
"resource": ""
} |
q231849 | PythonSTC.OnMarginClick | train | def OnMarginClick(self, evt):
"""When clicked, old and unfold as needed"""
if evt.GetMargin() == 2:
if evt.GetShift() and evt.GetControl():
self.fold_all()
else:
line_clicked = self.LineFromPosition(evt.GetPosition())
if self.GetF... | python | {
"resource": ""
} |
q231850 | PythonSTC.expand | train | def expand(self, line, do_expand, force=False, vislevels=0, level=-1):
"""Multi-purpose expand method from original STC class"""
lastchild = self.GetLastChild(line, level)
line += 1
while line <= lastchild:
if force:
if vislevels > 0:
sel... | python | {
"resource": ""
} |
q231851 | ImageComboBox.OnDrawBackground | train | def OnDrawBackground(self, dc, rect, item, flags):
"""Called for drawing the background area of each item
Overridden from OwnerDrawnComboBox
"""
# If the item is selected, or its item is even,
# or if we are painting the combo control itself
# then use the default rend... | python | {
"resource": ""
} |
q231852 | MatplotlibStyleChoice.get_style_code | train | def get_style_code(self, label):
"""Returns code for given label string
Inverse of get_code
Parameters
----------
label: String
\tLlabel string, field 0 of style tuple
"""
for style in self.styles:
if style[0] == label:
retu... | python | {
"resource": ""
} |
q231853 | MatplotlibStyleChoice.get_label | train | def get_label(self, code):
"""Returns string label for given code string
Inverse of get_code
Parameters
----------
code: String
\tCode string, field 1 of style tuple
"""
for style in self.styles:
if style[1] == code:
return ... | python | {
"resource": ""
} |
q231854 | BitmapToggleButton.toggle | train | def toggle(self, event):
"""Toggles state to next bitmap"""
if self.state < len(self.bitmap_list) - 1:
self.state += 1
else:
self.state = 0
self.SetBitmapLabel(self.bitmap_list[self.state])
try:
event.Skip()
except AttributeError:
... | python | {
"resource": ""
} |
q231855 | EntryLinePanel.OnToggle | train | def OnToggle(self, event):
"""Toggle button event handler"""
if self.selection_toggle_button.GetValue():
self.entry_line.last_selection = self.entry_line.GetSelection()
self.entry_line.last_selection_string = \
self.entry_line.GetStringSelection()
sel... | python | {
"resource": ""
} |
q231856 | EntryLine.OnContentChange | train | def OnContentChange(self, event):
"""Event handler for updating the content"""
self.ignore_changes = True
self.SetValue(u"" if event.text is None else event.text)
self.ignore_changes = False
event.Skip() | python | {
"resource": ""
} |
q231857 | EntryLine.OnGridSelection | train | def OnGridSelection(self, event):
"""Event handler for grid selection in selection mode adds text"""
current_table = copy(self.main_window.grid.current_table)
post_command_event(self, self.GridActionTableSwitchMsg,
newtable=self.last_table)
if is_gtk():
... | python | {
"resource": ""
} |
q231858 | EntryLine.OnText | train | def OnText(self, event):
"""Text event method evals the cell and updates the grid"""
if not self.ignore_changes:
post_command_event(self, self.CodeEntryMsg, code=event.GetString())
self.main_window.grid.grid_renderer.cell_cache.clear()
event.Skip() | python | {
"resource": ""
} |
q231859 | EntryLine.OnChar | train | def OnChar(self, event):
"""Key event method
* Forces grid update on <Enter> key
* Handles insertion of cell access code
"""
if not self.ignore_changes:
# Handle special keys
keycode = event.GetKeyCode()
if keycode == 13 and not self.Get... | python | {
"resource": ""
} |
q231860 | StatusBar.Reposition | train | def Reposition(self):
"""Reposition the checkbox"""
rect = self.GetFieldRect(1)
self.safemode_staticbmp.SetPosition((rect.x, rect.y))
self.size_changed = False | python | {
"resource": ""
} |
q231861 | TableChoiceIntCtrl.change_max | train | def change_max(self, no_tabs):
"""Updates to a new number of tables
Fixes current table if out of bounds.
Parameters
----------
no_tabs: Integer
\tNumber of tables for choice
"""
self.no_tabs = no_tabs
if self.GetValue() >= no_tabs:
... | python | {
"resource": ""
} |
q231862 | TableChoiceIntCtrl._fromGUI | train | def _fromGUI(self, value):
"""
Conversion function used in getting the value of the control.
"""
# One or more of the underlying text control implementations
# issue an intermediate EVT_TEXT when replacing the control's
# value, where the intermediate value is an empty ... | python | {
"resource": ""
} |
q231863 | TableChoiceIntCtrl.OnInt | train | def OnInt(self, event):
"""IntCtrl event method that updates the current table"""
value = event.GetValue()
current_time = time.clock()
if current_time < self.last_change_s + 0.01:
return
self.last_change_s = current_time
self.cursor_pos = wx.TextCtrl.GetIns... | python | {
"resource": ""
} |
q231864 | TableChoiceListCtrl.OnItemSelected | train | def OnItemSelected(self, event):
"""Item selection event handler"""
value = event.m_itemIndex
self.startIndex = value
self.switching = True
post_command_event(self, self.GridActionTableSwitchMsg, newtable=value)
self.switching = False
event.Skip() | python | {
"resource": ""
} |
q231865 | TableChoiceListCtrl.OnResizeGrid | train | def OnResizeGrid(self, event):
"""Event handler for grid resizing"""
shape = min(event.shape[2], 2**30)
self.SetItemCount(shape)
event.Skip() | python | {
"resource": ""
} |
q231866 | TableChoiceListCtrl.OnMouseUp | train | def OnMouseUp(self, event):
"""Generate a dropIndex.
Process: check self.IsInControl, check self.IsDrag, HitTest,
compare HitTest value
The mouse can end up in 5 different places:
Outside the Control
On itself
Above its starting point and on another item... | python | {
"resource": ""
} |
q231867 | MainWindow._set_properties | train | def _set_properties(self):
"""Setup title, icon, size, scale, statusbar, main grid"""
self.set_icon(icons["PyspreadLogo"])
# Without minimum size, initial size is minimum size in wxGTK
self.minSizeSet = False
# Leave save mode
post_command_event(self, self.SafeModeExit... | python | {
"resource": ""
} |
q231868 | MainWindow._set_menu_toggles | train | def _set_menu_toggles(self):
"""Enable menu bar view item checkmarks"""
toggles = [
(self.main_toolbar, "main_window_toolbar", _("Main toolbar")),
(self.macro_toolbar, "macro_toolbar", _("Macro toolbar")),
(self.macro_panel, "macro_panel", _("Macro panel")),
... | python | {
"resource": ""
} |
q231869 | MainWindow.set_icon | train | def set_icon(self, bmp):
"""Sets main window icon to given wx.Bitmap"""
_icon = wx.EmptyIcon()
_icon.CopyFromBitmap(bmp)
self.SetIcon(_icon) | python | {
"resource": ""
} |
q231870 | MainWindowEventHandlers.OnToggleFullscreen | train | def OnToggleFullscreen(self, event):
"""Fullscreen event handler"""
is_full_screen = self.main_window.IsFullScreen()
# Make sure that only the grid is shown in fullscreen mode
if is_full_screen:
try:
self.main_window.grid.SetRowLabelSize(self.row_label_size)... | python | {
"resource": ""
} |
q231871 | MainWindowEventHandlers.OnContentChanged | train | def OnContentChanged(self, event):
"""Titlebar star adjustment event handler"""
self.main_window.grid.update_attribute_toolbar()
title = self.main_window.GetTitle()
if undo.stack().haschanged():
# Put * in front of title
if title[:2] != "* ":
ne... | python | {
"resource": ""
} |
q231872 | MainWindowEventHandlers.OnSafeModeEntry | train | def OnSafeModeEntry(self, event):
"""Safe mode entry event handler"""
# Enable menu item for leaving safe mode
self.main_window.main_menu.enable_file_approve(True)
self.main_window.grid.Refresh()
event.Skip() | python | {
"resource": ""
} |
q231873 | MainWindowEventHandlers.OnSafeModeExit | train | def OnSafeModeExit(self, event):
"""Safe mode exit event handler"""
# Run macros
# self.MainGrid.model.pysgrid.sgrid.execute_macros(safe_mode=False)
# Disable menu item for leaving safe mode
self.main_window.main_menu.enable_file_approve(False)
self.main_window.grid.... | python | {
"resource": ""
} |
q231874 | MainWindowEventHandlers.OnClose | train | def OnClose(self, event):
"""Program exit event handler"""
# If changes have taken place save of old grid
if undo.stack().haschanged():
save_choice = self.interfaces.get_save_request_from_user()
if save_choice is None:
# Cancelled close operation
... | python | {
"resource": ""
} |
q231875 | MainWindowEventHandlers.OnSpellCheckToggle | train | def OnSpellCheckToggle(self, event):
"""Spell checking toggle event handler"""
spelltoolid = self.main_window.main_toolbar.label2id["CheckSpelling"]
self.main_window.main_toolbar.ToggleTool(spelltoolid,
not config["check_spelling"])
conf... | python | {
"resource": ""
} |
q231876 | MainWindowEventHandlers.OnPreferences | train | def OnPreferences(self, event):
"""Preferences event handler that launches preferences dialog"""
preferences = self.interfaces.get_preferences_from_user()
if preferences:
for key in preferences:
if type(config[key]) in (type(u""), type("")):
conf... | python | {
"resource": ""
} |
q231877 | MainWindowEventHandlers.OnNewGpgKey | train | def OnNewGpgKey(self, event):
"""New GPG key event handler.
Launches GPG choice and creation dialog
"""
if gnupg is None:
return
if genkey is None:
# gnupg is not present
self.interfaces.display_warning(
_("Python gnupg not ... | python | {
"resource": ""
} |
q231878 | MainWindowEventHandlers._toggle_pane | train | def _toggle_pane(self, pane):
"""Toggles visibility of given aui pane
Parameters
----------
pane: String
\tPane name
"""
if pane.IsShown():
pane.Hide()
else:
pane.Show()
self.main_window._mgr.Update() | python | {
"resource": ""
} |
q231879 | MainWindowEventHandlers.OnMainToolbarToggle | train | def OnMainToolbarToggle(self, event):
"""Main window toolbar toggle event handler"""
self.main_window.main_toolbar.SetGripperVisible(True)
main_toolbar_info = \
self.main_window._mgr.GetPane("main_window_toolbar")
self._toggle_pane(main_toolbar_info)
event.Skip() | python | {
"resource": ""
} |
q231880 | MainWindowEventHandlers.OnMacroToolbarToggle | train | def OnMacroToolbarToggle(self, event):
"""Macro toolbar toggle event handler"""
self.main_window.macro_toolbar.SetGripperVisible(True)
macro_toolbar_info = self.main_window._mgr.GetPane("macro_toolbar")
self._toggle_pane(macro_toolbar_info)
event.Skip() | python | {
"resource": ""
} |
q231881 | MainWindowEventHandlers.OnWidgetToolbarToggle | train | def OnWidgetToolbarToggle(self, event):
"""Widget toolbar toggle event handler"""
self.main_window.widget_toolbar.SetGripperVisible(True)
widget_toolbar_info = self.main_window._mgr.GetPane("widget_toolbar")
self._toggle_pane(widget_toolbar_info)
event.Skip() | python | {
"resource": ""
} |
q231882 | MainWindowEventHandlers.OnAttributesToolbarToggle | train | def OnAttributesToolbarToggle(self, event):
"""Format toolbar toggle event handler"""
self.main_window.attributes_toolbar.SetGripperVisible(True)
attributes_toolbar_info = \
self.main_window._mgr.GetPane("attributes_toolbar")
self._toggle_pane(attributes_toolbar_info)
... | python | {
"resource": ""
} |
q231883 | MainWindowEventHandlers.OnFindToolbarToggle | train | def OnFindToolbarToggle(self, event):
"""Search toolbar toggle event handler"""
self.main_window.find_toolbar.SetGripperVisible(True)
find_toolbar_info = self.main_window._mgr.GetPane("find_toolbar")
self._toggle_pane(find_toolbar_info)
event.Skip() | python | {
"resource": ""
} |
q231884 | MainWindowEventHandlers.OnEntryLineToggle | train | def OnEntryLineToggle(self, event):
"""Entry line toggle event handler"""
entry_line_panel_info = \
self.main_window._mgr.GetPane("entry_line_panel")
self._toggle_pane(entry_line_panel_info)
event.Skip() | python | {
"resource": ""
} |
q231885 | MainWindowEventHandlers.OnTableListToggle | train | def OnTableListToggle(self, event):
"""Table list toggle event handler"""
table_list_panel_info = \
self.main_window._mgr.GetPane("table_list_panel")
self._toggle_pane(table_list_panel_info)
event.Skip() | python | {
"resource": ""
} |
q231886 | MainWindowEventHandlers.OnNew | train | def OnNew(self, event):
"""New grid event handler"""
# If changes have taken place save of old grid
if undo.stack().haschanged():
save_choice = self.interfaces.get_save_request_from_user()
if save_choice is None:
# Cancelled close operation
... | python | {
"resource": ""
} |
q231887 | MainWindowEventHandlers.OnOpen | train | def OnOpen(self, event):
"""File open event handler"""
# If changes have taken place save of old grid
if undo.stack().haschanged():
save_choice = self.interfaces.get_save_request_from_user()
if save_choice is None:
# Cancelled close operation
... | python | {
"resource": ""
} |
q231888 | MainWindowEventHandlers.OnSave | train | def OnSave(self, event):
"""File save event handler"""
try:
filetype = event.attr["filetype"]
except (KeyError, AttributeError):
filetype = None
filepath = self.main_window.filepath
if filepath is None:
filetype = config["default_save_filety... | python | {
"resource": ""
} |
q231889 | MainWindowEventHandlers.OnSaveAs | train | def OnSaveAs(self, event):
"""File save as event handler"""
# Get filepath from user
f2w = get_filetypes2wildcards(["pys", "pysu", "xls", "all"])
filetypes = f2w.keys()
wildcards = f2w.values()
wildcard = "|".join(wildcards)
message = _("Choose filename for sa... | python | {
"resource": ""
} |
q231890 | MainWindowEventHandlers.OnImport | train | def OnImport(self, event):
"""File import event handler"""
# Get filepath from user
wildcards = get_filetypes2wildcards(["csv", "txt"]).values()
wildcard = "|".join(wildcards)
message = _("Choose file to import.")
style = wx.OPEN
filepath, filterindex = \
... | python | {
"resource": ""
} |
q231891 | MainWindowEventHandlers.OnExport | train | def OnExport(self, event):
"""File export event handler
Currently, only CSV export is supported
"""
code_array = self.main_window.grid.code_array
tab = self.main_window.grid.current_table
selection = self.main_window.grid.selection
# Check if no selection is ... | python | {
"resource": ""
} |
q231892 | MainWindowEventHandlers.OnExportPDF | train | def OnExportPDF(self, event):
"""Export PDF event handler"""
wildcards = get_filetypes2wildcards(["pdf"]).values()
if not wildcards:
return
wildcard = "|".join(wildcards)
# Get filepath from user
message = _("Choose file path for PDF export.")
sty... | python | {
"resource": ""
} |
q231893 | MainWindowEventHandlers.OnApprove | train | def OnApprove(self, event):
"""File approve event handler"""
if not self.main_window.safe_mode:
return
msg = _(u"You are going to approve and trust a file that\n"
u"you have not created yourself.\n"
u"After proceeding, the file is executed.\n \n"
... | python | {
"resource": ""
} |
q231894 | MainWindowEventHandlers.OnClearGlobals | train | def OnClearGlobals(self, event):
"""Clear globals event handler"""
msg = _("Deleting globals and reloading modules cannot be undone."
" Proceed?")
short_msg = _("Really delete globals and modules?")
choice = self.main_window.interfaces.get_warning_choice(msg, short_msg)... | python | {
"resource": ""
} |
q231895 | MainWindowEventHandlers.OnPageSetup | train | def OnPageSetup(self, event):
"""Page setup handler for printing framework"""
print_data = self.main_window.print_data
new_print_data = \
self.main_window.interfaces.get_print_setup(print_data)
self.main_window.print_data = new_print_data | python | {
"resource": ""
} |
q231896 | MainWindowEventHandlers._get_print_area | train | def _get_print_area(self):
"""Returns selection bounding box or visible area"""
# Get print area from current selection
selection = self.main_window.grid.selection
print_area = selection.get_bbox()
# If there is no selection use the visible area on the screen
if print_a... | python | {
"resource": ""
} |
q231897 | MainWindowEventHandlers.OnPrintPreview | train | def OnPrintPreview(self, event):
"""Print preview handler"""
print_area = self._get_print_area()
print_data = self.main_window.print_data
self.main_window.actions.print_preview(print_area, print_data) | python | {
"resource": ""
} |
q231898 | MainWindowEventHandlers.OnPrint | train | def OnPrint(self, event):
"""Print event handler"""
print_area = self._get_print_area()
print_data = self.main_window.print_data
self.main_window.actions.printout(print_area, print_data) | python | {
"resource": ""
} |
q231899 | MainWindowEventHandlers.OnCut | train | def OnCut(self, event):
"""Clipboard cut event handler"""
entry_line = \
self.main_window.entry_line_panel.entry_line_panel.entry_line
if wx.Window.FindFocus() != entry_line:
selection = self.main_window.grid.selection
with undo.group(_("Cut")):
... | python | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.