from kivy.lang
import Builder
from kivymd.app import MDApp
from android.storage
import app_storage_path
from kivymd.uix.screen
import Screen
from plyer.platforms.android
import activity
from kivymd.uix.datatables
import MDDataTable
from kivy.metrics
import dp
from kivy.uix.gridlayout
import GridLayout
from kivy.uix.boxlayout
import BoxLayout
from kivy.uix.label
import Label
from kivy.uix.button
import Button
from sender
import Sender
from kivy.clock
import Clock
import json
from time
import sleep
from plyer
import gps
from kivy.utils
import platform
from location_gps
import LocationsGPS
from android.permissions
import request_permissions
, Permission
, check_permission
from jnius
import autoclass
VERSION =
'v0.1'
KV =
"""
Screen:
id: screen
GridLayout:
rows: 4
MDLabel:
id: title
text: "Shrimptek: Squila SAS (SQU)"
#size_hint_y: None
size_hint: 1, 0.1
height: "48dp"
color: 1, 0, 0, 1 # red text color
font_size: "30sp" # increase font size to 20sp
BoxLayout:
id: box_layout_for_table_area
size_hint: 1, 0.8
Button:
id: button_exit
#size_hint_y: None
size_hint: 1, 0.1
height: "48dp"
text: "Salir"
color: 1, 0, 0, 1 # red text color
font_size: "50sp" # increase font size to 20sp
on_press: app.stop()
"""
class MainApp(MDApp):
def __init__(
self):
if platform ==
'android':
from jnius
import autoclass
from android.runnable
import run_on_ui_thread
from android
import mActivity
View = autoclass(
'android.view.View')
from plyer.platforms.android
import activity
from plyer.facades
import UniqueID
gps_fine_permission = check_permission(Permission.ACCESS_FINE_LOCATION)
print(
f"MAIN: Permissions gps_fine_permission={gps_fine_permission
}")
if not gps_fine_permission:
request_permissions([Permission.ACCESS_FINE_LOCATION])
gps_fine_permission = check_permission(Permission.ACCESS_FINE_LOCATION)
print(
f"MAIN: Permissions gps_fine_permission={gps_fine_permission
} after request")
gps_coarse_permission = check_permission(Permission.ACCESS_COARSE_LOCATION)
print(
f"MAIN: Permissions gps_coarse_permission={gps_coarse_permission
}")
if not gps_coarse_permission:
request_permissions([Permission.ACCESS_COARSE_LOCATION])
gps_coarse_permission = check_permission(Permission.ACCESS_COARSE_LOCATION)
print(
f"MAIN: Permissions gps_coarse_permission={gps_coarse_permission
} after request")
location_id =
'SQU' # TODO: paramterize
self.storage_filepath = app_storage_path()
self.loc_gps = LocationsGPS(
self.storage_filepath)
gps.configure(
on_location=
self.on_location
, on_status=
self.on_status)
self.gps_data_status =
None
self.gps_data_location =
None
self.gps_data_lat =
None
self.gps_data_lon =
None
gps.start(
minTime=
1000, minDistance=
1)
# pedir GPS
self.gps_data_lat =
None
self.gps_data_lon =
None
while not self.gps_data_lat
or not self.gps_data_lon:
print(
'waiting gps')
sleep(
0.1)
gps.stop()
self.gps_coords = {
'lat':
self.gps_data_lat
, 'lon':
self.gps_data_lon}
# get the phone ident
Secure = autoclass(
'android.provider.Settings$Secure')
android_uid = Secure.getString(activity.getContentResolver()
, Secure.ANDROID_ID)
self.ident_data = {
'location_id': location_id
, 'version': VERSION
, 'android_uid': android_uid}
print(
f"INIT: self.gps_data_lat={self.gps_data_lat
} self.gps_data_lon={self.gps_data_lon
}")
def build(
self):
testing =
True
# We get the GPS data on startup
if testing:
rows = [
[
"", "03-10 08:00:00", "P1", 2.23, 33.3, 26.4]
,
[
"", "03-10 08:00:01", "P2", 3.23, 0.3, 26.4]
,
[
"", "03-10 08:00:02", "P3", 0.23, 11.3, 26.4]
,
[
"", "03-10 09:00:03", "P0", 1.27, 22.4, 26.3]
,
[
"", "03-10 09:00:00", "P2", 4.23, 51.3, 26.4]
,
[
"", "03-10 09:00:00", "P3", 4.23, 51.3, 26.4]
,
[
"", "03-10 10:00:00", "P1", 5.11, 64.4, 26.5]
,
[
"", "03-10 10:00:00", "P2", 5.10, 64.1, 26.5]
,
[
"", "03-10 10:00:00", "P3", 5.11, 64.4, 26.5]
,
[
"", "03-10 11:00:00", "P1", 5.11, 64.4, 26.5]
]
else:
rows = [[
"", "----", "--", "--", "--", "--"]
, [
"", "----", "--", "--", "--", "--"]]
root_widget = Builder.load_string(KV)
self.table_area = root_widget.ids.box_layout_for_table_area
print(
f"root_widget={root_widget
}")
self.make_table_widget(rows)
self.sender = Sender(
self, self.ident_data
, self.gps_coords)
# send a copy of self to the sender
self.sender.request_data()
return root_widget
def on_location(
self, **kwargs):
print(
f"kwargs={kwargs
}")
# kwargs={'lat': 36.5555609, 'lon': -87.2884085, 'speed': 0.0, 'bearing': 0.0, 'altitude': 0.0, 'accuracy': 2700.0}
self.gps_data_lat = kwargs[
'lat']
self.gps_data_lon = kwargs[
'lon']
def on_status(
self, stype
, status):
self.gps_data_status =
'type={}\n{}'.format(stype
, status)
print(
f"self.gps_data_status={self.gps_data_status
}")
def make_table_widget(
self, rows):
self.table_area.clear_widgets()
# If a data table exists, delete the datatable widget
self.table = MDDataTable(
# Elliot: Create a new datatable with the received dat
pos_hint={
'center_x':
0.5, 'center_y':
0.5}
,
size_hint=(
1, 1)
,
check=
False,
use_pagination=
True,
rows_num=
10,
pagination_menu_height=
'180dp',
pagination_menu_pos=
"auto",
background_color=[
1, 0, 0, 0.5]
, # does not work
column_data=[
(
"", dp(
1))
,
(
"Cuando", dp(
30)
, self.sort_on_datetime)
,
(
"U", dp(
12)
, self.sort_on_location)
,
(
"O", dp(
12)
, self.sort_on_do)
,
(
"%", dp(
12)
, self.sort_on_pct)
,
(
"T", dp(
12)
, self.sort_on_temp)
]
,
row_data=rows
,
sorted_on=
"Cuando",
sorted_order=
"DSC",
)
self.table.bind(
on_row_press=
self.on_row_press)
self.table.bind(
on_check_press=
self.on_check_press)
self.table_area.add_widget(
self.table)
# Elliot: Add the datatable to the widget tre
def check_data(
self):
pass
def on_check_press(
self, instance_table
, current_row):
print(instance_table
, current_row)
def on_row_press(
self, instance_table
, instance_row):
print(instance_table
, instance_row)
def sort_on_location(
self, data):
print(
f"sort_on_location data={data
}")
data.append(json.loads(
'["", "03-10 12:00:00", "P1", 6.00, 70.0, 27.0]'))
pos_of_location =
2
print(data)
# data=[['', '03-10 08:00:00', 'P1', 4.23, 51.3, 26.4], ['', '03-10 08:00:00', 'P2', 4.23, 51.3, 26.4], ['', '03-10 08:00:00', 'P3', 4.23, 51.3, 26.4], ['', '03-10 09:00:00', 'P1', 4.27, 53.4, 26.3], ['', '03-10 09:00:00', 'P2', 4.23, 51.3, 26.4], ['', '03-10 09:00:00', 'P3', 4.23, 51.3, 26.4], ['', '03-10 10:00:00', 'P1', 5.11, 64.4, 26.5], ['', '03-10 10:00:00', 'P2', 5.1, 64.1, 26.5], ['', '03-10 10:00:00', 'P3', 5.11, 64.4, 26.5], ['', '03-10 11:00:00', 'P1', 5.11, 64.4, 26.5]]
# enumerate the tail of each rec and prepend the key at pos
sorting_list = []
pos =
0
for rec
in data:
key = rec[pos_of_location]
rec = [key] + rec
rec.append(pos)
sorting_list.append(rec)
print(rec)
pos +=
1
sorted_data = sort()
print(
enumerate(data))
# print(enumerate(data), key=lambda l: l[1][pos_of_location])
retval =
zip(*
sorted(
enumerate(data)
, key=
lambda l: l[
1][pos_of_location]))
print(
f"sort_on_location: retval={list(retval)
}")
# sort_on_datetime: retval=[(0, 1, 2, 3, 4, 5, 6, 7, 8, 9), (['', '03-10 08:00:00', 'P1', 4.23, 51.3, 26.4], ['', '03-10 08:00:00', 'P2', 4.23, 51.3, 26.4], ['', '03-10 08:00:00', 'P3', 4.23, 51.3, 26.4], ['', '03-10 09:00:00', 'P1', 4.27, 53.4, 26.3], ['', '03-10 09:00:00', 'P2', 4.23, 51.3, 26.4], ['', '03-10 09:00:00', 'P3', 4.23, 51.3, 26.4], ['', '03-10 10:00:00', 'P1', 5.11, 64.4, 26.5], ['', '03-10 10:00:00', 'P2', 5.1, 64.1, 26.5], ['', '03-10 10:00:00', 'P3', 5.11, 64.4, 26.5], ['', '03-10 11:00:00', 'P1', 5.11, 64.4, 26.5])]
# sort on location: retval=[(0, 3, 6, 9, 10, 1, 4, 7, 2, 5, 8), (['', '03-10 08:00:00', 'P1', 4.23, 51.3, 26.4], ['', '03-10 09:00:00', 'P1', 4.27, 53.4, 26.3], ['', '03-10 10:00:00', 'P1', 5.11, 64.4, 26.5], ['', '03-10 11:00:00', 'P1', 5.11, 64.4, 26.5], ['', '03-10 12:00:00', 'P1', 6.0, 70.0, 27.0], ['', '03-10 08:00:00', 'P2', 4.23, 51.3, 26.4], ['', '03-10 09:00:00', 'P2', 4.23, 51.3, 26.4], ['', '03-10 10:00:00', 'P2', 5.1, 64.1, 26.5], ['', '03-10 08:00:00', 'P3', 4.23, 51.3, 26.4], ['', '03-10 09:00:00', 'P3', 4.23, 51.3, 26.4], ['', '03-10 10:00:00', 'P3', 5.11, 64.4, 26.5])]
# sort_on_do: retval=[(0, 3, 6, 9, 1, 4, 7, 2, 5, 8), (['', '03-10 08:00:00', 'P1', 4.23, 51.3, 26.4], ['', '03-10 09:00:00', 'P1', 4.27, 53.4, 26.3], ['', '03-10 10:00:00', 'P1', 5.11, 64.4, 26.5], ['', '03-10 11:00:00', 'P1', 5.11, 64.4, 26.5], ['', '03-10 08:00:00', 'P2', 4.23, 51.3, 26.4], ['', '03-10 09:00:00', 'P2', 4.23, 51.3, 26.4], ['', '03-10 10:00:00', 'P2', 5.1, 64.1, 26.5], ['', '03-10 08:00:00', 'P3', 4.23, 51.3, 26.4], ['', '03-10 09:00:00', 'P3', 4.23, 51.3, 26.4], ['', '03-10 10:00:00', 'P3', 5.11, 64.4, 26.5])]
return retval
# 03-13 16:50:21.574 10582 10628 I python : sort_on_location data=[['', '03-13 16:37:41', 'casa', ' ', ' ', ' '], ['', '03-13 16:37:02', 'casa', ' ', ' ', ' '], ['', '03-13 08:12:36', '111', ' 3.52', ' 44.10', ' 26.80'], ['', '03-13 08:06:45', '111', ' 3.52', ' 44.10', ' 26.80'], ['', '03-13 07:45:18', '111', ' ', ' ', ' '], ['', '03-12 07:28:43', '111', ' ', ' ', ' '], ['', '03-11 13:01:33', '222', ' 7.35', ' 93.50', ' 27.10'], ['', '03-11 13:01:33', '222', ' 7.35', ' 93.50', ' 27.10'], ['', '03-11 13:01:11', 'NULL', ' 7.35', ' 93.50', ' 27.50'], ['', '03-11 12:58:00', '222', ' 8.35', ' 99.10', ' 23.60'], ['', '03-11 12:44:30', '222', ' 7.17', ' 91.70', ' 27.80'], ['', '03-11 12:44:30', '222', ' 7.17', ' 91.70', ' 27.80'], ['', '03-11 12:18:56', '222', ' 7.35', ' 93.50', ' 27.50'], ['', '03-11 11:53:02', '222', ' 6.73', ' 79.50', ' 34.10'], ['', '03-11 11:41:05', '222', ' 4.68', ' 79.80', ' 34.40'], ['', '03-11 11:39:55', 't7', ' 4.68', ' 79.80', ' 34.40'], ['', '03-11 11:32:40', '111', ' 7.30', ' 93.30', ' 27.10'], ['', '03-11 11:10:20', 't6', ' 5.06', ' 86.00', ' 34.20'], ['', '03-11 11:10:20', 't6', ' 5.06', ' 86.00', ' 34.20'], ['', '03-11 11:09:16', 't5', ' 5.06', ' 86.60', ' 34.70']]
# 03-13 16:50:21.575 10582 10628 I python : sort_on_location: retval=[(2, 3, 4, 5, 16, 6, 7, 9, 10, 11, 12, 13, 14, 8, 20, 0, 1, 19, 17, 18, 15), (['', '03-13 08:12:36', '111', ' 3.52', ' 44.10', ' 26.80'], ['', '03-13 08:06:45', '111', ' 3.52', ' 44.10', ' 26.80'], ['', '03-13 07:45:18', '111', ' ', ' ', ' '], ['', '03-12 07:28:43', '111', ' ', ' ', ' '], ['', '03-11 11:32:40', '111', ' 7.30', ' 93.30', ' 27.10'], ['', '03-11 13:01:33', '222', ' 7.35', ' 93.50', ' 27.10'], ['', '03-11 13:01:33', '222', ' 7.35', ' 93.50', ' 27.10'], ['', '03-11 12:58:00', '222', ' 8.35', ' 99.10', ' 23.60'], ['', '03-11 12:44:30', '222', ' 7.17', ' 91.70', ' 27.80'], ['', '03-11 12:44:30', '222', ' 7.17', ' 91.70', ' 27.80'], ['', '03-11 12:18:56', '222', ' 7.35', ' 93.50', ' 27.50'], ['', '03-11 11:53:02', '222', ' 6.73', ' 79.50', ' 34.10'], ['', '03-11 11:41:05', '222', ' 4.68', ' 79.80', ' 34.40'], ['', '03-11 13:01:11', 'NULL', ' 7.35', ' 93.50', ' 27.50'], ['', '03-10 12:00:00', 'P1', 6.0, 70.0, 27.0], ['', '03-13 16:37:41', 'casa', ' ', ' ', ' '], ['', '03-13 16:37:02', 'casa', ' ', ' ', ' '], ['', '03-11 11:09:16', 't5', ' 5.06', ' 86.60', ' 34.70'], ['', '03-11 11:10:20', 't6', ' 5.06', ' 86.00', ' 34.20'], ['', '03-11 11:10:20', 't6', ' 5.06', ' 86.00', ' 34.20'], ['', '03-11 11:39:55', 't7', ' 4.68', ' 79.80', ' 34.40'])]
# ValueError: not enough values to unpack (expected 2, got 0)
# 03-13 16:50:21.576 10582 10628 I python : File "/home/gary/PycharmProjects/YSI_Read/test_tables/.buildozer/android/app/main.py", line 162, in <module>
def sort_on_datetime(
self, data):
print(
f"sort_on_datetime data={data
}")
pos_of_datetime =
1
retval =
zip(*
sorted(
enumerate(data)
, key=
lambda l: l[
1][pos_of_datetime]))
print(
f"WTF: sort_on_datetime: retval={list(retval)
}")
return retval
# 03-13 16:47:10.347 7110 7156 I python : sort_on_datetime data=[['', '03-13 16:37:41', 'casa', ' ', ' ', ' '], ['', '03-13 16:37:02', 'casa', ' ', ' ', ' '], ['', '03-13 08:12:36', '111', ' 3.52', ' 44.10', ' 26.80'], ['', '03-13 08:06:45', '111', ' 3.52', ' 44.10', ' 26.80'], ['', '03-13 07:45:18', '111', ' ', ' ', ' '], ['', '03-12 07:28:43', '111', ' ', ' ', ' '], ['', '03-11 13:01:33', '222', ' 7.35', ' 93.50', ' 27.10'], ['', '03-11 13:01:33', '222', ' 7.35', ' 93.50', ' 27.10'], ['', '03-11 13:01:11', 'NULL', ' 7.35', ' 93.50', ' 27.50'], ['', '03-11 12:58:00', '222', ' 8.35', ' 99.10', ' 23.60'], ['', '03-11 12:44:30', '222', ' 7.17', ' 91.70', ' 27.80'], ['', '03-11 12:44:30', '222', ' 7.17', ' 91.70', ' 27.80'], ['', '03-11 12:18:56', '222', ' 7.35', ' 93.50', ' 27.50'], ['', '03-11 11:53:02', '222', ' 6.73', ' 79.50', ' 34.10'], ['', '03-11 11:41:05', '222', ' 4.68', ' 79.80', ' 34.40'], ['', '03-11 11:39:55', 't7', ' 4.68', ' 79.80', ' 34.40'], ['', '03-11 11:32:40', '111', ' 7.30', ' 93.30', ' 27.10'], ['', '03-11 11:10:20', 't6', ' 5.06', ' 86.00', ' 34.20'], ['', '03-11 11:10:20', 't6', ' 5.06', ' 86.00', ' 34.20'], ['', '03-11 11:09:16', 't5', ' 5.06', ' 86.60', ' 34.70']]
# 03-13 16:47:10.347 7110 7156 I python : sort_on_datetime: retval=[(19, 17, 18, 16, 15, 14, 13, 12, 10, 11, 9, 8, 6, 7, 5, 4, 3, 2, 1, 0), (['', '03-11 11:09:16', 't5', ' 5.06', ' 86.60', ' 34.70'], ['', '03-11 11:10:20', 't6', ' 5.06', ' 86.00', ' 34.20'], ['', '03-11 11:10:20', 't6', ' 5.06', ' 86.00', ' 34.20'], ['', '03-11 11:32:40', '111', ' 7.30', ' 93.30', ' 27.10'], ['', '03-11 11:39:55', 't7', ' 4.68', ' 79.80', ' 34.40'], ['', '03-11 11:41:05', '222', ' 4.68', ' 79.80', ' 34.40'], ['', '03-11 11:53:02', '222', ' 6.73', ' 79.50', ' 34.10'], ['', '03-11 12:18:56', '222', ' 7.35', ' 93.50', ' 27.50'], ['', '03-11 12:44:30', '222', ' 7.17', ' 91.70', ' 27.80'], ['', '03-11 12:44:30', '222', ' 7.17', ' 91.70', ' 27.80'], ['', '03-11 12:58:00', '222', ' 8.35', ' 99.10', ' 23.60'], ['', '03-11 13:01:11', 'NULL', ' 7.35', ' 93.50', ' 27.50'], ['', '03-11 13:01:33', '222', ' 7.35', ' 93.50', ' 27.10'], ['', '03-11 13:01:33', '222', ' 7.35', ' 93.50', ' 27.10'], ['', '03-12 07:28:43', '111', ' ', ' ', ' '], ['', '03-13 07:45:18', '111', ' ', ' ', ' '], ['', '03-13 08:06:45', '111', ' 3.52', ' 44.10', ' 26.80'], ['', '03-13 08:12:36', '111', ' 3.52', ' 44.10', ' 26.80'], ['', '03-13 16:37:02', 'casa', ' ', ' ', ' '], ['', '03-13 16:37:41', 'casa', ' ', ' ', ' '])]
# ValueError: not enough values to unpack (expected 2, got 0)
# 03-13 16:47:10.349 7110 7156 I python : File "/home/gary/PycharmProjects/YSI_Read/test_tables/.buildozer/android/app/main.py", line 162, in <module>
def sort_on_do(
self, data):
print(
f"sort_on_do data={data
}")
pos_of_do =
2
retval =
zip(*
sorted(
enumerate(data)
, key=
lambda l: l[
1][pos_of_do]))
print(
f"sort_on_do: retval={list(retval)
}")
return retval
#
def sort_on_pct(
self, data):
print(
f"sort_on_pct data={data
}")
pos_of_pct =
3
retval =
zip(*
sorted(
enumerate(data)
, key=
lambda l: l[
1][pos_of_pct]))
print(
f"sort_on_pct: retval={list(retval)
}")
return retval
# sort_on_pct data=[['', '03-13 16:37:41', 'casa', ' ', ' ', ' '], ['', '03-13 16:37:02', 'casa', ' ', ' ', ' '], ['', '03-13 08:12:36', '111', ' 3.52', ' 44.10', ' 26.80'], ['', '03-13 08:06:45', '111', ' 3.52', ' 44.10', ' 26.80'], ['', '03-13 07:45:18', '111', ' ', ' ', ' '], ['', '03-12 07:28:43', '111', ' ', ' ', ' '], ['', '03-11 13:01:33', '222', ' 7.35', ' 93.50', ' 27.10'], ['', '03-11 13:01:33', '222', ' 7.35', ' 93.50', ' 27.10'], ['', '03-11 13:01:11', 'NULL', ' 7.35', ' 93.50', ' 27.50'], ['', '03-11 12:58:00', '222', ' 8.35', ' 99.10', ' 23.60'], ['', '03-11 12:44:30', '222', ' 7.17', ' 91.70', ' 27.80'], ['', '03-11 12:44:30', '222', ' 7.17', ' 91.70', ' 27.80'], ['', '03-11 12:18:56', '222', ' 7.35', ' 93.50', ' 27.50'], ['', '03-11 11:53:02', '222', ' 6.73', ' 79.50', ' 34.10'], ['', '03-11 11:41:05', '222', ' 4.68', ' 79.80', ' 34.40'], ['', '03-11 11:39:55', 't7', ' 4.68', ' 79.80', ' 34.40'], ['', '03-11 11:32:40', '111', ' 7.30', ' 93.30', ' 27.10'], ['', '03-11 11:10:20', 't6', ' 5.06', ' 86.00', ' 34.20'], ['', '03-11 11:10:20', 't6', ' 5.06', ' 86.00', ' 34.20'], ['', '03-11 11:09:16', 't5', ' 5.06', ' 86.60', ' 34.70']]
# 03-13 16:42:24.899 2014 2065 I python : sort_on_pct: retval=[(0, 1, 4, 5, 2, 3, 14, 15, 17, 18, 19, 13, 10, 11, 16, 6, 7, 8, 12, 9), (['', '03-13 16:37:41', 'casa', ' ', ' ', ' '], ['', '03-13 16:37:02', 'casa', ' ', ' ', ' '], ['', '03-13 07:45:18', '111', ' ', ' ', ' '], ['', '03-12 07:28:43', '111', ' ', ' ', ' '], ['', '03-13 08:12:36', '111', ' 3.52', ' 44.10', ' 26.80'], ['', '03-13 08:06:45', '111', ' 3.52', ' 44.10', ' 26.80'], ['', '03-11 11:41:05', '222', ' 4.68', ' 79.80', ' 34.40'], ['', '03-11 11:39:55', 't7', ' 4.68', ' 79.80', ' 34.40'], ['', '03-11 11:10:20', 't6', ' 5.06', ' 86.00', ' 34.20'], ['', '03-11 11:10:20', 't6', ' 5.06', ' 86.00', ' 34.20'], ['', '03-11 11:09:16', 't5', ' 5.06', ' 86.60', ' 34.70'], ['', '03-11 11:53:02', '222', ' 6.73', ' 79.50', ' 34.10'], ['', '03-11 12:44:30', '222', ' 7.17', ' 91.70', ' 27.80'], ['', '03-11 12:44:30', '222', ' 7.17', ' 91.70', ' 27.80'], ['', '03-11 11:32:40', '111', ' 7.30', ' 93.30', ' 27.10'], ['', '03-11 13:01:33', '222', ' 7.35', ' 93.50', ' 27.10'], ['', '03-11 13:01:33', '222', ' 7.35', ' 93.50', ' 27.10'], ['', '03-11 13:01:11', 'NULL', ' 7.35', ' 93.50', ' 27.50'], ['', '03-11 12:18:56', '222', ' 7.35', ' 93.50', ' 27.50'], ['', '03-11 12:58:00', '222', ' 8.35', ' 99.10', ' 23.60'])]
# ValueError: not enough values to unpack (expected 2, got 0) pos_of_pct = 3???
def sort_on_temp(
self, data):
print(
f"sort_on_temp data={data
}")
pos_of_temp =
4
retval =
zip(*
sorted(
enumerate(data)
, key=
lambda l: l[
1][pos_of_temp]))
print(
f"sort_on_temp: retval={list(retval)
}")
return retval
MainApp().run()