Sitelet https://github.com/gpodder/gpodder/pull/1126
Skip to content

Add comtypes module to Windows build for the taskbar progress extension. - #1126

Merged
elelay merged 2 commits into
masterfrom
win-comtypes
Nov 6, 2021
Merged

elelay merged 2 commits into
masterfrom
win-comtypes

Conversation

@auouymous

Copy link
Copy Markdown
Member

No description provided.

@elelay

elelay commented Oct 11, 2021

Copy link
Copy Markdown
Member

Sorry I missed that one and now artifacts are gone. A rebuild is in progress.

@elelay

elelay commented Oct 13, 2021

Copy link
Copy Markdown
Member

There is a secondary issue:

1634125118.638199 [gpodder.log] ERROR: Uncaught exception: Traceback (most recent call last):
  File "C:\gpodder-3.10.21-portable\data\share\gpodder\extensions\taskbar_progress.py", line 164, in callback
    self.window_handle = window.window.handle
AttributeError: 'ApplicationWindow' object has no attribute 'window'

Traceback (most recent call last):
  File "C:\gpodder-3.10.21-portable\data\share\gpodder\extensions\taskbar_progress.py", line 164, in callback
    self.window_handle = window.window.handle
AttributeError: 'ApplicationWindow' object has no attribute 'window'

Solution

    def on_ui_object_available(self, name, ui_object):
        def callback(self, window, *args):
            #make sure to call ensure_native before e.g. on realize
            if not window.get_window().has_native():
                print("Your window is gonna freeze as soon as you move or resize it...")
            ctypes.pythonapi.PyCapsule_GetPointer.restype = ctypes.c_void_p
            ctypes.pythonapi.PyCapsule_GetPointer.argtypes = [ctypes.py_object]
            drawingarea_gpointer = ctypes.pythonapi.PyCapsule_GetPointer(window.get_window().__gpointer__, None)            
            #get the win32 handle
            gdkdll = ctypes.CDLL ("libgdk-3-0.dll")
            self.window_handle =  gdkdll.gdk_win32_window_get_handle(drawingarea_gpointer)

        if name == 'gpodder-gtk':
            ui_object.main_window.connect('realize',
                    functools.partial(callback, self))

Source: https://stackoverflow.com/questions/23021327/how-i-can-get-drawingarea-window-handle-in-gtk3

Other issue : the Downloads folder wasn't created, with error messages => I'll try to investigate

1634125824.664181 [gpodder.util] WARNING: Could not create directory C:\gpodder-3.10.21-portable\config\Downloads\The Moth: Operation not supported
1
```

@elelay

elelay commented Nov 1, 2021

Copy link
Copy Markdown
Member

See #1191 for the create directory issue

@elelay
elelay merged commit 28d7c6c into master Nov 6, 2021
@auouymous
auouymous deleted the win-comtypes branch November 6, 2021 16:26
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.

2 participants