← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~trb143/openlp/alpha3 into lp:openlp

 

Tim Bentley has proposed merging lp:~trb143/openlp/alpha3 into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)


bug 594909 - Theme needs a "Save As"
-- 
https://code.launchpad.net/~trb143/openlp/alpha3/+merge/29606
Your team OpenLP Core is requested to review the proposed merge of lp:~trb143/openlp/alpha3 into lp:openlp.
=== modified file 'openlp/core/ui/amendthemedialog.py'
--- openlp/core/ui/amendthemedialog.py	2010-07-06 12:58:33 +0000
+++ openlp/core/ui/amendthemedialog.py	2010-07-09 19:52:44 +0000
@@ -646,13 +646,20 @@
             QtGui.QDialogButtonBox.Ok)
         self.ThemeButtonBox.setObjectName(u'ThemeButtonBox')
         self.AmendThemeLayout.addWidget(self.ThemeButtonBox)
-
+        self.SaveAsButton = QtGui.QPushButton(
+            translate('AmendThemeForm','Save &as'))
+        self.SaveAsButton.setCheckable(True)
+        self.SaveAsButton.setAutoDefault(False)
+        self.ThemeButtonBox.addButton(self.SaveAsButton,
+            QtGui.QDialogButtonBox.ActionRole)
         self.retranslateUi(AmendThemeDialog)
         self.ThemeTabWidget.setCurrentIndex(0)
         QtCore.QObject.connect(self.ThemeButtonBox,
             QtCore.SIGNAL(u'accepted()'), AmendThemeDialog.accept)
         QtCore.QObject.connect(self.ThemeButtonBox,
             QtCore.SIGNAL(u'rejected()'), AmendThemeDialog.reject)
+        QtCore.QObject.connect(self.SaveAsButton,
+            QtCore.SIGNAL(u'clicked()'), AmendThemeDialog.saveAs)
         QtCore.QMetaObject.connectSlotsByName(AmendThemeDialog)
         AmendThemeDialog.setTabOrder(self.ThemeButtonBox, self.ThemeNameEdit)
         AmendThemeDialog.setTabOrder(self.ThemeNameEdit, self.ThemeTabWidget)
@@ -848,19 +855,19 @@
             translate('AmendThemeForm', 'Alignment'))
         self.HorizontalLabel.setText(
             translate('AmendThemeForm', 'Horizontal align:'))
-        self.HorizontalComboBox.setItemText(0, 
+        self.HorizontalComboBox.setItemText(0,
             translate('AmendThemeForm', 'Left'))
-        self.HorizontalComboBox.setItemText(1, 
+        self.HorizontalComboBox.setItemText(1,
             translate('AmendThemeForm', 'Right'))
-        self.HorizontalComboBox.setItemText(2, 
+        self.HorizontalComboBox.setItemText(2,
             translate('AmendThemeForm', 'Center'))
         self.VerticalLabel.setText(
             translate('AmendThemeForm', 'Vertical align:'))
-        self.VerticalComboBox.setItemText(0, 
+        self.VerticalComboBox.setItemText(0,
             translate('AmendThemeForm', 'Top'))
-        self.VerticalComboBox.setItemText(1, 
+        self.VerticalComboBox.setItemText(1,
             translate('AmendThemeForm', 'Middle'))
-        self.VerticalComboBox.setItemText(2, 
+        self.VerticalComboBox.setItemText(2,
             translate('AmendThemeForm', 'Bottom'))
         self.TransitionGroupBox.setTitle(
             translate('AmendThemeForm', 'Slide Transition'))

=== modified file 'openlp/core/ui/amendthemeform.py'
--- openlp/core/ui/amendthemeform.py	2010-07-06 12:58:33 +0000
+++ openlp/core/ui/amendthemeform.py	2010-07-09 19:52:44 +0000
@@ -137,6 +137,12 @@
             QtCore.SIGNAL(u'stateChanged(int)'),
             self.onSlideTransitionCheckBoxChanged)
 
+    def saveAs(self):
+        self.ThemeNameEdit.setEnabled(True)
+        self.SaveAsButton.setEnabled(False)
+        self.ThemeNameEdit.setText(u'')
+        self.ThemeNameEdit.setFocus()
+
     def accept(self):
         new_theme = ThemeXML()
         theme_name = unicode(self.ThemeNameEdit.text())
@@ -200,7 +206,7 @@
             save_from, save_to) is not False:
             return QtGui.QDialog.accept(self)
 
-    def loadTheme(self, theme):
+    def loadTheme(self, theme, newTheme=False):
         log.debug(u'LoadTheme %s', theme)
         self.theme = theme
         # Stop the initial screen setup generating 1 preview per field!
@@ -208,6 +214,12 @@
         self.paintUi(self.theme)
         self.allowPreview = True
         self.previewTheme()
+        self.ThemeNameEdit.setEnabled(True)
+        self.SaveAsButton.setEnabled(False)
+        if not newTheme:
+            self.ThemeNameEdit.setEnabled(False)
+            self.SaveAsButton.setEnabled(True)
+
 
     def onImageToolButtonClicked(self):
         images_filter = get_images_filter()

=== modified file 'openlp/core/ui/thememanager.py'
--- openlp/core/ui/thememanager.py	2010-07-05 16:00:48 +0000
+++ openlp/core/ui/thememanager.py	2010-07-09 19:52:44 +0000
@@ -173,7 +173,7 @@
         editing form for the user to make their customisations.
         """
         theme = self.createThemeFromXml(self.baseTheme(), self.path)
-        self.amendThemeForm.loadTheme(theme)
+        self.amendThemeForm.loadTheme(theme, True)
         self.saveThemeName = u''
         self.amendThemeForm.exec_()