def init(parent=None): action = QAction('&Update to ID3v2.4', parent) connect_shortcut(action, FILESSELECTED) parent.connect(action, SIGNAL('triggered()'), partial(update_to_24, parent)) convert = QAction('&Convert to UTF-8', parent) connect_shortcut(convert, FILESSELECTED) parent.connect(convert, SIGNAL('triggered()'), partial(to_utf8, parent)) add_shortcuts('Ta&g Tools', [separator(), action, convert, separator()])
def create_actions(parent): enable_preview = QAction('Enabl&e Preview Mode', parent) enable_preview.setShortcut('Ctrl+Shift+P') obj.connect(enable_preview, SIGNAL('triggered()'), toggle_preview_mode) clear_selection = PreviewAction('Clear Selected &Files', parent) clear_selection.setShortcut('Ctrl+Shift+F') obj.connect(clear_selection, SIGNAL('triggered()'), clear_selected) write = PreviewAction('&Write Previews', parent) write.setShortcut('Ctrl+W') obj.connect(write, SIGNAL('triggered()'), lambda: emit('writepreview')) revert = PreviewAction('&Undo Last Clear', parent) revert.setShortcut('Ctrl+Shift+Z') obj.connect(revert, SIGNAL('triggered()'), undo_last) sort = QAction('Sort &By', parent) obj.connect(sort, SIGNAL('triggered()'), sort_by_fields) clear_cells = PreviewAction('Clear Selected &Cells', parent) obj.connect(clear_cells, SIGNAL('triggered()'), clear_selected_cells) cparser = PuddleConfig() options = cparser.get('table', 'sortoptions', [ '__filename,track,__dirpath', 'track, album', '__filename,album,__dirpath' ]) global _sort_action _sort_action = sort sort_actions = set_sort_options(options) preview_actions = [clear_selection, write, revert, clear_cells] toggle = partial(toggle_preview_display, enable_preview, preview_actions) obj.receives.append(['previewModeChanged', toggle]) [connect_shortcut(z, FILESSELECTED) for z in preview_actions] return [enable_preview, clear_selection, write, revert, sort, clear_cells ] + sort_actions
def create_actions(parent): enable_preview = QAction('Enabl&e Preview Mode', parent) enable_preview.setShortcut('Ctrl+Shift+P') obj.connect(enable_preview, SIGNAL('triggered()'), toggle_preview_mode) clear_selection = PreviewAction('Clear Selected &Files', parent) clear_selection.setShortcut('Ctrl+Shift+F') obj.connect(clear_selection, SIGNAL('triggered()'), clear_selected) write = PreviewAction('&Write Previews', parent) write.setShortcut('Ctrl+W') obj.connect(write, SIGNAL('triggered()'), lambda: emit('writepreview')) revert = PreviewAction('&Undo Last Clear', parent) revert.setShortcut('Ctrl+Shift+Z') obj.connect(revert, SIGNAL('triggered()'), undo_last) sort = QAction('Sort &By', parent) obj.connect(sort, SIGNAL('triggered()'), sort_by_fields) clear_cells = PreviewAction('Clear Selected &Cells', parent) obj.connect(clear_cells, SIGNAL('triggered()'), clear_selected_cells) cparser = PuddleConfig() options = cparser.get('table', 'sortoptions', ['__filename,track,__dirpath','track, album', '__filename,album,__dirpath']) global _sort_action _sort_action = sort sort_actions = set_sort_options(options) preview_actions = [clear_selection, write, revert, clear_cells] toggle = partial(toggle_preview_display, enable_preview, preview_actions) obj.receives.append(['previewModeChanged', toggle]) [connect_shortcut(z, FILESSELECTED) for z in preview_actions] return [enable_preview, clear_selection, write, revert, sort, clear_cells] + sort_actions