def importSteamLibrary(self): apiKey, ok = QInputDialog.getText(self, "Import Steam Library", "Enter Steam API Key:") if ok and not (apiKey.isspace() or apiKey == ""): steamID, ok = QInputDialog.getText(self, "Import Steam Library", "Enter Steam User ID:") if ok and not (steamID.isspace() or steamID == ""): try: games = getSteamLibrary(apiKey, steamID) except (PermissionError, ValueError) as e: msgBox = QMessageBox(QMessageBox.Critical, "Error", "An error occured.") msgBox.setInformativeText(str(e)) msgBox.exec_() else: if "Steam" not in self.allPlatforms: self.allPlatforms.add("Steam") self.allRegions.add("Steam") self.filterDock.updatePlatforms(sorted(self.allPlatforms, key=str.lower)) self.filterDock.updateRegions(sorted(self.allRegions, key=str.lower)) self.gamesTableView.addData(games) else: # Only add games not already in collection existingGames = [] query = QSqlQuery() query.exec_("SELECT Name from games WHERE Region='Steam'") while query.next(): existingGames.append(query.value(0)) for game in games: if game["name"] not in existingGames: self.gamesTableView.addData(game) self.overview.updateData(self.gamesTableView) self.randomizer.updateLists(self.gamesTableView.ownedItems(), sorted(self.allPlatforms, key=str.lower), sorted(self.allGenres, key=str.lower)) self.search()
def Enter_nick(self): if self.alive(3) == 0: if self.choose == 0: text, ok = QInputDialog.getText(self, 'Input Dialog', 'Search for nik:') elif self.choose == 1: text, ok = QInputDialog.getText(self, 'Input Dialog', 'Search for phone:') elif self.choose == 2: text, ok = QInputDialog.getText(self, 'Input Dialog', 'Search for fname:') if ok: if self.choose == 0: self.result = posts.find({"nik": str(text)}) elif self.choose == 1: self.result = posts.find({"phone": str(text)}) elif self.choose == 2: self.result = posts.find({"fname": str(text)}) msgBox = QtWidgets.QMessageBox() msgBox.setIcon(QtWidgets.QMessageBox.Information) msgBox.setText("Сохранить результат в файл?") msgBox.setWindowTitle("?") msgBox.setStandardButtons(QtWidgets.QMessageBox.Ok | QtWidgets.QMessageBox.Cancel) returnvalue = msgBox.exec() if returnvalue == QtWidgets.QMessageBox.Ok: text, ok = QInputDialog.getText(self, 'Input Dialog', 'Enter name file') self.save_file(text) else: msgBox = QtWidgets.QMessageBox() msgBox.setIcon(QtWidgets.QMessageBox.Information) msgBox.setText("Вывести результат в таблицу?") msgBox.setWindowTitle("?") msgBox.setStandardButtons(QtWidgets.QMessageBox.Ok | QtWidgets.QMessageBox.Cancel) returnvalue = msgBox.exec() if returnvalue == QtWidgets.QMessageBox.Ok: j = 0 self.Next.setDisabled(True) self.Back.setDisabled(True) self.tableWidget.clearContents() for i in self.result: self.tableWidget.setItem( j, 0, QTableWidgetItem(i['Number'])) self.tableWidget.setItem( j, 1, QTableWidgetItem(i['name'])) self.tableWidget.setItem( j, 2, QTableWidgetItem(i['fname'])) self.tableWidget.setItem( j, 3, QTableWidgetItem(i['phone'])) self.tableWidget.setItem( j, 4, QTableWidgetItem(i['uid'])) self.tableWidget.setItem( j, 5, QTableWidgetItem(i['nik'])) self.tableWidget.setItem(j, 6, QTableWidgetItem(i['wo'])) j += 1 if j == 100: break
def newTab(self, root): """ Inicijalizuje novi tab Return: Objekat book """ if len(root.getChildren()) == 0: newName, ok = QInputDialog.getText( None, "New Chapter name", "Enter desired first chapter name") if not ok or newName == "": while not ok or newName == "": newName, ok = QInputDialog.getText( None, "New Chapter name", "Enter desired first chapter name") root.addChild(Chapter(newName)) book = Book(root.getName()) book.setPath(root.getPath()) book.setParent(QApplication.instance().model) rootModel = HierarchyTreeModel(book) rootView = HierarchyTreeView(rootModel) for chapter in root.getChildren(): tmpChapter = Chapter(chapter.getName()) book.addChild(tmpChapter) for page in chapter.getChildren(): tmpPage = Page(page.getName()) tmpChapter.addChild(tmpPage) for element in page.getChildren(): element.setParent(tmpPage) tmpPage.addChild(element) self.tabs.addTab(rootView, root.getName()) self.LeftButton.clicked.connect(rootView.leftButtonPressed) self.RightButton.clicked.connect(rootView.rightButtonPressed) rootView.SelectRoot() return book
def actionCalled(self): """ Prikazuje dijalog za unos imena nove knjige, kreira novu instancu knjige sa unetim imenom """ parent = QApplication.instance().model newName, ok = QInputDialog.getText(None, "New Book name", "Enter desired new name") if ok: if parent.isValidName(newName): newBook = Book(newName) book = QApplication.instance().mainWindow.newTab(newBook) parent.addChild(book) else: while not parent.isValidName(newName): dialog = QMessageBox() dialog.setWindowTitle("Error") dialog.setText("That name is not valid") dialog.setWindowIcon(QIcon("src/notification.png")) dialog.setModal(True) dialog.exec_() newName, cancel = QInputDialog.getText( None, "New Book name", "Enter desired new name") if not cancel: break else: if parent.isValidName(newName): newBook = Book(newName) book = QApplication.instance().mainWindow.newTab( newBook) parent.addChild(book) break
def check_input(self): flag = 0 if self.newName.text() == "": flag += 1 text, ok = QInputDialog.getText(self, 'Input Dialog', 'Enter lot name:') if ok: self.newName.setText(str(text)) if self.newCost.text() == "": flag += 1 text, ok = QInputDialog.getText(self, 'Input Dialog', 'Enter lot cost:') if ok: self.newCost.setText(str(text)) if self.newLink.text() == "": flag += 1 text, ok = QInputDialog.getText(self, 'Input Dialog', 'Enter lot link:') if ok: self.newLink.setText(str(text)) if self.newNote.text() == "": flag += 1 text, ok = QInputDialog.getText(self, 'Input Dialog', 'Enter lot note:') if ok: self.newNote.setText(str(text)) return flag
def Create_Tok(self): #получение токена кривое self.text, ok = QInputDialog.getText(self, 'Input Dialog', 'Введите id приложения') if ok: webbrowser.open( 'https://oauth.vk.com/authorize?client_id=' + str(self.text) + '&display=page&scope=photos,friends,messages&redirect_uri=https://oauth.vk.com/blank.html&response_type=token&v=5.124&revoke=1', new=2) self.AT, ok = QInputDialog.getText(self, 'Input Dialog', 'Введите access_token') if ok: QMessageBox.about( self, 'Уведомление', "Сейчас вам предложат указать папку для всех последующих сохранений альбомов" ) self.dialog = QFileDialog(self) self.path = self.dialog.getExistingDirectory() with open("config.txt", "w", encoding="utf-8") as file: file.write("ID_app" + " " + str(self.text) + "\n" + "AT" + " " + str(self.AT) + "\n" + "Path " + str(self.path)) QMessageBox.about(self, 'Успешно', 'Файл успешно изменен/создан') else: QMessageBox.about(self, 'Ошибка', 'Файл не будет изменен/создан') else: QMessageBox.about(self, 'Ошибка', 'Файл не будет изменен/создан')
def create_wallet(self): try: new_wallet_password, ok = QInputDialog.getText( self.password_dialog, f'Create {self.node_set.network} LND Wallet', 'New Wallet Password', QLineEdit.Password) if not ok: return seed_password, ok = QInputDialog.getText( self.password_dialog, f'Create {self.node_set.network} LND Wallet', 'New Seed Password (Optional)', QLineEdit.Password) if not ok: return if not seed_password: seed_password = None generate_seed_response = self.node_set.lnd_client.generate_seed( seed_password=seed_password) seed = generate_seed_response.cipher_seed_mnemonic seed_text = ''.join([ f'{index + 1}: {value}\n' for index, value in enumerate(seed) ]) seed_dialog = SeedDialog() seed_dialog.text.setText(seed_text) seed_dialog.show() timestamp = str(time.time()) keyring.set_password( service=f'lnd_{self.node_set.network}_wallet_password', username=timestamp, password=new_wallet_password) keyring.set_password(service=f'lnd_{self.node_set.network}_seed', username=timestamp, password=seed_text) if seed_password is not None: keyring.set_password( service=f'lnd_{self.node_set.network}_seed_password', username=timestamp, password=seed_password) self.node_set.lnd_client.initialize_wallet( wallet_password=new_wallet_password, seed=seed, seed_password=seed_password) except _Rendezvous as e: # noinspection PyProtectedMember self.error_message.showMessage(e._state.details) return keyring.set_password( service=f'lnd_{self.node_set.network}_wallet_password', username=self.node_set.bitcoin.file['rpcuser'], password=new_wallet_password)
def recover_wallet(self): try: new_wallet_password, ok = QInputDialog.getText( self.password_dialog, f'Recover {self.node_set.network} LND Wallet', 'New Wallet Password', QLineEdit.Password) if not ok: return seed_password, ok = QInputDialog.getText( self.password_dialog, f'Recover {self.node_set.network} LND Wallet', 'Seed Password (Optional)', QLineEdit.Password) if not ok: return if not seed_password: seed_password = None seed, ok = QInputDialog.getText( self.password_dialog, f'Recover {self.node_set.network} LND Wallet', 'Seed') if not ok: return seed_list = seed.split(' ') timestamp = str(time.time()) keyring.set_password( service=f'lnd_{self.node_set.network}_wallet_password', username=timestamp, password=new_wallet_password) keyring.set_password(service=f'lnd_{self.node_set.network}_seed', username=timestamp, password=seed) if seed_password is not None: keyring.set_password( service=f'lnd_{self.node_set.network}_seed_password', username=timestamp, password=seed_password) self.node_set.lnd_client.initialize_wallet( wallet_password=new_wallet_password, seed=seed_list, seed_password=seed_password, recovery_window=10000) except _Rendezvous as e: # noinspection PyProtectedMember self.error_message.showMessage(e._state.details) return keyring.set_password( service=f'lnd_{self.node_set.network}_wallet_password', username=self.node_set.bitcoin.file['rpcuser'], password=new_wallet_password)
def update_data(self): if self.chek: row = self.ui.tableWidget.currentRow() column = self.ui.tableWidget.currentColumn() value, ok = QInputDialog.getText(self, "Ввод нового значения", "Введите новое значение", QLineEdit.Normal, '') if value and ok: data = [] row1 = {} for i in range(7): item = self.ui.tableWidget.item(row, i).text() data.append(item) header = [ 'number', 'name', 'fname', 'phone', 'uid', 'nik', 'wo' ] for i in range(7): row2 = {} row2 = {header[i]: data[i]} row1.update(row2) new_collection.update_one( row1, {"$set": { f'{header[column]}': f'{value}' }}) QMessageBox.about(self, 'Успешно!', 'Для просмотра изменений обновите выборку') else: QMessageBox.about(self, 'Ошибка', 'Введите данные.') else: QMessageBox.about(self, 'Ошибка', 'Проанализируйте файл.')
def contextMenuEvent(self, event): contextMenu = QMenu(self) row = self.rowAt(event.pos().y()) reg = self.item(row, 0).text() unsetRegAction = QAction("Cancel symbolization", self) symRegAction = QAction("Symbolize Register", self) if reg in self.symRegs: contextMenu.addAction(unsetRegAction) else: contextMenu.addAction(symRegAction) action = contextMenu.exec_(self.viewport().mapToGlobal(event.pos())) if action == symRegAction: text, ok = QInputDialog.getText(self, "Symbolize register", "Size(bytes):") if ok: size = int(text) else: size = 8 self.symRegs[reg] = size self.updateContents() elif action == unsetRegAction: del self.symRegs[reg] self.updateContents()
def renameFile(self): if not os.path.exists(self.proxy.getFilePath()): self.eventManager.invalidFile.emit(self) return type = self.path.split(".")[1] name, entered = QInputDialog.getText(None, "Rename file", "Enter new file name: ", QLineEdit.Normal, self.path.split(".")[0]) if entered: name += "."+type parentDir = os.path.abspath(os.path.join(self.proxy.getFilePath(), os.pardir)) newPath = os.path.join(parentDir, name) regex = re.compile('[@!#$%^&*()<>?/\|}{~:]') if " " in name or regex.search(name): msg = QMessageBox() msg.setStyleSheet("background-color: #2D2D30; color: white;") msg.setModal(True) msg.setIcon(QMessageBox.Critical) msg.setText("File name cannot contain whitespace or special characters.") msg.setWindowTitle("File rename error") msg.exec_() return if os.path.exists(newPath): msg = QMessageBox() msg.setStyleSheet("background-color: #2D2D30; color: white;") msg.setModal(True) msg.setIcon(QMessageBox.Critical) msg.setText("File with the same name already exists.") msg.setWindowTitle("File rename error") msg.exec_() return os.rename(self.proxy.getFilePath(), newPath) oldPath = self.path self.proxy.path = self.path = os.path.basename(newPath) self.setText(0, self.path) self.eventManager.fileRename.emit(oldPath, self.proxy)
def save_to_forwarder_json(self): filename = file_dialog(True, "Save Forwarder JSON File", JSON_FILE_TYPES) if filename: provider_type, ok_pressed = QInputDialog.getItem( None, "Provider type", "Select provider type for PVs", ["ca", "pva"], 0, False, ) default_broker, ok_pressed = QInputDialog.getText( None, "Default broker", "Default Broker: (This will only be used for streams that do not already have a broker)", text="broker:port", echo=QLineEdit.Normal, ) if ok_pressed: with open(filename, "w") as file: nexus_constructor.json.forwarder_json_writer.generate_forwarder_command( file, self.instrument.nexus.entry, provider_type=provider_type, default_broker=default_broker, )
def code(self): text, ok = QInputDialog.getText(self.window, u'输入', '请输入文件名称') if ok: if text: coding.CodingWidget(self, self.window, text=text) else: self.messageBox("请输入文件名")
def delete_backup(self): current_item = self.backups_tree_widget.currentItem() if current_item is None: return backup_name = current_item.whatsThis(0) backup = Backups.load(backup_name) password, ret = QInputDialog.getText(self, "Password", "Enter your password:"******"Incorrect password", "Incorrect password") return reply = QMessageBox.question( self, "Confirm delete?", f"Are you sure you want to delete {backup_name}?", QMessageBox.Yes | QMessageBox.No, QMessageBox.No) if reply is QMessageBox.Yes: Backups.delete(backup_name) self.populate() self.app.scheduler.reload()
def make_new_file(self): """Create a new blank file to this Data Connections data directory.""" msg = "File name" # noinspection PyCallByClass, PyTypeChecker, PyArgumentList answer = QInputDialog.getText(self._toolbox, "Create new file", msg, flags=Qt.WindowTitleHint | Qt.WindowCloseButtonHint) file_name = answer[0] if not file_name.strip(): return # Check that file name has no invalid chars if any(True for x in file_name if x in INVALID_FILENAME_CHARS): msg = f"File name <b>{file_name}</b> contains invalid characters." self._logger.information_box.emit("Creating file failed", msg) return file_path = os.path.join(self.data_dir, file_name) if os.path.exists(file_path): msg = f"File <b>{file_name}</b> already exists." self._logger.information_box.emit("Creating file failed", msg) return try: with open(file_path, "w"): self._logger.msg.emit( f"File <b>{file_name}</b> created to Data Connection <b>{self.name}</b>" ) except OSError: msg = "Please check directory permissions." self._logger.information_box.emit("Creating file failed", msg) return
def _menu_dispatch(self, action: QAction): if action.text() == "Exit": self.close() elif action.text() == "&Save": self._content.binder.save() elif action.text() == "New Notebook": name, ok = QInputDialog.getText( self, "New Notebook", "New Notebook Name:", QLineEdit.Normal, "" ) if ok: success = self._content.binder.new_notebook(name) if not success: QMessageBox(self).warning( self, "Notebook Name Already Exists", "Another notebook with the name {} already exists in your workspace.".format(name) ) elif action.text() == "About": QMessageBox.about(self, "FreeNote", "Free Note is note taking software, developed by Zach Bullough. " "For more information, please visit github.com/qmuloadmin/freenote") elif action.text() == "S&ettings": SettingsDialog(self).show()
def onAddOptionGroup(self): text, ok = QInputDialog.getText(self.backtest, "请输入期权组名称", "名称", QLineEdit.Normal) current_item = self.backtest_tree.currentItem() # parent_item = current_item.parent() current_item_text = current_item.text(0) # parent_item_text = parent_item.text(0) if ok and text: node = QTreeWidgetItem(current_item) node.setText(0, text) node.setCheckState(0, Qt.Unchecked) node.setWhatsThis(0, "option_group") node.setIcon(0, QtGui.QIcon("../icon/group.png")) self.backtest_tree.expandItem(self.backtest_tree.currentItem()) group_dict = { "name": text, "enable": 1, "contracts": [], "signal": { "type": "list", "value": 0, "list": [] }, "ratio": { "type": "float", "value": 0, }, } for underlying in self.config["options"]["underlyings"]: if underlying.get("name") == current_item_text: underlying["groups"].append(group_dict)
def contextMenuEvent(self, event): menu = QtWidgets.QMenu(self) action_rename = menu.addAction("Rename") action_clipboard = menu.addAction("Copy to Clipboard (Again)") action_save = menu.addAction("Save Original") action_reset = menu.addAction("Reset to Original") action_frame = menu.addAction("Toggle Frame") action_close = menu.addAction("Close") action = menu.exec_(self.mapToGlobal(event.pos())) if action == action_save: self.save_copy() elif action == action_clipboard: self.clipboard.setPixmap(self.original_snap) elif action == action_reset: self.reset_size() elif action == action_frame: if self.flag_frame == True: self.flag_frame = False self.setWindowFlag(QtCore.Qt.FramelessWindowHint, True) self.hide() self.show() self.winsize = self.size() else: self.flag_frame = True self.setWindowFlag(QtCore.Qt.FramelessWindowHint, False) self.hide() self.show() self.winsize = self.size() self.reset_size() elif action == action_close: self.close() elif action == action_rename: name, tmp = QInputDialog.getText(self, "", "Name this window:") self.setWindowTitle(name)
def rename_parameter(self, param: ParameterBase, group: str) -> None: """Creates an input dialog where users can set a new name for the given parameter. NOTE: Currently defaults to updating downstream formulas if needed, by sub-classing the QInputDialog class it becomes possible to allow users to decide if they want to update downstream parameters. """ text = "Rename parameter '{}' to:".format(param.name) new_name, ok = QInputDialog.getText( self.window, "Rename parameter", text, ) if not ok or not new_name: return try: old_name = param.name if group == "project": bw.parameters.rename_project_parameter(param, new_name, True) elif group in bw.databases: bw.parameters.rename_database_parameter(param, new_name, True) else: bw.parameters.rename_activity_parameter(param, new_name, True) signals.parameters_changed.emit() signals.parameter_renamed.emit(old_name, group, new_name) except Exception as e: QMessageBox.warning( self.window, "Could not save changes", str(e), QMessageBox.Ok, QMessageBox.Ok )
def add_wordset(self): """Display a window to allow to add/edit/remove word sets The set is then imported in database. """ dialog = WordListDialog() if dialog.exec_() != QDialog.Accepted: return wordset_name = None while not wordset_name: wordset_name, _ = QInputDialog.getText( self, self.tr("Create a new set"), self.tr("Name of the new set:")) if not wordset_name: return if wordset_name in self.set_names: # Name already used QMessageBox.critical( self, self.tr("Error while creating set"), self. tr("Error while creating set '%s'; Name is already used") % wordset_name, ) wordset_name = None # Import & update view self.import_wordset(dialog.model.stringList(), wordset_name) self.populate()
def ask_question(self, player, tile_type, isCake): """ Interfaces with board, player, and QA manager to get question, get player input, verify input, and update accordingly Input: Player token who is answering question, the question type, and tile type to determine cake or not Output: True/False to determine subsequent action if answer is right Using just stdin/stdout for now to show functionality """ question = self.qa_manager.get_question(tile_type) answer, valid_input = QInputDialog.getText(self, tile_type + ' Question', question) if valid_input: correct, answer_string = self.qa_manager.check_answer(question, answer) if correct: QMessageBox.information(self, 'Your answer was...', 'Correct!', QMessageBox.Ok, QMessageBox.Ok) print("Correct") if isCake: player.award_cake_piece(tile_type) return True else: QMessageBox.information(self, 'Your answer was...', 'Incorrect! Correct answer was: ' + answer_string, QMessageBox.Ok, QMessageBox.Ok) print("Wrong") return False else: print("-----------------------") print("--- Input cancelled ---") print("-----------------------")
def save_all(self) -> bool: comment, ok = QInputDialog.getText(None, 'Commit', 'please enter a comment') if not ok: return False self._contact_model.commit(comment, self._contact_repo) return True
def history_information(): dialogBox = QInputDialog() info = '' dialog = QInputDialog.getText(dialogBox, 'Enter the history iformation', 'Author:') info = dialog[0] return info
def onBacktest(self): text, ok = QInputDialog.getText(self.window, u'输入', '请输入文件名称') if ok: if text: trading_center.TradeCenterWidget(self, self.window, text=text) else: self.messageBox(u"请输入文件名")
def submit_grep_command(self): if self.xsd_files_item == []: return self.selected_items = [] for i in self.xsd_files_item: if i.isSelected(): self.selected_items.append(str(i.file_path)) xvis = self.vsp.get_XVI_from_relative_xsd_files( self.selected_items)[0] a = getattr(xvis, "local_vasp_dir", "") if a == "" or a == None: return a += "/OUTCAR" a = a.replace("/", "\\", 99) command = str( QInputDialog.getText(self.main_window, "输入grep内容", "grep")[0]) if command == "": return try: command_ = "findstr %s %s" % (command, a) print(command_) return_ = os.popen(command_).read() print(return_) self.main_window_ui.commandOutput.setText(str(return_)) return except: traceback.print_exc()
def Create_Tok(self): text, ok = QInputDialog.getText(self, 'Input Dialog', 'Введите ваш API') if ok: text = text.encode('utf-8') code = 'booooooobs' key = RSA.generate(2048) encrypted_key = key.exportKey(passphrase=code, pkcs=8, protection="scryptAndAES128-CBC") with open('private_rsa_key.bin', 'wb') as file_key: file_key.write(encrypted_key) publick = key.publickey().exportKey() with open("config.txt", 'wb') as out_file: recipient_key = RSA.import_key(publick) session_key = get_random_bytes(16) cipher_rsa = PKCS1_OAEP.new(recipient_key) out_file.write(cipher_rsa.encrypt(session_key)) cipher_aes = AES.new(session_key, AES.MODE_EAX) ciphertext, tag = cipher_aes.encrypt_and_digest(text) out_file.write(cipher_aes.nonce) out_file.write(tag) out_file.write(ciphertext)
def pool(self): text, ok = QInputDialog.getText(self.window, u'输入', '请输入文件名称') if ok: if text: pool.PoolWidget(self, self.window, text=text) else: self.messageBox("请输入文件名")
def _on_add_faction_requested(self): if self.dispos_model: (faction_name, ok) = QInputDialog.getText(self, "Enter a faction name.", "Name:") if ok: self.dispos_model.add_faction(faction_name)
def bookSearch(self): # TODO: не работает поиск, если не совпадает регистр """ Слот для поиска информации в каталоге :return: None """ valid = False tip_text = None while not valid: s, ok = QInputDialog.getText(None, "Окно поиска", "Найти", text=tip_text) tip_text = s if ok: # self.sql.conn.create_function("mylower", 1, MainWindow.lower_func) # s = s.lower() self.sql.model.setFilter(f"Название_книги LIKE '%{s}%' " f"OR Автор LIKE '%{s}%' " f"OR Год_выпуска LIKE '%{s}%' " f"OR Жанр LIKE '%{s}%' " f"OR Статус LIKE '%{s}%'") self.sql.model.select() else: self.refresh() valid = True
def apply_context_menu_action(self, parent, action): """Applies given action from context menu. Args: parent (QWidget): The widget that is controlling the menu action (str): The selected action """ if action == "Copy": self._toolbox.project_item_to_clipboard() elif action == "Paste": self._toolbox.project_item_from_clipboard() elif action == "Duplicate": self._toolbox.duplicate_project_item() elif action == "Open directory...": self.project_item.open_directory() elif action == "Rename": # noinspection PyCallByClass answer = QInputDialog.getText( self._toolbox, "Rename Item", "New name:", text=self.name, flags=Qt.WindowTitleHint | Qt.WindowCloseButtonHint, ) if not answer[1]: pass else: new_name = answer[0] self.rename(new_name) elif action == "Remove item": self._project_item._project.remove_item(self.name, check_dialog=True)