← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~googol/openlp/python3-true-division into lp:openlp

 

Andreas Preikschat has proposed merging lp:~googol/openlp/python3-true-division into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)

For more details, see:
https://code.launchpad.net/~googol/openlp/python3-true-division/+merge/170177

more true division fixes
-- 
https://code.launchpad.net/~googol/openlp/python3-true-division/+merge/170177
Your team OpenLP Core is requested to review the proposed merge of lp:~googol/openlp/python3-true-division into lp:openlp.
=== modified file 'openlp/core/ui/listpreviewwidget.py'
--- openlp/core/ui/listpreviewwidget.py	2013-04-27 20:59:56 +0000
+++ openlp/core/ui/listpreviewwidget.py	2013-06-18 19:34:28 +0000
@@ -30,7 +30,7 @@
 The :mod:`listpreviewwidget` is a widget that lists the slides in the slide controller.
 It is based on a QTableWidget but represents its contents in list form.
 """
-
+from __future__ import division
 from PyQt4 import QtCore, QtGui
 
 from openlp.core.lib import ImageSource, Registry, ServiceItem
@@ -76,7 +76,7 @@
             else:
                 # Sort out image heights.
                 for framenumber in range(len(self.service_item.get_frames())):
-                    height = self.viewport().width() / self.screen_ratio
+                    height = self.viewport().width() // self.screen_ratio
                     self.setRowHeight(framenumber, height)
 
     def screen_size_changed(self, screen_ratio):
@@ -101,7 +101,7 @@
         for framenumber, frame in enumerate(self.service_item.get_frames()):
             self.setRowCount(self.slide_count() + 1)
             item = QtGui.QTableWidgetItem()
-            slideHeight = 0
+            slide_height = 0
             if self.service_item.is_text():
                 if frame[u'verseTag']:
                     # These tags are already translated.
@@ -125,12 +125,12 @@
                     image = self.image_manager.get_image(frame[u'path'], ImageSource.ImagePlugin)
                     label.setPixmap(QtGui.QPixmap.fromImage(image))
                 self.setCellWidget(framenumber, 0, label)
-                slideHeight = width / self.screen_ratio
+                slide_height = width // self.screen_ratio
                 row += 1
             text.append(unicode(row))
             self.setItem(framenumber, 0, item)
-            if slideHeight:
-                self.setRowHeight(framenumber, slideHeight)
+            if slide_height:
+                self.setRowHeight(framenumber, slide_height)
         self.setVerticalHeaderLabels(text)
         if self.service_item.is_text():
             self.resizeRowsToContents()

=== modified file 'openlp/core/ui/pluginform.py'
--- openlp/core/ui/pluginform.py	2013-03-19 20:05:13 +0000
+++ openlp/core/ui/pluginform.py	2013-06-18 19:34:28 +0000
@@ -31,7 +31,7 @@
 """
 import logging
 
-from PyQt4 import QtCore, QtGui
+from PyQt4 import QtGui
 
 from openlp.core.lib import PluginStatus, Registry, translate
 from plugindialog import Ui_PluginViewDialog

=== modified file 'openlp/core/ui/slidecontroller.py'
--- openlp/core/ui/slidecontroller.py	2013-06-16 07:54:16 +0000
+++ openlp/core/ui/slidecontroller.py	2013-06-18 19:34:28 +0000
@@ -29,6 +29,7 @@
 """
 The :mod:`slidecontroller` module contains the most important part of OpenLP - the slide controller
 """
+from __future__ import division
 import os
 import logging
 import copy
@@ -93,7 +94,7 @@
         Registry().register_function(u'bootstrap_post_set_up', self.screen_size_changed)
         self.screens = ScreenList()
         try:
-            self.ratio = float(self.screens.current[u'size'].width()) / float(self.screens.current[u'size'].height())
+            self.ratio = self.screens.current[u'size'].width() / self.screens.current[u'size'].height()
         except ZeroDivisionError:
             self.ratio = 1
         self.loop_list = [
@@ -524,7 +525,7 @@
             self.display.audio_player.connectSlot(QtCore.SIGNAL(u'tick(qint64)'), self.on_audio_time_remaining)
         # The SlidePreview's ratio.
         try:
-            self.ratio = float(self.screens.current[u'size'].width()) / float(self.screens.current[u'size'].height())
+            self.ratio = self.screens.current[u'size'].width() / self.screens.current[u'size'].height()
         except ZeroDivisionError:
             self.ratio = 1
         self.media_controller.setup_display(self.display, False)
@@ -553,7 +554,7 @@
         splitters is moved or when the screen size is changed. Note, that this
         method is (also) called frequently from the mainwindow *paintEvent*.
         """
-        if self.ratio < float(self.preview_frame.width()) / float(self.preview_frame.height()):
+        if self.ratio < self.preview_frame.width() / self.preview_frame.height():
             # We have to take the height as limit.
             max_height = self.preview_frame.height() - self.grid.margin() * 2
             self.slide_preview.setFixedSize(QtCore.QSize(max_height * self.ratio, max_height))
@@ -723,7 +724,7 @@
 
     def _process_item(self, service_item, slideno):
         """
-        Loads a ServiceItem into the system from ServiceManager 
+        Loads a ServiceItem into the system from ServiceManager
         Display the slide number passed
         """
         log.debug(u'processManagerItem live = %s' % self.is_live)


Follow ups