From c6833003851d7e70681a87429cec43e830556c5c Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Tue, 12 Apr 2011 23:01:27 +0200 Subject: [PATCH] fixed weight --- openlp/core/utils/actions.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/openlp/core/utils/actions.py b/openlp/core/utils/actions.py index 76b72c55c..0c4eee655 100644 --- a/openlp/core/utils/actions.py +++ b/openlp/core/utils/actions.py @@ -154,10 +154,13 @@ class CategoryList(object): return False def append(self, name, actions=None): + weight = 0 + if len(self.categories) > 0: + weight = self.categories[-1].weight + 1 if actions: - self.add(name, actions=actions) + self.add(name, weight, actions) else: - self.add(name) + self.add(name, weight) def add(self, name, weight=0, actions=None): category = ActionCategory(name, weight) @@ -168,7 +171,7 @@ class CategoryList(object): else: category.actions.append(action) self.categories.append(category) - self.categories.sort(key=lambda cat: cat.weight, reverse=True) + self.categories.sort(key=lambda cat: cat.weight) def remove(self, name): for category in self.categories: @@ -270,8 +273,7 @@ class ActionList(object): for category in self.categories: if category.name == name: category.weight = weight - self.categories.categories.sort( - key=lambda cat: cat.weight, reverse=True) + self.categories.categories.sort(key=lambda cat: cat.weight) return self.categories.add(name, weight) @@ -280,5 +282,5 @@ class CategoryOrder(object): """ An enumeration class for category weights. """ - standardMenu = 100 - standardToolbar = 90 + standardMenu = -20 + standardToolbar = -10