Example #1
0
    def activate_preferences(self):
        espeak.set_parameter(espeak.Parameter.Rate, self.voice_message_rate)
        espeak.set_parameter(espeak.Parameter.Pitch, self.voice_message_pitch)
        espeak.set_parameter(espeak.Parameter.Volume,
                             self.voice_message_volume)
        espeak.set_voice(espeak.list_voices()[self.voice_message_voice].name)

        self.highlight_tag = self.textbuffer.create_tag('Reading')
        self.highlight_tag.set_property(
            'foreground',
            Gdk.color_parse(self.highlight_color).to_string())
        self.highlight_tag.set_property('font', self.highlight_font)
        self.highlight_tag.set_property(
            'background',
            Gdk.color_parse(self.background_highlight_color).to_string())

        pangoFont = Pango.FontDescription(self.font)
        self.textview.modify_font(pangoFont)
        self.textview.modify_fg(Gtk.StateFlags.NORMAL,
                                Gdk.color_parse(self.font_color))
        self.textview.modify_bg(Gtk.StateFlags.NORMAL,
                                Gdk.color_parse(self.background_color))
        self.set_dict("%s" % self.key_value[self.language])
        if (self.require_scanner_refresh):
            self.scanner_refresh(self)
Example #2
0
	def on_Audio_converter_activate(self,wedget,data=None):
		try:
			start,end = self.textbuffer.get_selection_bounds()
		except ValueError:
			start,end = self.textbuffer.get_bounds()
		
		self.text_to_convert = self.textbuffer.get_text(start,end)
		to_convert = open("temp.txt",'w')
		to_convert.write(self.text_to_convert)
		to_convert.close()
		
		builder = gtk.Builder()
		builder.add_from_file("/usr/share/pyshared/sbw/ui/audio_converter.glade")
		builder.connect_signals(self)
		self.audio_converter_window = builder.get_object("window")
			
			
			
		self.spinbutton_speed = builder.get_object("spinbutton_speed")
		self.spinbutton_pitch = builder.get_object("spinbutton_pitch")
		self.spinbutton_split = builder.get_object("spinbutton_split")
		self.spinbutton_vloume = builder.get_object("spinbutton_vloume")
			
		voice = builder.get_object("combobox_language_convert")
		for item in espeak.list_voices():
			voice.append_text(item.name)
		voice.set_active(12)
		self.model_voice = voice.get_model()
		self.index_voice = voice.get_active()
		
				
		voice.connect('changed', self.change_voice)
		self.audio_converter_window.show()		                
Example #3
0
 def getVoiceFamilies(self):
     # Always offer the configured default voice with a language
     # set according to the current locale.
     from locale import getlocale, LC_MESSAGES
     locale = getlocale(LC_MESSAGES)[0]
     if locale is None or locale == 'C':
         lang = None
         dialect = None
     else:
         lang, dialect = locale.split('_')
     list_synthesis_voices = espeak.list_voices()
     families = [speechserver.VoiceFamily({ \
           speechserver.VoiceFamily.NAME: self._default_voice_name,
           #speechserver.VoiceFamily.GENDER: speechserver.VoiceFamily.MALE,
           speechserver.VoiceFamily.DIALECT: dialect,
           speechserver.VoiceFamily.LOCALE: lang})]
     for voice in list_synthesis_voices:
         dialect = None
         identifier = voice.identifier.split('/')[-1].split('-')
         locale = identifier[0]
         try:
             dialect = identifier[1]
         except IndexError:
             dialect = None
         families.append(speechserver.VoiceFamily({ \
             speechserver.VoiceFamily.NAME: voice.name,
             speechserver.VoiceFamily.DIALECT: dialect,
             speechserver.VoiceFamily.LOCALE: locale}))
     return families
Example #4
0
 def getVoiceFamilies(self):
     # Always offer the configured default voice with a language
     # set according to the current locale.
     from locale import getlocale, LC_MESSAGES
     locale = getlocale(LC_MESSAGES)[0]
     if locale is None or locale == 'C':
         lang = None
         dialect = None
     else:
         lang, dialect = locale.split('_')
     list_synthesis_voices = espeak.list_voices()
     families = [speechserver.VoiceFamily({ \
           speechserver.VoiceFamily.NAME: self._default_voice_name,
           #speechserver.VoiceFamily.GENDER: speechserver.VoiceFamily.MALE,
           speechserver.VoiceFamily.DIALECT: dialect,
           speechserver.VoiceFamily.LOCALE: lang})]
     for voice in list_synthesis_voices:
         dialect = None
         identifier = voice.identifier.split('/')[-1].split('-')
         locale = identifier[0]
         try:
             dialect = identifier[1]
         except IndexError:
             dialect = None
         families.append(speechserver.VoiceFamily({ \
             speechserver.VoiceFamily.NAME: voice.name,
             speechserver.VoiceFamily.DIALECT: dialect,
             speechserver.VoiceFamily.LOCALE: locale}))
     return families
 def list_voices(self):
     if self.say_backend == self.say_espeak:
         from espeak import espeak
         voices = espeak.list_voices()
         vlist = [v.name for v in voices]
         print(vlist)
     elif self.say_backend == self.say_pyttsx3:
         vlist = [v.name for v in self.pyttsx3_engine.getProperty('voices')]
         print(vlist)
Example #6
0
def commands(word, word_eol, users):
    """Function for doing different commands with XChat"""
    commands = {"set" : set_user,
                "rm" : deluser,
                "langlist" : (lambda x: ", ".join([item["name"] for item in espeak.list_voices()])),
                "save" : (lambda x: save()),
                "list" : (lambda x: "\n".join(["%s : %s" % (key, value["args"]) for key, value in options.iteritems()]))}

    arguments = word[1:]
    try:
        print commands[arguments[0]](arguments[1:])
    except KeyError:
        return xchat.EAT_XCHAT
Example #7
0
	def activate_preferences(self):
		espeak.set_parameter(espeak.Parameter.Rate,self.voice_message_rate)
		espeak.set_parameter(espeak.Parameter.Pitch,self.voice_message_pitch)
		espeak.set_parameter(espeak.Parameter.Volume,self.voice_message_volume)
		espeak.set_voice(espeak.list_voices()[self.voice_message_voice].name)
		
		self.highlight_tag = self.textbuffer.create_tag('Reading')
		self.highlight_tag.set_property('foreground',Gdk.color_parse(self.highlight_color).to_string())
		self.highlight_tag.set_property('font',self.highlight_font)
		self.highlight_tag.set_property('background',Gdk.color_parse(self.background_highlight_color).to_string())
		
		pangoFont = Pango.FontDescription(self.font)
		self.textview.modify_font(pangoFont)
		self.textview.modify_fg(Gtk.StateFlags.NORMAL, Gdk.color_parse(self.font_color))
		self.textview.modify_bg(Gtk.StateFlags.NORMAL, Gdk.color_parse(self.background_color))
		self.set_dict("%s" % self.key_value[self.language])
		if (self.require_scanner_refresh):
			self.scanner_refresh(self)
Example #8
0
 def list_voices(self):
     """ List all available espeak voices. """
     return [v.identifier for v in espeak.list_voices()]
Example #9
0
	def preferences(self,wedget,data=None):
		self.preferences_guibuilder = Gtk.Builder()
		self.preferences_guibuilder.add_from_file("%s/ui/preferences.glade" %(global_var.data_dir))
		self.preferences_window = self.preferences_guibuilder.get_object("window")
		self.preferences_guibuilder.connect_signals(self)
		self.require_scanner_refresh = False


		#General
		
		#Font and font color
		self.start_spin = self.preferences_guibuilder.get_object("spinbutton_page_start")
		self.start_spin.set_value(self.starting_page_number)
		self.pages_spin = self.preferences_guibuilder.get_object("spinbutton_number_of_pages_to_scan")
		self.pages_spin.set_value(self.number_of_pages_to_scan)		
		
		self.background_color_button = self.preferences_guibuilder.get_object("colorbutton_background")
		self.background_color_button.set_color(Gdk.color_parse(self.background_color))	

		self.highlight_color_button = self.preferences_guibuilder.get_object("colorbutton_highlight")
		self.highlight_color_button.set_color(Gdk.color_parse(self.highlight_color))	

		self.highlight_background_color_button = self.preferences_guibuilder.get_object("colorbutton_highlight_background")
		self.highlight_background_color_button.set_color(Gdk.color_parse(self.background_highlight_color))
					
		self.font_color_button = self.preferences_guibuilder.get_object("colorbutton_font")		
		self.font_color_button.set_color(Gdk.color_parse(self.font_color))
			
		self.font_button = self.preferences_guibuilder.get_object("fontbutton")
		self.font_button.set_font_name(self.font)

		self.fontbutton_highlight_button = self.preferences_guibuilder.get_object("fontbutton_highlight")
		self.fontbutton_highlight_button.set_font_name(self.highlight_font)
		
		#Voice Message
		self.hscale_rate = self.preferences_guibuilder.get_object("scale_rate")
		self.hscale_rate.set_value(self.voice_message_rate)
		self.hscale_volume = self.preferences_guibuilder.get_object("scale_volume")
		self.hscale_volume.set_value(self.voice_message_volume)
		self.hscale_pitch = self.preferences_guibuilder.get_object("scale_pitch")
		self.hscale_pitch.set_value(self.voice_message_pitch)
		self.combobox_voice = self.preferences_guibuilder.get_object("combobox_voice")
		
		voice_store = Gtk.ListStore(str)		
		for item in espeak.list_voices():
			voice_store.append([item.name])
		
		self.combobox_voice.set_model(voice_store)
		renderer_text = Gtk.CellRendererText()
		self.combobox_voice.pack_start(renderer_text, True)
		self.combobox_voice.add_attribute(renderer_text, "text", 0)		
		self.combobox_voice.set_active(self.voice_message_voice)
		
		self.checkbutton_say = self.preferences_guibuilder.get_object("checkbutton_say")
		if self.voice_message_state == 1:
			self.checkbutton_say.set_active(True)
		else:
			self.checkbutton_say.set_active(False)
		

		
		# Scanning
		self.time_spin = self.preferences_guibuilder.get_object("spinbutton_time")
		self.re_spin = self.preferences_guibuilder.get_object("spinbutton_resolution")
		self.bt_spin = self.preferences_guibuilder.get_object("spinbutton_brightness")
		self.time_spin.set_value(self.time_between_repeated_scanning)
		self.re_spin.set_value(self.scan_resolution)
		self.bt_spin.set_value(self.scan_brightness)
		
		#Angle
		self.angle_cb = self.preferences_guibuilder.get_object("combobox_angle")
		self.label_angle = self.preferences_guibuilder.get_object("label_angle")
		
		#AREA						      
		area = self.preferences_guibuilder.get_object("combobox_scan_area")
		area.connect('changed', self.change_area)
		area.set_active(self.scan_area)

		#Driver
		self.scan_driver_old = self.scan_driver						      
		driver = self.preferences_guibuilder.get_object("combobox_scan_driver")
		driver.connect('changed', self.change_driver)
		driver.set_active(self.scan_driver)

		#insert_position						      
		insert_position = self.preferences_guibuilder.get_object("combobox_insert_position")
		insert_position.connect('changed', self.change_insert_position)
		insert_position.set_active(self.insert_position)
		
		
		#ENGINE
		engine = self.preferences_guibuilder.get_object("combobox_engine")	
		engine.connect('changed', self.change_engine)
		set_engine = 0
		if self.ocr_engine == "CUNEIFORM":
			set_engine = 0
		elif self.ocr_engine == "TESSERACT":
			set_engine = 1
		else:
			set_engine = 2		
		engine.set_active(set_engine)
		
		#LANGUAGE
		self.language_cb = self.preferences_guibuilder.get_object("combobox_language")
		self.language_cb.connect('changed',self.change_language)
		renderer_text = Gtk.CellRendererText()
		self.language_cb.pack_start(renderer_text, True)
		self.language_cb.add_attribute(renderer_text, "text", 0)
		
		#Setting old language  
		number = 0
		for item in self.language_cb.get_model():
			if self.language == item[0]:
				self.language_cb.set_active(number)
			number += 1	
		
		#ROTATION
		rotation = self.preferences_guibuilder.get_object("combobox_rotation")
		rotation.connect("changed",self.change_rotation)
		rotation.set_active(self.mode_of_rotation)
		

		#Mode Switching
		self.scanner_mode_switching_old = self.scanner_mode_switching
		self.checkbutton_scanner_mode_switching = self.preferences_guibuilder.get_object("checkbutton_scanner_mode_switching")
		self.checkbutton_scanner_mode_switching.set_active(self.scanner_mode_switching)
		
		#Cache Calibration
		self.scanner_cache_calibration_old = self.scanner_cache_calibration
		self.checkbutton_scanner_cache_calibration = self.preferences_guibuilder.get_object("checkbutton_scanner_cache_calibration")
		self.checkbutton_scanner_cache_calibration.set_active(self.scanner_cache_calibration)

		#Skew
		self.checkbutton_skew = self.preferences_guibuilder.get_object("checkbutton_skew")
		self.checkbutton_skew.set_active(self.auto_skew)
		

	
		#PAGE-NUMBARING
		numbering = self.preferences_guibuilder.get_object("combobox_page_type")
		numbering.connect("changed",self.change_numbering)
		numbering.set_active(self.page_numbering_type)
		
		
		#Cam_and_Webcam
		self.combobox_cam_resolution = self.preferences_guibuilder.get_object("combobox_cam_resolution")
		self.liststore_cam_resolution = self.preferences_guibuilder.get_object("liststore_cam_resolution")
		for intex,item in enumerate(self.liststore_cam_resolution):
			if (self.cam_x == item[1] and self.cam_y == item[2]):
				self.combobox_cam_resolution.set_active(intex)
						
		
		
		self.combobox_cam_device = self.preferences_guibuilder.get_object("combobox_cam_device")
		self.combobox_cam_device.set_active(self.cam_device)
		

		notebook = self.preferences_guibuilder.get_object("notebook")
		try:
			notebook.set_current_page(data)
		except TypeError:
			pass
		self.preferences_window.show()		
Example #10
0
    def preferences(self, wedget, data=None):
        self.preferences_guibuilder = Gtk.Builder()
        self.preferences_guibuilder.add_from_file("%s/ui/preferences.glade" %
                                                  (global_var.data_dir))
        self.preferences_window = self.preferences_guibuilder.get_object(
            "window")
        self.preferences_guibuilder.connect_signals(self)
        self.require_scanner_refresh = False

        #General

        #Font and font color
        self.start_spin = self.preferences_guibuilder.get_object(
            "spinbutton_page_start")
        self.start_spin.set_value(self.starting_page_number)
        self.pages_spin = self.preferences_guibuilder.get_object(
            "spinbutton_number_of_pages_to_scan")
        self.pages_spin.set_value(self.number_of_pages_to_scan)

        self.background_color_button = self.preferences_guibuilder.get_object(
            "colorbutton_background")
        self.background_color_button.set_color(
            Gdk.color_parse(self.background_color))

        self.highlight_color_button = self.preferences_guibuilder.get_object(
            "colorbutton_highlight")
        self.highlight_color_button.set_color(
            Gdk.color_parse(self.highlight_color))

        self.highlight_background_color_button = self.preferences_guibuilder.get_object(
            "colorbutton_highlight_background")
        self.highlight_background_color_button.set_color(
            Gdk.color_parse(self.background_highlight_color))

        self.font_color_button = self.preferences_guibuilder.get_object(
            "colorbutton_font")
        self.font_color_button.set_color(Gdk.color_parse(self.font_color))

        self.font_button = self.preferences_guibuilder.get_object("fontbutton")
        self.font_button.set_font_name(self.font)

        self.fontbutton_highlight_button = self.preferences_guibuilder.get_object(
            "fontbutton_highlight")
        self.fontbutton_highlight_button.set_font_name(self.highlight_font)

        #Voice Message
        self.hscale_rate = self.preferences_guibuilder.get_object("scale_rate")
        self.hscale_rate.set_value(self.voice_message_rate)
        self.hscale_volume = self.preferences_guibuilder.get_object(
            "scale_volume")
        self.hscale_volume.set_value(self.voice_message_volume)
        self.hscale_pitch = self.preferences_guibuilder.get_object(
            "scale_pitch")
        self.hscale_pitch.set_value(self.voice_message_pitch)
        self.combobox_voice = self.preferences_guibuilder.get_object(
            "combobox_voice")

        voice_store = Gtk.ListStore(str)
        for item in espeak.list_voices():
            voice_store.append([item.name])

        self.combobox_voice.set_model(voice_store)
        renderer_text = Gtk.CellRendererText()
        self.combobox_voice.pack_start(renderer_text, True)
        self.combobox_voice.add_attribute(renderer_text, "text", 0)
        self.combobox_voice.set_active(self.voice_message_voice)

        self.checkbutton_say = self.preferences_guibuilder.get_object(
            "checkbutton_say")
        if self.voice_message_state == 1:
            self.checkbutton_say.set_active(True)
        else:
            self.checkbutton_say.set_active(False)

        # Scanning
        self.time_spin = self.preferences_guibuilder.get_object(
            "spinbutton_time")
        self.re_spin = self.preferences_guibuilder.get_object(
            "spinbutton_resolution")
        self.bt_spin = self.preferences_guibuilder.get_object(
            "spinbutton_brightness")
        self.time_spin.set_value(self.time_between_repeated_scanning)
        self.re_spin.set_value(self.scan_resolution)
        self.bt_spin.set_value(self.scan_brightness)

        #Angle
        self.angle_cb = self.preferences_guibuilder.get_object(
            "combobox_angle")
        self.label_angle = self.preferences_guibuilder.get_object(
            "label_angle")

        #AREA
        area = self.preferences_guibuilder.get_object("combobox_scan_area")
        area.connect('changed', self.change_area)
        area.set_active(self.scan_area)

        #Driver
        self.scan_driver_old = self.scan_driver
        driver = self.preferences_guibuilder.get_object("combobox_scan_driver")
        driver.connect('changed', self.change_driver)
        driver.set_active(self.scan_driver)

        #insert_position
        insert_position = self.preferences_guibuilder.get_object(
            "combobox_insert_position")
        insert_position.connect('changed', self.change_insert_position)
        insert_position.set_active(self.insert_position)

        #ENGINE
        engine = self.preferences_guibuilder.get_object("combobox_engine")
        engine.connect('changed', self.change_engine)
        set_engine = 0
        if self.ocr_engine == "CUNEIFORM":
            set_engine = 0
        elif self.ocr_engine == "TESSERACT":
            set_engine = 1
        else:
            set_engine = 2
        engine.set_active(set_engine)

        #LANGUAGE
        self.language_cb = self.preferences_guibuilder.get_object(
            "combobox_language")
        self.language_cb.connect('changed', self.change_language)
        renderer_text = Gtk.CellRendererText()
        self.language_cb.pack_start(renderer_text, True)
        self.language_cb.add_attribute(renderer_text, "text", 0)

        #Setting old language
        number = 0
        for item in self.language_cb.get_model():
            if self.language == item[0]:
                self.language_cb.set_active(number)
            number += 1

        #ROTATION
        rotation = self.preferences_guibuilder.get_object("combobox_rotation")
        rotation.connect("changed", self.change_rotation)
        rotation.set_active(self.mode_of_rotation)

        #Mode Switching
        self.scanner_mode_switching_old = self.scanner_mode_switching
        self.checkbutton_scanner_mode_switching = self.preferences_guibuilder.get_object(
            "checkbutton_scanner_mode_switching")
        self.checkbutton_scanner_mode_switching.set_active(
            self.scanner_mode_switching)

        #Cache Calibration
        self.scanner_cache_calibration_old = self.scanner_cache_calibration
        self.checkbutton_scanner_cache_calibration = self.preferences_guibuilder.get_object(
            "checkbutton_scanner_cache_calibration")
        self.checkbutton_scanner_cache_calibration.set_active(
            self.scanner_cache_calibration)

        #Skew
        self.checkbutton_skew = self.preferences_guibuilder.get_object(
            "checkbutton_skew")
        self.checkbutton_skew.set_active(self.auto_skew)

        #PAGE-NUMBARING
        numbering = self.preferences_guibuilder.get_object(
            "combobox_page_type")
        numbering.connect("changed", self.change_numbering)
        numbering.set_active(self.page_numbering_type)

        #Cam_and_Webcam
        self.combobox_cam_resolution = self.preferences_guibuilder.get_object(
            "combobox_cam_resolution")
        self.liststore_cam_resolution = self.preferences_guibuilder.get_object(
            "liststore_cam_resolution")
        for intex, item in enumerate(self.liststore_cam_resolution):
            if (self.cam_x == item[1] and self.cam_y == item[2]):
                self.combobox_cam_resolution.set_active(intex)

        self.combobox_cam_device = self.preferences_guibuilder.get_object(
            "combobox_cam_device")
        self.combobox_cam_device.set_active(self.cam_device)

        notebook = self.preferences_guibuilder.get_object("notebook")
        try:
            notebook.set_current_page(data)
        except TypeError:
            pass
        self.preferences_window.show()
done = False

while ( done == False ):
	print()
	print( "1. Display voices" )
	print( "2. Speak text" )
	print( "3. View espeak functions" )

	choice = int( input( "What do you want to do? >> " ) )

	print()

	if ( choice == 1 ):
		print( "VOICES" )
		voices = espeak.list_voices()

		print( "Identifier","Name","Gender","Age","Variant" )
		for voice in voices:
			print( "Name: 			", voice.name )
			print( "Identifier: 		", voice.identifier )
			print( "Gender: 		", voice.gender )
			print( "Age: 			", voice.age )
			print( "Variant: 		", voice.variant )
			print()

	elif ( choice == 2 ):
		print( "SPEAK" )
		voice = input( "What voice do you want to use? >> " )
		espeak.set_voice( voice )
Example #12
0
 def list_voices(self):
     from espeak import espeak
     voices = espeak.list_voices()
     vlist = [ v.name for v in voices ]
     print(vlist)
Example #13
0
from espeak import espeak

if __name__ == '__main__':

    voices = espeak.list_voices()
    if len(voices) <= 0:
        sys.exit()

    for v in voices:
        print
        print 'id : %s' % v.identifier
        print 'nombre : %s' % v.name
        print 'genero : %s' % v.gender
        print 'edad : %s ' % v.age
        print 'lenguajes : %s' % v.variant
Example #14
0
 def list_voices(self):
     from espeak import espeak
     voices = espeak.list_voices()
     vlist = [v.name for v in voices]
     print(vlist)
Example #15
0
	def __init__(self,filename=None):
		self.guibuilder = gtk.Builder()
		self.guibuilder.add_from_file("/usr/share/lios/Gui/main.glade")
		self.window = self.guibuilder.get_object("window")
		self.textbuffer = self.guibuilder.get_object("textbuffer")
		self.textview = self.guibuilder.get_object("textview")
		self.image_frame = self.guibuilder.get_object("frame")
		self.progressbar = self.guibuilder.get_object("progressbar")
		self.random_label = self.guibuilder.get_object("random_label")
		self.random_spinbutton = self.guibuilder.get_object("random_spinbutton")
		self.random_entry = self.guibuilder.get_object("random_entry")
		self.random_label.hide()
		self.random_spinbutton.hide()
		self.random_entry.hide()
		self.textview.grab_focus()
		self.guibuilder.connect_signals(self)
		

		self.progressbar.set_pulse_step(.01)
		self.pulse = True
		
		#self.image = self.guibuilder.get_object("image")
		
		self.scrolledwindow_image = self.guibuilder.get_object("scrolledwindow_image")
		self.vruler = self.guibuilder.get_object("vruler")
		self.hruler = self.guibuilder.get_object("hruler")
		self.scrolledwindow_image.connect_object("motion_notify_event", self.motion_notify, self.hruler)
		self.scrolledwindow_image.connect_object("motion_notify_event", self.motion_notify, self.vruler)
		
		

		
		self.voice_list=[]
		for item in espeak.list_voices():
			self.voice_list.append(item.name)

		for item in "scan_to_ui","ocr_pdf","ocr_folder","ocr_image","scan_and_ocr","scan_and_ocr_repeatedly","cam_scan","optimise_brightness","ocr_ui_image":
			self.guibuilder.get_object(item).connect("activate",self.run_process,item)
			
			
		ocr_ui_image_button = self.guibuilder.get_object("ocr_ui_image_button")
		ocr_ui_image_button.connect("clicked",self.run_process,"ocr_ui_image")

		ocr_selected_image_region_button = self.guibuilder.get_object("ocr_selected_image_region_button")
		ocr_selected_image_region_button.connect("clicked",self.run_process,"ocr_selected_image_region")
		
		
		scan_to_ui_button = self.guibuilder.get_object("scan_to_ui_button")		 
		scan_to_ui_button.connect("clicked",self.run_process,"scan_to_ui")
		
		
		#Preferences
		General_Preferences = self.guibuilder.get_object("General_Preferences")
		General_Preferences.connect("activate",self.preferences,0)
		Preferences_Recognition = self.guibuilder.get_object("Preferences_Recognition")
		Preferences_Recognition.connect("activate",self.preferences,1)
		Preferences_Scanning = self.guibuilder.get_object("Preferences_Scanning")
		Preferences_Scanning.connect("activate",self.preferences,2)
		Preferences_CamaraWebcam = self.guibuilder.get_object("Preferences_CamaraWebcam")
		Preferences_CamaraWebcam.connect("activate",self.preferences,3)
		
		#Getting Preferences Values
		self.read_preferences()
		
		#Init Keep Runner
		self.keep_running = False

		# Intiating thred in PyGtk
		gtk.threads_init()
		
		#Espeak And event
		espeak.set_parameter(espeak.Parameter.Rate,self.voice_message_rate)
		espeak.set_parameter(espeak.Parameter.Pitch,self.voice_message_pitch)
		espeak.set_parameter(espeak.Parameter.Volume,self.voice_message_volume)
		espeak.set_voice(self.voice_list[self.voice_message_voice])
		espeak.set_SynthCallback(self.espeak_event)


		#Gnome-Canvas
		self.first_run = True
		self.canvas = gnomecanvas.Canvas(aa=True)
		self.dragging = False
		self.scrolledwindow_image.add(self.canvas)
		self.canvas.connect("event", self.canvas_event)
		self.set_image(self,data=None)
		self.canvas.show()
		self.window.maximize()		

		#Reading Dictionarys		
		self.key_value = {"eng" : "en","afr" : "af","am" : "am","ara" : "ar","ara" : "ar","bul" : "bg","ben" : "bn","br" : "br","cat" : "ca","ces" : "cs","cy" : "cy","dan" : "da","ger" : "de","ger" : "de","ell" : "el","eo" : "eo","spa" : "es","est" : "et","eu" : "eu","fa" : "fa","fin" : "fi","fo" : "fo","fra" : "fr","ga" : "ga","gl" : "gl","gu" : "gu","heb" : "he","hin" : "hi","hrv" : "hr","hsb" : "hsb","hun" : "hu","hy" : "hy","id" : "id","is" : "is","ita" : "it","kk" : "kk","kn" : "kn","ku" : "ku","lit" : "lt","lav" : "lv","mal" : "ml ","mr" : "mr ","dut" : "nl","no" : "no","nr" : "nr","ns" : "ns ","or" : "or ","pa" : "pa ","pol" : "pl ","por" : "pt","por" : "pt","por" : "pt","ron" : "ro","rus" : "ru ","slk" : "sk","slv" : "sl","ss" : "ss","st" : "st","swe" : "sv","tam" : "ta","tel" : "te","tl" : "tl","tn" : "tn","ts" : "ts","ukr" : "uk","uz" : "uz","xh" : "xh","zu" : "zu" }
		self.dict = enchant.Dict("%s" % self.key_value[self.language])
		
		#Font 
		pangoFont = pango.FontDescription(self.font)
		self.textview.modify_font(pangoFont)

		if (filename):
			 self.textbuffer.set_text(open(filename,"r").read())
			 self.save_file_name = filename
		else:
			#Opening Recent Document
			try:
				recent_open = open("%srecent"%directory,'r')
			except IOError:
				pass
			else:
				recent_text = recent_open.read()
				self.textbuffer.set_text(recent_text)
		
		#Color
		self.highlight_tag = self.textbuffer.create_tag('Reading')
		self.textview.modify_text(gtk.STATE_NORMAL, gtk.gdk.Color(self.font_color))
		self.textview.modify_base(gtk.STATE_NORMAL, gtk.gdk.Color(self.background_color))
		self.highlight_tag.set_property('foreground',gtk.gdk.Color(self.highlight_color))
		self.highlight_tag.set_property('background',gtk.gdk.Color(self.background_highlight_color))		
		self.highlight_tag.set_property('font',self.highlight_font)
		
		#Welcome
		self.notify("Welcome To Linux-Intelligent-O.C.R-Solution",True,None,True)
		gobject.timeout_add(20, self.pulse_progressbar)

		#Placing cursor
		self.textbuffer.place_cursor(self.textbuffer.get_start_iter())
		
		self.window.show()
		gtk.main()
Example #16
0
GPIO.add_event_detect(23,GPIO.RISING,callback=fSelect,bouncetime=400)
GPIO.setup(24,GPIO.IN,pull_up_down=GPIO.PUD_UP)
GPIO.add_event_detect(24,GPIO.RISING,callback=fSelect,bouncetime=400)
#Now the rotary encoder buttons
GPIO.setup(9,GPIO.IN,pull_up_down=GPIO.PUD_UP)
GPIO.add_event_detect(9,GPIO.RISING,callback=fEncoder,bouncetime=50)
GPIO.setup(11,GPIO.IN,pull_up_down=GPIO.PUD_UP)
GPIO.add_event_detect(11,GPIO.RISING,callback=fEncoder,bouncetime=50)

m=alsaaudio.Mixer(control='PCM')
p=Popen(['./tts.alsa'])
while (p.poll() is None):
  time.sleep(.6)
  pass

espeak.list_voices()
espeak.set_voice('de')

repo=OrderedDict()
with open("zeitungen.txt") as f:
        lines = f.read().splitlines()
for item in lines:
        name, link = [a.strip() for a in item.split(',')]
        repo[name] = link

#for i in repo.keys():
#       print i,repo.get(i)

def FollowLink(k,v):
        global ButtonPressed
        f=feedparser.parse(''.join(v))