[jokosher-devel] [PATCH] import selection of audio
- From: John Kelly <kelly_worth2003 yahoo co uk>
- To: Jokosher development list <jokosher-devel-list gnome org>
- Subject: [jokosher-devel] [PATCH] import selection of audio
- Date: Sat, 16 Dec 2006 22:01:15 +0000
This patch will eventually add the ability to select the amount of audio
the user wishes to import in minutes and seconds. At the moment, only
the gui is done. The gui looks acceptable but it probably could look
better.
John
Index: EventLaneViewer.py
===================================================================
--- EventLaneViewer.py (revision 1014)
+++ EventLaneViewer.py (working copy)
@@ -104,6 +104,8 @@
break
self.messageID = None
+ # audio length example
+ self.alength = 1760
self.Update()
@@ -275,6 +277,27 @@
self.queue_draw()
#_____________________________________________________________________
+
+ def ExpanderClicked(self, expander, param_spec):
+ if expander.get_expanded():
+ expander.set_label(_("Show Fewer Options"))
+ else:
+ expander.set_label(_("Show More Options"))
+ #_____________________________________________________________________
+
+ def SpinTotals(self, mspin, sspin):
+ seconds = sspin.get_value_as_int()
+ minsec = mspin.get_value_as_int() * 60
+ total = minsec + seconds
+ return total
+ #_____________________________________________________________________
+
+ def ChangedSpinValues(self, dlg, mspin, sspin):
+ filename = dlg.get_filename()
+ if filename:
+ pass
+
+ #_____________________________________________________________________
def CreateEventFromFile(self, evt):
"""
@@ -290,21 +313,74 @@
dlg = gtk.FileChooserDialog(_("Import file..."), action=gtk.FILE_CHOOSER_ACTION_OPEN, buttons=buttons)
dlg.set_current_folder(Globals.settings.general["projectfolder"])
- dlg.set_extra_widget(copyfile)
+ tlabel = gtk.Label(_("Length of audio to be imported:"))
+ tlabel.set_alignment(0, 0.5)
+ minutes = self.alength / 60
+ seconds = self.alength - (minutes * 60)
+ # minutes spin button, label and vbox
+ mvbox = gtk.VBox()
+ mlabel = gtk.Label(_("Minutes"))
+ mspin = gtk.SpinButton()
+ mspin.set_increments(1, 5)
+
+ mspin.set_range(1, minutes)
+ mspin.set_value(minutes)
+
+ mvbox.pack_start(mlabel, False, False)
+ mvbox.pack_start(mspin, False, False)
+
+ # seconds spin button, label and vbox
+ svbox = gtk.VBox()
+ slabel = gtk.Label(_("Seconds"))
+ sspin = gtk.SpinButton()
+ sspin.set_increments(1, 5)
+
+ sspin.set_range(1, seconds)
+ sspin.set_value(seconds)
+
+ svbox.pack_start(slabel, False, False)
+ svbox.pack_start(sspin, False, False)
+
+ # time hbox
+ thbox = gtk.HBox()
+ thbox.set_spacing(12)
+ thbox.set_border_width(6)
+ thbox.pack_start(tlabel, False, False)
+ thbox.pack_start(mvbox, False, False)
+ thbox.pack_start(svbox, False, False)
+
+ # exapnder widget
+ exp = gtk.Expander(_("Show More Options"))
+ exp.connect("notify::expanded", self.ExpanderClicked)
+ exp.add(thbox)
+ exp.show_all()
+
vbox = gtk.VBox()
audiopreview = AudioPreview()
vbox.pack_start(audiopreview, True, False)
vbox.show_all()
+ # copyfile and expander widget are packed inside exvbox which will be the extra widget for the dialog
+ exvbox = gtk.VBox()
+ exvbox.set_border_width(6)
+ exvbox.set_spacing(6)
+ exvbox.pack_start(copyfile, False, False)
+ exvbox.pack_start(exp, False, False)
+ dlg.set_extra_widget(exvbox)
+
+ dlg.set_use_preview_label(False)
dlg.set_preview_widget(vbox)
- dlg.set_use_preview_label(False)
dlg.connect("selection-changed", audiopreview.OnSelection)
+ dlg.connect("selection-changed", self.ChangedSpinValues, sspin, mspin)
response = dlg.run()
if response == gtk.RESPONSE_OK:
+ # the total amount in seconds for both spin buttons
+ total = self.SpinTotals(mspin, sspin)
+
#stop the preview audio from playing without destorying the dialog
audiopreview.OnDestroy()
dlg.hide()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]