-
Notifications
You must be signed in to change notification settings - Fork 5
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
base: dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. одноразовое имя - не хорошо |
||
files = filedialog.askopenfilenames(title='Choose packets', initialdir=path, filetypes=(("TLM file", "*.txt"), ("All files", "*.*"))) | ||
for f in files: | ||
Comment on lines
+584
to
+585
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. тоже одноразовая files, можно прямо по результату функции итерироваться. |
||
file = open(f, 'r') | ||
line = file.readline().strip() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. только одну строку? а если в файле их будет много? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Предполагалось, что будут загружаться файлы телеметрии, уже созданные ранее декодером. А в них оригинальный пакет хранится в первой строке. |
||
x = bytes.fromhex(line) | ||
self.feed(x) | ||
file.close() | ||
|
||
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'), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. таки packets или files? |
||
} | ||
self.con_btn.config(text=d[m]['d' in kw]) | ||
|
||
|
@@ -618,9 +629,12 @@ def con(self): | |
m = utils.ConnMode(self.conn_mode.current()) | ||
if m == utils.ConnMode.HEX: | ||
self._hex_values() | ||
elif m == utils.ConnMode.HEX_TXT: | ||
self.openfiles() | ||
else: | ||
self.stop() if self.sk else self._start() | ||
|
||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. лишнее |
||
def set_merge_mode(self): | ||
if self.decoder.ir: | ||
self.decoder.ir.set_merge_mode(self.merge_mode_v.get()) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,13 +21,15 @@ class ConnMode(enum.IntEnum): | |
TCP_CLI = 1 | ||
TCP_SRV = 2 | ||
HEX = 3 | ||
HEX_TXT = 4 | ||
|
||
|
||
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', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TLM явно лишнее |
||
} | ||
|
||
|
||
|
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.
функция внезапно оказалась выше всех остальных. лучше следовать порядку, в котором расположен список источника данных и разместить ее под
_hex_values
.ну и название - мы таки открываем файлы или загружаем их?