forked from openlp/openlp
The category strings, if not unicode, can only be QStrings. Thanks to superfly.
This commit is contained in:
parent
ef3e3252e7
commit
97560f6947
@ -149,7 +149,7 @@ class CategoryList(object):
|
|||||||
return self.__next__()
|
return self.__next__()
|
||||||
|
|
||||||
def has_key(self, key):
|
def has_key(self, key):
|
||||||
if key and not isinstance(key, unicode):
|
if isinstance(key, QtCore.QString):
|
||||||
key = unicode(key)
|
key = unicode(key)
|
||||||
for category in self.categories:
|
for category in self.categories:
|
||||||
if category.name == key:
|
if category.name == key:
|
||||||
@ -166,7 +166,7 @@ class CategoryList(object):
|
|||||||
self.add(name, weight)
|
self.add(name, weight)
|
||||||
|
|
||||||
def add(self, name, weight=0, actions=None):
|
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)
|
name = unicode(name)
|
||||||
category = ActionCategory(name, weight)
|
category = ActionCategory(name, weight)
|
||||||
if actions:
|
if actions:
|
||||||
@ -221,7 +221,7 @@ class ActionList(object):
|
|||||||
The weight specifies how important a category is. However, this only
|
The weight specifies how important a category is. However, this only
|
||||||
has an impact on the order the categories are displayed.
|
has an impact on the order the categories are displayed.
|
||||||
"""
|
"""
|
||||||
if category is not None:
|
if category:
|
||||||
category = unicode(category)
|
category = unicode(category)
|
||||||
if category not in self.categories:
|
if category not in self.categories:
|
||||||
self.categories.append(category)
|
self.categories.append(category)
|
||||||
@ -230,7 +230,7 @@ class ActionList(object):
|
|||||||
self.categories[category].actions.append(action)
|
self.categories[category].actions.append(action)
|
||||||
else:
|
else:
|
||||||
self.categories[category].actions.add(action, weight)
|
self.categories[category].actions.add(action, weight)
|
||||||
if category is None:
|
if not category:
|
||||||
# Stop here, as this action is not configurable.
|
# Stop here, as this action is not configurable.
|
||||||
return
|
return
|
||||||
# Load the shortcut from the config.
|
# Load the shortcut from the config.
|
||||||
@ -254,7 +254,7 @@ class ActionList(object):
|
|||||||
The name (unicode string) of the category, which contains the
|
The name (unicode string) of the category, which contains the
|
||||||
action. Defaults to None.
|
action. Defaults to None.
|
||||||
"""
|
"""
|
||||||
if category is not None:
|
if isinstance(category, QtCore.QString):
|
||||||
category = unicode(category)
|
category = unicode(category)
|
||||||
if category not in self.categories:
|
if category not in self.categories:
|
||||||
return
|
return
|
||||||
@ -274,7 +274,7 @@ class ActionList(object):
|
|||||||
``weight``
|
``weight``
|
||||||
The category's weight (int).
|
The category's weight (int).
|
||||||
"""
|
"""
|
||||||
if name and not isinstance(name, unicode):
|
if isinstance(name, QtCore.QString):
|
||||||
name = unicode(name)
|
name = unicode(name)
|
||||||
if name in self.categories:
|
if name in self.categories:
|
||||||
# Only change the weight and resort the categories again.
|
# Only change the weight and resort the categories again.
|
||||||
|
Loading…
Reference in New Issue
Block a user