Changeset 6f16e25 in sasview for sasview


Ignore:
Timestamp:
Oct 21, 2015 8:35:00 AM (9 years ago)
Author:
Paul Kienzle <pkienzle@…>
Branches:
master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
85130cb
Parents:
2d88fc4
Message:

clean up wx id handling in fitting perspective

Location:
sasview
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sasview/sasview.py

    r6f3fea2 r6f16e25  
    7575    logging.error("Wx version: error reading version") 
    7676 
    77 #from . import wxcruft 
    78 #wxcruft.call_later_fix() 
     77from . import wxcruft 
     78wxcruft.call_later_fix() 
    7979#wxcruft.trace_new_id() 
    8080 
  • sasview/wxcruft.py

    r2d88fc4 r6f16e25  
    1515def NewId(): 
    1616    id = wx._misc.NewId() 
    17     frame = inspect.stack()[1] 
     17    path, line, function = _get_caller() 
     18    if path == "sas/guiframe/utils.py": 
     19        # Special case: NewId is being called via an IdList request; we 
     20        # want to which widget triggered the request, not that it was 
     21        # triggered via IdList. 
     22        path, line, function = _get_caller(2) 
     23        tag = " via IdList" 
     24    elif path.endswith("/wxcruft.py"): 
     25        # Special case: NewId is being called via CallLater; we want to 
     26        # know where the CallLater was invoked. 
     27        path, line, function = _get_caller(1) 
     28        tag = " via CallLater" 
     29    else: 
     30        tag = "" 
     31    print "NewId %d from %s(%d):%s%s"%(id, path, line, function, tag) 
     32    return id 
     33 
     34def _get_caller(distance=0): 
     35    frame = inspect.stack()[distance+2] 
    1836    path = frame[1] 
    1937    index = path.find('/sas/') 
    2038    if index == -1: index = path.find('\\sas\\') 
    21     path = path[index+1:] 
    22     print "NewId %d from %s(%d):%s"%(id, path, frame[2], frame[3]) 
    23     return id 
     39    return path[index+1:], frame[2], frame[3] 
     40 
    2441 
    2542 
Note: See TracChangeset for help on using the changeset viewer.