mirror of
				https://github.com/kovidgoyal/calibre.git
				synced 2025-11-03 19:17:02 -05:00 
			
		
		
		
	more lambda slots
This commit is contained in:
		
							parent
							
								
									134d1187e7
								
							
						
					
					
						commit
						be77554adb
					
				@ -768,7 +768,8 @@ class Boss(QObject):
 | 
				
			|||||||
        self.commit_all_editors_to_container()
 | 
					        self.commit_all_editors_to_container()
 | 
				
			||||||
        k = {} if allow_revert else {'revert_msg': None}
 | 
					        k = {} if allow_revert else {'revert_msg': None}
 | 
				
			||||||
        d = self.create_diff_dialog(**k)
 | 
					        d = self.create_diff_dialog(**k)
 | 
				
			||||||
        d.revert_requested.connect(partial(self.revert_requested, self.global_undo.previous_container))
 | 
					        previous_container = self.global_undo.previous_container
 | 
				
			||||||
 | 
					        connect_lambda(d.revert_requested, self, lambda self: self.revert_requested(previous_container))
 | 
				
			||||||
        other = to_container or self.global_undo.previous_container
 | 
					        other = to_container or self.global_undo.previous_container
 | 
				
			||||||
        d.container_diff(other, self.global_undo.current_container,
 | 
					        d.container_diff(other, self.global_undo.current_container,
 | 
				
			||||||
                         names=(self.global_undo.label_for_container(other), self.global_undo.label_for_container(self.global_undo.current_container)))
 | 
					                         names=(self.global_undo.label_for_container(other), self.global_undo.label_for_container(self.global_undo.current_container)))
 | 
				
			||||||
@ -1608,14 +1609,14 @@ class Boss(QObject):
 | 
				
			|||||||
            d.l.addWidget(d.bb, 1, 0, 1, 2)
 | 
					            d.l.addWidget(d.bb, 1, 0, 1, 2)
 | 
				
			||||||
            d.do_save = None
 | 
					            d.do_save = None
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            def endit(x):
 | 
					            def endit(d, x):
 | 
				
			||||||
                d.do_save = x
 | 
					                d.do_save = x
 | 
				
			||||||
                d.accept()
 | 
					                d.accept()
 | 
				
			||||||
            b = d.bb.addButton(_('&Save and Quit'), QDialogButtonBox.ActionRole)
 | 
					            b = d.bb.addButton(_('&Save and Quit'), QDialogButtonBox.ActionRole)
 | 
				
			||||||
            b.setIcon(QIcon(I('save.png')))
 | 
					            b.setIcon(QIcon(I('save.png')))
 | 
				
			||||||
            b.clicked.connect(lambda *args: endit(True))
 | 
					            connect_lambda(b.clicked, d, lambda d: endit(d, True))
 | 
				
			||||||
            b = d.bb.addButton(_('&Quit without saving'), QDialogButtonBox.ActionRole)
 | 
					            b = d.bb.addButton(_('&Quit without saving'), QDialogButtonBox.ActionRole)
 | 
				
			||||||
            b.clicked.connect(lambda *args: endit(False))
 | 
					            connect_lambda(b.clicked, d, lambda d: endit(d, False))
 | 
				
			||||||
            d.resize(d.sizeHint())
 | 
					            d.resize(d.sizeHint())
 | 
				
			||||||
            if d.exec_() != d.Accepted or d.do_save is None:
 | 
					            if d.exec_() != d.Accepted or d.do_save is None:
 | 
				
			||||||
                return False
 | 
					                return False
 | 
				
			||||||
 | 
				
			|||||||
@ -1082,7 +1082,11 @@ class AddCover(Dialog):
 | 
				
			|||||||
                       ' to the image.')))
 | 
					                       ' to the image.')))
 | 
				
			||||||
        p.setChecked(tprefs['add_cover_preserve_aspect_ratio'])
 | 
					        p.setChecked(tprefs['add_cover_preserve_aspect_ratio'])
 | 
				
			||||||
        p.setVisible(self.container.book_type != 'azw3')
 | 
					        p.setVisible(self.container.book_type != 'azw3')
 | 
				
			||||||
        p.stateChanged.connect(lambda s:tprefs.set('add_cover_preserve_aspect_ratio', s == Qt.Checked))
 | 
					
 | 
				
			||||||
 | 
					        def on_state_change(s):
 | 
				
			||||||
 | 
					            tprefs.set('add_cover_preserve_aspect_ratio', s == Qt.Checked)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        p.stateChanged.connect(on_state_change)
 | 
				
			||||||
        self.info_label = il = QLabel('\xa0')
 | 
					        self.info_label = il = QLabel('\xa0')
 | 
				
			||||||
        h.addWidget(p), h.addStretch(1), h.addWidget(il)
 | 
					        h.addWidget(p), h.addStretch(1), h.addWidget(il)
 | 
				
			||||||
        l.addLayout(h)
 | 
					        l.addLayout(h)
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user