refactor filenames

This commit is contained in:
Yannik Schmidt
2020-08-16 15:49:28 +02:00
parent f8e94ad36a
commit fa6e2893ad
5 changed files with 12 additions and 12 deletions

View File

@@ -5,7 +5,7 @@ import requests
import os
from dbfread import DBF
import plot_timeutils
import timeutils
line_colors = ['b', 'r', 'g', 'c', 'm', 'y']
tname = CFG("temperatur_plot_name")
@@ -142,7 +142,7 @@ def processExternalData(datapoints, plotNameKey, fromTime, toTime, dtype):
try:
timeStr, value = l.split(";")
timestamp = plot_timeutils.time_from_csv(timeStr, CFG("nff_input_timeformat"))
timestamp = timeutils.time_from_csv(timeStr, CFG("nff_input_timeformat"))
datapoints[plotNameKey].data += [float(value.replace(",","."))]
datapoints[plotNameKey].times += [timestamp]
@@ -223,7 +223,7 @@ def read_in_file(path, backend=None, outsideData=False, plotOutsideTemp=True, pl
def dbfread(path,datapoints,pt,ph,pd):
for record in DBF(path):
parse_line(datapoints,record,'DATETIME',[ ('TEMPCELS',pt) , ('HUMIDITY',ph) , ('DEWCELS',pd) ] ,plot_timeutils.time_from_dbf)
parse_line(datapoints,record,'DATETIME',[ ('TEMPCELS',pt) , ('HUMIDITY',ph) , ('DEWCELS',pd) ] ,timeutils.time_from_dbf)
def csvread(path,datapoints,pt,ph,pd):
count = 0;
@@ -240,7 +240,7 @@ def csvread(path,datapoints,pt,ph,pd):
row["hum"] = float(row_arg[4])
row["taupunkt"] = float(row_arg[5])
parse_line(datapoints,row,'datetime',[ ('temp',pt) , ('hum',ph) , ('taupunkt',pd) ],\
plot_timeutils.time_from_csv,timeformat="%d-%m-%Y%H:%M:%S")
timeutils.time_from_csv,timeformat="%d-%m-%Y%H:%M:%S")
print("Info: Ignored %d lines at beginning of file"%count)
import codecs
@@ -260,7 +260,7 @@ def csvread_txt(path,datapoints,pt,ph,pd):
row["hum"] = float(row_arg[7])
row["taupunkt"] = 0.0
parse_line(datapoints,row,'datetime',[ ('temp',pt) , ('hum',ph) , ('taupunkt',pd) ],\
plot_timeutils.time_from_csv,timeformat="%d-%m-%Y_%H:%M")
timeutils.time_from_csv,timeformat="%d-%m-%Y_%H:%M")
except (UnicodeError, IndexError):
count = csvread_txt_fallback(path,datapoints,pt,ph,pd)
@@ -283,7 +283,7 @@ def csvread_txt_fallback(path,datapoints,pt,ph,pd):
row["hum"] = float(hum)
row["taupunkt"] = 0.0
parse_line(datapoints,row,'datetime',[ ('temp',pt) , ('hum',ph) , ('taupunkt',pd) ],\
plot_timeutils.time_from_csv,timeformat="%d-%m-%Y_%H:%M")
timeutils.time_from_csv,timeformat="%d-%m-%Y_%H:%M")
return count

View File

@@ -15,7 +15,7 @@ import sys
import datetime as dt
import input_backend
import plot_main
import plot
import config_parse as cp
class WidgetGallery(QDialog):
@@ -180,7 +180,7 @@ class WidgetGallery(QDialog):
endDateTime = dt.datetime.combine(self.endDateEdit.date().toPyDate(), zeroTime)
endDateTime += endTimeOffset
self.truePath = plot_main.plot(self.datapoints, path=target,
self.truePath = plot.plot(self.datapoints, path=target,
date1=startDateTime,
date2=endDateTime,
forcePath=forcePath)

View File

@@ -15,13 +15,13 @@ import matplotlib.dates
import matplotlib.ticker as ticker
import plot_graphutils
import plot_imageutils
import plot_timeutils
import imageutils
import timeutils
def plot(datapoints, path=None, date1=None, date2=None, forcePath=False):
plotname = "" if CFG("name_of_plot") == "None" else CFG("name_of_plot")
tup = [None,None,plot_timeutils.between_dates,plotname]
tup = [None,None,timeutils.between_dates,plotname]
return __plot(tup, datapoints, path, date1, date2, forcePath)
def __plot(tup, datapoints, path, date1=None, date2=None, forcePath=False):
@@ -80,7 +80,7 @@ def __plot(tup, datapoints, path, date1=None, date2=None, forcePath=False):
tup[FIGURE].savefig(pic_path,dpi=DPI,pad_inches=0.1,bbox_inches='tight',transparent=CFG("transparent_background"))
### do operations on the finished png ###
plot_imageutils.check_and_rotate(pic_path)
imageutils.check_and_rotate(pic_path)
return pic_path