Skip to content
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

added loading telemetry from recent TLM text files #3

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

brightkill
Copy link

No description provided.

Copy link
Owner

@baskiton baskiton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

решение требует генерализации. нет смысла иметь поддержку только одного типа файлов - нашему выходному файлу телеметрии.
потому:

  1. обобщить, читая файлы построчно
  2. совместить с уже имеющимся функционалом загрузки HEX значений из поля ввода
  3. соответствующе обозвать все функции, строки и тд
  4. кодстайл
  5. не забываем про документацию

else:
self.stop() if self.sk else self._start()


Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

лишнее

@@ -579,13 +579,24 @@ def __init__(self, master, config, name):
self.dv_frame = DataViewFrame(self)
self.dv_frame.grid(column=1, row=0, rowspan=2, sticky=tk.NSEW, padx=2, pady=2)

def openfiles(self):
path = HOMEDIR
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

одноразовое имя - не хорошо

Comment on lines +584 to +585
files = filedialog.askopenfilenames(title='Choose packets', initialdir=path, filetypes=(("TLM file", "*.txt"), ("All files", "*.*")))
for f in files:
Copy link
Owner

@baskiton baskiton Jun 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

тоже одноразовая files, можно прямо по результату функции итерироваться.
также askopenfilenames лучше заменить на askopenfiles, где открытие файла сделается само.
тут же - одна строка в одинарных кавычках, другие в двойных

files = filedialog.askopenfilenames(title='Choose packets', initialdir=path, filetypes=(("TLM file", "*.txt"), ("All files", "*.*")))
for f in files:
file = open(f, 'r')
line = file.readline().strip()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

только одну строку? а если в файле их будет много?
в целом, итерация по строкам уже есть в _hex_values, надо лишь генерализовать, выведя в отдельную функцию для скармливания данных

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Предполагалось, что будут загружаться файлы телеметрии, уже созданные ранее декодером. А в них оригинальный пакет хранится в первой строке.

@@ -579,13 +579,24 @@ def __init__(self, master, config, name):
self.dv_frame = DataViewFrame(self)
self.dv_frame.grid(column=1, row=0, rowspan=2, sticky=tk.NSEW, padx=2, pady=2)

def openfiles(self):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

функция внезапно оказалась выше всех остальных. лучше следовать порядку, в котором расположен список источника данных и разместить ее под _hex_values.
ну и название - мы таки открываем файлы или загружаем их?

def named_conn_btn(self, _=None, **kw):
m = utils.ConnMode(self.conn_mode.current())
d = {
utils.ConnMode.AGWPE_CLI: ('Connect', 'Disconnect'),
utils.ConnMode.TCP_CLI: ('Connect', 'Disconnect'),
utils.ConnMode.TCP_SRV: ('Start', 'Stop'),
utils.ConnMode.HEX: ('Run', 'Stop'),
utils.ConnMode.HEX_TXT: ('Load packets', 'Stop'),
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

таки packets или files?



con_mode_names = {
ConnMode.AGWPE_CLI: 'AGWPE Client',
ConnMode.TCP_CLI: 'TCP Client',
ConnMode.TCP_SRV: 'TCP Server',
ConnMode.HEX: 'HEX values',
ConnMode.HEX_TXT: 'HEX from TLM file',
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TLM явно лишнее

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants