def __call__(self, val): dialog = QInputDialog(parent=self.parent) # dialog.setLabelText("") dialog.setLabelText("set label for minimum: " + str(self.minimum.energy)) dialog.setInputMode(0) dialog.exec_() if dialog.result(): label = dialog.textValue() self.parent._minima_labels[self.minimum] = label
def __call__(self, val): dialog = QInputDialog(parent=self.parent) # dialog.setLabelText("") dialog.setLabelText("Temperature for committor calculation") dialog.setInputMode(2) dialog.setDoubleValue(1.) dialog.exec_() if dialog.result(): T = dialog.doubleValue() self.parent._layout_by_committor(self.minimum1, self.minimum2, T=T)
def __call__(self, val): dialog = QInputDialog(parent=self.parent) # dialog.setLabelText("") dialog.setLabelText("Temperature for MFPT calculation") dialog.setInputMode(2) dialog.setDoubleValue(1.) dialog.exec_() if dialog.result(): T = dialog.doubleValue() self.parent._color_by_mfpt(self.minimum1, T=T)
def ask_password_dialog(parent, title, prompt, timeout = None): if parent is None: app = qt4tools.create_qapplication() translator = qt4tools.get_translator() app.installTranslator(translator) import icon dialog = QInputDialog() timer = QTimer() if not timeout is None: dialog.connect(timer, SIGNAL("timeout()"), dialog.reject) timer.setInterval(timeout * 1000) timer.start() dialog.setWindowIcon(icon.BIT_LOGO) dialog.setWindowTitle(title) dialog.setLabelText(prompt) dialog.setTextEchoMode(QLineEdit.Password) QApplication.processEvents() ret = dialog.exec_() timer.stop() if ret: password = dialog.textValue() else: password = '' del(dialog) return(password)
def ask_password_dialog(parent, title, prompt, timeout=None): if parent is None: qt4tools.create_qapplication() import icon dialog = QInputDialog() timer = QTimer() if not timeout is None: dialog.connect(timer, SIGNAL("timeout()"), dialog.reject) timer.setInterval(timeout * 1000) timer.start() dialog.setWindowIcon(icon.BIT_LOGO) dialog.setWindowTitle(title) dialog.setLabelText(prompt) dialog.setTextEchoMode(QLineEdit.Password) QApplication.processEvents() ret = dialog.exec_() timer.stop() if ret: password = dialog.textValue() else: password = '' del (dialog) return (password)
def _create_folder(self): DEBUG("Creating a folder...") current_item = self.currentItem() qinput = QInputDialog(self) qinput.setInputMode(QInputDialog.TextInput) qinput.setWindowTitle(self.tr("Nueva Carpeta")) qinput.setLabelText(self.tr("Nombre:")) qinput.resize(400, 100) ok = qinput.exec_() folder_name = qinput.textValue() if ok: path = os.path.join(current_item.path, folder_name) if os.path.exists(path): QMessageBox.information(self, self.tr("Información"), self.tr("La carpeta ya existe"), QMessageBox.Yes) DEBUG("The folder already exists...") return # Creo la carpeta os.mkdir(path) # Agrego el ítem al árbol folder_item = TreeItem(current_item, [folder_name]) folder_item.path = path folder_item.isFile = False folder_item.setExpanded(True)
def getFindMsg( parentWidget, prepText = None ): qd = QInputDialog(parentWidget) qd.setInputMode(QInputDialog.TextInput) qd.setOkButtonText(QString('Find')) qd.setLabelText(QString('Text to find')) if (prepText is not None): if prepText.size() > 40 : prepText.truncate(40) qd.setTextValue(prepText) b = (QDialog.Accepted == qd.exec_() ) if b : return (True, qd.textValue()) else: return (False, QString() )