Use logging instead of print

This commit is contained in:
ColinDuquesnoy 2014-05-16 23:34:59 +02:00
parent 2d38f55673
commit 7e625b521c
3 changed files with 17 additions and 6 deletions

View File

@ -36,20 +36,22 @@ Requirements:
the example the example
""" """
import logging
import sys import sys
from PyQt4 import QtGui, QtCore from PyQt4 import QtGui, QtCore
from os.path import abspath, dirname
# make the example runnable without the need to install # make the example runnable without the need to install
from os.path import abspath, dirname
sys.path.insert(0, abspath(dirname(abspath(__file__)) + '/..')) sys.path.insert(0, abspath(dirname(abspath(__file__)) + '/..'))
import qdarkstyle import qdarkstyle
import example_pyqt_ui as example_ui import example_pyqt_ui as example_ui
print(qdarkstyle.__file__)
def main(): def main():
""" """
Application entry point Application entry point
""" """
logging.basicConfig(level=logging.DEBUG)
# create the application and the main window # create the application and the main window
app = QtGui.QApplication(sys.argv) app = QtGui.QApplication(sys.argv)
window = QtGui.QMainWindow() window = QtGui.QMainWindow()

View File

@ -36,11 +36,13 @@ Requirements:
the example the example
""" """
import logging
import sys import sys
from PySide import QtGui, QtCore from PySide import QtGui, QtCore
from os.path import abspath, dirname
# make the example runnable without the need to install # make the example runnable without the need to install
from os.path import abspath, dirname
sys.path.insert(0, abspath(dirname(abspath(__file__)) + '/..')) sys.path.insert(0, abspath(dirname(abspath(__file__)) + '/..'))
import qdarkstyle import qdarkstyle
import example_pyside_ui as example_ui import example_pyside_ui as example_ui
@ -49,6 +51,7 @@ def main():
""" """
Application entry point Application entry point
""" """
logging.basicConfig(level=logging.DEBUG)
# create the application and the main window # create the application and the main window
app = QtGui.QApplication(sys.argv) app = QtGui.QApplication(sys.argv)
window = QtGui.QMainWindow() window = QtGui.QMainWindow()

View File

@ -28,12 +28,17 @@ Initialise the QDarkStyleSheet module when used with python.
This modules provides a function to transparently load the stylesheets This modules provides a function to transparently load the stylesheets
with the correct rc file. with the correct rc file.
""" """
import logging
import platform import platform
__version__ = "1.9" __version__ = "1.9"
def _logger():
return logging.getLogger('qdarkstyle')
def load_stylesheet(pyside=True): def load_stylesheet(pyside=True):
""" """
Loads the stylesheet. Takes care of importing the rc module. Loads the stylesheet. Takes care of importing the rc module.
@ -56,7 +61,8 @@ def load_stylesheet(pyside=True):
f = QFile(":qdarkstyle/style.qss") f = QFile(":qdarkstyle/style.qss")
if not f.exists(): if not f.exists():
print("Unable to set stylesheet, file not found\n") _logger().error("Unable to load stylesheet, file not found in "
"resources")
return "" return ""
else: else:
f.open(QFile.ReadOnly | QFile.Text) f.open(QFile.ReadOnly | QFile.Text)