diff --git a/compass_viewer/container/__init__.py b/compass_viewer/container/__init__.py index f25ba24..8d210ca 100644 --- a/compass_viewer/container/__init__.py +++ b/compass_viewer/container/__init__.py @@ -30,6 +30,7 @@ ID_GO_MENU_BACK = wx.NewId() ID_GO_MENU_NEXT = wx.NewId() ID_GO_MENU_UP = wx.NewId() +ID_GO_MENU_TOP = wx.NewId() ID_VIEW_MENU_LIST = wx.NewId() ID_VIEW_MENU_ICON = wx.NewId() @@ -59,6 +60,7 @@ def __init__(self, node, pos=None): go_menu.Append(ID_GO_MENU_BACK, "Back\tCtrl-[") go_menu.Append(ID_GO_MENU_NEXT, "Next\tCtrl-]") go_menu.Append(ID_GO_MENU_UP, "Up\tCtrl-Up") + go_menu.Append(ID_GO_MENU_TOP, "Top\tCtrl-/") self.add_menu(go_menu, "Go") self.go_menu = go_menu @@ -68,6 +70,7 @@ def __init__(self, node, pos=None): self.Bind(wx.EVT_MENU, lambda evt: self.go_back(), id=ID_GO_MENU_BACK) self.Bind(wx.EVT_MENU, lambda evt: self.go_next(), id=ID_GO_MENU_NEXT) self.Bind(wx.EVT_MENU, lambda evt: self.go_up(), id=ID_GO_MENU_UP) + self.Bind(wx.EVT_MENU, lambda evt: self.go_top(), id=ID_GO_MENU_TOP) self.Bind(wx.EVT_MENU, lambda evt: self.list_view(), id=ID_VIEW_MENU_LIST) self.Bind(wx.EVT_MENU, lambda evt: self.icon_view(), id=ID_VIEW_MENU_ICON) @@ -77,6 +80,7 @@ def __init__(self, node, pos=None): back_bmp = imagesupport.getbitmap('go_back_24') next_bmp = imagesupport.getbitmap('go_next_24') up_bmp = imagesupport.getbitmap('go_up_24') + top_bmp = imagesupport.getbitmap('go_top_24') icon_bmp = imagesupport.getbitmap('view_icon_24') list_bmp = imagesupport.getbitmap('view_list_24') @@ -85,6 +89,7 @@ def __init__(self, node, pos=None): self.toolbar.AddLabelTool(ID_GO_MENU_NEXT, "Next", next_bmp, shortHelp="New", longHelp="Long help for 'New'") self.toolbar.AddSeparator() self.toolbar.AddLabelTool(ID_GO_MENU_UP, "Up", up_bmp, shortHelp="New", longHelp="Long help for 'New'") + self.toolbar.AddLabelTool(ID_GO_MENU_TOP, "Top", top_bmp, shortHelp="New", longHelp="Long help for 'New'") self.toolbar.AddStretchableSpace() self.toolbar.AddLabelTool(ID_VIEW_MENU_LIST, "List View", list_bmp, shortHelp="New", longHelp="Long help for 'New'") self.toolbar.AddLabelTool(ID_VIEW_MENU_ICON, "Icon View", icon_bmp, shortHelp="New", longHelp="Long help for 'New'") @@ -136,6 +141,13 @@ def go_up(self): parent = node.store.getparent(node.key) if parent.key != node.key: # at the root item self.go(parent) + + def go_top(self): + """ Go to the root node """ + node = self.history[self.history_ptr] + parent = node.store.root + if parent.key != node.key: # at the root item + self.go(parent) def go(self, newnode): @@ -161,12 +173,15 @@ def update_view(self): can_go_back = self.history_ptr > 0 can_go_next = self.history_ptr < (len(self.history)-1) can_go_up = self.node.store.getparent(self.node.key) is not None + can_go_top = self.node.key != self.node.store.root.key self.go_menu.Enable(ID_GO_MENU_BACK, can_go_back) self.go_menu.Enable(ID_GO_MENU_NEXT, can_go_next) self.go_menu.Enable(ID_GO_MENU_UP, can_go_up) + self.go_menu.Enable(ID_GO_MENU_TOP, can_go_top) self.toolbar.EnableTool(ID_GO_MENU_BACK, can_go_back) self.toolbar.EnableTool(ID_GO_MENU_NEXT, can_go_next) self.toolbar.EnableTool(ID_GO_MENU_UP, can_go_up) + self.toolbar.EnableTool(ID_GO_MENU_TOP, can_go_top) icon_view_allowed = len(self.node) <= 1000 self.view_menu.Enable(ID_VIEW_MENU_ICON, icon_view_allowed) diff --git a/compass_viewer/icons/go-top_24.png b/compass_viewer/icons/go-top_24.png new file mode 100644 index 0000000..74f0041 Binary files /dev/null and b/compass_viewer/icons/go-top_24.png differ diff --git a/compass_viewer/icons/go-top_32.png b/compass_viewer/icons/go-top_32.png new file mode 100644 index 0000000..5f16e58 Binary files /dev/null and b/compass_viewer/icons/go-top_32.png differ diff --git a/compass_viewer/images.py b/compass_viewer/images.py index 4a16f3b..335e90f 100644 --- a/compass_viewer/images.py +++ b/compass_viewer/images.py @@ -8400,6 +8400,58 @@ def go_up_32(): "qfo2JjIP2JKadcLnXKrkU5kQHoahnzC7m6Hy5j2Vm2ILuUqLDUDeSKcUPjiXfvKdwngP5ofwCZp" "Zc/KoDT3AAAAABJRU5ErkJggg==") +def go_top_24(): + return base64.b64decode("iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAA" +"ABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH3wkdExQPIK4+hA" +"AAA9NJREFUSMetlk1oXFUYht/zd++dTGba/EynTad1JiZNiMkkmthWSGup2E2kCyVQwUhFGhVBV" +"5booosuRHSpGKKWYgWtgUYDgoVuil34AwGRbCox2kgzKW0yycy983PvPedzURCJPxnTfPDuvvc8" +"vN934ByGGqp/dEIVi9Gz9++OvMSI2Nxi5f1YzDsz88ELwUZeWQtgOVc5e3QgNpZqcUBE2L09HLv" +"yfYUAvLGRl9cCUCZ/yq+6KHoGRc/ALeYR4YXRWrw1AVYWf9Pzv5fA7SRUXQsWb/tYzt0ItwxQLd" +"ycupObB+cSAEdu4ReU8gtTtXhZLU1oa7MtN/qhbTlPAEDVr3zl13unMDdXxVZW6/DEto7j52L/x" +"8NrbUweeyfannRm05m62dTwZGTLATvi+OSZ4YdTI0/27t0Z88/V6hO1NO189PRzJ47vH2tJJcGl" +"RNwKe3L1j/+8MvvF7D0nSBx4pf1g9r7xtn0plFwPnuuitTWB3rR9vmPkQubeAEeOyGRz5MvBwW7" +"bLXpwXQ+eW0KxUMIjD+2yYw6m+0cn1KYBzYX0m0cP93VV/RBusQS3WL4rt4RKxcehrnhPoRA9s6" +"kdNHWdeKx/oHO8rSPDiAhEgDYGxhgYbRDqEJYlEFRKh1h6+Nry7KVfa06wrWeoIZHc/lm27wEeB" +"AZhSAg0QRsg1ECgCUFI8H2NznQ9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