Commit ae251396 by peastman

Fixed errors in UI that were introduced by recent changes

parent 264f95c1
...@@ -26,25 +26,21 @@ def controlsCallback(parameters, handler): ...@@ -26,25 +26,21 @@ def controlsCallback(parameters, handler):
if 'quit' in parameters: if 'quit' in parameters:
handler.sendResponse(loadHtmlFile("quit.html")) handler.sendResponse(loadHtmlFile("quit.html"))
uiserver.server.shutdown() uiserver.server.shutdown()
global uiIsRunning
uiIsRunning = False
def startPageCallback(parameters, handler): def startPageCallback(parameters, handler):
global fixer global fixer
if 'type' in parameters: if 'type' in parameters:
if parameters.getfirst('type') == 'local': if parameters.getfirst('type') == 'local':
pdb = PdbStructure(parameters['pdbfile'].value.decode().splitlines()) fixer = PDBFixer(file=parameters['pdbfile'].value.decode().splitlines())
fixer = PDBFixer(pdb)
displayDeleteChainsPage()
else: else:
id = parameters.getfirst('pdbid') id = parameters.getfirst('pdbid')
url = "ftp://ftp.wwpdb.org/pub/pdb/data/structures/all/pdb/pdb"+id.lower()+".ent.gz"
try: try:
response = urlopen(url) fixer = PDBFixer(pdbid=id)
content = gzip.GzipFile(fileobj=BytesIO(response.read())).read()
pdb = PdbStructure(content.decode().splitlines())
fixer = PDBFixer(pdb)
displayDeleteChainsPage()
except: except:
handler.sendResponse(header+"Unable to download the PDB file. This may indicate an invalid PDB identifier, or an error in network connectivity."+loadHtmlFile("error.html")) handler.sendResponse(header+"Unable to download the PDB file. This may indicate an invalid PDB identifier, or an error in network connectivity."+loadHtmlFile("error.html"))
displayDeleteChainsPage()
def deleteChainsPageCallback(parameters, handler): def deleteChainsPageCallback(parameters, handler):
numChains = len(list(fixer.topology.chains())) numChains = len(list(fixer.topology.chains()))
...@@ -215,5 +211,8 @@ def launchUI(): ...@@ -215,5 +211,8 @@ def launchUI():
# down and then the uiserver exits. Without this daemon/sleep combo, the # down and then the uiserver exits. Without this daemon/sleep combo, the
# process cannot be killed with Control-C. Reference stack overflow link: # process cannot be killed with Control-C. Reference stack overflow link:
# http://stackoverflow.com/a/11816038/1079728 # http://stackoverflow.com/a/11816038/1079728
while True:
global uiIsRunning
uiIsRunning = True
while uiIsRunning:
time.sleep(0.5) time.sleep(0.5)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment