Exemplo n.º 1
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]))
Exemplo n.º 2
0
 def okClicked(self):
            
     if self.directory != "" and self.textBox.text() != "":
         try:
             if self.parent.parent.platform == "linux2":
                 os.mkdir(self.directory + "/"+ self.textBox.text())
                 self.parent.parent.project = Project(self.directory + "/"+ self.textBox.text(), self.textBox.text(), "linux2")
                                             
             elif self.parent.parent.platform == "win32":
                 os.mkdir(self.directory + "\\"+ self.textBox.text())
                 self.parent.parent.project = Project(self.directory + "\\"+ self.textBox.text(), self.textBox.text(), "win32")
                                                                                                 
             self.parent.parent.project.save()
             self.dialog.setVisible(False)
             
             self.parent.parent.fileMenu.saveProjectAction.setEnabled(True)
             self.parent.parent.signalMenu.addSignalAction.setEnabled(True)
             self.parent.parent.signalMenu.applyOperationAction.setEnabled(True)
             
             msg = QMessageBox(self.parent.parent)
             msg.setText("Project created")
             msg.show()
                               
                            
         except OSError:
             msg = QErrorMessage(self.parent.parent)            
             msg.showMessage("Project already exists")
Exemplo n.º 3
0
 def __init__(self, parent):
     
     try:
         filePicker = QFileDialog()
         fileName = filePicker.getOpenFileName(parent, "Open File", "DSPToolProjects (*.dsp)")
         f = open (fileName[0], "r")
         parent.parent.project = pickle.load(f)
         f.close()
         filePicker.destroy()
         
                   
         parent.parent.fileMenu.saveProjectAction.setEnabled(True)
         parent.parent.signalMenu.addSignalAction.setEnabled(True)
         parent.parent.signalMenu.applyOperationAction.setEnabled(True)
         
         msg = QMessageBox(parent.parent)
         msg.setText("Project opened")
         msg.show()
         
         parent.parent.refreshTable()
      
         
     except:
         #tratar melhor
         msg = QErrorMessage(parent.parent)            
         msg.showMessage("Invalid File")
Exemplo n.º 4
0
	def insert(self):
		p = self.aFileModel.insert()
		if p:
			msgDuplBox = QMessageBox()
			msgDuplBox.setText('\n'.join(p) + 
				"\n\n...file(s) already being tracked.")
			msgDuplBox.exec_()
Exemplo n.º 5
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_()
Exemplo n.º 6
0
 def onAbout(self):
     msgBox = QMessageBox(self)
     msgBox.setIconPixmap(QPixmap(":/images/sherlock.png"))
     msgBox.setWindowTitle(_translate("MainWindow", "Pythonthusiast", None))
     msgBox.setText(_translate("MainWindow", "Well Watson, isn't it obvious to you that Qt rocks?", None))
     msgBox.setStandardButtons(QMessageBox.Ok)
     msgBox.exec_()
Exemplo n.º 7
0
    def start(self):
        incomplete = []
        if self.google_radio.isChecked():
            if not self.username.text():
                incomplete.append(self.username)
            if not self.password.text():
                incomplete.append(self.password)
            if not self.document_id.text():
                incomplete.append(self.document_id)
        elif not self.csv_file.text():
            incomplete.append(self.csv_file)
        if not self.dbf_file.text():
            incomplete.append(self.dbf_file)

        if len(incomplete) > 0:
            mbox = QMessageBox(self)
            mbox.setWindowTitle("Warning, incomplete fields!")
            mbox.setIcon(QMessageBox.Warning)
            mbox.setWindowIcon(QIcon.fromTheme("dialog-warning"))
            mbox.setText("%d fields are incomplete" % len(incomplete))
            mbox.exec()
            for field in self.changed_styles:
                field.setStyleSheet("")
            for field in incomplete:
                field.setStyleSheet("border: 1.5px solid red; border-radius: 5px")
            self.changed_styles = incomplete.copy()
            return
        for field in self.changed_styles:
            field.setStyleSheet("")
        self.setStatusTip("Working...")
        self.working_thread = WorkThread(self)
        self.working_thread.finished.connect(self.finished_start)
        self.working_thread.start()
Exemplo n.º 8
0
    def eventFilter(self, obj, event):
        if not event:
            return False

        if event.type() != QEvent.KeyPress:
            return False

        if event.key() not in (Qt.Key_Return, Qt.Key_Enter):
            return False

        print "Obj", obj
        if obj == self.loginEdit:
            print "Changing focus"
            self.passwordEdit.setFocus(Qt.OtherFocusReason)
        elif obj == self.passwordEdit:
            message = ""
            icon = None

            if not (self.loginEdit.text() or self.passwordEdit.text()):
                message = "Please enter your credentials"
                icon = QMessageBox.Warning
            else:
                message = "Login Successfull"
                icon = QMessageBox.Information

            messageBox = QMessageBox()
            messageBox.setText(message)
            messageBox.addButton("OK", QMessageBox.AcceptRole)
            messageBox.setIcon(icon)
            messageBox.exec_()

        return False
Exemplo n.º 9
0
 def displayError(self, message, details=None):
     msgBox = QMessageBox()
     msgBox.setText(message)
     msgBox.setIcon(QMessageBox.Critical)
     if details != None:
         msgBox.setDetailedText(details)
     msgBox.exec_()
Exemplo n.º 10
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()
Exemplo n.º 11
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_()
Exemplo n.º 12
0
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_()
Exemplo n.º 13
0
 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)
Exemplo n.º 14
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
Exemplo n.º 15
0
 def show_error(self, error):
     err = QMessageBox()
     err.setWindowTitle("Join error")
     err.setText(error)
     err.setIcon(QMessageBox.Critical)
     err.setModal(True)
     err.exec_()
Exemplo n.º 16
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
    def __loadKeyFile(self):
        file, extType = QFileDialog.getOpenFileName(self, 'Choose Key File')
        if file != '':
            # get algorithm type and keysize from the key file
            with open(file, 'r') as f:
                try:
                    # auth should be 'k'
                    # k should be the key
                    # alg will be the algorithm and 3 digit keylingth (128, 192 or 256)
                    auth, k, alg = f.read().split('_')

                    # check the auth and algorithm
                    if auth == 'k' and alg is not None:
                        self.key = bytearray.fromhex(k)
                        self.algo_type = alg[:3]
                        self.keysize = int(alg[3:])
                        self.key_label.setText(binascii.hexlify(self.key).decode())
                    else:
                        msg = QMessageBox()
                        msg.setWindowTitle('error')
                        msg.setText("Please Select a Valid Key File")
                        msg.exec_()
                # value error will be thrown if the selected file contents can not be split into auth, key and algorithm
                except ValueError:
                    msg = QMessageBox()
                    msg.setWindowTitle('error')
                    msg.setText("Please Select a Valid Key File")
                    msg.exec_()
Exemplo n.º 18
0
	def grammarAnalysis(self):
		self.useTree()
		os.system("python dlcheck.py < "+ self.fileName + "| tail -n +3 > tmp.json")
		try:
			with open("tmp.json", 'r') as f:
				j = json.loads(f.read())
				text_file = open("tmp.xml", "w")
				#text_file.write("<body>\n")
				text_file.write(json2xml(j))
				#text_file.write("</body>\n")
				text_file.close()
		except:
			msgBox = QMessageBox()
			msgBox.setText("Syntax Error.")
			msgBox.exec_()
			self.useConsole()
			with open("tmp.json", 'r') as f:
				self.consoleField.setPlainText( f.read() )
			return
			
		#os.system("rm tmp.json")
		fileName = "tmp.xml"
		if True:
			f = QtCore.QFile(fileName)
			if f.open(QtCore.QIODevice.ReadOnly):
				document = QtXml.QDomDocument()
				if document.setContent(f):
					newModel = DomModel(document, self)
					self.treeView.setModel(newModel)
					self.model = newModel
					self.xmlPath = fileName
				f.close()
		#os.system("rm tmp.xml")
		self.semanticButt.setEnabled(True)
    def processCancelled(self):
        self.active = False

        msg = QMessageBox()
        msg.setWindowTitle('Error')
        msg.setText('The Encryption Process Has Been Successfully Cancelled')
        msg.exec_()
Exemplo n.º 20
0
	def winsetup(self):
		msgbox = QMessageBox(self)
		msgbox.setWindowIcon(QIcon('img/note.png'))
		msgbox.resize(300, 80)
		msgbox.setWindowTitle('ADLMIDI pyGUI')
		text = "<center><b>ADLMIDI cannot be found!</b></center><br>" + "Please check that " + "<b>" + binary + "</b>" + " is in the same folder as this program."
		msgbox.setText(text)
		msgbox.show()
Exemplo n.º 21
0
def log(txt):
    if DEBUG_MSGBOX:
        from PySide.QtGui import QMessageBox
        msgBox = QMessageBox()
        msgBox.setText(txt)
        msgBox.exec_()
    else:
        print txt
Exemplo n.º 22
0
 def saveProject(self):
     """
     """
     self.parent.project.save()
     
     msg = QMessageBox(self.parent)
     msg.setText("Project Saved")
     msg.show()
Exemplo n.º 23
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_()
Exemplo n.º 24
0
 def showMessageBox(self, msg):
     warning = QMessageBox(self)
     warning.setFont(View.labelsFont())
     warning.setStyleSheet('QMessageBox {background: white}')
     warning.setWindowTitle("Error")
     warning.setText(msg)
     warning.setIcon(QMessageBox.Warning)
     warning.addButton("Ok", QMessageBox.AcceptRole).setFont(View.editsFont())
     warning.exec_()
Exemplo n.º 25
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_()
Exemplo n.º 26
0
 def dump_msh(self):
     filename, _ = QFileDialog.getOpenFileName(self, 'Select .MSH', os.getcwd(), 'MSH  Files (*.msh)')
     mup = msh2_unpack.MSHUnpack(filename)
     msh = mup.unpack()
     msh.dump(filename + '.dump')
     msg_box = QMessageBox()
     msg_box.setWindowTitle('MSH Suite')
     msg_box.setText('Dumped to {0}.'.format(filename + '.dump'))
     msg_box.exec_()
Exemplo n.º 27
0
 def accept(self):
     """Overriding accept slot for plausibility checking."""
     if len(self.textStart.text()) > 0 and len(self.textEnd.text()) > 0:
         super(DialogAddConnection, self).accept()
     else:
         msg = QMessageBox()
         msg.setText(self.tr("Start and End fields have to be filled out"))
         msg.setIcon(QMessageBox.Critical)
         msg.exec_()
Exemplo n.º 28
0
 def new_selected(self):
     msgBox = QMessageBox()
     msgBox.setText("Do you want to discard your changes?")
     msgBox.setStandardButtons(QMessageBox.Discard | QMessageBox.Cancel)
     msgBox.setDefaultButton(QMessageBox.Cancel)
     ret = msgBox.exec_()
     if ret == QMessageBox.Cancel:
         return
     self.filename = None
     self.apply_default()
Exemplo n.º 29
0
 def showMessageBox(self, msg):
     warning = QMessageBox(self)
     warning.setFont(View.labelsFont())
     warning.setStyleSheet('QMessageBox {background: white}')
     warning.setWindowTitle("Error")
     warning.setText(msg)
     warning.setIcon(QMessageBox.Warning)
     warning.addButton("Ok",
                       QMessageBox.AcceptRole).setFont(View.editsFont())
     warning.exec_()
Exemplo n.º 30
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_()
Exemplo n.º 31
0
    def reject(self):
        """exit the applicaiton if the user is sure"""

        box = QMessageBox()
        box.setStandardButtons(QMessageBox.Yes | QMessageBox.No)
        box.setText("Are you sure you want to exist?")
        ret = box.exec_()

        if ret == QMessageBox.Yes:
            QtGui.QApplication.exit()
Exemplo n.º 32
0
 def setLang(self, lang):
     """Sets the UI language. Warns a restart is required."""
     old = self.config.get('Appearance', 'lang')
     if old != lang:
         self.config.set('Appearance', 'lang', lang)
         with open(self.config.configFile, 'w+') as f:
             self.config.write(f)
         msgBox = QMessageBox()
         msgBox.setText(self.str_langChanged)
         msgBox.exec_()
Exemplo n.º 33
0
 def new_selected(self):
     msgBox = QMessageBox()
     msgBox.setText("Do you want to discard your changes?")
     msgBox.setStandardButtons(QMessageBox.Discard | QMessageBox.Cancel)
     msgBox.setDefaultButton(QMessageBox.Cancel)
     ret = msgBox.exec_()
     if ret == QMessageBox.Cancel:
         return
     self.filename = None
     self.apply_default()
Exemplo n.º 34
0
        def cmd_create():            
            tabName = lineEditTabName.text()
            if not tabName:
                msgbox = QMessageBox( self )
                msgbox.setText( "�̸��� �������ּ���".decode( 'utf-8' ) )
                msgbox.exec_()
                return

            self.tabWidget.addTab( tabName )
            dialog.close()
Exemplo n.º 35
0
 def updateDialog(self):
     msgBox = QMessageBox()
     msgBox.setWindowTitle('Update available')
     msgBox.setText("There is a new version of AssetJet available.\n" \
                    "Do you want to download and install?")
     msgBox.setStandardButtons(QMessageBox.Yes | QtGui.QMessageBox.No)
     msgBox.setIcon(QMessageBox.Question)
     msgBox.setDefaultButton(QMessageBox.Yes)
     msgBox.setWindowIcon(QtGui.QIcon(':/Pie-chart.ico'))
     reply = msgBox.exec_()
     return reply
def query_user(platform):
    msg_box = QMessageBox()
    msg_box.setWindowTitle("This plaform is not installed!")
    ok = msg_box.addButton("Install now", QMessageBox.AcceptRole)
    later = msg_box.addButton("Install later", QMessageBox.RejectRole)
    msg_box.setEscapeButton(later)
    msg_box.setDefaultButton(ok)
    msg_box.setIcon(QMessageBox.Warning)
    msg_box.setText("Do you want to install target\n{} ?".format(platform))
    msg_box.exec_()
    return msg_box.clickedButton() == ok
Exemplo n.º 37
0
 def _askAreYouSure(self):
   dialog_sure = QMessageBox(self)
   dialog_sure.setWindowTitle(self.tr("Confirm"))
   dialog_sure.setStandardButtons(QMessageBox.Ok | QMessageBox.Cancel)
   dialog_sure.setIcon(QMessageBox.Warning)
   dialog_sure.setText(self.tr("Are you sure"))
   result = dialog_sure.exec_()
   if result == QMessageBox.Ok:
     return True
   else:
     return False
Exemplo n.º 38
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()
Exemplo n.º 40
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
Exemplo n.º 41
0
def setToolsSettings(legacy, relative):
    pref = preferences()
    if legacy:
        msgBox = QMessageBox()
        msgBox.setIcon(QMessageBox.Warning)
        msgBox.setText(
            translate(
                "Path",
                "Legacy tools are deprecated. They will be removed after version 0.20",
            ))
        msgBox.exec_()
    pref.SetBool(UseLegacyTools, legacy)
    pref.SetBool(UseAbsoluteToolPaths, relative)
Exemplo n.º 42
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"))
Exemplo n.º 43
0
def run(app):
    # Ask user for AssetJet database location
    dlgDbLocation = DbLocation()
    # Hide the 'What's This' question mark
    dlgDbLocation.setWindowFlags(QtCore.Qt.WindowTitleHint)
    if dlgDbLocation.exec_():
        loc = os.path.join(dlgDbLocation.getText(),'assetjet.db')
        # create directory if it doesn't exist yet
        if not os.path.exists(dlgDbLocation.getText()):
            os.mkdir(dlgDbLocation.getText())
        cfg.add_entry('Database', 'DbFileName', loc)
                      
    # Start download thread if database is not existing yet
    if not os.path.exists(loc):
        # Check internet connection
        from assetjet.util import util
        if util.test_url('http://finance.yahoo.com'):
            # Start download thread
            download = download_data.Downloader(loc)
            download.daemon = True
            download.start()
            
            # Create download progress dialog
            dlgProgress = QtGui.QProgressDialog(
                                labelText='Downloading 1 year of daily returns for members of the S&P 500. \n This may take a couple of minutes.\n' ,
                                minimum = 0, maximum = 500,
                                flags=Qt.CustomizeWindowHint | Qt.WindowTitleHint)
            dlgProgress.setWindowTitle('Downloading...')                                       
            dlgProgress.setCancelButton(None)
            dlgProgress.setWindowIcon(QtGui.QIcon(':/Pie-chart.ico'))
            dlgProgress.show()
    
            # Update progress bar through signal
            download.downloaded.connect(dlgProgress.setValue)
            download.finished.connect(dlgProgress.close)
            app.exec_()  
            
            # TODO: let it run in parallel with the local server thread
            download.wait()
        else:
            msgBox = QMessageBox()
            msgBox.setWindowTitle('No Internet Connection')
            msgBox.setText("To run AssetJet the first time, you need a working \n" \
                           "internet connection to download the historical returns.")
            msgBox.setStandardButtons(QMessageBox.Ok)
            msgBox.setIcon(QMessageBox.Warning)
            msgBox.setDefaultButton(QMessageBox.Ok)
            msgBox.setWindowIcon(QtGui.QIcon(':/Pie-chart.ico'))
            reply = msgBox.exec_()
            sys.exit()
class Form(QDialog):
 def __init__(self, parent = None):
    super(Form,self).__init__(parent)

    self.usernamelabel = QLabel("Username : "******"Password : "******"Login")
    self.username.setPlaceholderText("Enter Username Here")
    self.password.setPlaceholderText("Enter Password Here")

    layout = QGridLayout()
    layout.addWidget(self.usernamelabel,0,0)
    layout.addWidget(self.passwordlabel,1,0)
    layout.addWidget(self.username,0,1)
    layout.addWidget(self.password,1,1)
    layout.addWidget(self.okbutton)
    self.setLayout(layout)

    self.usernamelist = ['priyank','stupendo','ayaan']
    self.passwordlist = ['priyank','stupendo','ayaan']

    self.connect(self.okbutton, SIGNAL("clicked()"),self.loginfunction)

 def loginfunction(self):
    usernamestatus = False
    usernameindex = -1
    passwordstatus = False
    passwordindex = -1
    for currentusername in range(len(self.usernamelist)):
        if self.passwordlist[currentusername] == self.username.text():
            usernamestatus = True
            usernameindex = self.usernamelist.index(self.passwordlist[currentusername])

    for currentpassword in range(len(self.passwordlist)):
        if self.usernamelist[currentpassword] ==self.password.text():
            passwordstatus = True
            passwordindex = self.passwordlist.index(self.usernamelist[currentpassword])

    if usernamestatus == True and passwordstatus ==True and usernameindex == passwordindex:
        self.hide()
        w2 = chooseoption.Form1(self)
        w2.show()


    else:
        self.msgBox = QMessageBox()
        self.msgBox.setText("Bloody Hacker!!!")
        self.msgBox.exec_()
Exemplo n.º 45
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()
Exemplo n.º 46
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
Exemplo n.º 47
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_()
Exemplo n.º 48
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 = ''
    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()
Exemplo n.º 50
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()
Exemplo n.º 51
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
Exemplo n.º 52
0
    def accept(self):
        """save the path var and exit"""

        items = []
        for i in xrange(self.ui.pathList.count()):
            items.append(self.ui.pathList.item(i).text())
        print items

        box = QMessageBox()
        box.setStandardButtons(QMessageBox.Yes | QMessageBox.No)
        box.setText("Are you sure you want to save?")
        ret = box.exec_()

        if ret == QMessageBox.Yes:
            envars.set_path(items)
            envars.broadcast_change()
            QtGui.QApplication.exit()
Exemplo n.º 53
0
 def stop_spider(self):
   if self._spider_id is None: # do not stop the the spider before receiving data
     pass
   else:
     if self._queue_check_timer.isActive():
       confirm_stop = QMessageBox(self)
       confirm_stop.setIcon(QMessageBox.Warning)
       confirm_stop.setStandardButtons(QMessageBox.Yes | QMessageBox.No)
       confirm_stop.setText(self.tr("Scraping process still running"))
       confirm_stop.setDetailedText(self.tr("Are you sure you want to stop it?"))
       confirm_stop.setWindowTitle(self.tr("Spider still running"))
       ret = confirm_stop.exec_()
       if ret == QMessageBox.Yes:
         self.stop_spider_signal.emit(self._spider_id)
         return True
       else: return False # I won't whip you if you stop it accidentally
     else: return True # already over
    def removeUnusedClips(self):

        # Get selected items
        item = self.selectedItem
        proj = item.project()

        # Build a list of Projects
        SEQS = hiero.core.findItems(proj, "Sequences")
        # Build a list of Clips
        CLIPSTOREMOVE = hiero.core.findItems(proj, "Clips")

        # For each sequence, iterate through each track Item, see if the Clip is in the CLIPS list.
        # Remaining items in CLIPS will be removed

        for seq in SEQS:
            # Loop through selected and make folders...
            for track in seq:
                for trackitem in track:
                    if trackitem.source() in CLIPSTOREMOVE:
                        CLIPSTOREMOVE.remove(trackitem.source())

        # If there are no Clips to remove, return
        if len(CLIPSTOREMOVE) == 0:
            return

        # Present Dialog Asking if User wants to remove Clips
        msgBox = QMessageBox()
        msgBox.setWindowTitle("Remove Unused Clips")
        msgBox.setText("Remove %i unused Clips from Project %s?" %
                       (len(CLIPSTOREMOVE), proj.name()))
        msgBox.setDetailedText("Remove:\n %s" % (str(CLIPSTOREMOVE)))
        msgBox.setStandardButtons(QMessageBox.Ok | QMessageBox.Cancel)
        msgBox.setDefaultButton(QMessageBox.Ok)
        ret = msgBox.exec_()

        if ret == QMessageBox.Cancel:
            return
        elif ret == QMessageBox.Ok:
            BINS = []
            with proj.beginUndo('Remove Unused Clips'):
                # Delete the rest of the Clips
                for clip in CLIPSTOREMOVE:
                    BI = clip.binItem()
                    B = BI.parentBin()
                    BINS += [B]
                    B.removeItem(BI)
Exemplo n.º 55
0
 def check_dir_is_empty(self, dir_path):
     if len(os.listdir(dir_path)) > 0:
         msgBox = QMessageBox()
         msgBox.setWindowTitle("Directory not empty")
         msgBox.setText(
             "The selected directory is not empty.\n"
             "For a new Component you usually want a new directory.\n"
             "Do you want to use this directory anyway?")
         msgBox.setStandardButtons(QMessageBox.Yes)
         msgBox.addButton(QMessageBox.No)
         msgBox.setDefaultButton(QMessageBox.No)
         if msgBox.exec_() == QMessageBox.Yes:
             return True
         else:
             return False
     else:
         return True
Exemplo n.º 56
0
    def keyPressEvent(self, event):
        selectedMovie = self.currentItem()
        if not selectedMovie: return

        if event.key() == Qt.Key_Delete:
            movieObject = selectedMovie.movieObject

            msg = QMessageBox(self)
            msg.setIcon(QMessageBox.Warning)
            msg.setText("Do you Want to delete {}?".format(movieObject.name))
            msg.setWindowTitle("Delete Movie")
            msg.setStandardButtons(QMessageBox.Ok | QMessageBox.Cancel)
            msg.show()

            if msg.exec_() == QMessageBox.Ok:
                selectedMovie.movieObject.delete()

                self.takeItem(self.row(selectedMovie))
Exemplo n.º 57
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
Exemplo n.º 58
0
 def stop():
     #clear workspace
     msg = QMessageBox(self)
     msg.setWindowTitle("Console cleanup")
     msg.setText("Do you want to clean the console workspace?")
     msg.setStandardButtons(QMessageBox.No | QMessageBox.Yes)
     msg.setDefaultButton(QMessageBox.Yes)
     ret = msg.exec_()
     try:
         if ret == QMessageBox.Yes:
             self.kernel_manager.kernel.shell.magic('reset -sf')
             kernel_client.stop_channels()
             kernel_manager.shutdown_kernel()
     except:
         print("Error cleaning console variables")
         kernel_client.stop_channels()
         kernel_manager.shutdown_kernel()
     # close widget instead of quitting application
     self.close()
Exemplo n.º 59
0
 def loginAction(self):
     self.result = [self.input1.text(), self.input2.text()]
     users = []
     infile = open(".\\users.cfg", "rb")
     while True:
         try:
             user = pickle.load(infile)
             users.append(user)
         except (EOFError, UnpicklingError):
             break
     infile.close()
     for user in users:
         if user.username == self.result[0] and user.password == self.result[1]:
             self.setUser(user)
             self.accept()
             return
     message = QMessageBox()
     message.setText("Username or password is incorrect")
     message.exec_()