Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Paths issues in wx.lib.agw.multidirdialog #2120

Closed
cipriantrofin opened this issue Mar 5, 2022 · 2 comments · Fixed by #2134
Closed

Paths issues in wx.lib.agw.multidirdialog #2120

cipriantrofin opened this issue Mar 5, 2022 · 2 comments · Fixed by #2134

Comments

@cipriantrofin
Copy link

Operating system: Windows 10, x64
wxPython version & source: 4.1.1 msw (phoenix) wxWidgets 3.1.5, pip
Python version & source: Python 3.8.5 (tags/v3.8.5:580fbb0, Jul 20 2020, 15:57:54) [MSC v.1924 64 bit (AMD64)] on win32, stock

Description of the problem:
wx.lib.agw.multidirdialog returns bad paths.
I run the code below and before submiting the OK button I get the screen like the screeenshot below.

The problem is: the code returns Disc local (E:)\Proiecte PY; I was expecting something like E:\Proiecte PY (a valid path).

screenshot

Code Example (click to expand)
import os
import wx
import wx.lib.agw.multidirdialog as MDD

app = wx.App(0)
dlg = MDD.MultiDirDialog(None, defaultPath = os.getcwd(), agwStyle=MDD.DD_DIR_MUST_EXIST)

if dlg.ShowModal() != wx.ID_OK:
    dlg.Destroy()


paths = dlg.GetPaths()
print (paths[0])
dlg.Destroy()

app.MainLoop()
@DietmarSchwertberger
Copy link
Contributor

@cipriantrofin
Please try this modification:
site-packages\wx\lib\agw\multidirdialog.py around line 447:

    def GetPaths(self):
        """ Returns the folders selected by the user, or the default path. """
        return self.dirCtrl.GetPaths()

        # Retrieve the tree control and the selections the
        # user has made
        treeCtrl = self.dirCtrl.GetTreeCtrl()
        selections = treeCtrl.GetSelections()

@DietmarSchwertberger
Copy link
Contributor

DietmarSchwertberger commented Apr 11, 2022

I have just tried on Windows and Ubuntu.
dirCtrl.GetPaths() fails with wxPython 4.1.1.
It's working with the current git version (just built myself).
So, I think it's safe to modify multidirdialog.py.

DietmarSchwertberger added a commit to DietmarSchwertberger/Phoenix that referenced this issue Apr 11, 2022
RobinD42 added a commit that referenced this issue May 21, 2022
fix issue #2120: wx.lib.agw.multidirdialog.MultiDirDialog.GetPaths()
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 a pull request may close this issue.

2 participants