Ejemplo n.º 1
0
    def enterPlaylistName(self):
        inputDialog = QInputDialog()
        inputDialog.setLabelText('Enter a name for the playlist: ')
        inputDialog.exec_()
        name = inputDialog.textValue().replace(" ", "")

        return name
Ejemplo n.º 2
0
    def createobj(self):
        self.objsCount = self.objsCount + 1
        msg = QInputDialog()
        msg.exec_()

        # if path.isfile('data.json') is True:
        #     with open ('data.json','r') as f:
        #         data = json.load(f)
        #         self.checklist = data
        #         print(self.checklist)
        #         print(type(self.checklist))

        txt = msg.textValue()
        if txt != '' and not txt.isspace():
            self.ls.clear()
            for i in self.checklist:
                # self.ls.clear()
                self.ls.append(i)

            if not self.ls:
                self.ls.append(-1)
            print(self.ls,'ls')
            self.s = max(self.ls)
            self.s = int(self.s) + 1

            self.checklist.update({self.s:txt})
            # print(self.checklist,'check')
            # bxx = QCheckBox(txt,self)
            # bxx.show()
            # bxx.move(10, self.s*20)
            # self.lista.append(bxx)
            # print(self.s)
            self.updateS()
            self.initUI()
Ejemplo n.º 3
0
    def enterPlaylistName(self):
        inputDialog = QInputDialog()
        inputDialog.setLabelText('Enter a name for the playlist: ')
        inputDialog.exec_()
        name = inputDialog.textValue().replace(" ", "")

        return name
Ejemplo n.º 4
0
    def new_profile(self):
        input_name = QInputDialog(self)
        input_name.setLabelText("Profile Name")
        input_name.setOkButtonText("Create")
        input_name.exec_()
        name = input_name.textValue()

        if name != '':
            self.save_profile(name)
Ejemplo n.º 5
0
 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)
Ejemplo n.º 6
0
 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)
Ejemplo n.º 7
0
 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
Ejemplo n.º 8
0
def inputTextCustom(title='No title',
                    label='Input',
                    text='',
                    width=500,
                    height=200,
                    parent=None):
    dlg = QInputDialog(parent)
    dlg.setInputMode(QInputDialog.TextInput)
    dlg.setLabelText(label)
    dlg.setTextValue(text)
    dlg.resize(width, height)
    dlg.exec_()
    return dlg.textValue()
    def filter_saving_process(self, error_text):
        if error_text:
            QMessageBox.about(
                self.view, 'Error',
                error_text
            )
            return
        input_name_dialog = QInputDialog(self.view)
        input_name_dialog.setWindowIconText('Save filter')
        input_name_dialog.setLabelText(
            'Enter filter name \n(you cannot use \' : = # ;\' symbols)'
        )
        input_name_dialog.setInputMode(QInputDialog.TextInput)

        while input_name_dialog.exec_():
            filter_name = input_name_dialog.textValue().lower()
            if not filter_name or set(':=#;') & set(filter_name):
                continue
            elif filter_name in self.filters_handler.items:
                reply = QMessageBox.question(
                    self.view,
                    'Warning',
                    'A filter with name \'{}\' '
                    'already exists. Overwrite?'.format(filter_name),
                    QMessageBox.Yes | QMessageBox.Cancel
                )
                if reply == QMessageBox.Yes:
                    self.filters_handler.add_filter(filter_name, self.current_filter)
                    self.view.set_current_filter(filter_name)
                    break
            else:
                self.filters_handler.add_filter(filter_name, self.current_filter)
                self.view.add_filter(filter_name)
                break
Ejemplo n.º 10
0
 def slot_set_robot_id(self):
     self.parent().releaseKeyboard()
     dialog = QInputDialog(self)
     dialog.setModal(True)
     dialog.setStyleSheet("""
     background-color: rgba(0, 0, 0, 200);
     border:1px solid rgba(0, 200, 200, 150);
     """)
     dialog.setFixedSize(350, 250)
     dialog.setWindowTitle('Set Input Flow for Improcessor')
     dialog.setInputMode(QInputDialog.TextInput)
     dialog.setLabelText('请输入……(机器人的ID)')
     dialog.setTextValue('7')
     dialog.setOkButtonText('Ok')
     dialog.setCancelButtonText('Cancel')
     if dialog.exec_() == QDialog.Accepted:
         id = dialog.textValue()
         if self.mRobot:
             self.mRobot.mId = int(id)
             self.deleteOptionList(0)
             self.insertOptionList(
                 '%s [ID: %d]' % (self.mRobot.client_addr, self.mRobot.mId),
                 self.defaultFunc, 0)
             self.parent().grabKeyboard()
             self.signalFocusedChanged.emit(self, True)
     else:
         print("dialog canceled")
     dialog.show()
Ejemplo n.º 11
0
    def read_time(self):

        self.time_start = min(
            [self.sygnals[i].x_data[0] for i in range(len(self.sygnals))])
        self.time_fin = max(
            [self.sygnals[i].x_data[-1] for i in range(len(self.sygnals))])

        time_str = 'от ' + mk_to_str(self.time_start) + ' до ' + mk_to_str(
            self.time_fin)
        labelT = "Введите интервал для отбора по времени:"
        while True:
            dlg = QInputDialog(self)
            dlg.setInputMode(QInputDialog.TextInput)
            dlg.setWindowTitle("Установка времени отбора")
            dlg.setLabelText(labelT)
            dlg.resize(500, 200)
            dlg.setTextValue(time_str)
            ok = dlg.exec_()
            if not (ok):
                break
            time_str2 = dlg.textValue()
            try:
                time_start, time_fin = time_str2.split(
                    ' ')[1], time_str2.split(' ')[3]
                time_start, time_fin = str_to_mkt([time_start, time_fin])

                time_start, time_fin = time_start + 3600 * 3, time_fin + 3600 * 3

            except Exception:
                labelT = "Неверный формат ввода, повторите:"
                dlg.setTextValue(time_str)
            else:
                break

        self.selection_by_time(time_start, time_fin)
Ejemplo n.º 12
0
    def select_btn(self):
        self.full_values()
        self.time_start = self.vertical_headers[0]
        self.time_fin = self.vertical_headers[-1]


        time_str = 'от '+ mk_to_str(self.time_start) + ' до ' + mk_to_str(self.time_fin)
        labelT = "Введите интервал для отбора по времени:"
        while True:
            dlg = QInputDialog(self)
            dlg.setInputMode(QInputDialog.TextInput)
            dlg.setWindowTitle("Установка времени отбора")
            dlg.setLabelText(labelT)
            dlg.resize(500,200)
            dlg.setTextValue(time_str)
            ok = dlg.exec_()
            if not(ok):
                break
            time_str2 = dlg.textValue()
            try:
                time_start,time_fin = time_str2.split(' ')[1],time_str2.split(' ')[3]
                time_start,time_fin = str_to_mkt(time_start),str_to_mkt(time_fin)

                self.time_start,self.time_fin = time_start+3600*3,time_fin+3600*3

            except Exception:
                labelT = "Неверный формат ввода, повторите:"
                dlg.setTextValue(time_str)
            else:
                break
        self.select_by_time()
Ejemplo n.º 13
0
def askPasswordDialog(parent, title, prompt, timeout = None):
    if parent is None:
        app = qttools.createQApplication()
        translator = qttools.translator()
        app.installTranslator(translator)

    import icon
    dialog = QInputDialog()

    timer = QTimer()
    if not timeout is None:
        timer.timeout.connect(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)
Ejemplo n.º 14
0
 def getEDID(self):
     pwdInputDialog = QInputDialog()
     pwdInputDialog.setFixedSize(250, 150)
     pwdInputDialog.setWindowTitle('权限申请')
     pwdInputDialog.setLabelText('请输入root账户密码:')
     pwdInputDialog.setOkButtonText('确认')
     pwdInputDialog.setCancelButtonText('取消')
     pwdInputDialog.setTextEchoMode(QLineEdit.Password)
     pwdInputDialog.setInputMode(QInputDialog.TextInput)
     okPressed = pwdInputDialog.exec_()
     pwd = pwdInputDialog.textValue()
     if okPressed and pwd != '':
         os.system('echo ' + pwd + ' | sudo -S get-edid > edid.bin')
         edidFile = open('edid.bin', 'rb')
         self.edidBytes = edidFile.read()
         edidFile.close()
         os.remove('edid.bin')
     else:
         messageBox = QMessageBox()
         messageBox.setWindowTitle('警告')
         messageBox.setText('获取屏幕信息需要root权限, 请正确输入密码!')
         messageBox.addButton(QMessageBox.Yes)
         buttonY = messageBox.button(QMessageBox.Yes)
         buttonY.setText('确定')
         messageBox.exec_()
Ejemplo n.º 15
0
    def wybor(self):
        poz_lista = [
            'Wykaz narzędzi ',
            "SELECT * FROM ",
            'Baza nie zawiera żadnych pozycji. Plik nie zostanie zapisany.',
        ]

        lista_poz = []
        lista_poz.append('Brak')
        from narzedzia_poz import naglowki
        for i in naglowki():
            if "/" in i[0]:
                lista_poz.append(i[0])
        inp = QInputDialog(self)
        inp.setWhatsThis('Wybierz pozycję aby eksportować do pliku')
        inp.setLabelText('Wybierz pozycję:')
        inp.setWindowTitle('Pozycje')
        inp.setComboBoxItems(lista_poz)
        inp.setCancelButtonText('Anuluj')

        if inp.exec_() == QDialog.Accepted:
            print(inp.textValue())
            poz_lista[0] += inp.textValue()
            poz_lista[1] += "'" + inp.textValue() + "'"
            if inp.textValue() != 'Brak':
                self.export(poz_lista)
                self.statusBar().showMessage(
                    "Wyeksportowano do pliku", 10000)
            else:
                QMessageBox.critical(self, 'Wybierz pozycję',
                                     'Nie wybrano żadnej pozycji!',
                                     QMessageBox.Ok,
                                     QMessageBox.Ok)
Ejemplo n.º 16
0
def askPasswordDialog(parent, title, prompt, timeout=None):
    if parent is None:
        app = qttools.createQApplication()
        translator = qttools.translator()
        app.installTranslator(translator)

    import icon
    dialog = QInputDialog()

    timer = QTimer()
    if not timeout is None:
        timer.timeout.connect(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)
Ejemplo n.º 17
0
    def slot_add_EPuck(self):
        dialog = QInputDialog(self)
        dialog.setModal(True)
        dialog.setStyleSheet("""
        background-color: rgba(0, 0, 0, 200);
        border:1px solid rgba(0, 200, 200, 150);
        """)
        dialog.setFixedSize(350, 250)
        dialog.setWindowTitle('Set Input Flow for Improcessor')
        dialog.setInputMode(QInputDialog.TextInput)
        dialog.setLabelText('请输入……(机器人的ip)')
        dialog.setTextValue('192.168.3.5')
        dialog.setOkButtonText('Ok')
        dialog.setCancelButtonText('Cancel')
        if dialog.exec_() == QDialog.Accepted:
            ip = dialog.textValue()
            robot_controller = MainController.getController().mRobotController

            robot_controller.addRobot(RobotEpuck)
            robot = robot_controller.getRobot(-1)
            robot.connect(ip)
            view = RobotFrame(self)
            view.setRobot(robot)
            self.addSubview(view)
        else:
            print("dialog canceled")
        dialog.show()
Ejemplo n.º 18
0
    def on_btn_run_clicked(self):
        password = "******"
        if self.export_mode == "scp":
            dlg = QInputDialog(self)
            dlg.setInputMode(QInputDialog.TextInput)
            dlg.setWindowTitle(_("Connecting to %s") % self.paras.exp_scp_server)
            dlg.setLabelText(_("Password for %s@%s:") % (self.paras.exp_scp_user, self.paras.exp_scp_server))
            dlg.setTextEchoMode(QLineEdit.Password)
            #dlg.resize(300, 100)
            if dlg.exec_():
                password = dlg.textValue()
            else:
                return

        super(TransportWidget, self).on_btn_run_clicked()
        self.executor_thread = TransportThread(self.paras,
                                               self.export_mode,
                                               self.all_resources,
                                               password,
                                               self)
        self.executor_thread.signal_exception.connect(self.on_signal_exception)
        self.executor_thread.ask_confirmation.connect(self.on_ask_confirmation)
        self.executor_thread.signal_main_event.connect(self.on_signal_main_event)
        self.executor_thread.signal_minor_event.connect(self.on_signal_minor_event)
        self.executor_thread.signal_next_file.connect(self.on_signal_next_file)
        self.executor_thread.signal_end_processing.connect(self.on_signal_end_processing)
        self.executor_thread.finished.connect(self.on_executor_thread_finished)
        self.executor_thread.start()
        self.update()
Ejemplo n.º 19
0
 def passwordPrompt(self, conName=None, conURL=None):
     '''if the connection is defined as prompt for password then prompt the user for a password and return what they enter.
       if the connection already has a password then return None
     '''
     self.settings = QSettings()
     # get the neocon dictionary from settings
     neoDict = self.settings.value("NeoCon/connection/{}".format(conName))
     if neoDict["prompt"] == "True":
         msgBox = QInputDialog()
         msgBox.setLabelText(
             "Enter password for connection: {} URL:{}".format(
                 str(conName), str(conURL)))
         msgBox.setInputMode(QInputDialog.TextInput)
         msgBox.setTextEchoMode(QLineEdit.Password)
         msgBox.exec_()
         return msgBox.textValue()
     else:
         return None
Ejemplo n.º 20
0
def input_dialog(title, label):
    dialog = QInputDialog(None, dialog_flags)
    dialog.setInputMode(QInputDialog.TextInput)
    dialog.setWindowTitle(title)
    dialog.setLabelText(label)
    dialog.setFont(font())
    ok = dialog.exec_()
    filename = dialog.textValue()
    return ok, filename
Ejemplo n.º 21
0
 def addRow(self):
     dlg = QInputDialog(self)
     dlg.setInputMode(QInputDialog.TextInput)
     dlg.setLabelText("Channel:")
     dlg.resize(500, 100)
     ok = dlg.exec_()
     pv = dlg.textValue()
     #pv, ok = QInputDialog.getText(self, "Input", "Enter channel")
     if ok:
         print(pv)
         self.parent.addPv(pv)
Ejemplo n.º 22
0
def _string_query(title, caption, parent, prepared='', ok_label=None):
    qd = QInputDialog(parent)
    qd.setInputMode(QInputDialog.TextInput)
    if ok_label is not None:
        qd.setOkButtonText(ok_label)
    qd.setTextValue(prepared)
    qd.setWindowTitle(title)
    qd.setLabelText(caption)
    ok = (QDialog.Accepted == qd.exec_())
    answer = qd.textValue() if ok else ''
    return (ok, answer)
Ejemplo n.º 23
0
def _string_query( title, caption, parent, prepared='', ok_label=None ):
    qd = QInputDialog(parent)
    qd.setInputMode(QInputDialog.TextInput)
    if ok_label is not None :
        qd.setOkButtonText(ok_label)
    qd.setTextValue(prepared)
    qd.setWindowTitle(title)
    qd.setLabelText(caption)
    ok = ( QDialog.Accepted == qd.exec_() )
    answer = qd.textValue() if ok else ''
    return (ok, answer)
Ejemplo n.º 24
0
 def on_action_save_configuration_as_triggered(self):
     text = _("Save configuration as...")
     if self.tabframe.about_to_change(text):
         dlg = QInputDialog(self)
         dlg.setInputMode(QInputDialog.TextInput)
         dlg.setWindowTitle(text)
         dlg.setLabelText(_("Configuration name:"))
         dlg.setTextValue(self.paras.configuration_name())
         dlg.resize(300, 100)
         if dlg.exec_():
             self.ctrl.save_configuration_as(dlg.textValue())
Ejemplo n.º 25
0
 def changePlayerName(self, event):
     '''
     Method that calls input dialog to change player's name.
     '''
     input = QInputDialog(self)
     input.setLabelText("Name")
     input.setWindowTitle("Change name")
     if input.exec_() == 1:
         newName = input.textValue()
         self.game.player.name = newName
         self.player.setText(newName)
         self.updateDiploLabels()
Ejemplo n.º 26
0
 def chooseterm(self):
     inputdialog = QInputDialog(self)
     inputdialog.setIntRange(100000, 999999)
     inputdialog.setIntValue(201701)
     inputdialog.setWindowTitle('学期')
     inputdialog.setLabelText('输入学期(如201701):')
     inputdialog.setOkButtonText('确定')
     inputdialog.setCancelButtonText('取消')
     inputdialog.setWindowOpacity(0.7)
     ok = inputdialog.exec_()
     if ok:
         self.termValueLabel.setText(str(inputdialog.intValue()))
Ejemplo n.º 27
0
 def execInput(self):
     '''
     Executes the input dialog for adding gold in the offer.
     '''
     input = QInputDialog()
     input.setWindowTitle("Gold ammount")
     msg = "Enter negative number"
     msg = msg + " to offer and positive number to demand gold"
     input.setLabelText(msg)
     input.setIntRange(-self.active.gold, self.player.gold)
     input.setIntValue(0)
     result = input.exec_()
     self.gold = -input.intValue()
     return result
	def getText(self,matdata):
		inputBox=QInputDialog()
		inputBox.setInputMode(0)
		inputBox.setWindowTitle('MatFileKeyInputDialog')
		itemlist=list()
		for key in matdata.keys():
			itemlist.append(key)
		inputBox.setComboBoxItems(itemlist)
		inputBox.setComboBoxEditable(False)
		inputBox.setLabelText('Please Input MatFile Key')
		inputBox.setOkButtonText(u'Ok')
		inputBox.setCancelButtonText(u'Cancel')
		if inputBox.exec_() and inputBox.textValue()!='':
			return inputBox.textValue()
Ejemplo n.º 29
0
 def chooseterm(self):
     inputdialog = QInputDialog(self)
     items = [
         '大一上期', '大一下期', '大二上期', '大二下期', '大三上期', '大三下期', '大四上期', '大四下期'
     ]
     inputdialog.setComboBoxItems(items)
     inputdialog.setWindowTitle('学期')
     inputdialog.setLabelText('选择学期:')
     inputdialog.setOkButtonText('确定')
     inputdialog.setCancelButtonText('取消')
     inputdialog.setWindowOpacity(0.7)
     ok = inputdialog.exec_()
     if ok:
         self.termValueLabel.setText(str(inputdialog.textValue()))
Ejemplo n.º 30
0
 def on_click_saveLineToken(self):
     LineValue = readConfig('notify', 'tokenline', 'config.ini')
     inputbox = QInputDialog(self)
     inputbox.setWindowTitle('Line token')
     inputbox.setInputMode(QInputDialog.TextInput)
     inputbox.setLabelText('Input Line token')
     inputbox.setTextValue(LineValue)
     inputbox.resize(400, 100)
     ok = inputbox.exec_()
     lineToken = inputbox.textValue()
     if ok:
         saveConfig('notify', 'tokenline', lineToken, 'config.ini')
     else:
         pass
Ejemplo n.º 31
0
 def on_click_saveFacebookID(self):
     FacebookIDValue = readConfig('notify', 'facebookID', 'config.ini')
     inputbox = QInputDialog(self)
     inputbox.setWindowTitle('Facebook ID')
     inputbox.setInputMode(QInputDialog.TextInput)
     inputbox.setLabelText('Input Facebook ID')
     inputbox.setTextValue(FacebookIDValue)
     inputbox.resize(250, 100)
     ok = inputbox.exec_()
     FacebookID = inputbox.textValue()
     if ok:
         saveConfig('notify', 'facebookID', FacebookID, 'config.ini')
     else:
         pass
Ejemplo n.º 32
0
    def mouseDoubleClickEvent(self, e: 'QMouseEvent') -> None:

        index = self.currentIndex()
        curr_data = self.model.data(index, role=Qt.DisplayRole)

        input_dialog = QInputDialog(self)
        input_dialog.setTextValue(curr_data)
        input_dialog.exec_()
        text = input_dialog.textValue()
        try:
            try:
                if text.find('.'):
                    val = float(text)
                else:
                    val = int(text)
            except:
                val = str(text)
        except:
            import traceback
            traceback.print_exc()
            return

        self.model.setData(index, val)
Ejemplo n.º 33
0
 def newWorkspaceClicked(self):
     dlg = QInputDialog(self.ui)
     dlg.setInputMode(QInputDialog.TextInput)
     dlg.setLabelText(self._tr("Workspace name:"))
     dlg.resize(rt(300), rt(100))
     ok = dlg.exec_()
     name = dlg.textValue()
     if ok:
         try:
             workspace = workspace_service.createWorkspace(name)
             self.onWorkspaceChanged(workspace_name=workspace.name)
             self.loadWorkspaces()
         except WorkspaceAlreadyExistsException:
             message_utils.error(
                 self._tr('Workspace already exists'),
                 self._tr('Please choose a different workspace\'s name'))
Ejemplo n.º 34
0
    def new(self):
        row = self.listWidget.currentRow()

        inputDialog = QInputDialog()
        inputDialog.setWindowIcon(QIcon(ICON))
        inputDialog.setWindowTitle("New Clause"), inputDialog.setLabelText("Enter a new clause")
        inputDialog.setInputMode(QInputDialog.TextInput)
        inputDialog.setFont(DIALOG_FONT)
        inputDialog.resize(500, 0)

        ok = inputDialog.exec_()
        text = inputDialog.textValue()

        if ok and text is not None:
            self.listWidget.insertItem(row + 1, text)
            self.listWidget.setCurrentRow(row + 1)
Ejemplo n.º 35
0
    def mouseDoubleClickEvent(self, event):
        if self.hasFocus():
            font = QFont('Arial', C_Font_Size['UI'] - 2)
            inputDialog = QInputDialog(None)
            inputDialog.setInputMode(QInputDialog.TextInput)
            inputDialog.setWindowTitle('Input a name')
            inputDialog.setLabelText('Enter the name for this Indicator')
            inputDialog.setTextValue(self.Name.text())
            inputDialog.setFont(font)
            okPressed = inputDialog.exec_()

            if okPressed:
                self.Name.setText(inputDialog.textValue())
                self.Name.show()
                self.Attach_Name_Label()
                print("%s Send text change Signal" % self)
                self.Changed_Signal.emit([self])