Example #1
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_()
    def processCancelled(self):
        self.active = False

        msg = QMessageBox()
        msg.setWindowTitle('Error')
        msg.setText('The Encryption Process Has Been Successfully Cancelled')
        msg.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]))
Example #4
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()
    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_()
Example #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
Example #7
0
 def show_error(self, error):
     err = QMessageBox()
     err.setWindowTitle("Join error")
     err.setText(error)
     err.setIcon(QMessageBox.Critical)
     err.setModal(True)
     err.exec_()
Example #8
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_()
Example #9
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
Example #10
0
def confirmationBox(text,info_text,object_name="confirmationBox"):
    """ Show a confirmation box to the user.

    :param text: Summary of the confirmation.
    :param info_text: Detailed message explaining what to confirm
    :param object_name: Name for Qt's object.
    :return: True if the user confirmed. False else.
    """

    box = QMessageBox()
    box.setObjectName(object_name)
    box.setWindowTitle(_("Please confirm"))
    box.setIcon(QMessageBox.Question)
    _setBoxTexts(box,text,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
 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)
Example #12
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)
Example #13
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
Example #14
0
 def getMsgBox(self, text, nRoom):
     msgBox = QMessageBox()
     msgBox.setWindowTitle("Room: " + str(nRoom))
     msgBox.setText(text)
     msgBox.addButton(QMessageBox.Ok)
     msgBox.show()
     msgBox.exec_()
Example #15
0
def error_message(text):
    errorbox = QMessageBox()
    errorbox.setWindowIcon(QPixmap("../icons/desuratools_256.png"))
    errorbox.setWindowTitle("Error")
    errorbox.setText(text)
    errorbox.setIcon(QMessageBox.Critical)
    return errorbox
Example #16
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]))
Example #17
0
 def finished_start(self):
     self.save_settings()
     self.start_button.setText("Start")
     self.setEnabled(True)
     self.setStatusTip("Ready")
     if self.working_thread.mbox:
         data = self.working_thread.mbox
         mbox = QMessageBox(self)
         mbox.setWindowTitle(data[0])
         mbox.setIcon(data[1])
         mbox.setWindowIcon(data[2])
         mbox.setText(data[3])
         if data[4]:
             mbox.setDetailedText(data[4])
         mbox.exec()
     # TODO: NEED TO FIX!
     if self.working_thread.updates:
         d = TableDialog(self.working_thread.updates, self.working_thread.streetdb)
         d.exec()
     else:
         mbox = QMessageBox(self)
         mbox.setWindowTitle("Done!")
         if self.working_thread.updates:
             mbox.setText("Program is done! {} updated!" .format(len(self.working_thread.updates)))
         else:
             mbox.setText("Program is done! Everything was up to date!")
         mbox.setIcon(QMessageBox.Information)
         mbox.exec()
Example #18
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()
Example #19
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_()
    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)
Example #21
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
Example #22
0
def yesNoBox(text,info_text,object_name="confirmationBox"):
    warningBox = QMessageBox()
    warningBox.setObjectName(object_name)
    warningBox.setWindowTitle(_("Please confirm"))
    warningBox.setIcon(QMessageBox.Question)
    _setBoxTexts(warningBox,text,info_text)
    warningBox.setStandardButtons(QMessageBox.Yes | QMessageBox.No | QMessageBox.Cancel);
    return warningBox.exec_()
Example #23
0
def makeWarningBox(text,info_text,parent=None):
    warningBox = QMessageBox(parent)
    warningBox.setObjectName("warning_box")
    warningBox.setWindowTitle(_("Warning !"))
    warningBox.setIcon(QMessageBox.Warning)
    _setBoxTexts(warningBox,text,info_text)
    warningBox.setStandardButtons(QMessageBox.Ok);
    return warningBox
Example #24
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()
Example #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_()
    def help(self):
        msg = '''
Don't Panic!
'''
        mb = QMessageBox(self)
        mb.setText(msg.strip())
        mb.setIcon(QtGui.QMessageBox.Information)
        mb.setWindowTitle('About')
        mb.show()
    def about(self):
        msg = '''
About this thing
'''
        mb = QMessageBox(self)
        mb.setText(msg.strip())
        mb.setIcon(QtGui.QMessageBox.Information)
        mb.setWindowTitle('About')
        mb.show()
Example #28
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_()
Example #29
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_()
Example #30
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_()
Example #31
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_()
Example #32
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_()
Example #33
0
def user_choice(text, windowtitle, icon, acceptbutton="OK"):
    choice_dialog = QMessageBox()
    choice_dialog.setWindowIcon(QPixmap("../icons/desuratools_256.png"))
    choice_dialog.setText(text)
    choice_dialog.setIcon(icon)
    choice_dialog.setStandardButtons(QMessageBox.Cancel)
    choice_dialog.setWindowTitle(windowtitle)
    choice_dialog.addButton(acceptbutton, QMessageBox.AcceptRole)
    return choice_dialog
Example #34
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_()
Example #35
0
 def onExit(self):
     msgBox = QMessageBox(self)
     msgBox.setIcon(QMessageBox.Question)
     msgBox.setWindowTitle(_translate("MainWindow", "Pythonthusiast", None));
     msgBox.setText(_translate("MainWindow", "Are you sure you want to quit?", None))
     msgBox.setStandardButtons(QMessageBox.No|QMessageBox.Yes)
     msgBox.setDefaultButton(QMessageBox.Yes)
     msgBox.exec_
     if msgBox.exec_() == QMessageBox.Yes:
       QtGui.qApp.quit()
    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))
Example #37
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_()
Example #38
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_()
 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
Example #40
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
Example #41
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
Example #43
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
Example #44
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_()
Example #45
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_()
Example #46
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_()
Example #47
0
    def _Proccessor(self):
        """开始生成所需要要生成的
        三角形内容"""
        import basic.XMLConfig
        from core import plotTriangle
        if len(str(self.lineEdit_Number.text()))<1:
            msg = QMessageBox()
            msg.setText(QApplication.translate("Cannot get N", "N未输入", None, QApplication.UnicodeUTF8))
            msg.setWindowTitle(QApplication.translate("Error", "错误", None, QApplication.UnicodeUTF8))
            msg.show()
            
        else:
            MaxLen =  int(str(self.lineEdit_Number.text()))
            print MaxLen
            #首先判断选择
            rootPath = basic.XMLConfig.getRootPath()
       
            if rootPath[len(rootPath)-1] != '\\':
                rootPath = rootPath + '\\'
            print rootPath
            tr = plotTriangle.CreateGTNTriangel()
            tr._set_root_path(rootPath)
            if self.checkBox_triangular.isChecked() == True:
                """要对外生成堆垒三角了"""           
                print "----堆垒三角处理开始-----"  
                if self.checkBox_VLayout.isChecked() == True:
                    #要生成垂直三角                
                     for x in xrange(1,MaxLen):
                        tr.oneRow_with_Sum_verticalV3(' ',True,x,self._createFileName('GTN_VLayout',MaxLen))

                if self.checkBox_HLayout.isChecked() == True:
                    #要生成水平三角
                    for x in xrange(1,MaxLen):
                        tr.oneRow_with_Sum(x,self._createFileName('GTN_HLayout',MaxLen))                 
                print "----堆垒三角处理结束-----"  
            if self.checkBox_triangularNumber.isChecked() == True:
                #这边是列出内容的
                #列出方法是,水平优先,垂直优先,
                print "----堆垒三角值处理开始-----"  
                if self.checkBox_pascal.isChecked()==True:
                    #pascal 一一水平投影
                    tr._PascalTriangle_List(MaxLen,self._createFileName('P',MaxLen))

                if self.checkBox_evenSeq.isChecked()==True:
                    tr._Projection_EvenSeq(MaxLen,self._createFileName('E',MaxLen))

                    #垂直投影
                if self.checkBox_LongSeq.isChecked()==True:
                    tr._MetaLongSeq(MaxLen,self._createFileName('L',MaxLen))
                if self.checkBox_sortSeq.isChecked()==True:
                    tr._MetaShortSeq(MaxLen,self._createFileName('S',MaxLen))
                print "----堆垒三角值处理结束-----"  
Example #48
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()
    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 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()
Example #51
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_()
Example #52
0
    def accept(self):
        if self.userEdit.text() == "" or self.passwordEdit.text() == "":
            if self.userEdit.text() == "":
                self.userEdit.setFocus()
            else:
                self.passwordEdit.setFocus()

            # meldung ausgeben, dass das doof ist so
            err = QMessageBox()
            err.setWindowTitle(_("Please provide credentials"))
            err.setText(_("You need to enter a user name and a password!"))
            err.setIcon(QMessageBox.Critical)
            err.setModal(True)
            err.exec_()

        else:
            QCoreApplication.quit()
 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 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
Example #55
0
    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)
Example #56
0
 def check_db(self):
     try:
         self.cur.execute('''SELECT name FROM sqlite_master WHERE type='table' AND name="CLIPBOARD"''')
         table = self.cur.fetchall()
         if table.__len__() == 0:
             self.cur.execute('CREATE TABLE CLIPBOARD (ID INTEGER PRIMARY KEY ASC AUTOINCREMENT, DATE DATETIME, CONTENT VARCHAR)')
             self.cur.execute('CREATE TABLE PROPERTIES (NAME VARCHAR PRIMARY KEY, VALUE VARCHAR)')
             self.cur.execute('INSERT INTO PROPERTIES(NAME, VALUE) VALUES ("ALWAYS_ON_TOP", "Y")')
             self.cur.execute('INSERT INTO PROPERTIES(NAME, VALUE) VALUES ("BUFFER_SIZE", "200")')
             self.conn.commit()
     except lite.IntegrityError:
         print("Error occurd while trying to create CLIPBOARD table")
         msgBox = QMessageBox().about()
         msgBox.setWindowTitle(APP_NAME)
         msgBox.setWindowIcon(QIcon(APP_ICON))
         msgBox.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)
         msgBox.setText("Error occurd while trying to create CLIPBOARD table, Please report to developer")
         msgBox.exec_()