def loadStyleSheet(self): styleFilePath = os.path.join(self.logic.fileDir, 'Resources', 'StyleSheets', 'FirstTaskStyle.qss') f = qt.QFile(styleFilePath) if not f.exists(): logging.error("Unable to load stylesheet, file not found") return "" f.open(qt.QFile.ReadOnly | qt.QFile.Text) ts = qt.QTextStream(f) stylesheet = ts.readAll() return stylesheet
def loadStyleSheet(self): moduleDir = os.path.dirname(__file__) style = self.parameterNode.GetParameter('StyleSheet') styleFile = os.path.join(moduleDir, 'Resources', 'StyleSheets', style) f = qt.QFile(styleFile) if not f.exists(): logging.debug("Unable to load stylesheet, file not found") return "" else: f.open(qt.QFile.ReadOnly | qt.QFile.Text) ts = qt.QTextStream(f) stylesheet = ts.readAll() return stylesheet