From 1603bfb705ccc12d92729eb05f0e1ee324ad18f8 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sun, 28 Nov 2021 14:13:28 +0000 Subject: [PATCH] OpenLP not running due to various Float / Int issues. --- openlp/core/ui/mainwindow.py | 5 ++++- openlp/core/ui/slidecontroller.py | 2 +- openlp/core/ui/themeform.py | 16 ++++++++-------- openlp/core/widgets/layouts.py | 6 +++--- openlp/core/widgets/views.py | 4 ++-- 5 files changed, 18 insertions(+), 15 deletions(-) diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 768c74269..0055702fd 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -642,6 +642,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow, LogMixin, RegistryPropert # We have -disable-web-security added by our code. # If a file is passed in we will have that as well so count of 2 # If not we need to see if we want to use the previous file.so count of 1 + self.log_info(self.application.args) if self.application.args and len(self.application.args) > 1: self.open_cmd_line_files(self.application.args) elif self.settings.value('core/auto open'): @@ -1408,9 +1409,11 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow, LogMixin, RegistryPropert """ Open files passed in through command line arguments - :param list[str] args: List of remaining positionall arguments + :param list[str] args: List of remaining positional arguments """ for arg in args: + self.log_info(arg) file_name = os.path.expanduser(arg) if os.path.isfile(file_name): + self.log_info("File name found") self.service_manager_contents.load_file(Path(file_name)) diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index 14c97bc95..4fa0b32a7 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -432,7 +432,7 @@ class SlideController(QtWidgets.QWidget, LogMixin, RegistryProperties): self.toolbar.set_widget_visible('song_menu', False) # Screen preview area self.preview_frame = QtWidgets.QFrame(self.splitter) - self.preview_frame.setGeometry(QtCore.QRect(0, 0, 300, 300 * self.ratio)) + self.preview_frame.setGeometry(QtCore.QRect(0, 0, 300, int(300 * self.ratio))) self.preview_frame.setMinimumHeight(100) self.preview_frame.setSizePolicy(QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Ignored, QtWidgets.QSizePolicy.Ignored, diff --git a/openlp/core/ui/themeform.py b/openlp/core/ui/themeform.py index a766d61d3..950a46d7b 100644 --- a/openlp/core/ui/themeform.py +++ b/openlp/core/ui/themeform.py @@ -309,16 +309,16 @@ class ThemeForm(QtWidgets.QWizard, Ui_ThemeWizard, RegistryProperties): """ # Main Area self.area_position_page.use_main_default_location = not self.theme.font_main_override - self.area_position_page.main_x = self.theme.font_main_x - self.area_position_page.main_y = self.theme.font_main_y - self.area_position_page.main_height = self.theme.font_main_height - self.area_position_page.main_width = self.theme.font_main_width + self.area_position_page.main_x = int(self.theme.font_main_x) + self.area_position_page.main_y = int(self.theme.font_main_y) + self.area_position_page.main_height = int(self.theme.font_main_height) + self.area_position_page.main_width = int(self.theme.font_main_width) # Footer self.area_position_page.use_footer_default_location = not self.theme.font_footer_override - self.area_position_page.footer_x = self.theme.font_footer_x - self.area_position_page.footer_y = self.theme.font_footer_y - self.area_position_page.footer_height = self.theme.font_footer_height - self.area_position_page.footer_width = self.theme.font_footer_width + self.area_position_page.footer_x = int(self.theme.font_footer_x) + self.area_position_page.footer_y = int(self.theme.font_footer_y) + self.area_position_page.footer_height = int(self.theme.font_footer_height) + self.area_position_page.footer_width = int(self.theme.font_footer_width) def set_alignment_page_values(self): """ diff --git a/openlp/core/widgets/layouts.py b/openlp/core/widgets/layouts.py index 4e51c9159..b76d5301e 100644 --- a/openlp/core/widgets/layouts.py +++ b/openlp/core/widgets/layouts.py @@ -158,7 +158,7 @@ class AspectRatioLayout(QtWidgets.QLayout): y = rect.height() - self.margin - height else: y = self.margin + (available_height - height) / 2 - widget.setGeometry(rect.x() + self.margin, rect.y() + y, width, height) + widget.setGeometry(int(rect.x() + self.margin), int(rect.y() + y), int(width), int(height)) else: if self._item.alignment() & QtCore.Qt.AlignLeft: x = self.margin @@ -166,8 +166,8 @@ class AspectRatioLayout(QtWidgets.QLayout): x = rect.width() - self.margin - width else: x = self.margin + (available_width - width) / 2 - widget.setGeometry(rect.x() + int(x), rect.y() + self.margin, width, height) - self.resize.emit(QtCore.QSize(width, height)) + widget.setGeometry(int(rect.x()) + int(x), int(rect.y() + self.margin), int(width), int(height)) + self.resize.emit(QtCore.QSize(int(width), int(height))) def sizeHint(self): """ diff --git a/openlp/core/widgets/views.py b/openlp/core/widgets/views.py index 5d5cf9a3f..d0b5d0b48 100644 --- a/openlp/core/widgets/views.py +++ b/openlp/core/widgets/views.py @@ -133,7 +133,7 @@ class ListPreviewWidget(QtWidgets.QTableWidget, RegistryProperties): height = min(height, self.auto_row_height) # Apply new height to slides for slide_index in range(len(self.service_item.slides)): - self.setRowHeight(slide_index, height) + self.setRowHeight(slide_index, int(height)) def row_resized(self, row, old_height, new_height): """ @@ -238,7 +238,7 @@ class ListPreviewWidget(QtWidgets.QTableWidget, RegistryProperties): # First set the height to 1 and then to the right height. This makes the item display correctly. # If this is not done, sometimes the image item is displayed as blank. self.setRowHeight(slide_index, 1) - self.setRowHeight(slide_index, slide_height) + self.setRowHeight(slide_index, int(slide_height)) self.setVerticalHeaderLabels(text) if self.service_item.is_text(): self.resizeRowsToContents()