summaryrefslogtreecommitdiffstats
path: root/pulsecaster
diff options
context:
space:
mode:
authorPaul W. Frields <stickster@gmail.com>2009-06-29 00:30:05 +0200
committerPaul W. Frields <stickster@gmail.com>2009-06-29 00:30:05 +0200
commit9ef29a88256ca25fa2d0e4c16e31382bb22c7043 (patch)
tree62f52799dbe65b57ba313de1ae9e348fb1879067 /pulsecaster
parent867da5cb30508d81f21ab1bbe29d43172e063ec4 (diff)
downloadpulsecaster-9ef29a88256ca25fa2d0e4c16e31382bb22c7043.tar.gz
pulsecaster-9ef29a88256ca25fa2d0e4c16e31382bb22c7043.tar.xz
pulsecaster-9ef29a88256ca25fa2d0e4c16e31382bb22c7043.zip
Add file chooser dialog and functionality
Diffstat (limited to 'pulsecaster')
-rw-r--r--pulsecaster/ui.py26
1 files changed, 23 insertions, 3 deletions
diff --git a/pulsecaster/ui.py b/pulsecaster/ui.py
index 7eabc07..345984e 100644
--- a/pulsecaster/ui.py
+++ b/pulsecaster/ui.py
@@ -93,8 +93,16 @@ class PulseCasterUI:
self.repop_sources()
self.listener = PulseCasterListener(self)
- self.filesinkpath = os.path.join(os.getenv('HOME'), 'podcast.ogg')
self.file_entry = self.xml.get_widget('file_entry')
+ self.file_chooser = self.xml.get_widget('file_chooser')
+ self.open_button = self.xml.get_widget('open_button')
+ self.open_button.connect('button-press-event', self.showFileChooser)
+ self.file_chooser_cancel_button = self.xml.get_widget('file_chooser_cancel_button')
+ self.file_chooser_cancel_button.connect('button-press-event', self.hideFileChooser)
+ self.file_chooser_save_button = self.xml.get_widget('file_chooser_save_button')
+ self.file_chooser_save_button.connect('button-press-event', self.updateFileSinkPath)
+ self.filesinkpath = os.path.join(os.getenv('HOME'), 'podcast.ogg')
+ self.file_chooser.set_filename(self.filesinkpath)
self.file_entry.set_text(self.filesinkpath)
def repop_sources(self, *args):
@@ -121,7 +129,7 @@ class PulseCasterUI:
def on_record(self, *args):
# Get filename
# Check whether filename exists, if so, overwrite? y/n
- filesinkpath = self.file_entry.get_text()
+ filesinkpath = self.file_button.get_file()
if filesinkpath is None:
return
# Set up GStreamer stuff
@@ -178,7 +186,19 @@ class PulseCasterUI:
def hideAbout(self, *args):
self.about.hide()
-
+
+ def showFileChooser(self, *args):
+ self.file_chooser.set_filename(self.filesinkpath)
+ self.file_chooser.show()
+
+ def hideFileChooser(self, *args):
+ self.file_chooser.hide()
+
+ def updateFileSinkPath(self, *args):
+ self.hideFileChooser()
+ self.filesinkpath = self.file_chooser.get_filename()
+ self.file_entry.set_text(self.filesinkpath)
+
class PulseCasterListener:
def __init__(self, ui):