Code indexing in gitaly is broken and leads to code not being visible to the user. We work on the issue with highest priority.

Skip to content

Draft: fix(dock): docks can be created as temporary, when closed the dock will not...

wyzula_j requested to merge fix/temp-docks into main

Description

Added temp flag for .add_dock method. This creates a temporary dock popup which do not return to the original dock area.

Related Issues

closes #216

Type of Change

  • temp flag in add_dock

Potential side effects

ATM there is a thread leak, if the temp dock is created in with the BECIPythonClient and then bec is closed.

No thread leak after rebasing, however but there is probably more elegant way just to add something like this on the DockArea level instead of changing the BECDock code (from @wakonig_k ):

        if temporary:
            target_area = self.dock_area.addTempArea()
        else:
            target_area = self.dock_area

        dock = BECDock(name=name, parent_dock_area=self, closable=closable)
        dock.config.position = position
        self.config.docks[name] = dock.config

        target_area.addDock(dock=dock, position=position, relativeTo=relative_to)

        if len(target_area.docks) <= 1:
            dock.hide_title_bar()
        elif len(target_area.docks) > 1:
            for dock in target_area.docks.values():
                dock.show_title_bar()

Screenshots / GIFs (if applicable)

[Include any relevant screenshots or GIFs to showcase the changes made.]

Additional Comments

The problem could be solved just by alternating pyqtgraph code TempAreaWindow to include check for dock.temp or something like that. I have to create new BECDockArea just for this temp dock.

class TempAreaWindow(QtWidgets.QWidget):
    def __init__(self, area, **kwargs):
        QtWidgets.QWidget.__init__(self, **kwargs)
        self.layout = QtWidgets.QGridLayout()
        self.setLayout(self.layout)
        self.layout.setContentsMargins(0, 0, 0, 0)
        self.dockarea = area
        self.layout.addWidget(area)

    def closeEvent(self, *args):
        # restore docks to their original area
        docks = self.dockarea.findAll()[1]
        for dock in docks.values(): #HERE IF THERE WOULD BE FLAG FOR TEMP, ALL OUR TROUBLES ARE SOLVED
            if hasattr(dock, 'orig_area'):
                dock.orig_area.addDock(dock, )
        # clear dock area, and close remaining docks
        self.dockarea.clear()
        super().closeEvent(*args)

Definition of Done

  • Documentation is up-to-date.
Edited by wyzula_j

Merge request reports

Loading