-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
27 Tallenna kaava jsonina #76
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hienoa, että sait toimimaan!
class SerializePlan(QDialog, FormClass): # type: ignore | ||
def __init__(self): | ||
super().__init__() | ||
self.setupUi(self) | ||
|
||
self.plan_outline_path_edit = self.findChild(QLineEdit, "plan_outline_path_edit") | ||
self.plan_path_edit = self.findChild(QLineEdit, "plan_path_edit") | ||
self.plan_outline_select_button = self.findChild(QPushButton, "plan_outline_select_button") | ||
self.plan_select_button = self.findChild(QPushButton, "plan_select_button") | ||
|
||
self.plan_outline_select_button.clicked.connect(self.select_plan_outline_file) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self.findChild
:t taitaa olla turhia tässä tapauksessa. setupUi() lataa kaikki muuttujat luokalle, jolloin ne on kyllä olemassa ilman findChild-kutsuja. Tyypityksen saa toimimaan kun ne määrittää "luokkamuuttujiksi".
class SerializePlan(QDialog, FormClass): # type: ignore | |
def __init__(self): | |
super().__init__() | |
self.setupUi(self) | |
self.plan_outline_path_edit = self.findChild(QLineEdit, "plan_outline_path_edit") | |
self.plan_path_edit = self.findChild(QLineEdit, "plan_path_edit") | |
self.plan_outline_select_button = self.findChild(QPushButton, "plan_outline_select_button") | |
self.plan_select_button = self.findChild(QPushButton, "plan_select_button") | |
self.plan_outline_select_button.clicked.connect(self.select_plan_outline_file) | |
class SerializePlan(QDialog, FormClass): # type: ignore | |
plan_outline_path_edit: QLineEdit | |
plan_path_edit: QLineEdit | |
plan_outline_select_button: QPushButton | |
plan_select_button: QPushButton | |
def __init__(self): | |
super().__init__() | |
self.setupUi(self) | |
self.plan_outline_select_button.clicked.connect(self.select_plan_outline_file) |
# Build the structured outline JSON and write to file | ||
outline_json = { | ||
"type": "Feature", | ||
"properties": {"name": "Example Polygon"}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
saisiko nimeksi kaavan nimen
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lambdoille kommunikoinnin voisi siirtää kokonaan omaan moduuliin. Plan managerissa voisi edelleen olla get_plan_json(), joka sitten kutsuisi tätä toisessa moduulissa olevaa koodia.
fa6f2dc
to
bcdaf92
Compare
outline_json = None | ||
if plan_json: | ||
geographical_area = plan_json.get("geographicalArea") | ||
if geographical_area: | ||
outline_name = get_plan_name(plan_id, language="fin") | ||
outline_json = { | ||
"type": "Feature", | ||
"properties": {"name": outline_name}, | ||
"srid": geographical_area.get("srid"), | ||
"geometry": geographical_area.get("geometry"), | ||
} | ||
|
||
if outline_json is None: | ||
outline_json = {} # Fallback to empty dictionary if no outline JSON is created |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
outline_json voidaan asettaa heti alkuun defaultiksi.
outline_json = None | |
if plan_json: | |
geographical_area = plan_json.get("geographicalArea") | |
if geographical_area: | |
outline_name = get_plan_name(plan_id, language="fin") | |
outline_json = { | |
"type": "Feature", | |
"properties": {"name": outline_name}, | |
"srid": geographical_area.get("srid"), | |
"geometry": geographical_area.get("geometry"), | |
} | |
if outline_json is None: | |
outline_json = {} # Fallback to empty dictionary if no outline JSON is created | |
outline_json = {} | |
if plan_json: | |
geographical_area = plan_json.get("geographicalArea") | |
if geographical_area: | |
outline_name = get_plan_name(plan_id, language="fin") | |
outline_json = { | |
"type": "Feature", | |
"properties": {"name": outline_name}, | |
"srid": geographical_area.get("srid"), | |
"geometry": geographical_area.get("geometry"), | |
} |
- Added UI for selecting path for saving JSONs - Added get_plan_json that calls lambda with the active_plan_id. The JSONs are extracted from the response and saved at user defined location. - Changed default lambda port. Refactor get_plan_json. Changed lambda call to use QNetworkRequest and created the required QNetworkProxy. Changed settings to store Proxy host and port. Added lambda url to settings. Cleanup
- Moved lambda request and response handling to their own module. - Added capability to use local docker lambdas. - Added utility to get plan name with plan_id from "Kaava" layer. Update lambda_service.py
Initialize or reset proxy each time before request is sent. Create LambdaService object when button is pressed. Removed redundant code.
e4161fa
to
4d8202d
Compare
Lisätty "Tallenna kaava JSON" nappi, joka tallentaa aktiivisen kaavan ja sen ulkorajan JSON muodossa käyttäjän valitsemaan paikkaan.
Lisätty QNetworkProxy, jotta voidaan käyttä AWS:llä olevaa lambdaa.
Asetukset muokattu, korvattu lambda isäntä ja -portti proxyn isännällä ja -portilla. Lisätty lambdan osoite.
Lisätty kaavan nimen haku. Jos kaavalle ei ole annettu suomenkielistä nimeä, ulkoraja JSONiin asetetaan nimeksi "Nimetön".
Lisätty mahdollisuus käyttää paikallista dockerissa olevaa lambdaa.
Paikallisen lambdan käyttämisesksi, asetuksiin tulee asettaa tyhjä Proxy isäntä ja Proxy portti, sekä lambdan osoite asettaa:
http://localhost:8083/2015-03-31/functions/function/invocations
Molemmat (AWS ja paikallinen) lambdat testattu.