Hello,

I'm trying to add another external GUI to be positioned at the bottom of the
structure window for displaying sequence alignments, with not much luck. Here
is what I want and what I've done:

Goal: when opening a sequence alignment file in the existing GUI, launch a new
GUI at the bottom displaying the alignments. So:

- in \modules\pmg_tk, add a new class alignApp that inherits from AbstractApp
(very similar to PMGApp for the exsting GUI), which adds widgets to the new
GUI and will parse files, etc..

- in \modules\pmg_tk\startup, add startNewGUI.py, whose __init__() adds an
additional file open option (all files in this directory are __init__'d upon
startup of the existing GUI) to the existing GUI's File menu:

-------------------------------
from pmg_tk.alignApp import *

def run_alignApp():
    if not hasattr(sys,"argv"):
      sys.argv=["pymol"]
    alignApp(balloon_state='both').run()

def alignment_open(self):
  ofile = askopenfilename(initialdir = self.initialdir,
                          filetypes=[("XML File","*.xml"),
                                     ("All Files","*.*"),
                                     ("All Files","*"),])
  if len(ofile):
     self.initialdir = re.sub(r"[^\/\\]*$","",ofile)
     t_alignApp = threading.Thread(target=run_alignApp,args=())
     t_alignApp.setDaemon(1)
     t_alignApp.start()

def __init__(self):
      self.menuBar.addmenuitem('File', 'command', 'Open alignment file.',
                        label=self.pad+'Open alignments',
                        command=lambda s=self:alignment_open(s))
-------------------------------

The result: the new GUI appears as a "one-piece" small square frame (1/6 the
width of the existing). No menu, output area or other widgets is shown. After
clicking in either GUI, the cursor turns busy, and both GUIs turn
non-responding.

I'm not sure if it's a Python thread problem on my part. Has anyone done
something similar before? Let me know if it's more appropriate to ask in a
Python newsgroup.

Thanks much!

Tina



Reply via email to