def check_editor_preferences():
    # get preference values of external app path
    photo_dir = cmds.optionVar(exists='PhotoshopDir')
    image_dir = cmds.optionVar(exists='EditImageDir')

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

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

            if app_path is not None:
                cmds.optionVar(sv=('PhotoshopDir', app_path[0]))
                cmds.optionVar(sv=('EditImageDir', app_path[0]))
Beispiel #2
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]))
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
 def __abortComputationBox(self):
     tit = self.tr("Aborting Batch Computation")
     txt = self.tr("Reduce is currently evaluating several groups in "
                   "batch. Do you want to interrupt only the current "
                   "computation or all?")
     diag = QMessageBox(self.model.controller.mainWindow)
     diag.setWindowTitle(tit)
     diag.setIcon(QMessageBox.Question)
     diag.setText(txt)
     abortAll = diag.addButton("Abort All",QMessageBox.YesRole)
     abortCurrent = diag.addButton("Abort Current",QMessageBox.YesRole)
     cancel = diag.addButton(QMessageBox.StandardButton.Cancel)
     diag.setDefaultButton(abortAll)
     diag.setEscapeButton(cancel)
     diag.setWindowModality(Qt.WindowModal)
     diag.exec_()
     ans = diag.clickedButton()
     if ans == abortAll:
         return 'all'
     elif ans == abortCurrent:
         return 'current'
     elif ans == cancel:
         return 'cancel'
     traceLogger.critical("unidentifiable button %s" % ans)