⚡ Fixed a problem with the window size
This commit is contained in:
parent
36539b64b2
commit
982e0ba1da
|
@ -12,7 +12,7 @@ from PyQt5.QtCore import *
|
||||||
import Analyser as ana
|
import Analyser as ana
|
||||||
|
|
||||||
|
|
||||||
class UserInterface(QMainWindow):
|
class UserInterface(QWidget):
|
||||||
def __init__(self, app):
|
def __init__(self, app):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
# Get Analyser instance and required stuff from it
|
# Get Analyser instance and required stuff from it
|
||||||
|
@ -24,8 +24,8 @@ class UserInterface(QMainWindow):
|
||||||
# PyQT Setup
|
# PyQT Setup
|
||||||
self.setWindowTitle('COVID-19 Analytics')
|
self.setWindowTitle('COVID-19 Analytics')
|
||||||
screen_width, screen_height = app.desktop().screenGeometry().width(), app.desktop().screenGeometry().height()
|
screen_width, screen_height = app.desktop().screenGeometry().width(), app.desktop().screenGeometry().height()
|
||||||
self.setGeometry(((screen_width / 2) - 750), ((screen_height / 2) - 375), 1500, 750)
|
self.setGeometry(((screen_width / 2) - 500), ((screen_height / 2) - 250), 1000, 500)
|
||||||
self.setMinimumWidth(1500)
|
self.setMinimumWidth(1000)
|
||||||
self.setMinimumHeight(500)
|
self.setMinimumHeight(500)
|
||||||
|
|
||||||
# Plot DPI Settings
|
# Plot DPI Settings
|
||||||
|
@ -33,11 +33,11 @@ class UserInterface(QMainWindow):
|
||||||
|
|
||||||
# Layout boxes
|
# Layout boxes
|
||||||
self.header_box = QHBoxLayout()
|
self.header_box = QHBoxLayout()
|
||||||
h2box1 = QHBoxLayout()
|
self.h2box1 = QHBoxLayout()
|
||||||
labelBox = QHBoxLayout()
|
self.labelBox = QHBoxLayout()
|
||||||
picklistBox = QHBoxLayout()
|
self.picklistBox = QHBoxLayout()
|
||||||
buttonBox = QHBoxLayout()
|
self.buttonBox = QHBoxLayout()
|
||||||
caseNumberBox = QHBoxLayout()
|
self.caseNumberBox = QHBoxLayout()
|
||||||
self.graphBox = QHBoxLayout()
|
self.graphBox = QHBoxLayout()
|
||||||
|
|
||||||
# Heading
|
# Heading
|
||||||
|
@ -46,78 +46,78 @@ class UserInterface(QMainWindow):
|
||||||
|
|
||||||
# Sub-Header
|
# Sub-Header
|
||||||
subheader1 = QLabel('<h2>Statistics about one country</h2>')
|
subheader1 = QLabel('<h2>Statistics about one country</h2>')
|
||||||
h2box1.addWidget(subheader1)
|
self.h2box1.addWidget(subheader1)
|
||||||
|
|
||||||
# Country Picker
|
# Country Picker
|
||||||
countryPickerLabel = QLabel('<h3>Pick a country:</h3>')
|
countryPickerLabel = QLabel('<h3>Pick a country:</h3>')
|
||||||
labelBox.addWidget(countryPickerLabel)
|
self.labelBox.addWidget(countryPickerLabel)
|
||||||
# self.countryPicker = QComboBox(parent=self)
|
# self.countryPicker = QComboBox()
|
||||||
# self.countryPicker.addItems(countries)
|
# self.countryPicker.addItems(countries)
|
||||||
# self.countryPicker.setCurrentText('Germany')
|
# self.countryPicker.setCurrentText('Germany')
|
||||||
# picklistBox.addWidget(self.countryPicker, 1)
|
# picklistBox.addWidget(self.countryPicker, 1)
|
||||||
self.countryPicker = QLineEdit()
|
self.countryPicker = QLineEdit()
|
||||||
self.countryPicker.setCompleter(QCompleter(countries))
|
self.countryPicker.setCompleter(QCompleter(countries))
|
||||||
self.countryPicker.setText('Germany')
|
self.countryPicker.setText('Germany')
|
||||||
picklistBox.addWidget(self.countryPicker, 1)
|
self.picklistBox.addWidget(self.countryPicker, 1)
|
||||||
|
|
||||||
# Start Date Picker
|
# Start Date Picker
|
||||||
startDatePickerLabel = QLabel('<h3>Pick a start date:</h3>')
|
startDatePickerLabel = QLabel('<h3>Pick a start date:</h3>')
|
||||||
labelBox.addWidget(startDatePickerLabel)
|
self.labelBox.addWidget(startDatePickerLabel)
|
||||||
self.startDatePicker = QComboBox(parent=self)
|
self.startDatePicker = QComboBox()
|
||||||
self.startDatePicker.addItems(dates)
|
self.startDatePicker.addItems(dates)
|
||||||
self.startDatePicker.setCurrentText('2019-12-31')
|
self.startDatePicker.setCurrentText('2019-12-31')
|
||||||
picklistBox.addWidget(self.startDatePicker, 1)
|
self.picklistBox.addWidget(self.startDatePicker, 1)
|
||||||
|
|
||||||
# End Date Picker
|
# End Date Picker
|
||||||
endDatePickerLabel = QLabel('<h3>Pick an end date:</h3>')
|
endDatePickerLabel = QLabel('<h3>Pick an end date:</h3>')
|
||||||
labelBox.addWidget(endDatePickerLabel)
|
self.labelBox.addWidget(endDatePickerLabel)
|
||||||
self.endDatePicker = QComboBox(parent=self)
|
self.endDatePicker = QComboBox()
|
||||||
self.endDatePicker.addItems(dates)
|
self.endDatePicker.addItems(dates)
|
||||||
self.endDatePicker.setCurrentText(dates[len(dates) - 1])
|
self.endDatePicker.setCurrentText(dates[len(dates) - 1])
|
||||||
picklistBox.addWidget(self.endDatePicker, 1)
|
self.picklistBox.addWidget(self.endDatePicker, 1)
|
||||||
|
|
||||||
# Graph Type Picker
|
# Graph Type Picker
|
||||||
graphTypePickerLabel = QLabel('<h3>Pick a graph type:</h3>')
|
graphTypePickerLabel = QLabel('<h3>Pick a graph type:</h3>')
|
||||||
labelBox.addWidget(graphTypePickerLabel)
|
self.labelBox.addWidget(graphTypePickerLabel)
|
||||||
self.graphTypePicker = QComboBox(parent=self)
|
self.graphTypePicker = QComboBox()
|
||||||
self.graphTypePicker.addItems(
|
self.graphTypePicker.addItems(
|
||||||
['Total Cases', 'Case Increase', 'Increase Percentage', 'Cases per Million', 'Total Deaths',
|
['Total Cases', 'Case Increase', 'Increase Percentage', 'Cases per Million', 'Total Deaths',
|
||||||
'Death Increase', 'Death Rate', 'Deaths per Million', 'Is it going to end soon?',
|
'Death Increase', 'Death Rate', 'Deaths per Million', 'Is it going to end soon?',
|
||||||
'Double Rate Compare'])
|
'Double Rate Compare'])
|
||||||
picklistBox.addWidget(self.graphTypePicker, 1)
|
self.picklistBox.addWidget(self.graphTypePicker, 1)
|
||||||
|
|
||||||
# Calculate Button
|
# Calculate Button
|
||||||
self.calculateSingleCountryStats = QPushButton('Calculate')
|
self.calculateSingleCountryStats = QPushButton('Calculate')
|
||||||
buttonBox.addWidget(self.calculateSingleCountryStats)
|
self.buttonBox.addWidget(self.calculateSingleCountryStats)
|
||||||
self.calculateSingleCountryStats.setCheckable(True)
|
self.calculateSingleCountryStats.setCheckable(True)
|
||||||
self.calculateSingleCountryStats.clicked.connect(self.btnstate)
|
self.calculateSingleCountryStats.clicked.connect(self.btnstate)
|
||||||
|
|
||||||
# Total cases number
|
# Total cases number
|
||||||
self.casesNumber = QLabel('<h4>Total Case Number: NaN</h4>')
|
self.casesNumber = QLabel('<h4>Daily Statistics appear here once you click "Calculate"</h4>')
|
||||||
caseNumberBox.addWidget(self.casesNumber)
|
self.caseNumberBox.addWidget(self.casesNumber)
|
||||||
|
|
||||||
# Generate Layout
|
# Generate Layout
|
||||||
layout = QVBoxLayout()
|
layout = QVBoxLayout()
|
||||||
layout.addLayout(self.header_box)
|
layout.addLayout(self.header_box)
|
||||||
layout.addSpacing(50)
|
layout.addSpacing(50)
|
||||||
layout.addLayout(h2box1)
|
layout.addLayout(self.h2box1)
|
||||||
layout.addSpacing(10)
|
layout.addSpacing(10)
|
||||||
layout.addLayout(labelBox)
|
layout.addLayout(self.labelBox)
|
||||||
layout.addLayout(picklistBox)
|
layout.addLayout(self.picklistBox)
|
||||||
layout.addSpacing(10)
|
layout.addSpacing(10)
|
||||||
layout.addLayout(buttonBox)
|
layout.addLayout(self.buttonBox)
|
||||||
layout.addSpacing(10)
|
layout.addSpacing(10)
|
||||||
layout.addLayout(caseNumberBox)
|
layout.addLayout(self.caseNumberBox)
|
||||||
layout.addSpacing(10)
|
layout.addSpacing(10)
|
||||||
layout.addLayout(self.graphBox)
|
layout.addLayout(self.graphBox)
|
||||||
layout.addStretch(1)
|
layout.addStretch(1)
|
||||||
|
|
||||||
self.scrollArea = QScrollArea()
|
# self.scrollArea = QScrollArea()
|
||||||
self.scrollArea.setLayout(layout)
|
# self.scrollArea.setLayout(layout)
|
||||||
self.scrollArea.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
|
# self.scrollArea.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
|
||||||
|
#
|
||||||
self.setCentralWidget(self.scrollArea)
|
# self.setCentralWidget(self.scrollArea)
|
||||||
# self.setLayout(layout)
|
self.setLayout(layout)
|
||||||
self.show()
|
self.show()
|
||||||
|
|
||||||
def btnstate(self):
|
def btnstate(self):
|
||||||
|
|
207
statsfile.csv
207
statsfile.csv
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user