mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Hook up global undo/redo
This commit is contained in:
parent
b49417adfd
commit
d1f35bebdf
@ -87,11 +87,23 @@ class Boss(QObject):
|
||||
set_current_container(nc)
|
||||
self.update_global_history_actions()
|
||||
|
||||
def apply_container_update_to_gui(self):
|
||||
container = current_container()
|
||||
self.gui.file_list.build(container)
|
||||
self.update_global_history_actions()
|
||||
# TODO: Apply to other GUI elements
|
||||
|
||||
def do_global_undo(self):
|
||||
pass
|
||||
container = self.global_undo.undo()
|
||||
if container is not None:
|
||||
set_current_container(container)
|
||||
self.apply_container_update_to_gui()
|
||||
|
||||
def do_global_redo(self):
|
||||
pass
|
||||
container = self.global_undo.redo()
|
||||
if container is not None:
|
||||
set_current_container(container)
|
||||
self.apply_container_update_to_gui()
|
||||
|
||||
def delete_requested(self, spine_items, other_items):
|
||||
if not self.check_dirtied():
|
||||
|
@ -96,11 +96,11 @@ class FileList(QTreeWidget):
|
||||
return s
|
||||
|
||||
def set_state(self, state):
|
||||
for category, item in self.categories:
|
||||
for category, item in self.categories.iteritems():
|
||||
item.setExpanded(category in state['expanded'])
|
||||
self.verticalScrollBar().setValue(state['pos'])
|
||||
for parent in self.categories.itervalues():
|
||||
for c in (parent.child(i) for i in parent.childCount()):
|
||||
for c in (parent.child(i) for i in xrange(parent.childCount())):
|
||||
name = unicode(c.data(0, NAME_ROLE).toString())
|
||||
if name in state['selected']:
|
||||
c.setSelected(True)
|
||||
|
Loading…
x
Reference in New Issue
Block a user