mirror of
				https://github.com/MCV-Software/TWBlue.git
				synced 2025-10-30 20:02:01 +00:00 
			
		
		
		
	Add shorcuts to the audio upload dialogue
This commit is contained in:
		| @@ -74,10 +74,10 @@ class audioUploader(object): | |||||||
|  def on_pause(self, *args, **kwargs): |  def on_pause(self, *args, **kwargs): | ||||||
|   if self.dialog.get("pause") == _(u"Pause"): |   if self.dialog.get("pause") == _(u"Pause"): | ||||||
|    self.recording.pause() |    self.recording.pause() | ||||||
|    self.dialog.set("pause", _(u"Resume")) |    self.dialog.set("pause", _(u"&Resume")) | ||||||
|   elif self.dialog.get("pause") == _(u"Resume"): |   elif self.dialog.get("pause") == _(u"Resume"): | ||||||
|    self.recording.play() |    self.recording.play() | ||||||
|    self.dialog.set("pause", _(U"Pause")) |    self.dialog.set("pause", _(U"&Pause")) | ||||||
|  |  | ||||||
|  def on_record(self, *args, **kwargs): |  def on_record(self, *args, **kwargs): | ||||||
|   if self.recording != None: |   if self.recording != None: | ||||||
| @@ -92,7 +92,7 @@ class audioUploader(object): | |||||||
|   self.file = tempfile.mktemp(suffix='.wav') |   self.file = tempfile.mktemp(suffix='.wav') | ||||||
|   self.recording = sound.recording(self.file) |   self.recording = sound.recording(self.file) | ||||||
|   self.recording.play() |   self.recording.play() | ||||||
|   self.dialog.set("record", _(u"Stop")) |   self.dialog.set("record", _(u"&Stop")) | ||||||
|   output.speak(_(u"Recording")) |   output.speak(_(u"Recording")) | ||||||
|  |  | ||||||
|  def stop_recording(self): |  def stop_recording(self): | ||||||
| @@ -100,11 +100,11 @@ class audioUploader(object): | |||||||
|   self.recording.free() |   self.recording.free() | ||||||
|   output.speak(_(u"Stopped")) |   output.speak(_(u"Stopped")) | ||||||
|   self.recorded = True |   self.recorded = True | ||||||
|   self.dialog.set("record", _(u"Record")) |   self.dialog.set("record", _(u"&Record")) | ||||||
|   self.file_attached() |   self.file_attached() | ||||||
|  |  | ||||||
|  def file_attached(self): |  def file_attached(self): | ||||||
|   self.dialog.set("pause", _(u"Pause")) |   self.dialog.set("pause", _(u"&Pause")) | ||||||
|   self.dialog.disable_control("record") |   self.dialog.disable_control("record") | ||||||
|   self.dialog.enable_control("play") |   self.dialog.enable_control("play") | ||||||
|   self.dialog.enable_control("discard") |   self.dialog.enable_control("discard") | ||||||
| @@ -137,11 +137,11 @@ class audioUploader(object): | |||||||
| #  try: | #  try: | ||||||
|   self.playing = sound_lib.stream.FileStream(file=unicode(self.file), flags=sound_lib.stream.BASS_UNICODE) |   self.playing = sound_lib.stream.FileStream(file=unicode(self.file), flags=sound_lib.stream.BASS_UNICODE) | ||||||
|   self.playing.play() |   self.playing.play() | ||||||
|   self.dialog.set("play", _(u"Stop")) |   self.dialog.set("play", _(u"&Stop")) | ||||||
|   try: |   try: | ||||||
|    while self.playing.is_playing: |    while self.playing.is_playing: | ||||||
|     pass |     pass | ||||||
|    self.dialog.set("play", _(u"Play")) |    self.dialog.set("play", _(u"&Play")) | ||||||
|    self.playing.free() |    self.playing.free() | ||||||
|    self.playing = None |    self.playing = None | ||||||
|   except: |   except: | ||||||
| @@ -151,7 +151,7 @@ class audioUploader(object): | |||||||
|   output.speak(_(u"Stopped")) |   output.speak(_(u"Stopped")) | ||||||
|   self.playing.stop() |   self.playing.stop() | ||||||
|   self.playing.free() |   self.playing.free() | ||||||
|   self.dialog.set("play", _(u"Play")) |   self.dialog.set("play", _(u"&Play")) | ||||||
|   self.playing = None |   self.playing = None | ||||||
|  |  | ||||||
|  def postprocess(self): |  def postprocess(self): | ||||||
|   | |||||||
| @@ -31,14 +31,14 @@ class audioDialog(widgetUtils.BaseDialog): | |||||||
|   btnSizer = wx.BoxSizer(wx.HORIZONTAL) |   btnSizer = wx.BoxSizer(wx.HORIZONTAL) | ||||||
|   btnSizer2 = wx.BoxSizer(wx.HORIZONTAL) |   btnSizer2 = wx.BoxSizer(wx.HORIZONTAL) | ||||||
|  |  | ||||||
|   self.play = wx.Button(panel, -1, _(u"Play")) |   self.play = wx.Button(panel, -1, _(u"&Play")) | ||||||
|   self.play.Disable() |   self.play.Disable() | ||||||
|   self.pause = wx.Button(panel, -1, _(u"Pause")) |   self.pause = wx.Button(panel, -1, _(u"&Pause")) | ||||||
|   self.pause.Disable() |   self.pause.Disable() | ||||||
|   self.record = wx.Button(panel, -1, _(u"Record")) |   self.record = wx.Button(panel, -1, _(u"&Record")) | ||||||
|   self.record.SetFocus() |   self.record.SetFocus() | ||||||
|   self.attach_exists = wx.Button(panel, -1, _(u"Add an existing file")) |   self.attach_exists = wx.Button(panel, -1, _(u"&Add an existing file")) | ||||||
|   self.discard = wx.Button(panel, -1, _(u"Discard")) |   self.discard = wx.Button(panel, -1, _(u"&Discard")) | ||||||
|   self.discard.Disable() |   self.discard.Disable() | ||||||
|   label = wx.StaticText(panel, -1, _(u"Upload to")) |   label = wx.StaticText(panel, -1, _(u"Upload to")) | ||||||
|   self.services = wx.ComboBox(panel, -1, choices=services, value=services[0], style=wx.CB_READONLY) |   self.services = wx.ComboBox(panel, -1, choices=services, value=services[0], style=wx.CB_READONLY) | ||||||
| @@ -47,7 +47,7 @@ class audioDialog(widgetUtils.BaseDialog): | |||||||
|   servicesBox.Add(self.services, 0, wx.ALL, 5) |   servicesBox.Add(self.services, 0, wx.ALL, 5) | ||||||
|   self.attach = wx.Button(panel, wx.ID_OK, _(u"Attach")) |   self.attach = wx.Button(panel, wx.ID_OK, _(u"Attach")) | ||||||
|   self.attach.Disable() |   self.attach.Disable() | ||||||
|   cancel = wx.Button(panel, wx.ID_CANCEL, _(u"Cancel")) |   cancel = wx.Button(panel, wx.ID_CANCEL, _(u"&Cancel")) | ||||||
|   btnSizer.Add(self.play, 0, wx.ALL, 5) |   btnSizer.Add(self.play, 0, wx.ALL, 5) | ||||||
|   btnSizer.Add(self.pause, 0, wx.ALL, 5) |   btnSizer.Add(self.pause, 0, wx.ALL, 5) | ||||||
|   btnSizer.Add(self.record, 0, wx.ALL, 5) |   btnSizer.Add(self.record, 0, wx.ALL, 5) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user