def __init__(self, cmd): super(PluginManager, self).__init__(None) window = getPyMOLWindow() self.form = window.load_form('pluginmanager') self.form.b_wiki.pressed.connect(self.fetchplugin) self.form.e_wiki.returnPressed.connect(self.fetchplugin) self.form.b_local.pressed.connect(self.installplugin) self.form.b_startup_all.pressed.connect(self.startup_all) self.form.b_startup_none.pressed.connect(self.startup_none) self.form.e_filter.textChanged.connect(self.filter_plugins) self.form.c_loaded.stateChanged.connect(self.filter_plugins) self.form.c_startup.stateChanged.connect(self.filter_plugins) self.form.l_repositories.itemClicked.connect(self.repo_changed) self.form.bb_path_add.pressed.connect(self.add_path) self.form.bb_path_up.pressed.connect(self.move_path_up) self.form.bb_path_down.pressed.connect(self.move_path_down) self.form.bb_path_remove.pressed.connect(self.remove_path) self.form.b_add_repo.pressed.connect(self.add_repository) self.form.b_remove_repo.pressed.connect(self.remove_repository) self.reload_plugins() self.form.l_repo_plugins.setSelectionMode( QtWidgets.QAbstractItemView.ExtendedSelection) self.form.b_install.pressed.connect(self.install_repo_plugins) self.form.b_info.pressed.connect(self.info_repo_plugin) self.populate_repositories() self.populate_startup_paths() self.populate_preferences() self.form._dialog.show()
def plugin_manager(): global plugin_manager_panel 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()
def reload_plugins(self, setting=None): from . import plugins window = getPyMOLWindow() self.clear_plugins() def add_plugin_item(info): item = window.load_form('pluginitem', QtWidgets.QFrame()) item._widget = item._dialog item._widget.setFrameStyle(QtWidgets.QFrame.Sunken) item._widget.setFrameShape(QtWidgets.QFrame.Panel) item.w_title.setText(info.name) item.w_version.setText(info.get_version()) item.w_startup.setChecked(info.autoload) item.w_startup.stateChanged.connect(self.w_startup_changed) item.w_enable.pressed.connect(info.load) item.w_enable.pressed.connect(self.disable_load_button) item.w_uninstall.pressed.connect(info.uninstall) item.w_uninstall.pressed.connect(self.reload_plugins) if info.loaded: item.w_enable.setEnabled(False) if hasattr(info.module, 'settings_dialog'): item.w_settings.setVisible(True) else: item.w_settings.setVisible(False) item.w_info.pressed.connect(self.show_info) if info.loadtime: item.w_loadtime.setText("Took %.3f seconds to load" % info.loadtime) else: item.w_loadtime.setText("Not loaded") item._widget._form = item self.plugin_info[item] = info self.form.f_installed_layout.addWidget(item._widget) for info in sorted(plugins.values(), key=lambda i: i.name.lower()): try: add_plugin_item(info) except Exception as e: print(e) self.filter_plugins() self.form.f_installed_layout.addStretch()
def reload_plugins(self, setting=None): from . import plugins window = getPyMOLWindow() self.clear_plugins() for info in sorted(plugins.values(), key=lambda i: i.name.lower()): item = window.load_form('pluginitem', QtWidgets.QFrame()) item._widget = item._dialog item._widget.setFrameStyle(QtWidgets.QFrame.Sunken) item._widget.setFrameShape(QtWidgets.QFrame.Panel) item.w_title.setText(info.name) item.w_version.setText(info.get_version()) item.w_startup.setChecked(info.autoload) item.w_startup.stateChanged.connect(self.w_startup_changed) item.w_enable.pressed.connect(info.load) item.w_enable.pressed.connect(self.disable_load_button) item.w_uninstall.pressed.connect(info.uninstall) item.w_uninstall.pressed.connect(self.reload_plugins) if info.loaded: item.w_enable.setEnabled(False) if hasattr(info.module, 'settings_dialog'): item.w_settings.setVisible(True) else: item.w_settings.setVisible(False) item.w_info.pressed.connect(self.show_info) if info.loadtime: item.w_loadtime.setText("Took %.3f seconds to load" % info.loadtime) else: item.w_loadtime.setText("Not loaded") item._widget._form = item self.plugin_info[item] = info self.form.f_installed_layout.addWidget(item._widget) self.filter_plugins() self.form.f_installed_layout.addStretch()