qe-api-client 2.6.0__py3-none-any.whl → 2.7.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- qe_api_client/api_classes/engine_generic_dimension_api.py +19 -0
- qe_api_client/engine.py +93 -2
- qe_api_client/structs.py +113 -7
- {qe_api_client-2.6.0.dist-info → qe_api_client-2.7.0.dist-info}/METADATA +1 -1
- {qe_api_client-2.6.0.dist-info → qe_api_client-2.7.0.dist-info}/RECORD +8 -8
- {qe_api_client-2.6.0.dist-info → qe_api_client-2.7.0.dist-info}/WHEEL +1 -1
- {qe_api_client-2.6.0.dist-info → qe_api_client-2.7.0.dist-info}/licenses/LICENSE +0 -0
- {qe_api_client-2.6.0.dist-info → qe_api_client-2.7.0.dist-info}/top_level.txt +0 -0
@@ -36,3 +36,22 @@ class EngineGenericDimensionApi:
|
|
36
36
|
return response["result"]["qReturn"]
|
37
37
|
except KeyError:
|
38
38
|
return response["error"]
|
39
|
+
|
40
|
+
def apply_patches(self, handle: int, patches: list):
|
41
|
+
"""
|
42
|
+
Applies a patch to the properties of an object. Allows an update to some of the properties.
|
43
|
+
|
44
|
+
Parameters:
|
45
|
+
handle (int): The handle identifying the generic object.
|
46
|
+
patches (list): List of patches.
|
47
|
+
|
48
|
+
Returns:
|
49
|
+
dict: Operation succeeded.
|
50
|
+
"""
|
51
|
+
msg = json.dumps({"jsonrpc": "2.0", "id": 0, "handle": handle, "method": "ApplyPatches",
|
52
|
+
"params": {"qPatches": patches}})
|
53
|
+
response = json.loads(self.engine_socket.send_call(self.engine_socket, msg))
|
54
|
+
try:
|
55
|
+
return response["result"]
|
56
|
+
except KeyError:
|
57
|
+
return response["error"]
|
qe_api_client/engine.py
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
import json
|
2
|
+
|
1
3
|
import qe_api_client.api_classes.engine_app_api as engine_app_api
|
2
4
|
import qe_api_client.engine_communicator as engine_communicator
|
3
5
|
import qe_api_client.api_classes.engine_field_api as engine_field_api
|
@@ -93,8 +95,14 @@ class QixEngine:
|
|
93
95
|
fld_handle = self.get_handle(lb_field)
|
94
96
|
return self.efa.clear(fld_handle)
|
95
97
|
|
98
|
+
|
96
99
|
def create_single_master_dimension(self, app_handle: int, dim_title: str, dim_def: str, dim_label: str = "",
|
97
|
-
dim_desc: str = "", dim_tags: list = None
|
100
|
+
dim_desc: str = "", dim_tags: list = None, dim_color: str = None,
|
101
|
+
dim_color_index: int = -1, value_colors: list = None,
|
102
|
+
null_value_color: str = None, null_value_color_index: int = -1,
|
103
|
+
other_value_color: str = None, other_value_color_index: int = -1,
|
104
|
+
single_color: str = None, single_color_index: int = -1, palette: str = None
|
105
|
+
):
|
98
106
|
"""
|
99
107
|
Creates a single master dimension.
|
100
108
|
|
@@ -105,26 +113,105 @@ class QixEngine:
|
|
105
113
|
dim_label (str, optional): The label of the dimension.
|
106
114
|
dim_desc (str, optional): The description of the dimension.
|
107
115
|
dim_tags (list, optional): The tags of the dimension.
|
116
|
+
dim_color (str, optional): The master dimension color.
|
117
|
+
dim_color_index (int, optional): The index of the master dimension color in the theme color picker.
|
118
|
+
value_colors (list, optional): The value colors of the master dimension.
|
119
|
+
null_value_color (str, optional): The NULL value color of the master dimension.
|
120
|
+
null_value_color_index (int, optional): The index of the NULL value color of the master dimension in the theme color picker.
|
121
|
+
other_value_color (str, optional): The OTHER value color of the master dimension.
|
122
|
+
other_value_color_index (int, optional): The index of the OTHER value color of the master dimension in the theme color picker.
|
123
|
+
single_color (str, optional): Single color of the values of the master dimension.
|
124
|
+
single_color_index (int, optional): The index of single color of the values of the master dimension in the theme color picker.
|
125
|
+
palette (str, optional): Choose a color palette, if there are more than one.
|
108
126
|
|
109
127
|
Returns:
|
110
128
|
dict: The handle and Id of the dimension.
|
111
129
|
"""
|
130
|
+
if value_colors is None:
|
131
|
+
value_colors = []
|
112
132
|
if dim_tags is None:
|
113
133
|
dim_tags = []
|
114
134
|
|
115
135
|
# Define of the single dimension properties
|
116
136
|
nx_info = self.structs.nx_info(obj_type="dimension")
|
137
|
+
if dim_color is None:
|
138
|
+
coloring = self.structs.coloring()
|
139
|
+
else:
|
140
|
+
coloring = self.structs.coloring(base_color={"color": dim_color, "index": dim_color_index})
|
141
|
+
|
117
142
|
nx_library_dimension_def = self.structs.nx_library_dimension_def(grouping="N", field_definitions=[dim_def],
|
118
143
|
field_labels=[dim_title],
|
119
|
-
label_expression=dim_label
|
144
|
+
label_expression=dim_label, alias=dim_title,
|
145
|
+
title=dim_title, coloring=coloring)
|
120
146
|
gen_dim_props = self.structs.generic_dimension_properties(nx_info=nx_info,
|
121
147
|
nx_library_dimension_def=nx_library_dimension_def,
|
122
148
|
title=dim_title, description=dim_desc, tags=dim_tags)
|
123
149
|
|
124
150
|
# Create the single dimension
|
125
151
|
master_dim = self.eaa.create_dimension(app_handle, gen_dim_props)
|
152
|
+
|
153
|
+
# Get id and handle of the master dimension
|
154
|
+
master_dim_id = self.get_id(master_dim)
|
155
|
+
master_dim_handle = self.get_handle(master_dim)
|
156
|
+
|
157
|
+
# Update "colorMapRef" property with the master dimension id.
|
158
|
+
patch_value = json.dumps(master_dim_id)
|
159
|
+
patch_color_map_ref = self.structs.nx_patch(op="replace", path="/qDim/coloring/colorMapRef", value=patch_value)
|
160
|
+
self.egda.apply_patches(handle=master_dim_handle, patches=[patch_color_map_ref])
|
161
|
+
|
162
|
+
# Define the color properties
|
163
|
+
if null_value_color is None:
|
164
|
+
null_value = None
|
165
|
+
else:
|
166
|
+
null_value = {"color": null_value_color, "index": null_value_color_index}
|
167
|
+
|
168
|
+
if other_value_color is None:
|
169
|
+
other_value = None
|
170
|
+
else:
|
171
|
+
other_value = {"color": other_value_color, "index": other_value_color_index}
|
172
|
+
|
173
|
+
if single_color is None:
|
174
|
+
single = None
|
175
|
+
else:
|
176
|
+
single = {"color": single_color, "index": single_color_index}
|
177
|
+
|
178
|
+
colors = value_colors
|
179
|
+
color_map = self.structs.color_map(colors=colors, nul=null_value, oth=other_value, single=single, pal=palette)
|
180
|
+
color_map_props = self.structs.color_map_properties(dim_id=master_dim_id, _color_map=color_map)
|
181
|
+
|
182
|
+
# Create color map object, if colors are passed.
|
183
|
+
if value_colors or null_value_color is not None or other_value_color is not None or single_color is not None or palette is not None:
|
184
|
+
color_map_model = self.eaa.create_object(app_handle, color_map_props)
|
185
|
+
color_map_model_handle = self.get_handle(color_map_model)
|
186
|
+
|
187
|
+
# Set "autoFill" and "usePal" to "False", if a single color is passed.
|
188
|
+
if bool(single):
|
189
|
+
patch_value_use_pal_auto_fill = json.dumps(False)
|
190
|
+
patch_use_pal = self.structs.nx_patch(op="replace", path="/colorMap/usePal",
|
191
|
+
value=patch_value_use_pal_auto_fill)
|
192
|
+
self.egda.apply_patches(handle=color_map_model_handle, patches=[patch_use_pal])
|
193
|
+
|
194
|
+
patch_auto_fill = self.structs.nx_patch(op="replace", path="/colorMap/autoFill",
|
195
|
+
value=patch_value_use_pal_auto_fill)
|
196
|
+
self.egda.apply_patches(handle=color_map_model_handle, patches=[patch_auto_fill])
|
197
|
+
|
198
|
+
# Set "autoFill" to "False", if a color palette is passed.
|
199
|
+
if palette is not None:
|
200
|
+
patch_value_auto_fill = json.dumps(False)
|
201
|
+
patch_auto_fill = self.structs.nx_patch(op="replace", path="/colorMap/autoFill",
|
202
|
+
value=patch_value_auto_fill)
|
203
|
+
self.egda.apply_patches(handle=color_map_model_handle, patches=[patch_auto_fill])
|
204
|
+
|
205
|
+
# Update "hasValueColors" property, if value colors are passed.
|
206
|
+
if value_colors:
|
207
|
+
patch_value_has_value_colors = json.dumps(True)
|
208
|
+
patch_has_value_colors = self.structs.nx_patch(op="replace", path="/qDim/coloring/hasValueColors",
|
209
|
+
value=patch_value_has_value_colors)
|
210
|
+
self.egda.apply_patches(handle=master_dim_handle, patches=[patch_has_value_colors])
|
211
|
+
|
126
212
|
return master_dim
|
127
213
|
|
214
|
+
|
128
215
|
def create_master_measure(self, app_handle: int, mes_title: str, mes_def: str, mes_label: str = "",
|
129
216
|
mes_desc: str = "", mes_tags: list = None):
|
130
217
|
"""
|
@@ -310,8 +397,12 @@ class QixEngine:
|
|
310
397
|
nx_info = self.structs.nx_info(obj_type=obj_type)
|
311
398
|
if obj_type == "table":
|
312
399
|
chart_props = self.structs.table_properties(info=nx_info, hypercube_def=hypercube_def)
|
400
|
+
elif obj_type == "sn-table":
|
401
|
+
chart_props = self.structs.sn_table_properties(info=nx_info, hypercube_def=hypercube_def)
|
313
402
|
elif obj_type == "pivot-table":
|
314
403
|
chart_props = self.structs.pivot_table_properties(info=nx_info, hypercube_def=hypercube_def)
|
404
|
+
elif obj_type == "sn-pivot-table":
|
405
|
+
chart_props = self.structs.pivot_table_properties(info=nx_info, hypercube_def=hypercube_def)
|
315
406
|
else:
|
316
407
|
print("Not valid object type.")
|
317
408
|
|
qe_api_client/structs.py
CHANGED
@@ -263,14 +263,16 @@ def generic_dimension_properties(nx_info: dict, nx_library_dimension_def: dict,
|
|
263
263
|
|
264
264
|
|
265
265
|
def nx_library_dimension_def(grouping: str = "N", field_definitions: list = None, field_labels: list = None,
|
266
|
-
label_expression: str = ""):
|
266
|
+
label_expression: str = "", alias: str = "", title: str = "", coloring: dict = None):
|
267
|
+
if coloring is None:
|
268
|
+
coloring = {}
|
267
269
|
if field_labels is None:
|
268
270
|
field_labels = []
|
269
271
|
if field_definitions is None:
|
270
272
|
field_definitions = []
|
271
273
|
return {
|
272
274
|
"qGrouping": grouping, "qFieldDefs": field_definitions, "qFieldLabels": field_labels,
|
273
|
-
"qLabelExpression": label_expression
|
275
|
+
"qLabelExpression": label_expression, "qAlias": alias, "title": title, "coloring": coloring
|
274
276
|
}
|
275
277
|
|
276
278
|
|
@@ -380,16 +382,18 @@ def nx_attr_expr_def(expression: str = "", library_id: str = "", attribute: bool
|
|
380
382
|
"qLabelExpression": label_expression
|
381
383
|
}
|
382
384
|
|
385
|
+
|
383
386
|
def table_properties(
|
384
387
|
info: dict, hypercube_def: dict, prop_def: dict = None, extends_id: str = "", state_name: str = "",
|
385
388
|
script: str = "", _search: dict = None, show_titles: bool = True, title: str = "", subtitle: str = "",
|
386
389
|
footnote: str = "", disable_nav_menu: bool = False, show_details: bool = False,
|
387
|
-
show_details_expression: bool = False,
|
388
|
-
totals_label: str = "Totals", scrolling_horizontal: bool = True, scrolling_keep_first_column_in_view: bool = False,
|
390
|
+
show_details_expression: bool = False, _totals: dict = None, scrolling_horizontal: bool = True, scrolling_keep_first_column_in_view: bool = False,
|
389
391
|
scrolling_keep_first_column_in_view_touch: bool = False, multiline_wrap_text_in_headers: bool = True,
|
390
392
|
multiline_wrap_text_in_cells: bool = True
|
391
393
|
):
|
392
394
|
|
395
|
+
if _totals is None:
|
396
|
+
_totals = totals()
|
393
397
|
if prop_def is None:
|
394
398
|
prop_def = {}
|
395
399
|
if _search is None:
|
@@ -399,14 +403,39 @@ def table_properties(
|
|
399
403
|
"qInfo": info, "qExtendsId": extends_id, "qMetaDef": prop_def, "qStateName": state_name,
|
400
404
|
"qHyperCubeDef": hypercube_def, "script": script, "search": _search, "showTitles": show_titles, "title": title,
|
401
405
|
"subtitle": subtitle, "footnote": footnote, "disableNavMenu": disable_nav_menu, "showDetails": show_details,
|
402
|
-
"showDetailsExpression": show_details_expression,
|
403
|
-
"totals": {"show": totals_show, "position": totals_position, "label": totals_label},
|
406
|
+
"showDetailsExpression": show_details_expression, "totals": _totals,
|
404
407
|
"scrolling": {"horizontal": scrolling_horizontal, "keepFirstColumnInView": scrolling_keep_first_column_in_view, "keepFirstColumnInViewTouch": scrolling_keep_first_column_in_view_touch},
|
405
408
|
"multiline": {"wrapTextInHeaders": multiline_wrap_text_in_headers, "wrapTextInCells": multiline_wrap_text_in_cells},
|
406
409
|
"visualization": "table"
|
407
410
|
}
|
408
411
|
|
409
412
|
|
413
|
+
def sn_table_properties(
|
414
|
+
info: dict, hypercube_def: dict, prop_def: dict = None, extends_id: str = "", state_name: str = "",
|
415
|
+
show_titles: bool = True, title: str = "", subtitle: str = "", footnote: str = "", disable_nav_menu: bool = False,
|
416
|
+
show_details: bool = False, show_details_expression: bool = False, components: list = None, _totals: dict = None,
|
417
|
+
use_pagination: bool = False, enable_chart_exploration: bool = False, chart_exploration: dict = None
|
418
|
+
):
|
419
|
+
|
420
|
+
if chart_exploration is None:
|
421
|
+
chart_exploration = {"menuVisibility": "auto"}
|
422
|
+
if components is None:
|
423
|
+
components = []
|
424
|
+
if _totals is None:
|
425
|
+
_totals = totals()
|
426
|
+
if prop_def is None:
|
427
|
+
prop_def = {}
|
428
|
+
|
429
|
+
return {
|
430
|
+
"qInfo": info, "qExtendsId": extends_id, "qMetaDef": prop_def, "qStateName": state_name,
|
431
|
+
"qHyperCubeDef": hypercube_def, "showTitles": show_titles, "title": title, "subtitle": subtitle,
|
432
|
+
"footnote": footnote, "disableNavMenu": disable_nav_menu, "showDetails": show_details,
|
433
|
+
"showDetailsExpression": show_details_expression, "components": components, "totals": _totals,
|
434
|
+
"usePagination": use_pagination, "enableChartExploration": enable_chart_exploration,
|
435
|
+
"chartExploration": chart_exploration, "visualization": "sn-table"
|
436
|
+
}
|
437
|
+
|
438
|
+
|
410
439
|
def pivot_table_properties(
|
411
440
|
info: dict, hypercube_def: dict, prop_def: dict = None, extends_id: str = "", state_name: str = "",
|
412
441
|
_search: dict = None, show_titles: bool = True, title: str = "", subtitle: str = "",
|
@@ -427,9 +456,86 @@ def pivot_table_properties(
|
|
427
456
|
}
|
428
457
|
|
429
458
|
|
459
|
+
def sn_pivot_table_properties(
|
460
|
+
info: dict, hypercube_def: dict, prop_def: dict = None, extends_id: str = "", state_name: str = "",
|
461
|
+
_search: dict = None, show_titles: bool = True, title: str = "", subtitle: str = "",
|
462
|
+
footnote: str = "", disable_nav_menu: bool = False, show_details: bool = True,
|
463
|
+
show_details_expression: bool = False, components: list = None, null_value_representation: dict = None
|
464
|
+
):
|
465
|
+
if null_value_representation is None:
|
466
|
+
null_value_representation = {"text": "-"}
|
467
|
+
if components is None:
|
468
|
+
components = []
|
469
|
+
if prop_def is None:
|
470
|
+
prop_def = {}
|
471
|
+
if _search is None:
|
472
|
+
_search = search()
|
473
|
+
|
474
|
+
return {
|
475
|
+
"qInfo": info, "qExtendsId": extends_id, "qMetaDef": prop_def, "qStateName": state_name,
|
476
|
+
"qHyperCubeDef": hypercube_def, "search": _search, "showTitles": show_titles, "title": title,
|
477
|
+
"subtitle": subtitle, "footnote": footnote, "disableNavMenu": disable_nav_menu, "showDetails": show_details,
|
478
|
+
"showDetailsExpression": show_details_expression, "components": components,
|
479
|
+
"nullValueRepresentation": null_value_representation, "visualization": "sn-pivot-table"
|
480
|
+
}
|
481
|
+
|
482
|
+
|
430
483
|
def search(sorting: str = "auto"):
|
431
484
|
return {"sorting": sorting}
|
432
485
|
|
433
486
|
|
434
487
|
def text_align(auto: bool = True, align: str = "left"):
|
435
|
-
return {"auto": auto, "align": align}
|
488
|
+
return {"auto": auto, "align": align}
|
489
|
+
|
490
|
+
|
491
|
+
def totals(totals_show: bool = True, totals_position: str = "noTotals", totals_label: str = "Totals"):
|
492
|
+
return {"show": totals_show, "position": totals_position, "label": totals_label}
|
493
|
+
|
494
|
+
|
495
|
+
def color_map(colors: list = None, nul: dict = None, oth: dict = None, pal: str = None, single: dict = None,
|
496
|
+
use_pal: bool = True, auto_fill: bool = True):
|
497
|
+
|
498
|
+
if colors is None:
|
499
|
+
colors = []
|
500
|
+
|
501
|
+
return {
|
502
|
+
"colors": colors,
|
503
|
+
"nul": nul,
|
504
|
+
"oth": oth,
|
505
|
+
"pal": pal,
|
506
|
+
"single": single,
|
507
|
+
"usePal": use_pal,
|
508
|
+
"autoFill": auto_fill
|
509
|
+
}
|
510
|
+
|
511
|
+
|
512
|
+
def coloring(change_hash: str = None, color_map_ref: str = "", has_value_colors: bool = False, base_color: dict = None):
|
513
|
+
if base_color is None:
|
514
|
+
base_color = {"color": "none", "index": 0}
|
515
|
+
return {
|
516
|
+
"changeHash": change_hash,
|
517
|
+
"colorMapRef": color_map_ref,
|
518
|
+
"hasValueColors": has_value_colors,
|
519
|
+
"baseColor": base_color
|
520
|
+
}
|
521
|
+
|
522
|
+
|
523
|
+
def color_map_properties(dim_id: str, prop_def:dict = None, extends_id: str = "", state_name: str = "",
|
524
|
+
_color_map: dict = None):
|
525
|
+
|
526
|
+
if _color_map is None:
|
527
|
+
_color_map = color_map()
|
528
|
+
if prop_def is None:
|
529
|
+
prop_def = {}
|
530
|
+
info = nx_info(obj_type="ColorMap", obj_id="ColorMapModel_" + dim_id)
|
531
|
+
|
532
|
+
return {
|
533
|
+
"qInfo": info, "qExtendsId": extends_id, "qMetaDef": prop_def, "qStateName": state_name, "colorMap": _color_map
|
534
|
+
}
|
535
|
+
|
536
|
+
|
537
|
+
def value_color(value: str, color: str, index: int = -1):
|
538
|
+
return {
|
539
|
+
"value": value,
|
540
|
+
"baseColor": {"color": color, "index": index}
|
541
|
+
}
|
@@ -1,17 +1,17 @@
|
|
1
1
|
qe_api_client/__init__.py,sha256=bypB4CIjpHtf5Pu_NwtJajC69zqQD7qB9jo8cCX0B54,23
|
2
|
-
qe_api_client/engine.py,sha256=
|
2
|
+
qe_api_client/engine.py,sha256=4pll0uoFPph5WgRufpP4OsYlypWKQhMfJQAaaWPWWUU,56738
|
3
3
|
qe_api_client/engine_communicator.py,sha256=q6x7ix2Ev8yGmTTm7cf1vHcidOihKM0HjDXeJ-dZYjk,1133
|
4
|
-
qe_api_client/structs.py,sha256=
|
4
|
+
qe_api_client/structs.py,sha256=Gh7aGNLN58kYeBY-6Nb7yagQpHnd1f-IlfaE8aEF9ns,22621
|
5
5
|
qe_api_client/api_classes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
6
6
|
qe_api_client/api_classes/engine_app_api.py,sha256=qobuSdLV5I-DOXto0Qi5ckMG3q5Dll0Lto3TyjZSbso,37493
|
7
7
|
qe_api_client/api_classes/engine_field_api.py,sha256=zCLIR7rmxqwIrJYK_-uHVEhMvBcEP2qofuX8ZPygqCA,5479
|
8
|
-
qe_api_client/api_classes/engine_generic_dimension_api.py,sha256=
|
8
|
+
qe_api_client/api_classes/engine_generic_dimension_api.py,sha256=oSZoRT-j4hsCVnUm1OSg7XZPWXhUzFLY_53kM0KwPHs,2122
|
9
9
|
qe_api_client/api_classes/engine_generic_measure_api.py,sha256=uj4i_ykX9F9Dtk78fOidMBhzSP8vEucEfrB6MrLwgPI,1340
|
10
10
|
qe_api_client/api_classes/engine_generic_object_api.py,sha256=iasoNYSSsBTr_S3ExoorfCip9fhy7sCQ_J-ru2JYal8,10130
|
11
11
|
qe_api_client/api_classes/engine_generic_variable_api.py,sha256=sWXZpE-GLfcMijmfORnDNrJ6lmXX3x5TRHlkEu_i0BQ,2027
|
12
12
|
qe_api_client/api_classes/engine_global_api.py,sha256=G6QQHI36WOo7W25zg4Uz__gMSLC2ptNTvbBdElPzgZI,27535
|
13
|
-
qe_api_client-2.
|
14
|
-
qe_api_client-2.
|
15
|
-
qe_api_client-2.
|
16
|
-
qe_api_client-2.
|
17
|
-
qe_api_client-2.
|
13
|
+
qe_api_client-2.7.0.dist-info/licenses/LICENSE,sha256=2bm9uFabQZ3Ykb_SaSU_uUbAj2-htc6WJQmS_65qD00,1073
|
14
|
+
qe_api_client-2.7.0.dist-info/METADATA,sha256=5-VkSmGbK-92mrMlEqFgozK8FtbUfmpW1o5_zQZrLlA,2385
|
15
|
+
qe_api_client-2.7.0.dist-info/WHEEL,sha256=0CuiUZ_p9E4cD6NyLD6UG80LBXYyiSYZOKDm5lp32xk,91
|
16
|
+
qe_api_client-2.7.0.dist-info/top_level.txt,sha256=m_43YagP8UtZgJHmZEfu0vlBNwt36M01-Qby2jByMnk,14
|
17
|
+
qe_api_client-2.7.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|