Opened 6 years ago

Closed 6 years ago

#2134 closed defect (fixed)

'main_view' needs to register itself as a state manager

Reported by: tic20@… Owned by: Eric Pettersen
Priority: normal Milestone:
Component: Sessions Version:
Keywords: Cc:
Blocked By: Blocking:
Notify when closed: Platform: all
Project: ChimeraX

Description

The following bug report has been submitted:
Platform:        Darwin-18.6.0-x86_64-i386-64bit
ChimeraX Version: 0.91 (2019-06-28)
Description
From looking at session.py it looks like I should now be using `session.main_view` rather than `session.view`, but the latter is currently broken entirely. Will it be going away, or acting as a synonym for main_view?

Log:
UCSF ChimeraX version: 0.91 (2019-06-28)  
© 2016-2019 Regents of the University of California. All rights reserved.  
How to cite UCSF ChimeraX  

> open 1a0m format mmCIF fromDatabase pdb structureFactors true

Traceback (most recent call last):  
File
"/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-
packages/chimerax/ui/gui.py", line 562, in customEvent  
func(*args, **kw)  
File
"/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-
packages/chimerax/ui/widgets/htmlview.py", line 334, in defer  
cxcmd(session, topic)  
File
"/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-
packages/chimerax/ui/widgets/htmlview.py", line 455, in cxcmd  
run(session, cmd)  
File
"/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-
packages/chimerax/core/commands/run.py", line 31, in run  
results = command.run(text, log=log)  
File
"/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-
packages/chimerax/core/commands/cli.py", line 2641, in run  
result = ci.function(session, **kw_args)  
File
"/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-
packages/chimerax/core/commands/open.py", line 44, in open  
db_models, status = _fetch_from_database(session, db_id, db_name, db_format,
name, ignore_cache, **kw)  
File
"/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-
packages/chimerax/core/commands/open.py", line 148, in _fetch_from_database  
ignore_cache=ignore_cache, **kw)  
File
"/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-
packages/chimerax/core/fetch.py", line 434, in fetch_from_database  
models, status = df.fetch(session, id, format=format,
ignore_cache=ignore_cache, **kw)  
File
"/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-
packages/chimerax/core/fetch.py", line 497, in fetch  
return fetch(session, database_id, ignore_cache=ignore_cache, **kw)  
File
"/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-
packages/chimerax/core/toolshed/info.py", line 383, in fetch_cb  
return fetch_shim(session, identifier, **kw)  
File
"/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-
packages/chimerax/core/toolshed/info.py", line 381, in fetch_shim  
return f(session, identifier, database_name=database_name,
format_name=format_name, **kw)  
File
"/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-
packages/chimerax/atomic/mmcif/__init__.py", line 46, in fetch_from_database  
return fetcher(session, identifier, ignore_cache=ignore_cache, **kw)  
File
"/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-
packages/chimerax/atomic/mmcif/mmcif.py", line 333, in fetch_mmcif  
mmgr = get_map_mgr(models[0], create=True)  
File "/Users/tic20/Library/Application Support/ChimeraX/0.91/site-
packages/chimerax/clipper/symmetry.py", line 166, in get_map_mgr  
sh = get_symmetry_handler(structure, create=create,
auto_add_to_session=auto_add_to_session)  
File "/Users/tic20/Library/Application Support/ChimeraX/0.91/site-
packages/chimerax/clipper/symmetry.py", line 151, in get_symmetry_handler  
sh = _get_symmetry_handler(structure, create)  
File "/Users/tic20/Library/Application Support/ChimeraX/0.91/site-
packages/chimerax/clipper/symmetry.py", line 162, in _get_symmetry_handler  
return Symmetry_Manager(structure)  
File "/Users/tic20/Library/Application Support/ChimeraX/0.91/site-
packages/chimerax/clipper/symmetry.py", line 421, in __init__  
self._last_box_center = session.view.center_of_rotation  
File
"/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-
packages/chimerax/core/session.py", line 423, in _get_view  
return self._state_containers['main_view']  
KeyError: 'main_view'  
  
KeyError: 'main_view'  
  
File
"/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-
packages/chimerax/core/session.py", line 423, in _get_view  
return self._state_containers['main_view']  
  
See log for complete Python traceback.  
  




OpenGL version: 4.1 INTEL-12.9.22
OpenGL renderer: Intel(R) HD Graphics 6000
OpenGL vendor: Intel Inc.

Change History (8)

comment:1 by Tristan Croll, 6 years ago

Platform: all
Project: ChimeraX

Switching to using session.main_view gets things working again. Will aim to put amended builds up by the middle of next week.

comment:2 by Eric Pettersen, 6 years ago

Component: UnassignedSessions
Owner: set to Tom Goddard
Status: newassigned
Summary: ChimeraX bug report submission'main_view' needs to register itself as a state manager

With session.setattr now only automagically registering objects that inherit from StateManager, 'view' (and possibly other objects) need to explicitly add themselves as state managers.

comment:3 by Tom Goddard, 6 years ago

Cc: Tom Goddard added
Owner: changed from Tom Goddard to Eric Pettersen

comment:4 by Eric Pettersen, 6 years ago

Owner: changed from Eric Pettersen to Tom Goddard

If you have objects that need to register as a state manager but that don't inherit from StateManager, I have no idea how to locate them all in your code. You need to fix this.

--Eric

comment:5 by Tom Goddard, 6 years ago

Owner: changed from Tom Goddard to Eric Pettersen

You should revert your change that caused this problem. I do not have time now to fix all the damage it causes.

comment:6 by Eric Pettersen, 6 years ago

Cc: Eric Pettersen added; Tom Goddard removed
Owner: changed from Eric Pettersen to Tom Goddard

Okay, I have reverted the change. Whenever you've updated your code, close this and I'll proceed with the setattr changes.

--Eric

comment:7 by Tom Goddard, 6 years ago

Cc: Eric Pettersen removed
Owner: changed from Tom Goddard to Eric Pettersen

Quit changing the owner of this ticket to me. Your code change broke this. Reverting your change should have fixed it. So you close this ticket. And add a comment to the other ticket about state managers that can point to this ticket indicating that there are additional non-state-managers that are being added as state managers such as session.main_view.

comment:8 by Eric Pettersen, 6 years ago

Resolution: fixed
Status: assignedclosed

Reverted to previous code, with slight tweak to avoid adding State-but-not-StateManager objects as state managers. Tweak tested okay.

Note: See TracTickets for help on using tickets.