import dialog
import sys
import os
+import stat
import textwrap
import signal
import optparse
def select_file(d, media):
- root = os.sep
+ default = os.getcwd() + os.sep
while 1:
if media is not None:
if not os.path.exists(media):
d.msgbox("The file `%s' you choose does not exist." % media,
width=SMALL_WIDTH)
else:
- break
+ mode = os.stat(media).st_mode
+ if not stat.S_ISDIR(mode):
+ break
+ default = media
- (code, media) = d.fselect(root, 10, 50,
- title="Please select input media")
+ (code, media) = d.fselect(default, 10, 60, extra_button=1,
+ title="Please select an input media.",
+ extra_label="Bundle Host")
if code in (d.DIALOG_CANCEL, d.DIALOG_ESC):
if confirm_exit(d, "You canceled the media selection dialog box."):
sys.exit(0)
else:
media = None
continue
+ elif code == d.DIALOG_EXTRA:
+ return '/'
return media