idx int64 0 63k | question stringlengths 61 4.03k | target stringlengths 6 1.23k |
|---|---|---|
42,500 | def OnDrawBackground ( self , dc , rect , item , flags ) : if ( item & 1 == 0 or flags & ( wx . combo . ODCB_PAINTING_CONTROL | wx . combo . ODCB_PAINTING_SELECTED ) ) : try : wx . combo . OwnerDrawnComboBox . OnDrawBackground ( self , dc , rect , item , flags ) finally : return bg_color = get_color ( config [ "label_c... | Called for drawing the background area of each item |
42,501 | def get_style_code ( self , label ) : for style in self . styles : if style [ 0 ] == label : return style [ 1 ] msg = _ ( "Label {label} is invalid." ) . format ( label = label ) raise ValueError ( msg ) | Returns code for given label string |
42,502 | def get_label ( self , code ) : for style in self . styles : if style [ 1 ] == code : return style [ 0 ] msg = _ ( "Code {code} is invalid." ) . format ( code = code ) raise ValueError ( msg ) | Returns string label for given code string |
42,503 | def toggle ( self , event ) : 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 : pass setattr ( self , "GetToolState" , lambda x : self . state ) | Toggles state to next bitmap |
42,504 | def OnToggle ( self , event ) : 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 ( ) self . entry_line . last_table = self . main_window . grid . current_table s... | Toggle button event handler |
42,505 | def OnContentChange ( self , event ) : self . ignore_changes = True self . SetValue ( u"" if event . text is None else event . text ) self . ignore_changes = False event . Skip ( ) | Event handler for updating the content |
42,506 | def OnGridSelection ( self , event ) : current_table = copy ( self . main_window . grid . current_table ) post_command_event ( self , self . GridActionTableSwitchMsg , newtable = self . last_table ) if is_gtk ( ) : try : wx . Yield ( ) except : pass sel_start , sel_stop = self . last_selection shape = self . main_windo... | Event handler for grid selection in selection mode adds text |
42,507 | def OnText ( self , event ) : 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 ( ) | Text event method evals the cell and updates the grid |
42,508 | def OnChar ( self , event ) : if not self . ignore_changes : keycode = event . GetKeyCode ( ) if keycode == 13 and not self . GetStringSelection ( ) : self . main_window . grid . SetFocus ( ) if event . ControlDown ( ) : self . SetValue ( quote ( self . GetValue ( ) ) ) return elif keycode == 13 and self . GetStringSel... | Key event method |
42,509 | def Reposition ( self ) : rect = self . GetFieldRect ( 1 ) self . safemode_staticbmp . SetPosition ( ( rect . x , rect . y ) ) self . size_changed = False | Reposition the checkbox |
42,510 | def change_max ( self , no_tabs ) : self . no_tabs = no_tabs if self . GetValue ( ) >= no_tabs : self . SetValue ( no_tabs - 1 ) | Updates to a new number of tables |
42,511 | def _fromGUI ( self , value ) : if value == '' : if not self . IsNoneAllowed ( ) : return 0 else : return else : try : return int ( value ) except ValueError : if self . IsLongAllowed ( ) : try : return long ( value ) except ValueError : wx . TextCtrl . SetValue ( self , "0" ) return 0 else : raise | Conversion function used in getting the value of the control . |
42,512 | def OnInt ( self , event ) : 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 . GetInsertionPoint ( self ) + 1 if event . GetValue ( ) > self . no_tabs - 1 : value = self . no_tabs - ... | IntCtrl event method that updates the current table |
42,513 | def OnItemSelected ( self , event ) : value = event . m_itemIndex self . startIndex = value self . switching = True post_command_event ( self , self . GridActionTableSwitchMsg , newtable = value ) self . switching = False event . Skip ( ) | Item selection event handler |
42,514 | def OnResizeGrid ( self , event ) : shape = min ( event . shape [ 2 ] , 2 ** 30 ) self . SetItemCount ( shape ) event . Skip ( ) | Event handler for grid resizing |
42,515 | def OnMouseUp ( self , event ) : if not self . IsInControl : self . IsDrag = False elif self . IsDrag : if not self . IsDrag : self . hitIndex = self . HitTest ( event . GetPosition ( ) ) self . dropIndex = self . hitIndex [ 0 ] if not ( self . dropIndex == self . startIndex or self . dropIndex == - 1 ) : dropList = [ ... | Generate a dropIndex . |
42,516 | def _set_properties ( self ) : self . set_icon ( icons [ "PyspreadLogo" ] ) self . minSizeSet = False post_command_event ( self , self . SafeModeExitMsg ) | Setup title icon size scale statusbar main grid |
42,517 | def _set_menu_toggles ( self ) : toggles = [ ( self . main_toolbar , "main_window_toolbar" , _ ( "Main toolbar" ) ) , ( self . macro_toolbar , "macro_toolbar" , _ ( "Macro toolbar" ) ) , ( self . macro_panel , "macro_panel" , _ ( "Macro panel" ) ) , ( self . attributes_toolbar , "attributes_toolbar" , _ ( "Format toolb... | Enable menu bar view item checkmarks |
42,518 | def set_icon ( self , bmp ) : _icon = wx . EmptyIcon ( ) _icon . CopyFromBitmap ( bmp ) self . SetIcon ( _icon ) | Sets main window icon to given wx . Bitmap |
42,519 | def OnToggleFullscreen ( self , event ) : is_full_screen = self . main_window . IsFullScreen ( ) if is_full_screen : try : self . main_window . grid . SetRowLabelSize ( self . row_label_size ) self . main_window . grid . SetColLabelSize ( self . col_label_size ) except AttributeError : pass try : self . main_window . _... | Fullscreen event handler |
42,520 | def OnContentChanged ( self , event ) : self . main_window . grid . update_attribute_toolbar ( ) title = self . main_window . GetTitle ( ) if undo . stack ( ) . haschanged ( ) : if title [ : 2 ] != "* " : new_title = "* " + title post_command_event ( self . main_window , self . main_window . TitleMsg , text = new_title... | Titlebar star adjustment event handler |
42,521 | def OnSafeModeEntry ( self , event ) : self . main_window . main_menu . enable_file_approve ( True ) self . main_window . grid . Refresh ( ) event . Skip ( ) | Safe mode entry event handler |
42,522 | def OnSafeModeExit ( self , event ) : self . main_window . main_menu . enable_file_approve ( False ) self . main_window . grid . Refresh ( ) event . Skip ( ) | Safe mode exit event handler |
42,523 | def OnClose ( self , event ) : if undo . stack ( ) . haschanged ( ) : save_choice = self . interfaces . get_save_request_from_user ( ) if save_choice is None : return elif save_choice : post_command_event ( self . main_window , self . main_window . SaveMsg ) config [ "window_layout" ] = repr ( self . main_window . _mgr... | Program exit event handler |
42,524 | def OnSpellCheckToggle ( self , event ) : spelltoolid = self . main_window . main_toolbar . label2id [ "CheckSpelling" ] self . main_window . main_toolbar . ToggleTool ( spelltoolid , not config [ "check_spelling" ] ) config [ "check_spelling" ] = repr ( not config [ "check_spelling" ] ) self . main_window . grid . gri... | Spell checking toggle event handler |
42,525 | def OnPreferences ( self , event ) : preferences = self . interfaces . get_preferences_from_user ( ) if preferences : for key in preferences : if type ( config [ key ] ) in ( type ( u"" ) , type ( "" ) ) : config [ key ] = preferences [ key ] else : config [ key ] = ast . literal_eval ( preferences [ key ] ) self . mai... | Preferences event handler that launches preferences dialog |
42,526 | def OnNewGpgKey ( self , event ) : if gnupg is None : return if genkey is None : self . interfaces . display_warning ( _ ( "Python gnupg not found. No key selected." ) , _ ( "Key selection failed." ) ) else : genkey ( ) | New GPG key event handler . |
42,527 | def _toggle_pane ( self , pane ) : if pane . IsShown ( ) : pane . Hide ( ) else : pane . Show ( ) self . main_window . _mgr . Update ( ) | Toggles visibility of given aui pane |
42,528 | def OnMainToolbarToggle ( self , event ) : 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 ( ) | Main window toolbar toggle event handler |
42,529 | def OnMacroToolbarToggle ( self , event ) : 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 ( ) | Macro toolbar toggle event handler |
42,530 | def OnWidgetToolbarToggle ( self , event ) : 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 ( ) | Widget toolbar toggle event handler |
42,531 | def OnAttributesToolbarToggle ( self , event ) : self . main_window . attributes_toolbar . SetGripperVisible ( True ) attributes_toolbar_info = self . main_window . _mgr . GetPane ( "attributes_toolbar" ) self . _toggle_pane ( attributes_toolbar_info ) event . Skip ( ) | Format toolbar toggle event handler |
42,532 | def OnFindToolbarToggle ( self , event ) : 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 ( ) | Search toolbar toggle event handler |
42,533 | def OnEntryLineToggle ( self , event ) : entry_line_panel_info = self . main_window . _mgr . GetPane ( "entry_line_panel" ) self . _toggle_pane ( entry_line_panel_info ) event . Skip ( ) | Entry line toggle event handler |
42,534 | def OnTableListToggle ( self , event ) : table_list_panel_info = self . main_window . _mgr . GetPane ( "table_list_panel" ) self . _toggle_pane ( table_list_panel_info ) event . Skip ( ) | Table list toggle event handler |
42,535 | def OnNew ( self , event ) : if undo . stack ( ) . haschanged ( ) : save_choice = self . interfaces . get_save_request_from_user ( ) if save_choice is None : return elif save_choice : post_command_event ( self . main_window , self . main_window . SaveMsg ) shape = self . interfaces . get_dimensions_from_user ( no_dim =... | New grid event handler |
42,536 | def OnOpen ( self , event ) : if undo . stack ( ) . haschanged ( ) : save_choice = self . interfaces . get_save_request_from_user ( ) if save_choice is None : return elif save_choice : post_command_event ( self . main_window , self . main_window . SaveMsg ) f2w = get_filetypes2wildcards ( [ "pys" , "pysu" , "xls" , "xl... | File open event handler |
42,537 | def OnSave ( self , event ) : try : filetype = event . attr [ "filetype" ] except ( KeyError , AttributeError ) : filetype = None filepath = self . main_window . filepath if filepath is None : filetype = config [ "default_save_filetype" ] if filetype is None : f2w = get_filetypes2wildcards ( [ "pys" , "pysu" , "xls" , ... | File save event handler |
42,538 | def OnSaveAs ( self , event ) : f2w = get_filetypes2wildcards ( [ "pys" , "pysu" , "xls" , "all" ] ) filetypes = f2w . keys ( ) wildcards = f2w . values ( ) wildcard = "|" . join ( wildcards ) message = _ ( "Choose filename for saving." ) style = wx . SAVE default_filetype = config [ "default_save_filetype" ] try : def... | File save as event handler |
42,539 | def OnImport ( self , event ) : wildcards = get_filetypes2wildcards ( [ "csv" , "txt" ] ) . values ( ) wildcard = "|" . join ( wildcards ) message = _ ( "Choose file to import." ) style = wx . OPEN filepath , filterindex = self . interfaces . get_filepath_findex_from_user ( wildcard , message , style ) if filepath is N... | File import event handler |
42,540 | def OnExport ( self , event ) : code_array = self . main_window . grid . code_array tab = self . main_window . grid . current_table selection = self . main_window . grid . selection selection_bbox = selection . get_bbox ( ) f2w = get_filetypes2wildcards ( [ "csv" , "pdf" , "svg" ] ) filters = f2w . keys ( ) wildcards =... | File export event handler |
42,541 | def OnExportPDF ( self , event ) : wildcards = get_filetypes2wildcards ( [ "pdf" ] ) . values ( ) if not wildcards : return wildcard = "|" . join ( wildcards ) message = _ ( "Choose file path for PDF export." ) style = wx . SAVE filepath , filterindex = self . interfaces . get_filepath_findex_from_user ( wildcard , mes... | Export PDF event handler |
42,542 | def OnApprove ( self , event ) : 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" u"It may harm your system as any program can.\n" u"Please check all cells thoroughly before\np... | File approve event handler |
42,543 | def OnClearGlobals ( self , event ) : 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 ) if choice : self . main_window . grid . actions . clear_global... | Clear globals event handler |
42,544 | def OnPageSetup ( self , event ) : 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 | Page setup handler for printing framework |
42,545 | def _get_print_area ( self ) : selection = self . main_window . grid . selection print_area = selection . get_bbox ( ) if print_area is None : print_area = self . main_window . grid . actions . get_visible_area ( ) return print_area | Returns selection bounding box or visible area |
42,546 | def OnPrintPreview ( self , event ) : print_area = self . _get_print_area ( ) print_data = self . main_window . print_data self . main_window . actions . print_preview ( print_area , print_data ) | Print preview handler |
42,547 | def OnPrint ( self , event ) : print_area = self . _get_print_area ( ) print_data = self . main_window . print_data self . main_window . actions . printout ( print_area , print_data ) | Print event handler |
42,548 | def OnCut ( self , event ) : 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" ) ) : data = self . main_window . actions . cut ( selection ) self . main_window ... | Clipboard cut event handler |
42,549 | def OnCopy ( self , event ) : focus = self . main_window . FindFocus ( ) if isinstance ( focus , wx . TextCtrl ) : focus . Copy ( ) else : selection = self . main_window . grid . selection data = self . main_window . actions . copy ( selection ) self . main_window . clipboard . set_clipboard ( data ) event . Skip ( ) | Clipboard copy event handler |
42,550 | def OnCopyResult ( self , event ) : selection = self . main_window . grid . selection data = self . main_window . actions . copy_result ( selection ) if type ( data ) is wx . _gdi . Bitmap : self . main_window . clipboard . set_clipboard ( data , datatype = "bitmap" ) else : self . main_window . clipboard . set_clipboa... | Clipboard copy results event handler |
42,551 | def OnPaste ( self , event ) : data = self . main_window . clipboard . get_clipboard ( ) focus = self . main_window . FindFocus ( ) if isinstance ( focus , wx . TextCtrl ) : focus . WriteText ( data ) else : key = self . main_window . grid . actions . cursor with undo . group ( _ ( "Paste" ) ) : self . main_window . ac... | Clipboard paste event handler |
42,552 | def OnPasteAs ( self , event ) : data = self . main_window . clipboard . get_clipboard ( ) key = self . main_window . grid . actions . cursor with undo . group ( _ ( "Paste As..." ) ) : self . main_window . actions . paste_as ( key , data ) self . main_window . grid . ForceRefresh ( ) event . Skip ( ) | Clipboard paste as event handler |
42,553 | def OnSelectAll ( self , event ) : entry_line = self . main_window . entry_line_panel . entry_line_panel . entry_line if wx . Window . FindFocus ( ) != entry_line : self . main_window . grid . SelectAll ( ) else : entry_line . SelectAll ( ) | Select all cells event handler |
42,554 | def OnFontDialog ( self , event ) : cursor = self . main_window . grid . actions . cursor attr = self . main_window . grid . code_array . cell_attributes [ cursor ] size , style , weight , font = [ attr [ name ] for name in [ "pointsize" , "fontstyle" , "fontweight" , "textfont" ] ] current_font = wx . Font ( int ( siz... | Event handler for launching font dialog |
42,555 | def OnTextColorDialog ( self , event ) : dlg = wx . ColourDialog ( self . main_window ) dlg . GetColourData ( ) . SetChooseFull ( True ) if dlg . ShowModal ( ) == wx . ID_OK : data = dlg . GetColourData ( ) color = data . GetColour ( ) . GetRGB ( ) post_command_event ( self . main_window , self . main_window . TextColo... | Event handler for launching text color dialog |
42,556 | def OnMacroListLoad ( self , event ) : wildcards = get_filetypes2wildcards ( [ "py" , "all" ] ) . values ( ) wildcard = "|" . join ( wildcards ) message = _ ( "Choose macro file." ) style = wx . OPEN filepath , filterindex = self . interfaces . get_filepath_findex_from_user ( wildcard , message , style ) if filepath is... | Macro list load event handler |
42,557 | def OnMacroListSave ( self , event ) : wildcards = get_filetypes2wildcards ( [ "py" , "all" ] ) . values ( ) wildcard = "|" . join ( wildcards ) message = _ ( "Choose macro file." ) style = wx . SAVE filepath , filterindex = self . interfaces . get_filepath_findex_from_user ( wildcard , message , style ) if filepath is... | Macro list save event handler |
42,558 | def OnDependencies ( self , event ) : dlg = DependencyDialog ( self . main_window ) dlg . ShowModal ( ) dlg . Destroy ( ) | Display dependency dialog |
42,559 | def _add_submenu ( self , parent , data ) : for item in data : obj = item [ 0 ] if obj == wx . Menu : try : __ , menuname , submenu , menu_id = item except ValueError : __ , menuname , submenu = item menu_id = - 1 menu = obj ( ) self . _add_submenu ( menu , submenu ) if parent == self : self . menubar . Append ( menu ,... | Adds items in data as a submenu to parent |
42,560 | def OnMenu ( self , event ) : msgtype = self . ids_msgs [ event . GetId ( ) ] post_command_event ( self . parent , msgtype ) | Menu event handler |
42,561 | def OnUpdate ( self , event ) : if wx . ID_UNDO in self . id2menuitem : undo_item = self . id2menuitem [ wx . ID_UNDO ] undo_item . Enable ( undo . stack ( ) . canundo ( ) ) if wx . ID_REDO in self . id2menuitem : redo_item = self . id2menuitem [ wx . ID_REDO ] redo_item . Enable ( undo . stack ( ) . canredo ( ) ) even... | Menu state update |
42,562 | def OnFont ( self , event ) : font_data = wx . FontData ( ) font_data . EnableEffects ( False ) if self . chosen_font : font_data . SetInitialFont ( self . chosen_font ) dlg = wx . FontDialog ( self , font_data ) if dlg . ShowModal ( ) == wx . ID_OK : font_data = dlg . GetFontData ( ) font = self . chosen_font = font_d... | Check event handler |
42,563 | def OnDirectionChoice ( self , event ) : label = self . direction_choicectrl . GetItems ( ) [ event . GetSelection ( ) ] param = self . choice_label2param [ label ] self . attrs [ "direction" ] = param post_command_event ( self , self . DrawChartMsg ) | Direction choice event handler |
42,564 | def OnSecondaryCheckbox ( self , event ) : self . attrs [ "top" ] = event . IsChecked ( ) self . attrs [ "right" ] = event . IsChecked ( ) post_command_event ( self , self . DrawChartMsg ) | Top Checkbox event handler |
42,565 | def OnPadIntCtrl ( self , event ) : self . attrs [ "pad" ] = event . GetValue ( ) post_command_event ( self , self . DrawChartMsg ) | Pad IntCtrl event handler |
42,566 | def OnLabelSizeIntCtrl ( self , event ) : self . attrs [ "labelsize" ] = event . GetValue ( ) post_command_event ( self , self . DrawChartMsg ) | Label size IntCtrl event handler |
42,567 | def get_code ( self ) : selection = self . GetSelection ( ) if selection == wx . NOT_FOUND : selection = 0 return self . styles [ selection ] [ 1 ] | Returns code representation of value of widget |
42,568 | def update ( self , series_data ) : for key in series_data : try : data_list = list ( self . data [ key ] ) data_list [ 2 ] = str ( series_data [ key ] ) self . data [ key ] = tuple ( data_list ) except KeyError : pass | Updates self . data from series data |
42,569 | def get_plot_panel ( self ) : plot_type_no = self . chart_type_book . GetSelection ( ) return self . chart_type_book . GetPage ( plot_type_no ) | Returns current plot_panel |
42,570 | def set_plot_type ( self , plot_type ) : ptypes = [ pt [ "type" ] for pt in self . plot_types ] self . plot_panel = ptypes . index ( plot_type ) | Sets plot type |
42,571 | def update ( self , series_list ) : if not series_list : self . series_notebook . AddPage ( wx . Panel ( self , - 1 ) , _ ( "+" ) ) return self . updating = True self . series_notebook . DeleteAllPages ( ) for page , attrdict in enumerate ( series_list ) : series_panel = SeriesPanel ( self . grid , attrdict ) name = "S... | Updates widget content from series_list |
42,572 | def OnSeriesChanged ( self , event ) : selection = event . GetSelection ( ) if not self . updating and selection == self . series_notebook . GetPageCount ( ) - 1 : new_panel = SeriesPanel ( self , { "type" : "plot" } ) self . series_notebook . InsertPage ( selection , new_panel , _ ( "Series" ) ) event . Skip ( ) | FlatNotebook change event handler |
42,573 | def update ( self , figure ) : if hasattr ( self , "figure_canvas" ) : self . figure_canvas . Destroy ( ) self . figure_canvas = self . _get_figure_canvas ( figure ) self . figure_canvas . SetSize ( self . GetSize ( ) ) figure . subplots_adjust ( ) self . main_sizer . Add ( self . figure_canvas , 1 , wx . EXPAND | wx .... | Updates figure on data change |
42,574 | def get_figure ( self , code ) : if code == self . figure_code_old and self . figure_cache : return self . figure_cache self . figure_code_old = code key = self . grid . actions . cursor cell_result = self . grid . code_array . _eval_cell ( key , code ) if isinstance ( cell_result , matplotlib . pyplot . Figure ) : sel... | Returns figure from executing code in grid |
42,575 | def set_code ( self , code ) : attributes = [ ] strip = lambda s : s . strip ( 'u' ) . strip ( "'" ) . strip ( '"' ) for attr_dict in parse_dict_strings ( unicode ( code ) . strip ( ) [ 19 : - 1 ] ) : attrs = list ( strip ( s ) for s in parse_dict_strings ( attr_dict [ 1 : - 1 ] ) ) attributes . append ( dict ( zip ( a... | Update widgets from code |
42,576 | def get_code ( self ) : def dict2str ( attr_dict ) : result = u"{" for key in attr_dict : code = attr_dict [ key ] if key in self . string_keys : code = repr ( code ) elif code and key in self . tuple_keys and not ( code [ 0 ] in [ "[" , "(" ] and code [ - 1 ] in [ "]" , ")" ] ) : code = "(" + code + ")" elif key in [ ... | Returns code that generates figure from widgets |
42,577 | def OnUpdateFigurePanel ( self , event ) : if self . updating : return self . updating = True self . figure_panel . update ( self . get_figure ( self . code ) ) self . updating = False | Redraw event handler for the figure panel |
42,578 | def parameters ( self ) : return self . block_tl , self . block_br , self . rows , self . cols , self . cells | Returns tuple of selection parameters of self |
42,579 | def get_access_string ( self , shape , table ) : rows , columns , tables = shape assert all ( dim > 0 for dim in shape ) assert 0 <= table < tables string_list = [ ] templ = "[(r, c, {}) for r in xrange({}, {}) for c in xrange({}, {})]" for ( top , left ) , ( bottom , right ) in izip ( self . block_tl , self . block_br... | Returns a string with which the selection can be accessed |
42,580 | def shifted ( self , rows , cols ) : shifted_block_tl = [ ( row + rows , col + cols ) for row , col in self . block_tl ] shifted_block_br = [ ( row + rows , col + cols ) for row , col in self . block_br ] shifted_rows = [ row + rows for row in self . rows ] shifted_cols = [ col + cols for col in self . cols ] shifted_c... | Returns a new selection that is shifted by rows and cols . |
42,581 | def grid_select ( self , grid , clear_selection = True ) : if clear_selection : grid . ClearSelection ( ) for ( tl , br ) in zip ( self . block_tl , self . block_br ) : grid . SelectBlock ( tl [ 0 ] , tl [ 1 ] , br [ 0 ] , br [ 1 ] , addToSelected = True ) for row in self . rows : grid . SelectRow ( row , addToSelected... | Selects cells of grid with selection content |
42,582 | def object2code ( key , code ) : if key in [ "xscale" , "yscale" ] : if code == "log" : code = True else : code = False else : code = unicode ( code ) return code | Returns code for widget from dict object |
42,583 | def fig2bmp ( figure , width , height , dpi , zoom ) : dpi *= float ( zoom ) figure . set_figwidth ( width / dpi ) figure . set_figheight ( height / dpi ) figure . subplots_adjust ( ) with warnings . catch_warnings ( ) : warnings . simplefilter ( "ignore" ) try : figure . tight_layout ( pad = 1.0 / zoom ) except ValueE... | Returns wx . Bitmap from matplotlib chart |
42,584 | def fig2x ( figure , format ) : io = StringIO ( ) figure . savefig ( io , format = format ) io . seek ( 0 ) data = io . getvalue ( ) io . close ( ) return data | Returns svg from matplotlib chart |
42,585 | def _xdate_setter ( self , xdate_format = '%Y-%m-%d' ) : if xdate_format : try : self . autofmt_xdate ( ) datetime . date ( 2000 , 1 , 1 ) . strftime ( xdate_format ) except ValueError : self . autofmt_xdate ( ) return self . __axes . xaxis_date ( ) formatter = dates . DateFormatter ( xdate_format ) self . __axes . xax... | Makes x axis a date axis with auto format |
42,586 | def _setup_axes ( self , axes_data ) : self . __axes . clear ( ) key_setter = [ ( "title" , self . __axes . set_title ) , ( "xlabel" , self . __axes . set_xlabel ) , ( "ylabel" , self . __axes . set_ylabel ) , ( "xscale" , self . __axes . set_xscale ) , ( "yscale" , self . __axes . set_yscale ) , ( "xticks" , self . __... | Sets up axes for drawing chart |
42,587 | def draw_chart ( self ) : if not hasattr ( self , "attributes" ) : return self . _setup_axes ( self . attributes [ 0 ] ) for attribute in self . attributes [ 1 : ] : series = copy ( attribute ) chart_type_string = series . pop ( "type" ) x_str , y_str = self . plot_type_xy_mapping [ chart_type_string ] if x_str in seri... | Plots chart from self . attributes |
42,588 | def GetSource ( self , row , col , table = None ) : if table is None : table = self . grid . current_table value = self . code_array ( ( row , col , table ) ) if value is None : return u"" else : return value | Return the source string of a cell |
42,589 | def GetValue ( self , row , col , table = None ) : if table is None : table = self . grid . current_table try : cell_code = self . code_array ( ( row , col , table ) ) except IndexError : cell_code = None maxlength = int ( config [ "max_textctrl_length" ] ) if cell_code is not None and len ( cell_code ) > maxlength : c... | Return the result value of a cell line split if too much data |
42,590 | def SetValue ( self , row , col , value , refresh = True ) : value = "" . join ( value . split ( "\n" ) ) key = row , col , self . grid . current_table old_code = self . grid . code_array ( key ) if old_code is None : old_code = "" if value != old_code : self . grid . actions . set_code ( key , value ) | Set the value of a cell merge line breaks |
42,591 | def UpdateValues ( self ) : msg = wx . grid . GridTableMessage ( self , wx . grid . GRIDTABLE_REQUEST_VIEW_GET_VALUES ) self . grid . ProcessTableMessage ( msg ) | Update all displayed values |
42,592 | def post_command_event ( target , msg_cls , ** kwargs ) : msg = msg_cls ( id = - 1 , ** kwargs ) wx . PostEvent ( target , msg ) | Posts command event to main window |
42,593 | def _convert_clipboard ( self , datastring = None , sep = '\t' ) : if datastring is None : datastring = self . get_clipboard ( ) data_it = ( ( ele for ele in line . split ( sep ) ) for line in datastring . splitlines ( ) ) return data_it | Converts data string to iterable . |
42,594 | def get_clipboard ( self ) : bmpdata = wx . BitmapDataObject ( ) textdata = wx . TextDataObject ( ) if self . clipboard . Open ( ) : is_bmp_present = self . clipboard . GetData ( bmpdata ) self . clipboard . GetData ( textdata ) self . clipboard . Close ( ) else : wx . MessageBox ( _ ( "Can't open the clipboard" ) , _ ... | Returns the clipboard content |
42,595 | def set_clipboard ( self , data , datatype = "text" ) : error_log = [ ] if datatype == "text" : clip_data = wx . TextDataObject ( text = data ) elif datatype == "bitmap" : clip_data = wx . BitmapDataObject ( bitmap = data ) else : msg = _ ( "Datatype {type} unknown" ) . format ( type = datatype ) raise ValueError ( msg... | Writes data to the clipboard |
42,596 | def draw_rect ( grid , attr , dc , rect ) : dc . SetBrush ( wx . Brush ( wx . Colour ( 15 , 255 , 127 ) , wx . SOLID ) ) dc . SetPen ( wx . Pen ( wx . BLUE , 1 , wx . SOLID ) ) dc . DrawRectangleRect ( rect ) | Draws a rect |
42,597 | def _is_aborted ( self , cycle , statustext , total_elements = None , freq = None ) : if total_elements is None : statustext += _ ( "{nele} elements processed. Press <Esc> to abort." ) else : statustext += _ ( "{nele} of {totalele} elements processed. " "Press <Esc> to abort." ) if freq is None : show_msg = False freq ... | Displays progress and returns True if abort |
42,598 | def validate_signature ( self , filename ) : if not GPG_PRESENT : return False sigfilename = filename + '.sig' try : with open ( sigfilename ) : pass except IOError : return False return verify ( sigfilename , filename ) | Returns True if a valid signature is present for filename |
42,599 | def leave_safe_mode ( self ) : self . code_array . safe_mode = False self . code_array . result_cache . clear ( ) self . main_window . actions . execute_macros ( ) post_command_event ( self . main_window , self . SafeModeExitMsg ) | Leaves safe mode |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.