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

    Requested reviews:
    OpenLP Core (openlp-core)


Added new theme features.
Line wrap indentation and display number of lines in a theme
-- 
https://code.launchpad.net/~trb143/openlp/fixes/+merge/13800
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/lib/renderer.py'
--- openlp/core/lib/renderer.py	2009-10-19 14:56:44 +0000
+++ openlp/core/lib/renderer.py	2009-10-22 19:10:23 +0000
@@ -196,6 +196,10 @@
                         split_text = line[:pos]
                 split_lines.append(split_text)
                 line = line[pos:]
+                #if we have more text add up to 10 spaces on the front.
+                if len(line) > 0 :
+                    line = u'%s%s' % \
+                        (u'          '[:self._theme.font_main_indentation], line)
                 #Text fits in a line now
         for line in split_lines:
             page.append(line)

=== modified file 'openlp/core/lib/themexmlhandler.py'
--- openlp/core/lib/themexmlhandler.py	2009-10-18 07:49:47 +0000
+++ openlp/core/lib/themexmlhandler.py	2009-10-22 19:10:23 +0000
@@ -51,6 +51,7 @@
       <proportion>30</proportion>
       <weight>Normal</weight>
       <italics>False</italics>
+      <indentation>0</indentation>
       <location override="False" x="0" y="0" width="0" height="0"/>
    </font>
    <font type="footer">
@@ -59,6 +60,7 @@
       <proportion>12</proportion>
       <weight>Normal</weight>
       <italics>False</italics>
+      <indentation>0</indentation>
       <location override="False" x="0" y="0" width="0" height="0"/>
    </font>
    <display>
@@ -167,7 +169,7 @@
         self.child_element(background, u'filename', filename)
 
     def add_font(self, name, color, proportion, override, fonttype=u'main',
-        weight=u'Normal', italics=u'False', xpos=0, ypos=0, width=0, height=0):
+        weight=u'Normal', italics=u'False', indentation=0, xpos=0, ypos=0, width=0, height=0):
         """
         Add a Font.
 
@@ -192,6 +194,9 @@
         ``italics``
             Does the font render to italics Defaults to 0 Normal
 
+        ``indentation``
+            Number of characters the wrap line is indented
+
         ``xpos``
             The X position of the text block.
 
@@ -217,6 +222,9 @@
         self.child_element(background, u'weight', weight)
         #Create italics name element
         self.child_element(background, u'italics', italics)
+        #Create indentation name element
+        self.child_element(background, u'indentation', unicode(indentation))
+
         #Create Location element
         element = self.theme_xml.createElement(u'location')
         element.setAttribute(u'override',override)

=== modified file 'openlp/core/ui/amendthemedialog.py'
--- openlp/core/ui/amendthemedialog.py	2009-10-01 23:43:16 +0000
+++ openlp/core/ui/amendthemedialog.py	2009-10-22 19:10:23 +0000
@@ -177,6 +177,16 @@
         self.FontMainWeightLabel.setObjectName("FontMainWeightLabel")
         self.MainFontLayout.setWidget(3, QtGui.QFormLayout.LabelRole, self.FontMainWeightLabel)
         self.MainLeftLayout.addWidget(self.FontMainGroupBox)
+        self.FontMainWrapIndentationLabel = QtGui.QLabel(self.FontMainGroupBox)
+        self.FontMainWrapIndentationLabel.setObjectName("FontMainWrapIndentationLabel")
+        self.MainFontLayout.setWidget(4, QtGui.QFormLayout.LabelRole, self.FontMainWrapIndentationLabel)
+        self.FontMainLineSpacingSpinBox = QtGui.QSpinBox(self.FontMainGroupBox)
+        self.FontMainLineSpacingSpinBox.setObjectName("FontMainLineSpacingSpinBox")
+        self.FontMainLineSpacingSpinBox.setMaximum(10)
+        self.MainFontLayout.setWidget(4, QtGui.QFormLayout.FieldRole, self.FontMainLineSpacingSpinBox)
+        self.FontMainLinesPageLabel = QtGui.QLabel(self.FontMainGroupBox)
+        self.FontMainLinesPageLabel.setObjectName("FontMainLinesPageLabel")
+        self.MainFontLayout.setWidget(5, QtGui.QFormLayout.LabelRole, self.FontMainLinesPageLabel)
         spacerItem1 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
         self.MainLeftLayout.addItem(spacerItem1)
         self.FontMainLayout.addWidget(self.MainLeftWidget)
@@ -528,7 +538,9 @@
         AmendThemeDialog.setTabOrder(self.GradientComboBox, self.FontMainComboBox)
         AmendThemeDialog.setTabOrder(self.FontMainComboBox, self.FontMainColorPushButton)
         AmendThemeDialog.setTabOrder(self.FontMainColorPushButton, self.FontMainSizeSpinBox)
-        AmendThemeDialog.setTabOrder(self.FontMainSizeSpinBox, self.FontMainDefaultCheckBox)
+        AmendThemeDialog.setTabOrder(self.FontMainSizeSpinBox, self.FontMainWeightComboBox)
+        AmendThemeDialog.setTabOrder(self.FontMainWeightComboBox, self.FontMainLineSpacingSpinBox)
+        AmendThemeDialog.setTabOrder(self.FontMainLineSpacingSpinBox, self.FontMainDefaultCheckBox)
         AmendThemeDialog.setTabOrder(self.FontMainDefaultCheckBox, self.FontMainXSpinBox)
         AmendThemeDialog.setTabOrder(self.FontMainXSpinBox, self.FontMainYSpinBox)
         AmendThemeDialog.setTabOrder(self.FontMainYSpinBox, self.FontMainWidthSpinBox)
@@ -536,7 +548,8 @@
         AmendThemeDialog.setTabOrder(self.FontMainHeightSpinBox, self.FontFooterComboBox)
         AmendThemeDialog.setTabOrder(self.FontFooterComboBox, self.FontFooterColorPushButton)
         AmendThemeDialog.setTabOrder(self.FontFooterColorPushButton, self.FontFooterSizeSpinBox)
-        AmendThemeDialog.setTabOrder(self.FontFooterSizeSpinBox, self.FontFooterDefaultCheckBox)
+        AmendThemeDialog.setTabOrder(self.FontFooterSizeSpinBox, self.FontFooterWeightComboBox)
+        AmendThemeDialog.setTabOrder(self.FontFooterWeightComboBox, self.FontFooterDefaultCheckBox)
         AmendThemeDialog.setTabOrder(self.FontFooterDefaultCheckBox, self.FontFooterXSpinBox)
         AmendThemeDialog.setTabOrder(self.FontFooterXSpinBox, self.FontFooterYSpinBox)
         AmendThemeDialog.setTabOrder(self.FontFooterYSpinBox, self.FontFooterWidthSpinBox)
@@ -571,10 +584,11 @@
         self.FontMainColorLabel.setText(translate(u'AmendThemeDialog', u'Font Color:'))
         self.FontMainSize.setText(translate(u'AmendThemeDialog', u'Size:'))
         self.FontMainSizeSpinBox.setSuffix(translate(u'AmendThemeDialog', u'pt'))
-        self.FontMainWeightComboBox.setItemText(0, translate("AmendThemeDialog", u'Normal'))
-        self.FontMainWeightComboBox.setItemText(1, translate("AmendThemeDialog", u'Bold'))
-        self.FontMainWeightComboBox.setItemText(2, translate("AmendThemeDialog", u'Italics'))
-        self.FontMainWeightComboBox.setItemText(3, translate("AmendThemeDialog", u'Bold/Italics'))
+        self.FontMainWrapIndentationLabel.setText(translate(u'AmendThemeDialog', u'Wrap Indentation'))
+        self.FontMainWeightComboBox.setItemText(0, translate(u'AmendThemeDialog', u'Normal'))
+        self.FontMainWeightComboBox.setItemText(1, translate(u'AmendThemeDialog', u'Bold'))
+        self.FontMainWeightComboBox.setItemText(2, translate(u'AmendThemeDialog', u'Italics'))
+        self.FontMainWeightComboBox.setItemText(3, translate(u'AmendThemeDialog', u'Bold/Italics'))
         self.FontMainWeightLabel.setText(translate("AmendThemeDialog", u'Font Weight:'))
         self.MainLocationGroupBox.setTitle(translate(u'AmendThemeDialog', u'Display Location'))
         self.DefaultLocationLabel.setText(translate(u'AmendThemeDialog', u'Use Default Location:'))

=== modified file 'openlp/core/ui/amendthemeform.py'
--- openlp/core/ui/amendthemeform.py	2009-09-26 18:22:10 +0000
+++ openlp/core/ui/amendthemeform.py	2009-10-22 19:10:23 +0000
@@ -100,6 +100,9 @@
         QtCore.QObject.connect(self.FontMainHeightSpinBox,
             QtCore.SIGNAL(u'editingFinished()'),
             self.onFontMainHeightSpinBoxChanged)
+        QtCore.QObject.connect(self.FontMainLineSpacingSpinBox,
+            QtCore.SIGNAL(u'editingFinished()'),
+            self.onFontMainLineSpacingSpinBoxChanged)
         QtCore.QObject.connect(self.FontFooterDefaultCheckBox,
             QtCore.SIGNAL(u'stateChanged(int)'),
             self.onFontFooterDefaultCheckBoxChanged)
@@ -150,6 +153,7 @@
                 unicode(self.theme.font_main_override), u'main',
                 unicode(self.theme.font_main_weight),
                 unicode(self.theme.font_main_italics),
+                unicode(self.theme.font_main_indentation),
                 unicode(self.theme.font_main_x),
                 unicode(self.theme.font_main_y),
                 unicode(self.theme.font_main_width),
@@ -160,6 +164,7 @@
                 unicode(self.theme.font_footer_override), u'footer',
                 unicode(self.theme.font_footer_weight),
                 unicode(self.theme.font_footer_italics),
+                0,
                 unicode(self.theme.font_footer_x),
                 unicode(self.theme.font_footer_y),
                 unicode(self.theme.font_footer_width),
@@ -187,6 +192,7 @@
             self.theme.parse(xml)
             self.theme.extend_image_filename(self.path)
         self.thememanager.cleanTheme(self.theme)
+        # Stop the initial screen setup generating 1 preview per field!
         self.allowPreview = False
         self.paintUi(self.theme)
         self.allowPreview = True
@@ -252,6 +258,8 @@
             self.FontMainWidthSpinBox.setValue(int(self.theme.font_main_width))
             self.FontMainHeightSpinBox.setValue(int( \
                 self.theme.font_main_height))
+            self.FontMainLineSpacingSpinBox.setValue(int( \
+                self.theme.font_main_indentation))
         self.stateChanging(self.theme)
         self.previewTheme(self.theme)
 
@@ -270,6 +278,11 @@
             self.theme.font_main_width = self.FontMainWidthSpinBox.value()
             self.previewTheme(self.theme)
 
+    def onFontMainLineSpacingSpinBoxChanged(self):
+        if self.theme.font_main_indentation != self.FontMainLineSpacingSpinBox.value():
+            self.theme.font_main_indentation = self.FontMainLineSpacingSpinBox.value()
+            self.previewTheme(self.theme)
+
     def onFontMainHeightSpinBoxChanged(self):
         if self.theme.font_main_height != self.FontMainHeightSpinBox.value():
             self.theme.font_main_height = self.FontMainHeightSpinBox.value()
@@ -498,7 +511,7 @@
             self.FontMainWeightComboBox.setCurrentIndex(2)
         else:
             self.FontMainWeightComboBox.setCurrentIndex(3)
-
+        self.FontMainLineSpacingSpinBox.setValue(int(self.theme.font_main_indentation))
         self.FontMainXSpinBox.setValue(int(self.theme.font_main_x))
         self.FontMainYSpinBox.setValue(int(self.theme.font_main_y))
         self.FontMainWidthSpinBox.setValue(int(self.theme.font_main_width))
@@ -653,5 +666,17 @@
 
     def previewTheme(self, theme):
         if self.allowPreview:
+            #calculate main number of rows
+            main_weight = 50
+            if self.theme.font_main_weight == u'Bold':
+                main_weight = 75
+            mainFont = QtGui.QFont(self.theme.font_main_name,
+                         int(self.theme.font_main_proportion), # size
+                         int(main_weight), # weight
+                         self.theme.font_main_italics)# italic
+            metrics = QtGui.QFontMetrics(mainFont)
+            page_length = (int(self.FontMainHeightSpinBox.value()) / metrics.height() - 2 ) - 1
+            self.FontMainLinesPageLabel.setText(
+                translate(u'ThemeManager', u'Slide Height is %s rows' % page_length  ))
             frame = self.thememanager.generateImage(theme)
             self.ThemePreview.setPixmap(QtGui.QPixmap.fromImage(frame))

=== modified file 'openlp/core/ui/thememanager.py'
--- openlp/core/ui/thememanager.py	2009-10-19 17:17:38 +0000
+++ openlp/core/ui/thememanager.py	2009-10-22 19:10:23 +0000
@@ -510,6 +510,7 @@
         theme.font_main_color = theme.font_main_color.strip()
         theme.font_main_height = theme.font_main_height.strip()
         theme.font_main_italics = str_to_bool(theme.font_main_italics)
+        theme.font_main_indentation = int(theme.font_main_indentation)
         theme.font_main_name = theme.font_main_name.strip()
         #theme.font_main_override
         theme.font_main_proportion = theme.font_main_proportion.strip()

=== modified file 'resources/forms/amendthemedialog.ui'
--- resources/forms/amendthemedialog.ui	2009-04-21 19:45:50 +0000
+++ resources/forms/amendthemedialog.ui	2009-10-22 19:10:23 +0000
@@ -17,7 +17,7 @@
    <string>Theme Maintance</string>
   </property>
   <property name="windowIcon">
-   <iconset resource="../images/openlp-2.qrc">
+   <iconset>
     <normaloff>:/icon/openlp.org-icon-32.bmp</normaloff>:/icon/openlp.org-icon-32.bmp</iconset>
   </property>
   <property name="modal">
@@ -64,7 +64,7 @@
       <item>
        <widget class="QTabWidget" name="ThemeTabWidget">
         <property name="currentIndex">
-         <number>0</number>
+         <number>2</number>
         </property>
         <widget class="QWidget" name="BackgroundTab">
          <attribute name="title">
@@ -312,14 +312,31 @@
                     <height>0</height>
                    </size>
                   </property>
+                  <property name="suffix">
+                   <string>pt</string>
+                  </property>
+                  <property name="maximum">
+                   <number>999</number>
+                  </property>
                   <property name="value">
                    <number>16</number>
                   </property>
-                  <property name="suffix">
-                   <string>pt</string>
+                 </widget>
+                </item>
+                <item row="3" column="0">
+                 <widget class="QLabel" name="FontMainWrapIndentationLabel">
+                  <property name="text">
+                   <string>Wrap Indentation</string>
                   </property>
-                  <property name="maximum">
-                   <number>999</number>
+                 </widget>
+                </item>
+                <item row="3" column="1">
+                 <widget class="QSpinBox" name="FontMainLineSpacingSpinBox"/>
+                </item>
+                <item row="4" column="0" colspan="2">
+                 <widget class="QLabel" name="FontMainLinesPageLabel">
+                  <property name="text">
+                   <string>TextLabel</string>
                   </property>
                  </widget>
                 </item>
@@ -425,15 +442,15 @@
                     <height>0</height>
                    </size>
                   </property>
-                  <property name="value">
-                   <number>0</number>
-                  </property>
                   <property name="suffix">
                    <string>px</string>
                   </property>
                   <property name="maximum">
                    <number>9999</number>
                   </property>
+                  <property name="value">
+                   <number>0</number>
+                  </property>
                  </widget>
                 </item>
                 <item row="2" column="1">
@@ -609,15 +626,15 @@
                     <height>0</height>
                    </size>
                   </property>
+                  <property name="suffix">
+                   <string>pt</string>
+                  </property>
+                  <property name="maximum">
+                   <number>999</number>
+                  </property>
                   <property name="value">
                    <number>10</number>
                   </property>
-                  <property name="suffix">
-                   <string>pt</string>
-                  </property>
-                  <property name="maximum">
-                   <number>999</number>
-                  </property>
                  </widget>
                 </item>
                </layout>
@@ -728,15 +745,15 @@
                     <height>0</height>
                    </size>
                   </property>
-                  <property name="value">
-                   <number>0</number>
-                  </property>
                   <property name="suffix">
                    <string>px</string>
                   </property>
                   <property name="maximum">
                    <number>9999</number>
                   </property>
+                  <property name="value">
+                   <number>0</number>
+                  </property>
                  </widget>
                 </item>
                 <item row="2" column="1">
@@ -753,15 +770,15 @@
                     <height>0</height>
                    </size>
                   </property>
-                  <property name="value">
-                   <number>0</number>
-                  </property>
                   <property name="suffix">
                    <string>px</string>
                   </property>
                   <property name="maximum">
                    <number>9999</number>
                   </property>
+                  <property name="value">
+                   <number>0</number>
+                  </property>
                  </widget>
                 </item>
                 <item row="3" column="1">

_______________________________________________
Mailing list: https://launchpad.net/~openlp-core
Post to     : openlp-core@lists.launchpad.net
Unsubscribe : https://launchpad.net/~openlp-core
More help   : https://help.launchpad.net/ListHelp

Reply via email to