openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #13226
[Merge] lp:~mahfiaz/openlp/unicode_warning_fix into lp:openlp
mahfiaz has proposed merging lp:~mahfiaz/openlp/unicode_warning_fix into lp:openlp.
Requested reviews:
Tim Bentley (trb143)
Raoul Snyman (raoul-snyman)
For more details, see:
https://code.launchpad.net/~mahfiaz/openlp/unicode_warning_fix/+merge/85113
Ensure that action category names are unicode, to prevent warnings on comparison. Also a fix for a path problem.
--
https://code.launchpad.net/~mahfiaz/openlp/unicode_warning_fix/+merge/85113
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/lib/__init__.py'
--- openlp/core/lib/__init__.py 2011-10-01 07:28:45 +0000
+++ openlp/core/lib/__init__.py 2011-12-09 11:53:27 +0000
@@ -191,10 +191,10 @@
``thumb_path``
The path to the thumb.
"""
- if not os.path.exists(unicode(thumb_path)):
+ if not os.path.exists(thumb_path):
return False
- image_date = os.stat(unicode(file_path)).st_mtime
- thumb_date = os.stat(unicode(thumb_path)).st_mtime
+ image_date = os.stat(file_path).st_mtime
+ thumb_date = os.stat(thumb_path).st_mtime
return image_date <= thumb_date
def resize_image(image_path, width, height, background=u'#000000'):
=== modified file 'openlp/core/ui/mainwindow.py'
--- openlp/core/ui/mainwindow.py 2011-12-05 21:40:56 +0000
+++ openlp/core/ui/mainwindow.py 2011-12-09 11:53:27 +0000
@@ -176,7 +176,8 @@
self.themeManagerDock)
# Create the menu items
action_list = ActionList.get_instance()
- action_list.add_category(UiStrings().File, CategoryOrder.standardMenu)
+ action_list.add_category(unicode(UiStrings().File),
+ CategoryOrder.standardMenu)
self.fileNewItem = shortcut_action(mainWindow, u'fileNewItem',
[QtGui.QKeySequence(u'Ctrl+N')],
self.serviceManagerContents.onNewServiceClicked,
@@ -199,17 +200,20 @@
self.fileExitItem = shortcut_action(mainWindow, u'fileExitItem',
[QtGui.QKeySequence(u'Alt+F4')], mainWindow.close,
u':/system/system_exit.png', category=UiStrings().File)
- action_list.add_category(UiStrings().Import, CategoryOrder.standardMenu)
+ action_list.add_category(unicode(UiStrings().Import),
+ CategoryOrder.standardMenu)
self.importThemeItem = base_action(
mainWindow, u'importThemeItem', UiStrings().Import)
self.importLanguageItem = base_action(
mainWindow, u'importLanguageItem')#, UiStrings().Import)
- action_list.add_category(UiStrings().Export, CategoryOrder.standardMenu)
+ action_list.add_category(unicode(UiStrings().Export),
+ CategoryOrder.standardMenu)
self.exportThemeItem = base_action(
mainWindow, u'exportThemeItem', UiStrings().Export)
self.exportLanguageItem = base_action(
mainWindow, u'exportLanguageItem')#, UiStrings().Export)
- action_list.add_category(UiStrings().View, CategoryOrder.standardMenu)
+ action_list.add_category(unicode(UiStrings().View),
+ CategoryOrder.standardMenu)
self.viewMediaManagerItem = shortcut_action(mainWindow,
u'viewMediaManagerItem', [QtGui.QKeySequence(u'F8')],
self.toggleMediaManager, u':/system/system_mediamanager.png',
@@ -232,7 +236,7 @@
self.lockPanel = shortcut_action(mainWindow, u'lockPanel',
None, self.setLockPanel,
checked=panelLocked, category=None)
- action_list.add_category(UiStrings().ViewMode,
+ action_list.add_category(unicode(UiStrings().ViewMode),
CategoryOrder.standardMenu)
self.modeDefaultItem = checkable_action(
mainWindow, u'modeDefaultItem', category=UiStrings().ViewMode)
@@ -245,7 +249,8 @@
self.modeGroup.addAction(self.modeSetupItem)
self.modeGroup.addAction(self.modeLiveItem)
self.modeDefaultItem.setChecked(True)
- action_list.add_category(UiStrings().Tools, CategoryOrder.standardMenu)
+ action_list.add_category(unicode(UiStrings().Tools),
+ CategoryOrder.standardMenu)
self.toolsAddToolItem = icon_action(mainWindow, u'toolsAddToolItem',
u':/tools/tools_add.png', category=UiStrings().Tools)
self.toolsOpenDataFolder = icon_action(mainWindow,
@@ -256,7 +261,7 @@
category=UiStrings().Tools)
self.updateThemeImages = base_action(mainWindow,
u'updateThemeImages', category=UiStrings().Tools)
- action_list.add_category(UiStrings().Settings,
+ action_list.add_category(unicode(UiStrings().Settings),
CategoryOrder.standardMenu)
self.settingsPluginListItem = shortcut_action(mainWindow,
u'settingsPluginListItem', [QtGui.QKeySequence(u'Alt+F7')],
@@ -290,7 +295,8 @@
u'settingsImportItem', category=UiStrings().Settings)
self.settingsExportItem = base_action(mainWindow,
u'settingsExportItem', category=UiStrings().Settings)
- action_list.add_category(UiStrings().Help, CategoryOrder.standardMenu)
+ action_list.add_category(unicode(UiStrings().Help),
+ CategoryOrder.standardMenu)
self.aboutItem = shortcut_action(mainWindow, u'aboutItem',
[QtGui.QKeySequence(u'Ctrl+F1')], self.onAboutItemClicked,
u':/system/system_about.png', category=UiStrings().Help)
=== modified file 'openlp/core/ui/servicemanager.py'
--- openlp/core/ui/servicemanager.py 2011-12-02 20:17:57 +0000
+++ openlp/core/ui/servicemanager.py 2011-12-09 11:53:27 +0000
@@ -177,9 +177,9 @@
self.serviceManagerList.moveTop.setObjectName(u'moveTop')
action_list = ActionList.get_instance()
action_list.add_category(
- UiStrings().Service, CategoryOrder.standardToolbar)
+ unicode(UiStrings().Service), CategoryOrder.standardToolbar)
action_list.add_action(
- self.serviceManagerList.moveTop, UiStrings().Service)
+ self.serviceManagerList.moveTop, unicode(UiStrings().Service))
self.serviceManagerList.moveUp = self.orderToolbar.addToolbarButton(
translate('OpenLP.ServiceManager', 'Move &up'),
u':/services/service_up.png',
@@ -188,7 +188,7 @@
self.onServiceUp, shortcuts=[QtCore.Qt.Key_PageUp])
self.serviceManagerList.moveUp.setObjectName(u'moveUp')
action_list.add_action(
- self.serviceManagerList.moveUp, UiStrings().Service)
+ self.serviceManagerList.moveUp, unicode(UiStrings().Service))
self.serviceManagerList.moveDown = self.orderToolbar.addToolbarButton(
translate('OpenLP.ServiceManager', 'Move &down'),
u':/services/service_down.png',
@@ -197,7 +197,7 @@
self.onServiceDown, shortcuts=[QtCore.Qt.Key_PageDown])
self.serviceManagerList.moveDown.setObjectName(u'moveDown')
action_list.add_action(
- self.serviceManagerList.moveDown, UiStrings().Service)
+ self.serviceManagerList.moveDown, unicode(UiStrings().Service))
self.serviceManagerList.moveBottom = self.orderToolbar.addToolbarButton(
translate('OpenLP.ServiceManager', 'Move to &bottom'),
u':/services/service_bottom.png',
@@ -206,7 +206,7 @@
self.onServiceEnd, shortcuts=[QtCore.Qt.Key_End])
self.serviceManagerList.moveBottom.setObjectName(u'moveBottom')
action_list.add_action(
- self.serviceManagerList.moveBottom, UiStrings().Service)
+ self.serviceManagerList.moveBottom, unicode(UiStrings().Service))
self.serviceManagerList.down = self.orderToolbar.addToolbarButton(
translate('OpenLP.ServiceManager', 'Move &down'),
None,
@@ -241,7 +241,7 @@
self.onExpandAll, shortcuts=[QtCore.Qt.Key_Plus])
self.serviceManagerList.expand.setObjectName(u'expand')
action_list.add_action(
- self.serviceManagerList.expand, UiStrings().Service)
+ self.serviceManagerList.expand, unicode(UiStrings().Service))
self.serviceManagerList.collapse = self.orderToolbar.addToolbarButton(
translate('OpenLP.ServiceManager', '&Collapse all'),
u':/services/service_collapse_all.png',
@@ -250,7 +250,7 @@
self.onCollapseAll, shortcuts=[QtCore.Qt.Key_Minus])
self.serviceManagerList.collapse.setObjectName(u'collapse')
action_list.add_action(
- self.serviceManagerList.collapse, UiStrings().Service)
+ self.serviceManagerList.collapse, unicode(UiStrings().Service))
self.orderToolbar.addSeparator()
self.serviceManagerList.makeLive = self.orderToolbar.addToolbarButton(
translate('OpenLP.ServiceManager', 'Go Live'),
@@ -260,7 +260,7 @@
shortcuts=[QtCore.Qt.Key_Enter, QtCore.Qt.Key_Return])
self.serviceManagerList.makeLive.setObjectName(u'orderToolbar')
action_list.add_action(
- self.serviceManagerList.makeLive, UiStrings().Service)
+ self.serviceManagerList.makeLive, unicode(UiStrings().Service))
self.layout.addWidget(self.orderToolbar)
# Connect up our signals and slots
QtCore.QObject.connect(self.themeComboBox,
=== modified file 'openlp/core/ui/slidecontroller.py'
--- openlp/core/ui/slidecontroller.py 2011-12-03 13:40:48 +0000
+++ openlp/core/ui/slidecontroller.py 2011-12-09 11:53:27 +0000
@@ -540,7 +540,7 @@
self.nextItem.setObjectName(u'nextItemLive')
action_list = ActionList.get_instance()
action_list.add_category(
- UiStrings().LiveToolbar, CategoryOrder.standardToolbar)
+ unicode(UiStrings().LiveToolbar), CategoryOrder.standardToolbar)
action_list.add_action(self.previousItem)
action_list.add_action(self.nextItem)
self.previousService = shortcut_action(parent, u'previousService',
=== modified file 'openlp/core/utils/actions.py'
--- openlp/core/utils/actions.py 2011-12-06 19:25:12 +0000
+++ openlp/core/utils/actions.py 2011-12-09 11:53:27 +0000
@@ -217,7 +217,7 @@
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)
@@ -226,7 +226,7 @@
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.
@@ -250,8 +250,6 @@
The name (unicode string) of the category, which contains the
action. Defaults to None.
"""
- if category is not None:
- category = unicode(category)
if category not in self.categories:
return
self.categories[category].actions.remove(action)
=== modified file 'openlp/plugins/bibles/bibleplugin.py'
--- openlp/plugins/bibles/bibleplugin.py 2011-08-29 12:59:19 +0000
+++ openlp/plugins/bibles/bibleplugin.py 2011-12-09 11:53:27 +0000
@@ -71,7 +71,8 @@
self.manager.finalise()
Plugin.finalise(self)
action_list = ActionList.get_instance()
- action_list.remove_action(self.importBibleItem, UiStrings().Import)
+ action_list.remove_action(self.importBibleItem,
+ unicode(UiStrings().Import))
self.importBibleItem.setVisible(False)
#action_list.remove_action(self.exportBibleItem, UiStrings().Export)
self.exportBibleItem.setVisible(False)
=== modified file 'openlp/plugins/images/lib/mediaitem.py'
--- openlp/plugins/images/lib/mediaitem.py 2011-11-26 20:32:47 +0000
+++ openlp/plugins/images/lib/mediaitem.py 2011-12-09 11:53:27 +0000
@@ -127,13 +127,13 @@
self.plugin.formparent.incrementProgressBar()
filename = os.path.split(unicode(imageFile))[1]
thumb = os.path.join(self.servicePath, filename)
- if not os.path.exists(imageFile):
+ if not os.path.exists(unicode(imageFile)):
icon = build_icon(u':/general/general_delete.png')
else:
- if validate_thumb(imageFile, thumb):
+ if validate_thumb(unicode(imageFile), thumb):
icon = build_icon(thumb)
else:
- icon = create_thumb(imageFile, thumb)
+ icon = create_thumb(unicode(imageFile), thumb)
item_name = QtGui.QListWidgetItem(filename)
item_name.setIcon(icon)
item_name.setToolTip(imageFile)
=== modified file 'openlp/plugins/songs/songsplugin.py'
--- openlp/plugins/songs/songsplugin.py 2011-12-03 13:32:19 +0000
+++ openlp/plugins/songs/songsplugin.py 2011-12-09 11:53:27 +0000
@@ -269,7 +269,10 @@
self.songExportItem.setVisible(False)
self.toolsReindexItem.setVisible(False)
action_list = ActionList.get_instance()
- action_list.remove_action(self.songImportItem, UiStrings().Import)
- action_list.remove_action(self.songExportItem, UiStrings().Export)
- action_list.remove_action(self.toolsReindexItem, UiStrings().Tools)
+ action_list.remove_action(self.songImportItem,
+ unicode(UiStrings().Import))
+ action_list.remove_action(self.songExportItem,
+ unicode(UiStrings().Export))
+ action_list.remove_action(self.toolsReindexItem,
+ unicode(UiStrings().Tools))
Plugin.finalise(self)
=== modified file 'openlp/plugins/songusage/songusageplugin.py'
--- openlp/plugins/songusage/songusageplugin.py 2011-12-03 13:32:19 +0000
+++ openlp/plugins/songusage/songusageplugin.py 2011-12-09 11:53:27 +0000
@@ -157,11 +157,11 @@
self.songUsageMenu.menuAction().setVisible(False)
action_list = ActionList.get_instance()
action_list.remove_action(self.songUsageStatus,
- translate('SongUsagePlugin', 'Song Usage'))
+ unicode(translate('SongUsagePlugin', 'Song Usage')))
action_list.remove_action(self.songUsageDelete,
- translate('SongUsagePlugin', 'Song Usage'))
+ unicode(translate('SongUsagePlugin', 'Song Usage')))
action_list.remove_action(self.songUsageReport,
- translate('SongUsagePlugin', 'Song Usage'))
+ unicode(translate('SongUsagePlugin', 'Song Usage')))
self.songUsageActiveButton.hide()
# stop any events being processed
self.songUsageActive = False
Follow ups