File tree 2 files changed +3
-8
lines changed
arho_feature_template/core
2 files changed +3
-8
lines changed Original file line number Diff line number Diff line change 9
9
from arho_feature_template .utils .misc_utils import get_active_plan_id , get_plan_name , get_settings
10
10
11
11
12
- # Luo uusi lambda service kun nappia painaa
13
12
class LambdaService (QObject ):
14
13
jsons_received = pyqtSignal (dict , dict )
15
14
@@ -57,7 +56,6 @@ def _process_reply(self, reply: QNetworkReply):
57
56
58
57
try :
59
58
response_data = reply .readAll ().data ().decode ("utf-8" )
60
-
61
59
response_json = json .loads (response_data )
62
60
63
61
# Determine if the proxy is set up.
@@ -75,7 +73,7 @@ def _process_reply(self, reply: QNetworkReply):
75
73
if not isinstance (plan_json , dict ):
76
74
plan_json = {}
77
75
78
- outline_json = None
76
+ outline_json = {}
79
77
if plan_json :
80
78
geographical_area = plan_json .get ("geographicalArea" )
81
79
if geographical_area :
@@ -87,9 +85,6 @@ def _process_reply(self, reply: QNetworkReply):
87
85
"geometry" : geographical_area .get ("geometry" ),
88
86
}
89
87
90
- if outline_json is None :
91
- outline_json = {} # Fallback to empty dictionary if no outline JSON is created
92
-
93
88
# Emit the signal with the two JSONs
94
89
self .jsons_received .emit (plan_json , outline_json )
95
90
Original file line number Diff line number Diff line change 16
16
17
17
class PlanManager :
18
18
def __init__ (self ):
19
- self .lambda_service = LambdaService ()
20
- self .lambda_service .jsons_received .connect (self .save_plan_jsons )
21
19
self .json_plan_path = None
22
20
self .json_plan_outline_path = None
23
21
self .kaava_layer = get_layer_by_name ("Kaava" )
@@ -121,6 +119,8 @@ def get_plan_json(self):
121
119
QMessageBox .critical (None , "Virhe" , "Ei aktiivista kaavaa." )
122
120
return
123
121
122
+ self .lambda_service = LambdaService ()
123
+ self .lambda_service .jsons_received .connect (self .save_plan_jsons )
124
124
self .lambda_service .send_request ("get_plans" , plan_id )
125
125
126
126
def save_plan_jsons (self , plan_json , outline_json ):
You can’t perform that action at this time.
0 commit comments