def _getProjectOpenOptions(parent=None): l = FnAssetAPI.l if parent is None: parent = hiero.ui.mainWindow() msgBox = QtGui.QMessageBox(parent=parent) msgBox.setText(l("{published} Projects can't be opened directly.")) msgBox.setInformativeText( "This is to avoid changing the asset itself by " + "saving. Would you like to Save a Copy or open read-only?") saveAs = msgBox.addButton("Save As...", msgBox.AcceptRole) readOnly = msgBox.addButton("Read Only", msgBox.NoRole) # Had some issues with StandardButton .vs. AbstractButton msgBox.addButton("Cancel", msgBox.RejectRole) msgBox.exec_() button = msgBox.clickedButton() if button == saveAs: return 'saveas' elif button == readOnly: return 'readonly' else: return ''
def _noItemsOptionsPrompt(self): l = FnAssetAPI.l msgBox = QtGui.QMessageBox() msgBox.setText( l("No matching {assets} were found to build the track from.")) msgBox.setInformativeText( l("Do you wish to keep the empty track (%s) " + "anyway? It can be refreshed later as {published} {assets} become " + "available.") % self.__trackName) msgBox.setStandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No) return msgBox.exec_() == QtGui.QMessageBox.Yes
def _getExistingItemOverlapOptions(self, track, overlapping): count = len(overlapping) allOverlapping = [] for items in overlapping.values(): allOverlapping.extend(items) allOverlapping = [i.name() for i in allOverlapping] msgBox = QtGui.QMessageBox() msgBox.setText("TrackItems overlap.") msgBox.setInformativeText( ("%d of your chosen Shots are overlapped by " + "existing items on the target track '%s'.") % (count, track.name())) msgBox.setDetailedText( "The following Shots overlap your chosen shots:\n%s" % ", ".join(allOverlapping)) replace = msgBox.addButton("Replace", msgBox.AcceptRole) cancel = msgBox.addButton("Cancel", msgBox.RejectRole) msgBox.addButton("Skip", msgBox.NoRole) msgBox.exec_() button = msgBox.clickedButton() if button == cancel: return False elif button == replace: self.__replaceOverlapping = True else: self.__replaceOverlapping = False return True