Prepare example to run with no screen

This commit is contained in:
Daniel Pizetta 2018-11-08 15:03:25 -02:00
parent 3271c5974d
commit 85b8333faa
1 changed files with 8 additions and 0 deletions

View File

@ -41,6 +41,7 @@ problems.
import logging
import sys
import argparse
import os
# make the example runnable without the need to install
from os.path import abspath, dirname
@ -70,6 +71,10 @@ def main():
# set log for debug
logging.basicConfig(level=logging.DEBUG)
# to avoid problems when testing without screen
if args.test:
os.environ['QT_QPA_PLATFORM']='offscreen'
if args.qt_from == 'pyside':
# using PySide wrapper
from PySide.QtGui import QApplication, QMainWindow, QDockWidget
@ -210,6 +215,9 @@ def main():
window.resize(size)
window.move(pos)
# create the application
app = QApplication(sys.argv)
app.setOrganizationName('QDarkStyle')