Advertisement
Guest User

CreateGraphFromInput.py

a guest
Jan 21st, 2018
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.25 KB | None | 0 0
  1. import ListCleaning
  2. import ConfigGraphFile
  3. import DrawGraph
  4. from PyQt4 import QtGui
  5.  
  6. #not used anymore
  7. def createGraphFromInputs(mainFrame):
  8. graphSettings=ConfigGraphFile.getFileConfigs()
  9. for i in range(len(mainFrame.graphInputs)):
  10. lista,period, startBit=ListCleaning.clearList(mainFrame.graphInputs[i])
  11. lista=ListCleaning.convertList(lista)
  12. print(period)
  13. graph=DrawGraph.drawGraph(5, 10, lista, len(lista), height=graphSettings[7],sizeDivision=0.05,zoom=1000,fontSize=graphSettings[0],fontColor=QtGui.QColor(graphSettings[2][0],graphSettings[2][1],graphSettings[2][2]),fontStyle=graphSettings[1],lineThick=graphSettings[6],lineColor=QtGui.QColor(graphSettings[4][0],graphSettings[4][1],graphSettings[4][2]),divisionLineColor=QtGui.QColor(graphSettings[5][0],graphSettings[5][1],graphSettings[5][2]),backgroundColor=QtGui.QColor(graphSettings[3][0],graphSettings[3][1],graphSettings[3][2]))
  14. scrollArea=QtGui.QScrollArea()
  15. scrollArea.setWidget(graph)
  16. mainFrame.grid.setRowMinimumHeight(i+1,10+graphSettings[7]+graphSettings[0]*2+20)
  17. #mainFrame.grid.addWidget(scrollArea, i+1, 2,i+6,10)
  18. mainFrame.grid.addWidget(scrollArea, i+1, 2, i+1, 10)
  19.  
  20. #this function create an empty graph, return an objet graph
  21. def createGraph():
  22. graphSettings=ConfigGraphFile.getFileConfigs()
  23. graph=DrawGraph.drawGraph(5, 10+240-graphSettings[7]-2*graphSettings[0], [], 550, height=graphSettings[7],sizeDivision=1,zoom=50,fontSize=graphSettings[0],fontColor=QtGui.QColor(graphSettings[2][0],graphSettings[2][1],graphSettings[2][2]),fontStyle=graphSettings[1],lineThick=graphSettings[6],lineColor=QtGui.QColor(graphSettings[4][0],graphSettings[4][1],graphSettings[4][2]),divisionLineColor=QtGui.QColor(graphSettings[5][0],graphSettings[5][1],graphSettings[5][2]),backgroundColor=QtGui.QColor(graphSettings[3][0],graphSettings[3][1],graphSettings[3][2]))
  24. return graph
  25.  
  26. #this function update the previous graph created by the createGraph function
  27. #TODO add a refreshing to change settings based on the config graph file
  28. def drawFromInputs(mainFrame):
  29. graphSettings=ConfigGraphFile.getFileConfigs()
  30. for i in range(len(mainFrame.graphInputs)):
  31. lista,period, startBit=ListCleaning.clearList(mainFrame.graphInputs[i])
  32. lista=ListCleaning.convertList(lista)
  33. mainFrame.graphList[i][2].setLista(lista)
  34. mainFrame.graphList[i][2].setSize(50+len(lista))
  35. upddateValues(mainFrame.graphList[i][2], graphSettings)
  36. mainFrame.graphList[i][2].repaint()
  37.  
  38. def upddateValues(graph, graphSettings):
  39. graph.setHeight(graphSettings[7])
  40. graph.setFontSize(graphSettings[0])
  41. graph.setFontStyle(graphSettings[1])
  42. graph.setPosY(10+240-graphSettings[7]-2*graphSettings[0])
  43. graph.setFontColor(QtGui.QColor(graphSettings[2][0],graphSettings[2][1],graphSettings[2][2]))
  44. graph.setLineThick(graphSettings[6])
  45. graph.setLineColor(QtGui.QColor(graphSettings[4][0],graphSettings[4][1],graphSettings[4][2]))
  46. graph.setDivisionLineColor(QtGui.QColor(graphSettings[5][0],graphSettings[5][1],graphSettings[5][2]))
  47. graph.setBackGroundColor(QtGui.QColor(graphSettings[3][0],graphSettings[3][1],graphSettings[3][2]))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement