Skip to content

Commit

Permalink
bookmarks: improve usability in the context menu
Browse files Browse the repository at this point in the history
The "Edit" action was really "Launch Editor", so the menu action
explicitly to avoid ambiguities.

Add a new "Edit" action that actually edits the bookmarks list, which is
what most users would expect when clicking on "Edit".

Closes git-cola#281

Reported-by: V字龍(Vdragon) <pika1021@gmail.com>
Signed-off-by: David Aguilar <davvid@gmail.com>
  • Loading branch information
davvid committed Jun 7, 2014
1 parent ab66936 commit 4a90299
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
4 changes: 2 additions & 2 deletions cola/cmds.py
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ class Edit(Command):

@staticmethod
def name():
return N_('Edit')
return N_('Launch Editor')

def __init__(self, filenames, line_number=None):
Command.__init__(self)
Expand Down Expand Up @@ -1238,7 +1238,7 @@ def __init__(self, paths):
Command.__init__(self)
browser = utils.shell_split(prefs.history_browser())
if paths:
self.argv = browser + paths
self.argv = browser + list(paths)
else:
self.argv = browser

Expand Down
20 changes: 13 additions & 7 deletions cola/widgets/bookmarks.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def __init__(self, parent=None):
tooltip=N_('Bookmarks...'), icon=qtutils.add_icon())

qtutils.connect_button(self.open_button, self.tree.open_repo)
qtutils.connect_button(self.edit_button, self.manage_bookmarks)
qtutils.connect_button(self.edit_button, self.tree.edit_bookmarks)

self.connect(self.tree, SIGNAL('itemSelectionChanged()'),
self._tree_selection_changed)
Expand All @@ -170,12 +170,8 @@ def _tree_selection_changed(self):
enabled = bool(self.tree.selected_item())
self.open_button.setEnabled(enabled)

def manage_bookmarks(self):
manage_bookmarks()
self.refresh()

def refresh(self):
self.tree.refresh()
def edit_bookmarks(self):
self.tree.edit_bookmarks()


class BookmarksTreeWidget(standard.TreeWidget):
Expand All @@ -199,6 +195,10 @@ def __init__(self, parent=None):
cmds.OpenDefaultApp.SHORTCUT)
self.open_default_action.setEnabled(False)

self.edit_bookmarks_action = qtutils.add_action(self,
N_('Edit'), self.edit_bookmarks)
self.edit_bookmarks_action.setEnabled(False)

self.launch_editor_action = qtutils.add_action(self,
cmds.Edit.name(), self.launch_editor,
cmds.Edit.SHORTCUT)
Expand Down Expand Up @@ -243,6 +243,7 @@ def contextMenuEvent(self, event):
menu.addAction(self.open_action)
menu.addAction(self.open_new_action)
menu.addAction(self.open_default_action)
menu.addAction(self.edit_bookmarks_action)
menu.addSeparator()
menu.addAction(self.copy_action)
menu.addAction(self.launch_editor_action)
Expand Down Expand Up @@ -273,6 +274,10 @@ def open_new_repo(self):
return
cmds.do(cmds.OpenNewRepo, item.path)

def edit_bookmarks(self):
manage_bookmarks()
self.refresh()

def launch_editor(self):
item = self.selected_item()
if not item:
Expand All @@ -293,6 +298,7 @@ def _tree_selection_changed(self):
self.launch_editor_action.setEnabled(enabled)
self.launch_terminal_action.setEnabled(enabled)
self.open_default_action.setEnabled(enabled)
self.edit_bookmarks_action.setEnabled(enabled)

def _tree_double_clicked(self, item, column):
cmds.do(cmds.OpenRepo, item.path)
Expand Down
4 changes: 4 additions & 0 deletions share/doc/git-cola/relnotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ Usability, bells and whistles
* New hotkeys: Ctrl+f for fetch, Ctrl+p for push,
and Ctrl-shift-p for pull.

* The bookmarks widget's context menu actions were made clearer.

https://github.com/git-cola/git-cola/issues/281

Fixes
-----
* We now use bold fonts instead of SmallCaps to avoid
Expand Down

0 comments on commit 4a90299

Please sign in to comment.