def getTimeSeriesFromTextData(data, template=' '): series = [] parseErrors = 0 parsed = DataParser.readDataByTemplate(data, template) separators = ['\n', '.', ',', ';'] if len(parsed) < DATA_LOW_LIMIT: for separator in separators: parsed = DataParser.readDataByTemplate(data, separator) if len(parsed) >= DATA_LOW_LIMIT: break for element in parsed: if element != '': # QString (manual input) if isinstance(element, QString): value = element.toDouble() if value[1]: series.append(value[0]) else: parseErrors += 1 log.debug('skipped value') # str (from file) elif isinstance(element, str): try: series.append(float(element.strip())) except Exception, e: parseErrors += 1 log.exception(e)
def main(): # qt application app = QApplication(sys.argv) app.setStyle(STYLE) app.setWindowIcon(QIcon(RES + ICONS + LOGO)) # splash screen splash = showSplash(app) # main widget muScale = MuScaleMainDialog() muScale.show() splash.finish(muScale) try: sys.exit(app.exec_()) except Exception, e: muScale.messageInfo.showInfo(str(e)) muScale.toolsFrame.updateLog([str(e)], True) log.exception(e)
def __init__(self): try: self.settings = QSettings(QSettings.IniFormat, QSettings.UserScope, _company, __name__) self.loadCustomFonts() except Exception, e: log.exception(e)