Ejemplo n.º 1
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.º 2
0
 async def _show_dialog(self, main_window: QMainWindow,
                        indexes: list[int]) -> int:
     dialog = QInputDialog(main_window)
     dialog.setLabelText("Line number to move subtitles to:")
     dialog.setIntMinimum(1)
     dialog.setIntMaximum(len(self.api.subs.events))
     if indexes:
         dialog.setIntValue(indexes[0] + 1)
     dialog.setInputMode(QInputDialog.IntInput)
     if not await async_dialog_exec(dialog):
         raise CommandCanceled
     return cast(int, dialog.intValue()) - 1
Ejemplo n.º 3
0
 async def _show_number_dialog(
     self, main_window: QMainWindow
 ) -> Optional[int]:
     dialog = QInputDialog(main_window)
     dialog.setLabelText("Line number to jump to:")
     dialog.setIntMinimum(1)
     dialog.setIntMaximum(len(self.api.subs.events))
     if self.api.subs.has_selection:
         dialog.setIntValue(self.api.subs.selected_indexes[0] + 1)
     dialog.setInputMode(QInputDialog.IntInput)
     if await async_dialog_exec(dialog):
         return dialog.intValue()
     return None
Ejemplo n.º 4
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
Ejemplo n.º 5
0
def openGoToTrialDialog(event):
    #Only works if session is loaded in playback
    if playMode != PlayMode.PLAYBACK or (not ts.currentSession):
        return

    #Open dialog box to prompt for trial number
    inputDialog = QInputDialog(mainWindow.centralwidget)
    inputDialog.setInputMode(QInputDialog.IntInput)
    inputDialog.setWindowTitle("Go To Trial")
    inputDialog.setLabelText("Go To Trial...")
    inputDialog.setFont(popUpFont)
    inputDialog.setIntValue(ts.currentSession.currentTrial)
    ok = inputDialog.exec()

    #If clicked OK, go to specified trial
    if ok:
        loadTrial(inputDialog.intValue())
Ejemplo n.º 6
0
    def edit_go_to(self):
        dialog = QInputDialog()

        dialog.setWindowTitle('Go To Line')
        dialog.setLabelText('Line number:')
        dialog.setOkButtonText('Go To')
        dialog.setInputMode(QInputDialog.IntInput)
        dialog.setWindowIcon(self.notepad_icon)

        dialog.exec()
        line_number = dialog.intValue()

        if line_number > 0:
            new_cursor = self.ui.textField.textCursor()
            new_cursor.movePosition(QTextCursor.Start, QTextCursor.MoveAnchor)
            new_cursor.movePosition(QTextCursor.Down, QTextCursor.MoveAnchor,
                                    line_number - 1)
            self.ui.textField.setTextCursor(new_cursor)
Ejemplo n.º 7
0
 def __onSetBPMDone(self, dialog: QtWidgets.QInputDialog) -> None:
     with self.project.apply_mutations('Change BPM'):
         self.project.bpm = dialog.intValue()