idx int64 0 252k | question stringlengths 48 5.28k | target stringlengths 5 1.23k |
|---|---|---|
231,300 | def vlm_add_input ( self , psz_name , psz_input ) : return libvlc_vlm_add_input ( self , str_to_bytes ( psz_name ) , str_to_bytes ( psz_input ) ) | Add a media s input MRL . This will add the specified one . |
231,301 | def vlm_change_media ( self , psz_name , psz_input , psz_output , i_options , ppsz_options , b_enabled , b_loop ) : return libvlc_vlm_change_media ( self , str_to_bytes ( psz_name ) , str_to_bytes ( psz_input ) , str_to_bytes ( psz_output ) , i_options , ppsz_options , b_enabled , b_loop ) | Edit the parameters of a media . This will delete all existing inputs and add the specified one . |
231,302 | def set_mrl ( self , mrl , * options ) : m = self . get_instance ( ) . media_new ( mrl , * options ) self . set_media ( m ) return m | Set the MRL to play . |
231,303 | def do ( self ) : 'Do or redo the action' self . _runner = self . _generator ( * self . args , ** self . kwargs ) rets = next ( self . _runner ) if isinstance ( rets , tuple ) : self . _text = rets [ 0 ] return rets [ 1 : ] elif rets is None : self . _text = '' return None else : self . _text = rets return None | Do or redo the action |
231,304 | def redo ( self ) : if self . canredo ( ) : undoable = self . _redos . pop ( ) with self . _pausereceiver ( ) : try : undoable . do ( ) except : self . clear ( ) raise else : self . _undos . append ( undoable ) self . docallback ( ) | Redo the last undone action . This is only possible if no other actions have occurred since the last undo call . |
231,305 | def clear ( self ) : self . _undos . clear ( ) self . _redos . clear ( ) self . _savepoint = None self . _receiver = self . _undos | Clear the undo list . |
231,306 | def is_bbox_not_intersecting ( self , other ) : self_x_min , self_x_max , self_y_min , self_y_max = self . get_bbox ( ) other_x_min , other_x_max , other_y_min , other_y_max = other . get_bbox ( ) return self_x_min > other_x_max or other_x_min > self_x_max or self_y_min > other_y_max or other_y_min > self_y_max | Returns False iif bounding boxed of self and other intersect |
231,307 | def is_edge_not_excluding_vertices ( self , other ) : c_a = cos ( self . angle ) s_a = sin ( self . angle ) other_x_min , other_x_max , other_y_min , other_y_max = other . get_bbox ( ) self_x_diff = 0.5 * self . width self_y_diff = 0.5 * self . height if c_a > 0 : if s_a > 0 : return c_a * other_x_max + s_a * other_y_m... | Returns False iif any edge excludes all vertices of other . |
231,308 | def collides ( self , other ) : angle = self . angle width = self . width height = self . height if angle == 0 : return other . collides ( Rect ( - 0.5 * width , - 0.5 * height , width , height ) ) if self . is_bbox_not_intersecting ( other ) : return False return not self . is_edge_not_excluding_vertices ( other ) | Returns collision with axis aligned rect |
231,309 | def get_vec_lr ( self ) : return self . width * self . cos_a ( ) , - self . width * self . sin_a ( ) | Returns vector from left to right |
231,310 | def get_vec_tb ( self ) : return self . height * self . sin_a ( ) , self . height * self . cos_a ( ) | Returns vector from top to bottom |
231,311 | def get_center ( self ) : lr_x , lr_y = self . get_vec_lr ( ) tb_x , tb_y = self . get_vec_tb ( ) center_x = self . x + ( lr_x + tb_x ) / 2.0 center_y = self . y + ( lr_y + tb_y ) / 2.0 return center_x , center_y | Returns rectangle center |
231,312 | def get_edges ( self ) : lr_x , lr_y = self . get_vec_lr ( ) tb_x , tb_y = self . get_vec_tb ( ) top_left = self . x , self . y top_right = self . x + lr_x , self . y + lr_y bottom_left = self . x + tb_x , self . y + tb_y bottom_right = self . x + lr_x + tb_x , self . y + lr_y + tb_y return top_left , top_right , botto... | Returns 2 - tuples for each edge |
231,313 | def collides_axisaligned_rect ( self , other ) : self_shifted = RotoOriginRect ( self . width , self . height , - self . angle ) s_a = self . sin_a ( ) c_a = self . cos_a ( ) center_x = self . x + self . width / 2.0 * c_a - self . height / 2.0 * s_a center_y = self . y - self . height / 2.0 * c_a - self . width / 2.0 *... | Returns collision with axis aligned other rect |
231,314 | def get_paths ( self , theme , icon_size ) : _size_str = "x" . join ( map ( str , icon_size ) ) theme_path = get_program_path ( ) + "share" + os . sep + "icons" + os . sep icon_path = theme_path + theme + os . sep + _size_str + os . sep action_path = icon_path + "actions" + os . sep toggle_path = icon_path + "toggles" ... | Returns tuple of theme icon action and toggle paths |
231,315 | def CreateBitmap ( self , artid , client , size ) : if artid in self . extra_icons : return wx . Bitmap ( self . extra_icons [ artid ] , wx . BITMAP_TYPE_ANY ) else : return wx . ArtProvider . GetBitmap ( artid , client , size ) | Adds custom images to Artprovider |
231,316 | def set_initial_state ( self , kwargs ) : self . main_window = kwargs . pop ( "main_window" ) try : statustext = kwargs . pop ( "statustext" ) except KeyError : statustext = "" try : self . total_lines = kwargs . pop ( "total_lines" ) self . statustext = statustext + _ ( "{nele} of {totalele} elements processed." ) exc... | Sets class state from kwargs attributes pops extra kwargs |
231,317 | def progress_status ( self ) : if self . line % self . freq == 0 : text = self . statustext . format ( nele = self . line , totalele = self . total_lines ) if self . main_window . grid . actions . pasting : try : post_command_event ( self . main_window , self . main_window . StatusBarMsg , text = text ) except TypeErro... | Displays progress in statusbar |
231,318 | def on_key ( self , event ) : if self . main_window . grid . actions . pasting and event . GetKeyCode ( ) == wx . WXK_ESCAPE : self . aborted = True event . Skip ( ) | Sets aborted state if escape is pressed |
231,319 | def _get_tables ( self , ods ) : childnodes = ods . spreadsheet . childNodes qname_childnodes = [ ( s . qname [ 1 ] , s ) for s in childnodes ] return [ node for name , node in qname_childnodes if name == u"table" ] | Returns list of table nodes from ods object |
231,320 | def _get_rows ( self , table ) : childnodes = table . childNodes qname_childnodes = [ ( s . qname [ 1 ] , s ) for s in childnodes ] return [ node for name , node in qname_childnodes if name == u'table-row' ] | Returns rows from table |
231,321 | def _get_cells ( self , row ) : childnodes = row . childNodes qname_childnodes = [ ( s . qname [ 1 ] , s ) for s in childnodes ] return [ node for name , node in qname_childnodes if name == u'table-cell' ] | Returns rows from row |
231,322 | def _ods2code ( self ) : ods = ODSReader ( self . ods_file , clonespannedcolumns = True ) tables = ods . sheets for tab_id , table in enumerate ( tables ) : for row_id in xrange ( len ( table ) ) : for col_id in xrange ( len ( table [ row_id ] ) ) : key = row_id , col_id , tab_id text = unicode ( table [ row_id ] [ col... | Updates code in code_array |
231,323 | def pyspread ( S = None ) : app = MainApplication ( S = S , redirect = False ) app . MainLoop ( ) | Holds application main loop |
231,324 | def readSheet ( self , sheet ) : name = sheet . getAttribute ( "name" ) rows = sheet . getElementsByType ( TableRow ) arrRows = [ ] for row in rows : row_comment = "" arrCells = GrowingList ( ) cells = row . getElementsByType ( TableCell ) count = 0 for cell in cells : repeat = cell . getAttribute ( "numbercolumnsrepea... | Reads a sheet in the sheet dictionary |
231,325 | def sniff ( filepath ) : with open ( filepath , "rb" ) as csvfile : sample = csvfile . read ( config [ "sniff_size" ] ) sniffer = csv . Sniffer ( ) dialect = sniffer . sniff ( sample ) ( ) has_header = sniffer . has_header ( sample ) return dialect , has_header | Sniffs CSV dialect and header info from csvfilepath |
231,326 | def get_first_line ( filepath , dialect ) : with open ( filepath , "rb" ) as csvfile : csvreader = csv . reader ( csvfile , dialect = dialect ) for first_line in csvreader : break return first_line | Returns List of first line items of file filepath |
231,327 | def digested_line ( line , digest_types ) : digested_line = [ ] for i , ele in enumerate ( line ) : try : digest_key = digest_types [ i ] except IndexError : digest_key = digest_types [ 0 ] digest = Digest ( acceptable_types = [ digest_key ] ) try : digested_line . append ( repr ( digest ( ele ) ) ) except Exception : ... | Returns list of digested values in line |
231,328 | def csv_digest_gen ( filepath , dialect , has_header , digest_types ) : with open ( filepath , "rb" ) as csvfile : csvreader = csv . reader ( csvfile , dialect = dialect ) if has_header : for line in csvreader : break for line in csvreader : yield digested_line ( line , digest_types ) | Generator of digested values from csv file in filepath |
231,329 | def cell_key_val_gen ( iterable , shape , topleft = ( 0 , 0 ) ) : top , left = topleft for __row , line in enumerate ( iterable ) : row = top + __row if row >= shape [ 0 ] : break for __col , value in enumerate ( line ) : col = left + __col if col >= shape [ 1 ] : break yield row , col , value | Generator of row col value tuple from iterable of iterables |
231,330 | def encode_gen ( line , encoding = "utf-8" ) : for ele in line : if isinstance ( ele , types . UnicodeType ) : yield ele . encode ( encoding ) else : yield ele | Encodes all Unicode strings in line to encoding |
231,331 | def _get_csv_cells_gen ( self , line ) : digest_types = self . digest_types for j , value in enumerate ( line ) : if self . first_line : digest_key = None digest = lambda x : x . decode ( self . encoding ) else : try : digest_key = digest_types [ j ] except IndexError : digest_key = digest_types [ 0 ] digest = Digest (... | Generator of values in a csv line |
231,332 | def write ( self , iterable ) : io_error_text = _ ( "Error writing to file {filepath}." ) io_error_text = io_error_text . format ( filepath = self . path ) try : with open ( self . path , "wb" ) as csvfile : csv_writer = csv . writer ( csvfile , self . dialect ) for line in iterable : csv_writer . writerow ( list ( enc... | Writes values from iterable into CSV file |
231,333 | def _shape2xls ( self , worksheets ) : __ , __ , tabs = self . code_array . shape if tabs > self . xls_max_tabs : tabs = self . xls_max_tabs for tab in xrange ( tabs ) : worksheet = self . workbook . add_sheet ( str ( tab ) ) worksheets . append ( worksheet ) | Writes shape to xls file |
231,334 | def _code2xls ( self , worksheets ) : code_array = self . code_array xls_max_shape = self . xls_max_rows , self . xls_max_cols , self . xls_max_tabs for key in code_array : if all ( kele < mele for kele , mele in zip ( key , xls_max_shape ) ) : row , col , tab = key code_str = code_array ( key ) if code_str is not None... | Writes code to xls file |
231,335 | def _xls2code ( self , worksheet , tab ) : def xlrddate2datetime ( xlrd_date ) : try : xldate_tuple = xlrd . xldate_as_tuple ( xlrd_date , self . workbook . datemode ) return datetime ( xldate_tuple ) except ( ValueError , TypeError ) : return '' type2mapper = { 0 : lambda x : None , 1 : lambda x : str ( x ) , 2 : lamb... | Updates code in xls code_array |
231,336 | def _get_font ( self , pys_style ) : if "textfont" not in pys_style : return font = xlwt . Font ( ) font . name = pys_style [ "textfont" ] if "pointsize" in pys_style : font . height = pys_style [ "pointsize" ] * 20.0 if "fontweight" in pys_style : font . bold = ( pys_style [ "fontweight" ] == wx . BOLD ) if "fontstyle... | Returns xlwt . Font for pyspread style |
231,337 | def _get_alignment ( self , pys_style ) : alignment_styles = [ "justification" , "vertical_align" , "angle" ] if not any ( astyle in pys_style for astyle in alignment_styles ) : return def angle2xfrotation ( angle ) : if 0 <= angle <= 90 : return angle elif - 90 <= angle < 0 : return 90 - angle return 0 justification2x... | Returns xlwt . Alignment for pyspread style |
231,338 | def _get_pattern ( self , pys_style ) : if "bgcolor" not in pys_style : return pattern = xlwt . Pattern ( ) pattern . pattern = xlwt . Pattern . SOLID_PATTERN bgcolor = wx . Colour ( ) bgcolor . SetRGB ( pys_style [ "bgcolor" ] ) pattern . pattern_fore_colour = self . color2idx ( * bgcolor . Get ( ) ) return pattern | Returns xlwt . pattern for pyspread style |
231,339 | def _get_borders ( self , pys_style , pys_style_above , pys_style_left ) : border_keys = [ "borderwidth_right" , "borderwidth_bottom" , "bordercolor_right" , "bordercolor_bottom" , ] if not any ( border_key in pys_style for border_key in border_keys ) : return def width2border_line_style ( width ) : if width == 0 : ret... | Returns xlwt . Borders for pyspread style |
231,340 | def _get_xfstyle ( self , worksheets , key ) : row , col , tab = key dict_grid = self . code_array . dict_grid dict_grid . cell_attributes . _update_table_cache ( ) pys_style = dict_grid . cell_attributes [ key ] pys_style_above = dict_grid . cell_attributes [ row - 1 , col , tab ] pys_style_left = dict_grid . cell_att... | Gets XFStyle for cell key |
231,341 | def _cell_attribute_append ( self , selection , tab , attributes ) : cell_attributes = self . code_array . cell_attributes thick_bottom_cells = [ ] thick_right_cells = [ ] if "borderwidth_bottom" in attributes : bwidth = attributes [ "borderwidth_bottom" ] for row , col in selection . cells : __bwidth = cell_attributes... | Appends to cell_attributes with checks |
231,342 | def _row_heights2xls ( self , worksheets ) : xls_max_rows , xls_max_tabs = self . xls_max_rows , self . xls_max_tabs dict_grid = self . code_array . dict_grid for row , tab in dict_grid . row_heights : if row < xls_max_rows and tab < xls_max_tabs : height_pixels = dict_grid . row_heights [ ( row , tab ) ] height_inches... | Writes row_heights to xls file |
231,343 | def pys_width2xls_width ( self , pys_width ) : width_0 = get_default_text_extent ( "0" ) [ 0 ] width_0_char = pys_width * 1.2 / width_0 return int ( width_0_char * 256.0 ) | Returns xls width from given pyspread width |
231,344 | def _col_widths2xls ( self , worksheets ) : xls_max_cols , xls_max_tabs = self . xls_max_cols , self . xls_max_tabs dict_grid = self . code_array . dict_grid for col , tab in dict_grid . col_widths : if col < xls_max_cols and tab < xls_max_tabs : pys_width = dict_grid . col_widths [ ( col , tab ) ] xls_width = self . p... | Writes col_widths to xls file |
231,345 | def from_code_array ( self ) : worksheets = [ ] self . _shape2xls ( worksheets ) self . _code2xls ( worksheets ) self . _row_heights2xls ( worksheets ) self . _col_widths2xls ( worksheets ) return self . workbook | Returns xls workbook object with everything from code_array |
231,346 | def to_code_array ( self ) : self . _xls2shape ( ) worksheets = self . workbook . sheet_names ( ) for tab , worksheet_name in enumerate ( worksheets ) : worksheet = self . workbook . sheet_by_name ( worksheet_name ) self . _xls2code ( worksheet , tab ) self . _xls2attributes ( worksheet , tab ) self . _xls2row_heights ... | Replaces everything in code_array from xls_file |
231,347 | def _split_tidy ( self , string , maxsplit = None ) : if maxsplit is None : return string . rstrip ( "\n" ) . split ( "\t" ) else : return string . rstrip ( "\n" ) . split ( "\t" , maxsplit ) | Rstrips string for \ n and splits string for \ t |
231,348 | def _pys_assert_version ( self , line ) : if float ( line . strip ( ) ) > 1.0 : msg = _ ( "File version {version} unsupported (>1.0)." ) . format ( version = line . strip ( ) ) raise ValueError ( msg ) | Asserts pys file version |
231,349 | def _shape2pys ( self ) : shape_line = u"\t" . join ( map ( unicode , self . code_array . shape ) ) + u"\n" self . pys_file . write ( shape_line ) | Writes shape to pys file |
231,350 | def _code2pys ( self ) : for key in self . code_array : key_str = u"\t" . join ( repr ( ele ) for ele in key ) code_str = self . code_array ( key ) if code_str is not None : out_str = key_str + u"\t" + code_str + u"\n" self . pys_file . write ( out_str . encode ( "utf-8" ) ) | Writes code to pys file |
231,351 | def _pys2code ( self , line ) : row , col , tab , code = self . _split_tidy ( line , maxsplit = 3 ) key = self . _get_key ( row , col , tab ) self . code_array . dict_grid [ key ] = unicode ( code , encoding = 'utf-8' ) | Updates code in pys code_array |
231,352 | def _attributes2pys ( self ) : purged_cell_attributes = [ ] purged_cell_attributes_keys = [ ] for selection , tab , attr_dict in self . code_array . cell_attributes : if purged_cell_attributes_keys and ( selection , tab ) == purged_cell_attributes_keys [ - 1 ] : purged_cell_attributes [ - 1 ] [ 2 ] . update ( attr_dict... | Writes attributes to pys file |
231,353 | def _row_heights2pys ( self ) : for row , tab in self . code_array . dict_grid . row_heights : if row < self . code_array . shape [ 0 ] and tab < self . code_array . shape [ 2 ] : height = self . code_array . dict_grid . row_heights [ ( row , tab ) ] height_strings = map ( repr , [ row , tab , height ] ) self . pys_fil... | Writes row_heights to pys file |
231,354 | def _col_widths2pys ( self ) : for col , tab in self . code_array . dict_grid . col_widths : if col < self . code_array . shape [ 1 ] and tab < self . code_array . shape [ 2 ] : width = self . code_array . dict_grid . col_widths [ ( col , tab ) ] width_strings = map ( repr , [ col , tab , width ] ) self . pys_file . wr... | Writes col_widths to pys file |
231,355 | def _macros2pys ( self ) : macros = self . code_array . dict_grid . macros pys_macros = macros . encode ( "utf-8" ) self . pys_file . write ( pys_macros ) | Writes macros to pys file |
231,356 | def _pys2macros ( self , line ) : if self . code_array . dict_grid . macros and self . code_array . dict_grid . macros [ - 1 ] != "\n" : self . code_array . dict_grid . macros += "\n" self . code_array . dict_grid . macros += line . decode ( "utf-8" ) | Updates macros in code_array |
231,357 | def _fonts2pys ( self ) : system_fonts = font_manager . findSystemFonts ( ) font_name2font_file = { } for sys_font in system_fonts : font_name = font_manager . FontProperties ( fname = sys_font ) . get_name ( ) if font_name in self . fonts_used : font_name2font_file [ font_name ] = sys_font for font_name in font_name2f... | Writes fonts to pys file |
231,358 | def _pys2fonts ( self , line ) : font_name , ascii_font_data = self . _split_tidy ( line ) font_data = base64 . b64decode ( ascii_font_data ) system_fonts = font_manager . findSystemFonts ( ) system_font_names = [ ] for sys_font in system_fonts : system_font_names . append ( font_manager . FontProperties ( fname = sys_... | Updates custom font list |
231,359 | def from_code_array ( self ) : for key in self . _section2writer : self . pys_file . write ( key ) self . _section2writer [ key ] ( ) try : if self . pys_file . aborted : break except AttributeError : pass if config [ "font_save_enabled" ] : self . fonts_used = [ ] | Replaces everything in pys_file from code_array |
231,360 | def to_code_array ( self ) : state = None first_line = True self . pys_file . seek ( 0 ) for line in self . pys_file : if first_line : if line == "[Pyspread save file version]\n" : first_line = False else : raise ValueError ( _ ( "File format unsupported." ) ) if line in self . _section2reader : state = line elif state... | Replaces everything in code_array from pys_file |
231,361 | def _style ( self ) : self . fold_symbols = 2 self . faces = { 'times' : 'Times' , 'mono' : 'Courier' , 'helv' : wx . SystemSettings . GetFont ( wx . SYS_DEFAULT_GUI_FONT ) . GetFaceName ( ) , 'other' : 'new century schoolbook' , 'size' : 10 , 'size2' : 8 , } white = "white" gray = "#404040" self . fold_symbol_style = ... | Set editor style |
231,362 | def OnUpdateUI ( self , evt ) : brace_at_caret = - 1 brace_opposite = - 1 char_before = None caret_pos = self . GetCurrentPos ( ) if caret_pos > 0 : char_before = self . GetCharAt ( caret_pos - 1 ) style_before = self . GetStyleAt ( caret_pos - 1 ) if char_before and chr ( char_before ) in "[]{}()" and style_before == ... | Syntax highlighting while editing |
231,363 | def OnMarginClick ( self , evt ) : if evt . GetMargin ( ) == 2 : if evt . GetShift ( ) and evt . GetControl ( ) : self . fold_all ( ) else : line_clicked = self . LineFromPosition ( evt . GetPosition ( ) ) if self . GetFoldLevel ( line_clicked ) & stc . STC_FOLDLEVELHEADERFLAG : if evt . GetShift ( ) : self . SetFoldEx... | When clicked old and unfold as needed |
231,364 | def expand ( self , line , do_expand , force = False , vislevels = 0 , level = - 1 ) : lastchild = self . GetLastChild ( line , level ) line += 1 while line <= lastchild : if force : if vislevels > 0 : self . ShowLines ( line , line ) else : self . HideLines ( line , line ) elif do_expand : self . ShowLines ( line , li... | Multi - purpose expand method from original STC class |
231,365 | def OnDrawBackground ( self , dc , rect , item , flags ) : if ( item & 1 == 0 or flags & ( wx . combo . ODCB_PAINTING_CONTROL | wx . combo . ODCB_PAINTING_SELECTED ) ) : try : wx . combo . OwnerDrawnComboBox . OnDrawBackground ( self , dc , rect , item , flags ) finally : return bg_color = get_color ( config [ "label_c... | Called for drawing the background area of each item |
231,366 | def get_style_code ( self , label ) : for style in self . styles : if style [ 0 ] == label : return style [ 1 ] msg = _ ( "Label {label} is invalid." ) . format ( label = label ) raise ValueError ( msg ) | Returns code for given label string |
231,367 | def get_label ( self , code ) : for style in self . styles : if style [ 1 ] == code : return style [ 0 ] msg = _ ( "Code {code} is invalid." ) . format ( code = code ) raise ValueError ( msg ) | Returns string label for given code string |
231,368 | def toggle ( self , event ) : if self . state < len ( self . bitmap_list ) - 1 : self . state += 1 else : self . state = 0 self . SetBitmapLabel ( self . bitmap_list [ self . state ] ) try : event . Skip ( ) except AttributeError : pass setattr ( self , "GetToolState" , lambda x : self . state ) | Toggles state to next bitmap |
231,369 | def OnToggle ( self , event ) : if self . selection_toggle_button . GetValue ( ) : self . entry_line . last_selection = self . entry_line . GetSelection ( ) self . entry_line . last_selection_string = self . entry_line . GetStringSelection ( ) self . entry_line . last_table = self . main_window . grid . current_table s... | Toggle button event handler |
231,370 | def OnContentChange ( self , event ) : self . ignore_changes = True self . SetValue ( u"" if event . text is None else event . text ) self . ignore_changes = False event . Skip ( ) | Event handler for updating the content |
231,371 | def OnGridSelection ( self , event ) : current_table = copy ( self . main_window . grid . current_table ) post_command_event ( self , self . GridActionTableSwitchMsg , newtable = self . last_table ) if is_gtk ( ) : try : wx . Yield ( ) except : pass sel_start , sel_stop = self . last_selection shape = self . main_windo... | Event handler for grid selection in selection mode adds text |
231,372 | def OnText ( self , event ) : if not self . ignore_changes : post_command_event ( self , self . CodeEntryMsg , code = event . GetString ( ) ) self . main_window . grid . grid_renderer . cell_cache . clear ( ) event . Skip ( ) | Text event method evals the cell and updates the grid |
231,373 | def OnChar ( self , event ) : if not self . ignore_changes : keycode = event . GetKeyCode ( ) if keycode == 13 and not self . GetStringSelection ( ) : self . main_window . grid . SetFocus ( ) if event . ControlDown ( ) : self . SetValue ( quote ( self . GetValue ( ) ) ) return elif keycode == 13 and self . GetStringSel... | Key event method |
231,374 | def Reposition ( self ) : rect = self . GetFieldRect ( 1 ) self . safemode_staticbmp . SetPosition ( ( rect . x , rect . y ) ) self . size_changed = False | Reposition the checkbox |
231,375 | def change_max ( self , no_tabs ) : self . no_tabs = no_tabs if self . GetValue ( ) >= no_tabs : self . SetValue ( no_tabs - 1 ) | Updates to a new number of tables |
231,376 | def _fromGUI ( self , value ) : if value == '' : if not self . IsNoneAllowed ( ) : return 0 else : return else : try : return int ( value ) except ValueError : if self . IsLongAllowed ( ) : try : return long ( value ) except ValueError : wx . TextCtrl . SetValue ( self , "0" ) return 0 else : raise | Conversion function used in getting the value of the control . |
231,377 | def OnInt ( self , event ) : value = event . GetValue ( ) current_time = time . clock ( ) if current_time < self . last_change_s + 0.01 : return self . last_change_s = current_time self . cursor_pos = wx . TextCtrl . GetInsertionPoint ( self ) + 1 if event . GetValue ( ) > self . no_tabs - 1 : value = self . no_tabs - ... | IntCtrl event method that updates the current table |
231,378 | def OnItemSelected ( self , event ) : value = event . m_itemIndex self . startIndex = value self . switching = True post_command_event ( self , self . GridActionTableSwitchMsg , newtable = value ) self . switching = False event . Skip ( ) | Item selection event handler |
231,379 | def OnResizeGrid ( self , event ) : shape = min ( event . shape [ 2 ] , 2 ** 30 ) self . SetItemCount ( shape ) event . Skip ( ) | Event handler for grid resizing |
231,380 | def OnMouseUp ( self , event ) : if not self . IsInControl : self . IsDrag = False elif self . IsDrag : if not self . IsDrag : self . hitIndex = self . HitTest ( event . GetPosition ( ) ) self . dropIndex = self . hitIndex [ 0 ] if not ( self . dropIndex == self . startIndex or self . dropIndex == - 1 ) : dropList = [ ... | Generate a dropIndex . |
231,381 | def _set_properties ( self ) : self . set_icon ( icons [ "PyspreadLogo" ] ) self . minSizeSet = False post_command_event ( self , self . SafeModeExitMsg ) | Setup title icon size scale statusbar main grid |
231,382 | def _set_menu_toggles ( self ) : toggles = [ ( self . main_toolbar , "main_window_toolbar" , _ ( "Main toolbar" ) ) , ( self . macro_toolbar , "macro_toolbar" , _ ( "Macro toolbar" ) ) , ( self . macro_panel , "macro_panel" , _ ( "Macro panel" ) ) , ( self . attributes_toolbar , "attributes_toolbar" , _ ( "Format toolb... | Enable menu bar view item checkmarks |
231,383 | def set_icon ( self , bmp ) : _icon = wx . EmptyIcon ( ) _icon . CopyFromBitmap ( bmp ) self . SetIcon ( _icon ) | Sets main window icon to given wx . Bitmap |
231,384 | def OnToggleFullscreen ( self , event ) : is_full_screen = self . main_window . IsFullScreen ( ) if is_full_screen : try : self . main_window . grid . SetRowLabelSize ( self . row_label_size ) self . main_window . grid . SetColLabelSize ( self . col_label_size ) except AttributeError : pass try : self . main_window . _... | Fullscreen event handler |
231,385 | def OnContentChanged ( self , event ) : self . main_window . grid . update_attribute_toolbar ( ) title = self . main_window . GetTitle ( ) if undo . stack ( ) . haschanged ( ) : if title [ : 2 ] != "* " : new_title = "* " + title post_command_event ( self . main_window , self . main_window . TitleMsg , text = new_title... | Titlebar star adjustment event handler |
231,386 | def OnSafeModeEntry ( self , event ) : self . main_window . main_menu . enable_file_approve ( True ) self . main_window . grid . Refresh ( ) event . Skip ( ) | Safe mode entry event handler |
231,387 | def OnSafeModeExit ( self , event ) : self . main_window . main_menu . enable_file_approve ( False ) self . main_window . grid . Refresh ( ) event . Skip ( ) | Safe mode exit event handler |
231,388 | def OnClose ( self , event ) : if undo . stack ( ) . haschanged ( ) : save_choice = self . interfaces . get_save_request_from_user ( ) if save_choice is None : return elif save_choice : post_command_event ( self . main_window , self . main_window . SaveMsg ) config [ "window_layout" ] = repr ( self . main_window . _mgr... | Program exit event handler |
231,389 | def OnSpellCheckToggle ( self , event ) : spelltoolid = self . main_window . main_toolbar . label2id [ "CheckSpelling" ] self . main_window . main_toolbar . ToggleTool ( spelltoolid , not config [ "check_spelling" ] ) config [ "check_spelling" ] = repr ( not config [ "check_spelling" ] ) self . main_window . grid . gri... | Spell checking toggle event handler |
231,390 | def OnPreferences ( self , event ) : preferences = self . interfaces . get_preferences_from_user ( ) if preferences : for key in preferences : if type ( config [ key ] ) in ( type ( u"" ) , type ( "" ) ) : config [ key ] = preferences [ key ] else : config [ key ] = ast . literal_eval ( preferences [ key ] ) self . mai... | Preferences event handler that launches preferences dialog |
231,391 | def OnNewGpgKey ( self , event ) : if gnupg is None : return if genkey is None : self . interfaces . display_warning ( _ ( "Python gnupg not found. No key selected." ) , _ ( "Key selection failed." ) ) else : genkey ( ) | New GPG key event handler . |
231,392 | def _toggle_pane ( self , pane ) : if pane . IsShown ( ) : pane . Hide ( ) else : pane . Show ( ) self . main_window . _mgr . Update ( ) | Toggles visibility of given aui pane |
231,393 | def OnMainToolbarToggle ( self , event ) : self . main_window . main_toolbar . SetGripperVisible ( True ) main_toolbar_info = self . main_window . _mgr . GetPane ( "main_window_toolbar" ) self . _toggle_pane ( main_toolbar_info ) event . Skip ( ) | Main window toolbar toggle event handler |
231,394 | def OnMacroToolbarToggle ( self , event ) : self . main_window . macro_toolbar . SetGripperVisible ( True ) macro_toolbar_info = self . main_window . _mgr . GetPane ( "macro_toolbar" ) self . _toggle_pane ( macro_toolbar_info ) event . Skip ( ) | Macro toolbar toggle event handler |
231,395 | def OnWidgetToolbarToggle ( self , event ) : self . main_window . widget_toolbar . SetGripperVisible ( True ) widget_toolbar_info = self . main_window . _mgr . GetPane ( "widget_toolbar" ) self . _toggle_pane ( widget_toolbar_info ) event . Skip ( ) | Widget toolbar toggle event handler |
231,396 | def OnAttributesToolbarToggle ( self , event ) : self . main_window . attributes_toolbar . SetGripperVisible ( True ) attributes_toolbar_info = self . main_window . _mgr . GetPane ( "attributes_toolbar" ) self . _toggle_pane ( attributes_toolbar_info ) event . Skip ( ) | Format toolbar toggle event handler |
231,397 | def OnFindToolbarToggle ( self , event ) : self . main_window . find_toolbar . SetGripperVisible ( True ) find_toolbar_info = self . main_window . _mgr . GetPane ( "find_toolbar" ) self . _toggle_pane ( find_toolbar_info ) event . Skip ( ) | Search toolbar toggle event handler |
231,398 | def OnEntryLineToggle ( self , event ) : entry_line_panel_info = self . main_window . _mgr . GetPane ( "entry_line_panel" ) self . _toggle_pane ( entry_line_panel_info ) event . Skip ( ) | Entry line toggle event handler |
231,399 | def OnTableListToggle ( self , event ) : table_list_panel_info = self . main_window . _mgr . GetPane ( "table_list_panel" ) self . _toggle_pane ( table_list_panel_info ) event . Skip ( ) | Table list toggle event handler |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.