Пример #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()
Пример #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()
Пример #3
0
 def set_path(self, ctrl, path):
     path = get_first_existing_path(path)
     self.msg("set path to '%s'." % path)
     ctrl.SetValue(path)
Пример #4
0
 def set_path(self, ctrl, path):
     path = get_first_existing_path(path)
     self.msg("set path to '%s'." % path)
     ctrl.SetValue(path)