def initModule(vf): for dict in commandList: vf.addCommand(dict['cmd'], dict['name'], dict['gui']) if not hasattr(vf, 'ADTSetMode'): vf.addCommand(AdtSetMode(), 'ADTSetMode') if not hasattr(vf, 'ADtors_limitTorsions'): vf.addCommand(SetTorsionNumber(), 'ADtors_limitTorsions') if not hasattr(vf, 'ADtors_setBondRotatableFlag'): vf.addCommand(SetBondRotatableFlag(), 'ADtors_setBondRotatableFlag') if not hasattr(vf, 'ADtors_stop'): vf.addCommand(StopAutoTors(), 'ADtors_stop') if vf.hasGui: vf.GUI.menuBars['AutoTools3Bar']._frame.config({'background': 'tan'}) for item in list( vf.GUI.menuBars['AutoTools3Bar'].menubuttons.values()): item.configure(background='tan') if not hasattr(vf.GUI, 'adt3Bar'): vf.GUI.adt3Bar = vf.GUI.menuBars['AutoTools3Bar'] vf.GUI.adt3Frame = list( vf.GUI.adt3Bar.menubuttons.values())[0].master if not hasattr(vf.GUI, 'adt3ModeLabel'): mbs = {} packing_list = [] for c in list(vf.GUI.adt3Frame.children.values()): if isinstance(c, tkinter.Menubutton): mbs[c.cget('text')] = c packing_list.append(c.cget('text')) c.pack_forget() vf.GUI.adt3ModeLabel = tkinter.Label(vf.GUI.adt3Frame, text="ADT3.0", width=6, relief='sunken', borderwidth=1, fg='DarkBlue', bg='ivory', anchor='w') vf.GUI.adt3ModeLabel.pack(side='left') vf.GUI.adt3ModeLabel.bind("<Double-Button-1>", vf.ADTSetMode.guiCallback()) for t in packing_list: try: c = mbs[t] c.pack(side='left') except: pass
def setADTmode(modeStr, mv): import Tkinter from AutoDockTools.autotorsCommands import AdtSetMode mv.addCommand(AdtSetMode(),'ADTSetMode') if not hasattr(mv.GUI, 'adtBar'): mv.GUI.adtBar = mv.GUI.menuBars['AutoToolsBar'] if not hasattr(mv.GUI, 'adtFrame'): mv.GUI.adtFrame = vf.GUI.adtBar.menubuttons.values()[0].master if not hasattr(mv.GUI, 'adt41ModeLabel'): mv.GUI.adt41ModeLabel=Tkinter.Label(mv.GUI.adtFrame, text="ADT4.2", width=6, relief='sunken', borderwidth=1, fg='DarkGreen', bg = 'ivory',anchor='w' ) mv.GUI.adt41ModeLabel.pack(side='left') mv.GUI.adt41ModeLabel.bind("<Double-Button-1>", mv.ADTSetMode.guiCallback) mv.ADTSetMode.Close_cb() return mv.ADTSetMode(modeStr)