diff options
Diffstat (limited to 'pulsecaster/ui.py')
-rw-r--r-- | pulsecaster/ui.py | 26 |
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): |