Permalink
Browse files

Fix infinite loop in file dialog

Update gitignore for vi swp files
  • Loading branch information...
Timothy Baldock
Timothy Baldock committed Jan 29, 2012
1 parent 0f7faa7 commit 0a0d3f92ce54145cb44249a40e7b22a52606b2e8
Showing with 10 additions and 0 deletions.
  1. +1 −0 .gitignore
  2. +9 −0 tcui/fileTextBox.py
View
@@ -1,2 +1,3 @@
.DS_Store
*.pyc
+*.swp
View
@@ -45,9 +45,14 @@ def filePickerDialog(self, path1, path2=None, dialogText="", dialogFilesAllowed=
# If path directory component empty, use passed-in "last" path as starting location
# rather than using default starting location
+
if path1 == u"" and config.last_save_path != u"" and os.path.exists(config.last_save_path):
a = config.last_save_path
+ debug(u"Path a is: %s and path b is: %s" % (a, b))
+
+ # Check path components exist
+
# Show the dialog
pickerDialog = wx.FileDialog(self.parent, dialogText,
a, b, dialogFilesAllowed, dialogFlags)
@@ -159,7 +164,11 @@ def existingPath(self, p):
if os.path.split(os.path.split(p)[0])[1] != "":
p = os.path.split(p)[0]
while not os.path.exists(p):
+ q = p
p = os.path.split(p)[0]
+ # Avoid infinite loop
+ if p == q:
+ return u""
return p
def comparePaths(self, p1, p2):

0 comments on commit 0a0d3f9

Please sign in to comment.