def modelChooserDlg(parent=None, selectables=None, host=None, asMimeData=False, singleModel=False, windowTitle='Model Chooser'): '''Static method that launches a modal dialog containing a TaurusModelChooser :param parent: (QObject) parent for the dialog :param selectables: (list<TaurusElementType>) if passed, only elements of the tree whose type is in the list will be selectable. :param host: (QObject) Tango host to be explored by the chooser :param asMimeData: (bool) If False (default), a list of models will be. returned. If True, a `QMimeData` object will be returned instead. See :meth:`getListedModels` for a detailed description of this QMimeData object. :param singleModel: (bool) If True, the selection will be of just one model. Otherwise (default) a list of models can be selected :param windowTitle: (str) Title of the dialog (default="Model Chooser") :return: (list,bool or QMimeData,bool) Returns a models,ok tuple. models can be either a list of models or a QMimeData object, depending on `asMimeData`. ok is True if the dialog was accepted (by clicking on the "update" button) and False otherwise ''' dlg = Qt.QDialog(parent) dlg.setWindowTitle(windowTitle) dlg.setWindowIcon(Qt.QIcon("logos:taurus.png")) layout = Qt.QVBoxLayout() w = TaurusModelChooser( parent=parent, selectables=selectables, host=host, singleModel=singleModel) layout.addWidget(w) dlg.setLayout(layout) w.updateModels.connect(dlg.accept) dlg.exec_() return w.getListedModels(asMimeData=asMimeData), (dlg.result() == dlg.Accepted)
def main3(): asMimeData = True app = Qt.QApplication([]) dlg = Qt.QDialog() dlg.setWindowTitle('Archiving Tree') dlg.setWindowIcon(Qt.QIcon("logos:taurus.png")) layout = Qt.QVBoxLayout() w = TaurusModelChooser( parent=dlg) #, selectables=selectables, host=host, singleModel=singleModel) layout.addWidget(w) dlg.setLayout(layout) w.updateModels.connect(dlg.accept) dlg.exec_() return w.getListedModels(asMimeData=asMimeData), (dlg.result() == dlg.Accepted)
def main3(): asMimeData = True app = Qt.QApplication([]) dlg = Qt.QDialog() dlg.setWindowTitle('Archiving Tree') dlg.setWindowIcon(Qt.QIcon("logos:taurus.png")) layout = Qt.QVBoxLayout() w = TaurusModelChooser( parent=dlg ) #, selectables=selectables, host=host, singleModel=singleModel) layout.addWidget(w) dlg.setLayout(layout) w.updateModels.connect(dlg.accept) dlg.exec_() return w.getListedModels( asMimeData=asMimeData), (dlg.result() == dlg.Accepted)
def modelChooserDlg(parent=None, selectables=None, host=None, asMimeData=False, singleModel=False, windowTitle='Model Chooser'): '''Static method that launches a modal dialog containing a TaurusModelChooser :param parent: (QObject) parent for the dialog :param selectables: (list<TaurusElementType>) if passed, only elements of the tree whose type is in the list will be selectable. :param host: (QObject) Tango host to be explored by the chooser :param asMimeData: (bool) If False (default), a list of models will be. returned. If True, a `QMimeData` object will be returned instead. See :meth:`getListedModels` for a detailed description of this QMimeData object. :param singleModel: (bool) If True, the selection will be of just one model. Otherwise (default) a list of models can be selected :param windowTitle: (str) Title of the dialog (default="Model Chooser") :return: (list,bool or QMimeData,bool) Returns a models,ok tuple. models can be either a list of models or a QMimeData object, depending on `asMimeData`. ok is True if the dialog was accepted (by clicking on the "update" button) and False otherwise ''' dlg = Qt.QDialog(parent) dlg.setWindowTitle(windowTitle) dlg.setWindowIcon(Qt.QIcon("logos:taurus.png")) layout = Qt.QVBoxLayout() w = TaurusModelChooser(parent=parent, selectables=selectables, host=host, singleModel=singleModel) layout.addWidget(w) dlg.setLayout(layout) w.updateModels.connect(dlg.accept) dlg.exec_() return w.getListedModels( asMimeData=asMimeData), (dlg.result() == dlg.Accepted)