def run(self, path_to_ebook): from calibre.gui2 import is_ok_to_use_qt from PyQt4.Qt import QMessageBox PID = self.site_customization data_file = file(path_to_ebook, 'rb').read() ar = PID.split(',') for i in ar: try: unlocked_file = DrmStripper(data_file, i).getResult() except DrmException: # ignore the error pass else: of = self.temporary_file('.mobi') of.write(unlocked_file) of.close() return of.name if is_ok_to_use_qt(): d = QMessageBox( QMessageBox.Warning, "MobiDeDRM Plugin", "Couldn't decode: %s\n\nImporting encrypted version." % path_to_ebook) d.show() d.raise_() d.exec_() return path_to_ebook
def msgbox(hsgui, title, msg): # Make a non modal critical QMessageBox msgBox = QMessageBox( hsgui ); msgBox.setAttribute( Qt.WA_DeleteOnClose ) msgBox.setStandardButtons( QMessageBox.Ok ) msgBox.setWindowTitle( title ) msgBox.setText( msg ) msgBox.setModal( False ) msgBox.open( msgBox.close ) msgBox.show() hsgui.non_modal_qt_handles.append(msgBox)
def emergency_msgbox(title, msg): 'Make a non modal critical QMessageBox.' from PyQt4.Qt import QMessageBox msgBox = QMessageBox(None) msgBox.setAttribute(Qt.WA_DeleteOnClose) msgBox.setStandardButtons(QMessageBox.Ok) msgBox.setWindowTitle(title) msgBox.setText(msg) msgBox.setModal(False) msgBox.open(msgBox.close) msgBox.show() return msgBox
def _typicalErrorDLG(self, exc=None): """ not sure if this is necessary yet """ qapp = QtGui.QApplication(sys.argv) qm = QtGui.QMessageBox() if exc is None: exc = "" qm = QMessageBox(QMessageBox.Critical, "Pref error.", "Preferences Critical Issue: " + exc) # qm.setStandardButtons(QMessageBox.Ok); qm.setIcon(QMessageBox.Critical) qm.show() qapp.exec_()
def run(self, path_to_ebook): from calibre.gui2 import is_ok_to_use_qt from PyQt4.Qt import QMessageBox PID = self.site_customization data_file = file(path_to_ebook, 'rb').read() ar = PID.split(',') for i in ar: try: unlocked_file = DrmStripper(data_file, i).getResult() except DrmException: # ignore the error pass else: of = self.temporary_file('.mobi') of.write(unlocked_file) of.close() return of.name if is_ok_to_use_qt(): d = QMessageBox(QMessageBox.Warning, "MobiDeDRM Plugin", "Couldn't decode: %s\n\nImporting encrypted version." % path_to_ebook) d.show() d.raise_() d.exec_() return path_to_ebook