def __init__(self, parent, availableAddons): super(AddAddonDlg, self).__init__(parent) box = Qt.QVBoxLayout(self) box.addWidget( Qt.QLabel( self.tr("Type name or url of the addon you want to add:"), self)) self.input = Qt.QLineEdit(self) box.addWidget(self.input) btnBox = Qt.QDialogButtonBox(Qt.QDialogButtonBox.Ok | Qt.QDialogButtonBox.Cancel) btnBox.accepted.connect(self.accept) btnBox.rejected.connect(self.reject) box.addWidget(btnBox) self.show() if len(availableAddons) > 0: self.completer = Qt.QCompleter( [addon[0] for addon in availableAddons], self) self.completer.setFilterMode(Qt.Qt.MatchContains) self.completer.setCaseSensitivity(Qt.Qt.CaseInsensitive) self.input.setCompleter(self.completer) else: Qt.QMessageBox.information( self, self.tr("No addon catalog data"), self. tr("You haven't updated the available addons catalog, " "so you need to insert a URL for the addon you want to add." ))
def __init__(self, parent, availableAddons): super(AddAddonDlg, self).__init__(parent) box = Qt.QVBoxLayout(self) box.addWidget(Qt.QLabel(self.tr("Donnez le nom ou l'URL de l'addon que vous souhaitez ajouter :"), self)) self.input = Qt.QLineEdit(self) box.addWidget(self.input) btnBox = Qt.QDialogButtonBox(Qt.QDialogButtonBox.Ok | Qt.QDialogButtonBox.Cancel) btnBox.accepted.connect(self.accept) btnBox.rejected.connect(self.reject) box.addWidget(btnBox) self.show() if availableAddons: self.completer = Qt.QCompleter([addon[0] for addon in availableAddons], self) self.completer.setFilterMode(Qt.Qt.MatchContains) self.completer.setCaseSensitivity(Qt.Qt.CaseInsensitive) self.input.setCompleter(self.completer) else: Qt.QMessageBox.information(self, self.tr("Catalogue des addons absent"), self.tr( "Vous n'avez pas mis à jour le catalogue des addons disponibles, " "donnez l'URL de l'addon que vous souhaitez ajouter."))
def _setup_text_interface(self): self.textInterface = Qt.QLineEdit() self.setCellWidget(8, 9, self.textInterface) self.textInterface.returnPressed.connect(self.parseText) self.textInterface.setToolTip(""" text interface: You can write abbrevations of elements: without any space: AlSiNaK with any separators like comma/space: Al;Br K,La abbrevations of element groups: HFSE, REE, REE_SEM, LILE, mAjor Use '-' (minus) sign to switch all elements after it: -AlCa, K; P -> toggles off Al, Ca, K, P HFSE - Nb -> toggles on HFSE elements, but switches off Nb """) completer = Qt.QCompleter( list(pt_indexes.keys()) + list(geo_groups.keys())) self.textInterface.setCompleter(completer)
def __init__(self, parent=None): """ Create dialog. """ super(SetupCatalog, self).__init__(parent) title = translate("CatalogsView", "Set-up catalogue") self.setWindowTitle(title) gl = Q.QGridLayout(self.main()) gl.setContentsMargins(0, 0, 0, 0) title = translate("CatalogsView", "Label") gl.addWidget(Q.QLabel(title, self.main()), 0, 0) self.label = Q.QLineEdit(self.main()) self.label.setObjectName('cataview_setup_catalog_title') gl.addWidget(self.label, 0, 1) title = translate("CatalogsView", "Location") gl.addWidget(Q.QLabel(title, self.main()), 1, 0) self.path = Q.QLineEdit(self.main()) self.path.setObjectName('cataview_setup_catalog_path') self.path.setMinimumWidth(200) self.path.setCompleter(Q.QCompleter()) model = Q.QDirModel() model.setFilter(Q.QDir.Drives | Q.QDir.Dirs | Q.QDir.NoDotAndDotDot) self.path.completer().setModel(model) gl.addWidget(self.path, 1, 1, 1, 2) title = translate("AsterStudy", "Browse...") btn = Q.QPushButton(title, self.main()) btn.setObjectName('cataview_setup_catalog_browse_btn') gl.addWidget(btn, 1, 3) gl.setColumnStretch(2, 5) btn.clicked.connect(self._browse) self.label.setFocus()
def __init__(self, astergui, parent=None, **kwargs): """ Create editor. Arguments: astergui (AsterGui): AsterGui instance. parent (Optional[QWidget]): Parent widget. Defaults to *None*. **kwargs: Keyword arguments. """ super(DirsPanel, self).__init__(parent=parent, name=translate("AsterStudy", "Set-up directories"), astergui=astergui, **kwargs) title = translate("AsterStudy", "Set-up directories") self.setWindowTitle(title) self.setPixmap(load_pixmap("as_pic_setup_dirs.png")) self.setObjectName("dirs_panel") completer = Q.QCompleter(Q.QDirModel(self), self) glayout = Q.QGridLayout(self) glayout.setContentsMargins(0, 0, 0, 0) label = Q.QLabel(translate("DirsPanel", "Input directory"), self) glayout.addWidget(label, 0, 0) self.in_dir = Q.QLineEdit(self) self.in_dir.setCompleter(completer) self.in_dir.setObjectName("dirs_panel_in_dir") glayout.addWidget(self.in_dir, 0, 1) button = Q.QPushButton(translate("AsterStudy", "Browse..."), self) button.mode = Directory.InDir button.setObjectName("dirs_panel_in_dir_browse") connect(button.clicked, self._browse) glayout.addWidget(button, 0, 2) label = Q.QLabel(translate("DirsPanel", "Output directory"), self) glayout.addWidget(label, 1, 0) self.out_dir = Q.QLineEdit(self) self.out_dir.setCompleter(completer) self.out_dir.setObjectName("dirs_panel_out_dir") glayout.addWidget(self.out_dir, 1, 1) button = Q.QPushButton(translate("AsterStudy", "Browse..."), self) button.mode = Directory.OutDir button.setObjectName("dirs_panel_out_dir_browse") connect(button.clicked, self._browse) glayout.addWidget(button, 1, 2) glayout.setRowStretch(2, 5) case = astergui.study().history.current_case self.in_dir.setText(case.in_dir) self.in_dir.home(False) self.out_dir.setText(case.out_dir) self.out_dir.home(False) self.setFocusProxy(self.in_dir)