Commit ec2c50f1 authored by Peterson, Peter's avatar Peterson, Peter
Browse files

Quiet python warnings on startup of workbench

These are minor issues having to do with types (yes, I know it is
python) and leaving dangling file references.
parent 7b9d1657
......@@ -68,8 +68,8 @@ def _get_splash_image():
SPLASH = QSplashScreen(_get_splash_image(), Qt.WindowStaysOnTopHint)
SPLASH.show()
SPLASH.showMessage("Starting...", Qt.AlignBottom | Qt.AlignLeft
| Qt.AlignAbsolute, QColor(Qt.black))
SPLASH.showMessage("Starting...", int(Qt.AlignBottom | Qt.AlignLeft
| Qt.AlignAbsolute), QColor(Qt.black))
# The event loop has not started - force event processing
QApplication.processEvents(QEventLoop.AllEvents)
......@@ -226,7 +226,7 @@ class MainWindow(QMainWindow):
if not self.splash:
return
if msg:
self.splash.showMessage(msg, Qt.AlignBottom | Qt.AlignLeft | Qt.AlignAbsolute,
self.splash.showMessage(msg, int(Qt.AlignBottom | Qt.AlignLeft | Qt.AlignAbsolute),
QColor(Qt.black))
QApplication.processEvents(QEventLoop.AllEvents)
......@@ -391,7 +391,8 @@ class MainWindow(QMainWindow):
for reg_list in registers_to_run.values():
for register in reg_list:
file_path = os.path.join(interface_dir, register)
self.interface_executor.execute(open(file_path).read(), file_path)
with open(file_path) as handle:
self.interface_executor.execute(handle.read(), file_path)
def redirect_python_warnings(self):
"""By default the warnings module writes warnings to sys.stderr. stderr is assumed to be
......
......@@ -18,15 +18,13 @@ import sys
from qtpy.QtGui import QFont, QFontDatabase
def is_ubuntu():
def is_ubuntu() -> bool:
"""Return True if we're running an Ubuntu distro else return False"""
# platform.linux_distribution doesn't exist in Python 3.5
if sys.platform.startswith('linux') and osp.isfile('/etc/lsb-release'):
release_info = open('/etc/lsb-release').read()
if 'Ubuntu' in release_info:
return True
else:
return False
with open('/etc/lsb-release') as handle:
release_info = handle.read()
return bool('Ubuntu' in release_info)
else:
return False
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment