idx int64 0 63k | question stringlengths 61 4.03k | target stringlengths 6 1.23k |
|---|---|---|
42,700 | 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 |
42,701 | 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 |
42,702 | 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 |
42,703 | 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 |
42,704 | 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 |
42,705 | 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 |
42,706 | 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 |
42,707 | 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 |
42,708 | 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 |
42,709 | def OnZoomStandard ( self , event ) : self . grid . actions . zoom ( zoom = 1.0 ) event . Skip ( ) | Event handler for resetting grid zoom |
42,710 | def OnContextMenu ( self , event ) : self . grid . PopupMenu ( self . grid . contextmenu ) event . Skip ( ) | Context menu event handler |
42,711 | 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 |
42,712 | 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 |
42,713 | 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 |
42,714 | 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 |
42,715 | 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 |
42,716 | 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 |
42,717 | 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 |
42,718 | 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 |
42,719 | 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 |
42,720 | 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 |
42,721 | 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 |
42,722 | 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 |
42,723 | 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 |
42,724 | 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 |
42,725 | 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 |
42,726 | 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 |
42,727 | 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 |
42,728 | 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 |
42,729 | 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 |
42,730 | 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 |
42,731 | 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 |
42,732 | 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 |
42,733 | 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 |
42,734 | 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 |
42,735 | def common_start ( strings ) : def gen_start_strings ( string ) : for i in xrange ( 1 , len ( string ) + 1 ) : yield string [ : i ] if not strings : return "" start_string = "" for start_string in gen_start_strings ( max ( strings ) ) : if not all ( string . startswith ( start_string ) for string in strings ) : return ... | Returns start sub - string that is common for all given strings |
42,736 | def is_svg ( code ) : if rsvg is None : return try : rsvg . Handle ( data = code ) except glib . GError : return False if "http://www.w3.org/2000/svg" in code [ : 1000 ] : return True return False | Checks if code is an svg image |
42,737 | def _get_dialog_title ( self ) : title_filetype = self . filetype [ 0 ] . upper ( ) + self . filetype [ 1 : ] if self . filetype == "print" : title_export = "" else : title_export = " export" return _ ( "{filetype}{export} options" ) . format ( filetype = title_filetype , export = title_export ) | Returns title string |
42,738 | def on_page_layout_choice ( self , event ) : width , height = self . paper_sizes_points [ event . GetString ( ) ] self . page_width_text_ctrl . SetValue ( str ( width / 72.0 ) ) self . page_height_text_ctrl . SetValue ( str ( height / 72.0 ) ) event . Skip ( ) | Page layout choice event handler |
42,739 | def get_info ( self ) : info = { } info [ "top_row" ] = self . top_row_text_ctrl . GetValue ( ) info [ "bottom_row" ] = self . bottom_row_text_ctrl . GetValue ( ) info [ "left_col" ] = self . left_col_text_ctrl . GetValue ( ) info [ "right_col" ] = self . right_col_text_ctrl . GetValue ( ) info [ "first_tab" ] = self .... | Returns a dict with the dialog PDF info |
42,740 | def get_program_path ( ) : src_folder = os . path . dirname ( __file__ ) program_path = os . sep . join ( src_folder . split ( os . sep ) [ : - 1 ] ) + os . sep return program_path | Returns the path in which pyspread is installed |
42,741 | def get_dpi ( ) : def pxmm_2_dpi ( ( pixels , length_mm ) ) : return pixels * 25.6 / length_mm return map ( pxmm_2_dpi , zip ( wx . GetDisplaySize ( ) , wx . GetDisplaySizeMM ( ) ) ) | Returns screen dpi resolution |
42,742 | def get_font_list ( ) : font_map = pangocairo . cairo_font_map_get_default ( ) font_list = [ f . get_name ( ) for f in font_map . list_families ( ) ] font_list . sort ( ) return font_list | Returns a sorted list of all system font names |
42,743 | def get_dependencies ( ) : dependencies = [ ] dep_attrs = { "name" : "numpy" , "min_version" : "1.1.0" , "description" : "required" , } try : import numpy dep_attrs [ "version" ] = numpy . version . version except ImportError : dep_attrs [ "version" ] = None dependencies . append ( dep_attrs ) dep_attrs = { "name" : "w... | Returns list of dicts which indicate installed dependencies |
42,744 | def get_cell_rect ( self , row , col , tab ) : top_row = self . row_tb [ 0 ] left_col = self . col_rl [ 0 ] pos_x = self . x_offset pos_y = self . y_offset merge_area = self . _get_merge_area ( ( row , col , tab ) ) for __row in xrange ( top_row , row ) : __row_height = self . code_array . get_row_height ( __row , tab ... | Returns rectangle of cell on canvas |
42,745 | def draw ( self ) : row_start , row_stop = self . row_tb col_start , col_stop = self . col_rl tab_start , tab_stop = self . tab_fl for tab in xrange ( tab_start , tab_stop ) : first_key = row_start , col_start , tab first_rect = self . get_cell_rect ( * first_key ) if first_rect is None : top , left , __ , __ = self . ... | Draws slice to context |
42,746 | def draw ( self ) : cell_background_renderer = GridCellBackgroundCairoRenderer ( self . context , self . code_array , self . key , self . rect , self . view_frozen ) cell_content_renderer = GridCellContentCairoRenderer ( self . context , self . code_array , self . key , self . rect , self . spell_check ) cell_border_re... | Draws cell to context |
42,747 | def get_cell_content ( self ) : try : if self . code_array . cell_attributes [ self . key ] [ "button_cell" ] : return except IndexError : return try : return self . code_array [ self . key ] except IndexError : pass | Returns cell content |
42,748 | def _get_scalexy ( self , ims_width , ims_height ) : cell_attributes = self . code_array . cell_attributes [ self . key ] angle = cell_attributes [ "angle" ] if abs ( angle ) == 90 : scale_x = self . rect [ 3 ] / float ( ims_width ) scale_y = self . rect [ 2 ] / float ( ims_height ) else : scale_x = self . rect [ 2 ] /... | Returns scale_x scale_y for bitmap display |
42,749 | def _get_translation ( self , ims_width , ims_height ) : cell_attributes = self . code_array . cell_attributes [ self . key ] justification = cell_attributes [ "justification" ] vertical_align = cell_attributes [ "vertical_align" ] angle = cell_attributes [ "angle" ] scale_x , scale_y = self . _get_scalexy ( ims_width ... | Returns x and y for a bitmap translation |
42,750 | def draw_bitmap ( self , content ) : if content . HasAlpha ( ) : image = wx . ImageFromBitmap ( content ) image . ConvertAlphaToMask ( ) image . SetMask ( False ) content = wx . BitmapFromImage ( image ) ims = wx . lib . wxcairo . ImageSurfaceFromBitmap ( content ) ims_width = ims . get_width ( ) ims_height = ims . get... | Draws bitmap cell content to context |
42,751 | def draw_svg ( self , svg_str ) : try : import rsvg except ImportError : self . draw_text ( svg_str ) return svg = rsvg . Handle ( data = svg_str ) svg_width , svg_height = svg . get_dimension_data ( ) [ : 2 ] transx , transy = self . _get_translation ( svg_width , svg_height ) scale_x , scale_y = self . _get_scalexy (... | Draws svg string to cell |
42,752 | def draw_matplotlib_figure ( self , figure ) : class CustomRendererCairo ( RendererCairo ) : if sys . byteorder == 'little' : BYTE_FORMAT = 0 else : BYTE_FORMAT = 1 def draw_path ( self , gc , path , transform , rgbFace = None ) : ctx = gc . ctx transform = transform + Affine2D ( ) . scale ( 1.0 , - 1.0 ) . translate (... | Draws matplotlib figure to context |
42,753 | def _get_text_color ( self ) : color = self . code_array . cell_attributes [ self . key ] [ "textcolor" ] return tuple ( c / 255.0 for c in color_pack2rgb ( color ) ) | Returns text color rgb tuple of right line |
42,754 | def set_font ( self , pango_layout ) : wx2pango_weights = { wx . FONTWEIGHT_BOLD : pango . WEIGHT_BOLD , wx . FONTWEIGHT_LIGHT : pango . WEIGHT_LIGHT , wx . FONTWEIGHT_NORMAL : None , } wx2pango_styles = { wx . FONTSTYLE_NORMAL : None , wx . FONTSTYLE_SLANT : pango . STYLE_OBLIQUE , wx . FONTSTYLE_ITALIC : pango . STYL... | Sets the font for draw_text |
42,755 | def _draw_error_underline ( self , ptx , pango_layout , start , stop ) : self . context . save ( ) self . context . set_source_rgb ( 1.0 , 0.0 , 0.0 ) pit = pango_layout . get_iter ( ) for i in xrange ( start ) : pit . next_char ( ) extents_list = [ ] for char_no in xrange ( start , stop ) : char_extents = pit . get_ch... | Draws an error underline |
42,756 | def _check_spelling ( self , text , lang = "en_US" ) : chkr = SpellChecker ( lang ) chkr . set_text ( text ) word_starts_ends = [ ] for err in chkr : start = err . wordpos stop = err . wordpos + len ( err . word ) + 1 word_starts_ends . append ( ( start , stop ) ) return word_starts_ends | Returns a list of start stop tuples that have spelling errors |
42,757 | def draw_text ( self , content ) : wx2pango_alignment = { "left" : pango . ALIGN_LEFT , "center" : pango . ALIGN_CENTER , "right" : pango . ALIGN_RIGHT , } cell_attributes = self . code_array . cell_attributes [ self . key ] angle = cell_attributes [ "angle" ] if angle in [ - 90 , 90 ] : rect = self . rect [ 1 ] , self... | Draws text cell content to context |
42,758 | def draw_roundedrect ( self , x , y , w , h , r = 10 ) : context = self . context context . save context . move_to ( x + r , y ) context . line_to ( x + w - r , y ) context . curve_to ( x + w , y , x + w , y , x + w , y + r ) context . line_to ( x + w , y + h - r ) context . curve_to ( x + w , y + h , x + w , y + h , x... | Draws a rounded rectangle |
42,759 | def draw_button ( self , x , y , w , h , label ) : context = self . context self . draw_roundedrect ( x , y , w , h ) context . clip ( ) gradient = cairo . LinearGradient ( 0 , 0 , 0 , 1 ) gradient . add_color_stop_rgba ( 0 , 0.5 , 0.5 , 0.5 , 0.1 ) gradient . add_color_stop_rgba ( 1 , 0.8 , 0.8 , 0.8 , 0.9 ) context .... | Draws a button |
42,760 | def draw ( self ) : self . context . save ( ) self . context . rectangle ( * self . rect ) self . context . clip ( ) content = self . get_cell_content ( ) pos_x , pos_y = self . rect [ : 2 ] self . context . translate ( pos_x + 2 , pos_y + 2 ) cell_attributes = self . code_array . cell_attributes if self . rect [ 2 ] <... | Draws cell content to context |
42,761 | def _get_background_color ( self ) : color = self . cell_attributes [ self . key ] [ "bgcolor" ] return tuple ( c / 255.0 for c in color_pack2rgb ( color ) ) | Returns background color rgb tuple of right line |
42,762 | def _draw_frozen_pattern ( self ) : self . context . save ( ) x , y , w , h = self . rect self . context . set_source_rgb ( 0 , 0 , 1 ) self . context . set_line_width ( 0.25 ) self . context . rectangle ( * self . rect ) self . context . clip ( ) for __x in numpy . arange ( x - h , x + w , 5 ) : self . context . move_... | Draws frozen pattern i . e . diagonal lines |
42,763 | def draw ( self ) : self . context . set_source_rgb ( * self . _get_background_color ( ) ) self . context . rectangle ( * self . rect ) self . context . fill ( ) if self . view_frozen and self . cell_attributes [ self . key ] [ "frozen" ] : self . _draw_frozen_pattern ( ) | Draws cell background to context |
42,764 | def draw ( self , context ) : context . set_line_width ( self . width ) context . set_source_rgb ( * self . color ) context . move_to ( * self . start_point ) context . line_to ( * self . end_point ) context . stroke ( ) | Draws self to Cairo context |
42,765 | def get_above_key_rect ( self ) : key_above = self . row - 1 , self . col , self . tab border_width_bottom = float ( self . cell_attributes [ key_above ] [ "borderwidth_bottom" ] ) / 2.0 rect_above = ( self . x , self . y - border_width_bottom , self . width , border_width_bottom ) return key_above , rect_above | Returns tuple key rect of above cell |
42,766 | def get_below_key_rect ( self ) : key_below = self . row + 1 , self . col , self . tab border_width_bottom = float ( self . cell_attributes [ self . key ] [ "borderwidth_bottom" ] ) / 2.0 rect_below = ( self . x , self . y + self . height , self . width , border_width_bottom ) return key_below , rect_below | Returns tuple key rect of below cell |
42,767 | def get_left_key_rect ( self ) : key_left = self . row , self . col - 1 , self . tab border_width_right = float ( self . cell_attributes [ key_left ] [ "borderwidth_right" ] ) / 2.0 rect_left = ( self . x - border_width_right , self . y , border_width_right , self . height ) return key_left , rect_left | Returns tuple key rect of left cell |
42,768 | def get_right_key_rect ( self ) : key_right = self . row , self . col + 1 , self . tab border_width_right = float ( self . cell_attributes [ self . key ] [ "borderwidth_right" ] ) / 2.0 rect_right = ( self . x + self . width , self . y , border_width_right , self . height ) return key_right , rect_right | Returns tuple key rect of right cell |
42,769 | def get_above_left_key_rect ( self ) : key_above_left = self . row - 1 , self . col - 1 , self . tab border_width_right = float ( self . cell_attributes [ key_above_left ] [ "borderwidth_right" ] ) / 2.0 border_width_bottom = float ( self . cell_attributes [ key_above_left ] [ "borderwidth_bottom" ] ) / 2.0 rect_above_... | Returns tuple key rect of above left cell |
42,770 | def get_above_right_key_rect ( self ) : key_above = self . row - 1 , self . col , self . tab key_above_right = self . row - 1 , self . col + 1 , self . tab border_width_right = float ( self . cell_attributes [ key_above ] [ "borderwidth_right" ] ) / 2.0 border_width_bottom = float ( self . cell_attributes [ key_above_r... | Returns tuple key rect of above right cell |
42,771 | def get_below_left_key_rect ( self ) : key_left = self . row , self . col - 1 , self . tab key_below_left = self . row + 1 , self . col - 1 , self . tab border_width_right = float ( self . cell_attributes [ key_below_left ] [ "borderwidth_right" ] ) / 2.0 border_width_bottom = float ( self . cell_attributes [ key_left ... | Returns tuple key rect of below left cell |
42,772 | def get_below_right_key_rect ( self ) : key_below_right = self . row + 1 , self . col + 1 , self . tab border_width_right = float ( self . cell_attributes [ self . key ] [ "borderwidth_right" ] ) / 2.0 border_width_bottom = float ( self . cell_attributes [ self . key ] [ "borderwidth_bottom" ] ) / 2.0 rect_below_right ... | Returns tuple key rect of below right cell |
42,773 | def _get_bottom_line_coordinates ( self ) : rect_x , rect_y , rect_width , rect_height = self . rect start_point = rect_x , rect_y + rect_height end_point = rect_x + rect_width , rect_y + rect_height return start_point , end_point | Returns start and stop coordinates of bottom line |
42,774 | def _get_bottom_line_color ( self ) : color = self . cell_attributes [ self . key ] [ "bordercolor_bottom" ] return tuple ( c / 255.0 for c in color_pack2rgb ( color ) ) | Returns color rgb tuple of bottom line |
42,775 | def _get_right_line_color ( self ) : color = self . cell_attributes [ self . key ] [ "bordercolor_right" ] return tuple ( c / 255.0 for c in color_pack2rgb ( color ) ) | Returns color rgb tuple of right line |
42,776 | def get_b ( self ) : start_point , end_point = self . _get_bottom_line_coordinates ( ) width = self . _get_bottom_line_width ( ) color = self . _get_bottom_line_color ( ) return CellBorder ( start_point , end_point , width , color ) | Returns the bottom border of the cell |
42,777 | def get_r ( self ) : start_point , end_point = self . _get_right_line_coordinates ( ) width = self . _get_right_line_width ( ) color = self . _get_right_line_color ( ) return CellBorder ( start_point , end_point , width , color ) | Returns the right border of the cell |
42,778 | def get_t ( self ) : cell_above = CellBorders ( self . cell_attributes , * self . cell . get_above_key_rect ( ) ) return cell_above . get_b ( ) | Returns the top border of the cell |
42,779 | def get_l ( self ) : cell_left = CellBorders ( self . cell_attributes , * self . cell . get_left_key_rect ( ) ) return cell_left . get_r ( ) | Returns the left border of the cell |
42,780 | def get_tl ( self ) : cell_above_left = CellBorders ( self . cell_attributes , * self . cell . get_above_left_key_rect ( ) ) return cell_above_left . get_r ( ) | Returns the top left border of the cell |
42,781 | def get_tr ( self ) : cell_above = CellBorders ( self . cell_attributes , * self . cell . get_above_key_rect ( ) ) return cell_above . get_r ( ) | Returns the top right border of the cell |
42,782 | def get_rt ( self ) : cell_above_right = CellBorders ( self . cell_attributes , * self . cell . get_above_right_key_rect ( ) ) return cell_above_right . get_b ( ) | Returns the right top border of the cell |
42,783 | def get_rb ( self ) : cell_right = CellBorders ( self . cell_attributes , * self . cell . get_right_key_rect ( ) ) return cell_right . get_b ( ) | Returns the right bottom border of the cell |
42,784 | def get_br ( self ) : cell_below = CellBorders ( self . cell_attributes , * self . cell . get_below_key_rect ( ) ) return cell_below . get_r ( ) | Returns the bottom right border of the cell |
42,785 | def get_bl ( self ) : cell_below_left = CellBorders ( self . cell_attributes , * self . cell . get_below_left_key_rect ( ) ) return cell_below_left . get_r ( ) | Returns the bottom left border of the cell |
42,786 | def get_lb ( self ) : cell_left = CellBorders ( self . cell_attributes , * self . cell . get_left_key_rect ( ) ) return cell_left . get_b ( ) | Returns the left bottom border of the cell |
42,787 | def get_lt ( self ) : cell_above_left = CellBorders ( self . cell_attributes , * self . cell . get_above_left_key_rect ( ) ) return cell_above_left . get_b ( ) | Returns the left top border of the cell |
42,788 | def gen_all ( self ) : borderfuncs = [ self . get_b , self . get_r , self . get_t , self . get_l , self . get_tl , self . get_tr , self . get_rt , self . get_rb , self . get_br , self . get_bl , self . get_lb , self . get_lt , ] for borderfunc in borderfuncs : yield borderfunc ( ) | Generator of all borders |
42,789 | def draw ( self ) : self . context . set_line_cap ( cairo . LINE_CAP_SQUARE ) self . context . save ( ) self . context . rectangle ( * self . rect ) self . context . clip ( ) cell_borders = CellBorders ( self . cell_attributes , self . key , self . rect ) borders = list ( cell_borders . gen_all ( ) ) borders . sort ( k... | Draws cell border to context |
42,790 | def _draw_cursor ( self , dc , grid , row , col , pen = None , brush = None ) : if grid . main_window . IsFullScreen ( ) : return key = row , col , grid . current_table rect = grid . CellToRect ( row , col ) rect = self . get_merged_rect ( grid , key , rect ) if rect is None : return size = self . get_zoomed_size ( 1.0... | Draws cursor as Rectangle in lower right corner |
42,791 | def update_cursor ( self , dc , grid , row , col ) : old_row , old_col = self . old_cursor_row_col bgcolor = get_color ( config [ "background_color" ] ) self . _draw_cursor ( dc , grid , old_row , old_col , pen = wx . Pen ( bgcolor ) , brush = wx . Brush ( bgcolor ) ) self . _draw_cursor ( dc , grid , row , col ) | Whites out the old cursor and draws the new one |
42,792 | def get_merged_rect ( self , grid , key , rect ) : row , col , tab = key cell_attributes = grid . code_array . cell_attributes merge_area = cell_attributes [ ( row , col , tab ) ] [ "merge_area" ] if merge_area is None : return rect else : top , left , bottom , right = merge_area if top == row and left == col : ul_rect... | Returns cell rect for normal or merged cells and None for merged |
42,793 | def _get_drawn_rect ( self , grid , key , rect ) : rect = self . get_merged_rect ( grid , key , rect ) if rect is None : if grid . is_merged_cell_drawn ( key ) : row , col , __ = key = self . get_merging_cell ( grid , key ) rect = grid . CellToRect ( row , col ) rect = self . get_merged_rect ( grid , key , rect ) else ... | Replaces drawn rect if the one provided by wx is incorrect |
42,794 | def _get_draw_cache_key ( self , grid , key , drawn_rect , is_selected ) : row , col , tab = key cell_attributes = grid . code_array . cell_attributes zoomed_width = drawn_rect . width / self . zoom zoomed_height = drawn_rect . height / self . zoom if grid . code_array . cell_attributes [ key ] [ "button_cell" ] : cell... | Returns key for the screen draw cache |
42,795 | def _get_cairo_bmp ( self , mdc , key , rect , is_selected , view_frozen ) : bmp = wx . EmptyBitmap ( rect . width , rect . height ) mdc . SelectObject ( bmp ) mdc . SetBackgroundMode ( wx . SOLID ) mdc . SetBackground ( wx . WHITE_BRUSH ) mdc . Clear ( ) mdc . SetDeviceOrigin ( 0 , 0 ) context = wx . lib . wxcairo . C... | Returns a wx . Bitmap of cell key in size rect |
42,796 | def Draw ( self , grid , attr , dc , rect , row , col , isSelected ) : key = row , col , grid . current_table if grid . code_array . cell_attributes [ key ] [ "merge_area" ] : key = self . get_merging_cell ( grid , key ) drawn_rect = self . _get_drawn_rect ( grid , key , rect ) if drawn_rect is None : return cell_cache... | Draws the cell border and content using pycairo |
42,797 | def choose_key ( gpg_private_keys ) : uid_strings_fp = [ ] uid_string_fp2key = { } current_key_index = None for i , key in enumerate ( gpg_private_keys ) : fingerprint = key [ 'fingerprint' ] if fingerprint == config [ "gpg_key_fingerprint" ] : current_key_index = i for uid_string in key [ 'uids' ] : uid_string_fp = '"... | Displays gpg key choice and returns key |
42,798 | def _register_key ( fingerprint , gpg ) : for private_key in gpg . list_keys ( True ) : try : if str ( fingerprint ) == private_key [ 'fingerprint' ] : config [ "gpg_key_fingerprint" ] = repr ( private_key [ 'fingerprint' ] ) except KeyError : pass | Registers key in config |
42,799 | def has_no_password ( gpg_secret_keyid ) : if gnupg is None : return False gpg = gnupg . GPG ( ) s = gpg . sign ( "" , keyid = gpg_secret_keyid , passphrase = "" ) try : return s . status == "signature created" except AttributeError : if hasattr ( s , "stderr" ) : return "GOOD_PASSPHRASE" in s . stderr | Returns True iif gpg_secret_key has a password |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.