idx int64 0 252k | question stringlengths 48 5.28k | target stringlengths 5 1.23k |
|---|---|---|
231,500 | def zoom ( self , zoom = None ) : status = True if zoom is None : zoom = self . grid . grid_renderer . zoom status = False self . grid . grid_renderer . zoom = zoom self . _zoom_labels ( zoom ) self . _zoom_rows ( zoom ) self . _zoom_cols ( zoom ) if self . main_window . IsFullScreen ( ) : self . main_window . handlers... | Zooms to zoom factor |
231,501 | def zoom_in ( self ) : zoom = self . grid . grid_renderer . zoom target_zoom = zoom * ( 1 + config [ "zoom_factor" ] ) if target_zoom < config [ "maximum_zoom" ] : self . zoom ( target_zoom ) | Zooms in by zoom factor |
231,502 | def zoom_out ( self ) : zoom = self . grid . grid_renderer . zoom target_zoom = zoom * ( 1 - config [ "zoom_factor" ] ) if target_zoom > config [ "minimum_zoom" ] : self . zoom ( target_zoom ) | Zooms out by zoom factor |
231,503 | def _get_rows_height ( self ) : tab = self . grid . current_table no_rows = self . grid . code_array . shape [ 0 ] default_row_height = self . grid . code_array . cell_attributes . default_cell_attributes [ "row-height" ] non_standard_row_heights = [ ] __row_heights = self . grid . code_array . row_heights for __row , ... | Returns the total height of all grid rows |
231,504 | def _get_cols_width ( self ) : tab = self . grid . current_table no_cols = self . grid . code_array . shape [ 1 ] default_col_width = self . grid . code_array . cell_attributes . default_cell_attributes [ "column-width" ] non_standard_col_widths = [ ] __col_widths = self . grid . code_array . col_widths for __col , __t... | Returns the total width of all grid cols |
231,505 | def zoom_fit ( self ) : zoom = self . grid . grid_renderer . zoom grid_width , grid_height = self . grid . GetSize ( ) rows_height = self . _get_rows_height ( ) + ( float ( self . grid . GetColLabelSize ( ) ) / zoom ) cols_width = self . _get_cols_width ( ) + ( float ( self . grid . GetRowLabelSize ( ) ) / zoom ) zoom_... | Zooms the rid to fit the window . |
231,506 | def on_mouse_over ( self , key ) : def split_lines ( string , line_length = 80 ) : result = u"" line = 0 while len ( string ) > line_length * line : line_start = line * line_length result += string [ line_start : line_start + line_length ] result += '\n' line += 1 return result [ : - 1 ] row , col , tab = key cell_attr... | Displays cell code of cell key in status bar |
231,507 | def get_visible_area ( self ) : grid = self . grid top = grid . YToRow ( grid . GetViewStart ( ) [ 1 ] * grid . ScrollLineX ) left = grid . XToCol ( grid . GetViewStart ( ) [ 0 ] * grid . ScrollLineY ) bottom , right = top , left while grid . IsVisible ( bottom , left , wholeCellVisible = False ) : bottom += 1 while gr... | Returns visible area |
231,508 | def switch_to_table ( self , event ) : newtable = event . newtable no_tabs = self . grid . code_array . shape [ 2 ] - 1 if 0 <= newtable <= no_tabs : self . grid . current_table = newtable self . grid . SetToolTip ( None ) self . grid . grid_renderer . cell_cache . clear ( ) video_cells = self . grid . grid_renderer . ... | Switches grid to table |
231,509 | def set_cursor ( self , value ) : shape = self . grid . code_array . shape if len ( value ) == 3 : self . grid . _last_selected_cell = row , col , tab = value if row < 0 or col < 0 or tab < 0 or row >= shape [ 0 ] or col >= shape [ 1 ] or tab >= shape [ 2 ] : raise ValueError ( "Cell {value} outside of {shape}" . forma... | Changes the grid cursor cell . |
231,510 | def get_selection ( self ) : block_top_left = self . grid . GetSelectionBlockTopLeft ( ) block_bottom_right = self . grid . GetSelectionBlockBottomRight ( ) rows = self . grid . GetSelectedRows ( ) cols = self . grid . GetSelectedCols ( ) cells = self . grid . GetSelectedCells ( ) return Selection ( block_top_left , bl... | Returns selected cells in grid as Selection object |
231,511 | def select_cell ( self , row , col , add_to_selected = False ) : self . grid . SelectBlock ( row , col , row , col , addToSelected = add_to_selected ) | Selects a single cell |
231,512 | def select_slice ( self , row_slc , col_slc , add_to_selected = False ) : if not add_to_selected : self . grid . ClearSelection ( ) if row_slc == row_slc == slice ( None , None , None ) : self . grid . SelectAll ( ) elif row_slc . stop is None and col_slc . stop is None : self . grid . SelectBlock ( row_slc . start , c... | Selects a slice of cells |
231,513 | def delete_selection ( self , selection = None ) : post_command_event ( self . main_window , self . ContentChangedMsg ) if selection is None : selection = self . get_selection ( ) current_table = self . grid . current_table for row , col , tab in self . grid . code_array . dict_grid . keys ( ) : if tab == current_table... | Deletes selection marks content as changed |
231,514 | def delete ( self ) : if self . grid . IsSelection ( ) : self . grid . actions . delete_selection ( ) else : cursor = self . grid . actions . cursor self . grid . actions . delete_cell ( cursor ) self . grid . ForceRefresh ( ) | Deletes a selection if any else deletes the cursor cell |
231,515 | def quote_selection ( self ) : selection = self . get_selection ( ) current_table = self . grid . current_table for row , col , tab in self . grid . code_array . dict_grid . keys ( ) : if tab == current_table and ( row , col ) in selection : self . grid . actions . quote_code ( ( row , col , tab ) ) self . grid . code_... | Quotes selected cells marks content as changed |
231,516 | def copy_selection_access_string ( self ) : selection = self . get_selection ( ) if not selection : cursor = self . grid . actions . cursor selection = Selection ( [ ] , [ ] , [ ] , [ ] , [ tuple ( cursor [ : 2 ] ) ] ) shape = self . grid . code_array . shape tab = self . grid . current_table access_string = selection ... | Copys access_string to selection to the clipboard |
231,517 | def copy_format ( self ) : row , col , tab = self . grid . actions . cursor code_array = self . grid . code_array new_cell_attributes = [ ] selection = self . get_selection ( ) if not selection : selection = Selection ( [ ] , [ ] , [ ] , [ ] , [ ( row , col ) ] ) ( ( top , left ) , ( bottom , right ) ) = selection . ge... | Copies the format of the selected cells to the Clipboard |
231,518 | def paste_format ( self ) : row , col , tab = self . grid . actions . cursor selection = self . get_selection ( ) if selection : row , col = [ tl if tl is not None else 0 for tl in selection . get_bbox ( ) [ 0 ] ] cell_attributes = self . grid . code_array . cell_attributes string_data = self . grid . main_window . cli... | Pastes cell formats |
231,519 | def find_all ( self , find_string , flags ) : code_array = self . grid . code_array string_match = code_array . string_match find_keys = [ ] for key in code_array : if string_match ( code_array ( key ) , find_string , flags ) is not None : find_keys . append ( key ) return find_keys | Return list of all positions of event_find_string in MainGrid . |
231,520 | def find ( self , gridpos , find_string , flags , search_result = True ) : findfunc = self . grid . code_array . findnextmatch if "DOWN" in flags : if gridpos [ 0 ] < self . grid . code_array . shape [ 0 ] : gridpos [ 0 ] += 1 elif gridpos [ 1 ] < self . grid . code_array . shape [ 1 ] : gridpos [ 1 ] += 1 elif gridpos... | Return next position of event_find_string in MainGrid |
231,521 | def _replace_bbox_none ( self , bbox ) : ( bb_top , bb_left ) , ( bb_bottom , bb_right ) = bbox if bb_top is None : bb_top = 0 if bb_left is None : bb_left = 0 if bb_bottom is None : bb_bottom = self . code_array . shape [ 0 ] - 1 if bb_right is None : bb_right = self . code_array . shape [ 1 ] - 1 return ( bb_top , bb... | Returns bbox in which None is replaced by grid boundaries |
231,522 | def get_filetypes2wildcards ( filetypes ) : def is_available ( filetype ) : return filetype not in FILETYPE_AVAILABILITY or FILETYPE_AVAILABILITY [ filetype ] available_filetypes = filter ( is_available , filetypes ) return OrderedDict ( ( ft , FILETYPE2WILDCARD [ ft ] ) for ft in available_filetypes ) | Returns OrderedDict of filetypes to wildcards |
231,523 | def get_key_params_from_user ( gpg_key_param_list ) : params = [ [ _ ( 'Real name' ) , 'name_real' ] ] vals = [ "" ] * len ( params ) while "" in vals : dlg = GPGParamsDialog ( None , - 1 , "Enter GPG key parameters" , params ) dlg . CenterOnScreen ( ) for val , textctrl in zip ( vals , dlg . textctrls ) : textctrl . S... | Displays parameter entry dialog and returns parameter dict |
231,524 | def get_dimensions_from_user ( self , no_dim ) : if no_dim != 3 : raise NotImplementedError ( _ ( "Currently, only 3D grids are supported." ) ) dim_dialog = DimensionsEntryDialog ( self . main_window ) if dim_dialog . ShowModal ( ) != wx . ID_OK : dim_dialog . Destroy ( ) return dim = tuple ( dim_dialog . dimensions ) ... | Queries grid dimensions in a model dialog and returns n - tuple |
231,525 | def get_preferences_from_user ( self ) : dlg = PreferencesDialog ( self . main_window ) change_choice = dlg . ShowModal ( ) preferences = { } if change_choice == wx . ID_OK : for ( parameter , _ ) , ctrl in zip ( dlg . parameters , dlg . textctrls ) : if isinstance ( ctrl , wx . Choice ) : value = ctrl . GetStringSelec... | Launches preferences dialog and returns dict with preferences |
231,526 | def get_save_request_from_user ( self ) : msg = _ ( "There are unsaved changes.\nDo you want to save?" ) dlg = GMD . GenericMessageDialog ( self . main_window , msg , _ ( "Unsaved changes" ) , wx . YES_NO | wx . ICON_QUESTION | wx . CANCEL ) save_choice = dlg . ShowModal ( ) dlg . Destroy ( ) if save_choice == wx . ID_... | Queries user if grid should be saved |
231,527 | def get_filepath_findex_from_user ( self , wildcard , message , style , filterindex = 0 ) : dlg = wx . FileDialog ( self . main_window , wildcard = wildcard , message = message , style = style , defaultDir = os . getcwd ( ) , defaultFile = "" ) dlg . SetFilterIndex ( filterindex ) filepath = None filter_index = None if... | Opens a file dialog and returns filepath and filterindex |
231,528 | def display_warning ( self , message , short_message , style = wx . OK | wx . ICON_WARNING ) : dlg = GMD . GenericMessageDialog ( self . main_window , message , short_message , style ) dlg . ShowModal ( ) dlg . Destroy ( ) | Displays a warning message |
231,529 | def get_warning_choice ( self , message , short_message , style = wx . YES_NO | wx . NO_DEFAULT | wx . ICON_WARNING ) : dlg = GMD . GenericMessageDialog ( self . main_window , message , short_message , style ) choice = dlg . ShowModal ( ) dlg . Destroy ( ) return choice == wx . ID_YES | Launches proceeding dialog and returns True if ok to proceed |
231,530 | def get_print_setup ( self , print_data ) : psd = wx . PageSetupDialogData ( print_data ) psd . CalculatePaperSizeFromId ( ) dlg = wx . PageSetupDialog ( self . main_window , psd ) dlg . ShowModal ( ) data = dlg . GetPageSetupData ( ) new_print_data = wx . PrintData ( data . GetPrintData ( ) ) new_print_data . PaperId ... | Opens print setup dialog and returns print_data |
231,531 | def get_csv_import_info ( self , path ) : csvfilename = os . path . split ( path ) [ 1 ] try : filterdlg = CsvImportDialog ( self . main_window , csvfilepath = path ) except csv . Error , err : msg = _ ( "'{filepath}' does not seem to be a valid CSV file.\n \n" "Opening it yielded the error:\n{error}" ) msg = msg . for... | Launches the csv dialog and returns csv_info |
231,532 | def get_csv_export_info ( self , preview_data ) : preview_rows = 100 preview_cols = 100 export_preview = list ( list ( islice ( col , None , preview_cols ) ) for col in islice ( preview_data , None , preview_rows ) ) filterdlg = CsvExportDialog ( self . main_window , data = export_preview ) if filterdlg . ShowModal ( )... | Shows csv export preview dialog and returns csv_info |
231,533 | def get_cairo_export_info ( self , filetype ) : export_dlg = CairoExportDialog ( self . main_window , filetype = filetype ) if export_dlg . ShowModal ( ) == wx . ID_OK : info = export_dlg . get_info ( ) export_dlg . Destroy ( ) return info else : export_dlg . Destroy ( ) | Shows Cairo export dialog and returns info |
231,534 | def get_int_from_user ( self , title = "Enter integer value" , cond_func = lambda i : i is not None ) : is_integer = False while not is_integer : dlg = wx . TextEntryDialog ( None , title , title ) if dlg . ShowModal ( ) == wx . ID_OK : result = dlg . GetValue ( ) else : return None dlg . Destroy ( ) try : integer = in... | Opens an integer entry dialog and returns integer |
231,535 | def get_pasteas_parameters_from_user ( self , obj ) : dlg = PasteAsDialog ( None , - 1 , obj ) dlg_choice = dlg . ShowModal ( ) if dlg_choice != wx . ID_OK : dlg . Destroy ( ) return None parameters = { } parameters . update ( dlg . parameters ) dlg . Destroy ( ) return parameters | Opens a PasteAsDialog and returns parameters dict |
231,536 | def _execute_cell_code ( self , row , col , grid ) : key = row , col , grid . current_table grid . code_array [ key ] grid . ForceRefresh ( ) | Executes cell code |
231,537 | def StartingKey ( self , evt ) : key = evt . GetKeyCode ( ) ch = None if key in [ wx . WXK_NUMPAD0 , wx . WXK_NUMPAD1 , wx . WXK_NUMPAD2 , wx . WXK_NUMPAD3 , wx . WXK_NUMPAD4 , wx . WXK_NUMPAD5 , wx . WXK_NUMPAD6 , wx . WXK_NUMPAD7 , wx . WXK_NUMPAD8 , wx . WXK_NUMPAD9 ] : ch = ch = chr ( ord ( '0' ) + key - wx . WXK_N... | If the editor is enabled by pressing keys on the grid this will be called to let the editor do something about that first key if desired . |
231,538 | def GetPageInfo ( self ) : return self . first_tab , self . last_tab , self . first_tab , self . last_tab | Returns page information |
231,539 | def quote ( code ) : try : code = code . rstrip ( ) except AttributeError : return code if code and code [ 0 ] + code [ - 1 ] not in ( '""' , "''" , "u'" , '"' ) and '"' not in code : return 'u"' + code + '"' else : return code | Returns quoted code if not already quoted and if possible |
231,540 | def _states ( self ) : self . current_table = 0 self . _last_selected_cell = 0 , 0 , 0 self . _view_frozen = False self . timer_running = False | Sets grid states |
231,541 | def _layout ( self ) : self . EnableGridLines ( False ) default_cell_attributes = self . code_array . cell_attributes . default_cell_attributes self . std_row_size = default_cell_attributes [ "row-height" ] self . std_col_size = default_cell_attributes [ "column-width" ] self . SetDefaultRowSize ( self . std_row_size )... | Initial layout of grid |
231,542 | def is_merged_cell_drawn ( self , key ) : row , col , tab = key cell_attributes = self . code_array . cell_attributes top , left , __ = cell_attributes . get_merging_cell ( key ) top_left_drawn = row == top and col == left and self . IsVisible ( row , col , wholeCellVisible = False ) left_drawn = col == left and self .... | True if key in merged area shall be drawn |
231,543 | def update_entry_line ( self , key = None ) : if key is None : key = self . actions . cursor cell_code = self . GetTable ( ) . GetValue ( * key ) post_command_event ( self , self . EntryLineMsg , text = cell_code ) | Updates the entry line |
231,544 | def update_attribute_toolbar ( self , key = None ) : if key is None : key = self . actions . cursor post_command_event ( self , self . ToolbarUpdateMsg , key = key , attr = self . code_array . cell_attributes [ key ] ) | Updates the attribute toolbar |
231,545 | def _update_video_volume_cell_attributes ( self , key ) : try : video_cell_panel = self . grid_renderer . video_cells [ key ] except KeyError : return old_video_volume = self . code_array . cell_attributes [ key ] [ "video_volume" ] new_video_volume = video_cell_panel . volume if old_video_volume == new_video_volume : ... | Updates the panel cell attrutes of a panel cell |
231,546 | def OnCellText ( self , event ) : row , col , _ = self . grid . actions . cursor self . grid . GetTable ( ) . SetValue ( row , col , event . code ) event . Skip ( ) | Text entry event handler |
231,547 | def OnInsertBitmap ( self , event ) : key = self . grid . actions . cursor wildcard = _ ( "Bitmap file" ) + " (*)|*" if rsvg is not None : wildcard += "|" + _ ( "SVG file" ) + " (*.svg)|*.svg" message = _ ( "Select image for current cell" ) style = wx . OPEN | wx . CHANGE_DIR filepath , index = self . grid . interfaces... | Insert bitmap event handler |
231,548 | def OnLinkBitmap ( self , event ) : wildcard = "*" message = _ ( "Select bitmap for current cell" ) style = wx . OPEN | wx . CHANGE_DIR filepath , __ = self . grid . interfaces . get_filepath_findex_from_user ( wildcard , message , style ) try : bmp = wx . Bitmap ( filepath ) except TypeError : return if bmp . Size == ... | Link bitmap event handler |
231,549 | def OnLinkVLCVideo ( self , event ) : key = self . grid . actions . cursor if event . videofile : try : video_volume = self . grid . code_array . cell_attributes [ key ] [ "video_volume" ] except KeyError : video_volume = None self . grid . actions . set_attr ( "panel_cell" , True ) if video_volume is not None : code =... | VLC video code event handler |
231,550 | def OnInsertChartDialog ( self , event ) : key = self . grid . actions . cursor cell_code = self . grid . code_array ( key ) if cell_code is None : cell_code = u"" chart_dialog = ChartDialog ( self . grid . main_window , key , cell_code ) if chart_dialog . ShowModal ( ) == wx . ID_OK : code = chart_dialog . get_code ( ... | Chart dialog event handler |
231,551 | def OnPasteFormat ( self , event ) : with undo . group ( _ ( "Paste format" ) ) : self . grid . actions . paste_format ( ) self . grid . ForceRefresh ( ) self . grid . update_attribute_toolbar ( ) self . grid . actions . zoom ( ) | Paste format event handler |
231,552 | def OnCellFont ( self , event ) : with undo . group ( _ ( "Font" ) ) : self . grid . actions . set_attr ( "textfont" , event . font ) self . grid . ForceRefresh ( ) self . grid . update_attribute_toolbar ( ) event . Skip ( ) | Cell font event handler |
231,553 | def OnCellFontSize ( self , event ) : with undo . group ( _ ( "Font size" ) ) : self . grid . actions . set_attr ( "pointsize" , event . size ) self . grid . ForceRefresh ( ) self . grid . update_attribute_toolbar ( ) event . Skip ( ) | Cell font size event handler |
231,554 | def OnCellFontBold ( self , event ) : with undo . group ( _ ( "Bold" ) ) : try : try : weight = getattr ( wx , event . weight [ 2 : ] ) except AttributeError : msg = _ ( "Weight {weight} unknown" ) . format ( weight = event . weight ) raise ValueError ( msg ) self . grid . actions . set_attr ( "fontweight" , weight ) e... | Cell font bold event handler |
231,555 | def OnCellFontUnderline ( self , event ) : with undo . group ( _ ( "Underline" ) ) : self . grid . actions . toggle_attr ( "underline" ) self . grid . ForceRefresh ( ) self . grid . update_attribute_toolbar ( ) event . Skip ( ) | Cell font underline event handler |
231,556 | def OnCellFrozen ( self , event ) : with undo . group ( _ ( "Frozen" ) ) : self . grid . actions . change_frozen_attr ( ) self . grid . ForceRefresh ( ) self . grid . update_attribute_toolbar ( ) event . Skip ( ) | Cell frozen event handler |
231,557 | def OnButtonCell ( self , event ) : text = event . text with undo . group ( _ ( "Button" ) ) : self . grid . actions . set_attr ( "button_cell" , text ) self . grid . ForceRefresh ( ) self . grid . update_attribute_toolbar ( ) event . Skip ( ) | Button cell event handler |
231,558 | def OnMerge ( self , event ) : with undo . group ( _ ( "Merge cells" ) ) : self . grid . actions . merge_selected_cells ( self . grid . selection ) self . grid . ForceRefresh ( ) self . grid . update_attribute_toolbar ( ) | Merge cells event handler |
231,559 | def OnCellBorderWidth ( self , event ) : with undo . group ( _ ( "Border width" ) ) : self . grid . actions . set_border_attr ( "borderwidth" , event . width , event . borders ) self . grid . ForceRefresh ( ) self . grid . update_attribute_toolbar ( ) event . Skip ( ) | Cell border width event handler |
231,560 | def OnCellBorderColor ( self , event ) : with undo . group ( _ ( "Border color" ) ) : self . grid . actions . set_border_attr ( "bordercolor" , event . color , event . borders ) self . grid . ForceRefresh ( ) self . grid . update_attribute_toolbar ( ) event . Skip ( ) | Cell border color event handler |
231,561 | def OnCellBackgroundColor ( self , event ) : with undo . group ( _ ( "Background color" ) ) : self . grid . actions . set_attr ( "bgcolor" , event . color ) self . grid . ForceRefresh ( ) self . grid . update_attribute_toolbar ( ) event . Skip ( ) | Cell background color event handler |
231,562 | def OnCellTextRotation ( self , event ) : with undo . group ( _ ( "Rotation" ) ) : self . grid . actions . toggle_attr ( "angle" ) self . grid . ForceRefresh ( ) self . grid . update_attribute_toolbar ( ) if is_gtk ( ) : try : wx . Yield ( ) except : pass event . Skip ( ) | Cell text rotation event handler |
231,563 | def OnCellSelected ( self , event ) : key = row , col , tab = event . Row , event . Col , self . grid . current_table cell_attributes = self . grid . code_array . cell_attributes merging_cell = cell_attributes . get_merging_cell ( key ) if merging_cell is not None and merging_cell != key : post_command_event ( self . g... | Cell selection event handler |
231,564 | def OnMouseMotion ( self , event ) : grid = self . grid pos_x , pos_y = grid . CalcUnscrolledPosition ( event . GetPosition ( ) ) row = grid . YToRow ( pos_y ) col = grid . XToCol ( pos_x ) tab = grid . current_table key = row , col , tab merge_area = self . grid . code_array . cell_attributes [ key ] [ "merge_area" ] ... | Mouse motion event handler |
231,565 | def OnKey ( self , event ) : def switch_to_next_table ( ) : newtable = self . grid . current_table + 1 post_command_event ( self . grid , self . GridActionTableSwitchMsg , newtable = newtable ) def switch_to_previous_table ( ) : newtable = self . grid . current_table - 1 post_command_event ( self . grid , self . GridAc... | Handles non - standard shortcut events |
231,566 | def OnRangeSelected ( self , event ) : if not self . grid . IsEditable ( ) : selection = self . grid . selection row , col , __ = self . grid . sel_mode_cursor if ( row , col ) in selection : self . grid . ClearSelection ( ) else : self . grid . SetGridCursor ( row , col ) post_command_event ( self . grid , self . grid... | Event handler for grid selection |
231,567 | def OnViewFrozen ( self , event ) : self . grid . _view_frozen = not self . grid . _view_frozen self . grid . grid_renderer . cell_cache . clear ( ) self . grid . ForceRefresh ( ) event . Skip ( ) | Show cells as frozen status |
231,568 | def OnGoToCell ( self , event ) : row , col , tab = event . key try : self . grid . actions . cursor = row , col , tab except ValueError : msg = _ ( "Cell {key} outside grid shape {shape}" ) . format ( key = event . key , shape = self . grid . code_array . shape ) post_command_event ( self . grid . main_window , self .... | Shift a given cell into view |
231,569 | def OnEnterSelectionMode ( self , event ) : self . grid . sel_mode_cursor = list ( self . grid . actions . cursor ) self . grid . EnableDragGridSize ( False ) self . grid . EnableEditing ( False ) | Event handler for entering selection mode disables cell edits |
231,570 | def OnExitSelectionMode ( self , event ) : self . grid . sel_mode_cursor = None self . grid . EnableDragGridSize ( True ) self . grid . EnableEditing ( True ) | Event handler for leaving selection mode enables cell edits |
231,571 | def OnRefreshSelectedCells ( self , event ) : self . grid . actions . refresh_selected_frozen_cells ( ) self . grid . ForceRefresh ( ) event . Skip ( ) | Event handler for refreshing the selected cells via menu |
231,572 | def OnTimerToggle ( self , event ) : if self . grid . timer_running : self . grid . timer_running = False self . grid . timer . Stop ( ) del self . grid . timer else : self . grid . timer_running = True self . grid . timer = wx . Timer ( self . grid ) self . grid . timer . Start ( config [ "timer_interval" ] ) | Toggles the timer for updating frozen cells |
231,573 | def OnTimer ( self , event ) : self . timer_updating = True shape = self . grid . code_array . shape [ : 2 ] selection = Selection ( [ ( 0 , 0 ) ] , [ ( shape ) ] , [ ] , [ ] , [ ] ) self . grid . actions . refresh_selected_frozen_cells ( selection ) self . grid . ForceRefresh ( ) | Update all frozen cells because of timer call |
231,574 | def OnZoomStandard ( self , event ) : self . grid . actions . zoom ( zoom = 1.0 ) event . Skip ( ) | Event handler for resetting grid zoom |
231,575 | def OnContextMenu ( self , event ) : self . grid . PopupMenu ( self . grid . contextmenu ) event . Skip ( ) | Context menu event handler |
231,576 | def OnMouseWheel ( self , event ) : if event . ControlDown ( ) : if event . WheelRotation > 0 : post_command_event ( self . grid , self . grid . ZoomInMsg ) else : post_command_event ( self . grid , self . grid . ZoomOutMsg ) elif self . main_window . IsFullScreen ( ) : if event . WheelRotation > 0 : newtable = self . ... | Event handler for mouse wheel actions |
231,577 | def OnFind ( self , event ) : gridpos = list ( self . grid . actions . cursor ) text , flags = event . text , event . flags findpos = self . grid . actions . find ( gridpos , text , flags ) if findpos is None : statustext = _ ( "'{text}' not found." ) . format ( text = text ) else : self . grid . actions . cursor = fin... | Find functionality called from toolbar returns find position |
231,578 | def OnShowFindReplace ( self , event ) : data = wx . FindReplaceData ( wx . FR_DOWN ) dlg = wx . FindReplaceDialog ( self . grid , data , "Find & Replace" , wx . FR_REPLACEDIALOG ) dlg . data = data dlg . Show ( True ) | Calls the find - replace dialog |
231,579 | def OnReplaceFind ( self , event ) : event . text = event . GetFindString ( ) event . flags = self . _wxflag2flag ( event . GetFlags ( ) ) self . OnFind ( event ) | Called when a find operation is started from F&R dialog |
231,580 | def OnReplace ( self , event ) : find_string = event . GetFindString ( ) flags = self . _wxflag2flag ( event . GetFlags ( ) ) replace_string = event . GetReplaceString ( ) gridpos = list ( self . grid . actions . cursor ) findpos = self . grid . actions . find ( gridpos , find_string , flags , search_result = False ) i... | Called when a replace operation is started returns find position |
231,581 | def OnReplaceAll ( self , event ) : find_string = event . GetFindString ( ) flags = self . _wxflag2flag ( event . GetFlags ( ) ) replace_string = event . GetReplaceString ( ) findpositions = self . grid . actions . find_all ( find_string , flags ) with undo . group ( _ ( "Replace all" ) ) : self . grid . actions . repl... | Called when a replace all operation is started |
231,582 | def _get_no_rowscols ( self , bbox ) : if bbox is None : return 1 , 1 else : ( bb_top , bb_left ) , ( bb_bottom , bb_right ) = bbox if bb_top is None : bb_top = 0 if bb_left is None : bb_left = 0 if bb_bottom is None : bb_bottom = self . grid . code_array . shape [ 0 ] - 1 if bb_right is None : bb_right = self . grid .... | Returns tuple of number of rows and cols from bbox |
231,583 | def OnInsertRows ( self , event ) : bbox = self . grid . selection . get_bbox ( ) if bbox is None or bbox [ 1 ] [ 0 ] is None : ins_point = self . grid . actions . cursor [ 0 ] - 1 no_rows = 1 else : ins_point = bbox [ 0 ] [ 0 ] - 1 no_rows = self . _get_no_rowscols ( bbox ) [ 0 ] with undo . group ( _ ( "Insert rows" ... | Insert the maximum of 1 and the number of selected rows |
231,584 | def OnInsertCols ( self , event ) : bbox = self . grid . selection . get_bbox ( ) if bbox is None or bbox [ 1 ] [ 1 ] is None : ins_point = self . grid . actions . cursor [ 1 ] - 1 no_cols = 1 else : ins_point = bbox [ 0 ] [ 1 ] - 1 no_cols = self . _get_no_rowscols ( bbox ) [ 1 ] with undo . group ( _ ( "Insert column... | Inserts the maximum of 1 and the number of selected columns |
231,585 | def OnInsertTabs ( self , event ) : with undo . group ( _ ( "Insert table" ) ) : self . grid . actions . insert_tabs ( self . grid . current_table - 1 , 1 ) self . grid . GetTable ( ) . ResetView ( ) self . grid . actions . zoom ( ) event . Skip ( ) | Insert one table into grid |
231,586 | def OnDeleteRows ( self , event ) : bbox = self . grid . selection . get_bbox ( ) if bbox is None or bbox [ 1 ] [ 0 ] is None : del_point = self . grid . actions . cursor [ 0 ] no_rows = 1 else : del_point = bbox [ 0 ] [ 0 ] no_rows = self . _get_no_rowscols ( bbox ) [ 0 ] with undo . group ( _ ( "Delete rows" ) ) : se... | Deletes rows from all tables of the grid |
231,587 | def OnDeleteCols ( self , event ) : bbox = self . grid . selection . get_bbox ( ) if bbox is None or bbox [ 1 ] [ 1 ] is None : del_point = self . grid . actions . cursor [ 1 ] no_cols = 1 else : del_point = bbox [ 0 ] [ 1 ] no_cols = self . _get_no_rowscols ( bbox ) [ 1 ] with undo . group ( _ ( "Delete columns" ) ) :... | Deletes columns from all tables of the grid |
231,588 | def OnQuote ( self , event ) : grid = self . grid grid . DisableCellEditControl ( ) with undo . group ( _ ( "Quote cell(s)" ) ) : if self . grid . IsSelection ( ) : self . grid . actions . quote_selection ( ) self . grid . ForceRefresh ( ) else : row = self . grid . GetGridCursorRow ( ) col = self . grid . GetGridCurso... | Quotes selection or if none the current cell |
231,589 | def OnRowSize ( self , event ) : row = event . GetRowOrCol ( ) tab = self . grid . current_table rowsize = self . grid . GetRowSize ( row ) / self . grid . grid_renderer . zoom rows = self . grid . GetSelectedRows ( ) if len ( rows ) == 0 : rows = [ row , ] selection = self . grid . selection num_cols = self . grid . c... | Row size event handler |
231,590 | def OnColSize ( self , event ) : col = event . GetRowOrCol ( ) tab = self . grid . current_table colsize = self . grid . GetColSize ( col ) / self . grid . grid_renderer . zoom cols = self . grid . GetSelectedCols ( ) if len ( cols ) == 0 : cols = [ col , ] selection = self . grid . selection num_rows = self . grid . c... | Column size event handler |
231,591 | def OnSortAscending ( self , event ) : try : with undo . group ( _ ( "Sort ascending" ) ) : self . grid . actions . sort_ascending ( self . grid . actions . cursor ) statustext = _ ( u"Sorting complete." ) except Exception , err : statustext = _ ( u"Sorting failed: {}" ) . format ( err ) post_command_event ( self . gri... | Sort ascending event handler |
231,592 | def OnUndo ( self , event ) : statustext = undo . stack ( ) . undotext ( ) undo . stack ( ) . undo ( ) try : post_command_event ( self . grid . main_window , self . grid . ContentChangedMsg ) except TypeError : pass self . grid . code_array . result_cache . clear ( ) post_command_event ( self . grid . main_window , sel... | Calls the grid undo method |
231,593 | def rowcol_from_template ( target_tab , template_tab = 0 ) : for row , tab in S . row_heights . keys ( ) : if tab == target_tab : S . row_heights . pop ( ( row , tab ) ) if tab == template_tab : S . row_heights [ ( row , target_tab ) ] = S . row_heights [ ( row , tab ) ] for col , tab in S . col_widths . keys ( ) : if ... | Adjusts row heights and column widths to match the template |
231,594 | def cell_attributes_from_template ( target_tab , template_tab = 0 ) : new_cell_attributes = [ ] for attr in S . cell_attributes : if attr [ 1 ] == template_tab : new_attr = ( attr [ 0 ] , target_tab , attr [ 2 ] ) new_cell_attributes . append ( new_attr ) S . cell_attributes . extend ( new_cell_attributes ) return "Tab... | Adjusts cell paarmeters to match the template |
231,595 | def get_font_from_data ( fontdata ) : textfont = get_default_font ( ) if fontdata != "" : nativefontinfo = wx . NativeFontInfo ( ) nativefontinfo . FromString ( fontdata ) if not nativefontinfo . GetPointSize ( ) : nativefontinfo . SetPointSize ( get_default_font ( ) . GetPointSize ( ) ) textfont . SetNativeFontInfo ( ... | Returns wx . Font from fontdata string |
231,596 | def get_pen_from_data ( pendata ) : pen_color = wx . Colour ( ) pen_color . SetRGB ( pendata [ 0 ] ) pen = wx . Pen ( pen_color , * pendata [ 1 : ] ) pen . SetJoin ( wx . JOIN_MITER ) return pen | Returns wx . Pen from pendata attribute list |
231,597 | def color_pack2rgb ( packed ) : r = packed & 255 g = ( packed & ( 255 << 8 ) ) >> 8 b = ( packed & ( 255 << 16 ) ) >> 16 return r , g , b | Returns r g b tuple from packed wx . ColourGetRGB value |
231,598 | def unquote_string ( code ) : scode = code . strip ( ) assert scode [ - 1 ] in [ "'" , '"' ] assert scode [ 0 ] in [ "'" , '"' ] or scode [ 1 ] in [ "'" , '"' ] return ast . literal_eval ( scode ) | Returns a string from code that contains a repr of the string |
231,599 | def parse_dict_strings ( code ) : i = 0 level = 0 chunk_start = 0 curr_paren = None for i , char in enumerate ( code ) : if char in [ "(" , "[" , "{" ] and curr_paren is None : level += 1 elif char in [ ")" , "]" , "}" ] and curr_paren is None : level -= 1 elif char in [ '"' , "'" ] : if curr_paren == char : curr_paren... | Generator of elements of a dict that is given in the code string |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.