Beispiel #1
0
 def ask_for_password(self):
     input_dlg = QInputDialog(parent=self)
     input_dlg.setTextEchoMode(QLineEdit.Password)
     input_dlg.setWindowTitle("Enter WebREPL password")
     input_dlg.setLabelText("Password")
     input_dlg.resize(500, 100)
     input_dlg.exec()
     return input_dlg.textValue()
Beispiel #2
0
    def ask_for_password(self, title, label="Password"):
        if self._preset_password is not None:
            return self._preset_password

        input_dlg = QInputDialog(parent=self, flags=Qt.Dialog)
        input_dlg.setTextEchoMode(QLineEdit.Password)
        input_dlg.setWindowTitle(title)
        input_dlg.setLabelText(label)
        input_dlg.resize(500, 100)
        input_dlg.exec()
        return input_dlg.textValue()
Beispiel #3
0
    def ask_for_password(self, title, label="Password"):
        if self._preset_password is not None:
            return self._preset_password

        input_dlg = QInputDialog(parent=self, flags=Qt.Dialog)
        input_dlg.setTextEchoMode(QLineEdit.Password)
        input_dlg.setWindowTitle(title)
        input_dlg.setLabelText(label)
        input_dlg.resize(500, 100)
        input_dlg.exec()
        return input_dlg.textValue()
Beispiel #4
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)
Beispiel #5
0
 def new_project(self, project):
     dlg = QInputDialog()
     dlg.setLabelText("Please enter a name for your new %s project" % project.NAME)
     dlg.setOkButtonText("Create project")
     res = dlg.exec()
     if not res:
         return
     name = dlg.textValue()
     proj = self.projlist.init_project(name, project)
     self.main_window.add_project(proj)
Beispiel #6
0
 def handle_doubleClickTab(self, index):
     """Edit Application name, tab only, the dictinary key remains unchanged"""
     old_name = self.ApplicationtabWidget.tabText(index)
     dlg = QInputDialog(self)
     dlg.setWindowTitle("Change Application Name")
     dlg.setLabelText("New Application Name:")
     dlg.setTextValue(old_name)
     dlg.resize(400, 100)
     success = dlg.exec()
     new_tab_name = dlg.textValue()
     if (success and new_tab_name != ""):
         self.ApplicationtabWidget.setTabText(index, new_tab_name)
Beispiel #7
0
    def handle_thTabBarDoubleClicked(self, index):
        """Edit Theory name

        Edit the theory tab name, leave 'theories' dictionary keys unchanged.
        Two tabs can share the same name"""
        old_name = self.TheorytabWidget.tabText(index)
        dlg = QInputDialog(self)
        dlg.setWindowTitle("Change Theory Name")
        dlg.setLabelText("New Theory Name:")
        dlg.setTextValue(old_name)
        dlg.resize(400, 100)
        success = dlg.exec()
        new_tab_name = dlg.textValue()
        if success and new_tab_name != "":
            self.TheorytabWidget.setTabText(index, new_tab_name)
Beispiel #8
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())
Beispiel #9
0
 def askForChapter(self):
     chapters = []
     selected_ch = 0
     chapter_index_curr = 0
     for ch in self.model.getChapters():
         ch_num = self.getChapterNumber(ch)
         if ch_num in self.model.allowed_chapters:
             chapters.append(ch)
             if ch_num == self.model.engine.currentDungeon:
                 selected_ch = chapter_index_curr
             chapter_index_curr += 1
     dialog = QInputDialog()
     dialog.setStyleSheet("")
     dialog.setComboBoxItems(chapters)
     dialog.setWindowTitle("Select chapter")
     dialog.setLabelText("Chapter:")
     ret = dialog.exec()
     if ret:
         new_ch = self.getChapterNumber(dialog.textValue())
         self.controller.requestchangeCurrentChapter(new_ch)
Beispiel #10
0
 def handle_action_save_theory_data(self):
     """Save theory data of current theory"""
     th = self.current_theory
     if th:
         # file browser window
         dir_start = "data/"
         dilogue_name = "Select Folder"
         folder = QFileDialog.getExistingDirectory(self, dilogue_name, dir_start)
         if os.path.isdir(folder):
             dialog = QInputDialog(self)
             dialog.setWindowTitle('Add label to filename(s)?')
             dialog.setLabelText('Add the following text to each saved theory filename(s):')
             dialog.setTextValue('')
             dialog.setCancelButtonText('None')
             if dialog.exec():
                 txt = dialog.textValue()
                 if txt != '':
                     txt = '_' + txt
             else:
                 txt = ''
             self.theories[th].do_save(folder, txt)
 def getuserInfo(self):
     font = QFont()
     font.setFamily("Grandstander Black")
     font.setPointSize(10)
     global userInfo
     inputDialog = QInputDialog(None)
     inputDialog.setInputMode(QInputDialog.TextInput)
     inputDialog.setWindowTitle('Enter Your Details')
     inputDialog.setLabelText(
         "Your gender and age in format(given below)   \n eg:f24")
     inputDialog.setFont(font)
     inputDialog.setStyleSheet("""
     background-color: #5D6D7E;
     color: #17202A
     """)
     okPressed = inputDialog.exec()
     userInfo = inputDialog.textValue()
     if okPressed and userInfo != '':
         global count
         count = register_Background()
         self.popup = AnotherWindow()
         self.popup.setFixedSize(1350, 200)
         self.popup.show()
Beispiel #12
0
 def _click(self, event):
     if self._hexpass:
         self.note_win = Note(self, hexpass=self._hexpass)
     else:
         qid = QInputDialog(self)
         qid.setWindowIcon(QIcon(OPEN_PIXMAP))
         qid.setWindowTitle(self.lang['pass_title'])
         qid.setOkButtonText(self.lang['ok_button'])
         qid.setCancelButtonText(self.lang['pass_cancel_button'])
         if 'note' in self.conf:
             qid.setLabelText(self.lang['pass_text'])
             qid.setTextEchoMode(QLineEdit.Password)
         else:
             qid.setLabelText(self.lang['create_pass_text'])
         if qid.exec() == QInputDialog.Accepted:
             text = qid.textValue()
             if text:
                 self.note_win = Note(self, text)
                 if self._session:
                     self._hexpass = self.note_win.cip.hexpass
                     self._start_timer()
             else:
                 self.show_pass_error(True)
Beispiel #13
0
 def _add(self, checked):
     id = QInputDialog(self)
     id.setWindowIcon(QIcon(HELP))
     id.setWindowTitle(self.lang['input_title'])
     id.setLabelText(self.lang['input_text'])
     id.setTextValue('s.vomine.ru:25565')
     id.setOkButtonText(self.lang['input_ok_button'])
     id.setCancelButtonText(self.lang['input_cancel_button'])
     if id.exec() == QInputDialog.Accepted:
         text = id.textValue()
         if not text or len(text.split(':')) != 2 \
                 or not text.split(':')[1].isdigit():
             self._show_error()
         else:
             self.main.servers.append(text)
             self.main.widget_manager.config.config[
                 self.main.info.NAME]['servers'] = json.dumps(
                     self.main.servers)
             self.main.widget_manager.config.save()
             self.main._list_fill()
             self._list_fill()
             self.__change_enabeld()
             self.list.setCurrentRow(self.list.count() - 1)
Beispiel #14
0
 def handle_action_save_theory_data(self):
     """Save theory data of current theory"""
     th = self.current_theory
     if th:
         # file browser window
         dir_start = join(RepTate.root_dir, "data")
         dilogue_name = "Select Folder"
         folder = QFileDialog.getExistingDirectory(self, dilogue_name,
                                                   dir_start)
         if isdir(folder):
             dialog = QInputDialog(self)
             dialog.setWindowTitle("Add label to filename(s)?")
             dialog.setLabelText(
                 "Add the following text to each saved theory filename(s):")
             dialog.setTextValue("")
             dialog.setCancelButtonText("None")
             if dialog.exec():
                 txt = dialog.textValue()
                 if txt != "":
                     txt = "_" + txt
             else:
                 txt = ""
             self.theories[th].do_save(folder, txt)
Beispiel #15
0
    def nueva_sol(self, restricciones, mensaje, respuesta, iteraciones,
                  holgura, artificial, data):

        vars_sol = []

        vars_entrada = []

        ultima_iteracion = iteraciones[len(iteraciones) - 1]

        for var in respuesta:
            tmp = str(var).split(" = ")
            if float(tmp[1]) > 0 and tmp[0] != 'Z':
                vars_sol.append(tmp[0])

        print("VARIABLES DE LA SOLUCION: ", vars_sol)

        for var in range(len(ultima_iteracion[0])):
            if ultima_iteracion[0][var] != "V.B" and ultima_iteracion[0][
                    var] != 'bi' and not ultima_iteracion[0][var] in vars_sol:
                if ultima_iteracion[len(ultima_iteracion) - 1][var] == 0:
                    vars_entrada.append(ultima_iteracion[0][var])

        print("VARIABLES DE ENTRADA: ", vars_entrada)

        input_ = QInputDialog(self)
        input_.setLabelText("Seleccione la nueva Variable de Entrada")
        input_.setWindowTitle("Seleccione la Nueva Variable de entrada")
        input_.setComboBoxItems(vars_entrada)
        input_.setOkButtonText("Encontrar la nueva Solución")
        input_.setCancelButtonText("Cancelar")
        button = input_.exec()

        print("RESULT: ", input_.textValue())
        print("BUTTON: ", button)

        pivote = sp.special_solution(
            ultima_iteracion[0].index(input_.textValue()), ultima_iteracion)

        sol_ = copy.deepcopy(ultima_iteracion)
        sol_ = sp.var_salida(sol_, pivote)
        sol_ = sp.reducir_fila_pivote(sol_, pivote)

        sol_ = sp.nueva_solucion_v2(sol_, pivote, holgura, artificial)
        sol_ = sp.depurar_nueva_solucion(sol_)
        iteraciones.append(sol_)
        respuesta = sp.generar_solucion(sol_, 2)

        message = QMessageBox()
        message.setWindowTitle("Simplex")
        message.setText("Nueva Solución")

        sol = ""
        for var in respuesta:
            sol = sol + var + "\n"

        message.setInformativeText("Solución: \n\n" + sol + "\n" +
                                   "¿Desea obtener una nueva solución?")
        yes = message.addButton("Sí", QMessageBox.YesRole)
        no = message.addButton("No", QMessageBox.NoRole)
        message.setIcon(QMessageBox.Information)
        message.setStyleSheet("font-weight: bold;")

        message.exec()

        if message.clickedButton() == yes:
            self.nueva_sol(restricciones, mensaje, respuesta, iteraciones,
                           holgura, artificial, data)
        elif message.clickedButton() == no:

            reporte = saveReport(restricciones, respuesta, iteraciones,
                                 mensaje, data)
            reporte.crear_pdf()
            reporte.mostrar_pdf()