#1 apbs_tools.py incompatible with tk 8.6

open
nobody
None
5
2013-08-20
2013-03-03
Jack Howarth
No

The current apbs_tools.py in pymol svn is incompatible with tk 8.6 (which MacPorts has migrated to). The plugin crashes with the backtrace...

<class '_tkinter.TclError'> Exception in Tk callback
Function: <function <lambda> at 0x110428b18> (type: <type 'function'>)
Args: ()
Traceback (innermost last):
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Pmw/Pmw_1_3_3/lib/PmwBase.py", line 1753, in __call__
return apply(self.func, args)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/pmg_tk/startup/apbs_tools.py", line 265, in <lambda>
command = lambda s=self: APBSTools2(s))
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/pmg_tk/startup/apbs_tools.py", line 628, in __init__
group.pack(fill='both',expand=1, padx=4, pady=5)
File "<string>", line 1, in pack
None
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-tk/Tkinter.py", line 1764, in pack_configure
+ self._options(cnf, kw))
<class '_tkinter.TclError'>: cannot use geometry manager pack inside .4536167960.4536169608.4536322240.4536485288 which already has slaves managed by grid

which seems to be the same issue described in this thread...

https://groups.google.com/forum/?fromgroups=#!topic/comp.lang.tcl/ncxQEhQ81TI

on the topic 'Again "cannot use geometry manager pack inside ..." '

This issue can be reproduced with the following steps...

1) Install MacPorts
2) sudo port -d selfupdate
3) sudo port -d install pymol
4) execute 'pymol' and then select the APBS Tools2 menu item from the Plugins menu.

I have upgraded the MacPorts py-pmw package locally to 1.3.3a which passes all if its demos under tcl/tk 8.5.13. This
particular crash isn't triiggered by any of the pmw demos so hopefully it can be worked around within abs-tools.py itself.

Discussion

  • Jack Howarth
    Jack Howarth
    2013-03-03

    Changing....
    --- /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/pmg_tk/startup/apbs_tools.py.orig 2013-03-03 14:37:58.000000000 -0500
    +++ /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/pmg_tk/startup/apbs_tools.py 2013-03-03 14:40:52.000000000 -0500
    @@ -625,7 +625,7 @@
    #entry.pack(side='left',fill='both',expand=1,padx=4) # side-by-side
    entry.pack(fill='x',expand=1,padx=4,pady=1) # vertical
    group = Pmw.Group(page,tag_text='Other')
    - group.pack(fill='both',expand=1, padx=4, pady=5)
    + #group.pack(fill='both',expand=1, padx=4, pady=5)
    group.grid(column=1, row=1,columnspan=4)
    self.max_mem_allowed = Pmw.EntryField(group.interior(),labelpos='w',
    label_text = 'Maximum Memory Allowed (MB):',
    @@ -683,7 +683,7 @@

    group = Pmw.Group(page,tag_text='Ions')
    - group.pack(fill='both',expand=1, padx=4, pady=5)
    + #group.pack(fill='both',expand=1, padx=4, pady=5)
    group.grid(column=0, row=1, )
    self.ion_plus_one_conc = Pmw.EntryField(group.interior(),
    labelpos='w',
    @@ -742,7 +742,7 @@
    entry.pack(fill='x',expand=1,padx=4)

    group = Pmw.Group(page,tag_text = 'Coarse Mesh Length')
    - group.pack(fill = 'both', expand = 1, padx = 4, pady = 5)
    + #group.pack(fill = 'both', expand = 1, padx = 4, pady = 5)
    group.grid(column = 1, row = 0)
    for coord in 'x y z'.split():
    setattr(self,'grid_coarse_%s'%coord,Pmw.EntryField(group.interior(),
    @@ -757,7 +757,7 @@

    group = Pmw.Group(page,tag_text = 'Fine Mesh Length')
    - group.pack(fill = 'both', expand = 1, padx = 4, pady = 5)
    + #group.pack(fill = 'both', expand = 1, padx = 4, pady = 5)
    group.grid(column = 2, row = 0)
    for coord in 'x y z'.split():
    setattr(self,'grid_fine_%s'%coord,Pmw.EntryField(group.interior(),
    @@ -772,7 +772,7 @@

    group = Pmw.Group(page,tag_text = 'Grid Center')
    - group.pack(fill = 'both', expand = 1, padx = 4, pady = 5)
    + #group.pack(fill = 'both', expand = 1, padx = 4, pady = 5)
    group.grid(column = 3, row = 0)
    for coord in 'x y z'.split():
    setattr(self,'grid_center_%s'%coord,Pmw.EntryField(group.interior(),
    @@ -786,7 +786,7 @@
    getattr(self,'grid_center_%s'%coord).pack(fill='x', expand=1, padx=4, pady=1)

    group = Pmw.Group(page,tag_text = 'Grid Points')
    - group.pack(fill = 'both', expand = 1, padx = 4, pady = 5)
    + #group.pack(fill = 'both', expand = 1, padx = 4, pady = 5)
    group.grid(column = 4, row = 0)
    for coord in 'x y z'.split():
    setattr(self,'grid_points_%s'%coord,Pmw.EntryField(group.interior(),

    suppresses the crashes on opening APBS Tools2 in pymol 1.5 but additional compatibility issues remain. If a pdb is opened and pymol is used to create the pqr, when the "set grid" button is clicked, python crashes with...

    Process: Python [7398]
    Path: /opt/local/Library/Frameworks/Python.framework/Versions/2.6/Resources/Python.app/Contents/MacOS/Python
    Identifier: Python
    Version: ??? (???)
    Code Type: X86-64 (Native)
    Parent Process: tcsh [7299]

    Date/Time: 2013-03-03 14:45:58.488 -0500
    OS Version: Mac OS X 10.7.5 (11G63)
    Report Version: 9

    Interval Since Last Report: 48114 sec
    Crashes Since Last Report: 8
    Per-App Crashes Since Last Report: 8
    Anonymous UUID: F80C0861-27BA-46A8-80EE-F7A7D9CF3CB4

    Crashed Thread: 2

    Exception Type: EXC_BAD_ACCESS (SIGSEGV)
    Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000000

    VM Regions Near 0:
    -->
    __TEXT 000000010ff09000-000000010ff0a000 [ 4K] r-x/rwx SM=COW /opt/local/Library/Frameworks/Python.framework/Versions/2.6/Resources/Python.app/Contents/MacOS/Python

    Application Specific Information:
    objc[7398]: garbage collection is OFF

     
  • Jack Howarth
    Jack Howarth
    2013-08-20

    The attached patch appears to produce an apbstools plugin which is functional under tcl/tk 8.6.0. Note that blt requires the additional patch for tcl/tk 8.6 from FreeBSD...

    http://svnweb.freebsd.org/ports/head/x11-toolkits/blt/files/patch-newertcl?revision=300897&view=markup

    such that blt is built against the tcl/tk 8.6 internal headers (which have to be manually copied into the blt src subdirectory). Without this patch, the apbstool plugin segfaults in blt when clicking on the "Choose Externally Generated PQR" button. The internal data structures and calls in tcl/tk has forked too far from the original ones embedded in blt's sources.

     
  • Jack Howarth
    Jack Howarth
    2013-08-20

    Note that the apbstools plugin should really settle on using the grid manager and deprecate the use of the pack manager. Using both for the same window is unsupported as it can cause race conditions, etc.