Compare commits

...

2 commits

Author SHA1 Message Date
j
211bde468d add delete from collection, delete from archive option to menu 2019-12-06 13:13:09 +00:00
j
24a6bb7c03 ignore non utf-8 output 2019-12-06 13:07:53 +00:00
2 changed files with 47 additions and 7 deletions

View file

@ -15,7 +15,7 @@ def pdfinfo(pdf):
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True) p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True)
stdout, stderr = p.communicate() stdout, stderr = p.communicate()
data = {} data = {}
for line in stdout.decode('utf-8').strip().split('\n'): for line in stdout.decode('utf-8', 'replace').strip().split('\n'):
parts = line.split(':') parts = line.split(':')
key = parts[0].lower().strip() key = parts[0].lower().strip()
if key: if key:

View file

@ -402,6 +402,47 @@ pandora.ui.mainMenu = function() {
}); });
} }
} else if (ui.section == 'documents') { } else if (ui.section == 'documents') {
var files, ids = [];
if (ui.document) {
files = [pandora.$ui.document.info()];
ids = [files[0].id];
} else {
files = pandora.$ui.list.options('selected').map(function(id) {
ids.push(id)
return pandora.$ui.list.value(id);
});
}
if (ui._collection) {
//fixme use history
//pandora.doHistory('delete', files, ui._collection, function() {
pandora.api.removeCollectionItems({
collection: ui._collection,
items: ids
}, function() {
pandora.UI.set({collectionSelection: []});
pandora.reloadList();
});
} else {
pandora.ui.deleteDocumentDialog(
files,
function() {
Ox.Request.clearCache();
if (ui.document) {
pandora.UI.set({document: ''});
} else {
pandora.$ui.list.reloadList()
}
}
).open();
}
} else if (ui.section == 'edits') {
var clips = pandora.$ui.editPanel.getSelectedClips();
pandora.doHistory('delete', clips, ui.edit, function(result) {
pandora.$ui.editPanel.updatePanel(function() {});
});
}
} else if (data.id == 'deletefromarchive') {
if (ui.section == 'documents') {
var files; var files;
if (ui.document) { if (ui.document) {
files = [pandora.$ui.document.info()]; files = [pandora.$ui.document.info()];
@ -421,11 +462,6 @@ pandora.ui.mainMenu = function() {
} }
} }
).open(); ).open();
} else if (ui.section == 'edits') {
var clips = pandora.$ui.editPanel.getSelectedClips();
pandora.doHistory('delete', clips, ui.edit, function(result) {
pandora.$ui.editPanel.updatePanel(function() {});
});
} }
} else if (data.id == 'undo') { } else if (data.id == 'undo') {
fromMenu = true; fromMenu = true;
@ -1045,7 +1081,11 @@ pandora.ui.mainMenu = function() {
{ id: 'paste', title: clipboardItems == 0 ? Ox._('Paste') : Ox._('Paste {0}', [clipboardItemName]), disabled: !canPaste, keyboard: 'control v' }, { id: 'paste', title: clipboardItems == 0 ? Ox._('Paste') : Ox._('Paste {0}', [clipboardItemName]), disabled: !canPaste, keyboard: 'control v' },
{ id: 'clearclipboard', title: Ox._('Clear Clipboard'), disabled: !clipboardItems}, { id: 'clearclipboard', title: Ox._('Clear Clipboard'), disabled: !clipboardItems},
{}, {},
{ id: 'delete', title: Ox._('{0} {1} {2}', [deleteVerb, selectionItemName, listName]), disabled: !canDelete, keyboard: 'delete' }, [
{ id: 'delete', title: Ox._('{0} {1} {2}', [deleteVerb, selectionItemName, listName]), disabled: !canDelete, keyboard: 'delete' }
].concat(ui._collection ? [
{ id: 'deletefromarchive', title: Ox._('{0} {1} {2}', [Ox._('Delete'), selectionItemName, Ox._('from Archive')]), disabled: !canDelete }
] : []),
{}, {},
{ id: 'undo', title: undoText ? Ox._('Undo {0}', [undoText]) : Ox._('Undo'), disabled: !undoText, keyboard: 'control z' }, { id: 'undo', title: undoText ? Ox._('Undo {0}', [undoText]) : Ox._('Undo'), disabled: !undoText, keyboard: 'control z' },
{ id: 'redo', title: redoText ? Ox._('Redo {0}', [redoText]) : Ox._('Redo'), disabled: !redoText, keyboard: 'shift control z' }, { id: 'redo', title: redoText ? Ox._('Redo {0}', [redoText]) : Ox._('Redo'), disabled: !redoText, keyboard: 'shift control z' },