Exemplo n.º 1
0
 def testQDialog(self):
     dlg = QInputDialog()
     dlg.setInputMode(QInputDialog.TextInput)
     lst = dlg.children()
     self.assert_(len(lst))
     obj = lst[0]
     self._called = False
     obj.destroyed[QObject].connect(self.cb)
     obj = None
     del dlg
     self.assert_(self._called)
Exemplo n.º 2
0
    def ajoutContact(self):  #ajout d'un dictionnaire à la liste de dico
        retour = QInputDialog().getText(
            self, "Ajout Contact",
            "Nom:")  #ouverture d'une nouvelle fenetre pour créer un contact
        if retour[0] == "":
            return
        else:
            fiche = {}
            fiche["nom"] = retour[0]
            fiche["prenom"] = ""
            fiche["tel"] = ""
            self.monRepertoire["repertoire"].append(
                fiche)  #ajout du dicco à la liste de dico
            self.majListeContact()

            self.sauveJSON(filename)
Exemplo n.º 3
0
    def setSymAddr(self):
        offset = int(self.symAddrAction.data())
        if offset in self.avoidAddrs or offset in self.findAddrs or offset in self.symAddrs:
            print("[angr-cutter] Address %s was already set" % hex(offset))
            return

        text, ok = QInputDialog.getText(self, "Symbolize address",
                                        "Size(bytes):")
        if ok:
            size = int(text)
        else:
            size = 8

        self.symAddrs[offset] = size
        self.updateSymAddrLine()
        cutter.cmd("ecHi black @ %d" % offset)
    def _create_new_stash(self, *args, **kwargs):

        stash_name, accepted = QInputDialog.getText(self, "Stash name", "Blah")

        if not accepted or stash_name.strip() == "":
            # The user didn't provide a stash name
            return

        if stash_name in self.simgr.stashes:
            QMessageBox.critical(
                None, 'Duplicate stash name',
                f"A stash with the name {stash_name} already exists in the current simulation manager."
            )
            return
        self.simgr._stashes[stash_name] = list()
        self.refresh()
    def change_usr_name(self, sub_name: str) -> None:
        """
        Handle changing names
        :param sub_name: equipment ID
        :return:
        """
        new_name, ok = QInputDialog.getText(self, 'input name', 'name:')

        if not ok:
            return

        print(sub_name, '--->', new_name)
        cur_sub_ui_info = self.UI_sub_info[sub_name]
        cur_sub_ui_info['usr_name'] = str(new_name)
        self.UI_sub_info[sub_name] = cur_sub_ui_info
        self.add_line_item()
Exemplo n.º 6
0
 def newFileDialog(self):
     (snippetName, ok) = QInputDialog.getText(self, self.tr("Snippet Name"),
                                              self.tr("Snippet Name: "))
     if ok and snippetName:
         if not snippetName.endswith(".py"):
             snippetName += ".py"
         index = self.tree.selectionModel().currentIndex()
         selection = self.files.filePath(index)
         if QFileInfo(selection).isDir():
             path = os.path.join(selection, snippetName)
         else:
             path = os.path.join(snippetPath, snippetName)
             self.readOnly(False)
         open(path, "w").close()
         self.tree.setCurrentIndex(self.files.index(path))
         log_debug("Snippet %s created." % snippetName)
Exemplo n.º 7
0
    def duplicate_object(self, index):
        """
        Duplicates the object at the given object tree model index.

        Args:
            index (QModelIndex)
        """
        orig_name = index.data()
        dup_name, ok = QInputDialog.getText(
            self,
            "Duplicate object",
            "Enter a name for the duplicate object:",
            text=orig_name + "_copy")
        if not ok:
            return
        _replace_name = lambda name_list: [
            name if name != orig_name else dup_name for name in name_list
        ]
        parcel = SpineDBParcel(self.db_mngr)
        object_item = index.internalPointer()
        db_map_obj_ids = {
            db_map: {object_item.db_map_id(db_map)}
            for db_map in object_item.db_maps
        }
        parcel.push_inside_object_ids(db_map_obj_ids)
        data = self._make_data_for_export(parcel.data)
        data = {
            "objects":
            [(cls_name, dup_name, description)
             for (cls_name, obj_name, description) in data.get("objects", [])],
            "relationships":
            [(cls_name, _replace_name(obj_name_lst))
             for (cls_name, obj_name_lst) in data.get("relationships", [])],
            "object_parameter_values":
            [(cls_name, dup_name, param_name, val)
             for (cls_name, obj_name, param_name,
                  val) in data.get("object_parameter_values", [])],
            "relationship_parameter_values":
            [(cls_name, _replace_name(obj_name_lst), param_name, val)
             for (cls_name, obj_name_lst, param_name,
                  val) in data.get("relationship_parameter_values", [])],
        }
        self.db_mngr.import_data(
            {db_map: data
             for db_map in object_item.db_maps},
            command_text="Duplicate object")
Exemplo n.º 8
0
 def open_input_choice_dialog(self):
     value, response = QInputDialog().getItem(
         # parent (QWidget): Pai da janela de diálogo.
         self.ui,
         # title (str): Título da janela de diálogo.
         'Título da janela de diálogo.',
         # label (str): Texto que será exibido junto com o input.
         'Selecione um dos itens e clique em OK:',
         # items ([str]): Lista com o texto que será exibido.
         ['item 1', 'item 2', 'item 3'],
         # current (int): Valor inicial (index).
         1,
         # editable (bool): Valor determina se o campo pode ser editado.
         False,
     )
     if response and value:
         self.label.setText(f'<b>Valor selecionado</b>: {value}')
Exemplo n.º 9
0
    def openFileFromUrlWithDialog(self):
        text =\
        """
		Use raw URLs only.
		
		Some useful URLs:
		 - https://pastebin.com/raw/<id>
		 - https://raw.githubusercontent.com/<user>/<repo>/master/<path>
		"""

        self.logger.debug("Opening URL dialog...")
        text, ok = QInputDialog.getText(
            self, "Open a URL", text, QLineEdit.Normal,
            "https://raw.githubusercontent.com/<user>/<repo>/master/<file>")

        if ok and text:
            self.openFileFromUrl(text)
Exemplo n.º 10
0
    def _on_copy_to_pressed(self):
        logging.info("Beginning copy to for " + self.module.name)
        choices = []
        for i in range(0, len(self.module.entries)):
            choices.append(
                str(i + 1) + ". " +
                self.model.data(self.model.index(i, 0), QtCore.Qt.DisplayRole))

        choice = QInputDialog.getItem(self, "Select Destination",
                                      "Destination", choices)
        if choice[1]:
            for i in range(0, len(choices)):
                if choice[0] == choices[i]:
                    self.selection.copy_to(self.module.entries[i])
        else:
            logging.info("No choice selected for " + self.module.name +
                         " copy to. Aborting.")
Exemplo n.º 11
0
    def wishImportFun(self, text=None):
        if text is None:
            text, ok = QInputDialog.getMultiLineText(self, '导入祝福', 'WISH 开头')
            if not (ok and text):
                return

        text = text.split(" ")
        if text[0] != "WISH":
            return
        else:
            wishLevelList = []
            for i in range(len(text) - 1):
                try:
                    wishLevelList.append(int(text[i + 1]))
                except:
                    pass
            self.wishpanel.wishLevelList = wishLevelList.copy()
Exemplo n.º 12
0
 def saveMyCard(self):
     (result, message) = self.ableCheck()
     if not result:
         QMessageBox.critical(self, "错误", message, QMessageBox.Yes)
         return
     try:
         newCard = self.makeMyCard()
         text, ok = QInputDialog.getText(self, '设置卡片显示名', '输入名称:', text=newCard.tostring())
         if ok and text:
             if text in self.cardList.keys():
                 QMessageBox.critical(self, "错误", "保存失败,与已有配置重名", QMessageBox.Yes)
                 return
             self.cardList[text] = newCard
             self.cardlistcomboBox.setCurrentText(text)
     except Exception as err:
         print(err)
         QMessageBox.critical(self, "错误", err.__str__(), QMessageBox.Yes)
Exemplo n.º 13
0
def add_new_contact_info_type_dialog(parent):
    """
    Ask the user for a name for a new contact info type.

    Args:
        parent: The parent widget to display the dialog over.

    Returns:
        The text that the user entered, or None if the user cancelled.

    """
    text, ok = QInputDialog.getText(parent, "Add New Contact Info Type",
                                    "Contact Info Type Name:")
    if ok:
        return text
    else:
        return None
Exemplo n.º 14
0
def add_new_membership_type_dialog(parent):
    """
    Ask the user for a name for a new membership type.

    Args:
        parent: The parent widget to display the dialog over.

    Returns:
        The text that the user entered, or None if the user cancelled.

    """
    text, ok = QInputDialog.getText(parent, "Add New Membership Type",
                                    "Membership Type Name:")
    if ok:
        return text
    else:
        return None
Exemplo n.º 15
0
    def init_shotgun_export(self) -> bool:
        """init_shotgun_export will init the shotgun export

        Returns:
            bool -- Can login to shotgun
        """
        if self.sg_login.text() == '' or self.sg_hostname.text() == '':
            self.__info('You need to enter your shotgun info')
            return '', False
        sg_password, ok = QInputDialog().getText(self, 'Shotgun password',
                                                 'Shotgun password:'******'', False
        self.shotgun = shotgun_api.shotgun(self.sg_hostname.text(),
                                           self.sg_login.text(), sg_password)
        return sg_password, True
Exemplo n.º 16
0
    def add_url_callback(self):
        """
        Callback method for the button "Add URL"
        It creates a dialog box that the user passes the URL into that is
        later added to the database
        """

        res, ok = QInputDialog.getText(self.parent, "Add URL", "Paste URL: ")
        res = res.strip()
        if ok:
            if URLHandler.string_is_url(res):
                url_added = URLHandler.add_url(res)
                if url_added != -1:
                    index = URLHandler.add_url_to_group(res, 'All')
                    self.mainView.group_view.add_url(res, 'All', index)
            else:
                print('it\'s not a url')
Exemplo n.º 17
0
    def _create_new_node(self):
        node_name, did_confirm = QInputDialog.getText(self, "New Node", "Insert node name:")
        if not did_confirm:
            return

        if self.current_area.node_with_name(node_name) is not None:
            QMessageBox.warning(self,
                                "New Node",
                                "A node named '{}' already exists.".format(node_name))
            return

        self.generic_index += 1
        new_node = GenericNode(node_name, True, self.generic_index)
        self.current_area.nodes.append(new_node)
        self.current_area.connections[new_node] = {}

        self.on_select_area()
Exemplo n.º 18
0
    def do_menu_rename_helper(self, name: str, row: int):
        """
        Allows users to rename a created QComponent
        Args:
            name (str): Old name for QComponent
            row (int): Row of QComponent in Model

        """
        if row > -1:
            text, okPressed = QInputDialog.getText(self,
                                                   f"Rename component {name}",
                                                   f"Rename {name} to:",
                                                   QLineEdit.Normal, "")
            if okPressed and text != '':
                self.logger.info(f'Renaming {name} to {text}')
                comp_id = self.design.components[name].id
                self.design.rename_component(comp_id, text)
    def do_menu_rename(self, event):
        """Called when the user clicks the context menu rename.

        Args:
            event (QContextMenuEvent): The event
        """
        name, row = self.get_name_from_event(event)

        if row > -1:
            text, okPressed = QInputDialog.getText(self,
                                                   f"Rename component {name}",
                                                   f"Rename {name} to:",
                                                   QLineEdit.Normal, "")
            if okPressed and text != '':
                self.logger.info(f'Renaming {name} to {text}')
                comp_id = self.design.components[name].id
                self.design.rename_component(comp_id, text)
Exemplo n.º 20
0
    def add_fake_listing_action(self):
        amount, ok = QInputDialog.getInt(
            self, 'Debug: Fake Listing Wizard',
            'Enter the amount of fake listings to add:', QLineEdit.Normal)
        if not ok:
            return

        self.status_message("DEBUG: Adding fake entries.. Please wait..")

        word_json = requests.get(
            f"https://random-word-api.herokuapp.com/word?number={amount}").text
        words = json.loads(word_json)
        for item in words:
            self.ui.listAppsWidget.addItem(item + "_wii")

        self.status_message(
            f"DEBUG: Added {amount} fake entries to applications list.")
Exemplo n.º 21
0
 def add_outputfiles(self, checked=False):
     """Let user select output files for this tool template."""
     msg = "Add output files that will be archived into the Tool results directory after the <br/>" \
           "Tool template has finished execution. Wildcards are supported.<br/><br/>" \
           "Examples:<br/>" \
           "<b>results.csv</b> -> File is copied from work directory into results.<br/> " \
           "<b>*.csv</b> -> All CSV files will copied into results.<br/> " \
           "<b>output\*.gdx</b> -> All GDX files from the work output\ directory will be copied into <br/>" \
           "output\ subdirectory in the results directory.<br/><br/>"
     # noinspection PyCallByClass, PyTypeChecker, PyArgumentList
     answer = QInputDialog.getText(self, "Add output item", msg, flags=Qt.WindowTitleHint | Qt.WindowCloseButtonHint)
     file_name = answer[0]
     if not file_name:  # Cancel button clicked
         return
     qitem = QStandardItem(file_name)
     qitem.setData(QFileIconProvider().icon(QFileInfo(file_name)), Qt.DecorationRole)
     self.outputfiles_model.appendRow(qitem)
Exemplo n.º 22
0
 def add_inputfiles(self, checked=False):
     """Let user select input files for this tool template."""
     msg = "Add an input file or a directory required by your program. Wildcards " \
           "<b> are not</b> supported.<br/><br/>" \
           "Examples:<br/>" \
           "<b>data.csv</b> -> File is copied to the same work directory as the main program.<br/>" \
           "<b>input/data.csv</b> -> Creates subdirectory input\ to the work directory and " \
           "copies the file there.<br/>" \
           "<b>output/</b> -> Creates an empty directory into the work directory.<br/><br/>"
     # noinspection PyCallByClass, PyTypeChecker, PyArgumentList
     answer = QInputDialog.getText(self, "Add input item", msg, flags=Qt.WindowTitleHint | Qt.WindowCloseButtonHint)
     file_name = answer[0]
     if not file_name:  # Cancel button clicked
         return
     qitem = QStandardItem(file_name)
     qitem.setData(QFileIconProvider().icon(QFileInfo(file_name)), Qt.DecorationRole)
     self.inputfiles_model.appendRow(qitem)
Exemplo n.º 23
0
 def unlock_wallet(self):
     password, ok = QInputDialog.getText(self.password_dialog,
                                         f'Unlock {self.node_set.network} LND Wallet',
                                         'Wallet Password',
                                         QLineEdit.Password)
     if not ok:
         return
     try:
         self.node_set.lnd_client.unlock(wallet_password=password)
         keyring.set_password(
             service=f'lnd_{self.node_set.network}_wallet_password',
             username=str(time.time()),
             password=password)
     except _Rendezvous as e:
         # noinspection PyProtectedMember
         self.error_message.showMessage(e._state.details)
         return
Exemplo n.º 24
0
 def add_inputfiles_opt(self, checked=False):
     """Let user select optional input files for this tool template."""
     msg = "Add optional input files that may be utilized by your program. <br/>" \
           "Wildcards are supported.<br/><br/>" \
           "Examples:<br/>" \
           "<b>data.csv</b> -> If found, file is copied to the same work directory as the main program.<br/>" \
           "<b>*.csv</b> -> All found CSV files are copied to the same work directory as the main program.<br/>" \
           "<b>input/data_?.dat</b> -> All found files matching the pattern 'data_?.dat' will be copied to <br/>" \
           "input/ subdirectory under the same work directory as the main program.<br/><br/>"
     # noinspection PyCallByClass, PyTypeChecker, PyArgumentList
     answer = QInputDialog.getText(self, "Add optional input item", msg,
                                   flags=Qt.WindowTitleHint | Qt.WindowCloseButtonHint)
     file_name = answer[0]
     if not file_name:  # Cancel button clicked
         return
     qitem = QStandardItem(file_name)
     qitem.setData(QFileIconProvider().icon(QFileInfo(file_name)), Qt.DecorationRole)
     self.inputfiles_opt_model.appendRow(qitem)
Exemplo n.º 25
0
    def handle_parameter_rename(self, proxy):
        """ Creates an input dialog where users can set a new name for the
        selected 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.
        """
        new_name, ok = QInputDialog.getText(
            self, "Rename parameter", "New parameter name:",
        )
        if ok and new_name:
            try:
                self.rename_parameter(proxy, new_name)
                signals.parameters_changed.emit()
            except Exception as e:
                self.sync(self.build_df())
                simple_warning_box(self, "Could not save changes", str(e))
Exemplo n.º 26
0
 def create_new_configuration(self, ) -> None:
     """Create a new configuration."""
     selected_format, ok = QInputDialog().getItem(
         self,
         'Select format',
         'Format:',
         list(AVAILABLE_FORMATS.keys()),
         0,
         False,  # noqa: WPS425
     )
     if not ok:
         return
     self.add_entry(entry=RootConfigurationEntry(
         name='New configuration',
         raw='',
         original_raw='',
         raw_format=selected_format,
     ), )
Exemplo n.º 27
0
    def recover_wallet(self):
        title = f'Recover {self.node_set.network} LND Wallet'
        new_wallet_password = self.get_new_password(title=title,
                                                    password_name='LND Wallet')

        seed_password = self.password_prompt(title=title,
                                             label='Seed Password (Optional)')

        seed, ok = QInputDialog.getText(
            self.password_dialog, title,
            'Mnemonic Seed (one line with spaces)')
        if not ok:
            raise Exception()
        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)

        try:
            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)
Exemplo n.º 28
0
 def createNewProject(self, quickAssembly=False, path=None):
     if not os.path.exists(self.path):
         self.eventManager.invalidWorkspace.emit(self)
         return
     dialogText = "New assembly project" if quickAssembly else "New project"
     if not path:
         name, entered = QInputDialog.getText(None, dialogText, "Enter project name: ", QLineEdit.Normal, "New project")
     else:
         name = os.path.basename(path)
         entered = True
     if entered:
         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("Project name cannot contain whitespace or special characters.")
             msg.setWindowTitle("Project creation error")
             msg.exec_()
             return
         if os.path.exists(os.path.join(self.path, name)):
             msg = QMessageBox()
             msg.setStyleSheet("background-color: #2D2D30; color: white;")
             msg.setModal(True)
             msg.setIcon(QMessageBox.Critical)
             msg.setText("Folder with the same name already exists.")
             msg.setWindowTitle("Project creation error")
             msg.exec_()
             return
         project = ProjectNode()
         project.path = name
         project.proxy.path = name
         project.proxy.parent = self.proxy
         project.setIcon(0, QIcon(main.resource_path("resources/project.png")))
         project.setText(0, name)
         self.addChild(project)
         newPath = os.path.join(self.path, name)
         os.mkdir(newPath)
         self.proxy.addProject(project.proxy)
         self.saveWorkspace()
         self.connectProjectEventHandlers(project)
         self.eventManager.projectAdded.emit(project)
         return project
Exemplo n.º 29
0
    def save_images(self):
        if self.ui.ignore_agg.isChecked():
            ims_dict = HexrdConfig().unagg_images
        else:
            ims_dict = HexrdConfig().imageseries_dict
        dets = HexrdConfig().detector_names
        if self.ui.single_detector.isChecked():
            dets = [self.ui.detectors.currentText()]
        for det in dets:
            selected_format = self.ui.format.currentText().lower()
            filename = f'{self.ui.file_stem.text()}_{det}.{selected_format}'
            path = f'{self.parent_dir}/{filename}'
            if selected_format.startswith('hdf5'):
                selected_format = 'hdf5'
            elif selected_format.startswith('npz'):
                selected_format = 'frame-cache'

            kwargs = {}
            if selected_format == 'hdf5':
                # A path must be specified. Set it ourselves for now.
                kwargs['path'] = 'imageseries'
            elif selected_format == 'frame-cache':
                # Get the user to pick a threshold
                result, ok = QInputDialog.getDouble(self.ui, 'HEXRD',
                                                    'Choose Threshold', 10, 0,
                                                    1e12, 3)
                if not ok:
                    # User canceled...
                    return

                kwargs['threshold'] = result

                # This needs to be specified, but I think it just needs
                # to be the same as the file name...
                kwargs['cache_file'] = path

            worker = AsyncWorker(HexrdConfig().save_imageseries,
                                 ims_dict.get(det), det, path, selected_format,
                                 **kwargs)
            self.thread_pool.start(worker)
            self.progress_dialog.setWindowTitle(f'Saving {filename}')
            self.progress_dialog.setRange(0, 0)
            worker.signals.finished.connect(self.progress_dialog.accept)
            self.progress_dialog.exec_()
Exemplo n.º 30
0
 def open_input_float_dialog(self):
     value, response = QInputDialog().getDouble(
         # parent (QWidget): Pai da janela de diálogo.
         self.ui,
         # title (str): Título da janela de diálogo.
         'Título da janela de diálogo.',
         # label (str): Texto que será exibido junto com o input.
         'Digite algo e clique em OK:',
         # value (float): Valor inicial do input.
         0,
         # minValue (float): Valor mínimo do input.
         -10,
         # maxValue (float): Valor maximo do input.
         10,
         # decimals(int): Numero de casas decimais.
         2,
     )
     if response and value:
         self.label.setText(f'<b>Valor digitado</b>: {value:.2f}')
Exemplo n.º 31
0
 def open_input_int_dialog(self):
     value, response = QInputDialog().getInt(
         # parent (QWidget): Pai da janela de diálogo.
         self.ui,
         # title (str): Título da janela de diálogo.
         'Título da janela de diálogo.',
         # label (str): Texto que será exibido junto com o input.
         'Digite um numero inteiro e clique em OK:',
         # value (int). Valor inicial do input.
         0,
         # minValue (int). Valor mínimo do input.
         -10,
         # maxValue (int). Valor maximo do input.
         10,
         # step (int). Valor do incremento/decremento.
         2,
     )
     if response and value:
         self.label.setText(f'<b>Valor digitado</b>: {value}')
Exemplo n.º 32
0
    def get_auth_code(self, opener, request):
        """
        :param opener: urllib.request.build_opener for sending an authcode per mail
        :param request: request to send using the given opener
        :return: the authcode
        """
        inputDialog = QInputDialog(self)
        inputDialog.setInputMode(QInputDialog.TextInput)
        inputDialog.setCancelButtonText("Cancel")
        inputDialog.setLabelText("Please enter your Authcode")
        inputDialog.setWindowTitle("TwoFactorAuth")
        inputDialog.setModal(True)

        response = None

        if inputDialog.exec_() == QInputDialog.Rejected:  # send mail
            return None, None
        else:
            return response, inputDialog.textValue().strip()

        inputDialog.setCancelButtonText("Cancel")
        if inputDialog.exec_() == QInputDialog.Rejected:
            return response, None
        return response, inputDialog.textValue().strip()
Exemplo n.º 33
0
 def start_gui(self, args):
     crypt_key = args.encryption
     if crypt_key is None:
         input_dialog = QInputDialog()
         input_dialog.setInputMode(QInputDialog.TextInput)
         input_dialog.setCancelButtonText("No Password")
         input_dialog.setLabelText("Please enter your Masterpassword")
         input_dialog.setWindowTitle("Masterpassword")
         input_dialog.setModal(False)
         while crypt_key is None:
             if input_dialog.exec_() == QInputDialog.Rejected:
                 crypt_key = u"0238jh74ngz23v84m90fcqewmn4f89"
             else:
                 crypt_key = input_dialog.textValue().strip()
             if not QtStarter.check_master_password(crypt_key):
                 crypt_key = None
                 input_dialog.setLabelText("Wrong Masterpassword, try again!")
     QtStarter.save_masterpassword_check(crypt_key)
     crypt = Coding(crypt_key.encode('utf-8'))
     self.window = ControlMainWindow(crypt)
     self.timer = threading.Timer(0.001, self.update_server_status,
                                  kwargs={'window': self.window}).start()
     self.window.show()
     ret = self.app.exec_()
     if self.timer is not None:
         self.timer.cancel()
     return ret
Exemplo n.º 34
0
    def get_charname(self):
        """
        :param mailurl: url to call for sending an authcode per mail
        :return: the authcode
        """
        inputDialog = QInputDialog(self)
        inputDialog.setInputMode(QInputDialog.TextInput)
        inputDialog.setLabelText("Please enter a Charname")
        inputDialog.setWindowTitle("Charname Challange")
        inputDialog.setModal(True)

        if inputDialog.exec_() == QInputDialog.Rejected:
            return None

        return inputDialog.textValue().strip()