mirror of
				https://github.com/kovidgoyal/calibre.git
				synced 2025-11-02 18:47:01 -05:00 
			
		
		
		
	Get books tweaks
This commit is contained in:
		
							parent
							
								
									f805cc60d6
								
							
						
					
					
						commit
						958ae79839
					
				@ -10,8 +10,8 @@ from functools import partial
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
from PyQt4.Qt import QMenu
 | 
					from PyQt4.Qt import QMenu
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from calibre.gui2 import JSONConfig
 | 
					 | 
				
			||||||
from calibre.gui2.actions import InterfaceAction
 | 
					from calibre.gui2.actions import InterfaceAction
 | 
				
			||||||
 | 
					from calibre.gui2.dialogs.confirm_delete import confirm
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class StoreAction(InterfaceAction):
 | 
					class StoreAction(InterfaceAction):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -19,8 +19,6 @@ class StoreAction(InterfaceAction):
 | 
				
			|||||||
    action_spec = (_('Get books'), 'store.png', None, None)
 | 
					    action_spec = (_('Get books'), 'store.png', None, None)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def genesis(self):
 | 
					    def genesis(self):
 | 
				
			||||||
        self.config = JSONConfig('store/action')
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        self.qaction.triggered.connect(self.search)
 | 
					        self.qaction.triggered.connect(self.search)
 | 
				
			||||||
        self.store_menu = QMenu()
 | 
					        self.store_menu = QMenu()
 | 
				
			||||||
        self.load_menu()
 | 
					        self.load_menu()
 | 
				
			||||||
@ -34,7 +32,7 @@ class StoreAction(InterfaceAction):
 | 
				
			|||||||
        self.qaction.setMenu(self.store_menu)
 | 
					        self.qaction.setMenu(self.store_menu)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def search(self):
 | 
					    def search(self):
 | 
				
			||||||
        self.first_run_check()
 | 
					        self.show_disclaimer()
 | 
				
			||||||
        from calibre.gui2.store.search import SearchDialog
 | 
					        from calibre.gui2.store.search import SearchDialog
 | 
				
			||||||
        sd = SearchDialog(self.gui.istores, self.gui)
 | 
					        sd = SearchDialog(self.gui.istores, self.gui)
 | 
				
			||||||
        sd.exec_()
 | 
					        sd.exec_()
 | 
				
			||||||
@ -43,18 +41,15 @@ class StoreAction(InterfaceAction):
 | 
				
			|||||||
        self.first_run_check()
 | 
					        self.first_run_check()
 | 
				
			||||||
        store_plugin.open(self.gui)
 | 
					        store_plugin.open(self.gui)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def first_run_check(self):
 | 
					    def show_disclaimer(self):
 | 
				
			||||||
        if self.config.get('first_run', True):
 | 
					        confirm(('<p>' +
 | 
				
			||||||
            self.config['first_run'] = False
 | 
					 | 
				
			||||||
            from calibre.gui2 import info_dialog
 | 
					 | 
				
			||||||
            info_dialog(self.gui, _('About Get Books'), '<p>' +
 | 
					 | 
				
			||||||
            _('Calibre helps you find the ebooks you want by searching '
 | 
					            _('Calibre helps you find the ebooks you want by searching '
 | 
				
			||||||
            'the websites of a variety of commercial and public domain '
 | 
					            'the websites of various commercial and public domain '
 | 
				
			||||||
            'book sources for you.') +
 | 
					            'book sources for you.') +
 | 
				
			||||||
            '<p>' +
 | 
					            '<p>' +
 | 
				
			||||||
            _('Using the integrated search you can easily find which '
 | 
					            _('Using the integrated search you can easily find which '
 | 
				
			||||||
            'store has the book you are looking for, at the best price. '
 | 
					            'store has the book you are looking for, at the best price. '
 | 
				
			||||||
            'You will also get DRM status and other useful information.')
 | 
					            'You also get DRM status and other useful information.')
 | 
				
			||||||
            + '<p>' +
 | 
					            + '<p>' +
 | 
				
			||||||
            _('All transactions (paid or otherwise) are handled between '
 | 
					            _('All transactions (paid or otherwise) are handled between '
 | 
				
			||||||
            'you and the particular website. '
 | 
					            'you and the particular website. '
 | 
				
			||||||
@ -64,4 +59,7 @@ class StoreAction(InterfaceAction):
 | 
				
			|||||||
            'will work with your e-book reader, especially if the book you '
 | 
					            'will work with your e-book reader, especially if the book you '
 | 
				
			||||||
            'are buying has '
 | 
					            'are buying has '
 | 
				
			||||||
            '<a href="http://drmfree.calibre-ebook.com/about#drm">DRM</a>.'
 | 
					            '<a href="http://drmfree.calibre-ebook.com/about#drm">DRM</a>.'
 | 
				
			||||||
            ), show=True, show_copy_button=False)
 | 
					            )), 'about_get_books_msg',
 | 
				
			||||||
 | 
					            parent=self.gui, show_cancel_button=False,
 | 
				
			||||||
 | 
					            confirm_msg=_('Show this message again'),
 | 
				
			||||||
 | 
					            pixmap='dialog_information.png', title=_('About Get Books'))
 | 
				
			||||||
 | 
				
			|||||||
@ -25,7 +25,7 @@ class Dialog(QDialog, Ui_Dialog):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def confirm(msg, name, parent=None, pixmap='dialog_warning.png', title=None,
 | 
					def confirm(msg, name, parent=None, pixmap='dialog_warning.png', title=None,
 | 
				
			||||||
        show_cancel_button=True):
 | 
					        show_cancel_button=True, confirm_msg=None):
 | 
				
			||||||
    if not dynamic.get(confirm_config_name(name), True):
 | 
					    if not dynamic.get(confirm_config_name(name), True):
 | 
				
			||||||
        return True
 | 
					        return True
 | 
				
			||||||
    d = Dialog(msg, name, parent)
 | 
					    d = Dialog(msg, name, parent)
 | 
				
			||||||
@ -35,5 +35,7 @@ def confirm(msg, name, parent=None, pixmap='dialog_warning.png', title=None,
 | 
				
			|||||||
        d.setWindowTitle(title)
 | 
					        d.setWindowTitle(title)
 | 
				
			||||||
    if not show_cancel_button:
 | 
					    if not show_cancel_button:
 | 
				
			||||||
        d.buttonBox.button(d.buttonBox.Cancel).setVisible(False)
 | 
					        d.buttonBox.button(d.buttonBox.Cancel).setVisible(False)
 | 
				
			||||||
 | 
					    if confirm_msg is not None:
 | 
				
			||||||
 | 
					        d.again.setText(confirm_msg)
 | 
				
			||||||
    d.resize(d.sizeHint())
 | 
					    d.resize(d.sizeHint())
 | 
				
			||||||
    return d.exec_() == d.Accepted
 | 
					    return d.exec_() == d.Accepted
 | 
				
			||||||
 | 
				
			|||||||
@ -429,9 +429,12 @@ class Matches(QAbstractItemModel):
 | 
				
			|||||||
    def __init__(self):
 | 
					    def __init__(self):
 | 
				
			||||||
        QAbstractItemModel.__init__(self)
 | 
					        QAbstractItemModel.__init__(self)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        self.DRM_LOCKED_ICON = QPixmap(I('drm-locked.png')).scaledToHeight(64)
 | 
					        self.DRM_LOCKED_ICON = QPixmap(I('drm-locked.png')).scaledToHeight(64,
 | 
				
			||||||
        self.DRM_UNLOCKED_ICON = QPixmap(I('drm-unlocked.png')).scaledToHeight(64)
 | 
					                Qt.SmoothTransformation)
 | 
				
			||||||
        self.DRM_UNKNOWN_ICON = QPixmap(I('dialog_warning.png')).scaledToHeight(64)
 | 
					        self.DRM_UNLOCKED_ICON = QPixmap(I('drm-unlocked.png')).scaledToHeight(64,
 | 
				
			||||||
 | 
					                Qt.SmoothTransformation)
 | 
				
			||||||
 | 
					        self.DRM_UNKNOWN_ICON = QPixmap(I('dialog_question.png')).scaledToHeight(64,
 | 
				
			||||||
 | 
					                Qt.SmoothTransformation)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # All matches. Used to determine the order to display
 | 
					        # All matches. Used to determine the order to display
 | 
				
			||||||
        # self.matches because the SearchFilter returns
 | 
					        # self.matches because the SearchFilter returns
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user