def run_dd(self): while True: player_name = QInputDialog.getItem( self.alex_window, "Player selection", "Who found the Daily Double?", [p.name for p in self.players], editable=False, )[0] player = next((p for p in self.players if p.name == player_name), None) max_wager = max(player.score, 1000) wager_res = QInputDialog.getInt( self.alex_window, "Wager", f"How much does {player_name} wager? (max: ${max_wager})", min=0, max=max_wager, ) if wager_res[1]: break wager = wager_res[0] self.active_question.value = wager self.answering_player = player self.keystroke_manager.activate("CORRECT_RESPONSE", "INCORRECT_RESPONSE") self.dc.boardwidget.questionwidget.show_question()
def stopLater(self, x): if x: num, ok = QInputDialog.getInt(self, '输入', '剩余的战斗数量', 1, 1, 1919810, 1) if ok: fgoKernel.schedule.stopLater(num) else: self.BTN_STOPLATER.setChecked(False) else: fgoKernel.schedule.stopLater()
def stopLater(self, x): if x: num, ok = QInputDialog.getInt(self, '输入', '剩余的战斗数量', 0, 0, 1919810, 1) if ok: fgoFunc.control.terminateLater(num) else: self.ui.BTN_STOPLATER.setChecked(False) else: fgoFunc.control.terminateLater()
def capturar_ahorros(self): ahorros, ok = QInputDialog.getDouble( self, 'Captura de datos.', 'Escribe tu cantidad de ahorros:', 0, 1000, 1000000) # Minimo, incremento, Maximo if ok: self.lbl_ahorros_result.setText(str(ahorros))
def exclusions_add(self): exclusion, okay = QInputDialog.getText(self, "Add exclusion", "Path or pattern") exists = self.exclusions_list_widget.findItems( exclusion, Qt.MatchFlag.MatchExactly ) if okay and exclusion and not exists: self.exclusions_list_widget.addItem(exclusion) self.logger.info("Exclusion added.")
def openDPI(self): text, ok = QInputDialog.getInt(self, 'Установка DPI', 'Введите новый DPI:', getDPI(self.device), 100, 900, 10) if ok: setDPI(self.device, text) else: resetDPI(self.device)
def screenSize(self): text, ok = QInputDialog.getText(self, 'Установка разрешения экрана', "Текущее разрешение - " + getScreenSize( self.device) + "\nВведите новое разрешение экрана в формате 'Число'x'Число'") if ok: setScreenSize(self.device, text) else: resetScreenSize(self.device)
def proc(self): query_name = self.sender().text() qry = QSqlQuery() p_name = 'Номер участка' if query_name == 'Процедура 1': qry.prepare("""SELECT date, shift, coal_id, volume FROM production WHERE volume is moved GROUP BY date, volume """) elif query_name == 'Процедура 2': p_name = 'Номер участка' value, ok = QInputDialog.getInt(self, 'Ввод параметра', p_name) qry.prepare( """SELECT month, year, area_code, plan, removal_plan FROM limits WHERE year is strftime('%Y', 'now') AND area_code is :param """) qry.bindValue(':param', str(value)) elif query_name == 'Процедура 3': qry.exec("""INSERT INTO pf(id, name) VALUES (14, 'Рязанский ПФ'), (15, 'Уральский ПФ), (16, 'Забайкальский ПФ) """) elif query_name == 'Процедура 4': p_name = 'Номер участка' value, ok = QInputDialog.getInt(self, 'Ввод параметра', p_name) qry.prepare( """SELECT plan-volume, removal_plan-removal_volume FROM limits WHERE area_code is :param """) qry.bindValue(':param', str(value)) if query_name != 'Процедура 3': qry.exec() sqlq = QSqlQueryModel(self) qui = TheQResult(self) qui.ui.tableView.setModel(sqlq) sqlq.setQuery(qry) qui.ui.tableView.show() qui.show()
def getDevice(self): text, ok = (lambda adbList: QInputDialog.getItem( self, '选取设备', '在下拉列表中选择一个设备', adbList, adbList.index(fgoFunc.base.serialno) if fgoFunc.base.serialno and fgoFunc.base.serialno in adbList else 0, True, Qt.WindowFlags.WindowStaysOnTopHint))( [i for i, j in ADB().devices() if j == 'device']) if ok and text and text != fgoFunc.base.serialno: fgoFunc.base = fgoFunc.Base(text)
def forget_matches_for_attribute_task(self): logger.info("Execute task 'forget_matches_for_attribute_task'.") if self.document_base is not None: name, ok = QInputDialog.getText(self, "Forget Matches for Attribute", "Attribute name:") if ok: self.disable_global_input() # noinspection PyUnresolvedReferences self.forget_matches_for_attribute.emit(str(name), self.document_base)
def remove_attribute_task(self): logger.info("Execute task 'remove_attribute_task'.") if self.document_base is not None: name, ok = QInputDialog.getText(self, "Remove Attribute", "Attribute name:") if ok: self.disable_global_input() # noinspection PyUnresolvedReferences self.remove_attribute.emit(str(name), self.document_base)
def adjust_score(self, player): new_score, answered = QInputDialog.getInt( self.alex_window, "Adjust Score", f"Enter a new score for {player.name}", value=player.score, ) if answered: player.score = new_score
def capturar_nombre(self): nombre, ok = QInputDialog.getText(self, 'Captura de datos.', 'Escribe tu nombre completo:') if ok: nombre = nombre.strip() if len(nombre): self.lbl_nombre_result.setText(nombre)
def runMain(self): text, ok = QInputDialog.getItem(self, '肝哪个', '在下拉列表中选择战斗函数', ['完成战斗', '用户脚本'], 0, False) if ok and text: self.runFunc(fgoFunc.main, self.ui.TXT_APPLE.value(), self.ui.CBX_APPLE.currentIndex(), { '完成战斗': fgoFunc.battle, '用户脚本': fgoFunc.userScript }[text])
def getDevice(self): adbList = [i for i, j in ADB().devices() if j == 'device'] text, ok = QInputDialog.getItem( self, '选取设备', '在下拉列表中选择一个设备', adbList, adbList.index(fgoFunc.base.serialno) if fgoFunc.base.serialno and fgoFunc.base.serialno in adbList else 0, True, Qt.WindowFlags.WindowStaysOnTopHint) if ok and text: if text not in adbList: ADB(text) if text != fgoFunc.base.serialno: fgoFunc.base = fgoFunc.Base(text) self.ui.LBL_DEVICE.setText(fgoFunc.base.serialno)
def capturar_color(self): colores = [ 'Amarillo', 'Azul', 'Blanco', 'Rojo', 'Verde', 'Negro', 'Morado' ] color, ok = QInputDialog.getItem( self, 'Captura de datos.', 'Selecciona un color.', colores, 0, False ) # 0 inicia desde el color[0], False no permite editar la lista de colores if ok: self.lbl_color_result.setText(color)
def measure_angle(self): self.lea = QLineEdit(self) self.lea.move(130, 22) text, ok = QInputDialog.getText(self, 'Input Dialog', 'Angle name') if ok: self.lea.setText(str(text)) self.angleNames.append(self.lea.text()) QApplication.setOverrideCursor(QtCore.Qt.CrossCursor) #change cursor self.bezier.setEnabled(False) self.iw.measuring_angle = True self.iw._lastpos = None self.iw._thispos = None self.statusbar.showMessage('Click initial point for angle measurement') else: self.angleButton.setChecked(False)
def measure_area(self): self.lea = QLineEdit(self) self.lea.move(130, 22) text, ok = QInputDialog.getText(self, 'Input Dialog', 'Area name') if ok: self.lea.setText(str(text)) self.areaNames.append(self.lea.text()) QApplication.setOverrideCursor(QtCore.Qt.CrossCursor) #change cursor self.bezier.setEnabled(False) self.iw.line_count = 0 self.iw.measuring_area = True self.iw._lastpos = None self.iw._thispos = None self.iw.A = posData( np.empty(shape=(0, 0)), np.empty(shape=(0, 0))) #preallocate self.statusbar.showMessage('Click initial point for area measurement') else: self.areaButton.setChecked(False)
def measure_length(self): self.lel = QLineEdit(self) self.lel.move(130, 22) text, ok = QInputDialog.getText(self, 'Input Dialog', 'Length name') if ok: self.lel.setText(str(text)) self.lengthNames.append(self.lel.text()) QApplication.setOverrideCursor(QtCore.Qt.CursorShape.CrossCursor) #change cursor self.widthsButton.setChecked(False) self.widthsButton.setEnabled(False) self.iw.line_count = 0 self.iw.measuring_length = True self.iw.L = posData( np.empty(shape=(0, 0)), np.empty(shape=(0, 0))) #preallocate self.iw._lastpos = None self.iw._thispos = None self.statusbar.showMessage('Click initial point for length measurement') else: self.lengthButton.setChecked(False)
def adbConnect(self): text, ok = QInputDialog.getText(self, '连接设备', '远程设备地址', text='localhost:5555') if ok and text: ADB(text)
def capturar_edad(self): edad, ok = QInputDialog.getInt(self, 'Captura de datos.', 'Escribe tu edad:', 10, 1, 80) if ok: self.lbl_edad_result.setText(str(edad))
def stopOnSpecialDrop(self): num, ok = QInputDialog.getInt(self, '输入', '剩余的特殊掉落数量', 1, 0, 1919810, 1) if ok: fgoKernel.schedule.stopOnSpecialDrop(num)