forked from openlp/openlp
python3 division fixes
bzr-revno: 2254
This commit is contained in:
commit
2fddcf61b8
@ -30,7 +30,7 @@
|
|||||||
The :mod:`listpreviewwidget` is a widget that lists the slides in the slide controller.
|
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.
|
It is based on a QTableWidget but represents its contents in list form.
|
||||||
"""
|
"""
|
||||||
|
from __future__ import division
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import ImageSource, Registry, ServiceItem
|
from openlp.core.lib import ImageSource, Registry, ServiceItem
|
||||||
@ -76,7 +76,7 @@ class ListPreviewWidget(QtGui.QTableWidget):
|
|||||||
else:
|
else:
|
||||||
# Sort out image heights.
|
# Sort out image heights.
|
||||||
for framenumber in range(len(self.service_item.get_frames())):
|
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)
|
self.setRowHeight(framenumber, height)
|
||||||
|
|
||||||
def screen_size_changed(self, screen_ratio):
|
def screen_size_changed(self, screen_ratio):
|
||||||
@ -101,7 +101,7 @@ class ListPreviewWidget(QtGui.QTableWidget):
|
|||||||
for framenumber, frame in enumerate(self.service_item.get_frames()):
|
for framenumber, frame in enumerate(self.service_item.get_frames()):
|
||||||
self.setRowCount(self.slide_count() + 1)
|
self.setRowCount(self.slide_count() + 1)
|
||||||
item = QtGui.QTableWidgetItem()
|
item = QtGui.QTableWidgetItem()
|
||||||
slideHeight = 0
|
slide_height = 0
|
||||||
if self.service_item.is_text():
|
if self.service_item.is_text():
|
||||||
if frame[u'verseTag']:
|
if frame[u'verseTag']:
|
||||||
# These tags are already translated.
|
# These tags are already translated.
|
||||||
@ -125,12 +125,12 @@ class ListPreviewWidget(QtGui.QTableWidget):
|
|||||||
image = self.image_manager.get_image(frame[u'path'], ImageSource.ImagePlugin)
|
image = self.image_manager.get_image(frame[u'path'], ImageSource.ImagePlugin)
|
||||||
label.setPixmap(QtGui.QPixmap.fromImage(image))
|
label.setPixmap(QtGui.QPixmap.fromImage(image))
|
||||||
self.setCellWidget(framenumber, 0, label)
|
self.setCellWidget(framenumber, 0, label)
|
||||||
slideHeight = width / self.screen_ratio
|
slide_height = width // self.screen_ratio
|
||||||
row += 1
|
row += 1
|
||||||
text.append(unicode(row))
|
text.append(unicode(row))
|
||||||
self.setItem(framenumber, 0, item)
|
self.setItem(framenumber, 0, item)
|
||||||
if slideHeight:
|
if slide_height:
|
||||||
self.setRowHeight(framenumber, slideHeight)
|
self.setRowHeight(framenumber, slide_height)
|
||||||
self.setVerticalHeaderLabels(text)
|
self.setVerticalHeaderLabels(text)
|
||||||
if self.service_item.is_text():
|
if self.service_item.is_text():
|
||||||
self.resizeRowsToContents()
|
self.resizeRowsToContents()
|
||||||
|
@ -31,7 +31,7 @@ The actual plugin view form
|
|||||||
"""
|
"""
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtGui
|
||||||
|
|
||||||
from openlp.core.lib import PluginStatus, Registry, translate
|
from openlp.core.lib import PluginStatus, Registry, translate
|
||||||
from plugindialog import Ui_PluginViewDialog
|
from plugindialog import Ui_PluginViewDialog
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
"""
|
"""
|
||||||
The :mod:`slidecontroller` module contains the most important part of OpenLP - the slide controller
|
The :mod:`slidecontroller` module contains the most important part of OpenLP - the slide controller
|
||||||
"""
|
"""
|
||||||
|
from __future__ import division
|
||||||
import os
|
import os
|
||||||
import logging
|
import logging
|
||||||
import copy
|
import copy
|
||||||
@ -93,7 +94,7 @@ class SlideController(DisplayController):
|
|||||||
Registry().register_function(u'bootstrap_post_set_up', self.screen_size_changed)
|
Registry().register_function(u'bootstrap_post_set_up', self.screen_size_changed)
|
||||||
self.screens = ScreenList()
|
self.screens = ScreenList()
|
||||||
try:
|
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:
|
except ZeroDivisionError:
|
||||||
self.ratio = 1
|
self.ratio = 1
|
||||||
self.loop_list = [
|
self.loop_list = [
|
||||||
@ -524,7 +525,7 @@ class SlideController(DisplayController):
|
|||||||
self.display.audio_player.connectSlot(QtCore.SIGNAL(u'tick(qint64)'), self.on_audio_time_remaining)
|
self.display.audio_player.connectSlot(QtCore.SIGNAL(u'tick(qint64)'), self.on_audio_time_remaining)
|
||||||
# The SlidePreview's ratio.
|
# The SlidePreview's ratio.
|
||||||
try:
|
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:
|
except ZeroDivisionError:
|
||||||
self.ratio = 1
|
self.ratio = 1
|
||||||
self.media_controller.setup_display(self.display, False)
|
self.media_controller.setup_display(self.display, False)
|
||||||
@ -553,7 +554,7 @@ class SlideController(DisplayController):
|
|||||||
splitters is moved or when the screen size is changed. Note, that this
|
splitters is moved or when the screen size is changed. Note, that this
|
||||||
method is (also) called frequently from the mainwindow *paintEvent*.
|
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.
|
# We have to take the height as limit.
|
||||||
max_height = self.preview_frame.height() - self.grid.margin() * 2
|
max_height = self.preview_frame.height() - self.grid.margin() * 2
|
||||||
self.slide_preview.setFixedSize(QtCore.QSize(max_height * self.ratio, max_height))
|
self.slide_preview.setFixedSize(QtCore.QSize(max_height * self.ratio, max_height))
|
||||||
@ -723,7 +724,7 @@ class SlideController(DisplayController):
|
|||||||
|
|
||||||
def _process_item(self, service_item, slideno):
|
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
|
Display the slide number passed
|
||||||
"""
|
"""
|
||||||
log.debug(u'processManagerItem live = %s' % self.is_live)
|
log.debug(u'processManagerItem live = %s' % self.is_live)
|
||||||
|
Loading…
Reference in New Issue
Block a user