Collect metadata on file transfer to pass to pending transfer widget #2

Closed
opened 2020-10-07 17:54:59 +02:00 by decentral1se · 4 comments
Owner

What is expected can be read from the following UI file:

https://git.vvvvvvaria.org/rra/dropship/src/branch/main/pendingTransmissions.ui

Need to handle:

  • Cancel the running transfer task (when X clicked)
  • Name of the file, size of the file
  • Transfer code
  • ???
What is expected can be read from the following UI file: > https://git.vvvvvvaria.org/rra/dropship/src/branch/main/pendingTransmissions.ui Need to handle: - [ ] Cancel the running transfer task (when X clicked) - [ ] Name of the file, size of the file - [ ] Transfer code - [ ] ???
decentral1se self-assigned this 2020-10-07 17:55:05 +02:00
Owner

I did an attempt at getting it to work with a minimal and naive implementation (see 3b8fb66032 on pendingUI branch) but getting errors I don't know how to interpret.

dropship.py:105: PyGTKDeprecationWarning: Using positional arguments with the GObject constructor has been deprecated. Please specify keyword(s) for "homogeneous, spacing" or use a class specific constructor. See: https://wiki.gnome.org/PyGObject/InitializerDeprecations
  status = pendingTransmissions(fpath, self.transfer_code)
Traceback (most recent call last):
  File "dropship.py", line 105, in on_drop
    status = pendingTransmissions(fpath, self.transfer_code)
  File "/usr/local/lib/python3.7/dist-packages/gi/overrides/__init__.py", line 319, in new_init
    return super_init_func(self, **new_kwargs)
TypeError: could not convert value for property `spacing' from str to gint

Based on fef71be702/minigalaxy/ui/gametile.py and fef71be702/minigalaxy/ui/library.py (L110) it should be possible to do it the proper way.

I did an attempt at getting it to work with a minimal and naive implementation (see https://git.vvvvvvaria.org/rra/dropship/commit/3b8fb6603223acad5578c9083c9bb2a0db9cd485 on pendingUI branch) but getting errors I don't know how to interpret. ``` dropship.py:105: PyGTKDeprecationWarning: Using positional arguments with the GObject constructor has been deprecated. Please specify keyword(s) for "homogeneous, spacing" or use a class specific constructor. See: https://wiki.gnome.org/PyGObject/InitializerDeprecations status = pendingTransmissions(fpath, self.transfer_code) Traceback (most recent call last): File "dropship.py", line 105, in on_drop status = pendingTransmissions(fpath, self.transfer_code) File "/usr/local/lib/python3.7/dist-packages/gi/overrides/__init__.py", line 319, in new_init return super_init_func(self, **new_kwargs) TypeError: could not convert value for property `spacing' from str to gint ``` Based on https://github.com/sharkwouter/minigalaxy/blob/fef71be7022dd2981e3115ef4f1dbb281e3d1dd5/minigalaxy/ui/gametile.py and https://github.com/sharkwouter/minigalaxy/blob/fef71be7022dd2981e3115ef4f1dbb281e3d1dd5/minigalaxy/ui/library.py#L110 it should be possible to do it the proper way.
Author
Owner

Here's a helper on how to cancel a task:

https://stackoverflow.com/a/60675826

Here's a helper on how to cancel a task: > https://stackoverflow.com/a/60675826
Author
Owner

Soooo, nearly there, I think! With https://git.vvvvvvaria.org/rra/dropship/src/branch/main/dropship/dropship.py#L131-L134, I currently see:

➜  dropship (main) ✔ poetry run dropship
Traceback (most recent call last):
  File "/home/decentral1se/.cache/pypoetry/virtualenvs/dropship-81zsWiEI-py3.8/lib/python3.8/site-packages/gi/_gtktemplate.py", line 31, in connect_func
    template_inst.__gtktemplate_handlers__.add(handler_name)
AttributeError: 'ListBoxRow' object has no attribute '__gtktemplate_handlers__'
Traceback (most recent call last):
  File "/home/decentral1se/.cache/pypoetry/virtualenvs/dropship-81zsWiEI-py3.8/lib/python3.8/site-packages/gi/_gtktemplate.py", line 31, in connect_func
    template_inst.__gtktemplate_handlers__.add(handler_name)
AttributeError: 'ListBoxRow' object has no attribute '__gtktemplate_handlers__'
Traceback (most recent call last):
  File "/home/decentral1se/.cache/pypoetry/virtualenvs/dropship-81zsWiEI-py3.8/lib/python3.8/site-packages/gi/_gtktemplate.py", line 95, in <lambda>
    lambda s: init_template(s, cls, base_init_template)
  File "/home/decentral1se/.cache/pypoetry/virtualenvs/dropship-81zsWiEI-py3.8/lib/python3.8/site-packages/gi/_gtktemplate.py", line 118, in init_template
    raise RuntimeError(
RuntimeError: Handler 'copy_transfer_code' was declared with @Gtk.Template.Callback but was not present in template

So, I think we need to wire up some connect(...) calls like we do in Window and the template? I am not sure what works here since I do not know if the handling of these callbacks is like the signal handlers?

Also, when I commented these out, I still couldn't get a transfer to show. I tried called show() on the self.pending_transfer_list but that didn't work either?

Also see #1 (comment).

Soooo, nearly there, I think! With https://git.vvvvvvaria.org/rra/dropship/src/branch/main/dropship/dropship.py#L131-L134, I currently see: ``` ➜ dropship (main) ✔ poetry run dropship Traceback (most recent call last): File "/home/decentral1se/.cache/pypoetry/virtualenvs/dropship-81zsWiEI-py3.8/lib/python3.8/site-packages/gi/_gtktemplate.py", line 31, in connect_func template_inst.__gtktemplate_handlers__.add(handler_name) AttributeError: 'ListBoxRow' object has no attribute '__gtktemplate_handlers__' Traceback (most recent call last): File "/home/decentral1se/.cache/pypoetry/virtualenvs/dropship-81zsWiEI-py3.8/lib/python3.8/site-packages/gi/_gtktemplate.py", line 31, in connect_func template_inst.__gtktemplate_handlers__.add(handler_name) AttributeError: 'ListBoxRow' object has no attribute '__gtktemplate_handlers__' Traceback (most recent call last): File "/home/decentral1se/.cache/pypoetry/virtualenvs/dropship-81zsWiEI-py3.8/lib/python3.8/site-packages/gi/_gtktemplate.py", line 95, in <lambda> lambda s: init_template(s, cls, base_init_template) File "/home/decentral1se/.cache/pypoetry/virtualenvs/dropship-81zsWiEI-py3.8/lib/python3.8/site-packages/gi/_gtktemplate.py", line 118, in init_template raise RuntimeError( RuntimeError: Handler 'copy_transfer_code' was declared with @Gtk.Template.Callback but was not present in template ``` So, I think we need to wire up some `connect(...)` calls like we do in Window and the template? I am not sure what works here since I do not know if the handling of these callbacks is like the signal handlers? Also, when I commented these out, I still couldn't get a transfer to show. I tried called `show()` on the `self.pending_transfer_list` but that didn't work either? Also see https://git.vvvvvvaria.org/rra/dropship/issues/1#issuecomment-113.
Author
Owner

That's done!

That's done! ⛅
Sign in to join this conversation.
No Label
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: rra/dropship#2
No description provided.