Dynamic Plot DPI based on user's screen size

This commit is contained in:
Patrick Müller 2020-04-12 13:39:38 +02:00
parent 3a119a7d18
commit 36539b64b2
2 changed files with 224 additions and 12 deletions

View File

@ -28,6 +28,9 @@ class UserInterface(QMainWindow):
self.setMinimumWidth(1500)
self.setMinimumHeight(500)
# Plot DPI Settings
self.plotDpi = screen_width / 20
# Layout boxes
self.header_box = QHBoxLayout()
h2box1 = QHBoxLayout()
@ -114,7 +117,7 @@ class UserInterface(QMainWindow):
self.scrollArea.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
self.setCentralWidget(self.scrollArea)
#self.setLayout(layout)
# self.setLayout(layout)
self.show()
def btnstate(self):
@ -142,34 +145,38 @@ class UserInterface(QMainWindow):
self.graphBox.addWidget(self.graphPlaceHolder)
if self.graphTypePicker.currentText() == 'Total Cases':
casesGraphPath = self.analyser.getCasesGraph(country, startDate, endDate)
casesGraphPath = self.analyser.getCasesGraph(country, startDate, endDate, plotDpi=self.plotDpi)
self.graphPlaceHolder.setPixmap(QPixmap(casesGraphPath))
elif self.graphTypePicker.currentText() == 'Case Increase':
caseIncreaseGraphPath = self.analyser.getCaseIncreaseGraph(country, startDate, endDate)
caseIncreaseGraphPath = self.analyser.getCaseIncreaseGraph(country, startDate, endDate,
plotDpi=self.plotDpi)
self.graphPlaceHolder.setPixmap(QPixmap(caseIncreaseGraphPath))
elif self.graphTypePicker.currentText() == 'Increase Percentage':
increasePercentageGraphPath = self.analyser.getIncreasePercentageGraph(country, startDate, endDate)
increasePercentageGraphPath = self.analyser.getIncreasePercentageGraph(country, startDate, endDate,
plotDpi=self.plotDpi)
self.graphPlaceHolder.setPixmap(QPixmap(increasePercentageGraphPath))
elif self.graphTypePicker.currentText() == 'Total Deaths':
deathGraphPath = self.analyser.getDeathGraph(country, startDate, endDate)
deathGraphPath = self.analyser.getDeathGraph(country, startDate, endDate, plotDpi=self.plotDpi)
self.graphPlaceHolder.setPixmap(QPixmap(deathGraphPath))
elif self.graphTypePicker.currentText() == 'Death Increase':
deathIncreaseGraphPath = self.analyser.getDeathIncreaseGraph(country, startDate, endDate)
deathIncreaseGraphPath = self.analyser.getDeathIncreaseGraph(country, startDate, endDate,
plotDpi=self.plotDpi)
self.graphPlaceHolder.setPixmap(QPixmap(deathIncreaseGraphPath))
elif self.graphTypePicker.currentText() == 'Death Rate':
deathRateGraphPath = self.analyser.getDailyDeathRateGraph(country, startDate, endDate)
deathRateGraphPath = self.analyser.getDailyDeathRateGraph(country, startDate, endDate,
plotDpi=self.plotDpi)
self.graphPlaceHolder.setPixmap(QPixmap(deathRateGraphPath))
elif self.graphTypePicker.currentText() == 'Is it going to end soon?':
isItOverGraphPath = self.analyser.getIsItOverGraph(country)
isItOverGraphPath = self.analyser.getIsItOverGraph(country, plotDpi=self.plotDpi)
self.graphPlaceHolder.setPixmap(QPixmap(isItOverGraphPath))
elif self.graphTypePicker.currentText() == 'Cases per Million':
casesPerMillionGraphPath = self.analyser.getCasesPerMillionGraph(country)
casesPerMillionGraphPath = self.analyser.getCasesPerMillionGraph(country, plotDpi=self.plotDpi)
self.graphPlaceHolder.setPixmap(QPixmap(casesPerMillionGraphPath))
elif self.graphTypePicker.currentText() == 'Deaths per Million':
deathsPerMillionGraphPath = self.analyser.getDeathsPerMillionGraph(country)
deathsPerMillionGraphPath = self.analyser.getDeathsPerMillionGraph(country, plotDpi=self.plotDpi)
self.graphPlaceHolder.setPixmap(QPixmap(deathsPerMillionGraphPath))
elif self.graphTypePicker.currentText() == 'Double Rate Compare':
doubleRateCompareGraphPath = self.analyser.getDoubleRateCompareGraph(country)
doubleRateCompareGraphPath = self.analyser.getDoubleRateCompareGraph(country, plotDpi=self.plotDpi)
self.graphPlaceHolder.setPixmap(QPixmap(doubleRateCompareGraphPath))
def clearLayout(self, layout):

File diff suppressed because it is too large Load Diff