← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~googol/openlp/trivial into lp:openlp

 

Andreas Preikschat has proposed merging lp:~googol/openlp/trivial into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)

For more details, see:
https://code.launchpad.net/~googol/openlp/trivial/+merge/66266

Hello,

- use the functions context_menu_action and context_menu_separator from core/lib/ui 
-- 
https://code.launchpad.net/~googol/openlp/trivial/+merge/66266
Your team OpenLP Core is requested to review the proposed merge of lp:~googol/openlp/trivial into lp:openlp.
=== modified file 'openlp/core/ui/servicemanager.py'
--- openlp/core/ui/servicemanager.py	2011-06-12 16:02:52 +0000
+++ openlp/core/ui/servicemanager.py	2011-06-29 09:31:20 +0000
@@ -688,7 +688,7 @@
                     QtGui.QAction, serviceItem[u'service_item'].theme)
             if themeAction is not None:
                 themeAction.setChecked(True)
-        action = self.menu.exec_(self.serviceManagerList.mapToGlobal(point))
+        self.menu.exec_(self.serviceManagerList.mapToGlobal(point))
 
     def onServiceItemNoteForm(self):
         item = self.findServiceItem()[0]

=== modified file 'openlp/core/ui/thememanager.py'
--- openlp/core/ui/thememanager.py	2011-06-26 19:34:01 +0000
+++ openlp/core/ui/thememanager.py	2011-06-29 09:31:20 +0000
@@ -39,7 +39,8 @@
     check_directory_exists
 from openlp.core.lib.theme import ThemeXML, BackgroundType, VerticalType, \
     BackgroundGradientType
-from openlp.core.lib.ui import UiStrings, critical_error_message_box
+from openlp.core.lib.ui import UiStrings, critical_error_message_box, \
+    context_menu_action, context_menu_separator
 from openlp.core.theme import Theme
 from openlp.core.ui import FileRenameForm, ThemeForm
 from openlp.core.utils import AppLocation, delete_file, file_is_unicode, \
@@ -104,25 +105,29 @@
             self.contextMenu)
         # build the context menu
         self.menu = QtGui.QMenu()
-        self.editAction = self.menu.addAction(
-            translate('OpenLP.ThemeManager', '&Edit Theme'))
-        self.editAction.setIcon(build_icon(u':/themes/theme_edit.png'))
-        self.copyAction = self.menu.addAction(
-            translate('OpenLP.ThemeManager', '&Copy Theme'))
-        self.copyAction.setIcon(build_icon(u':/themes/theme_edit.png'))
-        self.renameAction = self.menu.addAction(
-            translate('OpenLP.ThemeManager', '&Rename Theme'))
-        self.renameAction.setIcon(build_icon(u':/themes/theme_edit.png'))
-        self.deleteAction = self.menu.addAction(
-            translate('OpenLP.ThemeManager', '&Delete Theme'))
-        self.deleteAction.setIcon(build_icon(u':/general/general_delete.png'))
-        self.separator = self.menu.addSeparator()
-        self.globalAction = self.menu.addAction(
-            translate('OpenLP.ThemeManager', 'Set As &Global Default'))
-        self.globalAction.setIcon(build_icon(u':/general/general_export.png'))
-        self.exportAction = self.menu.addAction(
-            translate('OpenLP.ThemeManager', '&Export Theme'))
-        self.exportAction.setIcon(build_icon(u':/general/general_export.png'))
+        self.editAction = context_menu_action(
+            self.menu, u':/themes/theme_edit.png',
+            translate('OpenLP.ThemeManager', '&Edit Theme'), self.onEditTheme)
+        self.copyAction = context_menu_action(
+            self.menu, u':/themes/theme_edit.png',
+            translate('OpenLP.ThemeManager', '&Copy Theme'), self.onCopyTheme)
+        self.renameAction = context_menu_action(
+            self.menu, u':/themes/theme_edit.png',
+            translate('OpenLP.ThemeManager', '&Rename Theme'),
+            self.onRenameTheme)
+        self.deleteAction = context_menu_action(
+            self.menu, u':/general/general_delete.png',
+            translate('OpenLP.ThemeManager', '&Delete Theme'),
+            self.onDeleteTheme)
+        context_menu_separator(self.menu)
+        self.globalAction = context_menu_action(
+            self.menu, u':/general/general_export.png',
+            translate('OpenLP.ThemeManager', 'Set As &Global Default'),
+            self.changeGlobalFromScreen)
+        self.exportAction = context_menu_action(
+            self.menu, u':/general/general_export.png',
+            translate('OpenLP.ThemeManager', '&Export Theme'),
+            self.onExportTheme)
         # Signals
         QtCore.QObject.connect(self.themeListWidget,
             QtCore.SIGNAL(u'doubleClicked(QModelIndex)'),
@@ -198,19 +203,7 @@
             self.deleteAction.setVisible(True)
             self.renameAction.setVisible(True)
             self.globalAction.setVisible(True)
-        action = self.menu.exec_(self.themeListWidget.mapToGlobal(point))
-        if action == self.editAction:
-            self.onEditTheme()
-        if action == self.copyAction:
-            self.onCopyTheme()
-        if action == self.renameAction:
-            self.onRenameTheme()
-        if action == self.deleteAction:
-            self.onDeleteTheme()
-        if action == self.globalAction:
-            self.changeGlobalFromScreen()
-        if action == self.exportAction:
-            self.onExportTheme()
+        self.menu.exec_(self.themeListWidget.mapToGlobal(point))
 
     def changeGlobalFromTab(self, themeName):
         """


Follow ups