tristanpoland / SkiffUI

Create container images at the click of a button, and manage your network with an easy-to-use, intuitive UI
Apache License 2.0
5 stars 1 forks source link

Fix multi-OS compatability #20

Closed tristanpoland closed 1 year ago

tristanpoland commented 1 year ago

This is still a work in progress, currently working with the developers of the upstream code of Gimel Studio as it appears to have the same issue. Once we have updated Gimel Studio we will port the changes to SkiffUI as well.

tristanpoland commented 1 year ago

It appears that the PopupTransientWindow feature in WXPython which is supposed to close automatically as soon as it looses focus does not properly detect the loss of focus and so never closes. this prevents the user from interacting with the main window at all until the app is re-opened. In order to fix this we should swap PopupTransientWindow for a simpler PopupWindow which still allows main window interaction. We should then implement our own loss-of-focus detection system to close it as if it were a PopupTransientWindow. We will also need to detect if a menu is already opened each time to make sure two cannot be open at the same time. These other features are in progress, for now the window type has been changed.

NEW

class AddNodeMenu(wx.PopupWindow):
    def __init__(self, parent, node_registry, size,
                 style=wx.BORDER_NONE | wx.PU_CONTAINS_CONTROLS):
        wx.PopupWindow.__init__(self, parent, style)

        self.parent = parent
        self._size = size
        self._nodeRegistry = node_registry
        self._nodeRegistryMapping = {}

        self.SetBackgroundColour(const.ADD_NODE_MENU_BG)

        self.InitRegistryMapping()
        self.InitAddNodeMenuUI()

    def InitRegistryMapping(self):
        print ("[Debug] Node ID needed")
        i = 0
        for item in self._nodeRegistry:
            if item != "corenode_outputcomposite":
                self._nodeRegistryMapping[i] = item
                i += 1

OLD

class AddNodeMenu(wx.PopupTransientWindow):
    def __init__(self, parent, node_registry, size,
                 style=wx.BORDER_NONE | wx.PU_CONTAINS_CONTROLS):
        wx.PopupTransientWindow.__init__(self, parent, style)

        self.parent = parent
        self._size = size
        self._nodeRegistry = node_registry
        self._nodeRegistryMapping = {}

        self.SetBackgroundColour(const.ADD_NODE_MENU_BG)

        self.InitRegistryMapping()
        self.InitAddNodeMenuUI()

    def InitRegistryMapping(self):
        print ("[Debug] Node ID needed")
        i = 0
        for item in self._nodeRegistry:
            if item != "corenode_outputcomposite":
                self._nodeRegistryMapping[i] = item
                i += 1

the file in question is addnodemenu.py