示例#1
0
def qMsgBoxQuestion(parentWidg, titleMsgBx, messageMsgBx, buttonFlagsMsgBxm = QMessageBox.Yes | QMessageBox.No, defaultBtnMsgBx = QMessageBox.No):
    qmsgParent = None
    if(parentWidg is not None):
        qmsgParent = parentWidg
    reply = defaultBtnMsgBx
    try:
        reply = QMessageBox.question(qmsgParent, titleMsgBx, messageMsgBx, buttonFlagsMsgBxm, defaultBtnMsgBx)
    except:
        parentScreen = QtGui.QApplication.desktop().screen(QtGui.QApplication.desktop().primaryScreen())
        qmsgParent = QtGui.QMainWindow(parentScreen)
        reply = QMessageBox.question(qmsgParent, titleMsgBx, messageMsgBx, buttonFlagsMsgBxm, defaultBtnMsgBx)
    return reply
示例#2
0
    def updateRestShape(self):
        sel = cmds.ls(sl=True)
        if not sel:
            QMessageBox.warning(self.window, "Nothing Selected",
                                "Nothing Selected")
            return
        sel = sel[0]
        mesh = self.system.DCC.mesh

        # TODO, Check vert number and blendshape input connections
        selVerts = cmds.polyEvaluate(sel, vertex=1)
        meshVerts = cmds.polyEvaluate(mesh, vertex=1)

        if selVerts != meshVerts:
            msg = "Selected object {0} has {1} verts\nBase Object has {2} verts".format(
                sel, selVerts, meshVerts)
            QMessageBox.warning(self.window, "Vert Mismatch", msg)
            return

        # TODO Check for live connections
        bs = self.system.DCC.shapeNode
        cnx = cmds.listConnections(bs, plugs=1, destination=0, type='mesh')
        if cnx:
            cnxs = ', '.join([i.split('.')[0] for i in cnx])
            cnxs = textwrap.fill(cnxs)
            msg = "Some shapes have a live input connection:\n{0}\n\nThese shapes will not get the update.\nContinue anyway?".format(
                cnxs)
            btns = QMessageBox.Ok | QMessageBox.Cancel
            bret = QMessageBox.question(self.window, "Live Connections", msg,
                                        btns)
            if not bret & QMessageBox.Ok:
                return

        updateRestShape(mesh, sel)
示例#3
0
 def clear_table(self):
     are_you_sure = QMessageBox.question(
         None,
         "Clear table?",
         "Are you sure you want to clear the data table?",
     )
     if are_you_sure != QMessageBox.Yes:
         return
     self.table.setRowCount(0)
示例#4
0
def show_question(parent, title, question):
    """
    Show a question QMessageBox with the given question text
    :param question: str
    :return:
    """

    flags = QMessageBox.StandardButton.Yes | QMessageBox.StandardButton.No
    return QMessageBox.question(parent, title, question, flags)
示例#5
0
文件: pyxpad.py 项目: ZedThree/pyxpad
    def closeEvent(self, event):
        """
        Called when the main window is closed
        """
        reply = QMessageBox.question(self, 'Message',
                                           "Are you sure to quit?", QMessageBox.Yes |
                                           QMessageBox.No, QMessageBox.Yes)

        if reply == QMessageBox.Yes:
            event.accept()
        else:
            event.ignore()
示例#6
0
    def onExit(self):
        if self.isModified():
            button = QMessageBox.question(
                self,
                self.windowTitle(),
                self.tr(
                    "You have unsaved changes. Do you want to exit anyway?"),
            )
            if button != QMessageBox.Yes:
                return

        self.close()
示例#7
0
def showWindow():
	# Get Maya Window for parenting
	maya = gui.getMayaWindow()

	guides = actions.findGuides()
	if guides:
		guide = guides[0]
	else:
		if not QMessageBox.question(maya, "Brigks", "No Guide in the scene, do you wante to create a new one?"):
			return 
		guide = Guide()

	window = MainWindow(guide, maya)
	window.show()
示例#8
0
    def onFileNew(self):
        if self.isModified():
            button = QMessageBox.question(
                self,
                self.windowTitle(),
                self.
                tr("You have unsaved changes. Do you want to create a new document anyway?"
                   ),
            )
            if button != QMessageBox.Yes:
                return

        self.m_filePath = ""
        self.editor.setPlainText(self.tr("## New document"))
        self.editor.document().setModified(False)
示例#9
0
    def show_confirm_dialog(self, msg, title='Title'):
        """
        Shows a yes/no confirmation dialog
        :param msg: str, message to show with the dialog
        :param title: str, title of the dialog
        :return: bool, Whether the user has pressed yes(True) or No(False)
        """

        dialog = QMessageBox()
        dialog.setIcon(QMessageBox.Question)
        result = dialog.question(self.parent_window, title, msg,
                                 QMessageBox.Yes, QMessageBox.No)
        if result == QMessageBox.Yes:
            return True
        return False
示例#10
0
    def remove_job(self, job):
        if isinstance(job, LocalJob):
            self.tree.takeTopLevelItem(
                self.session.seqcrow_job_manager.jobs.index(job))
            self.session.seqcrow_job_manager.remove_local_job(job)
            if hasattr(job, "scratch_dir") and os.path.exists(job.scratch_dir):
                yes = QMessageBox.question(
                    self.tool_window.ui_area,
                    "Remove local files?",
                    "%s has been removed from the queue.\n" % (job.name) + \
                    "Would you also like to move '%s' to the trash bin?" % job.scratch_dir,
                    QMessageBox.Yes | QMessageBox.No
                )

                if yes == QMessageBox.Yes:
                    send2trash(job.scratch_dir)
示例#11
0
文件: pyxpad.py 项目: ZedThree/pyxpad
    def closeEvent(self, event):
        """
        Called when the main window is closed
        """
        reply = QMessageBox.question(
            self,
            "Message",
            "Are you sure to quit?",
            QMessageBox.Yes | QMessageBox.No,
            QMessageBox.Yes,
        )

        if reply == QMessageBox.Yes:
            event.accept()
        else:
            event.ignore()
示例#12
0
    def show_ask_if_running(self, job):
        if isinstance(job, LocalJob):
            yes = QMessageBox.question(self.tool_window.ui_area, \
                                       "Job status unknown", \
                                       "%s was running the last time ChimeraX was closed.\n" % (str(job)) + \
                                       "If the job is still running, it might compete with other jobs for you computer's resources, " + \
                                       "which could cause any running job to error out.\n\n" + \
                                       "Has this job finished running?", \
                                       QMessageBox.Yes | QMessageBox.No)

            if yes == QMessageBox.Yes:
                self.session.seqcrow_job_manager.unknown_status_jobs.remove(
                    job)
                job.isRunning = lambda *args, **kwargs: False
                job.isFinished = lambda *args, **kwargs: True

                self.session.seqcrow_job_manager.triggers.activate_trigger(
                    JOB_FINISHED, job)
示例#13
0
def confirm_dialog(title,
                   message,
                   button=None,
                   cancel_button=None,
                   default_button=None,
                   dismiss_string=None):
    """
    Shows DCC confirm dialog
    :param title:
    :param message:
    :param button:
    :param cancel_button:
    :param default_button:
    :param dismiss_string:
    :return:
    """

    return QMessageBox.question(dcc.get_main_window(), title, message)
示例#14
0
    def onFileOpen(self):
        if self.isModified():
            button = QMessageBox.question(
                self,
                self.windowTitle(),
                self.
                tr("You have unsaved changes. Do you want to open a new document anyway?"
                   ),
            )
            if button != QMessageBox.Yes:
                return

        path, _ = QFileDialog.getOpenFileName(self,
                                              self.tr("Open MarkDown File"),
                                              "",
                                              self.tr("MarkDown File (*.md)"))
        if not path:
            return

        self.openFile(path)