Beispiel #1
0
    def show_message(self):
        msgBox = QMessageBox()
        msgBox.setText(self.help_text + "                                     ") # The spaces keep the window from being too narrow.
        msgBox.setInformativeText(self.informative_text)
        msgBox.adjustSize()

        msgBox.exec_()
 def editingFinishedHandler(self):
     settings = QSettings()
     old = settings.value("computation/reduce",QtReduceDefaults.REDUCE)
     new = self.reduceBinary.text()
     if old == new:
         return
     self.reduceBinary.blockSignals(True)
     tit = "Change Binary?"
     txt = self.tr("Do you really want to change this setting?")
     itxt = self.tr("If yes, then the binary ")
     itxt += '"' + new + '" '
     itxt += self.tr("will be used at the next restart.")
     mbox = QMessageBox(self)
     mbox.setIcon(QMessageBox.Question)
     mbox.setWindowModality(Qt.WindowModal)
     mbox.setWindowTitle(tit)
     mbox.setText(txt)
     mbox.setInformativeText(itxt)
     mbox.setStandardButtons(QMessageBox.Yes|QMessageBox.No)
     button = mbox.exec_()
     if button == QMessageBox.Yes:
         settings.setValue("computation/reduce",new)
     else:
         self.reduceBinary.setText(old)
     self.reduceBinary.blockSignals(False)
def load_data():
    file_name = GlobalElements.LoadFilesDialog.findChild(QLineEdit, "lineEditFilename").text()
    dir_path = GlobalElements.LoadFilesDialog.findChild(QLineEdit, "lineEditDirectory").text()
    file_path = os.path.join(dir_path, file_name)
    if os.path.isfile(file_path):
        msgBox = QMessageBox()
        msgBox.setText(u"Plik o podanej nazwie już istnieje.")
        msgBox.setInformativeText(u"Czy chcesz go nadpisać?")
        msgBox.addButton(u"Tak", QMessageBox.AcceptRole)
        abortButton = msgBox.addButton(u"Nie", QMessageBox.Abort)
        msgBox.exec_()
        if msgBox.buttonClicked() == abortButton:
            return
    if file_name:
        update_load_data_config()
        data_reader = DataReader(GlobalElements.Config["start_channel"],
                                 GlobalElements.Config["end_channel"],
                                 GlobalElements.Config["output_format"],
                                 GlobalElements.Config["line_numbers"],
                                 file_path,
                                 GlobalElements.LoadFilesDialog.findChild(QPlainTextEdit, "plainTextEditDescription").toPlainText())
        data_reader.start()
        GlobalElements.LoadFilesDialog.findChild(QLineEdit, "lineEditFilename").clear()
        GlobalElements.LoadFilesDialog.findChild(QPlainTextEdit, "plainTextEditDescription").clear()
        GlobalElements.LoadFilesDialog.accept()
    else:
        msgBox = QMessageBox()
        msgBox.setText(u"Niepoprawna nazwa pliku!")
        msgBox.exec_()
def check_editor_preferences():
    # get preference values of external app path
    photo_dir = cmds.optionVar(exists='PhotoshopDir')
    image_dir = cmds.optionVar(exists='EditImageDir')

    # if there is no external app, request for an app path
    if not photo_dir and not image_dir:
        pref_warn = QMessageBox()
        pref_warn.setWindowTitle(WINDOW_TITLE)
        pref_warn.setIcon(QMessageBox.Warning)
        pref_warn.setText(
            '<b>Applications for Editing Image Files</b> '
            'is not set in your preferences.<br>'
            'Maya needs it to send image in the right Image Editor '
            'instead of file system association.')
        pref_warn.setInformativeText('Do you want to select an application ?')
        pref_warn.setStandardButtons(QMessageBox.Yes | QMessageBox.No)
        pref_warn.setDefaultButton(QMessageBox.Yes)
        pref_warn.setEscapeButton(QMessageBox.Cancel)
        ret = pref_warn.exec_()

        if ret == QMessageBox.Yes:
            app_path = cmds.fileDialog2(
                fileFilter='Image editor application (*.exe)',
                caption='Select image editor application',
                startingDirectory=os.path.expandvars('%ProgramFiles%'),
                fileMode=1)

            if app_path is not None:
                cmds.optionVar(sv=('PhotoshopDir', app_path[0]))
                cmds.optionVar(sv=('EditImageDir', app_path[0]))
Beispiel #5
0
    def verify_user(self, profileid=None):
        if profileid is None:
            profileid=self.current_profileid
        if len(profileid) == 0:
            return False

        try:
            username = gameslist.username_from_profile_id(profileid)
        except gameslist.NoSuchProfileError:
            return False

        if windows.desura_running(username):
            return True

        verify_dialog = QMessageBox()
        verify_dialog.setText("<b>Verify your identity</b><br />Sign in to Desura to continue with account <b>{0}</b> to confirm your identity".format(username))
        verify_dialog.setInformativeText("<i>Waiting for Desura sign-in...</i>")
        verify_dialog.setWindowTitle("Sign into Desura to continue")
        verify_dialog.setStandardButtons(QMessageBox.Cancel)
        verify_dialog.setIcon(QMessageBox.Information)
        verify_dialog.setWindowFlags(Qt.CustomizeWindowHint | Qt.WindowTitleHint)
        desurawaiter = DesuraWaiter(username)
        desurawaiter.finished.connect(verify_dialog.close)
        desurawaiter.start()
        verify_dialog.exec_()
        if windows.desura_running(username):
            return True
        else:
            desurawaiter.terminate()
            return False
Beispiel #6
0
    def verify_user(self, profileid=None):
        if profileid is None:
            profileid = self.current_profileid
        if len(profileid) == 0:
            return False

        try:
            username = gameslist.username_from_profile_id(profileid)
        except gameslist.NoSuchProfileError:
            return False

        if windows.desura_running(username):
            return True

        verify_dialog = QMessageBox()
        verify_dialog.setText(
            "<b>Verify your identity</b><br />Sign in to Desura to continue with account <b>{0}</b> to confirm your identity"
            .format(username))
        verify_dialog.setInformativeText(
            "<i>Waiting for Desura sign-in...</i>")
        verify_dialog.setWindowTitle("Sign into Desura to continue")
        verify_dialog.setStandardButtons(QMessageBox.Cancel)
        verify_dialog.setIcon(QMessageBox.Information)
        verify_dialog.setWindowFlags(Qt.CustomizeWindowHint
                                     | Qt.WindowTitleHint)
        desurawaiter = DesuraWaiter(username)
        desurawaiter.finished.connect(verify_dialog.close)
        desurawaiter.start()
        verify_dialog.exec_()
        if windows.desura_running(username):
            return True
        else:
            desurawaiter.terminate()
            return False
Beispiel #7
0
    def cmdElimina_click(self):
        """Evento che gestisce il tasto di elimina"""

        msgBox = QMessageBox()

        if self.myWidget.lstRubrica.currentIndex():
            index = self.myWidget.lstRubrica.currentIndex().row()
            rec = self.tableModel.record(index)
            nome = rec.value("nome")
            cognome = rec.value("cognome")

            msgBox.setText("Si conferma l'eliminazione del contatto %s %s?" %
                           (nome, cognome))
            msgBox.setInformativeText(
                "Se si procede con l'eliminazione il contatto verrà eliminato definitivamente."
            )
            msgBox.setStandardButtons(QMessageBox.Ok | QMessageBox.Cancel)
            ret = msgBox.exec_()

            if (ret == QMessageBox.Ok):
                self.tableModel.removeRow(index)
                self.tableModel.submitAll()
        else:
            msgBox.setText("Occorre selezionare un elemento!")
            msgBox.exec_()
Beispiel #8
0
 def mainbutton_clicked(self, button):
     if button == self.main_reset:
         for cat in self.base_cfg.get_categories():
             for setting in self.base_cfg.get_settings(cat):
                 self.widget_list[cat][setting].updateValue(self.base_cfg.get_setting(cat,setting))
     elif button == self.main_defaults:
         for cat in self.def_cfg.get_categories():
             for setting in self.def_cfg.get_settings(cat):
                 self.widget_list[cat][setting].updateValue(self.def_cfg.get_setting(cat,setting))
     elif button == self.main_apply:
         bad_settings = self.validate_settings()
         if bad_settings == []:
             self.save_settings()
             self.main_apply.setEnabled(False)
             self.main_reset.setEnabled(False)
         else:
             msgBox = QMessageBox()
             msgBox.setText("Must fix the following invalid settings before quitting:")
             msgBox.setStandardButtons(QMessageBox.Ok)
             info = ''
             for setting in bad_settings:
                 new = '%s,%s<br>' % setting
                 info = '%s%s' % (info, new)
             msgBox.setInformativeText(info)
             msgBox.exec_()
Beispiel #9
0
    def help_gpus(self):
        msg = QMessageBox()
        msg.setIcon(QMessageBox.Question)
        msg.setText("Setting the number of GPUs")
        msg.setWindowTitle("Number of GPUs")
        if not self.HAVE_CUDA:
            info = "No GPUs are detected on your system"
        else:
            gpu_id = 0
            is_available = True
            while is_available:
                try:
                    cmt.cuda_set_device(gpu_id)
                    is_available = True
                except Exception:
                    is_available = False
            info = "%d GPU is detected on your system" % (gpu_id + 1)

        msg.setInformativeText("SpyKING CIRCUS can use several GPUs\n"
                               "either locally or on multiple machine\n"
                               "using MPI (see documentation)"
                               "\n"
                               "\n"
                               "%s" % info)
        msg.setStandardButtons(QMessageBox.Close)
        msg.setDefaultButton(QMessageBox.Close)
        answer = msg.exec_()
Beispiel #10
0
 def _isCloseOk(self):
     
     doc = self.document
     
     if doc.saved:
         return True
     
     else:
         # current document has unsaved changes
         
         if doc.filePath is None:
             prefix = 'This document'
         else:
             fileName = os.path.basename(doc.filePath)
             prefix = 'The document "{:s}"'.format(fileName)
             
         box = QMessageBox()
         box.setText(prefix + ' has unsaved changes.')
         box.setInformativeText('Would you like to save them before closing?')
         box.setStandardButtons(QMessageBox.Save | QMessageBox.Discard | QMessageBox.Cancel)
         box.setDefaultButton(QMessageBox.Save)
         
         result = box.exec_()
         
         if result == QMessageBox.Save:
             return self._onSave()
         
         elif result == QMessageBox.Cancel:
             return False
         
         else:
             return True
Beispiel #11
0
    def save(self):
        mainlog.debug("EditTimeTracksDialog.save()")
        errors = self.controller.model.validate()
        if errors:
            showTableEntryErrorBox(errors)
            return False

        tt_start_time = datetime(self.edit_date.year, self.edit_date.month,
                                 self.edit_date.day, 6, 0, 0)
        edited_proxy_tts = self.controller.model.model_to_objects(
            lambda: TimetrackProxy())
        employee_id = self.current_employee_id_selected

        # for tt in edited_proxy_tts:
        #     mainlog.debug(type(tt))
        #     mainlog.debug(str(tt))

        try:
            save_proxy_timetracks(edited_proxy_tts, tt_start_time, employee_id)
            return True
        except Exception as e:
            msgBox = QMessageBox(self)
            msgBox.setIcon(QMessageBox.Critical)
            msgBox.setText("There was an error while saving your data")
            msgBox.setInformativeText(str(e))
            msgBox.setStandardButtons(QMessageBox.Ok)
            # msgBox.setDefaultButton(QMessageBox.Ok);
            ret = msgBox.exec_()
            return False
Beispiel #12
0
def check_editor_preferences():
    # get preference values of external app path
    photo_dir = cmds.optionVar(exists='PhotoshopDir')
    image_dir = cmds.optionVar(exists='EditImageDir')

    # if there is no external app, request for an app path
    if not photo_dir and not image_dir:
        pref_warn = QMessageBox()
        pref_warn.setWindowTitle(WINDOW_TITLE)
        pref_warn.setIcon(QMessageBox.Warning)
        pref_warn.setText(
            '<b>Applications for Editing Image Files</b> '
            'is not set in your preferences.<br>'
            'Maya needs it to send image in the right Image Editor '
            'instead of file system association.')
        pref_warn.setInformativeText('Do you want to select an application ?')
        pref_warn.setStandardButtons(QMessageBox.Yes | QMessageBox.No)
        pref_warn.setDefaultButton(QMessageBox.Yes)
        pref_warn.setEscapeButton(QMessageBox.Cancel)
        ret = pref_warn.exec_()

        if ret == QMessageBox.Yes:
            app_path = cmds.fileDialog2(
                fileFilter='Image editor application (*.exe)',
                caption='Select image editor application',
                startingDirectory=os.path.expandvars('%ProgramFiles%'),
                fileMode=1)

            if app_path is not None:
                cmds.optionVar(sv=('PhotoshopDir', app_path[0]))
                cmds.optionVar(sv=('EditImageDir', app_path[0]))
Beispiel #13
0
 def error(self, error):
     if error == QNetworkSession.UnknownSessionError:
         msgBox = QMessageBox(self.parent())
         msgBox.setText('This application requires network access to function.')
         msgBox.setInformativeText('Press Cancel to quit the application.')
         msgBox.setStandardButtons(QMessageBox.Retry | QMessageBox.Cancel)
         msgBox.setIcon(QMessageBox.Information)
         msgBox.setDefaultButton(QMessageBox.Retry)
         ret = msgBox.exec_()
         if ret == QMessageBox.Retry:
             QTimer.singleShot(0, self.session.open)
         elif ret == QMessageBox.Cancel:
             self.close()
     elif error == QNetworkSession.SessionAbortedError:
         msgBox = QMessageBox(self.parent())
         msgBox.setText('Out of range of network')
         msgBox.setInformativeText('Move back into range and press Retry, or press Cancel to quit the application')
         msgBox.setStandardButtons(QMessageBox.Retry | QMessageBox.Cancel)
         msgBox.setIcon(QMessageBox.Information)
         msgBox.setDefaultButton(QMessageBox.Retry)
         ret = msgBox.exec_()
         if ret == QMessageBox.Retry:
             QTimer.singleShot(0, self.session.open)
         elif ret == QMessageBox.Cancel:
             self.close()
Beispiel #14
0
def makeInformationBox(text,info_text = None):
    warningBox = QMessageBox()
    warningBox.setWindowTitle(_("Information"))
    warningBox.setIcon(QMessageBox.Information)
    warningBox.setText(text);
    warningBox.setInformativeText(info_text)
    warningBox.setStandardButtons(QMessageBox.Ok);
    return warningBox
Beispiel #15
0
def showdialog(x, y):
    msg = QMessageBox()
    msg.setIcon(QMessageBox.Information)
    msg.setText(x)
    msg.setInformativeText(y)
    msg.setWindowTitle("Alert")
    msg.setStandardButtons(QMessageBox.Ok | QMessageBox.Cancel)
    return msg.exec_()
Beispiel #16
0
 def error(title, text, buttons=QMessageBox.Ok, default_button=QMessageBox.Ok):
     msgBox = QMessageBox()
     msgBox.setWindowTitle(title)
     msgBox.setText(text)
     msgBox.setInformativeText(title)
     msgBox.setStandardButtons(buttons)
     msgBox.setDefaultButton(default_button)
     msgBox.setIcon(QMessageBox.Critical)
     return msgBox.exec_()
Beispiel #17
0
 def _detail_error_msg(self, title, error_text, error_detailed_text):
     msg = QMessageBox(self.new_wallet_ui)
     msg.setWindowTitle(title)
     msg.setText(error_text)
     msg.setInformativeText("Detailed error information below:")
     msg.setDetailedText(error_detailed_text)
     msg.setIcon(QMessageBox.Critical)
     msg.setStandardButtons(QMessageBox.Ok)
     msg.exec_()
Beispiel #18
0
 def make(title, text, icon=QMessageBox.Critical, buttons=QMessageBox.Ok, default_button=QMessageBox.Ok):
     ntfctn = QMessageBox()
     ntfctn.setWindowTitle(title)
     ntfctn.setText(text)
     ntfctn.setInformativeText(title)
     ntfctn.setStandardButtons(buttons)
     ntfctn.setDefaultButton(default_button)
     ntfctn.setIcon(icon)
     return ntfctn.exec_()
Beispiel #19
0
    def help_file_format(self):
        msg = QMessageBox()
        msg.setIcon(QMessageBox.Question)
        msg.setText("Supported file formats")
        msg.setWindowTitle("File formats")

        msg.setInformativeText("\n".join(list_all_file_format()))
        msg.setStandardButtons(QMessageBox.Close)
        msg.setDefaultButton(QMessageBox.Close)
        answer = msg.exec_()
Beispiel #20
0
def getWarningMessageBox(text, informative_text):
    message_box = QMessageBox()
    h_spacer = QSpacerItem(500, 0)
    gl = message_box.layout()
    gl.addItem(h_spacer, gl.rowCount(), 0, 1, gl.columnCount())
    message_box.setWindowTitle(constants.APPLICATION_TITLE)
    message_box.addButton(QMessageBox.Ok)
    message_box.setText('<b>{}'.format(text))
    message_box.setInformativeText(informative_text)
    message_box.setIcon(QMessageBox.Critical)
    return message_box
	def removeButtonClicked(self):
		"""
		Remove the last transformation in the list.
		"""
		messageBox = QMessageBox()
		messageBox.setText("The last transformation is about to be removed.")
		messageBox.setInformativeText("Do you want to proceed?")
		messageBox.setStandardButtons(QMessageBox.Ok | QMessageBox.Cancel)
		messageBox.setDefaultButton(QMessageBox.Ok)
		res = messageBox.exec_()
		if res == QMessageBox.Ok:
			self.transformationView.removeLastRow()
Beispiel #22
0
    def show_dialog(message, title):
        msg = QMessageBox()
        msg.setIcon(QMessageBox.Information)

        msg.setText(title)
        msg.setInformativeText(message)
        msg.setWindowTitle("Something wrong occurred")
        msg.setStandardButtons(QMessageBox.Ok | QMessageBox.Cancel)
        msg.buttonClicked.connect(QDataViewer.msgbtn)

        retval = msg.exec_()
        print "value of pressed message box button:", retval
    def removeButtonClicked(self):
        """
		Remove the last transformation in the list.
		"""
        messageBox = QMessageBox()
        messageBox.setText("The last transformation is about to be removed.")
        messageBox.setInformativeText("Do you want to proceed?")
        messageBox.setStandardButtons(QMessageBox.Ok | QMessageBox.Cancel)
        messageBox.setDefaultButton(QMessageBox.Ok)
        res = messageBox.exec_()
        if res == QMessageBox.Ok:
            self.transformationView.removeLastRow()
Beispiel #24
0
 def __savediag(self):
     diag = QMessageBox(self)
     msg = 'Do you want to save the changes in your worksheet "'
     msg += (self.controller.fileName().split('/')[-1] or 'untitled') + '"?'
     diag.setText(msg)
     diag.setInformativeText("Otherwise they will get lost")
     diag.setIcon(QMessageBox.Warning)
     diag.setStandardButtons(QMessageBox.StandardButton.Discard |
                             QMessageBox.StandardButton.Cancel |
                             QMessageBox.StandardButton.Save)
     diag.setWindowModality(Qt.WindowModal)
     return diag.exec_()
 def download_button_pressed(self):
     if self.ui.textEditDownload is not None:
         if self.check_url(self.ui.textEditDownload.toPlainText()):
             #subprocess.Popen(self.return_youtube_dl_cmd())
             system(self.return_youtube_dl_cmd())
         else:
             msgBox = QMessageBox()
             msgBox.setIcon(QMessageBox.Critical)
             msgBox.setText("Error in URL")
             msgBox.setInformativeText("Please check the URL you provided.")
             msgBox.setStandardButtons(QMessageBox.Ok)
             msgBox.exec_()
Beispiel #26
0
 def show_about(self):
     msg = QMessageBox()
     msg.setIcon(QMessageBox.Question)
     msg.setText("SpyKING CIRCUS v%s" % circus.__version__)
     msg.setWindowTitle("About")
     msg.setInformativeText("Documentation can be found at\n"
                            "http://spyking-circus.rtfd.org\n"
                            "\n"
                            "Open a browser to see the online help?")
     msg.setStandardButtons(QMessageBox.Yes | QMessageBox.No)
     msg.setDefaultButton(QMessageBox.No)
     answer = msg.exec_()
     if answer == QMessageBox.Yes:
         QDesktopServices.openUrl(QUrl("http://spyking-circus.rtfd.org"))
Beispiel #27
0
 def closeEvent(self, event):
     msgBox = QMessageBox()
     msgBox.setText("Do you want to save before quitting?")
     msgBox.setInformativeText("Do you want to save your changes?")
     msgBox.setStandardButtons(QMessageBox.Save | QMessageBox.Discard | QMessageBox.Cancel)
     msgBox.setDefaultButton(QMessageBox.Save)
     ret = msgBox.exec_()
     if ret == QMessageBox.Save:
         self.save_file()
         event.accept()
     elif ret == QMessageBox.Discard:
         event.accept()
     else:
         event.ignore()
    def on_override_panels():
        """ Override HyperShade and NodeEditor creation callback"""
        override_info_box = QMessageBox()
        override_info_box.setWindowTitle(WINDOW_TITLE)
        override_info_box.setIcon(QMessageBox.Information)
        override_info_box.setText(
            'Buttons will be added to HyperShade toolbar and Node Editor toolbar.<br/>'
            'Changes will exists during this session.')
        override_info_box.setInformativeText(
            '<i>Read Help to set this settings permanent</i>')
        override_info_box.setStandardButtons(QMessageBox.Ok)
        override_info_box.setDefaultButton(QMessageBox.Ok)
        override_info_box.exec_()

        mttOverridePanels.override_panels()
Beispiel #29
0
 def newFile(self):
     """
     Create a blank new file.
     """
     if self.saved is False and self.editor.toPlainText() != '':
         msgBox = QMessageBox()
         msgBox.setText("The document has been modified.")
         msgBox.setInformativeText("really discard current document?")
         msgBox.setStandardButtons(QMessageBox.Discard | QMessageBox.Cancel)
         msgBox.setDefaultButton(QMessageBox.Cancel)
         ret = msgBox.exec_()
         if ret == QMessageBox.Cancel:
             return
     self.editor.clear()
     self.filename = ''
Beispiel #30
0
    def show_alert_dialog(exception):
        msg = QMessageBox()
        msg.setIcon(QMessageBox.Warning)

        msg.setText("Something wrong occurred")
        msg.setInformativeText(str(exception.message))
        msg.setWindowTitle("Something wrong occurred")
        msg.setDetailedText("The details are as follows:\n" +
                            exception.message)
        print "The details are as follows:\n" + exception.message
        msg.setStandardButtons(QMessageBox.Ok | QMessageBox.Cancel)
        msg.buttonClicked.connect(QDataViewer.msgbtn)

        retval = msg.exec_()
        print "value of pressed message box button:", retval
Beispiel #31
0
 def help_cpus(self):
     msg = QMessageBox()
     msg.setIcon(QMessageBox.Question)
     msg.setText("Setting the number of CPUs")
     msg.setWindowTitle("Number of CPUs")
     msg.setInformativeText("SpyKING CIRCUS can use several CPUs "
                            "either locally or on multiple machines "
                            "using MPI (see documentation) "
                            "\n"
                            "\n"
                            "You have %d local CPUs available" %
                            psutil.cpu_count())
     msg.setStandardButtons(QMessageBox.Close)
     msg.setDefaultButton(QMessageBox.Close)
     answer = msg.exec_()
Beispiel #32
0
 def _removeProfile_Dialog(self):
     """Runs a prompt dialog.
     
     Ask the user if he really wants to remove the selected profile.
     """
     confirmationDialog = QMessageBox()
     confirmationDialog.setText("Do you really want to remove the selected profile ?")
     confirmationDialog.setInformativeText("Profile deletion can not be undone")
     confirmationDialog.setIcon(QMessageBox.Question)
     confirmationDialog.setStandardButtons(QMessageBox.Yes | QMessageBox.No)
     confirmationDialog.accepted.connect(self._emitRemoveProfile)
     ret = confirmationDialog.exec_()
     
     if ret==QMessageBox.Yes:
         self._emitRemoveProfile()
    def on_override_panels():
        """ Override HyperShade and NodeEditor creation callback"""
        override_info_box = QMessageBox()
        override_info_box.setWindowTitle(WINDOW_TITLE)
        override_info_box.setIcon(QMessageBox.Information)
        override_info_box.setText(
            'Buttons will be added to HyperShade toolbar and Node Editor toolbar.<br/>'
            'Changes will exists during this session.'
        )
        override_info_box.setInformativeText('<i>Read Help to set this settings permanent</i>')
        override_info_box.setStandardButtons(QMessageBox.Ok)
        override_info_box.setDefaultButton(QMessageBox.Ok)
        override_info_box.exec_()

        mttOverridePanels.override_panels()
Beispiel #34
0
 def newFile(self):
     """
     Create a blank new file.
     """
     if self.saved is False and self.editor.toPlainText() != '':
         msgBox = QMessageBox()
         msgBox.setText("The document has been modified.")
         msgBox.setInformativeText("really discard current document?")
         msgBox.setStandardButtons(QMessageBox.Discard | QMessageBox.Cancel)
         msgBox.setDefaultButton(QMessageBox.Cancel)
         ret = msgBox.exec_()
         if ret == QMessageBox.Cancel:
             return
     self.editor.clear()
     self.filename = ''
Beispiel #35
0
 def ssl_errors(self, reply):
     try:
         self.replies.remove(reply)
     except KeyError:
         return False
     ca_cert = reply.sslConfiguration().peerCertificateChain()[-1]
     if not ca_cert.isValid():
         self.message.setText(
             '<span style="font-size: 10px; color: #aa0000;">' +
             'Das Zertifikat ist nicht gültig.' + '</span>')
         return False
     domain_list = []
     for cert in reply.sslConfiguration().peerCertificateChain():
         domain_list.append(cert.subjectInfo(cert.SubjectInfo.CommonName))
         for key in cert.alternateSubjectNames().keys():
             if type(key) == str and key[:3] == "DNS":
                 domain_list.append(cert.alternateSubjectNames()[key])
     print(extract_full_domain(self.url_edit.text()))
     print(domain_list)
     if extract_full_domain(self.url_edit.text()) not in domain_list:
         self.message.setText(
             '<span style="font-size: 10px; color: #aa0000;">' +
             'Das Zertifikat wurde für eine andere Domain ausgestellt.' +
             '</span>')
         return False
     message_box = QMessageBox()
     message_box.setText("Ein unbekanntes CA-Zertifikat wurde gefunden.")
     message_box.setInformativeText(
         "Das Zertifikat hat den Fingerabdruck " + ":".join(
             re.findall(
                 "(.{2})",
                 str(
                     ca_cert.digest(
                         QCryptographicHash.Sha1).toHex().toUpper()))) +
         ". Möchten Sie diesem Zertifikat vertrauen?")
     message_box.setStandardButtons(QMessageBox.No | QMessageBox.Yes)
     message_box.setDefaultButton(QMessageBox.Yes)
     answer = message_box.exec_()
     if answer != QMessageBox.Yes:
         self.message.setText(
             '<span style="font-size: 10px; color: #aa0000;">' +
             'Sie haben dem Zertifikat nicht vertraut.' + '</span>')
         return False
     if not self.certificate:
         reply.ignoreSslErrors()
     self.certificate = ca_cert.toPem()
     self.save_settings()
     self.certificate_loaded.emit()
Beispiel #36
0
 def ssl_errors(self, reply):
     try:
         self.replies.remove(reply)
     except KeyError:
         return False
     ca_cert = reply.sslConfiguration().peerCertificateChain()[-1]
     if not ca_cert.isValid():
         self.message.setText(
             '<span style="font-size: 10px; color: #aa0000;">' + "Das Zertifikat ist nicht gültig." + "</span>"
         )
         return False
     domain_list = []
     for cert in reply.sslConfiguration().peerCertificateChain():
         domain_list.append(cert.subjectInfo(cert.SubjectInfo.CommonName))
         for key in cert.alternateSubjectNames().keys():
             if type(key) == str and key[:3] == "DNS":
                 domain_list.append(cert.alternateSubjectNames()[key])
     print(extract_full_domain(self.url_edit.text()))
     print(domain_list)
     if extract_full_domain(self.url_edit.text()) not in domain_list:
         self.message.setText(
             '<span style="font-size: 10px; color: #aa0000;">'
             + "Das Zertifikat wurde für eine andere Domain ausgestellt."
             + "</span>"
         )
         return False
     message_box = QMessageBox()
     message_box.setText("Ein unbekanntes CA-Zertifikat wurde gefunden.")
     message_box.setInformativeText(
         "Das Zertifikat hat den Fingerabdruck "
         + ":".join(re.findall("(.{2})", str(ca_cert.digest(QCryptographicHash.Sha1).toHex().toUpper())))
         + ". Möchten Sie diesem Zertifikat vertrauen?"
     )
     message_box.setStandardButtons(QMessageBox.No | QMessageBox.Yes)
     message_box.setDefaultButton(QMessageBox.Yes)
     answer = message_box.exec_()
     if answer != QMessageBox.Yes:
         self.message.setText(
             '<span style="font-size: 10px; color: #aa0000;">'
             + "Sie haben dem Zertifikat nicht vertraut."
             + "</span>"
         )
         return False
     if not self.certificate:
         reply.ignoreSslErrors()
     self.certificate = ca_cert.toPem()
     self.save_settings()
     self.certificate_loaded.emit()
Beispiel #37
0
 def prompt_for_closing_apps(self, apps_string):
     ''' Function to prompt user for prompting user
     for closing the restricted apps. '''
     msg = QMessageBox()
     msg.setIcon(QMessageBox.Warning)
     msg.setInformativeText("Kindly Close The Application")
     msg.setWindowTitle("ERROR!!!")
     msg.setWindowFlags(self.windowFlags()
                        | Qt.WindowStaysOnTopHint)  #added by RSR
     #msg.setDetailedText("The details are as follows:")
     msg.setStandardButtons(QMessageBox.Ok)
     msg.setText("Looks like  application {} is Open".format(
         apps_string.upper()))
     msg.show()
     msg.exec_()
     return True
 def requestTabClose(self, tabIndex):
   tab_to_close = self._tab_widget.widget(tabIndex)
   response = tab_to_close.stop_spider()
   if response is True:
     # now make sure the user doesn't want the data
     confirm_close = QMessageBox(self)
     confirm_close.setStandardButtons(QMessageBox.Yes | QMessageBox.No)
     confirm_close.setIcon(QMessageBox.Warning)
     confirm_close.setText(self.tr("{0} data may be lost".format(self._tab_widget.tabText(tabIndex))))
     confirm_close.setInformativeText(self.tr("Are you sure?"))
     confirm_close.setWindowTitle(self.tr("Warning"))
     ret = confirm_close.exec_()
     if ret == QMessageBox.Yes:
       self._tab_widget.removeTab(tabIndex)
       return True
     else: return False
   else: return False
Beispiel #39
0
def getCriticalMessageBox(text, informative_text, detailed_text=None):
    message_box = QMessageBox()
    h_spacer = QSpacerItem(500, 0)
    gl = message_box.layout()
    gl.addItem(h_spacer, gl.rowCount(), 0, 1, gl.columnCount())
    message_box.setWindowTitle(constants.APPLICATION_TITLE)
    message_box.addButton(QMessageBox.Ok)
    message_box.setText('<b>{}'.format(text))
    message_box.setInformativeText(informative_text)
    if detailed_text is not None:
        message_box.setDetailedText(detailed_text)
    else:
        excType, excValue, tracebackobj = sys.exc_info()
        tb_list = traceback.format_exception(excType, excValue, tracebackobj)
        tb_str = ''.join(tb_list)
        message_box.setDetailedText(tb_str)
    message_box.setIcon(QMessageBox.Critical)
    return message_box
Beispiel #40
0
 def closeEvent(self, event):
     if self.process is not None:
         msg = QMessageBox()
         msg.setIcon(QMessageBox.Warning)
         msg.setWindowTitle('Confirm process interruption')
         msg.setText('Closing the window will terminate the running process. '
                     'Do you really want to exit?')
         msg.setInformativeText('Interrupting the process may leave partly '
                                'created files that cannot be used for '
                                'further analysis.')
         close_button = msg.addButton("Stop and close", QMessageBox.YesRole)
         cancel_button = msg.addButton("Cancel", QMessageBox.NoRole)
         msg.setDefaultButton(cancel_button)
         msg.exec_()
         if msg.clickedButton() == close_button:
             self.stop(force=True)
             super(LaunchGUI, self).closeEvent(event)
         else:
             event.ignore()
Beispiel #41
0
 def closeTab(self):
     if self.tabWidget.currentWidget().getSaved() is True:
         self.tabWidget.removeTab(self.tabWidget.currentWidget().getIndex())
     else:
         confirmBox = QMessageBox()
         confirmBox.setText('The document has been modified.')
         confirmBox.setInformativeText('Do you want to save your changes?')
         confirmBox.setStandardButtons(QMessageBox.Save | QMessageBox.Discard | QMessageBox.Cancel)
         confirmBox.setDefaultButton(QMessageBox.Save)
         confirm = confirmBox.exec_()
         if confirm == QMessageBox.Save:
             self.tabWidget.currentWidget().save()
             self.closeTab()
         elif confirm == QMessageBox.Discard:
             self.tabWidget.removeTab(self.tabWidget.currentWidget().getIndex())
         elif confirm == QMessageBox.Cancel:
             pass
         else:
             raise ValueError(confirm)
Beispiel #42
0
def confirmationBox(text, info_text, object_name="confirmationBox"):
    box = QMessageBox()
    box.setObjectName(object_name)
    box.setWindowTitle(_("Please confirm"))
    box.setIcon(QMessageBox.Question)
    box.setText(text)
    if info_text:
        box.setInformativeText(info_text)
    box.setStandardButtons(QMessageBox.Ok | QMessageBox.Cancel)

    # box.show()
    # from PySide.QtTest import QTest
    # from PySide.QtGui import QApplication
    # QTest.qWaitForWindowShown(box)
    # QApplication.instance().removePostedEvents()

    r = box.exec_() == QMessageBox.Ok

    box.deleteLater()
    return r
Beispiel #43
0
    def stop(self, force=False):
        if self.process is not None:

            if not force:
                msg = QMessageBox()
                msg.setIcon(QMessageBox.Warning)
                msg.setWindowTitle('Confirm process termination')
                msg.setText(
                    'This will terminate the running process. Are you sure '
                    'you want to do this?')
                msg.setInformativeText(
                    'Interrupting the process may leave partly '
                    'created files that cannot be used for '
                    'further analysis.')
                msg.addButton('Stop process', QMessageBox.YesRole)
                cancel_button = msg.addButton('Cancel', QMessageBox.NoRole)
                msg.setDefaultButton(cancel_button)
                msg.exec_()
                if msg.clickedButton() == cancel_button:
                    # Continue to run
                    return

            self._interrupted = True
            # Terminate child processes as well
            pid = int(self.process.pid())
            if sys.platform == 'win32' and pid != 0:
                # The returned value is not a PID but a pointer
                lp = ctypes.cast(pid, LPWinProcInfo)
                pid = lp.contents.dwProcessID

            if pid != 0:
                process = psutil.Process(pid)
                children = process.children(recursive=True)
                for proc in children:
                    proc.terminate()
                gone, alive = psutil.wait_procs(children, timeout=3)
                for proc in alive:
                    proc.kill()

                self.process.terminate()
                self.process = None
 def __binary(self):
     binary = QSettings().value("computation/reduce",
                                QtReduceDefaults.REDUCE)
     if not os.path.exists(sys.path[0] + "/" + binary):
         tit = self.tr("Unable to Connect to Reduce")
         txt = self.tr("The binary ")
         txt += '"' + binary + '" '
         txt += self.tr("does not exist.")
         itxt = self.tr("Using the default binary ")
         itxt += '"' + QtReduceDefaults.REDUCE + '"'
         itxt += self.tr(". ")
         itxt += self.tr("Please check the Preferences.")
         mbox = QMessageBox()
         mbox.setIcon(QMessageBox.Warning)
         mbox.setWindowModality(Qt.WindowModal)
         mbox.setWindowTitle(tit)
         mbox.setText(txt)
         mbox.setInformativeText(itxt)
         mbox.exec_()
         binary = QtReduceDefaults.REDUCE
     return binary
Beispiel #45
0
    def warningDialogBox(self, title, message, typeButton='ok'):
        msgBox = QMessageBox()
        msgBox.setText("<p align='center'>" + title + "</p>")
        msgBox.setInformativeText("<p align='center'>" + message + "</p>")

        if typeButton:
            if typeButton.lower() == "yesno":
                msgBox.setStandardButtons(QMessageBox.No | QMessageBox.Yes)
                msgBox.setDefaultButton(QMessageBox.No)
            elif typeButton.lower() == "yesnoall":
                msgBox.setStandardButtons(QMessageBox.No | QMessageBox.NoToAll
                                          | QMessageBox.Yes
                                          | QMessageBox.YesToAll)
                msgBox.setDefaultButton(QMessageBox.No)
            elif typeButton.lower() == "savedisccan":
                msgBox.setStandardButtons(QMessageBox.Save
                                          | QMessageBox.Discard
                                          | QMessageBox.Cancel)
                msgBox.setDefaultButton(QMessageBox.Save)

        return msgBox.exec_()
Beispiel #46
0
 def requestTabClose(self, tabIndex):
     tab_to_close = self._tab_widget.widget(tabIndex)
     response = tab_to_close.stop_spider()
     if response is True:
         # now make sure the user doesn't want the data
         confirm_close = QMessageBox(self)
         confirm_close.setStandardButtons(QMessageBox.Yes | QMessageBox.No)
         confirm_close.setIcon(QMessageBox.Warning)
         confirm_close.setText(
             self.tr("{0} data may be lost".format(
                 self._tab_widget.tabText(tabIndex))))
         confirm_close.setInformativeText(self.tr("Are you sure?"))
         confirm_close.setWindowTitle(self.tr("Warning"))
         ret = confirm_close.exec_()
         if ret == QMessageBox.Yes:
             self._tab_widget.removeTab(tabIndex)
             return True
         else:
             return False
     else:
         return False
Beispiel #47
0
    def cmdElimina_click(self):
        """Evento che gestisce il tasto di elimina"""

        msgBox = QMessageBox()
                
        if self.myWidget.lstRubrica.currentIndex():
            index = self.myWidget.lstRubrica.currentIndex().row()
            rec = self.tableModel.record(index)
            nome = rec.value("nome")
            cognome = rec.value("cognome")
            
            msgBox.setText("Si conferma l'eliminazione del contatto %s %s?" % (nome, cognome))
            msgBox.setInformativeText("Se si procede con l'eliminazione il contatto verrà eliminato definitivamente.")
            msgBox.setStandardButtons(QMessageBox.Ok | QMessageBox.Cancel)
            ret = msgBox.exec_()
            
            if(ret == QMessageBox.Ok):
                self.tableModel.removeRow(index)
                self.tableModel.submitAll()                
        else:
            msgBox.setText("Occorre selezionare un elemento!")
            msgBox.exec_()            
Beispiel #48
0
def main():
    additionallibpath = None
    app = QApplication(sys.argv)
    if "-help" in sys.argv or "-?" in sys.argv:
        msgBox = QMessageBox()
        msgBox.setText("Following arguments are possible:\t\t")
        msgBox.setInformativeText("-path\tPath to additional service libraries.\ne.g.: -path C:/plugins/bin")
        msgBox.setStandardButtons(QMessageBox.Ok)
        msgBox.exec_()
        return
    if "-path" in sys.argv:
        index = sys.argv.index("-path")
        additionallibpath = sys.argv[index+1]

    """ add additional service library path """
    if additionallibpath:
        print "Additiona Library path:", additionallibpath
        QCoreApplication.addLibraryPath(additionallibpath);

    browser = ServiceBrowser()
    browser.show()
    return app.exec_()
Beispiel #49
0
  def showVersionUpdateReportFromShotManifest(self,sequenceShotManifest):
      """This just displays an info Message box, based on a Sequence[Shot] manifest dictionary"""

      # Now present an info dialog, explaining where shots were updated
      updateReportString = "The following Versions were updated:\n"
      for seq in sequenceShotManifest.keys():
        updateReportString+="%s:\n  Shots:\n" % (seq.name())
        for shot in sequenceShotManifest[seq]:
          updateReportString+='  %s\n    (New Version: %s)\n' % (shot.name(), shot.currentVersion().name())
        updateReportString+='\n'

      infoBox = QMessageBox(hiero.ui.mainWindow())
      infoBox.setIcon(QMessageBox.Information)

      if len(sequenceShotManifest)<=0:
        infoBox.setText("No Shot Versions were updated")
        infoBox.setInformativeText("Clip could not be found in any Shots in this Project")
      else:
        infoBox.setText("Versions were updated in %i Sequences of this Project." % (len(sequenceShotManifest)))
        infoBox.setInformativeText("Show Details for more info.")
        infoBox.setDetailedText(updateReportString)

      infoBox.exec_()     
Beispiel #50
0
    def openFile(self, filename = None):
        """
        Open a file.
        """
        if self.saved is False and self.editor.toPlainText() != '':
            msgBox = QMessageBox()
            msgBox.setText("The document has been modified.")
            msgBox.setInformativeText("Really discard current document?")
            msgBox.setStandardButtons(QMessageBox.Discard | QMessageBox.Cancel)
            msgBox.setDefaultButton(QMessageBox.Cancel)
            ret = msgBox.exec_()
            if ret == QMessageBox.Cancel:
                return

        self.editor.clear()
        if not filename:
            fname, _ = QtGui.QFileDialog.getOpenFileName(self, 'Open file', '',
                ("Markdown Files (*.txt *.md)"))
            self.filename = fname
        else:
            fname = filename
            self.filename = filename

        f = open(fname, 'r')

        # change working directory
        os.chdir(os.path.dirname(f.name))

        with f:
            tmp = f.read()
            tmp = tmp.decode('utf-8')
            self.editor.insertPlainText(tmp)
        f.close()

        self.saved = True
        self.saveStatus.setText('Document saved: ' + str(self.saved))
Beispiel #51
0
    def load_model(self, filename=None):
        """
        Loads a given SBML file, thereby creating a new subwindow
        on the main MDI Area.
        If filename is None, it creates a new model.

        There are a lot of reference variables, so that the system knows the
        currently active subwindow, etc.

        @param filename: The filename of the model. If None, a new model is created.
        @type filename: str
        """
        if not filename:
            action = self.sender()
            if type(action) == QAction:
                filename = action.data()
            else:
                return

        # note: this has been (temporarily added) to allow only one file to be open at the same time
        # We will probably change this behaviour again later, once we have decided how to handle
        # multiple-model results, etc. intelligently
        if len(self.ModelControllers) > 0:

            # show warning dialog
            msgBox = QMessageBox()
            infoText = """<b>Another model is currently loaded.</b><br>
            """
            msgBox.setText(infoText)
            infoTextShort = "Do you want to save the current model (you will be prompted to enter a new filename)?"
            msgBox.setInformativeText(infoTextShort)
            msgBox.setWindowTitle(infoTextShort)
            msgBox.setStandardButtons(QMessageBox.Save | QMessageBox.Discard)
            msgBox.setDefaultButton(QMessageBox.Save)
            msgBox.setIcon(QMessageBox.Warning)
            clickedButton = msgBox.exec_()

            if clickedButton == QMessageBox.Save:
                self.actionSave_as.trigger()

            for (
                modelController
            ) in self.ModelControllers.values():  # close all models (in theory, there should be only one :)
                self.modelClosed.emit(modelController)

        #        self.NetworkWindowCount += 1
        #        self.setStatusTip("Opening file %s..." % filename)
        self.statusBar().showMessage("Opening file %s..." % filename, 2000)
        modelController = ModelController(filename=filename, views=self.mainWindowViews)

        #        # create NetworkViewController
        #        networkViewController = NetworkViewController(modelController=modelController)
        #        networkView = networkViewController.createNetworkView(self) # sets networkController.networkView internally
        #        networkView.setMinimumSize(400, 300)
        #        modelController.setViews(networkViewController=networkViewController)

        #        # Create Subwindow to hold the NetworkView
        #        subWindow = QMdiSubWindow(parent=self._mdiArea)
        #        networkViewController.subWindow = subWindow
        #        subWindow.setAttribute(Qt.WA_DeleteOnClose)
        #        subWindow.setWidget(networkView)
        #        subWindow.setOption(QMdiSubWindow.RubberBandResize, True)
        #        self._mdiArea.addSubWindow(subWindow)
        #        subWindow.activateWindow()
        #        subWindow.show()    # important!
        #        networkView.show()

        # handle references
        filename = modelController.filename
        #        self.SubWindowToModelControllers[subWindow] = modelController
        #        self.networkSubWindows[modelController] = subWindow #networkView
        self.ModelControllers[filename] = modelController
        #        self.ActiveNetworkWindow = networkWindow
        self.ActiveModelController = modelController

        #        self.connectNetworkWindowSignals(networkView, subWindow)

        # emit custom Signal so that e.g. Simulationworkbench are notified of the new subwindow
        #        self.newNetworkWindowCreated.emit()
        self.activeModelChanged.emit(modelController)

        # handle recent files list
        if filename in self.recentFiles:
            self.recentFiles.remove(filename)
        self.recentFiles.insert(0, filename)
        if len(self.recentFiles) > NUM_RECENT_FILES:  # cap list at length of NUM_RECENT_FILES
            self.recentFiles = self.recentFiles[:NUM_RECENT_FILES]
Beispiel #52
0
def Mbox(title, text):
    msgBox = QMessageBox()
    msgBox.setText(title)
    msgBox.setInformativeText(text)
    msgBox.exec_()