pygubu-designer icon indicating copy to clipboard operation
pygubu-designer copied to clipboard

pygubu-designer opens outside of vision after dual monitor used

Open paulocorleone opened this issue 1 year ago • 3 comments

Hey,

I've found an issue where after using pygubu-designer on the second monitor, it will show outside of vision once you unplug the second monitor and reopen the program. I tried using windows shortcuts to move it, but was unable to.

I've solved it by adding the following code to PygubuDesigner.setup_app_preferences()

def setup_app_preferences(self):
        # Restore windows position and size
        geom = pref.get_window_size()

        # Check if window is outside of bounds
        window_size, x_axis, y_axis = geom.split("+")
        if (int(x_axis) < 0):
            x_axis = "0"
        if (int(y_axis) < 0):
            y_axis = "0"
        geom = "+".join((window_size, x_axis, y_axis))

        self.mainwindow.geometry(geom)
        # Load preferred ttk theme
        theme = pref.get_option('ttk_theme')
        self._change_ttk_theme(theme)

The downside to this is that, now the pygubu-designer will always popup in the main monitor.

Hope it helps.

paulocorleone avatar Aug 17 '22 21:08 paulocorleone

Hello @paulocorleone, thanks for trying pugubu and for your report.

One option can be remove the geometry setting form the configuration file. If you are on a Linux distro, run this command in the console:

sed -i.bak '/geometry/d' ~/.local/share/pygubu-designer/config

This will remove the geometry configuration and create a backup of the config file. After that, the designer will start in your current screen.

Regards Alejandro A.

alejandroautalan avatar Aug 17 '22 23:08 alejandroautalan

Hi @alejandroautalan

I'm on Windows 10, can't seem to find that config file in the pygubudesigner folder.

Thanks

paulocorleone avatar Aug 18 '22 08:08 paulocorleone

Hello.

On windows 10 the configuration file is located in:

%USERPROFILE%\AppData\Local\pygubu-designer\pygubu-designer\config

Example:

C:\Users\useradmin\AppData\Local\pygubu-designer\pygubu-designer\config

Regards Alejandro A.

alejandroautalan avatar Aug 19 '22 22:08 alejandroautalan