legacysupport.py (pymol-v1.8.6.0.tar.bz2) | : | legacysupport.py (pymol-v2.1.0.tar.bz2) | ||
---|---|---|---|---|
skipping to change at line 32 | skipping to change at line 32 | |||
'startup', | 'startup', | |||
'get_pmgapp', | 'get_pmgapp', | |||
'get_tk_root', | 'get_tk_root', | |||
'get_tk_focused', | 'get_tk_focused', | |||
] | ] | |||
def get_pmgapp(): | def get_pmgapp(): | |||
''' | ''' | |||
Returns the PMGApp instance. | Returns the PMGApp instance. | |||
''' | ''' | |||
if pymol._ext_gui is None: | import pymol.gui | |||
pymol._ext_gui = createlegacypmgapp() | return pymol.gui.get_pmgapp() | |||
return pymol._ext_gui | ||||
def get_tk_root(): | def get_tk_root(): | |||
''' | ''' | |||
Returns the Tk master instance. | Returns the Tk master instance. | |||
''' | ''' | |||
return get_pmgapp().root | return get_pmgapp().root | |||
def get_tk_focused(): | def get_tk_focused(): | |||
''' | ''' | |||
Return the Tk widget which has currently the focus. | Return the Tk widget which has currently the focus. | |||
''' | ''' | |||
if 'pmg_qt.mimic_tk' in sys.modules: | ||||
return None | ||||
root = get_tk_root() | root = get_tk_root() | |||
focused = root.focus_get() | focused = root.focus_get() | |||
if focused is None: | if focused is None: | |||
return root.focus_lastfor() | return root.focus_lastfor() | |||
return focused | return focused | |||
def installPlugin(self): | def installPlugin(self): | |||
''' | ''' | |||
Overloaded version of pmg_tk.PMGApp.installPlugin | Overloaded version of pmg_tk.PMGApp.installPlugin | |||
skipping to change at line 70 | skipping to change at line 72 | |||
# ask for file; to install a directory, point to its __init__.py file | # ask for file; to install a directory, point to its __init__.py file | |||
filetypes = [('Python Files', '*.py')] + \ | filetypes = [('Python Files', '*.py')] + \ | |||
[('Archives', '*.' + ext) for ext in zip_extensions] | [('Archives', '*.' + ext) for ext in zip_extensions] | |||
filetypes = [('All Files', pattern) for (_, pattern) in filetypes] + filetyp es | filetypes = [('All Files', pattern) for (_, pattern) in filetypes] + filetyp es | |||
ofile = tkFileDialog.askopenfilename(title='Install Plugin', | ofile = tkFileDialog.askopenfilename(title='Install Plugin', | |||
initialdir=os.getcwd(), | initialdir=os.getcwd(), | |||
filetypes=filetypes) | filetypes=filetypes) | |||
if len(ofile): | if len(ofile): | |||
installPluginFromFile(ofile) | installPluginFromFile(ofile) | |||
plugin_manager_panel = None | ||||
def addPluginManagerMenuItem(): | def addPluginManagerMenuItem(): | |||
def plugin_manager(): | def plugin_manager(): | |||
from . import managergui | global plugin_manager_panel | |||
managergui.manager_dialog() | from pymol.gui import get_qtwindow as getPyMOLWindow | |||
window = getPyMOLWindow() | ||||
if window: | ||||
if not plugin_manager_panel: | ||||
from .managergui_qt import PluginManager | ||||
plugin_manager_panel = PluginManager(None) | ||||
plugin_manager_panel.show() | ||||
else: | ||||
from . import managergui | ||||
managergui.manager_dialog() | ||||
pymol.plugins.addmenuitem('Plugin Manager', plugin_manager) | pymol.plugins.addmenuitem('Plugin Manager', plugin_manager) | |||
pymol.plugins.addmenuitem('-', None) | pymol.plugins.addmenuitem('-', None) | |||
def initializePlugins(self): | def initializePlugins(self): | |||
''' | ''' | |||
Overloaded version of pmg_tk.PMGApp.initializePlugins | Overloaded version of pmg_tk.PMGApp.initializePlugins | |||
Initializes already loaded plugins. | Initializes already loaded plugins. | |||
''' | ''' | |||
End of changes. 5 change blocks. | ||||
5 lines changed or deleted | 19 lines changed or added |