forked from openlp/openlp
python3 division in slidecontroller
This commit is contained in:
parent
8b5e5411c3
commit
62c5908d85
@ -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))
|
||||||
|
Loading…
Reference in New Issue
Block a user