def load_preferences(self):
		configuration = Configuration()
		first_time = configuration.get('first-time')
		version = configuration.get('version')
		if first_time or version != comun.VERSION:
			configuration.set_defaults()
			configuration.read()
		self.spinbutton1.set_value(configuration.get('session_length'))
		self.spinbutton2.set_value(configuration.get('break_length'))
		self.spinbutton3.set_value(configuration.get('long_break_length'))
		self.switch4.set_active(configuration.get('play_sounds'))
		select_value_in_combo(self.comboboxsound5,configuration.get('session_sound_file'))
		select_value_in_combo(self.comboboxsound6,configuration.get('break_sound_file'))
		self.switch7.set_active(os.path.exists(comun.FILE_AUTO_START))
		self.switch8.set_active(configuration.get('theme') == 'light')		
 def load_preferences(self):
     configuration = Configuration()
     first_time = configuration.get('first-time')
     version = configuration.get('version')
     if first_time or version != comun.VERSION:
         configuration.set_defaults()
         configuration.read()
     self.checkbutton0.set_active(configuration.get('shortcut_enabled'))
     self.checkbutton1.set_active(configuration.get('autostart'))
     self.checkbutton2.set_active(configuration.get('on_mouse_plugged'))
     self.checkbutton3.set_active(configuration.get('enable_on_exit'))
     self.checkbutton4.set_active(configuration.get('disable_on_exit'))
     self.checkbutton5.set_active(configuration.get('start_hidden'))
     self.checkbutton6.set_active(configuration.get('show_notifications'))
     self.checkbutton7.set_active(
         configuration.get('disable_touchpad_on_start_indicator'))
     self.checkbutton8.set_active(configuration.get('disable_on_typing'))
     self.checkbutton46.set_active(configuration.get('natural_scrolling'))
     self.seconds.set_value(configuration.get('seconds') * 1000)
     self.label_seconds.set_sensitive(self.checkbutton8.get_active())
     self.seconds.set_sensitive(self.checkbutton8.get_active())
     self.key = configuration.get('shortcut')
     self.shortcut_enabled = configuration.get('shortcut_enabled')
     if self.key.find('<Primary>') > -1:
         self.ctrl.set_active(True)
     if self.key.find('<Alt>') > -1:
         self.alt.set_active(True)
     self.entry11.set_text(self.key[-1:])
     option = configuration.get('theme')
     self.set_shortcut_sensitive(self.checkbutton0.get_active())
     if option == 'light':
         self.radiobutton1.set_active(True)
     else:
         self.radiobutton2.set_active(True)
     #
     self.checkbutton41.set_active(configuration.get('VertEdgeScroll'))
     self.checkbutton42.set_active(configuration.get('HorizEdgeScroll'))
     self.checkbutton43.set_active(configuration.get('CircularScrolling'))
     self.checkbutton44.set_active(configuration.get('VertTwoFingerScroll'))
     self.checkbutton45.set_active(
         configuration.get('HorizTwoFingerScroll'))
     self.combobox47.set_active(configuration.get('TapButton1'))
     self.combobox48.set_active(configuration.get('TapButton2'))
     self.combobox49.set_active(configuration.get('TapButton3'))
     '''
	def load_preferences(self):
		configuration = Configuration()
		first_time = configuration.get('first-time')
		version = configuration.get('version')
		if first_time or version != comun.VERSION:
			configuration.set_defaults()
			configuration.read()
		self.checkbutton0.set_active(configuration.get('shortcut_enabled'))
		self.checkbutton1.set_active(configuration.get('autostart'))
		self.checkbutton2.set_active(configuration.get('on_mouse_plugged'))
		self.checkbutton3.set_active(configuration.get('enable_on_exit'))
		self.checkbutton4.set_active(configuration.get('disable_on_exit'))
		self.checkbutton5.set_active(configuration.get('start_hidden'))
		self.checkbutton6.set_active(configuration.get('show_notifications'))
		self.checkbutton7.set_active(configuration.get('disable_touchpad_on_start_indicator'))		
		self.checkbutton8.set_active(configuration.get('disable_on_typing'))
		self.checkbutton46.set_active(configuration.get('natural_scrolling'))
		self.seconds.set_value(configuration.get('seconds'))
		self.label_seconds.set_sensitive(self.checkbutton8.get_active())
		self.seconds.set_sensitive(self.checkbutton8.get_active())		
		self.key = configuration.get('shortcut')
		self.shortcut_enabled = configuration.get('shortcut_enabled')
		if self.key.find('<Primary>')>-1:
			self.ctrl.set_active(True)
		if self.key.find('<Alt>')>-1:
			self.alt.set_active(True)
		self.entry11.set_text(self.key[-1:])
		option = configuration.get('theme')
		self.set_shortcut_sensitive(self.checkbutton0.get_active())		
		if option == 'light':
			self.radiobutton1.set_active(True)
		else:
			self.radiobutton2.set_active(True)
		#
		aclient = Synclient()
		self.checkbutton41.set_active(aclient.get('VertEdgeScroll')=='1')
		self.checkbutton42.set_active(aclient.get('HorizEdgeScroll')=='1')
		self.checkbutton43.set_active(aclient.get('CircularScrolling')=='1')
		self.checkbutton44.set_active(aclient.get('VertTwoFingerScroll')=='1')
		self.checkbutton45.set_active(aclient.get('HorizTwoFingerScroll')=='1')
		self.checkbutton46.set_active((int(aclient.get('VertScrollDelta'))<0) and (int(aclient.get('HorizScrollDelta'))<0))
		self.combobox47.set_active(int(aclient.get('TapButton1')))
		self.combobox48.set_active(int(aclient.get('TapButton2')))
		self.combobox49.set_active(int(aclient.get('TapButton3')))
    def load_preferences(self):
        configuration = Configuration()
        first_time = configuration.get('first-time')
        version = configuration.get('version')
        if first_time or version != comun.VERSION:
            configuration.set_defaults()
            configuration.read()
        if os.path.exists(comun.FILE_AUTO_START) and\
                not os.path.islink(comun.FILE_AUTO_START):
            os.remove(comun.FILE_AUTO_START)
        self.checkbutton1.set_active(os.path.islink(comun.FILE_AUTO_START))
        print(comun.FILE_AUTO_START)
        print('====', os.path.exists(comun.FILE_AUTO_START))
        self.checkbutton2.set_active(configuration.get('on_mouse_plugged'))

        desktop_environment = get_desktop_environment()
        print(desktop_environment)

        if desktop_environment == 'gnome' or\
                desktop_environment == 'unity':
            dcm = DConfManager('org.gnome.settings-daemon.plugins.media-keys.\
custom-keybindings.touchpad-indicator')
            shortcut = dcm.get_value('binding')
            if shortcut is None or len(shortcut) == 0:
                self.checkbutton0.set_active(False)
                self.entry11.set_text('')
            else:
                self.checkbutton0.set_active(True)
                self.ctrl.set_active(shortcut.find('<Control>') > -1)
                self.alt.set_active(shortcut.find('<Alt>') > -1)
                self.entry11.set_text(shortcut[-1:])
        elif desktop_environment == 'cinnamon':
            dcm = DConfManager('org.cinnamon.desktop.keybindings.\
custom-keybindings.touchpad-indicator')
            shortcuts = dcm.get_value('binding')
            if shortcuts is None or len(shortcuts) == 0:
                self.checkbutton0.set_active(False)
                self.entry11.set_text('')
            else:
                shortcut = shortcuts[0]
                self.checkbutton0.set_active(True)
                self.ctrl.set_active(shortcut.find('<Control>') > -1)
                self.alt.set_active(shortcut.find('<Alt>') > -1)
                self.entry11.set_text(shortcut[-1:])
        elif desktop_environment == 'mate':
            dcm = DConfManager('org.mate.desktop.keybindings.\
touchpad-indicator')
            shortcut = dcm.get_value('binding')
            if shortcut is None or len(shortcut) == 0:
                self.checkbutton0.set_active(False)
                self.entry11.set_text('')
            else:
                self.checkbutton0.set_active(True)
                self.ctrl.set_active(shortcut.find('<Control>') > -1)
                self.alt.set_active(shortcut.find('<Alt>') > -1)
                self.entry11.set_text(shortcut[-1:])
        option = configuration.get('on_start')
        if option == 0:
            self.on_start['none'].set_active(True)
        if option == 1:
            self.on_start['enable'].set_active(True)
        elif option == -1:
            self.on_start['disable'].set_active(True)

        option = configuration.get('on_end')
        if option == 0:
            self.on_end['none'].set_active(True)
        elif option == 1:
            self.on_end['enable'].set_active(True)
        elif option == -1:
            self.on_end['disable'].set_active(True)

        self.checkbutton5.set_active(configuration.get('start_hidden'))
        self.checkbutton6.set_active(configuration.get('show_notifications'))

        self.checkbutton8.set_active(configuration.get('disable_on_typing'))
        self.interval.set_value(configuration.get('interval'))
        self.label_interval.set_sensitive(self.checkbutton8.get_active())
        self.interval.set_sensitive(self.checkbutton8.get_active())

        option = configuration.get('theme')
        if option == 'light':
            self.radiobutton1.set_active(True)
        elif option == 'dark':
            self.radiobutton2.set_active(True)
        elif option == 'normal':
            self.radiobutton3.set_active(True)

        self.checkbutton46.set_active(configuration.get('natural_scrolling'))
        tp = Touchpad()
        if tp.is_there_touchpad():
            tipo = tp.get_driver()
            if tipo == SYNAPTICS:
                self.two_finger_scrolling.set_active(
                    configuration.get('two_finger_scrolling'))
                self.edge_scrolling.set_active(
                    configuration.get('edge_scrolling'))
                self.cicular_scrolling.set_active(
                    configuration.get('cicular_scrolling'))
                select_value_in_combo(self.right_top_corner,
                                      configuration.get('right-top-corner'))
                select_value_in_combo(self.right_bottom_corner,
                                      configuration.get('right-bottom-corner'))
                select_value_in_combo(self.left_top_corner,
                                      configuration.get('left-top-corner'))
                select_value_in_combo(self.left_bottom_corner,
                                      configuration.get('left-bottom-corner'))
                select_value_in_combo(self.one_finger_tap,
                                      configuration.get('one-finger-tap'))
                if tp.get_capabilities()['two-finger-detection']:
                    select_value_in_combo(
                        self.two_finger_tap,
                        configuration.get('two-finger-tap'))
                if tp.get_capabilities()['three-finger-detection']:
                    select_value_in_combo(
                        self.three_finger_tap,
                        configuration.get('three-finger-tap'))
            elif tipo == LIBINPUT:
                if tp.can_two_finger_scrolling():
                    self.two_finger_scrolling.set_active(
                        configuration.get('two_finger_scrolling'))
                if tp.can_edge_scrolling():
                    self.edge_scrolling.set_active(
                        configuration.get('edge_scrolling'))
                if tp.has_tapping():
                    self.tapping.set_active(configuration.get('tapping'))
            if self.speed is not None:
                self.speed.set_value(configuration.get('speed'))
    def load_preferences(self):
        configuration = Configuration()
        first_time = configuration.get('first-time')
        version = configuration.get('version')
        if first_time or version != comun.VERSION:
            configuration.set_defaults()
            configuration.read()
        if os.path.exists(comun.FILE_AUTO_START) and\
                not os.path.islink(comun.FILE_AUTO_START):
            os.remove(comun.FILE_AUTO_START)
        self.checkbutton1.set_active(os.path.islink(comun.FILE_AUTO_START))
        print(comun.FILE_AUTO_START)
        print('====', os.path.exists(comun.FILE_AUTO_START))
        self.checkbutton2.set_active(configuration.get('on_mouse_plugged'))

        desktop_environment = get_desktop_environment()
        print(desktop_environment)

        if desktop_environment == 'gnome' or\
                desktop_environment == 'unity':
            dcm = DConfManager('org.gnome.settings-daemon.plugins.media-keys.\
custom-keybindings.touchpad-indicator')
            shortcut = dcm.get_value('binding')
            if shortcut is None or len(shortcut) == 0:
                self.checkbutton0.set_active(False)
                self.entry11.set_text('')
            else:
                self.checkbutton0.set_active(True)
                self.ctrl.set_active(shortcut.find('<Control>') > -1)
                self.alt.set_active(shortcut.find('<Alt>') > -1)
                self.entry11.set_text(shortcut[-1:])
        elif desktop_environment == 'cinnamon':
            dcm = DConfManager('org.cinnamon.desktop.keybindings.\
custom-keybindings.touchpad-indicator')
            shortcuts = dcm.get_value('binding')
            if shortcuts is None or len(shortcuts) == 0:
                self.checkbutton0.set_active(False)
                self.entry11.set_text('')
            else:
                shortcut = shortcuts[0]
                self.checkbutton0.set_active(True)
                self.ctrl.set_active(shortcut.find('<Control>') > -1)
                self.alt.set_active(shortcut.find('<Alt>') > -1)
                self.entry11.set_text(shortcut[-1:])
        elif desktop_environment == 'mate':
            dcm = DConfManager('org.mate.desktop.keybindings.\
touchpad-indicator')
            shortcut = dcm.get_value('binding')
            if shortcut is None or len(shortcut) == 0:
                self.checkbutton0.set_active(False)
                self.entry11.set_text('')
            else:
                self.checkbutton0.set_active(True)
                self.ctrl.set_active(shortcut.find('<Control>') > -1)
                self.alt.set_active(shortcut.find('<Alt>') > -1)
                self.entry11.set_text(shortcut[-1:])
        option = configuration.get('on_start')
        if option == 0:
            self.on_start['none'].set_active(True)
        if option == 1:
            self.on_start['enable'].set_active(True)
        elif option == -1:
            self.on_start['disable'].set_active(True)

        option = configuration.get('on_end')
        if option == 0:
            self.on_end['none'].set_active(True)
        elif option == 1:
            self.on_end['enable'].set_active(True)
        elif option == -1:
            self.on_end['disable'].set_active(True)

        self.checkbutton5.set_active(configuration.get('start_hidden'))
        self.checkbutton6.set_active(configuration.get('show_notifications'))

        self.checkbutton8.set_active(configuration.get('disable_on_typing'))
        self.interval.set_value(configuration.get('interval'))
        self.label_interval.set_sensitive(self.checkbutton8.get_active())
        self.interval.set_sensitive(self.checkbutton8.get_active())

        option = configuration.get('theme')
        if option == 'light':
            self.radiobutton1.set_active(True)
        elif option == 'dark':
            self.radiobutton2.set_active(True)
        elif option == 'normal':
            self.radiobutton3.set_active(True)

        self.checkbutton46.set_active(configuration.get('natural_scrolling'))
        tp = Touchpad()
        if tp.is_there_touchpad():
            tipo = tp._get_type(tp._get_ids()[0])
            if tipo == SYNAPTICS:
                self.two_finger_scrolling.set_active(
                    configuration.get('two_finger_scrolling'))
                self.edge_scrolling.set_active(
                    configuration.get('edge_scrolling'))
                self.cicular_scrolling.set_active(
                    configuration.get('cicular_scrolling'))
            elif tipo == LIBINPUT:
                if tp.can_two_finger_scrolling():
                    self.two_finger_scrolling.set_active(
                        configuration.get('two_finger_scrolling'))
                if tp.can_edge_scrolling():
                    self.edge_scrolling.set_active(
                        configuration.get('edge_scrolling'))
                if tp.has_tapping():
                    self.tapping.set_active(configuration.get('tapping'))
            self.speed.set_value(configuration.get('speed'))