Skip to content

Commit

Permalink
Revert "feature_postcode_locations"
Browse files Browse the repository at this point in the history
  • Loading branch information
aliaksei135 authored Oct 25, 2021
1 parent 682ff53 commit 6786268
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 57 deletions.
1 change: 0 additions & 1 deletion requirements-linux.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ partd==1.2.0
pathos==0.2.7
pefile==2019.4.18
Pillow==8.2.0
postcodes-io-api==0.0.4
pox==0.2.9
ppft==1.6.6.3
psutil==5.8.0
Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ partd==1.2.0
pathos==0.2.7
pefile==2019.4.18
Pillow==8.2.0
postcodes-io-api==0.0.4
pox==0.2.9
ppft==1.6.6.3
psutil==5.8.0
Expand Down
29 changes: 4 additions & 25 deletions seedpod_ground_risk/ui_resources/coordbox.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import os
from pathlib import Path

import postcodes_io_api as pst
from PySide2.QtCore import Property, Signal, Slot, Qt, QUrl
from PySide2.QtPositioning import QGeoCoordinate
from PySide2.QtQuickWidgets import QQuickWidget
Expand All @@ -13,7 +12,7 @@
QLabel,
QToolButton,
QVBoxLayout,
QWidget, QInputDialog,
QWidget,
)


Expand Down Expand Up @@ -53,17 +52,15 @@ def __init__(self, parent=None):
self._lng_spinbox = QDoubleSpinBox(
minimum=-8, maximum=2
)
self.map_button = QToolButton(text="Map", clicked=self.handle_clicked_map)
self.post_button = QToolButton(text='Postcode', clicked=self.handle_clicked_post)
self.btn = QToolButton(text="Map", clicked=self.handle_clicked)
self.map_view = MapDialog(self)

lay = QHBoxLayout(self)
lay.addWidget(QLabel("Latitude:"))
lay.addWidget(self._lat_spinbox)
lay.addWidget(QLabel("Longitude:"))
lay.addWidget(self._lng_spinbox)
lay.addWidget(self.map_button)
lay.addWidget(self.post_button)
lay.addWidget(self.btn)

@Property(QGeoCoordinate, notify=coordinate_changed)
def coordinate(self):
Expand All @@ -88,23 +85,5 @@ def update_from_map(self, coordinate):
self._lat_spinbox.setValue(self.coordinate.latitude())
self._lng_spinbox.setValue(self.coordinate.longitude())

def handle_clicked_map(self):
def handle_clicked(self):
self.map_view.exec_()

def handle_clicked_post(self):
pcode, ok = QInputDialog.getText(self, 'Postcode', 'Postcode:')
api = pst.Api()
if ok is True:
valid = api.is_postcode_valid(pcode[0])
while valid is False:
pcode, ok = QInputDialog.getText(self, 'Postcode', 'Postcode Invalid, please try again')
if ok is False:
break
valid = api.is_postcode_valid(pcode[0])
else:
data = api.get_postcode(pcode[0])
self.coordinate = QGeoCoordinate(
data['result']['latitude'], data['result']['longitude']
)
self._lat_spinbox.setValue(self.coordinate.latitude())
self._lng_spinbox.setValue(self.coordinate.longitude())
Empty file removed tests/ui/__init__.py
Empty file.
30 changes: 0 additions & 30 deletions tests/ui/test_coordbox.py

This file was deleted.

0 comments on commit 6786268

Please sign in to comment.