本文整理汇总了Python中KdeQt.KQMessageBox.question方法的典型用法代码示例。如果您正苦于以下问题:Python KQMessageBox.question方法的具体用法?Python KQMessageBox.question怎么用?Python KQMessageBox.question使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KdeQt.KQMessageBox
的用法示例。
在下文中一共展示了KQMessageBox.question方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: on_removeButton_clicked
# 需要导入模块: from KdeQt import KQMessageBox [as 别名]
# 或者: from KdeQt.KQMessageBox import question [as 别名]
def on_removeButton_clicked(self):
"""
Private slot to remove a custom toolbar
"""
name = self.toolbarComboBox.currentText()
res = KQMessageBox.question(self,
self.trUtf8("Remove Toolbar"),
self.trUtf8("""Should the toolbar <b>%1</b> really be removed?""")\
.arg(name),
QMessageBox.StandardButtons(\
QMessageBox.No | \
QMessageBox.Yes),
QMessageBox.No)
if res == QMessageBox.Yes:
index = self.toolbarComboBox.currentIndex()
tbItemID = self.toolbarComboBox.itemData(index).toULongLong()[0]
tbItem = self.__toolbarItems[tbItemID]
if tbItem.toolBarId is not None and \
tbItem.toolBarId not in self.__removedToolBarIDs:
self.__removedToolBarIDs.append(tbItem.toolBarId)
del self.__toolbarItems[tbItemID]
for widgetActionID in self.__toolBarItemToWidgetActionID[tbItemID]:
self.__widgetActionToToolBarItemID[widgetActionID] = None
del self.__toolBarItemToWidgetActionID[tbItemID]
self.toolbarComboBox.removeItem(index)
示例2: createRequest
# 需要导入模块: from KdeQt import KQMessageBox [as 别名]
# 或者: from KdeQt.KQMessageBox import question [as 别名]
def createRequest(self, op, request, outgoingData = None):
"""
Protected method to create a request.
@param op the operation to be performed (QNetworkAccessManager.Operation)
@param request reference to the request object (QNetworkRequest)
@param outgoingData reference to an IODevice containing data to be sent
(QIODevice)
@return reference to the created reply object (QNetworkReply)
"""
if op != QNetworkAccessManager.GetOperation:
return None
if request.url().path() != "subscribe":
return None
subscription = AdBlockSubscription(request.url(),
Helpviewer.HelpWindow.HelpWindow.adblockManager())
res = KQMessageBox.question(None,
self.trUtf8("Subscribe?"),
self.trUtf8("""<p>Subscribe to this AdBlock subscription?</p><p>%1</p>""")\
.arg(subscription.title()),
QMessageBox.StandardButtons(\
QMessageBox.No | \
QMessageBox.Yes))
if res == QMessageBox.Yes:
Helpviewer.HelpWindow.HelpWindow.adblockManager()\
.addSubscription(subscription)
dlg = Helpviewer.HelpWindow.HelpWindow.adblockManager().showDialog()
model = dlg.model()
dlg.setCurrentIndex(model.index(model.rowCount() - 1, 0))
dlg.setFocus()
return EmptyNetworkReply(self.parent())
示例3: __getFileName
# 需要导入模块: from KdeQt import KQMessageBox [as 别名]
# 或者: from KdeQt.KQMessageBox import question [as 别名]
def __getFileName(self):
"""
Private method to get the filename to save to from the user.
@return flag indicating success (boolean)
"""
downloadDirectory = Preferences.getUI("DownloadPath")
if downloadDirectory.isEmpty():
downloadDirectory = \
QDesktopServices.storageLocation(QDesktopServices.DocumentsLocation)
if not downloadDirectory.isEmpty():
downloadDirectory += '/'
defaultFileName = self.__saveFileName(downloadDirectory)
fileName = defaultFileName
baseName = QFileInfo(fileName).completeBaseName()
self.__autoOpen = False
if not self.__toDownload:
res = KQMessageBox.question(None,
self.trUtf8("Downloading"),
self.trUtf8("""<p>You are about to download the file <b>%1</b>.</p>"""
"""<p>What do you want to do?</p>""").arg(fileName),
QMessageBox.StandardButtons(\
QMessageBox.Open | \
QMessageBox.Save | \
QMessageBox.Cancel))
if res == QMessageBox.Cancel:
self.__stop()
self.close()
return False
self.__autoOpen = res == QMessageBox.Open
fileName = QDesktopServices.storageLocation(QDesktopServices.TempLocation) + \
'/' + QFileInfo(fileName).completeBaseName()
if not self.__autoOpen and self.__requestFilename:
fileName = KQFileDialog.getSaveFileName(\
None,
self.trUtf8("Save File"),
defaultFileName,
QString(),
None)
if fileName.isEmpty():
self.__reply.close()
if not self.keepOpenCheckBox.isChecked():
self.close()
return False
else:
self.filenameLabel.setText(self.trUtf8("Download canceled: %1")\
.arg(QFileInfo(defaultFileName).fileName()))
self.__stop()
return True
self.__output.setFileName(fileName)
self.filenameLabel.setText(QFileInfo(self.__output.fileName()).fileName())
if self.__requestFilename:
self.__readyRead()
return True
示例4: __clearHistoryDialog
# 需要导入模块: from KdeQt import KQMessageBox [as 别名]
# 或者: from KdeQt.KQMessageBox import question [as 别名]
def __clearHistoryDialog(self):
"""
Private slot to clear the history.
"""
if self.__historyManager is not None and \
KQMessageBox.question(None,
self.trUtf8("Clear History"),
self.trUtf8("""Do you want to clear the history?"""),
QMessageBox.StandardButtons(\
QMessageBox.No | \
QMessageBox.Yes),
QMessageBox.No) == QMessageBox.Yes:
self.__historyManager.clear()
示例5: keyPressEvent
# 需要导入模块: from KdeQt import KQMessageBox [as 别名]
# 或者: from KdeQt.KQMessageBox import question [as 别名]
def keyPressEvent(self, ev):
"""
Re-implemented to handle the user pressing the escape key.
@param ev key event (QKeyEvent)
"""
if ev.key() == Qt.Key_Escape:
res = KQMessageBox.question(self,
self.trUtf8("Close dialog"),
self.trUtf8("""Do you really want to close the dialog?"""),
QMessageBox.StandardButtons(\
QMessageBox.No | \
QMessageBox.Yes),
QMessageBox.No)
if res == QMessageBox.Yes:
self.reject()
示例6: on_passwordsButton_clicked
# 需要导入模块: from KdeQt import KQMessageBox [as 别名]
# 或者: from KdeQt.KQMessageBox import question [as 别名]
def on_passwordsButton_clicked(self):
"""
Private slot to switch the password display mode.
"""
if self.__passwordModel.showPasswords():
self.__passwordModel.setShowPasswords(False)
self.passwordsButton.setText(self.__showPasswordsText)
else:
res = KQMessageBox.question(self,
self.trUtf8("Saved Passwords"),
self.trUtf8("""Do you really want to show passwords?"""),
QMessageBox.StandardButtons(\
QMessageBox.No | \
QMessageBox.Yes),
QMessageBox.No)
if res == QMessageBox.Yes:
self.__passwordModel.setShowPasswords(True)
self.passwordsButton.setText(self.__hidePasswordsText)
self.__calculateHeaderSizes()
示例7: on_removeButton_clicked
# 需要导入模块: from KdeQt import KQMessageBox [as 别名]
# 或者: from KdeQt.KQMessageBox import question [as 别名]
def on_removeButton_clicked(self):
"""
Private slot to remove a document from the help database.
"""
res = KQMessageBox.question(None,
self.trUtf8("Remove Documentation"),
self.trUtf8("""Do you really want to remove the selected documentation """
"""sets from the database?"""),
QMessageBox.StandardButtons(\
QMessageBox.No | \
QMessageBox.Yes),
QMessageBox.No)
if res == QMessageBox.No:
return
openedDocs = self.__mw.getSourceFileList()
items = self.documentsList.selectedItems()
for item in items:
ns = item.text()
if ns in openedDocs.values():
res = KQMessageBox.information(self,
self.trUtf8("Remove Documentation"),
self.trUtf8("""Some documents currently opened reference the """
"""documentation you are attempting to remove. """
"""Removing the documentation will close those """
"""documents."""),
QMessageBox.StandardButtons(\
QMessageBox.Cancel | \
QMessageBox.Ok))
if res == QMessageBox.Cancel:
return
self.__unregisteredDocs.append(ns)
for id in openedDocs:
if openedDocs[id] == ns and id not in self.__tabsToClose:
self.__tabsToClose.append(id)
itm = self.documentsList.takeItem(self.documentsList.row(item))
del itm
self.__engine.unregisterDocumentation(ns)
if self.documentsList.count():
self.documentsList.setCurrentRow(0, QItemSelectionModel.ClearAndSelect)
示例8: __remove
# 需要导入模块: from KdeQt import KQMessageBox [as 别名]
# 或者: from KdeQt.KQMessageBox import question [as 别名]
def __remove(self):
"""
Private slot to handle the Remove context menu action.
"""
itm = self.currentItem()
res = KQMessageBox.question(self,
self.trUtf8("Remove Template"),
self.trUtf8("""<p>Do you really want to remove <b>%1</b>?</p>""")\
.arg(itm.getName()),
QMessageBox.StandardButtons(\
QMessageBox.No | \
QMessageBox.Yes),
QMessageBox.No)
if res != QMessageBox.Yes:
return
if isinstance(itm, TemplateGroup):
self.removeGroup(itm)
else:
self.removeEntry(itm)
示例9: editPaste
# 需要导入模块: from KdeQt import KQMessageBox [as 别名]
# 或者: from KdeQt.KQMessageBox import question [as 别名]
def editPaste(self, pasting = False):
"""
Public slot to paste an image from the clipboard.
@param pasting flag indicating part two of the paste operation (boolean)
"""
img, ok = self.__clipboardImage()
if ok:
if img.width() > self.__image.width() or img.height() > self.__image.height():
res = KQMessageBox.question(self,
self.trUtf8("Paste"),
self.trUtf8("""<p>The clipboard image is larger than the current """
"""image.<br/>Paste as new image?</p>"""),
QMessageBox.StandardButtons(\
QMessageBox.No | \
QMessageBox.Yes),
QMessageBox.No)
if res == QMessageBox.Yes:
self.editPasteAsNew()
return
elif not pasting:
self.__isPasting = True
self.__clipboardSize = img.size()
else:
cmd = IconEditCommand(self, self.trUtf8("Paste Clipboard"), self.__image)
self.__markImage.fill(self.NoMarkColor.rgba())
for sx in range(self.__pasteRect.width() + 1):
for sy in range(self.__pasteRect.height() + 1):
dx = self.__pasteRect.x() + sx
dy = self.__pasteRect.y() + sy
if True: # TODO: insert code to test for compositing
# Porter-Duff Over composition
colorS = img.pixel(sx, sy)
colorD = self.__image.pixel(dx, dy)
alphaS = qAlpha(colorS) / 255.0
alphaD = qAlpha(colorD) / 255.0
r = qRed(colorS) * alphaS + \
(1 - alphaS) * qRed(colorD) * alphaD
g = qGreen(colorS) * alphaS + \
(1 - alphaS) * qGreen(colorD) * alphaD
b = qBlue(colorS) * alphaS + \
(1 - alphaS) * qBlue(colorD) * alphaD
a = alphaS + \
(1 - alphaS) * alphaD
# Remove multiplication by alpha
if a > 0:
r /= a
g /= a
b /= a
else:
r = 0
g = 0
b = 0
ir = int(r + 0.5)
if ir < 0:
ir = 0
elif ir > 255:
ir = 255
ig = int(g + 0.5)
if ig < 0:
ig = 0
elif ig > 255:
ig = 255
ib = int(b + 0.5)
if ib < 0:
ib = 0
elif ib > 255:
ib = 255
ia = int(a * 255 + 0.5)
if ia < 0:
ia = 0
elif ia > 255:
ia = 255
self.__image.setPixel(dx, dy, qRgba(ir, ig, ib, ia))
else:
self.__image.setPixel(dx, dy, img.pixel(sx, sy))
self.__undoStack.push(cmd)
cmd.setAfterImage(self.__image)
self.__updateImageRect(self.__pasteRect.topLeft(),
self.__pasteRect.bottomRight() + QPoint(1, 1))
else:
KQMessageBox.warning(self,
self.trUtf8("Pasting Image"),
self.trUtf8("""Invalid image data in clipboard."""))