From 97560f694721cac055689aa4266ef6131e361ab7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20P=C3=B5ldaru?= Date: Thu, 8 Dec 2011 14:13:57 +0200 Subject: [PATCH] The category strings, if not unicode, can only be QStrings. Thanks to superfly. --- openlp/core/utils/actions.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/openlp/core/utils/actions.py b/openlp/core/utils/actions.py index 37c2676ac..37b66dfce 100644 --- a/openlp/core/utils/actions.py +++ b/openlp/core/utils/actions.py @@ -149,7 +149,7 @@ class CategoryList(object): return self.__next__() def has_key(self, key): - if key and not isinstance(key, unicode): + if isinstance(key, QtCore.QString): key = unicode(key) for category in self.categories: if category.name == key: @@ -166,7 +166,7 @@ class CategoryList(object): self.add(name, weight) def add(self, name, weight=0, actions=None): - if name and not isinstance(name, unicode): + if name and isinstance(name, QtCore.QString): name = unicode(name) category = ActionCategory(name, weight) if actions: @@ -221,7 +221,7 @@ class ActionList(object): The weight specifies how important a category is. However, this only has an impact on the order the categories are displayed. """ - if category is not None: + if category: category = unicode(category) if category not in self.categories: self.categories.append(category) @@ -230,7 +230,7 @@ class ActionList(object): self.categories[category].actions.append(action) else: self.categories[category].actions.add(action, weight) - if category is None: + if not category: # Stop here, as this action is not configurable. return # Load the shortcut from the config. @@ -254,7 +254,7 @@ class ActionList(object): The name (unicode string) of the category, which contains the action. Defaults to None. """ - if category is not None: + if isinstance(category, QtCore.QString): category = unicode(category) if category not in self.categories: return @@ -274,7 +274,7 @@ class ActionList(object): ``weight`` The category's weight (int). """ - if name and not isinstance(name, unicode): + if isinstance(name, QtCore.QString): name = unicode(name) if name in self.categories: # Only change the weight and resort the categories again.