Пример #1
0
 def getMsgBox(self, text, nRoom):
     msgBox = QMessageBox()
     msgBox.setWindowTitle("Room: " + str(nRoom))
     msgBox.setText(text)
     msgBox.addButton(QMessageBox.Ok)
     msgBox.show()
     msgBox.exec_()
Пример #2
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_()
def main():
    app = QApplication(sys.argv)
    # check if the target in supported
    try:
        platform = sys.argv[1]
        PLATFORMS[platform.replace('.', '_')]()
    except KeyError:
        warn_box = QMessageBox()
        warn_box.setIcon(QMessageBox.Information)
        warn_box.setText("Unknown platform: {}".format(platform))
        warn_box.exec_()
        return 1
    except IndexError:
        print("You must specify the target in the command line")
    except NotImplementedError as exc:
        install_it, = exc.args
        if query_user(platform):
            install_it()
        else:
            warn_box = QMessageBox()
            warn_box.setIcon(QMessageBox.Information)
            warn_box.setText(
                "You can install the platform later by typing:\n" +
                str(install_it.__doc__))
            warn_box.exec_()

    else:
        print("Platform {} is installed".format(platform))
        sys.exit(0)
Пример #4
0
    def showContextMenu(self, pos):
        """
        Shows a context menu to add a node in the graph widget
        """
        gpos = self.graphicsView.mapToGlobal(pos)
        menu = QMenu()
        actionAddNode = menu.addAction("Add Node")
        QAction = menu.exec_(gpos)

        if (actionAddNode == QAction):
            (text,
             ok) = QInputDialog.getText(self.graphicsView, "Insert Node Name",
                                        "Please insert a name for the node")
            if ok:
                if text not in self.nodesToQNodes:
                    #User clicked on ok. Otherwise do nothing
                    self.gv.add_node(text)
                    node = self.gv.get_node(text)
                    qnode = self.createQtNode(node, 0, 0,
                                              QColor(204, 255, 255))

                    self.graphicsView.scene().addItem(qnode)
                    qnode.setPos(self.graphicsView.mapToScene(gpos))
                    qnode.setPos(qnode.x(), qnode.y() - 200)
                    self.nodesToQNodes[node] = qnode
                else:
                    msg = QMessageBox()
                    msg.setText("The node already exists.")
                    msg.exec_()
                self.searchNode(text)
Пример #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
Пример #6
0
 def displayError(self, message, details=None):
     msgBox = QMessageBox()
     msgBox.setText(message)
     msgBox.setIcon(QMessageBox.Critical)
     if details != None:
         msgBox.setDetailedText(details)
     msgBox.exec_()
Пример #7
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_()
Пример #8
0
    def onSearch(self):

        try:
            limit = int(self.tleLimit.text().strip())
        except ValueError:
            msgBox = QMessageBox()
            msgBox.setWindowTitle('Invalid upper limit')
            msgBox.setText('Please enter a valid upper limit')
            msgBox.setIcon(QMessageBox.Warning)
            msgBox.exec_()
            return

        if limit < self.LOWER_LIMIT:
            msgBox = QMessageBox()
            msgBox.setWindowTitle('Invalid upper limit')
            msgBox.setText('Please enter a valid upper limit')
            msgBox.setIcon(QMessageBox.Warning)
            msgBox.exec_()
            return

        if self.rbAKS.isChecked():
            algorithm = aks
        elif self.rbMR.isChecked():
            algorithm = millerRabbin

        self.search(algorithm, limit - 1)
Пример #9
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()
Пример #10
0
 def showStatusPopup(self):
     msgBox = QMessageBox(
         self.status.boxIcon,
         "System status",
         '<span style="color: white;">' + self.status.message + '</span>'
     )
     msgBox.exec_()
Пример #11
0
 def show_error(self, error):
     err = QMessageBox()
     err.setWindowTitle("Join error")
     err.setText(error)
     err.setIcon(QMessageBox.Critical)
     err.setModal(True)
     err.exec_()
Пример #12
0
    def askWhichAction(self):
        """
        Ask the user what to do if no chunk worked:
         - Try again
         - Re-test the current last working chunk
         - Cancel

        :return: An integer value indicating the pressed button:
         - 0 if the user wants to try again
         - 1 if the user wants to re-test
         - 2 if the user wants to cancel
        """

        messageBox = QMessageBox()
        messageBox.setWindowTitle(Strings.searcherTabAskActionMessageBoxTitle)
        messageBox.setText(Strings.searcherTabAskActionMessageBoxText)

        tryAgainButton = messageBox.addButton(
            Strings.searcherTabAskActionMessageBoxButtonTryAgainText,
            QMessageBox.RejectRole)
        reTestButton = messageBox.addButton(
            Strings.searcherTabAskActionMessageBoxButtonReTestText,
            QMessageBox.NoRole)
        cancelButton = messageBox.addButton(
            Strings.searcherTabAskActionMessageBoxButtonCancelText,
            QMessageBox.YesRole)
        messageBox.exec_()

        if messageBox.clickedButton() == tryAgainButton:
            return 0
        elif messageBox.clickedButton() == reTestButton:
            return 1
        elif messageBox.clickedButton() == cancelButton:
            return 2
Пример #13
0
    def __init__(self, emoji=None):
        """
        This class allows you to add() video files and convert them to gifs.
        Output files are going to be in the same folder as the input files.
        """
        super(Handbrake, self).__init__()
        self.tp = TasksPool()
        self.tp.return_signal.connect(lambda x: self.return_signal.emit(x))

        # If we supply Emoji object, then
        if isinstance(emoji, Emoji):
            video_file = abspath(join(emoji.folder, emoji.name + Config()()['name_delimiter'] + emoji.version + '.mov'))
            if not exists(video_file):
                video_file = abspath(join(emoji.folder, emoji.name + '-' + emoji.version + '.mov'))
            if exists(video_file):
                self.add(video_file)
                self.run()
            else:
                error_msg = 'Failed to locate {}, based on {}.'.format(video_file, emoji.name_no_ext)
                self.return_signal.emit(__name__ + error_msg)
                logger.warning(error_msg)
                error_box = QMessageBox()
                error_box.setStyleSheet(stylesheet.houdini)
                error_box.setWindowTitle('Handbrake mov to mp4 conversion: File error')
                error_box.setText(error_msg)
                error_box.exec_()
        elif isinstance(emoji, str):
            video_file = emoji
            if exists(video_file):
                self.add(video_file)
                self.run()
Пример #14
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_()
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_()
Пример #16
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
Пример #17
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
    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_()
Пример #19
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)
Пример #20
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 processCancelled(self):
        self.active = False

        msg = QMessageBox()
        msg.setWindowTitle('Error')
        msg.setText('The Encryption Process Has Been Successfully Cancelled')
        msg.exec_()
Пример #22
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_()
Пример #23
0
def log(txt):
    if DEBUG_MSGBOX:
        from PySide.QtGui import QMessageBox
        msgBox = QMessageBox()
        msgBox.setText(txt)
        msgBox.exec_()
    else:
        print txt
Пример #24
0
    def check_if_folder_exists(self):

        if not os.path.isdir(self.save_folder_editline.text()):
            msgBox = QMessageBox(icon=QMessageBox.Warning,
                                 text=ERROR_NO_DIR_MESSAGE)
            msgBox.setWindowTitle(ERROR_NO_DIR_TITLE)
            msgBox.exec_()
            self.save_folder_editline.setText(self.parent.default_save_folder)
Пример #25
0
    def choose_color(self):
        color = QColorDialog().getColor()

        if color.isValid():
            self.button.setStyleSheet(u'background-color:' + color.name())
        else:
            msgbox = QMessageBox()
            msgbox.setWindowTitle(u'No Color was Selected')
            msgbox.exec_()
Пример #26
0
 def choose_color(self):
   color  = QColorDialog().getColor()
   
   if color.isValid():
       self.button.setStyleSheet(u'background-color:' + color.name())
   else:
       msgbox = QMessageBox()
       msgbox.setWindowTitle(u'No Color was Selected')
       msgbox.exec_()
Пример #27
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_()
Пример #28
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_()
Пример #29
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_()
Пример #30
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_()
Пример #31
0
    def check_if_digit(self):

        try:
            int(self.interval_time_lineedit.text())
        except:
            msgBox = QMessageBox(icon=QMessageBox.Warning,
                                 text=ERROR_NO_INT_MESSAGE)
            msgBox.setWindowTitle(ERROR_NO_INT_TITLE)
            msgBox.exec_()
            self.interval_time_lineedit.setText(str(self.parent.interval_time))
Пример #32
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.deleteLater()
Пример #33
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()
Пример #34
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_()
Пример #35
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_()
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
Пример #37
0
def choose_color():
    color = QColorDialog().getColor()

    msgbox = QMessageBox()
    if color.isValid():
        pixmap = QPixmap(50, 50)
        pixmap.fill(color)
        msgbox.setWindowTitle(u'Selected Color')
        msgbox.setIconPixmap(pixmap)
    else:
        msgbox.setWindowTitle(u'No Color was Selected')
    msgbox.exec_()
Пример #38
0
def choose_color():
    color  = QColorDialog().getColor()
    
    msgbox = QMessageBox()
    if color.isValid():
        pixmap = QPixmap(50, 50)
        pixmap.fill(color)
        msgbox.setWindowTitle(u'Selected Color')
        msgbox.setIconPixmap(pixmap)
    else:
        msgbox.setWindowTitle(u'No Color was Selected')
    msgbox.exec_()
Пример #39
0
 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_()
Пример #40
0
 def event_about(self):
     msgBox = QMessageBox()
     msgBox.setWindowTitle(APP_NAME)
     msgBox.setWindowIcon(QIcon(APP_ICON))
     msgBox.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)
     msgBox.setText(
             '''
             \n%s %s programmed by Snir Turgeman\nIf you found some bugs, please report to [email protected]
             \nEnjoy!\n
             ''' % (APP_NAME, APP_VERSION)
     )
     msgBox.exec_()
Пример #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)
Пример #42
0
 def showReportDialog(self):
     """Shows a dialog that lets the user generate a report."""
     d = DialogCreateReport(self._db, self)
     ret = d.exec_()
     if ret == DialogCreateReport.Accepted:
         cons = d.getSelectedConnections()
         if len(cons) > 0:
             self.generateReport(cons)
         else:
             msg = QMessageBox()
             msg.setText(self.tr("No connections selected"))
             msg.setIcon(QMessageBox.Critical)
             msg.exec_()
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_()
    def reset(self, fp):
        self.active = False

        # create and show message box detailing the location of the decrypted file
        msg = QMessageBox()
        msg.setWindowTitle('Decryption Complete')
        msg.setText('<b>The decrypted file is saved to the location:</b> <i>'+fp+'</i>')
        msg.exec_()

        # create the choose mode screen and show
        global choose_mode_screen
        choose_mode_screen = ChooseMode()
        choose_mode_screen.show()
        self.close()
 def doImport(self):
     index = self.getCurrentRowValue(
         Constant.CONST_COLUMN_IMPORT_MOVEMENT_HIDDEN_ID)
     if (index is not None):
         operation = self.imLO.movementList[int(index)]
         print(operation.externalID)
         newID = None
         taxNewID = None
         if (isinstance(operation, Movement)):
             rs = DaoMovement.getMovementsByExternalID(operation.externalID)
             if len(rs) == 0:
                 if (operation.OID == "NEW"):
                     newID = DaoMovement.insertMovement(operation)
             if (operation.tax is not None and operation.tax.OID == "NEW"):
                 rs = DaoTax.getTaxByExternalID(operation.tax.externalID)
                 if len(rs) == 0:
                     taxNewID = DaoTax.insert(operation.tax)
         elif (isinstance(operation, CorporateEvent)):
             rs = DaoCorporateEvent.getCorporateEventByExternalID(
                 operation.externalID)
             if len(rs) == 0:
                 newID = DaoCorporateEvent.insert(operation)
                 print(newID)
                 if (operation.tax is not None):
                     rs = DaoTax.getTaxByExternalID(
                         operation.tax.externalID)
                     if len(rs) == 0:
                         operation.tax.originOID = newID
                         taxNewID = DaoTax.insert(operation.tax)
         elif (isinstance(operation, CashMovement)):
             rs = DaoCashMovement.getCashMovementsByExternalID(
                 operation.externalID)
             if len(rs) == 0:
                 newID = DaoCashMovement.insert(operation)
         box = QMessageBox()
         box.setWindowTitle('ADD')
         if (newID is None and taxNewID is None):
             box.setText("CANNOT ADD externalID " + operation.externalID)
         else:
             if (newID is not None and taxNewID is not None):
                 box.setText("INSERTED MOVEMENT " + operation.externalID +
                             " NEWID: " + str(newID) + " NEWTAXID: " +
                             str(taxNewID))
             elif (newID is not None and taxNewID is None):
                 box.setText("INSERTED MOVEMENT " + operation.externalID +
                             " NEWID: " + str(newID))
             else:
                 box.setText("INSERTED TAX " + operation.tax.externalID +
                             " NEWTAXID: " + str(taxNewID))
         box.exec_()
Пример #46
0
 def save(self):
     if not HAVE_PYVTK:
         msg = QMessageBox(QMessageBox.Critical, 'Error', 'VTK output disabled. Pleas install pyvtk.')
         msg.exec_()
         return
     filename = QFileDialog.getSaveFileName(self, 'Save as vtk file')[0]
     base_name = filename.split('.vtu')[0].split('.vtk')[0].split('.pvd')[0]
     if base_name:
         if len(self.U) == 1:
             write_vtk(self.grid, NumpyVectorArray(self.U[0], copy=False), base_name, codim=self.codim)
         else:
             for i, u in enumerate(self.U):
                 write_vtk(self.grid, NumpyVectorArray(u, copy=False), '{}-{}'.format(base_name, i),
                           codim=self.codim)
Пример #47
0
def Launch():
    """This function checks whether or not the user has selected one or more objects.

    It then calls the '_Launch_Main_Dialog' class.
    """
    if len(gui.Selection.getSelection()) > 0:
        __Launch_Main_Dialog()
    else:
        message = 'No FreeCAD objects have been selected for MultiCopy!'
        message_box = QMessageBox(
            QMessageBox.Critical, 'MultiCopy - Error Message', message
        )
        message_box.setWindowModality(QtCore.Qt.ApplicationModal)
        message_box.exec_()
Пример #48
0
def exception(parent, ex, buttons=QMessageBox.Ok,
              defaultButton=QMessageBox.NoButton):
    title = type(ex).__name__
    message = str(ex)
    tb = StringIO()
    if hasattr(ex, '__traceback__'):
        exc_traceback = ex.__traceback__
    else:
        exc_traceback = sys.exc_info()[2]
    traceback.print_tb(exc_traceback, file=tb)

    msgbox = QMessageBox(QMessageBox.Icon.Critical, title, message, buttons, parent)
    msgbox.setDefaultButton(defaultButton)
    msgbox.setDetailedText(tb.getvalue())
    msgbox.exec_()
    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()
    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()
Пример #51
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_()
Пример #52
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
Пример #53
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]))
Пример #54
0
    def change_auth(self):
        # If we already are authenticated, this click sets up to
        # remove authentication ---
        if self.app.provider.is_authenticated():
            print "everpad remove"

            # You really want to do this???? LOL
            # MKG - want to move to provider
            msgBox = QMessageBox(
                QMessageBox.Critical,
                self.tr("You are trying to remove authorisation"),
                self.tr("""
                Are you sure want to remove authoristion?
                It remove all not synced changes!
                """.strip()), QMessageBox.Yes | QMessageBox.No)
            ret = msgBox.exec_()

            #
            if ret == QMessageBox.Yes:
                # daemon.py
                self.app.provider.remove_authentication()
                self.update_tabs()

        # If not athenticated then authenticate ---
        else:
            #self.ui.tabWidget.hide()
            #self.ui.webView.show()
            self.app.provider.authenticate()

        #self.ui.webView.hide()
        self.ui.tabWidget.show()
        self.update_tabs()
Пример #55
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)
Пример #56
0
def choose_color():
    # Select color
    color = QColorDialog().getColor()

    # Report about result of selection in QMessageBox dialog
    msgbox = QMessageBox()
    if color.isValid():
        # Create a memory image 50x50 filled with selected color to display
        # as a icon in the msgbox dialog
        pixmap = QPixmap(50, 50)
        pixmap.fill(color)
        msgbox.setWindowTitle(u'Selected Color')
        msgbox.setIconPixmap(pixmap)
    else:
        msgbox.setWindowTitle(u'No Color was Selected')
    msgbox.exec_()
Пример #57
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