Ejemplo n.º 1
0
    def _set_path(self, ctrl, txt):
        defaultPath = ctrl.GetValue()
        defaultPath = get_first_existing_path(defaultPath)
        if not os.path.isdir(defaultPath):
            defaultPath = os.getcwd()

        dlg = wx.DirDialog(self,
                           "Choose the %s path" % txt,
                           defaultPath=defaultPath,
                           style=wx.DD_DEFAULT_STYLE | wx.DD_NEW_DIR_BUTTON)
        if dlg.ShowModal() == wx.ID_OK:
            path = dlg.GetPath()
            path = os.path.normpath(path)
            if path != ctrl.GetValue():
                self.msg("set %s path to: %s" % (txt, path))
                self.set_path(ctrl, path)

        dlg.Destroy()
Ejemplo n.º 2
0
    def _set_path(self, ctrl, txt):
        defaultPath = ctrl.GetValue()
        defaultPath = get_first_existing_path(defaultPath)
        if not os.path.isdir(defaultPath):
            defaultPath = os.getcwd()

        dlg = wx.DirDialog(
            self, "Choose the %s path" % txt,
            defaultPath=defaultPath,
            style=wx.DD_DEFAULT_STYLE | wx.DD_NEW_DIR_BUTTON
        )
        if dlg.ShowModal() == wx.ID_OK:
            path = dlg.GetPath()
            path = os.path.normpath(path)
            if path != ctrl.GetValue():
                self.msg("set %s path to: %s" % (txt, path))
                self.set_path(ctrl, path)

        dlg.Destroy()
Ejemplo n.º 3
0
 def set_path(self, ctrl, path):
     path = get_first_existing_path(path)
     self.msg("set path to '%s'." % path)
     ctrl.SetValue(path)
Ejemplo n.º 4
0
 def set_path(self, ctrl, path):
     path = get_first_existing_path(path)
     self.msg("set path to '%s'." % path)
     ctrl.SetValue(path)