idx int64 0 63k | question stringlengths 61 4.03k | target stringlengths 6 1.23k |
|---|---|---|
42,600 | def approve ( self , filepath ) : try : signature_valid = self . validate_signature ( filepath ) except ValueError : signature_valid = False if signature_valid : self . leave_safe_mode ( ) post_command_event ( self . main_window , self . SafeModeExitMsg ) statustext = _ ( "Valid signature found. File is trusted." ) pos... | Sets safe mode if signature missing of invalid |
42,601 | def clear_globals_reload_modules ( self ) : self . code_array . clear_globals ( ) self . code_array . reload_modules ( ) self . code_array . result_cache . clear ( ) | Clears globals and reloads modules |
42,602 | def _get_file_version ( self , infile ) : for line1 in infile : if line1 . strip ( ) != "[Pyspread save file version]" : raise ValueError ( _ ( "File format unsupported." ) ) break for line2 in infile : return line2 . strip ( ) | Returns infile version string . |
42,603 | def clear ( self , shape = None ) : self . grid . actions . cursor = 0 , 0 , 0 self . grid . current_table = 0 post_command_event ( self . main_window . grid , self . GotoCellMsg , key = ( 0 , 0 , 0 ) ) self . code_array . dict_grid . clear ( ) del self . code_array . dict_grid . cell_attributes [ : ] if shape is not N... | Empties grid and sets shape to shape |
42,604 | def open ( self , event ) : filepath = event . attr [ "filepath" ] try : filetype = event . attr [ "filetype" ] except KeyError : try : file_ext = filepath . strip ( ) . split ( "." ) [ - 1 ] except : file_ext = None if file_ext in [ "pys" , "pysu" , "xls" , "xlsx" , "ods" ] : filetype = file_ext else : filetype = "pys... | Opens a file that is specified in event . attr |
42,605 | def sign_file ( self , filepath ) : if not GPG_PRESENT : return signed_data = sign ( filepath ) signature = signed_data . data if signature is None or not signature : statustext = _ ( 'Error signing file. ' ) + signed_data . stderr try : post_command_event ( self . main_window , self . StatusBarMsg , text = statustext ... | Signs file if possible |
42,606 | def _set_save_states ( self ) : wx . BeginBusyCursor ( ) self . saving = True self . grid . Disable ( ) | Sets application save states |
42,607 | def _release_save_states ( self ) : self . saving = False self . grid . Enable ( ) wx . EndBusyCursor ( ) try : post_command_event ( self . main_window , self . ContentChangedMsg ) except TypeError : pass | Releases application save states |
42,608 | def _move_tmp_file ( self , tmpfilepath , filepath ) : try : shutil . move ( tmpfilepath , filepath ) except OSError , err : post_command_event ( self . main_window , self . StatusBarMsg , text = err ) | Moves tmpfile over file after saving is finished |
42,609 | def _save_xls ( self , filepath ) : Interface = self . type2interface [ "xls" ] workbook = xlwt . Workbook ( ) interface = Interface ( self . grid . code_array , workbook ) interface . from_code_array ( ) try : workbook . save ( filepath ) except IOError , err : try : post_command_event ( self . main_window , self . St... | Saves file as xls workbook |
42,610 | def _save_pys ( self , filepath ) : try : with Bz2AOpen ( filepath , "wb" , main_window = self . main_window ) as outfile : interface = Pys ( self . grid . code_array , outfile ) interface . from_code_array ( ) except ( IOError , ValueError ) , err : try : post_command_event ( self . main_window , self . StatusBarMsg ,... | Saves file as pys file and returns True if save success |
42,611 | def _save_sign ( self , filepath ) : if self . code_array . safe_mode : msg = _ ( "File saved but not signed because it is unapproved." ) try : post_command_event ( self . main_window , self . StatusBarMsg , text = msg ) except TypeError : pass else : try : self . sign_file ( filepath ) except ValueError , err : msg = ... | Sign so that the new file may be retrieved without safe mode |
42,612 | def save ( self , event ) : filepath = event . attr [ "filepath" ] try : filetype = event . attr [ "filetype" ] except KeyError : filetype = "pys" if self . saving : return __ , tmpfilepath = tempfile . mkstemp ( ) if filetype == "xls" : self . _set_save_states ( ) self . _save_xls ( tmpfilepath ) self . _move_tmp_file... | Saves a file that is specified in event . attr |
42,613 | def set_row_height ( self , row , height ) : post_command_event ( self . main_window , self . ContentChangedMsg ) tab = self . grid . current_table self . code_array . set_row_height ( row , tab , height ) self . grid . SetRowSize ( row , height ) | Sets row height and marks grid as changed |
42,614 | def insert_rows ( self , row , no_rows = 1 ) : post_command_event ( self . main_window , self . ContentChangedMsg ) tab = self . grid . current_table self . code_array . insert ( row , no_rows , axis = 0 , tab = tab ) | Adds no_rows rows before row appends if row > maxrows |
42,615 | def delete_rows ( self , row , no_rows = 1 ) : post_command_event ( self . main_window , self . ContentChangedMsg ) tab = self . grid . current_table try : self . code_array . delete ( row , no_rows , axis = 0 , tab = tab ) except ValueError , err : post_command_event ( self . main_window , self . StatusBarMsg , text =... | Deletes no_rows rows and marks grid as changed |
42,616 | def set_col_width ( self , col , width ) : post_command_event ( self . main_window , self . ContentChangedMsg ) tab = self . grid . current_table self . code_array . set_col_width ( col , tab , width ) self . grid . SetColSize ( col , width ) | Sets column width and marks grid as changed |
42,617 | def insert_cols ( self , col , no_cols = 1 ) : post_command_event ( self . main_window , self . ContentChangedMsg ) tab = self . grid . current_table self . code_array . insert ( col , no_cols , axis = 1 , tab = tab ) | Adds no_cols columns before col appends if col > maxcols |
42,618 | def delete_cols ( self , col , no_cols = 1 ) : post_command_event ( self . main_window , self . ContentChangedMsg ) tab = self . grid . current_table try : self . code_array . delete ( col , no_cols , axis = 1 , tab = tab ) except ValueError , err : post_command_event ( self . main_window , self . StatusBarMsg , text =... | Deletes no_cols column and marks grid as changed |
42,619 | def insert_tabs ( self , tab , no_tabs = 1 ) : post_command_event ( self . main_window , self . ContentChangedMsg ) self . code_array . insert ( tab , no_tabs , axis = 2 ) shape = self . grid . code_array . shape post_command_event ( self . main_window , self . ResizeGridMsg , shape = shape ) | Adds no_tabs tabs before table appends if tab > maxtabs |
42,620 | def delete_tabs ( self , tab , no_tabs = 1 ) : post_command_event ( self . main_window , self . ContentChangedMsg ) try : self . code_array . delete ( tab , no_tabs , axis = 2 ) shape = self . grid . code_array . shape post_command_event ( self . main_window , self . ResizeGridMsg , shape = shape ) except ValueError , ... | Deletes no_tabs tabs and marks grid as changed |
42,621 | def on_key ( self , event ) : if event . GetKeyCode ( ) == wx . WXK_ESCAPE and self . pasting or self . grid . actions . saving : self . need_abort = True event . Skip ( ) | Sets abort if pasting and if escape is pressed |
42,622 | def _get_full_key ( self , key ) : length = len ( key ) if length == 3 : return key elif length == 2 : row , col = key tab = self . grid . current_table return row , col , tab else : msg = _ ( "Key length {length} not in (2, 3)" ) . format ( length = length ) raise ValueError ( msg ) | Returns full key even if table is omitted |
42,623 | def _show_final_overflow_message ( self , row_overflow , col_overflow ) : if row_overflow and col_overflow : overflow_cause = _ ( "rows and columns" ) elif row_overflow : overflow_cause = _ ( "rows" ) elif col_overflow : overflow_cause = _ ( "columns" ) else : raise AssertionError ( _ ( "Import cell overflow missing" )... | Displays overflow message after import in statusbar |
42,624 | def _show_final_paste_message ( self , tl_key , no_pasted_cells ) : plural = "" if no_pasted_cells == 1 else _ ( "s" ) statustext = _ ( "{ncells} cell{plural} pasted at cell {topleft}" ) . format ( ncells = no_pasted_cells , plural = plural , topleft = tl_key ) post_command_event ( self . main_window , self . StatusBar... | Show actually pasted number of cells |
42,625 | def paste_to_current_cell ( self , tl_key , data , freq = None ) : self . pasting = True grid_rows , grid_cols , __ = self . grid . code_array . shape self . need_abort = False tl_row , tl_col , tl_tab = self . _get_full_key ( tl_key ) row_overflow = False col_overflow = False no_pasted_cells = 0 for src_row , row_data... | Pastes data into grid from top left cell tl_key |
42,626 | def selection_paste_data_gen ( self , selection , data , freq = None ) : ( bb_top , bb_left ) , ( bb_bottom , bb_right ) = selection . get_grid_bbox ( self . grid . code_array . shape ) bbox_height = bb_bottom - bb_top + 1 bbox_width = bb_right - bb_left + 1 for row , row_data in enumerate ( itertools . cycle ( data ) ... | Generator that yields data for selection paste |
42,627 | def paste_to_selection ( self , selection , data , freq = None ) : ( bb_top , bb_left ) , ( bb_bottom , bb_right ) = selection . get_grid_bbox ( self . grid . code_array . shape ) adjusted_data = self . selection_paste_data_gen ( selection , data ) self . paste_to_current_cell ( ( bb_top , bb_left ) , adjusted_data , f... | Pastes data into grid selection |
42,628 | def paste ( self , tl_key , data , freq = None ) : selection = self . get_selection ( ) post_command_event ( self . main_window , self . ContentChangedMsg ) if selection : self . paste_to_selection ( selection , data , freq = freq ) else : self . paste_to_current_cell ( tl_key , data , freq = freq ) | Pastes data into grid marks grid changed |
42,629 | def change_grid_shape ( self , shape ) : post_command_event ( self . main_window , self . ContentChangedMsg ) self . code_array . shape = shape post_command_event ( self . main_window , self . ResizeGridMsg , shape = shape ) self . grid . GetTable ( ) . ResetView ( ) self . code_array . result_cache . clear ( ) | Grid shape change event handler marks content as changed |
42,630 | def replace_cells ( self , key , sorted_row_idxs ) : row , col , tab = key new_keys = { } del_keys = [ ] selection = self . grid . actions . get_selection ( ) for __row , __col , __tab in self . grid . code_array : if __tab == tab and ( not selection or ( __row , __col ) in selection ) : new_row = sorted_row_idxs . ind... | Replaces cells in current selection so that they are sorted |
42,631 | def new ( self , event ) : self . grid . actions . clear ( event . shape ) _grid_table = GridTable ( self . grid , self . grid . code_array ) self . grid . SetTable ( _grid_table , True ) self . grid . update_entry_line ( ) self . grid . update_attribute_toolbar ( ) | Creates a new spreadsheet . Expects code_array in event . |
42,632 | def _zoom_rows ( self , zoom ) : self . grid . SetDefaultRowSize ( self . grid . std_row_size * zoom , resizeExistingRows = True ) self . grid . SetRowLabelSize ( self . grid . row_label_size * zoom ) for row , tab in self . code_array . row_heights : if tab == self . grid . current_table and row < self . grid . code_a... | Zooms grid rows |
42,633 | def _zoom_cols ( self , zoom ) : self . grid . SetDefaultColSize ( self . grid . std_col_size * zoom , resizeExistingCols = True ) self . grid . SetColLabelSize ( self . grid . col_label_size * zoom ) for col , tab in self . code_array . col_widths : if tab == self . grid . current_table and col < self . grid . code_ar... | Zooms grid columns |
42,634 | def _zoom_labels ( self , zoom ) : labelfont = self . grid . GetLabelFont ( ) default_fontsize = get_default_font ( ) . GetPointSize ( ) labelfont . SetPointSize ( max ( 1 , int ( round ( default_fontsize * zoom ) ) ) ) self . grid . SetLabelFont ( labelfont ) | Adjust grid label font to zoom factor |
42,635 | 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 |
42,636 | 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 |
42,637 | 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 |
42,638 | 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 |
42,639 | 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 |
42,640 | 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 . |
42,641 | 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 |
42,642 | 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 |
42,643 | 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 |
42,644 | 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 . |
42,645 | 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 |
42,646 | 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 |
42,647 | 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 |
42,648 | 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 |
42,649 | 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 |
42,650 | 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 |
42,651 | 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 |
42,652 | 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 |
42,653 | 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 |
42,654 | 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 . |
42,655 | 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 |
42,656 | 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 |
42,657 | 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 |
42,658 | 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 |
42,659 | 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 |
42,660 | 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 |
42,661 | 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 |
42,662 | 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 |
42,663 | 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 |
42,664 | 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 |
42,665 | 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 |
42,666 | 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 |
42,667 | 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 |
42,668 | 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 |
42,669 | 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 |
42,670 | 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 |
42,671 | def _execute_cell_code ( self , row , col , grid ) : key = row , col , grid . current_table grid . code_array [ key ] grid . ForceRefresh ( ) | Executes cell code |
42,672 | 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 . |
42,673 | def GetPageInfo ( self ) : return self . first_tab , self . last_tab , self . first_tab , self . last_tab | Returns page information |
42,674 | 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 |
42,675 | 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 |
42,676 | 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 |
42,677 | 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 |
42,678 | 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 |
42,679 | 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 |
42,680 | 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 |
42,681 | def OnCellText ( self , event ) : row , col , _ = self . grid . actions . cursor self . grid . GetTable ( ) . SetValue ( row , col , event . code ) event . Skip ( ) | Text entry event handler |
42,682 | 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 |
42,683 | 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 |
42,684 | 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 |
42,685 | 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 |
42,686 | 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 |
42,687 | 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 |
42,688 | 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 |
42,689 | 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 |
42,690 | 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 |
42,691 | 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 |
42,692 | 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 |
42,693 | 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 |
42,694 | 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 |
42,695 | 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 |
42,696 | 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 |
42,697 | 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 |
42,698 | 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 |
42,699 | 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.